diff --git "a/data/sft/train.jsonl" "b/data/sft/train.jsonl" --- "a/data/sft/train.jsonl" +++ "b/data/sft/train.jsonl" @@ -1,6000 +1,6000 @@ -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n~inPlaceSub = { |array, find, replace|\n array.do({ |item, i|\n if(item == find) { array[i] = replace };\n });\n};\n\n~trySub = { |array, find, replace|\n try {\n ~inPlaceSub.(array, find, replace)\n } { |error|\n switch(error.species.name)\n { 'PrimitiveFailedError' } {\n if(error.what.find(\"immutable\").notNil) {\n \"caught ImmutableError\".postln;\n ~inPlaceSub.(array.copy, find, replace)\n } { \"unknown primitive exception\".postln; error.throw }\n }\n // default case: unhandled exception, should\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n~inPlaceSub = { |array, find, replace|\n array.do({ |item, i|\n if(item == find) { array[i] = replace };\n });\n};\n\n~trySub = { |array, find, replace|\n try {\n ~inPlaceSub.(array, find, replace)\n } { |error|\n switch(error.species.name)\n { 'PrimitiveFailedError' } {\n if(error.what.find(\"immutable\").notNil) {\n \"caught ImmutableError\".postln;\n ~inPlaceSub.(array.copy, find, replace)\n } { \"unknown primitive exception\".postln; error.throw }\n }\n // default case: unhandled exception, should die so re-throw error\n { \"unknown exception\".postln; error.throw }\n };\n};\n);\n\n// pass in a mutable array, OK\n~trySub.((0..9), 9, 19);\n\n// pass in a literal array, Immutable exception is caught and handled\n~trySub.(#[0, 1, 2, 3, 4, 5], 5, 6);\n\n// pass in a nonsense value, other exception is re-thrown\n~trySub.(10, 5, 6);\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Re: Dark sea horns."}, {"role": "assistant", "content": "```supercollider\n(\n Ndef(\\x, {\n var output;\n var delayTime;\n var delayMax = 0.2;\n var delayAdd = 0.1;\n var pulseFreq = 0.5;\n var proxyMul = 2;\n var pulseMin = 40;\n var pulseMax = 130;\n var numOfEchos = 2;\n\n var mainPulse = LFPulse.ar(pulseFreq, 0, 0.5).range(pulseMin, pulseMax);\n var proxy = Ndef(\\x).ar * proxyMul;\n var ampModFreq = SinOsc.ar(0.01, 0).range(0.3, 30);\n var ampMod = LFNoise1.ar(ampModFreq, 6);\n output = SinOsc.ar(mainPulse + proxy, 0, ampMod).tanh;\n numOfEchos.do{\n delayTime = {delayMax.rand + delayAdd}!2;\n output = AllpassL.ar(output, 0.1, delayTime, 5);\n };\n output.tanh;\n }).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// vary frequency\n{ StandardN.ar(MouseX.kr(20, SampleRate.ir)) * 0.3 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// vary frequency\n{ StandardN.ar(MouseX.kr(20, SampleRate.ir)) * 0.3 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Out.ar(0,Pan2.ar(0.5*Fhn2DN.ar(220,800,0.3,0.3,0.6,0.8,LFPulse.kr(MouseX.kr(1, 10, 1), 0, 0.1)),0.0)) }.play\n\n(\nSynthDef(\\fhn, {|out=0, pan=0, amp=0.1|\n var sig;\n sig=Fhn2DN.ar(110, 22050, TExpRand.kr(0.001, 0.2, Dust.kr(8)), TExpRand.kr(0.001, 0.2, Dust.kr(13)), TRand.kr(0.1, 0.4, Dust.kr(5)),TRand.kr(0.1, 1.9, Dust.\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Out.ar(0,Pan2.ar(0.5*Fhn2DN.ar(220,800,0.3,0.3,0.6,0.8,LFPulse.kr(MouseX.kr(1, 10, 1), 0, 0.1)),0.0)) }.play\n\n(\nSynthDef(\\fhn, {|out=0, pan=0, amp=0.1|\n var sig;\n sig=Fhn2DN.ar(110, 22050, TExpRand.kr(0.001, 0.2, Dust.kr(8)), TExpRand.kr(0.001, 0.2, Dust.kr(13)), TRand.kr(0.1, 0.4, Dust.kr(5)),TRand.kr(0.1, 1.9, Dust.kr(3)), mul:amp);\n Out.ar(0,Pan2.ar(sig, pan))\n}).play\n);\n\n(\nSynthDef(\\fhn, {|out=0, pan=0, amp=0.1|\n var sig, trig1, trig2, b0, b1;\n trig1=FhnTrig.kr(5, 8, 0.3, 0.3, 1, 1);\n trig2=FhnTrig.kr(8, 13, 0.27, 0.27, 0.6, 0.8);\n b0=Fhn2DN.kr(3, 5, 0.29, 0.29, 0.5, 1.1, mul:0.23, add:0.25);\n b1=Fhn2DN.kr(2, 3, 0.25, 0.25, 0.2, 1.5, mul:0.48, add:0.5);\n sig=Fhn2DN.ar(110, 22050, TExpRand.kr(0.001, 0.3, trig1), TExpRand.kr(0.001, 0.3, trig2), b0, b1, mul:amp);\n Out.ar(0,Pan2.ar(sig, pan))\n}).play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "How do I make a piece reproducible instead of a different take every time?"}, {"role": "assistant", "content": "Three things make a SuperCollider piece repeatable: a fixed seed, a fixed tempo, and no live input.\n\n```supercollider\n(\nthisThread.randSeed = 1234;\nTempoClock.default.tempo = 2;\nPbind(\\degree, Pwhite(0, 7, inf), \\dur, 0.25).play;\n)\n```\n\n`thisThread.randSeed` fixes the random sequence of the current thread, so `Pwhite`, `Prand` and friends give\nthe same values again. Recording with `s.record(path, duration: 30)` then makes the take an artifact rather\nthan a performance. Input from `MouseX` or a MIDI controller is the usual remaining source of difference."}]} +{"conversations": [{"role": "user", "content": "What is `NetAddr` in SuperCollider?"}, {"role": "assistant", "content": "NetAddr — network address Category: Control, External Control > OSC."}]} +{"conversations": [{"role": "user", "content": "What is `Peak` in SuperCollider?"}, {"role": "assistant", "content": "Peak — Track peak signal amplitude. Outputs the peak amplitude of the signal received at the input. When a trigger occurs at the `reset` input, the maximum output value is reset to the current value. Category: UGens > Analysis > Amplitude."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for SOUND 1, from orig Influx Example. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// SOUND 1, from orig Influx Example\n(\nNdef(\\dog).addSpec(\\intv, [-24, 24]);\nNdef(\\dog).addSpec(\\timescale, [0.01, 10, \\exp]);\nNdef(\\dog).addSpec(\\curve, [-10, 10]);\nNdef(\\dog).addSpec(\\ffreq, \\freq);\n\nNdef(\\dog).addSpec(\\loopnode, [0, 12]);\nNdef(\\dog).addSpec(\\dens, [10, 1000]);\nNdef(\\dog).addSpec(\\resfreq, \\freq);\nNdef(\\dog).addSpec(\\ringtime, [0.01, 1, \\exp]);\n\nNdef(\\dog, { |amp=0, freq=250, intv=19, timescale=1, curve=0, loopnode=0, dens = 10, resfreq = 500, ringtime = 0.01|\n var n = 15;\n var env = EnvGen.kr(\n Env({ 1.0.rand2 }!(n+1), {1.0.rand}!n, curve, releaseNode: n-1, loopNode: loopnode.min(n-3)),\n timeScale: timescale);\n var pitch = (env * [1, 0.33, -1] * intv).midiratio * freq;\n var form = Formant.ar(pitch, pitch.rotate(1) * 1.6, pitch.rotate(2) * 2.6);\n\n var dusty = Ringz.ar(\n Dust.ar(dens!3),\n (resfreq * LFNoise0.kr([3, 5, 7], 0.5, 1)).lag(0.3),\n ringtime)\n * ((dens ** -0.5) * (ringtime ** -0.3)\n );\n\n Splay.ar(form * dusty, level: amp * 4) ;\n});\n);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n // LFSaw begins at 0, illustrates attack time better\n var sig = LFSaw.ar(440);\n var amps = Amplitude.ar(\n sig,\n attackTime: [0.001, 0.01],\n releaseTime: [0.01, 0.2]\n );\n [sig] ++ amps\n}.plot\n.superpose_(true)\n.plotColor_([Color.black, Color.green, Color.blue]);\n);\n\n(\n// use input amplitude to control SinOsc frequency\n{\n SinOsc.ar(\n Amplitude.kr(\n Blip.ar(3, 20) * LFNoise1.kr(0.1).range(0, 1),\n MouseX.kr(0.00\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n // LFSaw begins at 0, illustrates attack time better\n var sig = LFSaw.ar(440);\n var amps = Amplitude.ar(\n sig,\n attackTime: [0.001, 0.01],\n releaseTime: [0.01, 0.2]\n );\n [sig] ++ amps\n}.plot\n.superpose_(true)\n.plotColor_([Color.black, Color.green, Color.blue]);\n);\n\n(\n// use input amplitude to control SinOsc frequency\n{\n SinOsc.ar(\n Amplitude.kr(\n Blip.ar(3, 20) * LFNoise1.kr(0.1).range(0, 1),\n MouseX.kr(0.001, 1, 1),\n MouseY.kr(0.001, 1, 1),\n 1200,\n 400\n ),\n 0, 0.3)\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Plotter`?"}, {"role": "assistant", "content": "Plotter — Plot numerical data on a window or view"}, {"role": "user", "content": "What does `Plotter.plotGraph` do?"}, {"role": "assistant", "content": "`{ |x| sin(x) }.plotGraph(300, 0, 2*pi);`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\na = { (0..10).scramble.normalize }.dup(2).plot;\na.editMode = true;\na.editFunc = { |...args| args.postln };\n);\n\n// using plotter as a control interface\n(\na = { (0..10).scramble.normalize(300, 400) }.dup.plot;\na.specs = \\freq; a.plotMode = \\bars;\na.editMode = true;\nx = {\n var phase = SinOsc.ar(\\rate.kr(a.value[1]));\n SinOsc.ar(\\freq.kr(a.value[0]), phase).mean * 0.1\n}.play;\na.editFunc = { |plotter, plotIndex, i, val|\n x.setn(\\freq, a.value[0]);\n x.setn(\\rate, a.value[1]);\n};\na.parent.onClose = { x.release };\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Resonz`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"noiseToPitch\", { arg out = 0, mul = 1;\n Out.ar(\n out,\n Resonz.ar(\n WhiteNoise.ar(mul),\n LFNoise0.kr(4, 110, 660),\n [0.005, 0.005]\n )\n )\n}).add;\n);\n\n(\n// activate left and right channels\nSynth(\"noiseToPitch\", [\\out, 0, \\mul, 1]);\nSynth(\"noiseToPitch\", [\\out, 1, \\mul, 1]);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Interface.guiBodyFunction` do?"}, {"role": "assistant", "content": "Sets up an environment in which you can build a player, a GUI and responders for midi and keyboard control"}]} +{"conversations": [{"role": "user", "content": "What does `Out.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Write a signal to a bus. Arguments: bus — The index of the bus to write out to. The lowest numbers are written to the audio hardware.; channelsArray — An Array of channels or single output to write out. You cannot change the size of this once a SynthDef has been built.."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Compander` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var z;\n\n // signal (clean)\n z = Decay2.ar(\n Impulse.ar(8, 0, LFSaw.kr(0.3, 1, -0.3, 0.3)),\n 0.001,\n 0.3\n )\n * Mix.ar(Pulse.ar([80, 81], 0.3));\n\n // apply gate (mouse x sets treshold)\n Compander.ar(z, z,\n thresh: MouseX.kr(0.001, 1),\n slopeBelow: 10,\n slopeAbove: 1,\n clampTime: 0.01,\n relaxTime: 0.01\n )\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "How do I make a delay line?"}, {"role": "assistant", "content": "`CombN.ar(in, maxdelaytime, delaytime, decaytime)` is a feedback delay: maxdelaytime is the buffer size, delaytime the actual delay (and it can modulate), decaytime how long the repeats take to die. For a clean single echo use `DelayN.ar(in, maxdelaytime, delaytime)`, which has no feedback. Both replace the `in` with the delayed signal, so mix with the dry: `dry + CombN.ar(dry, 0.5, 0.3, 2) * 0.4`."}]} +{"conversations": [{"role": "user", "content": "What does `PlayerAmp.asSynthDef` do?"}, {"role": "assistant", "content": "adds a simple amplitude control to a Player"}]} +{"conversations": [{"role": "user", "content": "What does `InstrSynthDef.buildControlsWithObjects` do? What arguments does it take?"}, {"role": "assistant", "content": "Extends SynthDef enabling the extra capabilities of Instr with Patch Arguments: instr; objects."}]} +{"conversations": [{"role": "user", "content": "What does `Color.hexString` do?"}, {"role": "assistant", "content": "Returns a String containing a 6 character web color code, preceded by a #. `Color(1.0,"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Impulse`."}, {"role": "assistant", "content": "```supercollider\n{ Impulse.ar(800, 0.0, 0.5, 0) }.play\n\n{ Impulse.ar(XLine.kr(800, 100, 5), 0.0, 0.5, 0) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ LFNoise0.ar(1000, 0.25) }.play;\n\n// modulate frequency\n\n{ LFNoise0.ar(XLine.kr(1000, 10000, 10), 0.25) }.play;\n\n// as frequency modulator\n(\n{ SinOsc.ar(\n LFNoise0.ar(4, 400, 450),\n 0, 0.2\n )\n}.play;\n)\n\n// freq is the rate of starting points\n{ var freq = 1000; [LFNoise0.ar(freq), Impulse.ar(freq) }.plot\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ LFNoise0.ar(1000, 0.25) }.play;\n\n// modulate frequency\n\n{ LFNoise0.ar(XLine.kr(1000, 10000, 10), 0.25) }.play;\n\n// as frequency modulator\n(\n{ SinOsc.ar(\n LFNoise0.ar(4, 400, 450),\n 0, 0.2\n )\n}.play;\n)\n\n// freq is the rate of starting points\n{ var freq = 1000; [LFNoise0.ar(freq), Impulse.ar(freq)] }.plot\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `LinSelectX`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar(300),\n Pulse.ar(230)\n ];\n\n LinSelectX.ar(MouseX.kr(0, 1) * a.size, a) * 0.2\n}.play;\n);\n\n(\n{\n var a;\n a = [\n SinOsc.kr(0.25),\n LFSaw.kr(10),\n LFPulse.kr(0.3)\n ];\n\n SinOsc.ar(LinSelectX.kr(MouseX.kr(0, 1) * a.size, a) * 300 + 400) * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `PlayerSocket.psinit` do?"}, {"role": "assistant", "content": "a player that can play other players using a cross-faded and fuse-protected socket"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Compander` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var z;\n\n // signal (clean)\n z = Decay2.ar(\n Impulse.ar(8, 0, LFSaw.kr(0.3, 1, -0.3, 0.3)),\n 0.001,\n 0.3\n )\n * Mix.ar(Pulse.ar([80, 81], 0.3));\n\n // apply gate (mouse x sets treshold)\n Compander.ar(z, z,\n thresh: MouseX.kr(0.001, 1),\n slopeBelow: 10,\n slopeAbove: 1,\n clampTime: 0.01,\n relaxTime: 0.01\n )\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n/* Audio plugin definition\n\n Each audio plugin should define the following global variables:\n ~name: (symbol) name of the spatializer\n ~description: (string) a short description\n ~function: the actual definition of the plugin\n\n*/\n\n~name = \\MonoIn;\n~description = \"A direct input\";\n~channelLayout = \\mono;\n\n~function = {\n |gate = 0, bus = 0, attack = 0.02, susL = 0.9, release = 0.1, curve = -4|\n var env = Env.asr(attack, susL, release, curve);\n SoundIn.ar(bus, EnvGen.kr(env, gate));\n}\n```"}, {"role": "assistant", "content": "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see ."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// define the violin-like sound synth\n(\nSynthDef(\\violin, {\n | midinote=60, gate=1, amp=0.25 |\n var env = EnvGen.kr(Env.asr(0.1, 1, 0.1), gate, doneAction:2);\n var sig = VarSaw.ar(\n midinote.midicps,\n width:LFNoise2.kr(1).range(0.2, 0.8)*SinOsc.kr(5, Rand(0.0, 1.0)).range(0.7,0.8))*0.25;\n sig = sig * env * amp;\n Out.ar(0, sig!2);\n}).add;\n);\n\n\n// play a chord (farfisa-like sound)\n(\n[60, 64, 67].do ({\n | note |\n Synth(\\violin, [\\midinote, note]);\n})\n);\n\n// play a single note (it seems also a flute!)\nx = Synth(\\violin, [\\midinote, 84]);\nx.set(\\gate, 0); // stop the note\n\n\n// play some random notes\n(\np = Pbind(\n \\instrument, \\violin,\n \\midinote, Prand( Scale.majorPentatonic.degrees, inf) + 60,\n \\dur, 3,\n \\legato, 1\n).play;\n)\n```"}, {"role": "assistant", "content": "Trying to procedurally synthetise a violin, I eventually came out with a \"Farfisa\" organ like sound.\r\nIt can be used also as a flute!."}]} +{"conversations": [{"role": "user", "content": "Write a chord progression with Pbind."}, {"role": "assistant", "content": "Put an array of degrees in the pattern, use \\strum to spread the chord, and the default instrument\nplays all notes of each event.\n\n```supercollider\n(\nPbind(\n \\scale, Scale.minor,\n \\root, 2,\n \\degree, Pseq([[0, 4, 7], [-3, 0, 4], [-5, -1, 2], [0, 4, 7]], inf),\n \\dur, 1.5,\n \\strum, 0.02,\n \\amp, 0.12,\n \\legato, 0.9\n).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Ndef`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\nNdef(\\sound, { |freq = 56, numHarm = 10| Blip.ar(freq, numHarm, 30) * 0.2 }).play;\nNdef(\\sound).set(\\freq, 15);\nNdef(\\sound).set(\\freq, 15, \\numHarm, 100);\n\nNdef(\\lfo, { LFNoise2.kr(2).exprange(10, 200) });\nNdef(\\sound).map(\\numHarm, Ndef(\\lfo));\nNdef(\\sound).set(\\numHarm, nil); // unmap.\nNdef(\\sound).stop;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ LFSaw.ar(500, 1, 0.1) }.play\n\n// used as both Oscillator and LFO:\n{ LFSaw.ar(LFSaw.kr(4, 0, 200, 400), 0, 0.1 }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ LFSaw.ar(500, 1, 0.1) }.play\n\n// used as both Oscillator and LFO:\n{ LFSaw.ar(LFSaw.kr(4, 0, 200, 400), 0, 0.1) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Set`?"}, {"role": "assistant", "content": "Set — a set according to equality"}, {"role": "user", "content": "What does `Set.add` do?"}, {"role": "assistant", "content": "Add an Object to the Set. An object which is equal to an object already in the Set will not be added. `Set[1, 2, 3].add(4).postln;`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nSet[1, 2, 3].add(4).postln;\nSet[1, 2, 3].add(3).postln;\nSet[\"abc\", \"def\", \"ghi\"].add(\"jkl\").postln;\nSet[\"abc\", \"def\", \"ghi\"].add(\"def\").postln;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ LPF.ar(Saw.ar(200, 0.1), SinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3600, 4000)) }.play;\n\n// kr:\n(\n{ var ctl = LPF.kr(LFPulse.kr(8), SinOsc.kr(XLine.kr(1, 30, 5)) + 2);\n SinOsc.ar(ctl * 200 + 400)\n}.play;\n);\n\n(\n{ var ctl = LPF.kr(LFPulse.kr(8), MouseX.kr(2, 50, 1));\n SinOsc.ar(ctl * 200 + 400)\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ LPF.ar(Saw.ar(200, 0.1), SinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3600, 4000)) }.play;\n\n// kr:\n(\n{ var ctl = LPF.kr(LFPulse.kr(8), SinOsc.kr(XLine.kr(1, 30, 5)) + 2);\n SinOsc.ar(ctl * 200 + 400)\n}.play;\n);\n\n(\n{ var ctl = LPF.kr(LFPulse.kr(8), MouseX.kr(2, 50, 1));\n SinOsc.ar(ctl * 200 + 400)\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is a UGen?"}, {"role": "assistant", "content": "A UGen is a unit generator: the primitive signal-processing node of the server. SinOsc, Saw, WhiteNoise, LPF and EnvGen are UGens, and they are wired into a graph inside a SynthDef."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nb = NodeProxy.audio(s, 2);\nb.play; // listen to b\nb.source = { SinOsc.ar([400, 500], 0, 0.1) }; // play something\n\nr = b.record(\"recproxy101.aiff\"); // start recorder (paused\nr.unpause; // start recording\nr.close; // end recording, close file\nb.stop; // stop listen\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nb = NodeProxy.audio(s, 2);\nb.play; // listen to b\nb.source = { SinOsc.ar([400, 500], 0, 0.1) }; // play something\n\nr = b.record(\"recproxy101.aiff\"); // start recorder (paused)\nr.unpause; // start recording\nr.close; // end recording, close file\nb.stop; // stop listen\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Synth`?"}, {"role": "assistant", "content": "Synth — Client-side representation of a synth node on the server"}, {"role": "user", "content": "What does `Synth.new` do?"}, {"role": "assistant", "content": "Create and return a new Synth object, and immediately start the corresponding synth node on the server."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n// create a Synth at the head of the default Server's default group\n// based on the SynthDef \"default\"\nx = Synth.new(\"default\");\ns.queryAllNodes; // note the default group (ID 1)\nx.free;\n\n// Using an arrayed control\n// run this block first to make the SynthDef\n(\nSynthDef(\"help-synth\", { |freq = #[440, 450, 460], out = 0|\n Out.ar(out, Mix(SinOsc.ar(freq, 0, 0.1)));\n}).add;\n);\n\n// then this a short while later\nx = Synth(\"help-synth\", [freq: [500, 501, 510]]);\n\nx = Synth(\"help-synth\", [freq: [500, 501, 510]]);\nx.set(\\freq, [1, 2, 3] * 400 + [1, 2, 3], \\out, 1);\nx.set(\\freq, [3] * 400 + [1, 2, 3], \\out, 1);\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `BBandPass` in SuperCollider briefly."}, {"role": "assistant", "content": "BBandPass — Band Pass Filter The B equalization suite is based on the Second Order Section (SOS) biquad UGen. Category: UGens > Filters > BEQSuite."}]} +{"conversations": [{"role": "user", "content": "What does `Window.acceptsClickThrough` do? What arguments does it take?"}, {"role": "assistant", "content": "Whether the window receives clicks when it is not front-most. The default is Arguments: A Boolean.."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Ringz` that runs as it is."}, {"role": "assistant", "content": "```supercollider\na = NodeProxy(s);\na[0] = { |freq = 440, dt=0.1, rate=2| Ringz.ar(Impulse.ar(rate * [1, 1.2]), freq, dt)*0.1 };\na.play;\n(\na[1] = \\set -> Pbind(\n \\dur, Prand([1, 0.5], inf),\n \\freq, Pwhite(200.0, 1000, inf),\n \\rate, Pdup(4, Prand([1, 3, 6, 10], inf)),\n \\dt, Pwhite(0.01, 0.1, inf)\n)\n);\n// modify the source in the meanwhile:\na[0] = { |freq = 440, dt=0.1, rate=2| Ringz.ar(Dust.ar(rate * 10.dup), freq, dt)*0.1 };\n\na.nodeMap.postln; // the values are not set in the node map.\na.clear(3);\n```"}]} {"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//simple particlesystem.\n//with mouse controlling world gravity and system position\n\n(\nvar width= 300, height= 300, w, world,\nsys;\n\n//--world\nw= RedWindow(\"particlesystem test\", Rect(128, 64, width, height)).front;\nworld= RedWorld3(RedVector2D[width, height], 0, 20, -0.25); //dim,grav,maxvel,damp\n\n//--system\nsys= RedParticleSystem.new;\n\n//--loop\nw.draw{\n world.gravity= RedVector2D.newFrom(w.mouse/([width, height])-0.5);\n\n //--add new particles and update old\n sys.add(RedParticle(world, w.mouse+5.rand2, 0, RedVector2D[2.rand2, 10.rand], 1.5, 5.rand).age_(40.rrand(50)));\n sys.addForce(world.gravity);\n sys.update;\n\n //--render\n sys.do{|o| //iterate all particles in the system\n Pen.fillColor= Color.grey((o.age/50), 1);\n Pen.fillOval(Rect.aboutRedObject2D(o));\n };\n};\nw.play;\nCmdPeriod.doOnce({w.close});\n)\n```"}, {"role": "assistant", "content": "simple particlesystem. with mouse controlling world gravity and system position."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pevent`."}, {"role": "assistant", "content": "```supercollider\na = Pbind(\\note, Prand([1, 2, 3], inf)).asStream;\na.next; // returns nil\na = Pevent(Pbind(\\note, Prand([1, 2, 3], inf))).asStream;\na.next; // returns an event\n```"}]} -{"conversations": [{"role": "user", "content": "I get 'FAILURE IN SERVER /s_new SynthDef not found'. What is wrong?"}, {"role": "assistant", "content": "The server does not know that SynthDef. Three usual causes, in order of likelihood:\n\n1. **The SynthDef was added before the server booted.** `SynthDef(...).add` is asynchronous; wrap the work\n in `s.waitForBoot { ... }` or put `s.sync` after `.add`.\n2. **The name does not match.** `SynthDef(\\bell, ...)` is played by `Synth(\\bell)`, not `\\Bell` — symbols\n are case-sensitive.\n3. **`.add` was never called.** Writing `SynthDef(\\bell, { ... })` without `.add` builds the definition in\n the language and sends nothing.\n\nCheck with `SynthDescLib.global.dict.keys` — if the name is not there, it never reached the server."}]} -{"conversations": [{"role": "user", "content": "What is `DXEnvFanOut` in SuperCollider?"}, {"role": "assistant", "content": "DXEnvFanOut — sends crossfade envelopes to out buses according to demand-rate control DXEnvFanOut sends multichannel envelopes, which are used by DXMix / DXMixIn / DXFan / DXFanOut implicitely, to a sequence of out buses, which, together with fadeTimes and stepTimes, can be passed as demand rate ugens. It can be used as envelope and trigger at the same time, which leads to applications such as crossfading PlayBufs and different kinds of granulation, using a buffer or not. Category: Libraries > miSCellaneous > DX suite."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// an array of routine functions:\n(\na = [\n { 1.wait; \\done_one.postln },\n { 0.5.wait; \\done_two.postln },\n { 0.2.wait; \\done_three.postln }\n];\n);\n// join after 0\n(\nRoutine {\n \"join = 0.\".postcln;\n a.fork(0); \\doneAll.postln;\n}.play;\n);\n// join after 1\n(\nRoutine {\n \"join = 1.\".postcln;\n a.fork(1); \\doneAll.postln;\n}.play;\n);\n// join after all\n(\nRoutine {\n \"join = a.size (default).\".postcln;\n a.fork; \\doneAll.postln\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// an array of routine functions:\n(\na = [\n { 1.wait; \\done_one.postln },\n { 0.5.wait; \\done_two.postln },\n { 0.2.wait; \\done_three.postln }\n];\n);\n// join after 0\n(\nRoutine {\n \"join = 0.\".postcln;\n a.fork(0); \\doneAll.postln;\n}.play;\n);\n// join after 1\n(\nRoutine {\n \"join = 1.\".postcln;\n a.fork(1); \\doneAll.postln;\n}.play;\n);\n// join after all\n(\nRoutine {\n \"join = a.size (default).\".postcln;\n a.fork; \\doneAll.postln;\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `InstrSynthDef.buildErrorString` do?"}, {"role": "assistant", "content": "Extends SynthDef enabling the extra capabilities of Instr with Patch"}]} -{"conversations": [{"role": "user", "content": "Explain `AnalogIn` in SuperCollider briefly."}, {"role": "assistant", "content": "AnalogIn — Read data from an analog input Read a DC-coupled analog input connected to a sensor (e.g.: a potentiometer or CV in). Category: UGens > Bela."}]} -{"conversations": [{"role": "user", "content": "What does `Plotter.editFunc` do?"}, {"role": "assistant", "content": "Supply a function which is evaluated when editing data. The function is called with the arguments: `plotter`, `plotIndex`, `index`, `val`, `x`,"}]} -{"conversations": [{"role": "user", "content": "What does `Collection.symmetricDifference` do?"}, {"role": "assistant", "content": "Return the set of all items which are not elements of both this and that. this — that `a = [1, 2, 3]; b = [2, 3, 4,"}]} -{"conversations": [{"role": "user", "content": "What does `NumberEditor.bind` do? What arguments does it take?"}, {"role": "assistant", "content": "holds a float value with a spec, editable with a gui Arguments: model; varname; spec; layout; bounds; labelWidth."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Trig.ar(Dust.ar(1), 0.2) * FSinOsc.ar(800, 0.5) }.play\n\n{ Trig.ar(Dust.ar(4), 0.1 }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Trig.ar(Dust.ar(1), 0.2) * FSinOsc.ar(800, 0.5) }.play\n\n{ Trig.ar(Dust.ar(4), 0.1) }.play\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Pan4.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Four channel equal power pan. Arguments: in — The input signal.; xpos — X pan position from -1 to +1 (left to right).; ypos — Y pan position from -1 to +1 (back to front).; level — A control rate level input.."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Just experimenting with patterns."}, {"role": "assistant", "content": "```supercollider\n/* Some Funky Klangs - Totally botched the math on what I was trying to do but it sounds better this way */\n\n( \nSynthDef(\\DistKlangBlip, { \n | out = 0, release = 1, freq1 = 1, freq2 = 5, freq3 = 8, freqMult = 4 | \n var env = Linen.kr(Impulse.kr(0), 0.01, 1, release, doneAction:2); \n var freqs = ([freq1, freq2, freq3] * freqMult).midicps; \n var klang = Klang.ar(`[freqs, nil, nil ], 1, 0); \n Out.ar(out, klang.tanh!2 * env * 0.5) \n}).add\n\n);\n\n( \n Pbind(*[ \n instrument: \\DistKlangBlip, \n dur: Pxrand([0.25, 0.5], inf) * 0.5, \n release: Pkey(\\dur), \n freqMult: Pxrand((3..12), inf), \n freq2: Prand([4,5], inf), \n freq3: Prand([8,12], inf) \n]).play; \n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `LatoocarfianC` in SuperCollider?"}, {"role": "assistant", "content": "LatoocarfianC — Latoocarfian chaotic generator A cubic-interpolating sound generator based on a function given in Clifford Pickover's book Chaos In Wonderland, pg 26. The function is: Category: UGens > Generators > Chaotic."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes SyncSaw madness."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\fun, {\n var src, freq = 25;\n var lagTime = \\lagTime.kr(0);\n var vibrato = \\vibrato.kr([ 1.3515662384033, 1.3061940193176, 0.604791264534, 1.2328997278214, 0.33569867610931, 0.40528120040894, 1.0865307760239, 1.22394572258, 1.7781081724167, 0.15319232463837 ], lagTime);\n \n var vibRatio = \\vibRatio.kr([ 2.9047239411079, 0.39578121743921, 0.10932490532285, 0.051738858660565, 0.17840235868831, 0.024495380749894, 3.9689920754869, 4.1139229659643, 0.23327501819885, 0.97643604193256 ], lagTime);\n \n var freqVary = \\freqVary.kr([ 143.76541377614, 14.25479545154, 6.6728691888342, 58.434807398325, 154.89385962072, 34.112274650688, 3.1140823758236, 10.42040949808, 158.59959972037, 1.2163188440936 ], lagTime);\n \n \n var numSrcs = vibrato.size;\n\n src = numSrcs.collect{|i|\n var freq2 = (freq * freqVary[i]) * LFNoise2.kr(0.01).range(1, 1.5);\n     \n SyncSaw.ar(freq2, freq2 * SinOsc.ar(Line.kr(1, vibrato[i], 20) * vibRatio[i], Rand(0, 0.8)).range(pi, pi * 0.1)) * rrand(0.05, 0.1)\n };\n \n src = Splay.ar(src);\n \n}).play\n);\n\nNdef(\\fun).fadeTime = 20;\n\nNdef(\\fun).rebuild\n\n(\nNdef(\\fun).setn(\n \\lagTime, [5],\n \\vibRatio, {exprand(0.1, 3)}!10,\n \\freqVary, {exprand(1, 150)}!10,\n \\vibrato, {exprand(0.3, 3)}!10\n)\n);\n(\nNdef(\\fun).setn(\n \\lagTime, [200],\n \\vibRatio, ({exprand(0.1, 3)}!10).sort,\n \\freqVary, ({exprand(1, 150)}!10).sort,\n \\vibrato, ({exprand(0.3, 3)}!10).sort\n)\n);\n\n(\nNdef(\\fun).xsetn(\n \\lagTime, [100],\n \\vibRatio, {exprand(0.1, 3)}!10,\n \\freqVary, {exprand(1, 150)}!10,\n \\vibrato, {exprand(0.3, 3)}!10\n))\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// loopFunc also takes a pattern of Functions, in this case\n// the arg loopFuncPerItem decides if next Functions are polled per item or per loop.\n\n(\n~lookBack = 0;\n~loopFuncPerItem = true; // or 1\n\np = Pbind(\n \\dur, Pn(Pshuf([1, 1, 2]/6)),\n \\midinote, PSloop(\n Prand((60..80), inf),\n bufSize: 10,\n lookBack: { ~lookBack },\n // every number gets a Function that adds an interval of that size\n loopFunc: Pxrand((3..11), inf).collect { |x| { |y| y - [0, x].postln } },\n loopFuncPerItem: { ~loopFuncPerItem }\n )\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// loopFunc also takes a pattern of Functions, in this case\n// the arg loopFuncPerItem decides if next Functions are polled per item or per loop.\n\n(\n~lookBack = 0;\n~loopFuncPerItem = true; // or 1\n\np = Pbind(\n \\dur, Pn(Pshuf([1, 1, 2]/6)),\n \\midinote, PSloop(\n Prand((60..80), inf),\n bufSize: 10,\n lookBack: { ~lookBack },\n // every number gets a Function that adds an interval of that size\n loopFunc: Pxrand((3..11), inf).collect { |x| { |y| y - [0, x].postln } },\n loopFuncPerItem: { ~loopFuncPerItem }\n )\n).trace.play\n);\n\n// wait a bit to fill buffer\n// start looping with Functions polled per item\n\n~lookBack = 3\n\n~lookBack = 6\n\n\n// one interval per loop\n\n~loopFuncPerItem = false // or 0\n\n~lookBack = 9\n\n\n// switch back to new interval per item\n\n~loopFuncPerItem = 1\n\n\n// go on and stop\n\n~lookBack = 0\n\np.stop\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Compare:\n\n{ WhiteNoise.ar(0.25) }.play;\n\n{ LPZ2.ar(WhiteNoise.ar(0.25) }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Compare:\n\n{ WhiteNoise.ar(0.25) }.play;\n\n{ LPZ2.ar(WhiteNoise.ar(0.25)) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `LatoocarfianN.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Latoocarfian chaotic generator Arguments: freq — Iteration frequency in Hertz; a — Equation variable; b — Equation variable; c — Equation variable; d — Equation variable; xi — Initial value of x; yi — Initial value of y; mul."}]} -{"conversations": [{"role": "user", "content": "What does `IBVAfft.new` do? What arguments does it take?"}, {"role": "assistant", "content": "create a new Arguments: ibva — an instance of IBVA."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\RotateAz;\n~description = \"Rotation around the z-axis (angle from -180 to 180)\";\n\n~function = { |in = 0, order = 1, rotateAziDeg = 0|\n\n // Rotating the scene is done from the perspective of the listener\n // rotation follows the right-hand rule of rotation:\n // * Positive azimuth means the listener turns head to the left\n\n HOATransRotateAz.ar(\n order: order,\n in: in,\n az: rotateAziDeg.degrad\n );\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for attempt at a Star Wars sound effect!?"}, {"role": "assistant", "content": "```supercollider\n(\n\n// bye fighter\n{\n\nvar whooshPitch, whooseVol, swish, swishPitch = 970, noise, output, timeScale = 1.5;\nvar trump, trumpPitch = 400, chain, buf;\nvar panning;\n\nwhooshPitch = EnvGen.kr(\n\n Env(\n [0.8, 1.0, 0.9, 0.7, 0.5, 0.3, 0.24, 0.12, 0.0],\n [0.08, 0.2, 0.15, 0.11, 0.08, 0.09, 0.06, 0.18],\n 2\n ),\n timeScale: 1.3 * timeScale\n \n).lag(0.2);\n\nwhooseVol = EnvGen.kr(\n\n Env(\n [0.0, 0.2, 0.7, 0.9, 1.0, 0.8, 0.6, 0.43, 0.22, 0.0],\n [0.4, 0.5, 0.2, 0.15, 0.17, 0.11, 0.1, 0.16, 0.28],\n 2\n ),\n timeScale: 0.9 * timeScale\n \n).lag(0.2, 1.5) * LFNoise1.kr(37.2, 0.2, 1).lag(0.2);\n\nnoise = Mix(CombC.ar(WhiteNoise.ar(0.2), 0.1, [whooshPitch.exprange(0.16, 0.00011), whooshPitch.exprange(0.19, 0.00013)], 0.09));\nnoise = noise + BrownNoise.ar(0.1);\n\nswishPitch = swishPitch * LFNoise0.kr(365, 0.2, 1);\nswishPitch = swishPitch * whooshPitch.range(0.8, 1.3);\nswish = Mix.fill(\n 3,\n {\n |i|\n SinOsc.ar(swishPitch + (i * whooshPitch.exprange(45, 1)), rrand(0.0, 1.0), 0.4);\n }\n);\ntrumpPitch = trumpPitch * whooshPitch.range(0.92, 1.08);\ntrump = Mix.fill(3, { |i| SinOscFB.ar(trumpPitch * LFNoise0.kr(28, 0.06, 1).lag(0.8) * (0.8 + (i * 0.05)), 1.2, 0.8) }) * 0.6;\ntrump = RHPF.ar(trump, whooshPitch.range(120, 335), 0.2);\nchain = FFT(LocalBuf(2048), trump);\nchain = PV_BinShift(chain, WhiteNoise.kr.range(0.96, 1.01), whooshPitch.range(24, 28)); \ntrump = IFFT(chain) * 0.2;\npanning = Line.kr(-0.7, 0.7, 3);\noutput = noise + swish + trump;\noutput = output * whooseVol;\n\nPan2.ar(output, panning, 1.0);\n}.play;\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Pbinop` in SuperCollider?"}, {"role": "assistant", "content": "Pbinop — binary operator pattern Returns a stream that applies the binary operator to the stream values of the receiver. Usually, this is the result of applying a binary operator (i.e. a method with one argument) to a pattern. Category: Streams-Patterns-Events > Patterns > Math."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PV_MagFreeze`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\nb = Buffer.read(s, ExampleFiles.child);\n\n\n(\nSynthDef(\"help-magFreeze\", { |out = 0|\n var in, chain;\n in = SinOsc.ar(LFNoise1.kr(5.2, 250, 400));\n chain = FFT(LocalBuf(2048), in);\n // moves in and out of freeze\n chain = PV_MagFreeze(chain, SinOsc.kr(0.2));\n Out.ar(out, 0.1 * IFFT(chain).dup);\n}).play(s);\n\n);\n\n(\n// trig with MouseY\nSynthDef(\"help-magFreeze2\", { |out = 0, soundBufnum = 2|\n var in, chain;\n in = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);\n chain = FFT(LocalBuf(2048), in);\n chain = PV_MagFreeze(chain, MouseY.kr > 0.5);\n Out.ar(out, 0.1 * IFFT(chain).dup);\n}).play(s, [\\soundBufnum, b]);\n);\n\nb.free\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes shred01 (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n// by Notgoodenogh\n\n(\n5.do{\n\n{FreeVerb.ar(1 / pow(2.718281, LFSaw.ar(rrand(10,100),1,1).squared / (2 * (Latch.ar(WhiteNoise.ar(1).range(0.001, 0.15), LFSaw.ar(4,1,0.5,0.5) > 0.99)).squared)) * 0.1, 0.33, 2) * EnvGen.kr(Env.linen(20, 40, 20, 1), doneAction: 2) ! 2}.play\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// example; this buffer is mono, so the number of samples matches the number of frames\nb = Buffer.read(s, ExampleFiles.child);\n\n// indexing with a phasor\n{ BufRd.ar(1, b, Phasor.ar(0, BufRateScale.kr(b), 0, BufSamples.kr(b))) }.play;\n\n// indexing by hand\n{ BufRd.ar(1, b, K2A.ar(MouseX.kr(0, BufSamples.kr(b)))) }.play;\n\nb.free;\n```"}, {"role": "assistant", "content": "example; this buffer is mono, so the number of samples matches the number of frames indexing with a phasor (BufSamples: Current number of samples in buffer.)"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Change arg values of MIDIdef after instantiation."}, {"role": "assistant", "content": "```supercollider\n~mdef =\n{\n |key, func, msgNum, permanent = true|\n\n MIDIdef(key, func ?? { MIDIdef(key).func }, msgNum ? MIDIdef(key).msgNum, MIDIdef(key).chan, MIDIdef(key).msgType, MIDIdef(key).srcID).permanent_(permanent)\n}\n```"}]} -{"conversations": [{"role": "user", "content": "What does `AbstractDispatcher.remove` do? What arguments does it take?"}, {"role": "assistant", "content": "Remove a responder func from this Arguments: funcProxy — An instance of a subclass of AbstractResponderFunc to remove.."}]} -{"conversations": [{"role": "user", "content": "What does `BusPlug.control` do?"}, {"role": "assistant", "content": "Create a new control rate instance on the given"}]} -{"conversations": [{"role": "user", "content": "What is `PLnaryop` in SuperCollider?"}, {"role": "assistant", "content": "PLnaryop — dynamic scope Pnaryop variant Takes Symbol args for later reference by the Streams, which will read from variables in the Environments of their instantiation. See PLx_suite. For replacing operators dynamically take PLnaryFunc with the operator wrapped into a Function. Category: Libraries > miSCellaneous > PLx suite, Streams-Patterns-Events > PLx suite."}]} -{"conversations": [{"role": "user", "content": "What is `IFFT`?"}, {"role": "assistant", "content": "IFFT — Inverse Fast Fourier Transform"}, {"role": "user", "content": "What does `IFFT.new` do?"}, {"role": "assistant", "content": "returns a time domain signal from converting the FFT frequency domain signal chain. The *new method is equivalent to the *ar message returns an audio rate signal."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// without any modification, convert FFT chain (frequency domain signal) back to audio (time domain signal)\n(\n{ var in, chain;\n in = WhiteNoise.ar;\n chain = FFT(LocalBuf(2048), in);\n IFFT.ar(chain) * -20.dbamp // inverse FFT\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `UnicodeResponder.global` do?"}, {"role": "assistant", "content": "register responder functions for unicode and modifier combinations"}]} -{"conversations": [{"role": "user", "content": "What does `PlayerSocket.name` do?"}, {"role": "assistant", "content": "a player that can play other players using a cross-faded and fuse-protected socket"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Now with a little more stick?"}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\cowbell, {\n | out=0, amp=0.3, gate=1, fund_freq=540, pan=0.0 |\n var sig, env, hash;\n\n // hash = DC.ar(0);\n hash = BPF.ar(\n Hasher.ar(Sweep.ar(rate: TRand.kr(1.0, 10.0))), \n fund_freq * 1.4, \n 0.5,\n 2\n ).tanh * Env.perc(0.001, 0.02).ar(0);\n sig = Pulse.ar( fund_freq * [ 1, 1.5085 ], [ 0.565, 0.445 ], [ 0.4, 0.6 ] ).atan;\n env = EnvGen.ar(\n Env(\n [ 0, 0.05, 1, 0.1, 0 ], [ 0.003, 0.002, 0.05, 0.5 ], [2, -4, -4, -4]\n ),\n gate: gate,\n timeScale: [ 1.0, 1.5 ],\n doneAction: 2\n );\n sig = Mix( (hash + sig) * env );\n sig = BPF.ar( sig, fund_freq * 2, 1.808 );\n\n Out.ar( out, Pan2.ar( sig, pan, amp ) );\n}).add;\n);\n\nSynth(\\cowbell);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Drand`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a, freq, trig;\n a = Drand([1, 3, 2, 7, 8], inf);\n trig = Impulse.kr(MouseX.kr(1, 400, 1));\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `View.focusGainedAction` do?"}, {"role": "assistant", "content": "Sets or gets the object to be evaluated when the view gains the keyboard focus. It is passed the view as an"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for UI sounds (pt1)."}, {"role": "assistant", "content": "```supercollider\n// UI sounds\n// this code is an attempt to recreate a sound\n// inspired from some technological/electrical UI interface\n\n// 1. first define the synth\n// Here we are using the FM technique\n(\nSynthDef(\\fmmod, {\n |\n amp=0.2,\n fc=1000,\n fm = 100,\n idx = 100,\n atk=0.01,\n rls=0.1\n |\n var env = EnvGen.ar(Env.perc(atk, rls), doneAction:2);\n var modulator = SinOsc.ar(fm);\n var carrier = SinOsc.ar(fc + (idx*modulator) );\n var sig = carrier * env * amp;\n sig = HPF.ar(sig, 1000);\n Out.ar(0, sig!2);\n}).add;\n);\n\n// 2. then define the Pbind which will play the sequence\n// of UI sounds simulating variuos characters showing up on an\n// imaginary display.\n// Play around FC, FM, ATK and RLS to obtain different sound characters.\n(\np = Pbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 100,\n \\idx, 100,\n \\amp, 0.6,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).asEventStreamPlayer;\n);\n\n// 3. play it\np.play;\n\n// 4. Here are some presets\n\n// \"cricket\" preset\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 100,\n \\idx, 100,\n \\amp, 0.6,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 2\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 1000,\n \\idx, 100,\n \\amp, 0.6,\n \\atk, 0.001,\n \\rls, 0.01,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 3\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 100,\n \\idx, 10,\n \\amp, 0.4,\n \\atk, 0.01,\n \\rls, 0.01,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 4\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 1000,\n \\fm, 100,\n \\idx, 1000,\n \\amp, 0.2,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n\n// preset 5\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 5000,\n \\fm, 1000,\n \\idx, 1000,\n \\amp, 0.4,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 5\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 8000,\n \\fm, 1000,\n \\idx, 1000,\n \\amp, 0.7,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `LocalBuf`?"}, {"role": "assistant", "content": "LocalBuf — Allocate a buffer local to the synth"}, {"role": "user", "content": "What does `LocalBuf.newFrom` do?"}, {"role": "assistant", "content": "Allocates a new buffer from a given list of values"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\\bigLocalBuf, {\n LocalBuf(88200).set(Array.fill(88200, { #[0, 0.25, 0.5, 0.75, 1.0].choose }))\n}).add;\n\nSynthDescLib.at(\\bigLocalBuf).constants;\n// prints: FloatArray[1, 88200, 0, 0.75, 0.5, 0.25]\n```"}]} -{"conversations": [{"role": "user", "content": "Write a bell in SuperCollider."}, {"role": "assistant", "content": "A bell is a set of inharmonic partials with a long percussive decay. The ratios below are the\nclassic bell ones; the envelope frees the Synth when it ends.\n\n```supercollider\n(\nSynthDef(\\bell, { |out = 0, freq = 440, amp = 0.2, dur = 3|\n var partials = [1, 2.76, 5.4, 8.93];\n var amps = [1, 0.5, 0.3, 0.15];\n var sig = SinOsc.ar(freq * partials) * amps;\n var env = EnvGen.kr(Env.perc(0.001, dur, 1, -6), doneAction: 2);\n Out.ar(out, Pan2.ar(Mix(sig) * env * amp, 0));\n}).add;\n);\nSynth(\\bell, [\\freq, 660, \\dur, 4]);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Midterm Q3 (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"bell\", {arg freq, amp;\n\n\n var env, snd, partials, relativeAmps;\n\n partials = [0.5, 1, 1.19, 1.56, 2, 2.51, 2.66, 3.01, 4.1];\n relativeAmps = [0.25, 1, 0.8, 0.5, 0.9, 0.4, 0.3, 0.6, 0.1];\n\n env = Env.perc(\n attackTime: 0.01,\n releaseTime: 5,\n level: amp*relativeAmps).kr(doneAction:2);\n\n snd = SinOsc.ar(\n freq: freq*partials,\n mul: env\n );\n\n snd = Mix.ar(snd);\n\n Out.ar(0, snd * 0.1 ! 2);\n\n}).add;\n);\n\n\n//Test your \"bell\" SynthDef with the following Pbind:\n\n\n(\nPbind(\n \\instrument, \"bell\",\n \\degree, Pwhite(-5, 10),\n \\dur, Pwhite(3, 6),\n \\amp, Pwhite(0.1, 0.5)\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BLowPass`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n(\nz = {\n BLowPass.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(10, 20000, \\exponential), // cutoff freq.\n MouseY.kr(0.0, 1.0, \\linear), // rq\n 0.5); // mul\n}.play\n);\nz.release;\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Pfset`."}, {"role": "assistant", "content": "```supercollider\n(\nvar a, b;\na = Pfset({\n ~dur = 0.3;\n}, Pbind(\\dur, 0.5));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for bankrupt robot's dance-machine )."}, {"role": "assistant", "content": "```supercollider\n({var // rhythmoid\nr = 87/59/*MouseX.kr(1,10).linexp(1,10,1/10,10)*/, d = 1/r, l = 8, // tempo, bar dur, beat levels\ni = Impulse.ar(r*(2**l)), // base beat\npd = {|...a|PulseDivider.ar(*a)},\nq = {|n,s=0,p=0| n=n+l; pd.(i, 2**n, s*2.pow(n-(p?0)-1)) }, // quantizer\ne = {|p,d,a|EnvGen.ar(Env.perc(a?0.01,d?0.5),p)}, // perc envelope\ns = {|...a|Stepper.ar(*a)},\nz=DC.ar(0)\n+Ringz.ar(LPF.ar(q.(0),1800),50,d).tanh\n+SinOsc.ar(60,0,e.(q.(0)bitXor:q.(1))*3).tanh.madd(0.3)\n+Ringz.ar(LPF.ar(q.(-2)bitXor:q.(0),[400,800]),90,d/2,1/2).mean.tanh\n+BrownNoise.ar(e.(q.(0,1),d/4)/12*s.(q.(1),0,1,2))\n+WhiteNoise.ar(e.(q.(1,1,2),d/4)/30)\n+Blip.ar(360,4,e.(q.(-3)bitXor:q.(-2,1),d/8)/14)\n+Formlet.ar(LPF.ar(q.(0)bitXor:q.(1,1,2),2300),350,d/8,d/2,1/2)\n+Formlet.ar(LPF.ar(q.(-2,1)bitXor:q.(1,1,3),s.(q.(2),0,80,105,3).midicps),s.(q.(3),0,50,80,5).midicps,d/6,d/4,1/6)\n+Saw.ar(400,e.(q.(2,(1..4),3), d/8)*s.(q.(-2),0,0,3)/2)\n+Ringz.ar(LPF.ar(q.(-2),[400,800])/2,160,d,s.(q.(2),0,7,14)/14).mean.tanh\n+PMOsc.ar(300,490,2,0,e.(q.(2))/6)\n+PMOsc.ar(200,890,3,0,e.(q.(2,1))/8)\n+Pulse.ar(2900,mul:e.(q.(3)bitXor:q.(2,1),d/3)/12)\n+LFPar.ar(1900,mul:e.(q.(0,[1,2],[1,3])bitXor:q.(1,1,2),d/3,5e-3)/7)\n+SelectX.ar(s.([q.(1),q.(0)].choose,0,0,3.rrand(7)), Saw.ar(Array.rand(7,500,4500),mul:e.(q.(-2)bitXor:q.(0,3,1), d/3))/19)\n+Pulse.ar(s.(q.(3),0,60,80,3).midicps,0.5,e.(q.(-1,2,1),d/4)*2).tanh.madd(1/24)\n+LFCub.ar(s.(q.(3),0,80,108,6).midicps).madd(Saw.ar(2490)*e.(pd.(q.(-4)bitXor:q.(-3,1),8,1), d/3)/16)\n+Pluck.ar(Impulse.ar(s.(q.(4),0,80,108,6).midicps), q.(-2)bitXor:q.(0,3,1), d, d/18, d/2, -0.4).madd(e.(q.(2),d*8)/3) \n;z!2/8}.play)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Collection.includes` do?"}, {"role": "assistant", "content": "Answer whether anObject is contained in the receiver. `List[1, 2, 3,"}]} -{"conversations": [{"role": "user", "content": "What does `MIDIIn.sysex` do? What arguments does it take?"}, {"role": "assistant", "content": "receive MIDI messages Arguments: value — a Function evaluated whenever a MIDI System Exclusive message is received. It is passed the following arguments:."}]} -{"conversations": [{"role": "user", "content": "What does `Function.scope` do? What arguments does it take?"}, {"role": "assistant", "content": "As play above, and calls Server-scope to open a scope window in which to view the output. `{ FSinOsc.ar(440, 0, 0.3) Arguments: numChannels — The number of channels to display in the scope window, starting from outbus. It automatically reflects the number of channels.; outbus — The output bus to play the audio out on. This is equivalent to Out.ar(outbus, theoutput). The default is 0.; fadeTime — A fadein time. The default is 0.05 seconds, which is just enough to avoid a click.; bufsize — The size of the buffer for the ScopeView. The default is 4096.; zoom — A zoom value for the scope's X axis. Larger values show more. The default is 1.; bounds — The bounds of the `Window` in which the scope is embedded. A Rect specifying position and size of the window. The size does not include the border and title bar. Position is measured from the bottom-left corner of the screen (this is different than View#-bounds). The default is nil and the scope win."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nDelayC.ar(z, 0.2, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\n(\n// recursive application of delay.\n{\nz = Decay2.ar(Dust.ar(1, 0.5), 0.01, 0.1, Saw.ar(100 + [0, 1]));\n5.do { |i| z = DelayC.ar(RLPF.ar(z, Rand(100, 3000), 0.03), 1, 1 / (2**i), 1, z * 0.5) };\nz\n}.play\n)\n```"}, {"role": "assistant", "content": "Dust randomly triggers Decay to create an exponential decay envelope for the WhiteNoise input source (DelayC: Simple delay line with cubic interpolation.)"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for blaplop (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\bla, { arg out=0, amp=0.1, gate=1, pan=0, freq=200;\n var sig;\n var tab;\n tab = \\tab.kr(1 ! 15);\n sig = LFSaw.ar(freq * tab.abs);\n sig = sig.sum;\n sig = RLPF.ar(sig, Rand(10,freq*2) + 100 * SinOsc.ar(tab.abs).range(0.01,Rand(2,7)));\n sig = sig.sum;\n sig = sig / 100;\n sig = sig.tanh;\n sig = sig * EnvGen.ar(Env.adsr(0.01,0.1,0.8,0.1+ExpRand(0.001,0.2)),gate,doneAction:2);\n sig = Pan2.ar(sig, pan, amp);\n Out.ar(out, sig);\n}).add;\n);\n\n(\nPdef(\\plop, Pbind(\n \\instrument, \\bla,\n \\degree, Pstep(Pseq([\n Pseq([0,2,4],4),\n Pseq([0,12,6],4),\n Pseq([0,12,6]+7,1),\n ],inf), 1),\n \\octave, 3,\n \\tab, Pfunc {\n var tab;\n [\n //tab = { arg n; (n + 1.asFloat.rand + 1).tanh / (n.rand+1) } ! 15;\n tab = { arg n; (n + 2.asFloat.rand + 1) / (n+1) } ! 15;\n tab.postln;\n ]\n },\n \\dur, PdurStutter( Prand([1,2,4],inf), Pseq([1,2,3]/2,inf)),\n \\amp, 0.4\n)).play;\n);\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Main`?"}, {"role": "assistant", "content": "Main — The concrete instance of Process"}, {"role": "user", "content": "What does `Main.thisProcess` do?"}, {"role": "assistant", "content": "The singleton instance of Main is available through the special keyword thisProcess. For example, to find out what platform you're on: `thisProcess.platform; // --> e.g. \"an OSXPlatform\", \"a Linux`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nShutDown.add({ \"Good bye!!\".postln });\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// no, it doesn't take a ugen in ...\n(\n{\n EnvGen.kr(\n Env.asr(0.1, 1.0, 0.5, \\welch),\n 1.0,\n FSinOsc.ar(1.0).range(0.0, 1.0),\n timeScale: 0.1\n ) * SinOsc.ar(440, 0, 0.3)\n}.play;\n);\n\n// ...but an .ir rate input, a float or an ir rate ugen like Rand would work\n(\n{\n EnvGen.kr(\n Env.asr(0.1, 1.0, 0.5, \\welch),\n 1.0,\n Rand(0.1, 1.0),\n timeScale: 0.1\n ) * SinOsc.ar(440, 0, 0.3)\n}.play;\n)\n```"}, {"role": "assistant", "content": "no, it doesn't take a ugen in ... ...but an .ir rate input, a float or an ir rate ugen like Rand would work (EnvGen: Envelope generator)"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Blowing ambient with lots of reverb."}, {"role": "assistant", "content": "```supercollider\nfork{\n // notes sequence\n var seq = Pxrand([0,3,5,7,8],inf).asStream;\n loop{\n var dur = 8;\n var num = 8;\n var root = 36;\n var freq = (seq.next+root).midicps;\n var spread = rrand(0.4,0.8);\n var attack = rrand(0.05, 0.3);\n \n // play the cluster\n play{\n var harm = Array.geom(num, 1, 1.5);\n var harma = Array.geom(num, 0.5, 0.8);\n var detune = Array.fill(num, { LFNoise2.kr(1,0.01,1) });\n var source = PinkNoise.ar;\n var bandwidth = Rand(0.001,0.01);\n var generator = [\n SinOsc.ar(freq*harm*detune, mul:harma*0.3).scramble,\n Resonz.ar(source, freq*harm*detune, bandwidth, mul:harma).scramble * 50\n ].wchoose([0.2,0.8]);\n var snd = Splay.ar(generator,spread);\n snd * LFGauss.ar(dur, attack, loop:0, doneAction:2);\n };\n dur.wait;\n };\n \n};\n\n// global triple super gverb\n{\n var in = In.ar(0,2);\n in = (in*0.2) + GVerb.ar(in, 220, 12, mul:0.6);\n in = (in*0.2) + GVerb.ar(in, 220, 12, mul:0.6);\n in = (in*0.2) + GVerb.ar(in, 220, 12, mul:0.6);\n ReplaceOut.ar(0, Limiter.ar(LeakDC.ar(in)))\n}.play(addAction:\\addToTail)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nNdef(\\birdy, {arg freq=1500, amp=0.5, rate=10;\n var osc, son, convIn, rand;\n osc=LFCub;\n rand = LFNoise1.ar(rate);\n convIn=LinCongN.ar(rate);\n son = osc.ar(Convolution.ar(convIn,convIn));\n freq = Latch.kr(rand.range(0,1).round(0.1), rand) * freq;\n freq = osc.ar(osc.ar(rand)*rand.range(0,10)).range(freq, freq*3);\n son = Formlet.ar(son, freq, convIn.abs*0.1, rand.abs);\n son = Normalizer.ar(son, 0.9, 0.1) * convIn.abs * LFPulse.kr(LFPulse.kr(rand.abs), 0, rand.abs);\n son = son + GVerb.ar(son, 99, 2, mul: rand.range(0,0.3));\n son * amp\n}).play\n)\n```"}, {"role": "assistant", "content": "I just rewrote one of autocsi's tweets and came out with this which sounds like a digital bird of some kind:."}]} +{"conversations": [{"role": "user", "content": "When should I use a Pattern instead of writing Synth code by hand?"}, {"role": "assistant", "content": "Use a Pattern when what you want to express is a sequence over time — notes, durations, amplitudes, parameters — rather than a signal. A Pbind describes events, and `.play` turns each event into a Synth (by default of the \\default instrument, or of \\instrument if you name one). Hand-written Synth code is for the sound itself; Patterns are for what plays when. The two compose: a SynthDef named \\bell is triggered from `Pbind(\\instrument, \\bell, ...)`."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{ SinOsc.ar(\n SinOsc.ar(\n XLine.kr(1, 100, 5)).exprange(*XLine.kr([20, 800], [7000, 200], 10)\n )\n ) * 0.1\n\n}.play;\ns.record(duration: 10);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{ SinOsc.ar(\n SinOsc.ar(\n XLine.kr(1, 100, 5)).exprange(*XLine.kr([20, 800], [7000, 200], 10)\n )\n ) * 0.1\n\n}.play;\ns.record(duration: 10);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a chord progression with Pbind."}, {"role": "assistant", "content": "Put an array of degrees in the pattern, use \\strum to spread the chord, and the default instrument\nplays all notes of each event.\n\n```supercollider\n(\nPbind(\n \\scale, Scale.minor,\n \\root, 2,\n \\degree, Pseq([[0, 4, 7], [-3, 0, 4], [-5, -1, 2], [0, 4, 7]], inf),\n \\dur, 1.5,\n \\strum, 0.02,\n \\amp, 0.12,\n \\legato, 0.9\n).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\nz = {\nBBandPass.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(20, 20000, \\exponential),\n MouseY.kr(0.0, 10.0, \\linear), // bw\n 0.5); // mul\n}.play)\nz.release;\n\n(\nz = {\nBBandPass.ar(\n WhiteNoise.ar ! 2,\n MouseX.kr(20, 20000, \\exponential),\n MouseY.kr(0.0, 10.0, \\linear), // bw\n 0.5); // mul\n}.play\nz.release;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\nz = {\nBBandPass.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(20, 20000, \\exponential),\n MouseY.kr(0.0, 10.0, \\linear), // bw\n 0.5); // mul\n}.play)\nz.release;\n\n(\nz = {\nBBandPass.ar(\n WhiteNoise.ar ! 2,\n MouseX.kr(20, 20000, \\exponential),\n MouseY.kr(0.0, 10.0, \\linear), // bw\n 0.5); // mul\n}.play)\nz.release;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `PV_BinScramble` in SuperCollider briefly."}, {"role": "assistant", "content": "PV_BinScramble — Scramble bins. Randomizes the order of the bins. The trigger will select a new random ordering. Category: UGens > FFT."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `EnvGen`."}, {"role": "assistant", "content": "```supercollider\n{ PinkNoise.ar(EnvGen.kr(Env.perc, doneAction: Done.freeSelf)) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ReplaceOut`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"ReplaceOutHelp\", { |out = 0, freq = 440|\n var source;\n source = SinOsc.ar(freq, 0, 0.1);\n\n // write to the bus, replacing previous contents\n ReplaceOut.ar(out, source);\n\n}).add;\n);\n\n// each Synth replaces the output of the previous one\nx = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 500]);\ny = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 600]);\nz = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 700]);\n\n// release them in reverse order; the older Synths are still there.\nz.free;\ny.free;\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LatoocarfianL`."}, {"role": "assistant", "content": "```supercollider\n// default initial params\n{ LatoocarfianL.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `File.getcwd` do?"}, {"role": "assistant", "content": "POSIX standard 'get current working directory'. `//"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nf = ();\nf.beatAndBar = {\n var t = currentEnvironment.clock; // t= TempoClock.new;\n var text = \"xB: \";\n\n var nBeatsPerBar = { arg n, beats, clock;\n var nBpb = clock.beatsPerBar * n;\n \"\" ++ n ++ text ++ (nBpb - (beats%(nBpb))).asInteger\n };\n\n t.play({arg beats, time, clock;\n ( //[\"beat: \" ++ (t.beatInBar + 1).asInteger] ++ //uncomment for beat in bar\n [1,2,4,8,16,32].collect( {|n,i| nBeatsPerBar.value(n, beats, clock)})\n ).postln;\n 1});\n \"beatAntBar\";\n}\n);\n\nf[\\beatAndBar].value;\n\n(\nf[\\beatAndBar].value;\nCmdPeriod.add(f[\\beatAndBar]);\n)\n```"}, {"role": "assistant", "content": "Prints beats to bars for a mutiple of bar.\r\nHow many beats left until next 1, 2, 4, 8, 16, 32, etc bar."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// trigger an envelope\n(\n{\n var trig;\n trig = SinOsc.ar(1) > 0.1;\n EnvGen.kr(Env.perc, trig, doneAction: Done.none) * SinOsc.ar(440, 0, 0.1)\n}.play\n // > outputs 0 or 1\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// trigger an envelope\n(\n{\n var trig;\n trig = SinOsc.ar(1) > 0.1;\n EnvGen.kr(Env.perc, trig, doneAction: Done.none) * SinOsc.ar(440, 0, 0.1)\n}.play\n) // > outputs 0 or 1\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nb = NodeProxy.new.play;\nb.source = { PinkNoise.ar(0.2.dup) };\n// now I want to filter b through a new proxy.\na = NodeProxy.new;\na <-- b; a.source = { HPF.ar(b.ar, 7000) };\na.source = { HPF.ar(b.ar, 3000 }; // changing the source\na.clear; b.clear;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nb = NodeProxy.new.play;\nb.source = { PinkNoise.ar(0.2.dup) };\n// now I want to filter b through a new proxy.\na = NodeProxy.new;\na <-- b; a.source = { HPF.ar(b.ar, 7000) };\na.source = { HPF.ar(b.ar, 3000) }; // changing the source\na.clear; b.clear;\n```"}]} +{"conversations": [{"role": "user", "content": "How should I check an answer you give me?"}, {"role": "assistant", "content": "Three quick checks, cheapest first. Does it evaluate without a syntax error — the post window points at the exact character. Does the node appear in `s.plotTree` — if yes, the problem is signal rather than lifecycle. Does it reach `Out.ar(0, ...)` with a non-zero amplitude and an open filter. If those three pass and it is still silent, the class's own help page will show the argument order you may have assumed wrong."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BiPanB2`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var w, x, y, p, q, a, b, c, d;\n\n p = LFSaw.ar(200);\n q = LFSaw.ar(301);\n\n // B-format encode\n #w, x, y = BiPanB2.ar(p, q, MouseX.kr(-1, 1), 0.1);\n\n // B-format decode to quad\n #a, b, c, d = DecodeB2.ar(4, w, x, y);\n\n [a, b, d, c] // reorder to my speaker arrangement: Lf Rf Lr Rr\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `MxApp.play` do? What arguments does it take?"}, {"role": "assistant", "content": "Starts playing it isn't already Arguments: then — A callback, executed after play has started. Returns: this"}]} +{"conversations": [{"role": "user", "content": "What does `PSVsect_oi.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new PSVsect_oi Arguments: genList — An array of generators and corresponding offsets. Allowed generators: Integers, Streams or Patterns producing intervals or Sieves itself. Integers and Stream/Pattern output must be strictly positive. Integers as generators produce constant intervals. Offsets must be integers.; maxLength — Integer. Maximum number of items, which the stream will return. Defaults to inf.; limit — Integer. Limit up to which intervals can be returned by the stream. If no limit is passed, integer intervals might be returned up to default summation limit of 65536.."}]} +{"conversations": [{"role": "user", "content": "What does `MxInletApp.index` do?"}, {"role": "assistant", "content": "The integer index of this Returns: integer"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nn = NdefMixer(s);\nn.parent.alwaysOnTop_(true); // show mixer in front of IDE\n\ns.boot;\n// if you have JITLibExtensions installed, try ProxyMeter to see the proxy levels:\nif (\\ProxyMeter.asClass.notNil) { ProxyMeter.addMixer(n) };\n\n\n\"bcdefghijk\".do { |k| Ndef(k.asSymbol).ar };\n\n\"lmnopqrtuvw\".do { |k| Ndef(k.asSymbol).kr };\n\n\"abcdefghijk\".do { |k| Ndef(k.asSymbol).playN };\n(\nNdef(\\aaaaaa, { |freq = 250, intv =\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nn = NdefMixer(s);\nn.parent.alwaysOnTop_(true); // show mixer in front of IDE\n\ns.boot;\n// if you have JITLibExtensions installed, try ProxyMeter to see the proxy levels:\nif (\\ProxyMeter.asClass.notNil) { ProxyMeter.addMixer(n) };\n\n\n\"bcdefghijk\".do { |k| Ndef(k.asSymbol).ar };\n\n\"lmnopqrtuvw\".do { |k| Ndef(k.asSymbol).kr };\n\n\"abcdefghijk\".do { |k| Ndef(k.asSymbol).playN };\n(\nNdef(\\aaaaaa, { |freq = 250, intv = 19, timescale = 1, curve = 0, loopnode = 0|\n var env = EnvGen.kr(\n Env({ 1.0.rand2 }!11, { 1.0.rand }!10, curve, releaseNode: 9, loopNode: loopnode),\n timeScale: timescale);\n var pitch = (env * [1, 0.33, -1] * intv).midiratio * freq;\n Splay.ar(Formant.ar(pitch, pitch.scramble * 2, pitch.scramble)) * 0.1;\n}).play(vol: 0.25);\n);\n\nn.switchSize(2);\nn.switchSize(1);\nn.switchSize(0);\n\nn.switchSize(2);\nn.editGui.object_(Ndef(\\aaaaaa));\n\nNdefMixer(Server.internal, 24);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `ProxySpace.reduce` do?"}, {"role": "assistant", "content": "free all proxies that are not needed in order to play the ones passed in with 'to'. if none are passed in, all proxies that are monitored (with the play message) are kept as well as their parents"}]} +{"conversations": [{"role": "user", "content": "What is `Server`?"}, {"role": "assistant", "content": "Server — Object representing a server application"}, {"role": "user", "content": "What does `Server.new` do?"}, {"role": "assistant", "content": "Create a new Server instance."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n{ SinOsc.ar * 0.1 }.play(s); // play a synth on the server\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Routine` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// SynthDefs on the fly\ns.boot;\n(\nt = TempoClock.new;\nr = Routine.new({\n 10.do({\n // could be done with an argument instead of a new def, but proves the point\n SynthDef(\"help-EnvGen\" ++ i, { arg out = 0;\n Out.ar(\n out,\n EnvGen.kr(Env.perc, 1.0, doneAction: Done.freeSelf)\n * SinOsc.ar(100 + (100 * t.elapsedBeats), 0, 0.1)\n )\n }).play(s);\n 1.yield;\n });\n}).play(t); // Note the alternative syntax: Routine.play(aClock)\n)\n```"}]} {"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(//*********PREPARE**********\np.pop;\n//Any code that needs to access your own environment goes here\np = ProxySpace.push(s);\n~fxLoop.play.fadeTime_(5);\n);\n\n(//*********FXLoop**********\n~fxLoop = {\n var in = SoundIn.ar([0,1]);\n in;\n}\n)\n```"}, {"role": "assistant", "content": "Code for using Supercollider as a realtime livecode FX processor for audio input. Blog post explaing this code: http://schemawound.com/post/53528545022/fxloop."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SoundIn`."}, {"role": "assistant", "content": "```supercollider\n// world's most expensive patchcord (use headphones to avoid feedback)\n{ SoundIn.ar(0) }.play;\n\n// stereo version\n{ SoundIn.ar([0, 1]) }.play;\n\n// scope input; silent output\n{ Amplitude.kr(SoundIn.ar(0)) }.scope;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `RedDiskInSampler.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a new sampler on a Arguments: server — If this is `nil` it will use `Server.default`. The server must be booted.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ RLPFD.ar(Mix(LFSaw.ar([120, 180], 0, 0.33)), LinExp.kr(LFCub.kr(0.1, 0.5*pi), -1, 1, 280, 1500), 0.6, 0.5, mul:3.dup }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ RLPFD.ar(Mix(LFSaw.ar([120, 180], 0, 0.33)), LinExp.kr(LFCub.kr(0.1, 0.5*pi), -1, 1, 280, 1500), 0.6, 0.5, mul:3).dup }.play\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `DecodeB2`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var w, x, y, p, a, b, c, d;\n\n p = PinkNoise.ar; // source\n\n // B-format encode\n #w, x, y = PanB2.ar(p, MouseX.kr(-1, 1), 0.1);\n\n // B-format decode to quad\n #a, b, c, d = DecodeB2.ar(4, w, x, y);\n\n [a, b, d, c] // reorder to my speaker arrangement: Lf Rf Lr Rr\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = NodeProxy(s); a.play;\na.source = { Splay.ar(Blip.ar(\\freq.kr(18 ! 4))) * 0.2 };\na.set(\\freq, [1, 3, 56, 13]);\na.source = { Splay.ar(SinOsc.ar(LFSaw.ar(\\freq.kr(18 ! 4)) * 250 + 400)) * 0.2 };\nb = NodeProxy(s); b.source = { MouseX.kr(0, 3) * [1, 3, 56, 13] };\na.set(\\freq, b;\na.clear; b.clear;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = NodeProxy(s); a.play;\na.source = { Splay.ar(Blip.ar(\\freq.kr(18 ! 4))) * 0.2 };\na.set(\\freq, [1, 3, 56, 13]);\na.source = { Splay.ar(SinOsc.ar(LFSaw.ar(\\freq.kr(18 ! 4)) * 250 + 400)) * 0.2 };\nb = NodeProxy(s); b.source = { MouseX.kr(0, 3) * [1, 3, 56, 13] };\na.set(\\freq, b);\na.clear; b.clear;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `History` in SuperCollider briefly."}, {"role": "assistant", "content": "History — keeps a history of interpreted lines of code History stores all code strings as they are being evaluated, in order to reuse code written earlier, to forward code to other players, or to store, reproduce, edit and analyse live-coded performances. It records every evaluated code string into a singleton instance of History - `History.current`. Category: Streams-Patterns-Events."}]} +{"conversations": [{"role": "user", "content": "Explain `EaseInSine` in SuperCollider briefly."}, {"role": "assistant", "content": "EaseInSine — Sinusoidal ease-in Easing equation for a sinusoidal (sin(t)) ease-in, accelerating from zero velocity. Category: Ease."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var a = SinOsc.ar(1).round(0.1);\n var b = SinOsc.ar(1.2).round(0.1);\n BinaryOpUGen('==', a, b) * 0.1\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var a = SinOsc.ar(1).round(0.1);\n var b = SinOsc.ar(1.2).round(0.1);\n BinaryOpUGen('==', a, b) * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a random pentatonic melody that plays by itself."}, {"role": "assistant", "content": "Pick degrees from a pentatonic scale; `\\scale` and `\\root` define the pitch space, and `\\degree`\npicks within it.\n\n```supercollider\n(\nPbind(\n \\instrument, \\default,\n \\scale, Scale.minorPentatonic,\n \\root, 3,\n \\degree, Pwhite(0, 9, inf),\n \\octave, 5,\n \\dur, Pwhite(0.12, 0.28, inf),\n \\amp, 0.2,\n \\legato, 0.8\n).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `ClientOnTrigResponder` in SuperCollider?"}, {"role": "assistant", "content": "ClientOnTrigResponder — a helper object used by Instr to implement { }.onTrig inside of Instr functions Category: Libraries > crucial > Instr."}]} +{"conversations": [{"role": "user", "content": "What does `PathName.files` do?"}, {"role": "assistant", "content": "returns a list of all the files in the folder represented by this path."}]} {"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n b = {|x,y|\n var arr = List[];\n case\n {y % x.size == 0} // condition 1\n {\n var per = y / x.size;\n x.size.do{|oo|\n var pp = 1,i = 1;\n arr.add( x[oo] );\n while({i < per},{\n arr.add(0);\n i = i+1;\n });\n }\n }\n {x.size % y == 0} // condition 2\n {\n var pp = x.size / y, i = 0, sz = x.size;\n while({i < sz},{\n if(i % pp == 0)\n { arr.add(x[i]) };\n i=i+1;\n });\n };\n arr\n };\n a = [1,1,1,1];\n c = b.value(a,16) \n // [ 1, 1, 1, 1 ]\n // becomes\n // [ 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 ]\n\n b.value(c,4); \n // [ 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 ]\n // becomes\n // [ 1, 1, 1, 1 ]\n)\n```"}, {"role": "assistant", "content": "useful for expanding or reducing arrays by 2^x.\r\nI would like to know if there is a more concise way to write this!\r\nAny suggestions?\r\n\r\n(duplicate post, sorry! forgot to log in!)."}]} -{"conversations": [{"role": "user", "content": "Write a snare drum in SuperCollider."}, {"role": "assistant", "content": "Two ingredients: a short tonal body and band-passed noise for the rattle.\n\n```supercollider\n(\nSynthDef(\\snare, { |out = 0, amp = 0.6|\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -6), doneAction: 2);\n var body = SinOsc.ar(180) * 0.4;\n var rattle = BPF.ar(WhiteNoise.ar, 1800, 0.4) * 3;\n Out.ar(out, Pan2.ar((body + rattle) * env * amp));\n}).add;\n);\nSynth(\\snare);\n```"}]} -{"conversations": [{"role": "user", "content": "What is the difference between a Synth and a SynthDef?"}, {"role": "assistant", "content": "A SynthDef is a definition: a compiled UGen graph with named controls, registered on the server once. A Synth is one running instance of that definition. You create the definition with `SynthDef(\\bell, { |freq = 440| ... }).add` and then instances with `Synth(\\bell, [\\freq, 660])`. Defining the same SynthDef twice replaces it for future instances; already running Synths keep the old graph until they are freed."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `MouseButton`."}, {"role": "assistant", "content": "```supercollider\n{ SinOsc.ar(MouseButton.kr(400, 440, 0.1), 0, 0.1) }.play;\n{ SinOsc.ar(MouseButton.kr(400, 740, 2), 0, 0.1) }.play;\n\n(\nSynthDef(\\mousexyb, { |out = 0|\n var mousex, mousey, mousebutton;\n mousex = MouseX.kr(500, 1000); // this will determine the frequency of the sound (minimum value, maximum value, warp, lag)\n mousey = MouseY.kr(0, 0.3); // this will determine the amplitude of the sound\n mousebutton = MouseButton.kr(0, 1, 2); // this will turn the sound on or off (minimum value, maximum value, lag)\n Out.ar(out, SinOsc.ar(mousex, 0, mousey) * mousebutton);\n}).add\n);\n\nx = Synth.new(\\mousexyb);\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Mx.disconnectCable` do? What arguments does it take?"}, {"role": "assistant", "content": "A mixer and dynamic patching Arguments: cable."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `NumRunningSynths`."}, {"role": "assistant", "content": "```supercollider\n// example: frequency is derived from the number of synths running\n(\nSynthDef(\"numRunning\", { |out|\n Out.ar(out, SinOsc.ar(NumRunningSynths.ir * 200 + 400, 0, 0.1));\n}).add;\n);\n\ns.sendMsg(\"/s_new\", \"numRunning\", -1, 0, 0);\ns.sendMsg(\"/s_new\", \"numRunning\", -1, 0, 0);\ns.sendMsg(\"/s_new\", \"numRunning\", -1, 0, 0);\ns.sendMsg(\"/s_new\", \"numRunning\", -1, 0, 0);\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// For more SynthDefs and examples please head to: https://mycelialcordsblog.wordpress.com/ \n\n(\nSynthDef(\\hasherTest,\n{\narg rate = 1, freq = 60, index = 1000, tRate = 100,\nout = 0, fRate = 0.1;\n\nvar t_trig = LFPulse.kr(0.5/fRate, 0.5);\nvar random = LFNoise0.ar(rate, add:1);\nvar noise = Hasher.ar(random);\nvar sound = Saw.ar((freq+(noise*index)), Decay.kr(Impulse.kr(tRate), noise*0.001)).tanh;\nsound = Pan2.ar(sound, noise-0.3*2);\nFreeSelf.kr(t_trig);\nOut.ar(out, sound);\n}).store;\n);\n\n(\nPbind(\n\\instrument, \\hasherTest,\n\\dur, 5,\n\\rate, Pfuncn({100.rand}, inf),\n\\freq, Pfuncn({10000.rand}, inf),\n\\index, Pfuncn({20000.rand}, inf),\n\\tRate, Pfuncn({1000.rand}, inf),\n\\fRate, 5,\n).play;\n)\n```"}, {"role": "assistant", "content": "It is a simple SynthDef I made after having a look at Hasher UGen with a pattern to play it. It creates nice and varied glitch sounds."}]} -{"conversations": [{"role": "user", "content": "What does `Schmidt.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Schmidt trigger. Arguments: in — Signal to be tested.; lo — Low threshold.; hi — High threshold.."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n// prep\ns = Server.local;\n\nn = SynthDef(\"Updater-help\", {|out, freq|\n var sin;\n sin = SinOsc.ar(freq, 0.5)*EnvGen.kr(Env.triangle(4,1), doneAction:2);\n Out.ar(out, sin);\n }).send(s);\n);\n\n(\n//create a new synth node on the server\nn = Synth.new(\"Updater-help\", [\\out, 0, \\freq, 220]);\n\n//you need to register the synth with a NodeWatcher first\nNodeWatcher.register(n);\n\n//update the client of \\n_end messages\nUpdater(n, {|node, msg|\n// …\n```"}, {"role": "assistant", "content": "create a new synth node on the server you need to register the synth with a NodeWatcher first (Updater: simple MVC utility; calls an update handler when the model changes)"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n~loDev = -1;\n~hiDev = 1;\n~lookBack = 2;\n\np = Pbind(\n \\dur, 1/7,\n \\midinote, PIdev(\n Pseg(Pseq([65, 90], inf), 5, \\sin).round,\n 11,\n Pfunc { ~loDev },\n Pfunc { ~hiDev },\n Pfunc { ~lookBack }\n ).trace(prefix: \"midi \"),\n).play;\n);\n\n// widen range and increase lookBack\n\n(\n~loDev = -6;\n~hiDev = 5;\n~lookBack = 10;\n;\n\np.stop\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n~loDev = -1;\n~hiDev = 1;\n~lookBack = 2;\n\np = Pbind(\n \\dur, 1/7,\n \\midinote, PIdev(\n Pseg(Pseq([65, 90], inf), 5, \\sin).round,\n 11,\n Pfunc { ~loDev },\n Pfunc { ~hiDev },\n Pfunc { ~lookBack }\n ).trace(prefix: \"midi \"),\n).play;\n);\n\n// widen range and increase lookBack\n\n(\n~loDev = -6;\n~hiDev = 5;\n~lookBack = 10;\n);\n\np.stop\n```"}]} -{"conversations": [{"role": "user", "content": "Buffer.read fails and I get a path error. What should the path look like?"}, {"role": "assistant", "content": "On Windows use forward slashes or escaped backslashes inside the string: `Buffer.read(s, \"C:/sounds/kick.wav\")`. A single backslash starts an escape sequence, which is why `\"C:\\sounds\\kick.wav\"` fails. Also check the extension is real (`.wav`, `.aiff`, `.flac`) and that the file is not on a network path — the server reads it, not the language, and it may resolve differently. For sounds that ship with SuperCollider, `Platform.resourceDir +/+ \"sounds/a11wlk01.wav\"` is the portable form."}]} -{"conversations": [{"role": "user", "content": "How do I make this brighter?\n```supercollider\n{ LPF.ar(Saw.ar(110), 400) * 0.2 }.play;\n```"}, {"role": "assistant", "content": "Raise the cutoff. 400 Hz is well below the harmonics that carry brightness, so open it to 2000-4000 Hz:\n\n```supercollider\n{ LPF.ar(Saw.ar(110), 3000) * 0.2 }.play;\n```"}, {"role": "user", "content": "Still dull."}, {"role": "assistant", "content": "Then the low-pass is not the limit — the source is. A saw at 110 Hz has energy up to Nyquist, so check the amplitude: at 0.2 the high harmonics are quiet. Two moves: add resonance so the filter peak is audible, and raise the level slightly.\n\n```supercollider\n{ RLPF.ar(Saw.ar(110), 2500, 0.3) * 0.35 }.play;\n```\n\nIf that is still dull, the answer is a different source: `Saw` is band-limited and soft; try `LFSaw` or add a second detuned saw for more high content."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n {\n var freq;\n freq = Duty.kr(\n Dseq([0.2, 0.3, 0.4, Dseq([1, 1, 1, 2, 1, 2], inf)]) / 2,\n Dust.kr(1), // control rate reset\n Dseq([0, 1, 2, Dseq([1, 2, 3, 4, 5], inf)])\n ) * 30 + 250;\n SinOsc.ar(freq * [1, 1.01]) * 0.1\n\n }.play;\n);\n\n(\n {\n var freq;\n freq = Duty.kr(\n Dseq([0.2, 0.3, 0.4, Dseq([1, 1, 1, 2, 1, 2], inf)]) / 2,\n Dseq([1, 2, 4, 5], inf), // demand rate reset\n Dseq\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n {\n var freq;\n freq = Duty.kr(\n Dseq([0.2, 0.3, 0.4, Dseq([1, 1, 1, 2, 1, 2], inf)]) / 2,\n Dust.kr(1), // control rate reset\n Dseq([0, 1, 2, Dseq([1, 2, 3, 4, 5], inf)])\n ) * 30 + 250;\n SinOsc.ar(freq * [1, 1.01]) * 0.1\n\n }.play;\n);\n\n(\n {\n var freq;\n freq = Duty.kr(\n Dseq([0.2, 0.3, 0.4, Dseq([1, 1, 1, 2, 1, 2], inf)]) / 2,\n Dseq([1, 2, 4, 5], inf), // demand rate reset\n Dseq([0, 1, 2, Dseq([1, 2, 3, 4, 5], inf)])\n ) * 30 + 250;\n SinOsc.ar(freq * [1, 1.01]) * 0.1\n\n }.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for delay effect with accelerating echoes?"}, {"role": "assistant", "content": "```supercollider\n~buf = Buffer.alloc(s, s.sampleRate * 5);\n\n(\n{\n var trig, freq;\n var dry, snd, phase, iois;\n var cumulDelay;\n var decayFactor, lpfCutoff, numEchoes, ioiScale, ioiDecayFactor;\n\n // play with these!\n decayFactor = 0.65;\n lpfCutoff = 500;\n numEchoes = 16;\n ioiScale = 0.4;\n ioiDecayFactor = 0.75;\n\n // example input -- you can substitute other stuff here\n trig = Dust.ar(1);\n dry = Pulse.ar(100 * TIRand.ar(1, 12, trig));\n dry = dry * Decay2.ar(trig, 0.01, 0.2);\n\n phase = DelTapWr.ar(~buf, dry);\n iois = Array.geom(numEchoes, ioiScale, ioiDecayFactor);\n cumulDelay = iois.sum;\n (cumulDelay > ~buf.duration).if {\n Error(\"use a larger buffer\").throw;\n };\n snd = Silent.ar;\n iois.reverse.do { |ioi|\n snd = (snd + DelTapRd.ar(~buf, phase, cumulDelay, interp: 4)) * decayFactor;\n // one-pole lowpass -- LPF was too aggressive\n snd = OnePole.ar(snd, lpfCutoff / SampleRate.ir);\n cumulDelay = cumulDelay - ioi;\n };\n snd = snd + dry;\n \n snd * 0.5!2;\n}.play;\n\n// contributors so far: Nathan Ho\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `ArrayedCollection.putEach` do?"}, {"role": "assistant", "content": "Put the values in the corresponding indices given by keys. If one of the two argument arrays is longer then it will wrap. `y = [0, 1, 2, 3, 4, 5, 6, 7, 8,"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for XoX pattern helper."}, {"role": "assistant", "content": "```supercollider\n(\n~xox = {|str| str.collectAs({|l| switch(l.toLower,$x, {1}, $o, {Rest(1)})}, Array)};\n);\n\n\n(\nSynthDef(\\acid, { arg out, freq = 1000, gate = 1, pan = 1, cut = 4000, rez = 0.8, amp = 1, sustain = 1, release = 0.5;\n var sig, env;\n env = EnvGen.kr(Env.linen(0.01, sustain, sustain * release), gate, amp, doneAction: Done.freeSelf);\n sig = Pulse.ar([freq,freq*1.001], 0.5);\n sig = sig + Pulse.ar(freq*0.501, 0.01, [0,0.5]);\n sig = sig + Pulse.ar(freq*1.99, 0.11, [0.5,0]);\n sig = RLPF.ar(sig, cut, rez);\n sig = Pan2.ar(sig);\n sig = sig * env;\n\n Out.ar(out, sig);\n}).add;\n);\n\n(\nPbind(\n \\instrument, \\acid,\n \\dur, Pseq(~xox.(\"xxooxoxo\") * 8/120, inf),\n \\scale, Scale.minor,\n \\degree, Pseq([0,4,5,3,3], inf),\n \\cut, Pwhite(100, 1500),\n \\rez, Pwhite(0.1, 0.8),\n \\amp, -10.dbamp,\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for number 10 for Quiz 4a."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var tri, bpf;\n tri = LFTri.ar(\n freq: [440,340, 513],\n mul: LFPulse.kr(\n freq: [6,3,2],\n width: 0.15));\n bpf = SinOsc.ar(in: tri, freq: LFNoise2.kr(4).range(400,1000));\n Splay.ar(tri,bpf);\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Re: Timpani (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\ns.boot\n\n(\nSynthDef(\\aSynth, { |rel = 0, choose = 0, amp = 0|\n var klank, env;\n\n klank = Klank.ar(`[choose ! 12, {Rand(0.128, 0.7)} ! 12], BrownNoise.ar(0.7));\n env = EnvGen.kr(Env.perc(0.01, rel), doneAction: 2);\n Out.ar(0, klank * env.dup * amp);\n}).add;\n);\n\n(\n{\n 42.do{\n x = [70, 90, 120].choose;\n y = rrand(0.01, 5);\n // attack\n Synth(\\aSynth, [\\rel, y, \\choose, x, \\amp, 128e-6]);\n // resonance\n Synth(\\aSynth, [\\rel, 1, \\choose, x, \\amp, 128e-5]);\n y.wait;\n }\n}.fork;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `EZSlider.visible` do? What arguments does it take?"}, {"role": "assistant", "content": "Sets/gets it the component views are Arguments: bool — An instance of Boolean. Default is `true`.."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Psubdivide`."}, {"role": "assistant", "content": "```supercollider\n(\na = Psubdivide(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,4,4,0,4,4], inf),\n Pseq((80 + [0, 2, 3, 5, 7, 9, 10]).midicps, inf)\n);\nx = a.asStream;\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, x.next.postln]);\n 0.25.wait\n })\n}).play(TempoClock.default);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// derived from an answer by Sergio Luque to a mail to the sc-users SuperCollider mailing list on 2013/03/22\n\n(\nvar registerSize = 16;\nvar min =\"C2\".namemidi.asInteger;\nvar max = \"C6\".namemidi.asInteger;\nvar waitTime = 0.05; // in seconds\n//var chance = 0.1;\nvar chance = Pseq([Pseries(0, 0.1, 10), Pseries(1, -0.1, 10)], inf);\nvar change = 10; // step size\n\n\nPbind(\n \\midinote, Pswitch1(\n { \n Pbrown(min, max, Pif(Prout({ chance.trace.coin.embedInStream }), change, 0))\n } ! registerSize, \n Pseq(Array.iota(registerSize), inf)\n ),\n \\dur, waitTime\n).play\n)\n```"}, {"role": "assistant", "content": "wiard noise ring variation using a ringbuffer instead of bitshifting.\r\nRe-implemented according to Julian Parker's m4l patch.\r\nDerived from an answer by Sergio Luque to a mail to the sc-users SuperCollider mailing list on 2013/03/22."}]} -{"conversations": [{"role": "user", "content": "What does `Sieve.segmentBetween` do? What arguments does it take?"}, {"role": "assistant", "content": "Returns a new Sieve of mode 'points' with Integers greater than lo and less than hi. This method is more efficient than applying segmentGreater plus Arguments: lo — Integer.; hi — Integer.."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\nvar trigger, fund, flashInst;\nflashInst = Array.fill(7,\n{\ntrigger = Dust.kr(2)*PinkNoise.ar(1);\nfund = rrand(100, 137);\nPan2.ar(\nMix.ar(\nArray.fill(7,\n{arg counter;\nvar partial;\npartial = counter + 3;\n//HenonC.ar(fund*partial).atan *\nDPW3Tri.ar(fund*partial).atan *\nEnvGen.kr(Env.adsr(0.01, 0, 0.1, 7.0),\ntrigger, 1/partial) *AY.ar(713)* max(0, LFNoise1.kr(rrand(37.0, 73.0)))\n})\n)*0.2,\n1.0.rand2)\n});\nMix.ar(flashInst)*0.6\n}.play\n)\n```"}, {"role": "assistant", "content": "\"High-energy Radio Bursts, generated by an old coffee machine of Arab origin, manifest themselves as noise and audio signals, and trigger a magnetic alteration with unpredictable effects;\"\r\n\r\n\r\n\r\nhttp://bz-buzz.blogspot.com/2018/10/radio-bursts-from-old-coffee-pot.html\r\n\r\nhttp://bzakirasantjago.blogspot.com/."}]} -{"conversations": [{"role": "user", "content": "What does `JITGui.zone` do?"}, {"role": "assistant", "content": "a CompositeView inside the parent that holds the JITGui's"}]} -{"conversations": [{"role": "user", "content": "What is `ArrayedCollection`?"}, {"role": "assistant", "content": "ArrayedCollection — Abstract superclass of Collections of fixed maximum size"}, {"role": "user", "content": "What does `ArrayedCollection.newClear` do?"}, {"role": "assistant", "content": "Creates a new instance with indexedSize indexable slots. The slots are filled with Nil, zero or something else appropriate to the type of indexable slots in the object. `Array.newClear(4).postln;`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n pitches.size.do{ |i|\n {\n var freq = pitches[i].midicps;\n var env = Env.perc.ar(Done.freeSelf);\n SinOsc.ar(freq) * 0.1 * env\n }.play;\n 0.2.wait\n }\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `RedParticle` in SuperCollider?"}, {"role": "assistant", "content": "RedParticle — an object that ages with time Category: Red > redUniverse."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n Ndef(\\x, {\n var output;\n var delayTime;\n var delayMax = 0.2;\n var delayAdd = 0.1;\n var pulseFreq = 0.5;\n var proxyMul = 2;\n var pulseMin = 40;\n var pulseMax = 130;\n var numOfEchos = 2;\n\n var mainPulse = LFPulse.ar(pulseFreq, 0, 0.5).range(pulseMin, pulseMax);\n var proxy = Ndef(\\x).ar * proxyMul;\n var ampModFreq = SinOsc.ar(0.01, 0).range(0.3, 30);\n var ampMod = LFNoise1.ar(ampModFreq, 6);\n output = SinOsc.ar(mainPulse + proxy, 0, ampMod).tanh;\n numOfEchos.do{\n delayTime = {delayMax.rand + delayAdd}!2;\n output = AllpassL.ar(output, 0.1, delayTime, 5);\n };\n output.tanh;\n }).play\n)\n```"}, {"role": "assistant", "content": "Something I put together a while back by forking Dark Sea Horns."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n~classes = [\n[ // First class's mean, covariance, weight:\n[2, 8], [[1, 0], [0, 1]], 0.3\n],[ // Second class's mean, covariance, weight:\n[8, 2], [[1, 0], [0, 1]], 0.3\n],[ // Third class's mean, covariance, weight:\n[8, 8], [[0.75, 0.5], [0.5, 0.75]], 0.4\n]\n];\n~serialised = GaussClass.classesToFloatArray(~classes);\n);\n\n// Now let's use it:\ns.boot;\nb = Buffer.loadCollection(s, ~serialised);\n(\nx = {\nvar rate = 20, input, result, gate;\n//input = {LFNoise2\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n~classes = [\n[ // First class's mean, covariance, weight:\n[2, 8], [[1, 0], [0, 1]], 0.3\n],[ // Second class's mean, covariance, weight:\n[8, 2], [[1, 0], [0, 1]], 0.3\n],[ // Third class's mean, covariance, weight:\n[8, 8], [[0.75, 0.5], [0.5, 0.75]], 0.4\n]\n];\n~serialised = GaussClass.classesToFloatArray(~classes);\n);\n\n// Now let's use it:\ns.boot;\nb = Buffer.loadCollection(s, ~serialised);\n(\nx = {\nvar rate = 20, input, result, gate;\n//input = {LFNoise2.kr(rate).range(0, 10)}.dup(2); // Our \"query point\" wanders around in space\ninput = [MouseX.kr(0, 10), MouseY.kr(0, 10)]; // Or you can wander yourself using the mouse\ngate = Impulse.kr(rate);\nresult = GaussClass.kr(input, b, gate);\ninput.poll(gate, \"input\");\nresult.poll(gate, \"result\");\nOut.ar(0, SinOsc.ar(result.linexp(0, ~classes.size-1, 440, 880), 0, 0.1).dup); // sonify\n}.play(s)\n);\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `InFeedback`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-InFeedback\", { |out = 0, in = 0|\n Out.ar(out,\n InFeedback.ar(in, 1)\n );\n}).add;\nSynthDef(\"help-SinOsc\", { |out = 0, freq = 440|\n Out.ar(out, SinOsc.ar(freq, 0, 0.1))\n}).add;\n);\n\nx = Bus.audio(s, 1);\n\n// read from bus n play to bus 0 (silent)\na = Synth(\"help-InFeedback\", [\\in, x.index, \\out, 0]);\n\n// now play a synth after this one, playing to bus x\nb = Synth.after(a, \"help-SinOsc\", [\\out, x.index]);\n\n// add another synth before a which also writes to bus x\n// now you can't hear b, as its data is one cycle old, and is overwritten by c\nc = Synth.before(a, \"help-SinOsc\", [\\out, x.index, \\freq, 800]);\n\n// free c and you can hear b again\nc.free;\nx.free;\n\na.free; b.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LinExp`."}, {"role": "assistant", "content": "```supercollider\n// linexp\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(mod.linexp(-1, 1, MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1))) * 0.1\n}.play;\n);\n\n// exprange\n(\n{\n var mod = LFNoise2.ar(80).exprange(MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1));\n SinOsc.ar(mod) * 0.1\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n(\nx = { |rate = 1|\n BufRd.ar(1, b, Phasor.ar(0, BufRateScale.kr(b) * rate, 0, BufFrames.kr(b)))\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n(\nx = { |rate = 1|\n BufRd.ar(1, b, Phasor.ar(0, BufRateScale.kr(b) * rate, 0, BufFrames.kr(b)))\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `RedEffectModule.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a new stereo effect module and boot the server if not already running. Server is taken from group Arguments: out — Which audio bus to use. Puts a ReplaceOut on this bus and the following (index+1).; group — A Group. Defaults to `Server.default.defaultGroup`.; addAction — A Symbol.; lag — a non-modulatable lag time for all parameters.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\"help-InFeedback\", { |out = 0, in = 0|\n var input, sound;\n input = InFeedback.ar(in, 1);\n sound = SinOsc.ar(input * 1300 + 300, 0, 0.4);\n Out.ar(out, sound);\n\n}).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\"help-InFeedback\", { |out = 0, in = 0|\n var input, sound;\n input = InFeedback.ar(in, 1);\n sound = SinOsc.ar(input * 1300 + 300, 0, 0.4);\n Out.ar(out, sound);\n\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SoundFileView.readProgress` do?"}, {"role": "assistant", "content": "The reading progress, updated periodically when reading a soundfile using #-readWithTask or"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Just an exploration with Substractive synthesis?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n\n 2.do{\n {BPF.ar (WhiteNoise.ar, [73,81].midicps, 1e-4, Env.sine(10,50).kr(2)).sum!2}.play; gauss (7,0.2).wait;\n {BPF.ar (WhiteNoise.ar, [71,80].midicps, 1e-4, Env.sine(10).kr(2)).sum!2*50}.play; gauss (7,0.2).wait;\n {BPF.ar (WhiteNoise.ar, [69,78].midicps, 1e-4, Env.sine(10).kr(2)).sum!2*50}.play; gauss (7,0.2).wait;\n {BPF.ar (WhiteNoise.ar, [68,80].midicps, 1e-4, Env.sine(10).kr(2)).sum!2*50}.play; gauss (7,0.2).wait;\n}\n}.fork\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `NodeProxy.quant` do?"}, {"role": "assistant", "content": "A quant value, to specify quantizes replacement of sources. Compatible with the general use of quant in"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Convolution`."}, {"role": "assistant", "content": "```supercollider\n(\n\n{\n var input, kernel;\n\n input = SoundIn.ar(0);\n kernel = Mix.ar(LFSaw.ar([300, 500, 800, 1000] * MouseX.kr(1.0, 2.0), 0, 1.0));\n\n // must have power of two framesize\n Convolution.ar(input, kernel, 1024, 0.5)\n}.play;\n\n);\n\n(\n// must have power of two framesize- FFT size will be sorted by Convolution to be double this\n// maximum is currently a = 8192 for FFT of size 16384\n\na = 2048;\ns = Server.local;\n\n// kernel buffer\ng = Buffer.alloc(s, a, 1);\n);\n\n(\n\n// random impulse response\n\ng.set(0, 1.0);\n\n100.do({ |i| g.set(a.rand, 1.0.rand) });\n\n\n{\n var input, kernel;\n\n input = SoundIn.ar(0);\n kernel = PlayBuf.ar(1, g.bufnum, BufRateScale.kr(g.bufnum), 1, 0, 1);\n\n Convolution.ar(input, kernel, 2 * a, 0.5)\n}.play;\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `PSVdif` in SuperCollider briefly."}, {"role": "assistant", "content": "PSVdif — Sieve pattern for difference of integer generators with point output Pattern for difference of integer generators with point output. Corresponds to Sieve's methods Sieve#*dif and Sieve#-dif. For an introduction and more examples see Sieves_and_Psieve_patterns. Category: Libraries > miSCellaneous > Sieves and Psieve Patterns, Streams-Patterns-Events > Sieves and Psieve Patterns."}]} -{"conversations": [{"role": "user", "content": "What does `ScalarSpec.newFrom` do? What arguments does it take?"}, {"role": "assistant", "content": "datatype specifiying a \\scalar \"rate\" input or output Arguments: similar."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Ppar two intrument cumbia base."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\bass, { | atk = 0.01, dur = 0.15, freq = 50, amp=0.8 |\n var env, osc;\n env = EnvGen.kr( Env.perc( atk, dur-atk, amp, 6 ), doneAction: 2 );\n osc = BPF.ar(LFSaw.ar(freq), freq, 2, mul: env) ! 2;\n Out.ar([0,1],osc);\n}).add;\n);\n\n(\nSynthDef('wiro', { | amp = 0.1 |\n var osc, env, noise, out;\n noise = LPF.ar(WhiteNoise.ar(1),6000);\n osc = HPF.ar(noise,2000);\n //env = Line.ar(1, 0, 0.1);\n env = EnvGen.kr(Env.perc(0.01,0.05), doneAction: 2);\n out = (osc * env);\n Out.ar([0,1],out*amp)\n}).add;\n);\n\n(\nPpar([\n Pbind(\n \\instrument, \\bass,\n \\degree, Pseq([ Pseq([Pn(Pshuf([0,2,4],1),2),Pn(Pshuf([3,5,7],1),2)],2),Pn(Pshuf([-3,-1,1],1),2) ],inf),\n \\dur, Pseq([0.25,0.5,0.25],inf),\n \\legato, Pseq([ Pgeom(0.05, 0.05, 40), Pgeom(2.05, -0.05, 40) ], inf),\n \\octave, 3,\n \\amp, 0.03\n ),\n\n Pbind(\n \\instrument, \\wiro,\n \\dur, Pseq([0.5,0.25,0.25], inf),\n \\legato, Pseq([ Pgeom(0.05, 0.05, 40), Pgeom(2.05, -0.05, 40) ], inf),\n \\amp, 0.05,\n )\n]).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nSynthDef(\\madtraffic, {|out, sig, gate=1, freq=440|\n // doneAction: 2 rilascia la synth quando EvnGen ha finito\n sig = (Blip.ar(freq)*0.7+Blip.ar(freq/2+Rand(1,12))*0.7)\n*EnvGen.kr(Env.asr(0.1, 0.3, 0.3), gate, doneAction:2);\n sig = RLPF.ar(sig,SinOsc.kr(0.3, 0, 200, 1500), 0.1);\n sig = FreeVerb.ar(sig, 0.5, 0.5, 0.5);\n Out.ar(out, sig);\n\n}).add;\n);\n\n(\nPbind(\n \\instrument, \\madtraffic,\n \\freq, Pseq([137, 373, Prand([237, 473, 713],1)], inf),\n \\legato, Pseq([1.7, 0.3], inf),\n \\dur, 0.3,\n \\out, Pseq([1, 0], inf)\n).play;\n)\n```"}, {"role": "assistant", "content": "\"It's the lack of eye contact that makes us more idiots, to the point that convertible riders give less to escalation. Closed in the car, explain the psychologists, we regress to childhood and react by shouting, or with that surrogate of the shock that is the horn.\"\r\n\r\n\r\n\r\nhttp://bz-buzz.blogspot.com/2018/09/mad-traffic.html\r\n\r\nhttp://bzakirasantjago.blogspot.it/."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LastValue`."}, {"role": "assistant", "content": "```supercollider\nd = { |freq = 440| SinOsc.ar(LastValue.ar(freq, 20), 0, 0.2) }.play;\n\nd.set(\\freq, 400);\nd.set(\\freq, 200);\nd.set(\\freq, 670);\nd.set(\\freq, 680);\nd.set(\\freq, 695);\nd.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DigitalIO`."}, {"role": "assistant", "content": "```supercollider\n// write a sine oscillator's output to a pin, and read the pin value at other times\n\n(\nSynthDef(\"help-DigitalIO\", { |out = 0|\n DigitalIO.ar(0, SinOsc.ar(10), LFPulse.kr(0.1)).poll;\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is SuperCollider?"}, {"role": "assistant", "content": "SuperCollider is a platform for audio synthesis and algorithmic composition, written in C++ and SuperCollider. It splits into a language client (sclang) that runs your code and builds UGen graphs, and an audio server (scsynth) that does the DSP in real time. They talk over OSC."}]} -{"conversations": [{"role": "user", "content": "Explain `RedSmooth` in SuperCollider briefly."}, {"role": "assistant", "content": "RedSmooth — data filter A simple class for filtering values. Single exponential smoothing. Category: Red > redTools."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nPbind(\\degree, Ptuple([Pseq([0, 2, 3], inf), Pseq([2, 4, 5, 6], inf)]).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nPbind(\\degree, Ptuple([Pseq([0, 2, 3], inf), Pseq([2, 4, 5, 6], inf)])).play;\n```"}]} -{"conversations": [{"role": "user", "content": "What is `PLbindef`?"}, {"role": "assistant", "content": "PLbindef — wrapper for Pbindef which allows replacement in object prototyping style"}, {"role": "user", "content": "What does `PLbindef.new` do?"}, {"role": "assistant", "content": "Creates a new PLbindef object or sets sources as with Pbindef."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n// synthdefs to play with\n\n(\nSynthDef(\\noise_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, rq = 0.1, amp = 0.1|\n var sig = { WhiteNoise.ar } ! 2;\n sig = BPF.ar(sig, freq, rq) *\n EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2) *\n (rq ** -1) * (250 / (freq ** 0.8));\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\sin_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { SinOsc.ar(freq, Rand(0, 2pi)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\saw_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { VarSaw.ar(freq, Rand(0, 1)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for The quest for the prime numbers?"}, {"role": "assistant", "content": "```supercollider\n//Prime numbers\n \nServer.default.boot;\n(\n//maximum number\n~max=100;\n\n//synthdefs: 2 filtered sawteeth for number and divisor\nSynthDef ( \\gsaw, {arg g;\n Out.ar(1, \n RLPF.ar ( Saw.ar(20*g), 10000*(1-(g/~max)), 0.2, 0.2)\n )\n}).add;\n\nSynthDef ( \\dsaw, {arg d, g;\n Out.ar(0,\n RLPF.ar( Saw.ar(20*d), 10000*d/sqrt(g), 0.2, 0.2)\n // the square root is important: if you search for the divisors of a number,\n // don't search beyond the square root of the number. There won't be any.\n )\n}).add;\n\n//a fm-sound with carrier 20*number and modulator 20*divisor, modulation index = 10\nSynthDef (\\fm, {arg m, c;\n Out.ar(0,\n Pan2.ar(SinOsc.ar(20*c+(SinOsc.ar(20*m, 0, 200*m, 0))), 0)\n )\n}).add;\n\n);\n(\nr=Routine({\n var number, divisor;\n //the list of prime numbers\n l=Array.newClear(indexedSize: 0);\n\n for (2, ~max,{arg number;\n x=Synth(\\gsaw, [\\g, number]); //play the number\n divisor=2;\n p=true; //prime number?\n while ({((divisor <= (number.sqrt)).and(p == true))},\n { \n y=Synth(\\dsaw, [\\d, divisor, \\g, number]); //play the divisor\n z=Synth(\\fm, [\\m, divisor, \\c, number]); //play the fm sound of number and divisor\n 1.wait; //1 second should be enough to hear if a sound is harmonic\n // harmonic sound means: not a prime number\n y.free; \n z.free; \n if( number.mod(divisor) == 0, {p = false} ); //not a prime number\n divisor = divisor + 1;\n }\n );\n x.free;\n if (p == true){ //primenumber!\n l=l.add(number); //add primenumber to the list\n for (1, l.size, { arg i; //play the list of prime numbers\n z=Synth(\\fm, [\\m, l.size, \\c, l[i]]);\n 0.1.wait;\n z.free;\n });\n }\n\n });\n});\n);\nr.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Pdef`?"}, {"role": "assistant", "content": "Pdef — stream reference definition"}, {"role": "user", "content": "What does `Pdef.all` do?"}, {"role": "assistant", "content": "A global IdentityDictionary with all proxies."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\nPdef(\\x, Pbind(\\note, Pbrown(0, 6, 0.1, inf)));\nPdef(\\x).quant = 0; // no waiting.\nPbindf(Pdef(\\x), \\dur, 0.03).play;\nPbindf(Pdef(\\x), \\dur, 0.1, \\ctranspose, 15).play;\nPbindf(Pdef(\\x), \\dur, 0.3, \\ctranspose, 2).play;\n// now change the definition\nPdef(\\x, Pbind(\\note, Pseq([0, 3, 5, 7, 9, 11], inf)));\nPdef(\\x, Pbind(\\freq, Pseq([1000, 1923, 245.2, 1718] / 1.2 + 0.1, inf)));\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Rest.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Create an instance of Rest, with a value to be used in the resulting rest Arguments: value — The Rest instance's numeric value, to be used in math operations. Note that a Rest's value is ignored for most Event keys (assuming the Event does nothing in response to `.play`). If a Rest appears in a rhythm key (`dur` or `delta`), then the number is the time until the next event. Consequently, nu."}]} -{"conversations": [{"role": "user", "content": "What is `FoaSFWL` in SuperCollider?"}, {"role": "assistant", "content": "FoaSFWL — First Order Ambisonic (FOA) Soundfield Energy Level Return the Soundfield Energy Level, SFWL, of a first order ambisonic (B-format) signal, in dB. Category: Libraries > Ambisonic Toolkit > UGens > FOA > Analyzer, UGens > Multichannel > Ambisonics, UGens > Analysis > Ambisonics."}]} -{"conversations": [{"role": "user", "content": "What does `IdentityDictionary.know` do?"}, {"role": "assistant", "content": "If set to true, the dictionary interprets method calls as look ups. This allows you to implement object prototypes (see"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Ppar two intrument cumbia base."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\bass, { | atk = 0.01, dur = 0.15, freq = 50, amp=0.8 |\n var env, osc;\n env = EnvGen.kr( Env.perc( atk, dur-atk, amp, 6 ), doneAction: 2 );\n osc = BPF.ar(LFSaw.ar(freq), freq, 2, mul: env) ! 2;\n Out.ar([0,1],osc);\n}).add;\n);\n\n(\nSynthDef('wiro', { | amp = 0.1 |\n var osc, env, noise, out;\n noise = LPF.ar(WhiteNoise.ar(1),6000);\n osc = HPF.ar(noise,2000);\n //env = Line.ar(1, 0, 0.1);\n env = EnvGen.kr(Env.perc(0.01,0.05), doneAction: 2);\n out = (osc * env);\n Out.ar([0,1],out*amp)\n}).add;\n);\n\n(\nPpar([\n Pbind(\n \\instrument, \\bass,\n \\degree, Pseq([ Pseq([Pn(Pshuf([0,2,4],1),2),Pn(Pshuf([3,5,7],1),2)],2),Pn(Pshuf([-3,-1,1],1),2) ],inf),\n \\dur, Pseq([0.25,0.5,0.25],inf),\n \\legato, Pseq([ Pgeom(0.05, 0.05, 40), Pgeom(2.05, -0.05, 40) ], inf),\n \\octave, 3,\n \\amp, 0.03\n ),\n\n Pbind(\n \\instrument, \\wiro,\n \\dur, Pseq([0.5,0.25,0.25], inf),\n \\legato, Pseq([ Pgeom(0.05, 0.05, 40), Pgeom(2.05, -0.05, 40) ], inf),\n \\amp, 0.05,\n )\n]).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n// Function to check an array for repetitions within a maximum test span\n\n~repetitionCheck = { |array, maxTestSpan|\n maxTestSpan.do { |i|\n var result = (array.drop(i+1) - array).drop((i+1).neg).includes(0).not;\n (\"no repetitions within a span of \" ++ (i+2).asString ++ \" items: \").post;\n result.postln;\n }\n}\n);\n\n// test case\n// no repetitions within a maximum span of 6 (maxLookBack == 5)\n\n(\n~src = Pbrown(0, 20, 0.3).round.asInteger;\np = PLIdev(\\src, 5, -7, 7).iter;\na = p.nextN(10000);\na.plot;\n~repetition\n// …\n```"}, {"role": "assistant", "content": "Function to check an array for repetitions within a maximum test span no repetitions within a maximum span of 6 (maxLookBack == 5) (PLIdev: dynamic scope pattern searching for numbers with integer distance from a source pattern, optionally avoiding repetitions within a span)"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Duty`."}, {"role": "assistant", "content": "```supercollider\n(\n {\n var freq;\n freq = Duty.kr(\n Drand([0.01, 0.2, 0.4], inf), // demand ugen as durations\n 0,\n Dseq([204, 400, 201, 502, 300, 200], inf)\n );\n SinOsc.ar(freq * [1, 1.01]) * 0.1\n\n }.play;\n);\n\n(\n {\n var freq;\n freq = Duty.kr(\n MouseX.kr(0.001, 2, 1), // control rate ugen as durations\n 0,\n Dseq([204, 400, 201, 502, 300, 200], inf)\n );\n SinOsc.ar(freq * [1, 1.01]) * 0.1\n\n }.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `FoaEncoderMatrix` in SuperCollider briefly."}, {"role": "assistant", "content": "FoaEncoderMatrix — First Order Ambisonic (FOA) encoder matrices Generates encoding matrices required by the Ambisonic Toolkit's first order encoder, FoaEn`.` The ATK matrices are required for using some of the matrix encoders. Please see linkClasses/Atk#Installation of ATK dependencies for instructions. Category: Libraries > Ambisonic Toolkit > Matrix & Kernel > FOA."}]} -{"conversations": [{"role": "user", "content": "How should I organise a SuperCollider project on disk?"}, {"role": "assistant", "content": "One folder per piece, with a fixed shape:\n\n```text\nmy-piece/\n synthdefs.scd // only SynthDef(...).add, loaded first\n material.scd // buffers, samples, scales\n piece.scd // the performance: Tdefs, Pbinds, Ndefs\n README.md // tempo, required samples, how to run it\n```\n\nThen the workflow is: open `synthdefs.scd`, Ctrl+A Ctrl+Enter to load it, load `material.scd`, and work in\n`piece.scd`. Keeping definitions out of the performance file is what makes a reboot survivable and a piece\nre-runnable six months later."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n// restricting fm to harmonic sidebands after\n// [Chowning, 1973] Chowning, J. (1973). The synthesis of complex spectra by means of frequency modulation. Journal of the Audio Engineering Society, 21(7):526–534.\n// restriction actually happens because of the specs, not server-side.\n\nSpec.add(\\index, [0, 40]);\nSpec.add(\\harm1, [0, 20, \\lin, 1]);\nSpec.add(\\harm2, [0, 20, \\lin, 1]);\nSpec.add(\\fundFreq, \\freq);\n\nNdef(\\fmk, {\n \n PMOsc.ar(\n \\carFreq.kr(100, 0.1), \n (\\harm1.kr(1, 1)/(\\harm2.kr(1, 1)) * LFNoise1.ar(50).range(0.995, 1.001))*\\carFreq.kr(100), \n \\index.kr(1, 0.1) * SinOsc.ar(2.5).range(0.995, 1.005)\n ) \n})\n);\nNdef(\\fmk).gui\n```"}, {"role": "assistant", "content": "Restricting fm to harmonic sidebands after[Chowning, 1973]. Restriction actually happens because of the specs, not server-side.\r\n----- \r\nChowning, J. (1973). The synthesis of complex spectra by means of frequency modulation. Journal of the Audio Engineering Society, 21(7):526–534."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// Find/make a dataset of points:\nx = 15.collect{[1.0.rand, 1.0.rand]};\n// Append the index onto the end, for later reference\nx = x.collect{|data, i| data ++ i };\n// Use the KDTree quark and the .makeBufferData method to put the data in the searchable format\n~treedata = NearestN.makeBufferData(KDTree(x, lastIsLabel: true));\n// Load the data to the server\n~treebuf = Buffer.sendCollection(s, ~treedata.flat, 5);\n// Run a synth with the ugen and some kind of query data\n~synth = { NearestN.kr(~treebuf, {LFNoise0.kr\n// …\n```"}, {"role": "assistant", "content": "Find/make a dataset of points: Append the index onto the end, for later reference (NearestN: Find the nearest-neighbours in a set of points)"}]} -{"conversations": [{"role": "user", "content": "How do I pan notes around the stereo field in a pattern?"}, {"role": "assistant", "content": "Put `\\pan` in the Pbind: the default instrument understands it and passes it to Pan2.\n\n```supercollider\n(\nPbind(\n \\scale, Scale.minorPentatonic,\n \\degree, Pseq([0, 2, 4, 7, 9, 7, 4, 2], inf),\n \\dur, 0.2,\n \\pan, Pseq([-1, -0.5, 0, 0.5, 1, 0.5, 0, -0.5], inf),\n \\amp, 0.15\n).play;\n)\n```\n\nTo pan an arbitrary synth, add a `pan = 0` argument to the SynthDef and wrap the output in\n`Pan2.ar(sig, pan)`."}]} -{"conversations": [{"role": "user", "content": "What does `Object.awake` do? What arguments does it take?"}, {"role": "assistant", "content": "This method is called by a Clock on which the object was scheduled when its scheduling time is up. It calls #-next, passing on the scheduling time in beats as an Arguments: beats — The scheduling time in beats. This is equal to the current logical time (Thread#-beats).; seconds — The scheduling time in seconds. This is equal to the current logical time (Thread#-seconds).; clock — The clock on which the object was scheduled.."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Pisano Periods are used to generate melodies."}, {"role": "assistant", "content": "```supercollider\n/*\nThe Fibonacci-sequence as controlsignal: melodies from Pisano Periods.\nBecause the sequence runs more or less exponentially, it seems best to assign the values to frequencies. \n*/\ns.boot;\nSynthDef( \\puls, {|freq=30, out|\n Out.ar(out,\n SinOsc.ar(freq, mul: 0.5*EnvGen.kr(Env.perc(0.01,0.75), doneAction: 2)),0)\n}).add;\n(\nm=3000; //max index, 5 minutes = 300 when dur=0.1\na=Array.newClear(m);//two arrays to store numbers from the Pisano Periods\nb=Array.newClear(m);\na.put(0,0); \na.put(1,1);\nd=2; //even divisor\ni=2; //index\nwhile ({i 0).postln;\nd.add(\\robot -> 1).postln; // Add robot as a key with a value of 1\nd.add(\\monkey -> 2).postln; // Replaces the value for the key monkey with 2\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nd = Dictionary.new;\nd.add(\\monkey -> 0).postln;\nd.add(\\robot -> 1).postln; // Add robot as a key with a value of 1\nd.add(\\monkey -> 2).postln; // Replaces the value for the key monkey with 2\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is rq in BPF.ar?"}, {"role": "assistant", "content": "rq is the reciprocal of Q, so it is a bandwidth control, not a Q control. Small rq means a narrow, resonant band; large rq means a wide, gentle one. The signature is `BPF.ar(in, freq, rq, mul, add)`. A common idiom is `rq = 0.3` for a broad sweep and `rq = 0.02` for a whistle. The same rq convention applies to RLPF and RHPF."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n~name = \\test_noise_burst;\n~description = \"A short burst of enveloped noise that goes well with Patterns\";\n~channelLayout = \\mono;\n\n~function = { arg amp=1, trimDB = 0, attack = 0.01, release = 0.3;\n var env;\n env = EnvGen.ar(Env.perc(attack, release, 0.5), doneAction: Done.freeSelf);\n trimDB.dbamp*amp*PinkNoise.ar(1);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "What does `BusPool.makeBusFromSpec` do? What arguments does it take?"}, {"role": "assistant", "content": "bus allocator with retain/release counting for shared busses Arguments: busSpec; server; client; name."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `DelTapWr`."}, {"role": "assistant", "content": "```supercollider\n// a Buffer for the UGens to use\nb = Buffer.alloc(s, 44100, 1);\n\n// write a signal into a delay, tap it at multiple times\nSynthDef(\\write, { |buffer, cout|\n var src, tapPhase, tap1, tap2, tap3;\n src = WhiteNoise.ar(0.2) * Decay.kr(Dust.kr(3), 0.7);\n tapPhase = DelTapWr.ar(buffer, src);\n Out.kr(cout, tapPhase);\n }).add;\n\nSynthDef(\\readFilt, { |out, buffer, cin|\n var phase, src, filt;\n phase = In.kr(cin);\n src = DelTapRd.ar(buffer, phase, [0.01, 0.2]);\n filt = BPF.ar(src, 880, 0.01) * 10;\n Out.ar(out, filt);\n}).add;\n\nc = Bus.control;\n\nx = Synth(\\write, [\\buffer, b, \\cout, c]);\ny = Synth(\\readFilt, [\\buffer, b, \\cin, c]);\n\nx.free;\nb.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// crossfading a mono source between two outs\n\n(\nx = {\n DXFan.ar(\n Dseq([0, 1], inf),\n PinkNoise.ar(0.05),\n fadeTime: 1\n )\n}.play\n);\n\nx.release\n\n\n// Crossfading a stereo source between two outs,\n// for more than two channels size has to be passed.\n\n(\n{\n DXFan.ar(\n Dseq([0, 2], inf),\n `(Saw.ar(50 * [1, 5], 0.03)),\n size: 4,\n fadeTime: 0.1\n )\n}.plot(0.2)\n);\n\n\n// crossfading a mono source between several outs\n\n(\n{\n DXFan.ar(\n Dseq([0, 3, 1, 2], inf),\n BPF.ar(Pink\n// …\n```"}, {"role": "assistant", "content": "crossfading a mono source between two outs Crossfading a stereo source between two outs, (DXFan: crossfades signals within a multichannel array according to demand-rate control)"}]} -{"conversations": [{"role": "user", "content": "What is `Canvas3D` in SuperCollider?"}, {"role": "assistant", "content": "Canvas3D — 3D vector graphics canvas Canvas3D provides a simple wire-frame 3D vector graphics canvas. It displays a list of Canvas3DItems, and can be transformed and animated. Category: GUI > 3D."}]} -{"conversations": [{"role": "user", "content": "What does `Instr.name` do?"}, {"role": "assistant", "content": "the symbolized version of the name: [\\one,\\two,\\three] dotNotation is usually nicer to work"}]} -{"conversations": [{"role": "user", "content": "What does `SimpleNumber.airyAiPrime` do?"}, {"role": "assistant", "content": "Returns the derivative of the Airy function Ai at"}]} +{"conversations": [{"role": "user", "content": "Explain `PV_XFade` in SuperCollider briefly."}, {"role": "assistant", "content": "PV_XFade — one kind of spectral morphing Interpolates bins between two fft buffers by interpolating each bin's complex (Cartesian) coordinates. Category: UGens > FFT."}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for smooth arpeggio, updated envelope (a SuperCollider snippet): bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\bass, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.perc(0.2), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n~pad = Synth(\\pad, [\\freq, 165]);\n~pad.set(\\gate, 0);\n```"}, {"role": "assistant", "content": "It starts a sustained synth and then releases it.\n\n`Synth(\\pad, [\\freq, 165])` creates an instance of a SynthDef that takes a `gate` argument (default 1). The\narray after the name is alternating argument names and values: `\\freq, 165`. Setting `\\gate` to 0 does not\ncut the sound dead — the EnvGen inside sees the gate close and runs the release stage of its Env, then frees\nthe Synth because that EnvGen has `doneAction: 2`. This is the standard lifecycle for pads, drones and any\nsound you want to stop gracefully."}]} {"conversations": [{"role": "user", "content": "What are the server's default sample rate and block size?"}, {"role": "assistant", "content": "44100 Hz and 64 samples per block by default, so the control rate is 44100/64 = 689.06 Hz. You can read them from the language with `s.sampleRate` and `s.options.blockSize`, or from inside a Synth with `SampleRate.ir` and `ControlRate.ir`. A `.kr` signal therefore updates about 689 times a second, which is why it is smooth enough for filters and envelopes but not for audio-rate FM."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n var mod = SinOsc.ar([0.1,0.15,0.2]).range(0,1);\n var saw = LFSaw.ar([10,12,15]);\n var out = (saw - ((saw>0)*mod)+(mod*0.5));\n Splay.ar(out)*0.4;\n}.play;\n\n{\n var mod = SinOsc.ar([0.1,0.15,0.2]).range(0,1);\n var saw = SinOsc.ar(LFSaw.ar([10,12,15]).range(200,300));\n var out = (saw - ((saw>0)*mod)+(mod*0.5));\n Splay.ar(out)*0.4;\n}.play\n)\n```"}, {"role": "assistant", "content": "Made with code from Jonatan Liljedahl and Glen Fraser. Based on the Korg Z1 sawtooth oscilator."}]} -{"conversations": [{"role": "user", "content": "What does `OpenObject.avoidTheWorst` do?"}, {"role": "assistant", "content": "A Boolean to de/activate a layer of extra protection. By default this is true and will block strings that contain `unixCmd`, `systemCmd`, `Pipe` and `File`. To turn off the protection set this to false."}]} -{"conversations": [{"role": "user", "content": "What does `MxChannel.prepareToBundle` do? What arguments does it take?"}, {"role": "assistant", "content": "a group of MxUnits Arguments: parentGroup; bundle; private; bus; groupToUse."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//multiple objects within a world with gravity force\n//color and size depends on object's mass\n\n(\nvar width= 300, height= 300, w, wgrav, world, n= 80;\n\n//--world\nw= RedWindow(\"vector test\", Rect(128, 64, width, height)).front;\nwgrav= RedVector2D[-0.1, 0.98]; //world xy gravity\nworld= RedWorld3(RedVector2D[width, height], wgrav, 20, 0.2); //dim,grav,maxvel,damp\n\n//--objects\n{\n var mass= 1.0.rrand(4); //random mass for each object\n RedObject(world, RedVector2D[width, 20].rand, 0, 0, mass, mass*5); //world,loc,vel,acc,mass,size\n}.dup(n);\n\n//--loop\nw.draw{\n world.objects.do{|o|\n o.addForce(world.gravity);\n o.update;\n world.contain(o);\n\n //--render\n Pen.strokeColor= Color.grey(o.mass/4);\n Pen.strokeRect(Rect.aboutRedObject2D(o));\n };\n};\nw.play;\nCmdPeriod.doOnce({w.close});\n)\n```"}, {"role": "assistant", "content": "multiple objects within a world with gravity force color and size depends on object's mass."}]} -{"conversations": [{"role": "user", "content": "I get 'Node not found' when I call .set on a Synth after a while."}, {"role": "assistant", "content": "The Synth was freed and the language still holds a reference. That happens whenever the SynthDef used `doneAction: 2` and the envelope finished, or when something called `freeAll`/`CmdPeriod`. Guard it with `if (x.notNil and: { x.isPlaying }) { x.set(\\freq, 300) }`, or store the node in a variable that you clear when it ends. For sustained sounds the right pattern is a `gate` argument with `doneAction: 2` on the EnvGen, so the node lives until you release it."}]} -{"conversations": [{"role": "user", "content": "What does `PageLayout.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a Window with a FlowView on it. The PageLayout object can be treated like a Window or like a Arguments: title — Window title; bounds — Bounds or nil. Default of nil will size the window to the entire screen size. Use .resizeToFit to shrink the window to the content size.; margin — FlowLayout margin.; background — Background color; scroll — boolean: add scroll bars or not.; front — boolean: whether to immediately display the window, bringing it to the front. default is true. You may choose to first add your views to the window and then front it which is useful for large slow GUIs. Returns: a PageLayout"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for pitch tracker utility."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\\pitchTrack, {\n var soundin = SoundIn.ar(0);\n var zc = ZeroCrossing.ar(soundin);\n // var pt = Pitch.kr(soundin);\n // var tt = Tartini.kr(soundin);\n SendReply.kr(Impulse.kr(1), '/pitchTrackUtil', [zc, zc.cpsmidi]);\n}).add;\n\n~pitchTrack = {\n if(~pitchTrackSynth.isNil or: { ~pitchTrackSynth.isRunning.not }, {\n ~pitchTrackSynth = Synth(\\pitchTrack);\n ~pitchTrackNW = NodeWatcher.register(~pitchTrackSynth);\n }, {\n ~pitchTrackSynth.free;\n ~pitchTrackSynth = nil;\n \"Pitch tracker stopped.\".postln;\n });\n};\n\n~pitchTrackOSCFunc = {\n OSCFunc({\n | msg |\n (\"Pitch:\"+msg[3].round.asString.padLeft(5)+msg[4].round.asString.padLeft(3)).postln;\n }, '/pitchTrackUtil');\n};\n\n~pitchTrackOSCFunc.();\n\nCmdPeriod.add({~pitchTrackOSCFunc.();});\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `LinXFade2` in SuperCollider briefly."}, {"role": "assistant", "content": "LinXFade2 — Two channel linear crossfade. Two channel linear crossfader. Category: UGens > Multichannel > Select."}]} -{"conversations": [{"role": "user", "content": "Explain `CXAbstractLabel` in SuperCollider briefly."}, {"role": "assistant", "content": "CXAbstractLabel — parent class for Label classes Category: Libraries > crucial > GUI > abstract."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LatoocarfianN`."}, {"role": "assistant", "content": "```supercollider\n// default initial params\n{ LatoocarfianN.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\envfol;\n~description = \"Envelope follower (audio rate)\";\n~channelLayout = \\mono;\n~function = {|in = 0, decaycoeff = 0.99, amp = 10.0, lpf = 20 |\n var env, out;\n in.scope;\n env = LPF.ar(PeakFollower.ar(in), lpf, mul: 50, add:-1);\n env.scope;\n env;\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "What does `SoundFileView.scroll` do? What arguments does it take?"}, {"role": "assistant", "content": "Scrolls by a fraction of the visible Arguments: A Float.."}]} -{"conversations": [{"role": "user", "content": "What does `ControlPatchOut.scalar` do? What arguments does it take?"}, {"role": "assistant", "content": "manages a Player's output when connecting to other Players Arguments: scalarPatchIn."}]} -{"conversations": [{"role": "user", "content": "What does `Boolean.keywordWarnings` do?"}, {"role": "assistant", "content": "turn on/off warnings if a keyword argument is not"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nSynthDef(\\madtraffic, {|out, sig, gate=1, freq=440|\n // doneAction: 2 rilascia la synth quando EvnGen ha finito\n sig = (Blip.ar(freq)*0.7+Blip.ar(freq/2+Rand(1,12))*0.7)\n*EnvGen.kr(Env.asr(0.1, 0.3, 0.3), gate, doneAction:2);\n sig = RLPF.ar(sig,SinOsc.kr(0.3, 0, 200, 1500), 0.1);\n sig = FreeVerb.ar(sig, 0.5, 0.5, 0.5);\n Out.ar(out, sig);\n\n}).add;\n);\n\n(\nPbind(\n \\instrument, \\madtraffic,\n \\freq, Pseq([137, 373, Prand([237, 473, 713],1)], inf),\n \\legato, Pseq([1.7, 0.3], inf),\n \\dur, 0.3,\n \\out, Pseq([1, 0], inf)\n).play;\n)\n```"}, {"role": "assistant", "content": "\"It's the lack of eye contact that makes us more idiots, to the point that convertible riders give less to escalation. Closed in the car, explain the psychologists, we regress to childhood and react by shouting, or with that surrogate of the shock that is the horn.\"\r\n\r\n\r\n\r\nhttp://bz-buzz.blogspot.com/2018/09/mad-traffic.html\r\n\r\nhttp://bzakirasantjago.blogspot.it/."}]} -{"conversations": [{"role": "user", "content": "Approaches to recording generated midi in DAW?"}, {"role": "assistant", "content": "SuperCollider forum — Approaches to recording generated midi in DAW?\n\nToday I spent another 6 hours or so trying to record in ardour (linux) both the midi information generated by supercollider and the audio generated by sending this midi to external synths. I finally hit the right combination of magic to make it work and I want to add my recipe in this thread so that I can find it back the future (and perhaps it also works for someone else).\n\nIngredient 1: a2jmidid. You can run it manually on the command line using “a2jmidid -e” or (like me) you can just use the “start midi bridge” button in the jack front-end application “Cadence” (enable the “export hardware ports checkbox”)\n\nIngredient 2: In supercollider itself, it is extremely important to only connect to a port and not to specify a destination uid. It seems that by specifying a destination uid, supercollider gets some kind of direct connection to the midi destination and ardour can no long introspect/record what is happening (I know it doesn’t sound scientific - this is purely the result of empiric observation/frustration.\n\nSo in supercollider, simply use\n\n```supercollider\n~synth1 = MIDIOut(0);\n~synth2 = MIDIOut(1);\n```\n\nand then in ardour’s Window->Midi Connections dialog, you can connect the out ports from supercollider to both your external synth and the track in which you want to record the midi information.\n\nFor midi driver in jack you can configure None.\n\nIf you want to record the generated midi in ardour, do NOT use connection syntax like\n\n```supercollider\n~synth1 = MIDIOut(0, MIDIClient.destinations[2].uid);\n```\n\nand do NOT use\n\n```supercollider\n~synth1 = MIDIOut.newByName(\"INTEGRA-7\", \"INTEGRA-7 MIDI 1\");\n```\n\nIf you just want to send midi to the external synth without recording the information, both previous ways of connecting work as well but these ways of connecting appear to work only if the jack MIDI driver is configured to use “ALSA sequencer” mode. It doesn’t seem to work with “None” or “ALSA Raw” (this may need some further investigation to clear out)."}]} -{"conversations": [{"role": "user", "content": "Write a granular texture in SuperCollider."}, {"role": "assistant", "content": "Read a sound file into a buffer, then trigger grains from it. Grain density is the Impulse rate and\ngrain length is dur; keep the density times the length under maxGrains or raise it.\n\n```supercollider\n(\ns.waitForBoot {\n ~buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n SynthDef(\\grain, { |out = 0, amp = 0.4, density = 30, dur = 0.08|\n var trig = Impulse.kr(density);\n var sig = GrainBuf.ar(2, trig, dur, ~buf, 1, LFNoise0.kr(2).range(0, 1), 2, 0, -1, 512);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n Synth(\\grain);\n};\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes playing Pbinds with a MIDI controller (QuNeo, etc)."}, {"role": "assistant", "content": "```supercollider\n// Running Fifths\n// (QuNeo demo)\n//\n//\n// Ctrl + A, then Ctrl + Enter\n\ns.waitForBoot({\n\n MIDIIn.connectAll;\n\n a = Array.fill(8, {arg count; [count, count+7] });\n\n f = {arg velocity, midinote;\n var notes = if(midinote>=44, {a.reverse+midinote}, {a+midinote});\n p = Pbind(\n \\midinote, Pstutter(Pwrand([1, 3, 5], [0.1, 0.8, 0.1], inf), Pseq(notes)),\n \\dur, 0.1,\n \\amp, velocity/127 * 0.8,\n \\legato, 0.1,\n \\ctranspose, Pstutter(8, Pwhite(0, 36))\n ).play(quant: 0.1);\n };\n\n MIDIdef.noteOn(\\test, { arg vel, note; /*note.postln;*/ f.value(vel, note) });\n\n});\n```"}]} -{"conversations": [{"role": "user", "content": "How do I set the tempo?"}, {"role": "assistant", "content": "TempoClock.default.tempo = 120/60; the argument is beats per second, so 120 BPM is 2.0. Patterns scheduled on the default clock then follow it."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// Evaluate this to start your project\n// The Cactus instnce is stored in c by convention\n\nc = CactusGUI(Document.current.dir).cactus; // with GUI\nc = Cactus(Document.current.dir); // without GUI\n\n/*\n\nAny folder with sound files you place in the buffers folder becomes available\nwith the following syntax:\n\n c.buffers.at(\"[folder_name]/[file_name_without_extension]\").play;\n\nYou can also access the folder as a List\n\n c.buffers.at(\"[folder_name]\");\n\n*/\n\n// You can use the dictionary at .at to store anything you like. For example:\n\nc.at[\\exampleVariable] = 10000.rand;\n\n// Get the value\n\nc.at[\\exampleVariable];\n```"}, {"role": "assistant", "content": "Evaluate this to start your project The Cactus instnce is stored in c by convention."}]} -{"conversations": [{"role": "user", "content": "What does `MultiOutUGen.initOutputs` do? What arguments does it take?"}, {"role": "assistant", "content": "Create an array of OutputProxies for the Arguments: numChannels — Number of outputs. Must be a nonzero, positive integer. This is fixed when the SynthDef is compiled so cannot be assigned to a SynthDef argument.; rate — The rate of the OutputProxy.."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// proceed with caution. start at min volume, and not with your expensive speakers.\n\nfork{b=Buffer.alloc(s,512,1);inf.do{b.cheby({[1,0].choose}!2);{(Shaper.ar(b,SinOsc.ar(55,0,Line.kr(1,0,2,1,0,2))))!2}.play;0.1.wait;}};\n```"}, {"role": "assistant", "content": "can anyone tell me what the loud click is, and how to control it?\r\n\r\ni kind of really like it, but it sounds scary, \r\n\r\nand the resulting waveform is bizarre, too.\r\n\r\n[http://soundcloud.com/tengototen/m-chtegern-ikeda](http://soundcloud.com/tengototen/m-chtegern-ikeda)\r\n\r\n\r\nupdate: some discussion, and lots of interesting things to try out, [on the list](http://new-supercollider-mailing-lists-foru."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\na = {\n var dur;\n\n dur = 0.1;\n\n LFTri.ar(100+(1000*Maths2.ar(dur/2, dur/2, 0.99, 1, 0, 1, LFNoise0.ar(1/dur).range(0,1))[0]), 0, 0.1)\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\na = {\n var dur;\n\n dur = 0.1;\n\n LFTri.ar(100+(1000*Maths2.ar(dur/2, dur/2, 0.99, 1, 0, 1, LFNoise0.ar(1/dur).range(0,1))[0]), 0, 0.1)\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n \n// definition for future reference in arbitrary Environments\n\n(\np = Pbind(\n \\midinote, PLnaryop('+', \\src, [\\dev]),\n \\dur, 0.1\n);\n);\n\n\n// define Environment and play\n\n(\ne = (src: PLseq([61,62]), dev: Pbrown(-5, 5, 0.2) );\n\ne.use { x = p.play };\n);\n\n\n// replace\n\ne.dev = PLseq((0, 0.5..7));\n\ne.dev = Pbrown(-5, 5, 0.2);\n\ne.src = PLseq([61,64,65]);\n// …\n```"}, {"role": "assistant", "content": "definition for future reference in arbitrary Environments define Environment and play (PLnaryop: dynamic scope Pnaryop variant)"}]} +{"conversations": [{"role": "user", "content": "Explain `FoaXform` in SuperCollider briefly."}, {"role": "assistant", "content": "FoaXform — First Order Ambisonic (FOA) matrix transformer Transforms (spatial domain filter) a First Order Ambisonic signal (B-format). FoaXform provides static initial rate transforms, for continuously varying dynamic transforms transforms see FoaTransform. Category: Libraries > Ambisonic Toolkit > UGens > FOA > Transformer, UGens > Multichannel > Ambisonics."}]} +{"conversations": [{"role": "user", "content": "What is `Pdef`?"}, {"role": "assistant", "content": "Pdef — stream reference definition"}, {"role": "user", "content": "What does `Pdef.all` do?"}, {"role": "assistant", "content": "A global IdentityDictionary with all proxies."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\nPdef(\\x, Pbind(\\note, Pbrown(0, 6, 0.1, inf)));\nPdef(\\x).quant = 0; // no waiting.\nPbindf(Pdef(\\x), \\dur, 0.03).play;\nPbindf(Pdef(\\x), \\dur, 0.1, \\ctranspose, 15).play;\nPbindf(Pdef(\\x), \\dur, 0.3, \\ctranspose, 2).play;\n// now change the definition\nPdef(\\x, Pbind(\\note, Pseq([0, 3, 5, 7, 9, 11], inf)));\nPdef(\\x, Pbind(\\freq, Pseq([1000, 1923, 245.2, 1718] / 1.2 + 0.1, inf)));\n```"}]} {"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// larger pitch range and lookBack in upper voice \n// as with most patterns, no automatic array expansion of pattern arguments\n\n(\n~src = Pseg(Pseq([65, 85], inf), 5, \\sin).round;\n\np = Pbind(\n \\dur, 1/7,\n \\midinote, Ptuple([\n PLIdev(\\src, 1, -1, 1),\n PLIdev(\\src, 3, -5, 5) + 8.5\n ]).trace(prefix: \"midi \"),\n).play;\n);\n\np.stop\n```"}, {"role": "assistant", "content": "larger pitch range and lookBack in upper voice as with most patterns, no automatic array expansion of pattern arguments (PLIdev: dynamic scope pattern searching for numbers with integer distance from a source pattern, optionally avoiding repetitions within a span)"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `HPZ2`."}, {"role": "assistant", "content": "```supercollider\n// Compare:\n\n{ WhiteNoise.ar(0.25) }.play;\n\n{ HPZ2.ar(WhiteNoise.ar(0.25)) }.play;\n\n// HPZ2 is useful to detect changes in a signal:\n// see also HPZ1\n(\n{\n var changingSignal = LFNoise0.ar(1000);\n var hpz2 = HPZ2.ar(changingSignal);\n [hpz2, hpz2 > 0]\n}.plot\n);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Image.getPixel` do?"}, {"role": "assistant", "content": "retrieve the pixel value at x @ y as a RGBA integer `// A simple example on how to manipulate pixels with"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n/* Audio plugin definition\n\n Each audio plugin should define the following global variables:\n ~name: (symbol) name of the spatializer\n ~description: (string) a short description\n ~function: the actual definition of the plugin\n\n*/\n\n~name = \\emptySource;\n~description = \"dummy/template\";\n~channelLayout = \\mono;\n\n~function = {\n DC.ar(0);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "What is `AllpassL` in SuperCollider?"}, {"role": "assistant", "content": "AllpassL — Schroeder allpass delay line with linear interpolation. A Schroeder allpass filter is given by the difference equations Category: UGens > Delays."}]} -{"conversations": [{"role": "user", "content": "What does `Object.postln` do?"}, {"role": "assistant", "content": "Print a string representation of the receiver followed by a newline. `\"hello\".postln; \"hello\".postln;"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `RunningSum`."}, {"role": "assistant", "content": "```supercollider\n// distorts of course - would need scaling\n{ RunningSum.ar(SoundIn.ar) }.play\n\n// Running Average over x samples\n(\n{\n var x = 100;\n RunningSum.ar(LFSaw.ar, x) * (x.reciprocal)\n }.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.plotTree;\n\n// Define and play a repeating pattern that generates a new synth every 0.4 seconds:\nx = Pn((dur: 0.4, midinote: 69, amp: 0.1).play;\n\n/*\nThe NodeTreeView window dynamically displays active synth nodes.\nInitially, it shows the first node, and upon each refresh, it retains the previous node while adding a new one.\nThis results in the display of one or two subsequent nodes at each interval.\n*/\n\n// stop updating plotTree:\ns.nodeTreeView.stop;\n\n// start updating plotTree:\ns.nodeTreeView.start;\n\n// stop the playback of the pattern:\nx.stop;\n\ns.nodeTreeVie\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.plotTree;\n\n// Define and play a repeating pattern that generates a new synth every 0.4 seconds:\nx = Pn((dur: 0.4, midinote: 69, amp: 0.1)).play;\n\n/*\nThe NodeTreeView window dynamically displays active synth nodes.\nInitially, it shows the first node, and upon each refresh, it retains the previous node while adding a new one.\nThis results in the display of one or two subsequent nodes at each interval.\n*/\n\n// stop updating plotTree:\ns.nodeTreeView.stop;\n\n// start updating plotTree:\ns.nodeTreeView.start;\n\n// stop the playback of the pattern:\nx.stop;\n\ns.nodeTreeView.close;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// try wiggling mouse quickly:\n// LFNoise2 overshoots when going from high to low freqs, LFDNoise changes smoothly.\n\n{ SinOsc.ar(LFNoise2.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n{ SinOsc.ar(LFDNoise3.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFNoise2.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n\n{ LFDNoise3.ar(XLine.kr(2000, 20000, 8), 0.1\n// …\n```"}, {"role": "assistant", "content": "try wiggling mouse quickly: LFNoise2 overshoots when going from high to low freqs, LFDNoise changes smoothly. (LFDNoise3: Dynamic cubic noise)"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Monzo function?"}, {"role": "assistant", "content": "```supercollider\n// https://en.xen.wiki/w/Monzo\n//Monzo notation of JI ratios is often used in combination with Vals for temperament theory. I wrote this not for temperament, but rather to use monzos as a possible alternative to otonality and utonality, espescially when sonifying streams that include negative numbers.\n\n(//function that takes a collection representing a monzo as an argument, and outputs the ratio it encodes\n~zo = {\n arg exponentCollection;\n var ratio = 1;\n exponentCollection.do({arg item, i; ratio = ratio * (i.nthPrime).pow(item);});\n ratio;\n};\n);\n\n//5-limit\n~zo.([-1, 1]); // 3/2\n~zo.([-2, 0, 1]); // 5/4\n~zo.([-3, 2]); // 9/8\n~zo.([-4, 4, -1]); // 81/80\n~zo.([-4, 4, -1]); // 81/80\n\n//7-limit\n~zo.([-2, 0, 0, 1]); // 7/4\n~zo.([-1, -1, 0, 1]); // 7/6\n~zo.([0, 0, -1, 1]); // 7/5\n\n//fractional monzos\n~zo.([-1/2, 3.3, 4, -5]); //sure\n//it might be fun to do monzo glissandos in different places?\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ LPF.ar(Saw.ar(100), SinOsc.kr(0.5).exprange(200, 2000)) * 0.2 }.play;\n```"}, {"role": "assistant", "content": "A sawtooth through a low-pass filter whose cutoff is swept slowly up and down — a classic filter\nsweep.\n\n- `Saw.ar(100)` is a 100 Hz sawtooth, rich in harmonics.\n- `SinOsc.kr(0.5)` is a control-rate sine at 0.5 Hz, so one full cycle takes 2 seconds.\n- `.exprange(200, 2000)` maps that -1..1 sine exponentially onto 200..2000 Hz — exponential is the right\n mapping for frequency, because we hear pitch logarithmically.\n- `LPF.ar(sig, cutoff)` removes harmonics above the cutoff; as it opens and closes you hear the tone\n brighten and darken.\n- `* 0.2` keeps the output from clipping."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n/// measuring lastUpdateTime from MKtls,\n/// to display which interfaces were recently active\n~time = ();\n~time.actives = [ MKtl(\\ntmi), MKtl(\\uc4), MKtl(\\ferrari) ];\n~time.times = ();\n~time.spec = [1000, 1, \\exp].asSpec;\n~time.actives.do { |mk| ~time.times.addSpec(mk.name, ~time.spec) };\n\n~time.egui = EnvirGui(~time.times);\n\n~time.times.getSpec\n\n~time.skip.stop.free;\n~time.skip = SkipJack({\n ~time.actives.do { |mk|\n ~time.times.put(mk.name, mk.timeSinceLast)\n }\n});\n~time.skip.dt = 0.5;\n\nMKtl(\\ntmi).elAt(\\battery).action.cs;\n\nl = List.new(1024);\nMKtl(\\ntmi).elAt(\\battery).action = { |el|\n var val = el.deviceValue;\n // l.add(val);\n // val.postln;\n // if (val > 0) { val.postln };\n};\n\nl.postcs;\n```"}, {"role": "assistant", "content": "measuring lastUpdateTime from MKtls, to display which interfaces were recently active."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Here we start with initOutOffset = 0.5, fadeMode = 1 (step first),\n// channels with indices 0 and 4 (base tone and 5th partial) are equally weighted.\n\n(\nx = {\n var lfo = XLine.ar(1, 0.5, 60);\n DXMix.ar(\n Dseq([0, 4, 1, 5, 2, 6, 3, 7], inf),\n `(Saw.ar((1..8) * 70 * lfo, 0.075)),\n fadeTime: 0.1,\n stepTime: 2,\n fadeMode: 1,\n width: 3,\n maxWidth: 8,\n initOutOffset: 0.5\n ) ! 2\n}.play\n;\n\nx.release\n\n\n// overlap scheme with width = 3 and initOutOffset = 0.5:\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Here we start with initOutOffset = 0.5, fadeMode = 1 (step first),\n// channels with indices 0 and 4 (base tone and 5th partial) are equally weighted.\n\n(\nx = {\n var lfo = XLine.ar(1, 0.5, 60);\n DXMix.ar(\n Dseq([0, 4, 1, 5, 2, 6, 3, 7], inf),\n `(Saw.ar((1..8) * 70 * lfo, 0.075)),\n fadeTime: 0.1,\n stepTime: 2,\n fadeMode: 1,\n width: 3,\n maxWidth: 8,\n initOutOffset: 0.5\n ) ! 2\n}.play\n);\n\nx.release\n\n\n// overlap scheme with width = 3 and initOutOffset = 0.5:\n```"}]} -{"conversations": [{"role": "user", "content": "What does `TempoClock.bar` do?"}, {"role": "assistant", "content": "Returns the current bar. See #-bars2beats for returning beat of current"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes blipecho context."}, {"role": "assistant", "content": "```supercollider\n( \nSynthDef(\\klang_blip, { \n | out = 0, release = 1, freq1 = 1, freq2 = 5, freq3 = 8, freq_mul = 4, atk_dur = 0.01, amp = #[0.3,0.3,0.3], mod_freq = 25 | \n var sig = DynKlang.ar(\n `[([freq1, freq2, freq3].linexp(1,12,1,1140) * freq_mul), amp, nil ], \n EnvGen.kr(Env([5,1.05,0.95,0.01],[0.025,release*3/4,release/4])), \n 150\n ) * LFGauss.kr(mod_freq.reciprocal, 0.3);\n Out.ar(out, (sig/8)!2 * Linen.kr(Impulse.kr(0), atk_dur, 1, release, doneAction:2)) \n}).add;\n\nSynthDef(\\dubecho,{|in, out, length = 1, fb = 0.8, sep = 0.012|\n var input = In.ar(in, 2);\n var feedback = LocalIn.ar(2);\n var output = LeakDC.ar(feedback*fb + input);\n output = HPF.ar(output, 400);\n output = LPF.ar(output, 12000);\n output = output.tanh;\n LocalOut.ar(DelayC.ar(output, 1, LFNoise2.ar(12).range([length,length+sep],[length+sep,length])).reverse);\n ReplaceOut.ar(out, output);\n}).add;\n);\n\n( \n~bus = Bus.audio(s, 2);\n~echo = Synth(\\dubecho, [\\in, ~bus, \\length, TempoClock.default.tempo*(3/8), \\fb, 0.25, \\sep, 0.0012], addAction: \\addToTail);\n\nPbind(*[ \n instrument: \\klang_blip, \n dur: Pwrand([0.25,0.5,1,0.125], [16,16,1,1].normalizeSum, inf), \n release: Pkey(\\dur),\n freq_mul: Pstutter(Pwrand([1,2,4],[5,3,2].normalizeSum,inf), Pxrand((1..6), inf)),\n freq1: Pstutter(Pxrand((2,4..16), inf), Prand((1..4), inf)), \n freq2: Pstutter(Pxrand((2,4..16), inf), Prand((4..8), inf)), \n freq3: Pstutter(Pxrand((2,4..16), inf), Prand((8..12), inf)),\n mod_freq: Pstutter(Pxrand((2,4..16), inf), Pbrown(7,30,3)),\n atk_dur: Pkey(\\freq_mul).linlin(12,2,0.01,0.4),\n out: ~bus,\n amp: Pstutter(Pxrand((2,4..16),inf), Pfunc({[2,3,4].normalizeSum.scramble}))\n]).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Hymn #15 - generative melody by array rewriting?"}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\ping, {\n arg freq = 440, pan = 0;\n var sig;\n sig = SinOsc.ar(freq, 0, 0.3);\n sig = sig * EnvGen.ar(Env.perc(0.01, 1), doneAction:2);\n sig = Pan2.ar(sig, pan);\n Out.ar(0, sig)\n}).add;\n);\n\n(\n~scramb = {|pan|\nvar notes = [0,4,7,14,9,12,4,7,9,7];\nvar dur = [1,1,2,3,6,3,4,5,2,1,13];\nvar transp = [0, 5, 7, 3, 2];\nvar scrambRand = {|array|\n var rand = rrand(0, array.size-3);\n var end = rand + rrand(1,2);\n var range = (rand..end);\n var reverseRange = range.reverse;\n var temp = array.copy;\n range.postln;\n range.do({|item, index|\n array[item] = temp[reverseRange[index]];\n });\n array;\n};\nvar octRand = {|array|\n var rand = rrand(0, array.size-1);\n array[rand] = array[rand] + [-12,0,12].choose;\n };\nvar task = Task {\n var step = 0;\n var transpStep = 0;\n loop {\n var freq = (notes.wrapAt(step) + 60 + transp.wrapAt(transpStep)).midicps;\n Synth(\\ping, [\\freq, freq, \\pan, pan]);\n (dur.wrapAt(step) * 0.15).wait;\n step = step + 1 % (notes.size * 12;);\n if (step%32 == 0, {scrambRand.value(notes)});\n if (step%20 == 0, {scrambRand.value(dur)});\n if (step%66 == 0, {transpStep = transpStep + 1 % (transp.size)});\n if (step%24 == 0, {notes = notes.rotate(rrand(-1, 1))});\n if (step%56 ==0, {octRand.value(notes)});\n }\n}.play;\n};\n);\n\n(\n~scramb.value(-0.7);~scramb.value(0.7);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for reqs: sc3-plugins."}, {"role": "assistant", "content": "```supercollider\n(\nfork {\n TempoClock.tempo = 1;//156/60;\n Ndef(\\ttso).play;\n loop {\n var seed = thisThread.randSeed = 100000000.rand.debug('seed');\n var wait = 20.rrand(60).debug('wait');\n Ndef(\\ttso, {\n var gamma= {[rrand(30,50),rrand(50,70),rrand(50,70),rrand(70,100)].choose.midicps*LFNoise2.kr(1,0.01,1)}!24;\n Pan2.ar(\n LeakDC.ar(\n Normalizer.ar(\n BPeakEQ.ar(\n FreeVerb.ar(\n Splay.ar(RLPF.ar(LFSaw.ar(gamma)/4,gamma*LFCub.kr(rrand(0.01,0.1),0,2,3),LFNoise2.kr(1/8,0.6,0.7))),\n 0.1,0.1,0.1\n ),\n [100.rrand(200),1000.rrand(2000),5000.rrand(7000),10000.rrand(15000)],Array.rand(4,0,6),Array.rand(4,0,6)\n ).mean,\n 0.8,0.1\n )\n ),\n LFNoise2.kr(0.1.exprand(10)).range(-0.1,0.1),\n SelectX.kr(\n [SinOsc,LFTri].choose.kr(2.rrand(25).reciprocal).range(0,2),\n [\n 0.7.rrand(1),\n LFGauss.kr(\n Latch.kr(\n LFNoise2.kr(1).range(1/5,5.rrand(20)).reciprocal, \n Impulse.kr(LFNoise2.kr(3.rrand(10).reciprocal).range(0.5,3.rrand(6)))\n ),\n SinOsc.kr(3.rrand(15).reciprocal).range(0.07.rrand(0.16),0.25.rrand(0.4))\n ),\n 0.1.rrand(0.5)\n ]\n )\n )\n }).fadeTime_(3.rrand(6));\n wait.wait;\n }\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Modes, scales, keys (tonal music) inside Pbinds."}, {"role": "assistant", "content": "```supercollider\n// MODES, SCALES, KEYS inside Pbinds\n\n// How to write Pbinds in a specific key, for example G minor\n// (using \\scale and \\degree inside Pbind)\n\n(\nPbind(\n \\scale, Scale.minor, // natural minor scale\n \\degree, Pseq([0, 1, 2, 3, 4, 5, 6s, 7, 8, 9, 10, 11]), // s for sharp, b for flats as needed\n \\root, 7, // 0 is C, 1 is C#, etc. For G minor, we put the root at 7 (seven semitones above C)\n \\dur, 1/2\n).play\n);\n\n// \\degree considers 0 to be the first scale degree.\n// If you prefer to think of 1 as the first scale degree (like in \"movable do\" solfege), simply add -1 to the end of the line.\n// The example below is in Eb Major\n(\nPbind(\n \\scale, Scale.major,\n \\degree, Pseq([1, 2, 3, 4, 5, 6, 7, 8]) - 1,\n \\root, 3, // Eb Major\n \\dur, 1/2\n).play\n);\n\n// F Mixolydian #4\n(\nPbind(\n \\scale, Scale.mixolydian,\n \\degree, Pseq([1, 2, 3, 4s, 5, 6, 7, 8], 3) - 1,\n \\root, 5, // F mixolydian with #4\n \\dur, 1/4\n).play\n);\n\nScale.directory;\n```"}]} -{"conversations": [{"role": "user", "content": "What are the arguments of EnvGen?"}, {"role": "assistant", "content": "`EnvGen.ar(envelope, gate, levelScale, levelBias, timeScale, doneAction)` — or the .kr form. Envelope is an Env; gate is the signal that holds the envelope open (a number for a one-shot, a trigger or gate control for a sustained sound); levelScale and levelBias scale and offset the output; timeScale stretches durations. Use `doneAction: 2` on a one-shot so the Synth frees itself."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for julian rohrhuber (c 2007)."}, {"role": "assistant", "content": "```supercollider\n// julian rohrhuber (c 2007)\n\n(\nSynthDef(\"deepsea\", { arg out, pan=0, amp=0.1, variation=0.9;\n var dt, n, freq, mul, t, u;\n n = Rand(7, 46);\n dt = 25.0 + Rand(-1.7, 1.7);\n dt = dt + LFNoise2.kr(2, variation) * 0.001;\n freq = 901 + Rand(0, 65);\n t = Impulse.ar(dt.reciprocal, 0, 100);\n mul = PulseCount.ar(t) < n;\n u = BPF.ar(mul * t, freq, 0.1);\n u = BPF.ar(u, freq, 0.2);\n DetectSilence.ar(u, doneAction:2);\n Out.ar(out, Pan2.ar(u, pan, amp));\n}).add;\n);\n\n(\nSynthDef(\"deepsea\", { arg out, pan=0, amp=0.1, variation=0.9;\n var dt, n, freq, mul, t, u, count;\n n = Rand(7, 46);\n dt = 25.0 + Rand(-1.7, 1.7);\n dt = dt + LFNoise2.kr(2, variation) * 0.001;\n freq = 901 + Rand(0, 65);\n t = Impulse.ar(dt.reciprocal, 0, 100);\n count = PulseCount.ar(t);\n mul = count < n;\n u = BPF.ar(mul * t, freq, 0.1);\n u = BPF.ar(u, freq * (count % LFNoise1.kr(1).range(2, 20) + 1), 0.2);\n DetectSilence.ar(u, doneAction:2);\n Out.ar(out, Pan2.ar(u, pan, amp * 10));\n}).add;\n);\n\n\n\ns.sendMsg(\"/s_new\", \"deepsea\", -1);\n\n\np = ProxySpace.push(s.boot);\n\n~out.play;\n~out.fadeTime = 10;\n\n(\n~fish = Pbind(\n \\instrument, \\deepsea,\n \\dur, Pfunc #{ rrand(9.0, 2.0) },\n \\pan, Pfunc #{ 1.0.rand2 }\n );\n);\n\n~out = ~fish;\n~out[1] = \\filter -> #{ arg in; BPF.ar(in * 5, 700, 0.1) };\n\n(\n~out[2] = \\filter -> #{ arg in;\n CombL.ar(LPF.ar(in * LFNoise1.kr(0.1).max(0), 800), 0.5, 0.5) + in.reverse\n};\n);\n\n(\n~out[3] = \\filter -> #{ arg in; var x; x = in;\n 5.do { x = AllpassN.ar(x, 0.18, {0.06.rand} ! 2 + 0.06, 8) };\n LPF.ar(x + in, 400) + (LFNoise1.kr(0.2) * in)\n };\n\n);\n\n\n\n~out[1] = nil;\n~out[2] = nil;\n\n\np.clear(10).pop;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `RedHuffman.binaryStringToBytes` do?"}, {"role": "assistant", "content": "Converts a binary string into 8-bit bytes. Up to 7 zeros might be padded automatically at the end. The number of zeros is stored in #*pad. #*pad is semi-private and used when converting back to"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for 2 channels of chuckling sawtooths."}, {"role": "assistant", "content": "```supercollider\n//hall of mirrors\n{[AllpassC.ar(HPF.ar(RLPF.ar(Saw.ar(LFPar.kr(0.25).range(220,440)),LFPar.kr(MouseX.kr(0,8),pi).range(220,20000),0.3),LFPar.kr(MouseY.kr(0,8)).range(220,20000)),2,MouseX.kr(0,0.5),2),AllpassC.ar(HPF.ar(RLPF.ar(Saw.ar(LFPar.kr(0.25,pi).range(440,220)),LFPar.kr(MouseX.kr(8,0),pi).range(20000,220),0.3),LFPar.kr(MouseY.kr(8,0),pi).range(20000,220)),2,MouseX.kr(0.5,0),2)]}.play\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Server.sync_s` do?"}, {"role": "assistant", "content": "If kept true (default), when the default server is changed, also the interpreter variable s is changed. `Server.default = Server(\\alice, NetAddr(\"127.0.0.1\","}]} -{"conversations": [{"role": "user", "content": "What is `Saw` in SuperCollider?"}, {"role": "assistant", "content": "Saw — Band limited sawtooth. Band limited sawtooth wave generator. Category: UGens > Generators > Deterministic."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Entities (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\ota, { arg freq=200, pan=0, amp=0.1;\n var sig;\n var env1, env2, env3, env4, env5, env6, env7, env8;\n var sig1, sig2, sig3, sig4, sig5, sig6, sig7, sig8;\n var fac = 1/SelectX.kr( SinOsc.kr(1/113).range(0,6), [1/2,1,2,4,8,64,128] )/8;\n env1 = EnvGen.ar(Env([42,21,42,30,84],[4,4,7.5,0.5]/fac).circle, 1);\n env2 = EnvGen.kr(Env([0,0,2,1],[4,4,4]).circle, 1);\n env3 = XLine.kr(1,0.1,20*1);\n\n freq = 8.collect({ arg x;\n freq + ( env1 * x ) + [0,SinOsc.kr(x+1, mul:env2).range(0,10*x)];\n });\n //freq.debug.shape.debug(\"freq\");\n sig = SinOsc.ar( freq / [1,2,4]);\n //sig.shape.debug(\"sig1\");\n sig = sig.collect({ arg isig, x;\n isig = SelectX.ar( SinOsc.kr(x+1/34).range(0,1), [isig, isig.fold2(env3)]);\n isig = SelectX.ar( SinOsc.kr(1/223, 3pi/2).range(0,1), [isig, ( isig * SinOsc.kr(1/48 * ( x + 1 )).range(1,100) ).tanh]);\n });\n //sig.shape.debug(\"sig2\");\n sig1 = sig.flop[1];\n sig = sig.flop[0];\n //sig.debug(\"sig\");\n sig1 = Pan2.ar(sig1, SinOsc.ar(sig1.size.collect({ arg x; SinOsc.kr(x/10+1.2).range(0,8) })) * SinOsc.kr(1/48).range(0,1), amp).mean;\n sig = Pan2.ar(sig, SinOsc.ar(sig.size.collect({ arg x; SinOsc.kr(x/10+1.1).range(0,8) })) * SinOsc.kr(1/58).range(0,1), amp).mean;\n sig = sig + sig1;\n sig = sig / 2.0;\n sig = LPF.ar(sig, 1999);\n sig;\n}).play;\n);\n```"}]} -{"conversations": [{"role": "user", "content": "What is SuperCollider?"}, {"role": "assistant", "content": "SuperCollider is a platform for audio synthesis and algorithmic composition, written in C++ and SuperCollider. It splits into a language client (sclang) that runs your code and builds UGen graphs, and an audio server (scsynth) that does the DSP in real time. They talk over OSC."}]} -{"conversations": [{"role": "user", "content": "Splay - not getting spread, wrong use?"}, {"role": "assistant", "content": "SuperCollider forum — Splay - not getting spread, wrong use?\n\nYou need to undestand that if you have two identical signal coming from left and right it will always be mono. No stereo spread possible. So you need to introduce (at least) two different signals - and just different amplification will not really work.\n\nTo expand your first example, we can introduce an array of values for paramtere pos:\n\n```supercollider\n(\nx = { arg spread=1, level=0.2, center=0.0;\n Splay.ar(\n GrainBuf.ar(numChannels: 1,\n trigger: Impulse.kr(1.2875),\n dur: Impulse.kr(1.2875),\n sndbuf: b,\n pos:[0,0.5],\n interp: 1\n ),\n spread,\n level,\n center\n );\n}.play;\n);\n\nx.set(\\spread, 1, \\center, 0); // full stereo\nx.set(\\spread, 0, \\center, 0); // mono center\n```\n\nBy way of Multichannel Expansion this creates two different signals (channels, an array of 2 UGen graphs) that you can hear as different and therefore observe the stereo spread.\n\nAnd similarly, to use your other example with In.ar where I have added in=2, so that it takes my mic in (but you can specify another bus) and wrapped it into a feedback delay with an array of two values for delayTime. Multichannel expansion thus creates two channels that are different because they have different delaytimes but the rest of UGen graph is the same (a copy). Changing spread now works:\n\n```supercollider\n(\nSynthDef(\\stereo,{|out=0, in=2, spread=1, level=1, center=0.0|\n Out.ar(out,\n Splay.ar(\n CombN.ar(\n In.ar(in, 1), 1, [0.3,0.4], 2)\n ,spread,level,center));\n}).play;\n)\n```\n\nI hope that clarifies the issue better."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Josh Parmenter (2007) record scratcher?"}, {"role": "assistant", "content": "```supercollider\n// Josh Parmenter (2007)\n// record scratcher\n\nSynthDef(\\scratch, {arg gate = 1, buffer;\n var buf, speed, env;\n env = EnvGen.kr(\n Env([0,1,0], [0.1, 0.1], \\sin, 1),\n gate, doneAction: 20);\n speed = MouseX.kr(-10, 10);\n speed = speed - DelayN.kr(speed, 0.1, 0.1);\n speed = MouseButton.kr(1, 0, 0.3) + speed ;\n buf = PlayBuf.ar(1, buffer, speed * BufRateScale.kr(buffer), loop: 1);\n Out.ar(0, (buf * env).dup );\n}).add;\n\ns.boot;\n\n// path to a mono soundfile here\na = Buffer.read(s, ExampleFiles.child);\n\nb = Synth(\\scratch, [\\buffer, a]);\n\n// move mouse to scrub the record.\n// press mouse button to 'stop the record', you can scrub while it is stopped.\n\n// stop the synth\nb.set(\\gate, 0);\n// free the Buffer\na.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What is `PSVop_oi` in SuperCollider?"}, {"role": "assistant", "content": "PSVop_oi — Sieve pattern for arbitrary set operations of integer generators with offsets and interval output Pattern for arbitrary set operations of integer generators with offsets and interval output. For an introduction and more examples see Sieves_and_Psieve_patterns. Category: Libraries > miSCellaneous > Sieves and Psieve Patterns, Streams-Patterns-Events > Sieves and Psieve Patterns."}]} -{"conversations": [{"role": "user", "content": "How current is your SuperCollider knowledge?"}, {"role": "assistant", "content": "It comes from a snapshot of the SuperCollider repository (documentation, class library and examples) plus code I can reason about. So classes and arguments in that snapshot I know well, including argument order. Quarks, newer UGens, and anything outside the official tree I may not know at all, and I will say so rather than invent a method name. If you need certainty about a class, check its help page — `SinOsc.schelp` in the source tree is the authority."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LFSaw`."}, {"role": "assistant", "content": "```supercollider\n{ LFSaw.ar(500, 1, 0.1) }.play\n\n// used as both Oscillator and LFO:\n{ LFSaw.ar(LFSaw.kr(4, 0, 200, 400), 0, 0.1) }.play\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Duty`."}, {"role": "assistant", "content": "```supercollider\n(\n {\n var freq;\n freq = Duty.kr(\n Dseq([0.2, 0.3, 0.4, Dseq([1, 1, 1, 2, 1, 2], inf)]) / 2,\n Dust.kr(1), // control rate reset\n Dseq([0, 1, 2, Dseq([1, 2, 3, 4, 5], inf)])\n ) * 30 + 250;\n SinOsc.ar(freq * [1, 1.01]) * 0.1\n\n }.play;\n);\n\n(\n {\n var freq;\n freq = Duty.kr(\n Dseq([0.2, 0.3, 0.4, Dseq([1, 1, 1, 2, 1, 2], inf)]) / 2,\n Dseq([1, 2, 4, 5], inf), // demand rate reset\n Dseq([0, 1, 2, Dseq([1, 2, 3, 4, 5], inf)])\n ) * 30 + 250;\n SinOsc.ar(freq * [1, 1.01]) * 0.1\n\n }.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `GbmanL`."}, {"role": "assistant", "content": "```supercollider\n// default initial params\n{ GbmanL.ar(MouseX.kr(20, SampleRate.ir)) * 0.1 }.play(s);\n\n// different initial params\n{ GbmanL.ar(MouseX.kr(20, SampleRate.ir), -0.7, -2.7) * 0.1 }.play(s);\n\n// wait for it...\n{ GbmanL.ar(MouseX.kr(20, SampleRate.ir), 1.2, 2.0002) * 0.1 }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(GbmanL.ar(40)*400+500)*0.4 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// data sharing between streams of same PmonoPar and streams of second PmonoPar,\n// use of Ptpar ensures that first stream of second PmonoPar comes after first stream of first PmonoPar,\n// consider also PpolyPar for such type of usage\n\n(\np = PmonoPar([\n [\n \\dur, Prand([1, 1, 2]/3, 40).collect(~dur = _),\n \\amp, Pseq([0.3, 0.1], 15) \n ],[\n \\dur, Pfunc { ~dur / 2 },\n \\midinote, Pshuf((50..70)) \n ]\n]);\n\nq = PmonoPar([\n [\n \\dur, Pfunc { ~dur },\n \\amp, Pseq([0.3, 0\n// …\n```"}, {"role": "assistant", "content": "data sharing between streams of same PmonoPar and streams of second PmonoPar, use of Ptpar ensures that first stream of second PmonoPar comes after first stream of first PmonoPar, (PmonoPar: monophonic event pattern for an arbitrary number of timed setting streams)"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for SOUND 1, from orig Influx Example."}, {"role": "assistant", "content": "```supercollider\n// SOUND 1, from orig Influx Example\n(\n// // // if JITLibExtensions are used, you can make space local:\n// Ndef(\\dog).addSpec(\\intv, [-24, 24]);\n// Ndef(\\dog).addSpec(\\timescale, [0.01, 10, \\exp]);\n// Ndef(\\dog).addSpec(\\curve, [-10, 10]);\n// Ndef(\\dog).addSpec(\\ffreq, \\freq);\n//\n// Ndef(\\dog).addSpec(\\loopnode, [0, 12]);\n// Ndef(\\dog).addSpec(\\dens, [10, 1000, \\exp]);\n// Ndef(\\dog).addSpec(\\resfreq, \\freq);\n// Ndef(\\dog).addSpec(\\ringtime, [0.01, 1, \\exp]);\n\nSpec.add(\\intv, [-24, 24]);\nSpec.add(\\timescale, [0.01, 10, \\exp]);\nSpec.add(\\curve, [-10, 10]);\nSpec.add(\\ffreq, \\freq);\n\nSpec.add(\\loopnode, [0, 12]);\nSpec.add(\\dens, [10, 1000, \\exp]);\nSpec.add(\\resfreq, \\freq);\nSpec.add(\\ringtime, [0.01, 1, \\exp]);\n\n\nNdef(\\dog, { |amp=0, freq=250, intv=19, timescale=1, curve=0, loopnode=0, dens = 10, resfreq = 500, ringtime = 0.01|\n var n = 15;\n var env = EnvGen.kr(\n Env({ 1.0.rand2 }!(n+1), {1.0.rand}!n, curve, releaseNode: n-1, loopNode: loopnode.min(n-3)),\n timeScale: timescale);\n var pitch = (env * [1, 0.33, -1] * intv).midiratio * freq;\n var form = Formant.ar(pitch, pitch.rotate(1) * 1.6, pitch.rotate(2) * 2.6);\n\n var dusty = Ringz.ar(\n Dust.ar(dens!3),\n resfreq * LFNoise0.kr([3, 5, 7], 0.5, 1),\n ringtime)\n * ((dens ** -0.5) * (ringtime ** -0.3)\n );\n\n Splay.ar(form * dusty, level: amp) ;\n});\n);\n\nNdef(\\dog).set(\\amp, 0.2).vol_(0.2);\nNdef(\\dog).gui.moveTo(400, 380);\n\n/*\n// Ndef(\\dog).addHalo(\\orderedNames, Ndef(\\dog).controlKeys);\nNdef(\\dog).controlKeys;\nNdef(\\dog).vol_(0.5);\nNdefPreset( Ndef(\\dog) ).loadSettings;\nNdef(\\dog).play;\nNdef(\\dog).gui;\n*/\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes From a while ago."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var t, grav, sf, chain, sig;\n sf = LFPulse.ar(0.5);\n grav = LFNoise2.ar(1).range(0.1, 0.7);\n t = TBall.ar(sf, grav, 0.01, 0.0001) * 10;\n \n chain = FFT(LocalBuf(1024), t);\n chain = chain.pvcalc(1024, {|mags, phases|\n [phases, mags];\n });\n chain = PV_BrickWall(chain, LFNoise2.kr(1).range(-1, 0.5));\n chain = PV_RandComb(chain, LFNoise2.kr(1).range(0, 1), Dust.kr(20));\n sig = IFFT(chain);\n \n sig = sig ! 2;\n sig = sig + AllpassC.ar([sig[1], sig[0]], 0.1, {LFNoise2.kr(0.5).range(0.01, 0.1)} ! 2, 2);\n sig = sig + AllpassC.ar(sig, 0.1, {LFNoise2.kr(0.1).range(0.01, 0.1)} ! 2, 1);\n \n sig = LPF.ar(sig, 15000) + LPF.ar([sig[1], sig[0]], 500, 5) + LPF.ar(sig, 200, 10);\n sig = sig * 10;\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Condition`."}, {"role": "assistant", "content": "```supercollider\n(\nc = Condition.new(false);\n\nRoutine {\n 1.wait;\n \"waited for 1 second\".postln;\n 1.wait;\n \"waited for another second, now waiting for you ... \".postln;\n c.wait;\n \"the condition has stopped waiting.\".postln;\n 1.wait;\n \"waited for another second\".postln;\n \"waiting for you ... \".postln;\n c.test = false;\n c.wait;\n \"the condition has stopped waiting.\".postln;\n 1.wait;\n \"the end\".postln;\n}.play;\n);\n\n// continue\n(\nc.test = true;\nc.signal;\n);\n\n// a typical use is a routine that can pause under certain conditions:\n(\nc = Condition.new;\nfork { loop { 1.wait; \"going\".postln; c.wait } };\n);\nc.test = true; c.signal;\nc.test = false;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// make a storage place for various objects:\nq = (); // Event\n\nq[\\a_long_array] = Array.rand(128, 0.0, 1.0);\nq[\\pi_squared] = pi * pi;\nq[\\favourite_sound] = { { SinOsc.ar([300, 330]).sum * LFPulse.kr(2 + [0, 0.01]) * 0.1 }.play };\nq[\\same_long_array] = q[\\a_long_array]; // same objects may appear several times\n\nArchive.global.put(\\myData, q);\n\n\nArchive.global.at(\\myData).postcs;\n\n// after a recompile:\ns.boot;\n\nq = Archive.global.at(\\myData);\nq\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// make a storage place for various objects:\nq = (); // Event\n\nq[\\a_long_array] = Array.rand(128, 0.0, 1.0);\nq[\\pi_squared] = pi * pi;\nq[\\favourite_sound] = { { SinOsc.ar([300, 330]).sum * LFPulse.kr(2 + [0, 0.01]) * 0.1 }.play };\nq[\\same_long_array] = q[\\a_long_array]; // same objects may appear several times\n\nArchive.global.put(\\myData, q);\n\n\nArchive.global.at(\\myData).postcs;\n\n// after a recompile:\ns.boot;\n\nq = Archive.global.at(\\myData);\nq.postcs;\nq[\\favourite_sound].value;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for imitation of a ship's horn."}, {"role": "assistant", "content": "```supercollider\n(\n// by Nóslo Tredamus //\nSynthDef(\\Bocina3, {\n\n arg freq = 200, out = 0, amp = 1, gate = 1, bend = 21, relTime = 0.05, pitchRelTime = 0.015;\n var sig, env, mod, noise, pitchEnv;\n\n env = EnvGen.kr(Env.asr(0.1, 1, relTime), gate, doneAction: 0);\n pitchEnv = EnvGen.kr(\n Env(\n levels: [freq - bend, freq, freq, freq - bend],\n times: [0.3, 0, pitchRelTime],\n curve: [\\sine, 0, -8],\n releaseNode: 2\n ),\n gate\n );\n\n mod = LFNoise1.kr(3).exprange(pitchEnv * 1.5, pitchEnv * 3);\n sig = Mix([\n Saw.ar(pitchEnv, mul: amp),\n SinOsc.ar(pitchEnv * 2.098, mul: amp * 0.3),\n SinOsc.ar(pitchEnv * 2.3814, mul: amp * 0.3),\n SinOsc.ar(pitchEnv * 0.996, mul: amp * 0.3),\n Saw.ar(pitchEnv * 1.015, mul: amp * 0.8),\n Saw.ar(pitchEnv * 1.1907, mul: amp * 0.7),\n SinOsc.ar(pitchEnv * 1.503, mul: amp * 0.7),\n Saw.ar(pitchEnv * 0.498, mul: amp)\n ]);\n\n noise = PinkNoise.ar(amp * 0.9) * env;\n sig = sig + noise;\n sig = HPF.ar(sig, freq * 0.5);\n sig = LPF.ar(sig, mod);\n sig = sig * env;\n sig = GVerb.ar(sig, roomsize: 300, revtime: 0.6, drylevel: 1, mul: 0.9);\n sig = Limiter.ar(sig, 0.99);\n DetectSilence.ar(sig, amp: 0.001, time: 0.05, doneAction: 2);\n Out.ar(out, sig);\n}).add;\n);\n~claxon3 = Synth(\\Bocina3);\n~claxon3.set(\\gate, 0);\ns.record;\ns.stopRecording;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Stream`."}, {"role": "assistant", "content": "```supercollider\n// play at the next beat, with offset 0.4\n(\nRoutine({ loop {\n \"***\".postln; 0.5.wait;\n \"_*_\".postln; 0.1.wait;\n} }).play(quant: [1, 0.4]);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// ControlSpec-map can also be used to map ugens\n(\nvar spec;\nspec = [100, 18000, \\exp].asSpec;\n{\n var freq, osc;\n osc = SinOsc.kr(0.1).range(0, 1);\n freq = spec.map(osc);\n\n freq.dump; // BinaryOpUGen\n\n SinOsc.ar(\n freq.poll\n )\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// ControlSpec-map can also be used to map ugens\n(\nvar spec;\nspec = [100, 18000, \\exp].asSpec;\n{\n var freq, osc;\n osc = SinOsc.kr(0.1).range(0, 1);\n freq = spec.map(osc);\n\n freq.dump; // BinaryOpUGen\n\n SinOsc.ar(\n freq.poll\n )\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Gates (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\plop).put(0, { arg freq=200, rq=0.1, pan=0, amp=0.1;\n var sig;\n var sig1, sig2, sig3, sig4, sig5, sig6, sig7, sig8;\n sig1 = WhiteNoise.ar(1, 0);\n sig2 = LPF.ar(WhiteNoise.ar(1, 0), SinOsc.kr(1/16 * [1,2,3,4]/2).range(100,9001));\n sig3 = LFSaw.ar(( freq* [1/2,1,2,1] ).clip(20,15000)) * [1,4,1/2,2];\n sig1 = SelectX.ar(\\mixg.kr(0.5)*2, [sig1, sig2, sig3]);\n sig = Gate.ar(sig1, LFPulse.ar( SinOsc.kr(1/8 * [1,2,3,4].reverse/2).range(30,100), 0.5));\n sig = Gate.ar(sig, LFPulse.ar( freq ));\n sig = RLPF.ar(sig, ( freq * SinOsc.kr([1,2,3,4]/4).range(1,4) ).clip(20,15000), rq * [1,2,3,4]);\n sig1 = LFPulse.ar(freq * [1,1/2]) * [1,1/2];\n sig = SelectX.ar(\\mix.kr(0.8)*2, [sig, sig1 * sig, sig1]);\n sig1 = BPF.ar(sig, ( freq*2 ).clip(20,15000), rq) * 5;\n sig2 = BPF.ar(sig, freq, rq) * 5;\n sig3 = BPF.ar(sig, freq/2, rq) * 5;\n sig = SelectX.ar(\\mix2.kr(0.6) * 3, [sig, sig1, sig2, sig3]);\n sig = Pan2.ar(sig, LFNoise1.kr(1/2 * [1,2,3,4]).range(-1.0,1.0) * 0.3, amp).mean;\n}).play;\n\nSpec.add(\\mix, \\unipolar);\nSpec.add(\\mix2, \\unipolar);\nSpec.add(\\mixg, \\unipolar);\n);\n\nNdef(\\plop).edit;\n\nNdef(\\plop).unset(\\freq);\n\n(\n Ndef(\\plop).put(1, \\set -> Pbind(\n \\degree, Pseq([\n 0,3,2,3,\n 4,2,2,3,\n ],inf),\n \\octave, 4,\n \\dur, Pseq([1,2,4,1],inf)/4,\n )\n);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `RedKMeans.classifications` do?"}, {"role": "assistant", "content": "An array containing the result after the update method is called. It holds indices and have the same size as the number of items in the vectors array. Each index represents which centroid each vector belongs to. So to look up the closest centroid for vector i, do"}]} -{"conversations": [{"role": "user", "content": "What does `String.stripRTF` do?"}, {"role": "assistant", "content": "Returns a new String with all RTF formatting removed."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Crackle.ar(1.95, 0.5) }.play;\n\n// modulate chaos parameter\n{ Crackle.ar(Line.kr(1.0, 2.0, 3), 0.5, 0.5 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Crackle.ar(1.95, 0.5) }.play;\n\n// modulate chaos parameter\n{ Crackle.ar(Line.kr(1.0, 2.0, 3), 0.5, 0.5) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a closed hi-hat in SuperCollider."}, {"role": "assistant", "content": "High-passed noise with a very short envelope — the filter is what makes it a hat rather than a hiss.\n\n```supercollider\n(\nSynthDef(\\hat, { |out = 0, amp = 0.3, dur = 0.06|\n var env = EnvGen.kr(Env.perc(0.001, dur, 1, -6), doneAction: 2);\n Out.ar(out, Pan2.ar(HPF.ar(WhiteNoise.ar, 7000) * env * amp));\n}).add;\n);\nSynth(\\hat, [\\dur, 0.04]);\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n// restricting fm to harmonic sidebands after\n// [Chowning, 1973] Chowning, J. (1973). The synthesis of complex spectra by means of frequency modulation. Journal of the Audio Engineering Society, 21(7):526–534.\n// restriction actually happens because of the specs, not server-side.\n\nSpec.add(\\index, [0, 40]);\nSpec.add(\\harm1, [0, 20, \\lin, 1]);\nSpec.add(\\harm2, [0, 20, \\lin, 1]);\nSpec.add(\\fundFreq, \\freq);\n\nNdef(\\fmk, {\n \n PMOsc.ar(\n \\carFreq.kr(100, 0.1), \n (\\harm1.kr(1, 1)/(\\harm2.kr(1, 1)) * LFNoise1.ar(50).range(0.995, 1.001))*\\carFreq.kr(100), \n \\index.kr(1, 0.1) * SinOsc.ar(2.5).range(0.995, 1.005)\n ) \n})\n);\nNdef(\\fmk).gui\n```"}, {"role": "assistant", "content": "Restricting fm to harmonic sidebands after[Chowning, 1973]. Restriction actually happens because of the specs, not server-side.\r\n----- \r\nChowning, J. (1973). The synthesis of complex spectra by means of frequency modulation. Journal of the Audio Engineering Society, 21(7):526–534."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Compare:\n\n{ WhiteNoise.ar(0.25) }.play;\n\n{ LPZ1.ar(WhiteNoise.ar(0.25) }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Compare:\n\n{ WhiteNoise.ar(0.25) }.play;\n\n{ LPZ1.ar(WhiteNoise.ar(0.25)) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `IRand` in SuperCollider briefly."}, {"role": "assistant", "content": "IRand — Single integer random number generator. Generates a single random integer value in uniform distribution from `lo` to `hi` . It generates this when the SynthDef first starts playing, and remains fixed for the duration of the synth's existence. Category: UGens > Random."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\np = PbindFx([\n \\instrument, \\source,\n \\dur, 0.2,\n \\amp, 0.3,\n\n // downwards tendency + chord sequence\n \\midinote, Pseq((90, 80..50), inf) +\n Pn(Pshuf([[0, 5], 0, [0, 2.5], [-2.5, 12.5], [-3, 0]])),\n\n \\fxOrder, Prand([1, [1,2], [1,2]], inf),\n\n // lag must be adapted to maxEchoDelta\n \\lag, Pfunc { |e| e.fxOrder.isArray.if { 0 }{ 0.2 } },\n\n // echo -> shorter source decay\n \\decayTime, Pfunc { |e| e.fxOrder.isArray.if { 0.1\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\np = PbindFx([\n \\instrument, \\source,\n \\dur, 0.2,\n \\amp, 0.3,\n\n // downwards tendency + chord sequence\n \\midinote, Pseq((90, 80..50), inf) +\n Pn(Pshuf([[0, 5], 0, [0, 2.5], [-2.5, 12.5], [-3, 0]])),\n\n \\fxOrder, Prand([1, [1,2], [1,2]], inf),\n\n // lag must be adapted to maxEchoDelta\n \\lag, Pfunc { |e| e.fxOrder.isArray.if { 0 }{ 0.2 } },\n\n // echo -> shorter source decay\n \\decayTime, Pfunc { |e| e.fxOrder.isArray.if { 0.1 }{ 0.7 } },\n \\cleanupDelay, Pkey(\\decayTime)\n ],[\n \\fx, \\spat,\n \\maxDelayTime, 0.005,\n \\cleanupDelay, Pkey(\\maxDelayTime)\n ],[\n \\fx, \\echo,\n \\echoDelta, Pseq((1..5)/50, inf),\n \\decayTime, 1,\n \\cleanupDelay, Pkey(\\decayTime)\n ]\n);\n\nq = p.play;\n);\n\nq.stop;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Resonz.ar(WhiteNoise.ar(0.5), 2000, 0.1) }.play\n\n// modulate frequency\n{ Resonz.ar(WhiteNoise.ar(0.5), XLine.kr(1000, 8000, 10), 0.05) }.play\n\n// modulate bandwidth\n{ Resonz.ar(WhiteNoise.ar(0.5), 2000, XLine.kr(1, 0.001, 8)) }.play\n\n// modulate bandwidth opposite direction\n{ Resonz.ar(WhiteNoise.ar(0.5), 2000, XLine.kr(0.001, 1, 8) }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Resonz.ar(WhiteNoise.ar(0.5), 2000, 0.1) }.play\n\n// modulate frequency\n{ Resonz.ar(WhiteNoise.ar(0.5), XLine.kr(1000, 8000, 10), 0.05) }.play\n\n// modulate bandwidth\n{ Resonz.ar(WhiteNoise.ar(0.5), 2000, XLine.kr(1, 0.001, 8)) }.play\n\n// modulate bandwidth opposite direction\n{ Resonz.ar(WhiteNoise.ar(0.5), 2000, XLine.kr(0.001, 1, 8)) }.play\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `PLatch` in SuperCollider briefly."}, {"role": "assistant", "content": "PLatch — UGenPatterns quark library Based on Latch Category: Streams-Patterns-Events > UGenPatterns > Modifiers."}]} -{"conversations": [{"role": "user", "content": "What does `Editor.synthArg` do?"}, {"role": "assistant", "content": "holds a value that can be edited with a GUI, saves as the value"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// check blockSize before (or reset blockSize in examples)\n\n(\nif (s.options.blockSize != 64) {\n s.options.blockSize = 64;\n s.quit.reboot;\n}\n);\n\n\n// exponentiation can also be interesting\n// here an area of instability is crossed by a stereo lfo\n\ns.scope\n\n// start fb fx Synth\n\n(\n~bus = Bus.audio(s, 1);\n\ny = {\n var inSig = In.ar(~bus);\n var lfo = { LFDNoise3.ar(0.5).linexp(-1, 1, 0.1, 150) } ! 2;\n\n Fb1({ |in, out|\n in[1][0] * 0.07 +\n // out[0]\n// …\n```"}, {"role": "assistant", "content": "check blockSize before (or reset blockSize in examples) exponentiation can also be interesting (Fb1: single sample feedback / feedforward pseudo ugen)"}]} -{"conversations": [{"role": "user", "content": "Explain `BufAllpassL` in SuperCollider briefly."}, {"role": "assistant", "content": "BufAllpassL — Buffer based all pass delay line with linear interpolation. All pass delay line with linear interpolation which uses a buffer for its internal memory. See also BufAllpassN which uses no interpolation, and which BufAllpassC uses cubic interpolation. Cubic interpolation is more computationally expensive than linear, but more accurate. Category: UGens > Delays > Buffer."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for pattern of kicks."}, {"role": "assistant", "content": "```supercollider\n(\n{ | dur = 0.15, atk = 0.015, amp = 0.8, pan = 0 |\n Pan2.ar(\n SinOsc.ar(\n EnvGen.ar(Env(\\freq_l.kr([2960, 70, 90]), \\freq_d.kr([0.07, 0.15]), \\freq_c.kr([-13, -1]))),\n mul:EnvGen.ar(\n Env.perc( atk, max(dur - atk, atk), curve: \\amp_c.kr([-1, 5])),\n doneAction: 2 ) ), \n pan, amp )\n}.asSynthDef.name_(\"ckick\").add.play;\n);\n\n(\nPbind(*[\n instrument: \\ckick,\n delta: Pseg(Pwhite()/*Pbrown(step:0.05)*/.linexp(0, 1, 1/32, 1), Pbrown(0,1,0.05).linexp(0, 1, 1/8, 8), \\sine),\n //delta: Pseg(Pbrown(0,1,0.05).linexp(0, 1, 1/32, 1), Pbrown(0,1,0.05).linexp(0, 1, 1, 4), \\step),\n dur: Pfunc({ thisThread.clock.beatDur }) * Pkey(\\delta),\n atk: min(0.01, Pkey(\\dur)/2),\n freq_l: Pcollect(`_, Ptuple([Pbrown(1500, 4000, 50), Pbrown(40, 65, 1)/*+Pseq([0,300,100,0,50,0],inf)*/, Pbrown(45, 90, 5)], inf)),\n freq_d: Pfunc({ |e| `[e.atk*7, e.dur - 0.07] }),\n //freq_c: Pcollect(`_, Ptuple([Pbrown(-17, -4q, 0.5), Pbrown(0, 4)], inf)),\n freq_c: Ptuple({Pcollect(`_, Ptuple([Pbrown(-17, -4, 0.5), Pbrown(0, 4)], inf))}!2,inf),\n //amp_c: ``[-6,6],\n amp_c: Ptuple({Pcollect(`_, Ptuple([Pbrown(0, -6, 0.5), Pbrown(1, 6)], inf))}!2,inf), \n pan: Ptuple({Pbrown(-1,1)}!2, inf),\n amp: Ptuple({Pbrown(0.1,0.5,0.1)}!2, inf)\n])\n//.trace\n.play(TempoClock(156/60))\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `PathName.pathOnly` do?"}, {"role": "assistant", "content": "returns the full path up to the file name itself; i.e. everything up to and including the last slash. This is handy e.g. for storing several files in the same folder."}]} -{"conversations": [{"role": "user", "content": "What is `RedMixerGUI` in SuperCollider?"}, {"role": "assistant", "content": "RedMixerGUI — gui for RedMixer Category: Red > redMixer."}]} -{"conversations": [{"role": "user", "content": "What does `PlayerInputProxy.rate` do?"}, {"role": "assistant", "content": "placeholder for Patch inputs for a player that will be supplied later"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Multichannel Convolution Reverb (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\n~numIRs = 4;\n~fftsize = 2048;\ns.waitForBoot {\n var irs, irbuffs, bufsizes, nextmod, numSamples;\n nextmod = 100;\n numSamples = 40000 ;\n \n /* an array of multiple IRs */\n irs = ~numIRs.collect{ arg nth;\n // nth is here not used, but can be useful to scale decay time.\n [0] ++ 0.dup(100) ++ Array.fill(\n numSamples, { arg i;\n (i%nextmod==0).if\n {\n nextmod= rrand(80, 120);\n (i.asFloat/numSamples).squared * 0.3\n } {\n 0\n }\n }\n )\n };\n { irs.plot }.defer; // to show irs.\n \n /* an array of buffers. */\n irbuffs = ~numIRs.collect{ arg i; Buffer.loadCollection(s, irs[i]) };\n irbuffs.postln; // to show irbuffs info.\n s.sync;\n \n bufsizes= irbuffs.collect{ |nth|PartConv.calcBufSize(~fftsize, nth) };\n ~irSpctrms = bufsizes.collect{ arg size, i;\n Buffer\n .alloc(s, size, 1)\n .preparePartConv(irbuffs[i], ~fftsize)\n };\n s.sync; \n \n ~numIRs.do{|i| irbuffs[i].free}\n}\n);\n\n(\nfork{\n ~target= Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n s.sync;\n {\n var in, krnl;\n in= PlayBuf.ar(1, ~target, loop:1);\n \n /* an array of multiple instances of PartConv */\n krnl= ~numIRs.collect{ arg i;\n PartConv.ar(in, ~fftsize, ~irSpctrms[i].bufnum, 0.2)};\n // By iterating, each PartConv processes a mono-channel buffer in the array ~irSpctrms.\n \n Out.ar(0, krnl);\n }.play\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `MKtl.elementGroup` do?"}, {"role": "assistant", "content": "All the control elements (MKtlElement) on the device you may want to listen or talk to. this returns an MKtlElementGroup containing a hierarchical tree of MKtlElements, organised via MKtlElementGroup. (elements is a deprecated alias of elementGroup)."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LeastChange`."}, {"role": "assistant", "content": "```supercollider\n(\nd = { |amp = 1.0|\n var in1, in2;\n in1 = LFNoise0.ar(800, amp);\n in2 = SinOsc.ar(800);\n LeastChange.ar(in1, in2) * 0.1;\n}.play;\n);\n\nd.set(\\amp, 0.1);\nd.set(\\amp, 0);\nd.set(\\amp, 3);\nd.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `LineLayout.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a HLayout or a VLayout and immediately fill it with items given as arguments. (Note that LineLayout is an abstract class and can not be instantiated, but HLayout and VLayout inherit this Arguments: ... items — Each item can be a view, a layout, nil (for stretchable empty space) or an Integer (for fixed-size empty space).."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// SynthDefs from Ex. 2a\n\n(\nb = Bus.audio(s, 2);\nc = Bus.audio(s, 2);\n);\n\n\n// still none of the effects is set by a stream\n\n(\np = PpolyPar([[\n // values before \\dur are not sent to server, so do this work here:\n // echo (out b) is coupled with short release time\n // wah (out c) is coupled with longer release time\n \\data, Prand([[b, 0.1], [c, 0.5]], inf),\n \\dur, Prand([1, 1, 2]/5, inf),\n \\amp, 0.3,\n // data dispatch from above, these values will be sent\n \\rel, Pkey(\\data).collect(_[1]),\n \\out, Pkey(\\data).collect(_[0]),\n \\t\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// SynthDefs from Ex. 2a\n\n(\nb = Bus.audio(s, 2);\nc = Bus.audio(s, 2);\n);\n\n\n// still none of the effects is set by a stream\n\n(\np = PpolyPar([[\n // values before \\dur are not sent to server, so do this work here:\n // echo (out b) is coupled with short release time\n // wah (out c) is coupled with longer release time\n \\data, Prand([[b, 0.1], [c, 0.5]], inf),\n \\dur, Prand([1, 1, 2]/5, inf),\n \\amp, 0.3,\n // data dispatch from above, these values will be sent\n \\rel, Pkey(\\data).collect(_[1]),\n \\out, Pkey(\\data).collect(_[0]),\n \\t_gate, 1,\n \\midinote, Pwhite(50, 100)\n ],[\n \\dur, inf,\n \\in, b,\n \\out, 0,\n \\dtime, 0.1,\n \\decay, 3\n ],[\n \\dur, inf,\n \\in, c,\n \\amp, 0.3\n ]],\n [\\test, \\echo, \\wah]\n).play;\n);\n\np.stop;\n\n(\nb.free;\nc.free;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Object.writeArchive` do? What arguments does it take?"}, {"role": "assistant", "content": "Write an object to disk as a text Arguments: pathname — A String containing the resulting file's path.."}]} -{"conversations": [{"role": "user", "content": "What does `NumberEditor.rate` do?"}, {"role": "assistant", "content": "holds a float value with a spec, editable with a gui"}]} +{"conversations": [{"role": "user", "content": "What does `HasPatchIns.mapInputToBus` do? What arguments does it take?"}, {"role": "assistant", "content": "parent class for Players that have PatchIns such as Patch Arguments: i; bus."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Resonz`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"noiseToPitch\", { arg out = 0, mul = 1;\n Out.ar(\n out,\n Resonz.ar(\n WhiteNoise.ar(mul),\n LFNoise0.kr(4, 110, 660),\n [0.005, 0.005]\n )\n )\n}).add;\n);\n\n(\n// activate left and right channels\nSynth(\"noiseToPitch\", [\\out, 0, \\mul, 1]);\nSynth(\"noiseToPitch\", [\\out, 1, \\mul, 1]);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Psubdivide` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\na = Psubdivide(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,0,1,3,4,0], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n100.do({ x.next.postln });\n);\n\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Psubdivide(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n);\n\n\n(\na = Psubdivide(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,4,4,0,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `BPF`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// synthdefs to play with\n(\nSynthDef(\\noise_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, rq = 0.1, amp = 0.1|\n var sig = { WhiteNoise.ar } ! 2;\n sig = BPF.ar(sig, freq, rq) *\n EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2) *\n (rq ** -1) * (250 / (freq ** 0.8));\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\sin_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { SinOsc.ar(freq, Rand(0, 2pi)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n\n\nSynthDef(\\saw_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { VarSaw.ar(freq, Rand(0, 1)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LFTri`."}, {"role": "assistant", "content": "```supercollider\n// plot:\n{ LFTri.ar(40) }.plot(0.1);\n{ LFTri.ar(XLine.kr(1, 800, 0.1)) }.plot(0.1);\n\n{ LFTri.ar(500, 0, 0.1) }.play\n\n// used as both Oscillator and LFO:\n{ LFTri.ar(LFTri.kr(4, 0, 200, 400), 0, 0.1) }.play\n\n// phase. compare\n{ LFTri.ar(LFTri.kr(0.1, iphase: 0) * 200 + 400, 0, 0.1) }.play\n{ LFTri.ar(LFTri.kr(0.1, iphase: 1) * 200 + 400, 0, 0.1) }.play\n{ LFTri.ar(LFTri.kr(0.1, iphase: 2) * 200 + 400, 0, 0.1) }.play\n{ LFTri.ar(LFTri.kr(0.1, iphase: 3) * 200 + 400, 0, 0.1) }.play\n\n// together\n{ LFTri.ar(LFTri.kr(0.05, iphase: (0..3)) * 200 + 400, 0, 0.1).sum }.play\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Pseq` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Pseq(#[60, 61, 63, 65, 72], inf).asStream;\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, a.next.midicps]);\n 0.2.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PLbindef`."}, {"role": "assistant", "content": "```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n// synthdefs to play with\n\n(\nSynthDef(\\noise_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, rq = 0.1, amp = 0.1|\n var sig = { WhiteNoise.ar } ! 2;\n sig = BPF.ar(sig, freq, rq) *\n EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2) *\n (rq ** -1) * (250 / (freq ** 0.8));\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\sin_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { SinOsc.ar(freq, Rand(0, 2pi)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\saw_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { VarSaw.ar(freq, Rand(0, 1)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Monitor`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\ns.scope(16);\n\n{ Out.ar(87, SinOsc.ar(MouseX.kr(40, 10000, 1) * [1, 2, 3], 0, 0.2)) }.play;\nx = Monitor.new;\nx.play(87, 3, 1, 2);\nx.out = 0;\nx.stop(3.0);\nx.play(87, 1, 0, 1); // in > out : now mixes down (wrapping)\nx.play(89, 1, 0, 2); // in < out : now distributes to 2 channels\nx.stop;\n\n// multiple play\nx.play(87, 1, 0, 2, multi: true);\nx.play(88, 1, 0, 2, multi: true);\nx.play(89, 1, 0, 2, multi: true);\nx.stop;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `IdentityBag`?"}, {"role": "assistant", "content": "IdentityBag — A Bag according to identity"}, {"role": "user", "content": "What does `IdentityBag.add` do?"}, {"role": "assistant", "content": "Add anObject to the Bag. A Bag may contain multiple entries of the same object. `IdentityBag[1, 2, 3].add(4);`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nIdentityBag[1, 2, 3].add(4);\nIdentityBag[1, 2, 3].add(3);\nIdentityBag[\"abc\", \"def\", \"ghi\"].add(\"jkl\");\nIdentityBag[\"abc\", \"def\", \"ghi\"].add(\"def\");\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `TRand`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var trig = Dust.kr(10);\n SinOsc.ar(\n TRand.kr(300, 3000, trig)\n ) * 0.1\n}.play;\n);\n\n(\n{\n var trig = Dust.ar(MouseX.kr(1, 8000, 1));\n SinOsc.ar(\n TRand.ar(300, 3000, trig)\n ) * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Free`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\nSynthDef(\"a\", { Out.ar(0, SinOsc.ar(800, 0, 0.2)) }).add;\n\nSynthDef(\"b\", { |t_t = 0| Out.ar(1, PinkNoise.ar(0.3)); Free.kr(t_t, 1001) }).add;\n\ns.sendMsg(\\s_new, \\a, 1001, 0, 0);\n\ns.sendMsg(\\s_new, \\b, 1002, 0, 0);\n\ns.sendMsg(\\n_set, 1002, \\t_t, 1);\n\ns.sendMsg(\\s_new, \\a, 1001, 0, 0);\n\ns.sendMsg(\\n_set, 1002, \\t_t, 1);\n\ns.sendMsg(\\s_new, \\a, 1001, 0, 0);\n\ns.sendMsg(\\n_set, 1002, \\t_t, 1);\n```"}]} +{"conversations": [{"role": "user", "content": "What is `CXAbstractLabel` in SuperCollider?"}, {"role": "assistant", "content": "CXAbstractLabel — parent class for Label classes Category: Libraries > crucial > GUI > abstract."}]} +{"conversations": [{"role": "user", "content": "What does `PLbindefParEnvironment.stop` do?"}, {"role": "assistant", "content": "Stops all PLbindefs of the corresponding"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Compander` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var z;\n\n // signal (clean)\n z = Decay2.ar(\n Impulse.ar(8, 0, LFSaw.kr(0.3, 1, -0.3, 0.3)),\n 0.001,\n 0.3\n )\n * Mix.ar(Pulse.ar([80, 81], 0.3));\n\n // apply gate (mouse x sets treshold)\n Compander.ar(z, z,\n thresh: MouseX.kr(0.001, 1),\n slopeBelow: 10,\n slopeAbove: 1,\n clampTime: 0.01,\n relaxTime: 0.01\n )\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DynKlank`."}, {"role": "assistant", "content": "```supercollider\n{ DynKlank.ar(`[[800, 1071, 1153, 1723], nil, [1, 1, 1, 1]], Impulse.ar(2, 0, 0.1)) }.play;\n\n{ DynKlank.ar(`[[800, 1071, 1353, 1723], nil, [1, 1, 1, 1]], Dust.ar(8, 0.1)) }.play;\n\n{ DynKlank.ar(`[[800, 1071, 1353, 1723], nil, [1, 1, 1, 1]], PinkNoise.ar(0.007)) }.play;\n\n{ DynKlank.ar(`[[200, 671, 1153, 1723], nil, [1, 1, 1, 1]], PinkNoise.ar([0.007, 0.007])) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{SinOsc.ar(Summer.kr(Impulse.kr(5), 1.5, 0, 0).poll * 100, 0, 0.1)}.play;\n\n(\n{\n var trig = Dust.kr(5);\n var reset = Impulse.kr(0.5);\n SinOsc.ar(Summer.kr(trig, [0.5, 0.25], reset, 1) * 100, 0, 0.1)\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{SinOsc.ar(Summer.kr(Impulse.kr(5), 1.5, 0, 0).poll * 100, 0, 0.1)}.play;\n\n(\n{\n var trig = Dust.kr(5);\n var reset = Impulse.kr(0.5);\n SinOsc.ar(Summer.kr(trig, [0.5, 0.25], reset, 1) * 100, 0, 0.1)\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a plucked string in SuperCollider."}, {"role": "assistant", "content": "Pluck is a Karplus-Strong string: a noise burst into a tuned delay with feedback. The delay time is\nthe reciprocal of the frequency.\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 220, amp = 0.5, dur = 3|\n var period = freq.reciprocal;\n var sig = Pluck.ar(WhiteNoise.ar(0.2), Impulse.kr(0), period, period, dur, 0.5);\n Out.ar(out, Pan2.ar(sig * amp, 0));\n}).add;\n);\nSynth(\\pluck, [\\freq, 330, \\dur, 4]);\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n//Chaos engine hum\n(\n{\n SinOsc.ar(10 + (50 * SinOsc.kr([50, 51], 0, SinOsc.kr(101, Saw.kr(0.12345, 678, 9), 0.2, 0.8), Pulse.kr([25, 25.5], 0.25, 0.125, -0.25))), 0, 0.5, 0);\n}.play();\n)\n```"}, {"role": "assistant", "content": "A deep binaural cycle reminiscent of the engine of a space ship."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Routine` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// SynthDefs on the fly\ns.boot;\n(\nt = TempoClock.new;\nr = Routine.new({\n 10.do({\n // could be done with an argument instead of a new def, but proves the point\n SynthDef(\"help-EnvGen\" ++ i, { arg out = 0;\n Out.ar(\n out,\n EnvGen.kr(Env.perc, 1.0, doneAction: Done.freeSelf)\n * SinOsc.ar(100 + (100 * t.elapsedBeats), 0, 0.1)\n )\n }).play(s);\n 1.yield;\n });\n}).play(t); // Note the alternative syntax: Routine.play(aClock)\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Archive`."}, {"role": "assistant", "content": "```supercollider\n// make a storage place for various objects:\nq = (); // Event\n\nq[\\a_long_array] = Array.rand(128, 0.0, 1.0);\nq[\\pi_squared] = pi * pi;\nq[\\favourite_sound] = { { SinOsc.ar([300, 330]).sum * LFPulse.kr(2 + [0, 0.01]) * 0.1 }.play };\nq[\\same_long_array] = q[\\a_long_array]; // same objects may appear several times\n\nArchive.global.put(\\myData, q);\n\n\nArchive.global.at(\\myData).postcs;\n\n// after a recompile:\ns.boot;\n\nq = Archive.global.at(\\myData);\nq.postcs;\nq[\\favourite_sound].value;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `WebView.runJavaScript` do? What arguments does it take?"}, {"role": "assistant", "content": "Evaluates the given JavaScript code in the context of the current Arguments: A String.; A function to be called when execution is complete, with the result as first argument.."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Stethoscope`."}, {"role": "assistant", "content": "```supercollider\ns.boot\n{ SinOsc.ar([330, 440], 0, 0.4) }.play;\nStethoscope(s, 2);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SimpleNumber.raddeg` do?"}, {"role": "assistant", "content": "one-dimensional value Returns: converts radian to degree"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Pan2` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\ns.bind {\n SynthDef(\"tpulse2\", { arg out=0, freq=700, sawFreq=440.0;\n Out.ar(out, Pan2.ar(SyncSaw.ar(freq, sawFreq, 0.1), SinOsc.kr(8)) )\n }).send(s);\n s.sync; // wait until synthdef is loaded\n x = Synth.new(\"tpulse2\");\n a = Bus.control.set(440);\n x.map(\\freq, a);\n};\n);\n\na.free; x.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `CountLimit.count` do?"}, {"role": "assistant", "content": "Counts how many items have been presented to it. returns true until limit false thereafter"}]} +{"conversations": [{"role": "user", "content": "Who are you?"}, {"role": "assistant", "content": "I am sc-mind, a 198M MiniMind-3-MoE trained from scratch on the SuperCollider source and help corpus. I write and explain SuperCollider: SynthDefs, UGens, Patterns, Ndef, the language/server split, and how to make sound that is not silence."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `AbstractFunction`."}, {"role": "assistant", "content": "```supercollider\na = { |x| #[440, 720, 801, 1020.2].at(x) }; b = a.cpsmidi; [a.value(3), b.value(3)];\na = Pseries(220, 220, inf).cpsmidi; a.asStream.nextN(12); // overtone series as midinotes\n// follow but round to next midinote\n{ a = Pitch.kr(SoundIn.ar).at(1); Pulse.ar(a.cpsmidi.round.midicps) * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `NodeControl`."}, {"role": "assistant", "content": "```supercollider\nd = SynthDef(\"help-NodeControl\", { |out = 0, freq = 400|\n Out.ar(out,\n SinOsc.ar(freq, 0, 0.5)\n )\n});\ny = d.play; // the synth\n\nc = NodeControl(y, 1);\n\nc.value = 500;\n\nc.value = 300;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ LFPulse.ar(LFPulse.kr(3, 0, 0.3, 200, 200), 0, 0.2, 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ LFPulse.ar(LFPulse.kr(3, 0, 0.3, 200, 200), 0, 0.2, 0.1) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `LatoocarfianN.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Latoocarfian chaotic generator Arguments: freq — Iteration frequency in Hertz; a — Equation variable; b — Equation variable; c — Equation variable; d — Equation variable; xi — Initial value of x; yi — Initial value of y; mul."}]} +{"conversations": [{"role": "user", "content": "Explain `Array2D` in SuperCollider briefly."}, {"role": "assistant", "content": "Array2D — two-dimensional array Represents a two-dimensional array of data. The number of rows and columns is fixed. Category: Collections > Ordered."}]} +{"conversations": [{"role": "user", "content": "Do is not ¨returning¨ array (campanology)?"}, {"role": "assistant", "content": "SuperCollider forum — Do is not ̈returning ̈ array (campanology)\n\nYou can remove the need for all mutable variables by computing the indexes to swap first - these are stored in indexesEven and indexesOdd.\n\nThen an array of functions is made (swappers)...i.e.[indexesEven, indexesOdd, indexesEven....]\n\nFinally, .inject is used to chain these together, taking the previous result as the input to the next and building an array.\n\n```supercollider\n(\n~swap_sort_steps = {\n |parts|\n var swapConsequtiveIndexes = {|from, to|\n (from..to).clump(2).collect{|p| p.reverse }.flat\n };\n var indexesEven = swapConsequtiveIndexes.(0, parts - 1);\n var indexesOdd = [0] ++ swapConsequtiveIndexes.(1, parts - 1);\n var swappers = parts.collect{ |n|\n {|toSwap| if(n.even)\n { indexesEven.collect{|i| toSwap[i]} }\n { indexesOdd.collect{|i| toSwap[i]} }\n }\n };\n postf(\"indexesEven : %\\nindexesOdd : %\\n\", indexesEven, indexesOdd);\n swappers.inject( [(0..parts-1)], {\n |col, f|\n col ++ [f.(col.last)]\n });\n};\n)\n```\n\nAlso, as I’m sure you know, if anyone else is reading who doesn’t know what this is... its a swap sort algorithm."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\nvar noise, out;\nnoise = LFNoise0.kr(8);\n\nout = if( noise > 0.0,\n if(noise > 0.5, \n if(noise > 0.9, WhiteNoise.ar(0.2), Pulse.ar(60, 0.5, 0.4)),\n SinOsc.ar(500, 0, 0.25)\n ),\n Saw.ar(160, 0.5)\n);\n\nout ! 2\n\n}.play;\n)\n```"}, {"role": "assistant", "content": "A short, silly example of using if in a SynthDef. Using Select is generally a better thing to do."}]} +{"conversations": [{"role": "user", "content": "What is `Object`?"}, {"role": "assistant", "content": "Object — abstract superclass of all objects"}, {"role": "user", "content": "What does `Object.readArchive` do?"}, {"role": "assistant", "content": "Read in an object from a text archive. `(`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// embedding an event\na = (z: 77);\nb = Pset(\\y, 8, a.streamArg(true)).asStream;\nc = Pset(\\y, 8, a.streamArg(false)).asStream;\nb.nextN(3, ()); // this ends\nc.nextN(3, ()); // this loops\n\n// embedding a pattern\na = Pbind(\\note, Pseq([1, 2]));\nb = Pset(\\y, 8, a.streamArg(true)).asStream;\nc = Pset(\\y, 8, a.streamArg(false)).asStream;\nb.nextN(3, ()); // this ends\nc.nextN(3, ()); // this ends, too\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\nKlank.ar([ // the multichannel-expansion\n `[[500, 1078, 1201.5, 1723], nil, [1, 1, 0.5, 0.3]], // left channel\n `[[700, 1071, 1053, 1723], nil, [1, 1, 1, 1]] // right channel\n ], Impulse.ar([1.5, 1.875], 0, 0.1))\n}.play\n);\n\n// expanding specs within the parameter array\n{ Klank.ar(`[[[800, 6000], 1071, [1153, 8000], 1723], nil, [1, 1, 1, 1]], Impulse.ar([2, 3], 0, 0.1) }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\nKlank.ar([ // the multichannel-expansion\n `[[500, 1078, 1201.5, 1723], nil, [1, 1, 0.5, 0.3]], // left channel\n `[[700, 1071, 1053, 1723], nil, [1, 1, 1, 1]] // right channel\n ], Impulse.ar([1.5, 1.875], 0, 0.1))\n}.play\n);\n\n// expanding specs within the parameter array\n{ Klank.ar(`[[[800, 6000], 1071, [1153, 8000], 1723], nil, [1, 1, 1, 1]], Impulse.ar([2, 3], 0, 0.1)) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `StandardL`."}, {"role": "assistant", "content": "```supercollider\n// vary frequency\n{ StandardL.ar(MouseX.kr(20, SampleRate.ir)) * 0.3 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// Compare with Ex. 2 from DXFan help.\n// As DXFanOut, other than DXFan, doesn't return an array, a mix is not necessary, \n// by internal use of Out ugens the signal is mixed to the referred buses anyway.\n\n// For the same reason a normal release doesn't work, to get this option we can add an EnvGate.\n\n(\nx = {\n var lfo = { LFDNoise3.kr(0.2) };\n DXFanOut.ar(\n [Dseq([0, 1], inf), Dseq([1, 0], inf)],\n [\n LFTri.ar(150 * lfo.().range(1, 2), 0, 0.05),\n BPF.ar(PinkNoise.ar(), lfo.().range(1000, 3000),\n// …\n```"}, {"role": "assistant", "content": "Compare with Ex. 2 from DXFan help. As DXFanOut, other than DXFan, doesn't return an array, a mix is not necessary, (DXFanOut: crossfades signals between out buses according to demand-rate control)"}]} {"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nNdef(\\x, { Saw.ar(110) * 0.1 }).play;\nNdef(\\x)[1] = \\filter -> { |in| RLPF.ar(in, 800, 0.4) };\n```"}, {"role": "assistant", "content": "Two nodes in one named proxy: a saw source, then a resonant low-pass filter fed by it.\n\n`Ndef(\\x, { ... })` defines the first node of the chain and `.play` starts it. `Ndef(\\x)[1] = \\filter ->`\ninserts a second node at index 1; the `\\filter` key says 'make this node an effect that receives the\nprevious node's output as `in`'. So the patch is `Saw -> RLPF -> out`. Because it is an Ndef, calling\n`Ndef(\\x, { ... })` again replaces the source with a crossfade instead of restarting, and\n`Ndef(\\x).stop` removes the whole chain."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// mouse-controlled param\n{ StandardN.ar(SampleRate.ir/2, MouseX.kr(0.9, 4)) * 0.3 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// mouse-controlled param\n{ StandardN.ar(SampleRate.ir/2, MouseX.kr(0.9, 4)) * 0.3 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Buffer.setn` do?"}, {"role": "assistant", "content": "Set a contiguous range of values in the buffer starting at the index startAt to be equal to the Array of floats or integers, values. The number of values set corresponds to the size of values. Additional pairs of starting indices and arrays of values may be included in the same message. (Floating-point values for index are truncated to"}]} -{"conversations": [{"role": "user", "content": "What does `Synth.addReplaceMsg` do?"}, {"role": "assistant", "content": "See *new above for details on Returns: a message of the type s_new which can be bundled. When sent to the server this message will instantiate this synth, replacing nodeToReplace in the server's node order."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\ns = Server.local;\nt = TempoBus.new(s);\n\nt.index.postln;\n\nTempo.bpm = 60;\n\nSynthDef(\"help-TempoBus\",{ arg out=0,tempoBus;\n var tempo,trig,amp;\n tempo = In.kr(tempoBus);\n trig = Impulse.kr(tempo);\n amp = Decay2.kr(trig,0.01,0.1).clip2(1.0);\n Out.ar(out,\n amp * SinOsc.ar(300)\n )\n}).play(s,[0,0,1,t.index]);\n\n\nTempo.bpm = 40;\n\nTempo.bpm = 100;\n\nTempo.bpm = 666;\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\ns = Server.local;\nt = TempoBus.new(s);\n\nt.index.postln;\n\nTempo.bpm = 60;\n\nSynthDef(\"help-TempoBus\",{ arg out=0,tempoBus;\n var tempo,trig,amp;\n tempo = In.kr(tempoBus);\n trig = Impulse.kr(tempo);\n amp = Decay2.kr(trig,0.01,0.1).clip2(1.0);\n Out.ar(out,\n amp * SinOsc.ar(300)\n )\n}).play(s,[0,0,1,t.index]);\n\n\nTempo.bpm = 40;\n\nTempo.bpm = 100;\n\nTempo.bpm = 666;\n\nSheet({ arg f;\n Tempo.default.gui(f); // move the slider, it works\n})\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for cosmic organ with a inspiration of rukano tweet."}, {"role": "assistant", "content": "```supercollider\n// 2012.05.04\n// Work for NX014 Class\n// Inspiration: A Rukano Tweet. Thanks rukano!\n// Comment: Cosmic Organ.\n\np = ProxySpace.push(s.boot);\n\n~a.play;\n\n~a = { var alpha,gamma;\n alpha= LFNoise2;\n gamma= {[rrand(30,50),rrand(50,70),rrand(50,70),rrand(70,100)].choose.midicps*alpha.kr(1,0.01,1)}!24;\n Pan2.ar(LeakDC.ar(Normalizer.ar(\n BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(FreeVerb.ar(\n Splay.ar(RLPF.ar(LFSaw.ar(gamma)/4,gamma*LFCub.kr(rrand(0.01,0.1),0,2,3),alpha.kr(1/8,0.6,0.7))) \n ,0.1,0.1,0.1)\n ,100,6.0,6),1000,6.0,0),5000,6.0,0),10000,6.0,6)\n ,(0.8/0.999)*1,0.1)),0)\n};\n\n~a = nil;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Canvas3D.preDrawFunc` do?"}, {"role": "assistant", "content": "Function to evaluate at the beginning of the draw"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LorenzL`."}, {"role": "assistant", "content": "```supercollider\n// randomly modulate params\n(\n{ LorenzL.ar(\n SampleRate.ir,\n LFNoise0.kr(1, 2, 10),\n LFNoise0.kr(1, 20, 38),\n LFNoise0.kr(1, 1.5, 2)\n) * 0.2 }.play(s);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SeenBefore.reset` do?"}, {"role": "assistant", "content": "eliminates duplicates by saving a history of objects it has tested"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// indexing into a table\n(\n{\n var buf = LocalBuf.newFrom([200, 300, 400, 500, 600, 800]);\n var freq = FoldIndex.kr(buf, MouseX.kr(0, BufFrames.ir(buf) * 3));\n SinOsc.ar(freq) * 0.1\n}.play;\n);\n\n// the same using a global buffer\n(\nt = [200, 300, 400, 500, 600, 800];\nb = Buffer(s, t.size, 1);\n\n// alloc and set the values\ns.listSendMsg(b.allocMsg(b.setnMsg(0, t)).postln);\n\nSynthDef(\\help_Index, { |out = 0, bufnum\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// indexing into a table\n(\n{\n var buf = LocalBuf.newFrom([200, 300, 400, 500, 600, 800]);\n var freq = FoldIndex.kr(buf, MouseX.kr(0, BufFrames.ir(buf) * 3));\n SinOsc.ar(freq) * 0.1\n}.play;\n);\n\n// the same using a global buffer\n(\nt = [200, 300, 400, 500, 600, 800];\nb = Buffer(s, t.size, 1);\n\n// alloc and set the values\ns.listSendMsg(b.allocMsg(b.setnMsg(0, t)).postln);\n\nSynthDef(\\help_Index, { |out = 0, bufnum = 0|\n Out.ar(out,\n SinOsc.ar(\n FoldIndex.kr(\n bufnum,\n MouseX.kr(0, BufFrames.ir(bufnum) * 3)\n ),\n 0,\n 0.5\n )\n )\n}).play(s, [\\bufnum, b.bufnum]);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// python preprocessor, given that you have python installed\n// thanks to tasos tsesmetzis\n\n(\nthis.preProcessor = PreProcessor.new.startDelimiter_(\"{-\").endDelimiter_(\"-}\");\n\n// a simple python call\ne = (\n lang: \\python,\n languages:\n (\n python: // code is the incoming string, event is the event for parameters and output\n {|code, event|\n var input, pipe, output;\n code = e[\\prefix] ++ \"print\" ++ \"(\" ++ code ++ \")\";\n input = \"python -c '%'\".format(code);\n pipe = Pipe(input, \"r\");\n output = pipe.readUpTo;\n pipe.close;\n event.put(\\result, output)\n }\n ),\n prefix: \"import math;\"\n);\n);\n\n// ok, assuming such a little interpreter exists for a given language,\n// one can now use it in code.\n\n(\ne =\n{-\n math.factorial(61)\n-}.value(e);\ne.result;\n);\n\ne.calc_result = e.result.as(Array).collect { |x| x.asString.interpret };\n\nPbind(\\note, Pseq(e.calc_result), \\dur, 0.1).play;\n```"}, {"role": "assistant", "content": "python preprocessor, given that you have python installed thanks to tasos tsesmetzis."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Granular electromaton. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\nServer.local.waitForBoot({\n(\nz.free;\nz = Buffer.alloc(s, 512, 1);\nz.sine1(1.0 / [1, 2, 3, 4], true, true, true);\n\n fork( { loop {\n SynthDef(\"g1\",{ arg out=0,bufnum=0,dur=1,rate=1,pos=0,sdens=1,edens=1;\n var dens = Line.kr(sdens,edens,dur);\n var trig = [LFNoise0,SinOsc,Impulse,LFPulse,LFSaw].choose.ar(Line.kr(sdens,edens,dur));\n //var env = EnvGen.kr(Env.perc(0.0001.rrand(0.1),dur*0.5.rrand(2)),doneAction:2);\n var env = EnvGen.kr(Env.perc(0.0001.rrand(0.1),dur*(0.5.rrand(4))),doneAction:2);\n Out.ar(out,\n GrainBuf.ar(2,trig,1/dens,bufnum,rate,pos)*env;\n )\n }).add();\n [1,2,4,8,16,32].choose.postln.wait;\n }\n }\n );\n\n\na = Pbind(\\instrument,\\g1,\\dur,Pseq([Pseq([0.25],32),Pseq([0.25,0.125,0.125],32),Pseq([0.125],32)],inf),\\sdens,Pseq([9000,1000,500]/10,inf),\\edens,Prand([Pseq([9000,1000,500]/10,4),Pseq([1],1)],inf),\\rate,Pfunc({-10.0.rrand(10)}),\\pos,Pfunc({1.0.rand}),\\bufnum,z.bufnum);\nb = Pbind(\\instrument,\\g1,\\dur,Pseq([4],inf),\\sdens,Pseq([9000,1000,500]/100,inf),\\edens,Prand([Pseq([9000,1000,500]/10,1),Pseq([1],3)],inf),\\rate,Pfunc({-10.0.rrand(10)}),\\pos,Pfunc({-10.0.rrand(10)}),\\bufnum,z.bufnum);\nc = Pbind(\\instrument,\\g1,\\dur,Pseq([4/3],inf),\\sdens,Pseq([9000,1000,500,25],inf),\\edens,Prand([Pseq([9000,1000,500,25],1),Pseq([1],4)],inf),\\rate,Pfunc({-100.0.rrand(100)}),\\pos,Pfunc({-10.0.rrand(10)}),\\bufnum,z.bufnum);\n\n\na =a.play;\nb =b.play;\nc =c.play;\n\n)\n});\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `RangeSlider.range` do?"}, {"role": "assistant", "content": "The difference between #-hi and #-lo. Setting -range will set -hi to -lo +"}]} +{"conversations": [{"role": "user", "content": "Explain `CombC` in SuperCollider briefly."}, {"role": "assistant", "content": "CombC — Comb delay line with cubic interpolation. Comb delay line with cubic interpolation. See also CombN which uses no interpolation, and CombL which uses linear interpolation. Cubic interpolation is more computationally expensive than linear, but more accurate. Category: UGens > Delays."}]} +{"conversations": [{"role": "user", "content": "My sustained synth never stops, even when I set the gate to 0."}, {"role": "assistant", "content": "A sustained EnvGen only releases when the gate goes from positive to non-positive *after* the envelope has started, and the Synth only disappears if that EnvGen has `doneAction: 2`. Check three things: the SynthDef actually takes a `gate = 1` argument, the Env is a sustained shape (Env.adsr or Env.asr, not Env.perc), and you call `x.set(\\gate, 0)` on the Synth object. Setting the gate on a different Synth, or on a Group, does nothing."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `SharedOut` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\n// only works with the internal server\ns = Server.internal;\ns.boot;\n);\n\n(\nSynthDef(\"help-SharedOut\", {\n SharedOut.kr(0, SinOsc.kr(0.2));\n}).add;\n);\n\n(\ns.sendMsg(\\s_new, \"help-SharedOut\", x = s.nextNodeID, 0, 1);\ns.sendMsg(\\n_trace, x);\n\n// poll the shared control bus\nRoutine({\n 30.do({\n s.getSharedControl(0).postln;\n 0.2.wait;\n });\n}).play;\n);\n\n\ns.quit;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `BufCombN` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// These examples compare the variants, so that you can hear the difference in interpolation\n\n// allocate buffer\nb = Buffer.alloc(s, 44100, 1);\n\n// Comb used as a resonator. The resonant fundamental is equal to\n// reciprocal of the delay time.\n{ BufCombN.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ BufCombL.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ BufCombC.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// with negative feedback:\n{ BufCombN.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ BufCombL.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ BufCombC.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n// used as an echo.\n{ BufCombL.ar(b.bufnum, Decay.ar(Dust.ar(1, 0.5), 0.2, WhiteNoise.ar), 0.2, 3) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// synthdef\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n}).add;\n);\n\n// pattern with different start times\n(\nx = Pbind(\n \\instrument, \\help_sinegrain,\n \\degree, Pseq(#[0, 5, 4, 2, 1, 1, 3], inf),\n \\dur, Pseq(#[0.25, 0.5, 1.0], inf),\n \\scale, #[0, 3, 5, 9, 10]\n);\na = Pbus(Pgt\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// synthdef\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n}).add;\n);\n\n// pattern with different start times\n(\nx = Pbind(\n \\instrument, \\help_sinegrain,\n \\degree, Pseq(#[0, 5, 4, 2, 1, 1, 3], inf),\n \\dur, Pseq(#[0.25, 0.5, 1.0], inf),\n \\scale, #[0, 3, 5, 9, 10]\n);\na = Pbus(Pgtpar([0.0, x, 1.5, x, 2.25, x])).play;\n);\ns.plotTree;\na.stop;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `MIDIFunc.tick` do?"}, {"role": "assistant", "content": "A convenience method to create a new MIDIFunc which responds to MIDI tick messages. See #*new for argument descriptions. The responding `func` will be passed the argument Returns: A new instance of MIDIFunc which responds to MIDI tick messages."}]} +{"conversations": [{"role": "user", "content": "What is `PV_RandWipe` in SuperCollider?"}, {"role": "assistant", "content": "PV_RandWipe — Crossfade in random bin order. Crossfades between two sounds by copying bins in a random order. Category: UGens > FFT."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Event` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\pm, { |out = 0, freq = 440, amp = 0.1, pan = 0, gate = 1, ratio = 1, index = 1, ar = 0.1, dr = 0.1|\n var z;\n z = LPF.ar(\n PMOsc.ar(freq, freq * ratio, Linen.kr(gate, ar, index, dr), 0, 0.3),\n XLine.kr(Rand(4000, 5000), Rand(2500, 3200), 1)\n ) * Linen.kr(gate, 0.01, 0.7, dr, 2);\n OffsetOut.ar(out, Pan2.ar(z, pan, amp));\n}).add;\n);\n\n(instrument: \\pm).play;\n\n(instrument: \\pm, ratio: 3.42, index: 12, freq: 150, ar: 8, dr: 3, sustain: 10).play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `EZSlider.set` do?"}, {"role": "assistant", "content": "Set the args after creation. You can only set the label if it was not nil from the"}]} +{"conversations": [{"role": "user", "content": "Explain `RedLZ77` in SuperCollider briefly."}, {"role": "assistant", "content": "RedLZ77 — lz77 compression/decompression See http://michael.dipperstein.com/lzss/ and http://www.binaryessence.com/dct/en000138.htm Category: Red > > redTools."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\nvar carrier, modulator, depth, scale;\n\ncarrier = 440;\nmodulator = 650;\ndepth = 355.2;\n\n// generate a 5 step scale, picking the 5 most consonant steps from the dissonance curve\nscale = DissonanceCurve.fm(carrier, modulator, depth, 1202).scale(5);\n\nPbind(\n \\instrument, \\fm,\n \\scale, scale,\n \\degree, Pwhite(0, scale.size), // use scale.size as a limit in case the curve generates fewer than 5 steps\n \\carrier, carrier,\n \\modulator, modulator,\n \\depth, depth\n).play;\n)\n```"}, {"role": "assistant", "content": "generate a 5 step scale, picking the 5 most consonant steps from the dissonance curve (DissonanceCurve: Analyzes timbres in order to create tunings)"}]} +{"conversations": [{"role": "user", "content": "Explain `FFTSpread` in SuperCollider briefly."}, {"role": "assistant", "content": "FFTSpread — Spectral spread Given an FFT chain, this measures the spectral spread, which is the magnitude-weighted variance. This measure can serve as an (approximate) clue towards the bandwidth of a signal (although the value is not a frequency). Category: UGens > Analysis, UGens > FFT."}]} +{"conversations": [{"role": "user", "content": "What does `Tempo.beatsPerBar` do? What arguments does it take?"}, {"role": "assistant", "content": "Bored with the old 4/4 ? Tempo.beatsPerBar = Arguments: b."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Formant`."}, {"role": "assistant", "content": "```supercollider\n// modulate fundamental frequency, formant freq stays constant\n{ Formant.ar(XLine.kr(400, 1000, 8), 2000, 800, 0.125) }.play\n\n// modulate formant frequency, fundamental freq stays constant\n{ Formant.ar(200, XLine.kr(400, 4000, 8), 200, 0.125) }.play\n\n// modulate width frequency, other freqs stay constant\n{ Formant.ar(400, 2000, XLine.kr(800, 8000, 8), 0.125) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `FBSineC`."}, {"role": "assistant", "content": "```supercollider\n// increase feedback\n{ FBSineC.ar(SampleRate.ir, 1, Line.kr(0.01, 4, 10), 1, 0.1) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `FreqScopeView`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// Start server\ns.boot;\n\n// Create analyzer in a window\n(\nw = Window(\"My Analyzer\", Rect(0, 0, 511, 300)); // width should be 511\nf = FreqScopeView(w, w.view.bounds);\nf.active_(true); // turn it on the first time;\n\nw.onClose_({ f.kill }); // you must have this\nw.front;\n{ SinOsc.ar([500, 1000], 0, 0.25).mean.dup }.play(s); // start two sine waves\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `T2K`."}, {"role": "assistant", "content": "```supercollider\n// this does not work:\n(\n{\n var trig = Dust.ar(4);\n Trig.kr(trig, 0.1) * SinOsc.ar(800) * 0.1\n}.play;\n);\n\n// this works:\n(\n{\n var trig = T2K.kr(Dust.ar(4));\n Trig.kr(trig, 0.1) * SinOsc.ar(800) * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// plot:\n{ LFTri.ar(40) }.plot(0.1);\n{ LFTri.ar(XLine.kr(1, 800, 0.1)) }.plot(0.1);\n\n{ LFTri.ar(500, 0, 0.1) }.play\n\n// used as both Oscillator and LFO:\n{ LFTri.ar(LFTri.kr(4, 0, 200, 400), 0, 0.1) }.play\n\n// phase. compare\n{ LFTri.ar(LFTri.kr(0.1, iphase: 0) * 200 + 400, 0, 0.1) }.play\n{ LFTri.ar(LFTri.kr(0.1, iphase: 1) * 200 + 400, 0, 0.1) }.play\n{ LFTri.ar(LFTri.kr(0\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// plot:\n{ LFTri.ar(40) }.plot(0.1);\n{ LFTri.ar(XLine.kr(1, 800, 0.1)) }.plot(0.1);\n\n{ LFTri.ar(500, 0, 0.1) }.play\n\n// used as both Oscillator and LFO:\n{ LFTri.ar(LFTri.kr(4, 0, 200, 400), 0, 0.1) }.play\n\n// phase. compare\n{ LFTri.ar(LFTri.kr(0.1, iphase: 0) * 200 + 400, 0, 0.1) }.play\n{ LFTri.ar(LFTri.kr(0.1, iphase: 1) * 200 + 400, 0, 0.1) }.play\n{ LFTri.ar(LFTri.kr(0.1, iphase: 2) * 200 + 400, 0, 0.1) }.play\n{ LFTri.ar(LFTri.kr(0.1, iphase: 3) * 200 + 400, 0, 0.1) }.play\n\n// together\n{ LFTri.ar(LFTri.kr(0.05, iphase: (0..3)) * 200 + 400, 0, 0.1).sum }.play\n```"}]} +{"conversations": [{"role": "user", "content": "What is `OpenObject` in SuperCollider?"}, {"role": "assistant", "content": "OpenObject — talk to objects over the network Publish any object for remote access via network (OSC, see http://opensoundcontrol.org ). This allows to create easy access for other languages and systems, such as Pd, Processing or Max. Category: OpenSoundControl."}]} +{"conversations": [{"role": "user", "content": "What does `IdentityDictionary.insertParent` do? What arguments does it take?"}, {"role": "assistant", "content": "Inserts a dictionary into the chain of parents of the receiver (rather than replacing the Arguments: newParent — The dictionary that is added to the parent chain; insertionDepth — Level at which the new parent is inserted. Zero (default) means directly above, Inf means at the top of the parent chain.; reverseInsertionDepth — If the new parent dictionary has parents itself, this parameter specifies where the original parents are placed in the new parent chain. Zero means directly above, Inf (default) means at the top of the chain.."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Formant`."}, {"role": "assistant", "content": "```supercollider\n// modulate fundamental frequency, formant freq stays constant\n{ Formant.ar(XLine.kr(400, 1000, 8), 2000, 800, 0.125) }.play\n\n// modulate formant frequency, fundamental freq stays constant\n{ Formant.ar(200, XLine.kr(400, 4000, 8), 200, 0.125) }.play\n\n// modulate width frequency, other freqs stay constant\n{ Formant.ar(400, 2000, XLine.kr(800, 8000, 8), 0.125) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\n(\nSynthDef(\"help-PinkNoise\", { |out = 0|\n Out.ar(out, PinkNoise.ar(0.1))\n}).add;\n\nSynthDef(\"help-In\", { |out = 0, in = 0|\n var input;\n input = In.ar(in, 1);\n Out.ar(out, input);\n\n}).add;\n);\n\n// play noise on the right channel\nx = Synth(\"help-PinkNoise\", [\\out, 1]);\n\n// read the input and play it out on the left channel\nSynth.after(x, \"help-In\", [\\out, 0, \\in, 1];\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\n(\nSynthDef(\"help-PinkNoise\", { |out = 0|\n Out.ar(out, PinkNoise.ar(0.1))\n}).add;\n\nSynthDef(\"help-In\", { |out = 0, in = 0|\n var input;\n input = In.ar(in, 1);\n Out.ar(out, input);\n\n}).add;\n);\n\n// play noise on the right channel\nx = Synth(\"help-PinkNoise\", [\\out, 1]);\n\n// read the input and play it out on the left channel\nSynth.after(x, \"help-In\", [\\out, 0, \\in, 1]);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\nx = { SinOsc.ar((Line.kr(0, 10, 10).snap(1, 0.3, 1) + 60).poll.midicps, 0, -24.dbamp }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\nx = { SinOsc.ar((Line.kr(0, 10, 10).snap(1, 0.3, 1) + 60).poll.midicps, 0, -24.dbamp) }.play\n```"}]} {"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot\n{ SinOsc.ar([330, 440], 0, 0.4) }.play;\nStethoscope(s, 2;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot\n{ SinOsc.ar([330, 440], 0, 0.4) }.play;\nStethoscope(s, 2);\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for redo_minimalish sketch."}, {"role": "assistant", "content": "```supercollider\n//redFrik - redo_minimalish sketch\n(\ns.waitForBoot{\n \n SynthDef(\\p, {|out= 0, freq= 400, amp= 0.1, gate= 1, detune= 0|\n var env= EnvGen.ar(Env.perc(Rand(0.001, 0.01), LinRand(0.2, 0.4), amp, Rand(-9, -1)), doneAction:2);\n var snd= Mix(SinOsc.ar(freq+[0, detune*0.1], env*2pi));\n Out.ar(out, Pan2.ar(snd*env, Rand(-1, 1)));\n }).add;\n Ndef(\\p, Pspawn(Pbind(\\method,\\par,\\delta,1/8,\\pattern,{Pbind(\\instrument, \\p, \\dur,a=Pseq((1..9).sputter),\\sustain,1/8/a,\\degree,a,\\detune,a)})));\n Ndef(\\p).play(vol:0.5);\n \n Ndef(\\t, {\n var mod= Saw.ar([3, 4], Saw.ar(1, 32, 128), Duty.ar(1, 0, flop(Dseq([0, 8, 1, 5])*[1, 4, 8])));\n var snd= SinOsc.ar(Saw.ar(2, 64, 99), mod)/9;\n CombN.ar(snd, 1/4, 1/4.125, SinOsc.kr(0.005, 1.5pi).range(0, 6));\n });\n Ndef(\\t).play(vol:0.5);\n \n Routine.run({\n var cnt= 1;\n loop{\n var syn;\n cnt= cnt%8+1;\n syn= {\n var del= DelayN.ar(InFeedback.ar(0, 2)+(InFeedback.ar(100, 2)), 1, 1);\n SinOsc.ar(cnt*99+[0, 2], del[1..0])/4;\n }.play(outbus: 64);\n {syn.release(16)}.defer(9-cnt);\n wait(9-cnt);\n };\n });\n Ndef(\\c, {InFeedback.ar(64, 2)}).play(vol:0.5);\n \n Ndef(\\r, {\n var lfos= LFNoise1.ar(0.5!2);\n var snd= Crackle.ar(lfos.range(1.8, 1.98));\n Formlet.ar(snd, TExpRand.ar(200, 2000, lfos).lag(2), lfos.range(5e-4, 1e-3), 0.0012);\n });\n Ndef(\\r).play(vol:0.25);\n \n Routine.run({\n loop{\n var syn= {\n var snd= Pluck.ar(Crackle.ar([1.9, 1.8]), Mix(Impulse.ar({5.linrand+1}!2, -0.125)), 0.05, 0.05.linrand);\n BPF.ar(snd, 2000.rand+100, 0.25.rrand(1.75));\n }.play(s, 62, 18);\n {syn.release(69)}.defer(18);\n wait(18);\n };\n });\n Ndef(\\m, {InFeedback.ar(62, 2)*SinOsc.kr(0.006).range(0.25, 1)}).play(vol:0.5);\n \n NdefMixer(s);\n s.meter;\n};\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n{ BlitB3Saw.ar(XLine.kr(1000, 20, 10)) }.play;\n\n//aliasing suddenly appears for very high frequencies\n{ BlitB3Saw.ar(MouseX.kr(10,10000,'exponential'),MouseY.kr(0.01,0.99)) }.play;\n\n//comparison\n{ Saw.ar(1000) }.play;\n{ BlitB3Saw.ar(1000) }.play;\n\n{ Mix(Saw.ar({rrand(10,1000)}!100,mul:0.01)) }.play;\n//definitely more efficient second method\n{ Mix(BlitB3Saw.ar({rrand(10,1000)}!100,mul:0.01)) }.play;\n\n//see also comparison in BlitB3 help file\n```"}, {"role": "assistant", "content": "aliasing suddenly appears for very high frequencies definitely more efficient second method (BlitB3Saw: BLIT derived sawtooth)"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for We all could use a little more?"}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\cowbell, {\n | out=0, amp=0.3, gate=1, fund_freq=540, pan=0.0 |\n var sig, env;\n\n sig = Pulse.ar( fund_freq * [ 1, 1.5085 ], [ 0.565, 0.445 ], [ 0.4, 0.6 ] ).distort;\n env = EnvGen.ar(\n Env(\n [ 0, 0.05, 1, 0.1, 0 ], [ 0.003, 0.002, 0.05, 0.5 ], [2, -4, -4, -4]\n ),\n gate: gate,\n timeScale: [ 1.0, 1.5 ],\n doneAction: 2\n );\n sig = Mix( sig * env );\n sig = BPF.ar( sig, fund_freq * 2, 1.808 );\n\n Out.ar( out, Pan2.ar( sig, pan, amp ) );\n}).add;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Image.plot` do? What arguments does it take?"}, {"role": "assistant", "content": "plots the image in a Window. `i = Image.new(SCDoc.helpSourceDir +/+ Arguments: name — the title of the Window. may be nil.; bounds — the bounds of the Window. may be nil.; freeOnClose — flag to tell if the Window should free the Image when closed.; background — additional background to apply to the Window. may be useful for artifacts due to alpha / compositing...; showInfo — shows pixel coordinates while the mouse is over the image's plot window.."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Change arg values of MIDIdef after instantiation."}, {"role": "assistant", "content": "```supercollider\n~mdef =\n{\n |key, func, msgNum, permanent = true|\n\n MIDIdef(key, func ?? { MIDIdef(key).func }, msgNum ? MIDIdef(key).msgNum, MIDIdef(key).chan, MIDIdef(key).msgType, MIDIdef(key).srcID).permanent_(permanent)\n}\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// playing two interval lines in parallel\n\n(\n~a = Pseq([4, 2, 0]) + [0, -5];\n~b = Pseq([7, 5, 4]) + [0, 5];\n \np = Pbind(\n \\dur, Pseq([0.4, 0.2, 0.2], inf),\n \\note, PLn(\\a)\n);\n \nq = Pbindf(p, \\note, PLn(\\b));\n\nx = Ppar([p, q]).play; \n);\n\n \n\n// replace the lower event stream, new notes start after end of embedding Pseq\n \n~a = Pseq([3, 2, 0]) + [0, -5];\n\n\n// replace second line\n\n~b = Pseq([7, 5, 4]) + [5, 12;\n\n\n// source nil stops event st\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// playing two interval lines in parallel\n\n(\n~a = Pseq([4, 2, 0]) + [0, -5];\n~b = Pseq([7, 5, 4]) + [0, 5];\n \np = Pbind(\n \\dur, Pseq([0.4, 0.2, 0.2], inf),\n \\note, PLn(\\a)\n);\n \nq = Pbindf(p, \\note, PLn(\\b));\n\nx = Ppar([p, q]).play; \n);\n\n \n\n// replace the lower event stream, new notes start after end of embedding Pseq\n \n~a = Pseq([3, 2, 0]) + [0, -5];\n\n\n// replace second line\n\n~b = Pseq([7, 5, 4]) + [5, 12];\n\n\n// source nil stops event stream after end of embedding Pseq\n\n~a = nil;\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for change stuff in running Pbind with patternproxies?"}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\clusterboom, {| out = 0, freq=55, dur=1, amp=1|\n Out.ar(\n out,\n Splay.ar({SinOsc.ar(exprand(freq-(freq/128),freq+(freq/128)),0,0.1)}!33)\n * EnvGen.kr(Env.perc,1,1,0,dur,2)\n * amp\n ) \n}).add;\n);\n\n\n(\n~notes = [ 21, 21, 9, 19, 19, 9 ];\n~durs = [ 1/4, 1/4, 1/2, 1/8, 1/8, 14/8 ];\n~amps = [ 4, 4, 0, 3, 3, 0 ];\n\n~notespatternproxy = PatternProxy(Pxrand(~notes,inf)); \n~durspatternproxy = PatternProxy(Pxrand(~durs, inf));\n~ampspatternproxy = PatternProxy(Pxrand(~amps, inf)); \n\np = Pbind(\n \\instrument, \\clusterboom,\n \\midinote, ~notespatternproxy,\n \\dur, ~durspatternproxy,\n 'amp', ~ampspatternproxy, \n);\n);\np.play;\n\n// eval while running:\n\n~notespatternproxy.source = Pxrand(~notes + 7,inf); \n~notespatternproxy.source = Pxrand(union(~notes, ~notes + 7),inf); \n~notespatternproxy.source = Pxrand(~notes,inf);\n```"}]} -{"conversations": [{"role": "user", "content": "A starting point to start experimenting with non-standard synthesis?"}, {"role": "assistant", "content": "SuperCollider forum — A starting point to start experimenting with non-standard synthesis?\n\nI while ago I did this noise cloud generator which might serve as inspiration. Other ideas: scramble signals with FFT tools, granular synthesis, FM-synthesis with extreme settings, like index-of-modulation = 4000.\n\n```supercollider\nSynthDef(\\clouds, {\n var num = 10;\n var dur = \\duration.kr(1/6);\n var sig = num.collect{\n var freq = Rand(30, 5000) * SinOsc.kr(LFNoise1.kr(dur).range(30, 1000), 0, LFNoise1.kr(dur)\n .range(0.01, 8)).midiratio;\n var sig = Select.ar(LFNoise0.kr(dur).range(0, 2).round,\n [SinOsc.ar(freq, 0, 0.3), Saw.ar(freq, 0.3), Pulse.ar(freq, 0, 0.3)]);\n var filtFreq = Rand(30, 1000) * LFNoise1.kr(dur).range(1.0, 5.0);\n var filt = Select.ar(LFNoise0.kr(dur).range(0, 2).round,\n [LPF.ar(sig, filtFreq), HPF.ar(sig, filtFreq), BPF.ar(sig, filtFreq)]\n );\n sig = CombL.ar(filt, 0.5, LFNoise1.kr(dur).range(0.02, 0.5), rrand(0.3, 2));\n sig\n };\n var env = Env.perc(\\atk.kr(0.02), \\rel.kr(6), 1, \\cur.kr(-4)).ar(2);\n sig = Splay.ar(sig); // nb! levelComp: true, so if removed signal will be extremely loud!\n sig = LPF.ar(sig, 2000);\n sig = FreeVerb2.ar(sig[0], sig[1], LFNoise1.kr(dur).range(0, 1.0), LFNoise1.kr(dur).range(0.2, 2));\n sig = sig * env * \\amp.kr(1);\n Out.ar(\\out.kr(0), sig)\n}).add;\n\nSynth(\\clouds, [\\atk, rrand(0.01, 2), \\rel, rrand(1, 6.0), \\duration, rrand(0.01, 1)])\n// run it several times, the outcome is highly random\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes blipecho context."}, {"role": "assistant", "content": "```supercollider\n( \nSynthDef(\\klang_blip, { \n | out = 0, release = 1, freq1 = 1, freq2 = 5, freq3 = 8, freq_mul = 4, atk_dur = 0.01, amp = #[0.3,0.3,0.3], mod_freq = 25 | \n var sig = DynKlang.ar(\n `[([freq1, freq2, freq3].linexp(1,12,1,1140) * freq_mul), amp, nil ], \n EnvGen.kr(Env([5,1.05,0.95,0.01],[0.025,release*3/4,release/4])), \n 150\n ) * LFGauss.kr(mod_freq.reciprocal, 0.3);\n Out.ar(out, (sig/8)!2 * Linen.kr(Impulse.kr(0), atk_dur, 1, release, doneAction:2)) \n}).add;\n\nSynthDef(\\dubecho,{|in, out, length = 1, fb = 0.8, sep = 0.012|\n var input = In.ar(in, 2);\n var feedback = LocalIn.ar(2);\n var output = LeakDC.ar(feedback*fb + input);\n output = HPF.ar(output, 400);\n output = LPF.ar(output, 12000);\n output = output.tanh;\n LocalOut.ar(DelayC.ar(output, 1, LFNoise2.ar(12).range([length,length+sep],[length+sep,length])).reverse);\n ReplaceOut.ar(out, output);\n}).add;\n);\n\n( \n~bus = Bus.audio(s, 2);\n~echo = Synth(\\dubecho, [\\in, ~bus, \\length, TempoClock.default.tempo*(3/8), \\fb, 0.25, \\sep, 0.0012], addAction: \\addToTail);\n\nPbind(*[ \n instrument: \\klang_blip, \n dur: Pwrand([0.25,0.5,1,0.125], [16,16,1,1].normalizeSum, inf), \n release: Pkey(\\dur),\n freq_mul: Pstutter(Pwrand([1,2,4],[5,3,2].normalizeSum,inf), Pxrand((1..6), inf)),\n freq1: Pstutter(Pxrand((2,4..16), inf), Prand((1..4), inf)), \n freq2: Pstutter(Pxrand((2,4..16), inf), Prand((4..8), inf)), \n freq3: Pstutter(Pxrand((2,4..16), inf), Prand((8..12), inf)),\n mod_freq: Pstutter(Pxrand((2,4..16), inf), Pbrown(7,30,3)),\n atk_dur: Pkey(\\freq_mul).linlin(12,2,0.01,0.4),\n out: ~bus,\n amp: Pstutter(Pxrand((2,4..16),inf), Pfunc({[2,3,4].normalizeSum.scramble}))\n]).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n~loDev = -6;\n~hiDev = 5;\n~lookBack = 2;\n\np = Pbind(\n \\dur, 0.2,\n \\midinote, PIdev(72, 11, Pfunc { ~loDev }, Pfunc { ~hiDev }, Pfunc { ~lookBack }).trace(prefix: \"midi \"),\n).play;\n);\n\n// change on the fly\n// as lookBack equals 2, this defines a fixed sequence (up or down anyway)\n\n(\n~loDev = -1;\n~hiDev = 1;\n);\n\n// widen range\n\n(\n~loDev = -6;\n~hiDev = 5;\n);\n\n// force a twelve-tone row\n\n~lookBack = 11;\n\n\n// cont\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n~loDev = -6;\n~hiDev = 5;\n~lookBack = 2;\n\np = Pbind(\n \\dur, 0.2,\n \\midinote, PIdev(72, 11, Pfunc { ~loDev }, Pfunc { ~hiDev }, Pfunc { ~lookBack }).trace(prefix: \"midi \"),\n).play;\n);\n\n// change on the fly\n// as lookBack equals 2, this defines a fixed sequence (up or down anyway)\n\n(\n~loDev = -1;\n~hiDev = 1;\n);\n\n// widen range\n\n(\n~loDev = -6;\n~hiDev = 5;\n);\n\n// force a twelve-tone row\n\n~lookBack = 11;\n\n\n// contradictory input, lookBack 11 not possible within range, causes repetitions\n\n(\n~loDev = -3;\n~hiDev = 2;\n);\n\np.stop\n```"}]} -{"conversations": [{"role": "user", "content": "Can you run this code and tell me if it works?"}, {"role": "assistant", "content": "No — I cannot execute SuperCollider. What I can tell you is what would break and why: bracket balance, arguments that must exist for the class, a SynthDef that never reaches Out, a SynthDef played before it is added, an envelope that frees the Synth immediately. For certainty, evaluate it: the post window reports errors precisely, and `s.plotTree` shows whether the node exists."}]} -{"conversations": [{"role": "user", "content": "What does `Object.hash` do?"}, {"role": "assistant", "content": "Answer a code used to index into a hash table. This is used by Dictionary and Set and their subclasses to implement fast object lookup. Objects which are equal == should have the same hash values. Whenever == is overridden in a class, hash should be overridden as well. `a = \"worth trying\"; b = \"worth"}]} -{"conversations": [{"role": "user", "content": "What does `View.globalKeyDownAction` do?"}, {"role": "assistant", "content": "A settable class variable containing an object (e.g. an instance of Function or FunctionList) which is evaluated (i.e. Object#-value#value method is called on it) whenever a key is pressed, independently of keyboard focus. See also #-addAction. When the action object is evaluated, it is passed the following arguments: view, char, modifiers, unicode, keycode,"}]} -{"conversations": [{"role": "user", "content": "What is `Synth` in SuperCollider?"}, {"role": "assistant", "content": "Synth — Client-side representation of a synth node on the server A Synth is the client-side representation of a synth node on the server. A Synth represents a single sound producing unit. What it does is defined in a SynthDef, which specifies what UGens are used and how they are patched together. It also specifies what inputs and outputs the Synth will have. A SynthDef is thus a kind of fixed pattern, upon which Synths are be based. (Despite this, a given Synth Category: Server > Nodes, Server > Abstractions."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// q.zoom sets all the influx'es inScalers AND RandomOrbit's excursion from current state.\n\nq.zoom = q.zoom?1;\n\nq.setZoom = {|ev, val|\n val = val.clip(0.05, 1.0).round(0.05);\n // \"global ZOOM f. RandomOrbits and Influxes: %\\n\".postf(val);\n q.zoom = val;\n // do external funcs here\n try{ q.prez.ezs.value = q.zoom };\n q.inphlux.inScaler = q.zoom;\n // return value\n val\n};\n// increment / decrement\nq.incZoom = {|ev, inc=0.1|\n q.setZoom((q.zoom + inc));\n};\n\n\n// set it to poti on ana in 8 (it was 7, not worked)\nMKtl(\\xosc).elAt('inA').at(7).action.add(\\setZoom, {|el|\n var val = el.value.clip(0.05, 1).round(0.05);\n if (val != q.zoom) {\n \"zoom from xosc: %\\n\".postf(val);\n q.setZoom(val)\n };\n});\n```"}, {"role": "assistant", "content": "q.zoom sets all the influx'es inScalers AND RandomOrbit's excursion from current state."}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ LPF.ar(Saw.ar(100), SinOsc.kr(0.5).exprange(200, 2000)) * 0.2 }.play;\n```"}, {"role": "assistant", "content": "A sawtooth through a low-pass filter whose cutoff is swept slowly up and down — a classic filter\nsweep.\n\n- `Saw.ar(100)` is a 100 Hz sawtooth, rich in harmonics.\n- `SinOsc.kr(0.5)` is a control-rate sine at 0.5 Hz, so one full cycle takes 2 seconds.\n- `.exprange(200, 2000)` maps that -1..1 sine exponentially onto 200..2000 Hz — exponential is the right\n mapping for frequency, because we hear pitch logarithmically.\n- `LPF.ar(sig, cutoff)` removes harmonics above the cutoff; as it opens and closes you hear the tone\n brighten and darken.\n- `* 0.2` keeps the output from clipping."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for batuhan's buzzer parametrized that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n// A beautiful sc140 tweet by Batuhan Bozkurt, parametrized for real-time changes\n(\n// Start sound here\na = { | rateL = 5, rateR = 6, blipMul = 100, blipAdd = 50, fMul = 50, kMul = 1 |\n f = LocalIn.ar(2).tanh;\n k = Latch.kr(f[0].abs,Impulse.kr(1/4)) * kMul;\n LocalOut.ar(\n f +\n CombC.ar(Blip.ar([rateL, rateR], blipMul * k + blipAdd, 0.9), 1, k*0.3, fMul * f));f\n}.play\n);\n\n// Set parameters for changing sound here: \n\na.set(\\rateL, 10);\n\na.set(\\rateR, 8);\n\na.set(\\blipMul, 25);\n\na.set(\\blipAdd, 70);\n\na.set(\\fMul, 30);\n\n\na.set(\\kMul, 0.01);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SimpleNumber.log` do?"}, {"role": "assistant", "content": "one-dimensional value Returns: Base e logarithm."}]} +{"conversations": [{"role": "user", "content": "The server stopped responding. What do I do?"}, {"role": "assistant", "content": "In order: `Ctrl+.` (CmdPeriod) to reset scheduling, then `s.reboot` if the server itself is wedged.\nA reboot drops every SynthDef and buffer, so re-add them — which is why real projects keep their SynthDefs\nin a file you can re-evaluate rather than typing them in the REPL.\n\nIf the boot itself fails, the post window has the reason: usually the audio device (another application\nholding exclusive access) or a sample-rate mismatch. `Server.default.options.device` picks a device before\n`s.boot`."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// modulate frequency of a sine oscillator\n\n(\nSynthDef(\"help-MultiplexAnalogIn\", { |out = 0|\n Out.ar(out,\n SinOsc.ar(MultiplexAnalogIn.ar(0, 1).exprange(200, 5000), 0, 0.1)\n )\n}).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// modulate frequency of a sine oscillator\n\n(\nSynthDef(\"help-MultiplexAnalogIn\", { |out = 0|\n Out.ar(out,\n SinOsc.ar(MultiplexAnalogIn.ar(0, 1).exprange(200, 5000), 0, 0.1)\n )\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `CondVar`?"}, {"role": "assistant", "content": "CondVar — Condition variable: block one or more threads until some condition is true"}, {"role": "user", "content": "What does `CondVar.wait` do?"}, {"role": "assistant", "content": "The behavior depends on whether a `predicate` is given. If no `predicate` is given, this method simply blocks the current thread until it is woken by `signalOne` or `signalAll`. Otherwise, this method is equivalent to `while { predicate.value.not } { cond.wait }`. In other words, the thread only blocks if the predicate is false, otherwise it blocks and only resumes once the thread has been signall"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nc = CondVar();\n\nRoutine {\n 1.wait;\n \"waited for 1 second\".postln;\n 1.wait;\n \"waited for another second, now waiting for you to run 'c.signalOne'...\".postln;\n c.wait;\n \"the condition is no longer waiting\".postln;\n 1.wait;\n \"waited for another second, now waiting for you...\".postln;\n c.wait;\n \"the condition is no longer waiting\".postln;\n 1.wait;\n \"the end\".postln;\n}.play;\n);\n\n// Run this line to unblock the routine\nc.signalOne;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Compander` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var z;\n\n // signal (clean)\n z = Decay2.ar(\n Impulse.ar(8, 0, LFSaw.kr(0.3, 1, -0.3, 0.3)),\n 0.001,\n 0.3\n )\n * Mix.ar(Pulse.ar([80, 81], 0.3));\n\n // apply gate (mouse x sets treshold)\n Compander.ar(z, z,\n thresh: MouseX.kr(0.001, 1),\n slopeBelow: 10,\n slopeAbove: 1,\n clampTime: 0.01,\n relaxTime: 0.01\n )\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// create an audio-rate sine wave at 200 Hz,\n// starting with phase 0 and an amplitude of 0.5\n{ SinOsc.ar(200, 0, 0.5) }.play;\n\n// modulate the frequency with an exponential ramp\n{ SinOsc.ar(XLine.kr(2000, 200), 0, 0.5) }.play;\n\n// more complex frequency modulation\n{ SinOsc.ar(SinOsc.ar(XLine.kr(1, 1000, 9), 0, 200, 800), 0, 0.25) }.play;\n\n// phase modulation (see also PMOsc)\n{ SinOsc.ar(800, SinOsc.ar(XLine.kr(1, 1000, 9), 0, 2pi), 0.25 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// create an audio-rate sine wave at 200 Hz,\n// starting with phase 0 and an amplitude of 0.5\n{ SinOsc.ar(200, 0, 0.5) }.play;\n\n// modulate the frequency with an exponential ramp\n{ SinOsc.ar(XLine.kr(2000, 200), 0, 0.5) }.play;\n\n// more complex frequency modulation\n{ SinOsc.ar(SinOsc.ar(XLine.kr(1, 1000, 9), 0, 200, 800), 0, 0.25) }.play;\n\n// phase modulation (see also PMOsc)\n{ SinOsc.ar(800, SinOsc.ar(XLine.kr(1, 1000, 9), 0, 2pi), 0.25) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `In` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n(\nSynthDef(\"help-PinkNoise\", { |out = 0|\n Out.ar(out, PinkNoise.ar(0.1))\n}).add;\n\nSynthDef(\"help-In\", { |out = 0, in = 0|\n var input;\n input = In.ar(in, 1);\n Out.ar(out, input);\n\n}).add;\n);\n\n// play noise on the right channel\nx = Synth(\"help-PinkNoise\", [\\out, 1]);\n\n// read the input and play it out on the left channel\nSynth.after(x, \"help-In\", [\\out, 0, \\in, 1]);\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `VarGui`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// synth definition with raising frequency\n\n(\nSynthDef(\\synth_0, { |devFactor = 0.1, devFreq = 10, amp = 0.1|\n var freq = XLine.kr(400, 1200, 10); \n Out.ar(0, SinOsc.ar(SinOsc.ar(devFreq, 0, devFactor * freq, freq), mul: amp).dup(2) * EnvGate.new) \n}).add;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for UI sounds (pt1): bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n// UI sounds\n// this code is an attempt to recreate a sound\n// inspired from some technological/electrical UI interface\n\n// 1. first define the synth\n// Here we are using the FM technique\n(\nSynthDef(\\fmmod, {\n |\n amp=0.2,\n fc=1000,\n fm = 100,\n idx = 100,\n atk=0.01,\n rls=0.1\n |\n var env = EnvGen.ar(Env.perc(atk, rls), doneAction:2);\n var modulator = SinOsc.ar(fm);\n var carrier = SinOsc.ar(fc + (idx*modulator) );\n var sig = carrier * env * amp;\n sig = HPF.ar(sig, 1000);\n Out.ar(0, sig!2);\n}).add;\n);\n\n// 2. then define the Pbind which will play the sequence\n// of UI sounds simulating variuos characters showing up on an\n// imaginary display.\n// Play around FC, FM, ATK and RLS to obtain different sound characters.\n(\np = Pbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 100,\n \\idx, 100,\n \\amp, 0.6,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).asEventStreamPlayer;\n);\n\n// 3. play it\np.play;\n\n// 4. Here are some presets\n\n// \"cricket\" preset\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 100,\n \\idx, 100,\n \\amp, 0.6,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 2\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 1000,\n \\idx, 100,\n \\amp, 0.6,\n \\atk, 0.001,\n \\rls, 0.01,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 3\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 100,\n \\idx, 10,\n \\amp, 0.4,\n \\atk, 0.01,\n \\rls, 0.01,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 4\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 1000,\n \\fm, 100,\n \\idx, 1000,\n \\amp, 0.2,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n\n// preset 5\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 5000,\n \\fm, 1000,\n \\idx, 1000,\n \\amp, 0.4,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 5\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 8000,\n \\fm, 1000,\n \\idx, 1000,\n \\amp, 0.7,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var f = { |l,h| SinOsc.kr(0.1, {pi.rand}).range(l, h) } ;\n Pulse.ar({ f.(20, 1000) }!6, { f.(0.0, 1) }!6, { f.(0.0, 1.0) }!6)\n}.play;\n);\n\nc = s.scope;\nc.numChannels = 6;\nc.scopeView.waveColors = [Color.red, Color.red, Color.cyan, Color.cyan, Color.white, Color.white;\nc.style = 2;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var f = { |l,h| SinOsc.kr(0.1, {pi.rand}).range(l, h) } ;\n Pulse.ar({ f.(20, 1000) }!6, { f.(0.0, 1) }!6, { f.(0.0, 1.0) }!6)\n}.play;\n);\n\nc = s.scope;\nc.numChannels = 6;\nc.scopeView.waveColors = [Color.red, Color.red, Color.cyan, Color.cyan, Color.white, Color.white];\nc.style = 2;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `IdentityDictionary`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_sinegrain, { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0.5pi, env))\n}).add;\n\na = Pbind(\\instrument, \\help_sinegrain, \\note, Pseq([0, 7, 2, 9, 11, 10, 9, 8], inf), \\dur, 1);\na.play(quant: (quant: 1, phase: 0));\na.play(quant: (quant: 1, phase: 1/3));\na.play(quant: (quant: 1, phase: 1.0.rand));\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Patch.argsForSynth` do?"}, {"role": "assistant", "content": "Pairs an Instr with inputs that that will be passed to the Instr"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `CoinGate`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\na = SynthDef(\"help-TCoin\", { |out = 0, prob = 0.5|\n var trig;\n trig = CoinGate.kr(prob, Impulse.kr(10));\n Out.ar(out,\n SinOsc.ar(\n TRand.kr(300.0, 400.0, trig), 0, 0.2\n )\n )\n}).play;\n);\n\na.set(\\prob, 1.0);\na.set(\\prob, 0.0);\na.set(\\prob, 0.1);\n\n\n(\na = SynthDef(\"help-TCoin\", { |out = 0, prob = 0.5|\n var trig;\n trig = Impulse.ar(20, 0, SinOsc.kr(0.5, 0, 1, 1));\n Out.ar(out,\n Mix.fill(3, { Ringz.ar(CoinGate.ar(prob, trig*0.5), #[1, 1.5]*Rand(1000, 9000), 0.01) })\n )\n}).play;\n);\n\na.set(\\prob, 1.0);\na.set(\\prob, 0.0);\na.set(\\prob, 0.1);\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `BufSampleRate`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n// compares a 1102.5 Hz sine tone (11025 * 0.1, left) with a 1100 Hz tone (right)\n// the apollo sample has a sample rate of 11.025 kHz\n(\n{\n var freq;\n freq = [BufSampleRate.kr(b) * 0.1, 1100];\n SinOsc.ar(freq, 0, 0.1)\n}.play;\n);\n\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "I edited a SynthDef and the running sound did not change."}, {"role": "assistant", "content": "Redefining a SynthDef only affects Synths created after the new definition reaches the server; existing instances keep the graph they were built with. Free and recreate them: `~s.free; ~s = Synth(\\name)`. In JITLib, Ndef is the tool designed for this — redefining `Ndef(\\name, { ... })` crossfades to the new graph while it plays."}]} {"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ CheckBadValues.kr(SinOsc.ar); 0 }.play // nothing wrong here\n\n{ CheckBadValues.kr(1 / 0, 1).poll; 0 }.play // check infinity\n\nx = { |test = -1| CheckBadValues.kr(test); 0 }.play // check NaN\nx.set(\\test, -1.sqrt);\n\n// don't post, but do something with the output\n(\nx = { |freq = 440|\n var good;\n good = BinaryOpUGen('==', CheckBadValues.kr(freq, 0, 0), 0);\n SinOsc.ar(freq, 0, 0.1) * good // silence the output if freq is bad\n}.play;\n);\nx.set(\\freq, -1.sqrt);\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ CheckBadValues.kr(SinOsc.ar); 0 }.play // nothing wrong here\n\n{ CheckBadValues.kr(1 / 0, 1).poll; 0 }.play // check infinity\n\nx = { |test = -1| CheckBadValues.kr(test); 0 }.play // check NaN\nx.set(\\test, -1.sqrt);\n\n// don't post, but do something with the output\n(\nx = { |freq = 440|\n var good;\n good = BinaryOpUGen('==', CheckBadValues.kr(freq, 0, 0), 0);\n SinOsc.ar(freq, 0, 0.1) * good // silence the output if freq is bad\n}.play;\n);\nx.set(\\freq, -1.sqrt);\n\n// the UGen method checkBadValues passes through the input for quick testing\n{ SinOsc.ar(440, 0, 0.1).checkBadValues }.play\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// a strange mapping\n(\nvar f = { |degree, stepsPerOctave, acc|\n (1.8 ** (degree % stepsPerOctave) + acc).postln\n};\nPbind(\n \\scale, f,\n \\degree, Pseq([0, 1, 2b, 3s, 4s, 6, 14, [0, 2, 4], [1, 3, 6]], inf)\n).play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// a strange mapping\n(\nvar f = { |degree, stepsPerOctave, acc|\n (1.8 ** (degree % stepsPerOctave) + acc).postln\n};\nPbind(\n \\scale, f,\n \\degree, Pseq([0, 1, 2b, 3s, 4s, 6, 14, [0, 2, 4], [1, 3, 6]], inf)\n).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Multichannel Convolution Reverb (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\n~numIRs = 4;\n~fftsize = 2048;\ns.waitForBoot {\n var irs, irbuffs, bufsizes, nextmod, numSamples;\n nextmod = 100;\n numSamples = 40000 ;\n \n /* an array of multiple IRs */\n irs = ~numIRs.collect{ arg nth;\n // nth is here not used, but can be useful to scale decay time.\n [0] ++ 0.dup(100) ++ Array.fill(\n numSamples, { arg i;\n (i%nextmod==0).if\n {\n nextmod= rrand(80, 120);\n (i.asFloat/numSamples).squared * 0.3\n } {\n 0\n }\n }\n )\n };\n { irs.plot }.defer; // to show irs.\n \n /* an array of buffers. */\n irbuffs = ~numIRs.collect{ arg i; Buffer.loadCollection(s, irs[i]) };\n irbuffs.postln; // to show irbuffs info.\n s.sync;\n \n bufsizes= irbuffs.collect{ |nth|PartConv.calcBufSize(~fftsize, nth) };\n ~irSpctrms = bufsizes.collect{ arg size, i;\n Buffer\n .alloc(s, size, 1)\n .preparePartConv(irbuffs[i], ~fftsize)\n };\n s.sync; \n \n ~numIRs.do{|i| irbuffs[i].free}\n}\n);\n\n(\nfork{\n ~target= Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n s.sync;\n {\n var in, krnl;\n in= PlayBuf.ar(1, ~target, loop:1);\n \n /* an array of multiple instances of PartConv */\n krnl= ~numIRs.collect{ arg i;\n PartConv.ar(in, ~fftsize, ~irSpctrms[i].bufnum, 0.2)};\n // By iterating, each PartConv processes a mono-channel buffer in the array ~irSpctrms.\n \n Out.ar(0, krnl);\n }.play\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What are the server's default sample rate and block size?"}, {"role": "assistant", "content": "44100 Hz and 64 samples per block by default, so the control rate is 44100/64 = 689.06 Hz. You can read them from the language with `s.sampleRate` and `s.options.blockSize`, or from inside a Synth with `SampleRate.ir` and `ControlRate.ir`. A `.kr` signal therefore updates about 689 times a second, which is why it is smooth enough for filters and envelopes but not for audio-rate FM."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `DetectSilence`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"detectSilence-help\", { |out|\n var z;\n z = SinOsc.ar(Rand(400, 700), 0, LFDNoise3.kr(8).max(0)).softclip * 0.3;\n DetectSilence.ar(z, doneAction: Done.freeSelf);\n Out.ar(out, z);\n}).add;\n);\n\nSynth(\"detectSilence-help\");\nSynth(\"detectSilence-help\");\nSynth(\"detectSilence-help\");\n\n\n(\nTask({\n loop({\n Synth(\"detectSilence-help\");\n [0.5, 1].choose.wait;\n })\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\nb = Buffer.read(s, ExampleFiles.child);\n\n(\nSynthDef(\"help-magNoise\", { |out = 0|\n var in, chain;\n in = SinOsc.ar(SinOsc.kr(SinOsc.kr(0.08, 0, 6, 6.2).squared, 0, 100, 800));\n chain = FFT(LocalBuf(2048), in);\n chain = PV_MagNoise(chain);\n Out.ar(out, 0.1 * IFFT(chain).dup);\n}).play(s);\n);\n\n(\nSynthDef(\"help-magNoise2\", { |out = 0, soundBufnum = 2|\n var in, chain;\n in = PlayBuf.ar(1, soundBufnum,\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\nb = Buffer.read(s, ExampleFiles.child);\n\n(\nSynthDef(\"help-magNoise\", { |out = 0|\n var in, chain;\n in = SinOsc.ar(SinOsc.kr(SinOsc.kr(0.08, 0, 6, 6.2).squared, 0, 100, 800));\n chain = FFT(LocalBuf(2048), in);\n chain = PV_MagNoise(chain);\n Out.ar(out, 0.1 * IFFT(chain).dup);\n}).play(s);\n);\n\n(\nSynthDef(\"help-magNoise2\", { |out = 0, soundBufnum = 2|\n var in, chain;\n in = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);\n chain = FFT(LocalBuf(2048), in);\n chain = PV_MagNoise(chain);\n Out.ar(out, 0.2 * IFFT(chain).dup);\n}).play(s, [\\soundBufnum, b]);\n);\n\nb.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for muffled thump?"}, {"role": "assistant", "content": "```supercollider\n(\n{ var nse, env, kic;\n kic = tanh(Ringz.ar(LPF.ar(Trig.ar(Impulse.ar(1.0),SampleDur.ir),1000),30,0.25,7).sin*2);\n env = Env.perc(0.05, 1, 1, -4);\n nse = BrownNoise.ar(2) + PinkNoise.ar(0.5) * EnvGen.kr(env,Impulse.kr(1), doneAction: 2);\n\n nse = Mix.ar(BPF.ar(nse,[100,1200,80,40,20],MouseX.kr(0,1),[1,0.2,1,1,1]));\n nse = LPF.ar(nse + kic, MouseY.kr(100,1000))! 2\n\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is a UGen?"}, {"role": "assistant", "content": "A UGen is a unit generator: the primitive signal-processing node of the server. SinOsc, Saw, WhiteNoise, LPF and EnvGen are UGens, and they are wired into a graph inside a SynthDef."}]} -{"conversations": [{"role": "user", "content": "What does `UnicodeResponder.new` do?"}, {"role": "assistant", "content": "register responder functions for unicode and modifier combinations"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Peak`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n SinOsc.ar(\n Peak.ar(Dust.ar(20), Impulse.ar(0.4)) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// follow a sine lfo, reset rate controlled by mouse x\n(\n{\n SinOsc.ar(\n Peak.kr(SinOsc.kr(0.2), Impulse.kr(MouseX.kr(0.01, 2, 1))) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes vinyl noise emulation."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef.new(\\vinylCrackling, { arg out=0;\n var pop,imp,modImp,midNoise,hiNoise,loNoise,loopTime=8,numChan=2,w,x,y;\n\n //Harder pops\n pop = TDuty.ar(Dseq({ 1.0.bilinrand.abs } ! loopTime,inf));\n pop = Resonz.ar(Decay.ar(pop,TRand.ar(0.001,0.1,pop)),Demand.ar(pop,0,Dseq({ 7000.bilinrand.abs+40 } ! loopTime,inf)),\n mul:Demand.ar(pop,0,Dseq({ exprand(0.1,0.87) } ! loopTime,inf)));\n pop = LeakDC.ar(pop,TRand.ar(0.9,0.9995,pop));\n #w,x,y = PanB2.ar(pop,Demand.ar(pop,0,Dseq({ 1.0.rand2 } ! loopTime,inf)));\n\n //Softer, highpass filtered impulses\n imp = { arg i; HPF.ar(LPF.ar(Dust2.ar(8),8000.0),6000.0,WhiteNoise.ar(0.7)) } ! numChan;\n\n //Faster, modulated lowpass filtered impulses\n modImp = LPF.ar(Dust.ar(LFDNoise3.ar(1).exprange(100,500),LFDNoise3.ar(10).exprange(0.01,0.07)),9000.0) ! numChan;\n\n //Mid frequency modulated noise background\n midNoise = LPF.ar(GrayNoise.ar(LFDNoise3.ar(60))*WhiteNoise.ar(0.009),12000.0) ! numChan;\n\n //High frequency modulated noise background\n hiNoise = HPF.ar(LPF.ar(GrayNoise.ar(LFDNoise3.ar(60))*WhiteNoise.ar(0.01),14000.0),8000.0) ! numChan;\n\n //Low frequency modulated noise background\n loNoise = LPF.ar(BrownNoise.ar(PinkNoise.ar.range(0.001,0.02)),1200) ! numChan;\n\n Out.ar(out,DecodeB2.ar(numChan,w,x,y)+imp+modImp+midNoise+hiNoise+loNoise);\n }).add;\n);\n\ns.sendMsg('/s_new',\\vinylCrackling,a=s.nextNodeID,0,1,\\out,0);\ns.sendMsg('/n_free',a);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Another Star Wars inspired sound effect."}, {"role": "assistant", "content": "```supercollider\n(\n\n{\n\nvar flutter, flutterAmt = 0.02, humPitch = 88, hum, humLevel = 0.3, amp = 1.0, output;\nvar swing, swingNoise, swingLevel = 1.0, swingSwitch, swingThresh = 0.87;\nvar clash, clashTrig, clashDecay, clashEnvGen, clashSpring, clashLevel = 0.6;\n\nflutter = 4.collect(\n { \n |i|\n LFNoise0.kr(rrand(3, 16), flutterAmt, 1).lag(0.48);\n }\n);\n\nhumPitch = humPitch * StandardL.ar(2, 3.7).range(0.97, 1.03);\n\nhum = Mix(SyncSaw.ar([humPitch, humPitch * 1.001] * flutter.copyRange(0, 1), [humPitch * 1.003, humPitch * 1.0025] * flutter.copyRange(2, 3)));\nhum = hum * LFNoise0.kr(8.77224).range(0.2, 1.0).lag(0.4);\nhum = RLPF.ar(hum, LFNoise0.kr(21).range(200, 1800).lag(1.2), 0.5) * 0.1 * humLevel;\n\nhumPitch = humPitch * StandardL.ar(3.8, 2.9).range(0.93, 1.07);\n\nswingNoise = LFNoise1.kr(16.2).range(0, 1);\nswingSwitch = if(swingNoise > swingThresh, 1, 0).lag2(0.9, 1.3);\nswingLevel = swingLevel * swingSwitch;\n\nhumPitch = humPitch * StandardL.ar(3.8, 2.9).range(0.97, 1.03) * (1 + (swingSwitch * 0.2));\n\nswing = SyncSaw.ar(humPitch * 0.501, humPitch * 1.09);\nswing = LPF.ar(swing, 4300);\nswing = swing * swingLevel;\n\nclashTrig = Trig.kr(\n Schmidt.kr(1 - swingSwitch, swingThresh, swingThresh + 0.01),\n 0.01\n);\n\nclashDecay = TRand.kr(0.1, 1.6, clashTrig);\nclashEnvGen = Decay.kr(clashTrig, clashDecay) * TRand.kr(0.8, 1.0, clashTrig);\nclashSpring = Spring.kr(clashTrig, TRand.kr(5, 20, clashTrig), TRand.kr(0.001, 0.07, clashTrig));\nclash = SinOsc.ar(8000 * clashSpring + TRand.kr(600, 2342, clashTrig), SinOsc.ar(TRand.kr(452, 662, clashTrig), 0, 2));\nclash = clash + BPF.ar(WhiteNoise.ar(2), SinOsc.kr(2.6).range(3326, 4444), 0.16);\nclash = clash * clashEnvGen;\nclash = clash + ( clash * SinOsc.ar(39) * SinOsc.ar(3013) * 0.3);\nclash = clash * 0.1 * clashLevel;\n\noutput = hum + swing + clash; \n\n(output * amp) ! 2\n\n}.play\n\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// poor man's panning\n{\n var f, hornbostelwertheimerkonstante;\n f = MouseY.kr(1, 100, 1);\n hornbostelwertheimerkonstante = 0.00063;\n Impulse.ar(f, hornbostelwertheimerkonstante * f * [1, MouseX.kr(0, 2)], 0.1) \n}.play\n```"}, {"role": "assistant", "content": "If you are too poor to afford changing the amplitudes of a stereo signal, just let the channels wait. But the signal frequency is an impasse that is to be valued in itself."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// try wiggling mouse quickly:\n// LFNoise2 overshoots when going from high to low freqs, LFDNoise changes smoothly.\n\n{ SinOsc.ar(LFNoise2.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n{ SinOsc.ar(LFDNoise3.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFNoise2.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n\n{ LFDNoise3.ar(XLine.kr(2000, 20000, 8), 0.1\n// …\n```"}, {"role": "assistant", "content": "try wiggling mouse quickly: LFNoise2 overshoots when going from high to low freqs, LFDNoise changes smoothly. (LFDNoise3: Dynamic cubic noise)"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n(\np = Pbind(\n \\midinote, PlaceAll([[60, 61], 70, [80, [81, 81.5], 82]], inf),\n \\dur, 0.2\n);\n\nx = p.play;\n);\n\nx.stop;\n\n\n// to distinguish subarrays from arrays to be taken as output use Refs, \n// as wrapping in another array wouldn't do\n\n(\np = Pbind(\n \\midinote, PlaceAll([[60, 61], 70, [80, `[81, 81.5], 82]], inf),\n \\dur, 0.2\n);\n\nx = p.play;\n) ;\n\n\nx.stop;\n\n\n// Items may also\n// …\n```"}, {"role": "assistant", "content": "to distinguish subarrays from arrays to be taken as output use Refs, as wrapping in another array wouldn't do (PlaceAll: Arbitrarily nested embedding of subarrays)"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Idea: network of loosely connected nodes?"}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\nodeTest, {\n // the input\n// var input = Impulse.ar([1, 3, 5].reciprocal * 1, phase: [0, 0.25, 0.5]).sum;\n\n //var input = Impulse.ar([2, 3], phase: [0, 0.25]).sum;\n// var input = Select.ar(Line.kr(0, 1, 10) * SinOsc.ar(0.01).range(0, 1), [Impulse.ar([0.2, 0.3], phase: [0, 0.25]).sum, LocalIn.ar(1)]);\n\n var input = Select.ar(Line.kr(0, 1, 10), [Impulse.ar(0.134), LocalIn.ar(1)]);\n // the nodes, each takes its predecessor as input and estimates the duration between two events.\n var nodes = (1..20).inject([input], {|last, item|\n var dur = Gate.ar(\n Timer.ar(TDelay.ar(last.first, Rand(1, 4))),\n last.first\n );\n\n [TDuty.ar(\n dur.lag(20),\n TDelay.ar(last.first, dur.lag(20)),\n 1\n )] ++ last\n });\n\n\n LocalOut.ar(nodes.first);\n\n // add a pitch to each\n nodes = nodes.collect{|node, i| SinOsc.ar((500 + (i*250)), 0.9pi)\n// * Decay2.ar(node, 0.01, 0.2)\n * EnvGen.ar(Env.perc(0.0001, 0.1), gate: node)\n * 2 * (25-i) * 0.01};\n\n // splay in stereo field\n //nodes.sum!2;\n Splay.ar(nodes)// + (SinOsc.ar(2000) * Decay2.ar(input, 0.01, 0.2) * 0.1);\n\n}).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for seasonal reflections )?"}, {"role": "assistant", "content": "```supercollider\n(\nfork { loop { \n Ndef(\\winter_curves, {\n var bands = 5.rrand(15) * 2;\n var freqs = Array.exprand(bands.debug('bands'), 20, 18000);\n Pan2.ar(\n SinOsc.ar(\n freqs, \n Array.rand(bands, 0, pi),\n AmpCompA.kr(freqs, freqs.sort.first)\n ).perform(0.5.coin.if(\\tanh,\\value).debug('kind')),\n FSinOsc.kr(\n Array.exprand(bands, 0.01, 15),\n Array.rand(bands, 0, pi),\n ),\n bands.reciprocal\n * LFGauss.kr(SinOsc.kr(Array.rand(bands, 0.05, 0.1)).range(1,10), 0.3)\n * FSinOsc.kr(\n Array.exprand(bands, 0.1, 15),\n 0.3\n ).range(0,1)\n ).sum\n * SelectX.kr(\n FSinOsc.kr(Array.exprand(bands, 0.1, 15)).range(0,1),\n [\n EnvGen.kr(\n Env.perc(\n FSinOsc.kr(1/16).range(0.01,0.1),\n FSinOsc.kr(1/8).range(0.25,0.3)\n ).blend(\n Env.sine( // 1/4\n FSinOsc.kr(Array.exprand(bands, 0.1, 15)).range(0.05,2)\n ).blend(\n Env.sine(1/4),\n FSinOsc.kr(Array.exprand(bands, 0.1, 15)).range(0.05,2).mean\n ),\n FSinOsc.kr(Array.exprand(bands, 0.1, 15)).range(0,1)\n ).circle,\n 1, 0.8, \n FSinOsc.kr(freqs.linlin(20,18000,0.1,20)).range(0, 0.2).mean\n ),\n 1\n ]\n ).clump(2).mean\n }).fadeTime_(0.5.rrand(2.5)).play;\n 8.rrand(30).debug('len').wait;\n} }\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `RedWorld3` in SuperCollider briefly."}, {"role": "assistant", "content": "RedWorld3 — world with hard walls See also RedWorld, RedWorld1, RedWorld2. Category: Red > redUniverse."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PlazyEnvir`."}, {"role": "assistant", "content": "```supercollider\n(\na = PlazyEnvir({ |a = 0, b = 1| Pshuf([a, a, b], 2) }); // a, b default to 0, 1\nx = Pn(a, inf).asStream;\n\n10.do { x.next.postln }; Post.nl;\ne = (a: 100);\n10.do { x.next(e).postln }; Post.nl;\ne = (a: 100, b: 200);\n10.do { x.next(e).postln };\n);\n\n\n// PlazyEnvir used to produce a Pbind:\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05, pan = 0|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, Pan2.ar(SinOsc.ar(freq, 0, env), pan))\n }).add;\n\na = PlazyEnvir({ |g = 0, h = 0, dur = 1|\n postf(\"g: %, h: %, dur: %\\n\", g, h, dur);\n Pbind(\n \\instrument, \\help_sinegrain,\n \\dur, dur,\n \\degree, Pseq([g, g, h, g, h], 2)\n )\n});\n);\n\n// different variants\n(a <> (g: 0, h: 3, dur: 0.2)).play; // single stream\n(a <> (g: [0, 4], h: [3, -1], dur: 0.2)).play; // same durations, two streams\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Re: the perfect frequencies?"}, {"role": "assistant", "content": "```supercollider\n// Rumush\n// https://mycelialcordsblog.wordpress.com/\n// https://fungorumush.bandcamp.com/releases\n// https://soundcloud.com/fungorum\n\n(\nf = {\n var rep = [4, 8, 16, 32];\n var n = rep.choose;\n var x = [\n\n 54, 60, 66, 72, 81, 90, 96, 102,\n 108, 128, 132, 144, 162, 180, 192, 204,\n 216, 240, 264, 288, 324, 360, 384, 408,\n 432, 480, 528, 576, 648, 720, 768, 816,\n 864, 960, 1056, 1152, 1296, 1440, 1536, 1632,\n 1728, 1920, 2112, 2304, 2592, 2880, 3072, 3264,\n 3456, 3840, 4224, 4608, 5184, 5760, 6144, 6528,\n 6912, 7680, 8448, 9216, 10368, 11520, 12288, 528\n\n ];\n Mix.fill(n,\n {\n var detune = 5.rand;\n var sin = SinOsc.ar(x.choose, 4.rand, 0.25);\n var saw = RLPF.ar(Saw.ar(x.choose*0.01+detune, 0.75), x.choose, 2.rand).tanh;\n Pan2.ar((sin+saw) * EnvGen.kr(Env.sine(12, 1/n), 1, doneAction:2),\n 1.rand2) }\n );\n};\n);\n\n(\n// DEFINE A ROUTINE\nr = Routine({\n\n inf.do({\n f.play;\n 10.wait;\n })\n});\n);\n\nr.reset.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes DelayPannerSawSine (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n//delaypannersawsine\n{XFade2.ar(AllpassC.ar(HPF.ar(RLPF.ar(Saw.ar(LFPar.kr(0.25).range(220,440)),LFPar.kr(MouseX.kr(0,8),pi).range(220,20000),0.3),LFPar.kr(MouseY.kr(0,8)).range(220,20000)),2,MouseX.kr(0,2),2),AllpassC.ar(HPF.ar(RLPF.ar(WhiteNoise.ar * Saw.ar(LFPar.kr(0.25).range(220,440)),LFPar.kr(MouseX.kr(0,8),pi).range(220,20000),0.3),LFPar.kr(MouseY.kr(0,8)).range(220,20000)),2,MouseY.kr(0,2),2),MouseX.kr(-1,1))}.play\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes ~chaos2 (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\n~chaos2={\n var signal, myFrequency, frequencyMin=0.1, frequencyMax=30, myAmplitude, amplitudeMin=0.01, amplitudeMax=0.6, myPhase, phaseMin=0, phaseMax=1.5;\n myFrequency = Array.fill(2, {[rrand(frequencyMin, frequencyMax)]});\n myAmplitude = Array.fill(2, {[rrand(amplitudeMin, amplitudeMax)]});\n myPhase = Array.fill(2, {[rrand(phaseMin, phaseMax)]});\n signal = LeakDC.ar(ChaosGen.allSubclasses.choose.ar(myFrequency, myPhase, myAmplitude));\n myFrequency = (myFrequency + Array.fill(2, {[rrand(frequencyMin, frequencyMax)]})) * (signal);\n myAmplitude = (myAmplitude + Array.fill(2, {[rrand(amplitudeMin, amplitudeMax)]})) * (signal);\n myPhase = (myPhase + Array.fill(2, {[rrand(phaseMin, phaseMax)]}))* (signal);\n signal = LeakDC.ar(ChaosGen.allSubclasses.choose.ar(myFrequency, myPhase, myAmplitude));\n myFrequency = (myFrequency + Array.fill(2, {[rrand(frequencyMin, frequencyMax)]})) * (signal);\n myAmplitude = (myAmplitude + Array.fill(2, {[rrand(amplitudeMin, amplitudeMax)]})) * (signal);\n myPhase = (myPhase + Array.fill(2, {[rrand(phaseMin, phaseMax)]}))* (signal);\n signal = LeakDC.ar(ChaosGen.allSubclasses.choose.ar(myFrequency, myPhase, myAmplitude));\n Out.ar(0, LeakDC.ar(signal * 0.3));\n};\n);\n\n~chaosmegafeedback={Mix.new(~chaos2 ! 16) * 0.00000000000000000000000003}.scope;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n~x.play;\n\n~x = { var alpha,beta; alpha = rrand(99,399); beta = alpha = rrand(99,399);Pan2.ar(LeakDC.ar(Normalizer.ar(BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(\nFreeVerb.ar(Formant.ar(TRand.kr(alpha,alpha+(rrand(5,20)),Impulse.kr(rrand(10,100))), TRand.kr(beta,beta+(rrand(5,20)),Impulse.kr(rrand(10,100))), EnvGen.kr(Env.adsr,Impulse.kr(rrand(100,666)))*rrand(666,3333),0.125),\nrrand(0.5,1.0),rrand(0.5,1.0),rrand(0.5,1.0))\n,100,6.0,12),1000,6.0,0),5000,6.0,0),10000,6.0,12),0.6,0.1)),0)\n};\n```"}, {"role": "assistant", "content": "A drone insect-string from:\r\n\r\nhttp://musicnumbers.wordpress.com/2011/11/25/nx010/."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes a Panthera Pardus meditates about his melanism."}, {"role": "assistant", "content": "```supercollider\n// a Panthera Pardus meditates about his melanism\n\n(\n~chrs = {|in, speed| DelayC.ar(in, 0.5, Array.fill(12, {|i| LFNoise2.ar(speed).range(0.022, 0.024);}).sum)};\n~phas = {|in, speed=1| var chain; chain = in+FreqShift.ar(in, 0, SinOsc.kr(speed).range(0, pi)).tanh; chain = chain + FreqShift.ar(chain, 0, SinOsc.kr(speed*0.97).range(0, pi)).tanh; chain=(chain*0.5).tanh; };\n~smear = {|in, bins=50| var chain; chain=FFT(LocalBuf(2048), in); chain=PV_MagSmear(chain, bins); chain=IFFT(chain)*0.5; };\n\nNdef.clear;\nNdef(\\pantheraPardus___).play;\nNdef(\\___hisInner).play;\nNdef(\\pantheraPardus___).fadeTime = 5;\nNdef(\\___hisInner).fadeTime = 50;\n\nNdef(\\pantheraPardus___, {arg amp=1;\n var sig, env, sig0, ctrl;\n ctrl = LFGauss.kr(5, 0.15);\n sig = (Saw.ar([LFNoise1.kr(1).range(15, 30), 0.025], 0.14)) * LFNoise2.kr(1).range(0.5, 1);\n sig = (sig + PinkNoise.ar(0.1) * LFNoise2.kr(1).range(0.1, 0.4)) * ctrl;\n sig = sig*0.25 + ~chrs.(~phas.(sig, [0.2, 0.174]), [0.1, 0.12]);\n sig = DynKlank.ar(`[[100, 200, 300, 1000, 4000, 9000], (ctrl.range(0.2/6, 1/6)*LFNoise2.kr(1).range(0.2, 1))!6, 0.025], sig*0.2);\n sig = ~smear.(sig, 5);\n sig = HPF.ar(LPF.ar(sig, (LFNoise2.kr(1.25).range(100, 2000))), 250); \n sig = Limiter.ar(GVerb.ar(Limiter.ar(sig), 4.5, 0.2, 0.9, 0.1), -6.dbamp)*15;\n});\n\nNdef(\\___hisInner, {arg amp=1;\n var sig = Saw.ar(Duty.kr(Dseq([2, 4, 1, 1/4, 8], inf), 0, Dseq([61+(1/6), [63+(3/6), 58+(3/6)], 64+(3/6)].midicps, inf)), 0.14);\n sig = LPF.ar(sig, LFNoise0.kr(15).range(5120, 9400).lag(0.001), 0.01);\n sig = DynKlank.ar(`[[100, LFNoise0.kr(2).range(300, 320), 4000], 1/3, 0.04], sig);\n sig = ~chrs.(~phas.(sig, [0.2, 0.174]), [0.1, 0.12]);\n sig = HPF.ar(LPF.ar(sig, 1200), 400)*15;\n sig = Limiter.ar(FreeVerb.ar(sig, [0.8, 0.78]), -6.dbamp);\n});\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// create a DMX object, default to a single universe of 512 channels\nd = SimpleDMX();\n\n// get a fixture and set its color\nf = SimpleDMXFixture(0, 5, universeId: 0, desc: (\\channelTypes: #[dim, r, g, b, white]));\nf.setColor(Color.white);\n\n// add the fixture to the DMX state\nd.add(f);\n\n// get state\nd.getState\n```"}, {"role": "assistant", "content": "create a DMX object, default to a single universe of 512 channels get a fixture and set its color (SimpleDMX: an abstract DMX interface)"}]} -{"conversations": [{"role": "user", "content": "What does `Fb1_ODEintdef.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new Fb1_ODEintdef object and stores it in a Dictionary for further usage with Arguments: name — The name of the integration procedure, expects a Symbol. Default Fb1_ODEintdefs cannot be overwritten.; function — The implementation of the Function (\"stepper\") which describes the numeric procedure. It must take the arguments odeDef, t, y, dt and ... args for further ODE args and must return the new integration value(s). For evaluating the ODE function the method Fb1_ODEdef.value is used which performs the eva; stepDepth — Integer. Values greater than one are for multi-step procedures. Defaults to 1.; sizeFactor — Integer. 1 means that the procedure buffers only integration values, 2 means that the differential is buffered too. Defaults to 1.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\n(\nvar orc;\norc = Environment.make {\n ~a = { |freq, amp, pan|\n Pan2.ar(SinOsc.ar(freq), pan, amp);\n };\n ~b = { |amp, pan, freq|\n Pan2.ar(RLPF.ar(Saw.ar(freq), freq * 6, 0.1), pan, amp);\n };\n ~c = { |pan, freq, amp|\n Pan2.ar(Resonz.ar(GrayNoise.ar, freq * 2, 0.1), pan, amp * 2);\n };\n ~orc = [~a, ~b, ~c];\n};\n// 'reverb'\n{ var in; in = In.ar(0, 2); CombN.ar(in, 0\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\n(\nvar orc;\norc = Environment.make {\n ~a = { |freq, amp, pan|\n Pan2.ar(SinOsc.ar(freq), pan, amp);\n };\n ~b = { |amp, pan, freq|\n Pan2.ar(RLPF.ar(Saw.ar(freq), freq * 6, 0.1), pan, amp);\n };\n ~c = { |pan, freq, amp|\n Pan2.ar(Resonz.ar(GrayNoise.ar, freq * 2, 0.1), pan, amp * 2);\n };\n ~orc = [~a, ~b, ~c];\n};\n// 'reverb'\n{ var in; in = In.ar(0, 2); CombN.ar(in, 0.2, 0.2, 3, 1, in) }.play(addAction: \\addToTail);\n\n{ loop({\n orc.use({\n // set values in the environment\n ~freq = exprand(80, 600);\n ~amp = 0.1;\n ~pan = 1.0.rand2;\n\n // call a randomly chosen instrument function\n // with values from the environment\n\n x = { ~orc.choose.valueEnvir }.play(fadeTime: 0.2, addAction: \\addToHead);\n 0.2.wait;\n x.release(0.2);\n });\n}) }.fork;\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// you have to write the sample path in the firts line\n\n~bufferdue = Buffer.read(s,\" WRITE YOUR SAMPLE PATH HERE \", bufnum:2);\n\n(\nSynthDef.new(\\bufbeat, {\n arg amp = 1, out = 0, buf, start, end, freq = 1;\n var sig, ptr;\n ptr = LFNoise1.ar(freq).range(0.0,end);\n sig = BufRd.ar(2, buf, ptr);\n sig = sig * amp;\n Out.ar(out, sig);\n}).add\n);\n\nx = Synth.new(\\bufbeat, [\\buf, ~bufferdue.bufnum, \\start,0, \\end, ~bufferdue.numFrames-1, \\freq, 1, \\amp, 0.5],g);\n\nx.free;\n```"}, {"role": "assistant", "content": "a simple BufRd with the starting point of lecture randomized by LFNoise1."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\np = PHS(h, [], 0.15, [ \\midinote, Pkey(\\val) ]).play;\n\n// also:\n// p = PHS(h, [], 0.15, [ \\midinote, Pfunc { |e| e.use { ~val } } ]).play;\n\n// stop allows resuming, cleanup with free or Cmd-. \n\np.stop; // HS synth still playing \n\np.play; // resume the PHSplayer\n\np.stop(true); // HS synth also paused \n\np.play; // resume the PHSplayer together with HS synth\n\np.free; // also stop HS synth and cleanup - PHSplayer and HS object are freed\n```"}, {"role": "assistant", "content": "p = PHS(h, [], 0.15, [ \\midinote, Pfunc { |e| e.use { ~val } } ]).play; stop allows resuming, cleanup with free or Cmd-. (HS: object for use of synth values in the language by event patterns)"}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n~buf = Buffer.read(s, \"C:/sounds/break.wav\");\nPlayBuf.ar(1, ~buf, BufRateScale.kr(~buf), loop: 1);\n```"}, {"role": "assistant", "content": "Loads a sound file into server memory, then plays it in a loop at the file's original pitch.\n\n- `Buffer.read(s, path)` allocates a buffer on the server and fills it from the file. It is asynchronous:\n the Buffer object returns immediately, the samples arrive later.\n- `PlayBuf.ar(1, buf, ...)` needs the channel count first — 1 for a mono file. A wrong count is the usual\n cause of a buffer that plays wrongly or not at all.\n- `BufRateScale.kr(buf)` compensates when the file's sample rate differs from the server's, so `rate: 1` is\n the file's true speed.\n- `loop: 1` restarts at the end instead of stopping.\n\nBecause the read is asynchronous, this line pair is only safe if a `s.sync` or a wait happened in between;\notherwise PlayBuf sees a buffer with no data yet."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = { Ringz.ar(T2A.ar(\\trig.tr), \\freq.kr(500, 1), 0.8) }.play;\na.set(\\freq, 330, \\trig, 1);\na.set(\\freq, 830, \\trig, 1;\na.release;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = { Ringz.ar(T2A.ar(\\trig.tr), \\freq.kr(500, 1), 0.8) }.play;\na.set(\\freq, 330, \\trig, 1);\na.set(\\freq, 830, \\trig, 1);\na.release;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// load a synthdef\ns.boot;\nSynthDef(\"gpdef\",\n { |out = 0, freq = 440, sustain = 0.05, amp = 0.1, pan|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain), doneAction: Done.freeSelf) * amp;\n Out.ar(out, Pan2.ar(SinOsc.ar(freq, 0, env), pan))\n }).add;\n);\n\nPdefn(\\x, Pn(1, 3));\nPdefn(\\y, Prand([5, 9, 1], 2));\nPdefn(\\z, Pdefn(\\y) * 2);\n\n(\nPdef(\\play,\n Pbind(\n \\instrument, \\gpdef,\n \\harmonic, Pns\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// load a synthdef\ns.boot;\nSynthDef(\"gpdef\",\n { |out = 0, freq = 440, sustain = 0.05, amp = 0.1, pan|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain), doneAction: Done.freeSelf) * amp;\n Out.ar(out, Pan2.ar(SinOsc.ar(freq, 0, env), pan))\n }).add;\n);\n\nPdefn(\\x, Pn(1, 3));\nPdefn(\\y, Prand([5, 9, 1], 2));\nPdefn(\\z, Pdefn(\\y) * 2);\n\n(\nPdef(\\play,\n Pbind(\n \\instrument, \\gpdef,\n \\harmonic, Pnsym(Pseq([\\x, \\x, Prand([\\x, \\y]), [\\z, \\y], \\y], inf)).trace,\n \\dur, 0.2, \\note, 10\n )\n).play;\n);\n\n// change root pattern:\nPdefn(\\x, Pn(2, 3));\nPdefn(\\x, Pseq([1, 3, 1, 2, 1, 4, 5]));\nPdefn(\\x, Pseq([1, 3, 1, 2, [1, 3], 4, 5]));\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Ndef.kr` do?"}, {"role": "assistant", "content": "equivalent to `*new(key).kr(numChannels, offset)` (see"}]} -{"conversations": [{"role": "user", "content": "Explain `Position` in SuperCollider briefly."}, {"role": "assistant", "content": "Position — an object that holds the value of the current play position for an object Category: Libraries > crucial > Scheduling."}]} -{"conversations": [{"role": "user", "content": "How do I add reverb with FreeVerb?"}, {"role": "assistant", "content": "`FreeVerb.ar(in, mix, room, damp)` — mix 0..1 is dry/wet, room 0..1 is the size (0.5 is a small room, 0.9 is a hall), damp 0..1 rolls off the high end of the tail. Put it after your sound: `FreeVerb.ar(SinOsc.ar(440) * 0.1, 0.4, 0.8, 0.5)`. For a send-style reverb, write the dry signal to Out.ar(0, …) and the same signal through FreeVerb to a second bus."}]} -{"conversations": [{"role": "user", "content": "How do I put reverb on everything?"}, {"role": "assistant", "content": "Send it: one private bus, one FreeVerb instance reading it, and every instrument writing dry to the master and wet to the bus.\n\n```supercollider\n~verb = Bus.audio(s, 2);\nSynthDef(\\verb, { |in = 0| Out.ar(0, FreeVerb.ar(In.ar(in, 2), 0.5, 0.85, 0.5) * 0.7) }).add;\nSynth(\\verb, [\\in, ~verb]);\n```"}, {"role": "user", "content": "Too much reverb now."}, {"role": "assistant", "content": "Lower the wet mix and the return level, not the room size: the room is what makes it sound like a space, the mix is how much of it you hear. `FreeVerb.ar(In.ar(in, 2), 0.25, 0.85, 0.5) * 0.5`. To change it live without restarting, add a control and `.set` it: `|mix = 0.5|` then `~verbSynth.set(\\mix, 0.25)`."}]} -{"conversations": [{"role": "user", "content": "What does `LinearSpline.interpolate` do? What arguments does it take?"}, {"role": "assistant", "content": "Interpolate points along the spline path. Note they are not evenly spaced along the whole path, but interpolate per segment. For a more common usage see Arguments: divisions — number of divisions per segment. Returns: returns an array of points of size: (divisions * num segments)"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes beats to bar printing."}, {"role": "assistant", "content": "```supercollider\n(\nf = ();\nf.beatAndBar = {\n var t = currentEnvironment.clock; // t= TempoClock.new;\n var text = \"xB: \";\n\n var nBeatsPerBar = { arg n, beats, clock;\n var nBpb = clock.beatsPerBar * n;\n \"\" ++ n ++ text ++ (nBpb - (beats%(nBpb))).asInteger\n };\n\n t.play({arg beats, time, clock;\n ( //[\"beat: \" ++ (t.beatInBar + 1).asInteger] ++ //uncomment for beat in bar\n [1,2,4,8,16,32].collect( {|n,i| nBeatsPerBar.value(n, beats, clock)})\n ).postln;\n 1});\n \"beatAntBar\";\n}\n);\n\nf[\\beatAndBar].value;\n\n(\nf[\\beatAndBar].value;\nCmdPeriod.add(f[\\beatAndBar]);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `CuspL`."}, {"role": "assistant", "content": "```supercollider\n// vary frequency\n{ CuspL.ar(MouseX.kr(20, SampleRate.ir), 1.0, 1.99) * 0.3 }.play(s);\n\n// mouse-controlled params\n{ CuspL.ar(SampleRate.ir/4, MouseX.kr(0.9, 1.1, 1), MouseY.kr(1.8, 2, 1)) * 0.3 }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(CuspL.ar(40, MouseX.kr(0.9, 1.1, 1), MouseY.kr(1.8, 2, 1))*800+900)*0.4 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `PathName.entries` do?"}, {"role": "assistant", "content": "returns a list of all the files+folders inside the folder represented by this path."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `KeyTrack`."}, {"role": "assistant", "content": "```supercollider\n// alternating major and minor chords as a test\n(\n{\n var in, fft, resample;\n var key, transientdetection;\n\n in = Mix(SinOsc.ar((60 + [0, MouseX.kr(3, 4).round(1), 7]).midicps, 0, 0.1));\n\n // major dom 7 and minor 7; major keys preferred here\n // in = Mix(SinOsc.ar((60 + (MouseY.kr(0, 11).round(1.0)) + [0, MouseX.kr(3, 4).round(1), 7, 10]).midicps, 0, 0.1));\n\n fft = FFT(LocalBuf(4096), in); // for sampling rates 44100 and 48000\n\n key = KeyTrack.kr(fft);\n\n key.poll;\n\n Pan2.ar(in)\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n {\n var d, trig;\n d = Dswitch([\n Dwhite(3, 4, 2),\n Dwhite(0, 1, 2),\n Dseq([1, 1, 1, 0], 2)\n ], Dseq([0, 1, 2, 1, 0], 2));\n\n trig = Impulse.kr(4);\n\n SinOsc.ar(\n Demand.kr(trig, 0, d).poll(trig)\n * 300 + 400\n )\n * 0.1 ! 2\n }.play;\n);\n\n// compare with Dswitch1:\n\n(\n {\n var d, trig;\n d = Dswitch1([\n Dwhite(3, 4, 2),\n Dwhite(0, 1, 2),\n Dseq([1, 1, 1, 0], 2)\n ], Dseq([0,\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n {\n var d, trig;\n d = Dswitch([\n Dwhite(3, 4, 2),\n Dwhite(0, 1, 2),\n Dseq([1, 1, 1, 0], 2)\n ], Dseq([0, 1, 2, 1, 0], 2));\n\n trig = Impulse.kr(4);\n\n SinOsc.ar(\n Demand.kr(trig, 0, d).poll(trig)\n * 300 + 400\n )\n * 0.1 ! 2\n }.play;\n);\n\n// compare with Dswitch1:\n\n(\n {\n var d, trig;\n d = Dswitch1([\n Dwhite(3, 4, 2),\n Dwhite(0, 1, 2),\n Dseq([1, 1, 1, 0], 2)\n ], Dseq([0, 1, 2, 1, 0], 2));\n\n trig = Impulse.kr(4);\n\n SinOsc.ar(\n Demand.kr(trig, 0, d).poll(trig)\n * 300 + 400\n )\n * 0.1 ! 2\n }.play;\n);\n```"}]} -{"conversations": [{"role": "user", "content": "What is `NodeControl` in SuperCollider?"}, {"role": "assistant", "content": "NodeControl — Encapsulates in an object a node and an index. This object can be held by a client and have its value set without otherwise having to store the details about where the node's input is. Category: Server > Nodes."}]} -{"conversations": [{"role": "user", "content": "What does `ControlSpec.unmap` do?"}, {"role": "assistant", "content": "Maps and constrains a value between minval and maxval to the range between 0 and 1. `g = ControlSpec(0.01, 2000, \\exp, 0.1, 220,"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Feedback with beats."}, {"role": "assistant", "content": "```supercollider\nNdef(\\a, {\n var src, loc, delay=0.01;\n src = Decay2.ar(Impulse.ar(1/8), LFNoise2.kr(4).range(0.001, 0.0001),\n LFNoise2.kr(4).range(0.005, 0.05))!2\n * Saw.ar(LFNoise2.kr(4).exprange(40, 4000));\n loc = BPF.ar(LocalIn.ar(2) + [src, 0], LFNoise0.kr(1/4).range(100, 1200).lag, 3.2);\n loc = GVerb.ar(loc, 100, 4, mul:0.02, add:loc);\n loc = Compander.ar(loc, loc, 0.9, 1, 0.001);\n loc = (loc * 0.501).tanh;\n loc = Compander.ar(loc, loc, 0.1, 1, 0.1); \n loc = DelayC.ar(loc, delay * 2, delay * 1);\n LocalOut.ar(loc.reverse * 0.49);\n Out.ar(0, loc * 0.9)\n}).play;\n\nNdef(\\b, {\n var src, loc, del;\n del = 1/100;\n src = Decay2.ar(TDuty.ar(1/4,0,Dseq([1, 0.5, 0.3, 0.1],inf)), \n LFNoise2.kr(4).range(0.001, 0.0001), LFNoise2.kr(4).range(0.005, 0.05))!2\n * Saw.ar(LFNoise2.kr(200).exprange(40, 14000));\n loc = BPF.ar(LocalIn.ar(2) + [src, 0], LFNoise2.kr(0.1).range(40, 400), 3.2);\n loc = GVerb.ar(loc, 100, 4, mul:0.02, add:loc);\n loc = Compander.ar(loc, loc, 0.9, 1, 0.001);\n loc = (loc * 0.51).tanh;\n loc = Compander.ar(loc, loc, 0.1, 1, 0.1); \n loc = DelayC.ar(loc, del * 2, del * 1);\n LocalOut.ar(loc.reverse * 0.45);\n Out.ar(0, Compander.ar(loc,loc,0.1, 1, 0.05) * 1.2)\n}).play;\n\nNdef(\\c, {\n var src, loc, del=1/4;\n src = Decay2.ar(Impulse.ar(1), 0.0001, 0.05) * SinOsc.ar(60);\n loc = src + LocalIn.ar(2);\n loc = BPF.ar(loc, 800, 3.2).softclip;\n loc = DelayN.ar(loc, del, [0, del]);\n LocalOut.ar(loc.reverse * 0.99);\n Out.ar(0, loc * 2)\n}).play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `LID.isOpen` do?"}, {"role": "assistant", "content": "Returns true if the device is open, false if the device was"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// write a sine oscillator's output to a pin\n\n(\nSynthDef(\"help-DigitalOut\", { |out = 0|\n DigitalOut.ar(0, SinOsc.ar(10));\n}).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// write a sine oscillator's output to a pin\n\n(\nSynthDef(\"help-DigitalOut\", { |out = 0|\n DigitalOut.ar(0, SinOsc.ar(10));\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Feedback resonator."}, {"role": "assistant", "content": "```supercollider\n// Resonator, must subtract blockSize for correct tuning\n(\nSynthDef(\"testRes\", {\n \nvar freq = 300, localIn, input, limitLevel = 0.2, output;\nvar feedbackAmt = 0.999;\n\nfreq = MouseY.kr(20, 678, \\exponential).poll;\nfeedbackAmt = MouseX.kr(0.2, 0.99999).poll;\nlocalIn = LocalIn.ar(1); \ninput = LFNoise1.ar(freq * 16, 0.2);\ninput = input + Dust2.ar(freq);\n\n\nLocalOut.ar(\n HPF.ar(LPF.ar(DelayC.ar(input + (localIn * feedbackAmt), 2, freq.reciprocal - ControlRate.ir.reciprocal), freq * 8), freq * 0.125)\n);\n\noutput = Limiter.ar(localIn, limitLevel, 0.01) * limitLevel.reciprocal;\nOffsetOut.ar(0, output ! 2);\n\n}).play(s);\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Will nobody switch the damn thing off??"}, {"role": "assistant", "content": "```supercollider\n(\n\n{\nvar dseq, trig;\n\ndseq = Dseq([SinOsc.ar(45).range(-5, 12), SinOsc.ar(SinOsc.ar(0.285).range(42, 48)).range(-9, 19), 9, 0, -12], inf);\ntrig = Impulse.ar(SinOsc.ar(0.2).range(44, 46));\nSinOsc.ar(\n (77 + Demand.ar(trig, 0, dseq)).midicps,\n 0,\n 0.5\n) ! 2\n\n\n}.play\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "I get 'Message not understood' on a nil variable."}, {"role": "assistant", "content": "`~buffer` (or any variable) was never assigned, or it was assigned in a different environment. Environment variables are per-environment: a `~buf` set in one server-side file block is not visible in another. Check with `~buf.postln` before using it. The other common cause is an assignment that failed silently, e.g. `~buf = Buffer.read(...)` where the file was missing — the error is posted but ~buf stays nil."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Benoit XVI (a SuperCollider snippet)?"}, {"role": "assistant", "content": "```supercollider\n// a supercollider port of Coloscope's Pure-data organ. \n\nSynthDef(\\benoit, {\n arg out=0, amp=0.5, freq=440, semione=12, semitwo=24, trackingmul=2, gate=1, sus=1, rel=1;\n var env, sig, sig1, sig2, sig3, ringmod, tracking, sig4;\n\n sig1 = Pulse.ar(freq, 0.17);\n sig2 = Pulse.ar((freq.cpsmidi - semione).midicps, 0.17);\n sig3 = Pulse.ar((freq.cpsmidi + semitwo).midicps, 0.17);\n\n sig4 = LFTri.ar((freq.cpsmidi - semitwo).midicps);\n\n env = EnvGen.ar(Env.linen(0,sus,rel), gate, doneAction:2);\n\n tracking = ((freq * 1) + freq) * trackingmul;\n sig = sig1 + sig2 + sig3 + (sig4 * 2);\n\n\n sig = RLPF.ar(sig, tracking, 1, 0.33);\n sig = FreeVerb.ar(sig, 0.12);\n sig = sig.tanh;\n sig = sig * env;\n\n\n Out.ar(out, (sig * amp));\n\n}).add;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n(\nx = {\n |lookBack = 3, thr = 1|\n var trig = Impulse.ar(7);\n // for a non-integer source it makes sense to take a sufficiently large threshold thr\n var midi = Demand.ar(trig, 0, DIdev(SinOsc.ar(0.2, 0, 15, 82), 5, -6, 5, lookBack, thr: thr));\n midi.poll(7, label: \\midi);\n SinOsc.ar(midi.midicps.lag(0.007)) ! 2 * 0.1\n}.play;\n);\n\n// close floats can occur here \nx.set(\\thr, 0.01)\n\n// not here\nx.set(\\thr, 2)\n\nx.release\n```"}, {"role": "assistant", "content": "for a non-integer source it makes sense to take a sufficiently large threshold thr close floats can occur here (DIdev: pseudo drate ugen, searches for numbers with integer distance from a source signal, optionally avoiding repetitions within a span)"}]} -{"conversations": [{"role": "user", "content": "What does `Color.new255` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a new instance from 8-bit integer values between 0 and Arguments: red — An instance of Integer between 0 and 255.; green — An Integer between 0 and 255.; blue — An Integer between 0 and 255.; alpha — An Integer between 0 and 255.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\"fm\", {| out = 0, amp = 0.2, midinote=1, octave = 5, carrier, modulator, depth,\n dur = 1, detune = 0|\n\n var carrierOsc, modulation, env, degree, ratio;\n\n\n // adjust the octave. This assumes the fregencies we give for analysis generate a tone in the octave around middle C\n degree = midinote - 60;\n degree = degree + (12 * (octave - 5));\n\n // now compute a ratio\n ratio = degree.midiratio;\n\n // multiple the ratio by all of the FM values\n carrier = (carrier * ratio) + detune; // Pbinds sometimes use a detune value\n modulator = modul\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\"fm\", {| out = 0, amp = 0.2, midinote=1, octave = 5, carrier, modulator, depth,\n dur = 1, detune = 0|\n\n var carrierOsc, modulation, env, degree, ratio;\n\n\n // adjust the octave. This assumes the fregencies we give for analysis generate a tone in the octave around middle C\n degree = midinote - 60;\n degree = degree + (12 * (octave - 5));\n\n // now compute a ratio\n ratio = degree.midiratio;\n\n // multiple the ratio by all of the FM values\n carrier = (carrier * ratio) + detune; // Pbinds sometimes use a detune value\n modulator = modulator * ratio;\n depth = depth * ratio;\n\n env = EnvGen.kr(Env.sine(dur, 1), doneAction:2);\n\n modulation = SinOsc.ar(modulator, 0, depth);\n carrierOsc = SinOsc.ar(carrier+ modulation, 0, env);\n\n Out.ar(out, carrierOsc.dup* amp);\n\n}).add;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `ServerLogGui.addAction` do? What arguments does it take?"}, {"role": "assistant", "content": "the interface for display and searching the ServerLog Arguments: num. Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "What does `Window.minimize` do?"}, {"role": "assistant", "content": "Hides the window, only keeping its representation in the dock, taskbar,"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for number 10 for Quiz 4a."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var tri, bpf;\n tri = LFTri.ar(\n freq: [440,340, 513],\n mul: LFPulse.kr(\n freq: [6,3,2],\n width: 0.15));\n bpf = SinOsc.ar(in: tri, freq: LFNoise2.kr(4).range(400,1000));\n Splay.ar(tri,bpf);\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `EZRanger.unitView` do?"}, {"role": "assistant", "content": "The units label. Only appears if `unitWidth` was set to >"}]} -{"conversations": [{"role": "user", "content": "What does `InstrSynthDef.secretDefArgs` do?"}, {"role": "assistant", "content": "Extends SynthDef enabling the extra capabilities of Instr with Patch"}]} -{"conversations": [{"role": "user", "content": "What does `Patch.numChannels` do?"}, {"role": "assistant", "content": "Pairs an Instr with inputs that that will be passed to the Instr"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Will nobody switch the damn thing off??"}, {"role": "assistant", "content": "```supercollider\n(\n\n{\nvar dseq, trig;\n\ndseq = Dseq([SinOsc.ar(45).range(-5, 12), SinOsc.ar(SinOsc.ar(0.285).range(42, 48)).range(-9, 19), 9, 0, -12], inf);\ntrig = Impulse.ar(SinOsc.ar(0.2).range(44, 46));\nSinOsc.ar(\n (77 + Demand.ar(trig, 0, dseq)).midicps,\n 0,\n 0.5\n) ! 2\n\n\n}.play\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is the difference between a Synth and a SynthDef?"}, {"role": "assistant", "content": "A SynthDef is a definition: a compiled UGen graph with named controls, registered on the server once. A Synth is one running instance of that definition. You create the definition with `SynthDef(\\bell, { |freq = 440| ... }).add` and then instances with `Synth(\\bell, [\\freq, 660])`. Defining the same SynthDef twice replaces it for future instances; already running Synths keep the old graph until they are freed."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for mixolydian flat six meditation in pythagorean?"}, {"role": "assistant", "content": "```supercollider\n// last updated on sccode.org fri 7. jun, 14:57 CET\n\n( // load this first - synth def\nSynthDef(\\harpsi, { \n arg outbus = 0, freq = 440, ffreq = 2, amp = 1, gate = 1, release = 1;\n var out;\n freq = freq * Rand(1, 1.005);\n out = EnvGen.ar(Env.adsr(releaseTime:release), gate, doneAction: Done.freeSelf)\n * amp * Pulse.ar([freq,freq*1.005]/1, 0.25, mul:0.75 );\n out = out * [Rand(0.0, 1.0), Rand(0.0, 1.0)];\n out = RLPF.ar(out, freq * (ffreq / 4) + 1 );\n Out.ar(outbus, out); \n}).add; \n);\n\n\n( // then run this - sequence\nTempoClock.default.tempo = 1.4;\n~scale = Scale.new(#[0,2,4,5,7,8,10],tuning: \\pythagorean, name: \"mixolydianb6\");\np = Pbind(\n \\instrument, \\harpsi,\n \\root, -12,\n \\scale, ~scale,\n \\ffreq, Pseq(((1..2) ++ (3..1)),inf),\n \\degree, Pseq([\n Pseries({ rrand(0, 7) }, { ([1,2]).choose }, { rrand(4, 8) }),\n Pseries({ rrand(0, 7) }, {([1,2]).choose}, { rrand(4, 8) }),\n Pseries({ rrand(7, 14) }, 0-{([1,2]).choose}, { rrand(4, 8) })\n ], inf),\n \\release, Prand([5,6,7,8],inf),\n \\dur, Prand((1..8)/4, inf),\n \\amp, Prand(((1..8)/8)+1, inf)\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// nOut allows for switching between iteration levels up to maximum n\n\n(\ny = {\n |nOut = 10|\n GFIS.ar({ |x| sin(LFDNoise1.ar(20).range(3, 3.5) * x) }, [0.2, 0.3], 10, nOut) * 0.1\n}.play\n);\n\n\ny.set(\\nOut, 9)\n\ny.set(\\nOut, 8)\n\ny.release\n\n\n// it can be passed an array of levels, \n// the resulting multichannel signal can e.g. be used for crossfaded switching with DXMix\n\n// switch between 3 mono signals and double them\n\n(\ny = {\n var src = GFIS.ar({ |x| sin(LFDNoise3.ar(30).\n// …\n```"}, {"role": "assistant", "content": "nOut allows for switching between iteration levels up to maximum n it can be passed an array of levels, (GFIS: generalized functional iteration synthesis pseudo ugen)"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Just experimenting with patterns."}, {"role": "assistant", "content": "```supercollider\n/* Some Funky Klangs - Totally botched the math on what I was trying to do but it sounds better this way */\n\n( \nSynthDef(\\DistKlangBlip, { \n | out = 0, release = 1, freq1 = 1, freq2 = 5, freq3 = 8, freqMult = 4 | \n var env = Linen.kr(Impulse.kr(0), 0.01, 1, release, doneAction:2); \n var freqs = ([freq1, freq2, freq3] * freqMult).midicps; \n var klang = Klang.ar(`[freqs, nil, nil ], 1, 0); \n Out.ar(out, klang.tanh!2 * env * 0.5) \n}).add\n\n);\n\n( \n Pbind(*[ \n instrument: \\DistKlangBlip, \n dur: Pxrand([0.25, 0.5], inf) * 0.5, \n release: Pkey(\\dur), \n freqMult: Pxrand((3..12), inf), \n freq2: Prand([4,5], inf), \n freq3: Prand([8,12], inf) \n]).play; \n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n//difficult to find active parameters, forced to try resetting! \n\n{Out.ar(0,Pan2.ar(0.5*TermanWang.ar(2.0,Impulse.kr(MouseX.kr(1,1000)),0.1,0.01,1.0,1.0,1.0,MouseX.kr(0.4,1.2), MouseY.kr(2.0,4.0)),0.0))}.play;\n\n\n{Out.ar(0,Pan2.ar(0.5*TermanWang.ar(LFNoise1.ar(LFNoise0.kr(0.5,500,500),1.0,3.0),Impulse.kr(MouseX.kr(1,10000, 'exponential')),0.01,0.01,1.0,1.0,1.\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n//difficult to find active parameters, forced to try resetting! \n\n{Out.ar(0,Pan2.ar(0.5*TermanWang.ar(2.0,Impulse.kr(MouseX.kr(1,1000)),0.1,0.01,1.0,1.0,1.0,MouseX.kr(0.4,1.2), MouseY.kr(2.0,4.0)),0.0))}.play;\n\n\n{Out.ar(0,Pan2.ar(0.5*TermanWang.ar(LFNoise1.ar(LFNoise0.kr(0.5,500,500),1.0,3.0),Impulse.kr(MouseX.kr(1,10000, 'exponential')),0.01,0.01,1.0,1.0,1.0,MouseX.kr(0.4,1.2), MouseY.kr(2.0,4.0)),0.0))}.play;\n\n\n{Out.ar(0,Pan2.ar(FreeVerb.ar(0.5*TermanWang.ar(2.0+ SinOsc.ar(MouseX.kr(10,10000,'exponential'),0,MouseY.kr(0.1,100.0,'exponential')),Impulse.kr(MouseX.kr(1,10000, 'exponential')),0.01,0.01,1.0,1.0,1.0,MouseX.kr(0.4,1.2), MouseY.kr(2.0,4.0)),0.5)))}.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SOS`."}, {"role": "assistant", "content": "```supercollider\n// example: same as TwoPole\n(\n{\n var rho, theta, b1, b2;\n theta = MouseX.kr(0.2pi, pi);\n rho = MouseY.kr(0.6, 0.99);\n b1 = 2.0 * rho * cos(theta);\n b2 = rho.squared.neg;\n SOS.ar(LFSaw.ar(200, 0, 0.1), 1.0, 0.0, 0.0, b1, b2)\n}.play\n);\n\n\n(\n{\n var rho, theta, b1, b2;\n theta = MouseX.kr(0.2pi, pi);\n rho = MouseY.kr(0.6, 0.99);\n b1 = 2.0 * rho * cos(theta);\n b2 = rho.squared.neg;\n SOS.ar(WhiteNoise.ar(0.1 ! 2), 1.0, 0.0, 0.0, b1, b2)\n}.play\n);\n\n// example with SOS.kr kr as modulator\n(\n{\n var rho, theta, b1, b2, vib;\n theta = MouseX.kr(0.2pi, pi);\n rho = MouseY.kr(0.6, 0.99);\n b1 = 2.0 * rho * cos(theta);\n b2 = rho.squared.neg;\n\n vib = SOS.kr(LFSaw.kr(3.16), 1.0, 0.0, 0.0, b1, b2);\n SinOsc.ar(vib * 200 + 600) * 0.2\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Lag3UD`."}, {"role": "assistant", "content": "```supercollider\n// used to lag pitch\n(\nSynthDef(\\lag3ud_help, { |out, freq = 300, lagup = 1, lagdown = 5|\n Out.ar(out,\n SinOsc.ar( // sine wave\n Lag3UD.kr( // lag the frequency\n freq,\n lagup,\n lagdown\n ),\n 0, // phase\n 0.2 // sine amplitude\n )\n )\n}).add;\n);\n\nx = Synth(\\lag3ud_help); // create the synth\n\nx.set(\\freq, 500); // set the frequency to a higher value (takes 1 second)\nx.set(\\freq, 100); // set the frequency to a lower value (takes 5 seconds)\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `FreeSelf`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"freeSelf-help\", { |out, t_trig|\n FreeSelf.kr(t_trig);\n Out.ar(out, SinOsc.ar(400, 0, 0.2));\n}).add;\n);\n\ns.sendMsg(\"/s_new\", \"freeSelf-help\", 1731);\ns.sendMsg(\"/n_set\", 1731, \\t_trig, 1);\n\n// a single impulse SynthDef:\n\n(\nSynthDef(\"dirac\", { |out, amp = 0.1|\n var u;\n u = Impulse.ar(1);\n FreeSelf.kr(u);\n Out.ar(out, u * amp);\n // multiply by amp after using for release, so amp = 0\n // doesn't cause synth buildup.\n}).add;\n);\n\n(\nTask {\n loop({\n fork {\n exprand(34, 156).do { |i|\n i = i + 1;\n s.sendMsg(\"/s_new\", \"dirac\", -1, 0, 0, \\amp, 1 / i);\n (0.006 * i).wait;\n };\n };\n 1.wait;\n })\n} .play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can I run SuperCollider without the IDE?"}, {"role": "assistant", "content": "Yes. `sclang` runs the language and `scsynth` the server, and they are separate processes by design\n— the IDE is only a client. A headless script is a `.scd` run with `sclang my-piece.scd`, and it must boot\nthe server itself:\n\n```supercollider\ns.boot;\ns.waitForBoot {\n // build SynthDefs, play, then wait\n 30.wait;\n s.quit;\n};\n```\n\nThat shape — boot, wait, play, quit, exit — is what makes a piece runnable from a cron job or a\nRaspberry Pi."}]} -{"conversations": [{"role": "user", "content": "What does `MxOutletApp.>>` do? What arguments does it take?"}, {"role": "assistant", "content": "Connect this outlet to an inlet or to each item in a query Arguments: inlet. Returns: inlet"}]} -{"conversations": [{"role": "user", "content": "Explain `CircleRamp` in SuperCollider briefly."}, {"role": "assistant", "content": "CircleRamp — circular linear lag This is just like Ramp, but always takes the shortest way around a defined circle, wrapping values where appropriate. This can be useful when smoothing panning signals for speaker rings, for instance in Vector Base Amplitude Panning. Category: UGens > Filters > Linear."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nSynthDef(\\bird,{\n var sig, freqenv, env, trig;\n trig = Dust.ar(2);\n env = EnvGen.ar(Env.perc(0.01,0.4,0.8,-8), trig, doneAction: 2);\n freqenv = EnvGen.ar(Env([Rand(1000,3000), Rand(3000,6000), Rand(1000,2000), Rand(2000,5000)],[0.1,0.01,0.1]);, trig);\n sig = SinOsc.ar(freqenv, 0, env);\n sig = Pan2.ar(sig, Rand(-1.0,1.0));\n Out.ar(0, sig);\n}).add;\n);\n\n(\nRoutine({\n inf.do({\n Synth(\\bird);\n rrand(1.0,2.0).wait;\n })\n}).play;\n)\n```"}, {"role": "assistant", "content": "I haven't found a quite satisfying code about birds, so here's a very simple SynthDef to start with."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for little study on piano improvisation."}, {"role": "assistant", "content": "```supercollider\n/* Piano Gestures: A Little Study by mimetik\n\n This is a little study on piano improvisation, in particular on \"gestures\", by which I mean here little improvised phrasings.\n\n*/\n\nMIDIClient.init;\n\n/*\nChoose from the list of devices your internal MIDI router, so to send the notes to piano intrument in your favourite DAW\n*/\n\n~mOut = MIDIOut.new(3);\n\n//Set the scale to be Cmajor\n~scale=[0,2,4,5,7,9,11];\n\n//Define pattern proxies which will be modified by the task t below\n\na=PatternProxy(Pxrand([3,3,3,1,3,3],inf));\nb=PatternProxy(Pseq([1/2],inf));\nr=PatternProxy(Pseq([12],inf));\nn=Prand([4,8,16],inf).asStream;\n\nt=Task({\nPdef(\\x,Pbind(\\type,\\midi,\\chan,0,\n \\midiout,~mOut,\n \\scale,~scale,\n \\root,-12,\n \\degree,Pxrand([[0,3,5],[3,5,7],[4,6,8],[5,7,11]],inf),\n \\legato,1,\n \\amp,[{rrand(0.6,0.8)},{rrand(0.5,0.6)},{rrand(0.5,0.6)}]*0.7, \\dur,Prand([Pseq([1,1,1,1],1),Pseq([1,1,2],1),Pseq([1,2,1],1)],inf))).play(quant:1);\n\nPdef(\\y,Pbind(\\type,\\midi,\\chan,0,\n \\midiout,~mOut,\n \\scale,~scale,\n \\root,r,\n \\degree,a,\n \\legato,1,\n \\amp,{rrand(0.5,0.6)},\n\\dur,b)).play(quant:1);\n\n10.wait;\n\nt=Task({\n inf.do({\n if (0.7.coin,{ \n c=[[3,0,7,1,9,11,0,4],[[3,7],0,7,Rest,9,[0,11],0,4]].choose.scramble;\n r.source=Pseq([[12,24].wchoose([0.7,0.3])],inf);\n d=n.next;\n a.source=Pseq([Pxrand(c,d),Pxrand([3,3,3,1,3,3],inf)]);\n b.source=Pseq([Pseq([1/8],d),Pseq([1/2],inf)]);\n });\n rrand(3,4).wait;})}).play(quant:1);\n };\n).play(quant:1);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for radio static with tuning noise (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"radiostatic\", {arg out=0;\n var hum, sineSweep, tuning, dustNoise, staticNoise, humFreq, numHarms;\n \n numHarms = 7;\n humFreq = 100;\n hum = Array.fill(numHarms, {|i| SinOsc.ar( (i+1) * humFreq, 0, 1/numHarms)});\n hum = hum.sum;\n dustNoise = Dust.ar(LFNoise1.ar(0.5).range(1000,8000));\n staticNoise = hum * dustNoise * LFNoise1.ar(1).range(0.5, 2);\n \n sineSweep = SinOsc.ar(LFNoise2.ar(1).range(20, 11000));\n tuning = SinOsc.ar(10000).ring4(sineSweep) * LFNoise2.ar(1.1).range(0.05, 0.1);\n\n Out.ar(out, Pan2.ar(staticNoise + tuning, 0));\n}).add;\n);\n \na = Synth(\"radiostatic\");\n```"}]} -{"conversations": [{"role": "user", "content": "What does `ServerLog.sendBundle` do? What arguments does it take?"}, {"role": "assistant", "content": "records OSC traffic to and from a Server and displays this in a browseable searchable interface Arguments: time; ... args. Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for smooth arpeggio, updated envelope (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\bass, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.perc(0.2), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `ServerOptions` in SuperCollider briefly."}, {"role": "assistant", "content": "ServerOptions — Encapsulates commandline and other options for a Server ServerOptions encapsulates various options for a server app within an object. This makes it convenient to launch multiple servers with the same options, or to archive different sets of options, etc. Every Server has an instance of ServerOptions created for it if one is not passed as the options argument when the Server object is created. (This is the case for example with the local and internal Se Category: Server."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain);\nb = Pmulpre(\\freq, Pseq([1, 2, 3], inf), a);\nb.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain);\nb = Pmulpre(\\freq, Pseq([1, 2, 3], inf), a);\nb.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `PV_RandWipe` in SuperCollider?"}, {"role": "assistant", "content": "PV_RandWipe — Crossfade in random bin order. Crossfades between two sounds by copying bins in a random order. Category: UGens > FFT."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// same as OnePole\n{ var x;\n x = LFTri.ar(0.4, 0, 0.99);\n FOS.ar(LFSaw.ar(200, 0, 0.2), 1 - x.abs, 0.0, x)\n}.play;\n);\n\n(\n// same as OneZero\n{ var x;\n x = LFTri.ar(0.4, 0, 0.99);\n FOS.ar(LFSaw.ar(200, 0, 0.2), 1 - x.abs, x, 0.0)\n}.play;\n);\n\n(\n// same as OnePole, kr\n{ var x, ctl;\n x = LFTri.kr(0.2, 0, 0.99);\n ctl = FOS.kr(LFSaw.kr(8, 0, 0.2), 1 - x.abs, 0.\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// same as OnePole\n{ var x;\n x = LFTri.ar(0.4, 0, 0.99);\n FOS.ar(LFSaw.ar(200, 0, 0.2), 1 - x.abs, 0.0, x)\n}.play;\n);\n\n(\n// same as OneZero\n{ var x;\n x = LFTri.ar(0.4, 0, 0.99);\n FOS.ar(LFSaw.ar(200, 0, 0.2), 1 - x.abs, x, 0.0)\n}.play;\n);\n\n(\n// same as OnePole, kr\n{ var x, ctl;\n x = LFTri.kr(0.2, 0, 0.99);\n ctl = FOS.kr(LFSaw.kr(8, 0, 0.2), 1 - x.abs, 0.0, x);\n LFTri.ar(ctl * 200 + 500);\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes danger loud click."}, {"role": "assistant", "content": "```supercollider\n// proceed with caution. start at min volume, and not with your expensive speakers.\n\nfork{b=Buffer.alloc(s,512,1);inf.do{b.cheby({[1,0].choose}!2);{(Shaper.ar(b,SinOsc.ar(55,0,Line.kr(1,0,2,1,0,2))))!2}.play;0.1.wait;}};\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// poor man's panning\n{\n var f, hornbostelwertheimerkonstante;\n f = MouseY.kr(1, 100, 1);\n hornbostelwertheimerkonstante = 0.00063;\n Impulse.ar(f, hornbostelwertheimerkonstante * f * [1, MouseX.kr(0, 2)], 0.1) \n}.play\n```"}, {"role": "assistant", "content": "If you are too poor to afford changing the amplitudes of a stereo signal, just let the channels wait. But the signal frequency is an impasse that is to be valued in itself."}]} -{"conversations": [{"role": "user", "content": "What does `Font.hasPointSize` do?"}, {"role": "assistant", "content": "A Boolean variable indicating whether the #-size is regarded as pixel-size (precise amount of pixels), or point-size (adapting to screen resolution). To change this, you need to set the size via #-pixelSize or"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for SOUND 1, from orig Influx Example."}, {"role": "assistant", "content": "```supercollider\n// SOUND 1, from orig Influx Example\n(\n// // // if JITLibExtensions are used, you can make space local:\n// Ndef(\\dog).addSpec(\\intv, [-24, 24]);\n// Ndef(\\dog).addSpec(\\timescale, [0.01, 10, \\exp]);\n// Ndef(\\dog).addSpec(\\curve, [-10, 10]);\n// Ndef(\\dog).addSpec(\\ffreq, \\freq);\n//\n// Ndef(\\dog).addSpec(\\loopnode, [0, 12]);\n// Ndef(\\dog).addSpec(\\dens, [10, 1000, \\exp]);\n// Ndef(\\dog).addSpec(\\resfreq, \\freq);\n// Ndef(\\dog).addSpec(\\ringtime, [0.01, 1, \\exp]);\n\nSpec.add(\\intv, [-24, 24]);\nSpec.add(\\timescale, [0.01, 10, \\exp]);\nSpec.add(\\curve, [-10, 10]);\nSpec.add(\\ffreq, \\freq);\n\nSpec.add(\\loopnode, [0, 12]);\nSpec.add(\\dens, [10, 1000, \\exp]);\nSpec.add(\\resfreq, \\freq);\nSpec.add(\\ringtime, [0.01, 1, \\exp]);\n\n\nNdef(\\dog, { |amp=0, freq=250, intv=19, timescale=1, curve=0, loopnode=0, dens = 10, resfreq = 500, ringtime = 0.01|\n var n = 15;\n var env = EnvGen.kr(\n Env({ 1.0.rand2 }!(n+1), {1.0.rand}!n, curve, releaseNode: n-1, loopNode: loopnode.min(n-3)),\n timeScale: timescale);\n var pitch = (env * [1, 0.33, -1] * intv).midiratio * freq;\n var form = Formant.ar(pitch, pitch.rotate(1) * 1.6, pitch.rotate(2) * 2.6);\n\n var dusty = Ringz.ar(\n Dust.ar(dens!3),\n resfreq * LFNoise0.kr([3, 5, 7], 0.5, 1),\n ringtime)\n * ((dens ** -0.5) * (ringtime ** -0.3)\n );\n\n Splay.ar(form * dusty, level: amp) ;\n});\n);\n\nNdef(\\dog).set(\\amp, 0.2).vol_(0.2);\nNdef(\\dog).gui.moveTo(400, 380);\n\n/*\n// Ndef(\\dog).addHalo(\\orderedNames, Ndef(\\dog).controlKeys);\nNdef(\\dog).controlKeys;\nNdef(\\dog).vol_(0.5);\nNdefPreset( Ndef(\\dog) ).loadSettings;\nNdef(\\dog).play;\nNdef(\\dog).gui;\n*/\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = (note: 2).play;\na.set(\\freq, 700;\na.release;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = (note: 2).play;\na.set(\\freq, 700);\na.release;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\np = ProxySpace.new;\np.fadeTime = 2; // fadeTime specifies crossfade\np[\\out].play; // monitor an empty placeholder through hardware output\n// set its source\np[\\out] = { SinOsc.ar([350, 351.3], 0, 0.2) };\np[\\out] = { Pulse.ar([350, 351.3] / 4, 0.4) * 0.2 };\np[\\out] = Pbind(\\dur, 0.03, \\freq, Pbrown(0, 1, 0.1, inf).linexp(0, 1, 200, 350));\n\n// route one proxy through another:\np[\\out] = { Ringz.ar(p[\\in].ar, [350, 351.3] *\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\np = ProxySpace.new;\np.fadeTime = 2; // fadeTime specifies crossfade\np[\\out].play; // monitor an empty placeholder through hardware output\n// set its source\np[\\out] = { SinOsc.ar([350, 351.3], 0, 0.2) };\np[\\out] = { Pulse.ar([350, 351.3] / 4, 0.4) * 0.2 };\np[\\out] = Pbind(\\dur, 0.03, \\freq, Pbrown(0, 1, 0.1, inf).linexp(0, 1, 200, 350));\n\n// route one proxy through another:\np[\\out] = { Ringz.ar(p[\\in].ar, [350, 351.3] * 8, 0.2) * 4 };\np[\\in] = { Impulse.ar([5, 7]/2, [0, 0.5]) };\n\np.clear(3); // clear after 3 seconds\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = {LFTri.ar(50+(1000*Maths.ar(10, 10, 0.5, 1)[0]), 0, 0.1)}.play //notice how I am taking the [0]th channel of the Maths and ignoring the [1st channel.\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = {LFTri.ar(50+(1000*Maths.ar(10, 10, 0.5, 1)[0]), 0, 0.1)}.play //notice how I am taking the [0]th channel of the Maths and ignoring the [1]st channel.\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Latency`."}, {"role": "assistant", "content": "```supercollider\n// server has hardwareBufferSize 512 for this example.\ns.options.hardwareBufferSize = 512; s.reboot;\n// do something that sends messages with server latency\nPbind(\\degree, Pbrown(-14, 14, 3), \\dur, 1/8).play;\ns.latency;\ns.latency = 0.1; // tune down ...\ns.latency = 0.05;\ns.latency = 0.025;\ns.latency = 0.012; // ... until every message posts \"late 0.01....\" now\ns.latency = 0.018; // go back up -> fewer late messages\ns.latency = 0.021; // go back up until ...\ns.latency = 0.024; // late messages are completely gone again\n\ns.latency = 0.03; // this works on many systems\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// do nothing for 2 seconds\n(note: Rest(), dur: 2).play;\n\n// intersperse pauses in pattern\nPbind(\\note, Pseq([0, 4, 7, 11], inf), \\dur, Pseq([2, 1, Rest(1)], inf) / 5.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// do nothing for 2 seconds\n(note: Rest(), dur: 2).play;\n\n// intersperse pauses in pattern\nPbind(\\note, Pseq([0, 4, 7, 11], inf), \\dur, Pseq([2, 1, Rest(1)], inf) / 5).play;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `SCDoc` in SuperCollider?"}, {"role": "assistant", "content": "SCDoc — Help system main class SCDoc manages the SuperCollider documentation system. Category: HelpSystem."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Change MembraneHexagon to MembraneCircle for a different shaped\n// circular drum head\ns.boot;\ns.reboot;\n(\n{ var excitation = EnvGen.kr(Env.perc,\n MouseButton.kr(0, 1, 0),\n timeScale: 0.1, doneAction: 0\n ) * PinkNoise.ar(0.4);\n var tension = MouseX.kr(0.01, 0.1);\n var loss = MouseY.kr(0.999999, 0.999, 1);\n MembraneHexagon.ar(excitation, tension, loss);\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Change MembraneHexagon to MembraneCircle for a different shaped\n// circular drum head\ns.boot;\ns.reboot;\n(\n{ var excitation = EnvGen.kr(Env.perc,\n MouseButton.kr(0, 1, 0),\n timeScale: 0.1, doneAction: 0\n ) * PinkNoise.ar(0.4);\n var tension = MouseX.kr(0.01, 0.1);\n var loss = MouseY.kr(0.999999, 0.999, 1);\n MembraneHexagon.ar(excitation, tension, loss);\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `FreqScopeView`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// Start server\ns.boot;\n\n// Create analyzer in a window\n(\nw = Window(\"My Analyzer\", Rect(0, 0, 511, 300)); // width should be 511\nf = FreqScopeView(w, w.view.bounds);\nf.active_(true); // turn it on the first time;\n\nw.onClose_({ f.kill }); // you must have this\nw.front;\n{ SinOsc.ar([500, 1000], 0, 0.25).mean.dup }.play(s); // start two sine waves\n)\n```"}]} +{"conversations": [{"role": "user", "content": "A starting point to start experimenting with non-standard synthesis?"}, {"role": "assistant", "content": "SuperCollider forum — A starting point to start experimenting with non-standard synthesis?\n\nI while ago I did this noise cloud generator which might serve as inspiration. Other ideas: scramble signals with FFT tools, granular synthesis, FM-synthesis with extreme settings, like index-of-modulation = 4000.\n\n```supercollider\nSynthDef(\\clouds, {\n var num = 10;\n var dur = \\duration.kr(1/6);\n var sig = num.collect{\n var freq = Rand(30, 5000) * SinOsc.kr(LFNoise1.kr(dur).range(30, 1000), 0, LFNoise1.kr(dur)\n .range(0.01, 8)).midiratio;\n var sig = Select.ar(LFNoise0.kr(dur).range(0, 2).round,\n [SinOsc.ar(freq, 0, 0.3), Saw.ar(freq, 0.3), Pulse.ar(freq, 0, 0.3)]);\n var filtFreq = Rand(30, 1000) * LFNoise1.kr(dur).range(1.0, 5.0);\n var filt = Select.ar(LFNoise0.kr(dur).range(0, 2).round,\n [LPF.ar(sig, filtFreq), HPF.ar(sig, filtFreq), BPF.ar(sig, filtFreq)]\n );\n sig = CombL.ar(filt, 0.5, LFNoise1.kr(dur).range(0.02, 0.5), rrand(0.3, 2));\n sig\n };\n var env = Env.perc(\\atk.kr(0.02), \\rel.kr(6), 1, \\cur.kr(-4)).ar(2);\n sig = Splay.ar(sig); // nb! levelComp: true, so if removed signal will be extremely loud!\n sig = LPF.ar(sig, 2000);\n sig = FreeVerb2.ar(sig[0], sig[1], LFNoise1.kr(dur).range(0, 1.0), LFNoise1.kr(dur).range(0.2, 2));\n sig = sig * env * \\amp.kr(1);\n Out.ar(\\out.kr(0), sig)\n}).add;\n\nSynth(\\clouds, [\\atk, rrand(0.01, 2), \\rel, rrand(1, 6.0), \\duration, rrand(0.01, 1)])\n// run it several times, the outcome is highly random\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for batuhan's buzzer parametrized that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n// A beautiful sc140 tweet by Batuhan Bozkurt, parametrized for real-time changes\n(\n// Start sound here\na = { | rateL = 5, rateR = 6, blipMul = 100, blipAdd = 50, fMul = 50, kMul = 1 |\n f = LocalIn.ar(2).tanh;\n k = Latch.kr(f[0].abs,Impulse.kr(1/4)) * kMul;\n LocalOut.ar(\n f +\n CombC.ar(Blip.ar([rateL, rateR], blipMul * k + blipAdd, 0.9), 1, k*0.3, fMul * f));f\n}.play\n);\n\n// Set parameters for changing sound here: \n\na.set(\\rateL, 10);\n\na.set(\\rateR, 8);\n\na.set(\\blipMul, 25);\n\na.set(\\blipAdd, 70);\n\na.set(\\fMul, 30);\n\n\na.set(\\kMul, 0.01);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Monitor`."}, {"role": "assistant", "content": "```supercollider\n{ Out.ar(87, SinOsc.ar(MouseX.kr(240, 1000, 1) * [1, 2, 3], 0, 0.2)) }.play; // play three sine tone on channels 87, 88, and 89\nx = Monitor.new; // create a new monitor\nx.play(fromIndex: 87, fromNumChannels: 3, toIndex: 0, toNumChannels: 2); // play them back to the stereo hardware channels\n```"}]} +{"conversations": [{"role": "user", "content": "What does `NodeProxyEditor.new` do?"}, {"role": "assistant", "content": "Returns a new instance for a given proxy. If a window (win) or a composite view is given, it uses"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\Mirror;\n~description = \"Mirror soundfield\";\n\n~function = {|in = 0, order = 1, mirrorFrontBack = 0, mirrorLeftRight = 0, mirrorUpDown = 0 |\nHOATransMirror.ar(order, in, mirrorFrontBack, mirrorLeftRight, mirrorUpDown);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n‎{h={|f|1-LFTri.ar(f)};l={|s,e|Line.ar(s,e,1200,1,0,2)};FreeVerb.ar(h.(l.(147,5147))*h.(l.(1117,17))*h.(100)*h.([55,55.1])*0.05,0.7,1)}.play\n\n//Explanation of this piece - http://schemawound.com/post/40100438722/11-13-2012-tweet-explained\n```"}, {"role": "assistant", "content": "Explanation of this piece - http://schemawound.com/post/40100438722/11-13-2012-tweet-explained."}]} +{"conversations": [{"role": "user", "content": "What does `SimpleNumber.booleanValue` do?"}, {"role": "assistant", "content": "one-dimensional value Returns: true, if strictly positive (> 0), otherwise false (see Boolean)"}]} +{"conversations": [{"role": "user", "content": "What does `KeyState.kr` do? What arguments does it take?"}, {"role": "assistant", "content": "Respond to the state of a key Arguments: keycode — The keycode value of the key to check. This corresponds to the keycode values passed into the keyDownActions of SCViews. See the example below.; minval — The value to output when the key is not pressed.; maxval — The value to output when the key is pressed.; lag — A lag factor.."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `BrownNoise`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// 以下のSynthDefは全て共通のコントロール名(mul)を持つ\n(\n// 3つのSynthDefとグループを作成する\nSynthDef(\"synthNumber1\", { arg mul = 0.2;\n Out.ar(\n 0,\n BrownNoise.ar(mul) * LFNoise0.kr([1, 1.01])\n )\n }, [0.1]).add;\nSynthDef(\"synthNumber2\", { arg mul = 0.2;\n Out.ar(\n 0,\n WhiteNoise.ar(mul) * LFNoise1.kr([2.99, 3])\n )\n }, [0.1]).add;\nSynthDef(\"synthNumber3\", { arg mul = 0.2;\n Out.ar(\n 0,\n PinkNoise.ar(mul) * LFNoise2.kr([0.79, 0.67])\n )\n}, [0.1]).add;\n);\n\n(\n// グループを作成する\n~myGroup = Group.new;\n);\n\n(\n// 3つのシンセを加える\nSynth.head(~myGroup, \"synthNumber1\");\nSynth.head(~myGroup, \"synthNumber2\");\nSynth.head(~myGroup, \"synthNumber3\");\n);\n\n// 3つのシンセのそれぞれの\\mulコントロール、新しい(そして同じ)値にセットする\n~myGroup.set(\\mul, 0.05)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\np = ProxySpace.push(s.boot);\n\nl = NdefGui(nil, 3).moveTo(10, 120);\nm = NdefGui(nil, 3).moveTo(10, 240);\nn = NdefGui(nil, 3).moveTo(10, 360);\no = NdefGui(nil, 3).moveTo(10, 480);\n\nSpec.add(\\dens, [0.1, 300, \\exp]);\n\n// make 3 kinds of proxies: using tilde/proxyspace, Ndef, and unnamed.\n~spacy = { |dens = 5| Formlet.ar(Dust.ar(dens ! 2), LFDNoise0.kr(20 ! 2).lag(0.1).linexp(-1, 1, 300, 5000), 0.003,\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\np = ProxySpace.push(s.boot);\n\nl = NdefGui(nil, 3).moveTo(10, 120);\nm = NdefGui(nil, 3).moveTo(10, 240);\nn = NdefGui(nil, 3).moveTo(10, 360);\no = NdefGui(nil, 3).moveTo(10, 480);\n\nSpec.add(\\dens, [0.1, 300, \\exp]);\n\n// make 3 kinds of proxies: using tilde/proxyspace, Ndef, and unnamed.\n~spacy = { |dens = 5| Formlet.ar(Dust.ar(dens ! 2), LFDNoise0.kr(20 ! 2).lag(0.1).linexp(-1, 1, 300, 5000), 0.003, 0.03) };\nNdef(\\ndeffy, { GrayNoise.ar(0.1 ! 2) });\nc = NodeProxy.audio.source_({ PinkNoise.ar(0.1 ! 2) });\n\n// put one in each editor\nl.object_(~spacy);\nm.object_(Ndef(\\ndeffy));\nn.object_(c);\n);\n// One should also be able to drag and drop text into the drag,\n// but this is also not working yet.\n( Ndef(\\a) )\n```"}]} +{"conversations": [{"role": "user", "content": "What does `InstrBrowser.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Browse your instrument library, with customizable actions Arguments: toolbarFunc; topBarFunc; showUGenInstr."}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for Interpolate between Envs with Pseg: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\sin, { arg out=0, gate=1, amp=0.1, pan=0, freq=200;\n var sig;\n sig = SinOsc.ar(freq);\n sig = sig * EnvGen.kr(\\adsr.kr(Env.adsr(0.1,0.1,0.8,0.1)), gate, doneAction:2);\n sig = Pan2.ar(sig, pan, amp);\n Out.ar(out, sig);\n}).add;\n);\n\n(\n// sequence Envs\n// need [] else it is inlined or does pattern multichannel expansion\nPdef(\\demo, \n Pbind(\n \\instrument, \\sin,\n \\degree, Pseq([0, Pwhite(0,7,1)],inf),\n \\legato, 0.5,\n \\adsr, Pseq([\n [ Env.adsr(1.1,0.1,0.8,1.01) ],\n [ Env.adsr(0.01,0.1,0.8,0.01) ],\n [ Env.adsr(0.01,1.1,0.3,0.01) ],\n ],inf),\n )\n).play;\n);\n\n(\n// interpolate using Pseg\n// need .asArray\nPdef(\\demo, \n Pbind(\n \\instrument, \\sin,\n \\degree, Pseq([0, Pwhite(0,7,1)],inf),\n \\legato, 0.5,\n \\adsr, Pseg(Pseq([\n [ Env.adsr(1.1,0.1,0.8,1.01).asArray ],\n [ Env.adsr(0.01,0.1,0.8,0.01).asArray ],\n [ Env.adsr(0.01,1.1,0.3,0.01).asArray ],\n ],inf),8),\n )\n).play;\n);\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// =========================\n// extra demos for \\glockenspiel\n// =========================\n\n(\n// made by Diya Menon\n// demo\nPbindef(\\dmglockenspiel,\n \\instrument, \"glockenspiel\",\n \\midinote, Pseq([\n [65, 68, 72, 75],\n 72, 72, 72, 70, 72, 70, 68,\n [61, 65, 70, 73, 77],\n 73, 73, 73, 72, 72, 70, 68], 2),\n \\amp, Pseq([0.015, 0.005, 0.005, 0.0075, 0.0075, 0.01, 0.01, 0.02], 4) * 3,\n \\dur, Pseq([0.3, 0.3, 0.3, 0.15, 0.15, 0.3, 0.15, 0.15], 4),\n \\rel, 3,\n \\exciterRel, 0.03,\n \\att, 0.0005,\n).play;\n)\n```"}, {"role": "assistant", "content": "========================= extra demos for \\glockenspiel =========================."}]} +{"conversations": [{"role": "user", "content": "What does `FoaEncoderMatrix.newAmbix1` do?"}, {"role": "assistant", "content": "A first order linkhttps://en.wikipedia.org/wiki/Ambisonic_data_exchange_formats##Ambisonic format exchange encoder. Encodes from AmbiX to traditional B-format. A convenience alias to"}]} +{"conversations": [{"role": "user", "content": "Explain `EaseOutInQuint` in SuperCollider briefly."}, {"role": "assistant", "content": "EaseOutInQuint — Quintic ease-out/in Easing equation for a quintic (t^5) ease-out/in, decelerating until halfway, then accelerating. Category: Ease."}]} +{"conversations": [{"role": "user", "content": "What does `EventShortcuts.copyAllDicts` do?"}, {"role": "assistant", "content": "Returns an IdentityDictionary of copies of all stored shortcut"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nDelayL.ar(z, 0.2, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\n(\n// recursive application of delay.\n{\nz = Decay2.ar(Dust.ar(1, 0.5), 0.01, 0.1, Saw.ar(100 + [0, 1]));\n5.do { |i| z = DelayL.ar(RLPF.ar(z, Rand(100, 3000), 0.03), 1, 1 / (2**i), 1, z * 0.5) };\nz\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nDelayL.ar(z, 0.2, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\n(\n// recursive application of delay.\n{\nz = Decay2.ar(Dust.ar(1, 0.5), 0.01, 0.1, Saw.ar(100 + [0, 1]));\n5.do { |i| z = DelayL.ar(RLPF.ar(z, Rand(100, 3000), 0.03), 1, 1 / (2**i), 1, z * 0.5) };\nz\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Pmulpre` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain);\nb = Pmulpre(\\freq, Pseq([1, 2, 3], inf), a);\nb.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `DrawGrid`?"}, {"role": "assistant", "content": "DrawGrid — Draws grid lines on a UserView for plotting"}, {"role": "user", "content": "What does `DrawGrid.draw` do?"}, {"role": "assistant", "content": "This draws to the currently active UserView. This method is meant to be called from inside the UserView#-drawFunc#-drawFunc of a `UserView`."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nx = [0, 10].asSpec.units_(\"sec\");\ny = [0, 1].asSpec.units_(\"amp\");\nd = DrawGrid((500@250).asRect, x.grid, y.grid);\n\n// set its properties before testing\nd.x.tickSpacing_(25);\nd.linePattern_(FloatArray[10.0, 5.0, 2.0, 5.0]);\n\n// generate a preview\n~testView = d.preview;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `AudioIn.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Read audio input. Arguments: channel — Input channel number to read. Channel numbers begin at 1.; mul; add."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ BrownNoise.ar(0.1) }.play;\n{ WhiteNoise.ar(0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ BrownNoise.ar(0.1) }.play;\n{ WhiteNoise.ar(0.1) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `AudioMulchClock.permanent` do?"}, {"role": "assistant", "content": "A Boolean. If true then the clock will continue to run after a CmdPeriod. The user is responsible for clearing permanent clocks with the #-clear"}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ var sig = SinOsc.ar(440) * 0.2; Out.ar(0, sig) }.play;\n```"}, {"role": "assistant", "content": "The minimal SynthDef idiom: a source multiplied by an amplitude, written to the master bus.\n\n`var sig = SinOsc.ar(440) * 0.2` builds the signal; `Out.ar(0, sig)` is the only mandatory part, because a\nUGen graph that never reaches an output produces no sound. `Out`'s first argument is the bus number — 0 is\nthe main stereo output — and the second is the signal. The function's return value does not matter here,\nwhich is why the `Out.ar` can sit on its own line. `.play` compiles this into an anonymous SynthDef and\nstarts one instance."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `LeastChange`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\nd = { |freq = 440|\n var internalFreq;\n internalFreq = LFNoise0.ar(0.3, 300, 800);\n SinOsc.ar(\n LeastChange.kr(freq, internalFreq) // two sources of change: one external, one internal\n ) * 0.1\n}.play\n);\n\nd.set(\\freq, 800);\nd.set(\\freq, 900);\nd.free;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = NodeProxy(s);\na.play;\na.source = { Pulse.ar(130, Saw.kr(0.3) * 0.1 }; // change this line while running\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = NodeProxy(s);\na.play;\na.source = { Pulse.ar(130, Saw.kr(0.3)) * 0.1 }; // change this line while running\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `LPF`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\\default, { arg out=0, freq=440, amp=0.1, pan=0, gate=1;\n var z;\n z = LPF.ar(\n Mix.new(VarSaw.ar(freq + [0, Rand(-0.4,0.0), Rand(0.0,0.4)], 0, 0.3)),\n XLine.kr(Rand(4000,5000), Rand(2500,3200), 1)\n ) * Linen.kr(gate, 0.01, 0.7, 0.3, 2);\n OffsetOut.ar(out, Pan2.ar(z, pan, amp));\n}, [\\ir]);\n```"}]} +{"conversations": [{"role": "user", "content": "What happens when I call .play on a function?"}, {"role": "assistant", "content": "`.play` on a Function builds a SynthDef from the function body, adds it to the server under an anonymous name, and starts one Synth of it. You get back the Synth, so `x = { SinOsc.ar(440) * 0.1 }.play; x.free;` stops it. It is the fastest way to hear something, but it is not how you write a piece: nothing is named, nothing can be reused, and the definition is lost when the Synth is freed."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Lag2`."}, {"role": "assistant", "content": "```supercollider\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n Lag2.kr( // lag the modulator\n LFPulse.kr(4, 0, 0.5, 50, 400), // frequency modulator\n Line.kr(0, 1, 15) // modulate lag time\n ),\n 0, // phase\n 0.3 // sine amplitude\n )\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `OscN` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// compare examples below with interpolating Osc examples.\n\n(\ns = Server.local;\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, false, true);\nb = Buffer.alloc(s, 512, 1);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum, 500, 0, 0.5)\n )\n}).play(s, [0, 0, 1, b.bufnum]);\n\n);\nb.free;\n\n\n\n(\n// noninterpolating - there are noticeable artifacts\n// modulate freq\n\ns = Server.local;\nb.sine1(1.0/[1, 2, 3, 4, 5, 6].squared, true, false, true);\nb = Buffer.alloc(s, 512, 1);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum, XLine.kr(2000, 200), 0, 0.5)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n\n);\nb.free;\n\n(\n// sounds very different than the Osc example\ns = Server.local;\nb = Buffer.alloc(s, 512, 1);\nb.sine1([1.0], true, true, true);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum,\n OscN.ar(bufnum,\n XLine.kr(1, 1000, 9),\n 0,\n 200,\n 800),\n 0,\n 0.25)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n\n);\nb.free;\n\n(\n// modulate phase\ns = Server.local;\nb = Buffer.alloc(s, 512, 1);\nb.sine1([1.0], true, true, true);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum,\n 800,\n OscN.ar(bufnum,\n XLine.kr(20, 8000, 10),\n 0,\n 2pi),\n 0.25)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n);\nb.free;\n\n\n(\n// change the buffer while its playing\ns = Server.local;\nb = Buffer.alloc(s, 4096, 1);\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, true, true);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum, [80, 80.2], 0, 0.2)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n);\n\n(\nRoutine({\n var n = 32;\n 50.do({\n b.sine1(Array.rand(n, 0, 1).cubed, true, true, true);\n 0.25.wait;\n });\n}).play;\n);\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Condition`."}, {"role": "assistant", "content": "```supercollider\n(\nc = Condition.new(false);\n\nRoutine {\n 1.wait;\n \"waited for 1 second\".postln;\n 1.wait;\n \"waited for another second, now waiting for you ... \".postln;\n c.wait;\n \"the condition has stopped waiting.\".postln;\n 1.wait;\n \"waited for another second\".postln;\n \"waiting for you ... \".postln;\n c.test = false;\n c.wait;\n \"the condition has stopped waiting.\".postln;\n 1.wait;\n \"the end\".postln;\n}.play;\n);\n\n// continue\n(\nc.test = true;\nc.signal;\n);\n\n// a typical use is a routine that can pause under certain conditions:\n(\nc = Condition.new;\nfork { loop { 1.wait; \"going\".postln; c.wait } };\n);\nc.test = true; c.signal;\nc.test = false;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `AbstractSinglePlayerEffect` in SuperCollider?"}, {"role": "assistant", "content": "AbstractSinglePlayerEffect — base class for players that apply effects to a single input player Category: Libraries > crucial > Players > abstract."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `CombN`."}, {"role": "assistant", "content": "```supercollider\n// These examples compare the variants, so that you can hear the difference in interpolation\n\n// Comb used as a resonator. The resonant fundamental is equal to\n// reciprocal of the delay time.\n{ CombN.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ CombL.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ CombC.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// with negative feedback:\n{ CombN.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ CombL.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ CombC.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n// used as an echo.\n{ CombN.ar(Decay.ar(Dust.ar(1, 0.5), 0.2, WhiteNoise.ar), 0.2, 0.2, 3) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `PbindProxy.at` do?"}, {"role": "assistant", "content": "return a pattern at that key. this can be used to set quant value individually, so different elementary patterns can be quantized differently. `x.at(\\freq).quant ="}]} +{"conversations": [{"role": "user", "content": "Who made you?"}, {"role": "assistant", "content": "I was trained by the person who runs this project, on top of the MiniMind architecture. My weights started from random numbers and learned from the SuperCollider sources — no teacher model, no distillation."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `PLbindef`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n// synthdefs to play with\n\n(\nSynthDef(\\noise_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, rq = 0.1, amp = 0.1|\n var sig = { WhiteNoise.ar } ! 2;\n sig = BPF.ar(sig, freq, rq) *\n EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2) *\n (rq ** -1) * (250 / (freq ** 0.8));\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\sin_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { SinOsc.ar(freq, Rand(0, 2pi)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\saw_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { VarSaw.ar(freq, Rand(0, 1)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LinLin`."}, {"role": "assistant", "content": "```supercollider\n// examples:\n\n(\n{\n var mod = SinOsc.kr(Line.kr(1, 10, 10));\n SinOsc.ar(LinLin.kr(mod, -1, 1, 100, 900)) * 0.1\n}.play;\n);\n\n// modulating destination values.\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(LinLin.ar(mod, -1, 1, MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1))) * 0.1\n}.play;\n);\n\n// modulating source and destination values.\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(\n LinLin.ar(mod,\n SinOsc.kr(0.2), SinOsc.kr(0.2543),\n MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1)\n )\n ) * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `ReplaceOut` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// ... a reverb adapted from the \"01 Why SuperCollider document\" in the SC2 distribution\n(\nSynthDef(\"preDelay\", { arg inbus = 2;\n ReplaceOut.ar(\n 4,\n DelayN.ar(In.ar(inbus, 1), 0.048, 0.048)\n )\n}).add;\n\nSynthDef(\"combs\", {\n ReplaceOut.ar(\n 6,\n Mix.arFill(7, { CombL.ar(In.ar(4, 1), 0.1, LFNoise1.kr(Rand(0, 0.1), 0.04, 0.05), 15) })\n )\n}).add;\n\nSynthDef(\"allpass\", { arg gain = 0.2;\n var source;\n source = In.ar(6, 1);\n 4.do({ source = AllpassN.ar(source, 0.050, [Rand(0, 0.05), Rand(0, 0.05)], 1) });\n ReplaceOut.ar(\n 8,\n source * gain\n )\n}).add;\n\nSynthDef(\"theMixer\", { arg gain = 1;\n ReplaceOut.ar(\n 0,\n Mix.ar([In.ar(2, 1), In.ar(8, 2)]) * gain\n )\n}).add;\n);\n\n(\nSynth(\"fm1\", [\\bus, 2, \\freq, 440, \\carPartial, 1, \\modPartial, 1.99, \\mul, 0.071]);\nSynth(\"fm1\", [\\bus, 2, \\freq, 442, \\carPartial, 1, \\modPartial, 2.401, \\mul, 0.071]);\nSynth.tail(s, \"preDelay\");\nSynth.tail(s, \"combs\");\nSynth.tail(s, \"allpass\");\nSynth.tail(s, \"theMixer\", [\\gain, 0.64]);\n);\n\n(\ns.queryAllNodes;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `RecordBuf` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// Execute the following in order\n(\n// allocate a Buffer\ns = Server.local;\nb = Buffer.alloc(s, 44100 * 4.0, 1); // a four second 1 channel Buffer\n);\n\n// record for four seconds\n(\nSynthDef(\\help_RecordBuf, { |out = 0, bufnum = 0|\n var formant;\n formant = Formant.ar(XLine.kr(400, 1000, 4), 2000, 800, 0.125);\n RecordBuf.ar(formant, bufnum, doneAction: Done.freeSelf, loop: 0);\n}).play(s, [\\out, 0, \\bufnum, b]);\n);\n\n// play it back\n(\nSynthDef(\\help_RecordBuf_playback, { |out = 0, bufnum = 0|\n var playbuf;\n playbuf = PlayBuf.ar(1, bufnum);\n FreeSelfWhenDone.kr(playbuf); // frees the synth when the PlayBuf is finished\n Out.ar(out, playbuf);\n}).play(s, [\\out, 0, \\bufnum, b]);\n);\n\n// overdub\n(\nSynthDef(\\help_RecordBuf_overdub, { |out = 0, bufnum = 0|\n var formant;\n formant = Formant.ar(XLine.kr(200, 1000, 4), 2000, 800, 0.125);\n // mixes equally with existing data\n RecordBuf.ar(formant, bufnum, 0, 0.3, 0.5, doneAction: Done.freeSelf, loop: 0);\n}).play(s, [\\out, 0, \\bufnum, b]);\n);\n\n// play back the overdubbed version\nSynth.new(\\help_RecordBuf_playback, [\\out, 0, \\bufnum, b], s);\n\n// write the contents of the buffer to a file (see Buffer for more options)\n(\nb.write(sampleFormat: 'int16');\nthisProcess.platform.recordingsDir +/+ \"SC_\" ++ Date.localtime.stamp ++ \".aiff\"; // generated path\n);\n\nb.close; b.free; // cleanup\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// (thor magnusson) (2006)\n\n// An instrumentalist inside a synthdef.\n\n(\nSynthDef(\\drummer, { arg out=0, tempo=4;\n var snare, base, hihat;\n tempo = Impulse.ar(tempo); // for a drunk drummer replace Impulse with Dust !!!\n\n snare = WhiteNoise.ar(Decay2.ar(PulseDivider.ar(tempo, 4, 2), 0.005, 0.5));\n base = SinOsc.ar(Line.ar(120,60, 1), 0, Decay2.ar(PulseDivider.ar(tempo, 4, 0), 0.005, 0.5));\n hihat = HPF.ar(WhiteNoise.ar(1), 10000) * Decay2.ar(tempo, 0.005, 0.5);\n\n Out.ar(out,(snare + base + hihat) * 0.4 ! 2)\n}).add;\n);\n\na = Synth(\\drummer);\na.set(\\tempo, 6);\na.set(\\tempo, 18);\na.set(\\tempo, 180); // check the CPU! no increase.\na.free;\n```"}, {"role": "assistant", "content": "(thor magnusson) (2006) An instrumentalist inside a synthdef."}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nPbind(\\degree, Pseq([0, 2, 4, 7], inf), \\dur, 0.25).play;\n```"}, {"role": "assistant", "content": "It plays a four-note major arpeggio in a loop, one note every 250 ms.\n\n`Pbind` builds an event stream: each event is the current value of every key. `Pseq([0, 2, 4, 7], inf)`\ncycles the degrees forever, and `\\dur, 0.25` sets the time between events in beats on the default\nTempoClock. With no `\\instrument`, the `\\default` SynthDef is used, which converts `\\degree` to a\nfrequency through the current scale (major, rooted at C by default). `.play` schedules it on the clock\nand returns an EventStreamPlayer."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `LeastChange`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\nd = { |freq = 440|\n var internalFreq;\n internalFreq = LFNoise0.ar(0.3, 300, 800);\n SinOsc.ar(\n LeastChange.kr(freq, internalFreq) // two sources of change: one external, one internal\n ) * 0.1\n}.play\n);\n\nd.set(\\freq, 800);\nd.set(\\freq, 900);\nd.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `UnaryOpUGen` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\na = WhiteNoise.ar; // a WhiteNoise\nb = a.squared; // a UnaryOpUGen.\nb.operator; // squared\n\n// sound example\n\n{ var a = LFSaw.ar(300).range(0, 2pi); a.sin * 0.1 }.play;\n\n// Plotting the \"abs\" unary operator (via the server):\n\n{ SinOsc.ar(300).abs }.plot\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Resonz` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// 1st, evaluate a synthdef\n(\nSynthDef(\"pitchFromNoise\", { arg out = 0;\n Out.ar(\n out,\n Resonz.ar(\n WhiteNoise.ar(15),\n LFNoise0.kr(2, 110, 660),\n 0.005\n )\n )\n}).add;\n);\n\n// 2nd, make 2 synths\n(\nSynth(\"ringModulation\");\nSynth(\"pitchFromNoise\", [\\out, 1]);\n);\n\n// 3rd, tell the server to list its nodes\n(\ns.queryAllNodes;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Gbman2DN.ar(MouseX.kr(20, SampleRate.ir*0.25), MouseX.kr(80, SampleRate.ir), 0.1) }.play(s);\n\n{ Gbman2DN.ar(11025, 22050, -0.7, -2.7, 0.1) }.play(s);\n\n{ Gbman2DN.ar(2200, 8800, 1.2, 2.0002, 0.1) }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Gbman2DN.ar(MouseX.kr(20, SampleRate.ir*0.25), MouseX.kr(80, SampleRate.ir), 0.1) }.play(s);\n\n{ Gbman2DN.ar(11025, 22050, -0.7, -2.7, 0.1) }.play(s);\n\n{ Gbman2DN.ar(2200, 8800, 1.2, 2.0002, 0.1) }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `ControlRate`."}, {"role": "assistant", "content": "```supercollider\n{ SinOsc.ar(ControlRate.ir) * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// (thor magnusson) (2006)\n\n// An instrumentalist inside a synthdef.\n\n(\nSynthDef(\\drummer, { arg out=0, tempo=4;\n var snare, base, hihat;\n tempo = Impulse.ar(tempo); // for a drunk drummer replace Impulse with Dust !!!\n\n snare = WhiteNoise.ar(Decay2.ar(PulseDivider.ar(tempo, 4, 2), 0.005, 0.5));\n base = SinOsc.ar(Line.ar(120,60, 1), 0, Decay2.ar(PulseDivider.ar(tempo, 4, 0), 0.005, 0.5));\n hihat = HPF.ar(WhiteNoise.ar(1), 10000) * Decay2.ar(tempo, 0.005, 0.5);\n\n Out.ar(out,(snare + base + hihat) * 0.4 ! 2)\n}).add;\n);\n\na = Synth(\\drummer);\na.set(\\tempo, 6);\na.set(\\tempo, 18);\na.set(\\tempo, 180); // check the CPU! no increase.\na.free;\n```"}, {"role": "assistant", "content": "(thor magnusson) (2006) An instrumentalist inside a synthdef."}]} +{"conversations": [{"role": "user", "content": "What does `MultiSplineFr.liveValues` do?"}, {"role": "assistant", "content": "Multi dimensional spline frame rate device"}]} +{"conversations": [{"role": "user", "content": "What does `PopUpMenu.defaultGetDrag` do?"}, {"role": "assistant", "content": "A view displaying a text item selectable from a drop-down menu. Returns: The #-value."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// If a Function is passed to indices it takes the current lookBack arg as argument.\n\n// mirroring the full lookBack size\n// start without loop\n\n(\n~lookBack = 0;\n\np = PSloop(\n Pbind(\n \\dur, Pn(Pshuf([1, 1, 2]/6)),\n \\midinote, Prand((60..80), inf)\n ),\n bufSize: 10,\n lookBack: { ~lookBack },\n indices: { |l| (0..l-1).mirror }\n).trace.play\n);\n\n// wait a bit to fill buffer\n// mirrored loop i.e. loop with added retrograde\n\n~lookBack = 3\n\n\n// go on and loop again\n\n~lookBack = 0\n\n~lookBack = 3\n\np.stop\n```"}, {"role": "assistant", "content": "If a Function is passed to indices it takes the current lookBack arg as argument. mirroring the full lookBack size (PSloop: Pattern to derive loops from a given Pattern)"}]} +{"conversations": [{"role": "user", "content": "GrainBuf complains about too many grains."}, {"role": "assistant", "content": "The number of simultaneous grains is `density × dur` in seconds, and it exceeds maxGrains (512 by default). Either lower the trigger rate, shorten the grains, or raise the limit: `GrainBuf.ar(2, trig, dur, buf, 1, pos, 2, 0, -1, 1024)` — the 1024 is maxGrains. Raising it costs server CPU per grain, so prefer halving the density if the sound does not need it."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Play your (short) soundfiles with some delay that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n// By Bjørn Houdorf March 2013, Play your (short) soundfiles with some delay.\n\nb = SoundFile.collectIntoBuffers(\"yourSoundFileFolder/*\"); // 1. rund this\n\n( // 2. and then run this\nt = Task({\n({\n var num= b.size.rand;\n var buf= b[num];\n 0.1*Splay.ar(PlayBuf.ar(buf.numChannels, buf, 1, 1, 0, 0));\n}.play;\n) \n});\n);\n\n\n( // 3. Then run this\nz = Task({\nloop({\n t.start;\n 0.1.wait;\n});\n});\n);\n\n\nz.start; // 4. and run this\nz.stop; // 5. and finally run this\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nDelayN.ar(z, 0.2, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\n(\n// recursive application of delay.\n{\nz = Decay2.ar(Dust.ar(1, 0.5), 0.01, 0.1, Saw.ar(100 + [0, 1]));\n5.do { |i| z = DelayN.ar(RLPF.ar(z, Rand(100, 3000), 0.03), 1, 1 / (2**i), 1, z * 0.5) };\nz\n}.play\n)\n```"}, {"role": "assistant", "content": "Dust randomly triggers Decay to create an exponential decay envelope for the WhiteNoise input source (DelayN: Simple delay line with no interpolation.)"}]} {"conversations": [{"role": "user", "content": "What is the difference between the language and the server?"}, {"role": "assistant", "content": "sclang runs your code, the clock and Patterns, and builds UGen graphs. scsynth performs the DSP in real time. They communicate over OSC, which is why a language-side mistake can leave a sound running, and why s.freeAll stops it."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n\n// define HS, PHS - play\n\n(\nh = HS(s, { |freq = 0.5, dev = 10, center = 65| LFDNoise3.kr(freq, dev, center) });\n\np = PHS(h, nil, // default help synth args\n Prand([0.4, 0.2],inf), [ \\midinote, Pkey(\\val), \\amp, 0.1 ],\n 0.1, [ \\midinote, Pkey(\\val) + 9.5 + Pxrand([0, 2, 5],inf), \\amp, 0.08 ]\n).play;\n);\n\n\n// stop only help synth\n\np.stop(hsStop: true, pbindStop\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n\n// define HS, PHS - play\n\n(\nh = HS(s, { |freq = 0.5, dev = 10, center = 65| LFDNoise3.kr(freq, dev, center) });\n\np = PHS(h, nil, // default help synth args\n Prand([0.4, 0.2],inf), [ \\midinote, Pkey(\\val), \\amp, 0.1 ],\n 0.1, [ \\midinote, Pkey(\\val) + 9.5 + Pxrand([0, 2, 5],inf), \\amp, 0.08 ]\n).play;\n);\n\n\n// stop only help synth\n\np.stop(hsStop: true, pbindStop: false);\n\n\n// stop pbind\n\np.stop;\n\n\n// resume help synth and eventstream player\n\np.play(hsPlay: true, pbindPlay: true);\n\n\n// stop player and free HS\n\np.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for midified arpeggiator/auto-accompaniment using patterns."}, {"role": "assistant", "content": "```supercollider\n(\ns.waitForBoot({\n var right, left;\n var n0, n1, n2;\n var note_getter;\n\n MIDIdef.freeAll;\n if (~midi_initilized.isNil) {\n MIDIClient.init;\n MIDIIn.connectAll;\n ~midi_initialized = 1;\n };\n\n ~note_table = 0!127;\n ~n = nil;\n\n MIDIdef.noteOn(\n \\mynoteonhandler, // just a name for this handler\n {\n |val, num, chan, src|\n ~note_table[num] = 1; // update note table and update ~n\n ~n = ~note_table.selectIndices({|item, i| item != 0});\n }\n );\n\n MIDIdef.noteOff(\n \\mynoteoffhandler, // just a name for this handler\n {\n |val, num, chan, src|\n ~note_table[num] = 0; // update note table and update ~n\n /*\n // only enable the following lines if you want the arpeggio to stop as soon as you release the keys\n ~n = ~note_table.selectIndices({|item, i| item != 0});\n if (~n == []) { ~n = nil; };\n */\n }\n );\n\n note_getter = {\n | index |\n Plazy {\n if (~n.isNil) {\n Pseq([Rest(1)]);\n } {\n ~n[index] ?? (~n[0] ?? Pseq([Rest(1)]));\n };\n };\n };\n\n n0 = note_getter.(0);\n n1 = note_getter.(1);\n n2 = note_getter.(2);\n\n right = Pbind(\n \\instrument, \\default,\n \\midinote, Pseq([ n0, n2, n1, n2] ++ (([ n0, n2, n1, n2] + 12)!2).flatten),\n \\dur, Pseq([1, 1, 1, 1, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5 ].normalizeSum*2)\n );\n left = Pbind(\n \\instrument, \\default,\n \\midinote, Pseq([ n0, n2, n0, n2, n0, n2, n0, n2] - 12),\n \\dur, Pseq([1, 1, 1, 1, 1, 1, 1, 1].normalizeSum*2)\n );\n if (~player.notNil) { ~player.stop; };\n ~player = Pn(Ppar([right,left])).play;\n});\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What are you good at?"}, {"role": "assistant", "content": "SuperCollider. I can explain its classes and UGens, write SynthDefs and patches, read a patch back to you, and tell you why one does not compile. I am 198M parameters; I am not a general assistant."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n//code that utilizes the glitch.\n//warning! extremely loud.\n//note: might not sound the same on all soundcards\n(\n{GlitchRHPF.ar(\n BrownNoise.ar(1.dup),\n 0.5,\n Saw.kr(1, 10)\n)}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n//code that utilizes the glitch.\n//warning! extremely loud.\n//note: might not sound the same on all soundcards\n(\n{GlitchRHPF.ar(\n BrownNoise.ar(1.dup),\n 0.5,\n Saw.kr(1, 10)\n)}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for get different result each time running the pattern."}, {"role": "assistant", "content": "```supercollider\nTempoClock.default.tempo = 156/60;\n\n(\nSynthDef(\\spring, { |freq = 400, out = 0, pan = 0, gate = 1, dur = 0.15, curve = -4, amp = 1, index = 1|\n var sig = FreeVerb.ar(Pan2.ar(Blip.ar(freq, index), pan));\n var env = EnvGen.ar(Env.perc(0.01, dur, amp, curve), gate, doneAction:2);\n Out.ar(0, sig * env);\n}).add;\n);\n\n(\nPbind(*[\n instrument: \\spring,\n dur: Pseq([4, 1, 2, 1, 1, 1].scramble/ 4 / TempoClock.default.tempo, inf),\n degree: Pseq(#[1,2,3,4], inf) * Pkey(\\dur).reciprocal,\n octave: Pseq([2,3,4,4,4,3].scramble, inf),\n pan: Pxrand(Array.fill(100, { 0.gaussian(1).clip2(1) }), inf),\n amp: Pseq(#[0.95,1,0.8],inf),\n index: Pstutter(Pseq(#[4,8,12],inf), Pseq([2,3,4,5,6,8].scramble, inf))\n]).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Hymn #15 - generative melody by array rewriting?"}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\ping, {\n arg freq = 440, pan = 0;\n var sig;\n sig = SinOsc.ar(freq, 0, 0.3);\n sig = sig * EnvGen.ar(Env.perc(0.01, 1), doneAction:2);\n sig = Pan2.ar(sig, pan);\n Out.ar(0, sig)\n}).add;\n);\n\n(\n~scramb = {|pan|\nvar notes = [0,4,7,14,9,12,4,7,9,7];\nvar dur = [1,1,2,3,6,3,4,5,2,1,13];\nvar transp = [0, 5, 7, 3, 2];\nvar scrambRand = {|array|\n var rand = rrand(0, array.size-3);\n var end = rand + rrand(1,2);\n var range = (rand..end);\n var reverseRange = range.reverse;\n var temp = array.copy;\n range.postln;\n range.do({|item, index|\n array[item] = temp[reverseRange[index]];\n });\n array;\n};\nvar octRand = {|array|\n var rand = rrand(0, array.size-1);\n array[rand] = array[rand] + [-12,0,12].choose;\n };\nvar task = Task {\n var step = 0;\n var transpStep = 0;\n loop {\n var freq = (notes.wrapAt(step) + 60 + transp.wrapAt(transpStep)).midicps;\n Synth(\\ping, [\\freq, freq, \\pan, pan]);\n (dur.wrapAt(step) * 0.15).wait;\n step = step + 1 % (notes.size * 12;);\n if (step%32 == 0, {scrambRand.value(notes)});\n if (step%20 == 0, {scrambRand.value(dur)});\n if (step%66 == 0, {transpStep = transpStep + 1 % (transp.size)});\n if (step%24 == 0, {notes = notes.rotate(rrand(-1, 1))});\n if (step%56 ==0, {octRand.value(notes)});\n }\n}.play;\n};\n);\n\n(\n~scramb.value(-0.7);~scramb.value(0.7);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar synth = { Out.ar(99, SinOsc.ar([300, 700])) }.play;\n{ In.ar(99, 2) }.plot(0.02, synth);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar synth = { Out.ar(99, SinOsc.ar([300, 700])) }.play;\n{ In.ar(99, 2) }.plot(0.02, synth);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Which keys does a Pbind understand?"}, {"role": "assistant", "content": "The ones you use constantly are \\instrument (a SynthDef name), \\dur (seconds), \\degree (scale degree), \\midinote, \\freq, \\amp, \\legato (note length as a fraction of \\dur), and \\scale plus \\root for the scale used by \\degree. Everything else is passed to the Synth as an argument, so a SynthDef with `|cutoff = 800|` can be driven by `\\cutoff, Pwhite(400, 4000)`."}]} -{"conversations": [{"role": "user", "content": "What does `MultiProc.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Allows selection between multiple breakbeat cutting algorithms Arguments: procs — An array of cut procedure objects.; phrasefunc — a function that returns a valid index into the procs array.; blockfunc — a function that returns a valid index into the procs array. phrasefunc and blockfunc may be set to nil if unneeded. The default behaviour with all nil is a phrasefunc that randomly selects any index up to procs.size.."}]} -{"conversations": [{"role": "user", "content": "What is `Rest`?"}, {"role": "assistant", "content": "Rest — Represents a rest in event patterns"}, {"role": "user", "content": "What does `Rest.new` do?"}, {"role": "assistant", "content": "Create an instance of Rest, with a value to be used in the resulting rest event."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// do nothing for 2 seconds\n(note: Rest(), dur: 2).play;\n\n// intersperse pauses in pattern\nPbind(\\note, Pseq([0, 4, 7, 11], inf), \\dur, Pseq([2, 1, Rest(1)], inf) / 5).play;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nNdef(\\x, { Saw.ar(110) * 0.1 }).play;\nNdef(\\x)[1] = \\filter -> { |in| RLPF.ar(in, 800, 0.4) };\n```"}, {"role": "assistant", "content": "Two nodes in one named proxy: a saw source, then a resonant low-pass filter fed by it.\n\n`Ndef(\\x, { ... })` defines the first node of the chain and `.play` starts it. `Ndef(\\x)[1] = \\filter ->`\ninserts a second node at index 1; the `\\filter` key says 'make this node an effect that receives the\nprevious node's output as `in`'. So the patch is `Saw -> RLPF -> out`. Because it is an Ndef, calling\n`Ndef(\\x, { ... })` again replaces the source with a crossfade instead of restarting, and\n`Ndef(\\x).stop` removes the whole chain."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// make some sounds when play is started\n~this.sched(0,{\n ~sound = make sound\n},{\n ~sound.stop\n});\n\n\n// sched at beat 16, visible on the timeline\n~this.sched(16,{\n ~sound = make sound\n},{\n ~sound.stop\n});\n\n\n// sched using a name, moveable on the timeline, duplicatable on the timeline\n~this.sched(\\intro,{\n ~sound = make sound\n},{\n ~sound.stop\n};\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// make some sounds when play is started\n~this.sched(0,{\n ~sound = make sound\n},{\n ~sound.stop\n});\n\n\n// sched at beat 16, visible on the timeline\n~this.sched(16,{\n ~sound = make sound\n},{\n ~sound.stop\n});\n\n\n// sched using a name, moveable on the timeline, duplicatable on the timeline\n~this.sched(\\intro,{\n ~sound = make sound\n},{\n ~sound.stop\n});\n```"}]} -{"conversations": [{"role": "user", "content": "What does `MultiSplineFr.gui` do? What arguments does it take?"}, {"role": "assistant", "content": "Multi dimensional spline frame rate device Arguments: parent; bounds; maxTime."}]} -{"conversations": [{"role": "user", "content": "Who are you?"}, {"role": "assistant", "content": "I am sc-mind, a 198M MiniMind-3-MoE trained from scratch on the SuperCollider source and help corpus. I write and explain SuperCollider: SynthDefs, UGens, Patterns, Ndef, the language/server split, and how to make sound that is not silence."}]} -{"conversations": [{"role": "user", "content": "What does `LinXFade2.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Two channel linear crossfade. Arguments: inA — Input signal A.; inB — Input signal B.; pan — Cross fade position from -1 to +1.; level — A control rate level input.."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n var saw, bpf;\n saw = Pulse.ar(\n freq: [100,150],\n mul: LFPulse.kr(\n freq: [0, 0.03, 0.04],\n width: 0.15));\n bpf = LPF.ar(in: saw, freq: SinOsc.kr(-10, -5, 3).range(200, 400));\n Out.ar(0, bpf);\n}.play;\n)\n```"}, {"role": "assistant", "content": "//Pulse is the UGen. There is multichannel expansion due to the lists in the freqs. The range is a big part of the reason this sounds so deep."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// derived from an answer by Sergio Luque to a mail to the sc-users SuperCollider mailing list on 2013/03/22\n\n(\nvar registerSize = 16;\nvar min =\"C2\".namemidi.asInteger;\nvar max = \"C6\".namemidi.asInteger;\nvar waitTime = 0.05; // in seconds\n//var chance = 0.1;\nvar chance = Pseq([Pseries(0, 0.1, 10), Pseries(1, -0.1, 10)], inf);\nvar change = 10; // step size\n\n\nPbind(\n \\midinote, Pswitch1(\n { \n Pbrown(min, max, Pif(Prout({ chance.trace.coin.embedInStream }), change, 0))\n } ! registerSize, \n Pseq(Array.iota(registerSize), inf)\n ),\n \\dur, waitTime\n).play\n)\n```"}, {"role": "assistant", "content": "wiard noise ring variation using a ringbuffer instead of bitshifting.\r\nRe-implemented according to Julian Parker's m4l patch.\r\nDerived from an answer by Sergio Luque to a mail to the sc-users SuperCollider mailing list on 2013/03/22."}]} -{"conversations": [{"role": "user", "content": "What does `UChain.eventSustain` do?"}, {"role": "assistant", "content": "The time from the begging of the event until the moment when the chain should be released (to start the fade Returns: Float"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// what can it sound like? see: https://www.youtube.com/watch?v=dRmY3tEwZyE \n// the youtube version has been sent through an additional reverb pedal, but\n// you don't need the pedal to get something that sounds interesting\n\n(\ns.options.memSize_(16384*10);\ns.reboot;\ns.waitForBoot({\n \n Ndef(\\bits, {\n var t = PulseCount.ar(Impulse.ar(8e3));\n var u = PulseCount.ar(Impulse.ar(7009));\n var sig = HPF.ar(\n (\n ((t * 15) & (t >> 5)) |\n ((t * 5) & (t >> [3, 4])) |\n ((t * 2) & (t >> 9)) |\n ((t * 8) & (t >> 11)) |\n (((t*t) & t) | (t >> 3))\n - 3 % 256\n ) / 127-1 * 3\n , 20\n ) * 0.1;\n var sig2 = LPF.ar(HPF.ar(gcd(t*u, u+t), WhiteNoise.ar()*2000 + 1000), 20);\n sig2 = sig2*sig;\n sig = 0.3*Splay.ar(Limiter.ar(Greyhole.ar(sig + sig2, sig, 0.5, sig), 0.5).flatten);\n }).play;\n});\n)\n```"}, {"role": "assistant", "content": "a surprisingly rich soundscape in a few lines of code (lucky accident)."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Electrode Theremin (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var saw, bpf;\n saw = Saw.ar(\n freq: 30, \n mul: SinOsc.kr(\n freq: LFPulse.ar(freq: [100, 1000]).range(1, 10),\n width: 0.9));\n bpf = BPF.ar(in: saw, freq: MouseY.kr(1000, [6000, 9000]), rq: MouseX.kr(0.1, 0.9), mul: 20);\n Out.ar(0, bpf);\n \n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Trig`."}, {"role": "assistant", "content": "```supercollider\n{ Trig.ar(Dust.ar(1), 0.2) * FSinOsc.ar(800, 0.5) }.play\n\n{ Trig.ar(Dust.ar(4), 0.1) }.play\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Buffer.query` do? What arguments does it take?"}, {"role": "assistant", "content": "Sends a `\\b_query` message to the server, which reponds with: the OSC address pattern (`/b_info`), `bufnum`, `numFrames`, `numChannels`, and `sampleRate` of the server-side buffer representation. These values are passed, in order, to the action function which, by default, is: `action: { |oscAddrPattern, bufnum, numFrames, numChannels, s` which posts the buffer's Arguments: action — An optional Function to be called with the buffer attributes listed above as arguments, replacing the default action.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// change a parameter\n(\nPbind(\n \\note, Pseg(Pseq([1, 5], inf), Pseq([4, 1], inf), \\linear),\n \\dur, 0.1\n).play;\n);\n\n(\nPbind(\n \\freq, Pseg(Pseq([400, 1500], inf), Pseq([4, 4], inf), Pseq([\\linear, \\exp], inf)),\n \\dur, 0.1\n).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// change a parameter\n(\nPbind(\n \\note, Pseg(Pseq([1, 5], inf), Pseq([4, 1], inf), \\linear),\n \\dur, 0.1\n).play;\n);\n\n(\nPbind(\n \\freq, Pseg(Pseq([400, 1500], inf), Pseq([4, 4], inf), Pseq([\\linear, \\exp], inf)),\n \\dur, 0.1\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for first step?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n\nz = ( ( SinOsc.ar( ((LFSaw.kr(-0.05,1) +1) *100 + 20 ), LFTri.kr(40,0,1), LFSaw.kr(1.5) ) \n * LFTri.kr(rrand(0.005,0.03),3.99.rand,0.2) ) + \n( LFPulse.ar(60,0,0.5,Pulse.ar(0.5,0.5,0.1)) * LFTri.kr(rrand(0.005,0.03),3.99.rand,0.5) ) +\n( SinOsc.ar(65,0,LFPulse.kr(0.66666,0.5,0.3)*0.3) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) )+\n( LFPar.ar(120,0,LFPulse.kr(0.5,0.5,0.2)*0.3) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( LFCub.ar(185,0,LFPulse.kr(0.5,0.74,0.2)*0.3) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( SinOsc.ar(365,0,LFPulse.kr(1.33333333,0,0.1)*0.3) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( FreeVerb.ar(LFTri.ar(260,0,LFPulse.kr(0.5,0.25,0.01)*0.3),0.5,0.8,0.1) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( SinOsc.ar(800,0,LFPulse.kr(2,0,0.1)*0.1) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( LFPar.ar(820,0,LFPulse.kr(1.666666,0,0.1)*0.1) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( WhiteNoise.ar( LFPulse.kr(2,0.5,0.001,1) )/2 * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( WhiteNoise.ar( LFPulse.kr(1,0.5,0.001,1) )/2 * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( WhiteNoise.ar( LFPulse.kr(1.666666,0.5,0.001,1) )/4 * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( WhiteNoise.ar( LFPulse.kr(1.333333,0.5,0.001,1) )/4 * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) );\n\nFreeVerb.ar(\n ((CombC.ar(\n DelayN.ar(\n DelayN.ar(z, 0.5, [0.5,0.75], 1, z), \n 0.5, 0.5, 1, z), \n 0.1, LFNoise0.kr(1,0.05,0.001).abs, 2, z))+z),\n0.1,1,0.1); \n\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes an experiment with roots of unity in supercollider."}, {"role": "assistant", "content": "```supercollider\n(\n\n~divisors = {\n arg n;\n ~divs = List.newClear(0);\n for( 1, floor(sqrt(n)), {arg i; if(n%i==0,{\n //i.postln;\n ~divs.add(i);\n // (i==n.div(i)).postln;\n if(i==n.div(i),{},{~divs.add(n.div(i))});\n },{});\n });\n ~divs.sort;\n ~divs;\n};\n\n\nSynthDef(\\rootsOfUnitySum, { |out=0,freq=1,amp=1,n=1,ks=#[1]|\n var l,sigl,sigr,env;\n\n\n sigl = SinOsc.ar(freq:0,mul:0);\n sigr = SinOsc.ar(freq:0,mul:0);\n ks.do({arg item,i;\n k = item;\n sigr = sigr+SinOsc.ar(freq:freq*2pi*k/n,mul:amp,phase:0.5*pi);\n sigl = sigl+SinOsc.ar(freq:freq*2pi*k/n,mul:amp);\n });\n env = EnvGen.kr(Env.linen(attackTime: 0.001, sustainTime: 1, releaseTime: 0.01, level: 1.0, curve: 'lin'), doneAction: Done.freeSelf);\n sigr = sigr*env;\n sigl = sigl*env;\n\n Out.ar(out, [sigl,sigr])\n}).add;\n\n\n~getPbind = { arg n, amps, durs, freq;\n ~nums = ~divisors.value(n);\n r = Pbind(\\instrument,\\rootsOfUnitySum,\n \\amp,amps,\n \\dur,durs,\n \\freq,freq,\n \\n,Pseq([n],~nums.size),\n \\ks , Pseq(all{:~divisors.value(n),n<-~nums},1)).trace();\n r\n};\n\n~seq = (1..13);\n~tau = all{:~divisors.value(n).size,n<-~seq};\n\n\n~r = Pseq(all{:~getPbind.value(\n n:n,\n amps:Pseq(all{:0.5/t,t<-~tau},1),\n durs:Pseq(all{:0.3333/t,t<-~tau},1),\n freq:220/3),n<-~seq},1);\n\n~s = Pseq(all{:~getPbind.value(\n n:n,\n amps:Pseq(all{:0.5/t,t<-~tau},1),\n durs:Pseq(all{:0.5/t,t<-~tau},1),\n freq:110),n<-~seq},1);\n\n~t = Pseq(all{:~getPbind.value(\n n:n,\n amps:Pseq(all{:0.5/t,t<-~tau},1),\n durs:Pseq(all{:1/t,t<-~tau},1),\n freq:220),n<-~seq},1);\n\n~x = Pseq([\n Ppar([~t],1),\n Ppar([~s],1),\n Ppar([~s,~t],1),\n Ppar([~r],1),\n Ppar([~r,~t],1),\n Ppar([~r,~s],1),\n Ppar([~r,~s,~t],1),\n ],inf);\n\n);\n\nPdef(\\mplayer, ~x).clock_(TempoClock(100/60)).play;\nPdef(\\mplayer, Pn(Event.silent)).fadeTime_(8);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Multichannel Convolution Reverb (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\n~numIRs = 4;\n~fftsize = 2048;\ns.waitForBoot {\n var irs, irbuffs, bufsizes, nextmod, numSamples;\n nextmod = 100;\n numSamples = 40000 ;\n \n /* an array of multiple IRs */\n irs = ~numIRs.collect{ arg nth;\n // nth is here not used, but can be useful to scale decay time.\n [0] ++ 0.dup(100) ++ Array.fill(\n numSamples, { arg i;\n (i%nextmod==0).if\n {\n nextmod= rrand(80, 120);\n (i.asFloat/numSamples).squared * 0.3\n } {\n 0\n }\n }\n )\n };\n { irs.plot }.defer; // to show irs.\n \n /* an array of buffers. */\n irbuffs = ~numIRs.collect{ arg i; Buffer.loadCollection(s, irs[i]) };\n irbuffs.postln; // to show irbuffs info.\n s.sync;\n \n bufsizes= irbuffs.collect{ |nth|PartConv.calcBufSize(~fftsize, nth) };\n ~irSpctrms = bufsizes.collect{ arg size, i;\n Buffer\n .alloc(s, size, 1)\n .preparePartConv(irbuffs[i], ~fftsize)\n };\n s.sync; \n \n ~numIRs.do{|i| irbuffs[i].free}\n}\n);\n\n(\nfork{\n ~target= Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n s.sync;\n {\n var in, krnl;\n in= PlayBuf.ar(1, ~target, loop:1);\n \n /* an array of multiple instances of PartConv */\n krnl= ~numIRs.collect{ arg i;\n PartConv.ar(in, ~fftsize, ~irSpctrms[i].bufnum, 0.2)};\n // By iterating, each PartConv processes a mono-channel buffer in the array ~irSpctrms.\n \n Out.ar(0, krnl);\n }.play\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Buffer`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n// allocate an array of Buffers and fill them with different harmonics\n(\nb = Buffer.allocConsecutive(8, s, 4096, 1, { |buf, i|\n buf.sine1Msg((1 .. ((i + 1) * 6)).reciprocal) // completion messages\n});\n\na = { VOsc.ar(SinOsc.kr(0.5, 0).range(b.first.bufnum + 0.1, b.last.bufnum - 0.1),\n [440, 441], 0, 0.2) }.play;\n);\na.free;\n\n// iterate over the array and free it\nb.do(_.free);\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Josh Parmenter (2007) record scratcher?"}, {"role": "assistant", "content": "```supercollider\n// Josh Parmenter (2007)\n// record scratcher\n\nSynthDef(\\scratch, {arg gate = 1, buffer;\n var buf, speed, env;\n env = EnvGen.kr(\n Env([0,1,0], [0.1, 0.1], \\sin, 1),\n gate, doneAction: 20);\n speed = MouseX.kr(-10, 10);\n speed = speed - DelayN.kr(speed, 0.1, 0.1);\n speed = MouseButton.kr(1, 0, 0.3) + speed ;\n buf = PlayBuf.ar(1, buffer, speed * BufRateScale.kr(buffer), loop: 1);\n Out.ar(0, (buf * env).dup );\n}).add;\n\ns.boot;\n\n// path to a mono soundfile here\na = Buffer.read(s, ExampleFiles.child);\n\nb = Synth(\\scratch, [\\buffer, a]);\n\n// move mouse to scrub the record.\n// press mouse button to 'stop the record', you can scrub while it is stopped.\n\n// stop the synth\nb.set(\\gate, 0);\n// free the Buffer\na.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SoundFile.openWrite` do? What arguments does it take?"}, {"role": "assistant", "content": "Try to create an audio file at the given path. Note that there is no `numFrames` argument: the number of frames is counted after writing data into the Arguments: pathName — Full path to the sound file. Use String#-standardizePath to resolve home-folder shortcuts such as `~`.; headerFormat — A string for the sound file format. Valid strings are listed at SoundFile#-headerFormat. If not given, the default `\"AIFF\"` is used.; sampleFormat — A string for the sample format. Valid strings are listed at SoundFile#-sampleFormat. If not given, the default `\"float\"` is used.; numChannels — An integer number of channels (1 by default).; sampleRate — An integer sample rate (44100 by default).. Returns: A new SoundFile instance if successful, or `nil` if file open failed. User code should check for `nil` before doing anything with the SoundFile object."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LFPulse`."}, {"role": "assistant", "content": "```supercollider\n{ LFPulse.ar(50) * 0.1 }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nv = Vowel()\nv.addFormants([3000,4000], -6, [200, 200])\n\n{Formants.ar(100, v) * 0.1 }.play\n{Formants.ar(100, Vowel()) * 0.1}.play\n \n{[Formants.ar(100, Vowel()) * 0.1, Formants.ar(100, v) * 0.1 ]}.play\n\nv.removeFormants([5,6]\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nv = Vowel()\nv.addFormants([3000,4000], -6, [200, 200])\n\n{Formants.ar(100, v) * 0.1 }.play\n{Formants.ar(100, Vowel()) * 0.1}.play\n \n{[Formants.ar(100, Vowel()) * 0.1, Formants.ar(100, v) * 0.1 ]}.play\n\nv.removeFormants([5,6])\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Node.isRunning` do?"}, {"role": "assistant", "content": "Abstract superclass of Synth and Group Returns: a boolean indicating if this node is currently on the server, providing this Node has been registered with a NodeWatcher."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SendReply`."}, {"role": "assistant", "content": "```supercollider\n(\n{ SendReply.ar(Impulse.ar(4), \"/reply\", [Sweep.ar, SinOsc.ar(0.3)]); 0 }.play;\nOSCdef(\\x, { |msg|\n var time, value;\n time = msg[3];\n value = msg[4];\n \"value % occurred at time %\".format(value, time).postln;\n}, \"/reply\");\n)\n```"}]} -{"conversations": [{"role": "user", "content": "How do I add a reverb send to a whole group?"}, {"role": "assistant", "content": "Same shape as the delay: a private stereo bus, one effect reading it, instruments writing both dry\nand wet.\n\n```supercollider\n(\n~verbBus = Bus.audio(s, 2);\nSynthDef(\\verb, { |in = 0, out = 0, room = 0.85, mix = 0.5|\n Out.ar(out, FreeVerb.ar(In.ar(in, 2), mix, room, 0.5) * 0.7);\n}).add;\nSynthDef(\\blip, { |out = 0, send = 0, freq = 440, amp = 0.1|\n var env = EnvGen.kr(Env.perc(0.002, 0.4), doneAction: 2);\n var sig = SinOsc.ar(freq) * env * amp;\n Out.ar(out, sig);\n Out.ar(send, sig);\n}).add;\n);\nSynth(\\verb, [\\in, ~verbBus]);\nPbind(\\instrument, \\blip, \\send, ~verbBus, \\degree, Pseq([0, 4, 7, 11], inf), \\dur, 0.25).play;\n```"}]} -{"conversations": [{"role": "user", "content": "I get 'Node not found' when I call .set on a Synth after a while."}, {"role": "assistant", "content": "The Synth was freed and the language still holds a reference. That happens whenever the SynthDef used `doneAction: 2` and the envelope finished, or when something called `freeAll`/`CmdPeriod`. Guard it with `if (x.notNil and: { x.isPlaying }) { x.set(\\freq, 300) }`, or store the node in a variable that you clear when it ends. For sustained sounds the right pattern is a `gate` argument with `doneAction: 2` on the EnvGen, so the node lives until you release it."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `FBSineN`."}, {"role": "assistant", "content": "```supercollider\n// increase feedback\n{ FBSineN.ar(SampleRate.ir, 1, Line.kr(0.01, 4, 10), 1, 0.1) * 0.2 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BufDelayL`."}, {"role": "assistant", "content": "```supercollider\n// allocate buffer\nb = Buffer.alloc(s, 44100, 1);\n\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nBufDelayL.ar(b.bufnum, z, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\nb.free;\n\n\n// multichannel\n\n// two channels, two buffers\nb = Buffer.allocConsecutive(2, s, 32768, 1);\n\na = { |bufs = #[0, 1]|\n var sig = SinOsc.ar([440, 880]) * Decay2.kr(Impulse.kr([2, 4]), 0.01, 0.15);\n sig + BufDelayL.ar(bufs, sig, delaytime: 0.125)\n}.play(args: [bufs: b]);\n\na.free;\nb.do(_.free);\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nb = Buffer.alloc(s, 512, 1, { |buf| buf.sine1Msg(1.0/[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) });\n{ COsc.ar(b.bufnum, 200, 0.7, 0.25) }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nb = Buffer.alloc(s, 512, 1, { |buf| buf.sine1Msg(1.0/[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) });\n{ COsc.ar(b.bufnum, 200, 0.7, 0.25) }.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `List`."}, {"role": "assistant", "content": "```supercollider\n(\n// Create a new empty List with size: 3\nx = List.new(3);\n\nx.postln; // -> List[ ]\n\n// Add numbers 0 to 4 to the List\n5.do({ |i| x.add(i) });\n\n// The list has been modified in-place with each added item\nx.postln; // -> List[ 0, 1, 2, 3, 4 ]\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Those were the times."}, {"role": "assistant", "content": "```supercollider\n(\ns.waitForBoot({\n\n SynthDef(\\singer, {\n | out=0, freq=440, amp=0.5, vibrato=6|\n var lfo, lfo2, lfo3, sig;\n lfo = SinOsc.kr(1/5, 0).range(250,1000);\n lfo2 = SinOsc.kr(1/5, 0).range(0.1,0.9);\n lfo3 = SinOsc.kr(vibrato).range(0.3, 1);\n sig = lfo3*RLPF.ar(in:VarSaw.ar(freq:Lag.ar(in:K2A.ar(freq), lagTime:0.3), iphase:0, width:lfo2, mul:amp), freq:lfo, rq:200/lfo);\n Out.ar(out, sig!2);\n }).add;\n\n s.sync;\n\n Pdef.defaultQuant_(0);\n Pdef(\\bass, Pmono(\\default, \\dur, Pwhite(0.01, 0.1, inf), \\freq, (Pgbrown(1,8,5) * 20).round(10), \\amp, Pbrown(0.2,0.6,0.05)));\n Pdef(\\computer, Pmono(\\default, \\dur, Pwhite(0.01, 0.1, inf), \\freq, (Pgbrown(1,8,9) * 100).round(20), \\amp, Pbrown(0.2,0.6,0.05)));\n Pdef(\\soprano, Pmono(\\singer, \\dur, Pwhite(0.01, 0.1, inf), \\freq, Pgbrown(1,8,0.05) * 200, \\amp, Pbrown(0.2,0.6,0.05)/5, \\vibrato, Pbrown(4,7,0.125)));\n Pdef(\\soprano2, Pmono(\\singer, \\dur, Pwhite(0.01, 0.1, inf), \\freq, Pbrown(3,6,0.1) * 100, \\amp, Pbrown(0.2,0.6,0.05)/5, \\vibrato, Pbrown(3,8,0.125)));\n\n fork {\n Pdef(\\bass).play;\n 10.wait;\n Pdef(\\computer).play;\n 10.wait;\n Pdef(\\soprano).play;\n 10.wait;\n Pdef(\\soprano2).play;\n 10.wait;\n Pdef(\\computer).stop;\n 20.wait;\n Pdef(\\bass).stop;\n 10.wait;\n Pdef(\\soprano).stop;\n Pdef(\\soprano2).stop;\n Pdef(\\bass).play;\n Pdef(\\soprano).play;\n 10.wait;\n Pdef(\\soprano2).play;\n 10.wait;\n Pdef(\\computer).play;\n 20.wait;\n Pdef(\\bass).stop;\n Pdef(\\computer).stop;\n Pdef(\\soprano).stop;\n Pdef(\\soprano2).stop;\n }\n\n});\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n//Version 1\n//P(eace)Bind\n//If error messages could experience Nirvanna, it would sound like this.\n(\n{\nSaw.ar(\n freq: SinOsc.kr([60, 63, 67, 70]).range(440,880),\n mul:LFNoise0.kr(freq: [0.25,1]).range(0,1),\n )\n}.play\n\n);\n\n\n//Version 2\n//SuperCollider\n//Sometimes in life, you feel like you need to collide with things.\n(\n{\nPulse.ar(\n freq: SinOsc.kr([60, 63, 67, 70]).range(30,70),\n mul: LFPulse.kr(freq: [0.25,1]).range(0,1)\n )\n}.play\n\n)\n```"}, {"role": "assistant", "content": "Quiz 4a for MUSC 115, pp. 62-84 from Gentle Intro to SuperCollider."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LPZ1`."}, {"role": "assistant", "content": "```supercollider\n// Compare:\n\n{ WhiteNoise.ar(0.25) }.play;\n\n{ LPZ1.ar(WhiteNoise.ar(0.25)) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Swarm of sound files."}, {"role": "assistant", "content": "```supercollider\nb = SoundFile.collectIntoBuffers(\"yourSoundFileFolder/*\"); // By Bjørn Houdorf, December 21, 2012\n\n(\n{\nvar number = b.numChannels, randomNumber, trigger, delayed, panned, sound, mixedSound, rotatedSound;\ntrigger = Dust.kr(Array.fill(number,1), 1, -0.5); // Generates random impulses from -0.5 to 0.5. as a excitation function\nrandomNumber = TRand.kr(1, number, trigger);\nsound = PlayBuf.ar(Array.fill(number,1) ,randomNumber,1,trigger,0,0); // play sound files\ndelayed = DelayL.ar(sound, trigger, trigger); // delaying the sound files\npanned = Pan2.ar(delayed, Array.fill(number,{1.0.rand2})); // pan them out in the stereo field\nmixedSound = 0.05*Mix.new(panned);// and mix them to one stereo signal\nrotatedSound = Rotate2.ar(mixedSound[0], mixedSound[1], LFSaw.kr(0.05)); // rotate stereo signal\n}.play; // play it all\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for how to generate the synthdef with a pattern?"}, {"role": "assistant", "content": "```supercollider\n(\nPdef(\\zed, \n Pbind(\n \\osc, Pseq([SinOsc, LFSaw],inf),\n \\instrument, Prout({ arg ev;\n SynthDef(\\zed, { arg out=0, gate=1, amp=0.1, pan=0, freq=200;\n var sig;\n sig = ev[\\osc].ar(freq);\n sig = sig * EnvGen.kr(\\adsr.kr(Env.adsr(0.1,0.1,0.8,0.1)), gate, doneAction:2);\n sig = Pan2.ar(sig, pan, amp);\n Out.ar(out, sig);\n }).add.yield;\n }).loop,\n \\degree, Pseq([0],inf),\n \\dur, 1,\n \\amp, 0.1,\n )\n).play;\n);\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n//distortion creeps in under 200Hz\n{ DPW3Tri.ar(XLine.kr(2000, 20, 10)) }.play; \n\n//very fast sweeps can have transient distortion effects\n{ DPW3Tri.ar(MouseX.kr(200,12000,'exponential')) }.play;\n\n//compare:\n{LFTri.ar(MouseX.kr(200,12000,'exponential'))}.play\n\n\n//less efficient than LFTri\n{ Mix(DPW3Tri.ar(Array.rand(10,50,5000))*0.1) }.play;\n\n{ Mix(LFTri.ar(Array.rand(10,50,5000))*0.1) }.play;\n\n\n//triangle is integration of square wave; warning loud, not so kind \n{Int\n// …\n```"}, {"role": "assistant", "content": "distortion creeps in under 200Hz very fast sweeps can have transient distortion effects (DPW3Tri: Triangle via 3rd order differerentiated polynomial waveform)"}]} -{"conversations": [{"role": "user", "content": "How do I see what a signal is doing?"}, {"role": "assistant", "content": "`.poll` prints values to the post window — `SinOsc.kr(1).poll` prints once per control block, and `.poll(10)` limits it to every 10th. `s.scope` opens an oscilloscope on the main output, and `.scope` on a UGen shows just that signal. For a numeric snapshot of many signals at once, `s.meter` shows the output levels, and `\".dump\".postln` style probes are common while debugging."}]} -{"conversations": [{"role": "user", "content": "Explain `COsc` in SuperCollider briefly."}, {"role": "assistant", "content": "COsc — Chorusing wavetable oscillator. Chorusing wavetable lookup oscillator. Produces sum of two signals at Category: UGens > Generators > Deterministic."}]} -{"conversations": [{"role": "user", "content": "What does `PatchIn.connectedTo` do?"}, {"role": "assistant", "content": "manages a Player's input when connecting to other Players"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// track audio in (try clapping a beat or beatboxing, but allow up to 6 seconds for tracking to begin) and spawning stuff at quarters, eighths and sixteenths\n(\nSynthDef(\\help_beattrack2_2, { |out|\n var trackb, trackh, trackq, tempo;\n var source, kbus;\n var bsound, hsound, qsound;\n\n source = SoundIn.ar(0);\n\n // downsampling automatic via kr from ar\n kbus = Out.kr(0, LPF.ar(source, 1000)); // ([feature1, feature3]++feature2);\n\n #trackb, trackh, trackq, tempo = BeatTrack2.kr(0, 1, weightingscheme:\n// …\n```"}, {"role": "assistant", "content": "track audio in (try clapping a beat or beatboxing, but allow up to 6 seconds for tracking to begin) and spawning stuff at quarters, eighths and sixteenths downsampling automatic via kr from ar (BeatTrack2: Template matching beat tracker)"}]} -{"conversations": [{"role": "user", "content": "Explain `RedBencode` in SuperCollider briefly."}, {"role": "assistant", "content": "RedBencode — Bencode encoder and decoder Read about this format here... http://en.wikipedia.org/wiki/Bencode Category: Red > redTools."}]} -{"conversations": [{"role": "user", "content": "What does `Pkey.new` do? What arguments does it take?"}, {"role": "assistant", "content": "access a key in an event stream Arguments: key — The name of the event variable to read from.; repeats — The number of items returned before finishing. Using `nil`, the default value, makes the stream infinite.."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Stream`."}, {"role": "assistant", "content": "```supercollider\n// play at the next beat, with offset 0.4\n(\nRoutine({ loop {\n \"///\".postln; (delta: 0.5).yield;\n \"_/_\".postln; (delta: 0.1).wait;\n} }).asEventStreamPlayer.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// example: two SuperCollider apps communicating\n\n// application 1:\nn = NetAddr(\"127.0.0.1\", 57120); // the url should be the one of computer of app 2 (or nil)\n\no = OSCresponderNode(n, '/chat', { |t, r, msg| (\"time:\" + t).postln; msg[1].postln }).add;\n\n// application 2:\nm = NetAddr(\"127.0.0.1\", 57120); // the url should be the one of computer of app 1\nm.sendMsg(\"/chat\", \"Hello App 1\");\n\n// sending bundles (including timestamps)\n(\nm.sendBundle(2.0, [\"/chat\", \"Hello App 1\"], [\"/chat\", \"Hallo Wurld\n// …\n```"}, {"role": "assistant", "content": "example: two SuperCollider apps communicating sending bundles (including timestamps) (OSCresponderNode: client side network responder)"}]} -{"conversations": [{"role": "user", "content": "What does `Monitor.copy` do?"}, {"role": "assistant", "content": "Return a copy of the receiver, with the same channel setting, but not running. You can run it with the settings by sending it the #-play message, and pass in any modifications you want to"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for muffled thump?"}, {"role": "assistant", "content": "```supercollider\n(\n{ var nse, env, kic;\n kic = tanh(Ringz.ar(LPF.ar(Trig.ar(Impulse.ar(1.0),SampleDur.ir),1000),30,0.25,7).sin*2);\n env = Env.perc(0.05, 1, 1, -4);\n nse = BrownNoise.ar(2) + PinkNoise.ar(0.5) * EnvGen.kr(env,Impulse.kr(1), doneAction: 2);\n\n nse = Mix.ar(BPF.ar(nse,[100,1200,80,40,20],MouseX.kr(0,1),[1,0.2,1,1,1]));\n nse = LPF.ar(nse + kic, MouseY.kr(100,1000))! 2\n\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Re: winter is coming?"}, {"role": "assistant", "content": "```supercollider\n(\n{ \n Limiter.ar(\n Pan2.ar(\n LPF.ar(\n DynKlank.ar(\n `[\n Array.rand(5, 700, 2000), \n nil, \n Array.rand(5, 0.2, 5).collect({|freq|\n SinOsc.kr(freq).range(0.1,1)\n })\n ], \n Limiter.ar(\n Dust.ar( SinOsc.kr(1).range(1.5, 4), 0.45) \n + \n Impulse.ar( SinOsc.kr(0.03).range(0.5, 1.2) , 0, 0.9)\n )\n ),\n 1600,\n 0.6\n ),\n SinOsc.kr(0.01 + 4.rand, mul:0.5)\n )\n +\n Pan2.ar(\n DynKlank.ar(`[\n Array.rand(5, 700, 2000).collect({ |freq| SinOsc.kr( SinOsc.kr( SinOsc.kr(0.2).range(0, 10) ) ).range(100, freq) }),\n nil, \n Array.rand(5, 0.3, 1)\n ], PinkNoise.ar(0.006) ),\n Lag.kr(TRand.kr(-0.8, 0.8, Pulse.kr(2 + 10.rand)))\n )\n ) * LorenzL.ar(MouseX.kr(0, 230), add: 0.5, mul: 0.5)\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Change arg values of MIDIdef after instantiation."}, {"role": "assistant", "content": "```supercollider\n~mdef =\n{\n |key, func, msgNum, permanent = true|\n\n MIDIdef(key, func ?? { MIDIdef(key).func }, msgNum ? MIDIdef(key).msgNum, MIDIdef(key).chan, MIDIdef(key).msgType, MIDIdef(key).srcID).permanent_(permanent)\n}\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Server.pid` do?"}, {"role": "assistant", "content": "Get process ID of the running server (if not"}]} -{"conversations": [{"role": "user", "content": "Explain `EaseOutAtan` in SuperCollider briefly."}, {"role": "assistant", "content": "EaseOutAtan — Atan ease-out Easing equation for an atan ease-out, decelerating from zero velocity. The a parameter is curvature. Category: Ease."}]} -{"conversations": [{"role": "user", "content": "What is `Collection`?"}, {"role": "assistant", "content": "Collection — Abstract superclass of all collections"}, {"role": "user", "content": "What does `Collection.newFrom` do?"}, {"role": "assistant", "content": "Creates a new Collection from another collection. This supports the interface for the method \"as\". `Array.newFrom(Set[4, 2, 1]);`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n~closet = [\\hat, \\hat, \\hat, \\coat, \\coat, \\shoe, \\shoe];\n~closet.removeAll([\\hat, \\coat, \\shoe, \\shoe]); // Doesn't empty the closet, just removes what we wanted to\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// bend all numerical values by adding controls\nNdef(\\bubbles, {\n var index = 0;\n Bend({ |original|\n [original, original.isNumber, index].postln;\n if(original.isNumber) {\n original = NamedControl.kr(\"bend_\"++index, original);\n index = index + 1; \n };\n original;\n }, {\n f = LFSaw.kr(0.4, 0, 24, LFSaw.kr([8,7.23], 0, 3, 80)).midicps; // glissando function\n CombN.ar(SinOsc.ar(f, 0, 0.04), 0.2, 0.2, 4) // echoing sine wave\n })\n}).play)\n\n\nNdef(\\bubbles).\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// bend all numerical values by adding controls\nNdef(\\bubbles, {\n var index = 0;\n Bend({ |original|\n [original, original.isNumber, index].postln;\n if(original.isNumber) {\n original = NamedControl.kr(\"bend_\"++index, original);\n index = index + 1; \n };\n original;\n }, {\n f = LFSaw.kr(0.4, 0, 24, LFSaw.kr([8,7.23], 0, 3, 80)).midicps; // glissando function\n CombN.ar(SinOsc.ar(f, 0, 0.04), 0.2, 0.2, 4) // echoing sine wave\n })\n}).play)\n\n\nNdef(\\bubbles).gui(20);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `IdentityDictionary`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_sinegrain, { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0.5pi, env))\n}).add;\n\na = Pbind(\\instrument, \\help_sinegrain, \\note, Pseq([0, 7, 2, 9, 11, 10, 9, 8], inf), \\dur, 1);\na.play(quant: (quant: 1, phase: 0));\na.play(quant: (quant: 1, phase: 1/3));\na.play(quant: (quant: 1, phase: 1.0.rand));\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `CXLabel` in SuperCollider briefly."}, {"role": "assistant", "content": "CXLabel — a simple convience class to create a label Category: Libraries > crucial > GUI."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// For more SynthDefs and examples please head to: https://mycelialcordsblog.wordpress.com/ \n\n(\nSynthDef(\\hasherTest,\n{\narg rate = 1, freq = 60, index = 1000, tRate = 100,\nout = 0, fRate = 0.1;\n\nvar t_trig = LFPulse.kr(0.5/fRate, 0.5);\nvar random = LFNoise0.ar(rate, add:1);\nvar noise = Hasher.ar(random);\nvar sound = Saw.ar((freq+(noise*index)), Decay.kr(Impulse.kr(tRate), noise*0.001)).tanh;\nsound = Pan2.ar(sound, noise-0.3*2);\nFreeSelf.kr(t_trig);\nOut.ar(out, sound);\n}).store;\n);\n\n(\nPbind(\n\\instrument, \\hasherTest,\n\\dur, 5,\n\\rate, Pfuncn({100.rand}, inf),\n\\freq, Pfuncn({10000.rand}, inf),\n\\index, Pfuncn({20000.rand}, inf),\n\\tRate, Pfuncn({1000.rand}, inf),\n\\fRate, 5,\n).play;\n)\n```"}, {"role": "assistant", "content": "It is a simple SynthDef I made after having a look at Hasher UGen with a pattern to play it. It creates nice and varied glitch sounds."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nSynthDef(\\madtraffic, {|out, sig, gate=1, freq=440|\n // doneAction: 2 rilascia la synth quando EvnGen ha finito\n sig = (Blip.ar(freq)*0.7+Blip.ar(freq/2+Rand(1,12))*0.7)\n*EnvGen.kr(Env.asr(0.1, 0.3, 0.3), gate, doneAction:2);\n sig = RLPF.ar(sig,SinOsc.kr(0.3, 0, 200, 1500), 0.1);\n sig = FreeVerb.ar(sig, 0.5, 0.5, 0.5);\n Out.ar(out, sig);\n\n}).add;\n);\n\n(\nPbind(\n \\instrument, \\madtraffic,\n \\freq, Pseq([137, 373, Prand([237, 473, 713],1)], inf),\n \\legato, Pseq([1.7, 0.3], inf),\n \\dur, 0.3,\n \\out, Pseq([1, 0], inf)\n).play;\n)\n```"}, {"role": "assistant", "content": "\"It's the lack of eye contact that makes us more idiots, to the point that convertible riders give less to escalation. Closed in the car, explain the psychologists, we regress to childhood and react by shouting, or with that surrogate of the shock that is the horn.\"\r\n\r\n\r\n\r\nhttp://bz-buzz.blogspot.com/2018/09/mad-traffic.html\r\n\r\nhttp://bzakirasantjago.blogspot.it/."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var a, freq, trig;\n a = Dxrand([1, 3, 2, 7, 8], inf);\n trig = Impulse.kr(MouseX.kr(1, 400, 1));\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var a, freq, trig;\n a = Dxrand([1, 3, 2, 7, 8], inf);\n trig = Impulse.kr(MouseX.kr(1, 400, 1));\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns.waitForBoot {\n // Open a plotTree window with a refresh rate of 2 seconds:\n s.plotTree(2);\n\n // Define and play a repeating pattern that generates a new synth every 0.5 seconds:\n x = Pn((dur: 0.5, midinote: 69, amp: 0.1)).play;\n\n /*\n Since the plotTree window refreshes every 2 seconds,\n displaying only the most recent node,\n the first node will appear after a 2-second delay (once four notes have played),\n meaning only every fourth synth node is visible.\n */\n\n 5.wait; // wait for 5 seconds.\n\n x.stop; // stop the playback of the pattern\n\n 2.wait; // wait for 2 seconds.\n\n s.nodeTreeV\n// …\n```"}, {"role": "assistant", "content": "Open a plotTree window with a refresh rate of 2 seconds: Define and play a repeating pattern that generates a new synth every 0.5 seconds: (Server: Object representing a server application)"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n//a SynthDef\n(\nSynthDef(\"plucking\", {arg amp = 0.1, freq = 220, decay = 5, coef = 0.1;\n\nvar env, snd;\nenv = EnvGen.kr(Env.linen(0, decay, 0.5), doneAction: 2);\nsnd = Pluck.ar(\n in: Saw.ar(freq, 0.5*amp),\n trig: Impulse.kr(0),\n\n maxdelaytime: 0.1,\n delaytime: freq.reciprocal,\n decaytime: decay,\n coef: coef);\n Out.ar(0, [snd, snd]);\n}).add;\n);\n\n//Bugger soundtrack\n(\nPbind(\n \\instrument, \"plucking\",\n \\scale, Scale.lydian,\n \\degree, Prand([[-2.5, -4.001], [-7.002, -5], [-1, -3.003], [1.005, 0.51]], inf),\n \\amp, Pseq([0.1, 0.2, 0.3, 0.4, 0.5, 0.5, 0.5, 0.5], inf),\n \\decay, Pseq([0.25,1, 0.5, 0.125], inf),\n \\coef, Pseq([0.7, 0.8, 0.9], inf),\n \\dur, Pseq([0.01, 0.0025, 0.2475, 0.24, 0.5], inf)\n).play;\n)\n```"}, {"role": "assistant", "content": "This will be the sound track for Bugger, a Frogger clone that started as a school assignment.\r\nSimple SynthDef using Pluck, and a few Pbinds. \r\n\r\nBugger can be found on [GitLab](https://gitlab.com/Modanung/Bugger)."}]} -{"conversations": [{"role": "user", "content": "What does `DPW4Saw.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Sawtooth via 4th order differerentiated polynomial waveform Arguments: freq."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for little study on piano improvisation."}, {"role": "assistant", "content": "```supercollider\n/* Piano Gestures: A Little Study by mimetik\n\n This is a little study on piano improvisation, in particular on \"gestures\", by which I mean here little improvised phrasings.\n\n*/\n\nMIDIClient.init;\n\n/*\nChoose from the list of devices your internal MIDI router, so to send the notes to piano intrument in your favourite DAW\n*/\n\n~mOut = MIDIOut.new(3);\n\n//Set the scale to be Cmajor\n~scale=[0,2,4,5,7,9,11];\n\n//Define pattern proxies which will be modified by the task t below\n\na=PatternProxy(Pxrand([3,3,3,1,3,3],inf));\nb=PatternProxy(Pseq([1/2],inf));\nr=PatternProxy(Pseq([12],inf));\nn=Prand([4,8,16],inf).asStream;\n\nt=Task({\nPdef(\\x,Pbind(\\type,\\midi,\\chan,0,\n \\midiout,~mOut,\n \\scale,~scale,\n \\root,-12,\n \\degree,Pxrand([[0,3,5],[3,5,7],[4,6,8],[5,7,11]],inf),\n \\legato,1,\n \\amp,[{rrand(0.6,0.8)},{rrand(0.5,0.6)},{rrand(0.5,0.6)}]*0.7, \\dur,Prand([Pseq([1,1,1,1],1),Pseq([1,1,2],1),Pseq([1,2,1],1)],inf))).play(quant:1);\n\nPdef(\\y,Pbind(\\type,\\midi,\\chan,0,\n \\midiout,~mOut,\n \\scale,~scale,\n \\root,r,\n \\degree,a,\n \\legato,1,\n \\amp,{rrand(0.5,0.6)},\n\\dur,b)).play(quant:1);\n\n10.wait;\n\nt=Task({\n inf.do({\n if (0.7.coin,{ \n c=[[3,0,7,1,9,11,0,4],[[3,7],0,7,Rest,9,[0,11],0,4]].choose.scramble;\n r.source=Pseq([[12,24].wchoose([0.7,0.3])],inf);\n d=n.next;\n a.source=Pseq([Pxrand(c,d),Pxrand([3,3,3,1,3,3],inf)]);\n b.source=Pseq([Pseq([1/8],d),Pseq([1/2],inf)]);\n });\n rrand(3,4).wait;})}).play(quant:1);\n };\n).play(quant:1);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for gabber kick (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\gabberkick, {\n var snd;\n snd = SinOsc.ar(Env([1000, 69, 60], [0.015, 0.1], \\exp).ar * [-0.1, 0, 0.1].midiratio);\n snd = Mix(snd);\n snd = (snd * 10).tanh;\n snd = (snd * 5.1).atan;\n snd = BPeakEQ.ar(snd, XLine.kr(2000, 100, 0.3), 2.0, 8);\n snd = snd + DelayC.ar(snd, 0.01, SinOsc.ar(4).range(0.0, 0.001));\n snd = RLPF.ar(snd, 8000, 0.7);\n snd = snd * Env([0, 1, 0.7, 0.7, 0], [0.001, 0.01, 0.3, 0.02]).ar(2);\n snd = (snd * 0.6).clip(-1, 1);\n Out.ar(\\out.kr(0), Pan2.ar(snd, \\pan.kr(0), \\amp.kr(0.1)));\n}).add;\n);\n\nSynth(\\gabberkick, [amp: 0.6])\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nt = TempoClock(120/60).permanent_(true);\n\n(\n~change_clock_tempo = {|clock, tempo, beats=1|\n beats.do {|beat|\n var stepTempo = beat.linexp(0, beats-1, clock.tempo, tempo);\n clock.schedAbs(clock.nextBar + beat, {\n \"New Tempo: \".post; (stepTempo*60).post; \" BPM\".postln;\n clock.tempo_(stepTempo);\n });\n };\n nil;\n};\nPbindef(\\n,\n \\octave, 4,\n \\dur, 0.5,\n \\degree, Pseq((0..7), inf)\n).play(t, quant: 4);\n);\n\n~change_clock_tempo.value(t, 200/60, 16);\n~change_clock_tempo.value(t, 50/60, 8);\nt.tempo*60\n```"}, {"role": "assistant", "content": "This gradually changes the tempo of a TempoClock, each beat of a specified number of beats, and starting at the next bar.\r\n\r\n\r\nPersonally, I was not able to heavily distinguish between `.linlin` and `.linexp` for reasonable musical tempos.\r\n\r\n\r\nThere may be a mathematically smoother way of handling this at the control rate.\r\n\r\n\r\nThis function does not gracefully handle multiple simultaneous invoca."}]} -{"conversations": [{"role": "user", "content": "What is `Pbindf` in SuperCollider?"}, {"role": "assistant", "content": "Pbindf — bind several value patterns to one existing event stream by binding keys to values Pbindf adds several value streams into one existing event stream. Each value stream is assigned to one or more keys in the resulting event stream, overriding any values from the input stream. Category: Streams-Patterns-Events > Patterns > Composition."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n/// Installing sc3-plugins quarks\n\n// If you installed the sc3-plugins to a user location:\n~sc3plugs = Quarks(\nreposPath: \"https://sc3-plugins.svn.sourceforge.net/svnroot/sc3-plugins/build\",\nlocalPath: Platform.userAppSupportDir +/+ \"SC3plugins\"\n);\n\n// If the sc3-plugins were installed to a system wide location:\n~sc3plugs = Quarks(\nreposPath: \"https://sc3-plugins.svn.sourceforge.net/svnroot/sc3-plugins/build\",\nlocalPath: Platform.systemAppSupportDir +/+ \"SC3plugins\"\n);\n\n\n// Get a GUI of the available Quarks and install the ones you want to try out:\n~sc3plugs.gui;\n\n\n// For more general Help on Quarks, see the Quarks helpfile\n```"}, {"role": "assistant", "content": "Installing sc3-plugins quarks If you installed the sc3-plugins to a user location:."}]} -{"conversations": [{"role": "user", "content": "Explain `AudioPatchIn` in SuperCollider briefly."}, {"role": "assistant", "content": "AudioPatchIn — manages a Player's input when connecting to other Players Category: Libraries > crucial > internals."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for smooth arpeggio, updated envelope (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\bass, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.perc(0.2), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LastValue`."}, {"role": "assistant", "content": "```supercollider\nd = { |freq = 440| SinOsc.ar(LastValue.ar(freq, 20), 0, 0.2) }.play;\n\nd.set(\\freq, 400);\nd.set(\\freq, 200);\nd.set(\\freq, 670);\nd.set(\\freq, 680);\nd.set(\\freq, 695);\nd.free;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\n{\n// Move the mouse. This varies from sinewave (left) to almost-square (right)\nvar sig = (SinOsc.ar(MouseY.kr(100, 1000, 1)) * MouseX.kr(1,10)).clip2(1);\nvar val = Crest.kr(sig, 440).poll;\n(sig * 0.1).dup\n}.play\n);\n\n(\n// Or as a plot (which shows the odd results you get over the first few samples):\n{\nvar sig = (SinOsc.ar(440, pi.rand) * XLine.kr(1,10, 5)).clip2(1);\nvar val = Crest.kr(sig, 440).poll;\nOut.ar(0, sig * 0.1.dup);\nK2A\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\n{\n// Move the mouse. This varies from sinewave (left) to almost-square (right)\nvar sig = (SinOsc.ar(MouseY.kr(100, 1000, 1)) * MouseX.kr(1,10)).clip2(1);\nvar val = Crest.kr(sig, 440).poll;\n(sig * 0.1).dup\n}.play\n);\n\n(\n// Or as a plot (which shows the odd results you get over the first few samples):\n{\nvar sig = (SinOsc.ar(440, pi.rand) * XLine.kr(1,10, 5)).clip2(1);\nvar val = Crest.kr(sig, 440).poll;\nOut.ar(0, sig * 0.1.dup);\nK2A.ar(val);\n}.plot(5, minval:1, maxval: 4)\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Pmulpre`."}, {"role": "assistant", "content": "```supercollider\n(\nvar a, b;\na = Pmulpre(\\freq, 801, Pset(\\freq, 500, Pbind(\\dur, 0.2)));\nx = a.asStream;\n9.do({ x.next(Event.default).postln });\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// mono\n\n(\ny = {\n var i = LFDNoise3.ar(7).range(0.2, 0.9);\n GFIS.ar({ |x| sin(3.2 * x) }, i, 10) * 0.1 ! 2\n}.play\n);\n\ny.release\n\n\n// stereo init is propagated to a stereo signal\n\n(\ny = {\n var i = LFDNoise3.ar(7).range(0.2, 0.9) * [1, 1.01];\n GFIS.ar({ |x| sin(3.2 * x) }, i, 10) * 0.1\n}.play\n;\n\ny.release\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// mono\n\n(\ny = {\n var i = LFDNoise3.ar(7).range(0.2, 0.9);\n GFIS.ar({ |x| sin(3.2 * x) }, i, 10) * 0.1 ! 2\n}.play\n);\n\ny.release\n\n\n// stereo init is propagated to a stereo signal\n\n(\ny = {\n var i = LFDNoise3.ar(7).range(0.2, 0.9) * [1, 1.01];\n GFIS.ar({ |x| sin(3.2 * x) }, i, 10) * 0.1\n}.play\n);\n\ny.release\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Lorenz2DL` in SuperCollider?"}, {"role": "assistant", "content": "Lorenz2DL — lorenz 2D chaotic generator `x' = s(y - x)` Category: UGens > Generators > Stochastic."}]} -{"conversations": [{"role": "user", "content": "What does `MxCable.setInitial` do?"}, {"role": "assistant", "content": "Some cable strategies need to set an initial value on the target inlet at the time that the changes are being enacted. For instance when a cable is connected it does not immediately set the value on the target inlet until the Mx calls .update and the first the units are spawned and then the cables are spawned. setInitial allows the cable to set a value for the unit which the unit needs when it spawns, because the unit must spawn before the Returns: this"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\nz = Bus.control(s, 16);\nz.setn({ |i| (i * 5).nthPrime } ! 16 * 5 + 100);\na = BusPlug.for(z);\n{ Splay.ar(SinOsc.ar(a.kr(3, MouseX.kr(0, 25))) * 0.1 }.play; // selectively play 3 channel of the 16, modulate offset\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\nz = Bus.control(s, 16);\nz.setn({ |i| (i * 5).nthPrime } ! 16 * 5 + 100);\na = BusPlug.for(z);\n{ Splay.ar(SinOsc.ar(a.kr(3, MouseX.kr(0, 25)))) * 0.1 }.play; // selectively play 3 channel of the 16, modulate offset\n```"}]} -{"conversations": [{"role": "user", "content": "When should I use a Pattern instead of writing Synth code by hand?"}, {"role": "assistant", "content": "Use a Pattern when what you want to express is a sequence over time — notes, durations, amplitudes, parameters — rather than a signal. A Pbind describes events, and `.play` turns each event into a Synth (by default of the \\default instrument, or of \\instrument if you name one). Hand-written Synth code is for the sound itself; Patterns are for what plays when. The two compose: a SynthDef named \\bell is triggered from `Pbind(\\instrument, \\bell, ...)`."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Creaking door or roulette wheel?."}, {"role": "assistant", "content": "```supercollider\n(\n\n{\n\nvar output, basePitch = 387, macroPitch, macroPitchAmt = 400;\nvar modOsc, modAmt = 1.3, amp = 0.8;\nvar creakRate, creakTrig, creakEnvGen, noise, combs, oscFreq;\n\nnoise = LFNoise1.ar(LFNoise0.kr(4.8).lag(0.4).range(3646, 7777), 0.6);\n\ncreakRate = EnvGen.kr(\n Env(\n [40, 25, 15, 2],\n [0.9, 0.6, 1.0],\n -4\n ),\n doneAction: 2\n\n);\ncreakTrig = Impulse.kr(creakRate);\n\ncreakEnvGen = EnvGen.kr(\n Env(\n [0.0, 1.0, 0.0],\n [0.02, 0.1],\n [5, -8]\n ),\n creakTrig,\n timeScale: SinOsc.kr(1.5).range(0.12, 0.26) * Line.kr(0.5, 2.3, 2)\n\n);\n\nmacroPitch = EnvGen.kr(\n Env(\n [0.0, 4, 0.1, 0.3, 0.4, 0.7, 0.9],\n [0.2, 0.2, 0.4, 0.3, 0.48, 0.59],\n [2, 2, -4, -3, -2, -4]\n )\n\n);\nmodOsc = SinOsc.ar( (basePitch + (macroPitch * macroPitchAmt)) * 0.17);\nmodOsc = SinOsc.ar( (basePitch + (macroPitch * macroPitchAmt)) * 0.232, modOsc * 0.3);\n\noscFreq = basePitch + (macroPitch * macroPitchAmt);\noscFreq = oscFreq * (1 + (creakEnvGen * 2));\noutput = SinOsc.ar(oscFreq, modOsc * modAmt, 1);\noutput = output * SinOsc.ar(SinOsc.kr(1.6).range(1220, 1355));\noutput = output + noise;\noutput = output.clip(-0.5, 0.5) * creakEnvGen * amp * TRand.kr(0.8, 1.0, creakTrig);\n\ncombs = Mix([CombC.ar(output, 0.2, 0.0084, 0.12), CombC.ar(output, 0.2, 0.00181, 0.03)]);\noutput = output + (combs * 0.2);\noutput ! 2\n}.play\n\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `UChain.<|` do? What arguments does it take?"}, {"role": "assistant", "content": "Returns new UChain containing all the units of this UChain plus the unit passed in the Arguments: unit. Returns: UChain"}]} -{"conversations": [{"role": "user", "content": "What is `MIDIFuncChanMessageMatcher` in SuperCollider?"}, {"role": "assistant", "content": "MIDIFuncChanMessageMatcher — Matches incoming MIDI messages to responder funcs based on message channel This is used by MIDIMessageDispatcher to match incoming MIDI messages to instances of MIDIFunc or MIDIdef using MIDI channel. This class is private, and generally users should not need to address instances directly. Category: External Control > MIDI > Matchers."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\AcnSn3dIn;\n~description = \"A live ambisonic input (ACN_SN3D)\";\n~channelLayout = \\ambi;\n\n~function = { |order=1, t_trig = 0, bus = 0|\n var env = EnvGen.kr(Env([0,1], [1]), t_trig);\n var chans = Array.series(\n size: (order + 1).pow(2).asInteger,\n start: bus,\n step: 1\n );\n var input = SoundIn.ar(chans) * env;\n HOAConverterAcnSn3d2AcnN3d.ar(order, input);\n};\n```"}, {"role": "assistant", "content": "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see ."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// default initial params\n{ LatoocarfianN.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// default initial params\n{ LatoocarfianN.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Migration from the old SourceForge wiki."}, {"role": "assistant", "content": "```supercollider\n// Sing whatever pitch you like into the microphone, but have the output conform to the key you press on your connected MIDI keyboard, like a very low-rent Autotune.\n// by nonprivate April 2009\n// best used with headphones\n// execute one by one...\n\ns = Server.local.boot;\nb = 200; // no. of control bus to use for pitch control\n(\n SynthDef(\"straightenUp\",\n { |baseFreq = 100|\n \n var in, freq, hasFreq, out;\n in = Mix.new(SoundIn.ar([0,1]));\n # freq, hasFreq = Pitch.kr(in, ampThreshold: 0.02, median: 7);\n out = PitchShift.ar(in, 0.08, (baseFreq / freq), 0.0, 0.0);\n Out.ar(0,[out, out])\n }\n ).send(s);\n);\n\ns.sendMsg(\"/s_new\", \"straightenUp\", n = s.nextNodeID, 1, 0);\n\ns.sendMsg(\"/n_map\", n, \"baseFreq\", b);\n\n(\n c = NoteOnResponder(\n { |src,chan,note,vel|\n \n s.sendMsg(\"/c_set\", b, note.midicps);\n \n },\n nil, // any source\n nil, // any channel\n nil, // any note\n nil // any vel\n );\n \n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `Pseries` in SuperCollider briefly."}, {"role": "assistant", "content": "Pseries — arithmetic series pattern Returns a stream that behaves like an arithmetic series. Category: Streams-Patterns-Events > Patterns > List."}]} -{"conversations": [{"role": "user", "content": "What does `SimpleNumber.linexp` do? What arguments does it take?"}, {"role": "assistant", "content": "map the receiver from an assumed linear input range (inMin..inMax) to an exponential output range (outMin..outMax). The output range must not include zero. If the input exceeds the input range, the following behaviours are specified by the clip Arguments: inMin — assumed input minimum; inMax — assumed input maximum; outMin — output minimum; outMax — output maximum; clip — nil (don't clip) \\max (clip ceiling) \\min (clip floor) \\minmax (clip both - this is default).."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for micro-beat repeat, based on delay."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\stutter,{\n arg in=0, out=0;\n var sig, delayTime, increment, trigger;\n var reset=\\reset.kr(0);\n var delayPitch=\\pitch.kr(12);\n var offsetms=\\offsetms.kr(0)/1000;\n var strobe=\\strobe.kr(1);\n var on=\\onoff.kr(0);\n var envGen, sustainTime;\n var atkTime=0.002, relTime=0.002;\n\n reset=reset*on;\n // Convert pitch to delay time in seconds\n delayTime = delayPitch.midicps.reciprocal;\n\n // Trigger for incrementing delay time\n trigger = Impulse.ar(delayTime.reciprocal);\n\n // Calculate sustain time to ensure envelope stays high for the chunk duration minus attack and release\n sustainTime = delayTime - (atkTime + relTime);\n\n // Ensure sustainTime is not negative\n sustainTime = max(sustainTime, 0)*strobe;\n\n // Increment delay time\n increment = Dseries(0, delayTime, inf)*on;\n increment = Demand.ar(trigger, reset, increment);\n\n // Generate an envelope to soften clicks\n envGen = EnvGen.ar(Env([0, 1, 1, 0], [atkTime, sustainTime, relTime], 'lin'), trigger);\n\n\n // Get input signal\n sig = In.ar(in, 1); // Assuming stereo input\n\n // Apply delay\n sig = DelayC.ar(sig, 24, increment+offsetms);\n\n // Apply envGen\n sig=sig*envGen;\n\n // Output\n Out.ar(out, sig);\n}).add();\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `SmoothFoldQ` in SuperCollider?"}, {"role": "assistant", "content": "SmoothFoldQ — wave folding pseudo ugen using parabolic segments Wave folding using SmoothClipQ. Values outside the range lo-hi are folded back, if foldRange > 0. A larger foldRange means less folding whereas a smaller foldRange causes more folding. The spectral result depends on the source wave form also but in general a smaller foldRange causes more energy in the higher spectrum whereas near foldRange == 0 the higher part of the spectrum again decreases. Note Category: Libraries > miSCellaneous > WaveFolding."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// modulate fundamental frequency, formant freq stays constant\n{ Formant.ar(XLine.kr(400, 1000, 8), 2000, 800, 0.125) }.play\n\n// modulate formant frequency, fundamental freq stays constant\n{ Formant.ar(200, XLine.kr(400, 4000, 8), 200, 0.125) }.play\n\n// modulate width frequency, other freqs stay constant\n{ Formant.ar(400, 2000, XLine.kr(800, 8000, 8), 0.125) }.play\n```"}, {"role": "assistant", "content": "modulate fundamental frequency, formant freq stays constant modulate formant frequency, fundamental freq stays constant (Formant: Formant oscillator)"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n \n// definition for future reference in arbitrary Environments\n\n(\np = Pbind(\n \\midinote, PLnaryop('+', \\src, [\\dev]),\n \\dur, 0.1\n);\n);\n\n\n// define Environment and play\n\n(\ne = (src: PLseq([61,62]), dev: Pbrown(-5, 5, 0.2) );\n\ne.use { x = p.play };\n);\n\n\n// replace\n\ne.dev = PLseq((0, 0.5..7));\n\ne.dev = Pbrown(-5, 5, 0.2);\n\ne.src = PLseq([61,64,65];\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n \n// definition for future reference in arbitrary Environments\n\n(\np = Pbind(\n \\midinote, PLnaryop('+', \\src, [\\dev]),\n \\dur, 0.1\n);\n);\n\n\n// define Environment and play\n\n(\ne = (src: PLseq([61,62]), dev: Pbrown(-5, 5, 0.2) );\n\ne.use { x = p.play };\n);\n\n\n// replace\n\ne.dev = PLseq((0, 0.5..7));\n\ne.dev = Pbrown(-5, 5, 0.2);\n\ne.src = PLseq([61,64,65]);\n\n\nx.stop;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// sound example\n(\nvar a = { 19.rand };\nvar b = { [5, 8, 9].choose };\nvar c = a + b;\nfork {\n 15.do {\n (instrument: \\default, note: [c.value, a.value]).play;\n 0.3.wait;\n }\n}\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// sound example\n(\nvar a = { 19.rand };\nvar b = { [5, 8, 9].choose };\nvar c = a + b;\nfork {\n 15.do {\n (instrument: \\default, note: [c.value, a.value]).play;\n 0.3.wait;\n }\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Supernova, Groups, Threads, Ndef?"}, {"role": "assistant", "content": "SuperCollider forum — Supernova, Groups, Threads, Ndef?\n\nAbout Ndef:\n\nAFAIK you can manually move a NodeProxy’s group into another group:\n\n```supercollider\n~pargroup = ParGroup(s);\n\nNdef(\\a, { Silent.ar(1) });\n\nNdef(\\a).group.moveToHead(~pargroup);\n```\n\nBut...\n\nNodeProxies use InFeedback.\n\nI was a little suspicious about this for parallel processing. As I recalled, InFeedback’s result depends on the order of execution:\n\n-\nIf the source node for the bus finished processing before the server reaches InFeedback, then InFeedback will output the block of audio being processed now.\n\n-\nIf the source node comes after the node containing InFeedback, then it will output the previous block of audio.\n\nIn both cases, these are the most recently available audio blocks. But, if the order of evaluation is not consistent, then the output may not be consistent.\n\nLet’s test that:\n\n```supercollider\nb = Bus.audio(s, 1);\n\na = { SinOsc.ar(200, 0, 0.1) }.play(outbus: b);\n\nc = { InFeedback.ar(b, 1).dup }.play(target: a, addAction: \\addAfter);\n\n(\nfork {\n var order = Pseq([\\moveBefore, \\moveAfter], inf).asStream;\n loop {\n c.perform(order.next, a);\n 1.0.wait;\n }\n}\n)\n```\n\nOops.\n\nThis means you can’t randomly throw Ndefs into ParGroups. If one Ndef reads a signal from another, then you have to make sure that the target Ndef comes later in a serial (regular) Group. (Correctness of the result should be more important than “optimal” usage of multiple cores.)\n\nIf you don’t, and if supernova happens to put the source and target Ndefs onto separate cores at roughly the same time, then the target might evaluate InFeedback either before or after the source finishes, and there’s no guarantee of this being consistent. So you might get clicks.\n\nhjh"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ BPF.ar(Saw.ar(200, 0.5), FSinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3600, 4000), 0.3) }.play;\n\n{ BPF.ar(Saw.ar(200, 0.5), MouseX.kr(100, 10000, 1), 0.3) }.play;\n\n // BPF on control signals:\n(\n{ var vib = BPF.kr(PinkNoise.kr, MouseX.kr(1, 100, 1), 0.3) * 10;\n SinOsc.ar(vib * 200 + 600) * 0.2 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ BPF.ar(Saw.ar(200, 0.5), FSinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3600, 4000), 0.3) }.play;\n\n{ BPF.ar(Saw.ar(200, 0.5), MouseX.kr(100, 10000, 1), 0.3) }.play;\n\n // BPF on control signals:\n(\n{ var vib = BPF.kr(PinkNoise.kr, MouseX.kr(1, 100, 1), 0.3) * 10;\n SinOsc.ar(vib * 200 + 600) * 0.2 }.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SendTrig`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n(\nSynthDef(\"help-SendTrig\", {\n SendTrig.kr(Dust.kr(1.0), 0, 0.9);\n}).add;\n\n// register to receive this message\no = OSCFunc({ |msg, time|\n [time, msg].postln;\n}, '/tr', s.addr);\n);\n\nSynth(\"help-SendTrig\");\n\no.free;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var a = SinOsc.ar(1).round(0.1);\n var b = SinOsc.ar(1.2).round(0.1);\n BinaryOpUGen('==', a, b) * 0.1\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var a = SinOsc.ar(1).round(0.1);\n var b = SinOsc.ar(1.2).round(0.1);\n BinaryOpUGen('==', a, b) * 0.1\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Prewrite` in SuperCollider?"}, {"role": "assistant", "content": "Prewrite — L-system pattern for selfsimilar structures Lindenmayer system pattern for selfsimilar structures. Its dictionary (or event) maps one element to an array of child elements. The algorithm replaces iteratively (levels deep) elements by arrays of elements starting with the values in the pattern. Category: Streams-Patterns-Events > Patterns > List > Indexing."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Midterm Q2 (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"sawSynth\",{arg freq, amp;\n var env, snd;\n\n env = Env.perc(\n attackTime:0.1,\n releaseTime:2,\n level:amp).kr(doneAction: 2);\n snd = Saw.ar(\n freq:freq*[0.99, 1.0, 1.001, 1.008],\n mul: env);\n snd = LPF.ar(in: snd,freq:2000);\n snd = Splay.ar(snd);\n Out.ar(0,snd);\n\n}).add;\n);\n\n(\nPbind(\n \\instrument, \"sawSynth\",\n \\freq, Pwhite(300, 700, inf),\n \\amp, Pwhite(0.15, 0.2)\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `EventSource.reactimate` do?"}, {"role": "assistant", "content": "Implementation of Functional Reactive Programming. Returns: nil"}]} -{"conversations": [{"role": "user", "content": "Explain `AbstractSInstrument` in SuperCollider briefly."}, {"role": "assistant", "content": "AbstractSInstrument — an abstract class for all sInstruments Helper class for instruments. Category: SInstruments."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Polyrhythmic and dynamic FM drone."}, {"role": "assistant", "content": "```supercollider\n// https://recarteblog.wordpress.com/\n//droneFM01\n\n// 1. Añadir al servidor\n(\nSynthDef(\\droneFM, {\n arg f1Freq=0.1, f2Freq=1.1, f3Freq=2.2, nFreq=440, m1Ratio=1, m2Ratio=2, m3Ratio=3,\n amp=0.1, dur=55, ampM=0.84 , pan=0;\n var sig, car1, mod1, car2, mod2, car3, mod3, env, index;\n index = LFNoise1.kr(0.2).range(2, 12);\n env = EnvGen.kr(Env.new([0, 0.70, 0.70, 0], [dur*0.333, dur*0.333, dur*0.333]), doneAction:2);\n mod1 = SinOsc.ar([nFreq * m1Ratio, nFreq+0.7 * m1Ratio], mul:nFreq * m1Ratio * index) * ampM;\n car1 = SinOsc.ar(f1Freq + mod1);\n mod2 = SinOsc.ar([nFreq * m2Ratio, nFreq+1.4 * m2Ratio], mul:nFreq * m2Ratio * index) * ampM;\n car2 = SinOsc.ar(f2Freq + mod2);\n mod3 = SinOsc.ar([nFreq * m3Ratio, nFreq+0.35 * m3Ratio], mul:nFreq * m3Ratio * index) * ampM;\n car3 = SinOsc.ar(f3Freq + mod3) * 0.4;\n sig = car1 + car2 + car3 * env * amp;\n sig = Pan2.ar(sig, pan);\n Out.ar(0, sig);\n}).add;\n);\n\n// 2. Ejecutar los Synths\n(\nSynth(\\droneFM, [\\nFreq, 50.midicps]);\nSynth(\\droneFM, [\\nFreq, 57.midicps]);\nSynth(\\droneFM, [\\nFreq, 41.midicps]);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Do is not ¨returning¨ array (campanology)?"}, {"role": "assistant", "content": "SuperCollider forum — Do is not ̈returning ̈ array (campanology)\n\nYou can remove the need for all mutable variables by computing the indexes to swap first - these are stored in indexesEven and indexesOdd.\n\nThen an array of functions is made (swappers)...i.e.[indexesEven, indexesOdd, indexesEven....]\n\nFinally, .inject is used to chain these together, taking the previous result as the input to the next and building an array.\n\n```supercollider\n(\n~swap_sort_steps = {\n |parts|\n var swapConsequtiveIndexes = {|from, to|\n (from..to).clump(2).collect{|p| p.reverse }.flat\n };\n var indexesEven = swapConsequtiveIndexes.(0, parts - 1);\n var indexesOdd = [0] ++ swapConsequtiveIndexes.(1, parts - 1);\n var swappers = parts.collect{ |n|\n {|toSwap| if(n.even)\n { indexesEven.collect{|i| toSwap[i]} }\n { indexesOdd.collect{|i| toSwap[i]} }\n }\n };\n postf(\"indexesEven : %\\nindexesOdd : %\\n\", indexesEven, indexesOdd);\n swappers.inject( [(0..parts-1)], {\n |col, f|\n col ++ [f.(col.last)]\n });\n};\n)\n```\n\nAlso, as I’m sure you know, if anyone else is reading who doesn’t know what this is... its a swap sort algorithm."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\sub;\n~description = \"Dedicate a channel to subwoofer signal. Ideally use with monoSpat spatializer\";\n~channelLayout = \\mono;\n~function = { |in = 0, sub_gainDB = -99, sub_lpHz = 200|\n LPF.ar(in, sub_lpHz.clip(5.0, 18000)) * sub_gainDB.dbamp\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "What does `Rational.squared` do?"}, {"role": "assistant", "content": "Power of two `Rational(5,7).squared // -> 25 %/"}]} -{"conversations": [{"role": "user", "content": "Saving \"Presets\"?"}, {"role": "assistant", "content": "SuperCollider forum — Saving \"Presets\"?\n\nIf you don’t care too much about it being human readable, just use writeArchive and readArchive:\n\n```supercollider\na = Array.fill(400, {rrand(0,2200)});\n\na.writeArchive(\"/Users/spluta1/Documents/SC/test\");\n\nb = Object.readArchive(\"/Users/spluta1/Documents/SC/test\");\n\nb.postln;\n```\n\nSam"}]} -{"conversations": [{"role": "user", "content": "Explain `IsNotIn` in SuperCollider briefly."}, {"role": "assistant", "content": "IsNotIn — given a list, validates that the test object is not in the list answers whether an item is not included in a collection Category: Libraries > crucial > Constraints."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n Ndef(\\x, {\n var output;\n var delayTime;\n var delayMax = 0.2;\n var delayAdd = 0.1;\n var pulseFreq = 0.5;\n var proxyMul = 2;\n var pulseMin = 40;\n var pulseMax = 130;\n var numOfEchos = 2;\n\n var mainPulse = LFPulse.ar(pulseFreq, 0, 0.5).range(pulseMin, pulseMax);\n var proxy = Ndef(\\x).ar * proxyMul;\n var ampModFreq = SinOsc.ar(0.01, 0).range(0.3, 30);\n var ampMod = LFNoise1.ar(ampModFreq, 6);\n output = SinOsc.ar(mainPulse + proxy, 0, ampMod).tanh;\n numOfEchos.do{\n delayTime = {delayMax.rand + delayAdd}!2;\n output = AllpassL.ar(output, 0.1, delayTime, 5);\n };\n output.tanh;\n }).play\n)\n```"}, {"role": "assistant", "content": "Something I put together a while back by forking Dark Sea Horns."}]} -{"conversations": [{"role": "user", "content": "Explain `IBVAfile` in SuperCollider briefly."}, {"role": "assistant", "content": "IBVAfile — helper class some methods for reading and converting files recorded with IBVArecorder. Category: External Control."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for simple smooth arp."}, {"role": "assistant", "content": "```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\smooth, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.linen(0.05, sustain, 0.1), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nx = List[1, 2, 3] //-> [1, 2, 3]\n\n// Retrieve the value at index 1:\nx.at(1) //-> 2\n// Equivalent shorthand syntax:\nx[1] //-> 2\n\n// An index can also be retrieved from an array (returns not a list, but an array):\ny = [0, 0, 2, 2, 1] //-> [0, 0, 2, 2, 1]\nx[y]; //-> [1, 1, 3, 3, 2]\n\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n pitches.size.do{ |i|\n {\n var freq = pitches[i].midicps;\n var env = Env.perc\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nx = List[1, 2, 3] //-> [1, 2, 3]\n\n// Retrieve the value at index 1:\nx.at(1) //-> 2\n// Equivalent shorthand syntax:\nx[1] //-> 2\n\n// An index can also be retrieved from an array (returns not a list, but an array):\ny = [0, 0, 2, 2, 1] //-> [0, 0, 2, 2, 1]\nx[y]; //-> [1, 1, 3, 3, 2]\n\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n pitches.size.do{ |i|\n {\n var freq = pitches[i].midicps;\n var env = Env.perc.ar(Done.freeSelf);\n SinOsc.ar(freq) * 0.1 * env\n }.play;\n 0.2.wait\n }\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Node`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\nx = Synth(\"default\");\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Latoocarfian2DN.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "latoocarfian 2D chaotic generator Arguments: minfreq, maxfreq — iteration frequency in Hertz; a, b, c, d — equation variables; x0 — initial value of x; y0 — initial value of y."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for minor scale filtered pulsewave demands?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n arg amp=0.1;\n var a, trig, basefreq, snd, cutoffmod, rqmod;\n \n a = Dseq([0, 2, 3, 5, 7, 8, 10, 12], inf);\n trig = Impulse.kr(4);\n basefreq = Demand.kr(trig, 0, a) + 38;\n basefreq = basefreq.midicps;\n cutoffmod = LFNoise2.ar(0.2).range(100,1500);\n rqmod = LFNoise2.ar(0.2).range(1,0.05);\n\n snd = (Pulse.ar(basefreq + 1 * SinOsc.kr(0.1.rand).range(0.99,1.010)) * amp) \n + (Pulse.ar(basefreq + 2 * SinOsc.kr(0.1.rand).range(0.99,1.010)) * amp) \n + (Pulse.ar(basefreq + 3 * SinOsc.kr(0.1.rand).range(0.99,1.01)) * amp)\n + (Pulse.ar(basefreq + 4 * SinOsc.kr(0.1.rand).range(0.99,1.01)) * amp)\n + (Pulse.ar(basefreq + 5 * SinOsc.kr(0.1.rand).range(0.99,1.01)) * amp)\n + (Pulse.ar(basefreq + 2 * SinOsc.kr(0.1.rand).range(0.99,1.010)) * amp) \n + (Pulse.ar(basefreq + 3 * SinOsc.kr(0.1.rand).range(0.99,1.01)) * amp)\n + (Pulse.ar(basefreq + 4 * SinOsc.kr(0.1.rand).range(0.99,1.01)) * amp)\n + (Pulse.ar(basefreq + 5 * SinOsc.kr(0.1.rand).range(0.99,1.01)) * amp)\n + (Pulse.ar(basefreq + 6 * SinOsc.kr(0.1.rand).range(0.99,1.01)) * amp);\n \n \n snd = LeakDC.ar(snd);\n snd = RLPF.ar(snd, cutoffmod, rqmod);\n snd = Limiter.ar(in: snd, level: 0.8, dur:0.001);\n snd.dup;\n \n}.play)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(//*********PREPARE**********\np.pop;\n//Any code that needs to access your own environment goes here\np = ProxySpace.push(s);\n~fxLoop.play.fadeTime_(5);\n);\n\n(//*********FXLoop**********\n~fxLoop = {\n var in = SoundIn.ar([0,1]);\n // in = in + (in * SinOsc.ar(LFTri.ar([0.1, 0.09]).range(215, 321)));\n in = in + CombC.ar(in, 2, SinOsc.ar(0.015).range(0.5, 1) * [0.13, 0.17], 7);\n in = in + CombC.ar(in, 2, SinOsc.ar(0.01).range(0.5, 1) * [0.1, 0.15], 7);\n in = in + CombC.ar(in, 2, [1.5, 1.0], 7);\n in = in + GVerb.ar(in, 10);\n in = in / 3;\n in;\n}\n)\n```"}, {"role": "assistant", "content": "Audio Sample: https://soundcloud.com/schemawound/supercollider-guitar-fx-test."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LeastChange`."}, {"role": "assistant", "content": "```supercollider\n(\nd = { |amp = 1.0|\n var in1, in2;\n in1 = LFNoise0.ar(800, amp);\n in2 = SinOsc.ar(800);\n LeastChange.ar(in1, in2) * 0.1;\n}.play;\n);\n\nd.set(\\amp, 0.1);\nd.set(\\amp, 0);\nd.set(\\amp, 3);\nd.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Dser`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a, freq, trig;\n a = Dser([1, 3, 2, 7, 8], 8);\n trig = Impulse.kr(MouseX.kr(1, 40, 1));\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SoundFileView.peakColor` do? What arguments does it take?"}, {"role": "assistant", "content": "The color of the peak-to-peak data. This can be overridden by #-waveColors. Defaults to `Color(0.95, Arguments: A `Color`.."}]} -{"conversations": [{"role": "user", "content": "What does `MIDIdef.tick` do?"}, {"role": "assistant", "content": "A convenience method to create a new MIDIdef which responds to MIDI tick messages. See #*new for argument descriptions. The responding `func` will be passed the argument Returns: A new instance of MIDIdef which responds to MIDI tick messages."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n Instr(\\helpTempoPlayer,{\n var t;\n t = TempoPlayer.new; // default global tempo\n Impulse.ar( t.kr )\n });\n\n Patch(\\helpTempoPlayer).play(atTime:1)\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n Instr(\\helpTempoPlayer,{\n var t;\n t = TempoPlayer.new; // default global tempo\n Impulse.ar( t.kr )\n });\n\n Patch(\\helpTempoPlayer).play(atTime:1)\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes BD with ringing BPF."}, {"role": "assistant", "content": "```supercollider\n// BD with ringing BPF\n\n(\nSynthDef.new(\\bazedrum,\n {\n arg out = 0, outlevel=0.5, freq = 50, wet=0.5, q = 220, clicklevel =0, decaytrig = 0.1,\n decayfreq = 0.21, mulfreq =2 , decayamp = 1, dist = 17;\n\n var envtrig, envfreq, envamp, trigger,click, sig;\n\n envtrig = EnvGen.ar(Env.perc(1/10**5, decaytrig, 1, -9));\n envfreq = EnvGen.kr(Env.perc(0.003, decayfreq, mulfreq, -5));\n envamp = EnvGen.kr(Env.perc(0.003, decayamp,1, 2),doneAction:2);\n freq = freq * (1 + envfreq);\n trigger = envtrig*HPF.ar(PinkNoise.ar,40)+(envtrig*2);\n click = HPF.ar(envtrig*WhiteNoise.ar,2000*(1-envtrig),clicklevel);\n sig = BPF.ar(trigger, freq,1/q, sqrt(q)*5);\n sig = sig + click;\n\n sig = LeakDC.ar(sig* envamp,0.996);\n\n sig = Balance2.ar(sig,(sig*dist).tanh/3,(wet*2)-1);\n\n sig = Mix.ar(sig/2)*outlevel;\n\n out = 0;\n Out.ar(out, sig!2);\n }\n ).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Midterm Question 3 (a SuperCollider snippet)?"}, {"role": "assistant", "content": "```supercollider\n// This note is made up of 5 freqs, all integer multiples of 100 Hz.\n{ Mix.ar(SinOsc.ar(freq: 100 * [1, 2, 3, 4, 5], mul: 0.1)) }.play;\n\n\n// This note is made up of 5 freqs that are NOT integer multiples of 100 Hz.\n{ Mix.ar(SinOsc.ar(freq: 100 * [1.01, 1.9, 3, 4.2, 7.4], mul: 0.1)) }.play;\n\n\n(\nSynthDef(\"bell\", {arg freq, amp;\n \n var env, snd, partials, relativeAmps;\n partials = [0.5, 1, 1.19, 1.56, 2, 2.51, 2.66, 3.01, 4.1];\n relativeAmps = [0.25, 1, 0.8, 0.5, 0.9, 0.4, 0.3, 0.6, 0.1];\n \n env = Env.perc(attackTime: 0.01, releaseTime: 5, amp: relativeAmps\n \n ).kr(2);\n \n snd = SinOsc.ar(\n freq: 440 , \n mul: 1\n );\n \n snd = Splay.ar(snd);\n \n Out.ar(0, snd * 0.1 ! 2);\n \n}).add;\n);\n\n\n(\nPbind(\n \\instrument, \"bell\",\n \\degree, Pseq([1,4,7,9], inf),\n \\dur, 0.132, \n \n).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// make some sounds when play is started\n~this.sched(0,{\n ~sound = make sound\n},{\n ~sound.stop\n});\n\n\n// sched at beat 16, visible on the timeline\n~this.sched(16,{\n ~sound = make sound\n},{\n ~sound.stop\n});\n\n\n// sched using a name, moveable on the timeline, duplicatable on the timeline\n~this.sched(\\intro,{\n ~sound = make sound\n},{\n ~sound.stop\n};\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// make some sounds when play is started\n~this.sched(0,{\n ~sound = make sound\n},{\n ~sound.stop\n});\n\n\n// sched at beat 16, visible on the timeline\n~this.sched(16,{\n ~sound = make sound\n},{\n ~sound.stop\n});\n\n\n// sched using a name, moveable on the timeline, duplicatable on the timeline\n~this.sched(\\intro,{\n ~sound = make sound\n},{\n ~sound.stop\n});\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Reminder: This isn't the intended typical usage! It's OK to do this though.\n(\nx = {\n var mags, phases, chain, sig;\n // Create simple undulating magnitudes\n mags = { FSinOsc.kr(ExpRand(0.1, 1)).range(0, 1) }.dup(100);\n // Then give them a \"rolloff\" to make the sound less unpleasant\n mags = mags * ((1, 0.99 .. 0.01).squared);\n // Let's turn the bins on and off at different rates, I'm *sure* that'll sound interesting\n mags = mags * { LFPulse.kr(2 ** IRand(-3, 5)).range(0, 1) }.dup(100);\n // Let's ignore phase for now\n phases = 0.\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Reminder: This isn't the intended typical usage! It's OK to do this though.\n(\nx = {\n var mags, phases, chain, sig;\n // Create simple undulating magnitudes\n mags = { FSinOsc.kr(ExpRand(0.1, 1)).range(0, 1) }.dup(100);\n // Then give them a \"rolloff\" to make the sound less unpleasant\n mags = mags * ((1, 0.99 .. 0.01).squared);\n // Let's turn the bins on and off at different rates, I'm *sure* that'll sound interesting\n mags = mags * { LFPulse.kr(2 ** IRand(-3, 5)).range(0, 1) }.dup(100);\n // Let's ignore phase for now\n phases = 0.dup(100);\n chain = FFTTrigger(LocalBuf(512), 0.5);\n // Now we can do the packing\n chain = PackFFT(chain, 512, [mags, phases].flop.flatten, 0, 99, 1);\n sig = IFFT(chain);\n sig.dup\n}.play\n);\nx.free;\nb.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `ProxyMixer.setNameLeftBorder` do?"}, {"role": "assistant", "content": "sets current left border of nameView, trading size with volume"}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nRoutine({ loop { Synth(\\kick); 0.5.wait } }).play;\n```"}, {"role": "assistant", "content": "It starts a kick every half second, forever.\n\nA Routine is a language-side coroutine: `.play` runs it on the clock, and `wait` suspends it until the next\nbeat without blocking anything else. Inside the `loop`, `Synth(\\kick)` creates a kick and `0.5.wait` waits\nhalf a beat on the current TempoClock — the tempo, not seconds, so changing the clock changes the rate.\nBecause the kick SynthDef frees itself with `doneAction: 2`, the loop can run for hours without leaking\nnodes."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ DynKlank.ar(`[[800, 1071, 1153, 1723], nil, [1, 1, 1, 1]], Impulse.ar(2, 0, 0.1)) }.play;\n\n{ DynKlank.ar(`[[800, 1071, 1353, 1723], nil, [1, 1, 1, 1]], Dust.ar(8, 0.1)) }.play;\n\n{ DynKlank.ar(`[[800, 1071, 1353, 1723], nil, [1, 1, 1, 1]], PinkNoise.ar(0.007)) }.play;\n\n{ DynKlank.ar(`[[200, 671, 1153, 1723], nil, [1, 1, 1, 1]], PinkNoise.ar([0.007, 0.007]) }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ DynKlank.ar(`[[800, 1071, 1153, 1723], nil, [1, 1, 1, 1]], Impulse.ar(2, 0, 0.1)) }.play;\n\n{ DynKlank.ar(`[[800, 1071, 1353, 1723], nil, [1, 1, 1, 1]], Dust.ar(8, 0.1)) }.play;\n\n{ DynKlank.ar(`[[800, 1071, 1353, 1723], nil, [1, 1, 1, 1]], PinkNoise.ar(0.007)) }.play;\n\n{ DynKlank.ar(`[[200, 671, 1153, 1723], nil, [1, 1, 1, 1]], PinkNoise.ar([0.007, 0.007])) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `PXLine` in SuperCollider briefly."}, {"role": "assistant", "content": "PXLine — UGenPatterns quark library Based on XLine Category: Streams-Patterns-Events > UGenPatterns > Generators."}]} -{"conversations": [{"role": "user", "content": "Explain `Volume` in SuperCollider briefly."}, {"role": "assistant", "content": "Volume — Model for the global volume of the synthesis server Internally used by Server. When volume value != 0 dB or muted, a server's volume object will create a synth for controlling the volume on the main outputs for the number of channels given. For shared use of this volume synth with remote clients on this server, volume has its own group with fixed nodeID 2, and the synth (when present) uses the fixed nodeID 3. Category: Server."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Feedback with beats."}, {"role": "assistant", "content": "```supercollider\nNdef(\\a, {\n var src, loc, delay=0.01;\n src = Decay2.ar(Impulse.ar(1/8), LFNoise2.kr(4).range(0.001, 0.0001),\n LFNoise2.kr(4).range(0.005, 0.05))!2\n * Saw.ar(LFNoise2.kr(4).exprange(40, 4000));\n loc = BPF.ar(LocalIn.ar(2) + [src, 0], LFNoise0.kr(1/4).range(100, 1200).lag, 3.2);\n loc = GVerb.ar(loc, 100, 4, mul:0.02, add:loc);\n loc = Compander.ar(loc, loc, 0.9, 1, 0.001);\n loc = (loc * 0.501).tanh;\n loc = Compander.ar(loc, loc, 0.1, 1, 0.1); \n loc = DelayC.ar(loc, delay * 2, delay * 1);\n LocalOut.ar(loc.reverse * 0.49);\n Out.ar(0, loc * 0.9)\n}).play;\n\nNdef(\\b, {\n var src, loc, del;\n del = 1/100;\n src = Decay2.ar(TDuty.ar(1/4,0,Dseq([1, 0.5, 0.3, 0.1],inf)), \n LFNoise2.kr(4).range(0.001, 0.0001), LFNoise2.kr(4).range(0.005, 0.05))!2\n * Saw.ar(LFNoise2.kr(200).exprange(40, 14000));\n loc = BPF.ar(LocalIn.ar(2) + [src, 0], LFNoise2.kr(0.1).range(40, 400), 3.2);\n loc = GVerb.ar(loc, 100, 4, mul:0.02, add:loc);\n loc = Compander.ar(loc, loc, 0.9, 1, 0.001);\n loc = (loc * 0.51).tanh;\n loc = Compander.ar(loc, loc, 0.1, 1, 0.1); \n loc = DelayC.ar(loc, del * 2, del * 1);\n LocalOut.ar(loc.reverse * 0.45);\n Out.ar(0, Compander.ar(loc,loc,0.1, 1, 0.05) * 1.2)\n}).play;\n\nNdef(\\c, {\n var src, loc, del=1/4;\n src = Decay2.ar(Impulse.ar(1), 0.0001, 0.05) * SinOsc.ar(60);\n loc = src + LocalIn.ar(2);\n loc = BPF.ar(loc, 800, 3.2).softclip;\n loc = DelayN.ar(loc, del, [0, del]);\n LocalOut.ar(loc.reverse * 0.99);\n Out.ar(0, loc * 2)\n}).play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes From a while ago."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var t, grav, sf, chain, sig;\n sf = LFPulse.ar(0.5);\n grav = LFNoise2.ar(1).range(0.1, 0.7);\n t = TBall.ar(sf, grav, 0.01, 0.0001) * 10;\n \n chain = FFT(LocalBuf(1024), t);\n chain = chain.pvcalc(1024, {|mags, phases|\n [phases, mags];\n });\n chain = PV_BrickWall(chain, LFNoise2.kr(1).range(-1, 0.5));\n chain = PV_RandComb(chain, LFNoise2.kr(1).range(0, 1), Dust.kr(20));\n sig = IFFT(chain);\n \n sig = sig ! 2;\n sig = sig + AllpassC.ar([sig[1], sig[0]], 0.1, {LFNoise2.kr(0.5).range(0.01, 0.1)} ! 2, 2);\n sig = sig + AllpassC.ar(sig, 0.1, {LFNoise2.kr(0.1).range(0.01, 0.1)} ! 2, 1);\n \n sig = LPF.ar(sig, 15000) + LPF.ar([sig[1], sig[0]], 500, 5) + LPF.ar(sig, 200, 10);\n sig = sig * 10;\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a, b;\na = Paddp(\\freq, Pseq([2, 3, pi], inf), Pbind(\\freq, Pseq([100, 200, 300])));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a, b;\na = Paddp(\\freq, Pseq([2, 3, pi], inf), Pbind(\\freq, Pseq([100, 200, 300])));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for vinil 10."}, {"role": "assistant", "content": "```supercollider\n// vinil 10\n// Esta cosa tiene un delay de maximo 10 segundos. La posicion X controla el tiempo de delay.\n// nos permite hacer una especie de 'scratch' como el de los djs con lo que entra por el mic\n(\nSynthDef.new(\"vinil10\", {arg gain=2; var in, delay;\n in = SoundIn.ar(0,mul:gain);\n delay = DelayL.ar(in!2,10,MouseX.kr(0,10))!2;\n Out.ar(0,delay)\n}).add;\n);\n\na = Synth(\"vinil10\");\n\na.free // libera (desactiva) el oscilador\n```"}]} -{"conversations": [{"role": "user", "content": "What does `RedLSystem.reset` do?"}, {"role": "assistant", "content": "Reset generation counter to zero and the production to the"}]} -{"conversations": [{"role": "user", "content": "What does `FoaGamma.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "First Order Ambisonic (FOA) Soundfield Active-Reactive Intensity Alignment Arguments: in — The B-format signal, an array: [w, x, y, z]; size — Analysis filter kernel size.; method — The Soundfield analysis method:."}]} -{"conversations": [{"role": "user", "content": "What does `Slider.defaultKeyDownAction` do?"}, {"role": "assistant", "content": "Implements the default effects of key presses as"}]} -{"conversations": [{"role": "user", "content": "What does `ServerOptions.sampleRate` do?"}, {"role": "assistant", "content": "The preferred sample rate. If non-nil the server app will attempt to set the sample rate of the hardware. The hardware has to support the sample rate that you"}]} -{"conversations": [{"role": "user", "content": "Explain `NamedControl` in SuperCollider briefly."}, {"role": "assistant", "content": "NamedControl — Named reference to a control A NamedControl directly combines a ControlName and a Control UGen conveniently. Also this makes it safe even if several identical controls exist (see example below). Category: UGens > Synth control."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ModDif`."}, {"role": "assistant", "content": "```supercollider\n// different moduli\n(\n{\n var sig = LFSaw.ar(10);\n var dist = ModDif.kr(sig, 0, (0..8) * MouseX.kr(0, 1/5));\n Splay.ar(SinOsc.ar(dist * 4000 + 400)) * 0.1\n}.play;\n);\n\n// wrapping amplitude crossfade\n(\n{\n var numChan = 12;\n var x = SinOsc.ar({ rrand(300.0, 800.0) } ! numChan);\n var dist = ModDif.kr(MouseX.kr(0, numChan * 2), (0..numChan-1), numChan);\n x = x * max(0, 1 - dist);\n Splay.ar(x) * 0.1\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Resizing FreqScope?"}, {"role": "assistant", "content": "SuperCollider forum — Resizing FreqScope?\n\nOddly, this seems to work:\n\n```supercollider\n// max partial = 20 kHz\n// do not play this loudly\na = { Blip.ar(100, 200, 0.02).dup }.play;\n\nv = FreqScope(800, 600); // top partial is shown below 1.75 kHz (?)\n\nv.scope.scope.xZoom = 1; // seems correct, by eyeballing\n\n// let's try another resolution\nv = FreqScope(600, 500);\nv.scope.scope.xZoom = 1; // hm, zoom = 1 seems OK here too\n```\n\nFreqScope includes the line scope.xZoom_((scope.bufSize*0.25) / width); so it may be that this calculation is incorrect. I’m unclear, for instance, why it’s dividing by width – apparently zooming out for larger windows...?\n\nBut I tried three different widths (800x600, 600x500, 200x150), and for all of them, xZoom = 1 appeared to be correct. It’s possible that this calculation is vestigial, then – maybe we needed it for the older version of frequency scope, but the Qt version might not need it at all.\n\nhjh"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Fomus`."}, {"role": "assistant", "content": "```supercollider\nf.add(p.asStream, 40)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Splay`."}, {"role": "assistant", "content": "```supercollider\n// splay 10 chans of sound into 2\n(\nx = { |spread = 1, level = 0.2, center = 0.0|\n var numchans = 10;\n Splay.ar(\n SinOsc.ar({ |i| LFNoise2.kr(1).exprange(200, 4000) } ! numchans),\n spread,\n level,\n center\n // use levelComp default true\n );\n}.play;\n);\n\ns.meter;\ns.scope;\n\n// change settings dynamically:\n\nx.set(\\spread, 1, \\center, 0); // full stereo\nx.set(\\spread, 0.5, \\center, 0); // less wide\nx.set(\\spread, 0, \\center, 0); // mono center\nx.set(\\spread, 0.5, \\center, 0.5); // spread from center to right\nx.set(\\spread, 0, \\center, -1); // all left\nx.set(\\spread, 1, \\center, 0); // full stereo\n\n// A similar example written with arFill:\n(\nx = { |spread = 1, level = 0.2, center = 0.0|\n var numchans = 10;\n Splay.arFill(numchans,\n { |i| SinOsc.ar(LFNoise2.kr(rrand(10, 20), 200, i + 3 * 100)) },\n spread,\n level,\n center\n );\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `PV_MagBelow` in SuperCollider briefly."}, {"role": "assistant", "content": "PV_MagBelow — Pass bins below a threshold. Passes only bins whose magnitude is below a threshold. Category: UGens > FFT."}]} -{"conversations": [{"role": "user", "content": "What does `MxUnitApp.gui` do? What arguments does it take?"}, {"role": "assistant", "content": "Open a gui. The gui implementation is defined in the object driver Arguments: parent — parent view, window or nil; bounds — bounds rect or nil. Returns: this"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nm = SimpleMIDIFile.read( \"~/Téléchargements/Super Mario Bros 2 - Mario Dreams.mid\" ); \n(\n TempoClock.default.tempo = m.tempo/60;\n Pdef(\\bla, \n Pbind(\n \\instrument, \\default,\n [\\midinote, \\dur, \\sustain, \\amp], Prout({ arg ev;\n var timescale = 1/16/60;\n var prevev;\n m.noteSustainEvents.collect({ arg item, idx;\n // [track, absTime, \\noteOn, channel, note, velo, dur, upVelo]\n if(idx == 0) {\n prevev = [item[4], item[1], item[6] * timescale, item[5]/127]\n } {\n prevev[1] = item[1] - prevev[1] * timescale;\n ev = prevev.yield;\n prevev = [item[4], item[1], item[6] * timescale, item[5]/127];\n };\n });\n prevev[1] = prevev[2];\n ev = prevev.yield;\n }),\n )\n ).play\n)\n```"}, {"role": "assistant", "content": "There is the .p method (see http://sccode.org/1-5aT) but here is also a way to retrieve the values directly."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Balance2`."}, {"role": "assistant", "content": "```supercollider\n// a stereo signal, both channels at 0dB\n{ [SinOsc.ar(440), SinOsc.ar(440)] }.play\n\n// using Balance on a stereo signal with the position parameter at 0, effectively the same sound but both channels at -3dB\n{ Balance2.ar(SinOsc.ar(440), SinOsc.ar(440), 0) }.play\n\n// pan sweep from left to right\n{ Balance2.ar(SinOsc.ar(440), SinOsc.ar(1000), Line.kr(-1, 1, 5)) }.play\n\n// other examples\n{ Balance2.ar(LFSaw.ar(44), Pulse.ar(33), FSinOsc.kr(0.5), 0.1) }.play;\n{ var source; source = SinOsc.ar([440, 550]); Balance2.ar(source[0], source[1], LFNoise0.kr(4), 0.3) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Add two UGens\n{ SinOsc.ar(440, 0, 0.2) + PinkNoise.ar(0.1; }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Add two UGens\n{ SinOsc.ar(440, 0, 0.2) + PinkNoise.ar(0.1); }.play\n```"}]} -{"conversations": [{"role": "user", "content": "How current is your SuperCollider knowledge?"}, {"role": "assistant", "content": "It comes from a snapshot of the SuperCollider repository (documentation, class library and examples) plus code I can reason about. So classes and arguments in that snapshot I know well, including argument order. Quarks, newer UGens, and anything outside the official tree I may not know at all, and I will say so rather than invent a method name. If you need certainty about a class, check its help page — `SinOsc.schelp` in the source tree is the authority."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot\nb = Bus.audio(s, 2);\na = { SinOsc.ar([330, 440], 0, 0.4) }.play(s, b // you won't hear this if you only have two channels\nb.scope\n\na.free;\nb.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot\nb = Bus.audio(s, 2);\na = { SinOsc.ar([330, 440], 0, 0.4) }.play(s, b) // you won't hear this if you only have two channels\nb.scope\n\na.free;\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `PmonoArtic` in SuperCollider briefly."}, {"role": "assistant", "content": "PmonoArtic — partly monophonic event stream Like Pmono, PmonoArtic plays one synth at a time (where successive events change the parameters of the existing synth node). PmonoArtic, however, allows events to re-articulate and supports staccato in the middle of a monophonic phrase. Category: Streams-Patterns-Events > Patterns > Event."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\ns.boot;\n\n// excitation signal is WhiteNoise, triggered twice a second with varying OnePole coef\n(\n { Pluck.ar(WhiteNoise.ar(0.1), Impulse.kr(2), 440.reciprocal, 440.reciprocal, 10,\n coef: MouseX.kr(-0.999, 0.999))\n }.play(s)\n);\ns.quit;\n// a group of angry fretless mandolin players\n(\n {\n var freq, numparts;\n numparts = 50;\n freq = SinOsc.kr(Array.fill(numparts, { Rand(0.05, 0.2) }),\n Array.fill(numparts, { Rand(0, 1.0) })).range(1000,\n// …\n```"}, {"role": "assistant", "content": "excitation signal is WhiteNoise, triggered twice a second with varying OnePole coef a group of angry fretless mandolin players (Pluck: A Karplus-Strong UGen)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n Patch.new(\n [ 'help', 'Sample' ], [ Sample.new(\"a11wlk01.wav\", 1.6347258775994),\n 0.46511627906977, 0.17441860465116 ]\n ).play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n Patch.new(\n [ 'help', 'Sample' ], [ Sample.new(\"a11wlk01.wav\", 1.6347258775994),\n 0.46511627906977, 0.17441860465116 ]\n ).play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `BRF` in SuperCollider briefly."}, {"role": "assistant", "content": "BRF — 2nd order Butterworth band reject filter. A second order band reject filter. Category: UGens > Filters > Linear."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n var saw, bpf;\n saw = Saw.ar(\n freq: [1700,2000],\n mul: LFPulse.kr(\n freq: [2,7],\n width: 0.115));\n bpf = LPF.ar(in: saw, freq: SinOsc.kr(1/3).range(250, 4000)); \n}.play;\n)\n```"}, {"role": "assistant", "content": "Quiz 4a for MUSC 115, pp. 62-84 from Gentle Intro to SuperCollider."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nSynthDef(\"mini\",{\n Out.ar( 0,\n Instr(\"minimoog.two\").ar( SinOsc.kr(1.0).range(300,500) )\n )\n}).send(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nSynthDef(\"mini\",{\n Out.ar( 0,\n Instr(\"minimoog.two\").ar( SinOsc.kr(1.0).range(300,500) )\n )\n}).send(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `AverageOutput.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "calculates mean average of audio or control rate signal Arguments: in — input signal.; trig — if changes from <= 0 to > 0, resets average and count to zero.."}]} +{"conversations": [{"role": "user", "content": "What does `EaseInQuart.value` do? What arguments does it take?"}, {"role": "assistant", "content": "Quartic ease-in Arguments: t — a Float between 0.0 and 1.0.."}]} +{"conversations": [{"role": "user", "content": "What is the difference between Env and EnvGen?"}, {"role": "assistant", "content": "Env is a language-side description: a list of levels, times and a curve, e.g. `Env.perc(0.01, 1)` or `Env.adsr(0.01, 0.1, 0.5, 0.8)`. EnvGen is the UGen that plays it on the server: `EnvGen.kr(env, gate, doneAction: 2)`. The same Env can be played by many EnvGens, and Env also has language-side uses such as `.asStream` inside Patterns and `.plot`."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `RunningSum`."}, {"role": "assistant", "content": "```supercollider\n// distorts of course - would need scaling\n{ RunningSum.ar(SoundIn.ar) }.play\n\n// Running Average over x samples\n(\n{\n var x = 100;\n RunningSum.ar(LFSaw.ar, x) * (x.reciprocal)\n }.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nNdef(\\x, { SinOsc.ar(Rand(500, 900)) * 0.1 }).play;\nNdef(\\x).copy(\\y);\nNdef(\\y.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nNdef(\\x, { SinOsc.ar(Rand(500, 900)) * 0.1 }).play;\nNdef(\\x).copy(\\y);\nNdef(\\y).play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ LPF.ar(Saw.ar(200, 0.1), SinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3600, 4000)) }.play;\n\n// kr:\n(\n{ var ctl = LPF.kr(LFPulse.kr(8), SinOsc.kr(XLine.kr(1, 30, 5)) + 2);\n SinOsc.ar(ctl * 200 + 400)\n}.play;\n);\n\n(\n{ var ctl = LPF.kr(LFPulse.kr(8), MouseX.kr(2, 50, 1));\n SinOsc.ar(ctl * 200 + 400)\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ LPF.ar(Saw.ar(200, 0.1), SinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3600, 4000)) }.play;\n\n// kr:\n(\n{ var ctl = LPF.kr(LFPulse.kr(8), SinOsc.kr(XLine.kr(1, 30, 5)) + 2);\n SinOsc.ar(ctl * 200 + 400)\n}.play;\n);\n\n(\n{ var ctl = LPF.kr(LFPulse.kr(8), MouseX.kr(2, 50, 1));\n SinOsc.ar(ctl * 200 + 400)\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `NonControlSpec.rate` do?"}, {"role": "assistant", "content": "datatype specifying an input to an Instr that will not be in the SynthDef/Synth"}]} +{"conversations": [{"role": "user", "content": "What does `MIDIdef.start` do?"}, {"role": "assistant", "content": "A convenience method to create a new MIDIdef which responds to MIDI start messages. See #*new for argument descriptions. The responding `func` will be passed the argument Returns: A new instance of MIDIdef which responds to MIDI start messages."}]} {"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Lag`."}, {"role": "assistant", "content": "```supercollider\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n Lag.kr( // lag the modulator\n LFPulse.kr(4, 0, 0.5, 50, 400), // frequency modulator\n Line.kr(0, 1, 15) // modulate lag time\n ),\n 0, // phase\n 0.3 // sine amplitude\n )\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `UGen.signalRange` do?"}, {"role": "assistant", "content": "Abstract superclass of all unit generators Returns: A symbol indicating the signal range of the receiver. Either `\\bipolar` or `\\unipolar`."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pan2`."}, {"role": "assistant", "content": "```supercollider\n// hear the difference, LinPan having a slight drop in the middle...\n{ LinPan2.ar(SinOsc.ar(440), Line.kr(-1, 1, 5)) }.play\n\n// ... whereas Pan2 is more smooth\n{ Pan2.ar(SinOsc.ar(440), Line.kr(-1, 1, 5)) }.play\n\n// other examples\n{ Pan2.ar(PinkNoise.ar(0.4), FSinOsc.kr(2), 0.3) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Another fibonaccy melody."}, {"role": "assistant", "content": "```supercollider\n(\nc=13;a=Array.fib(64,0,1);b=Array.fill(size:c,function:{arg i;a[i]%12});\np=1/(21-c);Pdef(\\x,Pbind(\\dur,p,\\degree,Pseq(b,1,0)));\nr=Array.fill(c,{arg i;Pbindf(Pdef(\\x),\\mtranspose,1-b[i]);});\nPseq(r,(1/p)).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for attempt at a Star Wars sound effect!?"}, {"role": "assistant", "content": "```supercollider\n(\n\n// bye fighter\n{\n\nvar whooshPitch, whooseVol, swish, swishPitch = 970, noise, output, timeScale = 1.5;\nvar trump, trumpPitch = 400, chain, buf;\nvar panning;\n\nwhooshPitch = EnvGen.kr(\n\n Env(\n [0.8, 1.0, 0.9, 0.7, 0.5, 0.3, 0.24, 0.12, 0.0],\n [0.08, 0.2, 0.15, 0.11, 0.08, 0.09, 0.06, 0.18],\n 2\n ),\n timeScale: 1.3 * timeScale\n \n).lag(0.2);\n\nwhooseVol = EnvGen.kr(\n\n Env(\n [0.0, 0.2, 0.7, 0.9, 1.0, 0.8, 0.6, 0.43, 0.22, 0.0],\n [0.4, 0.5, 0.2, 0.15, 0.17, 0.11, 0.1, 0.16, 0.28],\n 2\n ),\n timeScale: 0.9 * timeScale\n \n).lag(0.2, 1.5) * LFNoise1.kr(37.2, 0.2, 1).lag(0.2);\n\nnoise = Mix(CombC.ar(WhiteNoise.ar(0.2), 0.1, [whooshPitch.exprange(0.16, 0.00011), whooshPitch.exprange(0.19, 0.00013)], 0.09));\nnoise = noise + BrownNoise.ar(0.1);\n\nswishPitch = swishPitch * LFNoise0.kr(365, 0.2, 1);\nswishPitch = swishPitch * whooshPitch.range(0.8, 1.3);\nswish = Mix.fill(\n 3,\n {\n |i|\n SinOsc.ar(swishPitch + (i * whooshPitch.exprange(45, 1)), rrand(0.0, 1.0), 0.4);\n }\n);\ntrumpPitch = trumpPitch * whooshPitch.range(0.92, 1.08);\ntrump = Mix.fill(3, { |i| SinOscFB.ar(trumpPitch * LFNoise0.kr(28, 0.06, 1).lag(0.8) * (0.8 + (i * 0.05)), 1.2, 0.8) }) * 0.6;\ntrump = RHPF.ar(trump, whooshPitch.range(120, 335), 0.2);\nchain = FFT(LocalBuf(2048), trump);\nchain = PV_BinShift(chain, WhiteNoise.kr.range(0.96, 1.01), whooshPitch.range(24, 28)); \ntrump = IFFT(chain) * 0.2;\npanning = Line.kr(-0.7, 0.7, 3);\noutput = noise + swish + trump;\noutput = output * whooseVol;\n\nPan2.ar(output, panning, 1.0);\n}.play;\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Lorenz2DN.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "lorenz 2D chaotic generator Arguments: minfreq — minimum frequency in Hertz; maxfreq — maximum frequency in Hertz; s, r, b — equation variables; h — integration time step; x0 — initial value of x; y0 — initial value of y; z0 — initial value of z."}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ var sig = SinOsc.ar(440) * 0.2; Out.ar(0, sig) }.play;\n```"}, {"role": "assistant", "content": "The minimal SynthDef idiom: a source multiplied by an amplitude, written to the master bus.\n\n`var sig = SinOsc.ar(440) * 0.2` builds the signal; `Out.ar(0, sig)` is the only mandatory part, because a\nUGen graph that never reaches an output produces no sound. `Out`'s first argument is the bus number — 0 is\nthe main stereo output — and the second is the signal. The function's return value does not matter here,\nwhich is why the `Out.ar` can sit on its own line. `.play` compiles this into an anonymous SynthDef and\nstarts one instance."}]} -{"conversations": [{"role": "user", "content": "What does `CompositeInstr.init` do?"}, {"role": "assistant", "content": "two Instr combined together with function composition"}]} -{"conversations": [{"role": "user", "content": "What does `String.find` do?"}, {"role": "assistant", "content": "Returns the index of the string in the receiver, or nil if not found. If ignoreCase is true, find makes no difference between uppercase and lowercase letters. The offset is the point in the string where the search begins. string may be a String or a Char. `\"These are several"}]} +{"conversations": [{"role": "user", "content": "What does `FoaDecoderMatrix.new5_0` do? What arguments does it take?"}, {"role": "assistant", "content": "First Order Ambisonic (FOA) decoder matrices Arguments: irregKind — Three kinds are available:."}]} +{"conversations": [{"role": "user", "content": "What is `PHSpar` in SuperCollider?"}, {"role": "assistant", "content": "PHSpar — defines Pbind(s) for using synth values of a HSpar Defines Pbind(s) which, when played, can use values of synths derived from HSpar's synth definitions. Category: Libraries > miSCellaneous > HS and HSpar, Streams-Patterns-Events > HS and HSpar."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// The done action is invoked after maxFadeNum.\n\n(\nx = {\n var lfo = LFDNoise3.kr(0.2);\n DXMix.ar(\n Dseq([0, 1], inf),\n `[\n Saw.ar(lfo.range(40, 90) * [1, 1.02], 0.03),\n { BPF.ar(PinkNoise.ar(0.05), lfo.range(200, 5000), 0.1) } ! 2\n ],\n fadeTime: 0.5,\n stepTime: 1,\n fadeMode: 0, // check with other modes too\n maxFadeNum: 5,\n doneAction: 2\n )\n}.play\n;\n\nx.release\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// The done action is invoked after maxFadeNum.\n\n(\nx = {\n var lfo = LFDNoise3.kr(0.2);\n DXMix.ar(\n Dseq([0, 1], inf),\n `[\n Saw.ar(lfo.range(40, 90) * [1, 1.02], 0.03),\n { BPF.ar(PinkNoise.ar(0.05), lfo.range(200, 5000), 0.1) } ! 2\n ],\n fadeTime: 0.5,\n stepTime: 1,\n fadeMode: 0, // check with other modes too\n maxFadeNum: 5,\n doneAction: 2\n )\n}.play\n);\n\nx.release\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nSynthDef(\\Synth3,\n {arg ress = 0;\n var klank, env;\n klank = Klank.ar(`[{Rand(70,21000)}!7, {Rand(0.128,0.700)}!7],BrownNoise.ar(0.7));\n klank = klank;\n env = EnvGen.kr(Env.perc(0.07, ress), doneAction:2);\n Out.ar(0, klank*env.dup*0.0128);\n}).add;\n)\n\n\n{inf.do{x = rrand(0.01,0.7); Synth(\\Synth3, [\\ress, x+(7*x)]); x.wait;}}.fork\n```"}, {"role": "assistant", "content": "Play around with {Rand(70, 21000)}!7\r\n\r\nA simple example for the begginers... hope I can contribute to something =)."}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ LPF.ar(Saw.ar(100), SinOsc.kr(0.5).exprange(200, 2000)) * 0.2 }.play;\n```"}, {"role": "assistant", "content": "A sawtooth through a low-pass filter whose cutoff is swept slowly up and down — a classic filter\nsweep.\n\n- `Saw.ar(100)` is a 100 Hz sawtooth, rich in harmonics.\n- `SinOsc.kr(0.5)` is a control-rate sine at 0.5 Hz, so one full cycle takes 2 seconds.\n- `.exprange(200, 2000)` maps that -1..1 sine exponentially onto 200..2000 Hz — exponential is the right\n mapping for frequency, because we hear pitch logarithmically.\n- `LPF.ar(sig, cutoff)` removes harmonics above the cutoff; as it opens and closes you hear the tone\n brighten and darken.\n- `* 0.2` keeps the output from clipping."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{Decimator.ar(SinOsc.ar([400, 404], 0, 0.2), MouseX.kr(0, 44100), MouseY.kr(0, 31))}.play\n\n{Decimator.ar(SoundIn.ar, MouseX.kr(0, 44100), MouseY.kr(0, 31)}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{Decimator.ar(SinOsc.ar([400, 404], 0, 0.2), MouseX.kr(0, 44100), MouseY.kr(0, 31))}.play\n\n{Decimator.ar(SoundIn.ar, MouseX.kr(0, 44100), MouseY.kr(0, 31))}.play\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `SFormant` in SuperCollider briefly."}, {"role": "assistant", "content": "SFormant — a formant sInstrument Based on optoformant3. Category: SInstruments."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Dust2`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-Dust2\", { |out = 0|\n Out.ar(out,\n Dust2.ar(200, 0.5)\n )\n}).play;\n);\n\n(\nSynthDef(\"help-Dust2\", { |out = 0|\n Out.ar(out,\n Dust2.ar(XLine.kr(20000, 2, 10), 0.5)\n )\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `TWChoose.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Randomly select one of several inputs Arguments: trig; array; weights; normalize."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\"help-GrayNoise\", { |out = 0|\n Out.ar(out,\n GrayNoise.ar(-20.dbamp)\n )\n}).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\"help-GrayNoise\", { |out = 0|\n Out.ar(out,\n GrayNoise.ar(-20.dbamp)\n )\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// you have to write the sample path in the firts line\n\n~bufferdue = Buffer.read(s,\" WRITE YOUR SAMPLE PATH HERE \", bufnum:2);\n\n(\nSynthDef.new(\\bufbeat, {\n arg amp = 1, out = 0, buf, start, end, freq = 1;\n var sig, ptr;\n ptr = LFNoise1.ar(freq).range(0.0,end);\n sig = BufRd.ar(2, buf, ptr);\n sig = sig * amp;\n Out.ar(out, sig);\n}).add\n);\n\nx = Synth.new(\\bufbeat, [\\buf, ~bufferdue.bufnum, \\start,0, \\end, ~bufferdue.numFrames-1, \\freq, 1, \\amp, 0.5],g);\n\nx.free;\n```"}, {"role": "assistant", "content": "a simple BufRd with the starting point of lecture randomized by LFNoise1."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// compare PL and PLn, start with polling two items from each Stream\n// Note that Pseq defaults to repeats = 1 and PL/PLn default to repeats = inf\n\n(\n~a = Pseq([1, 2, 3]);\nx = PLn(\\a).asStream;\ny = PL(\\a).asStream;\n\nx.nextN(2);\ny.nextN(2);\n);\n\n\n// replace proxy source \n\n~a = ~a * 100;\n\n\n// Stream from PLn finishes before replacement\n\nx.nextN(2)\n\n// With PL substream is replaced immediately\n\ny.nextN(2)\n```"}, {"role": "assistant", "content": "compare PL and PLn, start with polling two items from each Stream Note that Pseq defaults to repeats = 1 and PL/PLn default to repeats = inf (PLn: dynamic scope placeholder pattern whose streams will be finished before replacements)"}]} +{"conversations": [{"role": "user", "content": "What does `LineLayout.insert` do? What arguments does it take?"}, {"role": "assistant", "content": "Insert an item at a specific Arguments: item — The item can be a view, a layout, an Integer (specifying amount in pixels of empty space) or nil (for stretchable empty space).; index — The integer position among current items at which to insert the new item. If index is smaller than 0 or larger than the current amount of items, the new item will always be added to the end of the line.; stretch — An integer stretch factor.; align — A symbol expressing the alignment. See gui_alignments for possible values.."}]} +{"conversations": [{"role": "user", "content": "Explain `PLbindefPar` in SuperCollider briefly."}, {"role": "assistant", "content": "PLbindefPar — container for parallel PLbindefs which allows replacement in object prototyping style PLbindefPar employs a number of parallel PLbindefs, replacement of key streams can be done in object prototyping style with a dedicated PLbindefParEnvironment, which also holds player methods. This hybrid Environment is itself assigned to the PLbindefPar's name in an Environment of choice, by default the current Environment. Setting can thus be done in very condensed syntax, also in combination wi Category: Libraries > miSCellaneous > PLx suite, Streams-Patterns-Events > PLx suite."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nt = SortedList.new(8, {|a,b| a.first < b.first });\nt.add([10, \"last\"]);\nt.add([1, \"first\"];\nt.postln;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nt = SortedList.new(8, {|a,b| a.first < b.first });\nt.add([10, \"last\"]);\nt.add([1, \"first\"]);\nt.postln;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Sieve.union_oi` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new Sieve object in mode 'intervals' with offsets, generated by the union of sets of Arguments: ... data — Alternating generators and integer offsets plus an optional integer limit, wrapped into a Ref, which is included when reached. Allowed generators: Integers, Streams or Patterns producing intervals or Sieves itself. Integers and Stream/Pattern output must be strictly positive. Integers as generators ."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n{ BlitB3Square.ar(XLine.kr(1000, 20, 10)) }.play;\n\n{ BlitB3Square.ar(MouseX.kr(20,1000,'exponential'),MouseY.kr(0.001,0.999)) }.play;\n\n//comparison\n//blit version is cheaper, but aliases once pushed over 4000 or so at 44100 SR\n{ Pulse.ar(4000, 0.5) }.play;\n{ BlitB3Square.ar(4000) }.play;\n\n\n//spot the difference in CPU usage\n{ Mix.fill(100, {Pan2.ar(0.1*BlitB3Square.ar( ((LFNoise0.kr(rrand(2,3))).range(0,36)+36).midic\n// …\n```"}, {"role": "assistant", "content": "blit version is cheaper, but aliases once pushed over 4000 or so at 44100 SR spot the difference in CPU usage (BlitB3Square: Bipolar BLIT derived square waveform)"}]} +{"conversations": [{"role": "user", "content": "What does `SimpleNumber.asWarp` do? What arguments does it take?"}, {"role": "assistant", "content": "one-dimensional value Arguments: spec — a ControlSpec. Returns: this as CurveWarp according to spec."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `DelayN` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// これは(SC2の配布物の中の)\"01 Why SuperCollider document\"からのリバーブ\n(\nSynthDef(\"preDelay\", { arg inbus = 2;\n Out.ar(\n 4,\n DelayN.ar(In.ar(inbus, 1), 0.048, 0.048)\n )\n}).add;\n\nSynthDef(\"combs\", {\n Out.ar(\n 6,\n Mix.arFill(7, { CombL.ar(In.ar(4, 1), 0.1, LFNoise1.kr(Rand(0, 0.1), 0.04, 0.05), 15) })\n )\n}).add;\n\nSynthDef(\"allpass\", { arg gain = 0.2;\n var source;\n source = In.ar(6, 1);\n 4.do({ source = AllpassN.ar(source, 0.050, [Rand(0, 0.05), Rand(0, 0.05)], 1) });\n Out.ar(\n 8,\n source * gain\n )\n}).add;\n\nSynthDef(\"theMixer\", { arg gain = 1;\n Out.ar(\n 0,\n Mix.ar([In.ar(2, 1), In.ar(8, 2)]) * gain\n )\n}).add;\n);\n\n(\nSynth(\"fm1\", [\\bus, 2, \\freq, 440, \\carPartial, 1, \\modPartial, 1.99, \\mul, 0.071]);\nSynth(\"fm1\", [\\bus, 2, \\freq, 442, \\carPartial, 1, \\modPartial, 2.401, \\mul, 0.071]);\nSynth.tail(s, \"preDelay\");\nSynth.tail(s, \"combs\");\nSynth.tail(s, \"allpass\");\nSynth.tail(s, \"theMixer\", [\\gain, 0.64]);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `RedObject.update` do?"}, {"role": "assistant", "content": "Moves the object by updating the #-loc, #-vel and #-accel instance"}]} +{"conversations": [{"role": "user", "content": "What does `PSVdif_o.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new PSVdif_o Arguments: genList — An array of generators and corresponding offsets. Allowed generators: Integers, Streams or Patterns producing intervals or Sieves itself. Integers and Stream/Pattern output must be strictly positive. Integers as generators produce zero and its positive multiples. Offsets must be integers.; maxLength — Integer. Maximum number of items, which the stream will return. Defaults to inf.; limit — Integer. Limit up to which integers can be returned by the stream. If no limit is passed, returned integers might go up to default limit 65536.."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Seekers are something you should avoid. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var time = 0.23;\n var freq = (55).midicps;\n var a = VarSaw.ar(freq/2, width: XLine.ar(0.5,1,time)).range(0,XLine.ar(0.666,1/666,time));\n var tone = SinOsc.ar(freq).fold(-0.23*a,a) * EnvGen.ar(Env([1,0],[time]));\n Out.ar(0, tone.dup);\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `NamedControl`."}, {"role": "assistant", "content": "```supercollider\n// use NamedControl to create a number of multichannel controls:\n\na = { SinOsc.ar(NamedControl.kr(\\freq, [300, 330, 370], [1, 0.3, 0.02])).sum * 0.1 }.play;\na.setn(\\freq, [700, 705, 890]);\na.setn(\\freq, [0, 2, 5].midiratio * 400);\n\n// synonymous:\na = { SinOsc.ar(\\freq.kr([300, 330, 370], [1, 0.3, 0.02])).sum * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Streson.ar(LFSaw.ar([220, 180], 0, mul:EnvGen.kr(Env.asr(0.5, 1, 0.02), 1.0) * 0.2), LinExp.kr(LFCub.kr(0.1, 0.5*pi), -1, 1, 280, 377).reciprocal, 0.9, 0.3 }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Streson.ar(LFSaw.ar([220, 180], 0, mul:EnvGen.kr(Env.asr(0.5, 1, 0.02), 1.0) * 0.2), LinExp.kr(LFCub.kr(0.1, 0.5*pi), -1, 1, 280, 377).reciprocal, 0.9, 0.3) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `PTDelay` in SuperCollider briefly."}, {"role": "assistant", "content": "PTDelay — UGenPatterns quark library Based on TDelay Category: Streams-Patterns-Events > UGenPatterns > Modifiers."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n var saw, bpf;\n saw = Saw.ar(\n freq: [1700,2000],\n mul: LFPulse.kr(\n freq: [2,7],\n width: 0.115));\n bpf = LPF.ar(in: saw, freq: SinOsc.kr(1/3).range(250, 4000)); \n}.play;\n)\n```"}, {"role": "assistant", "content": "Quiz 4a for MUSC 115, pp. 62-84 from Gentle Intro to SuperCollider."}]} +{"conversations": [{"role": "user", "content": "How do I make a piece reproducible instead of a different take every time?"}, {"role": "assistant", "content": "Three things make a SuperCollider piece repeatable: a fixed seed, a fixed tempo, and no live input.\n\n```supercollider\n(\nthisThread.randSeed = 1234;\nTempoClock.default.tempo = 2;\nPbind(\\degree, Pwhite(0, 7, inf), \\dur, 0.25).play;\n)\n```\n\n`thisThread.randSeed` fixes the random sequence of the current thread, so `Pwhite`, `Prand` and friends give\nthe same values again. Recording with `s.record(path, duration: 30)` then makes the take an artifact rather\nthan a performance. Input from `MouseX` or a MIDI controller is the usual remaining source of difference."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Ref`."}, {"role": "assistant", "content": "```supercollider\n{ Klank.ar(`[[800, 1071, 1153, 1723], nil, [1, 1, 1, 1]], Impulse.ar(2, 0, 0.1)) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\Mirror;\n~description = \"Mirror soundfield\";\n\n~function = {|in = 0, order = 1, mirrorFrontBack = 0, mirrorLeftRight = 0, mirrorUpDown = 0 |\nHOATransMirror.ar(order, in, mirrorFrontBack, mirrorLeftRight, mirrorUpDown);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} {"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nx = { |freq = 440, amp = 0.2| SinOsc.ar(freq) * amp }.play;\nx.set(\\freq, 660);\n```"}, {"role": "assistant", "content": "Starts an anonymous synth with two controls, then changes one of them while it plays.\n\nThe `|freq = 440, amp = 0.2|` are arguments of the function, and `.play` turns each into a Synth control\nwith that default value. `x` holds the Synth node. `.set(\\freq, 660)` sends a `/n_set` message to the\nserver, so the oscillator changes frequency without being restarted — that is why the sound glides rather\nthan re-triggering. Note that `\\freq` is a Symbol: the backslash is part of the name."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Midterm Q2 (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"sawSynth\",{arg freq, amp;\n var env, snd;\n\n env = Env.perc(\n attackTime:0.1,\n releaseTime:2,\n level:amp).kr(doneAction: 2);\n snd = Saw.ar(\n freq:freq*[0.99, 1.0, 1.001, 1.008],\n mul: env);\n snd = LPF.ar(in: snd,freq:2000);\n snd = Splay.ar(snd);\n Out.ar(0,snd);\n\n}).add;\n);\n\n(\nPbind(\n \\instrument, \"sawSynth\",\n \\freq, Pwhite(300, 700, inf),\n \\amp, Pwhite(0.15, 0.2)\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Plotter`."}, {"role": "assistant", "content": "```supercollider\n(\na = { (0..10).scramble.normalize }.dup(2).plot;\na.editMode = true;\na.editFunc = { |...args| args.postln };\n);\n\n// using plotter as a control interface\n(\na = { (0..10).scramble.normalize(300, 400) }.dup.plot;\na.specs = \\freq; a.plotMode = \\bars;\na.editMode = true;\nx = {\n var phase = SinOsc.ar(\\rate.kr(a.value[1]));\n SinOsc.ar(\\freq.kr(a.value[0]), phase).mean * 0.1\n}.play;\na.editFunc = { |plotter, plotIndex, i, val|\n x.setn(\\freq, a.value[0]);\n x.setn(\\rate, a.value[1]);\n};\na.parent.onClose = { x.release };\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What model are you?"}, {"role": "assistant", "content": "I am sc-mind: a 198M MiniMind-3-MoE, eight layers, 768 wide, four experts with top-1 routing. I was trained from scratch on the SuperCollider documentation, class library and help pages, then fine-tuned on questions and answers about them."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// example from ServerErrorGui in crucial lib\n\nf = OSCresponderNode(s.addr, '/fail', { |time, responder, msg|\n {\n var mins, secs;\n mins = (time/60).round(1);\n secs = (time%60).round(0.1);\n if(secs<10, { secs = \"0\"++secs.asString }, { secs = secs.asString });\n // put this on a gui\n // errors.label = \"% % (%:%)\".format(msg[1], msg[2], mins, secs);\n // errors.stringColor = Color.white;\n \"% % (%:%)\".format(msg[1], msg[2], mins, secs).postln;\n }.defer\n});\nf.add;\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// example from ServerErrorGui in crucial lib\n\nf = OSCresponderNode(s.addr, '/fail', { |time, responder, msg|\n {\n var mins, secs;\n mins = (time/60).round(1);\n secs = (time%60).round(0.1);\n if(secs<10, { secs = \"0\"++secs.asString }, { secs = secs.asString });\n // put this on a gui\n // errors.label = \"% % (%:%)\".format(msg[1], msg[2], mins, secs);\n // errors.stringColor = Color.white;\n \"% % (%:%)\".format(msg[1], msg[2], mins, secs).postln;\n }.defer\n});\nf.add;\n\n// cause a failure\nSynth(\"gthhhhppppppp!\");\n\nf.remove\n```"}]} -{"conversations": [{"role": "user", "content": "What is `AnalyseEventsDatabase` in SuperCollider?"}, {"role": "assistant", "content": "AnalyseEventsDatabase — Records events found by the AnalyseEvents2 UGen Database that will store any events discovered in an audio signal using the AnalyseEvents UGen. This works on-the-fly, and you can switch the target input bus. Category: Libraries > BBCut > Machine listening."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n// allocate an array of Buffers and fill them with different harmonics\n(\nb = Buffer.allocConsecutive(8, s, 4096, 1, { |buf, i|\n buf.sine1Msg((1 .. ((i + 1) * 6)).reciprocal) // completion messages\n});\n\na = { VOsc.ar(SinOsc.kr(0.5, 0).range(b.first.bufnum + 0.1, b.last.bufnum - 0.1),\n [440, 441], 0, 0.2) }.play;\n);\na.free;\n\n// iterate over the array and free it\nb.do(_.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n// allocate an array of Buffers and fill them with different harmonics\n(\nb = Buffer.allocConsecutive(8, s, 4096, 1, { |buf, i|\n buf.sine1Msg((1 .. ((i + 1) * 6)).reciprocal) // completion messages\n});\n\na = { VOsc.ar(SinOsc.kr(0.5, 0).range(b.first.bufnum + 0.1, b.last.bufnum - 0.1),\n [440, 441], 0, 0.2) }.play;\n);\na.free;\n\n// iterate over the array and free it\nb.do(_.free);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `FunctionDef.varArgsValue` do?"}, {"role": "assistant", "content": "Returns how many sets of variable arguments the function has. 0 for none, 1 for ellipsis arguments, 2 for keyword arguments. `{ |a, b, c| a + b * c }.def.varArgsValue; //"}]} -{"conversations": [{"role": "user", "content": "What does `UScore.arrayForPlayTask` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: startPos — (describe argument here); assumePrepared — (describe argument here); startEventsActiveAtStartPos — (describe argument here); loop — (describe argument here). Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Penvir`."}, {"role": "assistant", "content": "```supercollider\n(\nx = (a: 8);\ny = Penvir(\n x,\n Pfunc { ~a * 2 }\n);\n\nt = y.asStream;\n);\n\nt.next;\n\n\n\n(\nx = (a: 8);\ny = Penvir(\n x,\n Pfunc { ~a = ~a * 2 }\n);\n\nt = y.asStream;\nz = y.asStream;\n);\n\nt.next;\nt.next;\nx.postln; // x stays unchanged\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = WhiteNoise.ar; // a WhiteNoise\nb = a.squared; // a UnaryOpUGen.\nb.operator; // squared\n\n// sound example\n\n{ var a = LFSaw.ar(300).range(0, 2pi); a.sin * 0.1 }.play;\n\n// Plotting the \"abs\" unary operator (via the server):\n\n{ SinOsc.ar(300.abs }.plot\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = WhiteNoise.ar; // a WhiteNoise\nb = a.squared; // a UnaryOpUGen.\nb.operator; // squared\n\n// sound example\n\n{ var a = LFSaw.ar(300).range(0, 2pi); a.sin * 0.1 }.play;\n\n// Plotting the \"abs\" unary operator (via the server):\n\n{ SinOsc.ar(300).abs }.plot\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Ringz`."}, {"role": "assistant", "content": "```supercollider\n{ Ringz.ar(Dust.ar(3, 0.3), 2000, 2) }.play\n\n{ Ringz.ar(WhiteNoise.ar(0.005), 2000, 0.5) }.play\n\n// modulate frequency\n{ Ringz.ar(WhiteNoise.ar(0.005), XLine.kr(100, 3000, 10), 0.5) }.play\n\n{ Ringz.ar(Impulse.ar(6, 0, 0.3), XLine.kr(100, 3000, 10), 0.5) }.play\n\n// modulate ring time\n{ Ringz.ar(Impulse.ar(6, 0, 0.3), 2000, XLine.kr(4, 0.04, 8)) }.play\n\n// modulate ring time opposite direction\n{ Ringz.ar(Impulse.ar(6, 0, 0.3), 2000, XLine.kr(0.04, 4, 8)) }.play\n\n(\n{\n var exciter;\n exciter = WhiteNoise.ar(0.001);\n Mix.arFill(10, {\n Ringz.ar(exciter,\n XLine.kr(exprand(100.0, 5000.0), exprand(100.0, 5000.0), 20),\n 0.5)\n })\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// example:\n(\nvar f, g, product;\nf = { SinOsc.ar(400) };\ng = { LFPulse.kr(8) };\nproduct = f * g * 0.1;\n{ Pan2.ar(product, SinOsc.kr(0.3)) }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// example:\n(\nvar f, g, product;\nf = { SinOsc.ar(400) };\ng = { LFPulse.kr(8) };\nproduct = f * g * 0.1;\n{ Pan2.ar(product, SinOsc.kr(0.3)) }.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Basic tone simulator of a stylophone?"}, {"role": "assistant", "content": "```supercollider\n/*\nRetro Stylophone\n\nReverse engineered from: https://www.waitingforfriday.com/?p=334\n\n1. Relaxation oscillator (UJT)\n\n- generated by a combination of two oscillators. The primary oscillator is a\n current controlled PUT (Programmable Uni-Junction Transistor) relaxation oscillator which is\n responsible for generating the overall tone of the instrument.\n A secondary LFO phase-shifted provides the vibrato\n (the relative slow wavering of a sound around the notes centre pitch)\n\n- around 10 VPP\n\n2. LFO phase-shift (vibrato)\n\n- generated by a low-frequency oscillator made with a transistor and several capacitors,\n which produces a triangle/sine wave fed into the frequency control voltage operating the UJT\n\n- frequency of about 8.5Hz, phased shifted of 180 degree, around 4.2 VPP\n*/\n\n(\nSynthDef(\\stylophone, { |freq = 220, vibAmp = 2, toneAmp = 5, atkTime = 0.01, trigger = 0|\n\n var lfo = OnePole.kr(LFPar.kr(8, mul: vibAmp, add: freq), 0.9); // 180 degree inversion\n var relaxOsc = LFPulse.ar(lfo, width: 0.9, mul: toneAmp);\n\n var asr = EnvGen.kr(Env.asr(atkTime * 5, releaseTime: 0.001, curve: \\lin), gate: trigger);\n\n Out.ar(0, relaxOsc * asr)\n}).add\n);\n\nf = Synth(\\stylophone);\n\nf.set(\\freq, 208.2);\nf.set(\\freq, 233.4);\n\nf.set(\\trigger, 1);\nf.set(\\trigger, 0);\nf.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `TempoGui` in SuperCollider briefly."}, {"role": "assistant", "content": "TempoGui — gui class a slider and number box to control the current Tempo in bpm Category: Libraries > crucial > GuiClasses."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Using sine waves to generate a saw waveform."}, {"role": "assistant", "content": "```supercollider\nq={|f,e|a=Array.fill(e,{|j|e-j}).reverse;(Mix.ar(a.collect{|x|SinOsc.ar(f*x,0,1/x)})/2)!2};{q.(60,300)}.play //saw from sine #supercollider\n\n//Change the values passed to q to control the frequency and how many sines are used.\n```"}]} -{"conversations": [{"role": "user", "content": "I edited a SynthDef and the running sound did not change."}, {"role": "assistant", "content": "Redefining a SynthDef only affects Synths created after the new definition reaches the server; existing instances keep the graph they were built with. Free and recreate them: `~s.free; ~s = Synth(\\name)`. In JITLib, Ndef is the tool designed for this — redefining `Ndef(\\name, { ... })` crossfades to the new graph while it plays."}]} -{"conversations": [{"role": "user", "content": "What is `SoundFileFormats` in SuperCollider?"}, {"role": "assistant", "content": "SoundFileFormats — a widget for selecting SoundFile format for recording `(` Category: Libraries > crucial > GUI."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for cosmic organ with a inspiration of rukano tweet."}, {"role": "assistant", "content": "```supercollider\n// 2012.05.04\n// Work for NX014 Class\n// Inspiration: A Rukano Tweet. Thanks rukano!\n// Comment: Cosmic Organ.\n\np = ProxySpace.push(s.boot);\n\n~a.play;\n\n~a = { var alpha,gamma;\n alpha= LFNoise2;\n gamma= {[rrand(30,50),rrand(50,70),rrand(50,70),rrand(70,100)].choose.midicps*alpha.kr(1,0.01,1)}!24;\n Pan2.ar(LeakDC.ar(Normalizer.ar(\n BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(FreeVerb.ar(\n Splay.ar(RLPF.ar(LFSaw.ar(gamma)/4,gamma*LFCub.kr(rrand(0.01,0.1),0,2,3),alpha.kr(1/8,0.6,0.7))) \n ,0.1,0.1,0.1)\n ,100,6.0,6),1000,6.0,0),5000,6.0,0),10000,6.0,6)\n ,(0.8/0.999)*1,0.1)),0)\n};\n\n~a = nil;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// start a server program from the cmdLine for testing\n~pid = unixCmd(Server.program + s.options.asOptionsString(57100));\n// kill just that server program by its pid:\nthisProcess.platform.killProcessByID(~pid;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// start a server program from the cmdLine for testing\n~pid = unixCmd(Server.program + s.options.asOptionsString(57100));\n// kill just that server program by its pid:\nthisProcess.platform.killProcessByID(~pid);\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for change stuff in running Pbind with patternproxies?"}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\clusterboom, {| out = 0, freq=55, dur=1, amp=1|\n Out.ar(\n out,\n Splay.ar({SinOsc.ar(exprand(freq-(freq/128),freq+(freq/128)),0,0.1)}!33)\n * EnvGen.kr(Env.perc,1,1,0,dur,2)\n * amp\n ) \n}).add;\n);\n\n\n(\n~notes = [ 21, 21, 9, 19, 19, 9 ];\n~durs = [ 1/4, 1/4, 1/2, 1/8, 1/8, 14/8 ];\n~amps = [ 4, 4, 0, 3, 3, 0 ];\n\n~notespatternproxy = PatternProxy(Pxrand(~notes,inf)); \n~durspatternproxy = PatternProxy(Pxrand(~durs, inf));\n~ampspatternproxy = PatternProxy(Pxrand(~amps, inf)); \n\np = Pbind(\n \\instrument, \\clusterboom,\n \\midinote, ~notespatternproxy,\n \\dur, ~durspatternproxy,\n 'amp', ~ampspatternproxy, \n);\n);\np.play;\n\n// eval while running:\n\n~notespatternproxy.source = Pxrand(~notes + 7,inf); \n~notespatternproxy.source = Pxrand(union(~notes, ~notes + 7),inf); \n~notespatternproxy.source = Pxrand(~notes,inf);\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for reflection on seasonal change )."}, {"role": "assistant", "content": "```supercollider\n(\n{ \n LPF.ar(\n DynKlank.ar(\n `[[900, 971, 1153, 1823, 1401], nil, [\n SinOsc.kr(0.2).range(0.1,1), \n SinOsc.kr(0.6).range(0.1,1), \n SinOsc.kr(0.8).range(0.1,1), \n SinOsc.kr(1.2).range(0.1,1), \n SinOsc.kr(2).range(0.1,1)]\n ], \n Limiter.ar(Dust.ar(2, 0.65) + Impulse.ar(1,0,0.9))\n )\n ) ! 2 \n}.play;\n{ \n Pan2.ar(\n DynKlank.ar(`[[800, 1071, 1353, 723 + SinOsc.ar(SinOsc.ar(0.2).range(0, 10)).range(0,330)], nil, [1, 1, 0.5, 1]], PinkNoise.ar(0.007)),\n TRand.kr(-1, 1, trig: Pulse.ar(10))\n )\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// crucial-library - sends midi clock and song position pointer\n// x.add( MIDIClockOut(\"IAC Driver\", \"IAC Bus 1\") )\n\nMxUnit.register('MIDIClockOut',\n(\n make: { arg mco;\n ~source = mco;\n MxUnit(mco, [], [])\n },\n spawnToBundle: { arg b;\n b.addFunction({~source.start}.inEnvir)\n },\n stopToBundle: { arg b;\n b.addFunction({~source.stop}.inEnvir)\n }\n /*,\n gotoBeat: { arg beat, atBeat, bundle;\n [beat, atBeat, bundle].debug;\n ~source.gotoBeatAtBeat(beat, atBeat)\n }*/\n\n));\n```"}, {"role": "assistant", "content": "crucial-library - sends midi clock and song position pointer x.add( MIDIClockOut(\"IAC Driver\", \"IAC Bus 1\") )."}]} -{"conversations": [{"role": "user", "content": "Who made you?"}, {"role": "assistant", "content": "I was trained by the person who runs this project, on top of the MiniMind architecture. My weights started from random numbers and learned from the SuperCollider sources — no teacher model, no distillation."}]} -{"conversations": [{"role": "user", "content": "What does `Collection.storeItemsOn` do?"}, {"role": "assistant", "content": "Write a comma separated compilable representation of the items in the collection to a"}]} -{"conversations": [{"role": "user", "content": "What is `LagControl` in SuperCollider?"}, {"role": "assistant", "content": "LagControl — Lagged control input `Control` ugen with fixed-time lags. Category: UGens > Synth control."}]} -{"conversations": [{"role": "user", "content": "What does `Knob.mode` do? What arguments does it take?"}, {"role": "assistant", "content": "The way value is controlled with respect to mouse movement after clicking on the Arguments: One of the symbols listed above.."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BPZ2`."}, {"role": "assistant", "content": "```supercollider\n// Compare:\n\n{ WhiteNoise.ar(0.25) }.play;\n\n{ BPZ2.ar(WhiteNoise.ar(0.25)) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Limiter`."}, {"role": "assistant", "content": "```supercollider\n(\n// example signal to process\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n z * 0.8\n}.play\n);\n\n(\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n [z, Limiter.ar(z, 0.4, 0.01)] * 0.5\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Standard2DL` in SuperCollider?"}, {"role": "assistant", "content": "Standard2DL — standard map 2D chaotic generator `x(n+1) = (x(n) + y(n+1)) % 2pi` Category: UGens > Generators > Stochastic."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// =========================\n// extra demos for \\glockenspiel\n// =========================\n\n(\n// made by Diya Menon\n// demo\nPbindef(\\dmglockenspiel,\n \\instrument, \"glockenspiel\",\n \\midinote, Pseq([\n [65, 68, 72, 75],\n 72, 72, 72, 70, 72, 70, 68,\n [61, 65, 70, 73, 77],\n 73, 73, 73, 72, 72, 70, 68], 2),\n \\amp, Pseq([0.015, 0.005, 0.005, 0.0075, 0.0075, 0.01, 0.01, 0.02], 4) * 3,\n \\dur, Pseq([0.3, 0.3, 0.3, 0.15, 0.15, 0.3, 0.15, 0.15], 4),\n \\rel, 3,\n \\exciterRel, 0.03,\n \\att, 0.0005,\n).play;\n)\n```"}, {"role": "assistant", "content": "========================= extra demos for \\glockenspiel =========================."}]} +{"conversations": [{"role": "user", "content": "What is `FreqScope`?"}, {"role": "assistant", "content": "FreqScope — Frequency spectrum visualizer"}, {"role": "user", "content": "What does `FreqScope.getInstance` do?"}, {"role": "assistant", "content": "Returns the (singleton) instance of the FreqScope."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n// create a new analyzer\nFreqScope.new(400, 200, 0, server: s);\n\n// basic sine\n{ SinOsc.ar(2000, 0, 0.25) }.play(s);\n\n// random saw\n{ RLPF.ar(Saw.ar(110, 0.2), LFNoise2.kr(1, 1e4, 1e4), LFNoise2.kr(1, 0.2, 0.22)) }.play(s);\n\n// modulate phase\n{ SinOsc.ar(800, SinOsc.ar(XLine.kr(20, 8000, 10), 0, 2pi), 0.25) }.play(s);\n\n// all harmonics\n{ Blip.ar(200, Line.kr(1, 100, 10), 0.2) }.play(s);\n\n// access the FreqScopeView object to set properties of the Qt Object:\nFreqScope.getInstance // get the FreqScope instance\n .scope // and its FreqScopeView\n .setProperty(\\updateInterval, 1000)\n // set updateInterval to 1000 ms because of reasons\n```"}]} +{"conversations": [{"role": "user", "content": "What happens when I call .play on a function?"}, {"role": "assistant", "content": "`.play` on a Function builds a SynthDef from the function body, adds it to the server under an anonymous name, and starts one Synth of it. You get back the Synth, so `x = { SinOsc.ar(440) * 0.1 }.play; x.free;` stops it. It is the fastest way to hear something, but it is not how you write a piece: nothing is named, nothing can be reused, and the definition is lost when the Synth is freed."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// First we create something to control\nx = { |freq = 440, amp = 0.6| MoogFF.ar(PinkNoise.ar(amp), freq).dup }.play;\n\n// In the following pattern, the first two keys are the ones that create the monophonic behaviour:\n(\np = Pbind(\n \\type, \\set, // This tells it we'll be setting parameters of an existing node...\n \\id, x.nodeID, // ...this tells it whose parameters we'll be setting\n \\args, #[\\freq, \\amp], // and this tells it which parameters to set\n \\freq, Pwhite(100, 1000),\n \\dur, 0.2,\n \\amp, Pseq((1, 0.99 .. 0.1), inf)\n).play;\n;\n\np.stop\nx.\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// First we create something to control\nx = { |freq = 440, amp = 0.6| MoogFF.ar(PinkNoise.ar(amp), freq).dup }.play;\n\n// In the following pattern, the first two keys are the ones that create the monophonic behaviour:\n(\np = Pbind(\n \\type, \\set, // This tells it we'll be setting parameters of an existing node...\n \\id, x.nodeID, // ...this tells it whose parameters we'll be setting\n \\args, #[\\freq, \\amp], // and this tells it which parameters to set\n \\freq, Pwhite(100, 1000),\n \\dur, 0.2,\n \\amp, Pseq((1, 0.99 .. 0.1), inf)\n).play;\n);\n\np.stop\nx.free\n```"}]} +{"conversations": [{"role": "user", "content": "My sustained synth never stops, even when I set the gate to 0."}, {"role": "assistant", "content": "A sustained EnvGen only releases when the gate goes from positive to non-positive *after* the envelope has started, and the Synth only disappears if that EnvGen has `doneAction: 2`. Check three things: the SynthDef actually takes a `gate = 1` argument, the Env is a sustained shape (Env.adsr or Env.asr, not Env.perc), and you call `x.set(\\gate, 0)` on the Synth object. Setting the gate on a different Synth, or on a Group, does nothing."}]} +{"conversations": [{"role": "user", "content": "What does `Group.freeAll` do?"}, {"role": "assistant", "content": "Free all the nodes in this group, but do not free this group"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `BufCombN` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// These examples compare the variants, so that you can hear the difference in interpolation\n\n// allocate buffer\nb = Buffer.alloc(s, 44100, 1);\n\n// Comb used as a resonator. The resonant fundamental is equal to\n// reciprocal of the delay time.\n{ BufCombN.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ BufCombL.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ BufCombC.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// with negative feedback:\n{ BufCombN.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ BufCombL.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ BufCombC.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n// used as an echo.\n{ BufCombL.ar(b.bufnum, Decay.ar(Dust.ar(1, 0.5), 0.2, WhiteNoise.ar), 0.2, 3) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = {LFTri.ar(100+(1000*Maths.ar(MouseX.kr, MouseY.kr, 0.2, 1-MouseButton.kr(lag:0.001))[0]), 0, 0.1)}.play //notice how I am taking the [0th channel of the Maths and ignoring the other outputs\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = {LFTri.ar(100+(1000*Maths.ar(MouseX.kr, MouseY.kr, 0.2, 1-MouseButton.kr(lag:0.001))[0]), 0, 0.1)}.play //notice how I am taking the [0]th channel of the Maths and ignoring the other outputs\n```"}]} +{"conversations": [{"role": "user", "content": "What does `RedMixGUI.new` do? What arguments does it take?"}, {"role": "assistant", "content": "gui for RedMixMono, RedMixStereo, RedMixStereoMono Arguments: redMix — A red mix object (RedMixMono, RedMixStereo, RedMixStereoMono); parent — A Window, View or `nil`.; position — A Point or `nil`.."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n~inPlaceSub = { |array, find, replace|\n array.do({ |item, i|\n if(item == find) { array[i] = replace };\n });\n};\n\n~trySub = { |array, find, replace|\n try {\n ~inPlaceSub.(array, find, replace)\n } { |error|\n switch(error.species.name)\n { 'PrimitiveFailedError' } {\n if(error.what.find(\"immutable\").notNil) {\n \"caught ImmutableError\".postln;\n ~inPlaceSub.(array.copy, find, replace)\n } { \"unknown primitive exception\".postln; error.throw }\n }\n // default case: unhandled exception, should\n// …\n```"}, {"role": "assistant", "content": "default case: unhandled exception, should die so re-throw error pass in a mutable array, OK (Exception: root error class)"}]} +{"conversations": [{"role": "user", "content": "How should I organise a SuperCollider project on disk?"}, {"role": "assistant", "content": "One folder per piece, with a fixed shape:\n\n```text\nmy-piece/\n synthdefs.scd // only SynthDef(...).add, loaded first\n material.scd // buffers, samples, scales\n piece.scd // the performance: Tdefs, Pbinds, Ndefs\n README.md // tempo, required samples, how to run it\n```\n\nThen the workflow is: open `synthdefs.scd`, Ctrl+A Ctrl+Enter to load it, load `material.scd`, and work in\n`piece.scd`. Keeping definitions out of the performance file is what makes a reboot survivable and a piece\nre-runnable six months later."}]} +{"conversations": [{"role": "user", "content": "What does `Class.dumpInterface` do?"}, {"role": "assistant", "content": "Post all the methods defined in this Class and their arguments."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\"help-PinkNoise\", { |out = 0|\n Out.ar(out,\n PinkNoise.ar(0.4)\n )\n}).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\"help-PinkNoise\", { |out = 0|\n Out.ar(out,\n PinkNoise.ar(0.4)\n )\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `TempoSpec` in SuperCollider?"}, {"role": "assistant", "content": "TempoSpec — datatype specifying a control rate input representing tempo Category: Spec, Libraries > crucial > Spec."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// note that the root pitch is not stored in the Scale (which should arguably be called a Mode for that reason)\n// instead you supply it at play time:\n\n// key of A\nPbind(\n \\degree, Pseq((0..7), inf), // your melody goes here\n \\scale, Scale.major, // your scale goes here\n \\root, -3 // semitones relative to 60.midicps, so this is A\n).play;\n```"}, {"role": "assistant", "content": "note that the root pitch is not stored in the Scale (which should arguably be called a Mode for that reason) instead you supply it at play time: (Scale: represents a musical scale)"}]} +{"conversations": [{"role": "user", "content": "What does `Char.isFileSafe` do?"}, {"role": "assistant", "content": "ASCII character Returns: true if the char is safe for use in a filename. Excludes the path separators / and :"}]} +{"conversations": [{"role": "user", "content": "What is `TZeroXBufRd` in SuperCollider?"}, {"role": "assistant", "content": "TZeroXBufRd — triggers sequences of segments between zero crossings from one or more buffers with demand-rate control TZeroXBufRd is for triggering possibly overlapped segments between zero crossings (half wavesets) from one or more buffers, whereby several reading and processing parameters can be sequenced with demand rate ugens. Full waveset sequences can so be generated as a special case. It needs analysis data prepared with ZeroXBufWr. For consecutive reading of segments between zero crossings see ZeroXBufRd. Category: Libraries > miSCellaneous > ZeroX ugens."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SortedList`."}, {"role": "assistant", "content": "```supercollider\nt = SortedList.new(8, {|a,b| a.first < b.first });\nt.add([10, \"last\"]);\nt.add([1, \"first\"]);\nt.postln;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PulseCount`."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\"help-PulseCount\", { |out = 0|\n Out.ar(out,\n SinOsc.ar(\n PulseCount.ar(Impulse.ar(10), Impulse.ar(0.4)) * 200,\n 0, 0.05\n )\n )\n}).play;\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `IEnvGen`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var env = Env([0, 0.6, 0.3, 1.0, 0], [0.1, 0.02, 0.4, 1.1], [\\lin, \\exp, -6, \\sin]);\n var envgen = IEnvGen.kr(env, MouseX.kr(0, env.times.sum));\n env.plot;\n SinOsc.ar(envgen * 500 + 440)\n}.play;\n);\n\n// index with an SinOsc ... mouse controls amplitude of SinOsc\n// use offset so negative values of SinOsc will map into the Env\n(\n{\n var sin = SinOsc.ar(440, 0, MouseX.kr(0, 1));\n // use offset so negative values of SinOsc will map into the Env\n var env = Env([-1, -0.7, 0.7, 1], [0.8666, 0.2666, 0.8668], \\lin, offset: -1.0);\n IEnvGen.ar(env, sin) * 0.1\n}.play;\n);\n\n// index with Amplitude of input, control freq of SinOsc (uses SoundIn)\n(\n{\n var point = Amplitude.ar(SoundIn.ar(0), 0.01, 0.2);\n // use offset so negative values of SinOsc will map into the Env\n var env = Env.xyc([[0, 330, \\exp], [0.5, 440, \\exp], [1.0, 1760]]);\n SinOsc.ar(IEnvGen.kr(env, point)) * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Why LeakDC and not a standard HPF for DC removal?"}, {"role": "assistant", "content": "SuperCollider forum — Why LeakDC and not a standard HPF for DC removal?\n\nHello everyone,\n\nI’m a bit sceptical of the DC removal implementation in LeakDC. As I understand it, DC removal is nothing but a HPF, preferably placed below the audible range. For this purpose, LeakDC seems to be reaching far too high, attenuating the audible low frequencies. You can run the following code and look at the server meter to see the difference in level between the two audio channels (note: there is of course no DC offset in this example that would need fixing):\n\n```supercollider\n( play { [\n SinOsc.ar(50),\n LeakDC.ar(SinOsc.ar(50))\n] * 0.2 } )\n```\n\nAlso, LeakDC’s behaviour is not consistent between sample rates (as is mentioned in the help file).\n\nI ran the it through Plugin Doctor to back up my suspicions and got these results:\n\nstandard coefficient of 0.995:\n\nSR 48 kHz: Filter starts rolling off at 200 Hz, -2dB at 50 Hz.\n\nSR 96 kHz: Filter starts rolling off at 500 hz! It reaches already -2dB at 100 Hz, -5 dB at 50 Hz.\n\ncoefficient of 0.999:\n\nSR 48 kHz: Filter starts rolling off at 50 Hz, -2 dB at 10 Hz.\n\nSR 96 kHz: Filter starts rolling off at 100 Hz, -2 dB at 20 Hz.\n\nI wonder why one wouldn’t just use a standard HPF at 10 Hz (or so) instead? It is consistent between sample rates, it only starts to roll of below 30 Hz and it reaches only -0.5 dB at 20 Hz. So this actually looks much better in the server meter:\n\n```supercollider\n( play { [\n SinOsc.ar(50),\n HPF.ar(SinOsc.ar(50), 10)\n] * 0.2 } )\n```\n\nSo my question is: Is there any reason why the LeakDC implementation would be peferable to such a standard butterworth HPF?\n\nOne difference I can see is that the HPF still has an initial offset spike before settling around zero phase, LeakDC does not show that behaviour:\n\n```supercollider\n{ LeakDC.ar(DC.ar(0.5)) }.plot(0.5);\n{ HPF.ar(DC.ar(0.5), 10) }.plot(0.5);\n\n{ LeakDC.ar(SinOsc.ar + DC.ar(0.5)) }.plot(0.02);\n{ HPF.ar(SinOsc.ar + DC.ar(0.5), 10) }.plot(0.02);\n```\n\nSo this could be a reason – I don’t know enough about filters to understand why this happens though. Any enlightenment would be appreciated."}]} +{"conversations": [{"role": "user", "content": "I get 'Node not found' when I call .set on a Synth after a while."}, {"role": "assistant", "content": "The Synth was freed and the language still holds a reference. That happens whenever the SynthDef used `doneAction: 2` and the envelope finished, or when something called `freeAll`/`CmdPeriod`. Guard it with `if (x.notNil and: { x.isPlaying }) { x.set(\\freq, 300) }`, or store the node in a variable that you clear when it ends. For sustained sounds the right pattern is a `gate` argument with `doneAction: 2` on the EnvGen, so the node lives until you release it."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = [1, 2, 3]\na.foldAt(2) // same as at\na.foldAt(3) // folds back\na.foldAt([-1, 3, 1]) // array of indices\na@|@3 //syntactic shortcut\n\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n 32.do{ |i|\n {\n var freq = pitches.foldAt(i).midicps;\n var env = Env.perc.ar(Done.freeSelf);\n SinOsc.ar(freq) * 0.1 * env\n }.play;\n 0.2.wait\n }\n}\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = [1, 2, 3]\na.foldAt(2) // same as at\na.foldAt(3) // folds back\na.foldAt([-1, 3, 1]) // array of indices\na@|@3 //syntactic shortcut\n\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n 32.do{ |i|\n {\n var freq = pitches.foldAt(i).midicps;\n var env = Env.perc.ar(Done.freeSelf);\n SinOsc.ar(freq) * 0.1 * env\n }.play;\n 0.2.wait\n }\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `String.load` do?"}, {"role": "assistant", "content": "Load and Interpreter#-executeFile#execute the file at the path represented by the receiver, and (optionally) pass positional and keyword arguments to the"}]} {"conversations": [{"role": "user", "content": "What does `EventShortcuts.copyDict` do? What arguments does it take?"}, {"role": "assistant", "content": "Returns a copy of a shortcut dictionary of that name (if Arguments: name — Symbol or String.."}]} -{"conversations": [{"role": "user", "content": "What does `ControlPrototypes.firstAt` do? What arguments does it take?"}, {"role": "assistant", "content": "creates default objects for Spec / argName combinations Arguments: argName; spec."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for first step?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n\nz = ( ( SinOsc.ar( ((LFSaw.kr(-0.05,1) +1) *100 + 20 ), LFTri.kr(40,0,1), LFSaw.kr(1.5) ) \n * LFTri.kr(rrand(0.005,0.03),3.99.rand,0.2) ) + \n( LFPulse.ar(60,0,0.5,Pulse.ar(0.5,0.5,0.1)) * LFTri.kr(rrand(0.005,0.03),3.99.rand,0.5) ) +\n( SinOsc.ar(65,0,LFPulse.kr(0.66666,0.5,0.3)*0.3) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) )+\n( LFPar.ar(120,0,LFPulse.kr(0.5,0.5,0.2)*0.3) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( LFCub.ar(185,0,LFPulse.kr(0.5,0.74,0.2)*0.3) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( SinOsc.ar(365,0,LFPulse.kr(1.33333333,0,0.1)*0.3) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( FreeVerb.ar(LFTri.ar(260,0,LFPulse.kr(0.5,0.25,0.01)*0.3),0.5,0.8,0.1) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( SinOsc.ar(800,0,LFPulse.kr(2,0,0.1)*0.1) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( LFPar.ar(820,0,LFPulse.kr(1.666666,0,0.1)*0.1) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( WhiteNoise.ar( LFPulse.kr(2,0.5,0.001,1) )/2 * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( WhiteNoise.ar( LFPulse.kr(1,0.5,0.001,1) )/2 * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( WhiteNoise.ar( LFPulse.kr(1.666666,0.5,0.001,1) )/4 * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( WhiteNoise.ar( LFPulse.kr(1.333333,0.5,0.001,1) )/4 * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) );\n\nFreeVerb.ar(\n ((CombC.ar(\n DelayN.ar(\n DelayN.ar(z, 0.5, [0.5,0.75], 1, z), \n 0.5, 0.5, 1, z), \n 0.1, LFNoise0.kr(1,0.05,0.001).abs, 2, z))+z),\n0.1,1,0.1); \n\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes THX Deep Note inspired synth sketch."}, {"role": "assistant", "content": "```supercollider\n// A. Broz: Deep Choir (v2, 2020-10-29)\n(\n~numVoices = 30;\n\n~chaos = { |range = 1.0|\n ~numVoices collect: { exprand(180 / range, 260 * range) }\n};\n\n~bigChord = { |fund = 30, harmonics = 5|\n ~numVoices collect: {\n fund\n * rrand(1, harmonics) // build chord\n * rrand(1, 2) * rrand(1, 2) // octaves\n + rrand(-1.2, 1.2) // beats\n }\n};\n\n// Try with Pmono\nSynthDef(\\fakeTHX, {\n var env = EnvGen.kr(\n envelope: Env.adsr(15, \\decay.kr(10), 1, 10, curve: \\sine),\n gate: \\gate.kr(1),\n doneAction: Done.freeSelf,\n );\n var chord = \\freq.kr(~chaos.value, \\lag.kr(10));\n var meander = \\meander.kr(0.3, 8);\n var sig = chord collect: { |f|\n f = f * LFNoise2.kr(rrand(0.3, 0.8)).exprange(1 - meander, 1 + meander);\n BLowPass.ar(Saw.ar(f), f, 0.6);\n };\n sig = Splay.ar(sig, 0.8) * env * \\mul.kr(0.5, 3);\n Out.ar(0, sig);\n}).add;\n);\n\n(\nRoutine({\n var fakeTHX = Synth(\\fakeTHX);\n\n 10.wait;\n\n fakeTHX.set(\\meander, 0);\n\n fakeTHX.set(\\freq, ~bigChord.(30, 5));\n\n 10.wait;\n\n fakeTHX.set(\\gate, 0);\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// playing two interval lines in parallel\n\n(\n~a = Pseq([4, 2, 0]) + [0, -5];\n~b = Pseq([7, 5, 4]) + [0, 5];\n \np = Pbind(\n \\dur, Pseq([0.4, 0.2, 0.2], inf),\n \\note, PLn(\\a)\n);\n \nq = Pbindf(p, \\note, PLn(\\b));\n\nx = Ppar([p, q]).play; \n);\n\n \n\n// replace the lower event stream, new notes start after end of embedding Pseq\n \n~a = Pseq([3, 2, 0]) + [0, -5];\n\n\n// replace second line\n\n~b = Pseq([7, 5, 4]) + [5, 12];\n\n\n// source nil stops event\n// …\n```"}, {"role": "assistant", "content": "playing two interval lines in parallel replace the lower event stream, new notes start after end of embedding Pseq (PLn: dynamic scope placeholder pattern whose streams will be finished before replacements)"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `PdurStutter`."}, {"role": "assistant", "content": "```supercollider\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,4,4,0,4,4], inf),\n Pseq((80 + [0, 2, 3, 5, 7, 9, 10]).midicps, inf)\n);\nx = a.asStream;\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, x.next.postln]);\n 0.25.wait\n })\n}).play(TempoClock.default);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "How do I make this brighter?\n```supercollider\n{ LPF.ar(Saw.ar(110), 400) * 0.2 }.play;\n```"}, {"role": "assistant", "content": "Raise the cutoff. 400 Hz is well below the harmonics that carry brightness, so open it to 2000-4000 Hz:\n\n```supercollider\n{ LPF.ar(Saw.ar(110), 3000) * 0.2 }.play;\n```"}, {"role": "user", "content": "Still dull."}, {"role": "assistant", "content": "Then the low-pass is not the limit — the source is. A saw at 110 Hz has energy up to Nyquist, so check the amplitude: at 0.2 the high harmonics are quiet. Two moves: add resonance so the filter peak is audible, and raise the level slightly.\n\n```supercollider\n{ RLPF.ar(Saw.ar(110), 2500, 0.3) * 0.35 }.play;\n```\n\nIf that is still dull, the answer is a different source: `Saw` is band-limited and soft; try `LFSaw` or add a second detuned saw for more high content."}]} -{"conversations": [{"role": "user", "content": "What does `Tempo.default` do?"}, {"role": "assistant", "content": "for control of tempo and for use in tempo based calculations"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// preserve only 3 bits of mantissa.\n{ MantissaMask.ar(SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4), 3) }.play\n\n// the original\n{ SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4) }.play\n\n// the difference.\n(\n{\n var in;\n in = SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4);\n in - MantissaMask.ar(in, 3)\n}.play\n)\n\n\n// preserve 7 bits of mantissa.\n// This makes the lower 16 bits of the floating point number become zero.\n{ MantissaMask.ar(SinOsc.ar(SinO\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// preserve only 3 bits of mantissa.\n{ MantissaMask.ar(SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4), 3) }.play\n\n// the original\n{ SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4) }.play\n\n// the difference.\n(\n{\n var in;\n in = SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4);\n in - MantissaMask.ar(in, 3)\n}.play\n)\n\n\n// preserve 7 bits of mantissa.\n// This makes the lower 16 bits of the floating point number become zero.\n{ MantissaMask.ar(SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4), 7) }.play\n\n// the original\n{ SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4) }.play\n\n// the difference.\n(\n{\n var in;\n in = SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4);\n in - MantissaMask.ar(in, 7)\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `FancySlider.knobColor` do?"}, {"role": "assistant", "content": "An efficient Slider which substitutes a user view for a slider"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for aurora borealis?"}, {"role": "assistant", "content": "```supercollider\n(\n~root = -13;\n~revSend = Bus.audio(s, 2);\n);\n(\ns.waitForBoot(\n {\n \n SynthDef(\\bell, {\n |\n freq=556, findex=0, frate=2,\n dur=5, pos=0,\n amp=0.25,\n out=0\n |\n var sigA, sigB, sigC, sig, env, fmod;\n env = EnvGen.ar(Env.triangle(5), doneAction:2);\n fmod = findex * SinOsc.kr(frate, mul:0.5, add:0.5) * Line.kr(0, 1, 7);\n sigA = Pulse.ar(freq + fmod, LFNoise2.kr(1).range(0.2, 0.8) );\n sigB = VarSaw.ar(freq + fmod);\n sigC = WhiteNoise.ar() * 0.125;\n sig = SelectX.ar(LFNoise2.kr(2).range(0, 2), [sigA, sigB, sigC]);\n sig = LPF.ar(sig, freq*4 );\n sig = sig * env * amp;\n Out.ar(out, Pan2.ar(sig, pos));\n }).add;\n\n s.sync;\n\n SynthDef(\\rev, {\n arg in=0, out=0, mix=1, room=0.8;\n var sig;\n sig = In.ar(in, 2);\n sig = FreeVerb.ar(sig, mix, room);\n Out.ar(out, sig);\n }).add;\n\n s.sync;\n\n ~rev = Synth(\\rev, [\\in, ~revSend]);\n\n x = Pbind(\n \\instrument, \\bell,\n \\out, ~revSend,\n \\root, Pfunc({~root}),\n \\octave, Pwrand([4, 5, 6, 7], [6,8,3,1].normalizeSum, inf),\n \\degree, Prand(Scale.lydian.degrees, inf),\n \\ctranspose, Pwhite( -0.05, 0.05, inf),\n \\amp, 1.1 * Pexprand(0.001, 0.7) * (1/(Pkey(\\octave)+1)),\n \\findex, Pexprand(2, 20),\n \\frate, Pwhite(1, 25, inf),\n \\pos, Pwhite(-0.8, 0.8, inf),\n \\dur, Pwhite(0.1, 0.5),\n ).asEventStreamPlayer;\n x.play;\n\n wait(15);\n r = Routine({\n \"starting\".postln;\n loop({\n ~root = [-13, -1, 4, 7].choose;\n wait( 10.rrand(25) );\n });\n });\n r.play;\n});\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nSynthDef(\\imp, { OffsetOut.ar(0, Impulse.ar(0)); FreeSelf.kr(Impulse.kr(0)) }).add;\nfork { (1 / (1..60).scramble).do { |dt| Synth.grain(\\imp; dt.wait } };\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nSynthDef(\\imp, { OffsetOut.ar(0, Impulse.ar(0)); FreeSelf.kr(Impulse.kr(0)) }).add;\nfork { (1 / (1..60).scramble).do { |dt| Synth.grain(\\imp); dt.wait } };\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Integer.isInteger` do?"}, {"role": "assistant", "content": "32-bit Integer number Returns: true (the receiver is an integer)."}]} -{"conversations": [{"role": "user", "content": "What does `EnvSpec.defaultControl` do? What arguments does it take?"}, {"role": "assistant", "content": "datatype specifying an Env Arguments: env."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for distobass (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\\bass, { arg out=0, amp=0.1, gate=1, pan=0, spread=0.8, freq=200, doneAction=2;\n var sig, sig1, sig2, sig3;\n freq = SinOsc.ar(freq*\\fmfreq.kr(1).lag(0.3)) * \\fmrange.kr(0.5).lag(0.3) * LFNoise1.kr(1/7).range(0.9,1.1) + 1 * freq;\n sig = SinOsc.ar(freq.lag(0.1) * [1,8,2,4,1.002]);\n sig1 = LFPulse.ar(freq * [1,4,1.001,2 * LFNoise1.kr(1/10).range(0.999,1.001),1/2], mul:1.00);\n sig = sig + sig1;\n sig = sig.fold2(SinOsc.kr(1/13).range(0.9,1));\n sig = sig.wrap2(SinOsc.kr(1/14).range(0.9,1));\n sig = RLPF.ar(sig, \\lpf.kr(500).lag(0.4) * LFNoise1.kr(1/9).range(0.9,1.1), \\rq.kr(0.5));\n sig = HPF.ar(sig, \\hpf.kr(40));\n sig = sig * EnvGen.ar(\\iadsr.kr(Env.adsr(0.01,0.1,0.8,0.1)),\\igate.kr(1),doneAction:0);\n sig = sig * EnvGen.ar(\\adsr.kr(Env.adsr(0.01,0.1,0.8,0.1)),gate,doneAction:doneAction);\n sig = Splay.ar(sig, spread, amp, pan);\n Out.ar(out, sig);\n}).add;\n\n(\nPdef(\\bass, Pmono(\\bass,\n \\freq, 70 * Pseq([0,1].midiratio,inf).stutter(16) * Pseq([1,2],inf).stutter(64),\n \\fmrange, Pseq([0.5,1,1.5],inf),\n \\fmfreq, Pseq([0.5,1,2,4],inf),\n \\dur, 1/4,\n \\igate, Pseq([\n 1,0,0,0,\n 0,0,0,0,\n ],inf),\n \\iadsr, Pseq([\n [ Env.adsr(0.1,0.1,0.8,4.1) ],\n ],inf),\n \\lpf, Pkey(\\freq) * Pseq([\n 2,1,4,8,\n 2,1,4,8,\n 2,1,4,8,\n 4,2,2,4,\n ],inf).stutter(8),\n \\hpf, Pkey(\\freq) / 2,\n\n \\amp, Pkey(\\amp) * 2,\n \\isRest, false,\n));\nPdef(\\bass).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// Here we start with initOutOffset = 0.5, fadeMode = 1 (step first),\n// channels with indices 0 and 4 (base tone and 5th partial) are equally weighted.\n\n(\nx = {\n var lfo = XLine.ar(1, 0.5, 60);\n DXMix.ar(\n Dseq([0, 4, 1, 5, 2, 6, 3, 7], inf),\n `(Saw.ar((1..8) * 70 * lfo, 0.075)),\n fadeTime: 0.1,\n stepTime: 2,\n fadeMode: 1,\n width: 3,\n maxWidth: 8,\n initOutOffset: 0.5\n ) ! 2\n}.play\n);\n\nx.release\n\n\n// overlap scheme with width = 3 and initOutOffset = 0.5:\n```"}, {"role": "assistant", "content": "Here we start with initOutOffset = 0.5, fadeMode = 1 (step first), channels with indices 0 and 4 (base tone and 5th partial) are equally weighted. (DXMix: crossfades between signals according to demand-rate control)"}]} -{"conversations": [{"role": "user", "content": "What is `Fb1` in SuperCollider?"}, {"role": "assistant", "content": "Fb1 — single sample feedback / feedforward pseudo ugen Fb1 provides an interface for single sample feedback and feedforward at audio and control rate, the defining relation with (formal) access to previous samples is passed as a Function, which might involve additional UGens. Fb1.ar works with arbitrary blockSizes and also allows to refer to samples earlier than one blockSize before. This includes linear filter definitions of arbitrary length with dyn Category: Libraries > miSCellaneous > Nonlinear."}]} -{"conversations": [{"role": "user", "content": "What is `Delay2` in SuperCollider?"}, {"role": "assistant", "content": "Delay2 — Two sample delay. Delays the input by two samples. Category: UGens > Delays."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Read a sound file from disk into a buffer\ns.boot;\n// ExampleFiles helps locate audio files used in examples\np = ExampleFiles.child;\n// peek at the path to see location and the format of a path\np.postln;\n// read the file\nb = Buffer.read(s, p);\n\n// now play it\n(\nx = SynthDef(\\help_Buffer, { |out = 0, bufnum|\n Out.ar(out,\n PlayBuf.ar(1, bufnum, BufRateScale.kr(bufnum))\n )\n}).play(s, [\\bufnum, b]);\n);\nx.free; b.free;\n\n// with an action function\n// note that the vars are not immediately up-to-date\n(\nb\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Read a sound file from disk into a buffer\ns.boot;\n// ExampleFiles helps locate audio files used in examples\np = ExampleFiles.child;\n// peek at the path to see location and the format of a path\np.postln;\n// read the file\nb = Buffer.read(s, p);\n\n// now play it\n(\nx = SynthDef(\\help_Buffer, { |out = 0, bufnum|\n Out.ar(out,\n PlayBuf.ar(1, bufnum, BufRateScale.kr(bufnum))\n )\n}).play(s, [\\bufnum, b]);\n);\nx.free; b.free;\n\n// with an action function\n// note that the vars are not immediately up-to-date\n(\nb = Buffer.read(s, p, action: { |buffer|\n (\"After update:\" + buffer.numFrames).postln;\n x = { PlayBuf.ar(1, buffer, BufRateScale.kr(buffer)) }.play;\n});\n(\"Before update:\" + b.numFrames).postln;\n);\nx.free; b.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `FoaSpeakerMatrix.numChannels` do?"}, {"role": "assistant", "content": "Answers the number of loudspeaker feeds (output"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Listening to CC messages."}, {"role": "assistant", "content": "```supercollider\n// connect will connect to all midi in devices\n// if you need to specify one,\n// check the sources at: MIDIClient.sources\n// and connect using MIDIIn.connect( source_index )\nMIDIIn.connect;\n\n// show incoming control data\n~control = { arg src, chan, num, val; \n [chan,num,val].postln; \n};\n\nMIDIIn.addFuncTo(\\control, ~control);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LocalBuf`."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\\bigLocalBuf, {\n LocalBuf(88200).set(Array.fill(88200, { #[0, 0.25, 0.5, 0.75, 1.0].choose }))\n}).add;\n\nSynthDescLib.at(\\bigLocalBuf).constants;\n// prints: FloatArray[1, 88200, 0, 0.75, 0.5, 0.25]\n```"}]} -{"conversations": [{"role": "user", "content": "What is `PRunningMin` in SuperCollider?"}, {"role": "assistant", "content": "PRunningMin — UGenPatterns quark library Based on RunningMin Category: Streams-Patterns-Events > UGenPatterns > Modifiers."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Very artificial example - just filtering some noise.\ns.boot;\nb = Buffer.alloc(s,2048,1);\n(\nx = {\nvar in, chain, freq, val;\nfreq = MouseX.kr(20000, 1000, 1);\nin = LPF.ar(WhiteNoise.ar, freq);\nchain = FFT(b.bufnum, in);\n\nval = FFTSlope.kr(chain);\n\nOut.ar(0, in.dup * 0.1);\n(val * 10000).poll(10); // Poll but scaled so more readable!\n}.play(s);\n;\nx.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Very artificial example - just filtering some noise.\ns.boot;\nb = Buffer.alloc(s,2048,1);\n(\nx = {\nvar in, chain, freq, val;\nfreq = MouseX.kr(20000, 1000, 1);\nin = LPF.ar(WhiteNoise.ar, freq);\nchain = FFT(b.bufnum, in);\n\nval = FFTSlope.kr(chain);\n\nOut.ar(0, in.dup * 0.1);\n(val * 10000).poll(10); // Poll but scaled so more readable!\n}.play(s);\n);\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(//*********PREPARE**********\np.pop;\n//Any code that needs to access your own environment goes here\np = ProxySpace.push(s);\n~fxLoop.play.fadeTime_(5);\n);\n\n(//*********FXLoop**********\n~fxLoop = {\n var in = SoundIn.ar([0,1]);\n in;\n}\n)\n```"}, {"role": "assistant", "content": "Code for using Supercollider as a realtime livecode FX processor for audio input. Blog post explaing this code: http://schemawound.com/post/53528545022/fxloop."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Variations for Z1 sawtooth."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var mod = SinOsc.ar([0.1,0.15,0.2]).range(0,1);\n var saw = LFSaw.ar([10,12,15]);\n var out = (saw - ((saw>0)*mod)+(mod*0.5));\n Splay.ar(out)*0.4;\n}.play;\n\n{\n var mod = SinOsc.ar([0.1,0.15,0.2]).range(0,1);\n var saw = SinOsc.ar(LFSaw.ar([10,12,15]).range(200,300));\n var out = (saw - ((saw>0)*mod)+(mod*0.5));\n Splay.ar(out)*0.4;\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// a Buffer for the UGens to use\nb = Buffer.alloc(s, 44100, 1);\n\n// write a signal into a delay, tap it at multiple times\nSynthDef(\\write, { |buffer, cout|\n var src, tapPhase, tap1, tap2, tap3;\n src = WhiteNoise.ar(0.2) * Decay.kr(Dust.kr(3), 0.7);\n tapPhase = DelTapWr.ar(buffer, src);\n Out.kr(cout, tapPhase);\n }).add;\n\nSynthDef(\\readFilt, { |out, buffer, cin|\n var phase, src, filt;\n phase = In.kr(cin);\n src = DelTapRd\n// …\n```"}, {"role": "assistant", "content": "a Buffer for the UGens to use write a signal into a delay, tap it at multiple times (DelTapWr: Write to a buffer for a DelTapRd UGen)"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for piece i'm working on for a dance performance."}, {"role": "assistant", "content": "```supercollider\n( // 'random' sequences of rhythms, reverb,...\nz = {\n var trig, seq;\n trig = Impulse.kr(6);\n seq = Drand([\n Dseq([4,0,0,1,Drand([1,4]),1,0,1]),\n Dseq([1,0,2,0,Drand([0,1,4]),0,1,1]),\n Dseq([4,0,0,2,Drand([1,2,4]),0,1,1]),\n Dseq([4,0,1,2,Drand([0,1,4]),1,2,0]),\n Dseq([1,1,4,1,Drand([1,4]),2,3,3]),\n Dseq([4,1,0,1,Drand([0,4]),1,0,1])\n ], inf);\n\n g = HenonN.ar(\n [120,120],\n LFNoise2.kr(1, 0.2, 1.2),\n LFNoise2.kr(1, 0.15, 0.15)\n )\n * 0.2\n + SinOsc.ar([61,40], mul:0.7)\n\n // add lovely chaos noise (taken from documentation example)\n + {\n LatoocarfianC.ar(\n SampleRate.ir/4,\n LFNoise2.kr(2,1.5,1.5),\n LFNoise2.kr(2,1.5,1.5),\n LFNoise2.kr(2,0.5,1.5),\n LFNoise2.kr(2,0.5,1.5)\n ) * 0.1 // volume\n }\n +\n { FBSineN.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(1, 32, 33),\n LFNoise2.kr(1, 0.5),\n LFNoise2.kr(1, 0.05, 1.05),\n LFNoise2.kr(1, 0.3, 0.3)\n ) * 0.2 * SinOsc.kr(0.01) }\n ;\n\n trig = Demand.kr(trig, 0, seq * 0.2) * trig;\n { MoogFF.ar(\n g,\n SinOsc.kr(0.1,0,1,1) * 1000 + 3000)}.dup\n * Decay.kr(trig, Demand.kr(trig,0,Drand([1,2,4,6], inf)*0.1)) // envelope\n ;\n};\n\n{\n GVerb.ar(\n in: EnvGen.kr(Env.linen(20, 240, 40, 0.6, \\sine)) * z * 0.9,\n roomsize: 30,\n revtime: 4, // SinOsc.kr(0.1,0,4,4.1),\n damping:0.4, // SinOsc.kr(0.12,0,0.4,0.5),\n inputbw:1,\n spread:15,\n drylevel:SinOsc.kr(0.02,0,0.5,0.5),\n earlyreflevel:SinOsc.kr(0.01,0,0.5,0.5),\n taillevel:SinOsc.kr(0.02,pi,0.05,0.05)\n );\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "I get 'FAILURE IN SERVER /s_new SynthDef not found'. What is wrong?"}, {"role": "assistant", "content": "The server does not know that SynthDef. Three usual causes, in order of likelihood:\n\n1. **The SynthDef was added before the server booted.** `SynthDef(...).add` is asynchronous; wrap the work\n in `s.waitForBoot { ... }` or put `s.sync` after `.add`.\n2. **The name does not match.** `SynthDef(\\bell, ...)` is played by `Synth(\\bell)`, not `\\Bell` — symbols\n are case-sensitive.\n3. **`.add` was never called.** Writing `SynthDef(\\bell, { ... })` without `.add` builds the definition in\n the language and sends nothing.\n\nCheck with `SynthDescLib.global.dict.keys` — if the name is not there, it never reached the server."}]} -{"conversations": [{"role": "user", "content": "Saving \"Presets\"?"}, {"role": "assistant", "content": "SuperCollider forum — Saving \"Presets\"?\n\nIf you don’t care too much about it being human readable, just use writeArchive and readArchive:\n\n```supercollider\na = Array.fill(400, {rrand(0,2200)});\n\na.writeArchive(\"/Users/spluta1/Documents/SC/test\");\n\nb = Object.readArchive(\"/Users/spluta1/Documents/SC/test\");\n\nb.postln;\n```\n\nSam"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for muffled thump?"}, {"role": "assistant", "content": "```supercollider\n(\n{ var nse, env, kic;\n kic = tanh(Ringz.ar(LPF.ar(Trig.ar(Impulse.ar(1.0),SampleDur.ir),1000),30,0.25,7).sin*2);\n env = Env.perc(0.05, 1, 1, -4);\n nse = BrownNoise.ar(2) + PinkNoise.ar(0.5) * EnvGen.kr(env,Impulse.kr(1), doneAction: 2);\n\n nse = Mix.ar(BPF.ar(nse,[100,1200,80,40,20],MouseX.kr(0,1),[1,0.2,1,1,1]));\n nse = LPF.ar(nse + kic, MouseY.kr(100,1000))! 2\n\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n var gspring;\n gspring = { |freq|\n var delay, sinc, env, line, impul;\n\n delay = freq.reciprocal;\n impul = Impulse.ar(0);\n env = Env.perc(0.001, 0.01).ar;\n line = Line.ar(1000, 50, 0.01 );\n sinc = SinOsc.ar(line);\n\n Pluck.ar( sinc * env, impul, delay, delay, 5, 0.5);\n };\n\n\nSynthDef.new('eguitar',\n { arg amp=1, freq=150, out_bus=0, pan=0;\n\n var snd;\n\n snd = gspring.value(freq-50) +\n gspring.value(freq) +\n gspring.value(freq+50);\n\n snd = (snd * 32.dbamp).tanh;\n snd = RLPF.ar(snd, 2800+freq, 0.5);\n snd = (snd * 32.dbamp).tanh;\n snd = RLPF.ar(snd, 300+freq, 0.5);\n snd = (snd * 32.dbamp).tanh;\n\n snd * -20.dbamp;\n\n Out.ar(out_bus, snd );\n}).add\n);\n\nSynth('eguitar', [freq: 360]);\n```"}, {"role": "assistant", "content": "just a very limited attempt for reference purpose of a hoped for eguitar synth ´\r\nbased on https://sccode.org/1-5aC#c982."}]} -{"conversations": [{"role": "user", "content": "What is `ProxySpace`?"}, {"role": "assistant", "content": "ProxySpace — an environment of references on a server"}, {"role": "user", "content": "What does `ProxySpace.push` do?"}, {"role": "assistant", "content": "replace the currentEnvironment with a new ProxySpace and clear the current one, if it is a ProxySpace (this is to avoid piling up proxy spaces). In order to move to another ProxySpace while keeping the current, use pop and then push a new one. To have multiple levels of proxy spaces, use .new.push;"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\np = ProxySpace.new;\np.fadeTime = 2; // fadeTime specifies crossfade\np[\\out].play; // monitor an empty placeholder through hardware output\n// set its source\np[\\out] = { SinOsc.ar([350, 351.3], 0, 0.2) };\np[\\out] = { Pulse.ar([350, 351.3] / 4, 0.4) * 0.2 };\np[\\out] = Pbind(\\dur, 0.03, \\freq, Pbrown(0, 1, 0.1, inf).linexp(0, 1, 200, 350));\n\n// route one proxy through another:\np[\\out] = { Ringz.ar(p[\\in].ar, [350, 351.3] * 8, 0.2) * 4 };\np[\\in] = { Impulse.ar([5, 7]/2, [0, 0.5]) };\n\np.clear(3); // clear after 3 seconds\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n \n// definition for future reference in arbitrary Environments\n\np = PLmeanrand(\\lo, \\hi);\n\n\n// prepare current Environment\n// PLseq repeats arg defaults to inf\n\n(\n~lo = PLseq((60, 60.25..70));\n~hi = PLseq((70, 69.75..60));\n);\n\n\n// run\n\n(\nx = Pbind(\n \\midinote, Ptuple([p, 65]), \n \\amp, [0.1, 0.06], \n \\dur, 0.1\n).play;\n);\n\n\n// replace\n\n(\n~lo = 60.5;\n~hi = 61;\n);\n\nx.st\n// …\n```"}, {"role": "assistant", "content": "definition for future reference in arbitrary Environments prepare current Environment (PLmeanrand: dynamic scope Pmeanrand variant)"}]} -{"conversations": [{"role": "user", "content": "What does `Document.dir` do? What arguments does it take?"}, {"role": "assistant", "content": "Get/set the default document directory. The default is dependent on Arguments: path — The file system path to the directory. An instance of String.."}]} -{"conversations": [{"role": "user", "content": "Are you an AI?"}, {"role": "assistant", "content": "Yes. I am a small language model specialised in SuperCollider. I generate text; I cannot hear audio, run sclang, or check whether a patch sounds the way you want."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `COsc`."}, {"role": "assistant", "content": "```supercollider\n(\nb = Buffer.alloc(s, 512, 1, { |buf| buf.sine1Msg(1.0/[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) });\n{ COsc.ar(b.bufnum, 200, 0.7, 0.25) }.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ProxySynthDef`."}, {"role": "assistant", "content": "```supercollider\na = ProxySynthDef(\"xtest\", { SinOsc.ar(400) * 0.1 });\n\na.add;\n\nx = Synth(\"xtest\");\nx.release;\n\n\n/*\n\n if the resulting number of channels is larger than a given channelConstraint,\n it behaves according to the rate: audio rate signals are wrapped around\n a smaller channel size, control rate signals are not (the exceeding channels are left out)\n\n*/\n```"}]} -{"conversations": [{"role": "user", "content": "What is `TRand` in SuperCollider?"}, {"role": "assistant", "content": "TRand — Triggered random number generator. Generates a random float value in uniform distribution from `lo` to `hi` each time the trigger signal changes from nonpositive to positive values. Category: UGens > Random, UGens > Triggers."}]} -{"conversations": [{"role": "user", "content": "What are the arguments of EnvGen?"}, {"role": "assistant", "content": "`EnvGen.ar(envelope, gate, levelScale, levelBias, timeScale, doneAction)` — or the .kr form. Envelope is an Env; gate is the signal that holds the envelope open (a number for a one-shot, a trigger or gate control for a sustained sound); levelScale and levelBias scale and offset the output; timeScale stretches durations. Use `doneAction: 2` on a one-shot so the Synth frees itself."}]} -{"conversations": [{"role": "user", "content": "Explain `Latency` in SuperCollider briefly."}, {"role": "assistant", "content": "Latency — Measure audio latency for multiple channels Latency is the time delay between when one initiates something and when it happens. There are several places in the SC architecture where latencies occur: Category: Utilities."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PeakFollower`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n// no decay\n(\n{\n SinOsc.ar(\n PeakFollower.ar(Dust.ar(20, Line.kr(0, 1, 4)), 1.0) * 1500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// a little decay\n(\n{\n SinOsc.ar(\n PeakFollower.ar(Dust.ar(20, Line.kr(0, 1, 4)), 0.999) * 1500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// mouse x controls decay, center of the\n(\n{\n var decay;\n decay = MouseX.kr(0.99, 1.00001).min(1.0);\n SinOsc.ar(\n PeakFollower.ar(Dust.ar(20), decay) * 1500 + 200,\n 0, 0.2\n );\n\n}.play;\n);\n\n\n\n\n// follow a sine lfo, decay controlled by mouse x\n(\n{\n var decay;\n decay = MouseX.kr(0, 1.1).min(1.0);\n SinOsc.ar(\n PeakFollower.kr(SinOsc.kr(0.2), decay) * 200 + 500,\n 0, 0.2\n )\n\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Node`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n(\nx = SynthDef(\"help-node-set\", { |freq = 440, out = 0|\n Out.ar(out, SinOsc.ar(freq, 0, 0.1))\n}).play\n);\nx.set(\\freq, 880, \\out, 1); // two pairs\nx.set(0, 660, 1, 0); // freq is the first argument, so it's index is 0. out is index 1.\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Pbindf`?"}, {"role": "assistant", "content": "Pbindf — bind several value patterns to one existing event stream by binding keys to values"}, {"role": "user", "content": "What does `Pbindf.new` do?"}, {"role": "assistant", "content": "The arguments to Pbindf is the initial pattern followed by an alternating sequence of keys and patterns. A pattern can also be bound to an array of keys. In this case, the pattern must specify a sequence whose elements are arrays with at least as many elements as there are keys."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\na = Pbind(\\x, Pseq([1, 2, 3]), \\zzz, 9000); // input stream\nb = Pbindf(a, \\y, Prand([100, 300, 200], inf), \\zzz, 99);\nx = b.asStream;\n);\n\nx.next(()); // pass in an event ()\nx.next(());\nx.next(());\nx.next(()); // end: nil\n\n\n\n// sound examples\n\n// using the default synth def\na = Pbind(\\dur, 0.1);\nPbindf(a, \\freq, Prand([300, 500, 231.2, 399.2], inf)).play;\nPbindf(a, \\freq, Prand([1, 1.2, 2, 2.5, 3, 4], inf) * 200).play;\n\n\n(\n// a SynthDef\nSynthDef(\\test, { |out, freq = 440, amp = 0.1, nharms = 10, pan = 0, gate = 1|\n var audio = Blip.ar(freq, nharms, amp);\n var env = Linen.kr(gate, doneAction: Done.freeSelf);\n OffsetOut.ar(out, Pan2.ar(audio, pan, env));\n}).add;\n);\n\na = Pbind(\\instrument, \\test, \\dur, 0.1);\n\nPbindf(a, \\freq, Prand([1, 1.2, 2, 2.5, 3, 4], inf) * 200).play;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `PXLine` in SuperCollider briefly."}, {"role": "assistant", "content": "PXLine — UGenPatterns quark library Based on XLine Category: Streams-Patterns-Events > UGenPatterns > Generators."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// default params\n{ QuadL.ar(SampleRate.ir/4) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// default params\n{ QuadL.ar(SampleRate.ir/4) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `RedInterpolator` in SuperCollider briefly."}, {"role": "assistant", "content": "RedInterpolator — holds a value and interpolates to new target Interpolator. Category: Red > redScore."}]} +{"conversations": [{"role": "user", "content": "What does `View.minimize` do?"}, {"role": "assistant", "content": "If the view is a window, hides it (only keep it present in the"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Klank.ar(`[[800, 1071, 1153, 1723], nil, [1, 1, 1, 1]], Impulse.ar(2, 0, 0.1)) }.play;\n\n{ Klank.ar(`[[800, 1071, 1353, 1723], nil, [1, 1, 1, 1]], Dust.ar(8, 0.1)) }.play;\n\n{ Klank.ar(`[[800, 1071, 1353, 1723], nil, [1, 1, 1, 1]], PinkNoise.ar(0.007)) }.play;\n\n{ Klank.ar(`[[200, 671, 1153, 1723], nil, [1, 1, 1, 1]], PinkNoise.ar([0.007, 0.007]) }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Klank.ar(`[[800, 1071, 1153, 1723], nil, [1, 1, 1, 1]], Impulse.ar(2, 0, 0.1)) }.play;\n\n{ Klank.ar(`[[800, 1071, 1353, 1723], nil, [1, 1, 1, 1]], Dust.ar(8, 0.1)) }.play;\n\n{ Klank.ar(`[[800, 1071, 1353, 1723], nil, [1, 1, 1, 1]], PinkNoise.ar(0.007)) }.play;\n\n{ Klank.ar(`[[200, 671, 1153, 1723], nil, [1, 1, 1, 1]], PinkNoise.ar([0.007, 0.007])) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// crossfading a mono source between two outs\n\n(\nx = {\n DXFan.ar(\n Dseq([0, 1], inf),\n PinkNoise.ar(0.05),\n fadeTime: 1\n )\n}.play\n);\n\nx.release\n\n\n// Crossfading a stereo source between two outs,\n// for more than two channels size has to be passed.\n\n(\n{\n DXFan.ar(\n Dseq([0, 2], inf),\n `(Saw.ar(50 * [1, 5], 0.03)),\n size: 4,\n fadeTime: 0.1\n )\n}.plot(0.2)\n);\n\n\n// crossfading a mono source between several outs\n\n(\n{\n DXFan.ar(\n Dseq([0, 3, 1, 2], inf),\n BPF.ar(Pink\n// …\n```"}, {"role": "assistant", "content": "crossfading a mono source between two outs Crossfading a stereo source between two outs, (DXFan: crossfades signals within a multichannel array according to demand-rate control)"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n+ String {\n decodeHex {\n var new = String.new, stream = CollStream(this), ch, int;\n while {\n ch = stream.next;\n ch.notNil\n } {\n if(ch == $%) {\n ch = stream.next;\n if(ch.notNil) {\n int = ch.digit << 4;\n } {\n // If the string ends with %, then 'ch' after that is nil\n // so we can just append the %\n ^new.add($%);\n };\n ch = stream.next;\n if(ch.notNil) {\n ch = (int + ch.digit).asAscii;\n } {\n // If we got this far, we know there was one (only one) char after %\n // so add them both\n ^new.add($%).add(this.last);\n };\n };\n new = new.add(ch);\n };\n ^new\n }\n}\n```"}, {"role": "assistant", "content": "A quick utility function for decoding UTF-8 characters in %hex codes (such as for web URLs). Save the code into a .sc file in your Extensions/ directory, recompile, and then:\r\n\r\n\"%E5%A4%A7%E5%AE%B6%E5%A5%BD\".decodeHex;\r\n-> 大家好\r\n\r\nThis probably works only for UTF-8. SC can save the individual bytes of Unicode characters into String objects, and the IDE will print UTF-8 code points correctly, but th."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// Change MembraneHexagon to MembraneCircle for a different shaped\n// circular drum head\ns.boot;\ns.reboot;\n(\n{ var excitation = EnvGen.kr(Env.perc,\n MouseButton.kr(0, 1, 0),\n timeScale: 0.1, doneAction: 0\n ) * PinkNoise.ar(0.4);\n var tension = MouseX.kr(0.01, 0.1);\n var loss = MouseY.kr(0.999999, 0.999, 1);\n MembraneHexagon.ar(excitation, tension, loss);\n}.play;\n)\n```"}, {"role": "assistant", "content": "Change MembraneHexagon to MembraneCircle for a different shaped circular drum head (MembraneHexagon: Waveguide mesh physical models of drum membranes)"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `BrownNoise`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// 以下のSynthDefは全て共通のコントロール名(mul)を持つ\n(\n// 3つのSynthDefとグループを作成する\nSynthDef(\"synthNumber1\", { arg mul = 0.2;\n Out.ar(\n 0,\n BrownNoise.ar(mul) * LFNoise0.kr([1, 1.01])\n )\n }, [0.1]).add;\nSynthDef(\"synthNumber2\", { arg mul = 0.2;\n Out.ar(\n 0,\n WhiteNoise.ar(mul) * LFNoise1.kr([2.99, 3])\n )\n }, [0.1]).add;\nSynthDef(\"synthNumber3\", { arg mul = 0.2;\n Out.ar(\n 0,\n PinkNoise.ar(mul) * LFNoise2.kr([0.79, 0.67])\n )\n}, [0.1]).add;\n);\n\n(\n// グループを作成する\n~myGroup = Group.new;\n);\n\n(\n// 3つのシンセを加える\nSynth.head(~myGroup, \"synthNumber1\");\nSynth.head(~myGroup, \"synthNumber2\");\nSynth.head(~myGroup, \"synthNumber3\");\n);\n\n// 3つのシンセのそれぞれの\\mulコントロール、新しい(そして同じ)値にセットする\n~myGroup.set(\\mul, 0.05)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `BufferProxy.freePatchOutToBundle` do? What arguments does it take?"}, {"role": "assistant", "content": "allocates a Buffer on play Arguments: bundle."}]} +{"conversations": [{"role": "user", "content": "What's the difference between Env.perc and Env.adsr?"}, {"role": "assistant", "content": "`Env.perc(attack, release)` goes up once and decays to zero — one-shot sounds. `Env.adsr(a, d, s, r)` holds at a sustain level while its gate is open and only releases when the gate closes — notes you start and stop."}, {"role": "user", "content": "So which do I use for a pad?"}, {"role": "assistant", "content": "adsr, with `gate` as a Synth argument and `doneAction: 2` on the EnvGen:\n\n```supercollider\nSynthDef(\\pad, { |out = 0, freq = 220, gate = 1|\n var env = EnvGen.kr(Env.adsr(0.8, 0.4, 0.7, 2), gate, doneAction: 2);\n Out.ar(out, Saw.ar(freq) * env * 0.1)\n}).add;\n```\n\nThen `x.set(\\gate, 0)` releases it over the 2 seconds of release time."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for batuhan's buzzer parametrized that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n// A beautiful sc140 tweet by Batuhan Bozkurt, parametrized for real-time changes\n(\n// Start sound here\na = { | rateL = 5, rateR = 6, blipMul = 100, blipAdd = 50, fMul = 50, kMul = 1 |\n f = LocalIn.ar(2).tanh;\n k = Latch.kr(f[0].abs,Impulse.kr(1/4)) * kMul;\n LocalOut.ar(\n f +\n CombC.ar(Blip.ar([rateL, rateR], blipMul * k + blipAdd, 0.9), 1, k*0.3, fMul * f));f\n}.play\n);\n\n// Set parameters for changing sound here: \n\na.set(\\rateL, 10);\n\na.set(\\rateR, 8);\n\na.set(\\blipMul, 25);\n\na.set(\\blipAdd, 70);\n\na.set(\\fMul, 30);\n\n\na.set(\\kMul, 0.01);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Fdef`."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\ns.boot;\nSynthDef(\"gpdef\",\n { |out = 0, freq = 440, sustain = 0.05, amp = 0.1|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain), doneAction: Done.freeSelf) * amp;\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n// fork a thread that plays some sounds\n(\nFdef(\\freq, 440);\nFdef(\\dur, 0.2);\n\nfork {\n loop {\n s.sendMsg(\"/s_new\", \"gpdef\", -1, 1, 1, \\freq, Fdef(\\freq).value);\n Fdef(\\dur).value.wait;\n }\n};\n);\n\n// some modifications\n\nFdef(\\freq, Fdef(\\midinote, 60).midicps);\nFdef(\\midinote, { [67, 64, 65].choose });\nFdef(\\midinote, { [67, 64, 65].choose } + Fdef(\\offset));\nFdef(\\offset, { 4.rand });\nFdef(\\dur, 0.23);\n```"}]} +{"conversations": [{"role": "user", "content": "What is `SinOsc` in SuperCollider?"}, {"role": "assistant", "content": "SinOsc — Interpolating sine wavetable oscillator. Generates a sine wave. Uses a wavetable lookup oscillator with linear interpolation. Frequency and phase modulation are provided for audio-rate modulation. Technically, `SinOsc` uses the same implementation as Osc except that its table is fixed to be a sine wave made of `8192` samples. Category: UGens > Generators > Deterministic."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Trig`."}, {"role": "assistant", "content": "```supercollider\n{ Trig.ar(Dust.ar(1), 0.2) * FSinOsc.ar(800, 0.5) }.play\n\n{ Trig.ar(Dust.ar(4), 0.1) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "How do I pan notes around the stereo field in a pattern?"}, {"role": "assistant", "content": "Put `\\pan` in the Pbind: the default instrument understands it and passes it to Pan2.\n\n```supercollider\n(\nPbind(\n \\scale, Scale.minorPentatonic,\n \\degree, Pseq([0, 2, 4, 7, 9, 7, 4, 2], inf),\n \\dur, 0.2,\n \\pan, Pseq([-1, -0.5, 0, 0.5, 1, 0.5, 0, -0.5], inf),\n \\amp, 0.15\n).play;\n)\n```\n\nTo pan an arbitrary synth, add a `pan = 0` argument to the SynthDef and wrap the output in\n`Pan2.ar(sig, pan)`."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `OneZero`."}, {"role": "assistant", "content": "```supercollider\n{ OneZero.ar(WhiteNoise.ar(0.5), 0.5) }.play\n\n{ OneZero.ar(WhiteNoise.ar(0.5), -0.5) }.play\n\n{ OneZero.ar(WhiteNoise.ar(0.5), Line.kr(-0.5, 0.5, 10)) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `NodeProxy`."}, {"role": "assistant", "content": "```supercollider\nb = NodeProxy.new.play;\nb.source = { PinkNoise.ar(0.2.dup) };\n// now I want to filter b through a new proxy.\na = NodeProxy.new;\na <-- b; a.source = { HPF.ar(b.ar, 7000) };\na.source = { HPF.ar(b.ar, 3000) }; // changing the source\na.clear; b.clear;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `LevelIndicator.critical` do? What arguments does it take?"}, {"role": "assistant", "content": "Set the warning and critical thresholds. If meter value is above either threshold, #-warningColor or #-criticalColor will be shown, respectively (by default, yellow and red). If #-drawsPeak is true warning color will be displayed based on #-peakLevel rather than Arguments: val — A Float. `a = LevelIndicator(bounds: Rect(10, 10, 20, 160)).front;`."}]} +{"conversations": [{"role": "user", "content": "What does `ProxySpace.play` do? What arguments does it take?"}, {"role": "assistant", "content": "returns a group that plays the NodeProxy at that Arguments: key — a Symbol; out — output channel offset; numChannels — play this number of channels.."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// example from ServerErrorGui in crucial lib\n\nf = OSCresponderNode(s.addr, '/fail', { |time, responder, msg|\n {\n var mins, secs;\n mins = (time/60).round(1);\n secs = (time%60).round(0.1);\n if(secs<10, { secs = \"0\"++secs.asString }, { secs = secs.asString });\n // put this on a gui\n // errors.label = \"% % (%:%)\".format(msg[1], msg[2], mins, secs);\n // errors.stringColor = Color.white;\n \"% % (%:%)\".format(msg[1], msg[2], mins, secs).postln;\n }.defer\n});\nf.add;\n// …\n```"}, {"role": "assistant", "content": "example from ServerErrorGui in crucial lib errors.label = \"% % (%:%)\".format(msg[1], msg[2], mins, secs); (OSCresponderNode: client side network responder)"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// start a noise patch and set the id of the generator\n(\nSynthDef(\"help-RandID\", { |out = 0, id = 1|\n RandID.ir(id);\n Out.ar(out,\n WhiteNoise.ar(0.05) + Dust2.ar(70)\n )\n}).add;\n);\n\n// reset the seed of my rgen at a variable rate\n(\nSynthDef(\"help-RandSeed\", { |seed = 1910, id = 1|\n RandID.kr(id);\n RandSeed.kr(Impulse.kr(FSinOsc.kr(0.2, 0, 10, 11)), seed);\n}).add;\n\n);\n\n// start two noise synths on left and right channel with a different randgen id\na = Synth(\"help-RandID\", [\\\n// …\n```"}, {"role": "assistant", "content": "start a noise patch and set the id of the generator reset the seed of my rgen at a variable rate (RandID: Set the synth's random generator ID.)"}]} +{"conversations": [{"role": "user", "content": "Write a chord progression with Pbind."}, {"role": "assistant", "content": "Put an array of degrees in the pattern, use \\strum to spread the chord, and the default instrument\nplays all notes of each event.\n\n```supercollider\n(\nPbind(\n \\scale, Scale.minor,\n \\root, 2,\n \\degree, Pseq([[0, 4, 7], [-3, 0, 4], [-5, -1, 2], [0, 4, 7]], inf),\n \\dur, 1.5,\n \\strum, 0.02,\n \\amp, 0.12,\n \\legato, 0.9\n).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Saw`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n SynthDef(\\controlList, { |out = 0, freq = 440, amp = 0.1, detune = #[0.999, 1.001], gate = 1|\n var sig = Mix(Saw.ar(freq * (detune ++ [1]), amp)),\n env = EnvGen.kr(Env.adsr, gate, doneAction: Done.freeSelf);\n Out.ar(out, (sig * env) ! 2);\n }).add;\n\n SynthDescLib.global[\\controlList]\n )\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `ReplaceOut` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// ... a reverb adapted from the \"01 Why SuperCollider document\" in the SC2 distribution\n(\nSynthDef(\"preDelay\", { arg inbus = 2;\n ReplaceOut.ar(\n 4,\n DelayN.ar(In.ar(inbus, 1), 0.048, 0.048)\n )\n}).add;\n\nSynthDef(\"combs\", {\n ReplaceOut.ar(\n 6,\n Mix.arFill(7, { CombL.ar(In.ar(4, 1), 0.1, LFNoise1.kr(Rand(0, 0.1), 0.04, 0.05), 15) })\n )\n}).add;\n\nSynthDef(\"allpass\", { arg gain = 0.2;\n var source;\n source = In.ar(6, 1);\n 4.do({ source = AllpassN.ar(source, 0.050, [Rand(0, 0.05), Rand(0, 0.05)], 1) });\n ReplaceOut.ar(\n 8,\n source * gain\n )\n}).add;\n\nSynthDef(\"theMixer\", { arg gain = 1;\n ReplaceOut.ar(\n 0,\n Mix.ar([In.ar(2, 1), In.ar(8, 2)]) * gain\n )\n}).add;\n);\n\n(\nSynth(\"fm1\", [\\bus, 2, \\freq, 440, \\carPartial, 1, \\modPartial, 1.99, \\mul, 0.071]);\nSynth(\"fm1\", [\\bus, 2, \\freq, 442, \\carPartial, 1, \\modPartial, 2.401, \\mul, 0.071]);\nSynth.tail(s, \"preDelay\");\nSynth.tail(s, \"combs\");\nSynth.tail(s, \"allpass\");\nSynth.tail(s, \"theMixer\", [\\gain, 0.64]);\n);\n\n(\ns.queryAllNodes;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `FunctionDef.prototypeFrame` do?"}, {"role": "assistant", "content": "Get the array of default values for argument and temporary variables. `{ |a = 9, b = 10, c| a + b"}]} +{"conversations": [{"role": "user", "content": "How to generate paradiddles?"}, {"role": "assistant", "content": "SuperCollider forum — How to generate paradiddles?\n\nHi Rodet, I’m teaching jazz at college, and sometimes paradiddles come up in conversation (although I’m not a drummer). A paradiddle is basically a way of ‘evenly’ playing a roll (single/double/triple/whatever). If you take your drumsticks/fingers and play evenly:\n\nright, left, right, right, left, right, left, left, right, left, right, right, etc\n\nyou’ll notice that it’s possible to get an even rhythm, which when played fast becomes a roll. The idea of the single/double/triple is just to place the accents (lightly, or not) on the left, right hand, which if I understand helps keep an even stroke (and makes better sense to follow).\n\nSo, although I don’t know the goal of your idea, a simple code which would give you the solution could be a pattern. You’ll notice I’ve put in a SynthDef to give the ‘snare’ sound - not very real, but just for the demonstration. If you run these patterns, un-commenting the line needed (single, double or triple - don’t forget to comment out the lines you don’t need), you’ll hear the accents a paradiddle gives.\n\nIn this example Pbind ‘a’ gives the pulse, and Pbind ‘b’ the accents. And, if you play along with them (using your chart), you’ll notice the accents pass from right hand to left hand (or vice versa). This is (more or less) what paradiddles do, although a drummer will explain better how they ‘accent’ strokes to get more complicated/subtle rhythms.\n\n```supercollider\n(\nSynthDef(\\snare, {\n arg out=0, sus=0.1;\n var sig, env;\n sig = WhiteNoise.ar(0.1);\n env = EnvGen.kr(Env.perc(0.001, sus), doneAction:2);\n sig = sig*env;\n Out.ar(out, sig!2);\n}).add;\n);\n\n(\nt=TempoClock(80/60);\na=Pbind(\n \\instrument, \\snare,\n \\dur, 1/2,\n \\sus, 0.01\n);\nb=Pbind(\n \\instrument, \\snare,\n \\dur, 1,\n \\sus, Pseq([0.02, 0.01],inf), // single\n //\\sus, Pseq([0.02, 0.01, 0.01],inf), // double\n //\\sus, Pseq([0.02, 0.01, 0.01, 0.01],inf), // triple\n);\nPpar([a, b]).play(t);\n)\n```\n\nI hope that puts you on the right track.\n\np.s. Don’t forget to try out changing the speed to get the real effect. Try something like 320/60 on the TempoClock."}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for get different result each time running the pattern: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\nTempoClock.default.tempo = 156/60;\n\n(\nSynthDef(\\spring, { |freq = 400, out = 0, pan = 0, gate = 1, dur = 0.15, curve = -4, amp = 1, index = 1|\n var sig = FreeVerb.ar(Pan2.ar(Blip.ar(freq, index), pan));\n var env = EnvGen.ar(Env.perc(0.01, dur, amp, curve), gate, doneAction:2);\n Out.ar(0, sig * env);\n}).add;\n);\n\n(\nPbind(*[\n instrument: \\spring,\n dur: Pseq([4, 1, 2, 1, 1, 1].scramble/ 4 / TempoClock.default.tempo, inf),\n degree: Pseq(#[1,2,3,4], inf) * Pkey(\\dur).reciprocal,\n octave: Pseq([2,3,4,4,4,3].scramble, inf),\n pan: Pxrand(Array.fill(100, { 0.gaussian(1).clip2(1) }), inf),\n amp: Pseq(#[0.95,1,0.8],inf),\n index: Pstutter(Pseq(#[4,8,12],inf), Pseq([2,3,4,5,6,8].scramble, inf))\n]).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `BufRd`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_playbuf, { |out = 0, bufnum = 0, rate = 1, startPos = 0, amp = 0.1, sustain = 1, pan = 0, loop = 1|\n var audio;\n rate = rate * BufRateScale.ir(bufnum);\n startPos = startPos * BufFrames.ir(bufnum);\n\n audio = BufRd.ar(1, bufnum, Phasor.ar(0, rate, startPos, BufFrames.ir(bufnum)), 1, 1);\n audio = EnvGen.ar(Env.sine, 1, timeScale: sustain, doneAction: Done.freeSelf) * audio;\n audio = Pan2.ar(audio, pan, amp);\n OffsetOut.ar(out, audio);\n}).add; // use .store for rendering example below\n\na = Pproto({\n ~newgroup = (type: \\group).yield;\n ~sf1 = (type: \\allocRead, path: ExampleFiles.apollo11).yield;\n},\n Pbind(*[\n instrument: \\help_playbuf,\n dur: Pseg([0, 0, 0.25, 0.5, 0.75, 1], 10).linexp(0, 1, 0.01, 2),\n legato: 4,\n startPos: Pn(Pseg([0, 1], 20), inf),\n rate: Pwhite(1, 1).midiratio,\n loop: 0,\n group: Pkey(\\newgroup),\n bufnum: Pkey(\\sf1)\n ])\n);\na.play;\n)\n\n// a.render(\"sounds/test.aif\", 40)\n// SoundFile.openRead(\"sounds/test.aif\").play\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LatoocarfianC`."}, {"role": "assistant", "content": "```supercollider\n// randomly modulate all params\n(\n{ LatoocarfianC.ar(\n SampleRate.ir/4,\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5)\n) * 0.2 }.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `HelpBrowser` in SuperCollider briefly."}, {"role": "assistant", "content": "HelpBrowser — Browse the SuperCollider help documentation HelpBrowser is a GUI help browser that lets you browse the documentation of SuperCollider. It is coupled with SCDoc to allow on-the-fly rendering of HTML help files. Category: HelpSystem, GUI > Interfaces."}]} +{"conversations": [{"role": "user", "content": "What does `Integer.indexOfPrime` do?"}, {"role": "assistant", "content": "32-bit Integer number Returns: the index of a prime number less than or equal to the receiver up to 65521. If the receiver is not a prime, the answer is nil."}]} +{"conversations": [{"role": "user", "content": "Explain `PlayerUnop` in SuperCollider briefly."}, {"role": "assistant", "content": "PlayerUnop — the result of performing a unary op on a Player `(` Category: Libraries > crucial > Players."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ SinOsc.ar(SinOsc.ar(0.3).curverange(440, 660, -3), 0, 0.5 * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ SinOsc.ar(SinOsc.ar(0.3).curverange(440, 660, -3), 0, 0.5) * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Font.setDefault` do? What arguments does it take?"}, {"role": "assistant", "content": "Sets the global default font. Properties of the `font` argument will be combined with properties of the default system font, and those of individual views. Optionally, a class can be given, so only views of that class will be affected. Note that this will immediately affect any existing Arguments: font — An instance of Font.; class — A Class (either View or one of its subclasses), or `nil`.."}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nRoutine({ loop { Synth(\\kick); 0.5.wait } }).play;\n```"}, {"role": "assistant", "content": "It starts a kick every half second, forever.\n\nA Routine is a language-side coroutine: `.play` runs it on the clock, and `wait` suspends it until the next\nbeat without blocking anything else. Inside the `loop`, `Synth(\\kick)` creates a kick and `0.5.wait` waits\nhalf a beat on the current TempoClock — the tempo, not seconds, so changing the clock changes the rate.\nBecause the kick SynthDef frees itself with `doneAction: 2`, the loop can run for hours without leaking\nnodes."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nNdef(\\birdy, {arg freq=1500, amp=0.5, rate=10;\n var osc, son, convIn, rand;\n osc=LFCub;\n rand = LFNoise1.ar(rate);\n convIn=LinCongN.ar(rate);\n son = osc.ar(Convolution.ar(convIn,convIn));\n freq = Latch.kr(rand.range(0,1).round(0.1), rand) * freq;\n freq = osc.ar(osc.ar(rand)*rand.range(0,10)).range(freq, freq*3);\n son = Formlet.ar(son, freq, convIn.abs*0.1, rand.abs);\n son = Normalizer.ar(son, 0.9, 0.1) * convIn.abs * LFPulse.kr(LFPulse.kr(rand.abs), 0, rand.abs);\n son = son + GVerb.ar(son, 99, 2, mul: rand.range(0,0.3));\n son * amp\n}).play\n)\n```"}, {"role": "assistant", "content": "I just rewrote one of autocsi's tweets and came out with this which sounds like a digital bird of some kind:."}]} +{"conversations": [{"role": "user", "content": "What does `HSpar.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new HSpar Arguments: server — Must be running server.; ugenFuncs — Collection of functions that define the synths.; demandLatency — Latency of help synths in seconds. Default value 0.15.; respondLatency — Time in seconds, given to the response to be received by the client on time. Default value 0.15.; postOSC — Boolean for posting of (server to client) OSC messages. Defaults to false.; granularity — Time grains per second, quantization for bookkeeping. Defaults to 200.; inputCheck — Boolean for checking input data. Defaults to true.."}]} +{"conversations": [{"role": "user", "content": "What does `EaseOutInQuad.value` do? What arguments does it take?"}, {"role": "assistant", "content": "Quadratic ease-out/in Arguments: t — a Float between 0.0 and 1.0.."}]} +{"conversations": [{"role": "user", "content": "What does `RedWorld.dim` do?"}, {"role": "assistant", "content": "Size of this world ( RedVector of any dimension). i.e. the world can have any number of"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nNdef(\\bitshift, {\n var t = PulseCount.ar(Impulse.ar(8e3));\n var sig = HPF.ar(\n ( \n ((t * 15) & (t >> 5)) |\n ((t * 5) & (t >> [3, 4])) |\n ((t * 2) & (t >> 9)) |\n ((t * 8) & (t >> 11))\n - 3 % 256\n ) / 127-1 * 3\n , 20\n ).distort * 0.2; \n sig = Greyhole.ar(sig, sig, 0.5, sig).flop.mean/4;\n}).play;\n)\n```"}, {"role": "assistant", "content": "Not very original since I copied the bit code from http://schemawound.com/post/58980873930/bitwise and added a greyhole. But it sound so amazing I want to share it =)."}]} +{"conversations": [{"role": "user", "content": "Write a filter sweep over a saw."}, {"role": "assistant", "content": "An LFO on the cutoff of a resonant low-pass; XLine or an LFO both work, the LFO is the loopable one.\n\n```supercollider\n{ LPF.ar(Saw.ar([60, 60.2]), SinOsc.kr(0.2).exprange(150, 4000), 0.4) * 0.2 }.play;\n```\n\n`.exprange` is the exponential mapping you want for frequency; a linear `.range` sweep sounds uneven."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// Kabelscahden \n// by Alberto de Campo and Julian Rohrhuber, 3/2003\n// licenced under creative commons Attribution-ShareAlike 2.5\n\n\n(\n{\n var h, n, m, k, trig;\n trig = Dust.kr( 7 ** LFNoise1.kr(0.3) );\n h = ToggleFF.kr(CoinGate.kr(0.4,trig)) *\n RLPF.ar(LFPulse.ar(50, 0, 0.5, 1, LFNoise1.kr(2, 0.5, -0.5)), 6000, 0.15);\n n = Trig.ar(trig, TRand.kr(0, 0.01, CoinGate.kr(0.4,trig))) * WhiteNoise.ar;\n m = Trig.ar(trig, TRand.kr(0, 0.01, CoinGate.kr(0.4,trig))) * BrownNoise.ar;\n k = Trig.ar(trig, LFNoise1.kr([ 4, 4.2 ], 0.1, 0.11)) *\n LFClipNoise.ar(LFNoise0.kr(7, 30, 40));\n LeakDC.ar(h + n + k + m * 10).distort;\n}.play;\n);\n\nhttps://swiki.hfbk-hamburg.de/MusicTechnology/851\n```"}, {"role": "assistant", "content": "Kabelscahden Guitar Cable Hum Buzz Noise Cable damage - Repost (a SuperCollider snippet)."}]} {"conversations": [{"role": "user", "content": "What is the difference between a Synth and a SynthDef?"}, {"role": "assistant", "content": "A SynthDef is a definition: a compiled UGen graph with named controls, registered on the server once. A Synth is one running instance of that definition. You create the definition with `SynthDef(\\bell, { |freq = 440| ... }).add` and then instances with `Synth(\\bell, [\\freq, 660])`. Defining the same SynthDef twice replaces it for future instances; already running Synths keep the old graph until they are freed."}]} -{"conversations": [{"role": "user", "content": "What does `InstrBrowser.topBarFunc` do?"}, {"role": "assistant", "content": "Browse your instrument library, with customizable actions"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// When we provide the 'root' argument an array, we should hear a chord.\n// the synth def is defined above\n(\nPbind(\n \\instrument, \\acid, \\dur, Pseq([0.25, 0.5, 0.25], inf),\n \\root, [-24, -17], // expand root\n \\degree, Pseq([0, 3, 5, 7, 9, 11, 5, 1], inf),\n \\pan, Pfunc { 1.0.rand2 },\n \\cut, Pxrand([1000, 500, 2000, 300], inf),\n \\rez, Pfunc { 0.7.rand + 0.3 },\n \\amp, 0.2).play;\n);\n\n// multiple arrays are correlated in parallel, the shorter one wraps:\n(\nPbind(\n \\instrument, \\acid,\n \\dur,\n// …\n```"}, {"role": "assistant", "content": "When we provide the 'root' argument an array, we should hear a chord. the synth def is defined above (Pbind: combine several value patterns to one event stream by binding keys to values)"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `WrapIndex`."}, {"role": "assistant", "content": "```supercollider\n// indexing into a table\n(\n{\n var buf = LocalBuf.newFrom([200, 300, 400, 500, 600, 800]);\n var freq = WrapIndex.kr(buf, MouseX.kr(0, BufFrames.ir(buf) * 3));\n SinOsc.ar(freq) * 0.1\n}.play;\n);\n\n// the same using a global buffer\n(\nt = [200, 300, 400, 500, 600, 800];\nb = Buffer(s, t.size, 1);\n\n// alloc and set the values\ns.listSendMsg(b.allocMsg(b.setnMsg(0, t)).postln);\n\nSynthDef(\\help_Index, { |out = 0, bufnum = 0|\n Out.ar(out,\n SinOsc.ar(\n WrapIndex.kr(\n bufnum,\n MouseX.kr(0, BufFrames.ir(bufnum) * 3)\n ),\n 0,\n 0.5\n )\n )\n}).play(s, [\\bufnum, b.bufnum]);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `CytonDaisySerial` in SuperCollider?"}, {"role": "assistant", "content": "CytonDaisySerial — for communicating with a Cyton+Daisy board (16ch) this class is for communication via bluetooth serial (dongle). use CytonDaisyWifi for the wifi shield. Category: External Control."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Kepler 22-b atmosphere."}, {"role": "assistant", "content": "```supercollider\n(\nfork { \n Ndef(\\ttwnd).play;//(d,2,addAction:\\addToHead);\n loop {\n var seed = thisThread.randSeed = 100000000.rand.debug('seed');\n Ndef(\\ttwnd, {\n var freq = [20, 7500];\n Splay.ar(\n { \n var bands = 2.rrand(10);\n var sig = { [BPF,RLPF,RHPF].choose.ar(\n LFNoise2.ar(freq[0].rrand(freq[1]), LFNoise2.kr(0.1.exprand(10))),\n Array.rand(bands, freq[0], freq[1]),\n Array.rand(bands, 0.2, 1.8)\n ).mean } ! 2;\n Rotate2.ar(sig[0], sig[1], LFSaw.kr(0.1.exprand(10)));\n } ! 4.rrand(6).debug('source'),\n 0.5.rrand(1)\n );\n }).fadeTime_(1.rrand(4.0));\n 10.0.rrand(40).debug('wait(bts)').wait;\n }\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n(\n// PLseq not used as proxy, only taken as it defaults to repeats = inf\n\np = Pbind(\n \\midinote, PLseq([PLser(\\a, \\r), 60, 61]),\n \\dur, 0.2\n);\n\n// prepare current Environment\n\n~a = (67..70);\n~r = 6;\n);\n\nx = p.play;\n\n\n// replace repeats\n\n~r = 3;\n\n\n// replace array elements\n\n~a[0] = [77, 93.5];\n\n~a[2] = Pseq((94..96));\n\n\n// replace whole array\n\n~a = [55, 52];\n\nx.stop;\n// …\n```"}, {"role": "assistant", "content": "PLseq not used as proxy, only taken as it defaults to repeats = inf prepare current Environment (PLser: dynamic scope Pser variant)"}]} -{"conversations": [{"role": "user", "content": "What does `Sieve.==` do? What arguments does it take?"}, {"role": "assistant", "content": "Equality check. Sieves of different mode are equal iff the lists resulting from conversion are Arguments: that — Object to compare.."}]} -{"conversations": [{"role": "user", "content": "What does `SimpleNumber.ibetaC` do?"}, {"role": "assistant", "content": "Returns the normalised complement of the incomplete beta function of `a`, `b` and `x`. Require 0 <= `x` <= 1, `a,b` >= 0, and in addition that not both `a` and `b` are"}]} +{"conversations": [{"role": "user", "content": "What does `FPSignal.reactimate` do?"}, {"role": "assistant", "content": "Implementation of Functional Reactive Programming. Returns: nil"}]} +{"conversations": [{"role": "user", "content": "What does `ProxySpace.stop` do?"}, {"role": "assistant", "content": "stop all proxies (stop only monitors, do not stop"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Ringz` that runs as it is."}, {"role": "assistant", "content": "```supercollider\na = NodeProxy(s);\na[0] = { |freq = 440, dt=0.1, rate=2| Ringz.ar(Impulse.ar(rate * [1, 1.2]), freq, dt)*0.1 };\na.play;\n(\na[1] = \\set -> Pbind(\n \\dur, Prand([1, 0.5], inf),\n \\freq, Pwhite(200.0, 1000, inf),\n \\rate, Pdup(4, Prand([1, 3, 6, 10], inf)),\n \\dt, Pwhite(0.01, 0.1, inf)\n)\n);\n// modify the source in the meanwhile:\na[0] = { |freq = 440, dt=0.1, rate=2| Ringz.ar(Dust.ar(rate * 10.dup), freq, dt)*0.1 };\n\na.nodeMap.postln; // the values are not set in the node map.\na.clear(3);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `MassEditUChain.gui` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: parent — (describe argument here); bounds — (describe argument here). Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "What is `InstrGateSpawner` in SuperCollider?"}, {"role": "assistant", "content": "InstrGateSpawner — a Pbind-like spawner that plays an Instr with streams supplied to its inputs a Pbind-like spawner that plays an Instr with streams supplied to its inputs. Category: Libraries > crucial > Instr, Libraries > crucial > Players."}]} +{"conversations": [{"role": "user", "content": "What does `Sieve.&` do? What arguments does it take?"}, {"role": "assistant", "content": "Binary operator for instance method sect. Creates a new Sieve object in mode 'points', generated by the intersection of the receiver and a Arguments: gen — A generator. Allowed generators: Integers, Streams or Patterns producing intervals or Sieves itself. Integers and Stream/Pattern output must be strictly positive. Integers as generators produce zero and its positive multiples. Returned integers might go up to default limit 65536.."}]} +{"conversations": [{"role": "user", "content": "What does `Collection.collectInPlace` do?"}, {"role": "assistant", "content": "Iterate over the collection and replace each item with a new one, returned by the function. This can be useful when one wants to aviod creating a new array in memory. In most cases, it is better to use #-collect. `a = [1, 5, 3,"}]} +{"conversations": [{"role": "user", "content": "What does `Editor.instrArgFromControl` do? What arguments does it take?"}, {"role": "assistant", "content": "holds a value that can be edited with a GUI, saves as the value Arguments: control."}]} +{"conversations": [{"role": "user", "content": "What does `PatchOut.releaseBusses` do?"}, {"role": "assistant", "content": "manages a Player's output when connecting to other Players"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `OscN` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// compare examples below with interpolating Osc examples.\n\n(\ns = Server.local;\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, false, true);\nb = Buffer.alloc(s, 512, 1);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum, 500, 0, 0.5)\n )\n}).play(s, [0, 0, 1, b.bufnum]);\n\n);\nb.free;\n\n\n\n(\n// noninterpolating - there are noticeable artifacts\n// modulate freq\n\ns = Server.local;\nb.sine1(1.0/[1, 2, 3, 4, 5, 6].squared, true, false, true);\nb = Buffer.alloc(s, 512, 1);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum, XLine.kr(2000, 200), 0, 0.5)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n\n);\nb.free;\n\n(\n// sounds very different than the Osc example\ns = Server.local;\nb = Buffer.alloc(s, 512, 1);\nb.sine1([1.0], true, true, true);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum,\n OscN.ar(bufnum,\n XLine.kr(1, 1000, 9),\n 0,\n 200,\n 800),\n 0,\n 0.25)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n\n);\nb.free;\n\n(\n// modulate phase\ns = Server.local;\nb = Buffer.alloc(s, 512, 1);\nb.sine1([1.0], true, true, true);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum,\n 800,\n OscN.ar(bufnum,\n XLine.kr(20, 8000, 10),\n 0,\n 2pi),\n 0.25)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n);\nb.free;\n\n\n(\n// change the buffer while its playing\ns = Server.local;\nb = Buffer.alloc(s, 4096, 1);\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, true, true);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum, [80, 80.2], 0, 0.2)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n);\n\n(\nRoutine({\n var n = 32;\n 50.do({\n b.sine1(Array.rand(n, 0, 1).cubed, true, true, true);\n 0.25.wait;\n });\n}).play;\n);\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ SinOsc.ar(MouseY.kr(40, 10000, 1), 0, 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ SinOsc.ar(MouseY.kr(40, 10000, 1), 0, 0.1) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Gbman2DN.ar(MouseX.kr(20, SampleRate.ir*0.25), MouseX.kr(80, SampleRate.ir), 0.1) }.play(s);\n\n{ Gbman2DN.ar(11025, 22050, -0.7, -2.7, 0.1) }.play(s);\n\n{ Gbman2DN.ar(2200, 8800, 1.2, 2.0002, 0.1) }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Gbman2DN.ar(MouseX.kr(20, SampleRate.ir*0.25), MouseX.kr(80, SampleRate.ir), 0.1) }.play(s);\n\n{ Gbman2DN.ar(11025, 22050, -0.7, -2.7, 0.1) }.play(s);\n\n{ Gbman2DN.ar(2200, 8800, 1.2, 2.0002, 0.1) }.play(s);\n```"}]} {"conversations": [{"role": "user", "content": "What is a UGen graph in SuperCollider?"}, {"role": "assistant", "content": "A UGen graph is the directed acyclic graph of unit generators that a SynthDef describes: sources (SinOsc, WhiteNoise) feed processors (LPF, EnvGen, Pan2) and end at an output such as Out.ar. The language builds the graph; the server instantiates it once per Synth. A signal path is drawn by passing one UGen's output as another's input, and because UGens are multi-channel by default, the same expression can build a stereo or 8-channel graph depending on the arrays inside it."}]} -{"conversations": [{"role": "user", "content": "Explain `Frame` in SuperCollider briefly."}, {"role": "assistant", "content": "Frame — Stack Frame Frames are used to contain the arguments, variables and other information for active Functions. Category: Core > Kernel."}]} -{"conversations": [{"role": "user", "content": "What does `Knob.shift_scale` do? What arguments does it take?"}, {"role": "assistant", "content": "The factor by which #-step or #-keystep is multiplied when used at mouse or keyboard interaction while the Shift key is Arguments: A Float.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\nx = SynthDef(\"help-node-set\", { |freq = 440, out = 0|\n Out.ar(out, SinOsc.ar(freq, 0, 0.1))\n}).play\n);\nx.set(\\freq, 880, \\out, 1); // two pairs\nx.set(0, 660, 1, 0; // freq is the first argument, so it's index is 0. out is index 1.\nx.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\nx = SynthDef(\"help-node-set\", { |freq = 440, out = 0|\n Out.ar(out, SinOsc.ar(freq, 0, 0.1))\n}).play\n);\nx.set(\\freq, 880, \\out, 1); // two pairs\nx.set(0, 660, 1, 0); // freq is the first argument, so it's index is 0. out is index 1.\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Red alert."}, {"role": "assistant", "content": "```supercollider\n//Fig 58.7: Red alert\n//Complete patch, saw + second harmonic, resonators, distortion and post filters to create \n//fixed resonance. Contains the subpatch shown in fig 58.6.\n\n(\n SynthDef(\\red, {\n \n var env, redAlert, dfbe, aIn, bIn, cIn, aOut, bOut, cOut;\n \n # aIn, bIn, cIn = LocalIn.ar(7).clumps([5,1,1]);\n \n env = [\n EnvGen.ar(Env.new([0,1,1,0], [0.9, 0.3, 0.0])), \n EnvGen.ar(Env.new([0,1,1,0], [0.01, 0.88, 0.01]))\n ];\n env[0] = LFSaw.ar(env[0].sqrt * 487 + 360, 1, 0.5, 0.5);\n env[0] = (env[0] - 0.5) + ((env[0] * 2 * 2pi).cos * 0.3);\n redAlert = (env[0] - OnePole.ar(env[0], exp(-2pi * (1 * SampleDur.ir)))) * env[1];\n redAlert = redAlert + (cIn * 0.006) * 0.2;\n \n \n // fig 58.6: Delay feedback element\n dfbe = 0!6;\n redAlert = redAlert + (aIn * 0.7);\n 5.do{|i| dfbe[i] = DelayN.ar(redAlert[i], 0.1, [0.015, 0.022, 0.035, 0.024, 0.011][i])};\n aOut = dfbe[0..4]; \n \n redAlert = redAlert[0..4].sum;\n redAlert = (redAlert - OnePole.ar(redAlert, exp(-2pi * (12 * SampleDur.ir))));\n \n dfbe[5] = redAlert + (bIn * 0.7);\n dfbe[5] = DelayN.ar(dfbe[5], 0.1, 0.061);\n # bOut, cOut = dfbe[5]!2;\n LocalOut.ar(aOut ++ bOut ++ cOut);\n \n redAlert = Clip.ar(redAlert * 4, -1, 1);\n redAlert = BPF.ar(redAlert, [740, 1400, 1500, 1600], (12!4).reciprocal) ++ (redAlert * 0.5);\n Out.ar(0, (redAlert.sum * 0.2)!2);\n \n}).add;\n);\n \n// ALL HANDS!! BATTLESTATIONS!\ne = Synth(\\red);\n\n\n\n// code also available here: \n// http://en.wikibooks.org/wiki/Designing_Sound_in_SuperCollider/Red_alert\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\smooth, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.linen(0.05, sustain, 0.1), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n)\n```"}, {"role": "assistant", "content": "plays an arpeggio on the \"left hand\" and an arpeggio on the \"right hand\"."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{SineShaper.ar(SinOsc.ar([400, 404], 0, 0.2), MouseX.kr(0, 1))}.play\n\n{SineShaper.ar(SoundIn.ar, MouseX.kr(0, 1)}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{SineShaper.ar(SinOsc.ar([400, 404], 0, 0.2), MouseX.kr(0, 1))}.play\n\n{SineShaper.ar(SoundIn.ar, MouseX.kr(0, 1))}.play\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nb = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n\n(\n{\n var snd, envTime, knee, out;\n snd = PlayBuf.ar(1, b, BufRateScale.kr(b), loop: 1);\n envTime = MouseX.kr(1.0e-3, 0.1e-3);\n knee = MouseY.kr(0, -90).dbamp;\n out = DelayC.ar(snd, 0.01, envTime * 0.5) * EnvFollow.ar(snd, 1 - (envTime * SampleRate.ir).reciprocal).max(knee).reciprocal;\n out * 0.1!2\n}.play;\n)\n```"}, {"role": "assistant", "content": "a replication of the legendary LADSPA plugin of the same name, originally written by steve harris. a compressor with a super fast attack which results in harsh distortion fx. requires sc3-plugins."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// default initial params\n{ HenonN.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n\n// mouse-control of params\n{ HenonN.ar(SampleRate.ir/4, MouseX.kr(1, 1.4), MouseY.kr(0, 0.3)) * 0.2 }.play(s);\n\n// randomly modulate params\n(\n{ HenonN.ar(\n SampleRate.ir/8,\n LFNoise2.kr(1, 0.2, 1.2),\n LFNoise2.kr(1, 0.15, 0.15)\n) * 0.2 }.play(s);\n)\n\n// as a frequency control\n{ SinOsc.ar(HenonN.ar(40, MouseX.kr(1, 1.4), MouseY\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// default initial params\n{ HenonN.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n\n// mouse-control of params\n{ HenonN.ar(SampleRate.ir/4, MouseX.kr(1, 1.4), MouseY.kr(0, 0.3)) * 0.2 }.play(s);\n\n// randomly modulate params\n(\n{ HenonN.ar(\n SampleRate.ir/8,\n LFNoise2.kr(1, 0.2, 1.2),\n LFNoise2.kr(1, 0.15, 0.15)\n) * 0.2 }.play(s);\n)\n\n// as a frequency control\n{ SinOsc.ar(HenonN.ar(40, MouseX.kr(1, 1.4), MouseY.kr(0, 0.3))*800+900)*0.4 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `KeyCodeResponder.new` do?"}, {"role": "assistant", "content": "register responder functions for keycode and modifier combinations"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Monzo function?"}, {"role": "assistant", "content": "```supercollider\n// https://en.xen.wiki/w/Monzo\n//Monzo notation of JI ratios is often used in combination with Vals for temperament theory. I wrote this not for temperament, but rather to use monzos as a possible alternative to otonality and utonality, espescially when sonifying streams that include negative numbers.\n\n(//function that takes a collection representing a monzo as an argument, and outputs the ratio it encodes\n~zo = {\n arg exponentCollection;\n var ratio = 1;\n exponentCollection.do({arg item, i; ratio = ratio * (i.nthPrime).pow(item);});\n ratio;\n};\n);\n\n//5-limit\n~zo.([-1, 1]); // 3/2\n~zo.([-2, 0, 1]); // 5/4\n~zo.([-3, 2]); // 9/8\n~zo.([-4, 4, -1]); // 81/80\n~zo.([-4, 4, -1]); // 81/80\n\n//7-limit\n~zo.([-2, 0, 0, 1]); // 7/4\n~zo.([-1, -1, 0, 1]); // 7/6\n~zo.([0, 0, -1, 1]); // 7/5\n\n//fractional monzos\n~zo.([-1/2, 3.3, 4, -5]); //sure\n//it might be fun to do monzo glissandos in different places?\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `MulAdd`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n// The mul and add arguments of SinOsc themselves use MulAdd!\n// These two examples will create precisely the same synth graph:\nx = { SinOsc.ar(440, 0, 0.1, 0.05) }.play(s);\nx.trace; // You should see a \"MulAdd\" in the trace\nx.free;\n\nx = { MulAdd(SinOsc.ar(440, 0), 0.1, 0.05) }.play(s);\nx.trace;\nx.free;\n\n// In fact this will produce the same graph too - the separate multiply and add are optimised into one MulAdd\nx = { SinOsc.ar(440, 0) * 0.1 + 0.05 }.play(s);\nx.trace;\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// where did I leave my keys?\n(\nvar n = 30, m = 5;\nNdef.clear(3);\nNdef.ar(\\x, n);\nNdef(\\y, { Splay.ar(Ndef.ar(\\x, m, LFNoise1.kr(1/m).range(0, n - m - 1))).clip2 * 0.5 }).play; \nNdef(\\x, { \n { \n var a = Ndef.ar(\\x, 1, LFNoise0.kr(Rand()) * Rand() + Rand() * n);\n a + 0.1 * SinOsc.ar(ExpRand(0.2, 1000)) \n } ! n\n}); \n);\n\n// where did I put my keys?\n(\nvar n = 30, m = 5;\nNdef.clear(3);\nNdef.ar(\\x, n);\nNdef(\\y, { Splay.ar(Ndef.ar(\\x, m, LFNoise1.kr(1/m).range(0, n - m - 1))).clip2 * 0.5 }).play; \nNdef(\\x, { \n {\n var a = Ndef.ar(\\x, 1, LFNoise0.kr(Rand()) * Rand() + Rand() * n);\n SinOsc.ar(ExpRand(0.2, 1000), a) \n } ! n\n}); \n)\n```"}, {"role": "assistant", "content": "Cross-tuning between multiple signal dimensions. The code is finished without listening."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\ns.bind {\n a = { |freq = 100| SinOsc.ar(freq, LFTri.ar(freq)) * 0.2 }.play;\n s.sync;\n a.set(\\freq, 400);\n}\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\ns.bind {\n a = { |freq = 100| SinOsc.ar(freq, LFTri.ar(freq)) * 0.2 }.play;\n s.sync;\n a.set(\\freq, 400);\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes sine ocean."}, {"role": "assistant", "content": "```supercollider\n(\n//fundamental pitch triad\n~notes = [45,55,60].midicps;\n\ns.waitForBoot({\n Routine{\n\n SynthDef.new(\\tone, {\n arg freq=440, pan=0, rel=0.05;\n var sig;\n sig = SinOsc.ar(freq);\n sig = sig * EnvGen.kr(Env.perc(0.005,rel), doneAction:2);\n sig = Pan2.ar(sig, pan, 0.05);\n Out.ar(0, sig);\n }).add;\n\n s.sync;\n\n 50.do{\n Pbind(\n \\instrument, \\tone,\n\n //trace some event times just for fun\n \\dur, Pseq(Array.geom(50, rrand(1.5,1.51), rrand(0.923,0.929)).mirror,inf).trace,\n\n \\freq, exprand(~notes[0],8000).round(~notes[0]),\n \\pan, rrand(-1.0,1.0),\n \\rel, exprand(0.005,0.35),\n ).play;\n\n Pbind(\n \\instrument, \\tone,\n \\dur, Pseq(Array.geom(50, rrand(1.5,1.51), rrand(0.923,0.929)).mirror,inf),\n \\freq, exprand(~notes[1],11000).round(~notes[1]),\n \\pan, rrand(-1.0,1.0),\n \\rel, exprand(0.005,0.35),\n ).play;\n\n Pbind(\n \\instrument, \\tone,\n \\dur, Pseq(\n Array.geom(50, rrand(1.5,1.51), rrand(0.923,0.929)).mirror,inf\n ),\n \\freq, exprand(~notes[2],15000).round(~notes[2]),\n \\pan, rrand(-1.0,1.0),\n \\rel, exprand(0.005,0.35),\n ).play;\n };\n }.play(AppClock);\n});\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Resetting start count with PulseDivider?"}, {"role": "assistant", "content": "SuperCollider forum — Resetting start count with PulseDivider?\n\ni think in your example Sweep is receiving a trigger while going from 0 to 1 causing the discontinuity in the phase because the duration between one trigger and the next is unknown.\n\nwith this example you get at least a continiuous phase with random triggers to drive the hanning window (evaluate it several times). but its not multichannel with distributed phases / windows accross channels:\n\n```supercollider\n(\nvar randomTrigPhase = { |triggerRate = 10, randomness = 1|\n var minDuration = (2 ** randomness) / triggerRate;\n var maxDuration = (2 ** (-1 * randomness)) / triggerRate;\n var demand = Dunique(minDuration * ((maxDuration / minDuration) ** Dwhite(0, 1)));\n var duration = Duty.ar(demand, DC.ar(0), demand);\n var phase = Phasor.ar(DC.ar(0), (1 / duration) / SampleRate.ir, 0, 1);\n (phase: phase, trigger: HPZ1.ar(phase) < 0);\n};\n\nvar hanningWindow = { |phase|\n (1 - (phase * 2pi).cos) / 2 * (phase < 1);\n};\n\n{\n var rate = 100;\n var phase = randomTrigPhase.(rate, 1).phase;\n hanningWindow.(phase);\n}.plot(0.1);\n)\n```\n\nim not sure if this is helping it just reminded me of some issue with multichannel random triggers and continiuous phases i have been trying to solve."}]} -{"conversations": [{"role": "user", "content": "What does `SequenceableCollection.performBinaryOp` do?"}, {"role": "assistant", "content": "Creates a new collection of the results of applying the selector with the operand to all elements in the receiver. If the operand is a collection then elements of that collection are paired with elements of the receiver. `([1, 2, 3, 4] *"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nb = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n\n// This is very cool!\n\n(\n{\n Spring.ar(PlayBuf.ar(1, b, loop: 1)*Saw.ar(4));\n}.play;\n)\n```"}, {"role": "assistant", "content": "Feeding sound file multiplied by a slow saw wave into the spring physical model. Fascinating results ensue."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n// connect a MIDI device, allNotesOff with CmdPeriod useful\n\nMIDIClient.init;\nm = MIDIOut(0);\ng = { 16.do({ |i| m.allNotesOff(i) }) };\nCmdPeriod.add(g); \n\n\np = Pbind(\n \\type, \\midi,\n \\midiout, m, \n \\chan, 0,\n\n \\amp, PL(\\amp),\n \\midinote, PLseq(\\seq) + PL(\\seqAdd), \n \\dur, 0.2\n);\n);\n\n(\nv = VarGui([\\seq, [36, 60, \\lin, 1, 36] ! 5, \n \\seqAdd, [0, 12, \\lin, 1, 0],\n \\amp, [0, 1, \\\n// …\n```"}, {"role": "assistant", "content": "connect a MIDI device, allNotesOff with CmdPeriod useful remove if not needed anymore (VarGui: slider / player gui to set envir variables and synth controllers and play synths, event patterns and tasks)"}]} -{"conversations": [{"role": "user", "content": "What does `Sieve.-*` do? What arguments does it take?"}, {"role": "assistant", "content": "Binary operator for instance method dif_i. Creates a new Sieve object in mode 'intervals', generated by the difference of the receiver and a Arguments: gen — A generator. Allowed generators: Integers, Streams or Patterns producing intervals or Sieves itself. Integers and Stream/Pattern output must be strictly positive. Integers as generators produce zero and its positive multiples. Integer intervals might be collected up to default summation limit of 655."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(// * //watch the postWindow\na=[\"m\",\"x\",\"f\",\"k\",\"d\",\"p\"];\nx=Array;\ny=x.newClear(6);\n~mxfkdp=Task({\n inf.do({y.put(x.series(6,0,1).choose,a.scramble).postln;\n 0.03.wait;})}).play;\nm=fork({inf.do({\n \"array num:\".postcln;\n if(y[x.series(6,0,1).choose.postcln]==a,\n {\"lo encontraste!/found it!\".postcln;\n 1.do({GVerb.ar(\n EnvGen.ar(Env.perc(0.01,8),1,doneAction:2)*\n Blip.ar(XLine.kr(440,1600,8)),50,10,0.02)}.play);\n ~mxfkdp.stop;\n m.stop;}, \n {\"buscando.../seeking...\".postcln;});\n 0.03.wait})});\n);\n//.SCtweetLong\n```"}, {"role": "assistant", "content": "this code throws a scrambled array of arrays seeking among them for the original array,\r\nIt only sounds when it founds it. (may take a while)\r\nthe idea started trying a SCtweet, but became with this funny code!."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n/* Audio plugin definition\n\n Each audio plugin should define the following global variables:\n ~name: (symbol) name of the spatializer\n ~description: (string) a short description\n ~function: the actual definition of the plugin\n\n*/\n\n~name = \\testtone;\n~description = \"a standard test tone (sine)\";\n~channelLayout = \\mono;\n\n~function = {| sfreq = 200 |\n FSinOsc.ar(sfreq)\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// Let's extract the DC component - i.e. the magnitude at binindex zero.\n(\n{\n var sig, chain, stream, windowStarts, demand;\n var fftsize = 1024;\n\n sig = SinOsc.ar(LFDNoise3.kr(LFNoise0.kr(1) * 40 + 60) * 700 + 800);\n\n chain = FFT(LocalBuf(fftsize), sig);\n stream = Unpack1FFT(chain, bufsize: fftsize, binindex: 0, whichmeasure: 0);\n\n // each time an FFT window starts, the unpacker returns a new value\n windowStarts = chain > -1;\n demand = Demand.kr(windowStarts, 0, stream);\n demand.poll(\n// …\n```"}, {"role": "assistant", "content": "Let's extract the DC component - i.e. the magnitude at binindex zero. each time an FFT window starts, the unpacker returns a new value (Unpack1FFT: Unpack a single value (magnitude or phase) from an FFT chain)"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n(\n~loDev = -6;\n~hiDev = 5;\n~lookBack = 2;\n\np = Pbind(\n \\dur, 0.2,\n \\midinote, PIdev(72, 11, Pfunc { ~loDev }, Pfunc { ~hiDev }, Pfunc { ~lookBack }).trace(prefix: \"midi \"),\n).play;\n);\n\n// change on the fly\n// as lookBack equals 2, this defines a fixed sequence (up or down anyway)\n\n(\n~loDev = -1;\n~hiDev = 1;\n);\n\n// widen range\n\n(\n~loDev = -6;\n~hiDev = 5;\n);\n\n// force a twelve-tone row\n\n~lookBack = 11;\n\n\n// cont\n// …\n```"}, {"role": "assistant", "content": "as lookBack equals 2, this defines a fixed sequence (up or down anyway) force a twelve-tone row (PIdev: pattern searching for numbers with integer distance from a source pattern, optionally avoiding repetitions within a span)"}]} -{"conversations": [{"role": "user", "content": "What is `SequenceableCollection`?"}, {"role": "assistant", "content": "SequenceableCollection — Abstract superclass of indexable collections"}, {"role": "user", "content": "What does `SequenceableCollection.series` do?"}, {"role": "assistant", "content": "Fill a SequenceableCollection with an arithmetic series. `Array.series(5, 10, 2);`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// using numbers as score\n[3, [1, 2, 1], 1].convertRhythm; // List[0.75, 1.5, 0.75]\n[2, [1, 3, [1, [2, 1, 1, 1]], 1, 3], 1].convertRhythm;\n[2, [1, [1, [2, 1, 1, 1]]], 1].convertRhythm;\n[2, [1, [1, [2, 1, 1, 1]]], 2].convertRhythm; // repeat\n[2, [1, [1, [2, 1, 1, -1]]], 2].convertRhythm; // negative value is tied over.\n\n// sound example\nPbind(\\degree, Pseries(0, 1, inf), \\dur, Pseq([2, [1, [1, [2, 1, 1, -1]]], 2].convertRhythm)).play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Granular electromaton."}, {"role": "assistant", "content": "```supercollider\n(\nServer.local.waitForBoot({\n(\nz.free;\nz = Buffer.alloc(s, 512, 1);\nz.sine1(1.0 / [1, 2, 3, 4], true, true, true);\n\n fork( { loop {\n SynthDef(\"g1\",{ arg out=0,bufnum=0,dur=1,rate=1,pos=0,sdens=1,edens=1;\n var dens = Line.kr(sdens,edens,dur);\n var trig = [LFNoise0,SinOsc,Impulse,LFPulse,LFSaw].choose.ar(Line.kr(sdens,edens,dur));\n //var env = EnvGen.kr(Env.perc(0.0001.rrand(0.1),dur*0.5.rrand(2)),doneAction:2);\n var env = EnvGen.kr(Env.perc(0.0001.rrand(0.1),dur*(0.5.rrand(4))),doneAction:2);\n Out.ar(out,\n GrainBuf.ar(2,trig,1/dens,bufnum,rate,pos)*env;\n )\n }).add();\n [1,2,4,8,16,32].choose.postln.wait;\n }\n }\n );\n\n\na = Pbind(\\instrument,\\g1,\\dur,Pseq([Pseq([0.25],32),Pseq([0.25,0.125,0.125],32),Pseq([0.125],32)],inf),\\sdens,Pseq([9000,1000,500]/10,inf),\\edens,Prand([Pseq([9000,1000,500]/10,4),Pseq([1],1)],inf),\\rate,Pfunc({-10.0.rrand(10)}),\\pos,Pfunc({1.0.rand}),\\bufnum,z.bufnum);\nb = Pbind(\\instrument,\\g1,\\dur,Pseq([4],inf),\\sdens,Pseq([9000,1000,500]/100,inf),\\edens,Prand([Pseq([9000,1000,500]/10,1),Pseq([1],3)],inf),\\rate,Pfunc({-10.0.rrand(10)}),\\pos,Pfunc({-10.0.rrand(10)}),\\bufnum,z.bufnum);\nc = Pbind(\\instrument,\\g1,\\dur,Pseq([4/3],inf),\\sdens,Pseq([9000,1000,500,25],inf),\\edens,Prand([Pseq([9000,1000,500,25],1),Pseq([1],4)],inf),\\rate,Pfunc({-100.0.rrand(100)}),\\pos,Pfunc({-10.0.rrand(10)}),\\bufnum,z.bufnum);\n\n\na =a.play;\nb =b.play;\nc =c.play;\n\n)\n});\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `View.maxHeight` do? What arguments does it take?"}, {"role": "assistant", "content": "Set maximum allowed height of the view, the view will not be able to grow larger in height, neither by user interaction nor Arguments: height — An Int.."}]} -{"conversations": [{"role": "user", "content": "What does `MIDIIn.program` do? What arguments does it take?"}, {"role": "assistant", "content": "receive MIDI messages Arguments: value — a Function evaluated whenever a MIDI program change message is received. It is passed the following arguments:."}]} -{"conversations": [{"role": "user", "content": "What is `MIDIFuncChanArrayMessageMatcher` in SuperCollider?"}, {"role": "assistant", "content": "MIDIFuncChanArrayMessageMatcher — Matches incoming MIDI messages to responder funcs based on message channel This is used by MIDIMessageDispatcher to match incoming MIDI messages to instances of MIDIFunc or MIDIdef using MIDI channel (when the MIDIFunc specifies an array of channels). This class is private, and generally users should not need to address instances directly. Category: External Control > MIDI > Matchers."}]} -{"conversations": [{"role": "user", "content": "What does `Interface.init` do? What arguments does it take?"}, {"role": "assistant", "content": "Sets up an environment in which you can build a player, a GUI and responders for midi and keyboard control Arguments: i; a."}]} -{"conversations": [{"role": "user", "content": "What does `MxMixerGui.updateFaders` do?"}, {"role": "assistant", "content": "Mixing console with faders, mutes, solos and scope"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Basic tone simulator of a stylophone?"}, {"role": "assistant", "content": "```supercollider\n/*\nRetro Stylophone\n\nReverse engineered from: https://www.waitingforfriday.com/?p=334\n\n1. Relaxation oscillator (UJT)\n\n- generated by a combination of two oscillators. The primary oscillator is a\n current controlled PUT (Programmable Uni-Junction Transistor) relaxation oscillator which is\n responsible for generating the overall tone of the instrument.\n A secondary LFO phase-shifted provides the vibrato\n (the relative slow wavering of a sound around the notes centre pitch)\n\n- around 10 VPP\n\n2. LFO phase-shift (vibrato)\n\n- generated by a low-frequency oscillator made with a transistor and several capacitors,\n which produces a triangle/sine wave fed into the frequency control voltage operating the UJT\n\n- frequency of about 8.5Hz, phased shifted of 180 degree, around 4.2 VPP\n*/\n\n(\nSynthDef(\\stylophone, { |freq = 220, vibAmp = 2, toneAmp = 5, atkTime = 0.01, trigger = 0|\n\n var lfo = OnePole.kr(LFPar.kr(8, mul: vibAmp, add: freq), 0.9); // 180 degree inversion\n var relaxOsc = LFPulse.ar(lfo, width: 0.9, mul: toneAmp);\n\n var asr = EnvGen.kr(Env.asr(atkTime * 5, releaseTime: 0.001, curve: \\lin), gate: trigger);\n\n Out.ar(0, relaxOsc * asr)\n}).add\n);\n\nf = Synth(\\stylophone);\n\nf.set(\\freq, 208.2);\nf.set(\\freq, 233.4);\n\nf.set(\\trigger, 1);\nf.set(\\trigger, 0);\nf.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ Pan2.ar(SinOsc.ar(440) * 0.2, SinOsc.kr(0.1)) }.play;\n```"}, {"role": "assistant", "content": "A sine that slowly moves between the speakers.\n\n`SinOsc.kr(0.1)` is a control-rate sine at 0.1 Hz — one cycle every 10 seconds — running between -1 and 1.\n`Pan2.ar(sig, pos)` treats that as the pan position, where -1 is hard left, 0 centre, 1 hard right, so the\nsound drifts across the stereo field. Pan2 is equal-power, so the centre is -3 dB per channel rather than\nhalf amplitude on each. The `* 0.2` sets the level before panning."}]} -{"conversations": [{"role": "user", "content": "What does `PV_Control.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Tracks Magnitudes and Reduces Output of Bins Arguments: buffer0 — Buffer created by the FFT when analysing the incoming signal.; buffer1 — Buffer to which PV_Control writes the alterations to be made to the magnitude of each bin. These values are scaled to be sent to MidEQ UGens, which will reduce the magnitude of the bins being attenuated. thresh=0.6, mulFactor=0.8, limiter=10, attackReleaseFrames=50, sustainZeroFrames= 100, waitGoFra; thresh — Magnitude is summed over time and multiplied by mulFactor. When a bin accumulates magnitude that crosses this threshold, it will be zeroed out. Lower numbers == quicker detection of feedback.; mulFactor — Summed amplitude over time is multiplied by this number. Lower numbers == quicker detection of feedback.; limiter — Limits the maximum magnitude of each of the bins.; attackReleaseFrames — The number of frames the algorithm takes to ramp the magnitude of the bin down from 1*mag to 0*mag.; sustainZeroFrames — The number of frames the bin is held to a magnitude of 0.; waitGoFrames — The number of frames algorithm waits before it starts to duck the incoming signal.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// increase phase multiplier\n{ FBSineC.ar(SampleRate.ir, 1, 0, XLine.kr(1, 2, 10), 0.1) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// increase phase multiplier\n{ FBSineC.ar(SampleRate.ir, 1, 0, XLine.kr(1, 2, 10), 0.1) * 0.2 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Modulating GVerb roomsize, among other things?"}, {"role": "assistant", "content": "```supercollider\nNdef(\\b, { LFDNoise0.ar(500)});\nNdef(\\c, { LFDNoise1.ar(0.3).range(5,15)});\nNdef(\\d, { LFDNoise3.ar(SinOsc.kr(0.1, 0, 1000, 300), 200, 200)});\nNdef(\\a, { Limiter.ar(GVerb.ar(SinOsc.ar(Ndef(\\d), mul: Ndef(\\b)), roomsize: Ndef(\\c) ) )});\nNdef(\\a).play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Unpack1FFT`."}, {"role": "assistant", "content": "```supercollider\n// Let's extract the DC component - i.e. the magnitude at binindex zero.\n(\n{\n var sig, chain, stream, windowStarts, demand;\n var fftsize = 1024;\n\n sig = SinOsc.ar(LFDNoise3.kr(LFNoise0.kr(1) * 40 + 60) * 700 + 800);\n\n chain = FFT(LocalBuf(fftsize), sig);\n stream = Unpack1FFT(chain, bufsize: fftsize, binindex: 0, whichmeasure: 0);\n\n // each time an FFT window starts, the unpacker returns a new value\n windowStarts = chain > -1;\n demand = Demand.kr(windowStarts, 0, stream);\n demand.poll(windowStarts);\n\n sig * 0.05\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes sine ocean."}, {"role": "assistant", "content": "```supercollider\n(\n//fundamental pitch triad\n~notes = [45,55,60].midicps;\n\ns.waitForBoot({\n Routine{\n\n SynthDef.new(\\tone, {\n arg freq=440, pan=0, rel=0.05;\n var sig;\n sig = SinOsc.ar(freq);\n sig = sig * EnvGen.kr(Env.perc(0.005,rel), doneAction:2);\n sig = Pan2.ar(sig, pan, 0.05);\n Out.ar(0, sig);\n }).add;\n\n s.sync;\n\n 50.do{\n Pbind(\n \\instrument, \\tone,\n\n //trace some event times just for fun\n \\dur, Pseq(Array.geom(50, rrand(1.5,1.51), rrand(0.923,0.929)).mirror,inf).trace,\n\n \\freq, exprand(~notes[0],8000).round(~notes[0]),\n \\pan, rrand(-1.0,1.0),\n \\rel, exprand(0.005,0.35),\n ).play;\n\n Pbind(\n \\instrument, \\tone,\n \\dur, Pseq(Array.geom(50, rrand(1.5,1.51), rrand(0.923,0.929)).mirror,inf),\n \\freq, exprand(~notes[1],11000).round(~notes[1]),\n \\pan, rrand(-1.0,1.0),\n \\rel, exprand(0.005,0.35),\n ).play;\n\n Pbind(\n \\instrument, \\tone,\n \\dur, Pseq(\n Array.geom(50, rrand(1.5,1.51), rrand(0.923,0.929)).mirror,inf\n ),\n \\freq, exprand(~notes[2],15000).round(~notes[2]),\n \\pan, rrand(-1.0,1.0),\n \\rel, exprand(0.005,0.35),\n ).play;\n };\n }.play(AppClock);\n});\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `PSVdif_o.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new PSVdif_o Arguments: genList — An array of generators and corresponding offsets. Allowed generators: Integers, Streams or Patterns producing intervals or Sieves itself. Integers and Stream/Pattern output must be strictly positive. Integers as generators produce zero and its positive multiples. Offsets must be integers.; maxLength — Integer. Maximum number of items, which the stream will return. Defaults to inf.; limit — Integer. Limit up to which integers can be returned by the stream. If no limit is passed, returned integers might go up to default limit 65536.."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(// * //watch the postWindow\na=[\"m\",\"x\",\"f\",\"k\",\"d\",\"p\"];\nx=Array;\ny=x.newClear(6);\n~mxfkdp=Task({\n inf.do({y.put(x.series(6,0,1).choose,a.scramble).postln;\n 0.03.wait;})}).play;\nm=fork({inf.do({\n \"array num:\".postcln;\n if(y[x.series(6,0,1).choose.postcln]==a,\n {\"lo encontraste!/found it!\".postcln;\n 1.do({GVerb.ar(\n EnvGen.ar(Env.perc(0.01,8),1,doneAction:2)*\n Blip.ar(XLine.kr(440,1600,8)),50,10,0.02)}.play);\n ~mxfkdp.stop;\n m.stop;}, \n {\"buscando.../seeking...\".postcln;});\n 0.03.wait})});\n);\n//.SCtweetLong\n```"}, {"role": "assistant", "content": "this code throws a scrambled array of arrays seeking among them for the original array,\r\nIt only sounds when it founds it. (may take a while)\r\nthe idea started trying a SCtweet, but became with this funny code!."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LFDClipNoise`."}, {"role": "assistant", "content": "```supercollider\n// try wiggling the mouse quickly;\n// LFNoise frequently seems stuck, LFDNoise changes smoothly.\n\n{ LFClipNoise.ar(MouseX.kr(0.1, 1000, 1), 0.1) }.play\n\n{ LFDClipNoise.ar(MouseX.kr(0.1, 1000, 1), 0.1) }.play\n\n// silent for 2 secs before going up in freq\n\n{ LFClipNoise.ar(XLine.kr(0.5, 10000, 3), 0.1) }.scope;\n\n{ LFDClipNoise.ar(XLine.kr(0.5, 10000, 3), 0.1) }.scope;\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFClipNoise.ar(XLine.kr(1000, 20000, 10), 0.1) }.scope;\n\n{ LFDClipNoise.ar(XLine.kr(1000, 20000, 10), 0.1) }.scope;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// Reminder: This isn't the intended typical usage! It's OK to do this though.\n(\nx = {\n var mags, phases, chain, sig;\n // Create simple undulating magnitudes\n mags = { FSinOsc.kr(ExpRand(0.1, 1)).range(0, 1) }.dup(100);\n // Then give them a \"rolloff\" to make the sound less unpleasant\n mags = mags * ((1, 0.99 .. 0.01).squared);\n // Let's turn the bins on and off at different rates, I'm *sure* that'll sound interesting\n mags = mags * { LFPulse.kr(2 ** IRand(-3, 5)).range(0, 1) }.dup(100);\n // Let's ignore phase for now\n phases = 0.\n// …\n```"}, {"role": "assistant", "content": "Reminder: This isn't the intended typical usage! It's OK to do this though. Create simple undulating magnitudes (FFTTrigger: Outputs the necessary signal for FFT chains, without doing an FFT on a signal)"}]} -{"conversations": [{"role": "user", "content": "What does `FoaDecoderMatrix.newMono` do? What arguments does it take?"}, {"role": "assistant", "content": "Virtual microphone monophonic Arguments: theta — Azimuth angle, in radians: pi to pi.neg.; phi — Elevation angle, in radians: pi/2 to pi.neg/2.; pattern — Virtual microphone pattern, 0 to 1:."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nt = SortedList.new(8, {|a,b| a.first < b.first });\nt.add([10, \"last\"]);\nt.add([1, \"first\"];\nt.postln;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nt = SortedList.new(8, {|a,b| a.first < b.first });\nt.add([10, \"last\"]);\nt.add([1, \"first\"]);\nt.postln;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes random 303."}, {"role": "assistant", "content": "```supercollider\n(\n{ var lk = [0,3,7,9], jx = [3,4,2,4,2], n, ox = 10, qw, cx, oi,z,w, faz, mp,\n cs = [Select,Stepper,RLPF,LFTri,Pulse,PulseDivider,Lag2,Lag,EnvGen,\n Saw, LPF, PitchShift, AllpassN, Env, LocalIn, LocalOut, Impulse ];\n var fa,ffa, ra, eca, era, fsa, xc, fxc, rq, ec, er,xcs, o,e;\n mp = {… |n,alk| alk = alk ? lk; \n {midicps(jx .choose * 12 + lk.choose) } !n }; \n faz = [ mp.(3)* 2.midiratio, mp.( 3 )\n *1. midiratio, mp.( 2,[ 0,3,9 ])*5.midiratio,mp.(1 )*1.midiratio ]; \n fa = faz[[3,0,3,1,2,2,2,2, 1,1,1,1,0,3]].flat; \n n = fa.size; \n qw = Impulse.kr(10); \n cx = PulseDivider.kr(qw, n); \n oi = Stepper.kr(qw,0,0,n-1); \n fsa = { [0,0,0, 0.02,0.08,0.1 ].choose }!div(n,4); \n xcs = Select.kr( Stepper.kr( qw,0,0,fsa.size-1 ), fsa); \n xc = Lag2.kr( Select.kr(oi, fa), xcs ); \n ffa = { rrand( 20, 90 ) } ! n;\n ffa.size.do({ |i| var pn = [2,4,8].choose;\n if ( 0.2.coin, { ffa[i] = Select.kr(Stepper.kr(cx, 0,0,pn-1), { rrand( 4, 70 ) } ! n) }) });\n fxc = Lag2.kr( Select.kr(oi, ffa), 0.04);\n ra = { rrand(0.05,0.5) } ! n;\n rq = Lag.kr( cs[0].kr(oi, ra), 0.04);\n eca = { [-4,0,-1].choose } ! n;\n ec = Select.kr(oi,eca);\n o = Saw.ar(xc) + Pulse.ar(xc * 0.01.midiratio,1-rq) + Pulse.ar(xc *0.04.midiratio,LFTri.ar(ox/n).range(0.1,0.9),0.02) + Pulse.ar(xc *\n 24.midiratio,LFTri.ar(ox/n/4).range(0.8,0.01),0.05);\n era = { rrand(0.8,0.4) } ! 4;\n er = Select.kr(cs[1].kr(qw, 0,0,3), era);\n e = Env.new([0,1,0],[xcs/5,er],ec);\n e = EnvGen.kr(e, gate:qw);\n fxc = fxc * [1.02, 0.98];\n xc = xc * [0.8,1.2].scramble;\n z = cs[2].ar(o, (fxc * e).midiratio * xc, rq) + (cs[2].ar(o.neg, fxc * (50 * e)\n .midiratio, 0.4) *0.05) + (cs[2].ar(o.neg, fxc * (65 * e).midiratio, rq/2) *0.01) * e;\n z = (z + (cs[11].ar(z,0.001,0.5,0.1,0.1).distort * 0.5)).distort;\n w = z+ cs[14].ar (2). distort;\n 10.do({ w = cs[12].ar(w,0.4,{0.03.rand}!2,{0.06.rand}!2) });\n cs[15].ar(cs[10].ar( w*0.9,800 )); (w *0.1 ) + (z * 0.7) }.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Swarm of sound files."}, {"role": "assistant", "content": "```supercollider\nb = SoundFile.collectIntoBuffers(\"yourSoundFileFolder/*\"); // By Bjørn Houdorf, December 21, 2012\n\n(\n{\nvar number = b.numChannels, randomNumber, trigger, delayed, panned, sound, mixedSound, rotatedSound;\ntrigger = Dust.kr(Array.fill(number,1), 1, -0.5); // Generates random impulses from -0.5 to 0.5. as a excitation function\nrandomNumber = TRand.kr(1, number, trigger);\nsound = PlayBuf.ar(Array.fill(number,1) ,randomNumber,1,trigger,0,0); // play sound files\ndelayed = DelayL.ar(sound, trigger, trigger); // delaying the sound files\npanned = Pan2.ar(delayed, Array.fill(number,{1.0.rand2})); // pan them out in the stereo field\nmixedSound = 0.05*Mix.new(panned);// and mix them to one stereo signal\nrotatedSound = Rotate2.ar(mixedSound[0], mixedSound[1], LFSaw.kr(0.05)); // rotate stereo signal\n}.play; // play it all\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `AudioIn`."}, {"role": "assistant", "content": "```supercollider\n// patching input to output\n\n// beware of the feedback\n\n(\nServerOptions.inDevices.postln; // post available audio input devices\ns.meter; // display level meters for monitoring\nSynthDef(\\helpAudioIn, { |out|\n var input = AudioIn.ar(1); // first input\n // delay output to tame feedback in case of microphones are configured:\n Out.ar(out, CombN.ar(input * -25.dbamp, 0.5, 0.5, 0.001))\n}).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SimpleNumber.ramp` do?"}, {"role": "assistant", "content": "Map the receiver onto a ramp starting at `0.0`, ending at `1.0`, effectively clipping the receiver at [0,"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n \n// definition for future reference in arbitrary Environments\n\np = PLlprand(\\lo, \\hi);\n\n\n// prepare current Environment\n// PLseq repeats arg defaults to inf\n\n(\n~lo = 60;\n~hi = PLseq((92..62));\n);\n\n\n// run\n\n(\nx = Pbind(\n \\midinote, Ptuple(p!5), \n \\dur, 0.1,\n \\amp, 0.05\n).play;\n);\n\n\n// replace, converging bounds\n\n(\n~lo = PLseq((40..70) ++ (70!5));\n~hi = 70.5;\n);\n\nx.stop;\n```"}, {"role": "assistant", "content": "definition for future reference in arbitrary Environments prepare current Environment (PLlprand: dynamic scope Plprand variant)"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Scheduler`."}, {"role": "assistant", "content": "```supercollider\na = Scheduler(SystemClock);\n\na.sched(3, { \"now it is 3 seconds.\".postln; nil });\na.sched(5, { \"now it is 5 seconds.\".postln; nil });\na.sched(1, { \"now it is 1 second.\".postln; nil });\n\na.advance(0.5);\na.advance(0.5);\na.advance(2);\na.advance(2);\n\n// the beats, seconds and clock are passed into the task function:\na.sched(1, { |beats, secs, clock| [beats, secs, clock].postln });\na.advance(1);\n\n// the scheduling is relative to \"now\":\na.sched(3, { \"now it was 3 seconds.\".postln });\na.sched(5, { \"now it was 5 seconds.\".postln });\na.sched(1, { \"now it was 1 second.\".postln });\n\na.advance(0.5);\na.advance(0.5);\na.advance(2);\na.advance(2);\n\n// play a Routine or a task:\na.play(Routine { 5.do { |i| i.postln; 1.yield } });\na.advance(0.9);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SimpleNumber.gauss` do? What arguments does it take?"}, {"role": "assistant", "content": "Returns a Float sampled from a Gaussian distribution with mean `this` and standard deviation `standardDeviation`. The range of the gaussian distribution is unbounded and thus may return +/-inf; consider using Arguments: standardDeviation — The standard deviation.. Returns: Always returns a Float."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes old school noise from needle on vinyl."}, {"role": "assistant", "content": "```supercollider\n{\n var sig, sig1, sig2, lpf, popHz, lagtime, noise, popHzMul,\n pan1, pan2, panmod1, panmod2;\n popHzMul = Decay.kr(Dust.kr(0.15), 3, 10, 0.8);\n popHz = LFNoise1.kr(20).exprange(0.1,10) * popHzMul;\n sig = Dust2.ar(popHz);\n lpf = LFNoise1.kr(10).exprange(1000,20000);\n lagtime = LFNoise1.kr(20).range(0.008,0.0001);\n sig = LPF.ar(sig, lpf);\n sig = Lag.ar(sig, lagtime);\n sig = sig + FreeVerb.ar(sig, 0.8, 1, mul:0.11);\n panmod1 = LFNoise1.kr(5).range(0.2,0.7);\n panmod2 = LFNoise1.kr(5).range(0.2,0.7);\n pan1 = SinOsc.kr(panmod1).range(-0.2,0.2);\n pan2 = SinOsc.kr(panmod2).range(-0.2,0.2);\n sig1 = Pan2.ar(sig, pan1, 0.5);\n sig2 = Pan2.ar(sig, pan2, 0.5);\n sig = sig1 + sig2;\n sig = sig + BPF.ar(BrownNoise.ar([0.0025,0.0025]), 7200, 0.4);\n sig = sig + HPF.ar(Crackle.ar([1.999,1.999], 0.0025),2000);\n Out.ar(0, sig*6);\n}.play\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n var time = 30;\n var line = Line.kr(3000, 290, time);\n var line2 = Line.kr(280, 290, time);\n var line3 = Line.kr(0.01, 10, time);\n var sin = Mix.ar(SinOsc.ar([line, line2]) * SinOsc.ar(line3));\n var comb = CombC.ar(sin, time, SinOsc.kr(0.1).range(0.1, 0.2), time);\n var env = EnvGen.ar(Env.linen(0.01, time, 10), 1, doneAction:2);\n comb * env * 0.05!2;\n}.play\n)\n```"}, {"role": "assistant", "content": "Here is some quick code that sounds like an old sci-fi UFO landing."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pluck`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n// excitation signal is WhiteNoise, triggered twice a second with varying OnePole coef\n(\n { Pluck.ar(WhiteNoise.ar(0.1), Impulse.kr(2), 440.reciprocal, 440.reciprocal, 10,\n coef: MouseX.kr(-0.999, 0.999))\n }.play(s)\n);\ns.quit;\n// a group of angry fretless mandolin players\n(\n {\n var freq, numparts;\n numparts = 50;\n freq = SinOsc.kr(Array.fill(numparts, { Rand(0.05, 0.2) }),\n Array.fill(numparts, { Rand(0, 1.0) })).range(1000, 3000);\n LeakDC.ar(\n Pan2.ar(\n Pluck.ar(\n WhiteNoise.ar(0.1).dup(numparts),\n Impulse.kr(Array.fill(numparts, { Rand(10, 12) })),\n 100.reciprocal, freq.reciprocal, 2, Rand(0.01, 0.2), mul: 1),\n Array.fill(numparts, { Rand.new(-1.0, 1.0) }))\n .sum\n );\n }.play(s);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for midified arpeggiator/auto-accompaniment using patterns."}, {"role": "assistant", "content": "```supercollider\n(\ns.waitForBoot({\n var right, left;\n var n0, n1, n2;\n var note_getter;\n\n MIDIdef.freeAll;\n if (~midi_initilized.isNil) {\n MIDIClient.init;\n MIDIIn.connectAll;\n ~midi_initialized = 1;\n };\n\n ~note_table = 0!127;\n ~n = nil;\n\n MIDIdef.noteOn(\n \\mynoteonhandler, // just a name for this handler\n {\n |val, num, chan, src|\n ~note_table[num] = 1; // update note table and update ~n\n ~n = ~note_table.selectIndices({|item, i| item != 0});\n }\n );\n\n MIDIdef.noteOff(\n \\mynoteoffhandler, // just a name for this handler\n {\n |val, num, chan, src|\n ~note_table[num] = 0; // update note table and update ~n\n /*\n // only enable the following lines if you want the arpeggio to stop as soon as you release the keys\n ~n = ~note_table.selectIndices({|item, i| item != 0});\n if (~n == []) { ~n = nil; };\n */\n }\n );\n\n note_getter = {\n | index |\n Plazy {\n if (~n.isNil) {\n Pseq([Rest(1)]);\n } {\n ~n[index] ?? (~n[0] ?? Pseq([Rest(1)]));\n };\n };\n };\n\n n0 = note_getter.(0);\n n1 = note_getter.(1);\n n2 = note_getter.(2);\n\n right = Pbind(\n \\instrument, \\default,\n \\midinote, Pseq([ n0, n2, n1, n2] ++ (([ n0, n2, n1, n2] + 12)!2).flatten),\n \\dur, Pseq([1, 1, 1, 1, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5 ].normalizeSum*2)\n );\n left = Pbind(\n \\instrument, \\default,\n \\midinote, Pseq([ n0, n2, n0, n2, n0, n2, n0, n2] - 12),\n \\dur, Pseq([1, 1, 1, 1, 1, 1, 1, 1].normalizeSum*2)\n );\n if (~player.notNil) { ~player.stop; };\n ~player = Pn(Ppar([right,left])).play;\n});\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Josh Parmenter (2007) record scratcher?"}, {"role": "assistant", "content": "```supercollider\n// Josh Parmenter (2007)\n// record scratcher\n\nSynthDef(\\scratch, {arg gate = 1, buffer;\n var buf, speed, env;\n env = EnvGen.kr(\n Env([0,1,0], [0.1, 0.1], \\sin, 1),\n gate, doneAction: 20);\n speed = MouseX.kr(-10, 10);\n speed = speed - DelayN.kr(speed, 0.1, 0.1);\n speed = MouseButton.kr(1, 0, 0.3) + speed ;\n buf = PlayBuf.ar(1, buffer, speed * BufRateScale.kr(buffer), loop: 1);\n Out.ar(0, (buf * env).dup );\n}).add;\n\ns.boot;\n\n// path to a mono soundfile here\na = Buffer.read(s, ExampleFiles.child);\n\nb = Synth(\\scratch, [\\buffer, a]);\n\n// move mouse to scrub the record.\n// press mouse button to 'stop the record', you can scrub while it is stopped.\n\n// stop the synth\nb.set(\\gate, 0);\n// free the Buffer\na.free;\n```"}]} -{"conversations": [{"role": "user", "content": "How do I put reverb on everything?"}, {"role": "assistant", "content": "Send it: one private bus, one FreeVerb instance reading it, and every instrument writing dry to the master and wet to the bus.\n\n```supercollider\n~verb = Bus.audio(s, 2);\nSynthDef(\\verb, { |in = 0| Out.ar(0, FreeVerb.ar(In.ar(in, 2), 0.5, 0.85, 0.5) * 0.7) }).add;\nSynth(\\verb, [\\in, ~verb]);\n```"}, {"role": "user", "content": "Too much reverb now."}, {"role": "assistant", "content": "Lower the wet mix and the return level, not the room size: the room is what makes it sound like a space, the mix is how much of it you hear. `FreeVerb.ar(In.ar(in, 2), 0.25, 0.85, 0.5) * 0.5`. To change it live without restarting, add a control and `.set` it: `|mix = 0.5|` then `~verbSynth.set(\\mix, 0.25)`."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Blip`."}, {"role": "assistant", "content": "```supercollider\n// modulate frequency\n{ Blip.ar(XLine.kr(20000, 200, 6), 100, 0.2) }.play;\n\n// modulate numharmonics\n{ Blip.ar(200, Line.kr(1, 100, 20), 0.2) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What is `EaseOutInBack` in SuperCollider?"}, {"role": "assistant", "content": "EaseOutInBack — Back ease-out/in Easing equation for a back (overshooting cubic easing: (a+1)*t^3 - a*t^2) ease-out/in, decelerating until halfway, then accelerating. The a parameter controls overshoot, the default producing a 10% overshoot. Category: Ease."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n(\n#a, c = { TaskProxy.new } ! 2;\na.source = { \"one\".postln; 1.wait; \"two\".postln };\nc.source = { var z; z = Synth(\\default); 0.5.wait; z.release };\nr = Task {\n \"counting...\".postln;\n 2.wait;\n a.embedInStream;\n 1.wait;\n c.embedInStream;\n \"done.\".postln;\n};\n);\n\nr.play; // play a stream\n\nc.source = { var z; z = Synth(\\default, [\\freq, 300]); 1.5.wait; z.release }; // change the def\n\nr.reset;\nr.play;\n\n// of course Task\n// …\n```"}, {"role": "assistant", "content": "of course TaskProxies can be used in other Tdefs: if one wants to branch off a stream in a separate thread, asStream is used. (TaskProxy: event stream reference)"}]} -{"conversations": [{"role": "user", "content": "What does `PatchOut.allocBus` do? What arguments does it take?"}, {"role": "assistant", "content": "manages a Player's output when connecting to other Players Arguments: name; rate; numChannels."}]} -{"conversations": [{"role": "user", "content": "GrainBuf complains about too many grains."}, {"role": "assistant", "content": "The number of simultaneous grains is `density × dur` in seconds, and it exceeds maxGrains (512 by default). Either lower the trigger rate, shorten the grains, or raise the limit: `GrainBuf.ar(2, trig, dur, buf, 1, pos, 2, 0, -1, 1024)` — the 1024 is maxGrains. Raising it costs server CPU per grain, so prefer halving the density if the sound does not need it."}]} -{"conversations": [{"role": "user", "content": "What does `Tempo.clockDidClear` do?"}, {"role": "assistant", "content": "for control of tempo and for use in tempo based calculations"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Feedback with beats."}, {"role": "assistant", "content": "```supercollider\nNdef(\\a, {\n var src, loc, delay=0.01;\n src = Decay2.ar(Impulse.ar(1/8), LFNoise2.kr(4).range(0.001, 0.0001),\n LFNoise2.kr(4).range(0.005, 0.05))!2\n * Saw.ar(LFNoise2.kr(4).exprange(40, 4000));\n loc = BPF.ar(LocalIn.ar(2) + [src, 0], LFNoise0.kr(1/4).range(100, 1200).lag, 3.2);\n loc = GVerb.ar(loc, 100, 4, mul:0.02, add:loc);\n loc = Compander.ar(loc, loc, 0.9, 1, 0.001);\n loc = (loc * 0.501).tanh;\n loc = Compander.ar(loc, loc, 0.1, 1, 0.1); \n loc = DelayC.ar(loc, delay * 2, delay * 1);\n LocalOut.ar(loc.reverse * 0.49);\n Out.ar(0, loc * 0.9)\n}).play;\n\nNdef(\\b, {\n var src, loc, del;\n del = 1/100;\n src = Decay2.ar(TDuty.ar(1/4,0,Dseq([1, 0.5, 0.3, 0.1],inf)), \n LFNoise2.kr(4).range(0.001, 0.0001), LFNoise2.kr(4).range(0.005, 0.05))!2\n * Saw.ar(LFNoise2.kr(200).exprange(40, 14000));\n loc = BPF.ar(LocalIn.ar(2) + [src, 0], LFNoise2.kr(0.1).range(40, 400), 3.2);\n loc = GVerb.ar(loc, 100, 4, mul:0.02, add:loc);\n loc = Compander.ar(loc, loc, 0.9, 1, 0.001);\n loc = (loc * 0.51).tanh;\n loc = Compander.ar(loc, loc, 0.1, 1, 0.1); \n loc = DelayC.ar(loc, del * 2, del * 1);\n LocalOut.ar(loc.reverse * 0.45);\n Out.ar(0, Compander.ar(loc,loc,0.1, 1, 0.05) * 1.2)\n}).play;\n\nNdef(\\c, {\n var src, loc, del=1/4;\n src = Decay2.ar(Impulse.ar(1), 0.0001, 0.05) * SinOsc.ar(60);\n loc = src + LocalIn.ar(2);\n loc = BPF.ar(loc, 800, 3.2).softclip;\n loc = DelayN.ar(loc, del, [0, del]);\n LocalOut.ar(loc.reverse * 0.99);\n Out.ar(0, loc * 2)\n}).play;\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Lag2UD` in SuperCollider?"}, {"role": "assistant", "content": "Lag2UD — Exponential lag Lag2 is equivalent to Lag.kr(Lag.kr(in, time), time), thus resulting in a smoother transition. This saves on CPU as you only have to calculate the decay factor once instead of twice. See Lag for more details. Category: UGens > Filters."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Very artificial example - just filtering some noise.\ns.boot;\nb = Buffer.alloc(s,2048,1);\n(\nx = {\nvar in, chain, freq, rq, val;\n//freq = LFPar.kr(0.3).exprange(100, 1000);\nfreq = MouseY.kr(1000, 100, 1);\nrq = MouseX.kr(0.001, 10, 1);\nin = BPF.ar(WhiteNoise.ar, freq, rq);\nchain = FFT(b.bufnum, in);\n\nval = FFTSpread.kr(chain);\n\nOut.ar(0, in.dup * 0.1);\n(val * 0.000001).poll(10); // Poll but scaled down so more readable!\n}.play(s);\n;\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Very artificial example - just filtering some noise.\ns.boot;\nb = Buffer.alloc(s,2048,1);\n(\nx = {\nvar in, chain, freq, rq, val;\n//freq = LFPar.kr(0.3).exprange(100, 1000);\nfreq = MouseY.kr(1000, 100, 1);\nrq = MouseX.kr(0.001, 10, 1);\nin = BPF.ar(WhiteNoise.ar, freq, rq);\nchain = FFT(b.bufnum, in);\n\nval = FFTSpread.kr(chain);\n\nOut.ar(0, in.dup * 0.1);\n(val * 0.000001).poll(10); // Poll but scaled down so more readable!\n}.play(s);\n);\n\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `SmoothFoldS2` in SuperCollider briefly."}, {"role": "assistant", "content": "SmoothFoldS2 — wave folding pseudo ugen using sine segments, two fold ranges Wave folding using SmoothClipS. Values outside the range lo-hi are folded back, if the concerned foldRange > 0. A larger foldRange means less folding whereas a smaller foldRange causes more folding. The spectral result depends on the source wave form also but in general a smaller foldRange causes more energy in the higher spectrum whereas near foldRange == 0 the higher part of the spectrum again d Category: Libraries > miSCellaneous > WaveFolding."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\nq = Patch({ Saw.ar(40.midicps) * 0.05 });\nr = Patch({ Saw.ar(52.midicps) * 0.05 });\np = PlayerSocket.new(\\audio,1);\np.play;\n);\n// then get the socked to alternately spawn q and r\np.prepareAndQSpawn(q,0.1);\np.prepareAndQSpawn(r,0.1);\np.prepareAndQSpawn(q,0.1);\np.prepareAndQSpawn(r,0.1);\n\n\n(\np.prepareAndSpawn(\n Patch({ arg freq=400,gate=1.0;\n Saw.ar(freq) * EnvGen.kr(Env.adsr(0.1,2.\n// …\n```"}, {"role": "assistant", "content": "then get the socked to alternately spawn q and r the current player in the socket is set to : p.source (PlayerSocket: a player that can play other players using a cross-faded and fuse-protected socket)"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Duty`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// this is useful when two UGens need to be called, but only one of their outputs is needed\n(\n{\n var a, b, c;\n a = Dseq([1, 2, 3, 4], inf).dpoll(\"a\");\n b = Dseq([1955, 1952, 1823, 1452], inf).dpoll(\"b\");\n c = (a a 0.1;\n EnvGen.kr(Env.perc, trig, doneAction: Done.none) * SinOsc.ar(440, 0, 0.1)\n}.play\n // > outputs 0 or 1\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// trigger an envelope\n(\n{\n var trig;\n trig = SinOsc.ar(1) > 0.1;\n EnvGen.kr(Env.perc, trig, doneAction: Done.none) * SinOsc.ar(440, 0, 0.1)\n}.play\n) // > outputs 0 or 1\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Lag3`."}, {"role": "assistant", "content": "```supercollider\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n Lag3.kr( // lag the modulator\n LFPulse.kr(4, 0, 0.5, 50, 400), // frequency modulator\n Line.kr(0, 1, 15) // modulate lag time\n ),\n 0, // phase\n 0.3 // sine amplitude\n )\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `PdurStutter`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,0,1,3,4,0], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n100.do({ x.next.postln });\n);\n\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n);\n\n\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,4,4,0,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `LADSPA.ladspalist_path` do?"}, {"role": "assistant", "content": "set/get the location of the `ladspalist` binary, used to print a list of available"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Ref`."}, {"role": "assistant", "content": "```supercollider\n{ Klank.ar(`[[800, 1071, 1153, 1723], nil, [1, 1, 1, 1]], Impulse.ar(2, 0, 0.1)) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\delay;\n~description = \"Simple delay line\";\n~channelLayout = \\mono;\n~function = {|in = 0, del = 0.5|\n DelayC.ar(in, 2, del);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "My pattern keeps playing after I press Ctrl+."}, {"role": "assistant", "content": "Ctrl+. (CmdPeriod) stops everything scheduled on the clocks, including Patterns. If yours survives, it is not scheduled on a clock — most often it is a `Synth` created directly, or a `Task`/`Routine` started on `SystemClock` in a way that outlived the period. Do you still see the node in `s.plotTree`?"}, {"role": "user", "content": "Yes, there's a synth."}, {"role": "assistant", "content": "Then the sound is a node, not a pattern: `s.freeAll` will stop it. The likely cause is a SynthDef whose EnvGen has no `doneAction`, or a drone with `gate = 1` that nothing releases. Add `doneAction: 2` to the envelope, or keep a reference and `x.set(\\gate, 0)` when you want it to end."}]} +{"conversations": [{"role": "user", "content": "What does `AbstractFunction.linexp` do?"}, {"role": "assistant", "content": "An object which responds to a set of messages that represent mathematical functions"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nSynthDef(\\madtraffic, {|out, sig, gate=1, freq=440|\n // doneAction: 2 rilascia la synth quando EvnGen ha finito\n sig = (Blip.ar(freq)*0.7+Blip.ar(freq/2+Rand(1,12))*0.7)\n*EnvGen.kr(Env.asr(0.1, 0.3, 0.3), gate, doneAction:2);\n sig = RLPF.ar(sig,SinOsc.kr(0.3, 0, 200, 1500), 0.1);\n sig = FreeVerb.ar(sig, 0.5, 0.5, 0.5);\n Out.ar(out, sig);\n\n}).add;\n);\n\n(\nPbind(\n \\instrument, \\madtraffic,\n \\freq, Pseq([137, 373, Prand([237, 473, 713],1)], inf),\n \\legato, Pseq([1.7, 0.3], inf),\n \\dur, 0.3,\n \\out, Pseq([1, 0], inf)\n).play;\n)\n```"}, {"role": "assistant", "content": "\"It's the lack of eye contact that makes us more idiots, to the point that convertible riders give less to escalation. Closed in the car, explain the psychologists, we regress to childhood and react by shouting, or with that surrogate of the shock that is the horn.\"\r\n\r\n\r\n\r\nhttp://bz-buzz.blogspot.com/2018/09/mad-traffic.html\r\n\r\nhttp://bzakirasantjago.blogspot.it/."}]} +{"conversations": [{"role": "user", "content": "Explain `LFNoise2` in SuperCollider briefly."}, {"role": "assistant", "content": "LFNoise2 — Quadratic noise. Generates quadratically interpolated random values at a rate given by the nearest integer division of the sample rate by the `freq` argument. Category: UGens > Generators > Stochastic."}]} +{"conversations": [{"role": "user", "content": "What are the arguments of Pan2?"}, {"role": "assistant", "content": "`Pan2.ar(in, pos, level)` — in is the mono signal, pos is -1 (left) to 1 (right) with 0 in the middle, and level scales the output. It is equal-power, so a centred signal is -3 dB per channel rather than half amplitude. `Pan2.ar(sig, SinOsc.kr(0.1))` is the simplest autopan."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Standard2DC.ar(220, 11025, mul:0.3) }.play(s);\n\n// mouse-controlled param\n{ Standard2DC.ar(8000, 20000, MouseX.kr(0.9,4), mul:0.3) }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(Standard2DC.ar(10, 20, MouseX.kr(0.9,4))*800+900)*0.4 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Standard2DC.ar(220, 11025, mul:0.3) }.play(s);\n\n// mouse-controlled param\n{ Standard2DC.ar(8000, 20000, MouseX.kr(0.9,4), mul:0.3) }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(Standard2DC.ar(10, 20, MouseX.kr(0.9,4))*800+900)*0.4 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// linlin\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(mod.linlin(-1, 1, MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1))) * 0.1\n}.play;\n);\n\n// range\n(\n{\n var mod = LFNoise2.ar(80).range(MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1));\n SinOsc.ar(mod) * 0.1\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// linlin\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(mod.linlin(-1, 1, MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1))) * 0.1\n}.play;\n);\n\n// range\n(\n{\n var mod = LFNoise2.ar(80).range(MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1));\n SinOsc.ar(mod) * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a random pentatonic melody that plays by itself."}, {"role": "assistant", "content": "Pick degrees from a pentatonic scale; `\\scale` and `\\root` define the pitch space, and `\\degree`\npicks within it.\n\n```supercollider\n(\nPbind(\n \\instrument, \\default,\n \\scale, Scale.minorPentatonic,\n \\root, 3,\n \\degree, Pwhite(0, 9, inf),\n \\octave, 5,\n \\dur, Pwhite(0.12, 0.28, inf),\n \\amp, 0.2,\n \\legato, 0.8\n).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nMIDIIn.connectAll;\n// MIDIClient.init;\n\n\n(\n// A SynthDef with ADSR envelope\nSynthDef(\"quick2\", {arg freq = 440, amp = 0.1, gate = 1;\n var snd, env;\n env = Env.adsr(0.01, 0.1, 0.3, 2, amp).kr(2, gate);\n snd = Saw.ar(freq: [freq, freq*1.5], mul: env);\n Out.ar(0, snd)\n}).add;\n);\n\n// Play it with a MIDI keyboard\n(\nvar noteArray = Array.newClear(128); // array has one slot per possible MIDI note\n\nMIDIdef.noteOn(\\myKeyDown, {arg vel, note;\n noteArray[note] = Synth(\"quick2\", [\\freq, note.midicps, \\amp, vel.linlin(0, 127, 0, 1)]);\n [\"NOTE ON\", note].postln;\n});\n\nMIDIdef.noteOff(\\myKeyUp, {arg vel, note;\n noteArray[note].set(\\gate, 0);\n [\"NOTE OFF\", note].postln;\n});\n)\n// PS. Make sure SC MIDI connections are made (MIDIIn.connectAll)\n```"}, {"role": "assistant", "content": "Basic example - how to use a MIDI keyboard with a simple synth."}]} +{"conversations": [{"role": "user", "content": "What does `SCluster.xsetFrequencies` do? What arguments does it take?"}, {"role": "assistant", "content": "convenience method for CODE.xset(\\frequencies, ...) will Arguments: arr — an array of floats in Hz.."}]} +{"conversations": [{"role": "user", "content": "What is `PLbindef`?"}, {"role": "assistant", "content": "PLbindef — wrapper for Pbindef which allows replacement in object prototyping style"}, {"role": "user", "content": "What does `PLbindef.new` do?"}, {"role": "assistant", "content": "Creates a new PLbindef object or sets sources as with Pbindef."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n// synthdefs to play with\n\n(\nSynthDef(\\noise_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, rq = 0.1, amp = 0.1|\n var sig = { WhiteNoise.ar } ! 2;\n sig = BPF.ar(sig, freq, rq) *\n EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2) *\n (rq ** -1) * (250 / (freq ** 0.8));\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\sin_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { SinOsc.ar(freq, Rand(0, 2pi)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\saw_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { VarSaw.ar(freq, Rand(0, 1)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `DoubleWell2` in SuperCollider?"}, {"role": "assistant", "content": "DoubleWell2 — Forced DoubleWell Oscillator Improved Euler ODE solver implementation of the chaotic Forced Double Well Oscillator (see Strogatz, Steven H. (1994) Nonlinear Dynamics and Chaos. Addison-Wesley, Reading, MA. pp441-7). Category: UGens > Generators > Chaotic."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `QuadC`."}, {"role": "assistant", "content": "```supercollider\n// logistic map\n// equation: x1 = -r*x0^2 + r*x0\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n QuadC.ar(SampleRate.ir/4, r.neg, r, 0, 0.1) * 0.4;\n}.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Pexprand.new` do? What arguments does it take?"}, {"role": "assistant", "content": "random values that follow a Exponential Distribution Arguments: lo — lower boundary of values.; hi — upper boundary of values; length — number of values produced.."}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for get different result each time running the pattern: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\nTempoClock.default.tempo = 156/60;\n\n(\nSynthDef(\\spring, { |freq = 400, out = 0, pan = 0, gate = 1, dur = 0.15, curve = -4, amp = 1, index = 1|\n var sig = FreeVerb.ar(Pan2.ar(Blip.ar(freq, index), pan));\n var env = EnvGen.ar(Env.perc(0.01, dur, amp, curve), gate, doneAction:2);\n Out.ar(0, sig * env);\n}).add;\n);\n\n(\nPbind(*[\n instrument: \\spring,\n dur: Pseq([4, 1, 2, 1, 1, 1].scramble/ 4 / TempoClock.default.tempo, inf),\n degree: Pseq(#[1,2,3,4], inf) * Pkey(\\dur).reciprocal,\n octave: Pseq([2,3,4,4,4,3].scramble, inf),\n pan: Pxrand(Array.fill(100, { 0.gaussian(1).clip2(1) }), inf),\n amp: Pseq(#[0.95,1,0.8],inf),\n index: Pstutter(Pseq(#[4,8,12],inf), Pseq([2,3,4,5,6,8].scramble, inf))\n]).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `PLbindef`?"}, {"role": "assistant", "content": "PLbindef — wrapper for Pbindef which allows replacement in object prototyping style"}, {"role": "user", "content": "What does `PLbindef.new` do?"}, {"role": "assistant", "content": "Creates a new PLbindef object or sets sources as with Pbindef."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n// synthdefs to play with\n\n(\nSynthDef(\\noise_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, rq = 0.1, amp = 0.1|\n var sig = { WhiteNoise.ar } ! 2;\n sig = BPF.ar(sig, freq, rq) *\n EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2) *\n (rq ** -1) * (250 / (freq ** 0.8));\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\sin_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { SinOsc.ar(freq, Rand(0, 2pi)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\saw_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { VarSaw.ar(freq, Rand(0, 1)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for some pattern exprimenting: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\brumm, { |dur = 1, pan = 2, freq = 40, index = 20|\n var sig = Pan2.ar(\n Blip.ar(freq, index),\n pan\n ) * EnvGen.ar(Env.perc(0.01, dur), doneAction: 2);\n Out.ar(0, sig);\n}).add;\n);\n\n(\nPbind(*[\n dur: Pseq([1.2, 0.2, 0.5, Pseries(0.1, -0.001, 100)], inf),\n pan: Pxrand(#[-0.5, 0.5, 0.1, -0.1, 0.8, -1], inf),\n freq: 40,\n instrument: \\brumm\n]).play();\n);\n\n(\nPbind(*[\n dur: Pseq([1.2, 0.2, 0.5, Pseries(0.1, -0.001, 100)], inf),\n pan: Pxrand(#[-0.5, 0.5, 0.1, -0.1, 0.8, -1], inf),\n freq: Pseq([Pseries(140, 0.5, 200)], inf),\n instrument: \\brumm\n]).play;\n);\n\n(\nPbind(*[\n dur: Pseq(Signal.chebyFill(1024, Array.rand(10, 0.0, 10.0)).abs + 0.05, inf),\n pan: Pxrand(#[-0.5, 0.5, 0.1, -0.1, 0.8, -1], inf),\n freq: Pseq(Signal.chebyFill(1024, Array.rand(10, 0.0, 10.0)).abs * 18000 + 120, inf),\n instrument: \\brumm\n]).play;\n);\n\n\n(\nPbind(*[\n dur: Pseq([1.2, 0.2, 0.5, Pseries(0.1, -0.002, 50)], inf),\n pan: Pxrand(#[-0.5, 0.5, 0.1, -0.1, 0.8, -1, 1, -0.8], inf),\n freq: Pseq([Pseries(740, 0.5, 200), Pxrand(Array.series(740, 0.5, 200), 50)], inf),\n instrument: \\brumm\n]).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `UChain.setGain` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: gain — (describe argument here). Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\"help-out\", { |out = 0, freq = 440|\n var source;\n source = SinOsc.ar(freq, 0, 0.1);\n\n // write to the bus, adding to previous contents\n Out.ar(out, source);\n\n}).add;\n);\n\n\nSynth(\"help-out\", [\\freq, 500]);\nSynth(\"help-out\", [\\freq, 600]);\nSynth(\"help-out\", [\\freq, 700];\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\"help-out\", { |out = 0, freq = 440|\n var source;\n source = SinOsc.ar(freq, 0, 0.1);\n\n // write to the bus, adding to previous contents\n Out.ar(out, source);\n\n}).add;\n);\n\n\nSynth(\"help-out\", [\\freq, 500]);\nSynth(\"help-out\", [\\freq, 600]);\nSynth(\"help-out\", [\\freq, 700]);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a;\na = Pgeom(1.0, 1.1, inf);\na.asStream.nextN(100).plot;\n);\n\n\n// sound example\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\nvar a;\na = Pseries(300, 20, 70).asStream;\n{\n a.do { |val|\n Synth(\\help_sinegrain, [\\freq, val]);\n 0.02.wait;\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a;\na = Pgeom(1.0, 1.1, inf);\na.asStream.nextN(100).plot;\n);\n\n\n// sound example\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\nvar a;\na = Pseries(300, 20, 70).asStream;\n{\n a.do { |val|\n Synth(\\help_sinegrain, [\\freq, val]);\n 0.02.wait;\n }\n}.fork;\n);\n\n(\nPbind(\n \\dur, 0.01,\n \\instrument, \\help_sinegrain,\n \\freq, Pseries(800.0, Pbrown(-1.0, 3.0, 0.1, inf), inf)\n).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for attempt at emulating a breathing sound. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\n//s.options.memSize_(64000);\nTempoClock.tempo_(1.0);\n\ns.waitForBoot({\n SynthDef(\\breathe_in, {\n | out = 0, gate = 1, in1=0.11, in2=0.63, in3=0.18, amdb= -10 |\n var menv = EnvGen.kr(Env.new([0,1,1,0],[in1, in2, in3], curve:'lin'),\n gate,\n doneAction:Done.freeSelf);\n var noise = WhiteNoise.ar(amdb.dbamp);\n var f1 = BPF.ar(in:noise, freq:5790, rq:0.1, mul:-29.dbamp);\n var f2 = BPF.ar(in:noise, freq:3400, rq:0.2, mul:-16.dbamp);\n var f3 = BPF.ar(in:noise, freq:1990, rq:0.1, mul:-23.dbamp);\n var f4 = BPF.ar(in:noise, freq:1250, rq:0.1, mul:-26.dbamp);\n Out.ar(out, menv*(f1+f2+f3+f4)!2);\n }).add;\n\n SynthDef(\\breathe_out, {\n | out = 0, gate=1, out1=0.343, out2=0.387, amdb= -4.33 |\n var menv = EnvGen.kr(Env.new([0, 1, 0], [out1,out2], curve:'lin'),\n gate,\n doneAction:Done.freeSelf);\n var noise = WhiteNoise.ar(amdb.dbamp);\n var f1 = BPF.ar(in:noise, freq:2290, rq:0.1, mul:-17.dbamp);\n var f2 = BPF.ar(in:noise, freq:1290, rq:0.1, mul:-19.dbamp);\n var f3 = BPF.ar(in:noise, freq:490, rq:0.1, mul:-18.dbamp);\n Out.ar(out, menv*(f1+f2+f3)!2);\n }).add;\n\n\n s.sync;\n\n fork {\n 50.do({\n var in1 = 0.11.rrand(0.22);\n var in2 = 0.6.rrand(0.8);\n var in3 = 0.16.rrand(0.30);\n var pausein = 0.11.rrand(0.20);\n var out1 = 0.30.rrand(0.50);\n var out2 = 0.36.rrand(0.50);\n var pauseout = 0.11.rrand(0.20);\n var amdb = -10.0.rrand(-14.0);\n var amdb2 = amdb/2.5;\n //(\"in1: \" ++ in1 ++ \" in2: \" ++ in2 ++ \" in3: \" ++ in3 ++ \" pausein: \" ++ pausein ++ \" out1: \" ++ out1 ++ \" out2: \" ++ out2 + \" pauseout: \" ++ pauseout).postln;\n Synth(\\breathe_in, [\\in1, in1, \\in2, in2, \\in3, in3, \\amdb, amdb]);\n (in1+in2+in3+pausein).wait;\n Synth(\\breathe_out, [\\out1, out1, \\out2, out2, \\amdb, amdb2]);\n (out1+out2+pauseout).wait;\n });\n };\n\n});\n);\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `SystemClock` in SuperCollider briefly."}, {"role": "assistant", "content": "SystemClock — Clock running on separate accurately timed thread SystemClock is more accurate than AppClock, but cannot call GUI primitives. Category: Scheduling > Clocks."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Compare with Ex. 2 from DXFan help.\n// As DXFanOut, other than DXFan, doesn't return an array, a mix is not necessary, \n// by internal use of Out ugens the signal is mixed to the referred buses anyway.\n\n// For the same reason a normal release doesn't work, to get this option we can add an EnvGate.\n\n(\nx = {\n var lfo = { LFDNoise3.kr(0.2) };\n DXFanOut.ar(\n [Dseq([0, 1], inf), Dseq([1, 0], inf)],\n [\n LFTri.ar(150 * lfo.().range(1, 2), 0, 0.05),\n BPF.ar(PinkNoise.ar(), lfo.().range(1000, 3000),\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Compare with Ex. 2 from DXFan help.\n// As DXFanOut, other than DXFan, doesn't return an array, a mix is not necessary, \n// by internal use of Out ugens the signal is mixed to the referred buses anyway.\n\n// For the same reason a normal release doesn't work, to get this option we can add an EnvGate.\n\n(\nx = {\n var lfo = { LFDNoise3.kr(0.2) };\n DXFanOut.ar(\n [Dseq([0, 1], inf), Dseq([1, 0], inf)],\n [\n LFTri.ar(150 * lfo.().range(1, 2), 0, 0.05),\n BPF.ar(PinkNoise.ar(), lfo.().range(1000, 3000), 0.1, 0.7)\n ] * EnvGate(),\n fadeTime: 0.07,\n width: 1\n )\n}.play\n);\n\nx.release\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SequenceableCollection.unixCmdGetStdOut` do?"}, {"role": "assistant", "content": "Similar to #-unixCmd except that the stdout of the process is returned (synchronously) rather than sent to the post window. This object should be an array of strings where the first string is the path to the executable to be run and all other strings are passed as arguments to the executable. This method starts the process directly without using a shell. `~listing = [\"ls\", \"/\"].unixCmdGetStdOut; //"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PinkNoise`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-PinkNoise\", { |out = 0|\n Out.ar(out,\n PinkNoise.ar(0.4)\n )\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Synth.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Create and return a new Synth object, and immediately start the corresponding synth node on the Arguments: defName — A String or Symbol specifying the name of the SynthDef to use in creating the Synth.; args — An optional Array specifying initial values for the SynthDef's arguments (controls). These are specified in pairs of control name or index and value. If names are used they can be specified with either Strings or Symbols. e.g. `[\\frequency, 440, \\amplitude, 1, ...]`. Values that are arrays are sent ; target — A target for this Synth. If target is not a Group or Synth, it will be converted as follows: If it is a Server, it will be converted to the default_group of that server. If it is nil, to the default_group of the default Server. If it is an integer, it is created relative to a group with that id.; addAction — one of the following Symbols:."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\nSynthDef(\"help-Infreq\", { |bus|\n Out.ar(0, FSinOsc.ar(In.kr(bus), 0, 0.5));\n}).add;\n\nSynthDef(\"help-Outfreq\", { |freq = 400, bus|\n Out.kr(bus, SinOsc.kr(1, 0, freq/40, freq));\n}).add;\n\nb = Bus.control(s, 1);\n);\n\n// add the first control Synth at the tail of the default server; no audio yet\nx = Synth.tail(s, \"help-Outfreq\", [\\bus, b.index]);\n\n// add the sound producing Synth BEFORE it; It receives x's data from the previous cycle\ny = Synth\n// …\n```"}, {"role": "assistant", "content": "add the first control Synth at the tail of the default server; no audio yet add the sound producing Synth BEFORE it; It receives x's data from the previous cycle (In: Read a signal from a bus.)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// example signal to process\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n z * 0.8\n}.play\n);\n\n(\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n [z, Normalizer.ar(z, 0.4, 0.01)] * 0.5\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// example signal to process\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n z * 0.8\n}.play\n);\n\n(\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n [z, Normalizer.ar(z, 0.4, 0.01)] * 0.5\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Resonz`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"pitchFromNoise\", { arg out = 0;\n Out.ar(\n out,\n Resonz.ar(\n WhiteNoise.ar(15),\n LFNoise0.kr(2, 110, 660),\n 0.005\n )\n )\n}).add;\n);\n\n\n(\nSynth(\"ringModulation\");\nSynth(\"pitchFromNoise\", [\\out, 1]);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Trig.ar(Dust.ar(1), 0.2) * FSinOsc.ar(800, 0.5) }.play\n\n{ Trig.ar(Dust.ar(4), 0.1 }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Trig.ar(Dust.ar(1), 0.2) * FSinOsc.ar(800, 0.5) }.play\n\n{ Trig.ar(Dust.ar(4), 0.1) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Ringz` that runs as it is."}, {"role": "assistant", "content": "```supercollider\na = NodeProxy(s);\na[0] = { |freq = 440, dt=0.1, rate=2| Ringz.ar(Impulse.ar(rate * [1, 1.2]), freq, dt)*0.1 };\na.play;\n(\na[1] = \\set -> Pbind(\n \\dur, Prand([1, 0.5], inf),\n \\freq, Pwhite(200.0, 1000, inf),\n \\rate, Pdup(4, Prand([1, 3, 6, 10], inf)),\n \\dt, Pwhite(0.01, 0.1, inf)\n)\n);\n// modify the source in the meanwhile:\na[0] = { |freq = 440, dt=0.1, rate=2| Ringz.ar(Dust.ar(rate * 10.dup), freq, dt)*0.1 };\n\na.nodeMap.postln; // the values are not set in the node map.\na.clear(3);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `MxQuery.outlets` do?"}, {"role": "assistant", "content": "Like inlets but returns Returns: an MxQuery with just outlets"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `QuadC`."}, {"role": "assistant", "content": "```supercollider\n// logistic map\n// equation: x1 = -r*x0^2 + r*x0\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n QuadC.ar(SampleRate.ir/4, r.neg, r, 0, 0.1) * 0.4;\n}.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `EventSource.reactimate` do?"}, {"role": "assistant", "content": "Implementation of Functional Reactive Programming. Returns: nil"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Osc`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\ns = Server.local;\nb = Buffer.alloc(s, 512, 1);\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, true, true);\n\nSynthDef(\"help-Osc\", { |out = 0, bufnum = 0|\n Out.ar(out,\n Osc.ar(bufnum, 200, 0, 0.5)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n);\n\n(\ns = Server.local;\nb = Buffer.alloc(s, 512, 1);\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, true, true);\n\nSynthDef(\"help-Osc\", { |out = 0, bufnum = 0|\n Out.ar(out,\n Osc.ar(bufnum, XLine.kr(2000, 200), 0, 0.5) // modulate freq\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n);\n\n\n(\ns = Server.local;\nb = Buffer.alloc(s, 512, 1);\nb.sine1([1.0], true, true, true);\n\nSynthDef(\"help-Osc\", { |out = 0, bufnum = 0|\n Out.ar(out,\n Osc.ar(bufnum,\n Osc.ar(bufnum,\n XLine.kr(1, 1000, 9),\n 0,\n 200,\n 800),\n 0,\n 0.25)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n);\n\n\n(\n// modulate phase\ns = Server.local;\nb = Buffer.alloc(s, 512, 1);\nb.sine1([1.0], true, true, true);\n\nSynthDef(\"help-Osc\", { |out = 0, bufnum = 0|\n Out.ar(out,\n Osc.ar(bufnum,\n 800,\n Osc.ar(bufnum,\n XLine.kr(20, 8000, 10),\n 0,\n 2pi),\n 0.25)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n);\n\n\n\n(\n// change the buffer while its playing\ns = Server.local;\nb = Buffer.alloc(s, 4096, 1);\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, true, true);\n\nSynthDef(\"help-Osc\", { |out = 0, bufnum = 0|\n Out.ar(out,\n Osc.ar(bufnum, [80, 80.2], 0, 0.2)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n);\n\n(\nfork {\n var n = 32;\n 50.do {\n b.sine1(Array.rand(n, 0, 1).cubed, true, true, true);\n 0.25.wait;\n };\n};\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `CombL`."}, {"role": "assistant", "content": "```supercollider\n// These examples compare the variants, so that you can hear the difference in interpolation\n\n// Comb used as a resonator. The resonant fundamental is equal to\n// reciprocal of the delay time.\n{ CombN.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ CombL.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ CombC.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// with negative feedback:\n{ CombN.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ CombL.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ CombC.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n// used as an echo.\n{ CombL.ar(Decay.ar(Dust.ar(1, 0.5), 0.2, WhiteNoise.ar), 0.2, 0.2, 3) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Saving \"Presets\"?"}, {"role": "assistant", "content": "SuperCollider forum — Saving \"Presets\"?\n\nIf you don’t care too much about it being human readable, just use writeArchive and readArchive:\n\n```supercollider\na = Array.fill(400, {rrand(0,2200)});\n\na.writeArchive(\"/Users/spluta1/Documents/SC/test\");\n\nb = Object.readArchive(\"/Users/spluta1/Documents/SC/test\");\n\nb.postln;\n```\n\nSam"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\nServer.local.quit; // If server running, need to stop it for this example\n\n// We'll modify the server boot procedure to set our env var...\n~realserverprogram = Server.program;\nServer.program = \"export PANCREAS=220;\" + Server.program\ns.boot;\n\n(\nx = {\n// Env var specifies frequency.\n// If you change the env var name to one that isn't set, 440 is used.\nSinOsc.ar(Getenv(\\PANCREAS, 440), 0, 0.1);\n}.play(Server.local);\n);\nx.free;\n\n// This should restore the variable to what it was\nServer.program = ~realserverprogram;\n```"}, {"role": "assistant", "content": "We'll modify the server boot procedure to set our env var... Env var specifies frequency. (Getenv: Read (numeric) shell environment variables into a synth)"}]} +{"conversations": [{"role": "user", "content": "What does `RedMixGUI.redMix` do?"}, {"role": "assistant", "content": "Return the current mixer (RedMixMono, RedMixStereo,"}]} +{"conversations": [{"role": "user", "content": "What does Splay.ar do?"}, {"role": "assistant", "content": "`Splay.ar(inArray, spread, level, center, levelComp)` takes an array of mono signals and distributes them across the stereo field, so `Splay.ar(SinOsc.ar([220, 330, 440]) * 0.1)` is a three-source stereo chord rather than three separate synths. spread (0..1) controls how far the voices fan out and center shifts the middle. It is the shorthand for 'make this array stereo'."}]} +{"conversations": [{"role": "user", "content": "What does `MxQuery.channels` do?"}, {"role": "assistant", "content": "If a query set includes units or iolets then this will return a query set with just the channels that those items are Returns: an MxQuery with just channels"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `WrapIndex`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// indexing into a table\n(\n{\n var buf = LocalBuf.newFrom([200, 300, 400, 500, 600, 800]);\n var freq = WrapIndex.kr(buf, MouseX.kr(0, BufFrames.ir(buf) * 3));\n SinOsc.ar(freq) * 0.1\n}.play;\n);\n\n// the same using a global buffer\n(\nt = [200, 300, 400, 500, 600, 800];\nb = Buffer(s, t.size, 1);\n\n// alloc and set the values\ns.listSendMsg(b.allocMsg(b.setnMsg(0, t)).postln);\n\nSynthDef(\\help_Index, { |out = 0, bufnum = 0|\n Out.ar(out,\n SinOsc.ar(\n WrapIndex.kr(\n bufnum,\n MouseX.kr(0, BufFrames.ir(bufnum) * 3)\n ),\n 0,\n 0.5\n )\n )\n}).play(s, [\\bufnum, b.bufnum]);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `BelaScope`?"}, {"role": "assistant", "content": "BelaScope — Bela's Oscilloscope interface"}, {"role": "user", "content": "What does `BelaScope.scope` do?"}, {"role": "assistant", "content": "Send an array of UGen data to Bela's oscilloscope."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n{ BelaScope.scope(0, SinOsc.ar) }.play;\n// same using UGen\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Function`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\nx = { |freq = 440| SinOsc.ar(freq, 0, 0.3) }.play; // this returns a Synth object;\nx.set(\\freq, 880); // note you can set the freq argument\nx.defName; // the name of the resulting SynthDef\nx.release(4); // fadeout over 4 seconds\n```"}]} +{"conversations": [{"role": "user", "content": "What is `LFDNoise3` in SuperCollider?"}, {"role": "assistant", "content": "LFDNoise3 — Dynamic cubic noise Similar to LFNoise2, it generates polynomially interpolated random values at a rate given by the `freq` argument, with 3 differences: Category: UGens > Generators > Stochastic."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\limiter;\n~description = \"hard limiter\";\n~channelLayout = \\mono;\n~function = {|in = 0, limitDB = 0 |\nvar limit = limitDB.dbamp;\nLimiter.ar(in, limit);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `ReplaceOut`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"ReplaceOutHelp\", { |out = 0, freq = 440|\n var source;\n source = SinOsc.ar(freq, 0, 0.1);\n\n // write to the bus, replacing previous contents\n ReplaceOut.ar(out, source);\n\n}).add;\n);\n\n// each Synth replaces the output of the previous one\nx = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 500]);\ny = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 600]);\nz = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 700]);\n\n// release them in reverse order; the older Synths are still there.\nz.free;\ny.free;\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `JITGui`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// typically, only subclasses of JITGui are used,\n // so here are just some basic usage and layout tests\n\n // make its own window - defPos, minSize is used\ng = JITGui(Ndef(\\a));\n\n // make its own window, specific size\ng = JITGui(Ndef(\\a), bounds: 390@20);\n\n // provide full bounds\ng = JITGui(Ndef(\\a), bounds: Rect(200, 500, 390, 24));\n\n // extent is 0@0: minSize x, y is used\ng = JITGui(Ndef(\\a), bounds: Rect(200, 500, 0, 0));\ng = JITGui(Ndef(\\a), bounds: Rect(200, 500, 0, 50));\ng = JITGui(Ndef(\\a), bounds: Rect(200, 500, 500, 0));\n\n\n( // put a JITGui in an existing window:\nw = Window().front;\ng = JITGui(Ndef(\\a), 0, w, bounds: 300@48);\n);\n\n( // 5 lines high\nw = Window().front;\ng = JITGui(Ndef(\\a), 5, w);\n);\n\n( // recommended: use a FlowLayout.\nw = Window().front;\nw.addFlowLayout;\nEZSlider(w, 300@100, \\test, []);\ng = JITGui(Ndef(\\a), 0, w, bounds: 300@40);\n);\n\n// test changing color schemes for JITguis\n// this scheme is admittedly ugly but different\n\nGUI.skins.put(\\jit, (\n fontSpecs: [\"Inconsolata\", 12],\n fontColor: Color.white,\n background: Color(0.2, 0.85, 0.7, 0.5),\n foreground: Color.grey(0.1),\n onColor: Color(0.5, 0, 0.5),\n onColor2: Color(0.0, 0.5, 0.5),\n offColor: Color.grey(0.2, 0.5),\n hiliteColor: Color.green(1.0, 0.5),\n gap: 0 @ 0,\n margin: 2@2,\n buttonHeight: 18,\n headHeight: 24)\n);\n\n// make some JITGuis to check\nn = NdefGui(Ndef(\\a));\nNdef(\\a, { SinOsc.ar(\\freq.kr(250)) });\nNdef(\\a).clear;\nn = NdefMixer(s);\n\nTdefAllGui();\nTdef(\\a).set(\\amp, 0.25);\nTdefGui(Tdef(\\a), 5);\n\nEnvirGui((a: 123));\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `CompositeView` in SuperCollider briefly."}, {"role": "assistant", "content": "CompositeView — A view that contains other views. Category: GUI > Views."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Monitor`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\ns.scope(16);\n\n{ Out.ar(87, SinOsc.ar(MouseX.kr(40, 10000, 1) * [1, 2, 3], 0, 0.2)) }.play;\nx = Monitor.new;\nx.play(87, 3, 1, 2);\nx.out = 0;\nx.stop(3.0);\nx.play(87, 1, 0, 1); // in > out : now mixes down (wrapping)\nx.play(89, 1, 0, 2); // in < out : now distributes to 2 channels\nx.stop;\n\n// multiple play\nx.play(87, 1, 0, 2, multi: true);\nx.play(88, 1, 0, 2, multi: true);\nx.play(89, 1, 0, 2, multi: true);\nx.stop;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `FoldIndex`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// indexing into a table\n(\n{\n var buf = LocalBuf.newFrom([200, 300, 400, 500, 600, 800]);\n var freq = FoldIndex.kr(buf, MouseX.kr(0, BufFrames.ir(buf) * 3));\n SinOsc.ar(freq) * 0.1\n}.play;\n);\n\n// the same using a global buffer\n(\nt = [200, 300, 400, 500, 600, 800];\nb = Buffer(s, t.size, 1);\n\n// alloc and set the values\ns.listSendMsg(b.allocMsg(b.setnMsg(0, t)).postln);\n\nSynthDef(\\help_Index, { |out = 0, bufnum = 0|\n Out.ar(out,\n SinOsc.ar(\n FoldIndex.kr(\n bufnum,\n MouseX.kr(0, BufFrames.ir(bufnum) * 3)\n ),\n 0,\n 0.5\n )\n )\n}).play(s, [\\bufnum, b.bufnum]);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `BSplineGui.curveGui` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: layout — (describe argument here). Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "What does `Object.multiChannelPerform` do? What arguments does it take?"}, {"role": "assistant", "content": "Perform selector with multichannel expansion. See also: Arguments: selector — A Symbol representing a method selector.; ... args — Method arguments which, if they contain an array, will call the method multiple times for each sub-element.."}]} +{"conversations": [{"role": "user", "content": "Explain `SynthlessPlayer` in SuperCollider briefly."}, {"role": "assistant", "content": "SynthlessPlayer — parent class for Players that will not spawn a synth Category: Libraries > crucial > Players > abstract."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Crackle.ar(1.95, 0.5) }.play;\n\n// modulate chaos parameter\n{ Crackle.ar(Line.kr(1.0, 2.0, 3), 0.5, 0.5 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Crackle.ar(1.95, 0.5) }.play;\n\n// modulate chaos parameter\n{ Crackle.ar(Line.kr(1.0, 2.0, 3), 0.5, 0.5) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Main.addOSCRecvFunc` do? What arguments does it take?"}, {"role": "assistant", "content": "Register a Function to be evaluated whenever SuperCollider language (the client) receives an OSC message. This will not overwrite any previously registered Arguments: func — A Function or similar object to be added. When evaluated, this function will be passed the arguments msg, time, replyAddr, and recvPort, corresponding to the message itself as an Array, the time the message was sent, the NetAddr of the sender, and the port on which the message was received. Note tha."}]} +{"conversations": [{"role": "user", "content": "What does `Tdef.reset` do?"}, {"role": "assistant", "content": "Switch the task immediately (stuck conditions can be subverted by"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// try wiggling mouse quickly;\n// LFNoise frequently seems stuck, LFDNoise changes smoothly.\n\n{ LFNoise0.ar(MouseX.kr(0.1, 1000, 1), 0.1) }.play\n\n{ LFDNoise0.ar(MouseX.kr(0.1, 1000, 1), 0.1) }.play\n\n// silent for 2 secs before going up in freq\n\n{ LFNoise0.ar(XLine.kr(0.5, 10000, 3), 0.1) }.scope;\n\n{ LFDNoise0.ar(XLine.kr(0.5, 10000, 3), 0.1) }.scope;\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFNoise0.ar(XLine.k\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// try wiggling mouse quickly;\n// LFNoise frequently seems stuck, LFDNoise changes smoothly.\n\n{ LFNoise0.ar(MouseX.kr(0.1, 1000, 1), 0.1) }.play\n\n{ LFDNoise0.ar(MouseX.kr(0.1, 1000, 1), 0.1) }.play\n\n// silent for 2 secs before going up in freq\n\n{ LFNoise0.ar(XLine.kr(0.5, 10000, 3), 0.1) }.scope;\n\n{ LFDNoise0.ar(XLine.kr(0.5, 10000, 3), 0.1) }.scope;\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFNoise0.ar(XLine.kr(1000, 20000, 10), 0.1) }.scope;\n\n{ LFDNoise0.ar(XLine.kr(1000, 20000, 10), 0.1) }.scope;\n\n{ LFNoise2.ar(1000, 0.25) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LorenzL`."}, {"role": "assistant", "content": "```supercollider\n// vary frequency\n{ LorenzL.ar(MouseX.kr(20, SampleRate.ir)) * 0.3 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ BRF.ar(Saw.ar(200, 0.1), FSinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3800, 4000), 0.3) }.play;\n\n{ BRF.ar(Saw.ar(200, 0.5), MouseX.kr(100, 10000, 1), 0.3) }.play;\n\n\n // BRF on control signals:\n(\n{ var vib = BRF.kr(SinOsc.kr([1, 3, 10], 0, [1, 0.5, 0.25]).sum, MouseX.kr(1, 10, 1), 0.3);\n SinOsc.ar(vib * 200 + 600) * 0.2 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ BRF.ar(Saw.ar(200, 0.1), FSinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3800, 4000), 0.3) }.play;\n\n{ BRF.ar(Saw.ar(200, 0.5), MouseX.kr(100, 10000, 1), 0.3) }.play;\n\n\n // BRF on control signals:\n(\n{ var vib = BRF.kr(SinOsc.kr([1, 3, 10], 0, [1, 0.5, 0.25]).sum, MouseX.kr(1, 10, 1), 0.3);\n SinOsc.ar(vib * 200 + 600) * 0.2 }.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n\n{\n var input, kernel;\n\n input = SoundIn.ar(0);\n kernel = Mix.ar(LFSaw.ar([300, 500, 800, 1000] * MouseX.kr(1.0, 2.0), 0, 1.0));\n\n // must have power of two framesize\n Convolution.ar(input, kernel, 1024, 0.5)\n}.play;\n\n);\n\n(\n// must have power of two framesize- FFT size will be sorted by Convolution to be double this\n// maximum is currently a = 8192 for FFT of size 16384\n\na = 2048;\ns = Server.local;\n\n// kernel buffer\ng = Buffer.alloc(s, a, 1);\n);\n\n(\n\n// random impulse response\n\ng.set(0, 1.\n// …\n```"}, {"role": "assistant", "content": "must have power of two framesize must have power of two framesize- FFT size will be sorted by Convolution to be double this (Convolution: Real-time convolver.)"}]} +{"conversations": [{"role": "user", "content": "What does `RedMixerChannel.restoreArchive` do? What arguments does it take?"}, {"role": "assistant", "content": "Similar to #*restoreFile but directly takes an Archive as Arguments: archive — An Archive.."}]} +{"conversations": [{"role": "user", "content": "What does `MxUnit.stopToBundle` do? What arguments does it take?"}, {"role": "assistant", "content": "Container for a musical object (Instr, NDef, Spline etc); this is a single unit that has inlets and outlets which can be connected to other units Arguments: bundle."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Impulse`."}, {"role": "assistant", "content": "```supercollider\n{ Impulse.ar(800, 0.0, 0.5, 0) }.play\n\n{ Impulse.ar(XLine.kr(800, 100, 5), 0.0, 0.5, 0) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "I get 'Node not found' when I call .set on a Synth after a while."}, {"role": "assistant", "content": "The Synth was freed and the language still holds a reference. That happens whenever the SynthDef used `doneAction: 2` and the envelope finished, or when something called `freeAll`/`CmdPeriod`. Guard it with `if (x.notNil and: { x.isPlaying }) { x.set(\\freq, 300) }`, or store the node in a variable that you clear when it ends. For sustained sounds the right pattern is a `gate` argument with `doneAction: 2` on the EnvGen, so the node lives until you release it."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Paddpre` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain);\nb = Paddpre(\\freq, Pseq([10, 30, 100], inf), a);\nb.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n//bass synth\n{Out.ar(0,Pan2.ar(DoubleWell3.ar(f:SinOsc.ar(MouseX.kr(0,200),0,MouseY.kr(0.5,4.0))),0.0))}.play\n\n//plotting check of first samples\n{DoubleWell3.ar}.plot(0.05, minval:-1, maxval:1)\n\n//gradually changing \n{Pan2.ar(DoubleWell3.ar(0,0.05,LFSaw.ar(Line.kr(10,1000,10)),Line.kr(0.0,0.3,20)),0.0)}.play\n\n//controlled - midscreen amplitude jump\n{Pan2.ar(DoubleWell3.ar(0,0.05,L\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n//bass synth\n{Out.ar(0,Pan2.ar(DoubleWell3.ar(f:SinOsc.ar(MouseX.kr(0,200),0,MouseY.kr(0.5,4.0))),0.0))}.play\n\n//plotting check of first samples\n{DoubleWell3.ar}.plot(0.05, minval:-1, maxval:1)\n\n//gradually changing \n{Pan2.ar(DoubleWell3.ar(0,0.05,LFSaw.ar(Line.kr(10,1000,10)),Line.kr(0.0,0.3,20)),0.0)}.play\n\n//controlled - midscreen amplitude jump\n{Pan2.ar(DoubleWell3.ar(0,0.05,LFSaw.ar(MouseX.kr(10,1000)),MouseY.kr(0.0,0.5)),0.0)}.play\n\n\n\n//triggering\n{DoubleWell3.ar(Impulse.kr(MouseY.kr(0.01,100, 'exponential')),0.1,LFCub.ar(MouseX.kr(10,1000, 'exponential')),MouseY.kr(0.0,1.0),LFNoise0.kr(2.3,0.2,0.8),LFNoise1.kr(2.37,0.2,0.8))}.play\n\n\n//AudioIn as forcing\n{Pan2.ar(DoubleWell3.ar(0,0.05,LPF.ar(AudioIn.ar(1),100,MouseX.kr(0,1000)),MouseY.kr(0.0,0.5)),0.0)}.play\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Rand`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-Rand\", { |out = 0|\n Out.ar(out,\n FSinOsc.ar(\n Rand(200.0, 400.0),\n 0, Line.kr(0.2, 0, 1, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n(\nRoutine({\n 8.do({\n Synth.new(\"help-Rand\"); 1.0.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `PIRand.new` do? What arguments does it take?"}, {"role": "assistant", "content": "UGenPatterns quark library Arguments: lo; hi; length — Number of values produced.."}]} +{"conversations": [{"role": "user", "content": "What is `ScalarSpec` in SuperCollider?"}, {"role": "assistant", "content": "ScalarSpec — datatype specifiying a \\scalar \"rate\" input or output Category: Spec, Libraries > crucial > Spec."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// The following files are test materials on my machine; you will subsitute your own filenames here\n// A major\nd = Buffer.read(s, \"/Volumes/data/stevebeattrack/samples/100.wav\");\n// F major; hard to track!\nd = Buffer.read(s, \"/Volumes/data/stevebeattrack/samples/115.wav\");\n\n// straight forward since no transients; training set from MIREX2006\n// 01 = A major\n// 57 = b minor\n// 78 e minor\n// 08 Bb major\n\nd = Buffer.read(s, \"/Users/nickcollins/Desktop/ML/training_wav/78.wav\")\n\n(\n{\n var in, fft, resample;\n var\n// …\n```"}, {"role": "assistant", "content": "The following files are test materials on my machine; you will subsitute your own filenames here F major; hard to track! (KeyTrack: Key tracker)"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BRF`."}, {"role": "assistant", "content": "```supercollider\n{ BRF.ar(Saw.ar(200, 0.1), FSinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3800, 4000), 0.3) }.play;\n\n{ BRF.ar(Saw.ar(200, 0.5), MouseX.kr(100, 10000, 1), 0.3) }.play;\n\n\n // BRF on control signals:\n(\n{ var vib = BRF.kr(SinOsc.kr([1, 3, 10], 0, [1, 0.5, 0.25]).sum, MouseX.kr(1, 10, 1), 0.3);\n SinOsc.ar(vib * 200 + 600) * 0.2 }.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `PLPZ2` in SuperCollider briefly."}, {"role": "assistant", "content": "PLPZ2 — UGenPatterns quark library Based on LPZ2 Category: Streams-Patterns-Events > UGenPatterns > Modifiers."}]} +{"conversations": [{"role": "user", "content": "What does `SynthConsole.free` do?"}, {"role": "assistant", "content": "a widget with controls: play/stop/record/scope etc."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `TRand`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var trig = Dust.kr(10);\n SinOsc.ar(\n TRand.kr(300, 3000, trig)\n ) * 0.1\n}.play;\n);\n\n(\n{\n var trig = Dust.ar(MouseX.kr(1, 8000, 1));\n SinOsc.ar(\n TRand.ar(300, 3000, trig)\n ) * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for get different result each time running the pattern: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\nTempoClock.default.tempo = 156/60;\n\n(\nSynthDef(\\spring, { |freq = 400, out = 0, pan = 0, gate = 1, dur = 0.15, curve = -4, amp = 1, index = 1|\n var sig = FreeVerb.ar(Pan2.ar(Blip.ar(freq, index), pan));\n var env = EnvGen.ar(Env.perc(0.01, dur, amp, curve), gate, doneAction:2);\n Out.ar(0, sig * env);\n}).add;\n);\n\n(\nPbind(*[\n instrument: \\spring,\n dur: Pseq([4, 1, 2, 1, 1, 1].scramble/ 4 / TempoClock.default.tempo, inf),\n degree: Pseq(#[1,2,3,4], inf) * Pkey(\\dur).reciprocal,\n octave: Pseq([2,3,4,4,4,3].scramble, inf),\n pan: Pxrand(Array.fill(100, { 0.gaussian(1).clip2(1) }), inf),\n amp: Pseq(#[0.95,1,0.8],inf),\n index: Pstutter(Pseq(#[4,8,12],inf), Pseq([2,3,4,5,6,8].scramble, inf))\n]).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nx = { SinOsc.ar(440, 0, 0.3) }.asDefName; // this must complete first\ny = Synth(x;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nx = { SinOsc.ar(440, 0, 0.3) }.asDefName; // this must complete first\ny = Synth(x);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `HPZ1`."}, {"role": "assistant", "content": "```supercollider\n// Compare:\n\n{ WhiteNoise.ar(0.25) }.play;\n\n{ HPZ1.ar(WhiteNoise.ar(0.25)) }.play;\n\n// HPZ1 is useful to detect changes in a signal:\n// see also HPZ2\n(\n{\n var changingSignal = LFNoise0.ar(1000);\n var hpz1 = HPZ1.ar(changingSignal);\n [hpz1, hpz1 > 0, hpz1.abs > 0]\n}.plot\n);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Server-side sequencing (a SuperCollider snippet) that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n(\nf = { |f0=200, rate=4|\n {\n var seq = Dseq(f0*[1/2,3/4, Dstutter(4, Drand([1/2,1,2,3,4,5,6],1)), 2,3/2,3,4/3], inf);\n var trig = Impulse.ar(rate);\n var freq = Demand.ar(trig,0, seq);\n var env = Decay2.ar(trig,1e-3,1);\n FreeVerb.ar(\n Splay.ar(SinOsc.ar(freq*[0.995, 1, 1.005]).fold(-0.995,0.995)*0.25*env),\n 0.5,\n 0.5\n );\n }\n};\n\nfork{ 4.do{\n fork{\n f.(100,2).play;\n (1/8).wait;\n f.(200,4).play;\n (1/4).wait;\n f.(100*4/3,8).play;\n (1/2).wait;\n f.(400,4).play;\n };\n (1/4).wait;\n}}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Env.embedInStream` do?"}, {"role": "assistant", "content": "Embeds this Env within an enclosing Stream. Timing is derived from"}]} +{"conversations": [{"role": "user", "content": "What is `Routine`?"}, {"role": "assistant", "content": "Routine — Functions that can return in the middle and then resume where they left off"}, {"role": "user", "content": "What does `Routine.new` do?"}, {"role": "assistant", "content": "Creates an instance of Routine, passing it the Function with code to run."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nr = Routine { |inval|\n loop {\n // thisThread refers to the routine.\n postf(\"beats: % seconds: % time: % \\n\",\n thisThread.beats, thisThread.seconds, Main.elapsedTime\n );\n 1.0.yield;\n\n }\n}.play;\n);\n\nr.stop;\nr.beats;\nr.seconds;\nr.clock;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n//code that utilizes the glitch.\n(\ns.waitForBoot{\n SynthDef(\\birdy, {|out= 0, amp= 0.1, freq= 1000, atk= 0.01, rel= 0.05, cur= -4, gate= 1|\n var env= EnvGen.kr(Env.asr(atk, 1, rel, cur), gate, doneAction:2);\n var src= SinOsc.ar(0.11, GlitchBRF.ar(SinOsc.ar(SinOsc.ar(0.12).exprange(1, freq), 2pi), 1/SinOsc.ar(0.13).range(1, #[99, 100])));\n Out.ar(out, Limiter.ar(LeakDC.ar(src*amp)));\n }).add\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n//code that utilizes the glitch.\n(\ns.waitForBoot{\n SynthDef(\\birdy, {|out= 0, amp= 0.1, freq= 1000, atk= 0.01, rel= 0.05, cur= -4, gate= 1|\n var env= EnvGen.kr(Env.asr(atk, 1, rel, cur), gate, doneAction:2);\n var src= SinOsc.ar(0.11, GlitchBRF.ar(SinOsc.ar(SinOsc.ar(0.12).exprange(1, freq), 2pi), 1/SinOsc.ar(0.13).range(1, #[99, 100])));\n Out.ar(out, Limiter.ar(LeakDC.ar(src*amp)));\n }).add;\n s.sync;\n Synth(\\birdy, [\\amp, 0.15]);\n};\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `CountLimit.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Counts how many items have been presented to it. returns true until limit false thereafter Arguments: limit."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nt = TempoClock(120/60).permanent_(true);\n\n(\n~change_clock_tempo = {|clock, tempo, beats=1|\n beats.do {|beat|\n var stepTempo = beat.linexp(0, beats-1, clock.tempo, tempo);\n clock.schedAbs(clock.nextBar + beat, {\n \"New Tempo: \".post; (stepTempo*60).post; \" BPM\".postln;\n clock.tempo_(stepTempo);\n });\n };\n nil;\n};\nPbindef(\\n,\n \\octave, 4,\n \\dur, 0.5,\n \\degree, Pseq((0..7), inf)\n).play(t, quant: 4);\n);\n\n~change_clock_tempo.value(t, 200/60, 16);\n~change_clock_tempo.value(t, 50/60, 8);\nt.tempo*60\n```"}, {"role": "assistant", "content": "This gradually changes the tempo of a TempoClock, each beat of a specified number of beats, and starting at the next bar.\r\n\r\n\r\nPersonally, I was not able to heavily distinguish between `.linlin` and `.linexp` for reasonable musical tempos.\r\n\r\n\r\nThere may be a mathematically smoother way of handling this at the control rate.\r\n\r\n\r\nThis function does not gracefully handle multiple simultaneous invoca."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `PdurStutter`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,0,1,3,4,0], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n100.do({ x.next.postln });\n);\n\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n);\n\n\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,4,4,0,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `PV_MagClip` in SuperCollider?"}, {"role": "assistant", "content": "PV_MagClip — Clip bins to a threshold. Clips bin magnitudes to a maximum threshold. Category: UGens > FFT."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// mouse-controlled param\n{ StandardN.ar(SampleRate.ir/2, MouseX.kr(0.9, 4)) * 0.3 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// mouse-controlled param\n{ StandardN.ar(SampleRate.ir/2, MouseX.kr(0.9, 4)) * 0.3 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `ServerOptions.verbosity` do?"}, {"role": "assistant", "content": "Controls the verbosity of server messages. A value of 0 is normal behaviour. -1 suppresses informational messages. -2 suppresses informational and many error messages, as well as messages from Poll. The default is"}]} +{"conversations": [{"role": "user", "content": "What does `PlayerBinop.new` do? What arguments does it take?"}, {"role": "assistant", "content": "the result of a binary op on a Player Arguments: operator; a; b."}]} +{"conversations": [{"role": "user", "content": "What does `JITGui.hasWindow` do?"}, {"role": "assistant", "content": "(common to all JITGuis) a flag whether the JITGui has made its own window, and thus owns"}]} +{"conversations": [{"role": "user", "content": "What does `AbstractPlayer.simplifyStoreArgs` do? What arguments does it take?"}, {"role": "assistant", "content": "the base class for all Players : a playable object Arguments: args."}]} +{"conversations": [{"role": "user", "content": "What does `SimpleNumber.rectWindow` do?"}, {"role": "assistant", "content": "one-dimensional value Returns: a value for a rectangular window function between 0 and 1."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\limiter;\n~description = \"hard limiter\";\n~channelLayout = \\mono;\n~function = {|in = 0, limitDB = 0 |\nvar limit = limitDB.dbamp;\nLimiter.ar(in, limit);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\ns.boot;\n(\n{\n// Move the mouse. This varies from sinewave (left) to almost-square (right)\nvar sig = (SinOsc.ar(MouseY.kr(100, 1000, 1)) * MouseX.kr(1,10)).clip2(1);\nvar val = Crest.kr(sig, 440).poll;\n(sig * 0.1).dup\n}.play\n);\n\n(\n// Or as a plot (which shows the odd results you get over the first few samples):\n{\nvar sig = (SinOsc.ar(440, pi.rand) * XLine.kr(1,10, 5)).clip2(1);\nvar val = Crest.kr(sig, 440).poll;\nOut.ar(0, sig * 0.1.dup);\nK2A\n// …\n```"}, {"role": "assistant", "content": "Move the mouse. This varies from sinewave (left) to almost-square (right) Or as a plot (which shows the odd results you get over the first few samples): (Crest: Measure the temporal crest factor of a signal)"}]} +{"conversations": [{"role": "user", "content": "My Synth runs but I hear nothing. How do I debug it?"}, {"role": "assistant", "content": "Check in this order, because each step eliminates a whole class of causes:\n\n1. **Is anything coming out of the bus you write to?** `Out.ar(0, sig)` for the master. A typo like\n `Out.ar(2, ...)` is silence.\n2. **Is the amplitude non-zero?** Multiply chain of `mul`/`add`, `amp`, and `env` all have to be positive;\n an envelope with `level: 0` or a gate that never opens is silent.\n3. **Did the Synth free itself immediately?** `doneAction: 2` on an EnvGen whose envelope is already\n finished at creation kills the node instantly. `s.plotTree` shows whether the node exists at all.\n4. **Is the envelope actually moving?** `env.poll` inside the SynthDef prints it per block.\n5. **Is the filter closed?** A `LPF.ar(sig, 50)` on a 440 Hz sine leaves almost nothing.\n\nThe fastest single tool is `s.plotTree`: if the Synth is not in the tree, the problem is lifecycle; if it\nis, the problem is signal."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Klank`."}, {"role": "assistant", "content": "```supercollider\n(\n{\nKlank.ar([ // the multichannel-expansion\n `[[500, 1078, 1201.5, 1723], nil, [1, 1, 0.5, 0.3]], // left channel\n `[[700, 1071, 1053, 1723], nil, [1, 1, 1, 1]] // right channel\n ], Impulse.ar([1.5, 1.875], 0, 0.1))\n}.play\n);\n\n// expanding specs within the parameter array\n{ Klank.ar(`[[[800, 6000], 1071, [1153, 8000], 1723], nil, [1, 1, 1, 1]], Impulse.ar([2, 3], 0, 0.1)) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What is the difference between .ar, .kr and .ir?"}, {"role": "assistant", "content": "The rate method decides how often a UGen is evaluated. `.ar` runs at the audio rate, once per sample, and produces an audio signal. `.kr` runs at the control rate, once per block of 64 samples by default, so it is cheaper and is used for parameters that do not need sample accuracy. `.ir` is evaluated once when the Synth is created and then never again, for constants such as SampleRate.ir or a size. Using .kr where you need audio-rate modulation gives stepped, zipper-noise-like control; using .ar where .kr would do costs CPU."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Just a dirty FM bass shuffling. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\nfork{\n SynthDef(\\basicFM, {|out = 0, gate = 1, amp = 1, carFreq = 1000, modFreq = 100, modAmount = 2000, clipAmount = 0.1|\n var modEnv = EnvGen.ar(Env.adsr(0.5, 0.5, 0.7, 0.1, peakLevel: modAmount), gate);\n var mod = SinOsc.ar(modFreq) * modEnv;\n var car = SinOsc.ar(carFreq + mod);\n var ampEnv = EnvGen.ar(Env.adsr(0.1, 0.3, 0.7, 0.2, peakLevel: amp), gate, doneAction: 2);\n var clip = clipAmount * 500;\n Out.ar(out, (car * ampEnv * clip).clip(-0.7, 0.7) * 0.1);\n }).add;\n\n s.sync;\n\n Pbind(*[\n instrument: \\basicFM,\n out: [0, 1],\n dur: Pseq([1/7, 1/3] / 1.2, inf),\n sustain: Pkey(\\dur),\n amp: 1/4,\n carFreq: Pseq([1, 1, 1, 2] * 350, inf),\n modFreq: Pkey(\\carFreq) * (1/8),\n modAmount: Pseq([2, 1, 0.5, 2, 1, 0.5, 2, 1, 2, 1, 0.5, 2, 1, 0.5, 2, 4] * 500, inf),\n clipAmount: Pseq([Pn(0.1, 32), Pn(1, 32)], inf)\n ]).play;\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Pipe.new` do? What arguments does it take?"}, {"role": "assistant", "content": "pipe stdin to, or stdout from, a UNIX shell command Arguments: commandLine — A String representing a valid shell command.; mode — A String representing the mode. Valid modes are \"w\" (pipe to stdin) and \"r\" (pipe from stdout).."}]} +{"conversations": [{"role": "user", "content": "What does `QtGUI.style` do?"}, {"role": "assistant", "content": "Gets or sets the current GUI style. The given style must be a String"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LFSaw`."}, {"role": "assistant", "content": "```supercollider\n{ LFSaw.ar(500, 1, 0.1) }.play\n\n// used as both Oscillator and LFO:\n{ LFSaw.ar(LFSaw.kr(4, 0, 200, 400), 0, 0.1) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `BBandStop` in SuperCollider briefly."}, {"role": "assistant", "content": "BBandStop — Band reject filter The B equalization suite is based on the Second Order Section (SOS) biquad UGen. Category: UGens > Filters > BEQSuite."}]} +{"conversations": [{"role": "user", "content": "What does `Mx.inlets` do?"}, {"role": "assistant", "content": "Just like an individual unit, an Mx can have inlets and can be loaded inside another Mx. (not yet fully Returns: array of MxInlet"}]} +{"conversations": [{"role": "user", "content": "What does `MxChannel.groupForIndex` do? What arguments does it take?"}, {"role": "assistant", "content": "a group of MxUnits Arguments: index; bundle."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\Identity;\n~description = \"Output the Ambisonics stream to outputs channels, useful for NRT rendering\";\n\n~function = {|in = 0|\nin;\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for batuhan's buzzer parametrized that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n// A beautiful sc140 tweet by Batuhan Bozkurt, parametrized for real-time changes\n(\n// Start sound here\na = { | rateL = 5, rateR = 6, blipMul = 100, blipAdd = 50, fMul = 50, kMul = 1 |\n f = LocalIn.ar(2).tanh;\n k = Latch.kr(f[0].abs,Impulse.kr(1/4)) * kMul;\n LocalOut.ar(\n f +\n CombC.ar(Blip.ar([rateL, rateR], blipMul * k + blipAdd, 0.9), 1, k*0.3, fMul * f));f\n}.play\n);\n\n// Set parameters for changing sound here: \n\na.set(\\rateL, 10);\n\na.set(\\rateR, 8);\n\na.set(\\blipMul, 25);\n\na.set(\\blipAdd, 70);\n\na.set(\\fMul, 30);\n\n\na.set(\\kMul, 0.01);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `HPF`."}, {"role": "assistant", "content": "```supercollider\n{ HPF.ar(Saw.ar(200, 0.1), FSinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3600, 4000), 5) }.play;\n\n(\n{ var ctl = HPF.kr(LFSaw.kr(5), SinOsc.kr(XLine.kr(0.07, 30, 20), 0, 35, 40)) ;\n SinOsc.ar(ctl * 200 + 500);\n}.play;\n);\n\n(\n{ var ctl = HPF.kr(LFSaw.kr(5, 0.1), MouseX.kr(2, 200, 1));\n SinOsc.ar(ctl * 200 + 400) * 0.1;\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nr = Recorder(s);\n{ GVerb.ar(Dust.ar(4)) }.play; // play on bus 64\nr.record(numChannels: 2;\nr.stopRecording;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nr = Recorder(s);\n{ GVerb.ar(Dust.ar(4)) }.play; // play on bus 64\nr.record(numChannels: 2);\nr.stopRecording;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n\nx = PlayerSocket.new(\\audio,1);\nx.play;\n\np = EnvelopedPlayer(\n Patch({\n SinOsc.ar * 0.1\n }),\n Env.adsr(releaseTime: 2.0),\n 1\n);\n\n\nx.prepareAndQSpawn(p)\n\n);\n\n\n\nx.preparePlayer(p)\n\np.insp\n\nx.qspawnPlayer(p)\n\n\n\n(\n\nEnvelopedPlayer(\n EnvelopedPlayer(\n Patch({\n SinOsc.ar * 0.1\n }),\n Env.adsr(releaseTime: 2.0),\n 1\n ),\n Env.adsr(releaseTime: 3.0),\n 1\n).play\n\n/*\nGroup(0)\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n\nx = PlayerSocket.new(\\audio,1);\nx.play;\n\np = EnvelopedPlayer(\n Patch({\n SinOsc.ar * 0.1\n }),\n Env.adsr(releaseTime: 2.0),\n 1\n);\n\n\nx.prepareAndQSpawn(p)\n\n);\n\n\n\nx.preparePlayer(p)\n\np.insp\n\nx.qspawnPlayer(p)\n\n\n\n(\n\nEnvelopedPlayer(\n EnvelopedPlayer(\n Patch({\n SinOsc.ar * 0.1\n }),\n Env.adsr(releaseTime: 2.0),\n 1\n ),\n Env.adsr(releaseTime: 3.0),\n 1\n).play\n\n/*\nGroup(0)\n Group(1)\n Synth(\"-15n~Em\" : 1000) Patch[ f-33811036 ]:synth\n Synth(\"EnvelopedPlayer1yeG~u\" : 1001) an EnvelopedPlayer:synth\n Synth(\"EnvelopedPlayer1-ysI-H\" : 1002) an EnvelopedPlayer:synth\n*/\n\n);\n\n(\n EnvelopedPlayer(\n Patch({\n SinOsc.ar * 0.1\n }),\n Env.adsr(releaseTime: 2.0),\n 1\n ).play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// try wiggling the mouse quickly;\n// LFNoise frequently seems stuck, LFDNoise changes smoothly.\n\n{ LFClipNoise.ar(MouseX.kr(0.1, 1000, 1), 0.1) }.play\n\n{ LFDClipNoise.ar(MouseX.kr(0.1, 1000, 1), 0.1) }.play\n\n// silent for 2 secs before going up in freq\n\n{ LFClipNoise.ar(XLine.kr(0.5, 10000, 3), 0.1) }.scope;\n\n{ LFDClipNoise.ar(XLine.kr(0.5, 10000, 3), 0.1) }.scope;\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFClipNoise.ar\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// try wiggling the mouse quickly;\n// LFNoise frequently seems stuck, LFDNoise changes smoothly.\n\n{ LFClipNoise.ar(MouseX.kr(0.1, 1000, 1), 0.1) }.play\n\n{ LFDClipNoise.ar(MouseX.kr(0.1, 1000, 1), 0.1) }.play\n\n// silent for 2 secs before going up in freq\n\n{ LFClipNoise.ar(XLine.kr(0.5, 10000, 3), 0.1) }.scope;\n\n{ LFDClipNoise.ar(XLine.kr(0.5, 10000, 3), 0.1) }.scope;\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFClipNoise.ar(XLine.kr(1000, 20000, 10), 0.1) }.scope;\n\n{ LFDClipNoise.ar(XLine.kr(1000, 20000, 10), 0.1) }.scope;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Function.value` do?"}, {"role": "assistant", "content": "Evaluates the FunctionDef referred to by the Function. The Function is passed the args given. `// different way of expressing the same:` Default arguments can be omitted in the call: `{ |a=3, b=10| a * b }.value; // use default arguments only` The results of functions composed with operators distribute the keyword arguments to each of the operands. `f = { |a, b=1| a ** b } * { |a, c = 0| a + c"}]} +{"conversations": [{"role": "user", "content": "What is `SendPeakRMS`?"}, {"role": "assistant", "content": "SendPeakRMS — Track peak and power of a signal for GUI applications."}, {"role": "user", "content": "What does `SendPeakRMS.ar` do?"}, {"role": "assistant", "content": "Unlike with other unit generators, the `ar` and `kr` methods do not specify the rate of the computation, but the granularity. When the SendPeakRMS ugen is instantiated with `kr`, the reply rate is quantized to control-rate blocks."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\n{\n SendPeakRMS.kr(Dust.ar(20), 20, 3, \"/replyAddress\")\n}.play;\n);\n\n(\no = OSCFunc({ |msg|\n \"peak: %, rms: %\".format(msg[3], msg[4]).postln\n}, '/replyAddress');\n);\no.free;\n```"}]} +{"conversations": [{"role": "user", "content": "I get 'syntax error, unexpected NAME' on a block that looks fine."}, {"role": "assistant", "content": "Almost always a missing semicolon between two statements — SuperCollider does not insert them.\n\n```supercollider\n// broken: two statements, no separator\n{ var sig = SinOsc.ar(440) sig = sig * 0.1; sig }.play\n```\n\n```supercollider\n// fixed\n{ var sig = SinOsc.ar(440); sig = sig * 0.1; sig }.play\n```\nThe error points at the second statement, not at the missing semicolon before it, which is why it looks\nfine. If it is not a semicolon, count the brackets: `.ar(` open, `)` closed."}]} +{"conversations": [{"role": "user", "content": "What does Splay.ar do?"}, {"role": "assistant", "content": "`Splay.ar(inArray, spread, level, center, levelComp)` takes an array of mono signals and distributes them across the stereo field, so `Splay.ar(SinOsc.ar([220, 330, 440]) * 0.1)` is a three-source stereo chord rather than three separate synths. spread (0..1) controls how far the voices fan out and center shifts the middle. It is the shorthand for 'make this array stereo'."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// as a frequency control\n{ SinOsc.ar(StandardL.ar(40, MouseX.kr(0.9, 4))*800+900)*0.4 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// as a frequency control\n{ SinOsc.ar(StandardL.ar(40, MouseX.kr(0.9, 4))*800+900)*0.4 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "How do I distort a signal?"}, {"role": "assistant", "content": "Drive it into a nonlinearity, then tame the level: `tanh` is soft clipping, `.distort` is harder,\nand a low-pass after the drive keeps it from getting fizzy.\n\n```supercollider\n(\n{\n var sig = SinOsc.ar(110) * 0.3;\n var driven = (sig * 12).tanh;\n LPF.ar(driven, 5000) * 0.4\n}.play;\n)\n```\n\nMore drive means more harmonics; because they are generated, the output is louder as well as brighter, so\nscale the result down after the nonlinearity."}]} +{"conversations": [{"role": "user", "content": "What does `InstrBrowser.search` do? What arguments does it take?"}, {"role": "assistant", "content": "Browse your instrument library, with customizable actions Arguments: q."}]} +{"conversations": [{"role": "user", "content": "What is `KeyMode` in SuperCollider?"}, {"role": "assistant", "content": "KeyMode — Find best correlated key mode with chromagram between major, minor and chromatic cluster A key mode tracker where output 0 = major, 1 = minor, 2 = chromatic (cluster). Category: UGens > Analysis > Pitch."}]} +{"conversations": [{"role": "user", "content": "What does `String.asAbsolutePath` do?"}, {"role": "assistant", "content": "Return this path as an absolute path by prefixing it with File#*getcwd if"}]} +{"conversations": [{"role": "user", "content": "Explain `RecursiveCutProc1` in SuperCollider briefly."}, {"role": "assistant", "content": "RecursiveCutProc1 — Recursive breakbeat cutting, version 2 This class implements explicit recursive cutting, as described in LMJ13. The level of recursion can be set as a parameter of the cut procedure. The user chooses cut, repeat and offset functions which are applied through successive iteratinos to make new cut sequences. Only the final cut sequence of a cut sequence of a cut sequence... is rendered. Category: Libraries > BBCut > Cut procedures."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\nz = {\n BLowPass.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(10, 20000, \\exponential), // cutoff freq.\n MouseY.kr(0.0, 1.0, \\linear), // rq\n 0.5); // mul\n}.play\n;\nz.release;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\nz = {\n BLowPass.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(10, 20000, \\exponential), // cutoff freq.\n MouseY.kr(0.0, 1.0, \\linear), // rq\n 0.5); // mul\n}.play\n);\nz.release;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `SelectX` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar(300),\n Pulse.ar(230)\n ];\n\n SelectX.ar(MouseX.kr(0, 1) * a.size, a) * 0.2\n}.play;\n);\n\n(\n{\n var a;\n a = [\n SinOsc.kr(0.25),\n LFSaw.kr(10),\n LFPulse.kr(0.3)\n ];\n\n SinOsc.ar(SelectX.kr(MouseX.kr(0, 1) * a.size, a) * 300 + 400) * 0.2\n}.play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ LPF.ar(Saw.ar(200, 0.1), SinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3600, 4000)) }.play;\n\n// kr:\n(\n{ var ctl = LPF.kr(LFPulse.kr(8), SinOsc.kr(XLine.kr(1, 30, 5)) + 2);\n SinOsc.ar(ctl * 200 + 400)\n}.play;\n);\n\n(\n{ var ctl = LPF.kr(LFPulse.kr(8), MouseX.kr(2, 50, 1));\n SinOsc.ar(ctl * 200 + 400)\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ LPF.ar(Saw.ar(200, 0.1), SinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3600, 4000)) }.play;\n\n// kr:\n(\n{ var ctl = LPF.kr(LFPulse.kr(8), SinOsc.kr(XLine.kr(1, 30, 5)) + 2);\n SinOsc.ar(ctl * 200 + 400)\n}.play;\n);\n\n(\n{ var ctl = LPF.kr(LFPulse.kr(8), MouseX.kr(2, 50, 1));\n SinOsc.ar(ctl * 200 + 400)\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for some initial thoughts on psytrance bassline."}, {"role": "assistant", "content": "```supercollider\n(\n{ | dur = 0.15, atk = 0.005, amp = 1 |\n SinOsc.ar(\n EnvGen.ar( Env(\n NamedControl.kr(\\freq_l, [2960, 70, 90]),\n NamedControl.kr(\\freq_d, [0.07, 0.2]),\n NamedControl.kr(\\freq_c, [-13, -1]),\n ) ),\n mul:amp * EnvGen.ar(\n Env.perc( atk, dur - atk, curve: NamedControl.kr(\\amp_c, [-1, 6])),\n doneAction: 2\n ); \n ) ! 2;\n}.asSynthDef.name_(\"kick\").add;\n\n{ | atk = 0.01, dur = 0.15, freq = 50, amp=0.8 |\n BPF.ar(LFSaw.ar(freq), freq, 2, mul: EnvGen.kr( Env.perc( atk, dur-atk, amp, 6 ), doneAction: 2 )) ! 2;\n}.asSynthDef.name_(\"bass\").add;\n\n{ | dur = 0.15, freq = 50, amp = 0.8, index = 10 |\n PMOsc.ar(freq, freq + 5, index, mul: amp * EnvGen.kr( Env.triangle( dur ), doneAction: 2 )) ! 2;\n}.asSynthDef.name_(\"bazz\").add;\n);\n\n\n(\nPpar([\n Pbind(*[\n instrument: \\kick,\n delta: 1,\n dur: Pfunc({ thisThread.clock.beatDur }) / 4,\n amp: Pseq([\n Pseq([1], 16),\n Pseq([0.8, 1], 8), \n Pseq([1], 16),\n Pseq([0.8, 0.8, 0.9, 1], 8)\n ], inf) * 0.8,\n freq_l: Pstutter(Prand(2.pow((1..4)),inf), Pseq([\n `[2960,70,90],\n `[1260,60,110],\n `[4360,60,120]\n ],inf))\n ]),\n Pbind(*[\n instrument: \\bass,\n delta: 1/4,\n dur: Pkey(\\delta) * Pfunc({ thisThread.clock.beatDur }),\n freq: Pseq([\\r, 50,60,70], inf),\n amp:0.6\n ]),\n Pbind(*[\n instrument: \\bazz,\n delta: 1/4,\n dur: Pkey(\\delta) * Pfunc({ thisThread.clock.beatDur }),\n freq: Pseq([\\r, 30,35,40], inf),\n amp:0.2\n ])\n]).play(TempoClock(156/60), quant:[1])\n);\n\n// kick from above?\n(\nPbind(*[\n instrument: \\kick,\n delta: Pseq(Array.geom(540, 1, 1.015).reciprocal.reverse),\n dur: Pkey(\\delta) * Pfunc({ thisThread.clock.beatDur }),\n atk: Pkey(\\dur) / 6,\n amp: 0.8\n]).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Basic tone simulator of a stylophone?"}, {"role": "assistant", "content": "```supercollider\n/*\nRetro Stylophone\n\nReverse engineered from: https://www.waitingforfriday.com/?p=334\n\n1. Relaxation oscillator (UJT)\n\n- generated by a combination of two oscillators. The primary oscillator is a\n current controlled PUT (Programmable Uni-Junction Transistor) relaxation oscillator which is\n responsible for generating the overall tone of the instrument.\n A secondary LFO phase-shifted provides the vibrato\n (the relative slow wavering of a sound around the notes centre pitch)\n\n- around 10 VPP\n\n2. LFO phase-shift (vibrato)\n\n- generated by a low-frequency oscillator made with a transistor and several capacitors,\n which produces a triangle/sine wave fed into the frequency control voltage operating the UJT\n\n- frequency of about 8.5Hz, phased shifted of 180 degree, around 4.2 VPP\n*/\n\n(\nSynthDef(\\stylophone, { |freq = 220, vibAmp = 2, toneAmp = 5, atkTime = 0.01, trigger = 0|\n\n var lfo = OnePole.kr(LFPar.kr(8, mul: vibAmp, add: freq), 0.9); // 180 degree inversion\n var relaxOsc = LFPulse.ar(lfo, width: 0.9, mul: toneAmp);\n\n var asr = EnvGen.kr(Env.asr(atkTime * 5, releaseTime: 0.001, curve: \\lin), gate: trigger);\n\n Out.ar(0, relaxOsc * asr)\n}).add\n);\n\nf = Synth(\\stylophone);\n\nf.set(\\freq, 208.2);\nf.set(\\freq, 233.4);\n\nf.set(\\trigger, 1);\nf.set(\\trigger, 0);\nf.free;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ LFSaw.ar(500, 1, 0.1) }.play\n\n// used as both Oscillator and LFO:\n{ LFSaw.ar(LFSaw.kr(4, 0, 200, 400), 0, 0.1 }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ LFSaw.ar(500, 1, 0.1) }.play\n\n// used as both Oscillator and LFO:\n{ LFSaw.ar(LFSaw.kr(4, 0, 200, 400), 0, 0.1) }.play\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Demand`."}, {"role": "assistant", "content": "```supercollider\n(\na = { |t_trig, t_reset|\n var d = Demand.kr(t_trig + t_reset, t_reset, Dseries(0, 1, inf));\n d.poll(t_trig + t_reset);\n 0.0;\n}.play\n);\na.set(\\t_trig, 1); // do this a few times — the demand value should increase by 1 each time\na.set(\\t_reset, 1); // goes immediately back to 0\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nNdef(\\x, { Saw.ar(110) * 0.1 }).play;\nNdef(\\x)[1] = \\filter -> { |in| RLPF.ar(in, 800, 0.4) };\n```"}, {"role": "assistant", "content": "Two nodes in one named proxy: a saw source, then a resonant low-pass filter fed by it.\n\n`Ndef(\\x, { ... })` defines the first node of the chain and `.play` starts it. `Ndef(\\x)[1] = \\filter ->`\ninserts a second node at index 1; the `\\filter` key says 'make this node an effect that receives the\nprevious node's output as `in`'. So the patch is `Saw -> RLPF -> out`. Because it is an Ndef, calling\n`Ndef(\\x, { ... })` again replaces the source with a crossfade instead of restarting, and\n`Ndef(\\x).stop` removes the whole chain."}]} -{"conversations": [{"role": "user", "content": "What are you not good at?"}, {"role": "assistant", "content": "Everything outside SuperCollider. I have no audio input, no live data, and my knowledge ends at the documentation snapshot I was trained on — so I can be confidently wrong about Quarks and new UGens."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Pwrap` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Pn(\n Pwrap(\n Pgeom(200, 1.07, 96),\n 200,\n 1000.0\n ),\n inf\n);\nx = a.asStream;\n\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, x.next.debug, \\dur, 0.3]);\n 0.12.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n//code that utilizes the glitch.\n(\ns.waitForBoot{\n SynthDef(\\birdy, {|out= 0, amp= 0.1, freq= 1000, atk= 0.01, rel= 0.05, cur= -4, gate= 1|\n var env= EnvGen.kr(Env.asr(atk, 1, rel, cur), gate, doneAction:2);\n var src= SinOsc.ar(0.11, GlitchBRF.ar(SinOsc.ar(SinOsc.ar(0.12).exprange(1, freq), 2pi), 1/SinOsc.ar(0.13).range(1, #[99, 100])));\n Out.ar(out, Limiter.ar(LeakDC.ar(src*amp)));\n }).add\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n//code that utilizes the glitch.\n(\ns.waitForBoot{\n SynthDef(\\birdy, {|out= 0, amp= 0.1, freq= 1000, atk= 0.01, rel= 0.05, cur= -4, gate= 1|\n var env= EnvGen.kr(Env.asr(atk, 1, rel, cur), gate, doneAction:2);\n var src= SinOsc.ar(0.11, GlitchBRF.ar(SinOsc.ar(SinOsc.ar(0.12).exprange(1, freq), 2pi), 1/SinOsc.ar(0.13).range(1, #[99, 100])));\n Out.ar(out, Limiter.ar(LeakDC.ar(src*amp)));\n }).add;\n s.sync;\n Synth(\\birdy, [\\amp, 0.15]);\n};\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Document.getTextAsync` do? What arguments does it take?"}, {"role": "assistant", "content": "Get a range of text from the document. Asynchronous. The text is passed to the `action` function as an Arguments: action — A function to evaluate after the request is complete. It is passed one argument, a String, for the retrieved contents.; start — An Integer for the starting position to access.; range — An Integer for the number of characters to retrieve. -1 retrieves to the end of the document.."}]} +{"conversations": [{"role": "user", "content": "What does `Canvas3D.mRotateY` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a matrix for rotating around Y Arguments: ay — Y rotation."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `BufRd`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_playbuf, { |out = 0, bufnum = 0, rate = 1, startPos = 0, amp = 0.1, sustain = 1, pan = 0, loop = 1|\n var audio;\n rate = rate * BufRateScale.ir(bufnum);\n startPos = startPos * BufFrames.ir(bufnum);\n\n audio = BufRd.ar(1, bufnum, Phasor.ar(0, rate, startPos, BufFrames.ir(bufnum)), 1, 1);\n audio = EnvGen.ar(Env.sine, 1, timeScale: sustain, doneAction: Done.freeSelf) * audio;\n audio = Pan2.ar(audio, pan, amp);\n OffsetOut.ar(out, audio);\n}).add; // use .store for rendering example below\n\na = Pproto({\n ~newgroup = (type: \\group).yield;\n ~sf1 = (type: \\allocRead, path: ExampleFiles.apollo11).yield;\n},\n Pbind(*[\n instrument: \\help_playbuf,\n dur: Pseg([0, 0, 0.25, 0.5, 0.75, 1], 10).linexp(0, 1, 0.01, 2),\n legato: 4,\n startPos: Pn(Pseg([0, 1], 20), inf),\n rate: Pwhite(1, 1).midiratio,\n loop: 0,\n group: Pkey(\\newgroup),\n bufnum: Pkey(\\sf1)\n ])\n);\na.play;\n)\n\n// a.render(\"sounds/test.aif\", 40)\n// SoundFile.openRead(\"sounds/test.aif\").play\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Plotter.plots` do?"}, {"role": "assistant", "content": "Plot numerical data on a window or view Returns: An Array of Plots."}]} {"conversations": [{"role": "user", "content": "Supernova, Groups, Threads, Ndef?"}, {"role": "assistant", "content": "SuperCollider forum — Supernova, Groups, Threads, Ndef?\n\nAbout Ndef:\n\nAFAIK you can manually move a NodeProxy’s group into another group:\n\n```supercollider\n~pargroup = ParGroup(s);\n\nNdef(\\a, { Silent.ar(1) });\n\nNdef(\\a).group.moveToHead(~pargroup);\n```\n\nBut...\n\nNodeProxies use InFeedback.\n\nI was a little suspicious about this for parallel processing. As I recalled, InFeedback’s result depends on the order of execution:\n\n-\nIf the source node for the bus finished processing before the server reaches InFeedback, then InFeedback will output the block of audio being processed now.\n\n-\nIf the source node comes after the node containing InFeedback, then it will output the previous block of audio.\n\nIn both cases, these are the most recently available audio blocks. But, if the order of evaluation is not consistent, then the output may not be consistent.\n\nLet’s test that:\n\n```supercollider\nb = Bus.audio(s, 1);\n\na = { SinOsc.ar(200, 0, 0.1) }.play(outbus: b);\n\nc = { InFeedback.ar(b, 1).dup }.play(target: a, addAction: \\addAfter);\n\n(\nfork {\n var order = Pseq([\\moveBefore, \\moveAfter], inf).asStream;\n loop {\n c.perform(order.next, a);\n 1.0.wait;\n }\n}\n)\n```\n\nOops.\n\nThis means you can’t randomly throw Ndefs into ParGroups. If one Ndef reads a signal from another, then you have to make sure that the target Ndef comes later in a serial (regular) Group. (Correctness of the result should be more important than “optimal” usage of multiple cores.)\n\nIf you don’t, and if supernova happens to put the source and target Ndefs onto separate cores at roughly the same time, then the target might evaluate InFeedback either before or after the source finishes, and there’s no guarantee of this being consistent. So you might get clicks.\n\nhjh"}]} -{"conversations": [{"role": "user", "content": "What does `String.asAbsolutePath` do?"}, {"role": "assistant", "content": "Return this path as an absolute path by prefixing it with File#*getcwd if"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// default initial params\n{ GbmanN.ar(MouseX.kr(20, SampleRate.ir)) * 0.1 }.play(s);\n\n// change initial params\n{ GbmanN.ar(MouseX.kr(20, SampleRate.ir), -0.7, -2.7) * 0.1 }.play(s);\n\n// wait for it...\n{ GbmanN.ar(MouseX.kr(20, SampleRate.ir), 1.2, 2.0002) * 0.1 }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(GbmanN.ar(40)*400+500)*0.4 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// default initial params\n{ GbmanN.ar(MouseX.kr(20, SampleRate.ir)) * 0.1 }.play(s);\n\n// change initial params\n{ GbmanN.ar(MouseX.kr(20, SampleRate.ir), -0.7, -2.7) * 0.1 }.play(s);\n\n// wait for it...\n{ GbmanN.ar(MouseX.kr(20, SampleRate.ir), 1.2, 2.0002) * 0.1 }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(GbmanN.ar(40)*400+500)*0.4 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "What does doneAction do?"}, {"role": "assistant", "content": "It tells the server what to do to the enclosing Synth when the UGen finishes. The one that matters most is `doneAction: 2`, which frees the Synth: that is how a percussive sound cleans itself up instead of leaking silent nodes. `doneAction: 0` does nothing, so the Synth keeps running. EnvGen, Line, XLine, LinePan and friends all accept it, which is why `EnvGen.kr(Env.perc(0.01, 1), doneAction: 2)` is the standard envelope idiom."}]} -{"conversations": [{"role": "user", "content": "What does `MultiSplineFr.guiClass` do?"}, {"role": "assistant", "content": "Multi dimensional spline frame rate device"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// a Function passed to loopFunc is applied to all items of the looping\n\n(\n~lookBack = 0;\n\np = Pbind(\n \\dur, Pn(Pshuf([1, 1, 2]/6)),\n \\midinote, PSloop(\n Prand((60..80), inf),\n bufSize: 10,\n lookBack: { ~lookBack },\n loopFunc: { |x| x + [0, 5] }\n )\n).play\n;\n\n// wait a bit to fill buffer\n// loop with Function applied\n\n~lookBack = 3\n\n~lookBack = 6\n\n\n// go on and stop\n\n~lookBack = 0\n\np.stop\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// a Function passed to loopFunc is applied to all items of the looping\n\n(\n~lookBack = 0;\n\np = Pbind(\n \\dur, Pn(Pshuf([1, 1, 2]/6)),\n \\midinote, PSloop(\n Prand((60..80), inf),\n bufSize: 10,\n lookBack: { ~lookBack },\n loopFunc: { |x| x + [0, 5] }\n )\n).play\n);\n\n// wait a bit to fill buffer\n// loop with Function applied\n\n~lookBack = 3\n\n~lookBack = 6\n\n\n// go on and stop\n\n~lookBack = 0\n\np.stop\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `HPZ2`."}, {"role": "assistant", "content": "```supercollider\n// Compare:\n\n{ WhiteNoise.ar(0.25) }.play;\n\n{ HPZ2.ar(WhiteNoise.ar(0.25)) }.play;\n\n// HPZ2 is useful to detect changes in a signal:\n// see also HPZ1\n(\n{\n var changingSignal = LFNoise0.ar(1000);\n var hpz2 = HPZ2.ar(changingSignal);\n [hpz2, hpz2 > 0]\n}.plot\n);\n```"}]} -{"conversations": [{"role": "user", "content": "What is a UGen graph in SuperCollider?"}, {"role": "assistant", "content": "A UGen graph is the directed acyclic graph of unit generators that a SynthDef describes: sources (SinOsc, WhiteNoise) feed processors (LPF, EnvGen, Pan2) and end at an output such as Out.ar. The language builds the graph; the server instantiates it once per Synth. A signal path is drawn by passing one UGen's output as another's input, and because UGens are multi-channel by default, the same expression can build a stereo or 8-channel graph depending on the arrays inside it."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ SinOsc.ar(ControlRate.ir * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ SinOsc.ar(ControlRate.ir) * 0.1 }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What is `ParGroup`?"}, {"role": "assistant", "content": "ParGroup — Client-side representation of a parallel group node on the server"}, {"role": "user", "content": "What does `ParGroup.basicNew` do?"}, {"role": "assistant", "content": "Create and return a ParGroup object without creating a group node on the server. (This method is inherited from Node and is documented here only for convenience.)"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nfork {\n p = ParGroup.new;\n loop {\n (\n degree: rrand(0.0, 12.0).round(1/4),\n group: p,\n db: rrand(-30, -25),\n pan: rrand(-1.0, 1.0)\n ).play;\n 0.2.wait;\n }\n}\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nb = Bus(\\audio, 0, 2);\ns.bind {\n SynthDef(\\sinPerc, { |out = 0|\n var signal = SinOsc.ar * Env.sine(0.1).ar(gate: Impulse.ar(2));\n OffsetOut.ar(out, signal ! 2) }\n ).add;\n s.sync;\n Synth(\\sinPerc, [\\out, b]);\n b.plot(1);\n}\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nb = Bus(\\audio, 0, 2);\ns.bind {\n SynthDef(\\sinPerc, { |out = 0|\n var signal = SinOsc.ar * Env.sine(0.1).ar(gate: Impulse.ar(2));\n OffsetOut.ar(out, signal ! 2) }\n ).add;\n s.sync;\n Synth(\\sinPerc, [\\out, b]);\n b.plot(1);\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Amplitude`."}, {"role": "assistant", "content": "```supercollider\n// use input amplitude to control Pulse amplitude - use headphones to prevent feedback.\n{ Pulse.ar(90, 0.3, Amplitude.kr(SoundIn.ar(0))) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `NodeControl.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Encapsulates in an object a node and an index. Arguments: node — The node to encapsulate; index — The index to encapsulate."}]} -{"conversations": [{"role": "user", "content": "Explain `PmonoArtic` in SuperCollider briefly."}, {"role": "assistant", "content": "PmonoArtic — partly monophonic event stream Like Pmono, PmonoArtic plays one synth at a time (where successive events change the parameters of the existing synth node). PmonoArtic, however, allows events to re-articulate and supports staccato in the middle of a monophonic phrase. Category: Streams-Patterns-Events > Patterns > Event."}]} -{"conversations": [{"role": "user", "content": "What does `SimpleNumber.gammaQInv` do?"}, {"role": "assistant", "content": "Returns a value x such that `q = gamma_q(a, x)`. Requires `a` > 0 and 1 >= `p,q` >="}]} -{"conversations": [{"role": "user", "content": "What does `UChain.muted` do? What arguments does it take?"}, {"role": "assistant", "content": "Determines if event will be played or not in a Arguments: bool."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for IP detector."}, {"role": "assistant", "content": "```supercollider\n// The following strings are to avoid listing network bridges which seem to be created by Parallels Desktop:\n// | grep -Fv \"inet 10.\" \n\n(\n~getLocalIPs = {\n var winCMD, macCMD, linCMD, ips;\n \n winCMD = {\n \"ipconfig | findstr /C:IPv4\"\n .unixCmdGetStdOut\n .replace(\" IPv4 Address. . . . . . . . . . . : \", \"\");\n };\n \n macCMD = {\n (\"ifconfig | grep -Fv\" + \"inet 10.\"\n .quote + \"| grep\" + \"inet \"\n .quote + \"| grep -Fv 127.0.0.1 | awk '{print $2}'\"\n ).unixCmdGetStdOut;\n };\n \n linCMD = {\n (\"ip address | grep \\\"inet \\\" | grep -Fv 127.0.0.1 | awk '{print $2}' | cut -d '/' -f1\")\n .unixCmdGetStdOut;\n };\n //linCMD = { (\n // \"ifconfig | grep\" + \"inet \".quote +\n // \"| grep -Fv 127.0.0.1 | awk '{print $2}'\" \n //).unixCmdGetStdOut };\n \n ips = Platform.case(\n \\osx, { macCMD.() },\n \\linux, { linCMD.() },\n \\windows, { winCMD.() }\n );\n \n ips = ips.split(Char.nl);\n ips.removeAt(ips.size-1);\n ips\n}\n);\n\n~getLocalIPs.()\n```"}]} -{"conversations": [{"role": "user", "content": "I get 'server not running' or nothing happens at all."}, {"role": "assistant", "content": "The server is not booted. In the IDE press Ctrl+B, or evaluate `s.boot`. If code depends on a SynthDef being there, put it inside `s.waitForBoot { ... }`. When a script runs headless you can do `s.boot; s.sync;` and continue. `s.serverRunning` tells you the truth; if it is false, look at the post window for the boot error (usually an audio device problem)."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Paddpre`."}, {"role": "assistant", "content": "```supercollider\n(\nvar a, b;\na = Paddpre(\\freq, 302, Pset(\\freq, 500, Pbind(\\dur, 0.3)));\nx = a.asStream;\n9.do({ x.next(Event.default).postln });\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Interfacing SC with external software: MIDI or OSC?"}, {"role": "assistant", "content": "SuperCollider forum — Interfacing SC with external software: MIDI or OSC?\n\nI found this partial solution on sccode.org :\n\n```supercollider\n // declare an event type which sends OSC commands to Renoise\n\n(\nEvent.addEventType(\\renoise, { |server|\n var renoiseOscServer = NetAddr(\"127.0.0.1\", 8000);\n var notes = [~midinote.value, ~ctranspose.value, ~velocity.value, ~sustain.value, ~lag.value, ~timingOffset.value, ~instr.value, ~track.value].flop;\n var timeNoteOn, timeNoteOff, instrument, track, velocity;\n var serverLatency;\n\n serverLatency = server.latency ? 0;\n\n notes.do {|note|\n instrument = note[6] ? -1;\n track = note[7] ? -1;\n velocity = note[2].asInt.clip(0,127);\n\n // sustain and timingOffset are in beats, lag is in seconds\n timeNoteOn = (thisThread.clock.tempo.reciprocal*note[5])+note[4]+server.latency;\n timeNoteOff = (thisThread.clock.tempo.reciprocal*(note[3]+note[5]))+note[4]+server.latency;\n SystemClock.sched(timeNoteOn, {renoiseOscServer.sendMsg(\"/renoise/trigger/note_on\", instrument.asInt, track.asInt, (note[0]+note[1]).asInt, velocity )});\n SystemClock.sched(timeNoteOff, {renoiseOscServer.sendMsg(\"/renoise/trigger/note_off\", instrument.asInt, track.asInt, (note[0]+note[1]).asInt)});\n }\n});\n);\n\n// Now start Renoise OSC server, load a sample, and try some patterns\n\n// straight timing\n(\nPbind(*[\n type: \\renoise,\n legato: Pgauss(0.2,0.05,inf),\n dur: 0.2,\n degree: [2,5,12],\n track: Prand([0,1], inf),\n ctranspose: Pseq([0,0,0,0,4,4,4,4,5,5,5,5],inf),\n velocity: Pgauss(64,10,inf),\n]).play;\n)\n```\n\nhttp://sccode.org/1-4SN\n\nBut what I couldn’t find there was a simple syntax for sending Note Events or Midi Events as OSC messages... Do I really need to re-implement the whole SC’s defaultParentEvent as new OSC Event to send it using regular pattern’s syntax?"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Amplitude`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n // LFSaw begins at 0, illustrates attack time better\n var sig = LFSaw.ar(440);\n var amps = Amplitude.ar(\n sig,\n attackTime: [0.001, 0.01],\n releaseTime: [0.01, 0.2]\n );\n [sig] ++ amps\n}.plot\n.superpose_(true)\n.plotColor_([Color.black, Color.green, Color.blue]);\n);\n\n(\n// use input amplitude to control SinOsc frequency\n{\n SinOsc.ar(\n Amplitude.kr(\n Blip.ar(3, 20) * LFNoise1.kr(0.1).range(0, 1),\n MouseX.kr(0.001, 1, 1),\n MouseY.kr(0.001, 1, 1),\n 1200,\n 400\n ),\n 0, 0.3)\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does Lag do?"}, {"role": "assistant", "content": "`Lag.ar(in, lagTime)` and `Lag.kr(in, lagTime)` smooth a signal with an exponential lag towards its target, which removes the clicks and zipper noise a stepped control would produce. Lag.kr on a mouse or MIDI input is the standard way to make a parameter feel analogue: `Lag.kr(MouseX.kr(200, 4000), 0.2)`. Lag2 and Lag3 are the second- and third-order versions, smoother and slower."}]} -{"conversations": [{"role": "user", "content": "What does `ServerErrorGui.guiBody` do? What arguments does it take?"}, {"role": "assistant", "content": "Listen to a server for /fail messages and display them in a small view. Arguments: layout."}]} -{"conversations": [{"role": "user", "content": "What is `CutComb1` in SuperCollider?"}, {"role": "assistant", "content": "CutComb1 — BBCut2 comb filter CutComb1 adds a comb filter to BBCut2. Category: Libraries > BBCut > Cut FX."}]} -{"conversations": [{"role": "user", "content": "What does `GridLayout.minRowHeight` do? What arguments does it take?"}, {"role": "assistant", "content": "Gets the minimum height assigned to a Arguments: row — The index of a row.."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pdiff`."}, {"role": "assistant", "content": "```supercollider\np = Pbind(\n \\degree, Pxrand([0, 2, 3, 4, 6, 7], 12),\n \\dur, Pdiff(Pkey(\\degree)).abs/4,\n).play;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// implicitly, the composition operator <> returns a Pchain when applied to a pattern.\n// so that a <> b creates a Pchain (a, b).\n// as seen above, in Pchain(a, b), a specifies (and overrides) b: b is the input to a.\n\n// the above example is equivalent to:\n\n(Pbind(\\degree, Pseq([1, 2, 3], inf)) <> (detune: [0, 4])).trace.play;\n\n(\na = Pbind(\\degree, Pseq([1, 2, 3], inf), \\dur, Prand([0.2, 0.4], inf));\nb = Pbind(\\detune, Pseq([-30, 0, [0, 40]], inf), \\dur, 0.1);\nc = b <> a;\nc.play; // see that the\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// implicitly, the composition operator <> returns a Pchain when applied to a pattern.\n// so that a <> b creates a Pchain (a, b).\n// as seen above, in Pchain(a, b), a specifies (and overrides) b: b is the input to a.\n\n// the above example is equivalent to:\n\n(Pbind(\\degree, Pseq([1, 2, 3], inf)) <> (detune: [0, 4])).trace.play;\n\n(\na = Pbind(\\degree, Pseq([1, 2, 3], inf), \\dur, Prand([0.2, 0.4], inf));\nb = Pbind(\\detune, Pseq([-30, 0, [0, 40]], inf), \\dur, 0.1);\nc = b <> a;\nc.play; // see that the \\dur key of a is overridden by b\n);\n\n// also value streams can be composed\n(\na = Pfunc { |x| x + 1.33 };\nb = Pfunc { |x| x * 3 };\nc = Pseries(1, 2, inf);\n);\n\n// post some values from the composite streams:\n\nt = (a <> b).asStream;\n10.do { t.value(10).postln };\n\nt = (a <> b <> c).asStream;\n10.do { t.value(10).postln };\n\nt = (b <> c <> a).asStream;\n10.do { t.value(10).postln };\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for midified arpeggiator/auto-accompaniment using patterns."}, {"role": "assistant", "content": "```supercollider\n(\ns.waitForBoot({\n var right, left;\n var n0, n1, n2;\n var note_getter;\n\n MIDIdef.freeAll;\n if (~midi_initilized.isNil) {\n MIDIClient.init;\n MIDIIn.connectAll;\n ~midi_initialized = 1;\n };\n\n ~note_table = 0!127;\n ~n = nil;\n\n MIDIdef.noteOn(\n \\mynoteonhandler, // just a name for this handler\n {\n |val, num, chan, src|\n ~note_table[num] = 1; // update note table and update ~n\n ~n = ~note_table.selectIndices({|item, i| item != 0});\n }\n );\n\n MIDIdef.noteOff(\n \\mynoteoffhandler, // just a name for this handler\n {\n |val, num, chan, src|\n ~note_table[num] = 0; // update note table and update ~n\n /*\n // only enable the following lines if you want the arpeggio to stop as soon as you release the keys\n ~n = ~note_table.selectIndices({|item, i| item != 0});\n if (~n == []) { ~n = nil; };\n */\n }\n );\n\n note_getter = {\n | index |\n Plazy {\n if (~n.isNil) {\n Pseq([Rest(1)]);\n } {\n ~n[index] ?? (~n[0] ?? Pseq([Rest(1)]));\n };\n };\n };\n\n n0 = note_getter.(0);\n n1 = note_getter.(1);\n n2 = note_getter.(2);\n\n right = Pbind(\n \\instrument, \\default,\n \\midinote, Pseq([ n0, n2, n1, n2] ++ (([ n0, n2, n1, n2] + 12)!2).flatten),\n \\dur, Pseq([1, 1, 1, 1, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5 ].normalizeSum*2)\n );\n left = Pbind(\n \\instrument, \\default,\n \\midinote, Pseq([ n0, n2, n0, n2, n0, n2, n0, n2] - 12),\n \\dur, Pseq([1, 1, 1, 1, 1, 1, 1, 1].normalizeSum*2)\n );\n if (~player.notNil) { ~player.stop; };\n ~player = Pn(Ppar([right,left])).play;\n});\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is the difference between Env and EnvGen?"}, {"role": "assistant", "content": "Env is a language-side description: a list of levels, times and a curve, e.g. `Env.perc(0.01, 1)` or `Env.adsr(0.01, 0.1, 0.5, 0.8)`. EnvGen is the UGen that plays it on the server: `EnvGen.kr(env, gate, doneAction: 2)`. The same Env can be played by many EnvGens, and Env also has language-side uses such as `.asStream` inside Patterns and `.plot`."}]} -{"conversations": [{"role": "user", "content": "What does `SimpleKDRUnit.guiClass` do?"}, {"role": "assistant", "content": "an internal part used in KeyCodeResponder"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n//try passing a signal through the hair cell; it won't come out like a pure sine, more like an impulse train stimulated by that input\n{ Pan2.ar(HairCell.ar(SinOsc.ar(440)),0.0) }.play;\n\n//modulation effects\n{ Pan2.ar(HairCell.ar(Saw.ar(MouseX.kr(1,1000)),0.0,MouseY.kr(0.0,1000.0)),0.0) }.play;\n\n//constantly self oscillates at 5 Hz, talk through it to modulate from base rate... \n{ Pan2.ar(HairCell.ar(SoundIn.ar,5.0,100),0.0) }.play;\n\n//sweeps and beeps\n{ Pan2.ar(HairCell.ar(Saw\n// …\n```"}, {"role": "assistant", "content": "try passing a signal through the hair cell; it won't come out like a pure sine, more like an impulse train stimulated by that input constantly self oscillates at 5 Hz, talk through it to modulate from base rate... (HairCell: Simple cochlear hair cell model)"}]} +{"conversations": [{"role": "user", "content": "What is `CytonDaisySerial` in SuperCollider?"}, {"role": "assistant", "content": "CytonDaisySerial — for communicating with a Cyton+Daisy board (16ch) this class is for communication via bluetooth serial (dongle). use CytonDaisyWifi for the wifi shield. Category: External Control."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `RandID`."}, {"role": "assistant", "content": "```supercollider\n// start a noise patch and set the id of the generator\n(\nSynthDef(\"help-RandID\", { |out = 0, id = 1|\n RandID.ir(id);\n Out.ar(out,\n WhiteNoise.ar(0.05) + Dust2.ar(70)\n )\n}).add;\n);\n\n// reset the seed of my rgen at a variable rate\n(\nSynthDef(\"help-RandSeed\", { |seed = 1910, id = 1|\n RandID.kr(id);\n RandSeed.kr(Impulse.kr(FSinOsc.kr(0.2, 0, 10, 11)), seed);\n}).add;\n\n);\n\n// start two noise synths on left and right channel with a different randgen id\na = Synth(\"help-RandID\", [\\out, 0, \\id, 1]);\nb = Synth(\"help-RandID\", [\\out, 1, \\id, 2]);\n\n// reset the seed of randgen 1\nx = Synth(\"help-RandSeed\", [\\id, 1]);\n\n// change the target randgen to 2 (affects right channel)\nx.set(\\id, 2);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `StandardL`."}, {"role": "assistant", "content": "```supercollider\n// vary frequency\n{ StandardL.ar(MouseX.kr(20, SampleRate.ir)) * 0.3 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// define the violin-like sound synth\n(\nSynthDef(\\violin, {\n | midinote=60, gate=1, amp=0.25 |\n var env = EnvGen.kr(Env.asr(0.1, 1, 0.1), gate, doneAction:2);\n var sig = VarSaw.ar(\n midinote.midicps,\n width:LFNoise2.kr(1).range(0.2, 0.8)*SinOsc.kr(5, Rand(0.0, 1.0)).range(0.7,0.8))*0.25;\n sig = sig * env * amp;\n Out.ar(0, sig!2);\n}).add;\n);\n\n\n// play a chord (farfisa-like sound)\n(\n[60, 64, 67].do ({\n | note |\n Synth(\\violin, [\\midinote, note]);\n})\n);\n\n// play a single note (it seems also a flute!)\nx = Synth(\\violin, [\\midinote, 84]);\nx.set(\\gate, 0); // stop the note\n\n\n// play some random notes\n(\np = Pbind(\n \\instrument, \\violin,\n \\midinote, Prand( Scale.majorPentatonic.degrees, inf) + 60,\n \\dur, 3,\n \\legato, 1\n).play;\n)\n```"}, {"role": "assistant", "content": "Trying to procedurally synthetise a violin, I eventually came out with a \"Farfisa\" organ like sound.\r\nIt can be used also as a flute!."}]} +{"conversations": [{"role": "user", "content": "What does `Node.release` do? What arguments does it take?"}, {"role": "assistant", "content": "This method causes the receiver to be freed after the specified amount of time. This is a convenience method which assumes that the synth contains an envelope generator (an EnvGen, Linen, or similar UGen) running a sustaining envelope (see Env#Sustained Envelope Creation Methods) and that this envelope's gate argument is set to a control called Arguments: releaseTime — The amount of time in seconds during which the node will release. If set to a value `<= 0`, the synth will release immediately. A `nil` value will cause the synth to release using its envelope's normal release stage(s).."}]} {"conversations": [{"role": "user", "content": "How do I set the tempo?"}, {"role": "assistant", "content": "TempoClock.default.tempo = 120/60; the argument is beats per second, so 120 BPM is 2.0. Patterns scheduled on the default clock then follow it."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nSynthDef(\\test, { |out, freq = 440, amp = 0.1, nharms = 10, pan = 0, gate = 1|\n var audio = Blip.ar(freq, nharms, amp);\n var env = Linen.kr(gate, doneAction: Done.freeSelf);\n OffsetOut.ar(out, Pan2.ar(audio, pan, env));\n}.add;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nSynthDef(\\test, { |out, freq = 440, amp = 0.1, nharms = 10, pan = 0, gate = 1|\n var audio = Blip.ar(freq, nharms, amp);\n var env = Linen.kr(gate, doneAction: Done.freeSelf);\n OffsetOut.ar(out, Pan2.ar(audio, pan, env));\n}).add;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Group.freeAll` do?"}, {"role": "assistant", "content": "Free all the nodes in this group, but do not free this group"}]} -{"conversations": [{"role": "user", "content": "What does `MxUnit.handlersForClass` do? What arguments does it take?"}, {"role": "assistant", "content": "Container for a musical object (Instr, NDef, Spline etc); this is a single unit that has inlets and outlets which can be connected to other units Arguments: class."}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nMix.ar([SinOsc.ar(220, 0, 0.1), SinOsc.ar(330, 0, 0.1)])\n```"}, {"role": "assistant", "content": "Sums two sine waves into one signal — a perfect fifth, 220 Hz and 330 Hz, at 0.1 amplitude each.\n\n`[SinOsc.ar(220, 0, 0.1), SinOsc.ar(330, 0, 0.1)]` is an Array of two audio-rate signals (each UGen\nreturns a signal; an array of them is just a list). `Mix.ar` adds the elements together. The alternative\n`+` operator does the same for two signals, and `Splay.ar` would spread them across the stereo field\ninstead of summing them."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Pisano periods for rythmic patterns."}, {"role": "assistant", "content": "```supercollider\nb = Buffer.read( s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\" );\n\n(\nSynthDef(\\playBuf, {| out = 0, buf = 0, amp = 0.2, pan = 0.0, dur = 0.2, gate = 1 startPos = 0 |\n var sig, env;\n env = EnvGen.ar( Env.sine( dur ), gate, amp, doneAction: 2 );\n sig = PlayBuf.ar( \n 1, \n buf, \n BufRateScale.ir( buf ), \n 1, \n startPos * BufFrames.ir( buf )\n );\n OffsetOut.ar(out, Pan2.ar( sig * env, pan ) )\n}).add\n);\n\n(\nPn(\n Plazy({\n var divisor = 3.rrand( 9 ), repeats = 10.rrand( 20 );\n var pisano, size, starts, durs, pans, amps;\n\n pisano = Array.pisano( divisor );\n size = pisano.size;\n starts = { 1.0.rand } ! size ;\n durs = { 0.03.rrand( 0.08 ) } ! size;\n pans = { 1.0.rand2 } ! size;\n amps = { 0.05.rrand( 0.8 ) } ! size;\n\n \"Divisor: %\\t pisano period is of length: %\\n\".postf( divisor, size );\n\n Pbind(\n \\instrument, \\playBuf,\n \\pisano, Pseq( pisano, repeats ),\n \\buf, b,\n \\amp, Pindex( amps, Pkey( \\pisano ) ),\n \\dur, Pindex( durs, Pkey( \\pisano ) ),\n \\pan, Pindex( pans, Pkey( \\pisano ) ),\n \\startPos, Pindex( starts, Pkey( \\pisano ) )\n )\n }),\n inf\n).play\n);\n\nb.free\n\n//////////////////////////////////////////////////////////////////////\n// + Array { \n// // The pisano period for the given integer.\n// *pisano { | divisor = 3 |\n// var list, lastPair, sum;\n// if ( divisor.isInteger.not or: { divisor < 0 } ){\n// \"The divisor must be a positive integer\".throw;\n// };\n// list = List[ 0, 1 ];\n// while {\n// lastPair = list.keep( -2 );\n// sum = lastPair.sum;\n// sum != 1 or: { lastPair.last != 0 }\n// }{\n// list.add( sum % divisor );\n// };\n// ^ list.array.drop( -1 )\n// }\n\n// }\n//////////////////////////////////////////////////////////////////////\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nMix.ar([SinOsc.ar(220, 0, 0.1), SinOsc.ar(330, 0, 0.1)])\n```"}, {"role": "assistant", "content": "Sums two sine waves into one signal — a perfect fifth, 220 Hz and 330 Hz, at 0.1 amplitude each.\n\n`[SinOsc.ar(220, 0, 0.1), SinOsc.ar(330, 0, 0.1)]` is an Array of two audio-rate signals (each UGen\nreturns a signal; an array of them is just a list). `Mix.ar` adds the elements together. The alternative\n`+` operator does the same for two signals, and `Splay.ar` would spread them across the stereo field\ninstead of summing them."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nx = List[1, 2, 3];\nx.array.add(\"foo\");\nx.postln;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nx = List[1, 2, 3];\nx.array.add(\"foo\");\nx.postln;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Now with a little more stick?"}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\cowbell, {\n | out=0, amp=0.3, gate=1, fund_freq=540, pan=0.0 |\n var sig, env, hash;\n\n // hash = DC.ar(0);\n hash = BPF.ar(\n Hasher.ar(Sweep.ar(rate: TRand.kr(1.0, 10.0))), \n fund_freq * 1.4, \n 0.5,\n 2\n ).tanh * Env.perc(0.001, 0.02).ar(0);\n sig = Pulse.ar( fund_freq * [ 1, 1.5085 ], [ 0.565, 0.445 ], [ 0.4, 0.6 ] ).atan;\n env = EnvGen.ar(\n Env(\n [ 0, 0.05, 1, 0.1, 0 ], [ 0.003, 0.002, 0.05, 0.5 ], [2, -4, -4, -4]\n ),\n gate: gate,\n timeScale: [ 1.0, 1.5 ],\n doneAction: 2\n );\n sig = Mix( (hash + sig) * env );\n sig = BPF.ar( sig, fund_freq * 2, 1.808 );\n\n Out.ar( out, Pan2.ar( sig, pan, amp ) );\n}).add;\n);\n\nSynth(\\cowbell);\n```"}]} -{"conversations": [{"role": "user", "content": "Saving \"Presets\"?"}, {"role": "assistant", "content": "SuperCollider forum — Saving \"Presets\"?\n\nIf you don’t care too much about it being human readable, just use writeArchive and readArchive:\n\n```supercollider\na = Array.fill(400, {rrand(0,2200)});\n\na.writeArchive(\"/Users/spluta1/Documents/SC/test\");\n\nb = Object.readArchive(\"/Users/spluta1/Documents/SC/test\");\n\nb.postln;\n```\n\nSam"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\ns.boot; // start the server\n\n// something to record\n(\nSynthDef(\"bubbles\", { |out|\n var f, sound;\n f = LFSaw.kr(0.4, 0, 24, LFSaw.kr([8, 7.23], 0, 3, 80)).midicps; // glissando function\n sound = CombN.ar(SinOsc.ar(f, 0, 0.04), 0.2, 0.2, 4); // echoing sine wave\n Out.ar(out, sound);\n}).add;\n);\n\nx = Synth.new(\"bubbles\");\n\ns.prepareForRecord; // if you want to start recording at a precise moment in time, you have to call this first.\n\ns.record;\n\ns.pauseRecording; // pausable\n\ns.record\n// …\n```"}, {"role": "assistant", "content": "something to record look in your recordings folder and you'll find a file named for this date and time (Server: Object representing a server application)"}]} -{"conversations": [{"role": "user", "content": "What does `OpenObject.replyPort` do?"}, {"role": "assistant", "content": "Some applications do not allow to receive messages through the same port they are passing in the OSC message as reply port. As a workaround, this port can be explicitly overridden"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BeatTrack2`."}, {"role": "assistant", "content": "```supercollider\n// track audio in (try clapping a beat or beatboxing, but allow up to 6 seconds for tracking to begin) and spawning stuff at quarters, eighths and sixteenths\n(\nSynthDef(\\help_beattrack2_2, { |out|\n var trackb, trackh, trackq, tempo;\n var source, kbus;\n var bsound, hsound, qsound;\n\n source = SoundIn.ar(0);\n\n // downsampling automatic via kr from ar\n kbus = Out.kr(0, LPF.ar(source, 1000)); // ([feature1, feature3]++feature2);\n\n #trackb, trackh, trackq, tempo = BeatTrack2.kr(0, 1, weightingscheme: e.bufnum);\n\n bsound = Pan2.ar(LPF.ar(WhiteNoise.ar * (Decay.kr(trackb, 0.05)), 1000), 0.0);\n hsound = Pan2.ar(BPF.ar(WhiteNoise.ar * (Decay.kr(trackh, 0.05)), 3000, 0.66), -0.5);\n qsound = Pan2.ar(HPF.ar(WhiteNoise.ar * (Decay.kr(trackq, 0.05)), 5000), 0.5);\n\n Out.ar(out, source + bsound + hsound + qsound);\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nPbind(\n \\degree, Pif(\n 0.1.loop.coin,\n Pseq([Rest(), 7], inf), // every second is a Rest\n Pseries(0, 1, inf).fold(-7, 7)\n ),\n \\dur, 0.125\n).play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nPbind(\n \\degree, Pif(\n 0.1.loop.coin,\n Pseq([Rest(), 7], inf), // every second is a Rest\n Pseries(0, 1, inf).fold(-7, 7)\n ),\n \\dur, 0.125\n).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\ns.boot;\n// Simple polling of median values - you could do this without a UGen!\nx = {|val=1, t_trig=0| MedianTriggered.kr(val, t_trig, 3).poll(t_trig, \"Median of recent 3 values\"); }.play;\nx.set(\\val, 10.rand.postln, \\t_trig, 1); // Execute this repeatedly\n\nx.free;\n\n// Same but with 4 values - note the way medians behave with even-sized sets\nx = {|val=1, t_trig=0| MedianTriggered.kr(val, t_trig, 4).poll(t_trig, \"Median of recent 4 values\"); }.play;\nx.set(\\val, 10.rand.postln, \\t_tr\n// …\n```"}, {"role": "assistant", "content": "Simple polling of median values - you could do this without a UGen! Same but with 4 values - note the way medians behave with even-sized sets (MedianTriggered: Median of recent values, triggered)"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for radio static with tuning noise (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"radiostatic\", {arg out=0;\n var hum, sineSweep, tuning, dustNoise, staticNoise, humFreq, numHarms;\n \n numHarms = 7;\n humFreq = 100;\n hum = Array.fill(numHarms, {|i| SinOsc.ar( (i+1) * humFreq, 0, 1/numHarms)});\n hum = hum.sum;\n dustNoise = Dust.ar(LFNoise1.ar(0.5).range(1000,8000));\n staticNoise = hum * dustNoise * LFNoise1.ar(1).range(0.5, 2);\n \n sineSweep = SinOsc.ar(LFNoise2.ar(1).range(20, 11000));\n tuning = SinOsc.ar(10000).ring4(sineSweep) * LFNoise2.ar(1.1).range(0.05, 0.1);\n\n Out.ar(out, Pan2.ar(staticNoise + tuning, 0));\n}).add;\n);\n \na = Synth(\"radiostatic\");\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\np = Pbind(\n \\degree, Pseq([\n 0, 1, 2, 0, 0, 1, 2, 0,\n 2, 3, 4, \\rest, 2, 3, 4, \\rest\n ]),\n \\dur, 0.25\n).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\np = Pbind(\n \\degree, Pseq([\n 0, 1, 2, 0, 0, 1, 2, 0,\n 2, 3, 4, \\rest, 2, 3, 4, \\rest\n ]),\n \\dur, 0.25\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `MxChannel.groupForIndex` do? What arguments does it take?"}, {"role": "assistant", "content": "a group of MxUnits Arguments: index; bundle."}]} -{"conversations": [{"role": "user", "content": "What does `VDiskIn.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Stream in audio from a file, with variable rate Arguments: numChannels — number of channels. Must be a nonzero, positive integer. This is fixed when the SynthDef is compiled so cannot be assigned to a SynthDef argument.; bufnum — buffer number; rate — controls the rate of playback. Values below 4 are probably fine, but the higher the value, the more disk activity there is, and the more likelihood there will be a problem.; loop — If loop is set to 1, the soundfile will loop.; sendID — If a sendID is given, the UGen sends an OSC message with this ID and the frame index relative to the onset of the Synth each time it reloads the buffer: `['/diskin', nodeID, sendID, frame]`. The true frame index into the file is determined by the `startFrame` given when reading the initial buffer's ."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BufDelayL`."}, {"role": "assistant", "content": "```supercollider\n// allocate buffer\nb = Buffer.alloc(s, 44100, 1);\n\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nBufDelayL.ar(b.bufnum, z, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\nb.free;\n\n\n// multichannel\n\n// two channels, two buffers\nb = Buffer.allocConsecutive(2, s, 32768, 1);\n\na = { |bufs = #[0, 1]|\n var sig = SinOsc.ar([440, 880]) * Decay2.kr(Impulse.kr([2, 4]), 0.01, 0.15);\n sig + BufDelayL.ar(bufs, sig, delaytime: 0.125)\n}.play(args: [bufs: b]);\n\na.free;\nb.do(_.free);\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// lookBack and deviations coupled here\n// maxLookBack must be large enough\n\n(\n~loDev = -1;\n~hiDev = 1;\n~lookBack = 2;\n\n\np = Pbind(\n    \\dur, 1/7,\n    \\midinote, PIdev(\n        78,\n        10,\n        Pn(Plazy { ~loDev }),\n        Pn(Plazy { ~hiDev }).trace(prefix: \"absolute deviation \"),\n        Pn(Plazy { ~lookBack })\n    ).t\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// lookBack and deviations coupled here\n// maxLookBack must be large enough\n\n(\n~loDev = -1;\n~hiDev = 1;\n~lookBack = 2;\n\n\np = Pbind(\n    \\dur, 1/7,\n    \\midinote, PIdev(\n        78,\n        10,\n        Pn(Plazy { ~loDev }),\n        Pn(Plazy { ~hiDev }).trace(prefix: \"absolute deviation \"),\n        Pn(Plazy { ~lookBack })\n    ).trace(prefix: \"midi \");\n).play\n);\n\n// start parameter movement on the fly\n\n(\n~loDev = Pseg(Pseq([2, 5].neg, inf), 5, \\sin);\n~hiDev = Pseg(Pseq([2, 5], inf), 5, \\sin).trace(prefix: \"absolute deviation and lookBack \");\n~lookBack = Pseg(Pseq([2, 5], inf), 5, \\sin);\n);\n\np.stop\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for more tweets (pitchshift feedback + sinoscfb)?"}, {"role": "assistant", "content": "```supercollider\n// probably horrible for speakers... \n\n// glitchift\n{l=LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j**[l,k],k),[0.05,0.03],j);LocalOut.ar(s);s}.play;\n// drone\n{l=LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j**[2,2.1],k),[0.05,0.03],j);LocalOut.ar(s);s}.play;\n\n\n// few more I was mucking around with (remove tanh loop for < 140c)\n{l = LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j**l,k),[0.05,0.03],j);5.do{s=s.tanh+(s*0.1)};LocalOut.ar(s);s}.play;\n\n{l = LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j**2,k),[0.05,0.03],j);5.do{s=s.tanh+(s*0.1)};LocalOut.ar(s);s}.play;\n\n{l = LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j*20,k),[0.05,0.03],j);5.do{s=s.tanh+(s*0.1)};LocalOut.ar(s);s}.play;\n\n{l = LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j**j,k),[0.05,0.03],j);5.do{s=s.tanh+(s*0.1)};LocalOut.ar(s);s}.play;\n\n{l = LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j**l.abs,k),[0.05,0.03],j);5.do{s=s.tanh+(s*0.1)};LocalOut.ar(s);s}.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Pisano periods for rythmic patterns."}, {"role": "assistant", "content": "```supercollider\nb = Buffer.read( s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\" );\n\n(\nSynthDef(\\playBuf, {| out = 0, buf = 0, amp = 0.2, pan = 0.0, dur = 0.2, gate = 1 startPos = 0 |\n var sig, env;\n env = EnvGen.ar( Env.sine( dur ), gate, amp, doneAction: 2 );\n sig = PlayBuf.ar( \n 1, \n buf, \n BufRateScale.ir( buf ), \n 1, \n startPos * BufFrames.ir( buf )\n );\n OffsetOut.ar(out, Pan2.ar( sig * env, pan ) )\n}).add\n);\n\n(\nPn(\n Plazy({\n var divisor = 3.rrand( 9 ), repeats = 10.rrand( 20 );\n var pisano, size, starts, durs, pans, amps;\n\n pisano = Array.pisano( divisor );\n size = pisano.size;\n starts = { 1.0.rand } ! size ;\n durs = { 0.03.rrand( 0.08 ) } ! size;\n pans = { 1.0.rand2 } ! size;\n amps = { 0.05.rrand( 0.8 ) } ! size;\n\n \"Divisor: %\\t pisano period is of length: %\\n\".postf( divisor, size );\n\n Pbind(\n \\instrument, \\playBuf,\n \\pisano, Pseq( pisano, repeats ),\n \\buf, b,\n \\amp, Pindex( amps, Pkey( \\pisano ) ),\n \\dur, Pindex( durs, Pkey( \\pisano ) ),\n \\pan, Pindex( pans, Pkey( \\pisano ) ),\n \\startPos, Pindex( starts, Pkey( \\pisano ) )\n )\n }),\n inf\n).play\n);\n\nb.free\n\n//////////////////////////////////////////////////////////////////////\n// + Array { \n// // The pisano period for the given integer.\n// *pisano { | divisor = 3 |\n// var list, lastPair, sum;\n// if ( divisor.isInteger.not or: { divisor < 0 } ){\n// \"The divisor must be a positive integer\".throw;\n// };\n// list = List[ 0, 1 ];\n// while {\n// lastPair = list.keep( -2 );\n// sum = lastPair.sum;\n// sum != 1 or: { lastPair.last != 0 }\n// }{\n// list.add( sum % divisor );\n// };\n// ^ list.array.drop( -1 )\n// }\n\n// }\n//////////////////////////////////////////////////////////////////////\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n \n// definition for future reference in arbitrary Environments,\n// intervals grow together with base tone\n\n(\nq = PLexprand(\\lo, \\hi);\n\np = Pbind(\n \\midinote, 60 + q + PLtuple([0, q]),\n \\dur, 0.1\n);\n);\n\n\n// prepare current Environment\n\n(\n~lo = 0.1;\n~hi = 10;\n);\n\n\n// run\n\nx = p.play;\n\n\n// replace \n\n~hi = 20;\n\nx.stop;\n```"}, {"role": "assistant", "content": "definition for future reference in arbitrary Environments, intervals grow together with base tone (PLexprand: dynamic scope Pexprand variant)"}]} -{"conversations": [{"role": "user", "content": "What does `Mx.extendChannels` do? What arguments does it take?"}, {"role": "assistant", "content": "A mixer and dynamic patching Arguments: toSize."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Pattern transcription of intro chords of this song."}, {"role": "assistant", "content": "```supercollider\n// Crystal Waters \"Gypsy Woman (She's Homeless)\" - chords\n(\n~bpm = TempoClock.new(120/60);\nPbind(\n \\midinote, Pseq([\n Pn([45, 57, 67, 72, 76], 2),\n Pn([46, 58, 69, 74, 77], 3),\n Pn([43, 55, 67, 70, 74, 77], 2), \n Pn([48, 60, 67, 70, 73, 76], 3),\n Pseq([\n Pn([50, 62, 65, 69, 72, 76], 2),\n Pn([50, 62, 65, 69, 72, 74], 3)\n ], 2),\n Pn([45, 57, 67, 72, 76], 2),\n Pn([46, 58, 69, 74, 77], 3),\n Pn([52, 64, 76, 79, 83, 86], 2),\n Pn([51, 63, 75, 79, 82, 86], 3),\n Pseq([\n Pn([50, 62, 65, 69, 72, 76], 2),\n Pn([50, 62, 65, 69, 72, 74], 3)\n ], 2),\n ], inf),\n \\ctranspose, -12,\n \\dur, Pseq([1, Pn(3/4, 4)], inf),\n \\amp, 0.2,\n \\legato, Pseq([0.5, 0.5, Pwhite(0.2, 0.3, 3)], inf)\n).play(~bpm);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// First we create something to control\nx = { |freq = 440, amp = 0.6| MoogFF.ar(PinkNoise.ar(amp), freq).dup }.play;\n\n// In the following pattern, the first two keys are the ones that create the monophonic behaviour:\n(\np = Pbind(\n \\type, \\set, // This tells it we'll be setting parameters of an existing node...\n \\id, x.nodeID, // ...this tells it whose parameters we'll be setting\n \\args, #[\\freq, \\amp], // and this tells it which parameters to set\n \\freq, Pwhite(100, 1000),\n \\dur, 0.2,\n \\amp, Pseq((1, 0.99 .. 0.1), inf)\n).play;\n;\n\np.stop\nx.\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// First we create something to control\nx = { |freq = 440, amp = 0.6| MoogFF.ar(PinkNoise.ar(amp), freq).dup }.play;\n\n// In the following pattern, the first two keys are the ones that create the monophonic behaviour:\n(\np = Pbind(\n \\type, \\set, // This tells it we'll be setting parameters of an existing node...\n \\id, x.nodeID, // ...this tells it whose parameters we'll be setting\n \\args, #[\\freq, \\amp], // and this tells it which parameters to set\n \\freq, Pwhite(100, 1000),\n \\dur, 0.2,\n \\amp, Pseq((1, 0.99 .. 0.1), inf)\n).play;\n);\n\np.stop\nx.free\n```"}]} -{"conversations": [{"role": "user", "content": "What does `MIDIFunc.reset` do?"}, {"role": "assistant", "content": "A convenience method to create a new MIDIFunc which responds to MIDI reset messages. See #*new for argument descriptions. The responding `func` will be passed the argument Returns: A new instance of MIDIFunc which responds to MIDI reset messages."}]} -{"conversations": [{"role": "user", "content": "What does `Interpreter.codeDump` do?"}, {"role": "assistant", "content": "this interpreter variable can be set to evaluate a function with any successfully compiled code. see e.g. the class History. `a = []; // store all the code evaluated in"}]} -{"conversations": [{"role": "user", "content": "What does `MxQuery.reject` do? What arguments does it take?"}, {"role": "assistant", "content": "Just like collection Arguments: function — a new MxQuery with the non-rejected results."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,0,1,3,4,0], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n100.do({ x.next.postln });\n);\n\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = PdurStutter\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,0,1,3,4,0], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n100.do({ x.next.postln });\n);\n\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n);\n\n\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,4,4,0,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `PLbindef`?"}, {"role": "assistant", "content": "PLbindef — wrapper for Pbindef which allows replacement in object prototyping style"}, {"role": "user", "content": "What does `PLbindef.new` do?"}, {"role": "assistant", "content": "Creates a new PLbindef object or sets sources as with Pbindef."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n// synthdefs to play with\n\n(\nSynthDef(\\noise_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, rq = 0.1, amp = 0.1|\n var sig = { WhiteNoise.ar } ! 2;\n sig = BPF.ar(sig, freq, rq) *\n EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2) *\n (rq ** -1) * (250 / (freq ** 0.8));\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\sin_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { SinOsc.ar(freq, Rand(0, 2pi)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\saw_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { VarSaw.ar(freq, Rand(0, 1)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `BHiPass4` in SuperCollider?"}, {"role": "assistant", "content": "BHiPass4 — 24db/oct rolloff - 4th order resonant Hi Pass Filter [1] The B equalization suite is based on the Second Order Section (SOS) biquad UGen. Category: UGens > Filters > BEQSuite."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\na = AllGui.new;\n // test adding things that should show up: \na = 12;\nz = 42;\n~bar = 345;\n~foo = 345;\nTdef(\\a); \nTdef(\\b); \nPdef(\\a);\nPdef(\\b);\nPdefn(\\trala);\nPdefn(\\hopsa);\nNdef(\\a);\nNdef(\\b);\n // then try clicking the open button on one!\n\n // all these guis are reasonably non-overlapping / tiled:\na = AllGui(12);\nAllGui.openFuncs.do(_.value(8)); // small screens\nAllGui.openFuncs.do(_.value(12));\n```"}, {"role": "assistant", "content": "test adding things that should show up: then try clicking the open button on one! (AllGui: Overview of many globally stored objects)"}]} -{"conversations": [{"role": "user", "content": "What does `KeyClarity.kr` do? What arguments does it take?"}, {"role": "assistant", "content": "Running score of maximum correlation of chromagram with key profiles Arguments: chain — [fft] Audio input to track. This must have been pre-analysed by a 4096 size FFT. No other FFT sizes are valid except as noted below. `// With standard hop of half FFT size = 2048 samples`; keydecay — [sk] Number of seconds for the influence of a window on the final key decision to decay by 40dB (to 0.01 its original value).; chromaleak — [sk] Each frame, the chroma values are set to the previous value multiplied by the chromadecay. 0.0 will start each frame afresh with no memory.."}]} -{"conversations": [{"role": "user", "content": "Build a slowly evolving drone with Ndef."}, {"role": "assistant", "content": "Ndef gives you a named patch you can redefine while it plays; the filter is a separate node in the\nchain so you can change it on its own.\n\n```supercollider\n(\nNdef(\\drone, { |freq = 55, amp = 0.12|\n var detune = [0, 0.07, -0.11];\n var sig = Mix(Saw.ar(freq * (1 + detune))) * amp;\n LPF.ar(sig, 400);\n}).play;\n\nNdef(\\drone)[1] = \\filter -> { |in| RLPF.ar(in, LFNoise1.kr(0.1).exprange(200, 1800), 0.3) };\n)\n```\n\nRedefining Ndef(\\drone, { ... }) later crossfades to the new definition; Ndef(\\drone).stop stops it."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes vinyl noise emulation."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef.new(\\vinylCrackling, { arg out=0;\n var pop,imp,modImp,midNoise,hiNoise,loNoise,loopTime=8,numChan=2,w,x,y;\n\n //Harder pops\n pop = TDuty.ar(Dseq({ 1.0.bilinrand.abs } ! loopTime,inf));\n pop = Resonz.ar(Decay.ar(pop,TRand.ar(0.001,0.1,pop)),Demand.ar(pop,0,Dseq({ 7000.bilinrand.abs+40 } ! loopTime,inf)),\n mul:Demand.ar(pop,0,Dseq({ exprand(0.1,0.87) } ! loopTime,inf)));\n pop = LeakDC.ar(pop,TRand.ar(0.9,0.9995,pop));\n #w,x,y = PanB2.ar(pop,Demand.ar(pop,0,Dseq({ 1.0.rand2 } ! loopTime,inf)));\n\n //Softer, highpass filtered impulses\n imp = { arg i; HPF.ar(LPF.ar(Dust2.ar(8),8000.0),6000.0,WhiteNoise.ar(0.7)) } ! numChan;\n\n //Faster, modulated lowpass filtered impulses\n modImp = LPF.ar(Dust.ar(LFDNoise3.ar(1).exprange(100,500),LFDNoise3.ar(10).exprange(0.01,0.07)),9000.0) ! numChan;\n\n //Mid frequency modulated noise background\n midNoise = LPF.ar(GrayNoise.ar(LFDNoise3.ar(60))*WhiteNoise.ar(0.009),12000.0) ! numChan;\n\n //High frequency modulated noise background\n hiNoise = HPF.ar(LPF.ar(GrayNoise.ar(LFDNoise3.ar(60))*WhiteNoise.ar(0.01),14000.0),8000.0) ! numChan;\n\n //Low frequency modulated noise background\n loNoise = LPF.ar(BrownNoise.ar(PinkNoise.ar.range(0.001,0.02)),1200) ! numChan;\n\n Out.ar(out,DecodeB2.ar(numChan,w,x,y)+imp+modImp+midNoise+hiNoise+loNoise);\n }).add;\n);\n\ns.sendMsg('/s_new',\\vinylCrackling,a=s.nextNodeID,0,1,\\out,0);\ns.sendMsg('/n_free',a);\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Nil`?"}, {"role": "assistant", "content": "Nil — Represents uninitialized data"}, {"role": "user", "content": "What does `Nil.isNil` do?"}, {"role": "assistant", "content": "Answers true because this is nil. In class Object this message is defined to answer false. `[1, 2, nil, 3].collect(_.isNil);`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nx = nil;\nx = x.add(8); // returns an array\nx = x.add(7); // appends to the array\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nb = Bus.audio(s, 2);\na = { |inbus = 0|\n var sig = In.ar(inbus, 2);\n // x axis is side, oriented toward right;\n // y axis is mid\n [sig[1] - sig[0], sig.sum]\n}.play(s.defaultGroup, outbus: b, addAction: \\addAfter);\nc = s.scope;\nc.style = 2;\nc.bus = b;\n)\n```"}, {"role": "assistant", "content": "Very quick-and-dirty hack to show stereo phase. Center = up (12:00). Full left = 10:30, full right = 1:30."}]} -{"conversations": [{"role": "user", "content": "[ 1, 2, 1, 1, 2, 1, 1 ] how to find adjacent elements in an array?"}, {"role": "assistant", "content": "SuperCollider forum — [ 1, 2, 1, 1, 2, 1, 1 ] how to find adjacent elements in an array\n\nRandColors:\n\nI need to find the index, the how many times (the adjacent values are equal) and what is the adjacent value.\n\nThis is perhaps a bit verbose and clunky, but it meets the above specification:\n\n```supercollider\n(\n~repeats = {|array|\n // return [index, number of repeats, the value] for each repeated value\n var results = [];\n var thisIndex = 0;\n var thisCount = 1;\n var thisValue = array[0];\n array[1..].do{|val, i|\n if(val == thisValue,\n {thisCount = thisCount + 1},\n {\n if(\n thisCount > 1,\n {results = results.add([thisIndex, thisCount, thisValue])},\n );\n thisValue = val;\n thisIndex = i + 1;\n thisCount = 1;\n }\n )\n };\n if(thisCount > 1, {results = results.add([thisIndex, thisCount, thisValue])});\n results;\n}\n);\n\na = [1, 2, 1, 1, 1, 2, 1, 1];\nb = ~repeats.value(a);\n\na = [2, 3, 5, 5];\nb = ~repeats.value(a);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes THX Deep Note inspired synth sketch."}, {"role": "assistant", "content": "```supercollider\n// A. Broz: Deep Choir (v2, 2020-10-29)\n(\n~numVoices = 30;\n\n~chaos = { |range = 1.0|\n ~numVoices collect: { exprand(180 / range, 260 * range) }\n};\n\n~bigChord = { |fund = 30, harmonics = 5|\n ~numVoices collect: {\n fund\n * rrand(1, harmonics) // build chord\n * rrand(1, 2) * rrand(1, 2) // octaves\n + rrand(-1.2, 1.2) // beats\n }\n};\n\n// Try with Pmono\nSynthDef(\\fakeTHX, {\n var env = EnvGen.kr(\n envelope: Env.adsr(15, \\decay.kr(10), 1, 10, curve: \\sine),\n gate: \\gate.kr(1),\n doneAction: Done.freeSelf,\n );\n var chord = \\freq.kr(~chaos.value, \\lag.kr(10));\n var meander = \\meander.kr(0.3, 8);\n var sig = chord collect: { |f|\n f = f * LFNoise2.kr(rrand(0.3, 0.8)).exprange(1 - meander, 1 + meander);\n BLowPass.ar(Saw.ar(f), f, 0.6);\n };\n sig = Splay.ar(sig, 0.8) * env * \\mul.kr(0.5, 3);\n Out.ar(0, sig);\n}).add;\n);\n\n(\nRoutine({\n var fakeTHX = Synth(\\fakeTHX);\n\n 10.wait;\n\n fakeTHX.set(\\meander, 0);\n\n fakeTHX.set(\\freq, ~bigChord.(30, 5));\n\n 10.wait;\n\n fakeTHX.set(\\gate, 0);\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for simple melody algorithmically generated with a Markov Chain."}, {"role": "assistant", "content": "```supercollider\n/* Markov Chain Experiment II\n Jacob Joaquin\n\n Get a visual representation of the Markov Chain here:\n http://codehop.com/supercollider-markov-chain/\n*/\n\n(\n// Synthesizer\nSynthDef(\\my_synth, {|dur = 1.0, amp = 1.0, freq = 440|\n var env = EnvGen.ar(Env.new([1, 0.1, 0], [0.06, dur - 0.06]), doneAction: 2);\n Out.ar([0, 1], SinOsc.ar([freq * 0.995, freq * 1.005], 0, env * amp))\n}).add; \n\n// Create task\nt = Task({\n // Set attributes of each node\n // [freq, dur, [[next_state, weighted_random],…]]\n var node_list = [\n [60, 1, [[1, 2]]],\n [62, 0.5, [[0, 1], [2, 1]]],\n [63, 1, [[0, 1], [3, 1]]],\n [65, 0.5, [[0, 1], [3, 4], [4, 1]]],\n [67, 1, [[5, 1]]],\n [70, 1.5, [[4, 1], [6, 2]]],\n [69, 1, [[4, 1], [7, 2]]],\n [72, 0.5, [[4, 1], [7, 4], [0, 2]]]\n ];\n\n var node_index = 0;\n var bps = 133.0 / 60.0; // Beats per second\n \n inf.do({\n var weight = 0;\n var random;\n var accumulator;\n var node = node_list[node_index]; \n var freq = node[0].midicps;\n var dur = node[1] / bps;\n var paths = node[2];\n \n // Get total statistical weight of connected nodes\n (0 .. paths.size - 1).do {|i| weight = weight + paths[i][1]};\n \n // Generate random value for choosing next node\n random = weight.rand;\n\n // Choose next node based on statistical weights\n accumulator = paths[0][1];\n \n node_index = block {|break|\n paths.size.do {|i|\n if ((random < accumulator), {\n break.value(paths[i][0])\n }, {\n accumulator = accumulator + paths[i + 1][1] \n })\n }\n };\n \n // Play\n Synth(\\my_synth, [\\dur, dur, \\amp, -3.dbamp, \\freq, freq]); \n dur.wait;\n })\n});\n\nt.start;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pwrap`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Pn(\n Pwrap(\n Pgeom(200, 1.07, 96),\n 200,\n 1000.0\n ),\n inf\n);\nx = a.asStream;\n\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, x.next.debug, \\dur, 0.3]);\n 0.12.wait;\n })\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `AbstractResponderFunc.permanent` do? What arguments does it take?"}, {"role": "assistant", "content": "Get or set whether this responder func is persists when the user executes Cmd-. If false this will be disabled and removed from the global lists. The default is Arguments: bool — A Boolean indicating if this object is permanent.. Returns: The getter returns a Boolean."}]} -{"conversations": [{"role": "user", "content": "What is a bus, in one sentence?"}, {"role": "assistant", "content": "A numbered channel on the server that nodes write signal into and read signal out of, which is how sounds are chained without cables."}, {"role": "user", "content": "Show me using one for an effect."}, {"role": "assistant", "content": "Write the source to a private bus, read it in the effect, send the effect to the master:\n\n```supercollider\n(\n~bus = Bus.audio(s, 1);\nSynthDef(\\src, { |out = 0| Out.ar(out, Saw.ar(110) * 0.1) }).add;\nSynthDef(\\fx, { |in = 0| Out.ar(0, RLPF.ar(In.ar(in, 1), 1200, 0.3)) }).add;\n);\nSynth(\\fx, [\\in, ~bus]);\nSynth(\\src, [\\out, ~bus]);\n```\n\nOrder matters: the effect exists before the source, so the source's output has a listener."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nNdef(\\birdy, {arg freq=1500, amp=0.5, rate=10;\n var osc, son, convIn, rand;\n osc=LFCub;\n rand = LFNoise1.ar(rate);\n convIn=LinCongN.ar(rate);\n son = osc.ar(Convolution.ar(convIn,convIn));\n freq = Latch.kr(rand.range(0,1).round(0.1), rand) * freq;\n freq = osc.ar(osc.ar(rand)*rand.range(0,10)).range(freq, freq*3);\n son = Formlet.ar(son, freq, convIn.abs*0.1, rand.abs);\n son = Normalizer.ar(son, 0.9, 0.1) * convIn.abs * LFPulse.kr(LFPulse.kr(rand.abs), 0, rand.abs);\n son = son + GVerb.ar(son, 99, 2, mul: rand.range(0,0.3));\n son * amp\n}).play\n)\n```"}, {"role": "assistant", "content": "I just rewrote one of autocsi's tweets and came out with this which sounds like a digital bird of some kind:."}]} -{"conversations": [{"role": "user", "content": "I get 'index out of range' when playing a buffer."}, {"role": "assistant", "content": "A read position is past the end of the buffer. `PlayBuf` with a `startPos` in frames beyond `~buf.numFrames`, or a `BufRd`/`GrainBuf` whose phase goes above 1, produces this. For GrainBuf, pos is normalised 0..1, so pass `LFNoise1.kr(1).range(0, 1)` rather than a frame count; for PlayBuf, cap the position at `~buf.numFrames - 1`. If you just loaded the file, check `~buf.numFrames` — a failed read gives 0 frames and every position is out of range."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// you have to write the sample path in the firts line\n\n~bufferdue = Buffer.read(s,\" WRITE YOUR SAMPLE PATH HERE \", bufnum:2);\n\n(\nSynthDef.new(\\bufbeat, {\n arg amp = 1, out = 0, buf, start, end, freq = 1;\n var sig, ptr;\n ptr = LFNoise1.ar(freq).range(0.0,end);\n sig = BufRd.ar(2, buf, ptr);\n sig = sig * amp;\n Out.ar(out, sig);\n}).add\n);\n\nx = Synth.new(\\bufbeat, [\\buf, ~bufferdue.bufnum, \\start,0, \\end, ~bufferdue.numFrames-1, \\freq, 1, \\amp, 0.5],g);\n\nx.free;\n```"}, {"role": "assistant", "content": "a simple BufRd with the starting point of lecture randomized by LFNoise1."}]} -{"conversations": [{"role": "user", "content": "What is `KeyCodeResponderStack` in SuperCollider?"}, {"role": "assistant", "content": "KeyCodeResponderStack — internal Category: Libraries > crucial > internals."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Random arpeggio by default (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\n Pbind(\n \\instrument, \\default,\n \\degree, Pwalk(#[c, e, g, c],1, Prand([-1,1],inf).stutter(Pwhite(1,10))) +\n Pseq([Pn(0,64),\n Prand([\n 0,\n [0,2,3],\n ],inf)\n ]),\n \\root, Pwhite(0,-8).stutter(32),\n \\mtranspose, Pwhite(-8,8).stutter(8),\n \\dur, 1/8,\n \\isRest, Pwrand([0,1], [0.1,1],inf).coin.not,\n \\legato, Pwhite(0.1,1.2),\n \\amp, 0.1\n ).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code:\n```supercollider\n{ SinOsc.ar(440) * EnvGen.kr(Env.perc(0.01, 1), doneAction: 2) }.play;\n```"}, {"role": "assistant", "content": "It plays a 440 Hz sine with a percussive envelope, and the Synth frees itself when the envelope\nends.\n\n- `SinOsc.ar(440)` is an audio-rate sine at 440 Hz.\n- `Env.perc(0.01, 1)` is a 10 ms attack to full level then a 1 s decay to zero.\n- `EnvGen.kr(...)` plays that envelope at control rate and multiplies the sine, so the sound fades out.\n- `doneAction: 2` frees the Synth at the end of the envelope, so it does not accumulate silent nodes.\n- `.play` on the function builds an anonymous SynthDef and starts one Synth of it."}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n~pad = Synth(\\pad, [\\freq, 165]);\n~pad.set(\\gate, 0);\n```"}, {"role": "assistant", "content": "It starts a sustained synth and then releases it.\n\n`Synth(\\pad, [\\freq, 165])` creates an instance of a SynthDef that takes a `gate` argument (default 1). The\narray after the name is alternating argument names and values: `\\freq, 165`. Setting `\\gate` to 0 does not\ncut the sound dead — the EnvGen inside sees the gate close and runs the release stage of its Env, then frees\nthe Synth because that EnvGen has `doneAction: 2`. This is the standard lifecycle for pads, drones and any\nsound you want to stop gracefully."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Stethoscope`."}, {"role": "assistant", "content": "```supercollider\ns.boot\n{ SinOsc.ar([330, 440], 0, 0.4) }.play;\nStethoscope(s, 2);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `TreeViewItem.setString` do? What arguments does it take?"}, {"role": "assistant", "content": "Sets the text in the given data Arguments: column — An integer index of a data field.; string — A String or nil.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a, b;\na = Pgbrown(0.0, 1.0, 0.2, inf);\nb = a.asStream;\n7.do({ b.next.postln });\n);\n\n\n// sound example\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\nvar a;\na = Pgbrown(1.0, 2.0, 0.1, inf).asStream;\nRoutine({\n loop({\n Synth(\\help\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a, b;\na = Pgbrown(0.0, 1.0, 0.2, inf);\nb = a.asStream;\n7.do({ b.next.postln });\n);\n\n\n// sound example\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\nvar a;\na = Pgbrown(1.0, 2.0, 0.1, inf).asStream;\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, a.next * 600 + 300]);\n 0.02.wait;\n })\n}).play;\n);\n\n// compare with normal brownian motion:\n\n(\nvar a;\na = Pbrown(1.0, 2.0, 0.1, inf).asStream;\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, a.next * 600 + 300]);\n 0.02.wait;\n })\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Play your (short) soundfiles with some delay."}, {"role": "assistant", "content": "```supercollider\n// By Bjørn Houdorf March 2013, Play your (short) soundfiles with some delay.\n\nb = SoundFile.collectIntoBuffers(\"yourSoundFileFolder/*\"); // 1. rund this\n\n( // 2. and then run this\nt = Task({\n({\n var num= b.size.rand;\n var buf= b[num];\n 0.1*Splay.ar(PlayBuf.ar(buf.numChannels, buf, 1, 1, 0, 0));\n}.play;\n) \n});\n);\n\n\n( // 3. Then run this\nz = Task({\nloop({\n t.start;\n 0.1.wait;\n});\n});\n);\n\n\nz.start; // 4. and run this\nz.stop; // 5. and finally run this\n```"}]} -{"conversations": [{"role": "user", "content": "What does `GUI.set` do? What arguments does it take?"}, {"role": "assistant", "content": "Changes the current Arguments: aScheme — An instance of Symbol. The scheme to use as current scheme.."}]} -{"conversations": [{"role": "user", "content": "What is `AnalogIn` in SuperCollider?"}, {"role": "assistant", "content": "AnalogIn — Read data from an analog input Read a DC-coupled analog input connected to a sensor (e.g.: a potentiometer or CV in). Category: UGens > Bela."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `TempoBusClock`."}, {"role": "assistant", "content": "```supercollider\n(\na = { |tempo = 1| Ringz.ar(Impulse.ar(tempo), [501, 500], 1/tempo) }.play;\nt = TempoBusClock(a);\nTask { loop { \"klink\".postln; 1.wait } }.play(t);\n);\n\nt.tempo = 1.3;\nt.tempo = 0.5;\nt.tempo = 1.0;\n\n\n// in ProxySpace, a TempoBusClock can be added together with a ~tempo NodeProxy:\n\np = ProxySpace.push(s);\np.makeTempoClock;\np.clock; // now the ProxySpace's clock is a TempoBusClock\n\n~out.play;\n~out = { Ringz.ar(Impulse.ar(~tempo.kr), [501, 500], 1/~tempo.kr) * 0.3 };\np.clock.tempo = 1.3;\n\n// patterns and tasks are synchronized:\n\n~out2.play;\n~out2 = Pbind(\\dur, 1, \\note, Pwhite(0, 7, inf));\n\np.clock.tempo = 3;\np.clock.tempo = 1;\n```"}]} -{"conversations": [{"role": "user", "content": "What is `BLowPass`?"}, {"role": "assistant", "content": "BLowPass — 12db/oct rolloff - 2nd order resonant Low Pass Filter"}, {"role": "user", "content": "What does `BLowPass.sc` do?"}, {"role": "assistant", "content": "calculate filter coefficients."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n(\nz = {\n BLowPass.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(10, 20000, \\exponential), // cutoff freq.\n MouseY.kr(0.0, 1.0, \\linear), // rq\n 0.5); // mul\n}.play\n);\nz.release;\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Environment`."}, {"role": "assistant", "content": "```supercollider\n(\na = Environment.make({\n ~a = 100;\n ~b = 200;\n ~c = 300;\n});\na.postln;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DelayN`."}, {"role": "assistant", "content": "```supercollider\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nDelayN.ar(z, 0.2, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\n(\n// recursive application of delay.\n{\nz = Decay2.ar(Dust.ar(1, 0.5), 0.01, 0.1, Saw.ar(100 + [0, 1]));\n5.do { |i| z = DelayN.ar(RLPF.ar(z, Rand(100, 3000), 0.03), 1, 1 / (2**i), 1, z * 0.5) };\nz\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Midterm Q3 (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"bell\", {arg freq, amp;\n\n\n var env, snd, partials, relativeAmps;\n\n partials = [0.5, 1, 1.19, 1.56, 2, 2.51, 2.66, 3.01, 4.1];\n relativeAmps = [0.25, 1, 0.8, 0.5, 0.9, 0.4, 0.3, 0.6, 0.1];\n\n env = Env.perc(\n attackTime: 0.01,\n releaseTime: 5,\n level: amp*relativeAmps).kr(doneAction:2);\n\n snd = SinOsc.ar(\n freq: freq*partials,\n mul: env\n );\n\n snd = Mix.ar(snd);\n\n Out.ar(0, snd * 0.1 ! 2);\n\n}).add;\n);\n\n\n//Test your \"bell\" SynthDef with the following Pbind:\n\n\n(\nPbind(\n \\instrument, \"bell\",\n \\degree, Pwhite(-5, 10),\n \\dur, Pwhite(3, 6),\n \\amp, Pwhite(0.1, 0.5)\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `MxOutletApp` in SuperCollider briefly."}, {"role": "assistant", "content": "MxOutletApp — scripting object for a units outlet An outlet may connect to multiple inlets. On the gui you can shift drag from an outlet to an inlet. If you dont hold down shift then any previous cables are deleted. Category: Mx."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// default initial params\n{ FBSineC.ar(SampleRate.ir/4) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// default initial params\n{ FBSineC.ar(SampleRate.ir/4) * 0.2 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// python preprocessor, given that you have python installed\n// thanks to tasos tsesmetzis\n\n(\nthis.preProcessor = PreProcessor.new.startDelimiter_(\"{-\").endDelimiter_(\"-}\");\n\n// a simple python call\ne = (\n lang: \\python,\n languages:\n (\n python: // code is the incoming string, event is the event for parameters and output\n {|code, event|\n var input, pipe, output;\n code = e[\\prefix] ++ \"print\" ++ \"(\" ++ code ++ \")\";\n input = \"python -c '%'\".format(code);\n pipe = Pipe(input, \"r\");\n output = pipe.readUpTo;\n pipe.close;\n event.put(\\result, output)\n }\n ),\n prefix: \"import math;\"\n);\n);\n\n// ok, assuming such a little interpreter exists for a given language,\n// one can now use it in code.\n\n(\ne =\n{-\n math.factorial(61)\n-}.value(e);\ne.result;\n);\n\ne.calc_result = e.result.as(Array).collect { |x| x.asString.interpret };\n\nPbind(\\note, Pseq(e.calc_result), \\dur, 0.1).play;\n```"}, {"role": "assistant", "content": "python preprocessor, given that you have python installed thanks to tasos tsesmetzis."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\nb = Buffer.read(s, ExampleFiles.child);\n\n\n(\nSynthDef(\"help-magFreeze\", { |out = 0|\n var in, chain;\n in = SinOsc.ar(LFNoise1.kr(5.2, 250, 400));\n chain = FFT(LocalBuf(2048), in);\n // moves in and out of freeze\n chain = PV_MagFreeze(chain, SinOsc.kr(0.2));\n Out.ar(out, 0.1 * IFFT(chain).dup);\n}).play(s);\n\n);\n\n(\n// trig with MouseY\nSynthDef(\"help-magFreeze2\", { |out = 0, soundBufnum = 2|\n var in, chain;\n in = PlayBu\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\nb = Buffer.read(s, ExampleFiles.child);\n\n\n(\nSynthDef(\"help-magFreeze\", { |out = 0|\n var in, chain;\n in = SinOsc.ar(LFNoise1.kr(5.2, 250, 400));\n chain = FFT(LocalBuf(2048), in);\n // moves in and out of freeze\n chain = PV_MagFreeze(chain, SinOsc.kr(0.2));\n Out.ar(out, 0.1 * IFFT(chain).dup);\n}).play(s);\n\n);\n\n(\n// trig with MouseY\nSynthDef(\"help-magFreeze2\", { |out = 0, soundBufnum = 2|\n var in, chain;\n in = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);\n chain = FFT(LocalBuf(2048), in);\n chain = PV_MagFreeze(chain, MouseY.kr > 0.5);\n Out.ar(out, 0.1 * IFFT(chain).dup);\n}).play(s, [\\soundBufnum, b]);\n);\n\nb.free\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Abusing Convolution2 to make pitch."}, {"role": "assistant", "content": "```supercollider\n// fixed (unchanging) impulse response\n// cmd-. to stop\n\n(\ns.waitForBoot {\n var c = Condition.new, cleanfunc = { CmdPeriod.remove(cleanfunc); b.free };\n fork {\n b = Buffer.alloc(s, 2048, 1);\n CmdPeriod.add(cleanfunc);\n s.sync;\n a = {\n RecordBuf.ar(BrownNoise.ar * EnvGen.ar(Env(#[0, 1, 0], #[0.5, 0.5], \\sin), timeScale: b.duration, doneAction: 2), b, loop: 0);\n 0\n }.play;\n OSCpathResponder(s.addr, ['/n_end', a.nodeID], { |time, resp, msg|\n resp.remove;\n c.unhang;\n }).add;\n c.hang;\n a = {\n var freq = MouseX.kr(150, 450, warp: 1, lag: 0.1);\n LeakDC.ar(Convolution2.ar(Impulse.ar(freq), b, framesize: b.numFrames) * -35.dbamp) ! 2;\n }.play;\n };\n};\n);\n\n\n\n// multiple impulse responses for timbre control\n(\ns.waitForBoot {\n var c = Condition.new, cleanfunc = { CmdPeriod.remove(cleanfunc); b.free };\n fork {\n b = Buffer.allocConsecutive(3, s, 2048, 1);\n CmdPeriod.add(cleanfunc);\n s.sync;\n a = {\n var sig = [BrownNoise.ar, PinkNoise.ar, WhiteNoise.ar];\n sig.do { |chan, i|\n RecordBuf.ar(chan * EnvGen.ar(Env(#[0, 1, 0], #[0.5, 0.5], \\sin), timeScale: b[i].duration, doneAction: 2), b[i], loop: 0);\n 0\n };\n }.play;\n OSCpathResponder(s.addr, ['/n_end', a.nodeID], { |time, resp, msg|\n resp.remove;\n c.unhang;\n }).add;\n c.hang;\n a = {\n var freq = MouseX.kr(150, 450, warp: 1, lag: 0.1),\n index = MouseY.kr(0, 1.99, lag: 0.1),\n iWhole = index.trunc(2),\n iFrac = index - iWhole,\n iAdjust = iFrac >= 1.0,\n trig = Impulse.ar(freq),\n convolvers = b.collect { |buf, i|\n LeakDC.ar(Convolution2.ar(trig, buf, framesize: buf.numFrames))\n };\n (\n XFade2.ar(\n Select.ar(iWhole + (2 * iAdjust), convolvers),\n Select.ar(iWhole + 1, convolvers),\n iFrac.fold(0, 1) * 2 - 1\n ) * -30.dbamp\n ) ! 2;\n }.play;\n };\n};\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a granular texture in SuperCollider."}, {"role": "assistant", "content": "Read a sound file into a buffer, then trigger grains from it. Grain density is the Impulse rate and\ngrain length is dur; keep the density times the length under maxGrains or raise it.\n\n```supercollider\n(\ns.waitForBoot {\n ~buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n SynthDef(\\grain, { |out = 0, amp = 0.4, density = 30, dur = 0.08|\n var trig = Impulse.kr(density);\n var sig = GrainBuf.ar(2, trig, dur, ~buf, 1, LFNoise0.kr(2).range(0, 1), 2, 0, -1, 512);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n Synth(\\grain);\n};\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `FFTSubbandPower.kr` do? What arguments does it take?"}, {"role": "assistant", "content": "Spectral power, divided into subbands Arguments: chain; cutfreqs — must be an array of frequencies. For example, to divide a 44100Hz signal into three subbands we might specify [ 5512, 11025 ] as the cutfreqs, giving subbands of 0-5512Hz, 5512-11025Hz, and 11025-22050Hz. (Frequencies above the Nyquist frequency are not included.); square — performs the same role as in FFTPower.; scalemode — specifies how the band powers are scaled: Mode 1 (default) is to scale the same way as FFTPower does (according to the total number of bins in the FFT). This means that if you add up the power from the various bins, you'll get the same result as if you'd just used FFTPower. This gives the best impre. Returns: #[power1, power2, ... powerN+1]"}]} -{"conversations": [{"role": "user", "content": "What does `LinearSpline.new` do? What arguments does it take?"}, {"role": "assistant", "content": "A simple linearly interpolated spline passing through a series of points. Arguments: points — An array of points supplied as either Point objects or simple arrays. Points may have unlimited dimensions, though all points in a spline need to have the same number of dimensions.; isClosed [boolean] — If the spline's last point loops around to its first point.."}]} -{"conversations": [{"role": "user", "content": "What are the arguments of Pan2?"}, {"role": "assistant", "content": "`Pan2.ar(in, pos, level)` — in is the mono signal, pos is -1 (left) to 1 (right) with 0 in the middle, and level scales the output. It is equal-power, so a centred signal is -3 dB per channel rather than half amplitude. `Pan2.ar(sig, SinOsc.kr(0.1))` is the simplest autopan."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Digital Bird sounds."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\birdy, {arg freq=1500, amp=0.5, rate=10;\n var osc, son, convIn, rand;\n osc=LFCub;\n rand = LFNoise1.ar(rate);\n convIn=LinCongN.ar(rate);\n son = osc.ar(Convolution.ar(convIn,convIn));\n freq = Latch.kr(rand.range(0,1).round(0.1), rand) * freq;\n freq = osc.ar(osc.ar(rand)*rand.range(0,10)).range(freq, freq*3);\n son = Formlet.ar(son, freq, convIn.abs*0.1, rand.abs);\n son = Normalizer.ar(son, 0.9, 0.1) * convIn.abs * LFPulse.kr(LFPulse.kr(rand.abs), 0, rand.abs);\n son = son + GVerb.ar(son, 99, 2, mul: rand.range(0,0.3));\n son * amp\n}).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `StreamSpec.constrain` do? What arguments does it take?"}, {"role": "assistant", "content": "datatype specifying that the input or output is stream or pattern Arguments: value."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Simple relaxing white noise generator simulating a seaside."}, {"role": "assistant", "content": "```supercollider\n// A.Broz: Waves & Surf (2020-10-29)\n\n/*\n _.====.._\n ,:._ ~-_\n `\\ ~-_\n | `.\n ,/ ~-_\n -..__..-'' ~~--..__...----...\n*/\n(\n~waves = {\n var noise = { WhiteNoise.ar(0.04 + LFNoise1.kr(0.3, 0.03)) };\n var motion = { LFNoise1.kr(0.2).exprange(100, 2000) };\n var hps = { HPF.ar(noise.value, 50) };\n var wave = { LPF.ar(hps.value, motion.value).tanh };\n var sig = wave!10;\n sig = Splay.ar(sig, 0.6).tanh;\n sig = sig * Line.kr(0, 1, 10); // fade in\n LeakDC.ar(sig);\n}.play;\n);\n\n~waves release: 10;\n```"}]} -{"conversations": [{"role": "user", "content": "What is `InstrSpawner` in SuperCollider?"}, {"role": "assistant", "content": "InstrSpawner — a Pbind-like spawner that plays an Instr with streams supplied to its inputs a Pbind-like spawner that plays an Instr with streams supplied to its inputs. Category: Libraries > crucial > Instr, Libraries > crucial > Players."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// 2012.05.04\n// Work for NX014 Class\n// Inspiration: A Rukano Tweet. Thanks rukano!\n// Comment: Cosmic Organ.\n\np = ProxySpace.push(s.boot);\n\n~a.play;\n\n~a = { var alpha,gamma;\n alpha= LFNoise2;\n gamma= {[rrand(30,50),rrand(50,70),rrand(50,70),rrand(70,100)].choose.midicps*alpha.kr(1,0.01,1)}!24;\n Pan2.ar(LeakDC.ar(Normalizer.ar(\n BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(FreeVerb.ar(\n Splay.ar(RLPF.ar(LFSaw.ar(gamma)/4,gamma*LFCub.kr(rrand(0.01,0.1),0,2,3),alpha.kr(1/8,0.6,0.7))) \n ,0.1,0.1,0.1)\n ,100,6.0,6),1000,6.0,0),5000,6.0,0),10000,6.0,6)\n ,(0.8/0.999)*1,0.1)),0)\n};\n\n~a = nil;\n```"}, {"role": "assistant", "content": "A cosmic organ with a inspiration of rukano tweet. Thanks rukano!."}]} -{"conversations": [{"role": "user", "content": "What does `UScore.playState` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: newState — (describe argument here); changed — (describe argument here). Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n// Simple amplitude tracker sending values to sclang\nSynthDef(\\ampTracker, { |in|\n var freq = 30; // num of values per second\n SendReply.kr(Impulse.kr(freq), '/amp', Amplitude.kr(SoundIn.ar(in)));\n}).add;\n);\n\n// start the tracker on scsynth\nSynth(\\ampTracker);\n\n(\n// receive the values in sclang\nOSCdef(\\ampTracker, { |m|\n m.postln;\n // now use m[3] for your purpose (detecting changes, etc...)\n}, '/amp');\n)\n```"}, {"role": "assistant", "content": "It's jsut an amplitude tracker, to exaplin how to send values from scsynth to sclang."}]} -{"conversations": [{"role": "user", "content": "What does `RedFingerprint.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a new fingerprint object and do the translation ( #-calc Arguments: array — Numerical data to be plotted.; normalize — Boolean.."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Hymn #15 - generative melody by array rewriting?"}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\ping, {\n arg freq = 440, pan = 0;\n var sig;\n sig = SinOsc.ar(freq, 0, 0.3);\n sig = sig * EnvGen.ar(Env.perc(0.01, 1), doneAction:2);\n sig = Pan2.ar(sig, pan);\n Out.ar(0, sig)\n}).add;\n);\n\n(\n~scramb = {|pan|\nvar notes = [0,4,7,14,9,12,4,7,9,7];\nvar dur = [1,1,2,3,6,3,4,5,2,1,13];\nvar transp = [0, 5, 7, 3, 2];\nvar scrambRand = {|array|\n var rand = rrand(0, array.size-3);\n var end = rand + rrand(1,2);\n var range = (rand..end);\n var reverseRange = range.reverse;\n var temp = array.copy;\n range.postln;\n range.do({|item, index|\n array[item] = temp[reverseRange[index]];\n });\n array;\n};\nvar octRand = {|array|\n var rand = rrand(0, array.size-1);\n array[rand] = array[rand] + [-12,0,12].choose;\n };\nvar task = Task {\n var step = 0;\n var transpStep = 0;\n loop {\n var freq = (notes.wrapAt(step) + 60 + transp.wrapAt(transpStep)).midicps;\n Synth(\\ping, [\\freq, freq, \\pan, pan]);\n (dur.wrapAt(step) * 0.15).wait;\n step = step + 1 % (notes.size * 12;);\n if (step%32 == 0, {scrambRand.value(notes)});\n if (step%20 == 0, {scrambRand.value(dur)});\n if (step%66 == 0, {transpStep = transpStep + 1 % (transp.size)});\n if (step%24 == 0, {notes = notes.rotate(rrand(-1, 1))});\n if (step%56 ==0, {octRand.value(notes)});\n }\n}.play;\n};\n);\n\n(\n~scramb.value(-0.7);~scramb.value(0.7);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `AbsApp.new` do? What arguments does it take?"}, {"role": "assistant", "content": "These objects are created by accessing them from the Mx. You do not create them manually. `x = Mx.new.app; // Arguments: model; mxapp."}]} -{"conversations": [{"role": "user", "content": "What is `UScoreEditor` in SuperCollider?"}, {"role": "assistant", "content": "UScoreEditor — (put short description here) (put long description here) Category: UnitLib."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for reflection on seasonal change )."}, {"role": "assistant", "content": "```supercollider\n(\n{ \n LPF.ar(\n DynKlank.ar(\n `[[900, 971, 1153, 1823, 1401], nil, [\n SinOsc.kr(0.2).range(0.1,1), \n SinOsc.kr(0.6).range(0.1,1), \n SinOsc.kr(0.8).range(0.1,1), \n SinOsc.kr(1.2).range(0.1,1), \n SinOsc.kr(2).range(0.1,1)]\n ], \n Limiter.ar(Dust.ar(2, 0.65) + Impulse.ar(1,0,0.9))\n )\n ) ! 2 \n}.play;\n{ \n Pan2.ar(\n DynKlank.ar(`[[800, 1071, 1353, 723 + SinOsc.ar(SinOsc.ar(0.2).range(0, 10)).range(0,330)], nil, [1, 1, 0.5, 1]], PinkNoise.ar(0.007)),\n TRand.kr(-1, 1, trig: Pulse.ar(10))\n )\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\np = SFPlayer.new; //shows open file dialog\n\n//specify the file\np = SFPlayer.new(Platform.resourceDir +/+ \"sounds/a11wlk01.wav\";\np.play;\np.stop;\np.gui;\n\n// shows open file dialog and opens the gui\np = SFPlayer.new.gui;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\np = SFPlayer.new; //shows open file dialog\n\n//specify the file\np = SFPlayer.new(Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\np.play;\np.stop;\np.gui;\n\n// shows open file dialog and opens the gui\np = SFPlayer.new.gui;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LinLin`."}, {"role": "assistant", "content": "```supercollider\n// examples:\n\n(\n{\n var mod = SinOsc.kr(Line.kr(1, 10, 10));\n SinOsc.ar(LinLin.kr(mod, -1, 1, 100, 900)) * 0.1\n}.play;\n);\n\n// modulating destination values.\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(LinLin.ar(mod, -1, 1, MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1))) * 0.1\n}.play;\n);\n\n// modulating source and destination values.\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(\n LinLin.ar(mod,\n SinOsc.kr(0.2), SinOsc.kr(0.2543),\n MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1)\n )\n ) * 0.1\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\na = Psubdivide(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,0,1,3,4,0], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n100.do({ x.next.postln });\n);\n\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Psubdivide(\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\na = Psubdivide(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,0,1,3,4,0], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n100.do({ x.next.postln });\n);\n\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Psubdivide(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n);\n\n\n(\na = Psubdivide(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,4,4,0,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Build a slowly evolving drone with Ndef."}, {"role": "assistant", "content": "Ndef gives you a named patch you can redefine while it plays; the filter is a separate node in the\nchain so you can change it on its own.\n\n```supercollider\n(\nNdef(\\drone, { |freq = 55, amp = 0.12|\n var detune = [0, 0.07, -0.11];\n var sig = Mix(Saw.ar(freq * (1 + detune))) * amp;\n LPF.ar(sig, 400);\n}).play;\n\nNdef(\\drone)[1] = \\filter -> { |in| RLPF.ar(in, LFNoise1.kr(0.1).exprange(200, 1800), 0.3) };\n)\n```\n\nRedefining Ndef(\\drone, { ... }) later crossfades to the new definition; Ndef(\\drone).stop stops it."}]} -{"conversations": [{"role": "user", "content": "What does `SimpleTrigger.instrArgFromControl` do? What arguments does it take?"}, {"role": "assistant", "content": "a player that emits a trigger on button push or .trig Arguments: control."}]} -{"conversations": [{"role": "user", "content": "What is rq in BPF.ar?"}, {"role": "assistant", "content": "rq is the reciprocal of Q, so it is a bandwidth control, not a Q control. Small rq means a narrow, resonant band; large rq means a wide, gentle one. The signature is `BPF.ar(in, freq, rq, mul, add)`. A common idiom is `rq = 0.3` for a broad sweep and `rq = 0.02` for a whistle. The same rq convention applies to RLPF and RHPF."}]} -{"conversations": [{"role": "user", "content": "I made a synth and I hear nothing. Where do I start?"}, {"role": "assistant", "content": "Start with the node tree, not the code: evaluate `s.plotTree`. If your Synth is not there, it never started or it already freed itself; if it is there, the problem is in the signal. Which of the two do you see?"}, {"role": "user", "content": "It's in the tree."}, {"role": "assistant", "content": "Then the node lives and the signal is being lost. Check three things in order: does the SynthDef reach `Out.ar(0, ...)` with bus 0; is any `amp`/`mul` zero; and is a filter closed, e.g. `LPF.ar(sig, 50)` on a 440 Hz sine. Paste the SynthDef and I will read it."}, {"role": "user", "content": "SynthDef(\\x, { |out = 0| Out.ar(out, LPF.ar(Saw.ar(60), 80) * 0.1) }).add; Synth(\\x, [\\out, 2]);"}, {"role": "assistant", "content": "Two things. You wrote a low-pass at 80 Hz over a 60 Hz saw, which leaves almost nothing above the fundamental — the patch is nearly a sine at 60 Hz at very low level. And you passed `\\out, 2`, so it is going to bus 2, not the master. Try `Synth(\\x)` with the default out and a cutoff of 800:\n\n```supercollider\nSynthDef(\\x, { |out = 0, cutoff = 800| Out.ar(out, LPF.ar(Saw.ar(60), cutoff) * 0.1) }).add;\nSynth(\\x);\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\ns.boot // Boot the server, if you need to\n\n// read a whole sound into memory\n\n// ExampleFiles helps locate audio files used in examples\np = ExampleFiles.child;\n// peek at the path to see location and the format of a path\np.postln;\n// read the file into a buffer\nb = Buffer.read(s, p); // remember to free the buffer later.\n\nSynthDef(\\help_PlayBuf, { |out = 0, bufnum = 0|\n Out.ar(out,\n PlayBuf.ar(1, bufnum, BufRateScale.kr(bufnum), doneAction: Done.freeSelf)\n )\n}).play(s, [\\out, 0, \\bufnum, b]);\n```"}, {"role": "assistant", "content": "read a whole sound into memory ExampleFiles helps locate audio files used in examples (PlayBuf: Sample playback oscillator.)"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ProxySpace`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\np = ProxySpace.new;\np.fadeTime = 2; // fadeTime specifies crossfade\np[\\out].play; // monitor an empty placeholder through hardware output\n// set its source\np[\\out] = { SinOsc.ar([350, 351.3], 0, 0.2) };\np[\\out] = { Pulse.ar([350, 351.3] / 4, 0.4) * 0.2 };\np[\\out] = Pbind(\\dur, 0.03, \\freq, Pbrown(0, 1, 0.1, inf).linexp(0, 1, 200, 350));\n\n// route one proxy through another:\np[\\out] = { Ringz.ar(p[\\in].ar, [350, 351.3] * 8, 0.2) * 4 };\np[\\in] = { Impulse.ar([5, 7]/2, [0, 0.5]) };\n\np.clear(3); // clear after 3 seconds\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes No Quarter pluck synth bass sound."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\bass, { |outbus, midinote = 42|\n var freq = midinote.midicps;\n var subfreq = freq / 2;\n \n // Envelopes\n var subenv = EnvGen.kr(Env.perc(0, 1), doneAction:2);\n var env = EnvGen.kr(Env.perc(0, 0.5));\n \n // Component synthesis\n var pluck = Pluck.ar(PinkNoise.ar, 1, 0.2, subfreq.reciprocal) * subenv * 2;\n var tri = VarSaw.ar(freq) * env;\n var sin = SinOsc.ar(freq) * env;\n var sub = (SinOsc.ar([subfreq, subfreq - 2, subfreq + 2]).sum * subenv).tanh;\n var click = RLPF.ar(Impulse.ar(0), [2000, 8000], 1).sum * 1000;\n \n // Initial signal\n var sig = pluck + tri + sub + click;\n \n // Resonant LPFs\n sig = RLPF.ar(sig, XLine.ar(freq * 100, freq * 10, 0.15));\n sig = sig + (MoogFF.ar(sig, freq * 20, 2.5) * 0.1);\n \n // EQ resulting signal\n sig = BPeakEQ.ar(sig, 400, 0.5, -9);\n sig = BPeakEQ.ar(sig, 2000, 0.5, 6);\n sig = BHiShelf.ar(sig, 8000, 1, 3);\n sig = BPeakEQ.ar(sig, 200, 1, 3);\n \n // Apply another envelope to dampen a bit more\n sig = sig * XLine.kr(1, 0.6, 0.1);\n \n // Tanh distortion / limiting\n sig = (sig * 1).tanh;\n \n // Another round of signal coloring, using another RLPF\n // and sine components\n sig = sig + RLPF.ar(sig, XLine.ar(freq * 100, freq * 10, 0.15)) + sin + sub;\n \n // Another round of tanh distortion / limiting\n sig = (sig / 2.3).tanh;\n \n // Another resonant LPF\n sig = MoogFF.ar(sig, XLine.ar(freq*150, freq*30, 0.1), 0.1);\n \n Out.ar(outbus, sig!2);\n}).add;\n);\n\n(\nTempoClock.default.tempo = 1.8;\n\nPbind(\n \\instrument, \\bass,\n \\midinote, Pseq([\n Pseq([Rest, 42, 42], 3),\n Pseq([Rest, 42, 42, 42]),\n Pseq([Rest, 42, 42], 3),\n Pseq([Rest, 45, 45, 42])\n ], inf),\n \\dur, Pseq([\n Pseq([0.75, 0.75, 0.5], 3),\n Pseq([0.5, 0.25, 0.75, 0.5])\n ], inf)\n).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Why LeakDC and not a standard HPF for DC removal?"}, {"role": "assistant", "content": "SuperCollider forum — Why LeakDC and not a standard HPF for DC removal?\n\nHello everyone,\n\nI’m a bit sceptical of the DC removal implementation in LeakDC. As I understand it, DC removal is nothing but a HPF, preferably placed below the audible range. For this purpose, LeakDC seems to be reaching far too high, attenuating the audible low frequencies. You can run the following code and look at the server meter to see the difference in level between the two audio channels (note: there is of course no DC offset in this example that would need fixing):\n\n```supercollider\n( play { [\n SinOsc.ar(50),\n LeakDC.ar(SinOsc.ar(50))\n] * 0.2 } )\n```\n\nAlso, LeakDC’s behaviour is not consistent between sample rates (as is mentioned in the help file).\n\nI ran the it through Plugin Doctor to back up my suspicions and got these results:\n\nstandard coefficient of 0.995:\n\nSR 48 kHz: Filter starts rolling off at 200 Hz, -2dB at 50 Hz.\n\nSR 96 kHz: Filter starts rolling off at 500 hz! It reaches already -2dB at 100 Hz, -5 dB at 50 Hz.\n\ncoefficient of 0.999:\n\nSR 48 kHz: Filter starts rolling off at 50 Hz, -2 dB at 10 Hz.\n\nSR 96 kHz: Filter starts rolling off at 100 Hz, -2 dB at 20 Hz.\n\nI wonder why one wouldn’t just use a standard HPF at 10 Hz (or so) instead? It is consistent between sample rates, it only starts to roll of below 30 Hz and it reaches only -0.5 dB at 20 Hz. So this actually looks much better in the server meter:\n\n```supercollider\n( play { [\n SinOsc.ar(50),\n HPF.ar(SinOsc.ar(50), 10)\n] * 0.2 } )\n```\n\nSo my question is: Is there any reason why the LeakDC implementation would be peferable to such a standard butterworth HPF?\n\nOne difference I can see is that the HPF still has an initial offset spike before settling around zero phase, LeakDC does not show that behaviour:\n\n```supercollider\n{ LeakDC.ar(DC.ar(0.5)) }.plot(0.5);\n{ HPF.ar(DC.ar(0.5), 10) }.plot(0.5);\n\n{ LeakDC.ar(SinOsc.ar + DC.ar(0.5)) }.plot(0.02);\n{ HPF.ar(SinOsc.ar + DC.ar(0.5), 10) }.plot(0.02);\n```\n\nSo this could be a reason – I don’t know enough about filters to understand why this happens though. Any enlightenment would be appreciated."}]} -{"conversations": [{"role": "user", "content": "How do I get a Euclidean-style rhythm in SuperCollider?"}, {"role": "assistant", "content": "Describe the pattern as a list of hits and rests; `Rest` gives the gap without starting a Synth.\n\n```supercollider\n(\nPbind(\n \\instrument, \\hat,\n \\dur, 0.125,\n \\amp, Pseq([0.3, 0, 0, 0.3, 0, 0.3, 0, 0], inf).collect { |x| x + 0.001 }\n).play;\n)\n```\n\nFor real Euclidean generation use `Pseq([1,0,0,1,0,1,0,0], inf)` on a duration multiplier and wrap rests\nwith `Rest`, or compute the pattern with `bjorklund`-style logic in a Function and `Pseq` the result."}]} -{"conversations": [{"role": "user", "content": "What are the server's default sample rate and block size?"}, {"role": "assistant", "content": "44100 Hz and 64 samples per block by default, so the control rate is 44100/64 = 689.06 Hz. You can read them from the language with `s.sampleRate` and `s.options.blockSize`, or from inside a Synth with `SampleRate.ir` and `ControlRate.ir`. A `.kr` signal therefore updates about 689 times a second, which is why it is smooth enough for filters and envelopes but not for audio-rate FM."}]} -{"conversations": [{"role": "user", "content": "Can you listen to the sound you generate?"}, {"role": "assistant", "content": "No. I am 198M parameters trained on SuperCollider's documentation and class library; I have no audio input and no way to hear a result. What I can do is reason about the code: whether it reaches an output bus, whether the envelope will ever open, whether a filter at that cutoff leaves anything audible. Treat my patches as a starting point you listen to, not as a judgement about how they sound."}]} -{"conversations": [{"role": "user", "content": "What is `Henon2DC` in SuperCollider?"}, {"role": "assistant", "content": "Henon2DC — henon map 2D chaotic generator `y = b * x(n)` Category: UGens > Generators > Stochastic."}]} -{"conversations": [{"role": "user", "content": "What does `SimpleNumber.gammaPInvA` do?"}, {"role": "assistant", "content": "Returns a value such that `p = gamma_p(a, x)`. Requires `x` > 0 and 1 >= `p,q` >="}]} -{"conversations": [{"role": "user", "content": "Explain `CompositeView` in SuperCollider briefly."}, {"role": "assistant", "content": "CompositeView — A view that contains other views. Category: GUI > Views."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for it goes beyond vibrato too."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"vibrato\", {arg freq=440, release=0.1;\n var x, sig,out, mod1, depth, mfreq,maxfreq, maxdepth, maxdelay, basedelay;\n maxfreq=5;\n maxdelay=0.1;\n basedelay=maxdelay/2;\n maxdepth=basedelay/2;\n depth = MouseY.kr(0,maxdepth);\n mfreq = MouseX.kr(0,maxfreq);\n mod1 = SinOsc.ar(mfreq,0,depth);\n sig = SoundIn.ar(0,mul:2);\n x = DelayC.ar(sig, maxdelay,basedelay+ mod1);\n out = x;// FreeVerb.ar(x,MouseX.kr(0,1),MouseY.kr(0,1), 0.1);\n Out.ar(0,out);\n Out.ar(1,out);\n}).load(s);\n);\n\na = Synth(\"vibrato\");\na.free\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for mixolydian flat six meditation in pythagorean?"}, {"role": "assistant", "content": "```supercollider\n// last updated on sccode.org fri 7. jun, 14:57 CET\n\n( // load this first - synth def\nSynthDef(\\harpsi, { \n arg outbus = 0, freq = 440, ffreq = 2, amp = 1, gate = 1, release = 1;\n var out;\n freq = freq * Rand(1, 1.005);\n out = EnvGen.ar(Env.adsr(releaseTime:release), gate, doneAction: Done.freeSelf)\n * amp * Pulse.ar([freq,freq*1.005]/1, 0.25, mul:0.75 );\n out = out * [Rand(0.0, 1.0), Rand(0.0, 1.0)];\n out = RLPF.ar(out, freq * (ffreq / 4) + 1 );\n Out.ar(outbus, out); \n}).add; \n);\n\n\n( // then run this - sequence\nTempoClock.default.tempo = 1.4;\n~scale = Scale.new(#[0,2,4,5,7,8,10],tuning: \\pythagorean, name: \"mixolydianb6\");\np = Pbind(\n \\instrument, \\harpsi,\n \\root, -12,\n \\scale, ~scale,\n \\ffreq, Pseq(((1..2) ++ (3..1)),inf),\n \\degree, Pseq([\n Pseries({ rrand(0, 7) }, { ([1,2]).choose }, { rrand(4, 8) }),\n Pseries({ rrand(0, 7) }, {([1,2]).choose}, { rrand(4, 8) }),\n Pseries({ rrand(7, 14) }, 0-{([1,2]).choose}, { rrand(4, 8) })\n ], inf),\n \\release, Prand([5,6,7,8],inf),\n \\dur, Prand((1..8)/4, inf),\n \\amp, Prand(((1..8)/8)+1, inf)\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for automatically playback of all soundfiles in a directory."}, {"role": "assistant", "content": "```supercollider\n(\nw = {|pathPattern|\nvar soundFiles;\n// get sounds\nsoundFiles = SoundFile.collect(pathPattern);\n\n// play back in order of their appearance\nPseq(soundFiles.collect{|file| file.cue((\\dur: file.duration))}, 1).play;\n}\n);\n\n// adjust path and evaluate the next line\nw.value(\"/Volumes/usbImport/PMD620/200804062000/*.WAV\")\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes song of forest."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\sound, {\n arg i_bus = 0, amp = 0.1, freq = 440, sustain = 1, pan = 0;\n var env, osc, out;\n env = EnvGen.kr(Env.perc(0.01, sustain, amp),doneAction:2);\n osc = SinOsc.ar([freq, freq * 1.005, freq * 0.995], mul:env);\n out = Pan2.ar(osc, pan);\n Out.ar(i_bus, out);\n}).send(s);\n);\n\n(\n~amp = 0.1;\na = Pdef(\\a,\n Pbind(\n \\instrument, \\sound,\n \\amp, ~amp * 1.5,\n \\degree, Pseq([2, 4, 5, 6, 1] - 1, inf),\n \\dur, Pseq([1, 1, 1, 1, 2] / 4, inf)\n )\n).quant_([3, 0, 0, 1]);\n\nb = Pdef(\\b,\n Pbind(\n \\instrument, \\sound,\n \\amp, ~amp,\n \\degree, Pseq([8, 6, 5, 3, 4, 6] - 1, inf),\n \\dur, Pseq([1, 1, 1, 1, 1, 1] / 4, inf)\n )\n).quant_([3, 0, 0, 1]);\n\nc = Pdef(\\c,\n Pbind(\n \\instrument, \\sound,\n \\amp, ~amp * 0.6,\n \\degree, Pseq([1, 6, 8, 6, Pwrand([11,13], [2, 1].normalizeSum)] - 1, inf),\n \\amp, Pseq([0, 1, 1, 1, 1] / 10, inf),\n \\dur, Pseq([8, 1, 1, 1, 1] / 8, inf),\n \\sustain, 0.1\n )\n).quant_([3, 0, 0, 1]);\n);\n\n(\nSystemClock.sched(0, Routine({\n a.play; 12.yield;\n b.play; 12.yield;\n c.play; 12.yield;\n c.pause; 6.yield;\n a.pause; 6.yield;\n\n b.pause; a.play; 12.yield;\n b.play; 12.yield;\n c.play; 12.yield;\n c.pause; a.pause; 6.yield;\n b.pause; 6.yield;\n}));\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `IBVAfile.convert` do? What arguments does it take?"}, {"role": "assistant", "content": "convert file from binary to Arguments: path — input binary file; outPath — optional output text file path. if nil then `path++\"CONVERTED.txt\"` will be used.."}]} -{"conversations": [{"role": "user", "content": "Can you listen to the sound you generate?"}, {"role": "assistant", "content": "No. I am 198M parameters trained on SuperCollider's documentation and class library; I have no audio input and no way to hear a result. What I can do is reason about the code: whether it reaches an output bus, whether the envelope will ever open, whether a filter at that cutoff leaves anything audible. Treat my patches as a starting point you listen to, not as a judgement about how they sound."}]} -{"conversations": [{"role": "user", "content": "What is the difference between Env and EnvGen?"}, {"role": "assistant", "content": "Env is a language-side description: a list of levels, times and a curve, e.g. `Env.perc(0.01, 1)` or `Env.adsr(0.01, 0.1, 0.5, 0.8)`. EnvGen is the UGen that plays it on the server: `EnvGen.kr(env, gate, doneAction: 2)`. The same Env can be played by many EnvGens, and Env also has language-side uses such as `.asStream` inside Patterns and `.plot`."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n/* Audio plugin definition\n\n Each audio plugin should define the following global variables:\n ~name: (symbol) name of the spatializer\n ~description: (string) a short description\n ~function: the actual definition of the plugin\n\n*/\n\n~name = \\emptySource;\n~description = \"dummy/template\";\n~channelLayout = \\mono;\n\n~function = {\n DC.ar(0);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Migration from the old SourceForge wiki?"}, {"role": "assistant", "content": "```supercollider\np = ProxySpace.push(s.boot);\n\n~out.play(0,2);\n\n// taube eule und maus\n(\n~out = { \n var tr, e, eg, fm, maus;\n maus = MouseX.kr(0.1, 2);\n e = Env([0, 1, 0.4, 1, 0], [0.03, 0.2 * maus, 0.2, maus]);\n tr = Dust.kr(0.3);\n eg = EnvGen.kr(e, tr);\n fm = SinOsc.ar(30, 0, 0.2 * (1 - eg), 1);\n SinOsc.ar(100 * eg + 200 * fm) * 0.1 * eg\n};\n);\n\n// taube eulen und maus\n(\n~out = { \n var tr, e, eg, fm, maus;\n maus = MouseX.kr(0.1, 2);\n e = { Env([0, 1, 0.4, 1, 0], [0.03, 0.2.rand, 0.2, maus]) };\n tr = { Dust.kr(0.3) };\n eg = [\n EnvGen.kr(e.value, tr.value), \n EnvGen.kr(e.value, tr.value)\n ];\n fm = SinOsc.ar(30, 0, 0.2 * (1 - eg), 1);\n SinOsc.ar(100 * eg + 200 * [1, 1.15] * fm) * 0.1 * eg\n};\n);\n\n\n// eulenschlag und maus\n(\n~out = { \n var tr, e, eg, fm, maus, n, u;\n n = 6;\n maus = MouseX.kr(0.1, 2);\n e = { Env([0, 1, 0.4, 1, 0], [0.03, 0.2.rand, 0.2, maus]) };\n tr = { Dust.kr(0.1) };\n eg = (e ! n).collect { arg env; EnvGen.kr(env, tr.value) };\n fm = SinOsc.ar({ 30 + 2.0.rand2 } ! n, 0, 0.2 * (1 - eg), 1);\n u = SinOsc.ar(100 * eg + 200 * { rrand(0.9, 1.1) } ! n * fm) * 0.1 * eg;\n u.clump(2).sum\n};\n);\n\n/*\nauthors so far:\njrh\n*/\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Listening to CC messages."}, {"role": "assistant", "content": "```supercollider\n// connect will connect to all midi in devices\n// if you need to specify one,\n// check the sources at: MIDIClient.sources\n// and connect using MIDIIn.connect( source_index )\nMIDIIn.connect;\n\n// show incoming control data\n~control = { arg src, chan, num, val; \n [chan,num,val].postln; \n};\n\nMIDIIn.addFuncTo(\\control, ~control);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `EZNumber.font` do? What arguments does it take?"}, {"role": "assistant", "content": "Set the Font used by all the Arguments: font — An instance of Font.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var a, freq, trig;\n a = Diwhite(0, 15, inf);\n trig = Impulse.kr(MouseX.kr(1, 40, 1));\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var a, freq, trig;\n a = Diwhite(0, 15, inf);\n trig = Impulse.kr(MouseX.kr(1, 40, 1));\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Dictionary.includesKey` do?"}, {"role": "assistant", "content": "Returns true if the specified item is stored in the Dictionary as a key. Element is checked for equality (not for identity). For identity matching see subclasses: IdentityDictionary or Event. `var d = Dictionary.newFrom([\"hey\", 1, \"hello\","}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Play your (short) soundfiles with some delay."}, {"role": "assistant", "content": "```supercollider\n// By Bjørn Houdorf March 2013, Play your (short) soundfiles with some delay.\n\nb = SoundFile.collectIntoBuffers(\"yourSoundFileFolder/*\"); // 1. rund this\n\n( // 2. and then run this\nt = Task({\n({\n var num= b.size.rand;\n var buf= b[num];\n 0.1*Splay.ar(PlayBuf.ar(buf.numChannels, buf, 1, 1, 0, 0));\n}.play;\n) \n});\n);\n\n\n( // 3. Then run this\nz = Task({\nloop({\n t.start;\n 0.1.wait;\n});\n});\n);\n\n\nz.start; // 4. and run this\nz.stop; // 5. and finally run this\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Rect.moveToPoint` do?"}, {"role": "assistant", "content": "Returns a new Rect whose upper left corner is moved to"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n \n// definition for future reference in arbitrary Environments\n\n(\np = Pbind(\n \\midinote, PLnaryop('+', \\src, [\\dev]),\n \\dur, 0.1\n);\n);\n\n\n// define Environment and play\n\n(\ne = (src: PLseq([61,62]), dev: Pbrown(-5, 5, 0.2) );\n\ne.use { x = p.play };\n);\n\n\n// replace\n\ne.dev = PLseq((0, 0.5..7));\n\ne.dev = Pbrown(-5, 5, 0.2);\n\ne.src = PLseq([61,64,65]);\n// …\n```"}, {"role": "assistant", "content": "definition for future reference in arbitrary Environments define Environment and play (PLnaryop: dynamic scope Pnaryop variant)"}]} -{"conversations": [{"role": "user", "content": "Explain `PV_HainsworthFoote` in SuperCollider briefly."}, {"role": "assistant", "content": "PV_HainsworthFoote — FFT onset detector. FFT onset detector based on work described in Hainsworth, S. (2003) Techniques for the Automated Analysis of Musical Audio. PhD, University of Cambridge engineering dept. See especially p128. The Hainsworth metric is a modification of the Kullback Liebler distance. Category: UGens > FFT."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\Identity;\n~description = \"Output the Ambisonics stream to outputs channels, useful for NRT rendering\";\n\n~function = {|in = 0|\nin;\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PulseDivider`."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\"help-PulseDivider\", { |out = 0|\n var p, a, b;\n p = Impulse.ar(8);\n a = SinOsc.ar(1200, 0, Decay2.ar(p, 0.005, 0.1));\n b = SinOsc.ar(600, 0, Decay2.ar(PulseDivider.ar(p, 4), 0.005, 0.5));\n\n Out.ar(out, (a + b) * 0.4)\n}).play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Algorithmic melancholy (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nvar n = 20, baseFreq = 45.midicps;\nvar lsin, rsin, arg1, arg2, sig;\nvar bus, busIndex, scale, freq, freqIndex, amp;\nvar responder;\n\nscale = Scale.nikriz.ratios * baseFreq;\n\nbus = Bus.control( s, 2 * n );\nbus.setn( { 1.0.rand2 } ! ( 2 * n ) );\nbusIndex = bus.index;\n\nfreq = Bus.control( s, n );\nfreqIndex = freq.index;\n\nresponder = OSCFunc({ | id |\n freq.setAt( id[2] , scale.choose * 1.rrand( 3 ) );\n},'/tr', s.addr);\n\nCmdPeriod.doOnce { [ bus, freq, responder ].free; };\n\nn.do {|i|\n freq.setn( { scale.choose * rrand( 1, 3) } ! n );\n {\n #arg1, arg2 = In.kr( 2 * i + busIndex, 2 );\n\n #lsin, rsin = SinOsc.kr( [ arg1, arg2 ], { 2.0.rrand(20.0) } ! 2 * [ arg2, arg1 ] ); \n\n sig = Formant.ar( \n LFNoise0.kr( 0.05, 2.5, 7) * arg1, \n arg2,\n 500.0.rrand(700) \n );\n\n ReplaceOut.kr( 2 * i + busIndex, [ rsin, lsin ] );\n\n sig = Pluck.ar( \n BrownNoise.ar(0.5), \n sig, \n 0.025, \n freq.kr( 1, i ).reciprocal, \n 3.7\n ) * 0.6;\n\n amp = Line.kr( dur: rrand( 1.0, 20.0) ) * max( 0, LFNoise1.kr( 0.05, 0.6, 0.4 ) ) ;\n sig = sig * amp;\n SendTrig.kr( amp <= 0, i, i );\n\n Pan2.ar( sig, 0.8.rand2 )\n }.play\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `BufferProxy.freePatchOutToBundle` do? What arguments does it take?"}, {"role": "assistant", "content": "allocates a Buffer on play Arguments: bundle."}]} -{"conversations": [{"role": "user", "content": "Explain `MultiPageLayout` in SuperCollider briefly."}, {"role": "assistant", "content": "MultiPageLayout — deprecated, see PageLayout see PageLayout Category: Libraries > crucial > deprecated."}]} -{"conversations": [{"role": "user", "content": "What does `Pevent.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Provide an inval for an event stream. Arguments: pattern — pattern or stream that returns or modifies events.; event — an event with objects to embed. If none is provided, it uses Event#*default.."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for radio static with tuning noise (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"radiostatic\", {arg out=0;\n var hum, sineSweep, tuning, dustNoise, staticNoise, humFreq, numHarms;\n \n numHarms = 7;\n humFreq = 100;\n hum = Array.fill(numHarms, {|i| SinOsc.ar( (i+1) * humFreq, 0, 1/numHarms)});\n hum = hum.sum;\n dustNoise = Dust.ar(LFNoise1.ar(0.5).range(1000,8000));\n staticNoise = hum * dustNoise * LFNoise1.ar(1).range(0.5, 2);\n \n sineSweep = SinOsc.ar(LFNoise2.ar(1).range(20, 11000));\n tuning = SinOsc.ar(10000).ring4(sineSweep) * LFNoise2.ar(1.1).range(0.05, 0.1);\n\n Out.ar(out, Pan2.ar(staticNoise + tuning, 0));\n}).add;\n);\n \na = Synth(\"radiostatic\");\n```"}]} -{"conversations": [{"role": "user", "content": "Why LeakDC and not a standard HPF for DC removal?"}, {"role": "assistant", "content": "SuperCollider forum — Why LeakDC and not a standard HPF for DC removal?\n\nHello everyone,\n\nI’m a bit sceptical of the DC removal implementation in LeakDC. As I understand it, DC removal is nothing but a HPF, preferably placed below the audible range. For this purpose, LeakDC seems to be reaching far too high, attenuating the audible low frequencies. You can run the following code and look at the server meter to see the difference in level between the two audio channels (note: there is of course no DC offset in this example that would need fixing):\n\n```supercollider\n( play { [\n SinOsc.ar(50),\n LeakDC.ar(SinOsc.ar(50))\n] * 0.2 } )\n```\n\nAlso, LeakDC’s behaviour is not consistent between sample rates (as is mentioned in the help file).\n\nI ran the it through Plugin Doctor to back up my suspicions and got these results:\n\nstandard coefficient of 0.995:\n\nSR 48 kHz: Filter starts rolling off at 200 Hz, -2dB at 50 Hz.\n\nSR 96 kHz: Filter starts rolling off at 500 hz! It reaches already -2dB at 100 Hz, -5 dB at 50 Hz.\n\ncoefficient of 0.999:\n\nSR 48 kHz: Filter starts rolling off at 50 Hz, -2 dB at 10 Hz.\n\nSR 96 kHz: Filter starts rolling off at 100 Hz, -2 dB at 20 Hz.\n\nI wonder why one wouldn’t just use a standard HPF at 10 Hz (or so) instead? It is consistent between sample rates, it only starts to roll of below 30 Hz and it reaches only -0.5 dB at 20 Hz. So this actually looks much better in the server meter:\n\n```supercollider\n( play { [\n SinOsc.ar(50),\n HPF.ar(SinOsc.ar(50), 10)\n] * 0.2 } )\n```\n\nSo my question is: Is there any reason why the LeakDC implementation would be peferable to such a standard butterworth HPF?\n\nOne difference I can see is that the HPF still has an initial offset spike before settling around zero phase, LeakDC does not show that behaviour:\n\n```supercollider\n{ LeakDC.ar(DC.ar(0.5)) }.plot(0.5);\n{ HPF.ar(DC.ar(0.5), 10) }.plot(0.5);\n\n{ LeakDC.ar(SinOsc.ar + DC.ar(0.5)) }.plot(0.02);\n{ HPF.ar(SinOsc.ar + DC.ar(0.5), 10) }.plot(0.02);\n```\n\nSo this could be a reason – I don’t know enough about filters to understand why this happens though. Any enlightenment would be appreciated."}]} -{"conversations": [{"role": "user", "content": "What does `Updater.updateFunc` do?"}, {"role": "assistant", "content": "simple MVC utility; calls an update handler when the model changes"}]} -{"conversations": [{"role": "user", "content": "Explain `PV_Compander` in SuperCollider briefly."}, {"role": "assistant", "content": "PV_Compander — simple spectral compression/expansion Applies compression/expansion to individual magnitudes. Category: UGens > FFT."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Ball`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var f, sf, g;\n sf = LFNoise0.ar(MouseX.kr(1, 100, 1));\n g = MouseY.kr(0.1, 10, 1);\n f = Ball.ar(sf, g, 0.01, 0.01);\n f = f * 140 + 500;\n SinOsc.ar(f, 0, 0.2)\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nt = SortedList.new(8, {|a,b| a.first < b.first });\nt.add([10, \"last\"]);\nt.add([1, \"first\"];\nt.postln;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nt = SortedList.new(8, {|a,b| a.first < b.first });\nt.add([10, \"last\"]);\nt.add([1, \"first\"]);\nt.postln;\n```"}]} -{"conversations": [{"role": "user", "content": "What happens when I call .play on a function?"}, {"role": "assistant", "content": "`.play` on a Function builds a SynthDef from the function body, adds it to the server under an anonymous name, and starts one Synth of it. You get back the Synth, so `x = { SinOsc.ar(440) * 0.1 }.play; x.free;` stops it. It is the fastest way to hear something, but it is not how you write a piece: nothing is named, nothing can be reused, and the definition is lost when the Synth is freed."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for The quest for the prime numbers?"}, {"role": "assistant", "content": "```supercollider\n//Prime numbers\n \nServer.default.boot;\n(\n//maximum number\n~max=100;\n\n//synthdefs: 2 filtered sawteeth for number and divisor\nSynthDef ( \\gsaw, {arg g;\n Out.ar(1, \n RLPF.ar ( Saw.ar(20*g), 10000*(1-(g/~max)), 0.2, 0.2)\n )\n}).add;\n\nSynthDef ( \\dsaw, {arg d, g;\n Out.ar(0,\n RLPF.ar( Saw.ar(20*d), 10000*d/sqrt(g), 0.2, 0.2)\n // the square root is important: if you search for the divisors of a number,\n // don't search beyond the square root of the number. There won't be any.\n )\n}).add;\n\n//a fm-sound with carrier 20*number and modulator 20*divisor, modulation index = 10\nSynthDef (\\fm, {arg m, c;\n Out.ar(0,\n Pan2.ar(SinOsc.ar(20*c+(SinOsc.ar(20*m, 0, 200*m, 0))), 0)\n )\n}).add;\n\n);\n(\nr=Routine({\n var number, divisor;\n //the list of prime numbers\n l=Array.newClear(indexedSize: 0);\n\n for (2, ~max,{arg number;\n x=Synth(\\gsaw, [\\g, number]); //play the number\n divisor=2;\n p=true; //prime number?\n while ({((divisor <= (number.sqrt)).and(p == true))},\n { \n y=Synth(\\dsaw, [\\d, divisor, \\g, number]); //play the divisor\n z=Synth(\\fm, [\\m, divisor, \\c, number]); //play the fm sound of number and divisor\n 1.wait; //1 second should be enough to hear if a sound is harmonic\n // harmonic sound means: not a prime number\n y.free; \n z.free; \n if( number.mod(divisor) == 0, {p = false} ); //not a prime number\n divisor = divisor + 1;\n }\n );\n x.free;\n if (p == true){ //primenumber!\n l=l.add(number); //add primenumber to the list\n for (1, l.size, { arg i; //play the list of prime numbers\n z=Synth(\\fm, [\\m, l.size, \\c, l[i]]);\n 0.1.wait;\n z.free;\n });\n }\n\n });\n});\n);\nr.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SDrone.func` do?"}, {"role": "assistant", "content": "a LINKClasses/Function that will be wrapped inside the internal"}]} -{"conversations": [{"role": "user", "content": "What does `RedEffectModule.gui` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a Arguments: parent — Can be a Window or a View.; position — A Point.."}]} -{"conversations": [{"role": "user", "content": "What does `SharedBus.owner` do?"}, {"role": "assistant", "content": "a Bus that is used by several objects and implements reference counting"}]} -{"conversations": [{"role": "user", "content": "What is `ArrayedCollection`?"}, {"role": "assistant", "content": "ArrayedCollection — Abstract superclass of Collections of fixed maximum size"}, {"role": "user", "content": "What does `ArrayedCollection.newClear` do?"}, {"role": "assistant", "content": "Creates a new instance with indexedSize indexable slots. The slots are filled with Nil, zero or something else appropriate to the type of indexable slots in the object. `Array.newClear(4).postln;`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n pitches.size.do{ |i|\n {\n var freq = pitches[i].midicps;\n var env = Env.perc.ar(Done.freeSelf);\n SinOsc.ar(freq) * 0.1 * env\n }.play;\n 0.2.wait\n }\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Detune idea is from James Harkins."}, {"role": "assistant", "content": "```supercollider\n(\na = {\n |freq = 40, wid = 0.5|\n Mix(LFPulse.ar(freq *((Array.fill(40, Pxrand((1, 2..20), inf).iter)/1000)+1),\n 0, wid, 0.05)\n ).dup\n}.play;\n);\n\n//more distorsion\n~widlfo = {Saw.kr(0.5).range(0,1)};\na.set(\\wid, ~widlfo);\n\n//stop\na.release;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Wobble, tremolo, whatever you want to call it."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"Triangular AM\", { arg freq = 440, modfreq = 5, amp = 0.5, attack = 0.01, release = 0.1, pos = 0, gate = 1;\n var carrier, modulator, env;\n modulator = SinOsc.kr(modfreq).range(0, 1); // provides amplitude modulation for wobble\n carrier = LFTri.ar(freq: freq, mul: modulator); // provides triangle wave for an interesting harmonic\n env = Env.asr(\n attackTime: attack,\n sustainLevel: amp,\n releaseTime: release).kr(doneAction: 2, gate: gate);\n carrier = carrier * env;\n Out.ar(0, Pan2.ar(carrier, pos))\n}).add;\n);\n\n(\n// Using these settings you can produce a pulsating wobble sound\n~wobble = Pbind(\n \\instrument, \"Triangular AM\",\n \\scale, Scale.aeolian,\n \\ctranspose, -12,\n \\degree, Pseq([\n [-7,-3, 0, 2, 4, 7],\n [-8, -4, -1, 1, 3, 6],\n [-9, -5, -2, 0, 2, 5],\n [-5, -1, 2, 4, 6, 9],\n [-4, 0, 3, 5, 7, 10],\n ], inf),\n \\dur, Pseq([Pn(4, 3), 2, 2], inf),\n \\amp, 0.4,\n \\modfreq, Pseq([Pn(6.5, 3), 2, 6.5], inf),\n \\attack, 2,\n \\release, 1.2,\n \\pos, [-1, -0.7, -0.2, 0.2, 0.7, 1],\n \\gate, 0,\n);\n);\n\n~wobble.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nNdef(\\x, { Saw.ar(110) * 0.1 }).play;\nNdef(\\x)[1] = \\filter -> { |in| RLPF.ar(in, 800, 0.4) };\n```"}, {"role": "assistant", "content": "Two nodes in one named proxy: a saw source, then a resonant low-pass filter fed by it.\n\n`Ndef(\\x, { ... })` defines the first node of the chain and `.play` starts it. `Ndef(\\x)[1] = \\filter ->`\ninserts a second node at index 1; the `\\filter` key says 'make this node an effect that receives the\nprevious node's output as `in`'. So the patch is `Saw -> RLPF -> out`. Because it is an Ndef, calling\n`Ndef(\\x, { ... })` again replaces the source with a crossfade instead of restarting, and\n`Ndef(\\x).stop` removes the whole chain."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nPbind(x:7, y:Pseq([1, 2, 3]).patternpairs\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nPbind(x:7, y:Pseq([1, 2, 3])).patternpairs\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `LazyEnvir` in SuperCollider briefly."}, {"role": "assistant", "content": "LazyEnvir — lazy environment Environment with deferred evaluation and default values. Category: JITLib > Environments, Live Coding, Collections > Unordered."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Re: Re: the perfect frequencies?"}, {"role": "assistant", "content": "```supercollider\n(\nf = {\n var rep = [4, 8, 16, 32];\n var n = rep.choose;\n var x = [\n\n 54, 60, 66, 72, 81, 90, 96, 102,\n 108, 128, 132, 144, 162, 180, 192, 204,\n 216, 240, 264, 288, 324, 360, 384, 408,\n 432, 480, 528, 576, 648, 720, 768, 816,\n 864, 960, 1056, 1152, 1296, 1440, 1536, 1632,\n 1728, 1920, 2112, 2304, 2592, 2880, 3072, 3264,\n 3456, 3840, 4224, 4608, 5184, 5760, 6144, 6528,\n 6912, 7680, 8448, 9216, 10368, 11520, 12288, 528\n\n ];\n var fac1 = [1,10,100,1000].choose;\n var fac2 = [1,10,100,1000].choose;\n var fac3 = [1,10,100,1000].choose;\n Mix.fill(n,\n {\n var detune = 5.rand;\n var saw;\n var sin;\n detune = XLine.kr(0.1,1+250.0.rand ,2+9.0.rand) * 2.0.rand* [1,-1].choose;\n sin = SinOsc.ar(x.choose * ( 1 + ( SinOsc.ar(x.choose/fac1) * x.choose/fac2 )) + detune, 4.rand, 0.25);\n saw = RLPF.ar(Saw.ar(x.choose*0.01+detune, 0.75), x.choose, 2.rand);\n saw = [\n saw,\n saw.fold2( SinOsc.ar(x.choose/fac3).range(0.1,1) ),\n saw.wrap2( SinOsc.ar(x.choose/fac3).range(0.1,1) ),\n saw * SinOsc.ar(x.choose/2),\n ( saw * SinOsc.ar(x.choose/fac3).range(1,20) ).tanh/2,\n ].choose;\n Pan2.ar((sin+saw) * EnvGen.kr(Env.sine(12, 1/n), 1, doneAction:2),\n 1.rand2) \n }\n );\n};\n);\n\n(\n// DEFINE A ROUTINE\nr = Routine({\n\n inf.do({\n f.play;\n 10.wait;\n })\n});\n);\n\nr.reset.play;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\ns.boot;\n\nInstr(\"saw\",{ arg freq=400; Saw.ar(freq) * EnvGen.kr(Env.perc,doneAction:2)});\n\np = Patch(\"saw\",[KrNumberEditor(300,\\freq)]);\n\nSheet({ arg f;\n p.gui(f);\n ActionButton(f,\"asEvent\",{\n p.asEvent.play.postln\n });\n});\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\ns.boot;\n\nInstr(\"saw\",{ arg freq=400; Saw.ar(freq) * EnvGen.kr(Env.perc,doneAction:2)});\n\np = Patch(\"saw\",[KrNumberEditor(300,\\freq)]);\n\nSheet({ arg f;\n p.gui(f);\n ActionButton(f,\"asEvent\",{\n p.asEvent.play.postln\n });\n});\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `PathName` in SuperCollider briefly."}, {"role": "assistant", "content": "PathName — file and directory path utilities PathName is a utility class for manipulating file names and paths. It expects a path to a file, and lets you access parts of that file path. Category: Files."}]} -{"conversations": [{"role": "user", "content": "What is `AbstractConstraint` in SuperCollider?"}, {"role": "assistant", "content": "AbstractConstraint — abstract parent class for the Constraints micro-library See the Constraints first. Category: Libraries > crucial > Constraints > abstract."}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ LPF.ar(Saw.ar(100), SinOsc.kr(0.5).exprange(200, 2000)) * 0.2 }.play;\n```"}, {"role": "assistant", "content": "A sawtooth through a low-pass filter whose cutoff is swept slowly up and down — a classic filter\nsweep.\n\n- `Saw.ar(100)` is a 100 Hz sawtooth, rich in harmonics.\n- `SinOsc.kr(0.5)` is a control-rate sine at 0.5 Hz, so one full cycle takes 2 seconds.\n- `.exprange(200, 2000)` maps that -1..1 sine exponentially onto 200..2000 Hz — exponential is the right\n mapping for frequency, because we hear pitch logarithmically.\n- `LPF.ar(sig, cutoff)` removes harmonics above the cutoff; as it opens and closes you hear the tone\n brighten and darken.\n- `* 0.2` keeps the output from clipping."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `QuadN`."}, {"role": "assistant", "content": "```supercollider\n// logistic map\n// equation: x1 = -r*x0^2 + r*x0\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n QuadN.ar(SampleRate.ir/4, r.neg, r, 0, 0.1) * 0.4;\n}.play(s);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `APF` in SuperCollider?"}, {"role": "assistant", "content": "APF — FIXME: APF purpose. FIXME: APF description. Category: UGens > Filters > Linear, UGens > Undocumented."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Dibrown`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a, freq, trig;\n a = Dibrown(0, 15, 1, inf);\n trig = Impulse.kr(MouseX.kr(1, 40, 1));\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What are the arguments of GrainBuf.ar?"}, {"role": "assistant", "content": "`GrainBuf.ar(numChannels, trigger, dur, sndbuf, rate, pos, interp, pan, envbufnum, maxGrains, mul, add)`. The ones you always pass are numChannels (1 or 2), trigger (a UGen that fires grains, e.g. Impulse.kr(20)), dur (grain length in seconds), sndbuf (an integer buffer number, or `~buf`), rate (playback rate per grain), and pos (read position 0..1 into the buffer). Raise maxGrains if the server complains about too many grains rather than lowering density."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Dseries`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a, freq, trig;\n a = Dseries(0, 1, 15);\n trig = Impulse.kr(MouseX.kr(1, 40, 1));\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n);\n\n(\n{\n var a, freq, trig;\n a = Dseries(0, 1, inf);\n trig = Dust.kr(MouseX.kr(1, 40, 1));\n freq = Demand.kr(trig, 0, a) % 15 * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `HilbertHIm` in SuperCollider?"}, {"role": "assistant", "content": "HilbertHIm — Applies the Imaginary part of the Hilbert Transform to an input signal. [1] Offers the Hilbert Transform of an input signal via Weaver's Second Method,footWeaver, Donald. “A Third Method of Generation and Detection of Single-Sideband Signals.” Proceedings of the IRE, vol. 44, no. 12, 1956, pp. 1703–1705. known as Hartley Phasing.footUS Patent 1,666,206, Modulation System, April 17, 1928, United States Patent and Trademark Office. Category: Libraries > Hilbert > Pseudo-UGens, UGens > Filters > Nonlinear."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// as amplitude envelope\n(\n{\n var env = Env([0, 1, 0.5, 1, 0], [0.01, 0.5, 0.02, 0.5]);\n SinOsc.ar(470) * EnvGen.kr(env, doneAction: Done.freeSelf)\n}.play\n);\n\n// as amplitude and modulation envelope\n(\n{\n var env = Env([0, 1, 0.5, 0.8, 0, 1.2, 0], [0.01, 0.5, 0.02, 0.5, 0.2, 0.5]);\n var gate = Impulse.kr(MouseX.kr(0.2, 3), 0.5);\n var gen = EnvGen.kr(env, gate);\n SinOsc.ar(270, S\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// as amplitude envelope\n(\n{\n var env = Env([0, 1, 0.5, 1, 0], [0.01, 0.5, 0.02, 0.5]);\n SinOsc.ar(470) * EnvGen.kr(env, doneAction: Done.freeSelf)\n}.play\n);\n\n// as amplitude and modulation envelope\n(\n{\n var env = Env([0, 1, 0.5, 0.8, 0, 1.2, 0], [0.01, 0.5, 0.02, 0.5, 0.2, 0.5]);\n var gate = Impulse.kr(MouseX.kr(0.2, 3), 0.5);\n var gen = EnvGen.kr(env, gate);\n SinOsc.ar(270, SinOsc.ar(gen * 473)) * gen * 0.2\n}.play\n);\n// EnvGen multichannel expands when passed a multichannel envelope\n(\n{\n SinOsc.ar(\n EnvGen.kr(\n Env.circle([0, 1, 0, (2..4), 0, LFNoise1.kr(0.1 ! 5) * 10, 0], [0.01, 0.6])\n )\n * 240 + 300\n ).sum * 0.2\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = []; // store all the code evaluated in a\nthis.codeDump = { |code| a = a.add(code };\n1 + 3;\nf = { \"hallo\" };\na.postcs;\ncodeDump = nil; // reset to nil.\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = []; // store all the code evaluated in a\nthis.codeDump = { |code| a = a.add(code) };\n1 + 3;\nf = { \"hallo\" };\na.postcs;\ncodeDump = nil; // reset to nil.\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// This can go towards granulation\n\n// load sound file\n\nb = Buffer.read(s, Platform.miSCellaneousDirs[0] +/+ \"Sounds\" +/+ \"kitchen_sounds_1.wav\");\n\n\n// switch between looping PlayBufs\n\n(\nx = {\n var sig = {\n DXMix.ar(\n Dxrand([0, 1, 2], inf),\n `(PlayBuf.ar(1, b, BufRateScale.kr(b) * [0.4, 1, 2.2], loop: 1)),\n stepTime: 0.2,\n fadeTime: 0.01,\n fadeMode: 1,\n width: 2\n ) } ! 2;\n // do a bit correlation\n Splay.ar(sig, 0.8\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// This can go towards granulation\n\n// load sound file\n\nb = Buffer.read(s, Platform.miSCellaneousDirs[0] +/+ \"Sounds\" +/+ \"kitchen_sounds_1.wav\");\n\n\n// switch between looping PlayBufs\n\n(\nx = {\n var sig = {\n DXMix.ar(\n Dxrand([0, 1, 2], inf),\n `(PlayBuf.ar(1, b, BufRateScale.kr(b) * [0.4, 1, 2.2], loop: 1)),\n stepTime: 0.2,\n fadeTime: 0.01,\n fadeMode: 1,\n width: 2\n ) } ! 2;\n // do a bit correlation\n Splay.ar(sig, 0.8)\n}.play\n);\n\nx.release\n```"}]} -{"conversations": [{"role": "user", "content": "What does `AudioInPlayer.storeArgs` do?"}, {"role": "assistant", "content": "plays the computers audio in — microphone or record busses"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// Pseq returns one item in the list after the other\n(\nPseq([\n (note: 2, sustain: 1, dur: 1.5),\n (note: [5, 7], sustain: 0.5, dur: 0.8),\n (note: [2, 6], sustain: 1, dur: 0.8)\n]).play;\n);\n\n// Pbind binds parameters to events:\n(\nPbind(\n \\note, Pseq([2, [5, 7], [2, 6]]),\n \\sustain, Pseq([1, 0.5, 1]),\n \\dur, Pseq([1.5, 0.8, 0.8])\n).play;\n);\n\n// per-event timing may be specified:\n(\nPbind(\n \\note, Pseq([[0, 9], [5, 7], [2, 6]], inf),\n \\s\n// …\n```"}, {"role": "assistant", "content": "Pseq returns one item in the list after the other Pbind binds parameters to events: (Event: an environment that represents an action)"}]} -{"conversations": [{"role": "user", "content": "What is `Object`?"}, {"role": "assistant", "content": "Object — abstract superclass of all objects"}, {"role": "user", "content": "What does `Object.readArchive` do?"}, {"role": "assistant", "content": "Read in an object from a text archive. `(`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// embedding an event\na = (z: 77);\nb = Pset(\\y, 8, a.streamArg(true)).asStream;\nc = Pset(\\y, 8, a.streamArg(false)).asStream;\nb.nextN(3, ()); // this ends\nc.nextN(3, ()); // this loops\n\n// embedding a pattern\na = Pbind(\\note, Pseq([1, 2]));\nb = Pset(\\y, 8, a.streamArg(true)).asStream;\nc = Pset(\\y, 8, a.streamArg(false)).asStream;\nb.nextN(3, ()); // this ends\nc.nextN(3, ()); // this ends, too\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Out.ar(0,Pan2.ar(0.3*Fhn2DC.ar(220,800,0.3,0.3,0.6,0.8,LFPulse.kr(MouseX.kr(1, 10, 1), 0, 0.1)),0.0)) }.play\n\n(\nSynthDef(\\fhn, {|out=0, pan=0, amp=0.1|\n var sig;\n sig=Fhn2DC.ar(110, 22050, TExpRand.kr(0.001, 0.2, Dust.kr(8)), TExpRand.kr(0.001, 0.2, Dust.kr(13)), TRand.kr(0.1, 0.4, Dust.kr(5)),TRand.kr(0.1, 1.9, Dust.\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Out.ar(0,Pan2.ar(0.3*Fhn2DC.ar(220,800,0.3,0.3,0.6,0.8,LFPulse.kr(MouseX.kr(1, 10, 1), 0, 0.1)),0.0)) }.play\n\n(\nSynthDef(\\fhn, {|out=0, pan=0, amp=0.1|\n var sig;\n sig=Fhn2DC.ar(110, 22050, TExpRand.kr(0.001, 0.2, Dust.kr(8)), TExpRand.kr(0.001, 0.2, Dust.kr(13)), TRand.kr(0.1, 0.4, Dust.kr(5)),TRand.kr(0.1, 1.9, Dust.kr(3)), mul:amp);\n Out.ar(0,Pan2.ar(sig, pan))\n}).play\n);\n\n(\nSynthDef(\\fhn, {|out=0, pan=0, amp=0.1|\n var sig, trig1, trig2, b0, b1;\n trig1=FhnTrig.kr(5, 8, 0.3, 0.3, 1, 1);\n trig2=FhnTrig.kr(8, 13, 0.27, 0.27, 0.6, 0.8);\n b0=Fhn2DN.kr(3, 5, 0.29, 0.29, 0.5, 1.1, mul:0.23, add:0.25);\n b1=Fhn2DN.kr(2, 3, 0.25, 0.25, 0.2, 1.5, mul:0.48, add:0.5);\n sig=Fhn2DC.ar(110, 22050, TExpRand.kr(0.001, 0.3, trig1), TExpRand.kr(0.001, 0.3, trig2), b0, b1, mul:amp);\n Out.ar(0,Pan2.ar(sig, pan))\n}).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ArrayedCollection`."}, {"role": "assistant", "content": "```supercollider\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n pitches.size.do{ |i|\n {\n var freq = pitches[i].midicps;\n var env = Env.perc.ar(Done.freeSelf);\n SinOsc.ar(freq) * 0.1 * env\n }.play;\n 0.2.wait\n }\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `RedKCS.encodeStringAsSoundFile` do? What arguments does it take?"}, {"role": "assistant", "content": "convert a string into a sound file (render to Arguments: str — the string to be encoded.; path — a string specifying where to save the resulting sound file.. Returns: a Boolean indicating if creating the file was successful."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Re: winter is coming?"}, {"role": "assistant", "content": "```supercollider\n(\n{ \n Limiter.ar(\n Pan2.ar(\n LPF.ar(\n DynKlank.ar(\n `[\n Array.rand(5, 700, 2000), \n nil, \n Array.rand(5, 0.2, 5).collect({|freq|\n SinOsc.kr(freq).range(0.1,1)\n })\n ], \n Limiter.ar(\n Dust.ar( SinOsc.kr(1).range(1.5, 4), 0.45) \n + \n Impulse.ar( SinOsc.kr(0.03).range(0.5, 1.2) , 0, 0.9)\n )\n ),\n 1600,\n 0.6\n ),\n SinOsc.kr(0.01 + 4.rand, mul:0.5)\n )\n +\n Pan2.ar(\n DynKlank.ar(`[\n Array.rand(5, 700, 2000).collect({ |freq| SinOsc.kr( SinOsc.kr( SinOsc.kr(0.2).range(0, 10) ) ).range(100, freq) }),\n nil, \n Array.rand(5, 0.3, 1)\n ], PinkNoise.ar(0.006) ),\n Lag.kr(TRand.kr(-0.8, 0.8, Pulse.kr(2 + 10.rand)))\n )\n ) * LorenzL.ar(MouseX.kr(0, 230), add: 0.5, mul: 0.5)\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// check blockSize before (or reset blockSize in examples)\n\n(\nif (s.options.blockSize != 64) {\n s.options.blockSize = 64;\n s.quit.reboot;\n}\n);\n\n// With divisions we must avoid division by zero resp. blowup, here it's max in the divisor.\n// The example also establishes a cross-feedback of the two channels by using reverse.\n\ns.scope\n\n// start fb fx Synth\n\n(\n~bus = Bus.audio(s, 2);\n\ny = {\n var inSig = In.ar(~bus, 2);\n var lfo = LFDNoise3.ar(1).linexp(-1, 1, 0.2, 10);\n LPF.ar(\n Fb1({ |\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// check blockSize before (or reset blockSize in examples)\n\n(\nif (s.options.blockSize != 64) {\n s.options.blockSize = 64;\n s.quit.reboot;\n}\n);\n\n// With divisions we must avoid division by zero resp. blowup, here it's max in the divisor.\n// The example also establishes a cross-feedback of the two channels by using reverse.\n\ns.scope\n\n// start fb fx Synth\n\n(\n~bus = Bus.audio(s, 2);\n\ny = {\n var inSig = In.ar(~bus, 2);\n var lfo = LFDNoise3.ar(1).linexp(-1, 1, 0.2, 10);\n LPF.ar(\n Fb1({ |in, out|\n (in[1][0] * in[0][1] / max(0.001, (in[1][0] - out[1].reverse).abs)).tanh\n }, [inSig, lfo], 2, [2, 1], 2\n ), 15000) * 0.1\n}.play\n);\n\n// start source\n\nx = { Out.ar(~bus, SinOsc.ar(LFDNoise3.ar(0.1!2).range(100, 101)) * EnvGate.new) }.play\n\nx.release\n\n(\ny.free;\n~bus.free;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for muffled thump?"}, {"role": "assistant", "content": "```supercollider\n(\n{ var nse, env, kic;\n kic = tanh(Ringz.ar(LPF.ar(Trig.ar(Impulse.ar(1.0),SampleDur.ir),1000),30,0.25,7).sin*2);\n env = Env.perc(0.05, 1, 1, -4);\n nse = BrownNoise.ar(2) + PinkNoise.ar(0.5) * EnvGen.kr(env,Impulse.kr(1), doneAction: 2);\n\n nse = Mix.ar(BPF.ar(nse,[100,1200,80,40,20],MouseX.kr(0,1),[1,0.2,1,1,1]));\n nse = LPF.ar(nse + kic, MouseY.kr(100,1000))! 2\n\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Mx.insertChannel` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a channel at the index and add objects to Arguments: index; objects. Returns: MxChannel"}]} -{"conversations": [{"role": "user", "content": "What is `SynthDescLib` in SuperCollider?"}, {"role": "assistant", "content": "SynthDescLib — SynthDesc library See SynthDesc Category: Server > Nodes."}]} -{"conversations": [{"role": "user", "content": "What does `PdefGui.clear` do?"}, {"role": "assistant", "content": "(if the jitGui is in its own window) set the PdefGui's object to"}]} -{"conversations": [{"role": "user", "content": "What does `U.makeBundle` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: targets — (describe argument here); startPos — (describe argument here); synthAction — (describe argument here). Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "How do I pan notes around the stereo field in a pattern?"}, {"role": "assistant", "content": "Put `\\pan` in the Pbind: the default instrument understands it and passes it to Pan2.\n\n```supercollider\n(\nPbind(\n \\scale, Scale.minorPentatonic,\n \\degree, Pseq([0, 2, 4, 7, 9, 7, 4, 2], inf),\n \\dur, 0.2,\n \\pan, Pseq([-1, -0.5, 0, 0.5, 1, 0.5, 0, -0.5], inf),\n \\amp, 0.15\n).play;\n)\n```\n\nTo pan an arbitrary synth, add a `pan = 0` argument to the SynthDef and wrap the output in\n`Pan2.ar(sig, pan)`."}]} -{"conversations": [{"role": "user", "content": "What is `MxDocument` in SuperCollider?"}, {"role": "assistant", "content": "MxDocument — a wrapper for placing code Documents onto the Mx grid This is for adding code documents to an Mx. Category: Mx."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Periphonic (3D) decoder with eight channels arranged in a bi-rectangle:\n// [ [ 30, 0 ], [ -30, 0 ], [ 90, 35.3 ], [ -90, 35.3 ],\n// [ -150, -0 ], [ 150, -0 ], [ -90, -35.3 ], [ 90, -35.3 ] ]\n\n// specify 1/2 the desired directions\n~directions = [[ 30, 0 ], [ -30, 0 ], [ 90, 35.3 ], [ -90, 35.3]].degrad;\n~decoder = FoaDecoderMatrix.newDiametric(~directions;\n\n// inspect\n~decoder.dirChannels.raddeg\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Periphonic (3D) decoder with eight channels arranged in a bi-rectangle:\n// [ [ 30, 0 ], [ -30, 0 ], [ 90, 35.3 ], [ -90, 35.3 ],\n// [ -150, -0 ], [ 150, -0 ], [ -90, -35.3 ], [ 90, -35.3 ] ]\n\n// specify 1/2 the desired directions\n~directions = [[ 30, 0 ], [ -30, 0 ], [ 90, 35.3 ], [ -90, 35.3]].degrad;\n~decoder = FoaDecoderMatrix.newDiametric(~directions);\n\n// inspect\n~decoder.dirChannels.raddeg\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `FSinOsc`."}, {"role": "assistant", "content": "```supercollider\n{ FSinOsc.ar(800) * 0.2 }.play;\n\n{ FSinOsc.ar(XLine.kr(200, 4000, 1)) * 0.2 }.play;\n\n// loses amplitude towards the end\n{ FSinOsc.ar(FSinOsc.ar(XLine.kr(4, 401, 8), 0.0, 200, 800)) * 0.2 }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What is `AbstractGridLines` in SuperCollider?"}, {"role": "assistant", "content": "AbstractGridLines — Calculates the numerical values suitable for grid lines to be used for plotting or other UI elements. `AbstractGridLines` and its subclasses are strategy objects that find suitable intervals for plotting grid lines and labels. The data range and warping behavior (e.g. linear or exponential) are derived from the corresponding ControlSpec. The instance methods of `AbstractGridLines` are used by DrawGrid (which is in turn used by Plotter) for getting logically spaced intervals that span the data for Category: GUI > Accessories."}]} -{"conversations": [{"role": "user", "content": "What is `Diwhite` in SuperCollider?"}, {"role": "assistant", "content": "Diwhite — Demand rate white noise random generator. Category: UGens > Demand."}]} -{"conversations": [{"role": "user", "content": "What is `EaseGallery` in SuperCollider?"}, {"role": "assistant", "content": "EaseGallery — overview of easing equations Graphical overview. Run this line... `EaseGallery.new` Category: Ease."}]} -{"conversations": [{"role": "user", "content": "Explain `SerialPort` in SuperCollider briefly."}, {"role": "assistant", "content": "SerialPort — serial port interface Category: External Control."}]} -{"conversations": [{"role": "user", "content": "Why LeakDC and not a standard HPF for DC removal?"}, {"role": "assistant", "content": "SuperCollider forum — Why LeakDC and not a standard HPF for DC removal?\n\nHello everyone,\n\nI’m a bit sceptical of the DC removal implementation in LeakDC. As I understand it, DC removal is nothing but a HPF, preferably placed below the audible range. For this purpose, LeakDC seems to be reaching far too high, attenuating the audible low frequencies. You can run the following code and look at the server meter to see the difference in level between the two audio channels (note: there is of course no DC offset in this example that would need fixing):\n\n```supercollider\n( play { [\n SinOsc.ar(50),\n LeakDC.ar(SinOsc.ar(50))\n] * 0.2 } )\n```\n\nAlso, LeakDC’s behaviour is not consistent between sample rates (as is mentioned in the help file).\n\nI ran the it through Plugin Doctor to back up my suspicions and got these results:\n\nstandard coefficient of 0.995:\n\nSR 48 kHz: Filter starts rolling off at 200 Hz, -2dB at 50 Hz.\n\nSR 96 kHz: Filter starts rolling off at 500 hz! It reaches already -2dB at 100 Hz, -5 dB at 50 Hz.\n\ncoefficient of 0.999:\n\nSR 48 kHz: Filter starts rolling off at 50 Hz, -2 dB at 10 Hz.\n\nSR 96 kHz: Filter starts rolling off at 100 Hz, -2 dB at 20 Hz.\n\nI wonder why one wouldn’t just use a standard HPF at 10 Hz (or so) instead? It is consistent between sample rates, it only starts to roll of below 30 Hz and it reaches only -0.5 dB at 20 Hz. So this actually looks much better in the server meter:\n\n```supercollider\n( play { [\n SinOsc.ar(50),\n HPF.ar(SinOsc.ar(50), 10)\n] * 0.2 } )\n```\n\nSo my question is: Is there any reason why the LeakDC implementation would be peferable to such a standard butterworth HPF?\n\nOne difference I can see is that the HPF still has an initial offset spike before settling around zero phase, LeakDC does not show that behaviour:\n\n```supercollider\n{ LeakDC.ar(DC.ar(0.5)) }.plot(0.5);\n{ HPF.ar(DC.ar(0.5), 10) }.plot(0.5);\n\n{ LeakDC.ar(SinOsc.ar + DC.ar(0.5)) }.plot(0.02);\n{ HPF.ar(SinOsc.ar + DC.ar(0.5), 10) }.plot(0.02);\n```\n\nSo this could be a reason – I don’t know enough about filters to understand why this happens though. Any enlightenment would be appreciated."}]} -{"conversations": [{"role": "user", "content": "How do I distort a signal?"}, {"role": "assistant", "content": "Drive it into a nonlinearity, then tame the level: `tanh` is soft clipping, `.distort` is harder,\nand a low-pass after the drive keeps it from getting fizzy.\n\n```supercollider\n(\n{\n var sig = SinOsc.ar(110) * 0.3;\n var driven = (sig * 12).tanh;\n LPF.ar(driven, 5000) * 0.4\n}.play;\n)\n```\n\nMore drive means more harmonics; because they are generated, the output is louder as well as brighter, so\nscale the result down after the nonlinearity."}]} -{"conversations": [{"role": "user", "content": "Explain `MonitorGui` in SuperCollider briefly."}, {"role": "assistant", "content": "MonitorGui — display and control a Monitor MonitorGui displays the state of a NodeProxy's Monitor. It is used in NdefGui, ProxyMixer, and NdefMixer. Category: JITLib > GUI, Live Coding."}]} -{"conversations": [{"role": "user", "content": "What does `Fb1_ODEdef.reset` do?"}, {"role": "assistant", "content": "Removes all Fb1_ODEdefs other than the predefined ones from the"}]} -{"conversations": [{"role": "user", "content": "What is `MarkovSynth` in SuperCollider?"}, {"role": "assistant", "content": "MarkovSynth — First order Markov Chain implementation for audio signals MarkovSynth populates a sample to sample transition probability table with its signal input. Each possible sample value in an 16bit signal has its own transition probability table whose size is defined by the \"tableSize\" argument at creation time. It waits and populates the table for \"waitTime\" seconds and then starts synthesizing audio by continuously outputting a random value selected from the p Category: UGens > Generators > Stochastic."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes sound of an alien weapon firing."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"raygun\", {arg amp = 0.5, sinfreq = 1000, glissf = 0.001, att = 0.01, rel = 0.9;\n var gliss = XLine.kr(sinfreq, sinfreq*glissf, rel);\n var snd = SinOsc.ar(gliss);\n var env = EnvGen.kr(Env.perc(att, rel), doneAction: 2);\n snd = snd * env * amp;\n Out.ar(0, snd);\n}).add;\n);\n\n(\nPbind(\n \\instrument, \"raygun\",\n \\dur, Pseq([0.75,0.75,0.75,0.75,0.25,0.25,0.25]*0.5, inf),\n \\amp, 0.4\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Fb1_ODEintdef.reset` do?"}, {"role": "assistant", "content": "Removes all Fb1_ODEintdefs other than the predefined ones from the"}]} -{"conversations": [{"role": "user", "content": "What is `TaskProxyGui` in SuperCollider?"}, {"role": "assistant", "content": "TaskProxyGui — a superclass for Guis for PatternProxies Please see TdefGui and PdefGui for examples! Category: JITLib > GUI, Live Coding."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LinCongN`."}, {"role": "assistant", "content": "```supercollider\n// default initial params\n{ LinCongN.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `Fhn2DL` in SuperCollider briefly."}, {"role": "assistant", "content": "Fhn2DL — FitzHughNagumo Neuron Firing Oscillator `du/dt= rateu*(u-0.3333*u^3 - w)` Category: UGens > Generators > Stochastic."}]} -{"conversations": [{"role": "user", "content": "Saving \"Presets\"?"}, {"role": "assistant", "content": "SuperCollider forum — Saving \"Presets\"?\n\nIf you don’t care too much about it being human readable, just use writeArchive and readArchive:\n\n```supercollider\na = Array.fill(400, {rrand(0,2200)});\n\na.writeArchive(\"/Users/spluta1/Documents/SC/test\");\n\nb = Object.readArchive(\"/Users/spluta1/Documents/SC/test\");\n\nb.postln;\n```\n\nSam"}]} -{"conversations": [{"role": "user", "content": "What happens when I call .play on a function?"}, {"role": "assistant", "content": "`.play` on a Function builds a SynthDef from the function body, adds it to the server under an anonymous name, and starts one Synth of it. You get back the Synth, so `x = { SinOsc.ar(440) * 0.1 }.play; x.free;` stops it. It is the fastest way to hear something, but it is not how you write a piece: nothing is named, nothing can be reused, and the definition is lost when the Synth is freed."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n~x.play;\n\n~x = { var alpha,beta; alpha = rrand(99,399); beta = alpha = rrand(99,399);Pan2.ar(LeakDC.ar(Normalizer.ar(BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(\nFreeVerb.ar(Formant.ar(TRand.kr(alpha,alpha+(rrand(5,20)),Impulse.kr(rrand(10,100))), TRand.kr(beta,beta+(rrand(5,20)),Impulse.kr(rrand(10,100))), EnvGen.kr(Env.adsr,Impulse.kr(rrand(100,666)))*rrand(666,3333),0.125),\nrrand(0.5,1.0),rrand(0.5,1.0),rrand(0.5,1.0))\n,100,6.0,12),1000,6.0,0),5000,6.0,0),10000,6.0,12),0.6,0.1)),0)\n};\n```"}, {"role": "assistant", "content": "A drone insect-string from:\r\n\r\nhttp://musicnumbers.wordpress.com/2011/11/25/nx010/."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// start a noise patch and set the id of the generator\n(\nSynthDef(\"help-RandID\", { |out = 0, id = 1|\n RandID.ir(id);\n Out.ar(out,\n WhiteNoise.ar(0.05) + Dust2.ar(70)\n )\n}).add;\n);\n\n// reset the seed of my rgen at a variable rate\n(\nSynthDef(\"help-RandSeed\", { |seed = 1910, id = 1|\n RandID.kr(id);\n RandSeed.kr(Impulse.kr(FSinOsc.kr(0.2, 0, 10, 11)), seed);\n}).add;\n\n);\n\n// start two noise synths on left and right channel with a different randgen id\na = Synth(\"help-RandID\", [\\\n// …\n```"}, {"role": "assistant", "content": "start a noise patch and set the id of the generator reset the seed of my rgen at a variable rate (RandID: Set the synth's random generator ID.)"}]} -{"conversations": [{"role": "user", "content": "What is `List`?"}, {"role": "assistant", "content": "List — list of items of variable size"}, {"role": "user", "content": "What does `List.new` do?"}, {"role": "assistant", "content": "Creates a List with the initial capacity given by size."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// Create a new empty collections with size 3:\nx = Array.new(3);\ny = Array.new(3);\nz = List.new(3);\n\n// Try to add 7 items to the array and list.\n// If the array exceeds maxSize, it will only\n// grow to an internally specified max size.\n(\n7.do { |i|\n x.add(i);\n y = y.add(i); // reassign array y on each add\n z.add(i);\n};\n);\n\n// Attempt to access the 5th item:\nx.at(4); // -> nil (out of bounds)\ny.at(4); // -> 4\nz.at(4); // -> 4\n\n// x grew only to size 4\nx.postln; // -> [ 0, 1, 2, 3 ]\ny.postln; // -> [ 0, 1, 2, 3, 4, 5, 6 ]\nz.postln; // -> List[ 0, 1, 2, 3, 4, 5, 6 ]\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `OSCresponderNode`."}, {"role": "assistant", "content": "```supercollider\n// example: two SuperCollider apps communicating\n\n// application 1:\nn = NetAddr(\"127.0.0.1\", 57120); // the url should be the one of computer of app 2 (or nil)\n\no = OSCresponderNode(n, '/chat', { |t, r, msg| (\"time:\" + t).postln; msg[1].postln }).add;\n\n// application 2:\nm = NetAddr(\"127.0.0.1\", 57120); // the url should be the one of computer of app 1\nm.sendMsg(\"/chat\", \"Hello App 1\");\n\n// sending bundles (including timestamps)\n(\nm.sendBundle(2.0, [\"/chat\", \"Hello App 1\"], [\"/chat\", \"Hallo Wurld\"]);\nm.sendBundle(0.0, [\"/chat\", \"Hello App 1\"], [\"/chat\", \"Hallo Wurld\"]);\n);\n\n// end application 1:\no.remove;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LinPan2`."}, {"role": "assistant", "content": "```supercollider\n// hear the difference, LinPan having a slight drop in the middle (yeah, it's subtle)...\n{ LinPan2.ar(SinOsc.ar(440), Line.kr(-1, 1, 5)) }.play;\n\n// ... whereas Pan2 is more smooth\n{ Pan2.ar(SinOsc.ar(440), Line.kr(-1, 1, 5)) }.play;\n\n// other examples\n{ LinPan2.ar(PinkNoise.ar(0.4), FSinOsc.kr(2)) }.play;\n\n{ LinPan2.ar(FSinOsc.ar(800, 0, 0.1), FSinOsc.kr(3)) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\delay;\n~description = \"Simple delay line\";\n~channelLayout = \\mono;\n~function = {|in = 0, del = 0.5|\n DelayC.ar(in, 2, del);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "What does `KeyCodeResponder.at` do? What arguments does it take?"}, {"role": "assistant", "content": "register responder functions for keycode and modifier combinations Arguments: address."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// constant source, max deviation +/- 3\n// no repetition within 5 pitches\n\n(\n~in = 72;\n\np = Pbind(\n \\dur, 0.2,\n \\midinote, PLIdev(\\in, 5, -3, 3).trace(prefix: \"midi \"),\n).play;\n;\n\n// change source\n\n~in = 65\n\np.stop\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// constant source, max deviation +/- 3\n// no repetition within 5 pitches\n\n(\n~in = 72;\n\np = Pbind(\n \\dur, 0.2,\n \\midinote, PLIdev(\\in, 5, -3, 3).trace(prefix: \"midi \"),\n).play;\n);\n\n// change source\n\n~in = 65\n\np.stop\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// connect will connect to all midi in devices\n// if you need to specify one,\n// check the sources at: MIDIClient.sources\n// and connect using MIDIIn.connect( source_index )\nMIDIIn.connect;\n\n// show incoming control data\n~control = { arg src, chan, num, val; \n [chan,num,val].postln; \n};\n\nMIDIIn.addFuncTo(\\control, ~control);\n```"}, {"role": "assistant", "content": "Simple example showing how to listen for MIDI control messages."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Monzo function?"}, {"role": "assistant", "content": "```supercollider\n// https://en.xen.wiki/w/Monzo\n//Monzo notation of JI ratios is often used in combination with Vals for temperament theory. I wrote this not for temperament, but rather to use monzos as a possible alternative to otonality and utonality, espescially when sonifying streams that include negative numbers.\n\n(//function that takes a collection representing a monzo as an argument, and outputs the ratio it encodes\n~zo = {\n arg exponentCollection;\n var ratio = 1;\n exponentCollection.do({arg item, i; ratio = ratio * (i.nthPrime).pow(item);});\n ratio;\n};\n);\n\n//5-limit\n~zo.([-1, 1]); // 3/2\n~zo.([-2, 0, 1]); // 5/4\n~zo.([-3, 2]); // 9/8\n~zo.([-4, 4, -1]); // 81/80\n~zo.([-4, 4, -1]); // 81/80\n\n//7-limit\n~zo.([-2, 0, 0, 1]); // 7/4\n~zo.([-1, -1, 0, 1]); // 7/6\n~zo.([0, 0, -1, 1]); // 7/5\n\n//fractional monzos\n~zo.([-1/2, 3.3, 4, -5]); //sure\n//it might be fun to do monzo glissandos in different places?\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Ball`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var f, sf;\n sf = K2A.ar(MouseX.kr > 0.5) > 0;\n f = Ball.ar(sf, MouseY.kr(0.01, 20, 1), 0.01);\n f = f * 10 + 500;\n SinOsc.ar(f, 0, 0.2)\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n b = {|x,y|\n var arr = List[];\n case\n {y % x.size == 0} // condition 1\n {\n var per = y / x.size;\n x.size.do{|oo|\n var pp = 1,i = 1;\n arr.add( x[oo] );\n while({i < per},{\n arr.add(0);\n i = i+1;\n });\n }\n }\n {x.size % y == 0} // condition 2\n {\n var pp = x.size / y, i = 0, sz = x.size;\n while({i < sz},{\n if(i % pp == 0)\n { arr.add(x[i]) };\n i=i+1;\n });\n };\n arr\n };\n a = [1,1,1,1];\n c = b.value(a,16) \n // [ 1, 1, 1, 1 ]\n // becomes\n // [ 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 ]\n\n b.value(c,4); \n // [ 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 ]\n // becomes\n // [ 1, 1, 1, 1 ]\n)\n```"}, {"role": "assistant", "content": "useful for expanding or reducing arrays by 2^x.\r\nI would like to know if there is a more concise way to write this!\r\nAny suggestions?\r\n\r\n(duplicate post, sorry! forgot to log in!)."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nNdef(\\birdy, {arg freq=1500, amp=0.5, rate=10;\n var osc, son, convIn, rand;\n osc=LFCub;\n rand = LFNoise1.ar(rate);\n convIn=LinCongN.ar(rate);\n son = osc.ar(Convolution.ar(convIn,convIn));\n freq = Latch.kr(rand.range(0,1).round(0.1), rand) * freq;\n freq = osc.ar(osc.ar(rand)*rand.range(0,10)).range(freq, freq*3);\n son = Formlet.ar(son, freq, convIn.abs*0.1, rand.abs);\n son = Normalizer.ar(son, 0.9, 0.1) * convIn.abs * LFPulse.kr(LFPulse.kr(rand.abs), 0, rand.abs);\n son = son + GVerb.ar(son, 99, 2, mul: rand.range(0,0.3));\n son * amp\n}).play\n)\n```"}, {"role": "assistant", "content": "I just rewrote one of autocsi's tweets and came out with this which sounds like a digital bird of some kind:."}]} -{"conversations": [{"role": "user", "content": "What is `RedLFSR4BitStream` in SuperCollider?"}, {"role": "assistant", "content": "RedLFSR4BitStream — 4-bit linear feedback shift register 4-bit fibonacci LFSR. see https://en.wikipedia.org/wiki/Linear_feedback_shift_register Category: Red > redUGens."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Node`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n(\nx = SynthDef(\"help-node-set\", { |freq = 440, out = 0|\n Out.ar(out, SinOsc.ar(freq, 0, 0.1))\n}).play\n);\nx.run(false);\nx.run; // default is true\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = NodeProxy(s);\na.play;\na.source = { BPF.ar(Impulse.ar({ rrand(1.0, 2.0) } ! a.numChannels), (0..5).nthPrime * 300, 0.01) * 20 };\na.numChannels; // 2\na.mold(8;\na.numChannels; // 8\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = NodeProxy(s);\na.play;\na.source = { BPF.ar(Impulse.ar({ rrand(1.0, 2.0) } ! a.numChannels), (0..5).nthPrime * 300, 0.01) * 20 };\na.numChannels; // 2\na.mold(8);\na.numChannels; // 8\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// These examples compare the variants, so that you can hear the difference in interpolation\n\n// Comb used as a resonator. The resonant fundamental is equal to\n// reciprocal of the delay time.\n{ CombN.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ CombL.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ CombC.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// with negative feedback:\n{ CombN.ar(WhiteNoise.ar(0.01), 0\n// …\n```"}, {"role": "assistant", "content": "These examples compare the variants, so that you can hear the difference in interpolation Comb used as a resonator. The resonant fundamental is equal to (CombL: Comb delay line with linear interpolation.)"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BufSamples`."}, {"role": "assistant", "content": "```supercollider\n// example; this buffer is mono, so the number of samples matches the number of frames\nb = Buffer.read(s, ExampleFiles.child);\n\n// indexing with a phasor\n{ BufRd.ar(1, b, Phasor.ar(0, BufRateScale.kr(b), 0, BufSamples.kr(b))) }.play;\n\n// indexing by hand\n{ BufRd.ar(1, b, K2A.ar(MouseX.kr(0, BufSamples.kr(b)))) }.play;\n\nb.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Splay`?"}, {"role": "assistant", "content": "Splay — Splay spreads an array of channels across the stereo field"}, {"role": "user", "content": "What does `Splay.arFill` do?"}, {"role": "assistant", "content": "In analogy to Mix:arFill, this method takes a function that produces the channels. The counting index is passed to it."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// splay 10 chans of sound into 2\n(\nx = { |spread = 1, level = 0.2, center = 0.0|\n var numchans = 10;\n Splay.ar(\n SinOsc.ar({ |i| LFNoise2.kr(1).exprange(200, 4000) } ! numchans),\n spread,\n level,\n center\n // use levelComp default true\n );\n}.play;\n);\n\ns.meter;\ns.scope;\n\n// change settings dynamically:\n\nx.set(\\spread, 1, \\center, 0); // full stereo\nx.set(\\spread, 0.5, \\center, 0); // less wide\nx.set(\\spread, 0, \\center, 0); // mono center\nx.set(\\spread, 0.5, \\center, 0.5); // spread from center to right\nx.set(\\spread, 0, \\center, -1); // all left\nx.set(\\spread, 1, \\center, 0); // full stereo\n\n// A similar example written with arFill:\n(\nx = { |spread = 1, level = 0.2, center = 0.0|\n var numchans = 10;\n Splay.arFill(numchans,\n { |i| SinOsc.ar(LFNoise2.kr(rrand(10, 20), 200, i + 3 * 100)) },\n spread,\n level,\n center\n );\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Instr.test` do? What arguments does it take?"}, {"role": "assistant", "content": "creates a Patch, guis it and plays Arguments: ... args. Returns: a Patch"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for our first work and posting."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"pulse\",{ arg freq,delayTime,amp = 1.0,attack = 0.01;\n var out,out2,env;\n env = EnvGen.kr(Env.perc(attack, 1, 5, 10),doneAction: 2);\n z = SinOsc.ar(freq,0,0.7);\n a = Pan2.ar(ToggleFF.ar(TDelay.ar(z,delayTime)) * SinOsc.ar(freq),\n SinOsc.kr(3,0), 0.6);\n out = Pan2.ar(z, SinOsc.kr(5,1.0pi),0.7 ) + a;\n out = out * env;\n out = out.clip2(1);\n \n Out.ar(0,FreeVerb.ar(out,0.7,1.0,0.4, amp)); \n}).send(s);\n\nSynthDef(\"droneee\", { arg freq = 440, amp = 1.0, outbus = 0, phase = 0;\n var out, env;\n env = EnvGen.kr(Env.sine(10),doneAction: 2);\n out = LFPulse.ar(freq , 0.15);\n out = RLPF.ar(out,SinOsc.kr(0.3, 0, 200, 1500), 0.1);\n out = FreeVerb.ar(out, 0.5, 0.5, 0.5) * env;\n out = Pan2.ar(out, SinOsc.kr(1/10, phase),amp);\n \n Out.ar(outbus, out);\n}).send(s);\n\n\nSynthDef(\"bass\",{\n arg freq,amp,outbus=0;\n var env,out;\n out = SinOsc.ar(freq,0,amp);\n env = EnvGen.kr(Env.perc(0.5,1,1,0),doneAction: 2); \n out = out*env;\n out = Pan2.ar(out,0);\n Out.ar(outbus,out);\n \n \n}).send(s);\n);\n\n\n(\n\np = Prand( [31,40, 45,64,68,69], inf).asStream;\nq = Prand( [3,0.7,1,0.5], inf ).asStream;\ne = Prand([59,72,76,79,81,88,90],inf).asStream;\n\nt = Task({\n inf.do({\n \n if( 0.1.coin, {\n Synth(\"pulse\",\n [\\freq,e.value.midicps,\n \\amp,0.07.rand +0.2,\n \\attack,7.0.rand,\n \\delayTime, 0.02;\n ]);\n });\n\n\n Synth(\"droneee\",\n [\\outBus,0,\n \\freq, p.value.midicps,\n \\amp, (0.02.rand2 + 0.05) * 0.7,\n \\phase,[0,1.5pi].wchoose([0.5,0.5]);\n ]);\n q.value.wait;\n \n Synth(\"bass\",[\\freq,31.value.midicps,\\amp,0.3]);\n\n });\n});\n\nt.start;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Wow, the conciseness of SuperCollider is wonderful!."}, {"role": "assistant", "content": "```supercollider\n(\na=Array.fib(64,0,1);b=Array.fill(size:12,function:{arg i;a[i]%8});\np=1/8;Pdef(\\x,Pbind(\\dur,p,\\degree,Pseq(b,1,0)));\nr=Array.fill(12,{arg i;Pbindf(Pdef(\\x),\\mtranspose,b[i]);});\nPseq(r,(1/p)).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `Fb1_ODEintdef` in SuperCollider briefly."}, {"role": "assistant", "content": "Fb1_ODEintdef — container for ordinary differential equation numeric integrators For the optional definition of ODE integration procedures that can then be used with Fb1_ODE. This is an advanced feature, the built-in symplectic procedures should suffice for most use cases. See the source code in Fb1_ODEintdef.sc for the way integrators are defined and Fb1_ODE for general information about Fb1 ODE integrator UGens. Category: Libraries > miSCellaneous > Nonlinear."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nfork {\n p = ParGroup.new;\n loop {\n (\n degree: rrand(0.0, 12.0).round(1/4),\n group: p,\n db: rrand(-30, -25),\n pan: rrand(-1.0, 1.0)\n .play;\n 0.2.wait;\n }\n}\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nfork {\n p = ParGroup.new;\n loop {\n (\n degree: rrand(0.0, 12.0).round(1/4),\n group: p,\n db: rrand(-30, -25),\n pan: rrand(-1.0, 1.0)\n ).play;\n 0.2.wait;\n }\n}\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// The code below generates a series of test signals for each speaker of \n// the currently active setup. In the default settings this generates \n// short pink noise bursts, twice on each group of 8 speakers.\n\n(\nn = 8; // size of speaker groups\nz = 1/4; // duration per burst\nt = \\pinkNoise; // udef name for sound generation\nr = 2; // number of repeats per group\nx = UScore();\n\n(WFSSpeakerConf.default.speakerCount / n).ceil.do({ |i|\n var folder;\n folder = UScore( i * (r * (n + 1) * z) );\n x.add( folder );\n r.do({ |ii|\n n.do({ |iii|\n folder.add( UChain( ((ii * (n + 1)) + iii) * z, iii, z * (3/4), \n [ t, [ \\seed, 12345 ] ],\n [ \\wfsIndex, [ \\index, (i * 8) + iii, \\gain, 0 ] ]\n )\n );\n });\n });\n folder.name = ([1,n] + (i*8)).join(\"-\"); \n});\n\nx.gui;\n)\n```"}, {"role": "assistant", "content": "The code below generates a series of test signals for each speaker of the currently active setup. In the default settings this generates short pink noise bursts, twice on each group of 8 speakers."}]} -{"conversations": [{"role": "user", "content": "What does `KeyResponder.register` do? What arguments does it take?"}, {"role": "assistant", "content": "combines KeyCodeResponder and UnicodeResponder Arguments: key; shift; caps; opt; cntl; function; description."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes No Quarter pluck synth bass sound."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\bass, { |outbus, midinote = 42|\n var freq = midinote.midicps;\n var subfreq = freq / 2;\n \n // Envelopes\n var subenv = EnvGen.kr(Env.perc(0, 1), doneAction:2);\n var env = EnvGen.kr(Env.perc(0, 0.5));\n \n // Component synthesis\n var pluck = Pluck.ar(PinkNoise.ar, 1, 0.2, subfreq.reciprocal) * subenv * 2;\n var tri = VarSaw.ar(freq) * env;\n var sin = SinOsc.ar(freq) * env;\n var sub = (SinOsc.ar([subfreq, subfreq - 2, subfreq + 2]).sum * subenv).tanh;\n var click = RLPF.ar(Impulse.ar(0), [2000, 8000], 1).sum * 1000;\n \n // Initial signal\n var sig = pluck + tri + sub + click;\n \n // Resonant LPFs\n sig = RLPF.ar(sig, XLine.ar(freq * 100, freq * 10, 0.15));\n sig = sig + (MoogFF.ar(sig, freq * 20, 2.5) * 0.1);\n \n // EQ resulting signal\n sig = BPeakEQ.ar(sig, 400, 0.5, -9);\n sig = BPeakEQ.ar(sig, 2000, 0.5, 6);\n sig = BHiShelf.ar(sig, 8000, 1, 3);\n sig = BPeakEQ.ar(sig, 200, 1, 3);\n \n // Apply another envelope to dampen a bit more\n sig = sig * XLine.kr(1, 0.6, 0.1);\n \n // Tanh distortion / limiting\n sig = (sig * 1).tanh;\n \n // Another round of signal coloring, using another RLPF\n // and sine components\n sig = sig + RLPF.ar(sig, XLine.ar(freq * 100, freq * 10, 0.15)) + sin + sub;\n \n // Another round of tanh distortion / limiting\n sig = (sig / 2.3).tanh;\n \n // Another resonant LPF\n sig = MoogFF.ar(sig, XLine.ar(freq*150, freq*30, 0.1), 0.1);\n \n Out.ar(outbus, sig!2);\n}).add;\n);\n\n(\nTempoClock.default.tempo = 1.8;\n\nPbind(\n \\instrument, \\bass,\n \\midinote, Pseq([\n Pseq([Rest, 42, 42], 3),\n Pseq([Rest, 42, 42, 42]),\n Pseq([Rest, 42, 42], 3),\n Pseq([Rest, 45, 45, 42])\n ], inf),\n \\dur, Pseq([\n Pseq([0.75, 0.75, 0.5], 3),\n Pseq([0.5, 0.25, 0.75, 0.5])\n ], inf)\n).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `ServerLog.sendMsg` do? What arguments does it take?"}, {"role": "assistant", "content": "records OSC traffic to and from a Server and displays this in a browseable searchable interface Arguments: ... args. Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "What does `View.unminimize` do?"}, {"role": "assistant", "content": "If the view is a window, restores the its previous state after being"}]} -{"conversations": [{"role": "user", "content": "Explain `LPZ1` in SuperCollider briefly."}, {"role": "assistant", "content": "LPZ1 — Two point average filter A special case fixed filter. Implements the formula: `out(i) = 0.5 * (in(i) + in(i-1))` which is a two point averager. Category: UGens > Filters > Linear."}]} -{"conversations": [{"role": "user", "content": "How to generate paradiddles?"}, {"role": "assistant", "content": "SuperCollider forum — How to generate paradiddles?\n\nHi Rodet, I’m teaching jazz at college, and sometimes paradiddles come up in conversation (although I’m not a drummer). A paradiddle is basically a way of ‘evenly’ playing a roll (single/double/triple/whatever). If you take your drumsticks/fingers and play evenly:\n\nright, left, right, right, left, right, left, left, right, left, right, right, etc\n\nyou’ll notice that it’s possible to get an even rhythm, which when played fast becomes a roll. The idea of the single/double/triple is just to place the accents (lightly, or not) on the left, right hand, which if I understand helps keep an even stroke (and makes better sense to follow).\n\nSo, although I don’t know the goal of your idea, a simple code which would give you the solution could be a pattern. You’ll notice I’ve put in a SynthDef to give the ‘snare’ sound - not very real, but just for the demonstration. If you run these patterns, un-commenting the line needed (single, double or triple - don’t forget to comment out the lines you don’t need), you’ll hear the accents a paradiddle gives.\n\nIn this example Pbind ‘a’ gives the pulse, and Pbind ‘b’ the accents. And, if you play along with them (using your chart), you’ll notice the accents pass from right hand to left hand (or vice versa). This is (more or less) what paradiddles do, although a drummer will explain better how they ‘accent’ strokes to get more complicated/subtle rhythms.\n\n```supercollider\n(\nSynthDef(\\snare, {\n arg out=0, sus=0.1;\n var sig, env;\n sig = WhiteNoise.ar(0.1);\n env = EnvGen.kr(Env.perc(0.001, sus), doneAction:2);\n sig = sig*env;\n Out.ar(out, sig!2);\n}).add;\n);\n\n(\nt=TempoClock(80/60);\na=Pbind(\n \\instrument, \\snare,\n \\dur, 1/2,\n \\sus, 0.01\n);\nb=Pbind(\n \\instrument, \\snare,\n \\dur, 1,\n \\sus, Pseq([0.02, 0.01],inf), // single\n //\\sus, Pseq([0.02, 0.01, 0.01],inf), // double\n //\\sus, Pseq([0.02, 0.01, 0.01, 0.01],inf), // triple\n);\nPpar([a, b]).play(t);\n)\n```\n\nI hope that puts you on the right track.\n\np.s. Don’t forget to try out changing the speed to get the real effect. Try something like 320/60 on the TempoClock."}]} -{"conversations": [{"role": "user", "content": "When should I use a Pattern instead of writing Synth code by hand?"}, {"role": "assistant", "content": "Use a Pattern when what you want to express is a sequence over time — notes, durations, amplitudes, parameters — rather than a signal. A Pbind describes events, and `.play` turns each event into a Synth (by default of the \\default instrument, or of \\instrument if you name one). Hand-written Synth code is for the sound itself; Patterns are for what plays when. The two compose: a SynthDef named \\bell is triggered from `Pbind(\\instrument, \\bell, ...)`."}]} -{"conversations": [{"role": "user", "content": "What does `PLFNoise2.new` do? What arguments does it take?"}, {"role": "assistant", "content": "UGenPatterns quark library Arguments: freq; mul; add; length — Number of values produced.."}]} -{"conversations": [{"role": "user", "content": "What does `ArrayMax.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "detect the largest value (and its position) in an array of UGens Arguments: array. Returns: # val, index"}]} -{"conversations": [{"role": "user", "content": "What is `Buffer`?"}, {"role": "assistant", "content": "Buffer — Client-side representation of a buffer on a server"}, {"role": "user", "content": "What does `Buffer.alloc` do?"}, {"role": "assistant", "content": "Create and return a Buffer and immediately allocate the required memory on the server. The buffer's values will be initialised to 0.0."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n// allocate an array of Buffers and fill them with different harmonics\n(\nb = Buffer.allocConsecutive(8, s, 4096, 1, { |buf, i|\n buf.sine1Msg((1 .. ((i + 1) * 6)).reciprocal) // completion messages\n});\n\na = { VOsc.ar(SinOsc.kr(0.5, 0).range(b.first.bufnum + 0.1, b.last.bufnum - 0.1),\n [440, 441], 0, 0.2) }.play;\n);\na.free;\n\n// iterate over the array and free it\nb.do(_.free);\n```"}]} -{"conversations": [{"role": "user", "content": "What is `SequenceableCollection`?"}, {"role": "assistant", "content": "SequenceableCollection — Abstract superclass of indexable collections"}, {"role": "user", "content": "What does `SequenceableCollection.series` do?"}, {"role": "assistant", "content": "Fill a SequenceableCollection with an arithmetic series. `Array.series(5, 10, 2);`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// using numbers as score\n[3, [1, 2, 1], 1].convertRhythm; // List[0.75, 1.5, 0.75]\n[2, [1, 3, [1, [2, 1, 1, 1]], 1, 3], 1].convertRhythm;\n[2, [1, [1, [2, 1, 1, 1]]], 1].convertRhythm;\n[2, [1, [1, [2, 1, 1, 1]]], 2].convertRhythm; // repeat\n[2, [1, [1, [2, 1, 1, -1]]], 2].convertRhythm; // negative value is tied over.\n\n// sound example\nPbind(\\degree, Pseries(0, 1, inf), \\dur, Pseq([2, [1, [1, [2, 1, 1, -1]]], 2].convertRhythm)).play;\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Entities (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\ota, { arg freq=200, pan=0, amp=0.1;\n var sig;\n var env1, env2, env3, env4, env5, env6, env7, env8;\n var sig1, sig2, sig3, sig4, sig5, sig6, sig7, sig8;\n var fac = 1/SelectX.kr( SinOsc.kr(1/113).range(0,6), [1/2,1,2,4,8,64,128] )/8;\n env1 = EnvGen.ar(Env([42,21,42,30,84],[4,4,7.5,0.5]/fac).circle, 1);\n env2 = EnvGen.kr(Env([0,0,2,1],[4,4,4]).circle, 1);\n env3 = XLine.kr(1,0.1,20*1);\n\n freq = 8.collect({ arg x;\n freq + ( env1 * x ) + [0,SinOsc.kr(x+1, mul:env2).range(0,10*x)];\n });\n //freq.debug.shape.debug(\"freq\");\n sig = SinOsc.ar( freq / [1,2,4]);\n //sig.shape.debug(\"sig1\");\n sig = sig.collect({ arg isig, x;\n isig = SelectX.ar( SinOsc.kr(x+1/34).range(0,1), [isig, isig.fold2(env3)]);\n isig = SelectX.ar( SinOsc.kr(1/223, 3pi/2).range(0,1), [isig, ( isig * SinOsc.kr(1/48 * ( x + 1 )).range(1,100) ).tanh]);\n });\n //sig.shape.debug(\"sig2\");\n sig1 = sig.flop[1];\n sig = sig.flop[0];\n //sig.debug(\"sig\");\n sig1 = Pan2.ar(sig1, SinOsc.ar(sig1.size.collect({ arg x; SinOsc.kr(x/10+1.2).range(0,8) })) * SinOsc.kr(1/48).range(0,1), amp).mean;\n sig = Pan2.ar(sig, SinOsc.ar(sig.size.collect({ arg x; SinOsc.kr(x/10+1.1).range(0,8) })) * SinOsc.kr(1/58).range(0,1), amp).mean;\n sig = sig + sig1;\n sig = sig / 2.0;\n sig = LPF.ar(sig, 1999);\n sig;\n}).play;\n);\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\na = { |tempo = 1| Ringz.ar(Impulse.ar(tempo), [501, 500], 1/tempo) }.play;\nt = TempoBusClock(a);\nTask { loop { \"klink\".postln; 1.wait } }.play(t);\n);\n\nt.tempo = 1.3;\nt.tempo = 0.5;\nt.tempo = 1.0;\n\n\n// in ProxySpace, a TempoBusClock can be added together with a ~tempo NodeProxy:\n\np = ProxySpace.push(s);\np.makeTempoClock;\np.clock; // now the ProxySpace's clock is a TempoBusClock\n\n~out.play;\n~out = { Ringz.ar(Impulse\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\na = { |tempo = 1| Ringz.ar(Impulse.ar(tempo), [501, 500], 1/tempo) }.play;\nt = TempoBusClock(a);\nTask { loop { \"klink\".postln; 1.wait } }.play(t);\n);\n\nt.tempo = 1.3;\nt.tempo = 0.5;\nt.tempo = 1.0;\n\n\n// in ProxySpace, a TempoBusClock can be added together with a ~tempo NodeProxy:\n\np = ProxySpace.push(s);\np.makeTempoClock;\np.clock; // now the ProxySpace's clock is a TempoBusClock\n\n~out.play;\n~out = { Ringz.ar(Impulse.ar(~tempo.kr), [501, 500], 1/~tempo.kr) * 0.3 };\np.clock.tempo = 1.3;\n\n// patterns and tasks are synchronized:\n\n~out2.play;\n~out2 = Pbind(\\dur, 1, \\note, Pwhite(0, 7, inf));\n\np.clock.tempo = 3;\np.clock.tempo = 1;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Those were the times."}, {"role": "assistant", "content": "```supercollider\n(\ns.waitForBoot({\n\n SynthDef(\\singer, {\n | out=0, freq=440, amp=0.5, vibrato=6|\n var lfo, lfo2, lfo3, sig;\n lfo = SinOsc.kr(1/5, 0).range(250,1000);\n lfo2 = SinOsc.kr(1/5, 0).range(0.1,0.9);\n lfo3 = SinOsc.kr(vibrato).range(0.3, 1);\n sig = lfo3*RLPF.ar(in:VarSaw.ar(freq:Lag.ar(in:K2A.ar(freq), lagTime:0.3), iphase:0, width:lfo2, mul:amp), freq:lfo, rq:200/lfo);\n Out.ar(out, sig!2);\n }).add;\n\n s.sync;\n\n Pdef.defaultQuant_(0);\n Pdef(\\bass, Pmono(\\default, \\dur, Pwhite(0.01, 0.1, inf), \\freq, (Pgbrown(1,8,5) * 20).round(10), \\amp, Pbrown(0.2,0.6,0.05)));\n Pdef(\\computer, Pmono(\\default, \\dur, Pwhite(0.01, 0.1, inf), \\freq, (Pgbrown(1,8,9) * 100).round(20), \\amp, Pbrown(0.2,0.6,0.05)));\n Pdef(\\soprano, Pmono(\\singer, \\dur, Pwhite(0.01, 0.1, inf), \\freq, Pgbrown(1,8,0.05) * 200, \\amp, Pbrown(0.2,0.6,0.05)/5, \\vibrato, Pbrown(4,7,0.125)));\n Pdef(\\soprano2, Pmono(\\singer, \\dur, Pwhite(0.01, 0.1, inf), \\freq, Pbrown(3,6,0.1) * 100, \\amp, Pbrown(0.2,0.6,0.05)/5, \\vibrato, Pbrown(3,8,0.125)));\n\n fork {\n Pdef(\\bass).play;\n 10.wait;\n Pdef(\\computer).play;\n 10.wait;\n Pdef(\\soprano).play;\n 10.wait;\n Pdef(\\soprano2).play;\n 10.wait;\n Pdef(\\computer).stop;\n 20.wait;\n Pdef(\\bass).stop;\n 10.wait;\n Pdef(\\soprano).stop;\n Pdef(\\soprano2).stop;\n Pdef(\\bass).play;\n Pdef(\\soprano).play;\n 10.wait;\n Pdef(\\soprano2).play;\n 10.wait;\n Pdef(\\computer).play;\n 20.wait;\n Pdef(\\bass).stop;\n Pdef(\\computer).stop;\n Pdef(\\soprano).stop;\n Pdef(\\soprano2).stop;\n }\n\n});\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `IEnvGen`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var env = Env([0, 0.6, 0.3, 1.0, 0], [0.1, 0.02, 0.4, 1.1], [\\lin, \\exp, -6, \\sin]);\n var envgen = IEnvGen.kr(env, MouseX.kr(0, env.times.sum));\n env.plot;\n SinOsc.ar(envgen * 500 + 440)\n}.play;\n);\n\n// index with an SinOsc ... mouse controls amplitude of SinOsc\n// use offset so negative values of SinOsc will map into the Env\n(\n{\n var sin = SinOsc.ar(440, 0, MouseX.kr(0, 1));\n // use offset so negative values of SinOsc will map into the Env\n var env = Env([-1, -0.7, 0.7, 1], [0.8666, 0.2666, 0.8668], \\lin, offset: -1.0);\n IEnvGen.ar(env, sin) * 0.1\n}.play;\n);\n\n// index with Amplitude of input, control freq of SinOsc (uses SoundIn)\n(\n{\n var point = Amplitude.ar(SoundIn.ar(0), 0.01, 0.2);\n // use offset so negative values of SinOsc will map into the Env\n var env = Env.xyc([[0, 330, \\exp], [0.5, 440, \\exp], [1.0, 1760]]);\n SinOsc.ar(IEnvGen.kr(env, point)) * 0.2\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `OSCresponderNode`."}, {"role": "assistant", "content": "```supercollider\n// same as above, but we set the address to nil so we can receive from anywhere\n// no need for a NetAddr since we are just listening (and not sending)\n\no = OSCresponderNode(nil, '/test', { |t, r, msg| msg.postln }).add;\no.remove;\n```"}]} -{"conversations": [{"role": "user", "content": "How big are you?"}, {"role": "assistant", "content": "198M parameters in total, 64M active per token because the feed-forward layers are a mixture of four experts with top-1 routing. That is small enough to train in minutes on one GPU."}]} -{"conversations": [{"role": "user", "content": "How do I pan notes around the stereo field in a pattern?"}, {"role": "assistant", "content": "Put `\\pan` in the Pbind: the default instrument understands it and passes it to Pan2.\n\n```supercollider\n(\nPbind(\n \\scale, Scale.minorPentatonic,\n \\degree, Pseq([0, 2, 4, 7, 9, 7, 4, 2], inf),\n \\dur, 0.2,\n \\pan, Pseq([-1, -0.5, 0, 0.5, 1, 0.5, 0, -0.5], inf),\n \\amp, 0.15\n).play;\n)\n```\n\nTo pan an arbitrary synth, add a `pan = 0` argument to the SynthDef and wrap the output in\n`Pan2.ar(sig, pan)`."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes BD with ringing BPF."}, {"role": "assistant", "content": "```supercollider\n// BD with ringing BPF\n\n(\nSynthDef.new(\\bazedrum,\n {\n arg out = 0, outlevel=0.5, freq = 50, wet=0.5, q = 220, clicklevel =0, decaytrig = 0.1,\n decayfreq = 0.21, mulfreq =2 , decayamp = 1, dist = 17;\n\n var envtrig, envfreq, envamp, trigger,click, sig;\n\n envtrig = EnvGen.ar(Env.perc(1/10**5, decaytrig, 1, -9));\n envfreq = EnvGen.kr(Env.perc(0.003, decayfreq, mulfreq, -5));\n envamp = EnvGen.kr(Env.perc(0.003, decayamp,1, 2),doneAction:2);\n freq = freq * (1 + envfreq);\n trigger = envtrig*HPF.ar(PinkNoise.ar,40)+(envtrig*2);\n click = HPF.ar(envtrig*WhiteNoise.ar,2000*(1-envtrig),clicklevel);\n sig = BPF.ar(trigger, freq,1/q, sqrt(q)*5);\n sig = sig + click;\n\n sig = LeakDC.ar(sig* envamp,0.996);\n\n sig = Balance2.ar(sig,(sig*dist).tanh/3,(wet*2)-1);\n\n sig = Mix.ar(sig/2)*outlevel;\n\n out = 0;\n Out.ar(out, sig!2);\n }\n ).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pfset`."}, {"role": "assistant", "content": "```supercollider\n(\nvar a, b;\na = Pfset({\n ~legato = 0.3;\n ~detune = rrand(0, 30);\n}, Pbind(\\dur, 0.5));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for SOUND 1, from orig Influx Example."}, {"role": "assistant", "content": "```supercollider\n// SOUND 1, from orig Influx Example\n(\n// // // if JITLibExtensions are used, you can make space local:\n// Ndef(\\dog).addSpec(\\intv, [-24, 24]);\n// Ndef(\\dog).addSpec(\\timescale, [0.01, 10, \\exp]);\n// Ndef(\\dog).addSpec(\\curve, [-10, 10]);\n// Ndef(\\dog).addSpec(\\ffreq, \\freq);\n//\n// Ndef(\\dog).addSpec(\\loopnode, [0, 12]);\n// Ndef(\\dog).addSpec(\\dens, [10, 1000, \\exp]);\n// Ndef(\\dog).addSpec(\\resfreq, \\freq);\n// Ndef(\\dog).addSpec(\\ringtime, [0.01, 1, \\exp]);\n\nSpec.add(\\intv, [-24, 24]);\nSpec.add(\\timescale, [0.01, 10, \\exp]);\nSpec.add(\\curve, [-10, 10]);\nSpec.add(\\ffreq, \\freq);\n\nSpec.add(\\loopnode, [0, 12]);\nSpec.add(\\dens, [10, 1000, \\exp]);\nSpec.add(\\resfreq, \\freq);\nSpec.add(\\ringtime, [0.01, 1, \\exp]);\n\n\nNdef(\\dog, { |amp=0, freq=250, intv=19, timescale=1, curve=0, loopnode=0, dens = 10, resfreq = 500, ringtime = 0.01|\n var n = 15;\n var env = EnvGen.kr(\n Env({ 1.0.rand2 }!(n+1), {1.0.rand}!n, curve, releaseNode: n-1, loopNode: loopnode.min(n-3)),\n timeScale: timescale);\n var pitch = (env * [1, 0.33, -1] * intv).midiratio * freq;\n var form = Formant.ar(pitch, pitch.rotate(1) * 1.6, pitch.rotate(2) * 2.6);\n\n var dusty = Ringz.ar(\n Dust.ar(dens!3),\n resfreq * LFNoise0.kr([3, 5, 7], 0.5, 1),\n ringtime)\n * ((dens ** -0.5) * (ringtime ** -0.3)\n );\n\n Splay.ar(form * dusty, level: amp) ;\n});\n);\n\nNdef(\\dog).set(\\amp, 0.2).vol_(0.2);\nNdef(\\dog).gui.moveTo(400, 380);\n\n/*\n// Ndef(\\dog).addHalo(\\orderedNames, Ndef(\\dog).controlKeys);\nNdef(\\dog).controlKeys;\nNdef(\\dog).vol_(0.5);\nNdefPreset( Ndef(\\dog) ).loadSettings;\nNdef(\\dog).play;\nNdef(\\dog).gui;\n*/\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\FuMaIn;\n~description = \"A live ambisonic input (ACN_FuMa)\";\n~channelLayout = \\ambi;\n\n~function = { |order = 1, t_trig = 0, bus = 0|\n var env = EnvGen.kr(Env([0,1], [1]), t_trig);\n var chans = Array.series(\n size: (order + 1).pow(2).asInteger,\n start: bus,\n step: 1\n );\n var input = SoundIn.ar(chans, env);\n HOAConverterFuma2AcnN3d.ar(order, input);\n}\n```"}, {"role": "assistant", "content": "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see ."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n(\nx = {\n |loDev = -6, hiDev = 5, lookBack = 2|\n var trig = Impulse.ar(5);\n // define maxLookBack, minLoDev and maxHiDev\n var midi = Demand.ar(trig, 0, DIdev(72, 11, -6, 5, lookBack, loDev, hiDev));\n midi.poll(5, label: \\midi);\n SinOsc.ar(midi.midicps.lag(0.007)) ! 2 * 0.1\n}.play;\n);\n\n\n// as lookBack equals 2, this defines a fixed sequence (up or down anyway)\n\n(\nx.set(\\loDev, -1);\nx.set(\\hiDev, 1)\n);\n\n\n// widen range\n// …\n```"}, {"role": "assistant", "content": "define maxLookBack, minLoDev and maxHiDev as lookBack equals 2, this defines a fixed sequence (up or down anyway) (DIdev: pseudo drate ugen, searches for numbers with integer distance from a source signal, optionally avoiding repetitions within a span)"}]} -{"conversations": [{"role": "user", "content": "Write a bell in SuperCollider."}, {"role": "assistant", "content": "A bell is a set of inharmonic partials with a long percussive decay. The ratios below are the\nclassic bell ones; the envelope frees the Synth when it ends.\n\n```supercollider\n(\nSynthDef(\\bell, { |out = 0, freq = 440, amp = 0.2, dur = 3|\n var partials = [1, 2.76, 5.4, 8.93];\n var amps = [1, 0.5, 0.3, 0.15];\n var sig = SinOsc.ar(freq * partials) * amps;\n var env = EnvGen.kr(Env.perc(0.001, dur, 1, -6), doneAction: 2);\n Out.ar(out, Pan2.ar(Mix(sig) * env * amp, 0));\n}).add;\n);\nSynth(\\bell, [\\freq, 660, \\dur, 4]);\n```"}]} -{"conversations": [{"role": "user", "content": "I get 'FAILURE IN SERVER /s_new SynthDef not found'. What is wrong?"}, {"role": "assistant", "content": "The server does not know that SynthDef. Three usual causes, in order of likelihood:\n\n1. **The SynthDef was added before the server booted.** `SynthDef(...).add` is asynchronous; wrap the work\n in `s.waitForBoot { ... }` or put `s.sync` after `.add`.\n2. **The name does not match.** `SynthDef(\\bell, ...)` is played by `Synth(\\bell)`, not `\\Bell` — symbols\n are case-sensitive.\n3. **`.add` was never called.** Writing `SynthDef(\\bell, { ... })` without `.add` builds the definition in\n the language and sends nothing.\n\nCheck with `SynthDescLib.global.dict.keys` — if the name is not there, it never reached the server."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Normalizer`."}, {"role": "assistant", "content": "```supercollider\n(\n// example signal to process\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n z * 0.8\n}.play\n);\n\n(\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n [z, Normalizer.ar(z, 0.4, 0.01)] * 0.5\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Main`."}, {"role": "assistant", "content": "```supercollider\nShutDown.add({ \"Good bye!!\".postln });\n```"}]} -{"conversations": [{"role": "user", "content": "What does `MxUnit.parentEnvir` do? What arguments does it take?"}, {"role": "assistant", "content": "Container for a musical object (Instr, NDef, Spline etc); this is a single unit that has inlets and outlets which can be connected to other units Arguments: env."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nRoutine({ ... }).play(quant: 4.0\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nRoutine({ ... }).play(quant: 4.0)\n```"}]} -{"conversations": [{"role": "user", "content": "I get 'Message not understood' on a nil variable."}, {"role": "assistant", "content": "`~buffer` (or any variable) was never assigned, or it was assigned in a different environment. Environment variables are per-environment: a `~buf` set in one server-side file block is not visible in another. Check with `~buf.postln` before using it. The other common cause is an assignment that failed silently, e.g. `~buf = Buffer.read(...)` where the file was missing — the error is posted but ~buf stays nil."}]} -{"conversations": [{"role": "user", "content": "What does `Instr.spawnEvent` do? What arguments does it take?"}, {"role": "assistant", "content": "sets the Event 'type' = 'instr' and 'instr' = this and then .plays the Arguments: event."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n b = {|x,y|\n var arr = List[];\n case\n {y % x.size == 0} // condition 1\n {\n var per = y / x.size;\n x.size.do{|oo|\n var pp = 1,i = 1;\n arr.add( x[oo] );\n while({i < per},{\n arr.add(0);\n i = i+1;\n });\n }\n }\n {x.size % y == 0} // condition 2\n {\n var pp = x.size / y, i = 0, sz = x.size;\n while({i < sz},{\n if(i % pp == 0)\n { arr.add(x[i]) };\n i=i+1;\n });\n };\n arr\n };\n a = [1,1,1,1];\n c = b.value(a,16) \n // [ 1, 1, 1, 1 ]\n // becomes\n // [ 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 ]\n\n b.value(c,4); \n // [ 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 ]\n // becomes\n // [ 1, 1, 1, 1 ]\n)\n```"}, {"role": "assistant", "content": "useful for expanding or reducing arrays by 2^x.\r\nI would like to know if there is a more concise way to write this!\r\nAny suggestions?\r\n\r\n(duplicate post, sorry! forgot to log in!)."}]} -{"conversations": [{"role": "user", "content": "Explain `OutputProxy` in SuperCollider briefly."}, {"role": "assistant", "content": "OutputProxy — Place holder for multiple outputs OutputProxy is used by some UGens as a place holder for multiple outputs. There is no reason for a user to create an OutputProxy directly. Category: UGens > Base."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `EnvGen`."}, {"role": "assistant", "content": "```supercollider\n// as amplitude envelope\n(\n{\n var env = Env([0, 1, 0.5, 1, 0], [0.01, 0.5, 0.02, 0.5]);\n SinOsc.ar(470) * EnvGen.kr(env, doneAction: Done.freeSelf)\n}.play\n);\n\n// as amplitude and modulation envelope\n(\n{\n var env = Env([0, 1, 0.5, 0.8, 0, 1.2, 0], [0.01, 0.5, 0.02, 0.5, 0.2, 0.5]);\n var gate = Impulse.kr(MouseX.kr(0.2, 3), 0.5);\n var gen = EnvGen.kr(env, gate);\n SinOsc.ar(270, SinOsc.ar(gen * 473)) * gen * 0.2\n}.play\n);\n// EnvGen multichannel expands when passed a multichannel envelope\n(\n{\n SinOsc.ar(\n EnvGen.kr(\n Env.circle([0, 1, 0, (2..4), 0, LFNoise1.kr(0.1 ! 5) * 10, 0], [0.01, 0.6])\n )\n * 240 + 300\n ).sum * 0.2\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// Kabelscahden \n// by Alberto de Campo and Julian Rohrhuber, 3/2003\n// licenced under creative commons Attribution-ShareAlike 2.5\n\n\n(\n{\n var h, n, m, k, trig;\n trig = Dust.kr( 7 ** LFNoise1.kr(0.3) );\n h = ToggleFF.kr(CoinGate.kr(0.4,trig)) *\n RLPF.ar(LFPulse.ar(50, 0, 0.5, 1, LFNoise1.kr(2, 0.5, -0.5)), 6000, 0.15);\n n = Trig.ar(trig, TRand.kr(0, 0.01, CoinGate.kr(0.4,trig))) * WhiteNoise.ar;\n m = Trig.ar(trig, TRand.kr(0, 0.01, CoinGate.kr(0.4,trig))) * BrownNoise.ar;\n k = Trig.ar(trig, LFNoise1.kr([ 4, 4.2 ], 0.1, 0.11)) *\n LFClipNoise.ar(LFNoise0.kr(7, 30, 40));\n LeakDC.ar(h + n + k + m * 10).distort;\n}.play;\n);\n\nhttps://swiki.hfbk-hamburg.de/MusicTechnology/851\n```"}, {"role": "assistant", "content": "Kabelscahden Guitar Cable Hum Buzz Noise Cable damage - Repost (a SuperCollider snippet)."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Basic tone simulator of a stylophone?"}, {"role": "assistant", "content": "```supercollider\n/*\nRetro Stylophone\n\nReverse engineered from: https://www.waitingforfriday.com/?p=334\n\n1. Relaxation oscillator (UJT)\n\n- generated by a combination of two oscillators. The primary oscillator is a\n current controlled PUT (Programmable Uni-Junction Transistor) relaxation oscillator which is\n responsible for generating the overall tone of the instrument.\n A secondary LFO phase-shifted provides the vibrato\n (the relative slow wavering of a sound around the notes centre pitch)\n\n- around 10 VPP\n\n2. LFO phase-shift (vibrato)\n\n- generated by a low-frequency oscillator made with a transistor and several capacitors,\n which produces a triangle/sine wave fed into the frequency control voltage operating the UJT\n\n- frequency of about 8.5Hz, phased shifted of 180 degree, around 4.2 VPP\n*/\n\n(\nSynthDef(\\stylophone, { |freq = 220, vibAmp = 2, toneAmp = 5, atkTime = 0.01, trigger = 0|\n\n var lfo = OnePole.kr(LFPar.kr(8, mul: vibAmp, add: freq), 0.9); // 180 degree inversion\n var relaxOsc = LFPulse.ar(lfo, width: 0.9, mul: toneAmp);\n\n var asr = EnvGen.kr(Env.asr(atkTime * 5, releaseTime: 0.001, curve: \\lin), gate: trigger);\n\n Out.ar(0, relaxOsc * asr)\n}).add\n);\n\nf = Synth(\\stylophone);\n\nf.set(\\freq, 208.2);\nf.set(\\freq, 233.4);\n\nf.set(\\trigger, 1);\nf.set(\\trigger, 0);\nf.free;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n(\np = Pbind(\n \\freq, 50 * PLwrand(\\a, \\w),\n \\dur, 0.01,\n \\amp, 0.02\n);\n\n// prepare (current) Environment\n// give low overtones more weight\n\n~a = (1..8);\n~w = (8..1).cubed.normalizeSum;\n);\n\nx = p.play;\n\n\n// reverse overtone weights\n\n~w = (1..8).cubed.normalizeSum;\n\n\n// replace with Pattern for weights,\n// PLseq taken as repeats defaults to inf\n\n~w = Pstutter(50, PLseq([(8..1), (1..8)].collect\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n(\np = Pbind(\n \\freq, 50 * PLwrand(\\a, \\w),\n \\dur, 0.01,\n \\amp, 0.02\n);\n\n// prepare (current) Environment\n// give low overtones more weight\n\n~a = (1..8);\n~w = (8..1).cubed.normalizeSum;\n);\n\nx = p.play;\n\n\n// reverse overtone weights\n\n~w = (1..8).cubed.normalizeSum;\n\n\n// replace with Pattern for weights,\n// PLseq taken as repeats defaults to inf\n\n~w = Pstutter(50, PLseq([(8..1), (1..8)].collect { |x| x.cubed.normalizeSum }));\n\n\n// replace arrays (must be sufficiently long)\n\n~a = (3..10);\n~a = (5..12);\n\n~a = (1,3..15);\n~a = (1,4..22);\n~a = (1,5..29);\n~a = (1,6..36);\n~a = (2,7..37);\n~a = (3,8..38);\n~a = (4,9..39);\n~a = (5,10..40);\n\nx.stop;\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Just a dirty FM bass shuffling?"}, {"role": "assistant", "content": "```supercollider\n(\nfork{\n SynthDef(\\basicFM, {|out = 0, gate = 1, amp = 1, carFreq = 1000, modFreq = 100, modAmount = 2000, clipAmount = 0.1|\n var modEnv = EnvGen.ar(Env.adsr(0.5, 0.5, 0.7, 0.1, peakLevel: modAmount), gate);\n var mod = SinOsc.ar(modFreq) * modEnv;\n var car = SinOsc.ar(carFreq + mod);\n var ampEnv = EnvGen.ar(Env.adsr(0.1, 0.3, 0.7, 0.2, peakLevel: amp), gate, doneAction: 2);\n var clip = clipAmount * 500;\n Out.ar(out, (car * ampEnv * clip).clip(-0.7, 0.7) * 0.1);\n }).add;\n\n s.sync;\n\n Pbind(*[\n instrument: \\basicFM,\n out: [0, 1],\n dur: Pseq([1/7, 1/3] / 1.2, inf),\n sustain: Pkey(\\dur),\n amp: 1/4,\n carFreq: Pseq([1, 1, 1, 2] * 350, inf),\n modFreq: Pkey(\\carFreq) * (1/8),\n modAmount: Pseq([2, 1, 0.5, 2, 1, 0.5, 2, 1, 2, 1, 0.5, 2, 1, 0.5, 2, 4] * 500, inf),\n clipAmount: Pseq([Pn(0.1, 32), Pn(1, 32)], inf)\n ]).play;\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `BLowPass`?"}, {"role": "assistant", "content": "BLowPass — 12db/oct rolloff - 2nd order resonant Low Pass Filter"}, {"role": "user", "content": "What does `BLowPass.sc` do?"}, {"role": "assistant", "content": "calculate filter coefficients."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n(\nz = {\n BLowPass.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(10, 20000, \\exponential), // cutoff freq.\n MouseY.kr(0.0, 1.0, \\linear), // rq\n 0.5); // mul\n}.play\n);\nz.release;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `VOsc` in SuperCollider briefly."}, {"role": "assistant", "content": "VOsc — Variable wavetable oscillator. A wavetable lookup oscillator which can be swept smoothly across wavetables. Fractional values of table will interpolate between two adjacent tables. Category: UGens > Generators > Deterministic."}]} -{"conversations": [{"role": "user", "content": "Explain `Error` in SuperCollider briefly."}, {"role": "assistant", "content": "Error — superclass of all Errors Error and its subclasses separate different types of error is that can occur in the SuperCollider program into distinct classes, so that they can be reported differently to the user. Category: Core."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n\n// definition for future reference in arbitrary Environments\n\n(\np = Pbind(\n \\midinote, PLbeta(\\lo, \\hi, \\p1, \\p2),\n \\dur, 0.1\n);\n);\n\n// prepare current Environment\n// prob values for equal distribution\n\n(\n~lo = 60;\n~hi = 90;\n~p1 = 1;\n~p2 = 1;\n);\n\n\n// run\n\nx = p.play;\n\n\n// replace probabilities, get values close to the bounds\n\n(\n~p1 = 0.02;\n~p2 = 0.02;\n);\n\n\n// change between close-to-bounds and equally-distributed\n// PLseq\n// …\n```"}, {"role": "assistant", "content": "definition for future reference in arbitrary Environments prepare current Environment (PLbeta: dynamic scope Pbeta variant)"}]} -{"conversations": [{"role": "user", "content": "What is `Pdefn`?"}, {"role": "assistant", "content": "Pdefn — non event stream reference definition"}, {"role": "user", "content": "What does `Pdefn.all` do?"}, {"role": "assistant", "content": "A global IdentityDictionary with all proxies."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\nPdefn(\\x, Pbrown(0, 6, 0.1, inf));\nPbind(\\note, Pdefn(\\x), \\dur, 0.3).play;\nPbind(\\note, Pdefn(\\x), \\dur, 0.1, \\ctranspose, 15).play;\n// now change the definition\nPdefn(\\x, Pseq([0, 3, 5, 7, 9, 11], inf));\nPdefn(\\x, Pseq([0, 3, 3, 7], inf) + Pseq([0, [0, 3], [0, 5, 7]], inf));\n```"}]} -{"conversations": [{"role": "user", "content": "What does `RedMixer.cvs` do?"}, {"role": "assistant", "content": "Dictionary with all Ref objects. (used to be CV"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nPsync(Pbind(....), 4, 16\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nPsync(Pbind(....), 4, 16)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Lag3`."}, {"role": "assistant", "content": "```supercollider\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n Lag3.kr( // lag the modulator\n LFPulse.kr(4, 0, 0.5, 50, 400), // frequency modulator\n Line.kr(0, 1, 15) // modulate lag time\n ),\n 0, // phase\n 0.3 // sine amplitude\n )\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `UGen`?"}, {"role": "assistant", "content": "UGen — Abstract superclass of all unit generators"}, {"role": "user", "content": "What does `UGen.multiNew` do?"}, {"role": "assistant", "content": "These methods are responsible for multichannel expansion. They call `*new1(rate, ...args)` for each parallel combination. Most `*ar / *kr` methods delegate to #*multiNewList."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n{ Blip.ar(Blip.kr(4, 5, 500, 60), 59, 0.1) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for electric guitar (a SuperCollider snippet)?"}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\noisecomb2, { arg out, gate=1, pan=0, freq=300, amp=0.1, noiselevel=0.2,\n minfreq=100, decaytime=1, doneAction=2, ffreq=500, rq=0.3, spread=0.8;\n var sig, env;\n sig = WhiteNoise.ar(noiselevel);\n sig = sig + ClipNoise.ar(noiselevel);\n sig = sig + AllpassC.ar(sig, 1/minfreq, 1/freq, decaytime);\n sig = RLPF.ar(sig, ffreq * \\ffreqtab.kr(1!10), rq);\n env = EnvGen.kr(\\adsr.kr(Env.adsr(0.6,0.1,0.8,0.1)), gate, doneAction:doneAction);\n sig = sig * env;\n sig = Splay.ar(sig, spread, 1, pan);\n sig = sig * amp;\n Out.ar(out, sig);\n}).store;\n);\n\n(\nPdef(\\plopbla, Pbind(\n \\instrument, \\noisecomb2,\n \\note, Pseq([[0,7],[1,8],[-1,5]]-2,inf),\n //\\note, Pseq([0,1,2,3,4],inf)\n \\octave, Pstep(Pseq([3,4],inf),Pseq([5,0.75],inf)),\n \\minfreq, 50,\n \\decaytime, 1.0,\n \\adsr, Pseq([\n [Env.adsr(0.02,0.1,0.8,0.4,curve:0.5)],\n [Env.adsr(0.02,0.1,0.8,0.4,curve:0.5)],\n [Env.adsr(0.02,0.1,0.8,0.4,curve:0.5)],\n [Env.adsr(0.03,0.1,0.8,0.1,curve:0.5)],\n [Env.adsr(0.03,0.1,0.8,0.1,curve:0.5)],\n [Env.adsr(0.03,0.1,0.8,0.1,curve:0.5)],\n ],inf),\n \\legato, 1.0,\n //\\ffreq, [500,610,820,140],\n \\ffreq, 500,\n //\\ffreqtab, [[0.8,1,1.1,1.2, 2,4,5,6, 8,10].scramble.postln],\n //\\ffreqtab, Pfunc{ [[ 0.1, 0.2, 0.3, 0.5, 1,2,3,8, 10, 12 ].scramble] + rrand(0.01,1.0); },\n //\\ffreqtab, [ 6, 4, 5, 10, 1, 1.2, 0.8, 1.1, 2, 8 ], // also nice\n \\ffreqtab, [[ 6, 4, 5, 10, 1, 1.2, 0.8, 0.4, 2, 8 ]],\n \\dur, Pseq([3,1,1, 0.25,0.25,0.25],inf),\n \\amp, 1.1\n)).play;\n);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Recorder.filePrefix` do?"}, {"role": "assistant", "content": "a string used as prefix for the path when recording. This can be used to separate the outputs of several recorders. The default is"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n// sound example:\n(\nvar clutch, pat, decision;\ndecision = Pseq([Pn(true, 10), Prand([true, false], 10)], inf).asStream;\npat = Pbind(\\freq, Pseq([200, [300, 302], 400, 450], inf), \\dur, 0.3);\nclutch = StreamClutch(pat, decision);\nclutch.asEventStreamPlayer.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n// sound example:\n(\nvar clutch, pat, decision;\ndecision = Pseq([Pn(true, 10), Prand([true, false], 10)], inf).asStream;\npat = Pbind(\\freq, Pseq([200, [300, 302], 400, 450], inf), \\dur, 0.3);\nclutch = StreamClutch(pat, decision);\nclutch.asEventStreamPlayer.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\nb = Buffer.read(s, ExampleFiles.child);\n\n(\nSynthDef(\"help-copyPhase\", { |out = 0|\n var inA, chainA, inB, chainB, chain;\n inA = SinOsc.ar(SinOsc.kr(SinOsc.kr(0.08, 0, 6, 6.2).squared, 0, 100, 800));\n inB = WhiteNoise.ar(0.2);\n chainA = FFT(LocalBuf(2048), inA);\n chainB = FFT(LocalBuf(2048), inB);\n chain = PV_CopyPhase(chainA, chainB);\n Out.ar(out, 0.1 * IFFT(chain).dup);\n}).play(s);\n);\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\nb = Buffer.read(s, ExampleFiles.child);\n\n(\nSynthDef(\"help-copyPhase\", { |out = 0|\n var inA, chainA, inB, chainB, chain;\n inA = SinOsc.ar(SinOsc.kr(SinOsc.kr(0.08, 0, 6, 6.2).squared, 0, 100, 800));\n inB = WhiteNoise.ar(0.2);\n chainA = FFT(LocalBuf(2048), inA);\n chainB = FFT(LocalBuf(2048), inB);\n chain = PV_CopyPhase(chainA, chainB);\n Out.ar(out, 0.1 * IFFT(chain).dup);\n}).play(s);\n);\n\n(\nSynthDef(\"help-copyPhase2\", { |out = 0, soundBufnum = 2|\n var inA, chainA, inB, chainB, chain;\n inA = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);\n inB = SinOsc.ar(SinOsc.kr(SinOsc.kr(0.08, 0, 6, 6.2).squared, 0, 100, 800));\n chainA = FFT(LocalBuf(2048), inA);\n chainB = FFT(LocalBuf(2048), inB);\n chain = PV_CopyPhase(chainA, chainB);\n Out.ar(out, 0.1 * IFFT(chain).dup);\n}).play(s, [\\soundBufnum, b]);\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// default initial params\n{ LatoocarfianC.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// default initial params\n{ LatoocarfianC.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `CXPlayerControl.stopToBundle` do? What arguments does it take?"}, {"role": "assistant", "content": "adapter class for JITLib to control players Arguments: bundle; fadeTime."}]} -{"conversations": [{"role": "user", "content": "What does `BusPlug.initBus` do?"}, {"role": "assistant", "content": "Make a new bus only if necessary. This depends on the current bus and the #-reshaping Returns: Boolean (true if successful)."}]} -{"conversations": [{"role": "user", "content": "What is rq in BPF.ar?"}, {"role": "assistant", "content": "rq is the reciprocal of Q, so it is a bandwidth control, not a Q control. Small rq means a narrow, resonant band; large rq means a wide, gentle one. The signature is `BPF.ar(in, freq, rq, mul, add)`. A common idiom is `rq = 0.3` for a broad sweep and `rq = 0.02` for a whistle. The same rq convention applies to RLPF and RHPF."}]} -{"conversations": [{"role": "user", "content": "What does `FoaFocusZ.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "First Order Ambisonic (FOA) focus transformer Arguments: in — The B-format signal, an array: [w, x, y, z]; angle — The distortion angle, in radians. -pi/2 to pi/2; mul — Output will be multiplied by this value.; add — This value will be added to the output.."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Pisano Periods are used to generate melodies."}, {"role": "assistant", "content": "```supercollider\n/*\nThe Fibonacci-sequence as controlsignal: melodies from Pisano Periods.\nBecause the sequence runs more or less exponentially, it seems best to assign the values to frequencies. \n*/\ns.boot;\nSynthDef( \\puls, {|freq=30, out|\n Out.ar(out,\n SinOsc.ar(freq, mul: 0.5*EnvGen.kr(Env.perc(0.01,0.75), doneAction: 2)),0)\n}).add;\n(\nm=3000; //max index, 5 minutes = 300 when dur=0.1\na=Array.newClear(m);//two arrays to store numbers from the Pisano Periods\nb=Array.newClear(m);\na.put(0,0); \na.put(1,1);\nd=2; //even divisor\ni=2; //index\nwhile ({i Delays."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `ControlRate`."}, {"role": "assistant", "content": "```supercollider\n{ SinOsc.ar(ControlRate.ir) * 0.1 }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What is `GUI` in SuperCollider?"}, {"role": "assistant", "content": "GUI — Factory abstraction for all GUI related core classes SuperCollider currently supports three operating system platforms: macOS, UNIX (Linux and FreeBSD) and Windows (with some limitations). Category: GUI > Kits."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Blip thru Formlet, pseudo-vocal synthesis."}, {"role": "assistant", "content": "```supercollider\n// Blip thru Formlet, pseudo-vocal synthesis.\n// hh&adc, since beijing 2005\n// 2019 made quad/MC\n\n// keywords: vocal, voice, formants\n\n/*\nNdef(\\formSing).gui;\nNdef(\\formSing).play;\nNdef(\\formSing).getHalo(\\stepFdev).value;\n*/\nNdef(\\formSing).addSpec(\\root, [20, 500, 6]);\nNdef(\\formSing).addSpec(\\formfrq, [50, 5000, \\exp]);\nNdef(\\formSing).addSpec(\\harm, [1, 256, \\exp]);\nNdef(\\formSing).addSpec(\\formLag, [0.01, 100, \\exp]);\nNdef(\\formSing).addSpec(\\ndiv, [0.01, 1, \\exp]);\nNdef(\\formSing).addSpec(\\fdev, [0, 24, \\amp]);\nNdef(\\formSing).addSpec(\\round, [0, 3, \\amp, 0.05]);\n\n(\n// modulating formant frequency\nNdef(\\formSing, { arg amp=0, root=150, formfrq=500, harm=20, fdev=2, ndiv = 0.2, formLag=0.1, round = 1.5;\n var freqCompare = 1; // ((formfrq / root).log2).abs.min(1).linexp(0, 1, 0.25, 1);\n var in = Blip.ar(\n root.lag(formLag) * LFNoise0.kr(root * ndiv ! q.numChans, fdev.max(0.01) ).midiratio,\n harm.lag(formLag), // .max(formfrq / root * 0.25),\n 0.1\n ) * GrayNoise.ar(0.1 ! q.numChans, 1);\n\n Limiter.ar(Formlet.ar(in, formfrq.lag(formLag), 0.005, 0.02) * (freqCompare * amp.lag(0.1)))\n .softclip;\n});\n);\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{ var nse, env, kic;\n kic = tanh(Ringz.ar(LPF.ar(Trig.ar(Impulse.ar(1.0),SampleDur.ir),1000),30,0.25,7).sin*2);\n env = Env.perc(0.05, 1, 1, -4);\n nse = BrownNoise.ar(2) + PinkNoise.ar(0.5) * EnvGen.kr(env,Impulse.kr(1), doneAction: 2);\n\n nse = Mix.ar(BPF.ar(nse,[100,1200,80,40,20],MouseX.kr(0,1),[1,0.2,1,1,1]));\n nse = LPF.ar(nse + kic, MouseY.kr(100,1000))! 2\n\n}.play\n)\n```"}, {"role": "assistant", "content": "A muffled thump. An attempt at a Jurassic Park © glass of water sort of thing - or breaking into a silo."}]} -{"conversations": [{"role": "user", "content": "What does `MIDIFunc.tick` do?"}, {"role": "assistant", "content": "A convenience method to create a new MIDIFunc which responds to MIDI tick messages. See #*new for argument descriptions. The responding `func` will be passed the argument Returns: A new instance of MIDIFunc which responds to MIDI tick messages."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SendReply`."}, {"role": "assistant", "content": "```supercollider\n(\n{ SendReply.ar(Impulse.ar(4), \"/reply\", [Sweep.ar, SinOsc.ar(0.3)]); 0 }.play;\nOSCdef(\\x, { |msg|\n var time, value;\n time = msg[3];\n value = msg[4];\n \"value % occurred at time %\".format(value, time).postln;\n}, \"/reply\");\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `InterfaceDef` in SuperCollider?"}, {"role": "assistant", "content": "InterfaceDef — defines event, midi and GUI handlers for an Interface see Interface Category: Libraries > crucial > Instr."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nb = SoundFile.collectIntoBuffers(\"yourSoundFileFolder/*\"); // By Bjørn Houdorf, December 21, 2012\n\n(\n{\nvar number = b.numChannels, randomNumber, trigger, delayed, panned, sound, mixedSound, rotatedSound;\ntrigger = Dust.kr(Array.fill(number,1), 1, -0.5); // Generates random impulses from -0.5 to 0.5. as a excitation function\nrandomNumber = TRand.kr(1, number, trigger);\nsound = PlayBuf.ar(Array.fill(number,1) ,randomNumber,1,trigger,0,0); // play sound files\ndelayed = DelayL.ar(sound, trigger, trigger); // delaying the sound files\npanned = Pan2.ar(delayed, Array.fill(number,{1.0.rand2})); // pan them out in the stereo field\nmixedSound = 0.05*Mix.new(panned);// and mix them to one stereo signal\nrotatedSound = Rotate2.ar(mixedSound[0], mixedSound[1], LFSaw.kr(0.05)); // rotate stereo signal\n}.play; // play it all\n)\n```"}, {"role": "assistant", "content": "Put your sound files in the sound file folder. The code plays random sound files panned out in the stereo field. A swarm of sound files."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Stream`."}, {"role": "assistant", "content": "```supercollider\n// play at the next beat, with offset 0.4\n(\nRoutine({ loop {\n \"///\".postln; (delta: 0.5).yield;\n \"_/_\".postln; (delta: 0.1).wait;\n} }).asEventStreamPlayer.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// 2D:\n~positions = [ [ x0, y0 ], [ x1, y1 ], ... [ xN, yN ] ;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// 2D:\n~positions = [ [ x0, y0 ], [ x1, y1 ], ... [ xN, yN ] ];\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Ref`."}, {"role": "assistant", "content": "```supercollider\n{ Klank.ar(`[[800, 1071, 1153, 1723], nil, [1, 1, 1, 1]], Impulse.ar(2, 0, 0.1)) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Annotations.unregister` do? What arguments does it take?"}, {"role": "assistant", "content": "stores names and notations for Nodes, identifying the Node's owner and its purpose Arguments: object."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nm = MIDIClockOut( \"IAC Driver\", \"IAC Bus 1\";\n\nm.play\n\nTempo.bpm = 140\n\nTempo.bpm = 60\n\nTempo.bpm = 20\n\n\nm.stop\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nm = MIDIClockOut( \"IAC Driver\", \"IAC Bus 1\");\n\nm.play\n\nTempo.bpm = 140\n\nTempo.bpm = 60\n\nTempo.bpm = 20\n\n\nm.stop\n```"}]} -{"conversations": [{"role": "user", "content": "What does `PopUpEditor.selectedIndex` do?"}, {"role": "assistant", "content": "selects from an integer => name option array"}]} -{"conversations": [{"role": "user", "content": "What is the difference between Env and EnvGen?"}, {"role": "assistant", "content": "Env is a language-side description: a list of levels, times and a curve, e.g. `Env.perc(0.01, 1)` or `Env.adsr(0.01, 0.1, 0.5, 0.8)`. EnvGen is the UGen that plays it on the server: `EnvGen.kr(env, gate, doneAction: 2)`. The same Env can be played by many EnvGens, and Env also has language-side uses such as `.asStream` inside Patterns and `.plot`."}]} -{"conversations": [{"role": "user", "content": "What does `InterfaceDef.keyDownAction` do?"}, {"role": "assistant", "content": "defines event, midi and GUI handlers for an Interface"}]} -{"conversations": [{"role": "user", "content": "What does `SelectXFocus.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Mix one output from many sources Arguments: which — Index of the selected input, which is also the center of the selection for a focus > 0.; array — A collection of inputs.; focus — The \"fuzziness\" of the selection: the larger the focus, the less adjacent inputs are mixed in.; wrap — If set to true, index will wrap around the array of inputs (see also: Array#-wrapAt). `(`."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// proceed with caution. start at min volume, and not with your expensive speakers.\n\nfork{b=Buffer.alloc(s,512,1);inf.do{b.cheby({[1,0].choose}!2);{(Shaper.ar(b,SinOsc.ar(55,0,Line.kr(1,0,2,1,0,2))))!2}.play;0.1.wait;}};\n```"}, {"role": "assistant", "content": "can anyone tell me what the loud click is, and how to control it?\r\n\r\ni kind of really like it, but it sounds scary, \r\n\r\nand the resulting waveform is bizarre, too.\r\n\r\n[http://soundcloud.com/tengototen/m-chtegern-ikeda](http://soundcloud.com/tengototen/m-chtegern-ikeda)\r\n\r\n\r\nupdate: some discussion, and lots of interesting things to try out, [on the list](http://new-supercollider-mailing-lists-foru."}]} -{"conversations": [{"role": "user", "content": "What does `FBSineN.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Feedback sine with chaotic phase indexing Arguments: freq — Iteration frequency in Hertz; im — Index multiplier amount; fb — Feedback amount; a — Phase multiplier amount; c — Phase increment amount; xi — Initial value of x; yi — Initial value of y; mul."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nPsloth {\n var seed, repeats;\n\n *new { arg seed, repeats=1;\n ^super.newCopyArgs(seed, repeats);\n }\n\n storeArgs{^[seed, repeats]}\n\n embedInStream { arg inval;\n var size=seed.size;\n var pointers=List[];\n repeats.value(inval).do({ arg j;\n j = j+1;\n if(j == j.nextPowerOf(size),{ pointers.add(0); });\n pointers.collect{|i| seed.at(i)}.sum.embedInStream(inval);\n pointers.do{|x, i|\n if((i==0) || (pointers[0..(i-1)].sum==0), {pointers[i] = ((x+1)%size);})\n };\n });\n ^inval\n }\n}\n```"}, {"role": "assistant", "content": "Save this as an extension and recompile class library. You can now use `Psloth([0,1,0], 10)`, for example, instead of declaring a new routine for each pattern.\r\n\r\nI didn't persist the use cases, as this should be saved as a `.sc` file. Please refer to the ancestor code for usage.\r\n\r\nMemory/CPU usage will grow over time, but at a decreasing rate. This can be used for a large amount of repeats. Exte."}]} -{"conversations": [{"role": "user", "content": "What does `TempoClock.permanent` do?"}, {"role": "assistant", "content": "Sets or gets a Boolean value indicating whether the clock will survive cmd-period. If false the clock is stopped (and thus removed) on cmd-period. If true the clock survives cmd-period. It is false by"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for blaplop (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\bla, { arg out=0, amp=0.1, gate=1, pan=0, freq=200;\n var sig;\n var tab;\n tab = \\tab.kr(1 ! 15);\n sig = LFSaw.ar(freq * tab.abs);\n sig = sig.sum;\n sig = RLPF.ar(sig, Rand(10,freq*2) + 100 * SinOsc.ar(tab.abs).range(0.01,Rand(2,7)));\n sig = sig.sum;\n sig = sig / 100;\n sig = sig.tanh;\n sig = sig * EnvGen.ar(Env.adsr(0.01,0.1,0.8,0.1+ExpRand(0.001,0.2)),gate,doneAction:2);\n sig = Pan2.ar(sig, pan, amp);\n Out.ar(out, sig);\n}).add;\n);\n\n(\nPdef(\\plop, Pbind(\n \\instrument, \\bla,\n \\degree, Pstep(Pseq([\n Pseq([0,2,4],4),\n Pseq([0,12,6],4),\n Pseq([0,12,6]+7,1),\n ],inf), 1),\n \\octave, 3,\n \\tab, Pfunc {\n var tab;\n [\n //tab = { arg n; (n + 1.asFloat.rand + 1).tanh / (n.rand+1) } ! 15;\n tab = { arg n; (n + 2.asFloat.rand + 1) / (n+1) } ! 15;\n tab.postln;\n ]\n },\n \\dur, PdurStutter( Prand([1,2,4],inf), Pseq([1,2,3]/2,inf)),\n \\amp, 0.4\n)).play;\n);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `AbstractSplineGui.showGrid` do?"}, {"role": "assistant", "content": "boolean: show the GridLines or not. Useful when displaying multiple splines on top of each Returns: boolean"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for controlling arrayed args using pattern."}, {"role": "assistant", "content": "```supercollider\n(\nfork {\n var size = 3.rrand(10).debug('envelope size');\n {|dur=1, amp=0.8, pan = 0|\n Pan2.ar( \n SinOsc.ar(\n EnvGen.ar(Env(\\freq_l.kr(400!size), \\freq_d.kr(0.1!(size-1)), \\freq_c.kr(1!(size-1)))), // named controls\n mul: EnvGen.ar(Env.sine(dur, amp), doneAction:2)\n ).tanh, \n pan\n );\n }.asSynthDef.name_(\"dzin\").add;\n Server.default.sync;\n Pbind(*[\n instrument: \\dzin,\n delta: Pseg(Prand(1/2.pow((0..3)), inf), Pwhite(1,4), \\lin),\n dur: Pfunc({ thisThread.clock.beatDur }) * Pkey(\\delta), // set dur to delta duration\n freq_l: Pcollect(`_, Ptuple({ Pbrown(0,1,0.05).linexp(0,1,40,4e3) } ! size, inf)), // array refs - freq envelope levels\n freq_c: Ptuple({ Pcollect(`_, Ptuple({ Pbrown(-4,4,0.5) } ! (size-1), inf)) }!2, inf), // array of arrayrefs - multichannel expansion w/ different curve levels\n freq_d: Pfunc({ |e| Ref(Array.rand(size-1,0.3,1).normalizeSum * e.dur) }), // sending array ref with total dur = Pkey(\\dur)\n pan: Ptuple( { Pbrown() - 0.5 * 2 } ! 2, inf ), // array - multichannel expansion\n amp: Ptuple( { Pbrown() / 10 + 0.1 } ! 2, inf ) // same\n ]).play(TempoClock(156/60));\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// modulating the frequency\n\n{ Saw.ar(XLine.kr(40, 4000, 6), 0.2) }.play;\n\n// two band limited sawtooth waves through a resonant low pass filter\n\n{ RLPF.ar(Saw.ar([100, 250], 0.1), XLine.kr(8000, 400, 5), 0.05) }.play;\n```"}, {"role": "assistant", "content": "modulating the frequency two band limited sawtooth waves through a resonant low pass filter (Saw: Band limited sawtooth.)"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\nb = Buffer.new(s);\nb.allocRead(ExampleFiles.child);\nx = { PlayBuf.ar(1, b, BufRateScale.kr(b), loop: 1 * 0.5 }.play;\nx.free; b.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\nb = Buffer.new(s);\nb.allocRead(ExampleFiles.child);\nx = { PlayBuf.ar(1, b, BufRateScale.kr(b), loop: 1) * 0.5 }.play;\nx.free; b.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What model are you?"}, {"role": "assistant", "content": "I am sc-mind: a 198M MiniMind-3-MoE, eight layers, 768 wide, four experts with top-1 routing. I was trained from scratch on the SuperCollider documentation, class library and help pages, then fine-tuned on questions and answers about them."}]} -{"conversations": [{"role": "user", "content": "What is `Set`?"}, {"role": "assistant", "content": "Set — a set according to equality"}, {"role": "user", "content": "What does `Set.add` do?"}, {"role": "assistant", "content": "Add an Object to the Set. An object which is equal to an object already in the Set will not be added. `Set[1, 2, 3].add(4).postln;`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nSet[1, 2, 3].add(4).postln;\nSet[1, 2, 3].add(3).postln;\nSet[\"abc\", \"def\", \"ghi\"].add(\"jkl\").postln;\nSet[\"abc\", \"def\", \"ghi\"].add(\"def\").postln;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `EventSource.enKrUni` do?"}, {"role": "assistant", "content": "Implementation of Functional Reactive Programming."}]} -{"conversations": [{"role": "user", "content": "What is `NdefParamGui` in SuperCollider?"}, {"role": "assistant", "content": "NdefParamGui — display the settings of a nodeproxy NdefParamGui displays all settings and mappings of a nodeproxy, so one can change them flexibly. Single number get displayed with an EZSlider, and anything else is shown as an EZText (a text field). Its main use is within NdefGui. Category: JITLib > GUI, Live Coding."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for poor man's panning."}, {"role": "assistant", "content": "```supercollider\n// poor man's panning\n{\n var f, hornbostelwertheimerkonstante;\n f = MouseY.kr(1, 100, 1);\n hornbostelwertheimerkonstante = 0.00063;\n Impulse.ar(f, hornbostelwertheimerkonstante * f * [1, MouseX.kr(0, 2)], 0.1) \n}.play\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code:\n```supercollider\n{ SinOsc.ar(440) * EnvGen.kr(Env.perc(0.01, 1), doneAction: 2) }.play;\n```"}, {"role": "assistant", "content": "It plays a 440 Hz sine with a percussive envelope, and the Synth frees itself when the envelope\nends.\n\n- `SinOsc.ar(440)` is an audio-rate sine at 440 Hz.\n- `Env.perc(0.01, 1)` is a 10 ms attack to full level then a 1 s decay to zero.\n- `EnvGen.kr(...)` plays that envelope at control rate and multiplies the sine, so the sound fades out.\n- `doneAction: 2` frees the Synth at the end of the envelope, so it does not accumulate silent nodes.\n- `.play` on the function builds an anonymous SynthDef and starts one Synth of it."}]} -{"conversations": [{"role": "user", "content": "What does `InstrBrowser.inputSpec` do?"}, {"role": "assistant", "content": "Browse your instrument library, with customizable actions"}]} -{"conversations": [{"role": "user", "content": "What does `Instr.proxyControlClass` do?"}, {"role": "assistant", "content": "An enhanced version of SynthDef with a library"}]} -{"conversations": [{"role": "user", "content": "What does `UserView.drawFunc` do? What arguments does it take?"}, {"role": "assistant", "content": "Sets the Function to evaluate whenever the view is asked to redraw itself. This may be, for example, due to being hidden and shown again, being resized, another view moving on top of it, or after the View#-refresh method has been called. Within that Function you are allowed to use the Pen class to draw within the bounds of the view. All the coordinates given to the methods of Pen are relative to the top-left corner of the view. Usage of Pen is not allowed outside of that Arguments: A Function.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = NodeProxy(s);\na.reshaping = \\elastic;\na.play(0, 2); // play stereo\na.source = { BPF.ar(Dust.ar(8 ! 8), (0..5).nthPrime * 300, 0.01 * 20 };\na.numChannels; // 8\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = NodeProxy(s);\na.reshaping = \\elastic;\na.play(0, 2); // play stereo\na.source = { BPF.ar(Dust.ar(8 ! 8), (0..5).nthPrime * 300, 0.01) * 20 };\na.numChannels; // 8\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n Tempo.bpm = 140.0;\n InstrGateSpawner({ arg freq=440,rq=0.1,width=0.5,fenv,fenvmod=1000,envadsr,dur=0.1,tempo;\n var gate;\n gate = Trig1.kr(1.0,dur / tempo);\n RLPF.ar(\n VarSaw.ar(\n freq,\n 0.0,\n width\n ),\n EnvGen.kr(fenv,gate,levelScale: fenvmod),\n rq)\n * EnvGen.kr(envadsr,gate,0.2, doneAction: 2)\n },[\n Pseq((70 + [ 0, 1, 5, 6, 10 ]).midicps ,inf) *\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n Tempo.bpm = 140.0;\n InstrGateSpawner({ arg freq=440,rq=0.1,width=0.5,fenv,fenvmod=1000,envadsr,dur=0.1,tempo;\n var gate;\n gate = Trig1.kr(1.0,dur / tempo);\n RLPF.ar(\n VarSaw.ar(\n freq,\n 0.0,\n width\n ),\n EnvGen.kr(fenv,gate,levelScale: fenvmod),\n rq)\n * EnvGen.kr(envadsr,gate,0.2, doneAction: 2)\n },[\n Pseq((70 + [ 0, 1, 5, 6, 10 ]).midicps ,inf) *\n Prand(2 ** [0,-1,2,-2,-3],inf), // octave shifts\n 0.2,\n Patch({ LFTri.kr(0.1,[0.0,0.5],0.5,0.5) }),\n Env.adsr(0.3,sustainLevel: 0.4),\n Pbrown(2000,10000,100),\n Env.adsr(releaseTime: 0.5),\n\n // dur uses a Pfunc to ask the delta till the next event\n Pfunc({ arg igs; (igs.delta * 0.9) }),\n\n TempoPlayer.new\n ],\n 0.25\n ).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Crackle`."}, {"role": "assistant", "content": "```supercollider\n{ Crackle.ar(1.95, 0.5) }.play;\n\n// modulate chaos parameter\n{ Crackle.ar(Line.kr(1.0, 2.0, 3), 0.5, 0.5) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PV_LocalMax`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\nb = Buffer.read(s, ExampleFiles.child);\n\n\n(\nSynthDef(\"help-localMax\", { |out = 0|\n var in, chain;\n in = Mix.arFill(3, { LFSaw.ar(exprand(100, 500), 0, 0.1) });\n chain = FFT(LocalBuf(2048), in);\n chain = PV_LocalMax(chain, MouseX.kr(0, 50));\n Out.ar(out, 0.5 * IFFT(chain).dup);\n}).play(s);\n);\n\n(\nSynthDef(\"help-localMax2\", { |out = 0, soundBufnum = 2|\n var in, chain;\n in = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);\n chain = FFT(LocalBuf(2048), in);\n chain = PV_LocalMax(chain, MouseX.kr(0, 100));\n Out.ar(out, 0.1 * IFFT(chain).dup);\n}).play(s, [\\soundBufnum, b]);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "How do I play a sample from disk?"}, {"role": "assistant", "content": "Load it into a Buffer on the server, then play the buffer. `BufRateScale` keeps the pitch right when\nthe file's sample rate differs from the server's.\n\n```supercollider\n(\ns.waitForBoot {\n ~buf = Buffer.read(s, \"C:/sounds/break.wav\");\n SynthDef(\\player, { |out = 0, buf = 0, amp = 0.6, rate = 1|\n var sig = PlayBuf.ar(2, buf, BufRateScale.kr(buf) * rate, loop: 1);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n ~player = Synth(\\player, [\\buf, ~buf]);\n};\n)\n```\nUse `numChannels` 1 for a mono file; a mismatch is silent or wrong-sounding rather than an error."}]} -{"conversations": [{"role": "user", "content": "Approaches to recording generated midi in DAW?"}, {"role": "assistant", "content": "SuperCollider forum — Approaches to recording generated midi in DAW?\n\nToday I spent another 6 hours or so trying to record in ardour (linux) both the midi information generated by supercollider and the audio generated by sending this midi to external synths. I finally hit the right combination of magic to make it work and I want to add my recipe in this thread so that I can find it back the future (and perhaps it also works for someone else).\n\nIngredient 1: a2jmidid. You can run it manually on the command line using “a2jmidid -e” or (like me) you can just use the “start midi bridge” button in the jack front-end application “Cadence” (enable the “export hardware ports checkbox”)\n\nIngredient 2: In supercollider itself, it is extremely important to only connect to a port and not to specify a destination uid. It seems that by specifying a destination uid, supercollider gets some kind of direct connection to the midi destination and ardour can no long introspect/record what is happening (I know it doesn’t sound scientific - this is purely the result of empiric observation/frustration.\n\nSo in supercollider, simply use\n\n```supercollider\n~synth1 = MIDIOut(0);\n~synth2 = MIDIOut(1);\n```\n\nand then in ardour’s Window->Midi Connections dialog, you can connect the out ports from supercollider to both your external synth and the track in which you want to record the midi information.\n\nFor midi driver in jack you can configure None.\n\nIf you want to record the generated midi in ardour, do NOT use connection syntax like\n\n```supercollider\n~synth1 = MIDIOut(0, MIDIClient.destinations[2].uid);\n```\n\nand do NOT use\n\n```supercollider\n~synth1 = MIDIOut.newByName(\"INTEGRA-7\", \"INTEGRA-7 MIDI 1\");\n```\n\nIf you just want to send midi to the external synth without recording the information, both previous ways of connecting work as well but these ways of connecting appear to work only if the jack MIDI driver is configured to use “ALSA sequencer” mode. It doesn’t seem to work with “None” or “ALSA Raw” (this may need some further investigation to clear out)."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Interpreter`."}, {"role": "assistant", "content": "```supercollider\n// typical usage\na = 4;\nb = 3;\nb = b + a;\n\n// some sound\na = Synth(\\default);\ng = fork { loop { 0.1.wait; a.set(\\freq, 200 + 20.0.rand2.postln) } };\ng.stop; a.free;\n\n// an overview of all the variables\nthis.inspect;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `HLayoutView` in SuperCollider briefly."}, {"role": "assistant", "content": "HLayoutView — A container view that arranges its children horizontally Category: GUI > Views."}]} -{"conversations": [{"role": "user", "content": "What does `WebView.title` do?"}, {"role": "assistant", "content": "The title of the current Returns: A String."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// per convention keys after \\dur are the ones to be set\n// playing ends after end of last stream\n\n(\np = PmonoPar([\n [\n \\dur, 1.0,\n \\pan, Pser([-0.9, 0, 0.9], 8) \n ],[\n \\dur, 0.4,\n \\freq, Pexprand(300, 1000, 24) \n ],[\n \\dur, 0.2,\n \\amp, Pseq([0.05, 0.3], 30) \n ]\n]).trace.play;\n)\n```"}, {"role": "assistant", "content": "per convention keys after \\dur are the ones to be set playing ends after end of last stream (PmonoPar: monophonic event pattern for an arbitrary number of timed setting streams)"}]} -{"conversations": [{"role": "user", "content": "What does `BufMax.kr` do? What arguments does it take?"}, {"role": "assistant", "content": "detect the largest value (and its position) in an array of UGens Arguments: bufnum; gate — You don't need to make use of the gate control: if you do use it, the calculation is only performed when gate>0.. Returns: # val, index"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nSynthDef(\\dubecho,{|in, out, length = 1, fb = 0.8, sep = 0.012|\n var input = In.ar(in, 2);\n var feedback = LocalIn.ar(2);\n var output = LeakDC.ar(feedback*fb + input);\n output = HPF.ar(output, 400);\n output = LPF.ar(output, 5000);\n output = output.tanh;\n LocalOut.ar(DelayC.ar(output, 1, LFNoise2.ar(12).range([length,length+sep],[length+sep,length])).reverse);\n ReplaceOut.ar(out, output);\n}).add;\n\n// Example as effecet bus\n~bus = Bus.audio(s, 2);\n~echo = Synth(\\dubecho, [\\in, ~bus, \\length, TempoClock.default.tempo*(3/8), \\fb, 0.7, \\sep, 0.0012], addAction: \\addToTail);\n\n// send something\nplay{ Out.ar(~bus, LFGauss.ar(1, 0.1, loop:0, doneAction:2) * Blip.ar(80!2, 8)) }\n\n// turn it off\n~echo.free;\n```"}, {"role": "assistant", "content": "Fork of Bjorn's Dub echo, rewritten w/o the Feedback Quark (using LocalIn + LocalOut) and adding a ping pong (can be removed by deleting the .reverse method in the LocalOut line)."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for minor random bliss in two for Prout."}, {"role": "assistant", "content": "```supercollider\n(\n\nSynthDef(\\param, { arg freq = 100, sustain, amp;\n var sig;\n sig = LFPar.ar(freq: freq,\n mul: EnvGen.kr(Env.perc(0, sustain, 0.5), doneAction:2) * amp);\n sig = Splay.ar(sig);\n Out.ar(0, sig);\n}).add;\n\ne = Pbind(\n \\midinote, Prout({\n var tone0, tone1, tone2, interval, freq0, delta;\n loop {\n tone0 = rrand(0,11);\n interval = rrand(2,4);\n tone1 = Scale.minor(\\pythagorean).at(tone0) + [0,12,24].choose + 0.07;\n tone2 = Scale.minor(\\pythagorean).at(tone0 + interval) + [0,12,24].choose;\n freq0 = [tone1,tone2]+48;\n postln(freq0);\n freq0.yield;\n }\n }),\n \\dur, Prand([1,2,4,8,12,16,4,6,8], inf),\n \\instrument, \\param,\n \\amp, 0.5,\n \\sustain, 2,\n).play(quant:1); // returns an EventStream\nTempoClock.default.tempo = 1200/60;\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Tdef`?"}, {"role": "assistant", "content": "Tdef — task reference definition"}, {"role": "user", "content": "What does `Tdef.all` do?"}, {"role": "assistant", "content": "A global IdentityDictionary with all proxies."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nTdef(\\x, { loop { 0.5.wait; \"aaaaaaaaaaaaaazz\".scramble.postln } }).play;\nTdef(\\x, { loop { 0.125.wait; \"aazz\".scramble.postln } });\nTdef(\\x, { loop { 0.5.wait; (note: 14.rand).play } });\nTdef(\\x, { loop { 0.5.wait; (note: 14.rand + [0, 3, 6, 7].keep(4.rand)).play } });\nTdef(\\x).stop;\nTdef(\\x).play;\nTdef(\\x).clear;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n{ SyncSaw.ar(100, Line.kr(100, 800, 12), 0.1) }.play;\n\n\n(\nplot { [\n SyncSaw.ar(800, 1200),\n Impulse.ar(800) // to show sync rate\n] }\n);\n\n(\nplot { [\n SyncSaw.ar(800, Line.kr(800, 1600, 0.01)), // modulate saw freq\n Impulse.ar(800) // to show sync rate\n] }\n);\n\n// scoping the saw: hit 's' when focused on the scope window to compare the channels\n(\nscope {\n var freq = 400;\n [\n SyncSaw.ar(freq, freq * MouseX.kr(1, 3)), // modulate saw freq\n Impulse\n// …\n```"}, {"role": "assistant", "content": "scoping the saw: hit 's' when focused on the scope window to compare the channels (SyncSaw: Hard sync sawtooth wave.)"}]} -{"conversations": [{"role": "user", "content": "What does `Magnitude.<` do?"}, {"role": "assistant", "content": "Comparable value in a linear continuum Returns: a Boolean whether the receiver is less than aMagnitude."}]} -{"conversations": [{"role": "user", "content": "What is `SVF` in SuperCollider?"}, {"role": "assistant", "content": "SVF — 12db/Oct State Variable Filter Total, 100% Plastic... Category: UGens > Filters."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for rough sketch of chicago minor chord pad thing."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\\ChicagoPad, { |out = 0, freq = 440, cutoff = 500, amp = 0.2|\n var snd;\n freq = freq + SinOsc.kr(0.1, 0, 1, 20);\n snd = Saw.ar([freq, freq+1, freq-1, freq*3/2, freq*6/5])*0.1;\n snd = snd + VarSaw.ar(0.99*[freq, freq+1, freq-1,freq*3/2, freq*6/5],0, LFTri.kr(0.3).range(0.25,0.9))*0.1;\n snd = Mix(snd);\n snd = RLPF.ar(snd, SinOsc.kr(0.1, 0, 100, 5000), 0.1);\n snd = GVerb.ar(snd ,40, 10, 0.6, 0.6, -3, -9, -11)*0.2;\n \n //snd = RLPF.ar(snd, SinOsc.kr(0.08, 0.5, cutoff/10, cutoff), 0.2);\n snd = MoogFF.ar(snd, SinOsc.kr(0.08, 0.5, cutoff/10, cutoff), 3, 0);\n snd = DelayC.ar(snd, 1.5, 1,0.8);\n //snd = snd * EnvGen.ar(Env.linen(0.001, 0.01,0.01,1), doneAction:2);\n Out.ar(out, [snd, AllpassC.ar(snd, 0.5, 0.05, 0.3)]*amp);\n}).send;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Find/make a dataset of points:\nx = 15.collect{[1.0.rand, 1.0.rand]};\n// Append the index onto the end, for later reference\nx = x.collect{|data, i| data ++ i };\n// Use the KDTree quark and the .makeBufferData method to put the data in the searchable format\n~treedata = NearestN.makeBufferData(KDTree(x, lastIsLabel: true));\n// Load the data to the server\n~treebuf = Buffer.sendCollection(s, ~treedata.flat, 5);\n// Run a synth with the ugen and some kind of query data\n~synth = { NearestN.kr(~treebuf, {LFNoise0.kr\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Find/make a dataset of points:\nx = 15.collect{[1.0.rand, 1.0.rand]};\n// Append the index onto the end, for later reference\nx = x.collect{|data, i| data ++ i };\n// Use the KDTree quark and the .makeBufferData method to put the data in the searchable format\n~treedata = NearestN.makeBufferData(KDTree(x, lastIsLabel: true));\n// Load the data to the server\n~treebuf = Buffer.sendCollection(s, ~treedata.flat, 5);\n// Run a synth with the ugen and some kind of query data\n~synth = { NearestN.kr(~treebuf, {LFNoise0.kr(1)}.dup, num:3).poll(1)}.play;\n~synth.free\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `BufMax` in SuperCollider briefly."}, {"role": "assistant", "content": "BufMax — detect the largest value (and its position) in an array of UGens Finds the largest value in a Buffer, and outputs the value and the index. Category: UGens > Multichannel, UGens > Analysis."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes flanger (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"flange\", {arg freq=440, release=0.1;\n var x, sig,out, mod1, depth, mfreq,maxfreq, maxdepth, maxdelay, basedelay;\n maxfreq=3;\n maxdelay=0.01;\n basedelay=maxdelay/2;\n maxdepth=basedelay/2;\n depth = MouseY.kr(0,maxdepth);\n mfreq = MouseX.kr(0,maxfreq);\n mod1 = SinOsc.ar(mfreq,0,depth);\n sig = SoundIn.ar(0,mul:2);\n out = DelayC.ar(sig, maxdelay,basedelay+ mod1);\n out = Mix.ar([out,sig]);\n Out.ar(0,out);\n Out.ar(1,out);\n}).load(s);\n);\n\na = Synth(\"flange\");\na.free\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nSynthDef(\\Synth3,\n {arg ress = 0;\n var klank, env;\n klank = Klank.ar(`[{Rand(70,21000)}!7, {Rand(0.128,0.700)}!7],BrownNoise.ar(0.7));\n klank = klank;\n env = EnvGen.kr(Env.perc(0.07, ress), doneAction:2);\n Out.ar(0, klank*env.dup*0.0128);\n}).add;\n)\n\n\n{inf.do{x = rrand(0.01,0.7); Synth(\\Synth3, [\\ress, x+(7*x)]); x.wait;}}.fork\n```"}, {"role": "assistant", "content": "Play around with {Rand(70, 21000)}!7\r\n\r\nA simple example for the begginers... hope I can contribute to something =)."}]} -{"conversations": [{"role": "user", "content": "How do I make a piece reproducible instead of a different take every time?"}, {"role": "assistant", "content": "Three things make a SuperCollider piece repeatable: a fixed seed, a fixed tempo, and no live input.\n\n```supercollider\n(\nthisThread.randSeed = 1234;\nTempoClock.default.tempo = 2;\nPbind(\\degree, Pwhite(0, 7, inf), \\dur, 0.25).play;\n)\n```\n\n`thisThread.randSeed` fixes the random sequence of the current thread, so `Pwhite`, `Prand` and friends give\nthe same values again. Recording with `s.record(path, duration: 30)` then makes the take an artifact rather\nthan a performance. Input from `MouseX` or a MIDI controller is the usual remaining source of difference."}]} -{"conversations": [{"role": "user", "content": "What does `AbstractPlayer.bundle` do? What arguments does it take?"}, {"role": "assistant", "content": "the base class for all Players : a playable object Arguments: server; atTime — see atTime; buildFunction."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Normalizer`."}, {"role": "assistant", "content": "```supercollider\n(\n// example signal to process\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n z * 0.8\n}.play\n);\n\n(\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n [z, Normalizer.ar(z, 0.4, 0.01)] * 0.5\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Window.bounds` do? What arguments does it take?"}, {"role": "assistant", "content": "The position and size of the window. The position is relative to the bottom-left corner of the Arguments: A Rect or a Point interpreted Point#-asRect#as Rect.. Returns: A Rect."}]} -{"conversations": [{"role": "user", "content": "What does `Function.asRoutine` do?"}, {"role": "assistant", "content": "Returns a Routine using this as its func"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Voices (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n/* Voices\n\nhttp://www.kimri.org/blog/?p=64\n\n */\n\ns.boot;\n\nSynthDef(\\voice,{arg out=0,n=0,p=0,d=10,r=10;\nvar sig=Array.fill(3,{|i| VarSaw.ar(n.midicps*(i+1.0001),mul:0.05/(i+1))}).sum;\nvar sig2=Ringz.ar(WhiteNoise.ar(0.0003),TRand.ar(n.midicps,(n+1).midicps,Impulse.ar(10)));\nvar env=EnvGen.kr(Env.linen(d,1,r),gate:1,doneAction:2);\nOut.ar(out,Pan2.ar((sig+sig2)*env*(0.8+SinOsc.kr(0.1,0,0.2)),p));\n}).add;\n\nNdef(\\rev,{\nOut.ar(0,Limiter.ar(FreeVerb.ar(LPF.ar(In.ar([0,1]),10000),mix:0.33),0.7));\n};\n);\n\nTdef(\\voices,{\ninf.do{\n10.do{\nif ((0.8).coin,{\nSynth(\\voice,[\\n:[24,28,29,48,36,40,41,52,53,60,64,65].choose,\\p:{rrand(-0.5,0.5)},\\d:{rrand(5,13)},\\r:{rrand(8,14)}]);\n});\nrrand(0.1,1).wait;\n};\n18.wait;\n};\n});\n\nTdef(\\voices).play;\nTdef(\\voices).stop;\n\ns.quit;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `GUI.setSkin` do? What arguments does it take?"}, {"role": "assistant", "content": "Factory abstraction for all GUI related core classes Arguments: skinName."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// Very artificial example - just filtering some noise.\ns.boot;\nb = Buffer.alloc(s,2048,1);\n(\nx = {\nvar in, chain, freq, rq, val;\n//freq = LFPar.kr(0.3).exprange(100, 1000);\nfreq = MouseY.kr(1000, 100, 1);\nrq = MouseX.kr(0.001, 10, 1);\nin = BPF.ar(WhiteNoise.ar, freq, rq);\nchain = FFT(b.bufnum, in);\n\nval = FFTSpread.kr(chain);\n\nOut.ar(0, in.dup * 0.1);\n(val * 0.000001).poll(10); // Poll but scaled down so more readable!\n}.play(s);\n);\n// …\n```"}, {"role": "assistant", "content": "Very artificial example - just filtering some noise. freq = LFPar.kr(0.3).exprange(100, 1000); (FFTSpread: Spectral spread)"}]} -{"conversations": [{"role": "user", "content": "What does `PHSusePlayer.free` do?"}, {"role": "assistant", "content": "Only free this PHSusePlayer - the PHSplayer / PHSparPlayer, which is using the same HS / HSpar, is not"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n\n// add a mouse action to this document:\n// example: easy button:\n// when you click in front of a 17 a SinOsc will start up;\ns.waitForBoot({\n Document.current.mouseUpAction_({ |doc|\n var char;\n char = doc.rangeText(doc.selectionStart, 2);\n if(char == \"17\", {\n { EnvGen.kr(Env.perc, doneAction: Done.freeSelf) * SinOsc.ar([600, 720, 300].choose, 0, 0.5) }.play;\n });\n if(char == \"23\", {\n { EnvGen.kr(Env.perc, doneAction: Done.freeSelf) * PinkNoise.ar(0.2) }.play;\n }\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n\n// add a mouse action to this document:\n// example: easy button:\n// when you click in front of a 17 a SinOsc will start up;\ns.waitForBoot({\n Document.current.mouseUpAction_({ |doc|\n var char;\n char = doc.rangeText(doc.selectionStart, 2);\n if(char == \"17\", {\n { EnvGen.kr(Env.perc, doneAction: Done.freeSelf) * SinOsc.ar([600, 720, 300].choose, 0, 0.5) }.play;\n });\n if(char == \"23\", {\n { EnvGen.kr(Env.perc, doneAction: Done.freeSelf) * PinkNoise.ar(0.2) }.play;\n });\n })\n});\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes blipecho context."}, {"role": "assistant", "content": "```supercollider\n( \nSynthDef(\\klang_blip, { \n | out = 0, release = 1, freq1 = 1, freq2 = 5, freq3 = 8, freq_mul = 4, atk_dur = 0.01, amp = #[0.3,0.3,0.3], mod_freq = 25 | \n var sig = DynKlang.ar(\n `[([freq1, freq2, freq3].linexp(1,12,1,1140) * freq_mul), amp, nil ], \n EnvGen.kr(Env([5,1.05,0.95,0.01],[0.025,release*3/4,release/4])), \n 150\n ) * LFGauss.kr(mod_freq.reciprocal, 0.3);\n Out.ar(out, (sig/8)!2 * Linen.kr(Impulse.kr(0), atk_dur, 1, release, doneAction:2)) \n}).add;\n\nSynthDef(\\dubecho,{|in, out, length = 1, fb = 0.8, sep = 0.012|\n var input = In.ar(in, 2);\n var feedback = LocalIn.ar(2);\n var output = LeakDC.ar(feedback*fb + input);\n output = HPF.ar(output, 400);\n output = LPF.ar(output, 12000);\n output = output.tanh;\n LocalOut.ar(DelayC.ar(output, 1, LFNoise2.ar(12).range([length,length+sep],[length+sep,length])).reverse);\n ReplaceOut.ar(out, output);\n}).add;\n);\n\n( \n~bus = Bus.audio(s, 2);\n~echo = Synth(\\dubecho, [\\in, ~bus, \\length, TempoClock.default.tempo*(3/8), \\fb, 0.25, \\sep, 0.0012], addAction: \\addToTail);\n\nPbind(*[ \n instrument: \\klang_blip, \n dur: Pwrand([0.25,0.5,1,0.125], [16,16,1,1].normalizeSum, inf), \n release: Pkey(\\dur),\n freq_mul: Pstutter(Pwrand([1,2,4],[5,3,2].normalizeSum,inf), Pxrand((1..6), inf)),\n freq1: Pstutter(Pxrand((2,4..16), inf), Prand((1..4), inf)), \n freq2: Pstutter(Pxrand((2,4..16), inf), Prand((4..8), inf)), \n freq3: Pstutter(Pxrand((2,4..16), inf), Prand((8..12), inf)),\n mod_freq: Pstutter(Pxrand((2,4..16), inf), Pbrown(7,30,3)),\n atk_dur: Pkey(\\freq_mul).linlin(12,2,0.01,0.4),\n out: ~bus,\n amp: Pstutter(Pxrand((2,4..16),inf), Pfunc({[2,3,4].normalizeSum.scramble}))\n]).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Mx.bpm` do?"}, {"role": "assistant", "content": "The bpm that the Mx should play at. This sets the global Tempo when play starts and is saved with the Mx Returns: float. beats per minute"}]} -{"conversations": [{"role": "user", "content": "What does `Sieve.sect_i` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new Sieve object in mode 'intervals', generated by the intersection of sets of Arguments: ... data — Generators and an optional integer limit, wrapped into a Ref, which is included when reached. Allowed generators: Integers, Streams or Patterns producing intervals or Sieves itself. Integers and Stream/Pattern output must be strictly positive. Integers as generators produce constant intervals. If no."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n~name = \\defaultMapper;\n\n// default mapper does nothing. It could have been named 'identity'\n~function = { |aziDeg = 0, eleDeg = 0, gainDB = -99, delayMs = 1, lpHz = 15000, hpHz = 5, spread = 0.01, nfIndex = 0|\n [[aziDeg, eleDeg, gainDB, delayMs, lpHz, hpHz, spread, nfIndex]];\n };\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "What does `RedWorld.neighbours` do?"}, {"role": "assistant", "content": "Returns an Array of objects that are in the surrounding locations. Only useful when working with discrete worlds. e.g. cellular"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\n(\nb = Buffer.alloc(s, 2048, 1);\nc = Buffer.read(s, ExampleFiles.child);\n);\n\n(\nSynthDef(\"help-magSmear\", { |out = 0, bufnum = 0|\n var in, chain;\n in = LFSaw.ar(500, 0, Decay2.ar(Impulse.ar(2, 0, 0.2), 0.01, 2));\n chain = FFT(bufnum, in);\n chain = PV_MagSmear(chain, MouseX.kr(0, 100));\n Out.ar(out, 0.5 * IFFT(chain).dup);\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n);\n\n(\nSynthDef(\"help\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\n(\nb = Buffer.alloc(s, 2048, 1);\nc = Buffer.read(s, ExampleFiles.child);\n);\n\n(\nSynthDef(\"help-magSmear\", { |out = 0, bufnum = 0|\n var in, chain;\n in = LFSaw.ar(500, 0, Decay2.ar(Impulse.ar(2, 0, 0.2), 0.01, 2));\n chain = FFT(bufnum, in);\n chain = PV_MagSmear(chain, MouseX.kr(0, 100));\n Out.ar(out, 0.5 * IFFT(chain).dup);\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n);\n\n(\nSynthDef(\"help-magSmear2\", { |out = 0, bufnum = 0, soundBufnum = 2|\n var in, chain;\n in = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);\n chain = FFT(bufnum, in);\n chain = PV_MagSmear(chain, MouseX.kr(0, 100));\n Out.ar(out, 0.5 * IFFT(chain).dup);\n}).play(s, [\\out, 0, \\bufnum, b.bufnum, \\soundBufnum, c.bufnum]);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Another Star Wars inspired sound effect."}, {"role": "assistant", "content": "```supercollider\n(\n\n{\n\nvar flutter, flutterAmt = 0.02, humPitch = 88, hum, humLevel = 0.3, amp = 1.0, output;\nvar swing, swingNoise, swingLevel = 1.0, swingSwitch, swingThresh = 0.87;\nvar clash, clashTrig, clashDecay, clashEnvGen, clashSpring, clashLevel = 0.6;\n\nflutter = 4.collect(\n { \n |i|\n LFNoise0.kr(rrand(3, 16), flutterAmt, 1).lag(0.48);\n }\n);\n\nhumPitch = humPitch * StandardL.ar(2, 3.7).range(0.97, 1.03);\n\nhum = Mix(SyncSaw.ar([humPitch, humPitch * 1.001] * flutter.copyRange(0, 1), [humPitch * 1.003, humPitch * 1.0025] * flutter.copyRange(2, 3)));\nhum = hum * LFNoise0.kr(8.77224).range(0.2, 1.0).lag(0.4);\nhum = RLPF.ar(hum, LFNoise0.kr(21).range(200, 1800).lag(1.2), 0.5) * 0.1 * humLevel;\n\nhumPitch = humPitch * StandardL.ar(3.8, 2.9).range(0.93, 1.07);\n\nswingNoise = LFNoise1.kr(16.2).range(0, 1);\nswingSwitch = if(swingNoise > swingThresh, 1, 0).lag2(0.9, 1.3);\nswingLevel = swingLevel * swingSwitch;\n\nhumPitch = humPitch * StandardL.ar(3.8, 2.9).range(0.97, 1.03) * (1 + (swingSwitch * 0.2));\n\nswing = SyncSaw.ar(humPitch * 0.501, humPitch * 1.09);\nswing = LPF.ar(swing, 4300);\nswing = swing * swingLevel;\n\nclashTrig = Trig.kr(\n Schmidt.kr(1 - swingSwitch, swingThresh, swingThresh + 0.01),\n 0.01\n);\n\nclashDecay = TRand.kr(0.1, 1.6, clashTrig);\nclashEnvGen = Decay.kr(clashTrig, clashDecay) * TRand.kr(0.8, 1.0, clashTrig);\nclashSpring = Spring.kr(clashTrig, TRand.kr(5, 20, clashTrig), TRand.kr(0.001, 0.07, clashTrig));\nclash = SinOsc.ar(8000 * clashSpring + TRand.kr(600, 2342, clashTrig), SinOsc.ar(TRand.kr(452, 662, clashTrig), 0, 2));\nclash = clash + BPF.ar(WhiteNoise.ar(2), SinOsc.kr(2.6).range(3326, 4444), 0.16);\nclash = clash * clashEnvGen;\nclash = clash + ( clash * SinOsc.ar(39) * SinOsc.ar(3013) * 0.3);\nclash = clash * 0.1 * clashLevel;\n\noutput = hum + swing + clash; \n\n(output * amp) ! 2\n\n}.play\n\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `NoLagControlSpec` in SuperCollider?"}, {"role": "assistant", "content": "NoLagControlSpec — datatype specifying a 'control' rate input that does not any lag applied to it Control rate inputs are usually given a Lag to smooth out any zipper noises. Some inputs like those used for binary flags (eg 0/1 to toggle playing) should not ever get a lag. Category: Spec, Libraries > crucial > Spec."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Nested ifs in a SynthDef?"}, {"role": "assistant", "content": "```supercollider\n(\n{\nvar noise, out;\nnoise = LFNoise0.kr(8);\n\nout = if( noise > 0.0,\n if(noise > 0.5, \n if(noise > 0.9, WhiteNoise.ar(0.2), Pulse.ar(60, 0.5, 0.4)),\n SinOsc.ar(500, 0, 0.25)\n ),\n Saw.ar(160, 0.5)\n);\n\nout ! 2\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `UnixFILE.isOpen` do?"}, {"role": "assistant", "content": "Returns whether the file is open. An open request can fail if a file cannot be found for example. This method lets you test that the open call"}]} -{"conversations": [{"role": "user", "content": "What is Env.perc and what does it take?"}, {"role": "assistant", "content": "`Env.perc(attackTime, releaseTime, level, curve)` — an attack to `level` (default 1) then a decay to zero, with curve defaulting to -4 (an exponential-ish decay). `Env.perc(0.01, 1)` is the default percussive envelope, and it is a complete Env, not a generator: pair it with EnvGen to hear it."}]} -{"conversations": [{"role": "user", "content": "What is Ndef used for?"}, {"role": "assistant", "content": "Ndef is the JITLib node proxy: a named placeholder for a running signal chain that you can redefine while it plays. `Ndef(\\drone, { SinOsc.ar(55) * 0.1 }).play` starts it, and calling Ndef(\\drone, { ... }) again crossfades to the new definition without restarting the sound. It also supports chaining, `Ndef(\\drone)[1] = \\filter -> { |in| LPF.ar(in, 800) }`, which is the idiomatic way to build and modify a live patch."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ SinOsc.ar(500 + LFPulse.ar(4).bipolar(40), 0, 0.5 * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ SinOsc.ar(500 + LFPulse.ar(4).bipolar(40), 0, 0.5) * 0.1 }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// preserve only 3 bits of mantissa.\n{ MantissaMask.ar(SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4), 3) }.play\n\n// the original\n{ SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4) }.play\n\n// the difference.\n(\n{\n var in;\n in = SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4);\n in - MantissaMask.ar(in, 3)\n}.play\n)\n\n\n// preserve 7 bits of mantissa.\n// This makes the lower 16 bits of the floating point number become zero.\n{ MantissaMask.ar(SinOsc.ar(SinO\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// preserve only 3 bits of mantissa.\n{ MantissaMask.ar(SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4), 3) }.play\n\n// the original\n{ SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4) }.play\n\n// the difference.\n(\n{\n var in;\n in = SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4);\n in - MantissaMask.ar(in, 3)\n}.play\n)\n\n\n// preserve 7 bits of mantissa.\n// This makes the lower 16 bits of the floating point number become zero.\n{ MantissaMask.ar(SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4), 7) }.play\n\n// the original\n{ SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4) }.play\n\n// the difference.\n(\n{\n var in;\n in = SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4);\n in - MantissaMask.ar(in, 7)\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `PLorenzN.new` do? What arguments does it take?"}, {"role": "assistant", "content": "UGenPatterns quark library Arguments: freq; s — sigma; r — rho; b — beta; h — step amount; xi — initial value; yi — initial value; zi — initial value."}]} -{"conversations": [{"role": "user", "content": "What is `TwoPole` in SuperCollider?"}, {"role": "assistant", "content": "TwoPole — Two pole filter. A two pole filter. This provides lower level access to setting of pole location. For general purposes Resonz is better. Category: UGens > Filters > Linear."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SharedOut`."}, {"role": "assistant", "content": "```supercollider\n(\n// only works with the internal server\ns = Server.internal;\ns.boot;\n);\n\n(\nSynthDef(\"help-SharedOut\", {\n SharedOut.kr(0, SinOsc.kr(0.2));\n}).add;\n);\n\n(\ns.sendMsg(\\s_new, \"help-SharedOut\", x = s.nextNodeID, 0, 1);\ns.sendMsg(\\n_trace, x);\n\n// poll the shared control bus\nRoutine({\n 30.do({\n s.getSharedControl(0).postln;\n 0.2.wait;\n });\n}).play;\n);\n\n\ns.quit;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `RedOscillator.couple` do? What arguments does it take?"}, {"role": "assistant", "content": "Apply influence from another oscillator's phase. Call this before each Arguments: osc — Another LINKClasses/RedOscillator instance.."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n/* Audio plugin definition\n\n Each audio plugin should define the following global variables:\n ~name: (symbol) name of the spatializer\n ~description: (string) a short description\n ~function: the actual definition of the plugin\n\n*/\n\n~name = \\Limiter;\n~description = \"A simple limiter\";\n~channelLayout = \\mono;\n\n~function = { arg in, level=0.7, dur=0.01, outputDB=0;\n outputDB.dbamp * Limiter.ar(In.ar(in), level, dur);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "Which keys does a Pbind understand?"}, {"role": "assistant", "content": "The ones you use constantly are \\instrument (a SynthDef name), \\dur (seconds), \\degree (scale degree), \\midinote, \\freq, \\amp, \\legato (note length as a fraction of \\dur), and \\scale plus \\root for the scale used by \\degree. Everything else is passed to the Synth as an argument, so a SynthDef with `|cutoff = 800|` can be driven by `\\cutoff, Pwhite(400, 4000)`."}]} -{"conversations": [{"role": "user", "content": "How do I use a metronome or check my timing?"}, {"role": "assistant", "content": "A click on the clock you are using, plus a counter to see where you are in the bar:\n\n```supercollider\n(\nTdef(\\click, {\n var count = 0;\n loop {\n (Synth(\\hat, [\\amp, if (count % 4 == 0) { 0.25 } { 0.08 }]));\n count = count + 1;\n 1.wait;\n }\n}).play;\n)\n```\n\nBecause it waits on `TempoClock.default`, it stays in sync with every Pbind you start, which makes it a\ntempo reference rather than a separate sound."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for muffled thump?"}, {"role": "assistant", "content": "```supercollider\n(\n{ var nse, env, kic;\n kic = tanh(Ringz.ar(LPF.ar(Trig.ar(Impulse.ar(1.0),SampleDur.ir),1000),30,0.25,7).sin*2);\n env = Env.perc(0.05, 1, 1, -4);\n nse = BrownNoise.ar(2) + PinkNoise.ar(0.5) * EnvGen.kr(env,Impulse.kr(1), doneAction: 2);\n\n nse = Mix.ar(BPF.ar(nse,[100,1200,80,40,20],MouseX.kr(0,1),[1,0.2,1,1,1]));\n nse = LPF.ar(nse + kic, MouseY.kr(100,1000))! 2\n\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// linlin\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(mod.linlin(-1, 1, MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1))) * 0.1\n}.play;\n);\n\n// range\n(\n{\n var mod = LFNoise2.ar(80).range(MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1));\n SinOsc.ar(mod) * 0.1\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// linlin\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(mod.linlin(-1, 1, MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1))) * 0.1\n}.play;\n);\n\n// range\n(\n{\n var mod = LFNoise2.ar(80).range(MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1));\n SinOsc.ar(mod) * 0.1\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// the following two lines produce equivalent results\n{ SinOsc.ar(440, 0, 0.3) }.play(fadeTime: 0.0);\nSynthDef(\\help_FuncPlay, { Out.ar(0, SinOsc.ar(440, 0, 0.3)) }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// the following two lines produce equivalent results\n{ SinOsc.ar(440, 0, 0.3) }.play(fadeTime: 0.0);\nSynthDef(\\help_FuncPlay, { Out.ar(0, SinOsc.ar(440, 0, 0.3)) }).play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `ControlPatchIn.rate` do?"}, {"role": "assistant", "content": "manages a Player's input when connecting to other Players"}]} -{"conversations": [{"role": "user", "content": "What does `MIDIFunc.msgNum` do?"}, {"role": "assistant", "content": "Get this MIDIFunc's MIDI message Returns: An Integer."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SyncSaw`."}, {"role": "assistant", "content": "```supercollider\n{ SyncSaw.ar(100, Line.kr(100, 800, 12), 0.1) }.play;\n\n\n(\nplot { [\n SyncSaw.ar(800, 1200),\n Impulse.ar(800) // to show sync rate\n] }\n);\n\n(\nplot { [\n SyncSaw.ar(800, Line.kr(800, 1600, 0.01)), // modulate saw freq\n Impulse.ar(800) // to show sync rate\n] }\n);\n\n// scoping the saw: hit 's' when focused on the scope window to compare the channels\n(\nscope {\n var freq = 400;\n [\n SyncSaw.ar(freq, freq * MouseX.kr(1, 3)), // modulate saw freq\n Impulse.ar(freq) // to show sync rate\n] * 0.3 }\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Seekers are something you should avoid?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n var time = 0.23;\n var freq = (55).midicps;\n var a = VarSaw.ar(freq/2, width: XLine.ar(0.5,1,time)).range(0,XLine.ar(0.666,1/666,time));\n var tone = SinOsc.ar(freq).fold(-0.23*a,a) * EnvGen.ar(Env([1,0],[time]));\n Out.ar(0, tone.dup);\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Symbol`."}, {"role": "assistant", "content": "```supercollider\na = { Ringz.ar(T2A.ar(\\trig.tr), \\freq.kr(500, 1), 0.8) }.play;\na.set(\\freq, 330, \\trig, 1);\na.set(\\freq, 830, \\trig, 1);\na.release;\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Float` in SuperCollider?"}, {"role": "assistant", "content": "Float — 64-bit Floating point number A 64-bit double precision floating point number. Float inherits most of its behaviour from its superclass, SimpleNumber. Category: Math."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// modulate frequency and index multiplier\n{ FBSineC.ar(LFNoise2.kr(1, 1e4, 1e4), LFNoise2.kr(1, 16, 17), 1, 1.005, 0.7) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// modulate frequency and index multiplier\n{ FBSineC.ar(LFNoise2.kr(1, 1e4, 1e4), LFNoise2.kr(1, 16, 17), 1, 1.005, 0.7) * 0.2 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LinCongN`."}, {"role": "assistant", "content": "```supercollider\n// randomly modulate params\n(\n{ LinCongN.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(0.1, 0.5, 1.4),\n LFNoise2.kr(0.1, 0.1, 0.1),\n LFNoise2.kr(0.1)\n) * 0.2 }.play(s);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// decoder (narrow quad)\n~decoder = FoaDecoderMatrix.newQuad(pi/6\n\n// inspect\n~decoder.numChannels\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// decoder (narrow quad)\n~decoder = FoaDecoderMatrix.newQuad(pi/6)\n\n// inspect\n~decoder.numChannels\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `QuadC`."}, {"role": "assistant", "content": "```supercollider\n// default params\n{ QuadC.ar(SampleRate.ir/4) * 0.2 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `RandID`."}, {"role": "assistant", "content": "```supercollider\n// start a noise patch and set the id of the generator\n(\nSynthDef(\"help-RandID\", { |out = 0, id = 1|\n RandID.ir(id);\n Out.ar(out,\n WhiteNoise.ar(0.05) + Dust2.ar(70)\n )\n}).add;\n);\n\n// reset the seed of my rgen at a variable rate\n(\nSynthDef(\"help-RandSeed\", { |seed = 1910, id = 1|\n RandID.kr(id);\n RandSeed.kr(Impulse.kr(FSinOsc.kr(0.2, 0, 10, 11)), seed);\n}).add;\n\n);\n\n// start two noise synths on left and right channel with a different randgen id\na = Synth(\"help-RandID\", [\\out, 0, \\id, 1]);\nb = Synth(\"help-RandID\", [\\out, 1, \\id, 2]);\n\n// reset the seed of randgen 1\nx = Synth(\"help-RandSeed\", [\\id, 1]);\n\n// change the target randgen to 2 (affects right channel)\nx.set(\\id, 2);\n```"}]} -{"conversations": [{"role": "user", "content": "What are you good at?"}, {"role": "assistant", "content": "SuperCollider. I can explain its classes and UGens, write SynthDefs and patches, read a patch back to you, and tell you why one does not compile. I am 198M parameters; I am not a general assistant."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nPbind(\n \\degree, Pif(\n 0.1.loop.coin,\n Pseq([Rest(), 7], inf), // every second is a Rest\n Pseries(0, 1, inf).fold(-7, 7)\n ),\n \\dur, 0.125\n).play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nPbind(\n \\degree, Pif(\n 0.1.loop.coin,\n Pseq([Rest(), 7], inf), // every second is a Rest\n Pseries(0, 1, inf).fold(-7, 7)\n ),\n \\dur, 0.125\n).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nEnvironment.use({\n~a = 3;\n~b = 10;\n{ |a, b| (a * b).postln }.valueEnvir;\n});\n);\n\n// or syntactically shorter using an Event:\n\n(a:3, b:10).use { { |a, b| (a * b.postln }.valueEnvir };\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nEnvironment.use({\n~a = 3;\n~b = 10;\n{ |a, b| (a * b).postln }.valueEnvir;\n});\n);\n\n// or syntactically shorter using an Event:\n\n(a:3, b:10).use { { |a, b| (a * b).postln }.valueEnvir };\n```"}]} -{"conversations": [{"role": "user", "content": "Splay - not getting spread, wrong use?"}, {"role": "assistant", "content": "SuperCollider forum — Splay - not getting spread, wrong use?\n\nYou need to undestand that if you have two identical signal coming from left and right it will always be mono. No stereo spread possible. So you need to introduce (at least) two different signals - and just different amplification will not really work.\n\nTo expand your first example, we can introduce an array of values for paramtere pos:\n\n```supercollider\n(\nx = { arg spread=1, level=0.2, center=0.0;\n Splay.ar(\n GrainBuf.ar(numChannels: 1,\n trigger: Impulse.kr(1.2875),\n dur: Impulse.kr(1.2875),\n sndbuf: b,\n pos:[0,0.5],\n interp: 1\n ),\n spread,\n level,\n center\n );\n}.play;\n);\n\nx.set(\\spread, 1, \\center, 0); // full stereo\nx.set(\\spread, 0, \\center, 0); // mono center\n```\n\nBy way of Multichannel Expansion this creates two different signals (channels, an array of 2 UGen graphs) that you can hear as different and therefore observe the stereo spread.\n\nAnd similarly, to use your other example with In.ar where I have added in=2, so that it takes my mic in (but you can specify another bus) and wrapped it into a feedback delay with an array of two values for delayTime. Multichannel expansion thus creates two channels that are different because they have different delaytimes but the rest of UGen graph is the same (a copy). Changing spread now works:\n\n```supercollider\n(\nSynthDef(\\stereo,{|out=0, in=2, spread=1, level=1, center=0.0|\n Out.ar(out,\n Splay.ar(\n CombN.ar(\n In.ar(in, 1), 1, [0.3,0.4], 2)\n ,spread,level,center));\n}).play;\n)\n```\n\nI hope that clarifies the issue better."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// start something to record\nx = Synth(\"bubbles\");\n\n// allocate a disk i/o buffer\nb = Buffer.alloc(s, 65536, 2);\n\n// create an output file for this buffer, leave it open\nb.write(\"~/diskouttest.wav\".standardizePath, \"wav\", \"int16\", 0, 0, true);\n// create the diskout node; making sure it comes after the source\nd = Synth.tail(nil, \"help-Diskout\", [\"bufnum\", b]);\n// stop recording\nd.free;\n// stop the bubbles\nx.free;\n// close the buffer and the soundfile\nb.close;\n// free the buffer\nb.free;\n\n// play it back\n(\nx = Synth.basicN\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// start something to record\nx = Synth(\"bubbles\");\n\n// allocate a disk i/o buffer\nb = Buffer.alloc(s, 65536, 2);\n\n// create an output file for this buffer, leave it open\nb.write(\"~/diskouttest.wav\".standardizePath, \"wav\", \"int16\", 0, 0, true);\n// create the diskout node; making sure it comes after the source\nd = Synth.tail(nil, \"help-Diskout\", [\"bufnum\", b]);\n// stop recording\nd.free;\n// stop the bubbles\nx.free;\n// close the buffer and the soundfile\nb.close;\n// free the buffer\nb.free;\n\n// play it back\n(\nx = Synth.basicNew(\"help-Diskin-2chan\");\nm = { |buf| x.addToHeadMsg(nil, [\\bufnum, buf]) };\n\nb = Buffer.cueSoundFile(s, \"~/diskouttest.wav\".standardizePath, 0, 2, completionMessage: m);\n);\nx.free; b.close; b.free; // cleanup\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nMIDIClient.init;\nm = MIDIOut(0); // Linux users: MIDIOut(0, MIDIClient.destinations[0].uid)\n\n// Simplest way for sending \\note-type events to MIDI\n// define a Pattern of note-events:\na = Pbind(degree: Prand([1, 2, 3, [0, 5]], inf);\n\n// chain a \\midi-type event into the pattern and play it (see link\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nMIDIClient.init;\nm = MIDIOut(0); // Linux users: MIDIOut(0, MIDIClient.destinations[0].uid)\n\n// Simplest way for sending \\note-type events to MIDI\n// define a Pattern of note-events:\na = Pbind(degree: Prand([1, 2, 3, [0, 5]], inf));\n\n// chain a \\midi-type event into the pattern and play it (see link\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Tuning`."}, {"role": "assistant", "content": "```supercollider\nt = Tuning.et12;\nt.semitones; // [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]\nt.ratios; // [1, 1.0594630943591, 1.1224620483089, 1.1892071150019, etc.]\n\nPbind(\\scale, Scale.major(t), \\degree, Pseq((0..7) ++ (6..0) ++ [\\rest], 1), \\dur, 0.25).play;\n\n// use non-standard tuning\nt = Tuning.just;\nt.semitones; // [0, 1.1173128526978, 2.0391000173077, 3.1564128700055, etc.]\nt.ratios.collect(_.round(0.001)); // [1, 1.067, 1.125, 1.2, 1.25, 1.333, 1.406, 1.5, etc.]\n\nPbind(\\scale, Scale.major(t), \\degree, Pseq((0..7) ++ (6..0) ++ [\\rest], 1), \\dur, 0.25).play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n//algorithm to approach the square root of n\n~next = { |n| { |x| (x + n/x)/2 } };\n\n//look for a good enough match in the stream\n~within = { |eps, list| \n list.match({},\n { |a, rest|\n rest.match({},{ |b, rest2|\n if( (a-b).abs < eps){ b }{ ~within.(eps, rest) }\n });\n })\n};\n\n// A better way is to see how close a/b is to 1,\n// to avoid the rounding errors\n~relative = { |eps, list| \n list.match({},\n { |a, rest|\n rest.match({},{ |b, rest2|\n if( (a/b -1).abs < eps){ b }{\n// …\n```"}, {"role": "assistant", "content": "algorithm to approach the square root of n look for a good enough match in the stream (LazyList: Implementation of lazy list or stream)"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Verschwende deine Jugend (bassline cover)?"}, {"role": "assistant", "content": "```supercollider\n/* An approach to try to reproduce the 'famous' bassline of \"Verschwende deine Jugend\" by D.A.F. */\n\nSynthDef(\\daf_bass,{ |out, freq=440, sustain=1, gate=1, amp=0.1|\n var snd, env, fenv, harm;\n \n harm = [1,1.01,2,2.02,3.5,4.01,5.501];\n harm = harm ++ (harm*2);\n \n snd = SinOsc.ar(freq*harm).sum.distort.squared * 6;\n snd = snd + SinOsc.ar(freq / [1, 2]).sum!2;\n\n fenv = EnvGen.kr(Env.adsr(0.075,0.05,0.1,0.25));\n\n snd = RLPF.ar(snd, fenv.range(freq*2, freq*8), 0.75, 2) + (snd * 0.25);\n env = EnvGen.kr(Env.adsr(0.001,0.2,0.9,0.25), gate, amp, doneAction:2);\n \n snd = LeakDC.ar(Limiter.ar(snd * env));\n OffsetOut.ar(out, (snd!2));\n}).add;\n\n// approx 65 bpm\nTempoClock.default.tempo = 65/60;\n\n// approx bass pattern + modulation of Verschwende Deine Jugend bassline\nPdef(\\daf_bass,\n PmonoArtic(\\daf_bass,\n \\scale, Scale.minor,\n \\octave, [3],\n \\root, 2,\n \\ctranspose,Pseq([\n Pn(0, 8*4),\n Pn(-5, 8*4)\n ], inf),\n \\degree, Pseq([7,7s,1,8,1,1,7,1]-1,inf),\n \\dur, 0.18\n )\n).play;\n\n// link: http://www.youtube.com/watch?v=KjqrnUBdLqY\n```"}]} -{"conversations": [{"role": "user", "content": "What is `SystemSynthDefs` in SuperCollider?"}, {"role": "assistant", "content": "SystemSynthDefs — SynthDefs assumed to exist on the server After it has booted, this collection of SynthDefs is sent to the server. The SynthDefs are used for purposes such as routing audio and writing to busses, see Event and NodeProxy. The SynthDefs are instantiated automatically at StartUp. For non-realtime-synthesis, they have to be added explicitly, see Score#-addSystemSynthDefs. Category: Server."}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ LPF.ar(Saw.ar(100), SinOsc.kr(0.5).exprange(200, 2000)) * 0.2 }.play;\n```"}, {"role": "assistant", "content": "A sawtooth through a low-pass filter whose cutoff is swept slowly up and down — a classic filter\nsweep.\n\n- `Saw.ar(100)` is a 100 Hz sawtooth, rich in harmonics.\n- `SinOsc.kr(0.5)` is a control-rate sine at 0.5 Hz, so one full cycle takes 2 seconds.\n- `.exprange(200, 2000)` maps that -1..1 sine exponentially onto 200..2000 Hz — exponential is the right\n mapping for frequency, because we hear pitch logarithmically.\n- `LPF.ar(sig, cutoff)` removes harmonics above the cutoff; as it opens and closes you hear the tone\n brighten and darken.\n- `* 0.2` keeps the output from clipping."}]} -{"conversations": [{"role": "user", "content": "What does `LID.deviceRoot` do?"}, {"role": "assistant", "content": "This is the base path where to look for devices. By default this is: `\"/dev/input\"`. With `findAvailable` this is extended with the `name` that is passed in, which has as a default `\"event\"`. Hence, by default we look for devices that match the path: `\"/dev/input/event*\"`. See below for some #Opening devices with alternative"}]} -{"conversations": [{"role": "user", "content": "What does `DrawGrid.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Draws grid lines on a UserView for plotting Arguments: bounds — A Point or Rect describing the size and position of the grid within the parent view (not including any labels).; horzGrid — A grid lines object for the x-axis, instantiated via GridLines, or ControlSpec#-grid method, or `nil` (resulting in no grid lines).; vertGrid — A grid lines object for the y-axis, see horzGrid.. Returns: A `DrawGrid`."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n‎{h={|f|1-LFTri.ar(f)};l={|s,e|Line.ar(s,e,1200,1,0,2)};FreeVerb.ar(h.(l.(147,5147))*h.(l.(1117,17))*h.(100)*h.([55,55.1])*0.05,0.7,1)}.play\n\n//Explanation of this piece - http://schemawound.com/post/40100438722/11-13-2012-tweet-explained\n```"}, {"role": "assistant", "content": "Explanation of this piece - http://schemawound.com/post/40100438722/11-13-2012-tweet-explained."}]} -{"conversations": [{"role": "user", "content": "What does `FlowLayout.currentBounds` do?"}, {"role": "assistant", "content": "Gets a Rect with `bounds.width` and `height = top +"}]} -{"conversations": [{"role": "user", "content": "What does `EventSource.do` do? What arguments does it take?"}, {"role": "assistant", "content": "Run f every time a new event Arguments: f — A function. Returns: Unit `(`"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// modulate frequency and index multiplier\n{ FBSineL.ar(LFNoise2.kr(1, 1e4, 1e4), LFNoise2.kr(1, 16, 17), 1, 1.005, 0.7) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// modulate frequency and index multiplier\n{ FBSineL.ar(LFNoise2.kr(1, 1e4, 1e4), LFNoise2.kr(1, 16, 17), 1, 1.005, 0.7) * 0.2 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Wrap.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Wrap a signal outside given thresholds. Arguments: in — Signal to be wrapped.; lo — Low threshold of wrapping.; hi — High threshold of wrapping.."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `TWindex`."}, {"role": "assistant", "content": "```supercollider\n// assuming normalized values\n(\na = SynthDef(\"help-TWindex\", { |out, w1 = 0.0, w2 = 0.5, w3 = 0.5|\n var trig = Impulse.kr(6);\n var index = TWindex.kr(trig, [w1, w2, w3]);\n Out.ar(out,\n SinOsc.ar(\n Select.kr(index, [400, 500, 600]),\n 0, 0.2\n )\n )\n}).play;\n);\n\na.setn(0, [0, 0, 1].normalizeSum);\na.setn(0, [1, 1, 1].normalizeSum);\na.setn(0, [1, 0, 1].normalizeSum);\n\n\n// modulating probability values\n(\n\na = SynthDef(\"help-TWindex\", { |out, w1 = 0.0, w2 = 0.5|\n var trig = Impulse.kr(6);\n var index = TWindex.kr(\n trig,\n [w1, w2, SinOsc.kr(0.3, 0, 0.5, 0.5)], // modulate probability\n 1 // do normalisation\n );\n\n Out.ar(out,\n SinOsc.ar(\n Select.kr(index, [400, 500, 600]),\n 0, 0.2\n )\n )\n}).play;\n\n);\n\na.setn(0, [0, 0]);\na.setn(0, [1, 1]);\na.setn(0, [1, 0]);\na.setn(0, [0, 1]);\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `VarGui`."}, {"role": "assistant", "content": "```supercollider\n// synth definition with raising frequency\n\n(\nSynthDef(\\synth_0, { |devFactor = 0.1, devFreq = 10, amp = 0.1|\n var freq = XLine.kr(400, 1200, 10); \n Out.ar(0, SinOsc.ar(SinOsc.ar(devFreq, 0, devFactor * freq, freq), mul: amp).dup(2) * EnvGate.new) \n}).add;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `MoogFF`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n// Play it with the mouse...\nx = { MoogFF.ar(WhiteNoise.ar(01.1), MouseY.kr(100, 10000, 1), MouseX.kr(0, 4)) }.play(s);\nx.free;\n\n// Mmmm, throbby\n(\nx = {\n MoogFF.ar(\n Pulse.ar([40, 121], [0.3, 0.7]),\n SinOsc.kr(LFNoise0.kr(0.42).range(0.001, 2.2)).range(30, 4200),\n 0.83 * 4) }.play(s);\n);\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What is `NamedControl`?"}, {"role": "assistant", "content": "NamedControl — Named reference to a control"}, {"role": "user", "content": "What does `NamedControl.ar` do?"}, {"role": "assistant", "content": "add a new instance of AudioControl with given name and default values. If lags are given, apply a Lag UGen to it."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// use NamedControl to create a number of multichannel controls:\n\na = { SinOsc.ar(NamedControl.kr(\\freq, [300, 330, 370], [1, 0.3, 0.02])).sum * 0.1 }.play;\na.setn(\\freq, [700, 705, 890]);\na.setn(\\freq, [0, 2, 5].midiratio * 400);\n\n// synonymous:\na = { SinOsc.ar(\\freq.kr([300, 330, 370], [1, 0.3, 0.02])).sum * 0.1 }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n/* Audio plugin definition\n\n Each audio plugin should define the following global variables:\n ~name: (symbol) name of the spatializer\n ~description: (string) a short description\n ~function: the actual definition of the plugin\n\n*/\n\n~name = \\testtone;\n~description = \"a standard test tone (sine)\";\n~channelLayout = \\mono;\n\n~function = {| sfreq = 200 |\n FSinOsc.ar(sfreq)\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PV_Diffuser`."}, {"role": "assistant", "content": "```supercollider\n(\n// trig with MouseY crossing center of screen\n{\n var in, chain;\n in = Mix.ar(SinOsc.ar(200 * (1..10), 0, Array.fill(10, { rrand(0.1, 0.2) })));\n chain = FFT(LocalBuf(2048), in);\n chain = PV_Diffuser(chain, MouseY.kr > 0.5);\n 0.5 * IFFT(chain).dup;\n}.play\n);\n\n(\nb = Buffer.read(s, ExampleFiles.child);\n\n// trig with MouseY crossing center of screen\n{\n var in, chain;\n in = PlayBuf.ar(1, b, BufRateScale.kr(b), loop: 1);\n chain = FFT(LocalBuf(2048), in);\n chain = PV_Diffuser(chain, MouseY.kr > 0.5);\n 0.5 * IFFT(chain).dup;\n}.play\n);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Lag2`."}, {"role": "assistant", "content": "```supercollider\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n Lag2.kr( // lag the modulator\n LFPulse.kr(4, 0, 0.5, 50, 400), // frequency modulator\n Line.kr(0, 1, 15) // modulate lag time\n ),\n 0, // phase\n 0.3 // sine amplitude\n )\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LatoocarfianC`."}, {"role": "assistant", "content": "```supercollider\n// randomly modulate all params\n(\n{ LatoocarfianC.ar(\n SampleRate.ir/4,\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5)\n) * 0.2 }.play(s);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Klank`."}, {"role": "assistant", "content": "```supercollider\n{ Klank.ar(`[[800, 1071, 1153, 1723], nil, [1, 1, 1, 1]], Impulse.ar(2, 0, 0.1)) }.play;\n\n{ Klank.ar(`[[800, 1071, 1353, 1723], nil, [1, 1, 1, 1]], Dust.ar(8, 0.1)) }.play;\n\n{ Klank.ar(`[[800, 1071, 1353, 1723], nil, [1, 1, 1, 1]], PinkNoise.ar(0.007)) }.play;\n\n{ Klank.ar(`[[200, 671, 1153, 1723], nil, [1, 1, 1, 1]], PinkNoise.ar([0.007, 0.007])) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "In what order should I learn SuperCollider?"}, {"role": "assistant", "content": "The order that pays off fastest:\n\n1. **One UGen and Out** — `{ SinOsc.ar(440) * 0.2 }.play`. Learn that a graph must reach Out.\n2. **Envelopes and doneAction** — the difference between a sound and a click.\n3. **SynthDef and Synth** — naming a graph, controlling it with arguments, freeing it with a gate.\n4. **Patterns** — `Pbind` for sequence, so you stop writing loops by hand.\n5. **Buses and effects** — chaining, sends, groups.\n6. **JITLib** — Ndef for patches you modify while they play.\n\nVocabulary to carry: UGen, SynthDef, Synth, bus, group, envelope, gate, doneAction, Pattern, clock. Every\nconfusion in SuperCollider tends to be one of those words."}]} -{"conversations": [{"role": "user", "content": "What does `Env.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a new envelope Arguments: levels — an array of levels. The first value is the initial level of the envelope and, when used with EnvGen, is held until the `gate` opens. If a level is a UGen, it's value is updated only when the envelope reaches that node. When a level is itself an array, the envelope returns a multichannel output (for ; times — an array of durations of segments in seconds. There should be one fewer duration than there are levels, but if shorter, the array is extended by wrapping around the given values.; curve — a Symbol, Float, or an Array of those. Determines the shape of the envelope segments. The possible values are:; releaseNode — an Integer or `nil`. The envelope will sustain at the releaseNode until released. `(` In the above example, the release node is set to the third node, which means it will sustain at the level of 0.5 until it is released. The envelope will then continue on until its last node is reached.; loopNode — an Integer or `nil`. Creates a segment of looping nodes. You must specify a releaseNode in order for loopNode to have any effect. The loop node is the initial node of the loop and is never repeated. Upon reaching the release node, the envelope will transition back to the node that follows the loop n; offset — an offset to all time values (only applies in IEnvGen).."}]} -{"conversations": [{"role": "user", "content": "What does `XFader4.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Crossfades between 4 stereo pairs using an X/Y controller Arguments: lf; rf; lb; rb; xpan; ypan."}]} -{"conversations": [{"role": "user", "content": "What is `Splay` in SuperCollider?"}, {"role": "assistant", "content": "Splay — Splay spreads an array of channels across the stereo field Splay spreads an array of channels across the stereo field. Optional arguments are spread and center, and equal power levelCompensation. The formula for the stereo position is ((0 .. (n - 1)) * (2 / (n - 1)) - 1) * spread + center Category: UGens > Multichannel > Panners."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// where did I leave my keys?\n(\nvar n = 30, m = 5;\nNdef.clear(3);\nNdef.ar(\\x, n);\nNdef(\\y, { Splay.ar(Ndef.ar(\\x, m, LFNoise1.kr(1/m).range(0, n - m - 1))).clip2 * 0.5 }).play; \nNdef(\\x, { \n { \n var a = Ndef.ar(\\x, 1, LFNoise0.kr(Rand()) * Rand() + Rand() * n);\n a + 0.1 * SinOsc.ar(ExpRand(0.2, 1000)) \n } ! n\n}); \n);\n\n// where did I put my keys?\n(\nvar n = 30, m = 5;\nNdef.clear(3);\nNdef.ar(\\x, n);\nNdef(\\y, { Splay.ar(Ndef.ar(\\x, m, LFNoise1.kr(1/m).range(0, n - m - 1))).clip2 * 0.5 }).play; \nNdef(\\x, { \n {\n var a = Ndef.ar(\\x, 1, LFNoise0.kr(Rand()) * Rand() + Rand() * n);\n SinOsc.ar(ExpRand(0.2, 1000), a) \n } ! n\n}); \n)\n```"}, {"role": "assistant", "content": "Cross-tuning between multiple signal dimensions. The code is finished without listening."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes SOUND 1, from orig Influx Example."}, {"role": "assistant", "content": "```supercollider\n// SOUND 1, from orig Influx Example\n(\nNdef(\\dog).addSpec(\\intv, [-24, 24]);\nNdef(\\dog).addSpec(\\timescale, [0.01, 10, \\exp]);\nNdef(\\dog).addSpec(\\curve, [-10, 10]);\nNdef(\\dog).addSpec(\\ffreq, \\freq);\n\nNdef(\\dog).addSpec(\\loopnode, [0, 12]);\nNdef(\\dog).addSpec(\\dens, [10, 1000]);\nNdef(\\dog).addSpec(\\resfreq, \\freq);\nNdef(\\dog).addSpec(\\ringtime, [0.01, 1, \\exp]);\n\nNdef(\\dog, { |amp, freq=250, intv=19, timescale=1, curve=0, loopnode=0, dens = 10, resfreq = 500, ringtime = 0.01|\n var n = 15;\n var env = EnvGen.kr(\n Env({ 1.0.rand2 }!(n+1), {1.0.rand}!n, curve, releaseNode: n-1, loopNode: loopnode.min(n-3)),\n timeScale: timescale);\n var pitch = (env * [1, 0.33, -1] * intv).midiratio * freq;\n var form = Formant.ar(pitch, pitch.rotate(1) * 1.6, pitch.rotate(2) * 2.6);\n\n var dusty = Ringz.ar(\n Dust.ar(dens!3), \n resfreq * LFNoise0.kr([3, 5, 7], 0.5, 1), \n ringtime) \n * ((dens ** -0.5) * (ringtime ** -0.3)\n );\n \n Splay.ar(form * dusty, level: amp) ;\n});\n);\n\nNdef(\\dog).addHalo(\\orderedNames, Ndef(\\dog).controlKeys);\n\n/*\nNdef(\\dog).controlKeys;\nNdef(\\dog).vol_(0.5);\nNdefPreset( Ndef(\\dog) ).loadSettings;\nNdef(\\dog).play;\nNdef(\\dog).gui;\n*/\n```"}]} -{"conversations": [{"role": "user", "content": "What does `String.postcs` do?"}, {"role": "assistant", "content": "As #-postln, but posts the #-asCompileString#compileString of the receiver. `List[1, 2, [\"comment\", [3, 2]], { 1.0.rand"}]} -{"conversations": [{"role": "user", "content": "What does `LID.slots` do?"}, {"role": "assistant", "content": "An IdentityDictionary holding all the slots, i.e. controls, of the"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DelTapWr`."}, {"role": "assistant", "content": "```supercollider\n// a Buffer for the UGens to use, one second at the current sample rate\nb = Buffer.alloc(s, s.sampleRate * 1, 1);\n\n// write a signal into a delay, tap it at multiple times\nSynthDef(\\test, { |out, buffer|\n var src, tapPhase, tap1, tap2, tap3;\n src = WhiteNoise.ar(0.2) * Decay.kr(Dust.kr(3), 0.2);\n tapPhase = DelTapWr.ar(buffer, src);\n #tap1, tap2, tap3 = DelTapRd.ar(buffer, tapPhase,\n [0.2, 0.27, 0.303], // tap times\n 1, // no interp\n [1.0, 0.4, 0.2] // muls for each tap\n );\n Out.ar(out, [src + tap2, tap1 + tap3])\n}).add;\n\nx = Synth(\\test, [\\buffer, b]);\nx.free;\nb.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `LevelIndicator.style` do? What arguments does it take?"}, {"role": "assistant", "content": "Sets the style of the Arguments: val — An QLevelIndicatorStyle \\continuous or \\led (see #-stepWidth) `(`."}]} -{"conversations": [{"role": "user", "content": "What does `Pen.translate` do?"}, {"role": "assistant", "content": "Translate the coordinate system to have its origin moved by"}]} -{"conversations": [{"role": "user", "content": "Explain `IFFT` in SuperCollider briefly."}, {"role": "assistant", "content": "IFFT — Inverse Fast Fourier Transform The inverse fast fourier transform converts from frequency content to a signal. Category: UGens > FFT."}]} -{"conversations": [{"role": "user", "content": "Can you run this code and tell me if it works?"}, {"role": "assistant", "content": "No — I cannot execute SuperCollider. What I can tell you is what would break and why: bracket balance, arguments that must exist for the class, a SynthDef that never reaches Out, a SynthDef played before it is added, an envelope that frees the Synth immediately. For certainty, evaluate it: the post window reports errors precisely, and `s.plotTree` shows whether the node exists."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Routine`."}, {"role": "assistant", "content": "```supercollider\n(\nr = Routine { |inval|\n loop {\n // thisThread refers to the routine.\n postf(\"beats: % seconds: % time: % \\n\",\n thisThread.beats, thisThread.seconds, Main.elapsedTime\n );\n 1.0.yield;\n\n }\n}.play;\n);\n\nr.stop;\nr.beats;\nr.seconds;\nr.clock;\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Feedback with beats."}, {"role": "assistant", "content": "```supercollider\nNdef(\\a, {\n var src, loc, delay=0.01;\n src = Decay2.ar(Impulse.ar(1/8), LFNoise2.kr(4).range(0.001, 0.0001),\n LFNoise2.kr(4).range(0.005, 0.05))!2\n * Saw.ar(LFNoise2.kr(4).exprange(40, 4000));\n loc = BPF.ar(LocalIn.ar(2) + [src, 0], LFNoise0.kr(1/4).range(100, 1200).lag, 3.2);\n loc = GVerb.ar(loc, 100, 4, mul:0.02, add:loc);\n loc = Compander.ar(loc, loc, 0.9, 1, 0.001);\n loc = (loc * 0.501).tanh;\n loc = Compander.ar(loc, loc, 0.1, 1, 0.1); \n loc = DelayC.ar(loc, delay * 2, delay * 1);\n LocalOut.ar(loc.reverse * 0.49);\n Out.ar(0, loc * 0.9)\n}).play;\n\nNdef(\\b, {\n var src, loc, del;\n del = 1/100;\n src = Decay2.ar(TDuty.ar(1/4,0,Dseq([1, 0.5, 0.3, 0.1],inf)), \n LFNoise2.kr(4).range(0.001, 0.0001), LFNoise2.kr(4).range(0.005, 0.05))!2\n * Saw.ar(LFNoise2.kr(200).exprange(40, 14000));\n loc = BPF.ar(LocalIn.ar(2) + [src, 0], LFNoise2.kr(0.1).range(40, 400), 3.2);\n loc = GVerb.ar(loc, 100, 4, mul:0.02, add:loc);\n loc = Compander.ar(loc, loc, 0.9, 1, 0.001);\n loc = (loc * 0.51).tanh;\n loc = Compander.ar(loc, loc, 0.1, 1, 0.1); \n loc = DelayC.ar(loc, del * 2, del * 1);\n LocalOut.ar(loc.reverse * 0.45);\n Out.ar(0, Compander.ar(loc,loc,0.1, 1, 0.05) * 1.2)\n}).play;\n\nNdef(\\c, {\n var src, loc, del=1/4;\n src = Decay2.ar(Impulse.ar(1), 0.0001, 0.05) * SinOsc.ar(60);\n loc = src + LocalIn.ar(2);\n loc = BPF.ar(loc, 800, 3.2).softclip;\n loc = DelayN.ar(loc, del, [0, del]);\n LocalOut.ar(loc.reverse * 0.99);\n Out.ar(0, loc * 2)\n}).play;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `BBandPass` in SuperCollider briefly."}, {"role": "assistant", "content": "BBandPass — Band Pass Filter The B equalization suite is based on the Second Order Section (SOS) biquad UGen. Category: UGens > Filters > BEQSuite."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Ddup`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var freq, trig;\n var in = Dseq([1, 2, 3], inf);\n var rep = Ddup(Diwhite(2, 8, inf), in);\n trig = Impulse.kr(MouseX.kr(1, 40, 1));\n freq = Demand.kr(trig, 0, rep).poll(trig) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\na = Ptime.new;\nx = a.asStream;\n);\n\nx.next;\nx.next;\nx.next;\n\n// post time in a playing event stream\n(\nPbind(\n \\pfunc, Ptime.new.trace,\n \\dur, Pseries(0.5, 0.5, 5)\n).play;\n);\n\n\n// change degree independant of number of events that have been playing\n\n(\nvar a, b;\na = Pbind(\n \\degree, Pswitch(#[0, 2b, 3], Ptime(8).round(2) / 2),\n \\dur, Prand(#[0.2, 0.5, 1.1, 0.25, 0.15], inf)\n);\nb = Pbind(\n \\degree, Pseq(#[0, 2b, 3], 1),\n \\dur, 2,\n// …\n```"}, {"role": "assistant", "content": "post time in a playing event stream change degree independant of number of events that have been playing (Ptime: returns time in beats from moment of embedding in stream)"}]} -{"conversations": [{"role": "user", "content": "What does `Cyton.uVScale` do?"}, {"role": "assistant", "content": "A Float scaling factor used internally to convert from 24bit to microvolt (uV). This factor differ for each"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\ns.boot;\n(\n{\n// Move the mouse. This varies from sinewave (left) to almost-square (right)\nvar sig = (SinOsc.ar(MouseY.kr(100, 1000, 1)) * MouseX.kr(1,10)).clip2(1);\nvar val = Crest.kr(sig, 440).poll;\n(sig * 0.1).dup\n}.play\n);\n\n(\n// Or as a plot (which shows the odd results you get over the first few samples):\n{\nvar sig = (SinOsc.ar(440, pi.rand) * XLine.kr(1,10, 5)).clip2(1);\nvar val = Crest.kr(sig, 440).poll;\nOut.ar(0, sig * 0.1.dup);\nK2A\n// …\n```"}, {"role": "assistant", "content": "Move the mouse. This varies from sinewave (left) to almost-square (right) Or as a plot (which shows the odd results you get over the first few samples): (Crest: Measure the temporal crest factor of a signal)"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Change arg values of MIDIdef after instantiation."}, {"role": "assistant", "content": "```supercollider\n~mdef =\n{\n |key, func, msgNum, permanent = true|\n\n MIDIdef(key, func ?? { MIDIdef(key).func }, msgNum ? MIDIdef(key).msgNum, MIDIdef(key).chan, MIDIdef(key).msgType, MIDIdef(key).srcID).permanent_(permanent)\n}\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Ndef\nNdef(\\a, { Saw.ar(12) }).asCode;\n\n// in a pushed proxy space\np = ProxySpace.push(s.boot);\n~x = { Saw.ar(123, 0.1 };\n~x.play;\n~x.asCode;\n\np.end.pop;\n\n// anonymous nodeproxy also posts instructions:\nx = NodeProxy.new.source = { DC.ar };\nx.asCode;\n\nx.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Ndef\nNdef(\\a, { Saw.ar(12) }).asCode;\n\n// in a pushed proxy space\np = ProxySpace.push(s.boot);\n~x = { Saw.ar(123, 0.1) };\n~x.play;\n~x.asCode;\n\np.end.pop;\n\n// anonymous nodeproxy also posts instructions:\nx = NodeProxy.new.source = { DC.ar };\nx.asCode;\n\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BPZ2`."}, {"role": "assistant", "content": "```supercollider\n// Compare:\n\n{ WhiteNoise.ar(0.25) }.play;\n\n{ BPZ2.ar(WhiteNoise.ar(0.25)) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "How do I set the tempo?"}, {"role": "assistant", "content": "TempoClock.default.tempo = 120/60; the argument is beats per second, so 120 BPM is 2.0. Patterns scheduled on the default clock then follow it."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// load from a file\n(\nx = AminoacidPattern.new.loadData(\"data/escherichia-coli\".resolveRelative);\nx.genome.postln; // the nucleic acids\nx.asStream.all.postcs; // the aminoacids\n);\n\n// sonify the aminoacids by mapping them to degrees in a TET-72 scale:\n\n(\nSynthDef(\\amino, { | out, freq = 440, sustain = 1.0, pan, p, amp = 0.1 |\n var u;\n u = EnvGen.ar(Env.perc(0.001, sustain), doneAction:2) *\n SinOsc.ar(freq,\n SinOsc.ar(freq * p, 0, BrownNoise.kr\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// load from a file\n(\nx = AminoacidPattern.new.loadData(\"data/escherichia-coli\".resolveRelative);\nx.genome.postln; // the nucleic acids\nx.asStream.all.postcs; // the aminoacids\n);\n\n// sonify the aminoacids by mapping them to degrees in a TET-72 scale:\n\n(\nSynthDef(\\amino, { | out, freq = 440, sustain = 1.0, pan, p, amp = 0.1 |\n var u;\n u = EnvGen.ar(Env.perc(0.001, sustain), doneAction:2) *\n SinOsc.ar(freq,\n SinOsc.ar(freq * p, 0, BrownNoise.kr(pi/8), 0.5pi)\n );\n Out.ar(out, Pan2.ar(u, pan, amp));\n\n}).add;\n);\n\n(\nPbind(\n \\instrument, \\amino,\n \\degree, x,\n \\stepsPerOctave, 72,\n \\dur, 0.1,\n \\legato, 0.8\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is a Buffer, and how is it different from a SoundFile?"}, {"role": "assistant", "content": "A Buffer is server-side memory: an array of samples (or a wavetable) living on scsynth, addressed by an integer bufnum. A SoundFile is a language-side object for reading or writing a file on disk. `Buffer.read(s, path)` loads a sound file into server memory and gives you a Buffer; `SoundFile.openRead(path)` just reads metadata such as duration and sample rate without loading audio. PlayBuf, GrainBuf and BufRd all take a Buffer, never a SoundFile."}]} -{"conversations": [{"role": "user", "content": "What does `PopUpTreeMenu.tree` do?"}, {"role": "assistant", "content": "Dictionary of dictionaries. Branches terminate if they have an empty dictionary as a value (="}]} -{"conversations": [{"role": "user", "content": "What does `ListView.defaultCanReceiveDrag` do?"}, {"role": "assistant", "content": "A view displaying a list of text items. Returns: True if the current drag data is a number."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Gates (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\plop).put(0, { arg freq=200, rq=0.1, pan=0, amp=0.1;\n var sig;\n var sig1, sig2, sig3, sig4, sig5, sig6, sig7, sig8;\n sig1 = WhiteNoise.ar(1, 0);\n sig2 = LPF.ar(WhiteNoise.ar(1, 0), SinOsc.kr(1/16 * [1,2,3,4]/2).range(100,9001));\n sig3 = LFSaw.ar(( freq* [1/2,1,2,1] ).clip(20,15000)) * [1,4,1/2,2];\n sig1 = SelectX.ar(\\mixg.kr(0.5)*2, [sig1, sig2, sig3]);\n sig = Gate.ar(sig1, LFPulse.ar( SinOsc.kr(1/8 * [1,2,3,4].reverse/2).range(30,100), 0.5));\n sig = Gate.ar(sig, LFPulse.ar( freq ));\n sig = RLPF.ar(sig, ( freq * SinOsc.kr([1,2,3,4]/4).range(1,4) ).clip(20,15000), rq * [1,2,3,4]);\n sig1 = LFPulse.ar(freq * [1,1/2]) * [1,1/2];\n sig = SelectX.ar(\\mix.kr(0.8)*2, [sig, sig1 * sig, sig1]);\n sig1 = BPF.ar(sig, ( freq*2 ).clip(20,15000), rq) * 5;\n sig2 = BPF.ar(sig, freq, rq) * 5;\n sig3 = BPF.ar(sig, freq/2, rq) * 5;\n sig = SelectX.ar(\\mix2.kr(0.6) * 3, [sig, sig1, sig2, sig3]);\n sig = Pan2.ar(sig, LFNoise1.kr(1/2 * [1,2,3,4]).range(-1.0,1.0) * 0.3, amp).mean;\n}).play;\n\nSpec.add(\\mix, \\unipolar);\nSpec.add(\\mix2, \\unipolar);\nSpec.add(\\mixg, \\unipolar);\n);\n\nNdef(\\plop).edit;\n\nNdef(\\plop).unset(\\freq);\n\n(\n Ndef(\\plop).put(1, \\set -> Pbind(\n \\degree, Pseq([\n 0,3,2,3,\n 4,2,2,3,\n ],inf),\n \\octave, 4,\n \\dur, Pseq([1,2,4,1],inf)/4,\n )\n);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Env`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var env = Env([0.0, 0.5, 0.0, 1.0, 0.9, 0.0], [0.05, 0.1, 0.01, 1.0, 1.5], -4);\n var envgen = EnvGen.ar(env, doneAction: Done.freeSelf);\n env.plot;\n SinOsc.ar(\n envgen * 1000 + 440\n ) * envgen * 0.1\n}.play\n);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Wow, the conciseness of SuperCollider is wonderful!."}, {"role": "assistant", "content": "```supercollider\n(\na=Array.fib(64,0,1);b=Array.fill(size:12,function:{arg i;a[i]%8});\np=1/8;Pdef(\\x,Pbind(\\dur,p,\\degree,Pseq(b,1,0)));\nr=Array.fill(12,{arg i;Pbindf(Pdef(\\x),\\mtranspose,b[i]);});\nPseq(r,(1/p)).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// timing offset = 0\np = Pbind(\\freq, 440, \\pan, -1, \\delta, 1.0, \\sustain, 0.1).play(quant: [2, 0, 0]);\n// timing offest = 0.1\nq = Pbind(\\freq, 880, \\pan, 1, \\delta, 0.5, \\sustain, 0.1).play(quant: [2, 0, 0.1]);\n);\n\n// p's nextBeat is x.0 - q's is x.4 or x.9 (e.g., halves of a beat minus 0.1)\n[p.nextBeat, q.nextBeat\n\np.stop; q.stop;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// timing offset = 0\np = Pbind(\\freq, 440, \\pan, -1, \\delta, 1.0, \\sustain, 0.1).play(quant: [2, 0, 0]);\n// timing offest = 0.1\nq = Pbind(\\freq, 880, \\pan, 1, \\delta, 0.5, \\sustain, 0.1).play(quant: [2, 0, 0.1]);\n);\n\n// p's nextBeat is x.0 - q's is x.4 or x.9 (e.g., halves of a beat minus 0.1)\n[p.nextBeat, q.nextBeat]\n\np.stop; q.stop;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// for the members of the cult of q\n// who don't want to ~tilde\n\n\n//-- INIT\nq = q ? ();\n\nq.local = currentEnvironment;\n\nq.local.pattern = Pbind(\\note, Pbrown(0, { 17.rand + 1 } ! 12), \\dur, 0.05, \\amp, 0.01);\n\n\n//-- PLAY\n\nq.local.player = q.local.pattern.play;\n\n\n\n\n//-- STOP\n\nq.local.player.stop;\n\n//-- FREE\n\nq.local = nil;\n```"}, {"role": "assistant", "content": "for the members of the cult of q who don't want to ~tilde -- INIT."}]} -{"conversations": [{"role": "user", "content": "What is the difference between ~foo and a local variable?"}, {"role": "assistant", "content": "`var foo` is a local: it exists only inside the function or file block that declares it. `~foo` is an environment variable: it lives in the current Environment, survives between executions of the same block, and is visible to everything running in that environment. That is why `~buf = Buffer.read(s, path)` works in one cell and `PlayBuf.ar(1, ~buf)` works in the next, while a `var` would be gone."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nNdef(\\nodeTest, {\n // the input\n var input = Impulse.ar([1, 3, 5].reciprocal, phase: [0, 0.133, 0.5]).sum;\n\n // the nodes, each takes its predecessor as input and estimates the duration between two events. \n // Unfortunately, the starting point of Timer is '0' which we have to put into reasonable limits. System settles after about 15 seconds\n var nodes = (1..10).inject([input], {|last, item| \n [TDuty.ar(max(0.25, Timer.ar(last.first)), 0, 1)] ++ last\n });\n\n // add a pitch to each\n nodes = nodes.collect{|node, i| SinOsc.ar((4000 + (i*500))) * Decay2.ar(node, 0.01, 0.2)};\n\n // splay in stereo field\n Splay.ar(nodes);\n\n}).play\n)\n```"}, {"role": "assistant", "content": "Idea: network of loosely connected nodes. Each node has a dedicated pulse rate / phase. Inducing an irregular trigger signal influences the nodes to (gradually) adapt their pulsation freq (and phase?) to the one of the input.\r\nsound example: https://soundcloud.com/lfsaw/sync-weakconnection-tduty-time."}]} -{"conversations": [{"role": "user", "content": "Explain `RecursiveCutProc1` in SuperCollider briefly."}, {"role": "assistant", "content": "RecursiveCutProc1 — Recursive breakbeat cutting, version 2 This class implements explicit recursive cutting, as described in LMJ13. The level of recursion can be set as a parameter of the cut procedure. The user chooses cut, repeat and offset functions which are applied through successive iteratinos to make new cut sequences. Only the final cut sequence of a cut sequence of a cut sequence... is rendered. Category: Libraries > BBCut > Cut procedures."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `QuadC`."}, {"role": "assistant", "content": "```supercollider\n// logistic map\n// equation: x1 = -r*x0^2 + r*x0\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n QuadC.ar(SampleRate.ir/4, r.neg, r, 0, 0.1) * 0.4;\n}.play(s);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes alone in the storm (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\alone, { arg amp=0.5;\n var source, local, lfo;\n\n lfo = LFNoise1.kr(0.32).abs*50+[70,0.01];\n source = Decay.ar(Impulse.ar(lfo), 0.1) * WhiteNoise.ar(0.2);\n source = source * [LFNoise1.ar(0.17,0.4,1.1), LFNoise1.ar(0.57,1,1)];\n source = source;\n\n local = LocalIn.ar(2) + source;\n\n local = LPF.ar(local, 400 + LFNoise1.kr(0.1,300,100)) * 1.5;\n local = HPF.ar(local, 100 + LFNoise1.kr(0.15,050,050)) * 1.0;\n local = DelayN.ar(local, 0.2, 0.1);\n\n local = Limiter.ar(local.reverse,0.5);\n LocalOut.ar(local * 0.6);\n local = [local, Decay.ar(Impulse.ar(LFNoise1.kr(2.12).exprange(2,400)), 0.2 + LFNoise1.kr(0.11,0.1)) * local];\n local = FreqShift.ar(local, LFNoise1.kr(LFNoise1.kr(0.21).exprange(0.1,5)).exprange(0.1,500));\n local = HPF.ar(local, LFNoise1.kr(0.4).range(50,170), LFNoise1.kr(0.1).range(0.1,0.7));\n\n Splay.ar(local, LFNoise1.kr(0.21).range(0,1)) * amp;\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//multiple objects within a world with gravity force\n//color and size depends on object's mass\n\n(\nvar width= 300, height= 300, w, wgrav, world, n= 80;\n\n//--world\nw= RedWindow(\"vector test\", Rect(128, 64, width, height)).front;\nwgrav= RedVector2D[-0.1, 0.98]; //world xy gravity\nworld= RedWorld3(RedVector2D[width, height], wgrav, 20, 0.2); //dim,grav,maxvel,damp\n\n//--objects\n{\n var mass= 1.0.rrand(4); //random mass for each object\n RedObject(world, RedVector2D[width, 20].rand, 0, 0, mass, mass*5); //world,loc,vel,acc,mass,size\n}.dup(n);\n\n//--loop\nw.draw{\n world.objects.do{|o|\n o.addForce(world.gravity);\n o.update;\n world.contain(o);\n\n //--render\n Pen.strokeColor= Color.grey(o.mass/4);\n Pen.strokeRect(Rect.aboutRedObject2D(o));\n };\n};\nw.play;\nCmdPeriod.doOnce({w.close});\n)\n```"}, {"role": "assistant", "content": "multiple objects within a world with gravity force color and size depends on object's mass."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pgate`."}, {"role": "assistant", "content": "```supercollider\n// Use \\step to change the octave randomly\n(\nPbind(\n \\degree, Pseq((0..7), inf),\n \\step, Pseq([false, false, false, true, false, true, false], inf),\n \\octave, Pgate(Pwhite(3, 7), inf, \\step),\n \\dur, 0.2\n).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for aurora borealis?"}, {"role": "assistant", "content": "```supercollider\n(\n~root = -13;\n~revSend = Bus.audio(s, 2);\n);\n(\ns.waitForBoot(\n {\n \n SynthDef(\\bell, {\n |\n freq=556, findex=0, frate=2,\n dur=5, pos=0,\n amp=0.25,\n out=0\n |\n var sigA, sigB, sigC, sig, env, fmod;\n env = EnvGen.ar(Env.triangle(5), doneAction:2);\n fmod = findex * SinOsc.kr(frate, mul:0.5, add:0.5) * Line.kr(0, 1, 7);\n sigA = Pulse.ar(freq + fmod, LFNoise2.kr(1).range(0.2, 0.8) );\n sigB = VarSaw.ar(freq + fmod);\n sigC = WhiteNoise.ar() * 0.125;\n sig = SelectX.ar(LFNoise2.kr(2).range(0, 2), [sigA, sigB, sigC]);\n sig = LPF.ar(sig, freq*4 );\n sig = sig * env * amp;\n Out.ar(out, Pan2.ar(sig, pos));\n }).add;\n\n s.sync;\n\n SynthDef(\\rev, {\n arg in=0, out=0, mix=1, room=0.8;\n var sig;\n sig = In.ar(in, 2);\n sig = FreeVerb.ar(sig, mix, room);\n Out.ar(out, sig);\n }).add;\n\n s.sync;\n\n ~rev = Synth(\\rev, [\\in, ~revSend]);\n\n x = Pbind(\n \\instrument, \\bell,\n \\out, ~revSend,\n \\root, Pfunc({~root}),\n \\octave, Pwrand([4, 5, 6, 7], [6,8,3,1].normalizeSum, inf),\n \\degree, Prand(Scale.lydian.degrees, inf),\n \\ctranspose, Pwhite( -0.05, 0.05, inf),\n \\amp, 1.1 * Pexprand(0.001, 0.7) * (1/(Pkey(\\octave)+1)),\n \\findex, Pexprand(2, 20),\n \\frate, Pwhite(1, 25, inf),\n \\pos, Pwhite(-0.8, 0.8, inf),\n \\dur, Pwhite(0.1, 0.5),\n ).asEventStreamPlayer;\n x.play;\n\n wait(15);\n r = Routine({\n \"starting\".postln;\n loop({\n ~root = [-13, -1, 4, 7].choose;\n wait( 10.rrand(25) );\n });\n });\n r.play;\n});\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Recorder.record` do? What arguments does it take?"}, {"role": "assistant", "content": "Starts or resumes recording the Arguments: path — this is optional, and is passed to `prepareForRecord` (above).; bus — The bus (Bus object or integer bus index), the offset at which to start to count the number of channels. You can record any adjacent number of bus channels.; numChannels — The number of output channels to record.; node — The Node to record immediately after. By default, this is the default group 1.; duration — If set, this limits recording to a given time in seconds.."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Random arpeggio by default (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\n Pbind(\n \\instrument, \\default,\n \\degree, Pwalk(#[c, e, g, c],1, Prand([-1,1],inf).stutter(Pwhite(1,10))) +\n Pseq([Pn(0,64),\n Prand([\n 0,\n [0,2,3],\n ],inf)\n ]),\n \\root, Pwhite(0,-8).stutter(32),\n \\mtranspose, Pwhite(-8,8).stutter(8),\n \\dur, 1/8,\n \\isRest, Pwrand([0,1], [0.1,1],inf).coin.not,\n \\legato, Pwhite(0.1,1.2),\n \\amp, 0.1\n ).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for strange device found in space )\r\n\r\np.s?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n Limiter.ar(HPF.ar(\n GVerb.ar(\n Pan2.ar(\n PMOsc.ar(\n Demand.kr(\n Impulse.kr(\n SinOsc.kr(SinOsc.kr(1/30).range(1/10, 1/15)).range(0, 25)\n * LFPulse.kr(0.2).range(0.5, 1)\n + \n LFDNoise3.kr(1/10, 10, 10)\n ), \n 0, \n Dxrand(Array.geom(100, 50, 1.06), inf) + Dgeom(1, 1.005)\n ),\n [[3,5],[7,11]] + SinOsc.ar([1/60, 1/45]).range(0, 1300),\n Demand.kr(\n Impulse.kr(SinOsc.kr(0.1).range(0.1, 20)),\n 0,\n Dxrand(Array.series(13, 0, 0.5), inf)\n )\n ).sum,\n SinOsc.ar(1, mul:0.5),\n LFPar.ar([1/5,1/3]).range(0.3, 1)\n ), \n 250, \n 0.5, \n damping:SinOsc.kr(1/20).range(0.2,0.7), \n drylevel: SinOsc.kr(1/15).range(0.2,0.7), \n earlyreflevel:0.3\n ) * 0.1\n +\n LFDNoise3.ar(SinOsc.kr(1/15, [0, pi/4]).range(100,350), 0.3),\n [SinOsc.ar(1/45, [0,pi/2]).range(20, 120)]\n ))\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n+ String {\n decodeHex {\n var new = String.new, stream = CollStream(this), ch, int;\n while {\n ch = stream.next;\n ch.notNil\n } {\n if(ch == $%) {\n ch = stream.next;\n if(ch.notNil) {\n int = ch.digit << 4;\n } {\n // If the string ends with %, then 'ch' after that is nil\n // so we can just append the %\n ^new.add($%);\n };\n ch = stream.next;\n if(ch.notNil) {\n ch = (int + ch.digit).asAscii;\n } {\n // If we got this far, we know there was one (only one) char after %\n // so add them both\n ^new.add($%).add(this.last);\n };\n };\n new = new.add(ch);\n };\n ^new\n }\n}\n```"}, {"role": "assistant", "content": "A quick utility function for decoding UTF-8 characters in %hex codes (such as for web URLs). Save the code into a .sc file in your Extensions/ directory, recompile, and then:\r\n\r\n\"%E5%A4%A7%E5%AE%B6%E5%A5%BD\".decodeHex;\r\n-> 大家好\r\n\r\nThis probably works only for UTF-8. SC can save the individual bytes of Unicode characters into String objects, and the IDE will print UTF-8 code points correctly, but th."}]} -{"conversations": [{"role": "user", "content": "What does `AudioIn.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Read audio input. Arguments: channel — Input channel number to read. Channel numbers begin at 1.; mul; add."}]} -{"conversations": [{"role": "user", "content": "Explain `EaseOutBack` in SuperCollider briefly."}, {"role": "assistant", "content": "EaseOutBack — Back ease-out Easing equation for a back (overshooting cubic easing: (a+1)*t^3 - a*t^2) ease-out, decelerating from zero velocity. The a parameter controls overshoot, the default producing a 10% overshoot. Category: Ease."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes danger loud click."}, {"role": "assistant", "content": "```supercollider\n// proceed with caution. start at min volume, and not with your expensive speakers.\n\nfork{b=Buffer.alloc(s,512,1);inf.do{b.cheby({[1,0].choose}!2);{(Shaper.ar(b,SinOsc.ar(55,0,Line.kr(1,0,2,1,0,2))))!2}.play;0.1.wait;}};\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Pwhile` in SuperCollider?"}, {"role": "assistant", "content": "Pwhile — While a condition holds, repeatedly embed stream Repeatedly embed a Stream while the result of `func` is `true`. Category: Streams-Patterns-Events > Patterns > Language Control."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// With the indices arg arbitrary series from the buffer can be played.\n// Passing an array we define an index sequence which doesn't depend on lookBack\n\n(\n~lookBack = 0;\n\np = PSloop(\n Pbind(\n \\dur, Pn(Pshuf([1, 1, 2]/6)),\n \\midinote, Pseq((60..80), inf)\n ),\n bufSize: 10,\n lookBack: { ~lookBack },\n indices: [0, 1, 0, 1, 2, 0, 1, 2, 3]\n).trace.play\n);\n\n// wait a bit to fill buffer\n// start loop with useful lookBack (here > 3)\n\n~lookBack = 4\n\n~lookBack = 6\n\n\n// go on and loop again\n\n~lookBack = 0;\n\n~\n// …\n```"}, {"role": "assistant", "content": "With the indices arg arbitrary series from the buffer can be played. Passing an array we define an index sequence which doesn't depend on lookBack (PSloop: Pattern to derive loops from a given Pattern)"}]} -{"conversations": [{"role": "user", "content": "What is `Association` in SuperCollider?"}, {"role": "assistant", "content": "Association — relate two objects Associates a key with a value. Associations can be created via the -> operator which is defined in class Object. Category: Collections."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Psetpre`."}, {"role": "assistant", "content": "```supercollider\n(\nvar a, b;\na = Psetpre(\\freq, 801, Pbind(\\dur, 0.5));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Those were the times."}, {"role": "assistant", "content": "```supercollider\n(\ns.waitForBoot({\n\n SynthDef(\\singer, {\n | out=0, freq=440, amp=0.5, vibrato=6|\n var lfo, lfo2, lfo3, sig;\n lfo = SinOsc.kr(1/5, 0).range(250,1000);\n lfo2 = SinOsc.kr(1/5, 0).range(0.1,0.9);\n lfo3 = SinOsc.kr(vibrato).range(0.3, 1);\n sig = lfo3*RLPF.ar(in:VarSaw.ar(freq:Lag.ar(in:K2A.ar(freq), lagTime:0.3), iphase:0, width:lfo2, mul:amp), freq:lfo, rq:200/lfo);\n Out.ar(out, sig!2);\n }).add;\n\n s.sync;\n\n Pdef.defaultQuant_(0);\n Pdef(\\bass, Pmono(\\default, \\dur, Pwhite(0.01, 0.1, inf), \\freq, (Pgbrown(1,8,5) * 20).round(10), \\amp, Pbrown(0.2,0.6,0.05)));\n Pdef(\\computer, Pmono(\\default, \\dur, Pwhite(0.01, 0.1, inf), \\freq, (Pgbrown(1,8,9) * 100).round(20), \\amp, Pbrown(0.2,0.6,0.05)));\n Pdef(\\soprano, Pmono(\\singer, \\dur, Pwhite(0.01, 0.1, inf), \\freq, Pgbrown(1,8,0.05) * 200, \\amp, Pbrown(0.2,0.6,0.05)/5, \\vibrato, Pbrown(4,7,0.125)));\n Pdef(\\soprano2, Pmono(\\singer, \\dur, Pwhite(0.01, 0.1, inf), \\freq, Pbrown(3,6,0.1) * 100, \\amp, Pbrown(0.2,0.6,0.05)/5, \\vibrato, Pbrown(3,8,0.125)));\n\n fork {\n Pdef(\\bass).play;\n 10.wait;\n Pdef(\\computer).play;\n 10.wait;\n Pdef(\\soprano).play;\n 10.wait;\n Pdef(\\soprano2).play;\n 10.wait;\n Pdef(\\computer).stop;\n 20.wait;\n Pdef(\\bass).stop;\n 10.wait;\n Pdef(\\soprano).stop;\n Pdef(\\soprano2).stop;\n Pdef(\\bass).play;\n Pdef(\\soprano).play;\n 10.wait;\n Pdef(\\soprano2).play;\n 10.wait;\n Pdef(\\computer).play;\n 20.wait;\n Pdef(\\bass).stop;\n Pdef(\\computer).stop;\n Pdef(\\soprano).stop;\n Pdef(\\soprano2).stop;\n }\n\n});\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `BusSpec` in SuperCollider briefly."}, {"role": "assistant", "content": "BusSpec — datatype specifying a Bus object Category: Spec, Libraries > crucial > Spec."}]} -{"conversations": [{"role": "user", "content": "What is `IdentityDictionary`?"}, {"role": "assistant", "content": "IdentityDictionary — associative collection mapping keys to values"}, {"role": "user", "content": "What does `IdentityDictionary.new` do?"}, {"role": "assistant", "content": "The #-parent and #-proto instance variables allow additional IdentityDictionary's to provide default values. The precedence order for determining the value of a key is the IdentityDictionary, its prototype, its parent. When the instance variable #-know is True, the IdentityDictionary responds to unknown messages by looking up the selector and evaluating the result with the dictionary as an argumen"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_sinegrain, { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0.5pi, env))\n}).add;\n\na = Pbind(\\instrument, \\help_sinegrain, \\note, Pseq([0, 7, 2, 9, 11, 10, 9, 8], inf), \\dur, 1);\na.play(quant: (quant: 1, phase: 0));\na.play(quant: (quant: 1, phase: 1/3));\na.play(quant: (quant: 1, phase: 1.0.rand));\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PauseSelf`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"pauseSelf-help\", { |out, t_trig|\n PauseSelf.kr(t_trig);\n Out.ar(out, SinOsc.ar(400, 0, 0.2));\n}).add;\n);\n\ns.sendMsg(\"/s_new\", \"pauseSelf-help\", 1731);\ns.sendMsg(\"/n_set\", 1731, \\t_trig, 1);\ns.sendMsg(\"/n_run\", 1731, 1);\ns.sendMsg(\"/n_set\", 1731, \\t_trig, 1);\ns.sendMsg(\"/n_free\", 1731);\n```"}]} -{"conversations": [{"role": "user", "content": "How do I make this brighter?\n```supercollider\n{ LPF.ar(Saw.ar(110), 400) * 0.2 }.play;\n```"}, {"role": "assistant", "content": "Raise the cutoff. 400 Hz is well below the harmonics that carry brightness, so open it to 2000-4000 Hz:\n\n```supercollider\n{ LPF.ar(Saw.ar(110), 3000) * 0.2 }.play;\n```"}, {"role": "user", "content": "Still dull."}, {"role": "assistant", "content": "Then the low-pass is not the limit — the source is. A saw at 110 Hz has energy up to Nyquist, so check the amplitude: at 0.2 the high harmonics are quiet. Two moves: add resonance so the filter peak is audible, and raise the level slightly.\n\n```supercollider\n{ RLPF.ar(Saw.ar(110), 2500, 0.3) * 0.35 }.play;\n```\n\nIf that is still dull, the answer is a different source: `Saw` is band-limited and soft; try `LFSaw` or add a second detuned saw for more high content."}]} -{"conversations": [{"role": "user", "content": "What does `EnvelopeView.thumbSize` do?"}, {"role": "assistant", "content": "Sets both #-thumbWidth and #-thumbHeight to the"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n Ndef(\\x, {\n var output;\n var delayTime;\n var delayMax = 0.2;\n var delayAdd = 0.1;\n var pulseFreq = 0.5;\n var proxyMul = 2;\n var pulseMin = 40;\n var pulseMax = 130;\n var numOfEchos = 2;\n\n var mainPulse = LFPulse.ar(pulseFreq, 0, 0.5).range(pulseMin, pulseMax);\n var proxy = Ndef(\\x).ar * proxyMul;\n var ampModFreq = SinOsc.ar(0.01, 0).range(0.3, 30);\n var ampMod = LFNoise1.ar(ampModFreq, 6);\n output = SinOsc.ar(mainPulse + proxy, 0, ampMod).tanh;\n numOfEchos.do{\n delayTime = {delayMax.rand + delayAdd}!2;\n output = AllpassL.ar(output, 0.1, delayTime, 5);\n };\n output.tanh;\n }).play\n)\n```"}, {"role": "assistant", "content": "Something I put together a while back by forking Dark Sea Horns."}]} -{"conversations": [{"role": "user", "content": "What does `Function.fork` do?"}, {"role": "assistant", "content": "Returns a Routine using the receiver as it's function, and plays it in a TempoClock. `{ 4.do({ \"Threading...\".postln; 1.wait })"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Now you're going to die (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\fall, { arg freq=200, pan=0, amp=0.1;\n var sig;\n sig = ( WhiteNoise.ar + 0.8 ) * LFSaw.ar({ exprand(10.0,10000) }!20 * ( 1 + ( SinOsc.ar((1..4).rand(0.0)/18 * XLine.kr(1,121200,80)) * 1/41 * XLine.kr(1,180,60) )));\n sig = DelayC.ar(sig, 0.2, {rrand(1/5,1/10000) * ( 1 + ( SinOsc.ar((1..2).rand(0.0)/18 * XLine.kr(1,121200,60)) * 1/41 * XLine.kr(1,180,60) ))}!4) + sig / 2;\n sig = DelayC.ar(sig, 0.2, {rrand(1/5,1/10000) * XLine.kr(1,1/1000,14)}!4) + sig / 2;\n sig = sig + BPF.ar(\n sig, \n { ( exprand(100.0,10000) * LFNoise1.ar(1/100.0.rand).range(1,2) ).clip(20,20000) }!10,\n { ( rand(0.01,1) * LFNoise1.ar(1/100.0.rand).range(1,2) ).clip(0.01,1) }!10\n );\n sig = BRF.ar(\n sig, \n { ( exprand(100.0,10000) * LFNoise1.ar(1/100.0.rand).range(1,2) ).clip(20,20000) }!10,\n { ( rand(0.01,1) * LFNoise1.ar(1/100.0.rand).range(1,2) ).clip(0.01,1) }!10\n );\n sig = LeakDC.ar(sig);\n sig = LPF.ar(sig, 17000 * XLine.kr(1/100,1,4));\n sig = sig * 5 * 3;\n sig = sig.mean;\n sig = sig * amp;\n sig;\n}).play;\n);\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// check blockSize before (or reset blockSize in examples)\n\n(\nif (s.options.blockSize != 64) {\n s.options.blockSize = 64;\n s.quit.reboot;\n}\n);\n\n// With divisions we must avoid division by zero resp. blowup, here it's max in the divisor.\n// The example also establishes a cross-feedback of the two channels by using reverse.\n\ns.scope\n\n// start fb fx Synth\n\n(\n~bus = Bus.audio(s, 2);\n\ny = {\n var inSig = In.ar(~bus, 2);\n var lfo = LFDNoise3.ar(1).linexp(-1, 1, 0.2, 10);\n LPF.ar(\n Fb1({ |\n// …\n```"}, {"role": "assistant", "content": "check blockSize before (or reset blockSize in examples) With divisions we must avoid division by zero resp. blowup, here it's max in the divisor. (Fb1: single sample feedback / feedforward pseudo ugen)"}]} -{"conversations": [{"role": "user", "content": "What are you good at?"}, {"role": "assistant", "content": "SuperCollider. I can explain its classes and UGens, write SynthDefs and patches, read a patch back to you, and tell you why one does not compile. I am 198M parameters; I am not a general assistant."}]} -{"conversations": [{"role": "user", "content": "What is `PopUpTreeMenu` in SuperCollider?"}, {"role": "assistant", "content": "PopUpTreeMenu — hierarchical PopUp menu This class is modelled after PopUpMenu, but implements submenus. Category: GUI."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ BrownNoise.ar(0.1) }.play;\n{ WhiteNoise.ar(0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ BrownNoise.ar(0.1) }.play;\n{ WhiteNoise.ar(0.1) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = NodeProxy.new.play;\na.source = { RLPF.ar(\\in.ar(0!2), [4600, 7000], 0.1) };\nb = NodeProxy.new.source_ { Impulse.ar([5, 7] / 2 };\na <<> b;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = NodeProxy.new.play;\na.source = { RLPF.ar(\\in.ar(0!2), [4600, 7000], 0.1) };\nb = NodeProxy.new.source_ { Impulse.ar([5, 7] / 2) };\na <<> b;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar carrier, modulator, depth, scale;\n\ncarrier = 440;\nmodulator = 650;\ndepth = 355.2;\n\n// generate a 5 step scale, picking the 5 most consonant steps from the dissonance curve\nscale = DissonanceCurve.fm(carrier, modulator, depth, 1202).scale(5);\n\nPbind(\n \\instrument, \\fm,\n \\scale, scale,\n \\degree, Pwhite(0, scale.size), // use scale.size as a limit in case the curve generates fewer than 5 steps\n \\carrier, carrier,\n \\modulator, modulator,\n \\depth, depth\n).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar carrier, modulator, depth, scale;\n\ncarrier = 440;\nmodulator = 650;\ndepth = 355.2;\n\n// generate a 5 step scale, picking the 5 most consonant steps from the dissonance curve\nscale = DissonanceCurve.fm(carrier, modulator, depth, 1202).scale(5);\n\nPbind(\n \\instrument, \\fm,\n \\scale, scale,\n \\degree, Pwhite(0, scale.size), // use scale.size as a limit in case the curve generates fewer than 5 steps\n \\carrier, carrier,\n \\modulator, modulator,\n \\depth, depth\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a kick drum in SuperCollider."}, {"role": "assistant", "content": "A pitch-swept sine with a fast decay: the frequency envelope is what makes it read as a kick.\n\n```supercollider\n(\nSynthDef(\\kick, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 50, 40], [0.03, 0.15], -4));\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -6), doneAction: 2);\n Out.ar(out, Pan2.ar(SinOsc.ar(pitch) * env * amp));\n}).add;\n);\nSynth(\\kick);\n```"}]} -{"conversations": [{"role": "user", "content": "Can you run this code and tell me if it works?"}, {"role": "assistant", "content": "No — I cannot execute SuperCollider. What I can tell you is what would break and why: bracket balance, arguments that must exist for the class, a SynthDef that never reaches Out, a SynthDef played before it is added, an envelope that frees the Synth immediately. For certainty, evaluate it: the post window reports errors precisely, and `s.plotTree` shows whether the node exists."}]} -{"conversations": [{"role": "user", "content": "What does `RedMixGUI.redMix` do?"}, {"role": "assistant", "content": "Return the current mixer (RedMixMono, RedMixStereo,"}]} -{"conversations": [{"role": "user", "content": "What is `Signal` in SuperCollider?"}, {"role": "assistant", "content": "Signal — Sampled audio buffer A Signal is a FloatArray that represents a sampled function of time buffer. Signals support math operations. Category: Collections > Ordered."}]} -{"conversations": [{"role": "user", "content": "What is `BStore` in SuperCollider?"}, {"role": "assistant", "content": "BStore — Radicles Buffer Store Manage Buffers for Radicles Category: Libraries > Radicles."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\np = Pbind(\n \\degree, Pseries(0, 1, inf).fold(-7, 7),\n \\dur, 0.125,\n \\type, Pwrand([\\note, \\rest], [0.9, 0.1], inf)\n).play;\n;\n\np.stop;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\np = Pbind(\n \\degree, Pseries(0, 1, inf).fold(-7, 7),\n \\dur, 0.125,\n \\type, Pwrand([\\note, \\rest], [0.9, 0.1], inf)\n).play;\n);\n\np.stop;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `FoaEncoderMatrix.numChannels` do?"}, {"role": "assistant", "content": "Answers the number of input channels (virtual loudspeakers or"}]} -{"conversations": [{"role": "user", "content": "What does `Document.keyDownAction` do? What arguments does it take?"}, {"role": "assistant", "content": "Get/set the action to be performed on Arguments: action — An instance of Function or FunctionList. The arguments passed to the function are: `document`, `char`, `modifiers`, `unicode`, `keycode`. See View#Key actions for details on these arguments.."}]} -{"conversations": [{"role": "user", "content": "What does `StaticIntegerSpec.constrain` do? What arguments does it take?"}, {"role": "assistant", "content": "an integer that is supplied at the init of a synth and cannot change Arguments: value."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\n(\nSynthDef(\"help-magMul\", { |out = 0|\n var inA, chainA, inB, chainB, chain;\n inA = WhiteNoise.ar(0.2);\n inB = LFSaw.ar(100, 0, 0.2);\n chainA = FFT(LocalBuf(2048), inA);\n chainB = FFT(LocalBuf(2048), inB);\n chain = PV_MagDiv(chainA, chainB);\n Out.ar(out, 0.5 * IFFT(chain).dup);\n}).play;\n);\n\n\nc = Buffer.read(s, ExampleFiles.child);\n\n(\nSynthDef(\"help-magMul2\", { |out = 0, soundBufnum = 0|\n var inA,\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\n(\nSynthDef(\"help-magMul\", { |out = 0|\n var inA, chainA, inB, chainB, chain;\n inA = WhiteNoise.ar(0.2);\n inB = LFSaw.ar(100, 0, 0.2);\n chainA = FFT(LocalBuf(2048), inA);\n chainB = FFT(LocalBuf(2048), inB);\n chain = PV_MagDiv(chainA, chainB);\n Out.ar(out, 0.5 * IFFT(chain).dup);\n}).play;\n);\n\n\nc = Buffer.read(s, ExampleFiles.child);\n\n(\nSynthDef(\"help-magMul2\", { |out = 0, soundBufnum = 0|\n var inA, chainA, inB, chainB, chain;\n inA = LFSaw.ar([100, 150], 0, 0.2);\n inB = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);\n chainA = FFT(LocalBuf(2048), inA);\n chainB = FFT(LocalBuf(2048), inB);\n chain = PV_MagDiv(chainA, chainB);\n Out.ar(out, 0.1 * IFFT(chain));\n}).play(s, [\\out, 0, \\soundBufnum, c]);\n);\n\nc.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes a Panthera Pardus meditates about his melanism."}, {"role": "assistant", "content": "```supercollider\n// a Panthera Pardus meditates about his melanism\n\n(\n~chrs = {|in, speed| DelayC.ar(in, 0.5, Array.fill(12, {|i| LFNoise2.ar(speed).range(0.022, 0.024);}).sum)};\n~phas = {|in, speed=1| var chain; chain = in+FreqShift.ar(in, 0, SinOsc.kr(speed).range(0, pi)).tanh; chain = chain + FreqShift.ar(chain, 0, SinOsc.kr(speed*0.97).range(0, pi)).tanh; chain=(chain*0.5).tanh; };\n~smear = {|in, bins=50| var chain; chain=FFT(LocalBuf(2048), in); chain=PV_MagSmear(chain, bins); chain=IFFT(chain)*0.5; };\n\nNdef.clear;\nNdef(\\pantheraPardus___).play;\nNdef(\\___hisInner).play;\nNdef(\\pantheraPardus___).fadeTime = 5;\nNdef(\\___hisInner).fadeTime = 50;\n\nNdef(\\pantheraPardus___, {arg amp=1;\n var sig, env, sig0, ctrl;\n ctrl = LFGauss.kr(5, 0.15);\n sig = (Saw.ar([LFNoise1.kr(1).range(15, 30), 0.025], 0.14)) * LFNoise2.kr(1).range(0.5, 1);\n sig = (sig + PinkNoise.ar(0.1) * LFNoise2.kr(1).range(0.1, 0.4)) * ctrl;\n sig = sig*0.25 + ~chrs.(~phas.(sig, [0.2, 0.174]), [0.1, 0.12]);\n sig = DynKlank.ar(`[[100, 200, 300, 1000, 4000, 9000], (ctrl.range(0.2/6, 1/6)*LFNoise2.kr(1).range(0.2, 1))!6, 0.025], sig*0.2);\n sig = ~smear.(sig, 5);\n sig = HPF.ar(LPF.ar(sig, (LFNoise2.kr(1.25).range(100, 2000))), 250); \n sig = Limiter.ar(GVerb.ar(Limiter.ar(sig), 4.5, 0.2, 0.9, 0.1), -6.dbamp)*15;\n});\n\nNdef(\\___hisInner, {arg amp=1;\n var sig = Saw.ar(Duty.kr(Dseq([2, 4, 1, 1/4, 8], inf), 0, Dseq([61+(1/6), [63+(3/6), 58+(3/6)], 64+(3/6)].midicps, inf)), 0.14);\n sig = LPF.ar(sig, LFNoise0.kr(15).range(5120, 9400).lag(0.001), 0.01);\n sig = DynKlank.ar(`[[100, LFNoise0.kr(2).range(300, 320), 4000], 1/3, 0.04], sig);\n sig = ~chrs.(~phas.(sig, [0.2, 0.174]), [0.1, 0.12]);\n sig = HPF.ar(LPF.ar(sig, 1200), 400)*15;\n sig = Limiter.ar(FreeVerb.ar(sig, [0.8, 0.78]), -6.dbamp);\n});\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `PatchOut.prNew` do? What arguments does it take?"}, {"role": "assistant", "content": "manages a Player's output when connecting to other Players Arguments: source; group; bus."}]} -{"conversations": [{"role": "user", "content": "What does `HasPatchIns.setDeepInput` do? What arguments does it take?"}, {"role": "assistant", "content": "parent class for Players that have PatchIns such as Patch Arguments: ai; ag; offset."}]} -{"conversations": [{"role": "user", "content": "Explain `PStandardN` in SuperCollider briefly."}, {"role": "assistant", "content": "PStandardN — UGenPatterns quark library Standard Map. Category: Streams-Patterns-Events > UGenPatterns > Generators."}]} -{"conversations": [{"role": "user", "content": "What does `Sieve.copyWith` do? What arguments does it take?"}, {"role": "assistant", "content": "Takes over mode and offset from receiver and passes an appropriate Arguments: seqCollection — SequenceableCollection.; withCheck — Boolean. Determines if seqCollection is checked according to mode. Defaults to true.."}]} -{"conversations": [{"role": "user", "content": "What does `OSCFunc.defaultDispatcher` do?"}, {"role": "assistant", "content": "Get or set the default dispatcher object for OSCFuncs (this is what you get if you pass nil as the dispatcher argument to #*new). This object will decide if any of its registered OSCFuncs should respond to an incoming OSC Returns: By default this will be an OSCMessageDispatcher, but it can be set to any instance of an appropriate subclass of AbstractDispatcher."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Stockmarket Sonification (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\dollar, { |out, freq = 440, amp = 0.1, pan = 0, sustain = 1.0|\n var env = EnvGen.kr(Env([amp, amp, 0], [sustain, 0.01]), doneAction: 2);\n var decay = freq ** -0.5 * 100;\n var string = CombL.ar(Decay2.ar(Impulse.ar(0), 0.0001, 0.001), 1/freq, 1/freq, decay);\n var damped = string; //LPF.ar(string, Line.kr(11000, 3000, decay));\n OffsetOut.ar(out, Pan2.ar(damped * env, pan));\n}).add;\n);\n\n(\nSynthDef(\\euro, { |out, freq = 440, amp = 0.1, pan = 0, sustain = 1.0|\n var env = EnvGen.kr(Env.perc(0.001, sustain), doneAction: 2);\n var decay = freq ** -0.5 * 100;\n var thing;\n freq = freq * (1..7).nthPrime;\n thing = SinOsc.ar(freq , 0, amp * AmpComp.kr(freq)).mean;\n OffsetOut.ar(out, Pan2.ar(thing * env, pan));\n}).add;\n);\n\n\n(\nPdef(\\stock, { |note = 0, sustain = 1|\n Pbind(\n \\instrument, [\\dollar, \\euro].choose,\n \\note, note.value + Pseq((12..0).curdle(0.1).scramble.flat * 3), \n \\dur, sustain.value / 12\n )\n})\n);\n\n(\nPdef(\\ett, \n Pbind(\n \\type, \\phrase,\n \\instrument, \\stock,\n \\dur, 4,\n \\legato, Prand((1..5), inf),\n \\note, Prand((0..12), inf) + Prand([[0, 2], [0, 6], [0, 7], 0, 0], inf)\n )\n).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SynthDesc`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"test\", { |out, freq, xFade|\n XOut.ar(out, xFade, SinOsc.ar(freq))\n}).store\n);\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// you have to write the sample path in the firts line\n\n~bufferdue = Buffer.read(s,\" WRITE YOUR SAMPLE PATH HERE \", bufnum:2);\n\n(\nSynthDef.new(\\bufbeat, {\n arg amp = 1, out = 0, buf, start, end, freq = 1;\n var sig, ptr;\n ptr = LFNoise1.ar(freq).range(0.0,end);\n sig = BufRd.ar(2, buf, ptr);\n sig = sig * amp;\n Out.ar(out, sig);\n}).add\n);\n\nx = Synth.new(\\bufbeat, [\\buf, ~bufferdue.bufnum, \\start,0, \\end, ~bufferdue.numFrames-1, \\freq, 1, \\amp, 0.5],g);\n\nx.free;\n```"}, {"role": "assistant", "content": "a simple BufRd with the starting point of lecture randomized by LFNoise1."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code:\n```supercollider\n{ SinOsc.ar(440) * EnvGen.kr(Env.perc(0.01, 1), doneAction: 2) }.play;\n```"}, {"role": "assistant", "content": "It plays a 440 Hz sine with a percussive envelope, and the Synth frees itself when the envelope\nends.\n\n- `SinOsc.ar(440)` is an audio-rate sine at 440 Hz.\n- `Env.perc(0.01, 1)` is a 10 ms attack to full level then a 1 s decay to zero.\n- `EnvGen.kr(...)` plays that envelope at control rate and multiplies the sine, so the sound fades out.\n- `doneAction: 2` frees the Synth at the end of the envelope, so it does not accumulate silent nodes.\n- `.play` on the function builds an anonymous SynthDef and starts one Synth of it."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// if \\degree, \\note or \\midinote are occuring after \\dur,\n// a frequency value will be calculated according to Event's usual conversion framework\n// and used for setting the arg 'freq'.\n\n(\np = PmonoPar([\n [\n \\dur, 1.0,\n \\pan, Pser([-0.9, 0, 0.9], 8) \n ],[\n \\dur, 0.4,\n \\midinote, Pseq((70..75), 7)\n ],[\n \\dur, 0.2,\n \\amp, Pseq([0.05, 0.3], 30) \n ]\n]).trace.play;\n)\n```"}, {"role": "assistant", "content": "if \\degree, \\note or \\midinote are occuring after \\dur, a frequency value will be calculated according to Event's usual conversion framework (PmonoPar: monophonic event pattern for an arbitrary number of timed setting streams)"}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n~buf = Buffer.read(s, \"C:/sounds/break.wav\");\nPlayBuf.ar(1, ~buf, BufRateScale.kr(~buf), loop: 1);\n```"}, {"role": "assistant", "content": "Loads a sound file into server memory, then plays it in a loop at the file's original pitch.\n\n- `Buffer.read(s, path)` allocates a buffer on the server and fills it from the file. It is asynchronous:\n the Buffer object returns immediately, the samples arrive later.\n- `PlayBuf.ar(1, buf, ...)` needs the channel count first — 1 for a mono file. A wrong count is the usual\n cause of a buffer that plays wrongly or not at all.\n- `BufRateScale.kr(buf)` compensates when the file's sample rate differs from the server's, so `rate: 1` is\n the file's true speed.\n- `loop: 1` restarts at the end instead of stopping.\n\nBecause the read is asynchronous, this line pair is only safe if a `s.sync` or a wait happened in between;\notherwise PlayBuf sees a buffer with no data yet."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Out`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-out\", { |out = 0, freq = 440|\n var source;\n source = SinOsc.ar(freq, 0, 0.1);\n\n // write to the bus, adding to previous contents\n Out.ar(out, source);\n\n}).add;\n);\n\n\nSynth(\"help-out\", [\\freq, 500]);\nSynth(\"help-out\", [\\freq, 600]);\nSynth(\"help-out\", [\\freq, 700]);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Digital Bird sounds."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\birdy, {arg freq=1500, amp=0.5, rate=10;\n var osc, son, convIn, rand;\n osc=LFCub;\n rand = LFNoise1.ar(rate);\n convIn=LinCongN.ar(rate);\n son = osc.ar(Convolution.ar(convIn,convIn));\n freq = Latch.kr(rand.range(0,1).round(0.1), rand) * freq;\n freq = osc.ar(osc.ar(rand)*rand.range(0,10)).range(freq, freq*3);\n son = Formlet.ar(son, freq, convIn.abs*0.1, rand.abs);\n son = Normalizer.ar(son, 0.9, 0.1) * convIn.abs * LFPulse.kr(LFPulse.kr(rand.abs), 0, rand.abs);\n son = son + GVerb.ar(son, 99, 2, mul: rand.range(0,0.3));\n son * amp\n}).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "List of exit codes?"}, {"role": "assistant", "content": "SuperCollider forum — List of exit codes?\n\n7068696c:\n\n```supercollider\no = s.options;\no.inDevice = nil;\no.outDevice = \"ASIO : ASIO4ALL\";\n```\n\nHmmmm... In earlier SC versions, it wouldn’t have worked to have a nil input device in scsynth either (which is admittedly a problem for devices with no inputs). This was fixed in scsynth but it’s possible that it wasn’t fully fixed in supernova.\n\n@MarcinP – any thoughts about this? (I remember you worked on scsynth device selection but I don’t recall who ported that to supernova.)\n\nhjh"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for more tweets (pitchshift feedback + sinoscfb)?"}, {"role": "assistant", "content": "```supercollider\n// probably horrible for speakers... \n\n// glitchift\n{l=LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j**[l,k],k),[0.05,0.03],j);LocalOut.ar(s);s}.play;\n// drone\n{l=LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j**[2,2.1],k),[0.05,0.03],j);LocalOut.ar(s);s}.play;\n\n\n// few more I was mucking around with (remove tanh loop for < 140c)\n{l = LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j**l,k),[0.05,0.03],j);5.do{s=s.tanh+(s*0.1)};LocalOut.ar(s);s}.play;\n\n{l = LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j**2,k),[0.05,0.03],j);5.do{s=s.tanh+(s*0.1)};LocalOut.ar(s);s}.play;\n\n{l = LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j*20,k),[0.05,0.03],j);5.do{s=s.tanh+(s*0.1)};LocalOut.ar(s);s}.play;\n\n{l = LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j**j,k),[0.05,0.03],j);5.do{s=s.tanh+(s*0.1)};LocalOut.ar(s);s}.play;\n\n{l = LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j**l.abs,k),[0.05,0.03],j);5.do{s=s.tanh+(s*0.1)};LocalOut.ar(s);s}.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Random arpeggio by default (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\n Pbind(\n \\instrument, \\default,\n \\degree, Pwalk(#[c, e, g, c],1, Prand([-1,1],inf).stutter(Pwhite(1,10))) +\n Pseq([Pn(0,64),\n Prand([\n 0,\n [0,2,3],\n ],inf)\n ]),\n \\root, Pwhite(0,-8).stutter(32),\n \\mtranspose, Pwhite(-8,8).stutter(8),\n \\dur, 1/8,\n \\isRest, Pwrand([0,1], [0.1,1],inf).coin.not,\n \\legato, Pwhite(0.1,1.2),\n \\amp, 0.1\n ).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `ServerOptions.outputStreamsEnabled` do?"}, {"role": "assistant", "content": "A String which allows turning off output streams that you are not interested in on the audio device. If the string is \"11000\", for example, then only the first two output streams on the device will be enabled. Turning off streams can reduce CPU"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Recorder`."}, {"role": "assistant", "content": "```supercollider\n(\n{ SinOsc.ar(\n SinOsc.ar(\n XLine.kr(1, 100, 5)).exprange(*XLine.kr([20, 800], [7000, 200], 10)\n )\n ) * 0.1\n\n}.play;\ns.record(duration: 10);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for reverbio (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"reverb\", {arg freq=440, release=0.1;\n var in, s1,out, mod1, depth, mfreq;\n s1 = SoundIn.ar(0,mul:2);\n out=FreeVerb.ar(s1,mix:1,room:MouseX.kr(0,1),damp:MouseY.kr(0,1));\n Out.ar(0,out);\n Out.ar(1,out);\n}).load(s);\n);\na = Synth(\"reverb\");\na.free\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pdefn`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\nPdefn(\\x, Pbrown(0, 6, 0.1, inf));\nPbind(\\note, Pdefn(\\x), \\dur, 0.3).play;\nPbind(\\note, Pdefn(\\x), \\dur, 0.1, \\ctranspose, 15).play;\n// now change the definition\nPdefn(\\x, Pseq([0, 3, 5, 7, 9, 11], inf));\nPdefn(\\x, Pseq([0, 3, 3, 7], inf) + Pseq([0, [0, 3], [0, 5, 7]], inf));\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for algorithmic/aleatoric composition for mallets and proxy patterns."}, {"role": "assistant", "content": "```supercollider\n/*\"Musical Toys For Little Robots\"\n\n or\n\n \"How I learned to stop worrying and love the proxy\"\n\nhttp://soundcloud.com/unknown-artist-6/musical-toys-for-little-robots\n\n */\n\n~fx=Bus.audio(s,2);\n\n(\nSynthDef(\\mallet,{arg in=0,out=0,m=48,a=1,r=1,p=0;\n\n var sig=Array.fill(3,{|n| SinOsc.ar(m.midicps+(n*0.01),mul:a*0.3)}).sum;\n var env=EnvGen.kr(Env.perc(0.001,r),gate:1,doneAction:2);\n\n Out.ar(out,Pan2.ar(sig*env,pos:p));\n};\n).add;\n\nSynthDef(\\rev,{arg in=0,out=0;\n var sig=In.ar(in,2);\n sig=sig*0.8+CombC.ar(sig,0.5,0.3,0.5,0.2);\n Out.ar(out,sig)\n };\n).add;\n);\n\nSynth(\\rev,[\\in:~fx]);\n\n\n(\nfork{\n var degrees=Prand([0,4,5,7,9,12],inf).asStream;\n var root=[36,48,60,72];\n var x;\n x=Array.new;\n a=PatternProxy(Pseq([0+root.wchoose([0.3,0.4,0.2,0.1])],inf));\n d=1/8;\n\n ~streams=[];\n ~names={|pbind| ~streams=~streams++pbind.play(quant:1)};\n\n ~names.value(Pbind(*[\\instrument:\\mallet,\n \\m:a,\n \\dur:d,\n \\a:{rrand(0.4,1)*0.05},\n \\p:{rrand(-0.2,0.2)},\n \\r:{rrand(0.5,0.8)},\n \\out:~fx\n ]));\n\n\n 20.do({|n|\n x=x.add(degrees.next+root.wchoose([0.3,0.4,0.2,0.1]));\n x.postln;\n a.source=Pseq(x.scramble,inf);\n if ((n+1) % 6 == 0,{~names.value(Pbind(*[\\instrument:\\mallet,\n \\m:Pcollect({arg inval;inval-[-24,12].choose},a),\n \\dur:d,\n \\a:{rrand(0.4,1)*0.05/(n+1)},\n \\p:{rrand(-0.2,0.2)},\n \\r:{rrand(0.5,0.8)},\n \\out:~fx\n ]));\"new stream\".postln});\n (n+1).wait});\n\n 19.do({|n|\n x.removeAt(0);\n x.postln;\n a.source=Pseq(x.scramble,inf);\n (19-(n+1)).wait;});\n4.wait;\n ~streams.do{|n| n.stop;2.wait};\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `AbstractSController` in SuperCollider?"}, {"role": "assistant", "content": "AbstractSController — an abstract class for all sInstrument controllers Multi-channel control rate bus+synth for amplitudes, frequencies, panning positions etc. Category: SInstruments."}]} -{"conversations": [{"role": "user", "content": "What is `PlayBuf` in SuperCollider?"}, {"role": "assistant", "content": "PlayBuf — Sample playback oscillator. Plays back a sample resident in memory. Category: UGens > Buffer."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Granular electromaton."}, {"role": "assistant", "content": "```supercollider\n(\nServer.local.waitForBoot({\n(\nz.free;\nz = Buffer.alloc(s, 512, 1);\nz.sine1(1.0 / [1, 2, 3, 4], true, true, true);\n\n fork( { loop {\n SynthDef(\"g1\",{ arg out=0,bufnum=0,dur=1,rate=1,pos=0,sdens=1,edens=1;\n var dens = Line.kr(sdens,edens,dur);\n var trig = [LFNoise0,SinOsc,Impulse,LFPulse,LFSaw].choose.ar(Line.kr(sdens,edens,dur));\n //var env = EnvGen.kr(Env.perc(0.0001.rrand(0.1),dur*0.5.rrand(2)),doneAction:2);\n var env = EnvGen.kr(Env.perc(0.0001.rrand(0.1),dur*(0.5.rrand(4))),doneAction:2);\n Out.ar(out,\n GrainBuf.ar(2,trig,1/dens,bufnum,rate,pos)*env;\n )\n }).add();\n [1,2,4,8,16,32].choose.postln.wait;\n }\n }\n );\n\n\na = Pbind(\\instrument,\\g1,\\dur,Pseq([Pseq([0.25],32),Pseq([0.25,0.125,0.125],32),Pseq([0.125],32)],inf),\\sdens,Pseq([9000,1000,500]/10,inf),\\edens,Prand([Pseq([9000,1000,500]/10,4),Pseq([1],1)],inf),\\rate,Pfunc({-10.0.rrand(10)}),\\pos,Pfunc({1.0.rand}),\\bufnum,z.bufnum);\nb = Pbind(\\instrument,\\g1,\\dur,Pseq([4],inf),\\sdens,Pseq([9000,1000,500]/100,inf),\\edens,Prand([Pseq([9000,1000,500]/10,1),Pseq([1],3)],inf),\\rate,Pfunc({-10.0.rrand(10)}),\\pos,Pfunc({-10.0.rrand(10)}),\\bufnum,z.bufnum);\nc = Pbind(\\instrument,\\g1,\\dur,Pseq([4/3],inf),\\sdens,Pseq([9000,1000,500,25],inf),\\edens,Prand([Pseq([9000,1000,500,25],1),Pseq([1],4)],inf),\\rate,Pfunc({-100.0.rrand(100)}),\\pos,Pfunc({-10.0.rrand(10)}),\\bufnum,z.bufnum);\n\n\na =a.play;\nb =b.play;\nc =c.play;\n\n)\n});\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\na = { |tempo = 1| Ringz.ar(Impulse.ar(tempo), [501, 500], 1/tempo) }.play;\nt = TempoBusClock(a);\nTask { loop { \"klink\".postln; 1.wait } }.play(t);\n);\n\nt.tempo = 1.3;\nt.tempo = 0.5;\nt.tempo = 1.0;\n\n\n// in ProxySpace, a TempoBusClock can be added together with a ~tempo NodeProxy:\n\np = ProxySpace.push(s);\np.makeTempoClock;\np.clock; // now the ProxySpace's clock is a TempoBusClock\n\n~out.play;\n~out = { Ringz.ar(Impulse\n// …\n```"}, {"role": "assistant", "content": "in ProxySpace, a TempoBusClock can be added together with a ~tempo NodeProxy: patterns and tasks are synchronized: (TempoBusClock: a clock that synchronizes its tempo with the server)"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DigitalIn`."}, {"role": "assistant", "content": "```supercollider\n// turn on and off a sine oscillator\n\n(\nSynthDef(\"help-DigitalIn\", { |out = 0|\n Out.ar(out,\n SinOsc.ar(500, 0, 0.1 * DigitalIn.ar(0))\n )\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Psubdivide`."}, {"role": "assistant", "content": "```supercollider\n(\na = Psubdivide(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,0,1,3,4,0], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n100.do({ x.next.postln });\n);\n\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Psubdivide(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n);\n\n\n(\na = Psubdivide(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,4,4,0,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Pbindef.new` do?"}, {"role": "assistant", "content": "store the pattern in the global dictionary of Pdef under key. If there is already a Pdef of this key, replace its pattern with the new one. If there is already a Pbindef af this key, set the parameters only, or add a new one (the whole pattern is replaced). Using *new(key) you can access the pattern at that key (if none is there, a default pattern is created). see"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PLbindef`."}, {"role": "assistant", "content": "```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n// synthdefs to play with\n\n(\nSynthDef(\\noise_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, rq = 0.1, amp = 0.1|\n var sig = { WhiteNoise.ar } ! 2;\n sig = BPF.ar(sig, freq, rq) *\n EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2) *\n (rq ** -1) * (250 / (freq ** 0.8));\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\sin_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { SinOsc.ar(freq, Rand(0, 2pi)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\saw_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { VarSaw.ar(freq, Rand(0, 1)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What's the difference between Env.perc and Env.adsr?"}, {"role": "assistant", "content": "`Env.perc(attack, release)` goes up once and decays to zero — one-shot sounds. `Env.adsr(a, d, s, r)` holds at a sustain level while its gate is open and only releases when the gate closes — notes you start and stop."}, {"role": "user", "content": "So which do I use for a pad?"}, {"role": "assistant", "content": "adsr, with `gate` as a Synth argument and `doneAction: 2` on the EnvGen:\n\n```supercollider\nSynthDef(\\pad, { |out = 0, freq = 220, gate = 1|\n var env = EnvGen.kr(Env.adsr(0.8, 0.4, 0.7, 2), gate, doneAction: 2);\n Out.ar(out, Saw.ar(freq) * env * 0.1)\n}).add;\n```\n\nThen `x.set(\\gate, 0)` releases it over the 2 seconds of release time."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Nuclear Fallout (a SuperCollider snippet)?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n var saw, bpf;\n saw = Saw.ar(\n freq: [60,150],\n mul: LFPulse.kr(\n freq: [2,3],\n width: 0.15));\n \n { BPF.ar(\n in: WhiteNoise.ar(mul: 1),\n freq: 1000,\n rq: 0.9\n )\n}\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// a pattern with long notes\np = Pbind(\n \\freq, Pwhite(0, log(32)).exp.round(1) * 36.midicps,\n \\detune, Pfunc({ |ev| ev[\\freq] * rand(0.01) }),\n \\sustain, Pwhite(log(0.1), log(20)).exp,\n \\dur, Prand([0.1, 0.1, 0.1, 0.1, 0.2, 1, 2], inf),\n \\db, Pstep(Pseq([-20, -30, -25, -30], inf), 0.2)\n);\n\n// unrelated cluster pattern running on TempoClock.default\nPbind(\\dur, 2, \\midinote, Pseq([(48..60)], 20), \\db, -30).play;\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// a pattern with long notes\np = Pbind(\n \\freq, Pwhite(0, log(32)).exp.round(1) * 36.midicps,\n \\detune, Pfunc({ |ev| ev[\\freq] * rand(0.01) }),\n \\sustain, Pwhite(log(0.1), log(20)).exp,\n \\dur, Prand([0.1, 0.1, 0.1, 0.1, 0.2, 1, 2], inf),\n \\db, Pstep(Pseq([-20, -30, -25, -30], inf), 0.2)\n);\n\n// unrelated cluster pattern running on TempoClock.default\nPbind(\\dur, 2, \\midinote, Pseq([(48..60)], 20), \\db, -30).play;\n\n// make a conductor\na = PatternConductor(p, quant: 2);\na.play;\n);\n\n\n// now try some interactive control options line by line:\na.quant = 0;\na.pause;\na.resume;\na.stop;\na.play;\na.pause;\na.play;\na.stop(1000);\n```"}]} -{"conversations": [{"role": "user", "content": "What is `RedIntelHex` in SuperCollider?"}, {"role": "assistant", "content": "RedIntelHex — read and decode intel hex files See http://en.wikipedia.org/wiki/Intel_HEX and http://www.sbprojects.com/knowledge/fileformats/intelhex.php Category: Red > redTools."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Random arpeggio by default (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\n Pbind(\n \\instrument, \\default,\n \\degree, Pwalk(#[c, e, g, c],1, Prand([-1,1],inf).stutter(Pwhite(1,10))) +\n Pseq([Pn(0,64),\n Prand([\n 0,\n [0,2,3],\n ],inf)\n ]),\n \\root, Pwhite(0,-8).stutter(32),\n \\mtranspose, Pwhite(-8,8).stutter(8),\n \\dur, 1/8,\n \\isRest, Pwrand([0,1], [0.1,1],inf).coin.not,\n \\legato, Pwhite(0.1,1.2),\n \\amp, 0.1\n ).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `SendPeakRMS`?"}, {"role": "assistant", "content": "SendPeakRMS — Track peak and power of a signal for GUI applications."}, {"role": "user", "content": "What does `SendPeakRMS.ar` do?"}, {"role": "assistant", "content": "Unlike with other unit generators, the `ar` and `kr` methods do not specify the rate of the computation, but the granularity. When the SendPeakRMS ugen is instantiated with `kr`, the reply rate is quantized to control-rate blocks."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\n{\n SendPeakRMS.kr(Dust.ar(20), 20, 3, \"/replyAddress\")\n}.play;\n);\n\n(\no = OSCFunc({ |msg|\n \"peak: %, rms: %\".format(msg[3], msg[4]).postln\n}, '/replyAddress');\n);\no.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What is the difference between a Synth and a SynthDef?"}, {"role": "assistant", "content": "A SynthDef is a definition: a compiled UGen graph with named controls, registered on the server once. A Synth is one running instance of that definition. You create the definition with `SynthDef(\\bell, { |freq = 440| ... }).add` and then instances with `Synth(\\bell, [\\freq, 660])`. Defining the same SynthDef twice replaces it for future instances; already running Synths keep the old graph until they are freed."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes an experiment with roots of unity in supercollider."}, {"role": "assistant", "content": "```supercollider\n(\n\n~divisors = {\n arg n;\n ~divs = List.newClear(0);\n for( 1, floor(sqrt(n)), {arg i; if(n%i==0,{\n //i.postln;\n ~divs.add(i);\n // (i==n.div(i)).postln;\n if(i==n.div(i),{},{~divs.add(n.div(i))});\n },{});\n });\n ~divs.sort;\n ~divs;\n};\n\n\nSynthDef(\\rootsOfUnitySum, { |out=0,freq=1,amp=1,n=1,ks=#[1]|\n var l,sigl,sigr,env;\n\n\n sigl = SinOsc.ar(freq:0,mul:0);\n sigr = SinOsc.ar(freq:0,mul:0);\n ks.do({arg item,i;\n k = item;\n sigr = sigr+SinOsc.ar(freq:freq*2pi*k/n,mul:amp,phase:0.5*pi);\n sigl = sigl+SinOsc.ar(freq:freq*2pi*k/n,mul:amp);\n });\n env = EnvGen.kr(Env.linen(attackTime: 0.001, sustainTime: 1, releaseTime: 0.01, level: 1.0, curve: 'lin'), doneAction: Done.freeSelf);\n sigr = sigr*env;\n sigl = sigl*env;\n\n Out.ar(out, [sigl,sigr])\n}).add;\n\n\n~getPbind = { arg n, amps, durs, freq;\n ~nums = ~divisors.value(n);\n r = Pbind(\\instrument,\\rootsOfUnitySum,\n \\amp,amps,\n \\dur,durs,\n \\freq,freq,\n \\n,Pseq([n],~nums.size),\n \\ks , Pseq(all{:~divisors.value(n),n<-~nums},1)).trace();\n r\n};\n\n~seq = (1..13);\n~tau = all{:~divisors.value(n).size,n<-~seq};\n\n\n~r = Pseq(all{:~getPbind.value(\n n:n,\n amps:Pseq(all{:0.5/t,t<-~tau},1),\n durs:Pseq(all{:0.3333/t,t<-~tau},1),\n freq:220/3),n<-~seq},1);\n\n~s = Pseq(all{:~getPbind.value(\n n:n,\n amps:Pseq(all{:0.5/t,t<-~tau},1),\n durs:Pseq(all{:0.5/t,t<-~tau},1),\n freq:110),n<-~seq},1);\n\n~t = Pseq(all{:~getPbind.value(\n n:n,\n amps:Pseq(all{:0.5/t,t<-~tau},1),\n durs:Pseq(all{:1/t,t<-~tau},1),\n freq:220),n<-~seq},1);\n\n~x = Pseq([\n Ppar([~t],1),\n Ppar([~s],1),\n Ppar([~s,~t],1),\n Ppar([~r],1),\n Ppar([~r,~t],1),\n Ppar([~r,~s],1),\n Ppar([~r,~s,~t],1),\n ],inf);\n\n);\n\nPdef(\\mplayer, ~x).clock_(TempoClock(100/60)).play;\nPdef(\\mplayer, Pn(Event.silent)).fadeTime_(8);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SendPeakRMS`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n SendPeakRMS.kr(Dust.ar(20), 20, 3, \"/replyAddress\")\n}.play;\n);\n\n(\no = OSCFunc({ |msg|\n \"peak: %, rms: %\".format(msg[3], msg[4]).postln\n}, '/replyAddress');\n);\no.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Nuclear Fallout (a SuperCollider snippet)?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n var saw, bpf;\n saw = Saw.ar(\n freq: [60,150],\n mul: LFPulse.kr(\n freq: [2,3],\n width: 0.15));\n \n { BPF.ar(\n in: WhiteNoise.ar(mul: 1),\n freq: 1000,\n rq: 0.9\n )\n}\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar,\n Pulse.ar\n ];\n TChoose.ar(Dust.ar(MouseX.kr(1, 1000, 1)), a) * 0.2\n\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar,\n Pulse.ar\n ];\n TChoose.ar(Dust.ar(MouseX.kr(1, 1000, 1)), a) * 0.2\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a;\na = Pexprand.new(0.0001, 1, inf);\nc = a.asStream.nextN(500);\n// plot the values\nc.plot(bounds: Rect(10, 10, 520, 380), discrete: true, parent: w);\n// a histogram of the values\nc.histo(500).plot(bounds: Rect(10, 410, 520, 380), parent: w);\n);\n\n// sound example\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq,\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a;\na = Pexprand.new(0.0001, 1, inf);\nc = a.asStream.nextN(500);\n// plot the values\nc.plot(bounds: Rect(10, 10, 520, 380), discrete: true, parent: w);\n// a histogram of the values\nc.histo(500).plot(bounds: Rect(10, 410, 520, 380), parent: w);\n);\n\n// sound example\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n(\nvar a;\na = Pexprand(0.0001, 1.0, inf).asStream;\n{\n loop {\n Synth(\\help_sinegrain, [\\freq, a.next * 600 + 300]);\n 0.02.wait;\n }\n}.fork;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\\help_Env_newClear, { |out = 0, gate = 1|\n var env, envctl;\n // make an empty 4 segment envelope\n env = Env.newClear(4);\n // create a control argument array\n envctl = \\env.kr(env.asArray);\n Out.ar(out, SinOsc.ar(EnvGen.kr(envctl, gate), 0) * -12.dbamp);\n}).add;\n);\n\nSynth(\\help_Env_newClear, [\\env, Env([700, 900, 900, 800], [1, 1, 1], \\exp)]); // 3 segments\n\n// reset then play again:\nSynth(\\help_Env_newClear, [\\en\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\\help_Env_newClear, { |out = 0, gate = 1|\n var env, envctl;\n // make an empty 4 segment envelope\n env = Env.newClear(4);\n // create a control argument array\n envctl = \\env.kr(env.asArray);\n Out.ar(out, SinOsc.ar(EnvGen.kr(envctl, gate), 0) * -12.dbamp);\n}).add;\n);\n\nSynth(\\help_Env_newClear, [\\env, Env([700, 900, 900, 800], [1, 1, 1], \\exp)]); // 3 segments\n\n// reset then play again:\nSynth(\\help_Env_newClear, [\\env, Env({ rrand(60, 70).midicps } ! 4, [1, 1, 1], \\exp)]);\n\n// the same written as an event:\n(instrument: \\help_Env_newClear, env: Env({ rrand(60, 70).midicps } ! 4, [1, 1, 1], \\exp)).play;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// allocate buffer\nb = Buffer.alloc(s, 44100, 1);\n\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nBufDelayC.ar(b.bufnum, z, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\nb.free;\n\n\n// multichannel\n\n// two channels, two buffers\nb = Buffer.allocConsecutive(2, s, 32768, 1);\n\na = { |bufs = #[0, 1]|\n var sig = SinOsc.ar([440, 880\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// allocate buffer\nb = Buffer.alloc(s, 44100, 1);\n\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nBufDelayC.ar(b.bufnum, z, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\nb.free;\n\n\n// multichannel\n\n// two channels, two buffers\nb = Buffer.allocConsecutive(2, s, 32768, 1);\n\na = { |bufs = #[0, 1]|\n var sig = SinOsc.ar([440, 880]) * Decay2.kr(Impulse.kr([2, 4]), 0.01, 0.15);\n sig + BufDelayC.ar(bufs, sig, delaytime: 0.125)\n}.play(args: [bufs: b]);\n\na.free;\nb.do(_.free);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes ~chaos2 (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\n~chaos2={\n var signal, myFrequency, frequencyMin=0.1, frequencyMax=30, myAmplitude, amplitudeMin=0.01, amplitudeMax=0.6, myPhase, phaseMin=0, phaseMax=1.5;\n myFrequency = Array.fill(2, {[rrand(frequencyMin, frequencyMax)]});\n myAmplitude = Array.fill(2, {[rrand(amplitudeMin, amplitudeMax)]});\n myPhase = Array.fill(2, {[rrand(phaseMin, phaseMax)]});\n signal = LeakDC.ar(ChaosGen.allSubclasses.choose.ar(myFrequency, myPhase, myAmplitude));\n myFrequency = (myFrequency + Array.fill(2, {[rrand(frequencyMin, frequencyMax)]})) * (signal);\n myAmplitude = (myAmplitude + Array.fill(2, {[rrand(amplitudeMin, amplitudeMax)]})) * (signal);\n myPhase = (myPhase + Array.fill(2, {[rrand(phaseMin, phaseMax)]}))* (signal);\n signal = LeakDC.ar(ChaosGen.allSubclasses.choose.ar(myFrequency, myPhase, myAmplitude));\n myFrequency = (myFrequency + Array.fill(2, {[rrand(frequencyMin, frequencyMax)]})) * (signal);\n myAmplitude = (myAmplitude + Array.fill(2, {[rrand(amplitudeMin, amplitudeMax)]})) * (signal);\n myPhase = (myPhase + Array.fill(2, {[rrand(phaseMin, phaseMax)]}))* (signal);\n signal = LeakDC.ar(ChaosGen.allSubclasses.choose.ar(myFrequency, myPhase, myAmplitude));\n Out.ar(0, LeakDC.ar(signal * 0.3));\n};\n);\n\n~chaosmegafeedback={Mix.new(~chaos2 ! 16) * 0.00000000000000000000000003}.scope;\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Simple relaxing white noise generator simulating a seaside."}, {"role": "assistant", "content": "```supercollider\n// A.Broz: Waves & Surf (2020-10-29)\n\n/*\n _.====.._\n ,:._ ~-_\n `\\ ~-_\n | `.\n ,/ ~-_\n -..__..-'' ~~--..__...----...\n*/\n(\n~waves = {\n var noise = { WhiteNoise.ar(0.04 + LFNoise1.kr(0.3, 0.03)) };\n var motion = { LFNoise1.kr(0.2).exprange(100, 2000) };\n var hps = { HPF.ar(noise.value, 50) };\n var wave = { LPF.ar(hps.value, motion.value).tanh };\n var sig = wave!10;\n sig = Splay.ar(sig, 0.6).tanh;\n sig = sig * Line.kr(0, 1, 10); // fade in\n LeakDC.ar(sig);\n}.play;\n);\n\n~waves release: 10;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `KeyState` in SuperCollider briefly."}, {"role": "assistant", "content": "KeyState — Respond to the state of a key Respond to the state of a key. Category: UGens > User interaction."}]} -{"conversations": [{"role": "user", "content": "What is `AbstractFunction`?"}, {"role": "assistant", "content": "AbstractFunction — An object which responds to a set of messages that represent mathematical functions"}, {"role": "user", "content": "What does `AbstractFunction.neg` do?"}, {"role": "assistant", "content": "`a = { 10.rand.postln }; b = a.neg; b.value;`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na = { |x, root = 60| x + root }; b = a.midicps; [a.value(9), b.value(9)];\na = Pseries(60, 1, inf).midicps; a.asStream.nextN(12);\n{ a = LFNoise1.ar(1) * 5 + 60; Pulse.ar(a.round.midicps) * 0.1 }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `BendResponder` in SuperCollider briefly."}, {"role": "assistant", "content": "BendResponder — allow functions to be registered to respond to MIDI pitchbend events Category: External Control > MIDI."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// For more SynthDefs and examples please head to: https://mycelialcordsblog.wordpress.com/ \n\n(\nSynthDef(\\hasherTest,\n{\narg rate = 1, freq = 60, index = 1000, tRate = 100,\nout = 0, fRate = 0.1;\n\nvar t_trig = LFPulse.kr(0.5/fRate, 0.5);\nvar random = LFNoise0.ar(rate, add:1);\nvar noise = Hasher.ar(random);\nvar sound = Saw.ar((freq+(noise*index)), Decay.kr(Impulse.kr(tRate), noise*0.001)).tanh;\nsound = Pan2.ar(sound, noise-0.3*2);\nFreeSelf.kr(t_trig);\nOut.ar(out, sound);\n}).store;\n);\n\n(\nPbind(\n\\instrument, \\hasherTest,\n\\dur, 5,\n\\rate, Pfuncn({100.rand}, inf),\n\\freq, Pfuncn({10000.rand}, inf),\n\\index, Pfuncn({20000.rand}, inf),\n\\tRate, Pfuncn({1000.rand}, inf),\n\\fRate, 5,\n).play;\n)\n```"}, {"role": "assistant", "content": "It is a simple SynthDef I made after having a look at Hasher UGen with a pattern to play it. It creates nice and varied glitch sounds."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n/// Installing sc3-plugins quarks\n\n// If you installed the sc3-plugins to a user location:\n~sc3plugs = Quarks(\nreposPath: \"https://sc3-plugins.svn.sourceforge.net/svnroot/sc3-plugins/build\",\nlocalPath: Platform.userAppSupportDir +/+ \"SC3plugins\"\n);\n\n// If the sc3-plugins were installed to a system wide location:\n~sc3plugs = Quarks(\nreposPath: \"https://sc3-plugins.svn.sourceforge.net/svnroot/sc3-plugins/build\",\nlocalPath: Platform.systemAppSupportDir +/+ \"SC3plugins\"\n);\n\n\n// Get a GUI of the available Quarks and install the ones you want to try out:\n~sc3plugs.gui;\n\n\n// For more general Help on Quarks, see the Quarks helpfile\n```"}, {"role": "assistant", "content": "Installing sc3-plugins quarks If you installed the sc3-plugins to a user location:."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// try wiggling the mouse quickly;\n// LFNoise frequently seems stuck, LFDNoise changes smoothly.\n\n{ LFClipNoise.ar(MouseX.kr(0.1, 1000, 1), 0.1) }.play\n\n{ LFDClipNoise.ar(MouseX.kr(0.1, 1000, 1), 0.1) }.play\n\n// silent for 2 secs before going up in freq\n\n{ LFClipNoise.ar(XLine.kr(0.5, 10000, 3), 0.1) }.scope;\n\n{ LFDClipNoise.ar(XLine.kr(0.5, 10000, 3), 0.1) }.scope;\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFClipNoise.ar\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// try wiggling the mouse quickly;\n// LFNoise frequently seems stuck, LFDNoise changes smoothly.\n\n{ LFClipNoise.ar(MouseX.kr(0.1, 1000, 1), 0.1) }.play\n\n{ LFDClipNoise.ar(MouseX.kr(0.1, 1000, 1), 0.1) }.play\n\n// silent for 2 secs before going up in freq\n\n{ LFClipNoise.ar(XLine.kr(0.5, 10000, 3), 0.1) }.scope;\n\n{ LFDClipNoise.ar(XLine.kr(0.5, 10000, 3), 0.1) }.scope;\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFClipNoise.ar(XLine.kr(1000, 20000, 10), 0.1) }.scope;\n\n{ LFDClipNoise.ar(XLine.kr(1000, 20000, 10), 0.1) }.scope;\n```"}]} -{"conversations": [{"role": "user", "content": "What is `PSchmidt` in SuperCollider?"}, {"role": "assistant", "content": "PSchmidt — UGenPatterns quark library Based on Schmidt Category: Streams-Patterns-Events > UGenPatterns > Modifiers."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `OneZero`."}, {"role": "assistant", "content": "```supercollider\n{ OneZero.ar(WhiteNoise.ar(0.5), 0.5) }.play\n\n{ OneZero.ar(WhiteNoise.ar(0.5), -0.5) }.play\n\n{ OneZero.ar(WhiteNoise.ar(0.5), Line.kr(-0.5, 0.5, 10)) }.play\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nSynthDef(\\dubecho,{|in, out, length = 1, fb = 0.8, sep = 0.012|\n var input = In.ar(in, 2);\n var feedback = LocalIn.ar(2);\n var output = LeakDC.ar(feedback*fb + input);\n output = HPF.ar(output, 400);\n output = LPF.ar(output, 5000);\n output = output.tanh;\n LocalOut.ar(DelayC.ar(output, 1, LFNoise2.ar(12).range([length,length+sep],[length+sep,length])).reverse);\n ReplaceOut.ar(out, output);\n}).add;\n\n// Example as effecet bus\n~bus = Bus.audio(s, 2);\n~echo = Synth(\\dubecho, [\\in, ~bus, \\length, TempoClock.default.tempo*(3/8), \\fb, 0.7, \\sep, 0.0012], addAction: \\addToTail);\n\n// send something\nplay{ Out.ar(~bus, LFGauss.ar(1, 0.1, loop:0, doneAction:2) * Blip.ar(80!2, 8)) }\n\n// turn it off\n~echo.free;\n```"}, {"role": "assistant", "content": "Fork of Bjorn's Dub echo, rewritten w/o the Feedback Quark (using LocalIn + LocalOut) and adding a ping pong (can be removed by deleting the .reverse method in the LocalOut line)."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n var mod = SinOsc.ar([0.1,0.15,0.2]).range(0,1);\n var saw = LFSaw.ar([10,12,15]);\n var out = (saw - ((saw>0)*mod)+(mod*0.5));\n Splay.ar(out)*0.4;\n}.play;\n\n{\n var mod = SinOsc.ar([0.1,0.15,0.2]).range(0,1);\n var saw = SinOsc.ar(LFSaw.ar([10,12,15]).range(200,300));\n var out = (saw - ((saw>0)*mod)+(mod*0.5));\n Splay.ar(out)*0.4;\n}.play\n)\n```"}, {"role": "assistant", "content": "Made with code from Jonatan Liljedahl and Glen Fraser. Based on the Korg Z1 sawtooth oscilator."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na.sine(8, 0, 1, 0);\n\nb.sine2(a.ramp(1.0, 1.0), a.sine(8, 0, 1, 0).postln, true, true, true);\ny = z.play(s, [\\out, 0, \\bufnum, b]);\nb.sine2(a.ramp(1.0, 1.0), a.sine(4, 0, 1, 0).postln, true, true, true);\nb.sine2(a.ramp(1.0, 1.0), a.sine(2.2, 0.5pi, 0.4, 0.2).postln, true, true, true);\nb.sine2(a.ramp(1.0, 1.0), a.sine(pi, 0.25pi, 0.5, 0).postln, true, true, true;\ny.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na.sine(8, 0, 1, 0);\n\nb.sine2(a.ramp(1.0, 1.0), a.sine(8, 0, 1, 0).postln, true, true, true);\ny = z.play(s, [\\out, 0, \\bufnum, b]);\nb.sine2(a.ramp(1.0, 1.0), a.sine(4, 0, 1, 0).postln, true, true, true);\nb.sine2(a.ramp(1.0, 1.0), a.sine(2.2, 0.5pi, 0.4, 0.2).postln, true, true, true);\nb.sine2(a.ramp(1.0, 1.0), a.sine(pi, 0.25pi, 0.5, 0).postln, true, true, true);\ny.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `ToggleButton.new` do? What arguments does it take?"}, {"role": "assistant", "content": "simple two state button Arguments: layout; title; onFunction; offFunction; init; minWidth — button width is calculated to fit the title setting minWidth will widen the button to a minimum width; minHeight — default is the GUI.skin.buttonHeight; onColor."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for strange device found in space )\r\n\r\np.s?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n Limiter.ar(HPF.ar(\n GVerb.ar(\n Pan2.ar(\n PMOsc.ar(\n Demand.kr(\n Impulse.kr(\n SinOsc.kr(SinOsc.kr(1/30).range(1/10, 1/15)).range(0, 25)\n * LFPulse.kr(0.2).range(0.5, 1)\n + \n LFDNoise3.kr(1/10, 10, 10)\n ), \n 0, \n Dxrand(Array.geom(100, 50, 1.06), inf) + Dgeom(1, 1.005)\n ),\n [[3,5],[7,11]] + SinOsc.ar([1/60, 1/45]).range(0, 1300),\n Demand.kr(\n Impulse.kr(SinOsc.kr(0.1).range(0.1, 20)),\n 0,\n Dxrand(Array.series(13, 0, 0.5), inf)\n )\n ).sum,\n SinOsc.ar(1, mul:0.5),\n LFPar.ar([1/5,1/3]).range(0.3, 1)\n ), \n 250, \n 0.5, \n damping:SinOsc.kr(1/20).range(0.2,0.7), \n drylevel: SinOsc.kr(1/15).range(0.2,0.7), \n earlyreflevel:0.3\n ) * 0.1\n +\n LFDNoise3.ar(SinOsc.kr(1/15, [0, pi/4]).range(100,350), 0.3),\n [SinOsc.ar(1/45, [0,pi/2]).range(20, 120)]\n ))\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Set.do` do?"}, {"role": "assistant", "content": "Evaluates function for each item in the Set. The function is passed two arguments, the item and an integer index. `Set[1, 2, 3, 300].do({ |item, i| item.postln"}]} -{"conversations": [{"role": "user", "content": "What does `Class.browse` do?"}, {"role": "assistant", "content": "Open a graphical browser for this Class. Shows methods, arguments, variables, subclasses, and has buttons for navigating to the superclass, source, helpfile, etc."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `RunningMax`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n SinOsc.ar(\n RunningMax.ar(Dust.ar(20), Impulse.ar(0.4)) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// follow a sine lfo, reset rate controlled by mouse x\n(\n{\n SinOsc.ar(\n RunningMax.kr(SinOsc.kr(0.2), Impulse.kr(MouseX.kr(0.01, 2, 1))) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\na = Scale.major;\na.degrees; // [0, 2, 4, 5, 7, 9, 11]\na.semitones; // [0, 2, 4, 5, 7, 9, 11]\na.cents; // [0, 200, 300, 500, 700, 900, 1100]\na.ratios; // [1, 1.1224620483089, 1.2599210498937, 1.3348398541685, etc.]\n\nPbind(\\scale, a, \\degree, Pseq((0..7) ++ (6..0) ++ [\\rest], 1), \\dur, 0.25).play;\n\n// use non-standard tuning\na.tuning_(\\just);\na.degrees; // no change; de\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\na = Scale.major;\na.degrees; // [0, 2, 4, 5, 7, 9, 11]\na.semitones; // [0, 2, 4, 5, 7, 9, 11]\na.cents; // [0, 200, 300, 500, 700, 900, 1100]\na.ratios; // [1, 1.1224620483089, 1.2599210498937, 1.3348398541685, etc.]\n\nPbind(\\scale, a, \\degree, Pseq((0..7) ++ (6..0) ++ [\\rest], 1), \\dur, 0.25).play;\n\n// use non-standard tuning\na.tuning_(\\just);\na.degrees; // no change; degrees are independent of tuning\na.semitones; // [0, 2.0391000173077, 3.1564128700055, 4.9804499913461, etc.]\na.ratios.collect(_.round(0.001)); // [1, 1.125, 1.2, 1.333, 1.5, 1.667, 1.875]\n\nPbind(\\scale, a, \\degree, Pseq((0..7) ++ (6..0) ++ [\\rest], 1), \\dur, 0.25).play;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `RedGUI` in SuperCollider briefly."}, {"role": "assistant", "content": "RedGUI — base class of gui wrappers This class is an abstract class and only creates a skin at `*initClass`. Category: Red > redGUI."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Just experimental sketch of somewhere audio background."}, {"role": "assistant", "content": "```supercollider\n(\n{ \n Limiter.ar(\n GVerb.ar(\n ( \n BPF.ar(\n WhiteNoise.ar([0.07,0.07]) + Blip.ar([13,19], 200.rand, mul:0.5),\n SinOsc.kr(\n SinOsc.kr([1/108,1/109]).range(1/108, 1/13)\n ).exprange(10, 23000),\n PMOsc.kr(1/54,1/216, 3).range(0.1, 2)\n ) \n * \n SinOsc.ar(Array.rand(20, 1/216, 1), mul: Array.rand(20, 0.2, 1)).reshape(10,2)\n ).sum,\n roomsize:10,\n damping: PMOsc.kr(1/27, 1/108, 3).range(0.5, 1), \n drylevel: SinOsc.kr(1/9).range(0.1, 1)\n )\n +\n GVerb.ar(\n Pan2.ar(\n LPF.ar(\n DynKlank.ar(\n `[\n Array.rand(6, 600, 4000).collect({|freq|\n SinOsc.kr(1/108).range(freq/2,freq)\n }), \n nil, \n Array.rand(6, 1/108, 1/27).collect({|freq|\n SinOsc.kr(freq).range(1/108,1/3)\n })\n ],\n Limiter.ar(\n Dust.ar( SinOsc.kr(1/256).exprange(1/27, 3), TRand.kr(0.15, 0.25, Dust.kr(1/9))) \n + \n Impulse.ar( SinOsc.kr(1/108).exprange(1/54, 3), 0, TRand.kr(0.6, 0.8, Dust.kr(1/3)))\n )\n ),\n 1700,\n LFPar.kr(1/27).exprange(0.05, 0.2)\n ),\n SinOsc.kr(1/9).range(-0.2, 0.2)\n ),\n roomsize: 30,\n drylevel: 0.5\n )\n )\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// using timer to modulate sine frequency: the slower the trigger is the higher the frequency\n(\n{ var trig;\n trig = Impulse.kr(MouseX.kr(0.5, 20, 1));\n SinOsc.ar(Timer.kr(trig) * 500 + 500, 0, 0.2)\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// using timer to modulate sine frequency: the slower the trigger is the higher the frequency\n(\n{ var trig;\n trig = Impulse.kr(MouseX.kr(0.5, 20, 1));\n SinOsc.ar(Timer.kr(trig) * 500 + 500, 0, 0.2)\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `LFSaw.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Sawtooth oscillator Arguments: freq — Frequency in Hertz.; iphase — Initial phase offset. For efficiency reasons this is a value ranging from 0 to 2.; mul — Output will be multiplied by this value.; add — This value will be added to the output.."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for very punchy snare in neurofunk style."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\neurosnare, {\n var snd;\n // a percussive click to give it some attack\n snd = LPF.ar(HPF.ar(WhiteNoise.ar, 300), 8000) * Env.linen(0.001, 0.01, 0.001).ar;\n // sine sweep body. very important!\n snd = snd + (SinOsc.ar(Env([400, 196, 160], [0.04, 0.2], \\exp).ar) * Env.perc(0.04, 0.2).ar * 6.dbamp).tanh;\n // sound of snare coils rattling\n snd = snd + (HPF.ar(BPeakEQ.ar(WhiteNoise.ar, 4000, 0.5, 3), 300) * Env.perc(0.05, 0.2).delay(0.01).ar(2) * -3.dbamp);\n // another sound sweep to improve the attack, optional\n snd = snd + (SinOsc.ar(XLine.kr(3000, 1500, 0.01)) * Env.perc(0.001, 0.02).ar);\n // distortion helps glue everything together and acts as a compressor\n snd = (snd * 1.4).tanh;\n snd = Pan2.ar(snd, \\pan.kr(0), \\amp.kr(0.1));\n Out.ar(\\out.kr(0), snd);\n}).add;\n);\n\nSynth(\\neurosnare, [amp: 0.4]);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a random pentatonic melody that plays by itself."}, {"role": "assistant", "content": "Pick degrees from a pentatonic scale; `\\scale` and `\\root` define the pitch space, and `\\degree`\npicks within it.\n\n```supercollider\n(\nPbind(\n \\instrument, \\default,\n \\scale, Scale.minorPentatonic,\n \\root, 3,\n \\degree, Pwhite(0, 9, inf),\n \\octave, 5,\n \\dur, Pwhite(0.12, 0.28, inf),\n \\amp, 0.2,\n \\legato, 0.8\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `DrawGrid`?"}, {"role": "assistant", "content": "DrawGrid — Draws grid lines on a UserView for plotting"}, {"role": "user", "content": "What does `DrawGrid.draw` do?"}, {"role": "assistant", "content": "This draws to the currently active UserView. This method is meant to be called from inside the UserView#-drawFunc#-drawFunc of a `UserView`."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nx = [0, 10].asSpec.units_(\"sec\");\ny = [0, 1].asSpec.units_(\"amp\");\nd = DrawGrid((500@250).asRect, x.grid, y.grid);\n\n// set its properties before testing\nd.x.tickSpacing_(25);\nd.linePattern_(FloatArray[10.0, 5.0, 2.0, 5.0]);\n\n// generate a preview\n~testView = d.preview;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `Boolean` in SuperCollider briefly."}, {"role": "assistant", "content": "Boolean — abstract class whose instances represent a logical value Boolean is the superclass of True and False which are the concrete realizations. In code True and False are represented by the literal values `true` and `false`. Category: Core."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PV_BinScramble`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\nb = Buffer.read(s, ExampleFiles.child);\n\n(\n// trig with MouseY\nSynthDef(\"help-binScramble\", { |out = 0, soundBufnum = 2|\n var in, chain;\n in = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);\n chain = FFT(LocalBuf(2048), in);\n chain = PV_BinScramble(chain, MouseX.kr, 0.1, MouseY.kr > 0.5);\n Out.ar(out, 0.1 * IFFT(chain).dup);\n}).play(s, [\\soundBufnum, b]);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `WhiteNoise`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-WhiteNoise\", { |out = 0|\n Out.ar(out,\n WhiteNoise.ar(0.25)\n )\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SimpleNumber.fallingFactorial` do?"}, {"role": "assistant", "content": "Returns the falling factorial of `x` and `i`: `x(x-1)(x-2)(x-3)...(x-i+1)` This function is only defined for positive `i`. Argument `x` can be either positive or"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// note that the root pitch is not stored in the Scale (which should arguably be called a Mode for that reason)\n// instead you supply it at play time:\n\n// key of A\nPbind(\n \\degree, Pseq((0..7), inf), // your melody goes here\n \\scale, Scale.major, // your scale goes here\n \\root, -3 // semitones relative to 60.midicps, so this is A\n).play;\n```"}, {"role": "assistant", "content": "note that the root pitch is not stored in the Scale (which should arguably be called a Mode for that reason) instead you supply it at play time: (Scale: represents a musical scale)"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ProxySynthDef`."}, {"role": "assistant", "content": "```supercollider\na = ProxySynthDef(\"xtest\", { SinOsc.ar(400) * 0.1 });\n\na.add;\n\nx = Synth(\"xtest\");\nx.release;\n\n\n/*\n\n if the resulting number of channels is larger than a given channelConstraint,\n it behaves according to the rate: audio rate signals are wrapped around\n a smaller channel size, control rate signals are not (the exceeding channels are left out)\n\n*/\n```"}]} -{"conversations": [{"role": "user", "content": "What does `DataFilter.filter` do? What arguments does it take?"}, {"role": "assistant", "content": "perform the filter Arguments: data — a List of data.."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes shred01 (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n// by Notgoodenogh\n\n(\n5.do{\n\n{FreeVerb.ar(1 / pow(2.718281, LFSaw.ar(rrand(10,100),1,1).squared / (2 * (Latch.ar(WhiteNoise.ar(1).range(0.001, 0.15), LFSaw.ar(4,1,0.5,0.5) > 0.99)).squared)) * 0.1, 0.33, 2) * EnvGen.kr(Env.linen(20, 40, 20, 1), doneAction: 2) ! 2}.play\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `PV_RandComb` in SuperCollider briefly."}, {"role": "assistant", "content": "PV_RandComb — Pass random bins. Randomly clear bins. Category: UGens > FFT."}]} -{"conversations": [{"role": "user", "content": "What does `TDelay.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Trigger delay. Arguments: in — Input trigger signal.; dur — Delay time in seconds.."}]} -{"conversations": [{"role": "user", "content": "What does `Pfin.new` do?"}, {"role": "assistant", "content": "embeds count elements of the pattern into the"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BPF`."}, {"role": "assistant", "content": "```supercollider\n{ BPF.ar(Saw.ar(200, 0.5), FSinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3600, 4000), 0.3) }.play;\n\n{ BPF.ar(Saw.ar(200, 0.5), MouseX.kr(100, 10000, 1), 0.3) }.play;\n\n // BPF on control signals:\n(\n{ var vib = BPF.kr(PinkNoise.kr, MouseX.kr(1, 100, 1), 0.3) * 10;\n SinOsc.ar(vib * 200 + 600) * 0.2 }.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Timing variations."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\sound, {\n arg i_bus = 0, amp = 0.1, freq = 440, sustain = 1, pan = 0;\n var env, osc, out;\n env = EnvGen.kr(Env.perc(0.01, sustain, amp),doneAction:2);\n osc = SinOsc.ar([freq, freq * 1.005, freq * 0.995], mul:env);\n out = Pan2.ar(osc, pan);\n Out.ar(i_bus, out);\n}).send(s);\n);\n\n(\n~amp = 0.1;\na = Pdef(\\a,\n Pbind(\n \\instrument, \\sound,\n \\amp, ~amp * 1.5,\n \\degree, Pseq([2, 4, 5, 6, 1] - 1, inf),\n \\dur, Pseq([1, 1, 1, 1, 2] / 4, inf)\n )\n).quant_([3, 0, 0, 1]);\n\nb = Pdef(\\b,\n Pbind(\n \\instrument, \\sound,\n \\amp, ~amp,\n \\degree, Pseq(([8, 6, 5, 3, 4, 6]!3).flat[0..(6*3)-2] - 1, inf),\n \\dur, Prand([Pseq([1, 1, 1, 1, 1, 1] / 4, 4), Prand([1/8, 3/8], 1)], inf)\n )\n).quant_([3, 0, 0, 1]);\n\nc = Pdef(\\c,\n Pbind(\n \\instrument, \\sound,\n \\amp, ~amp * 0.6,\n \\degree, Pseq([1, 6, 8, 6, Pwrand([11,13], [2, 1].normalizeSum)] - 1, inf),\n \\amp, Pseq([0, 1, 1, 1, 1] / 10, inf),\n \\dur, Pseq([8, 1, 1, 1, 1] / 8, inf),\n \\sustain, 0.1\n )\n).quant_([3, 0, 0, 1]);\n);\n\n(\nSystemClock.sched(0, Routine({\n a.play; 12.yield;\n b.play; 12.yield;\n c.play; 12.yield;\n c.pause; 6.yield;\n a.pause; 6.yield;\n\n b.pause; a.play; 12.yield;\n b.play; 12.yield;\n c.play; 12.yield;\n c.pause; a.pause; 6.yield;\n b.pause; 6.yield;\n}));\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n{ BlitB3Tri.ar(XLine.kr(1000, 20, 10)) }.play;\n\n//unfortunately, aliasing returns at higher frequencies (over 5000Hz or so) with a vengence\n{ BlitB3Tri.ar(MouseX.kr(20,8000,'exponential').poll,0.99,MouseY.kr(0.001,0.99)) }.play;\n\n//more efficient, some aliasing from 3000, but not so scary over 5000. Duller sound (less high harmonics included for lower fundamentals)\n{ LFTri.ar(MouseX.kr(20,8000,'exponential').poll) }.play;\n\n\n//comparison\n//LFTri version cheaper, and less aliasing! \nx = { LFTri.ar(\n// …\n```"}, {"role": "assistant", "content": "unfortunately, aliasing returns at higher frequencies (over 5000Hz or so) with a vengence more efficient, some aliasing from 3000, but not so scary over 5000. Duller sound (less high harmonics included for lower fundamentals) (BlitB3Tri: Bipolar BLIT derived triangle)"}]} -{"conversations": [{"role": "user", "content": "What are the arguments of GrainBuf.ar?"}, {"role": "assistant", "content": "`GrainBuf.ar(numChannels, trigger, dur, sndbuf, rate, pos, interp, pan, envbufnum, maxGrains, mul, add)`. The ones you always pass are numChannels (1 or 2), trigger (a UGen that fires grains, e.g. Impulse.kr(20)), dur (grain length in seconds), sndbuf (an integer buffer number, or `~buf`), rate (playback rate per grain), and pos (read position 0..1 into the buffer). Raise maxGrains if the server complains about too many grains rather than lowering density."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n//Chaos engine hum\n(\n{\n SinOsc.ar(10 + (50 * SinOsc.kr([50, 51], 0, SinOsc.kr(101, Saw.kr(0.12345, 678, 9), 0.2, 0.8), Pulse.kr([25, 25.5], 0.25, 0.125, -0.25))), 0, 0.5, 0);\n}.play();\n)\n```"}, {"role": "assistant", "content": "A deep binaural cycle reminiscent of the engine of a space ship."}]} -{"conversations": [{"role": "user", "content": "Explain `POneZero` in SuperCollider briefly."}, {"role": "assistant", "content": "POneZero — UGenPatterns quark library Based on OneZero Category: Streams-Patterns-Events > UGenPatterns > Modifiers."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `CombL`."}, {"role": "assistant", "content": "```supercollider\n// These examples compare the variants, so that you can hear the difference in interpolation\n\n// Comb used as a resonator. The resonant fundamental is equal to\n// reciprocal of the delay time.\n{ CombN.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ CombL.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ CombC.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// with negative feedback:\n{ CombN.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ CombL.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ CombC.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n// used as an echo.\n{ CombL.ar(Decay.ar(Dust.ar(1, 0.5), 0.2, WhiteNoise.ar), 0.2, 0.2, 3) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Modulating GVerb roomsize, among other things?"}, {"role": "assistant", "content": "```supercollider\nNdef(\\b, { LFDNoise0.ar(500)});\nNdef(\\c, { LFDNoise1.ar(0.3).range(5,15)});\nNdef(\\d, { LFDNoise3.ar(SinOsc.kr(0.1, 0, 1000, 300), 200, 200)});\nNdef(\\a, { Limiter.ar(GVerb.ar(SinOsc.ar(Ndef(\\d), mul: Ndef(\\b)), roomsize: Ndef(\\c) ) )});\nNdef(\\a).play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Just experimenting with patterns."}, {"role": "assistant", "content": "```supercollider\n/* Some Funky Klangs - Totally botched the math on what I was trying to do but it sounds better this way */\n\n( \nSynthDef(\\DistKlangBlip, { \n | out = 0, release = 1, freq1 = 1, freq2 = 5, freq3 = 8, freqMult = 4 | \n var env = Linen.kr(Impulse.kr(0), 0.01, 1, release, doneAction:2); \n var freqs = ([freq1, freq2, freq3] * freqMult).midicps; \n var klang = Klang.ar(`[freqs, nil, nil ], 1, 0); \n Out.ar(out, klang.tanh!2 * env * 0.5) \n}).add\n\n);\n\n( \n Pbind(*[ \n instrument: \\DistKlangBlip, \n dur: Pxrand([0.25, 0.5], inf) * 0.5, \n release: Pkey(\\dur), \n freqMult: Pxrand((3..12), inf), \n freq2: Prand([4,5], inf), \n freq3: Prand([8,12], inf) \n]).play; \n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Change MembraneCircle to MembraneHexagon for a different shaped\n// circular drum head\ns.boot;\ns.reboot;\n(\n{ var excitation = EnvGen.kr(Env.perc,\n MouseButton.kr(0, 1, 0),\n timeScale: 0.1, doneAction: 0\n ) * PinkNoise.ar(0.4);\n var tension = MouseX.kr(0.01, 0.1);\n var loss = MouseY.kr(0.999999, 0.999, 1);\n MembraneCircle.ar(excitation, tension, loss);\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Change MembraneCircle to MembraneHexagon for a different shaped\n// circular drum head\ns.boot;\ns.reboot;\n(\n{ var excitation = EnvGen.kr(Env.perc,\n MouseButton.kr(0, 1, 0),\n timeScale: 0.1, doneAction: 0\n ) * PinkNoise.ar(0.4);\n var tension = MouseX.kr(0.01, 0.1);\n var loss = MouseY.kr(0.999999, 0.999, 1);\n MembraneCircle.ar(excitation, tension, loss);\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Seekers are something you should avoid?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n var time = 0.23;\n var freq = (55).midicps;\n var a = VarSaw.ar(freq/2, width: XLine.ar(0.5,1,time)).range(0,XLine.ar(0.666,1/666,time));\n var tone = SinOsc.ar(freq).fold(-0.23*a,a) * EnvGen.ar(Env([1,0],[time]));\n Out.ar(0, tone.dup);\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n var saw, bpf;\n saw = Pulse.ar(\n freq: [100,150],\n mul: LFPulse.kr(\n freq: [0, 0.03, 0.04],\n width: 0.15));\n bpf = LPF.ar(in: saw, freq: SinOsc.kr(-10, -5, 3).range(200, 400));\n Out.ar(0, bpf);\n}.play;\n)\n```"}, {"role": "assistant", "content": "//Pulse is the UGen. There is multichannel expansion due to the lists in the freqs. The range is a big part of the reason this sounds so deep."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// example from ServerErrorGui in crucial lib\n\nf = OSCresponderNode(s.addr, '/fail', { |time, responder, msg|\n {\n var mins, secs;\n mins = (time/60).round(1);\n secs = (time%60).round(0.1);\n if(secs<10, { secs = \"0\"++secs.asString }, { secs = secs.asString });\n // put this on a gui\n // errors.label = \"% % (%:%)\".format(msg[1], msg[2], mins, secs);\n // errors.stringColor = Color.white;\n \"% % (%:%)\".format(msg[1], msg[2], mins, secs).postln;\n }.defer\n});\nf.add;\n// …\n```"}, {"role": "assistant", "content": "example from ServerErrorGui in crucial lib errors.label = \"% % (%:%)\".format(msg[1], msg[2], mins, secs); (OSCresponderNode: client side network responder)"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `MouseY`."}, {"role": "assistant", "content": "```supercollider\n{ SinOsc.ar(MouseY.kr(40, 10000, 1), 0, 0.1) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n~lfd={\n var signal, myFrequency, frequencyMin=0.1, frequencyMax=30, myAmplitude, amplitudeMin=0.01, amplitudeMax=0.6, myPhase, phaseMin=0, phaseMax=1.5;\n myFrequency = Array.fill(2, {[rrand(frequencyMin, frequencyMax)]});\n myAmplitude = Array.fill(2, {[rrand(amplitudeMin, amplitudeMax)]});\n myPhase = Array.fill(2, {[rrand(phaseMin, phaseMax)]});\n signal = LeakDC.ar([LFDNoise1, LFDNoise0, LFDNoise3, LFDClipNoise].choose.ar(myFrequency, myPhase, myAmplitude));\n Out.ar(0, signal);\n};\n);\n\n~lfd.scope\n```"}, {"role": "assistant", "content": "a draft of a modular function for LFDNoise sctochastically selection. i shall be turning this into a pseudo ugen, using high level classes abstraction layer."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Event`."}, {"role": "assistant", "content": "```supercollider\na = (x: 6, y: 7, play: { (~x * ~y).postln });\na.play; // returns 6 * 7\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Idea: network of loosely connected nodes?"}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\nodeTest, {\n // the input\n// var input = Impulse.ar([1, 3, 5].reciprocal * 1, phase: [0, 0.25, 0.5]).sum;\n\n //var input = Impulse.ar([2, 3], phase: [0, 0.25]).sum;\n// var input = Select.ar(Line.kr(0, 1, 10) * SinOsc.ar(0.01).range(0, 1), [Impulse.ar([0.2, 0.3], phase: [0, 0.25]).sum, LocalIn.ar(1)]);\n\n var input = Select.ar(Line.kr(0, 1, 10), [Impulse.ar(0.134), LocalIn.ar(1)]);\n // the nodes, each takes its predecessor as input and estimates the duration between two events.\n var nodes = (1..20).inject([input], {|last, item|\n var dur = Gate.ar(\n Timer.ar(TDelay.ar(last.first, Rand(1, 4))),\n last.first\n );\n\n [TDuty.ar(\n dur.lag(20),\n TDelay.ar(last.first, dur.lag(20)),\n 1\n )] ++ last\n });\n\n\n LocalOut.ar(nodes.first);\n\n // add a pitch to each\n nodes = nodes.collect{|node, i| SinOsc.ar((500 + (i*250)), 0.9pi)\n// * Decay2.ar(node, 0.01, 0.2)\n * EnvGen.ar(Env.perc(0.0001, 0.1), gate: node)\n * 2 * (25-i) * 0.01};\n\n // splay in stereo field\n //nodes.sum!2;\n Splay.ar(nodes)// + (SinOsc.ar(2000) * Decay2.ar(input, 0.01, 0.2) * 0.1);\n\n}).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `BufFrames` in SuperCollider?"}, {"role": "assistant", "content": "BufFrames — Current number of frames allocated in the buffer. Get the current number of allocated frames. Category: UGens > Buffer > Info."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Integrator.ar(LFPulse.ar(300, 0.2, 0.1), MouseX.kr(0.001, 0.999, 1)) }.play\n\n// used as an envelope\n{ Integrator.ar(LFPulse.ar(3, 0.2, 0.0004), 0.999, FSinOsc.ar(700), 0) }.play\n\n\n// scope\n\n{ Integrator.ar(LFPulse.ar(1500 / 4, 0.2, 0.1), MouseX.kr(0.01, 0.999, 1) }.scope\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Integrator.ar(LFPulse.ar(300, 0.2, 0.1), MouseX.kr(0.001, 0.999, 1)) }.play\n\n// used as an envelope\n{ Integrator.ar(LFPulse.ar(3, 0.2, 0.0004), 0.999, FSinOsc.ar(700), 0) }.play\n\n\n// scope\n\n{ Integrator.ar(LFPulse.ar(1500 / 4, 0.2, 0.1), MouseX.kr(0.01, 0.999, 1)) }.scope\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Pseq(#[60, 61, 63, 65, 72], inf).asStream;\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, a.next.midicps]);\n 0.2.wait;\n })\n}).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Pseq(#[60, 61, 63, 65, 72], inf).asStream;\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, a.next.midicps]);\n 0.2.wait;\n })\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Bus`."}, {"role": "assistant", "content": "```supercollider\n(\na = Bus.control(s, 1).set(440);\nb = Bus.control(s, 1).set(0.01);\n);\n(\nSynthDef(\\rlpf, { |out, ffreq, rq|\n Out.ar(out, RLPF.ar(WhiteNoise.ar(0.2), ffreq, rq))\n}).play(s, [\\ffreq, a.asMap, \\rq, b.asMap]);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// (thor magnusson) (2006)\n\n// An instrumentalist inside a synthdef.\n\n(\nSynthDef(\\drummer, { arg out=0, tempo=4;\n var snare, base, hihat;\n tempo = Impulse.ar(tempo); // for a drunk drummer replace Impulse with Dust !!!\n\n snare = WhiteNoise.ar(Decay2.ar(PulseDivider.ar(tempo, 4, 2), 0.005, 0.5));\n base = SinOsc.ar(Line.ar(120,60, 1), 0, Decay2.ar(PulseDivider.ar(tempo, 4, 0), 0.005, 0.5));\n hihat = HPF.ar(WhiteNoise.ar(1), 10000) * Decay2.ar(tempo, 0.005, 0.5);\n\n Out.ar(out,(snare + base + hihat) * 0.4 ! 2)\n}).add;\n);\n\na = Synth(\\drummer);\na.set(\\tempo, 6);\na.set(\\tempo, 18);\na.set(\\tempo, 180); // check the CPU! no increase.\na.free;\n```"}, {"role": "assistant", "content": "(thor magnusson) (2006) An instrumentalist inside a synthdef."}]} -{"conversations": [{"role": "user", "content": "How do I play a sample from disk?"}, {"role": "assistant", "content": "Load it into a Buffer on the server, then play the buffer. `BufRateScale` keeps the pitch right when\nthe file's sample rate differs from the server's.\n\n```supercollider\n(\ns.waitForBoot {\n ~buf = Buffer.read(s, \"C:/sounds/break.wav\");\n SynthDef(\\player, { |out = 0, buf = 0, amp = 0.6, rate = 1|\n var sig = PlayBuf.ar(2, buf, BufRateScale.kr(buf) * rate, loop: 1);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n ~player = Synth(\\player, [\\buf, ~buf]);\n};\n)\n```\nUse `numChannels` 1 for a mono file; a mismatch is silent or wrong-sounding rather than an error."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Re: the perfect frequencies?"}, {"role": "assistant", "content": "```supercollider\n// Rumush\n// https://mycelialcordsblog.wordpress.com/\n// https://fungorumush.bandcamp.com/releases\n// https://soundcloud.com/fungorum\n\n(\nf = {\n var rep = [4, 8, 16, 32];\n var n = rep.choose;\n var x = [\n\n 54, 60, 66, 72, 81, 90, 96, 102,\n 108, 128, 132, 144, 162, 180, 192, 204,\n 216, 240, 264, 288, 324, 360, 384, 408,\n 432, 480, 528, 576, 648, 720, 768, 816,\n 864, 960, 1056, 1152, 1296, 1440, 1536, 1632,\n 1728, 1920, 2112, 2304, 2592, 2880, 3072, 3264,\n 3456, 3840, 4224, 4608, 5184, 5760, 6144, 6528,\n 6912, 7680, 8448, 9216, 10368, 11520, 12288, 528\n\n ];\n Mix.fill(n,\n {\n var detune = 5.rand;\n var sin = SinOsc.ar(x.choose, 4.rand, 0.25);\n var saw = RLPF.ar(Saw.ar(x.choose*0.01+detune, 0.75), x.choose, 2.rand).tanh;\n Pan2.ar((sin+saw) * EnvGen.kr(Env.sine(12, 1/n), 1, doneAction:2),\n 1.rand2) }\n );\n};\n);\n\n(\n// DEFINE A ROUTINE\nr = Routine({\n\n inf.do({\n f.play;\n 10.wait;\n })\n});\n);\n\nr.reset.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `NetAddr`."}, {"role": "assistant", "content": "```supercollider\nn = NetAddr(\"localhost\", 12345);\nn = s.addr;\n\n// Example sending symbols, integers, and a float\nn.sendMsg('/s_new', \\default, 2000, 0, s.defaultGroup.nodeID, \\freq, 60.midicps);\n\n// The initial forward slash can be omitted\nn.sendMsg(\\n_set, 2000, \\gate, 0);\n\n// Using the performList syntax, you can use an array to store an OSC message\n~msg = [\\n_set, 2000, \\gate, 0];\nn.sendMsg(*~msg);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Play your (short) soundfiles with some delay."}, {"role": "assistant", "content": "```supercollider\n// By Bjørn Houdorf March 2013, Play your (short) soundfiles with some delay.\n\nb = SoundFile.collectIntoBuffers(\"yourSoundFileFolder/*\"); // 1. rund this\n\n( // 2. and then run this\nt = Task({\n({\n var num= b.size.rand;\n var buf= b[num];\n 0.1*Splay.ar(PlayBuf.ar(buf.numChannels, buf, 1, 1, 0, 0));\n}.play;\n) \n});\n);\n\n\n( // 3. Then run this\nz = Task({\nloop({\n t.start;\n 0.1.wait;\n});\n});\n);\n\n\nz.start; // 4. and run this\nz.stop; // 5. and finally run this\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Pmono` in SuperCollider?"}, {"role": "assistant", "content": "Pmono — monophonic event stream Plays one instance of a Synth. The pattern pairs define changes in that one synth's controls. This node is created when entering a Pmono, and released when the Pmono terminates. There is just one node for the duration of the entire pattern, and it will sustain through each event. If a monophonic phrase requires staccato notes or re-articulation between some notes, see PmonoArtic. Category: Streams-Patterns-Events > Patterns > Event."}]} -{"conversations": [{"role": "user", "content": "What is the difference between the language and the server?"}, {"role": "assistant", "content": "sclang runs your code, the clock and Patterns, and builds UGen graphs. scsynth performs the DSP in real time. They communicate over OSC, which is why a language-side mistake can leave a sound running, and why s.freeAll stops it."}]} -{"conversations": [{"role": "user", "content": "What does `BSpline.interpolate` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: divisions — (describe argument here). Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{ Latoocarfian2DC.ar(\n SampleRate.ir/8,\n SampleRate.ir/2,\n LFNoise2.kr(2.dup, 1.5, 1.5),\n d:LFNoise2.kr(2.dup, 0.5, 1.5),\n mul:0.2\n) }.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{ Latoocarfian2DC.ar(\n SampleRate.ir/8,\n SampleRate.ir/2,\n LFNoise2.kr(2.dup, 1.5, 1.5),\n d:LFNoise2.kr(2.dup, 0.5, 1.5),\n mul:0.2\n) }.play(s);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Entities (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\ota, { arg freq=200, pan=0, amp=0.1;\n var sig;\n var env1, env2, env3, env4, env5, env6, env7, env8;\n var sig1, sig2, sig3, sig4, sig5, sig6, sig7, sig8;\n var fac = 1/SelectX.kr( SinOsc.kr(1/113).range(0,6), [1/2,1,2,4,8,64,128] )/8;\n env1 = EnvGen.ar(Env([42,21,42,30,84],[4,4,7.5,0.5]/fac).circle, 1);\n env2 = EnvGen.kr(Env([0,0,2,1],[4,4,4]).circle, 1);\n env3 = XLine.kr(1,0.1,20*1);\n\n freq = 8.collect({ arg x;\n freq + ( env1 * x ) + [0,SinOsc.kr(x+1, mul:env2).range(0,10*x)];\n });\n //freq.debug.shape.debug(\"freq\");\n sig = SinOsc.ar( freq / [1,2,4]);\n //sig.shape.debug(\"sig1\");\n sig = sig.collect({ arg isig, x;\n isig = SelectX.ar( SinOsc.kr(x+1/34).range(0,1), [isig, isig.fold2(env3)]);\n isig = SelectX.ar( SinOsc.kr(1/223, 3pi/2).range(0,1), [isig, ( isig * SinOsc.kr(1/48 * ( x + 1 )).range(1,100) ).tanh]);\n });\n //sig.shape.debug(\"sig2\");\n sig1 = sig.flop[1];\n sig = sig.flop[0];\n //sig.debug(\"sig\");\n sig1 = Pan2.ar(sig1, SinOsc.ar(sig1.size.collect({ arg x; SinOsc.kr(x/10+1.2).range(0,8) })) * SinOsc.kr(1/48).range(0,1), amp).mean;\n sig = Pan2.ar(sig, SinOsc.ar(sig.size.collect({ arg x; SinOsc.kr(x/10+1.1).range(0,8) })) * SinOsc.kr(1/58).range(0,1), amp).mean;\n sig = sig + sig1;\n sig = sig / 2.0;\n sig = LPF.ar(sig, 1999);\n sig;\n}).play;\n);\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\\help_Control, { |freq = 200|\n\n freq.inspect; // at the time of compiling the def\n\n}).add\n);\n\n// synonym:\n(\nSynthDef(\\help_Control, {\n\n \\freq.kr(200).inspect; // at the time of compiling the def\n\n}).add\n;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\\help_Control, { |freq = 200|\n\n freq.inspect; // at the time of compiling the def\n\n}).add\n);\n\n// synonym:\n(\nSynthDef(\\help_Control, {\n\n \\freq.kr(200).inspect; // at the time of compiling the def\n\n}).add\n);\n```"}]} -{"conversations": [{"role": "user", "content": "How do I record my output to a file?"}, {"role": "assistant", "content": "`s.record(path)` starts recording the server's output; `s.stopRecording` stops it.\n\n```supercollider\ns.record(\"C:/audio/take1.wav\");\n// play for a while\ns.stopRecording;\n```\n\nThe path must be writable and the format follows the extension (.wav, .aiff, .flac). The file is written\nby the server, so it captures exactly what the master bus produces — including your effects, which is what\nyou want. `s.record` also accepts `duration:` to stop by itself, which is the reproducible form for a take."}]} -{"conversations": [{"role": "user", "content": "What is `List`?"}, {"role": "assistant", "content": "List — list of items of variable size"}, {"role": "user", "content": "What does `List.new` do?"}, {"role": "assistant", "content": "Creates a List with the initial capacity given by size."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// Create a new empty collections with size 3:\nx = Array.new(3);\ny = Array.new(3);\nz = List.new(3);\n\n// Try to add 7 items to the array and list.\n// If the array exceeds maxSize, it will only\n// grow to an internally specified max size.\n(\n7.do { |i|\n x.add(i);\n y = y.add(i); // reassign array y on each add\n z.add(i);\n};\n);\n\n// Attempt to access the 5th item:\nx.at(4); // -> nil (out of bounds)\ny.at(4); // -> 4\nz.at(4); // -> 4\n\n// x grew only to size 4\nx.postln; // -> [ 0, 1, 2, 3 ]\ny.postln; // -> [ 0, 1, 2, 3, 4, 5, 6 ]\nz.postln; // -> List[ 0, 1, 2, 3, 4, 5, 6 ]\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Pushing air."}, {"role": "assistant", "content": "```supercollider\n/*\n0050\n\"pushing air\" => \".--. ..- ... .... .. -. --. / .- .. .-.\"\n*/\n\n~morsestr = \".--. ..- ... .... .. -. --. / .- .. .-. / \";\n\n~ctlbus1 = Bus.control(s);\nMIDIIn.connectAll;\n\n(\nSynthDef(\\perc, {|freq=280|\n var ampEnv, snd, attack, release, sat, mod;\n release = 3;\n attack = ~ctlbus1.kr;\n sat = -2;\n mod = SinOsc.ar(4, 0, 2);\n ampEnv = EnvGen.ar(Env.perc(attack, release, 1), doneAction:2);\n snd = ampEnv * SinOsc.ar([freq, (1.005*freq)+mod], [Rand(0,3.14),Rand(0,3.14)]);\n snd = 2/(1 + (sat*snd).exp) - 1;\n Out.ar(0,snd);\n}).add;\n);\n\n~t = TempoClock.new;\n~t.tempo = 3;\nTdef(\\morse).play(~t);\n\n\n(\nMIDIdef.cc(\\attackTime, \n {|val, num, chan, src| \n var attackTime;\n\n attackTime = val.linlin(0,127,0,2);\n ~ctlbus1.set(attackTime);\n (\"attackTime: \" ++ attackTime).postln;\n },2);\n\nMIDIdef.cc(\\tempo, \n {|val, num, chan, src| \n var index;\n var tempoArray = [3,6,12];\n \n index = val.linlin(0,127,0,2);\n ~t.tempo = val.linlin(0,127,1,12);//tempoArray[index];\n val.linlin(0,127,1,12).postln;//tempoArray[index].postln;\n },14);\n);\n\n(\nTdef(\\morse,\n{ \n inf.do{ |i| \n \n var f0 = 180 * (2**(0/12));\n var freq = 2**(([-7,-3,0,2,5,9,12].choose)/12) * f0;\n var char = ~morsestr.wrapAt(i).asString;\n \n switch(char,\n \".\", { \".\".post; \n //x = Synth(\\default); \n x = Synth(\\perc, [\\freq, freq]); \n 1.wait;\n //x.release;\n },\n \"-\", { \"-\".post; \n //x = Synth(\\default); \n x = Synth(\\perc, [\\freq, freq]); \n 3.wait;\n //x.release;\n },\n \" \", { \" \".post; \n 1.wait;\n },\n \"/\", { \"/\".post;\n 3.wait;\n }, {});\n };\n})\n);\n\nTdef(\\morse).reset;\nTdef(\\morse).pause;\nTdef(\\morse).stop;\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Hymn #15 - generative melody by array rewriting?"}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\ping, {\n arg freq = 440, pan = 0;\n var sig;\n sig = SinOsc.ar(freq, 0, 0.3);\n sig = sig * EnvGen.ar(Env.perc(0.01, 1), doneAction:2);\n sig = Pan2.ar(sig, pan);\n Out.ar(0, sig)\n}).add;\n);\n\n(\n~scramb = {|pan|\nvar notes = [0,4,7,14,9,12,4,7,9,7];\nvar dur = [1,1,2,3,6,3,4,5,2,1,13];\nvar transp = [0, 5, 7, 3, 2];\nvar scrambRand = {|array|\n var rand = rrand(0, array.size-3);\n var end = rand + rrand(1,2);\n var range = (rand..end);\n var reverseRange = range.reverse;\n var temp = array.copy;\n range.postln;\n range.do({|item, index|\n array[item] = temp[reverseRange[index]];\n });\n array;\n};\nvar octRand = {|array|\n var rand = rrand(0, array.size-1);\n array[rand] = array[rand] + [-12,0,12].choose;\n };\nvar task = Task {\n var step = 0;\n var transpStep = 0;\n loop {\n var freq = (notes.wrapAt(step) + 60 + transp.wrapAt(transpStep)).midicps;\n Synth(\\ping, [\\freq, freq, \\pan, pan]);\n (dur.wrapAt(step) * 0.15).wait;\n step = step + 1 % (notes.size * 12;);\n if (step%32 == 0, {scrambRand.value(notes)});\n if (step%20 == 0, {scrambRand.value(dur)});\n if (step%66 == 0, {transpStep = transpStep + 1 % (transp.size)});\n if (step%24 == 0, {notes = notes.rotate(rrand(-1, 1))});\n if (step%56 ==0, {octRand.value(notes)});\n }\n}.play;\n};\n);\n\n(\n~scramb.value(-0.7);~scramb.value(0.7);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "I made a synth and I hear nothing. Where do I start?"}, {"role": "assistant", "content": "Start with the node tree, not the code: evaluate `s.plotTree`. If your Synth is not there, it never started or it already freed itself; if it is there, the problem is in the signal. Which of the two do you see?"}, {"role": "user", "content": "It's in the tree."}, {"role": "assistant", "content": "Then the node lives and the signal is being lost. Check three things in order: does the SynthDef reach `Out.ar(0, ...)` with bus 0; is any `amp`/`mul` zero; and is a filter closed, e.g. `LPF.ar(sig, 50)` on a 440 Hz sine. Paste the SynthDef and I will read it."}, {"role": "user", "content": "SynthDef(\\x, { |out = 0| Out.ar(out, LPF.ar(Saw.ar(60), 80) * 0.1) }).add; Synth(\\x, [\\out, 2]);"}, {"role": "assistant", "content": "Two things. You wrote a low-pass at 80 Hz over a 60 Hz saw, which leaves almost nothing above the fundamental — the patch is nearly a sine at 60 Hz at very low level. And you passed `\\out, 2`, so it is going to bus 2, not the master. Try `Synth(\\x)` with the default out and a cutoff of 800:\n\n```supercollider\nSynthDef(\\x, { |out = 0, cutoff = 800| Out.ar(out, LPF.ar(Saw.ar(60), cutoff) * 0.1) }).add;\nSynth(\\x);\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// create a new server\na = Server(\\foo, NetAddr(\"127.0.0.1\", 57123)).boot.makeWindow;\nNdef(\\sound, { SinOsc.ar([600, 635]) * SinOsc.kr(2).max(0) * 0.2 }).play; // play on default\nNdef(\\sound -> \\foo, { SinOsc.ar([700, 745]) * SinOsc.kr(2).max(0) * 0.2 }).play; // play on foo\n\n// clear definitions\nNdef(\\sound -> \\foo).clear(3);\nNdef(\\sound).clear(3;\n\na.dump; // display settings of new server\na.quit; // terminate new server\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// create a new server\na = Server(\\foo, NetAddr(\"127.0.0.1\", 57123)).boot.makeWindow;\nNdef(\\sound, { SinOsc.ar([600, 635]) * SinOsc.kr(2).max(0) * 0.2 }).play; // play on default\nNdef(\\sound -> \\foo, { SinOsc.ar([700, 745]) * SinOsc.kr(2).max(0) * 0.2 }).play; // play on foo\n\n// clear definitions\nNdef(\\sound -> \\foo).clear(3);\nNdef(\\sound).clear(3);\n\na.dump; // display settings of new server\na.quit; // terminate new server\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for simple melody algorithmically generated with a Markov Chain."}, {"role": "assistant", "content": "```supercollider\n/* Markov Chain Experiment II\n Jacob Joaquin\n\n Get a visual representation of the Markov Chain here:\n http://codehop.com/supercollider-markov-chain/\n*/\n\n(\n// Synthesizer\nSynthDef(\\my_synth, {|dur = 1.0, amp = 1.0, freq = 440|\n var env = EnvGen.ar(Env.new([1, 0.1, 0], [0.06, dur - 0.06]), doneAction: 2);\n Out.ar([0, 1], SinOsc.ar([freq * 0.995, freq * 1.005], 0, env * amp))\n}).add; \n\n// Create task\nt = Task({\n // Set attributes of each node\n // [freq, dur, [[next_state, weighted_random],…]]\n var node_list = [\n [60, 1, [[1, 2]]],\n [62, 0.5, [[0, 1], [2, 1]]],\n [63, 1, [[0, 1], [3, 1]]],\n [65, 0.5, [[0, 1], [3, 4], [4, 1]]],\n [67, 1, [[5, 1]]],\n [70, 1.5, [[4, 1], [6, 2]]],\n [69, 1, [[4, 1], [7, 2]]],\n [72, 0.5, [[4, 1], [7, 4], [0, 2]]]\n ];\n\n var node_index = 0;\n var bps = 133.0 / 60.0; // Beats per second\n \n inf.do({\n var weight = 0;\n var random;\n var accumulator;\n var node = node_list[node_index]; \n var freq = node[0].midicps;\n var dur = node[1] / bps;\n var paths = node[2];\n \n // Get total statistical weight of connected nodes\n (0 .. paths.size - 1).do {|i| weight = weight + paths[i][1]};\n \n // Generate random value for choosing next node\n random = weight.rand;\n\n // Choose next node based on statistical weights\n accumulator = paths[0][1];\n \n node_index = block {|break|\n paths.size.do {|i|\n if ((random < accumulator), {\n break.value(paths[i][0])\n }, {\n accumulator = accumulator + paths[i + 1][1] \n })\n }\n };\n \n // Play\n Synth(\\my_synth, [\\dur, dur, \\amp, -3.dbamp, \\freq, freq]); \n dur.wait;\n })\n});\n\nt.start;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for tired pads."}, {"role": "assistant", "content": "```supercollider\n// this is what I write when I didn't sleep last night.. zzzzzz\n// easy subsynth with dynklank and simple scale\n\n(\n\nfork{ \n loop{\n var time;\n time = 5.rand;\n {\n var sound, freqs, envs, rings, numvoices, env;\n numvoices = 40;\n freqs = {(Scale.major(\\just).degrees+26+\n (0,12..110).choose).choose}.dup(numvoices).midicps;\n rings = {1.0.rand}.dup(numvoices);\n envs = { EnvGen.kr(Env.linen( time/3.0.rand, \n time/3.0.rand, time/3.0.rand, 1.0.rand ) ) }.dup(numvoices);\n \n sound = PinkNoise.ar(numvoices.reciprocal!2);\n sound = DynKlank.ar(`[freqs,envs,rings], sound );\n sound = sound * EnvGen.kr(Env.linen(time.rand,time/3,time.rand),doneAction:2);\n \n sound = HPF.ar(sound, 120);\n \n 4.do{sound = DelayC.ar(sound, 0.4, [0.4.rand,0.4.rand], 1/8, sound) };\n \n //good call - lets turn this down \n sound*0.2;\n }.play;\n time.rand.wait;\n }\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a kick drum in SuperCollider."}, {"role": "assistant", "content": "A pitch-swept sine with a fast decay: the frequency envelope is what makes it read as a kick.\n\n```supercollider\n(\nSynthDef(\\kick, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 50, 40], [0.03, 0.15], -4));\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -6), doneAction: 2);\n Out.ar(out, Pan2.ar(SinOsc.ar(pitch) * env * amp));\n}).add;\n);\nSynth(\\kick);\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for how to generate the synthdef with a pattern?"}, {"role": "assistant", "content": "```supercollider\n(\nPdef(\\zed, \n Pbind(\n \\osc, Pseq([SinOsc, LFSaw],inf),\n \\instrument, Prout({ arg ev;\n SynthDef(\\zed, { arg out=0, gate=1, amp=0.1, pan=0, freq=200;\n var sig;\n sig = ev[\\osc].ar(freq);\n sig = sig * EnvGen.kr(\\adsr.kr(Env.adsr(0.1,0.1,0.8,0.1)), gate, doneAction:2);\n sig = Pan2.ar(sig, pan, amp);\n Out.ar(out, sig);\n }).add.yield;\n }).loop,\n \\degree, Pseq([0],inf),\n \\dur, 1,\n \\amp, 0.1,\n )\n).play;\n);\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LatoocarfianL`."}, {"role": "assistant", "content": "```supercollider\n// randomly modulate all params\n(\n{ LatoocarfianL.ar(\n SampleRate.ir/4,\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5)\n) * 0.2 }.play(s);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n(\np = Pbind(\n \\midinote, PlaceAll([[60, 61], 70, [80, [81, 81.5], 82]], inf),\n \\dur, 0.2\n);\n\nx = p.play;\n);\n\nx.stop;\n\n\n// to distinguish subarrays from arrays to be taken as output use Refs, \n// as wrapping in another array wouldn't do\n\n(\np = Pbind(\n \\midinote, PlaceAll([[60, 61], 70, [80, `[81, 81.5], 82]], inf),\n \\dur, 0.2\n);\n\nx = p.play;\n) ;\n\n\nx.stop;\n\n\n// Items may also\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n(\np = Pbind(\n \\midinote, PlaceAll([[60, 61], 70, [80, [81, 81.5], 82]], inf),\n \\dur, 0.2\n);\n\nx = p.play;\n);\n\nx.stop;\n\n\n// to distinguish subarrays from arrays to be taken as output use Refs, \n// as wrapping in another array wouldn't do\n\n(\np = Pbind(\n \\midinote, PlaceAll([[60, 61], 70, [80, `[81, 81.5], 82]], inf),\n \\dur, 0.2\n);\n\nx = p.play;\n) ;\n\n\nx.stop;\n\n\n// Items may also be Patterns or Streams\n\n(\np = Pbind(\n \\midinote, PlaceAll([[60, 61], 70, [80, Pwhite(84.0, 89), 82]], inf),\n \\dur, 0.2\n);\n\nx = p.play;\n) ;\n\n\nx.stop;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `RollAmplitude.new` do? What arguments does it take?"}, {"role": "assistant", "content": "CutMixer amplitude algorithm Arguments: ampdirect — A function, called every block, that determines whether to crescendo or diminuendo. Crescendo if positive, dim if nonpositive.; ampexp — A float value that determines the exponent of the crescendo or diminuendo. 1 is linear, 2 is parabolic, 3 is cubic, etc. The default is 2. This can also be a function, in which case it is called every block.."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Simple relaxing white noise generator simulating a seaside."}, {"role": "assistant", "content": "```supercollider\n// A.Broz: Waves & Surf (2020-10-29)\n\n/*\n _.====.._\n ,:._ ~-_\n `\\ ~-_\n | `.\n ,/ ~-_\n -..__..-'' ~~--..__...----...\n*/\n(\n~waves = {\n var noise = { WhiteNoise.ar(0.04 + LFNoise1.kr(0.3, 0.03)) };\n var motion = { LFNoise1.kr(0.2).exprange(100, 2000) };\n var hps = { HPF.ar(noise.value, 50) };\n var wave = { LPF.ar(hps.value, motion.value).tanh };\n var sig = wave!10;\n sig = Splay.ar(sig, 0.6).tanh;\n sig = sig * Line.kr(0, 1, 10); // fade in\n LeakDC.ar(sig);\n}.play;\n);\n\n~waves release: 10;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `UScore.prepareWaitAndStart` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: targets — (describe argument here); startPos — (describe argument here); updatePosition — (describe argument here). Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for 2 channels of chuckling sawtooths."}, {"role": "assistant", "content": "```supercollider\n//hall of mirrors\n{[AllpassC.ar(HPF.ar(RLPF.ar(Saw.ar(LFPar.kr(0.25).range(220,440)),LFPar.kr(MouseX.kr(0,8),pi).range(220,20000),0.3),LFPar.kr(MouseY.kr(0,8)).range(220,20000)),2,MouseX.kr(0,0.5),2),AllpassC.ar(HPF.ar(RLPF.ar(Saw.ar(LFPar.kr(0.25,pi).range(440,220)),LFPar.kr(MouseX.kr(8,0),pi).range(20000,220),0.3),LFPar.kr(MouseY.kr(8,0),pi).range(20000,220)),2,MouseX.kr(0.5,0),2)]}.play\n```"}]} -{"conversations": [{"role": "user", "content": "How do I play a sample from disk?"}, {"role": "assistant", "content": "Load it into a Buffer on the server, then play the buffer. `BufRateScale` keeps the pitch right when\nthe file's sample rate differs from the server's.\n\n```supercollider\n(\ns.waitForBoot {\n ~buf = Buffer.read(s, \"C:/sounds/break.wav\");\n SynthDef(\\player, { |out = 0, buf = 0, amp = 0.6, rate = 1|\n var sig = PlayBuf.ar(2, buf, BufRateScale.kr(buf) * rate, loop: 1);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n ~player = Synth(\\player, [\\buf, ~buf]);\n};\n)\n```\nUse `numChannels` 1 for a mono file; a mismatch is silent or wrong-sounding rather than an error."}]} -{"conversations": [{"role": "user", "content": "Explain `PLseries` in SuperCollider briefly."}, {"role": "assistant", "content": "PLseries — dynamic scope Pseries variant Takes Symbol args for later reference by the Streams, which will read from variables in the Environments of their instantiation. See PLx_suite. Category: Libraries > miSCellaneous > PLx suite, Streams-Patterns-Events > PLx suite."}]} -{"conversations": [{"role": "user", "content": "Supernova, Groups, Threads, Ndef?"}, {"role": "assistant", "content": "SuperCollider forum — Supernova, Groups, Threads, Ndef?\n\nAbout Ndef:\n\nAFAIK you can manually move a NodeProxy’s group into another group:\n\n```supercollider\n~pargroup = ParGroup(s);\n\nNdef(\\a, { Silent.ar(1) });\n\nNdef(\\a).group.moveToHead(~pargroup);\n```\n\nBut...\n\nNodeProxies use InFeedback.\n\nI was a little suspicious about this for parallel processing. As I recalled, InFeedback’s result depends on the order of execution:\n\n-\nIf the source node for the bus finished processing before the server reaches InFeedback, then InFeedback will output the block of audio being processed now.\n\n-\nIf the source node comes after the node containing InFeedback, then it will output the previous block of audio.\n\nIn both cases, these are the most recently available audio blocks. But, if the order of evaluation is not consistent, then the output may not be consistent.\n\nLet’s test that:\n\n```supercollider\nb = Bus.audio(s, 1);\n\na = { SinOsc.ar(200, 0, 0.1) }.play(outbus: b);\n\nc = { InFeedback.ar(b, 1).dup }.play(target: a, addAction: \\addAfter);\n\n(\nfork {\n var order = Pseq([\\moveBefore, \\moveAfter], inf).asStream;\n loop {\n c.perform(order.next, a);\n 1.0.wait;\n }\n}\n)\n```\n\nOops.\n\nThis means you can’t randomly throw Ndefs into ParGroups. If one Ndef reads a signal from another, then you have to make sure that the target Ndef comes later in a serial (regular) Group. (Correctness of the result should be more important than “optimal” usage of multiple cores.)\n\nIf you don’t, and if supernova happens to put the source and target Ndefs onto separate cores at roughly the same time, then the target might evaluate InFeedback either before or after the source finishes, and there’s no guarantee of this being consistent. So you might get clicks.\n\nhjh"}]} -{"conversations": [{"role": "user", "content": "What does `ServerLog.filterBySynthDef` do? What arguments does it take?"}, {"role": "assistant", "content": "records OSC traffic to and from a Server and displays this in a browseable searchable interface Arguments: defName. Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes No Quarter pluck synth bass sound."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\bass, { |outbus, midinote = 42|\n var freq = midinote.midicps;\n var subfreq = freq / 2;\n \n // Envelopes\n var subenv = EnvGen.kr(Env.perc(0, 1), doneAction:2);\n var env = EnvGen.kr(Env.perc(0, 0.5));\n \n // Component synthesis\n var pluck = Pluck.ar(PinkNoise.ar, 1, 0.2, subfreq.reciprocal) * subenv * 2;\n var tri = VarSaw.ar(freq) * env;\n var sin = SinOsc.ar(freq) * env;\n var sub = (SinOsc.ar([subfreq, subfreq - 2, subfreq + 2]).sum * subenv).tanh;\n var click = RLPF.ar(Impulse.ar(0), [2000, 8000], 1).sum * 1000;\n \n // Initial signal\n var sig = pluck + tri + sub + click;\n \n // Resonant LPFs\n sig = RLPF.ar(sig, XLine.ar(freq * 100, freq * 10, 0.15));\n sig = sig + (MoogFF.ar(sig, freq * 20, 2.5) * 0.1);\n \n // EQ resulting signal\n sig = BPeakEQ.ar(sig, 400, 0.5, -9);\n sig = BPeakEQ.ar(sig, 2000, 0.5, 6);\n sig = BHiShelf.ar(sig, 8000, 1, 3);\n sig = BPeakEQ.ar(sig, 200, 1, 3);\n \n // Apply another envelope to dampen a bit more\n sig = sig * XLine.kr(1, 0.6, 0.1);\n \n // Tanh distortion / limiting\n sig = (sig * 1).tanh;\n \n // Another round of signal coloring, using another RLPF\n // and sine components\n sig = sig + RLPF.ar(sig, XLine.ar(freq * 100, freq * 10, 0.15)) + sin + sub;\n \n // Another round of tanh distortion / limiting\n sig = (sig / 2.3).tanh;\n \n // Another resonant LPF\n sig = MoogFF.ar(sig, XLine.ar(freq*150, freq*30, 0.1), 0.1);\n \n Out.ar(outbus, sig!2);\n}).add;\n);\n\n(\nTempoClock.default.tempo = 1.8;\n\nPbind(\n \\instrument, \\bass,\n \\midinote, Pseq([\n Pseq([Rest, 42, 42], 3),\n Pseq([Rest, 42, 42, 42]),\n Pseq([Rest, 42, 42], 3),\n Pseq([Rest, 45, 45, 42])\n ], inf),\n \\dur, Pseq([\n Pseq([0.75, 0.75, 0.5], 3),\n Pseq([0.5, 0.25, 0.75, 0.5])\n ], inf)\n).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `VectorSplineGui.focused` do? What arguments does it take?"}, {"role": "assistant", "content": "Switches the currently focused data dimension. Indexing starts with the first data dimension, not the 0th (time) dimension. So focused = 0 focuses spline dimension Arguments: di — Integer. Returns: Integer"}]} -{"conversations": [{"role": "user", "content": "What is `RedSlide` in SuperCollider?"}, {"role": "assistant", "content": "RedSlide — logarithmic lag Very similar to .lagud. Useful for smoothing sensor data. Category: Red > redUGens."}]} -{"conversations": [{"role": "user", "content": "What does `SimpleNumber.bilinrand` do?"}, {"role": "assistant", "content": "Bilateral linearly distributed random number in the range (-this, +this). Like linrand, but adds a second straight line from `-this` to 0. Histogram will approach an isosceles triangle with its apex at x = 0. Formally like `.linrand`, but the probability density function is also supported in the range (-x, 0] by 2(1 +"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for simple smooth arp."}, {"role": "assistant", "content": "```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\smooth, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.linen(0.05, sustain, 0.1), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Seekers are something you should avoid?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n var time = 0.23;\n var freq = (55).midicps;\n var a = VarSaw.ar(freq/2, width: XLine.ar(0.5,1,time)).range(0,XLine.ar(0.666,1/666,time));\n var tone = SinOsc.ar(freq).fold(-0.23*a,a) * EnvGen.ar(Env([1,0],[time]));\n Out.ar(0, tone.dup);\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\nSynthDef(\"help-Synth-get\", { |out, freq = 440|\n Out.ar(out, SinOsc.ar(freq, 0, 0.1));\n}).add;\n);\nx = Synth(\"help-Synth-get\");\nx.set(\\freq, 220 + 440.rand);\nx.get(\\freq, { |value| (\"freq is now:\" + value + \"Hz\").postln };\nx.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\nSynthDef(\"help-Synth-get\", { |out, freq = 440|\n Out.ar(out, SinOsc.ar(freq, 0, 0.1));\n}).add;\n);\nx = Synth(\"help-Synth-get\");\nx.set(\\freq, 220 + 440.rand);\nx.get(\\freq, { |value| (\"freq is now:\" + value + \"Hz\").postln });\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Wobble, tremolo, whatever you want to call it."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"Triangular AM\", { arg freq = 440, modfreq = 5, amp = 0.5, attack = 0.01, release = 0.1, pos = 0, gate = 1;\n var carrier, modulator, env;\n modulator = SinOsc.kr(modfreq).range(0, 1); // provides amplitude modulation for wobble\n carrier = LFTri.ar(freq: freq, mul: modulator); // provides triangle wave for an interesting harmonic\n env = Env.asr(\n attackTime: attack,\n sustainLevel: amp,\n releaseTime: release).kr(doneAction: 2, gate: gate);\n carrier = carrier * env;\n Out.ar(0, Pan2.ar(carrier, pos))\n}).add;\n);\n\n(\n// Using these settings you can produce a pulsating wobble sound\n~wobble = Pbind(\n \\instrument, \"Triangular AM\",\n \\scale, Scale.aeolian,\n \\ctranspose, -12,\n \\degree, Pseq([\n [-7,-3, 0, 2, 4, 7],\n [-8, -4, -1, 1, 3, 6],\n [-9, -5, -2, 0, 2, 5],\n [-5, -1, 2, 4, 6, 9],\n [-4, 0, 3, 5, 7, 10],\n ], inf),\n \\dur, Pseq([Pn(4, 3), 2, 2], inf),\n \\amp, 0.4,\n \\modfreq, Pseq([Pn(6.5, 3), 2, 6.5], inf),\n \\attack, 2,\n \\release, 1.2,\n \\pos, [-1, -0.7, -0.2, 0.2, 0.7, 1],\n \\gate, 0,\n);\n);\n\n~wobble.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Synth.basicNew` do? What arguments does it take?"}, {"role": "assistant", "content": "Create and return a Synth object without creating a synth node on the Arguments: defName — A String or Symbol specifying the name of the SynthDef to use in creating the Synth.; server — An optional instance of Server. If nil this will default to the default Server.; nodeID — An optional node ID number. If not supplied one will be generated by the Server's NodeIDAllocator. Normally you should not need to supply an ID.."}]} -{"conversations": [{"role": "user", "content": "Explain `RangeSlider` in SuperCollider briefly."}, {"role": "assistant", "content": "RangeSlider — A view consisting of a sliding extendable handle A view that allows setting two numerical values between 0 and 1, represented by the two ends of a movable and extendable handle. It can have horizontal or vertical orientation, meaning the direction in which the handle moves and extends. Category: GUI > Views."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for in the jungle."}, {"role": "assistant", "content": "```supercollider\n({\nvar nz = { |...args| LFDNoise3.kr(*args) };\nvar sig = Limiter.ar(\n BPF.ar(\n RHPF.ar(\n RLPF.ar(\n WhiteNoise.ar(nz.(1/[9,10],0.25,0.75)),\n nz.(5!2).exprange(1000, 2000),\n nz.(1/5!2).range(0.1,1)),\n nz.(5!2).exprange(50,150),\n nz.(1/5!2).range(0.1,1)),\n nz.(5!2).exprange(150,1000),\n nz.(1/5!2).range(0.1,1)))\n* LFGauss.ar([3,4],0.33) * LFGauss.ar(1/[4,9],0.25)\n* SinOsc.ar(Lag2UD.kr(Duty.kr(1,0,{Dibrown(300,2400,250)}!2),0.25,0.8));\nRotate2.ar(sig[0], sig[1], LFSaw.kr(1/5));\n}.play)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes simple peak detection algorithm."}, {"role": "assistant", "content": "```supercollider\nq = q ? ();\n\n(\nq.s1 = {|q, left, item, right, rContextSize|\n //[left, item, right].postln;\n ((maxItem(item - left) ? 0) + (maxItem(item - right) ? 0)) * 0.5\n};\n\nq.peak1 = {|q, signal, windowSize = 4|\n var mean, sDev, aAbs, peaksSize;\n var rWindowSize = windowSize.reciprocal;\n var h = 3; // 1<= h <= 3\n var idxs = List[];\n var a = signal.collect{|val, i|\n // compute peak function value for each of the N points in T\n q.s1(\n signal.copyRange(i-windowSize, i-1), \n val, \n signal.copyRange(i+1, i + windowSize), \n val\n );\n };\n // Compute the mean m and standard deviation s of all positive values in array a;\n aAbs = a.abs;\n mean = aAbs.mean;\n sDev = aAbs.stdDev;\n\n// mean.postln;\n// sDev.postln;\n \n\n a.do{|val, i| // collect all indices that are concidered big \n if ((a[i]>0) && ((a[i]-mean) > (h*sDev))) {\n idxs.add(i);\n }\n };\n peaksSize = idxs.size.postln;\n\n // retain only one peak of any set of peaks within windowSize of each other\n idxs.inject([0], {|last, now, i|\n ((now - last.last) <= windowSize).if({\n (signal[now] > signal[last.last]).if({\n last.pop;\n last ++ now;\n }, {\n last;\n })\n }, {\n last ++ now; \n })\n })\n}\n);\n\n// apply peak1 to any \"signal\", i.e. a 1-dimensional sequence of numbers, play around with the windowSize param (and possibly h, see above).\nq.res = q.peak1(q.wireWset.amps, 4);q.res\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pdef`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\nPdef(\\x, Pbind(\\note, Pbrown(0, 6, 0.1, inf)));\nPdef(\\x).quant = 0; // no waiting.\nPbindf(Pdef(\\x), \\dur, 0.03).play;\nPbindf(Pdef(\\x), \\dur, 0.1, \\ctranspose, 15).play;\nPbindf(Pdef(\\x), \\dur, 0.3, \\ctranspose, 2).play;\n// now change the definition\nPdef(\\x, Pbind(\\note, Pseq([0, 3, 5, 7, 9, 11], inf)));\nPdef(\\x, Pbind(\\freq, Pseq([1000, 1923, 245.2, 1718] / 1.2 + 0.1, inf)));\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `Pprob` in SuperCollider briefly."}, {"role": "assistant", "content": "Pprob — random values with arbitrary probability distribution Creates an integral table on instantiation (cpu intensive) which is then used by the streams to generate random values efficiently. Category: Streams-Patterns-Events > Patterns > Random."}]} -{"conversations": [{"role": "user", "content": "Explain `OffsetOut` in SuperCollider briefly."}, {"role": "assistant", "content": "OffsetOut — Write a signal to a bus with sample accurate timing. Output signal to a bus, the sample offset within the bus is kept exactly; i.e. if the synth is scheduled to be started part way through a control cycle, OffsetOut will maintain the correct offset by buffering the output and delaying it until the exact time that the synth was scheduled for. Category: UGens > InOut."}]} -{"conversations": [{"role": "user", "content": "What does `IRand.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Single integer random number generator. Arguments: lo — Lower limit of the output range.; hi — Upper limit of the output range.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nPbind(\\type, \\note, \\degree, Pseq([0, 1, 2, 3, 4, 4, 5, 5, 5, 5, 4, 2, 3, 2, 3, 1], inf), \\dur, 0.08).play;\nEvent.addParentType(\\note, (mtranspose: 2, root: 5)); // set different defaults\n\n// note is the default type, this will also pick up the information:\nPbind(\\degree, Pseq([0, 1, 2, 3, 4, 4, 5, 5, 5, 5, 4, 2, 3, 2, 3, 1], inf), \\dur, 0.08.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nPbind(\\type, \\note, \\degree, Pseq([0, 1, 2, 3, 4, 4, 5, 5, 5, 5, 4, 2, 3, 2, 3, 1], inf), \\dur, 0.08).play;\nEvent.addParentType(\\note, (mtranspose: 2, root: 5)); // set different defaults\n\n// note is the default type, this will also pick up the information:\nPbind(\\degree, Pseq([0, 1, 2, 3, 4, 4, 5, 5, 5, 5, 4, 2, 3, 2, 3, 1], inf), \\dur, 0.08).play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `MultiSliderView.selectionSize` do?"}, {"role": "assistant", "content": "The amount of sliders in the selection (starting at"}]} -{"conversations": [{"role": "user", "content": "How do I stop all sound?"}, {"role": "assistant", "content": "s.freeAll stops every node on the server. On the language side, Ndef.clear and Pdef.clear clear the proxies. If a Pattern is still running, Pdef(\\name).stop does it; CmdPeriod immediately stops everything scheduled on the default clock."}]} -{"conversations": [{"role": "user", "content": "How do I make a piece reproducible instead of a different take every time?"}, {"role": "assistant", "content": "Three things make a SuperCollider piece repeatable: a fixed seed, a fixed tempo, and no live input.\n\n```supercollider\n(\nthisThread.randSeed = 1234;\nTempoClock.default.tempo = 2;\nPbind(\\degree, Pwhite(0, 7, inf), \\dur, 0.25).play;\n)\n```\n\n`thisThread.randSeed` fixes the random sequence of the current thread, so `Pwhite`, `Prand` and friends give\nthe same values again. Recording with `s.record(path, duration: 30)` then makes the take an artifact rather\nthan a performance. Input from `MouseX` or a MIDI controller is the usual remaining source of difference."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for micro-beat repeat, based on delay."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\stutter,{\n arg in=0, out=0;\n var sig, delayTime, increment, trigger;\n var reset=\\reset.kr(0);\n var delayPitch=\\pitch.kr(12);\n var offsetms=\\offsetms.kr(0)/1000;\n var strobe=\\strobe.kr(1);\n var on=\\onoff.kr(0);\n var envGen, sustainTime;\n var atkTime=0.002, relTime=0.002;\n\n reset=reset*on;\n // Convert pitch to delay time in seconds\n delayTime = delayPitch.midicps.reciprocal;\n\n // Trigger for incrementing delay time\n trigger = Impulse.ar(delayTime.reciprocal);\n\n // Calculate sustain time to ensure envelope stays high for the chunk duration minus attack and release\n sustainTime = delayTime - (atkTime + relTime);\n\n // Ensure sustainTime is not negative\n sustainTime = max(sustainTime, 0)*strobe;\n\n // Increment delay time\n increment = Dseries(0, delayTime, inf)*on;\n increment = Demand.ar(trigger, reset, increment);\n\n // Generate an envelope to soften clicks\n envGen = EnvGen.ar(Env([0, 1, 1, 0], [atkTime, sustainTime, relTime], 'lin'), trigger);\n\n\n // Get input signal\n sig = In.ar(in, 1); // Assuming stereo input\n\n // Apply delay\n sig = DelayC.ar(sig, 24, increment+offsetms);\n\n // Apply envGen\n sig=sig*envGen;\n\n // Output\n Out.ar(out, sig);\n}).add();\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `SequenceableCollection`?"}, {"role": "assistant", "content": "SequenceableCollection — Abstract superclass of indexable collections"}, {"role": "user", "content": "What does `SequenceableCollection.series` do?"}, {"role": "assistant", "content": "Fill a SequenceableCollection with an arithmetic series. `Array.series(5, 10, 2);`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// using numbers as score\n[3, [1, 2, 1], 1].convertRhythm; // List[0.75, 1.5, 0.75]\n[2, [1, 3, [1, [2, 1, 1, 1]], 1, 3], 1].convertRhythm;\n[2, [1, [1, [2, 1, 1, 1]]], 1].convertRhythm;\n[2, [1, [1, [2, 1, 1, 1]]], 2].convertRhythm; // repeat\n[2, [1, [1, [2, 1, 1, -1]]], 2].convertRhythm; // negative value is tied over.\n\n// sound example\nPbind(\\degree, Pseries(0, 1, inf), \\dur, Pseq([2, [1, [1, [2, 1, 1, -1]]], 2].convertRhythm)).play;\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Splay`?"}, {"role": "assistant", "content": "Splay — Splay spreads an array of channels across the stereo field"}, {"role": "user", "content": "What does `Splay.arFill` do?"}, {"role": "assistant", "content": "In analogy to Mix:arFill, this method takes a function that produces the channels. The counting index is passed to it."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// splay 10 chans of sound into 2\n(\nx = { |spread = 1, level = 0.2, center = 0.0|\n var numchans = 10;\n Splay.ar(\n SinOsc.ar({ |i| LFNoise2.kr(1).exprange(200, 4000) } ! numchans),\n spread,\n level,\n center\n // use levelComp default true\n );\n}.play;\n);\n\ns.meter;\ns.scope;\n\n// change settings dynamically:\n\nx.set(\\spread, 1, \\center, 0); // full stereo\nx.set(\\spread, 0.5, \\center, 0); // less wide\nx.set(\\spread, 0, \\center, 0); // mono center\nx.set(\\spread, 0.5, \\center, 0.5); // spread from center to right\nx.set(\\spread, 0, \\center, -1); // all left\nx.set(\\spread, 1, \\center, 0); // full stereo\n\n// A similar example written with arFill:\n(\nx = { |spread = 1, level = 0.2, center = 0.0|\n var numchans = 10;\n Splay.arFill(numchans,\n { |i| SinOsc.ar(LFNoise2.kr(rrand(10, 20), 200, i + 3 * 100)) },\n spread,\n level,\n center\n );\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for redo_minimalish sketch."}, {"role": "assistant", "content": "```supercollider\n//redFrik - redo_minimalish sketch\n(\ns.waitForBoot{\n \n SynthDef(\\p, {|out= 0, freq= 400, amp= 0.1, gate= 1, detune= 0|\n var env= EnvGen.ar(Env.perc(Rand(0.001, 0.01), LinRand(0.2, 0.4), amp, Rand(-9, -1)), doneAction:2);\n var snd= Mix(SinOsc.ar(freq+[0, detune*0.1], env*2pi));\n Out.ar(out, Pan2.ar(snd*env, Rand(-1, 1)));\n }).add;\n Ndef(\\p, Pspawn(Pbind(\\method,\\par,\\delta,1/8,\\pattern,{Pbind(\\instrument, \\p, \\dur,a=Pseq((1..9).sputter),\\sustain,1/8/a,\\degree,a,\\detune,a)})));\n Ndef(\\p).play(vol:0.5);\n \n Ndef(\\t, {\n var mod= Saw.ar([3, 4], Saw.ar(1, 32, 128), Duty.ar(1, 0, flop(Dseq([0, 8, 1, 5])*[1, 4, 8])));\n var snd= SinOsc.ar(Saw.ar(2, 64, 99), mod)/9;\n CombN.ar(snd, 1/4, 1/4.125, SinOsc.kr(0.005, 1.5pi).range(0, 6));\n });\n Ndef(\\t).play(vol:0.5);\n \n Routine.run({\n var cnt= 1;\n loop{\n var syn;\n cnt= cnt%8+1;\n syn= {\n var del= DelayN.ar(InFeedback.ar(0, 2)+(InFeedback.ar(100, 2)), 1, 1);\n SinOsc.ar(cnt*99+[0, 2], del[1..0])/4;\n }.play(outbus: 64);\n {syn.release(16)}.defer(9-cnt);\n wait(9-cnt);\n };\n });\n Ndef(\\c, {InFeedback.ar(64, 2)}).play(vol:0.5);\n \n Ndef(\\r, {\n var lfos= LFNoise1.ar(0.5!2);\n var snd= Crackle.ar(lfos.range(1.8, 1.98));\n Formlet.ar(snd, TExpRand.ar(200, 2000, lfos).lag(2), lfos.range(5e-4, 1e-3), 0.0012);\n });\n Ndef(\\r).play(vol:0.25);\n \n Routine.run({\n loop{\n var syn= {\n var snd= Pluck.ar(Crackle.ar([1.9, 1.8]), Mix(Impulse.ar({5.linrand+1}!2, -0.125)), 0.05, 0.05.linrand);\n BPF.ar(snd, 2000.rand+100, 0.25.rrand(1.75));\n }.play(s, 62, 18);\n {syn.release(69)}.defer(18);\n wait(18);\n };\n });\n Ndef(\\m, {InFeedback.ar(62, 2)*SinOsc.kr(0.006).range(0.25, 1)}).play(vol:0.5);\n \n NdefMixer(s);\n s.meter;\n};\n)\n```"}]} -{"conversations": [{"role": "user", "content": "My pattern keeps playing after I press Ctrl+."}, {"role": "assistant", "content": "Ctrl+. (CmdPeriod) stops everything scheduled on the clocks, including Patterns. If yours survives, it is not scheduled on a clock — most often it is a `Synth` created directly, or a `Task`/`Routine` started on `SystemClock` in a way that outlived the period. Do you still see the node in `s.plotTree`?"}, {"role": "user", "content": "Yes, there's a synth."}, {"role": "assistant", "content": "Then the sound is a node, not a pattern: `s.freeAll` will stop it. The likely cause is a SynthDef whose EnvGen has no `doneAction`, or a drone with `gate = 1` that nothing releases. Add `doneAction: 2` to the envelope, or keep a reference and `x.set(\\gate, 0)` when you want it to end."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//spinning box / cube\n//after Shiffman https://codingtrain.github.io/website-archive/CodingChallenges/112-3d-rendering.html\n\n(\nvar width= 640, height= 480, w,\ntheta= 0, speed= 0.01, box;\n\nw= RedWindow(\"3Dbox\", Rect(128, 64, width, height)).front;\nbox= Red3DBox();\n\n//--loop\nw.draw{\n theta= theta+speed;\n box.rotation= RedVector3D[theta, theta, theta];\n box.update;\n\n //--render\n box.render(1, 100); //1= exaggerate, 2= standard\n Pen.translate(width*0.5, height*0.5);\n Pen.strokeColor= Color.white;\n box.drawOutlines;\n Pen.fillColor= Color.white;\n box.draw;\n};\nw.play;\nCmdPeriod.doOnce({w.close});\n)\n```"}, {"role": "assistant", "content": "spinning box / cube after Shiffman https://codingtrain.github.io/website-archive/CodingChallenges/112-3d-rendering.html."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,4,4,0,4,4], inf),\n Pseq((80 + [0, 2, 3, 5, 7, 9, 10]).midicps, inf)\n);\nx = a.asStream;\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, x.next.postln]);\n 0.25.wait\n })\n}).play(TempoClock.default);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,4,4,0,4,4], inf),\n Pseq((80 + [0, 2, 3, 5, 7, 9, 10]).midicps, inf)\n);\nx = a.asStream;\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, x.next.postln]);\n 0.25.wait\n })\n}).play(TempoClock.default);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n{Mix({|i|var j=Impulse,t=TChoose.kr(j.kr(1/8),[1,6,3]/8),r=Ringz.ar(j.ar(i*t+0.25),600*t*i+[0,9]);CombC.ar(r,1,0.5,4,0.1,r)}!4).tanh/4}.play\n```"}, {"role": "assistant", "content": "Hi colliders, this is my first post here, and also my very first sc tweet! \r\nIt's nothing special, just a little rhythmic Ringz thingy...\r\nAs a beginner, I found this really useful getting the hang of some syntax shortcuts:\r\nhttp://schemawound.com/post/25710867587/supercollider-tweets-background-tips."}]} -{"conversations": [{"role": "user", "content": "What does `GlitchBPF.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "backward compatibility Arguments: in — The input signal.; freq — Centre frequency in Hertz.; rq — The reciprocal of Q. Q is conventionally defined as cutoffFreq / bandwidth, meaning rq = (bandwidth / cutoffFreq).; mul — Output will be multiplied by this value.; add — This value will be added to the output.."}]} -{"conversations": [{"role": "user", "content": "What does `GridLayout.setAlignment` do? What arguments does it take?"}, {"role": "assistant", "content": "Sets the alignment of an item managed by the Arguments: item — A view or a layout managed by this layout, or a Point of which x denotes the column index and y the row index of an item.; align — A symbol denoting the alignment. See gui_alignments for possible values.."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\nMIDIClient.init;\nm = MIDIOut(0); // Linux users: MIDIOut(0, MIDIClient.destinations[0].uid)\n\n// Simplest way for sending \\note-type events to MIDI\n// define a Pattern of note-events:\na = Pbind(degree: Prand([1, 2, 3, [0, 5]], inf));\n\n// chain a \\midi-type event into the pattern and play it (see link\n```"}, {"role": "assistant", "content": "Simplest way for sending \\note-type events to MIDI define a Pattern of note-events: (MIDIOut: send MIDI messages)"}]} -{"conversations": [{"role": "user", "content": "What does `RedVector.manhattan` do?"}, {"role": "assistant", "content": "Get the sum of the absolute differences as a Float."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Pgroup`."}, {"role": "assistant", "content": "```supercollider\np = Pbind(\\degree, Prand((0..7), inf), \\dur, 0.3, \\legato, 0.2);\n\n // watch the node structure as it changes\ns.waitForBoot({ s.plotTree });\n\n// one group\nPgroup(p).play;\n\n// two nested groups\nPgroup(Pgroup(p)).play;\nPgroup(Ppar([Pgroup(p), Pgroup(p)])).play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `RedHuffman.decompress` do?"}, {"role": "assistant", "content": "Decompresses a binary string into an array. Make sure you use the right #*tree and #*dict as generated by the compress"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// compare PL and PLn, start with polling two items from each Stream\n// Note that Pseq defaults to repeats = 1 and PL/PLn default to repeats = inf\n\n(\n~a = Pseq([1, 2, 3]);\nx = PLn(\\a).asStream;\ny = PL(\\a).asStream;\n\nx.nextN(2);\ny.nextN(2);\n);\n\n\n// replace proxy source \n\n~a = ~a * 100;\n\n\n// Stream from PLn finishes before replacement\n\nx.nextN(2)\n\n// With PL substream is replaced immediately\n\ny.nextN(2)\n```"}, {"role": "assistant", "content": "compare PL and PLn, start with polling two items from each Stream Note that Pseq defaults to repeats = 1 and PL/PLn default to repeats = inf (PLn: dynamic scope placeholder pattern whose streams will be finished before replacements)"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `OSCresponderNode`."}, {"role": "assistant", "content": "```supercollider\n// same as above, but we set the address to nil so we can receive from anywhere\n// no need for a NetAddr since we are just listening (and not sending)\n\no = OSCresponderNode(nil, '/test', { |t, r, msg| msg.postln }).add;\no.remove;\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Pdef`?"}, {"role": "assistant", "content": "Pdef — stream reference definition"}, {"role": "user", "content": "What does `Pdef.all` do?"}, {"role": "assistant", "content": "A global IdentityDictionary with all proxies."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\nPdef(\\x, Pbind(\\note, Pbrown(0, 6, 0.1, inf)));\nPdef(\\x).quant = 0; // no waiting.\nPbindf(Pdef(\\x), \\dur, 0.03).play;\nPbindf(Pdef(\\x), \\dur, 0.1, \\ctranspose, 15).play;\nPbindf(Pdef(\\x), \\dur, 0.3, \\ctranspose, 2).play;\n// now change the definition\nPdef(\\x, Pbind(\\note, Pseq([0, 3, 5, 7, 9, 11], inf)));\nPdef(\\x, Pbind(\\freq, Pseq([1000, 1923, 245.2, 1718] / 1.2 + 0.1, inf)));\n```"}]} -{"conversations": [{"role": "user", "content": "What does `PHSplayer.stop` do? What arguments does it take?"}, {"role": "assistant", "content": "PHS player object Arguments: hsStop — Boolean. Determines if help synth should stop. Defaults to false.; pbindStop — Boolean. Determines if Pbind player(s) should stop. Defaults to true.; addAction — Function to be evaluated at receive time.."}]} -{"conversations": [{"role": "user", "content": "What is `SDrone` in SuperCollider?"}, {"role": "assistant", "content": "SDrone — a droning sInstrument Based on the Ndef used for 'Strange Foreign Bodies'. Category: SInstruments."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n var freqs = [200, 600, 400, 450, 150, 20, 800];\n var amps = Saw.ar(freq: [2,3, 5]).range(1, 0.5, 0.3, 0.8);\n var snd = LFTri.ar(freq: freqs, mul: amps);\n Mix.ar(snd)\n}.play;\n)\n```"}, {"role": "assistant", "content": "LFTri that plays in a single channel with frequent amplitude shifts."}]} -{"conversations": [{"role": "user", "content": "What is `Pdef`?"}, {"role": "assistant", "content": "Pdef — stream reference definition"}, {"role": "user", "content": "What does `Pdef.all` do?"}, {"role": "assistant", "content": "A global IdentityDictionary with all proxies."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\nPdef(\\x, Pbind(\\note, Pbrown(0, 6, 0.1, inf)));\nPdef(\\x).quant = 0; // no waiting.\nPbindf(Pdef(\\x), \\dur, 0.03).play;\nPbindf(Pdef(\\x), \\dur, 0.1, \\ctranspose, 15).play;\nPbindf(Pdef(\\x), \\dur, 0.3, \\ctranspose, 2).play;\n// now change the definition\nPdef(\\x, Pbind(\\note, Pseq([0, 3, 5, 7, 9, 11], inf)));\nPdef(\\x, Pbind(\\freq, Pseq([1000, 1923, 245.2, 1718] / 1.2 + 0.1, inf)));\n```"}]} -{"conversations": [{"role": "user", "content": "What does `AbstractFunction.log2` do?"}, {"role": "assistant", "content": "An object which responds to a set of messages that represent mathematical functions"}]} -{"conversations": [{"role": "user", "content": "What does `Sieve.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new Sieve object in mode Arguments: gen — A generator. Allowed generators: Integers, Streams or Patterns producing intervals or Sieves itself. Integers and Stream/Pattern output must be strictly positive. Integers as generators produce zero and its positive multiples.; limit — An integer limit, which is included when reached. If no limit is passed, returned integers might go up to default limit 65536.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// vibrato at 1 Hz, note the use of DC.ar UGen; a constant of 400.0 doesn't work\n{ SinOsc.ar(Vibrato.ar(DC.ar(400.0), 1, 0.02)) }.play\n\n// compare: k-rate freq input can be a constant\n{ SinOsc.ar(Vibrato.kr(400.0, 1, 0.02)) }.play\n\n// control rate and rateVariation\n{ SinOsc.ar(Vibrato.ar(DC.ar(400.0), MouseX.kr(2.0, 100.0), 0.1, 1.0, 1.0, MouseY.kr(0.0, 1.0), 0.1)) }.play\n\n// control depth and depthVariation\n{ SinOsc.ar(Vibrato.ar(DC.ar(4\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// vibrato at 1 Hz, note the use of DC.ar UGen; a constant of 400.0 doesn't work\n{ SinOsc.ar(Vibrato.ar(DC.ar(400.0), 1, 0.02)) }.play\n\n// compare: k-rate freq input can be a constant\n{ SinOsc.ar(Vibrato.kr(400.0, 1, 0.02)) }.play\n\n// control rate and rateVariation\n{ SinOsc.ar(Vibrato.ar(DC.ar(400.0), MouseX.kr(2.0, 100.0), 0.1, 1.0, 1.0, MouseY.kr(0.0, 1.0), 0.1)) }.play\n\n// control depth and depthVariation\n{ SinOsc.ar(Vibrato.ar(DC.ar(400.0), LFNoise1.kr(1, 3, 7), MouseX.kr(0.0, 1.0), 1.0, 1.0, MouseY.kr(0.0, 1.0), 0.1)) }.play\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\ns.boot;\n\nb = Buffer.alloc(s, 100);\nb.zero;\nb.set(33, 1.034);\n// This should detect the 33rd value as the highest...\nx = {BufMax.kr(b).poll}.play;\n\n// ...until we set a new winner...\nb.set(74, 1.038);\n```"}, {"role": "assistant", "content": "This should detect the 33rd value as the highest... ...until we set a new winner... (BufMax: detect the largest value (and its position) in an array of UGens)"}]} -{"conversations": [{"role": "user", "content": "Explain `RedMixMono` in SuperCollider briefly."}, {"role": "assistant", "content": "RedMixMono — mix 2 mono channels in stereo Simple mixer that take two mono sources, combines them and output to one stereo. Category: Red > redMix."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Idea: network of loosely connected nodes?"}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\nodeTest, {\n // the input\n// var input = Impulse.ar([1, 3, 5].reciprocal * 1, phase: [0, 0.25, 0.5]).sum;\n\n //var input = Impulse.ar([2, 3], phase: [0, 0.25]).sum;\n// var input = Select.ar(Line.kr(0, 1, 10) * SinOsc.ar(0.01).range(0, 1), [Impulse.ar([0.2, 0.3], phase: [0, 0.25]).sum, LocalIn.ar(1)]);\n\n var input = Select.ar(Line.kr(0, 1, 10), [Impulse.ar(0.134), LocalIn.ar(1)]);\n // the nodes, each takes its predecessor as input and estimates the duration between two events.\n var nodes = (1..20).inject([input], {|last, item|\n var dur = Gate.ar(\n Timer.ar(TDelay.ar(last.first, Rand(1, 4))),\n last.first\n );\n\n [TDuty.ar(\n dur.lag(20),\n TDelay.ar(last.first, dur.lag(20)),\n 1\n )] ++ last\n });\n\n\n LocalOut.ar(nodes.first);\n\n // add a pitch to each\n nodes = nodes.collect{|node, i| SinOsc.ar((500 + (i*250)), 0.9pi)\n// * Decay2.ar(node, 0.01, 0.2)\n * EnvGen.ar(Env.perc(0.0001, 0.1), gate: node)\n * 2 * (25-i) * 0.01};\n\n // splay in stereo field\n //nodes.sum!2;\n Splay.ar(nodes)// + (SinOsc.ar(2000) * Decay2.ar(input, 0.01, 0.2) * 0.1);\n\n}).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does Splay.ar do?"}, {"role": "assistant", "content": "`Splay.ar(inArray, spread, level, center, levelComp)` takes an array of mono signals and distributes them across the stereo field, so `Splay.ar(SinOsc.ar([220, 330, 440]) * 0.1)` is a three-source stereo chord rather than three separate synths. spread (0..1) controls how far the voices fan out and center shifts the middle. It is the shorthand for 'make this array stereo'."}]} -{"conversations": [{"role": "user", "content": "What does `FancySlider.sliderColor` do?"}, {"role": "assistant", "content": "An efficient Slider which substitutes a user view for a slider"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `FBSineL`."}, {"role": "assistant", "content": "```supercollider\n// increase feedback\n{ FBSineL.ar(SampleRate.ir, 1, Line.kr(0.01, 4, 10), 1, 0.1) * 0.2 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Ndef` in SuperCollider?"}, {"role": "assistant", "content": "Ndef — node proxy definition Ndef registers synths by key. All accesses to the registered synths go through the Ndef class via that key. Registered synths can be replaced with other synths while playing. A synth and its replacement can automatically crossfade and the replacement time can be quantized. Category: JITLib > NodeProxy, Live Coding."}]} -{"conversations": [{"role": "user", "content": "What does `PageLayout.show` do?"}, {"role": "assistant", "content": "Show the window if it was previously Returns: self"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for pattern of kicks."}, {"role": "assistant", "content": "```supercollider\n(\n{ | dur = 0.15, atk = 0.015, amp = 0.8, pan = 0 |\n Pan2.ar(\n SinOsc.ar(\n EnvGen.ar(Env(\\freq_l.kr([2960, 70, 90]), \\freq_d.kr([0.07, 0.15]), \\freq_c.kr([-13, -1]))),\n mul:EnvGen.ar(\n Env.perc( atk, max(dur - atk, atk), curve: \\amp_c.kr([-1, 5])),\n doneAction: 2 ) ), \n pan, amp )\n}.asSynthDef.name_(\"ckick\").add.play;\n);\n\n(\nPbind(*[\n instrument: \\ckick,\n delta: Pseg(Pwhite()/*Pbrown(step:0.05)*/.linexp(0, 1, 1/32, 1), Pbrown(0,1,0.05).linexp(0, 1, 1/8, 8), \\sine),\n //delta: Pseg(Pbrown(0,1,0.05).linexp(0, 1, 1/32, 1), Pbrown(0,1,0.05).linexp(0, 1, 1, 4), \\step),\n dur: Pfunc({ thisThread.clock.beatDur }) * Pkey(\\delta),\n atk: min(0.01, Pkey(\\dur)/2),\n freq_l: Pcollect(`_, Ptuple([Pbrown(1500, 4000, 50), Pbrown(40, 65, 1)/*+Pseq([0,300,100,0,50,0],inf)*/, Pbrown(45, 90, 5)], inf)),\n freq_d: Pfunc({ |e| `[e.atk*7, e.dur - 0.07] }),\n //freq_c: Pcollect(`_, Ptuple([Pbrown(-17, -4q, 0.5), Pbrown(0, 4)], inf)),\n freq_c: Ptuple({Pcollect(`_, Ptuple([Pbrown(-17, -4, 0.5), Pbrown(0, 4)], inf))}!2,inf),\n //amp_c: ``[-6,6],\n amp_c: Ptuple({Pcollect(`_, Ptuple([Pbrown(0, -6, 0.5), Pbrown(1, 6)], inf))}!2,inf), \n pan: Ptuple({Pbrown(-1,1)}!2, inf),\n amp: Ptuple({Pbrown(0.1,0.5,0.1)}!2, inf)\n])\n//.trace\n.play(TempoClock(156/60))\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SynthConsole.record` do?"}, {"role": "assistant", "content": "a widget with controls: play/stop/record/scope etc."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nNdef(\\bitshift, {\n var t = PulseCount.ar(Impulse.ar(8e3));\n var sig = HPF.ar(\n ( \n ((t * 15) & (t >> 5)) |\n ((t * 5) & (t >> [3, 4])) |\n ((t * 2) & (t >> 9)) |\n ((t * 8) & (t >> 11))\n - 3 % 256\n ) / 127-1 * 3\n , 20\n ).distort * 0.2; \n sig = Greyhole.ar(sig, sig, 0.5, sig).flop.mean/4;\n}).play;\n)\n```"}, {"role": "assistant", "content": "Not very original since I copied the bit code from http://schemawound.com/post/58980873930/bitwise and added a greyhole. But it sound so amazing I want to share it =)."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\\test, {\n |out = 0, amp = 0.01, freq = #[300, 400, 400], pan, gate = 1|\n var audio, env;\n audio = Mix.ar(Pulse.ar(freq, 0.5)); // this is a mixture of three oscillators\n env = Linen.kr(gate, susLevel: amp, doneAction: Done.freeSelf);\n audio = audio * env;\n OffsetOut.ar(out, audio);\n}).add;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\\test, {\n |out = 0, amp = 0.01, freq = #[300, 400, 400], pan, gate = 1|\n var audio, env;\n audio = Mix.ar(Pulse.ar(freq, 0.5)); // this is a mixture of three oscillators\n env = Linen.kr(gate, susLevel: amp, doneAction: Done.freeSelf);\n audio = audio * env;\n OffsetOut.ar(out, audio);\n}).add;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `AbstractFunction`."}, {"role": "assistant", "content": "```supercollider\na = { |x, root = 60| x + root }; b = a.midicps; [a.value(9), b.value(9)];\na = Pseries(60, 1, inf).midicps; a.asStream.nextN(12);\n{ a = LFNoise1.ar(1) * 5 + 60; Pulse.ar(a.round.midicps) * 0.1 }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ SinOscFB.ar(440, MouseX.kr(0, 4))*0.1 }.play\n\n\n{ SinOscFB.ar(MouseY.kr(10, 1000, 'exponential'), MouseX.kr(0.5pi, pi))*0.1 }.play\n\n\n{ SinOscFB.ar(100*SinOscFB.ar(MouseY.kr(1, 1000, 'exponential'))+200, MouseX.kr(0.5pi, pi))*0.1 }.play\n\n\n// Scope the wave form\n{ SinOscFB.ar([400, 301], MouseX.kr(0, 4), 0.3 }.scope;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ SinOscFB.ar(440, MouseX.kr(0, 4))*0.1 }.play\n\n\n{ SinOscFB.ar(MouseY.kr(10, 1000, 'exponential'), MouseX.kr(0.5pi, pi))*0.1 }.play\n\n\n{ SinOscFB.ar(100*SinOscFB.ar(MouseY.kr(1, 1000, 'exponential'))+200, MouseX.kr(0.5pi, pi))*0.1 }.play\n\n\n// Scope the wave form\n{ SinOscFB.ar([400, 301], MouseX.kr(0, 4), 0.3) }.scope;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `RedMixer.new` do? What arguments does it take?"}, {"role": "assistant", "content": "create and hold multiple RedMixerChannel Arguments: inputChannels — Array of input stereo channels. A matching array of RedMixerChannel channels will be created.; outputChannels — Array of output stereo channels. A matching array of RedMixerChannel mixers will be created (think subgroups).; group — `nil` boots the default server and creates a group after the `defaultGroup`.; lag — For equalizer settings, balance and volume. In seconds.."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for cosmic organ expansion )."}, {"role": "assistant", "content": "```supercollider\n(\nfork {\n TempoClock.tempo = 1;\n Ndef(\\ttso).play;\n loop {\n var seed = thisThread.randSeed = 100000000.rand.debug('seed');\n var wait = 20.rrand(60).debug('wait');\n Ndef(\\ttso, {\n var gamma= {[rrand(30,50),rrand(50,70),rrand(50,70),rrand(70,100)].choose.midicps*LFNoise2.kr(1,0.01,1)}!24;\n Pan2.ar(\n LeakDC.ar(\n Normalizer.ar(\n BPeakEQ.ar(\n FreeVerb.ar(\n Splay.ar(RLPF.ar(LFSaw.ar(gamma)/4,gamma*LFCub.kr(rrand(0.01,0.1),0,2,3),LFNoise2.kr(1/8,0.6,0.7))),\n 0.1,0.1,0.1\n ),\n [100.rrand(200),1000.rrand(2000),5000.rrand(7000),10000.rrand(15000)],Array.rand(4,0,6),Array.rand(4,0,6)\n ).mean,\n 0.8,0.1\n )\n ),\n LFNoise2.kr(0.1.exprand(10)).range(-0.1,0.1),\n SelectX.kr(\n [SinOsc,LFTri].choose.kr(2.rrand(25).reciprocal).range(0,2),\n [\n 0.7.rrand(1),\n LFGauss.kr(\n Latch.kr(\n LFNoise2.kr(1).range(1/5,5.rrand(20)).reciprocal, \n Impulse.kr(LFNoise2.kr(3.rrand(10).reciprocal).range(0.5,3.rrand(6)))\n ),\n SinOsc.kr(3.rrand(15).reciprocal).range(0.07.rrand(0.16),0.25.rrand(0.4))\n ),\n 0.1.rrand(0.5)\n ]\n )\n )\n }).fadeTime_(3.rrand(6));\n wait.wait;\n }\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `RedMatrixMixer` in SuperCollider briefly."}, {"role": "assistant", "content": "RedMatrixMixer — mix any number of input and output channels matrix mixer Category: Red > redMatrixMixer."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for it goes beyond vibrato too."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"vibrato\", {arg freq=440, release=0.1;\n var x, sig,out, mod1, depth, mfreq,maxfreq, maxdepth, maxdelay, basedelay;\n maxfreq=5;\n maxdelay=0.1;\n basedelay=maxdelay/2;\n maxdepth=basedelay/2;\n depth = MouseY.kr(0,maxdepth);\n mfreq = MouseX.kr(0,maxfreq);\n mod1 = SinOsc.ar(mfreq,0,depth);\n sig = SoundIn.ar(0,mul:2);\n x = DelayC.ar(sig, maxdelay,basedelay+ mod1);\n out = x;// FreeVerb.ar(x,MouseX.kr(0,1),MouseY.kr(0,1), 0.1);\n Out.ar(0,out);\n Out.ar(1,out);\n}).load(s);\n);\n\na = Synth(\"vibrato\");\na.free\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ExpRand`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-ExpRand\", { |out = 0|\n Out.ar(out,\n FSinOsc.ar(\n ExpRand(100.0, 8000.0),\n 0, Line.kr(0.2, 0, 0.01, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n(\nRoutine({\n inf.do({ |i|\n Synth.new(\"help-ExpRand\"); 0.05.wait;\n })\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `BBandStop` in SuperCollider briefly."}, {"role": "assistant", "content": "BBandStop — Band reject filter The B equalization suite is based on the Second Order Section (SOS) biquad UGen. Category: UGens > Filters > BEQSuite."}]} -{"conversations": [{"role": "user", "content": "How should I check an answer you give me?"}, {"role": "assistant", "content": "Three quick checks, cheapest first. Does it evaluate without a syntax error — the post window points at the exact character. Does the node appear in `s.plotTree` — if yes, the problem is signal rather than lifecycle. Does it reach `Out.ar(0, ...)` with a non-zero amplitude and an open filter. If those three pass and it is still silent, the class's own help page will show the argument order you may have assumed wrong."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pprotect`."}, {"role": "assistant", "content": "```supercollider\n(\nvar x;\nvar func = { \"an error happened\".postln };\na = Pprotect(Pseq([1, 3, 3, Pfuncn({ Error.new.throw }), 2]), func);\nx = Pbind(\\degree, a, \\dur, 0.5).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `MembraneCircle.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Waveguide mesh physical models of drum membranes Arguments: excitation — sound in; tension; loss; mul; add."}]} -{"conversations": [{"role": "user", "content": "What does `AbstractPlayer.didSpawn` do?"}, {"role": "assistant", "content": "the base class for all Players : a playable object"}]} -{"conversations": [{"role": "user", "content": "What does `CCPlayer.initResponders` do?"}, {"role": "assistant", "content": "adds a MIDI CC responder and plays it to a bus as control rate"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nPrand([\n Pbind(\\instrument, \\acid, \\dur, Pseq([0.25, 0.5, 0.25], 4), \\root, -24,\n \\degree, Pseq([0, 3, 5, 7, 9, 11, 5, 1], inf), \\pan, Pfunc({ 1.0.rand2 }),\n \\cut, Pxrand([1000, 500, 2000, 300], inf), \\rez, Pfunc({ 0.7.rand +0.3 }),\n \\amp, 0.2),\n\n Pbind(\\instrument, \\acid, \\dur, Pseq([0.25], 6), \\root, -24, \\degree, Pseq([18, 17, 11, 9], inf),\n \\pan, Pfunc({ 1.0.rand2 }), \\cut, 1500, \\rez, Pfun\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nPrand([\n Pbind(\\instrument, \\acid, \\dur, Pseq([0.25, 0.5, 0.25], 4), \\root, -24,\n \\degree, Pseq([0, 3, 5, 7, 9, 11, 5, 1], inf), \\pan, Pfunc({ 1.0.rand2 }),\n \\cut, Pxrand([1000, 500, 2000, 300], inf), \\rez, Pfunc({ 0.7.rand +0.3 }),\n \\amp, 0.2),\n\n Pbind(\\instrument, \\acid, \\dur, Pseq([0.25], 6), \\root, -24, \\degree, Pseq([18, 17, 11, 9], inf),\n \\pan, Pfunc({ 1.0.rand2 }), \\cut, 1500, \\rez, Pfunc({ 0.7.rand +0.3 }), \\amp, 0.16)\n\n], inf).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nBag[1, 2, 3].add(4).postln;\n\nBag[1, 2, 3].add(3).postln;\n\nBag[\"abc\", \"def\", \"ghi\"].add(\"jkl\").postln;\n\nBag[\"abc\", \"def\", \"ghi\"].add(\"def\".postln;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nBag[1, 2, 3].add(4).postln;\n\nBag[1, 2, 3].add(3).postln;\n\nBag[\"abc\", \"def\", \"ghi\"].add(\"jkl\").postln;\n\nBag[\"abc\", \"def\", \"ghi\"].add(\"def\").postln;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Maybe.new` do? What arguments does it take?"}, {"role": "assistant", "content": "create a new Arguments: thing — an object or nil. `a = Maybe.new;`."}]} -{"conversations": [{"role": "user", "content": "What does `AbstractFunction.cpsmidi` do?"}, {"role": "assistant", "content": "Converts cycles per seconds (Hz) into midinote. `a = { |x| #[440, 720, 801, 1020.2].at(x) }; b = a.cpsmidi;"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n~name = \\test_noise_burst;\n~description = \"A short burst of enveloped noise that goes well with Patterns\";\n~channelLayout = \\mono;\n\n~function = { arg amp=1, trimDB = 0, attack = 0.01, release = 0.3;\n var env;\n env = EnvGen.ar(Env.perc(attack, release, 0.5), doneAction: Done.freeSelf);\n trimDB.dbamp*amp*PinkNoise.ar(1);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{ var nse, env, kic;\n kic = tanh(Ringz.ar(LPF.ar(Trig.ar(Impulse.ar(1.0),SampleDur.ir),1000),30,0.25,7).sin*2);\n env = Env.perc(0.05, 1, 1, -4);\n nse = BrownNoise.ar(2) + PinkNoise.ar(0.5) * EnvGen.kr(env,Impulse.kr(1), doneAction: 2);\n\n nse = Mix.ar(BPF.ar(nse,[100,1200,80,40,20],MouseX.kr(0,1),[1,0.2,1,1,1]));\n nse = LPF.ar(nse + kic, MouseY.kr(100,1000))! 2\n\n}.play\n)\n```"}, {"role": "assistant", "content": "A muffled thump. An attempt at a Jurassic Park © glass of water sort of thing - or breaking into a silo."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Restricting fm to harmonic sidebands after[Chowning, 1973]?"}, {"role": "assistant", "content": "```supercollider\n(\n// restricting fm to harmonic sidebands after\n// [Chowning, 1973] Chowning, J. (1973). The synthesis of complex spectra by means of frequency modulation. Journal of the Audio Engineering Society, 21(7):526–534.\n// restriction actually happens because of the specs, not server-side.\n\nSpec.add(\\index, [0, 40]);\nSpec.add(\\harm1, [0, 20, \\lin, 1]);\nSpec.add(\\harm2, [0, 20, \\lin, 1]);\nSpec.add(\\fundFreq, \\freq);\n\nNdef(\\fmk, {\n \n PMOsc.ar(\n \\carFreq.kr(100, 0.1), \n (\\harm1.kr(1, 1)/(\\harm2.kr(1, 1)) * LFNoise1.ar(50).range(0.995, 1.001))*\\carFreq.kr(100), \n \\index.kr(1, 0.1) * SinOsc.ar(2.5).range(0.995, 1.005)\n ) \n})\n);\nNdef(\\fmk).gui\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Josh Parmenter (2007) record scratcher?"}, {"role": "assistant", "content": "```supercollider\n// Josh Parmenter (2007)\n// record scratcher\n\nSynthDef(\\scratch, {arg gate = 1, buffer;\n var buf, speed, env;\n env = EnvGen.kr(\n Env([0,1,0], [0.1, 0.1], \\sin, 1),\n gate, doneAction: 20);\n speed = MouseX.kr(-10, 10);\n speed = speed - DelayN.kr(speed, 0.1, 0.1);\n speed = MouseButton.kr(1, 0, 0.3) + speed ;\n buf = PlayBuf.ar(1, buffer, speed * BufRateScale.kr(buffer), loop: 1);\n Out.ar(0, (buf * env).dup );\n}).add;\n\ns.boot;\n\n// path to a mono soundfile here\na = Buffer.read(s, ExampleFiles.child);\n\nb = Synth(\\scratch, [\\buffer, a]);\n\n// move mouse to scrub the record.\n// press mouse button to 'stop the record', you can scrub while it is stopped.\n\n// stop the synth\nb.set(\\gate, 0);\n// free the Buffer\na.free;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain, \\x, Pfunc { rrand(500, 600) });\na = Pfset({ ~freq = { ~x.postln * 2 }; ~legato = 3 }, a);\na.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain, \\x, Pfunc { rrand(500, 600) });\na = Pfset({ ~freq = { ~x.postln * 2 }; ~legato = 3 }, a);\na.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Document.onClose` do? What arguments does it take?"}, {"role": "assistant", "content": "Get/set the action to be performed on closing the Arguments: value — An instance of Function or FunctionList.."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for julian rohrhuber (c 2007)."}, {"role": "assistant", "content": "```supercollider\n// julian rohrhuber (c 2007)\n\n(\nSynthDef(\"deepsea\", { arg out, pan=0, amp=0.1, variation=0.9;\n var dt, n, freq, mul, t, u;\n n = Rand(7, 46);\n dt = 25.0 + Rand(-1.7, 1.7);\n dt = dt + LFNoise2.kr(2, variation) * 0.001;\n freq = 901 + Rand(0, 65);\n t = Impulse.ar(dt.reciprocal, 0, 100);\n mul = PulseCount.ar(t) < n;\n u = BPF.ar(mul * t, freq, 0.1);\n u = BPF.ar(u, freq, 0.2);\n DetectSilence.ar(u, doneAction:2);\n Out.ar(out, Pan2.ar(u, pan, amp));\n}).add;\n);\n\n(\nSynthDef(\"deepsea\", { arg out, pan=0, amp=0.1, variation=0.9;\n var dt, n, freq, mul, t, u, count;\n n = Rand(7, 46);\n dt = 25.0 + Rand(-1.7, 1.7);\n dt = dt + LFNoise2.kr(2, variation) * 0.001;\n freq = 901 + Rand(0, 65);\n t = Impulse.ar(dt.reciprocal, 0, 100);\n count = PulseCount.ar(t);\n mul = count < n;\n u = BPF.ar(mul * t, freq, 0.1);\n u = BPF.ar(u, freq * (count % LFNoise1.kr(1).range(2, 20) + 1), 0.2);\n DetectSilence.ar(u, doneAction:2);\n Out.ar(out, Pan2.ar(u, pan, amp * 10));\n}).add;\n);\n\n\n\ns.sendMsg(\"/s_new\", \"deepsea\", -1);\n\n\np = ProxySpace.push(s.boot);\n\n~out.play;\n~out.fadeTime = 10;\n\n(\n~fish = Pbind(\n \\instrument, \\deepsea,\n \\dur, Pfunc #{ rrand(9.0, 2.0) },\n \\pan, Pfunc #{ 1.0.rand2 }\n );\n);\n\n~out = ~fish;\n~out[1] = \\filter -> #{ arg in; BPF.ar(in * 5, 700, 0.1) };\n\n(\n~out[2] = \\filter -> #{ arg in;\n CombL.ar(LPF.ar(in * LFNoise1.kr(0.1).max(0), 800), 0.5, 0.5) + in.reverse\n};\n);\n\n(\n~out[3] = \\filter -> #{ arg in; var x; x = in;\n 5.do { x = AllpassN.ar(x, 0.18, {0.06.rand} ! 2 + 0.06, 8) };\n LPF.ar(x + in, 400) + (LFNoise1.kr(0.2) * in)\n };\n\n);\n\n\n\n~out[1] = nil;\n~out[2] = nil;\n\n\np.clear(10).pop;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n//algorithm to approach the square root of n\n~next = { |n| { |x| (x + n/x)/2 } };\n\n//look for a good enough match in the stream\n~within = { |eps, list| \n list.match({},\n { |a, rest|\n rest.match({},{ |b, rest2|\n if( (a-b).abs < eps){ b }{ ~within.(eps, rest) }\n });\n })\n};\n\n// A better way is to see how close a/b is to 1,\n// to avoid the rounding errors\n~relative = { |eps, list| \n list.match({},\n { |a, rest|\n rest.match({},{ |b, rest2|\n if( (a/b -1).abs < eps){ b }{\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n//algorithm to approach the square root of n\n~next = { |n| { |x| (x + n/x)/2 } };\n\n//look for a good enough match in the stream\n~within = { |eps, list| \n list.match({},\n { |a, rest|\n rest.match({},{ |b, rest2|\n if( (a-b).abs < eps){ b }{ ~within.(eps, rest) }\n });\n })\n};\n\n// A better way is to see how close a/b is to 1,\n// to avoid the rounding errors\n~relative = { |eps, list| \n list.match({},\n { |a, rest|\n rest.match({},{ |b, rest2|\n if( (a/b -1).abs < eps){ b }{ ~relative.(eps, rest) }\n })\n })\n};\n\n\n//find the square root of 3 starting from the approximation\n// value 1, until approximations are within 0.01\n~within.(0.01, LazyList.iterate(1, ~next.(3) ) )\n);\n\n~relative.(0.01, LazyList.iterate(1, ~next.(3) ) )\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// for Nil: return the argument unmodified (an event).\nnil.transformEvent((x: 8));\n// for Dictionary (and thus for Event): add to the argument.\n(y: 100, z: 1).transformEvent((x: 8));\n// for Association: add the association to the event\n(\\a -> \\x).transformEvent((x: 8));\n// for Function: use the function receive the event as argument.\n{ |event| event.use { ~x = ~x + 1 }; event }.transformEvent((x: 8);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// for Nil: return the argument unmodified (an event).\nnil.transformEvent((x: 8));\n// for Dictionary (and thus for Event): add to the argument.\n(y: 100, z: 1).transformEvent((x: 8));\n// for Association: add the association to the event\n(\\a -> \\x).transformEvent((x: 8));\n// for Function: use the function receive the event as argument.\n{ |event| event.use { ~x = ~x + 1 }; event }.transformEvent((x: 8));\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `QuadL`."}, {"role": "assistant", "content": "```supercollider\n// logistic map\n// equation: x1 = -r*x0^2 + r*x0\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n QuadL.ar(SampleRate.ir/4, r.neg, r, 0, 0.1) * 0.4;\n}.play(s);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `PLrand` in SuperCollider briefly."}, {"role": "assistant", "content": "PLrand — dynamic scope Prand variant Takes Symbol args for later reference by the Streams, which will read from variables in the Environments of their instantiation. See PLx_suite. Category: Libraries > miSCellaneous > PLx suite, Streams-Patterns-Events > PLx suite."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nc.free; c = Buffer.read(s, ExampleFiles.child);\n\n(\nx = {\n var fftsize = 1024;\n var in, chain, in2, chain2, out;\n in = PlayBuf.ar(1, c, BufRateScale.kr(c), loop: 1);\n chain = FFT(LocalBuf(fftsize), in);\n\n // JMcC babbling brook\n in2 = ({\n RHPF.ar(OnePole.ar(BrownNoise.ar, 0.99), LPF.ar(BrownNoise.ar, 14)\n * 400 + 500, 0.03, 0.003) }!2)\n + ({ RHPF.ar(OnePole.ar(BrownNoise.ar, 0.99), LPF.ar(Brow\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nc.free; c = Buffer.read(s, ExampleFiles.child);\n\n(\nx = {\n var fftsize = 1024;\n var in, chain, in2, chain2, out;\n in = PlayBuf.ar(1, c, BufRateScale.kr(c), loop: 1);\n chain = FFT(LocalBuf(fftsize), in);\n\n // JMcC babbling brook\n in2 = ({\n RHPF.ar(OnePole.ar(BrownNoise.ar, 0.99), LPF.ar(BrownNoise.ar, 14)\n * 400 + 500, 0.03, 0.003) }!2)\n + ({ RHPF.ar(OnePole.ar(BrownNoise.ar, 0.99), LPF.ar(BrownNoise.ar, 20)\n * 800 + 1000, 0.03, 0.005) }!2\n ) * 4;\n chain2 = FFT(LocalBuf(fftsize), in2);\n\n chain = chain.pvcalc2(chain2, fftsize, { |mags, phases, mags2, phases2|\n [\n mags * mags2 / 10,\n phases2 + phases\n ]\n }, frombin: 0, tobin: 125, zeroothers: 0);\n\n out = IFFT(chain);\n 0.5 * out.dup\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Stethoscope.ugenScopes` do?"}, {"role": "assistant", "content": "Returns an array of the running ugen scopes."}]} -{"conversations": [{"role": "user", "content": "Explain `Dust2` in SuperCollider briefly."}, {"role": "assistant", "content": "Dust2 — Random impulses. Generates random impulses from -1 to +1. Category: UGens > Generators > Stochastic."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// same as above, but we use a NetAddr with a port of nil, so we can receive from a specific host, but from any port\n\nn = NetAddr(\"127.0.0.1\", nil); // the url should be the one of computer of app 2\no = OSCresponderNode(n, '/test', { |t, r, msg| msg.postln }).add;\no.remove;\n```"}, {"role": "assistant", "content": "same as above, but we use a NetAddr with a port of nil, so we can receive from a specific host, but from any port (OSCresponderNode: client side network responder)"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n var mod = SinOsc.ar([0.1,0.15,0.2]).range(0,1);\n var saw = LFSaw.ar([10,12,15]);\n var out = (saw - ((saw>0)*mod)+(mod*0.5));\n Splay.ar(out)*0.4;\n}.play;\n\n{\n var mod = SinOsc.ar([0.1,0.15,0.2]).range(0,1);\n var saw = SinOsc.ar(LFSaw.ar([10,12,15]).range(200,300));\n var out = (saw - ((saw>0)*mod)+(mod*0.5));\n Splay.ar(out)*0.4;\n}.play\n)\n```"}, {"role": "assistant", "content": "Made with code from Jonatan Liljedahl and Glen Fraser. Based on the Korg Z1 sawtooth oscilator."}]} -{"conversations": [{"role": "user", "content": "What does `Dictionary.asPairs` do? What arguments does it take?"}, {"role": "assistant", "content": "Return the values in an array of alternating key value pairs, like `[\\freq, 1848, \\amp, 0.2]`. This is part of the Key-Value-Pairs Arguments: class — The class of the collection to be returned. By default this is an Array.."}]} -{"conversations": [{"role": "user", "content": "What is `RedInstrumentModuleGUI` in SuperCollider?"}, {"role": "assistant", "content": "RedInstrumentModuleGUI — gui for instrument modules Category: Red > redModule."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Multichannel Convolution Reverb (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\n~numIRs = 4;\n~fftsize = 2048;\ns.waitForBoot {\n var irs, irbuffs, bufsizes, nextmod, numSamples;\n nextmod = 100;\n numSamples = 40000 ;\n \n /* an array of multiple IRs */\n irs = ~numIRs.collect{ arg nth;\n // nth is here not used, but can be useful to scale decay time.\n [0] ++ 0.dup(100) ++ Array.fill(\n numSamples, { arg i;\n (i%nextmod==0).if\n {\n nextmod= rrand(80, 120);\n (i.asFloat/numSamples).squared * 0.3\n } {\n 0\n }\n }\n )\n };\n { irs.plot }.defer; // to show irs.\n \n /* an array of buffers. */\n irbuffs = ~numIRs.collect{ arg i; Buffer.loadCollection(s, irs[i]) };\n irbuffs.postln; // to show irbuffs info.\n s.sync;\n \n bufsizes= irbuffs.collect{ |nth|PartConv.calcBufSize(~fftsize, nth) };\n ~irSpctrms = bufsizes.collect{ arg size, i;\n Buffer\n .alloc(s, size, 1)\n .preparePartConv(irbuffs[i], ~fftsize)\n };\n s.sync; \n \n ~numIRs.do{|i| irbuffs[i].free}\n}\n);\n\n(\nfork{\n ~target= Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n s.sync;\n {\n var in, krnl;\n in= PlayBuf.ar(1, ~target, loop:1);\n \n /* an array of multiple instances of PartConv */\n krnl= ~numIRs.collect{ arg i;\n PartConv.ar(in, ~fftsize, ~irSpctrms[i].bufnum, 0.2)};\n // By iterating, each PartConv processes a mono-channel buffer in the array ~irSpctrms.\n \n Out.ar(0, krnl);\n }.play\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{ var nse, env, kic;\n kic = tanh(Ringz.ar(LPF.ar(Trig.ar(Impulse.ar(1.0),SampleDur.ir),1000),30,0.25,7).sin*2);\n env = Env.perc(0.05, 1, 1, -4);\n nse = BrownNoise.ar(2) + PinkNoise.ar(0.5) * EnvGen.kr(env,Impulse.kr(1), doneAction: 2);\n\n nse = Mix.ar(BPF.ar(nse,[100,1200,80,40,20],MouseX.kr(0,1),[1,0.2,1,1,1]));\n nse = LPF.ar(nse + kic, MouseY.kr(100,1000))! 2\n\n}.play\n)\n```"}, {"role": "assistant", "content": "A muffled thump. An attempt at a Jurassic Park © glass of water sort of thing - or breaking into a silo."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Simple Amplitude Tracker (language side)?"}, {"role": "assistant", "content": "```supercollider\n(\n// Simple amplitude tracker sending values to sclang\nSynthDef(\\ampTracker, { |in|\n var freq = 30; // num of values per second\n SendReply.kr(Impulse.kr(freq), '/amp', Amplitude.kr(SoundIn.ar(in)));\n}).add;\n);\n\n// start the tracker on scsynth\nSynth(\\ampTracker);\n\n(\n// receive the values in sclang\nOSCdef(\\ampTracker, { |m|\n m.postln;\n // now use m[3] for your purpose (detecting changes, etc...)\n}, '/amp');\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\ambiIn;\n~description = \"A live ambisonic input (ACN_N3D)\";\n~channelLayout = \\ambi;\n\n~function = { |order = 1, t_trig = 0, bus = 0|\n var env = EnvGen.kr(Env([0,1], [1]), t_trig);\n var chans = Array.series(\n size: (order + 1).pow(2).asInteger,\n start: bus,\n step: 1\n );\n SoundIn.ar(chans) * env;\n};\n```"}, {"role": "assistant", "content": "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see ."}]} -{"conversations": [{"role": "user", "content": "What are the arguments of EnvGen?"}, {"role": "assistant", "content": "`EnvGen.ar(envelope, gate, levelScale, levelBias, timeScale, doneAction)` — or the .kr form. Envelope is an Env; gate is the signal that holds the envelope open (a number for a one-shot, a trigger or gate control for a sustained sound); levelScale and levelBias scale and offset the output; timeScale stretches durations. Use `doneAction: 2` on a one-shot so the Synth frees itself."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for julian rohrhuber (c 2007)."}, {"role": "assistant", "content": "```supercollider\n// julian rohrhuber (c 2007)\n\n(\nSynthDef(\"deepsea\", { arg out, pan=0, amp=0.1, variation=0.9;\n var dt, n, freq, mul, t, u;\n n = Rand(7, 46);\n dt = 25.0 + Rand(-1.7, 1.7);\n dt = dt + LFNoise2.kr(2, variation) * 0.001;\n freq = 901 + Rand(0, 65);\n t = Impulse.ar(dt.reciprocal, 0, 100);\n mul = PulseCount.ar(t) < n;\n u = BPF.ar(mul * t, freq, 0.1);\n u = BPF.ar(u, freq, 0.2);\n DetectSilence.ar(u, doneAction:2);\n Out.ar(out, Pan2.ar(u, pan, amp));\n}).add;\n);\n\n(\nSynthDef(\"deepsea\", { arg out, pan=0, amp=0.1, variation=0.9;\n var dt, n, freq, mul, t, u, count;\n n = Rand(7, 46);\n dt = 25.0 + Rand(-1.7, 1.7);\n dt = dt + LFNoise2.kr(2, variation) * 0.001;\n freq = 901 + Rand(0, 65);\n t = Impulse.ar(dt.reciprocal, 0, 100);\n count = PulseCount.ar(t);\n mul = count < n;\n u = BPF.ar(mul * t, freq, 0.1);\n u = BPF.ar(u, freq * (count % LFNoise1.kr(1).range(2, 20) + 1), 0.2);\n DetectSilence.ar(u, doneAction:2);\n Out.ar(out, Pan2.ar(u, pan, amp * 10));\n}).add;\n);\n\n\n\ns.sendMsg(\"/s_new\", \"deepsea\", -1);\n\n\np = ProxySpace.push(s.boot);\n\n~out.play;\n~out.fadeTime = 10;\n\n(\n~fish = Pbind(\n \\instrument, \\deepsea,\n \\dur, Pfunc #{ rrand(9.0, 2.0) },\n \\pan, Pfunc #{ 1.0.rand2 }\n );\n);\n\n~out = ~fish;\n~out[1] = \\filter -> #{ arg in; BPF.ar(in * 5, 700, 0.1) };\n\n(\n~out[2] = \\filter -> #{ arg in;\n CombL.ar(LPF.ar(in * LFNoise1.kr(0.1).max(0), 800), 0.5, 0.5) + in.reverse\n};\n);\n\n(\n~out[3] = \\filter -> #{ arg in; var x; x = in;\n 5.do { x = AllpassN.ar(x, 0.18, {0.06.rand} ! 2 + 0.06, 8) };\n LPF.ar(x + in, 400) + (LFNoise1.kr(0.2) * in)\n };\n\n);\n\n\n\n~out[1] = nil;\n~out[2] = nil;\n\n\np.clear(10).pop;\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Routine`?"}, {"role": "assistant", "content": "Routine — Functions that can return in the middle and then resume where they left off"}, {"role": "user", "content": "What does `Routine.new` do?"}, {"role": "assistant", "content": "Creates an instance of Routine, passing it the Function with code to run."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nr = Routine { |inval|\n loop {\n // thisThread refers to the routine.\n postf(\"beats: % seconds: % time: % \\n\",\n thisThread.beats, thisThread.seconds, Main.elapsedTime\n );\n 1.0.yield;\n\n }\n}.play;\n);\n\nr.stop;\nr.beats;\nr.seconds;\nr.clock;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `InstrSynthDef.loadDefFileToBundle` do? What arguments does it take?"}, {"role": "assistant", "content": "Extends SynthDef enabling the extra capabilities of Instr with Patch Arguments: def; bundle; server."}]} -{"conversations": [{"role": "user", "content": "Who made you?"}, {"role": "assistant", "content": "I was trained by the person who runs this project, on top of the MiniMind architecture. My weights started from random numbers and learned from the SuperCollider sources — no teacher model, no distillation."}]} -{"conversations": [{"role": "user", "content": "What does `SCDoc.helpSourceDir` do?"}, {"role": "assistant", "content": "get/set the system-wide directory of help sourcefiles. Defaults to `Platform.classLibraryDir.dirname +/+ \"HelpSource\"` and should typically not be changed by the"}]} -{"conversations": [{"role": "user", "content": "What does `List.pop` do?"}, {"role": "assistant", "content": "Remove and return the last element of the"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nVowel().brightenLin(-1).dBs.postln; \nVowel().brightenLin( 0).dBs.postln;\nVowel().brightenLin( 1).dBs.postln;\n\n// refFormant = 0 loud on the left\n{Formants.ar(100, Vowel().brightenLin(MouseX.kr(0, 20), 0 )) * 0.1}.play\n// refFormant = 1\n{Formants.ar(100, Vowel().brightenLin(MouseX.kr(0, 20), 1 )) * 0.1}.play\n// refFormant = 2\n{Formants.ar(100, Vowel().brightenLin(MouseX.kr(0, 20), 2 )) * 0.1}.play\n// refFormant = 3\n{Formants.ar\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nVowel().brightenLin(-1).dBs.postln; \nVowel().brightenLin( 0).dBs.postln;\nVowel().brightenLin( 1).dBs.postln;\n\n// refFormant = 0 loud on the left\n{Formants.ar(100, Vowel().brightenLin(MouseX.kr(0, 20), 0 )) * 0.1}.play\n// refFormant = 1\n{Formants.ar(100, Vowel().brightenLin(MouseX.kr(0, 20), 1 )) * 0.1}.play\n// refFormant = 2\n{Formants.ar(100, Vowel().brightenLin(MouseX.kr(0, 20), 2 )) * 0.1}.play\n// refFormant = 3\n{Formants.ar(100, Vowel().brightenLin(MouseX.kr(0, 20), 3 )) * 0.1}.play\n// refFormant = 4 loud on the right\n{Formants.ar(100, Vowel().brightenLin(MouseX.kr(0, 20), 4 )) * 0.1}.play\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Play your (short) soundfiles with some delay."}, {"role": "assistant", "content": "```supercollider\n// By Bjørn Houdorf March 2013, Play your (short) soundfiles with some delay.\n\nb = SoundFile.collectIntoBuffers(\"yourSoundFileFolder/*\"); // 1. rund this\n\n( // 2. and then run this\nt = Task({\n({\n var num= b.size.rand;\n var buf= b[num];\n 0.1*Splay.ar(PlayBuf.ar(buf.numChannels, buf, 1, 1, 0, 0));\n}.play;\n) \n});\n);\n\n\n( // 3. Then run this\nz = Task({\nloop({\n t.start;\n 0.1.wait;\n});\n});\n);\n\n\nz.start; // 4. and run this\nz.stop; // 5. and finally run this\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n~name = \\test_noise_burst;\n~description = \"A short burst of enveloped noise that goes well with Patterns\";\n~channelLayout = \\mono;\n\n~function = { arg amp=1, trimDB = 0, attack = 0.01, release = 0.3;\n var env;\n env = EnvGen.ar(Env.perc(attack, release, 0.5), doneAction: Done.freeSelf);\n trimDB.dbamp*amp*PinkNoise.ar(1);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Very quick-and-dirty hack to show stereo phase."}, {"role": "assistant", "content": "```supercollider\n(\nb = Bus.audio(s, 2);\na = { |inbus = 0|\n var sig = In.ar(inbus, 2);\n // x axis is side, oriented toward right;\n // y axis is mid\n [sig[1] - sig[0], sig.sum]\n}.play(s.defaultGroup, outbus: b, addAction: \\addAfter);\nc = s.scope;\nc.style = 2;\nc.bus = b;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nb = SoundFile.collectIntoBuffers(\"yourSoundFileFolder/*\"); // By Bjørn Houdorf, December 21, 2012\n\n(\n{\nvar number = b.numChannels, randomNumber, trigger, delayed, panned, sound, mixedSound, rotatedSound;\ntrigger = Dust.kr(Array.fill(number,1), 1, -0.5); // Generates random impulses from -0.5 to 0.5. as a excitation function\nrandomNumber = TRand.kr(1, number, trigger);\nsound = PlayBuf.ar(Array.fill(number,1) ,randomNumber,1,trigger,0,0); // play sound files\ndelayed = DelayL.ar(sound, trigger, trigger); // delaying the sound files\npanned = Pan2.ar(delayed, Array.fill(number,{1.0.rand2})); // pan them out in the stereo field\nmixedSound = 0.05*Mix.new(panned);// and mix them to one stereo signal\nrotatedSound = Rotate2.ar(mixedSound[0], mixedSound[1], LFSaw.kr(0.05)); // rotate stereo signal\n}.play; // play it all\n)\n```"}, {"role": "assistant", "content": "Put your sound files in the sound file folder. The code plays random sound files panned out in the stereo field. A swarm of sound files."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for XoX pattern helper."}, {"role": "assistant", "content": "```supercollider\n(\n~xox = {|str| str.collectAs({|l| switch(l.toLower,$x, {1}, $o, {Rest(1)})}, Array)};\n);\n\n\n(\nSynthDef(\\acid, { arg out, freq = 1000, gate = 1, pan = 1, cut = 4000, rez = 0.8, amp = 1, sustain = 1, release = 0.5;\n var sig, env;\n env = EnvGen.kr(Env.linen(0.01, sustain, sustain * release), gate, amp, doneAction: Done.freeSelf);\n sig = Pulse.ar([freq,freq*1.001], 0.5);\n sig = sig + Pulse.ar(freq*0.501, 0.01, [0,0.5]);\n sig = sig + Pulse.ar(freq*1.99, 0.11, [0.5,0]);\n sig = RLPF.ar(sig, cut, rez);\n sig = Pan2.ar(sig);\n sig = sig * env;\n\n Out.ar(out, sig);\n}).add;\n);\n\n(\nPbind(\n \\instrument, \\acid,\n \\dur, Pseq(~xox.(\"xxooxoxo\") * 8/120, inf),\n \\scale, Scale.minor,\n \\degree, Pseq([0,4,5,3,3], inf),\n \\cut, Pwhite(100, 1500),\n \\rez, Pwhite(0.1, 0.8),\n \\amp, -10.dbamp,\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `DictionaryEditorGui` in SuperCollider briefly."}, {"role": "assistant", "content": "DictionaryEditorGui — gui class Category: Libraries > crucial > GuiClasses."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for tired pads."}, {"role": "assistant", "content": "```supercollider\n// this is what I write when I didn't sleep last night.. zzzzzz\n// easy subsynth with dynklank and simple scale\n\n(\n\nfork{ \n loop{\n var time;\n time = 5.rand;\n {\n var sound, freqs, envs, rings, numvoices, env;\n numvoices = 40;\n freqs = {(Scale.major(\\just).degrees+26+\n (0,12..110).choose).choose}.dup(numvoices).midicps;\n rings = {1.0.rand}.dup(numvoices);\n envs = { EnvGen.kr(Env.linen( time/3.0.rand, \n time/3.0.rand, time/3.0.rand, 1.0.rand ) ) }.dup(numvoices);\n \n sound = PinkNoise.ar(numvoices.reciprocal!2);\n sound = DynKlank.ar(`[freqs,envs,rings], sound );\n sound = sound * EnvGen.kr(Env.linen(time.rand,time/3,time.rand),doneAction:2);\n \n sound = HPF.ar(sound, 120);\n \n 4.do{sound = DelayC.ar(sound, 0.4, [0.4.rand,0.4.rand], 1/8, sound) };\n \n //good call - lets turn this down \n sound*0.2;\n }.play;\n time.rand.wait;\n }\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for vagabond kicks (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var base_freq = LFNoise2.kr(1!2).exprange(35,60);\n Pan2.ar(\n SinOsc.ar( \n EnvGen.ar(\n Env(\n [ \n base_freq,\n LFNoise2.kr(1/2!2).exprange(400,6500),\n LFNoise2.kr(1/2!2).exprange(35,125),\n base_freq\n ],\n [\n LFNoise2.kr(1/2!2).exprange(0.001,0.008),\n LFNoise2.kr(1/2!2).exprange(0.008,0.13),\n LFNoise2.kr(1/2!2).exprange(0.01,0.5)\n ], \n [\n LFNoise2.kr(1/4!2).exprange(1/5,5), \n LFNoise2.kr(1/4!2).range(-19,-6), \n LFNoise2.kr(1/4!2).range(-5,5)\n ]\n ).circle\n ), 0,\n LFNoise2.kr(LFNoise2.kr(1/20!2).exprange(1/9,9)).range(0.05,1)\n //EaseInBounce.ar(SinOsc.ar(LFNoise2.kr(1/10!2).exprange(1/5,5)).range(0,1))\n ),\n LFTri.ar(\n LFNoise2.kr(1/20).exprange(1/10,10), [0,2], \n SinOsc.kr(LFNoise2.kr(1/10!2).exprange(1/5,5)).range(0.3,1)\n )\n ).mean;\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// Three nodes in this data. First is always the root.\n// So the first is applied to decide whether to branch down to the second or third.\n// Then those nodes decide whether to classify the datum as 1/2/3/4.\n~treedata = [\n/* xoff,yoff, xvec,yvec, lisl, risl */\n [0.5, 0.5, -0.7, 0.4, 0, 0], // this is the root node, its number is 1\n [0.3, 0.7, 0.4, 0.7, 1, 1], // this one's number is 2\n [0.5, 0.2, -0.8,-0.8, 1, 1] // this one's number is 3\n];\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// Three nodes in this data. First is always the root.\n// So the first is applied to decide whether to branch down to the second or third.\n// Then those nodes decide whether to classify the datum as 1/2/3/4.\n~treedata = [\n/* xoff,yoff, xvec,yvec, lisl, risl */\n [0.5, 0.5, -0.7, 0.4, 0, 0], // this is the root node, its number is 1\n [0.3, 0.7, 0.4, 0.7, 1, 1], // this one's number is 2\n [0.5, 0.2, -0.8,-0.8, 1, 1] // this one's number is 3\n];\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `FPSignal.nlin` do?"}, {"role": "assistant", "content": "Implementation of Functional Reactive Programming."}]} -{"conversations": [{"role": "user", "content": "Write a snare drum in SuperCollider."}, {"role": "assistant", "content": "Two ingredients: a short tonal body and band-passed noise for the rattle.\n\n```supercollider\n(\nSynthDef(\\snare, { |out = 0, amp = 0.6|\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -6), doneAction: 2);\n var body = SinOsc.ar(180) * 0.4;\n var rattle = BPF.ar(WhiteNoise.ar, 1800, 0.4) * 3;\n Out.ar(out, Pan2.ar((body + rattle) * env * amp));\n}).add;\n);\nSynth(\\snare);\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Latoocarfian2DN.ar(MouseX.kr(20, SampleRate.ir * 0.5), MouseX.kr(40, SampleRate.ir), mul:0.2) }.play(s);\n\n\n(\n{ Latoocarfian2DN.ar(\n SampleRate.ir/4,\n SampleRate.ir,\n LFNoise2.kr(2.dup, 1.5, 1.5),\n d:LFNoise2.kr(2.dup, 0.5, 1.5),\n mul:0.2\n) }.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Latoocarfian2DN.ar(MouseX.kr(20, SampleRate.ir * 0.5), MouseX.kr(40, SampleRate.ir), mul:0.2) }.play(s);\n\n\n(\n{ Latoocarfian2DN.ar(\n SampleRate.ir/4,\n SampleRate.ir,\n LFNoise2.kr(2.dup, 1.5, 1.5),\n d:LFNoise2.kr(2.dup, 0.5, 1.5),\n mul:0.2\n) }.play(s);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\ns=Server.default;\n\na= CutProcStream(BBCutProc11.new);\n\n//no offsets set (usually this would be decided by cut synthesisers\n10.do {a.next(Event.default).postln};\n\na= CutProcStream(RecursiveCutProc1.new);\n\n//offsets set\n10.do {a.next(Event.default).postln };\n\n//use with Patterns- not good for live interaction and beat induction in this case, but fine for rendering at server latency arms length.\n\nt=TempoClock(2.4);\n\nPbindf(CutProcStream(WarpCutProc1.new),\\sustain,0.01,\\freq,Pfun\n// …\n```"}, {"role": "assistant", "content": "no offsets set (usually this would be decided by cut synthesisers use with Patterns- not good for live interaction and beat induction in this case, but fine for rendering at server latency arms length. (CutProcStream: Stream wrapper for a cut procedure)"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Nested ifs in a SynthDef?"}, {"role": "assistant", "content": "```supercollider\n(\n{\nvar noise, out;\nnoise = LFNoise0.kr(8);\n\nout = if( noise > 0.0,\n if(noise > 0.5, \n if(noise > 0.9, WhiteNoise.ar(0.2), Pulse.ar(60, 0.5, 0.4)),\n SinOsc.ar(500, 0, 0.25)\n ),\n Saw.ar(160, 0.5)\n);\n\nout ! 2\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for 2 channels of chuckling sawtooths."}, {"role": "assistant", "content": "```supercollider\n//hall of mirrors\n{[AllpassC.ar(HPF.ar(RLPF.ar(Saw.ar(LFPar.kr(0.25).range(220,440)),LFPar.kr(MouseX.kr(0,8),pi).range(220,20000),0.3),LFPar.kr(MouseY.kr(0,8)).range(220,20000)),2,MouseX.kr(0,0.5),2),AllpassC.ar(HPF.ar(RLPF.ar(Saw.ar(LFPar.kr(0.25,pi).range(440,220)),LFPar.kr(MouseX.kr(8,0),pi).range(20000,220),0.3),LFPar.kr(MouseY.kr(8,0),pi).range(20000,220)),2,MouseX.kr(0.5,0),2)]}.play\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// Analogizer\n// a quick draft of a model of the EHX Analogizer pedal\n// some info from \"https://www.bassic.de/threads/electro-harmonix-ehx-analogizer.14865686/\"\n\ns.default\ns.boot\n\n// used this for testing: https://www.freesound.org/people/wescwave/sounds/169885/\n~buf = Buffer.read(s, \"169884__wescwave__double-bass-test2.wav\");\n\n(\n~x.free;\n~x = {\n var a, d, s;\n\n a = PlayBuf.ar(2, ~buf, 1, 1, 0, 1);\n a = a.sum!2; // go mono to make the effect more prominent\n\n // the \"distortion modeling\" could use some more love...\n s = (a * MouseY.kr(26/2, 0).dbamp).tanh;\n s = s * MouseY.kr(-16/2, 0).dbamp;\n\n // a simple delay\n d = DelayC.ar(s, 0.1, MouseX.kr(3.5/1000, 65/1000));\n\n // dry/wet...\n a = a + (d * MouseY.kr(0, -96).dbamp);\n\n Out.ar(0, a);\n}.play\n)\n```"}, {"role": "assistant", "content": "The EHX Analogizer (http://www.ehx.com/products/analogizer) is a guitar pedal that apparently consists of a ultra-short delay with some gain stage. It's supposed to \"fatten\" and somehow \"spread\" the sound to make it appear more \"analog\" (thus: dirty). I wanted to quickly test the effect myself.\r\n\r\nI guess with some additional care of the distortion stage and maybe some very little modulation (ster."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// We'll hear the sawtooth wave when the two sine oscillators are both in the region x = 0.0 to 0.5, y = 0.5 to 1.0\n(\n{\n InRect.ar(\n SinOsc.ar(1), SinOsc.ar(1.3), Rect(0, 0.5, 0.5, 0.5)\n ) * LFSaw.ar(44, 0, 0.1)\n}.play\n);\n\n// Stereo effect\n(\n{\n InRect.ar(\n LFNoise0.ar([140, 141]), LFNoise0.ar(143), Rect(0, 0, 0.5, 1)\n ).lag(0.1) * LFSaw.ar(SinOsc.ar(10, 0, 5, 400), 0, 0.1)\n}.play\n);\n\n// For the Rect, create as left\n// …\n```"}, {"role": "assistant", "content": "We'll hear the sawtooth wave when the two sine oscillators are both in the region x = 0.0 to 0.5, y = 0.5 to 1.0 For the Rect, create as left, 'top', width, height; (InRect: Test if a point is within a given rectangle.)"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\delay;\n~description = \"Simple delay line\";\n~channelLayout = \\mono;\n~function = {|in = 0, del = 0.5|\n DelayC.ar(in, 2, del);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "SC can't open or read files?"}, {"role": "assistant", "content": "SuperCollider forum — SC can't open or read files\n\nIt looks as though it’s finally working!\n\nI moved the file to a folder I created in the user support directory for SuperCollider and then changed the quotes to ascii.\n\nI think the issue was that at first I had the file name listed without the extension, then I added the extension to the file name and added the file extension to the file path in the code and this must have created a conflict.\n\nIn the first instance SC needed the file extension, ascii quotes, and since I’m on windows the path needed double \\ in the path file.\n\nThe final working code looks like this:\n\n```supercollider\nb = Buffer.readChannel(s, \"C:\\\\Users\\\\44774\\\\AppData\\\\Local\\\\SuperCollider\\\\Tables\\\\wubsquare.wav\", startFrame:0, numFrames: -1);\n```\n\nThe wav file is simply named wubsquare and I included the file extension in the code."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// define two Pbinds of same length, play first\n\n// data sharing with rhythms of coinciding entry points is sure as streams are time-shifted\n\n(\np = PmonoPar([\n [\n \\dur, Prand([1, 1, 2]/3, inf).collect(~dur = _).trace, // or: .collect { |x| ~dur = x } .trace\n \\amp, Pseq([0.2, 0.05], 15).trace \n ],[\n \\dur, Pfunc { ~dur / 2 },\n \\midinote, Pshuf((60..85)) \n ]\n]).trace.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// define two Pbinds of same length, play first\n\n// data sharing with rhythms of coinciding entry points is sure as streams are time-shifted\n\n(\np = PmonoPar([\n [\n \\dur, Prand([1, 1, 2]/3, inf).collect(~dur = _).trace, // or: .collect { |x| ~dur = x } .trace\n \\amp, Pseq([0.2, 0.05], 15).trace \n ],[\n \\dur, Pfunc { ~dur / 2 },\n \\midinote, Pshuf((60..85)) \n ]\n]).trace.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\nb = Buffer.alloc(s, 2048, 1);\nc = Buffer.alloc(s, 2048, 1);\nd = Buffer.read(s, \"sounds/a11wlk01.wav\");\n);\n\n(\nSynthDef(\"help-commonMag\", { arg out=0, bufnumA=0, bufnumB=1, soundBufnum=2;\n var inA, inB, chainA, chainB, chain;\n inA = HPF.ar(Mix(LFSaw.ar([100, 150], 0, 0.2)), 1200);\n inB = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);\n chainA = FFT(bufnumA, inA);\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\nb = Buffer.alloc(s, 2048, 1);\nc = Buffer.alloc(s, 2048, 1);\nd = Buffer.read(s, \"sounds/a11wlk01.wav\");\n);\n\n(\nSynthDef(\"help-commonMag\", { arg out=0, bufnumA=0, bufnumB=1, soundBufnum=2;\n var inA, inB, chainA, chainB, chain;\n inA = HPF.ar(Mix(LFSaw.ar([100, 150], 0, 0.2)), 1200);\n inB = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);\n chainA = FFT(bufnumA, inA);\n chainB = FFT(bufnumB, inB);\n chain = PV_CommonMag(chainA, chainB, MouseX.kr(0, 50), MouseY.kr);\n Out.ar(out, IFFT(chain).dup);\n}).play(s,[\\out, 0, \\bufnumA, b.bufnum, \\bufnumB, c.bufnum, \\soundBufnum, d.bufnum]);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Symbol` in SuperCollider?"}, {"role": "assistant", "content": "Symbol — a unique name for something A symbol, like a String, is a sequence of characters. Unlike strings, two symbols with exactly the same characters will be the exact same object. Symbols are optimized for recreating the same symbol over and over again. In practice, this means that symbols are best used for identifiers or tags that are only meaningful within your program, whereas you should use a string when your characters are re Category: Core."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Will nobody switch the damn thing off??"}, {"role": "assistant", "content": "```supercollider\n(\n\n{\nvar dseq, trig;\n\ndseq = Dseq([SinOsc.ar(45).range(-5, 12), SinOsc.ar(SinOsc.ar(0.285).range(42, 48)).range(-9, 19), 9, 0, -12], inf);\ntrig = Impulse.ar(SinOsc.ar(0.2).range(44, 46));\nSinOsc.ar(\n (77 + Demand.ar(trig, 0, dseq)).midicps,\n 0,\n 0.5\n) ! 2\n\n\n}.play\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n(\np = Pbind(\n \\midinote, Pshufn((70..73), inf),\n \\dur, 0.2\n);\n;\n\nx = p.play;\n\nx.stop;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n(\np = Pbind(\n \\midinote, Pshufn((70..73), inf),\n \\dur, 0.2\n);\n);\n\nx = p.play;\n\nx.stop;\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for load all files for the hyperdisco setup."}, {"role": "assistant", "content": "```supercollider\n//// load all files for the hyperdisco setup.\n\nq = q ? ();\nq.hyperfolder = q.hyperfolder ?? { thisProcess.nowExecutingPath.dirname };\n\n(q.hyperfolder +/+ \"libs/_SynthLib.scd\").loadPaths;\n(q.hyperfolder +/+ \"libs/_FXLib.scd\").loadPaths;\n(q.hyperfolder +/+ \"setup_files/2_makeHistory.scd\").loadPaths;\n\nif (Platform.hasQt) {\n (q.hyperfolder +/+ \"setup_files/1a_Butz.scd\").loadPaths;\n (q.hyperfolder +/+ \"setup_files/1b_winbounds.scd\").loadPaths;\n (q.hyperfolder +/+ \"setup_files/2b_makeHistoryGUI.scd\").loadPaths;\n};\n\n// this may be too harsh - comment out if not needed!\nServer.killAll;\n\nTask {\n try { (q.hyperfolder +/+ \"setup_files/1_logMeIn.scd\").loadPaths } {\n \"*** setup_files/1_logMeIn.scd failed!\".postln;\n };\n 1.wait;\n\n (q.hyperfolder +/+ \"setup_files/3_runCode*.scd\").loadPaths;\n\n // this could be problematic,\n if (Platform.hasQt) {\n // maybe we need a non-doc- SyncText version?\n (q.hyperfolder +/+ \"setup_files/4_makeSyncedEditor.scd\").loadPaths;\n // sent drawing code will just be ignored ...\n /// would be nice if it did get shown!\n (q.hyperfolder +/+ \"setup_files/5_drawer.scd\").loadPaths;\n };\n\n s.options.memSize = (2 ** 18).asInteger;\n s.waitForBoot {\n s.sync;\n (q.hyperfolder +/+ \"setup_files/6_HyperMasterFX.scd\").loadPaths;\n };\n\n}.play(AppClock);\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nPdef(\\zed, \n Pbind(\n \\osc, Pseq([SinOsc, LFSaw],inf),\n \\instrument, Prout({ arg ev;\n SynthDef(\\zed, { arg out=0, gate=1, amp=0.1, pan=0, freq=200;\n var sig;\n sig = ev[\\osc].ar(freq);\n sig = sig * EnvGen.kr(\\adsr.kr(Env.adsr(0.1,0.1,0.8,0.1)), gate, doneAction:2);\n sig = Pan2.ar(sig, pan, amp);\n Out.ar(out, sig);\n }).add.yield;\n }).loop,\n \\degree, Pseq([0],inf),\n \\dur, 1,\n \\amp, 0.1,\n )\n).play;\n);\n```"}, {"role": "assistant", "content": "synthdef building should take less time than s.latency for this to work."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Migration from the old SourceForge wiki?"}, {"role": "assistant", "content": "```supercollider\np = ProxySpace.push(s.boot);\n\n~out.play(0,2);\n\n// taube eule und maus\n(\n~out = { \n var tr, e, eg, fm, maus;\n maus = MouseX.kr(0.1, 2);\n e = Env([0, 1, 0.4, 1, 0], [0.03, 0.2 * maus, 0.2, maus]);\n tr = Dust.kr(0.3);\n eg = EnvGen.kr(e, tr);\n fm = SinOsc.ar(30, 0, 0.2 * (1 - eg), 1);\n SinOsc.ar(100 * eg + 200 * fm) * 0.1 * eg\n};\n);\n\n// taube eulen und maus\n(\n~out = { \n var tr, e, eg, fm, maus;\n maus = MouseX.kr(0.1, 2);\n e = { Env([0, 1, 0.4, 1, 0], [0.03, 0.2.rand, 0.2, maus]) };\n tr = { Dust.kr(0.3) };\n eg = [\n EnvGen.kr(e.value, tr.value), \n EnvGen.kr(e.value, tr.value)\n ];\n fm = SinOsc.ar(30, 0, 0.2 * (1 - eg), 1);\n SinOsc.ar(100 * eg + 200 * [1, 1.15] * fm) * 0.1 * eg\n};\n);\n\n\n// eulenschlag und maus\n(\n~out = { \n var tr, e, eg, fm, maus, n, u;\n n = 6;\n maus = MouseX.kr(0.1, 2);\n e = { Env([0, 1, 0.4, 1, 0], [0.03, 0.2.rand, 0.2, maus]) };\n tr = { Dust.kr(0.1) };\n eg = (e ! n).collect { arg env; EnvGen.kr(env, tr.value) };\n fm = SinOsc.ar({ 30 + 2.0.rand2 } ! n, 0, 0.2 * (1 - eg), 1);\n u = SinOsc.ar(100 * eg + 200 * { rrand(0.9, 1.1) } ! n * fm) * 0.1 * eg;\n u.clump(2).sum\n};\n);\n\n/*\nauthors so far:\njrh\n*/\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `MoogFF`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n// Play it with the mouse...\nx = { MoogFF.ar(WhiteNoise.ar(01.1), MouseY.kr(100, 10000, 1), MouseX.kr(0, 4)) }.play(s);\nx.free;\n\n// Mmmm, throbby\n(\nx = {\n MoogFF.ar(\n Pulse.ar([40, 121], [0.3, 0.7]),\n SinOsc.kr(LFNoise0.kr(0.42).range(0.001, 2.2)).range(30, 4200),\n 0.83 * 4) }.play(s);\n);\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PV_RandComb`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\nc = Buffer.read(s, ExampleFiles.child);\n\n(\nSynthDef(\"help-randcomb\", { |out = 0|\n var sig, chain;\n sig = WhiteNoise.ar(0.8);\n chain = FFT(LocalBuf(2048), sig);\n chain = PV_RandComb(chain, 0.95, Impulse.kr(0.4));\n Out.ar(out, IFFT(chain).dup);\n}).play(s);\n);\n\n(\n// trig with MouseY\nSynthDef(\"help-randcomb2\", { |out = 0, soundBufnum = 2|\n var sig, chain;\n sig = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);\n chain = FFT(LocalBuf(2048), sig);\n chain = PV_RandComb(chain, MouseY.kr, Impulse.kr(0.4));\n Out.ar(out, IFFT(chain).dup);\n}).play(s, [\\soundBufnum, c.bufnum]);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `PatternProxy.source` do?"}, {"role": "assistant", "content": "set the source. If a quantization is given, schedule this change to the next"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Re: the perfect frequencies?"}, {"role": "assistant", "content": "```supercollider\n// Rumush\n// https://mycelialcordsblog.wordpress.com/\n// https://fungorumush.bandcamp.com/releases\n// https://soundcloud.com/fungorum\n\n(\nf = {\n var rep = [4, 8, 16, 32];\n var n = rep.choose;\n var x = [\n\n 54, 60, 66, 72, 81, 90, 96, 102,\n 108, 128, 132, 144, 162, 180, 192, 204,\n 216, 240, 264, 288, 324, 360, 384, 408,\n 432, 480, 528, 576, 648, 720, 768, 816,\n 864, 960, 1056, 1152, 1296, 1440, 1536, 1632,\n 1728, 1920, 2112, 2304, 2592, 2880, 3072, 3264,\n 3456, 3840, 4224, 4608, 5184, 5760, 6144, 6528,\n 6912, 7680, 8448, 9216, 10368, 11520, 12288, 528\n\n ];\n Mix.fill(n,\n {\n var detune = 5.rand;\n var sin = SinOsc.ar(x.choose, 4.rand, 0.25);\n var saw = RLPF.ar(Saw.ar(x.choose*0.01+detune, 0.75), x.choose, 2.rand).tanh;\n Pan2.ar((sin+saw) * EnvGen.kr(Env.sine(12, 1/n), 1, doneAction:2),\n 1.rand2) }\n );\n};\n);\n\n(\n// DEFINE A ROUTINE\nr = Routine({\n\n inf.do({\n f.play;\n 10.wait;\n })\n});\n);\n\nr.reset.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SequenceableCollection.isSeries` do? What arguments does it take?"}, {"role": "assistant", "content": "Returns true if the collection is an arithmetic Arguments: step — Step size to look for. If none is given, any step size will match. `[0, 1, 2, 3, 4, 5].isSeries; // true`."}]} -{"conversations": [{"role": "user", "content": "Why does every UGen have mul and add arguments?"}, {"role": "assistant", "content": "They are a convenience applied to the UGen's output: the result is `ugens_result * mul + add`. So `SinOsc.ar(440, 0, 0.2)` is the same as `SinOsc.ar(440) * 0.2`, and `SinOsc.ar(440, 0, 0.5, 1800)` is usable directly as a frequency. They exist because multiplying and offsetting is so common that folding it into the UGen saves a node in the graph and a line in the source."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for delay effect with accelerating echoes?"}, {"role": "assistant", "content": "```supercollider\n~buf = Buffer.alloc(s, s.sampleRate * 5);\n\n(\n{\n var trig, freq;\n var dry, snd, phase, iois;\n var cumulDelay;\n var decayFactor, lpfCutoff, numEchoes, ioiScale, ioiDecayFactor;\n\n // play with these!\n decayFactor = 0.65;\n lpfCutoff = 500;\n numEchoes = 16;\n ioiScale = 0.4;\n ioiDecayFactor = 0.75;\n\n // example input -- you can substitute other stuff here\n trig = Dust.ar(1);\n dry = Pulse.ar(100 * TIRand.ar(1, 12, trig));\n dry = dry * Decay2.ar(trig, 0.01, 0.2);\n\n phase = DelTapWr.ar(~buf, dry);\n iois = Array.geom(numEchoes, ioiScale, ioiDecayFactor);\n cumulDelay = iois.sum;\n (cumulDelay > ~buf.duration).if {\n Error(\"use a larger buffer\").throw;\n };\n snd = Silent.ar;\n iois.reverse.do { |ioi|\n snd = (snd + DelTapRd.ar(~buf, phase, cumulDelay, interp: 4)) * decayFactor;\n // one-pole lowpass -- LPF was too aggressive\n snd = OnePole.ar(snd, lpfCutoff / SampleRate.ir);\n cumulDelay = cumulDelay - ioi;\n };\n snd = snd + dry;\n \n snd * 0.5!2;\n}.play;\n\n// contributors so far: Nathan Ho\n)\n```"}]} -{"conversations": [{"role": "user", "content": "I get 'Node not found' when I call .set on a Synth after a while."}, {"role": "assistant", "content": "The Synth was freed and the language still holds a reference. That happens whenever the SynthDef used `doneAction: 2` and the envelope finished, or when something called `freeAll`/`CmdPeriod`. Guard it with `if (x.notNil and: { x.isPlaying }) { x.set(\\freq, 300) }`, or store the node in a variable that you clear when it ends. For sustained sounds the right pattern is a `gate` argument with `doneAction: 2` on the EnvGen, so the node lives until you release it."}]} -{"conversations": [{"role": "user", "content": "What is `Fb1_HopfA` in SuperCollider?"}, {"role": "assistant", "content": "Fb1_HopfA — Adaptive Hopf pseudo ugen This is an adaptive variant of Hopf, i.e. it can hold the frequency of an oscillating input f after it vanishes. The model refers to #[1], see also #[2] (4.1.) for an enhancement implemented with Fb1_HopfAFDC. The parameter naming follows the convention of #[2]. Category: Libraries > miSCellaneous > Nonlinear."}]} -{"conversations": [{"role": "user", "content": "What does `Object.performMsg` do?"}, {"role": "assistant", "content": "The argument must be a List or Array whose first element is a Symbol representing a method selector. The remaining elements are unpacked and passed as arguments to the method named by the selector. `a = { |a, b, c| postf(\"% plus % plus % is %\\n\", a, b, c, a"}]} -{"conversations": [{"role": "user", "content": "What does `ServerGui.update` do? What arguments does it take?"}, {"role": "assistant", "content": "an alternate small server view Arguments: changer; what."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n \n// definition for future reference in arbitrary Environments\n\np = PLmeanrand(\\lo, \\hi);\n\n\n// prepare current Environment\n// PLseq repeats arg defaults to inf\n\n(\n~lo = PLseq((60, 60.25..70));\n~hi = PLseq((70, 69.75..60));\n);\n\n\n// run\n\n(\nx = Pbind(\n \\midinote, Ptuple([p, 65]), \n \\amp, [0.1, 0.06], \n \\dur, 0.1\n).play;\n);\n\n\n// replace\n\n(\n~lo = 60.5;\n~hi = 61;\n;\n\nx.st\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n \n// definition for future reference in arbitrary Environments\n\np = PLmeanrand(\\lo, \\hi);\n\n\n// prepare current Environment\n// PLseq repeats arg defaults to inf\n\n(\n~lo = PLseq((60, 60.25..70));\n~hi = PLseq((70, 69.75..60));\n);\n\n\n// run\n\n(\nx = Pbind(\n \\midinote, Ptuple([p, 65]), \n \\amp, [0.1, 0.06], \n \\dur, 0.1\n).play;\n);\n\n\n// replace\n\n(\n~lo = 60.5;\n~hi = 61;\n);\n\nx.stop;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `TempoPlayer.freeResourcesToBundle` do? What arguments does it take?"}, {"role": "assistant", "content": "a control rate player that plays the TempoBus [which is the current Tempo] Arguments: bundle."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Looping sampler with crossfading."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\\simpler, {\n arg buf=0\n ,freq=220\n ,sampleStart=0\n ,loopStart=0\n ,loopLen=1 // between 0 (min) and 1 (max)\n ,fadeTime=0.1\n ,gate=1\n ,attack=0.01\n ,sustain=1\n ,release=1\n ,f0=220;\n\n var rate = freq / f0;\n var sr = rate*BufSampleRate.kr(buf);\n var fadeFrames = fadeTime*sr;\n var loopEnd = loopLen*(BufFrames.kr(buf) - loopStart) + loopStart;\n var loopFrames = loopEnd - loopStart + 1;\n var loopTime = (loopFrames - fadeFrames)/sr;\n var startUpTime = (loopStart - sampleStart)/sr;\n\n var trigLoop = TDuty.ar(Dseq([startUpTime + loopTime, Dseq([loopTime], inf)]), gapFirst:1);\n\n var phaseA = Phasor.ar(trigLoop, rate, sampleStart, inf, loopStart);\n var phaseB = Phasor.ar(trigLoop, rate, loopEnd - fadeFrames, inf, loopEnd - fadeFrames);\n\n var srcA = BufRd.ar(buf.numChannels, buf, phaseA);\n var srcB = BufRd.ar(buf.numChannels, buf, phaseB);\n\n var startLoop = SetResetFF.ar(trigLoop);\n var loopPan = Phasor.ar(trigLoop, 2/fadeFrames * rate, -1, inf, -1).clip(-1,1);\n\n var out = Select.ar(startLoop, [srcA, LinXFade2.ar(srcB, srcA, pan:loopPan)]);\n var env = EnvGen.ar(Env.asr(attack, sustain, release, 1), gate, doneAction:2);\n\n Out.ar(0, Splay.ar(out) * env);\n}).add;\n\n// Try it out:\n~buf = Buffer.read(s, Platform.resourceDir +/+ 'sounds/a11wlk01.wav');\n\nPdef(\\p, Pbind(*[\n instrument: \\simpler\n ,buf: ~buf\n ,octave: Prand([3,4,5],inf)\n ,degree: Pn(Plazy({Pseq([-4,0,5,7,9,12].scramble.clump(2),2)}))\n ,dur: 0.5\n ,strum: Prand([0, 0.125, 0.25], inf)\n ,strumEndsTogether: false\n ,loopStart: Pwhite(90000, 150000)\n ,sampleStart: Pwhite(50000, 85000)\n ,loopLen: 0.4\n ,fadeTime: 0.15\n ,attack: 0.25\n ,release: 4\n])).play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Convolution2L`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\conv_test, { |out, kernel, t_trig = 0|\n var input = Impulse.ar(1);\n var framesize = 2048; // must have power of two\n var result = Convolution2L.ar(input, kernel, t_trig, framesize, 1, 0.5);\n Out.ar(out, result);\n}).add\n);\n\nx = Synth(\\conv_test, [\\kernel, b]);\n\n// changing the buffer number:\nx.set(\\kernel, c);\nx.set(\\t_trig, 1); // after this trigger, the change will take effect.\nx.set(\\kernel, d);\nx.set(\\t_trig, 1); // after this trigger, the change will take effect.\n\nd.zero;\n40.do { |it| d.set(20 * it + 10, 1) }; // changing the buffers' contents\nx.set(\\t_trig, 1); // after this trigger, the change will take effect.\n\nx.set(\\kernel, b);\nx.set(\\t_trig, 1); // after this trigger, the change will take effect.\n\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// logistic map as frequency control\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n SinOsc.ar(QuadC.ar(40, r.neg, r, 0, 0.1, 800, 900)) * 0.4;\n}.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// logistic map as frequency control\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n SinOsc.ar(QuadC.ar(40, r.neg, r, 0, 0.1, 800, 900)) * 0.4;\n}.play(s);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `PIRand` in SuperCollider briefly."}, {"role": "assistant", "content": "PIRand — UGenPatterns quark library Based on IRand Category: Streams-Patterns-Events > UGenPatterns > Generators."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Ref`."}, {"role": "assistant", "content": "```supercollider\n(\n SynthDef(\\multi, { |out, freq = #[100, 200, 300], amp = 0.1, pan = 0, sustain = 1|\n var audio, env;\n env = EnvGen.kr(Env.perc(0.01, sustain), doneAction: Done.freeSelf);\n audio = Mix(Saw.ar(freq));\n audio = Pan2.ar(audio * env, pan, amp);\n OffsetOut.ar(out, audio)\n }).add;\n\n (instrument: \\multi, freq: [[500, 501, 700]], sustain: 2).play\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `MIDIClockOut.stopToBundle` do? What arguments does it take?"}, {"role": "assistant", "content": "a Player that sends MIDI Clock Out Arguments: b."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Dwhite`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a, freq, trig;\n a = Dwhite(0, 15, inf);\n trig = Impulse.kr(MouseX.kr(1, 40, 1));\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PV_Div`."}, {"role": "assistant", "content": "```supercollider\n(\ns.waitForBoot({\n var fftsize = 16384;\n b = Buffer.alloc(s, fftsize)\n})\n);\n\n\n(\nx = {\n // Any input should theoretically be OK, white noise is a good choice\n var son = WhiteNoise.ar;\n// var son = Impulse.ar;\n var out = LPF.ar(son, MouseX.kr(100, 10000, 1));\n var fft1 = FFT(LocalBuf(b.numFrames), son, wintype: 1);\n var fft2 = FFT(b, out, wintype: 1);\n\n // As with most PV_ ugens, the result is *actually* stored in the first fft buf\n var result = PV_Div(fft2, fft1);\n\n out.dup * 0.1\n}.play;\n);\n\n// Now we can grab the FFT buffer and peek at the magnitudes\n(\np = Plotter.new;\nt = Task {\n loop {\n 0.1.wait;\n b.loadToFloatArray(action: { |data|\n {\n p.value = data[2..]\n .clump(2)\n .collect { |a| a[0].squared + a[1].squared }\n .collect { |a| if(a.isNaN) { 0.post } { a } }\n }.defer\n })\n} }.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Plotter.value` do?"}, {"role": "assistant", "content": "Return or set the data values. Data may be numerical arrays of up to 3 dimensions. `a = [1, 4, 2, 7,"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nSerialPort.listDevices;\n\n//start reading at 2Hz with a cutoff filter of 0.33\na= IBVA(\"/dev/tty.BlueVAS_H-Data\", {|ch0, ch1, ch2, ch3| [ch0, ch1, ch2, ch3].postln}, 2, 0.33);\n\na.setSamplingRate(5);\na.getSamplingRate;\na.setFilterCutoff(0.1);\na.getFilterCutoff;\na.getBatteryLevel;\na.getDeviceName;\n\n(\ns.latency= nil;\na.setSamplingRate(120);\na.setFilterCutoff(0.3);\ns.waitForBoot{\n var synth;\n Syn\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nSerialPort.listDevices;\n\n//start reading at 2Hz with a cutoff filter of 0.33\na= IBVA(\"/dev/tty.BlueVAS_H-Data\", {|ch0, ch1, ch2, ch3| [ch0, ch1, ch2, ch3].postln}, 2, 0.33);\n\na.setSamplingRate(5);\na.getSamplingRate;\na.setFilterCutoff(0.1);\na.getFilterCutoff;\na.getBatteryLevel;\na.getDeviceName;\n\n(\ns.latency= nil;\na.setSamplingRate(120);\na.setFilterCutoff(0.3);\ns.waitForBoot{\n var synth;\n SynthDef(\\mysnd, {|out= 0, amp= 0.2, lag= 0.01|\n var snd= SinOsc.ar(\\data.kr(#[0, 0, 0, 0], lag));\n Out.ar(out, Splay.ar(snd*amp));\n }).add;\n s.sync;\n synth= Synth(\\mysnd);\n a.action= {|...arr| synth.set(\\data, arr.linexp(0, 1023, 200, 2000))};\n};\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a filter sweep over a saw."}, {"role": "assistant", "content": "An LFO on the cutoff of a resonant low-pass; XLine or an LFO both work, the LFO is the loopable one.\n\n```supercollider\n{ LPF.ar(Saw.ar([60, 60.2]), SinOsc.kr(0.2).exprange(150, 4000), 0.4) * 0.2 }.play;\n```\n\n`.exprange` is the exponential mapping you want for frequency; a linear `.range` sweep sounds uneven."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// A generative song\n(\n// Scale degrees going up\nPdef(\\a, Pbind(\\dur, 0.25, \\degree, Pseq((0..3))));\n\n// Scale degrees going down\nPdef(\\b, Pbind(\\dur, 0.25, \\degree, Pseq((3..0))));\n\n// Random scale degrees\nPdef(\\c, Pbind(\\dur, 0.125, \\degree, Pwhite(0, 10, 8)));\n\n// Use the L-system to put together a sequence of keys\n// Psym will then retrieve the patterns from the global Pdef dictionary\n// See the post window for info about which of these are playing\nPsym(\n Prewrite(\\a, // start with pattern \\a\n (\n \\a: #[\\a, \\\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// A generative song\n(\n// Scale degrees going up\nPdef(\\a, Pbind(\\dur, 0.25, \\degree, Pseq((0..3))));\n\n// Scale degrees going down\nPdef(\\b, Pbind(\\dur, 0.25, \\degree, Pseq((3..0))));\n\n// Random scale degrees\nPdef(\\c, Pbind(\\dur, 0.125, \\degree, Pwhite(0, 10, 8)));\n\n// Use the L-system to put together a sequence of keys\n// Psym will then retrieve the patterns from the global Pdef dictionary\n// See the post window for info about which of these are playing\nPsym(\n Prewrite(\\a, // start with pattern \\a\n (\n \\a: #[\\a, \\b],\n \\b: #[\\c, \\a],\n \\c: #[\\a, \\b]\n ), 4).trace\n).play\n);\n\n// Inspect the L-system to see what data it produces\n(\na = Prewrite(0, // start with 0\n (\n 0: #[2, 0],\n 1: #[0, 0, 1],\n 2: #[1, 0, 1]\n), 4);\nx = a.asStream;\n30.do({ x.next.postln });\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Linen.kr` do? What arguments does it take?"}, {"role": "assistant", "content": "Simple linear envelope generator. Arguments: gate — This triggers the envelope and holds it open while > 0. If gate < 0, force release with time `-1.0 - gate`. See EnvGen#Forced release.; attackTime — The duration of the attack portion.; susLevel — The level of the sustain portion.; releaseTime — The duration of the release portion.; doneAction — An integer representing an action to be executed when the envelope is finished. See."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nMIDIIn.connectAll;\n// MIDIClient.init;\n\n\n(\n// A SynthDef with ADSR envelope\nSynthDef(\"quick2\", {arg freq = 440, amp = 0.1, gate = 1;\n var snd, env;\n env = Env.adsr(0.01, 0.1, 0.3, 2, amp).kr(2, gate);\n snd = Saw.ar(freq: [freq, freq*1.5], mul: env);\n Out.ar(0, snd)\n}).add;\n);\n\n// Play it with a MIDI keyboard\n(\nvar noteArray = Array.newClear(128); // array has one slot per possible MIDI note\n\nMIDIdef.noteOn(\\myKeyDown, {arg vel, note;\n noteArray[note] = Synth(\"quick2\", [\\freq, note.midicps, \\amp, vel.linlin(0, 127, 0, 1)]);\n [\"NOTE ON\", note].postln;\n});\n\nMIDIdef.noteOff(\\myKeyUp, {arg vel, note;\n noteArray[note].set(\\gate, 0);\n [\"NOTE OFF\", note].postln;\n});\n)\n// PS. Make sure SC MIDI connections are made (MIDIIn.connectAll)\n```"}, {"role": "assistant", "content": "Basic example - how to use a MIDI keyboard with a simple synth."}]} -{"conversations": [{"role": "user", "content": "What does `KeyCodeResponder.functionKeyModifier` do?"}, {"role": "assistant", "content": "register responder functions for keycode and modifier combinations"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `FoldIndex`."}, {"role": "assistant", "content": "```supercollider\n// indexing into a table\n(\n{\n var buf = LocalBuf.newFrom([200, 300, 400, 500, 600, 800]);\n var freq = FoldIndex.kr(buf, MouseX.kr(0, BufFrames.ir(buf) * 3));\n SinOsc.ar(freq) * 0.1\n}.play;\n);\n\n// the same using a global buffer\n(\nt = [200, 300, 400, 500, 600, 800];\nb = Buffer(s, t.size, 1);\n\n// alloc and set the values\ns.listSendMsg(b.allocMsg(b.setnMsg(0, t)).postln);\n\nSynthDef(\\help_Index, { |out = 0, bufnum = 0|\n Out.ar(out,\n SinOsc.ar(\n FoldIndex.kr(\n bufnum,\n MouseX.kr(0, BufFrames.ir(bufnum) * 3)\n ),\n 0,\n 0.5\n )\n )\n}).play(s, [\\bufnum, b.bufnum]);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nSynthDef(\\dubecho,{|in, out, length = 1, fb = 0.8, sep = 0.012|\n var input = In.ar(in, 2);\n var feedback = LocalIn.ar(2);\n var output = LeakDC.ar(feedback*fb + input);\n output = HPF.ar(output, 400);\n output = LPF.ar(output, 5000);\n output = output.tanh;\n LocalOut.ar(DelayC.ar(output, 1, LFNoise2.ar(12).range([length,length+sep],[length+sep,length])).reverse);\n ReplaceOut.ar(out, output);\n}).add;\n\n// Example as effecet bus\n~bus = Bus.audio(s, 2);\n~echo = Synth(\\dubecho, [\\in, ~bus, \\length, TempoClock.default.tempo*(3/8), \\fb, 0.7, \\sep, 0.0012], addAction: \\addToTail);\n\n// send something\nplay{ Out.ar(~bus, LFGauss.ar(1, 0.1, loop:0, doneAction:2) * Blip.ar(80!2, 8)) }\n\n// turn it off\n~echo.free;\n```"}, {"role": "assistant", "content": "Fork of Bjorn's Dub echo, rewritten w/o the Feedback Quark (using LocalIn + LocalOut) and adding a ping pong (can be removed by deleting the .reverse method in the LocalOut line)."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `GbmanN`."}, {"role": "assistant", "content": "```supercollider\n// default initial params\n{ GbmanN.ar(MouseX.kr(20, SampleRate.ir)) * 0.1 }.play(s);\n\n// change initial params\n{ GbmanN.ar(MouseX.kr(20, SampleRate.ir), -0.7, -2.7) * 0.1 }.play(s);\n\n// wait for it...\n{ GbmanN.ar(MouseX.kr(20, SampleRate.ir), 1.2, 2.0002) * 0.1 }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(GbmanN.ar(40)*400+500)*0.4 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(SynthDef(\\x, {|midi = 60, amp = 0.8| Out.ar(0, Pan2.ar(SinOsc.ar(midi.midicps, mul: EnvGen.kr(Env.perc(0, 0.5), timeScale: 0.5, levelScale: 0.3)), Rand(-1, 1)) * EnvGen.kr(Env.perc(0, 0.5), timeScale: 1.3*0.5, levelScale: Rand(0.3, 0.5), doneAction:2));}).add;)\n\n(~phase = Pbind(*[ instrument: \\x, dur: 0.5, midi: Pseq([0, 4, 7] + 60, inf)]);\n5.do({|val| ~phase.play(TempoClock.new((110 + (0.5 * val)) / 60))}); )\n```"}, {"role": "assistant", "content": "Experimenting with some Reich style phasings\r\n\r\nAudio: http://soundcloud.com/schemawound/goodnightworld."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// The driven pendulum is interesting as it's a quite simple model\n// that includes parameter zones of chaotic behaviour:\n// http://lampx.tugraz.at/~hadley/physikm/apps/numerical_integration/pendulum.en.php\n\n// y here denotes the angle\n\n// y''(t) + (y'(t) / q) + sin(y(t)) = a * cos(omega * t)\n\n// which translates to\n\n// y'(t) = w(t)\n// w'(t) = (-w(t) / q) - sin(y(t)) + (a * cos(omega * t))\n\n\n(\nFb1_ODEdef(\\DrivenPendulum, { |t, y, q = 1, omega = 0,\n// …\n```"}, {"role": "assistant", "content": "The driven pendulum is interesting as it's a quite simple model that includes parameter zones of chaotic behaviour: (Fb1_ODE: general ordinary differential equation integrator pseudo ugen)"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// example: frequency is derived from the number of synths running\n(\nSynthDef(\"numRunning\", { |out|\n Out.ar(out, SinOsc.ar(NumRunningSynths.ir * 200 + 400, 0, 0.1));\n}).add;\n);\n\ns.sendMsg(\"/s_new\", \"numRunning\", -1, 0, 0);\ns.sendMsg(\"/s_new\", \"numRunning\", -1, 0, 0);\ns.sendMsg(\"/s_new\", \"numRunning\", -1, 0, 0);\ns.sendMsg(\"/s_new\", \"numRunning\", -1, 0, 0;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// example: frequency is derived from the number of synths running\n(\nSynthDef(\"numRunning\", { |out|\n Out.ar(out, SinOsc.ar(NumRunningSynths.ir * 200 + 400, 0, 0.1));\n}).add;\n);\n\ns.sendMsg(\"/s_new\", \"numRunning\", -1, 0, 0);\ns.sendMsg(\"/s_new\", \"numRunning\", -1, 0, 0);\ns.sendMsg(\"/s_new\", \"numRunning\", -1, 0, 0);\ns.sendMsg(\"/s_new\", \"numRunning\", -1, 0, 0);\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Midterm Question 2 (a SuperCollider snippet)?"}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"sawSynth\", {arg freq, amp;\n \n Out.ar(0, Splay.ar(LPF.ar(in: Saw.ar(freq * [0.99, 1.0, 1.001, 1.008], mul:Env.perc(attackTime:0.1, releaseTime:2, level:amp).kr(2)),freq: 2000)))\n\n}).add;\n);\n\n(\nPbind(\n \\instrument, \"sawSynth\",\n \\degree, Pseq([1,3,5,7], inf),\n \\dur, 0.111, \n \n).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `FFTSlope` in SuperCollider?"}, {"role": "assistant", "content": "FFTSlope — Spectral slope Given an FFT chain, this measures the spectral slope, which is the slope of the linear correlation line derived from the spectral magnitudes. Category: UGens > Analysis, UGens > FFT."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `SequenceableCollection`."}, {"role": "assistant", "content": "```supercollider\n~listing = [\"ls\", \"/\"].unixCmdGetStdOut; // Grab\n~listing.reverse.as(Array).dupEach.join.postln; // Mangle\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//spinning hypercube / tesseract\n//after Shiffman https://codingtrain.github.io/website-archive/CodingChallenges/113-hypercube.html\n\n\n(\nvar width= 640, height= 480, w,\ntheta= 0, speed= 0.005, hypercube;\n\nw= RedWindow(\"3Dhypercube\", Rect(128, 64, width, height)).front;\nhypercube= Red4DTesseract();\n\n//--loop\nw.draw{\n theta= theta+speed;\n hypercube.rotation= RedVector[theta, 0, 0, 0, 0, theta];\n hypercube.update;\n\n //--render\n hypercube.render(2, 500); //1= exaggerate, 2= standard\n Pen.translate(width*0.5, height*0.5);\n Pen.fillColor= Color.white;\n hypercube.draw;\n Pen.strokeColor= Color.white;\n hypercube.drawOutlines;\n};\nw.play;\nCmdPeriod.doOnce({w.close});\n)\n```"}, {"role": "assistant", "content": "spinning hypercube / tesseract after Shiffman https://codingtrain.github.io/website-archive/CodingChallenges/113-hypercube.html."}]} -{"conversations": [{"role": "user", "content": "What does `Interpreter.interpretPrint` do?"}, {"role": "assistant", "content": "Compile and execute a String, printing the result. `this.interpretPrint(\"123 +"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Hymn #15 - generative melody by array rewriting?"}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\ping, {\n arg freq = 440, pan = 0;\n var sig;\n sig = SinOsc.ar(freq, 0, 0.3);\n sig = sig * EnvGen.ar(Env.perc(0.01, 1), doneAction:2);\n sig = Pan2.ar(sig, pan);\n Out.ar(0, sig)\n}).add;\n);\n\n(\n~scramb = {|pan|\nvar notes = [0,4,7,14,9,12,4,7,9,7];\nvar dur = [1,1,2,3,6,3,4,5,2,1,13];\nvar transp = [0, 5, 7, 3, 2];\nvar scrambRand = {|array|\n var rand = rrand(0, array.size-3);\n var end = rand + rrand(1,2);\n var range = (rand..end);\n var reverseRange = range.reverse;\n var temp = array.copy;\n range.postln;\n range.do({|item, index|\n array[item] = temp[reverseRange[index]];\n });\n array;\n};\nvar octRand = {|array|\n var rand = rrand(0, array.size-1);\n array[rand] = array[rand] + [-12,0,12].choose;\n };\nvar task = Task {\n var step = 0;\n var transpStep = 0;\n loop {\n var freq = (notes.wrapAt(step) + 60 + transp.wrapAt(transpStep)).midicps;\n Synth(\\ping, [\\freq, freq, \\pan, pan]);\n (dur.wrapAt(step) * 0.15).wait;\n step = step + 1 % (notes.size * 12;);\n if (step%32 == 0, {scrambRand.value(notes)});\n if (step%20 == 0, {scrambRand.value(dur)});\n if (step%66 == 0, {transpStep = transpStep + 1 % (transp.size)});\n if (step%24 == 0, {notes = notes.rotate(rrand(-1, 1))});\n if (step%56 ==0, {octRand.value(notes)});\n }\n}.play;\n};\n);\n\n(\n~scramb.value(-0.7);~scramb.value(0.7);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Lorenz2DL.ar(11025, 44100) }.play(s);\n\n// randomly modulate params\n(\n{ Lorenz2DL.ar(\n 11025, 44100,\n LFNoise0.kr(1, 2, 10),\n 20,\n LFNoise0.kr(1, 1.5, 2),\n 0.02\n) * 0.2 }.play(s);\n)\n\n// as a frequency control\n{ SinOsc.ar(Lorenz2DL.ar(40, 80, h:0.02)*800+900)*0.4 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Lorenz2DL.ar(11025, 44100) }.play(s);\n\n// randomly modulate params\n(\n{ Lorenz2DL.ar(\n 11025, 44100,\n LFNoise0.kr(1, 2, 10),\n 20,\n LFNoise0.kr(1, 1.5, 2),\n 0.02\n) * 0.2 }.play(s);\n)\n\n// as a frequency control\n{ SinOsc.ar(Lorenz2DL.ar(40, 80, h:0.02)*800+900)*0.4 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "What is `CutPan1` in SuperCollider?"}, {"role": "assistant", "content": "CutPan1 — CutMixer panning algorithm CutPan1 is intended to be used in the panfunc parameter of CutMixer . It pans repeats in each block in an arithmetic sequence starting from 0. The pan is automatically clipped if it goes outside of the range [-1, 1]. Category: Libraries > BBCut > Cut FX."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ControlDur`."}, {"role": "assistant", "content": "```supercollider\n{ ControlDur.ir.poll }.play;\n\n{ (1/ControlDur.ir).poll }.play;\n\n{ ControlRate.ir.poll }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `PreProcessor.verbose` do?"}, {"role": "assistant", "content": "If set to true, the preprocessor prints information to the post"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `PV_ChainUGen`."}, {"role": "assistant", "content": "```supercollider\n// a sound file\nc.free; c = Buffer.read(s, ExampleFiles.child);\n\n(\n{\n var in, chain, v;\n in = PlayBuf.ar(1, c, BufRateScale.kr(c), loop: 1);\n chain = FFT(LocalBuf(1024), in);\n\n chain = chain.pvcalc(1024, { |mags, phases|\n//////// Try uncommenting each of these lines in turn and re-running the synth:\n [mags * { 1.5.rand }.dup(mags.size), phases + { pi.rand }.dup(phases.size)]; // Arbitrary filter, arbitrary phase shift\n // [mags.reverse, phases.reverse]; // Upside-down!\n // [mags.differentiate, phases.differentiate]; // Differentiate along frequency axis\n // [mags[30..] ++ mags[..30], phases[30..] ++ phases[..30]]; // \".rotate\" doesn't work directly, but this is equivalent\n }, frombin: 0, tobin: 250, zeroothers: 0);\n\n 0.5 * IFFT(chain).dup\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `EZRanger.value` do? What arguments does it take?"}, {"role": "assistant", "content": "Gets/sets the `lo` and `hi` Arguments: vals — An instance of Array `[lo, hi]`.."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\na = Scheduler(SystemClock);\n\na.sched(3, { \"now it is 3 seconds.\".postln; nil });\na.sched(5, { \"now it is 5 seconds.\".postln; nil });\na.sched(1, { \"now it is 1 second.\".postln; nil });\n\na.advance(0.5);\na.advance(0.5);\na.advance(2);\na.advance(2);\n\n// the beats, seconds and clock are passed into the task function:\na.sched(1, { |beats, secs, clock| [beats, secs, clock].postln });\na.advance(1);\n\n// the scheduling is relative to \"now\":\na.sched(3, { \"now it was 3 seconds.\".postln });\n// …\n```"}, {"role": "assistant", "content": "the beats, seconds and clock are passed into the task function: the scheduling is relative to \"now\": (Scheduler: schedules functions to be evaluated in the future)"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Stockmarket Sonification (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\dollar, { |out, freq = 440, amp = 0.1, pan = 0, sustain = 1.0|\n var env = EnvGen.kr(Env([amp, amp, 0], [sustain, 0.01]), doneAction: 2);\n var decay = freq ** -0.5 * 100;\n var string = CombL.ar(Decay2.ar(Impulse.ar(0), 0.0001, 0.001), 1/freq, 1/freq, decay);\n var damped = string; //LPF.ar(string, Line.kr(11000, 3000, decay));\n OffsetOut.ar(out, Pan2.ar(damped * env, pan));\n}).add;\n);\n\n(\nSynthDef(\\euro, { |out, freq = 440, amp = 0.1, pan = 0, sustain = 1.0|\n var env = EnvGen.kr(Env.perc(0.001, sustain), doneAction: 2);\n var decay = freq ** -0.5 * 100;\n var thing;\n freq = freq * (1..7).nthPrime;\n thing = SinOsc.ar(freq , 0, amp * AmpComp.kr(freq)).mean;\n OffsetOut.ar(out, Pan2.ar(thing * env, pan));\n}).add;\n);\n\n\n(\nPdef(\\stock, { |note = 0, sustain = 1|\n Pbind(\n \\instrument, [\\dollar, \\euro].choose,\n \\note, note.value + Pseq((12..0).curdle(0.1).scramble.flat * 3), \n \\dur, sustain.value / 12\n )\n})\n);\n\n(\nPdef(\\ett, \n Pbind(\n \\type, \\phrase,\n \\instrument, \\stock,\n \\dur, 4,\n \\legato, Prand((1..5), inf),\n \\note, Prand((0..12), inf) + Prand([[0, 2], [0, 6], [0, 7], 0, 0], inf)\n )\n).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "I get 'syntax error, unexpected NAME' on a block that looks fine."}, {"role": "assistant", "content": "Almost always a missing semicolon between two statements — SuperCollider does not insert them.\n\n```supercollider\n// broken: two statements, no separator\n{ var sig = SinOsc.ar(440) sig = sig * 0.1; sig }.play\n```\n\n```supercollider\n// fixed\n{ var sig = SinOsc.ar(440); sig = sig * 0.1; sig }.play\n```\nThe error points at the second statement, not at the missing semicolon before it, which is why it looks\nfine. If it is not a semicolon, count the brackets: `.ar(` open, `)` closed."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `PlazyEnvirN`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05, pan = 0|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, Pan2.ar(SinOsc.ar(freq, 0, env), pan))\n }).add;\n\na = PlazyEnvirN({ |g = 0, h = 0, dur = 1|\n postf(\"g: %, h: %, dur: %\\n\", g, h, dur);\n\n Pbind(\n \\instrument, \\help_sinegrain,\n \\dur, dur,\n \\degree, Pseq([g, g, h, g, h], 2)\n )\n});\n);\n\n// different variants\n(a <> (g: 0, h: 3, dur: 0.2)).play; // single stream\n(a <> (g: [0, 4], h: [3, -1], dur: 0.2)).play; // same durations, two streams\n(a <> (g: [0, 4], h: [3, -1], dur: [0.2, 0.3])).play; // different durations, two streams\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes sclang fun )."}, {"role": "assistant", "content": "```supercollider\n( // whatever\nNdef(\\ff_twist, {\n var tempo = 156/60;//TempoClock.tempo;\n var bands = 4.rrand(16).debug('bands');\n var sync = bands.factors.scramble.pop.debug('sync');\n var gen = [LFNoise1,LFNoise2,LFNoise0];\n var sig = Splay.ar(\n VarSaw.ar(//LFSaw.kr(Array.rand(bands/sync, 8, 390).stutter(sync)).range(0.97,1.03) * \n Array.exprand(bands, 50, 400) * ({ gen.choose.kr(1/1.rrand(10)).exprange(1, 10) } ! (bands/sync)).stutter(sync), \n 0, \n { gen.choose.kr(1/1.rrand(10)).range(0.1,1) } ! bands, \n { gen.choose.kr(1/1.rrand(10)).range(0.1,1) } ! bands\n ) * ({ EnvGen.kr(Env.perc(0.008.exprand(0.03), tempo.reciprocal / [1,2,4,8].choose, 1, rrand(-7,-1.0)).circle) } ! (bands/sync)).stutter(sync)\n );\n sig = sig * 0.7 + GVerb.ar(sig, mul:0.3);\n sig = Rotate2.ar(\n sig[0], sig[1], \n LFSaw.kr( Duty.kr(tempo.reciprocal * (2,8..24).choose, 0, Drand((1..4)*tempo, inf)) )\n );\n sig;\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Event`?"}, {"role": "assistant", "content": "Event — an environment that represents an action"}, {"role": "user", "content": "What does `Event.parentEvents` do?"}, {"role": "assistant", "content": "An extendible IdentityDictionary of useful parent events."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na = (x: 6, y: 7, play: { (~x * ~y).postln });\na.play; // returns 6 * 7\n```"}]} -{"conversations": [{"role": "user", "content": "What is `IdentityDictionary`?"}, {"role": "assistant", "content": "IdentityDictionary — associative collection mapping keys to values"}, {"role": "user", "content": "What does `IdentityDictionary.new` do?"}, {"role": "assistant", "content": "The #-parent and #-proto instance variables allow additional IdentityDictionary's to provide default values. The precedence order for determining the value of a key is the IdentityDictionary, its prototype, its parent. When the instance variable #-know is True, the IdentityDictionary responds to unknown messages by looking up the selector and evaluating the result with the dictionary as an argumen"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_sinegrain, { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0.5pi, env))\n}).add;\n\na = Pbind(\\instrument, \\help_sinegrain, \\note, Pseq([0, 7, 2, 9, 11, 10, 9, 8], inf), \\dur, 1);\na.play(quant: (quant: 1, phase: 0));\na.play(quant: (quant: 1, phase: 1/3));\na.play(quant: (quant: 1, phase: 1.0.rand));\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var env = Env([0.0, 0.5, 0.0, 1.0, 0.9, 0.0], [0.05, 0.1, 0.01, 1.0, 1.5], -4);\n var envgen = EnvGen.ar(env, doneAction: Done.freeSelf);\n env.plot;\n SinOsc.ar(\n envgen * 1000 + 440\n ) * envgen * 0.1\n}.play\n;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var env = Env([0.0, 0.5, 0.0, 1.0, 0.9, 0.0], [0.05, 0.1, 0.01, 1.0, 1.5], -4);\n var envgen = EnvGen.ar(env, doneAction: Done.freeSelf);\n env.plot;\n SinOsc.ar(\n envgen * 1000 + 440\n ) * envgen * 0.1\n}.play\n);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Another Star Wars inspired sound effect."}, {"role": "assistant", "content": "```supercollider\n(\n\n{\n\nvar flutter, flutterAmt = 0.02, humPitch = 88, hum, humLevel = 0.3, amp = 1.0, output;\nvar swing, swingNoise, swingLevel = 1.0, swingSwitch, swingThresh = 0.87;\nvar clash, clashTrig, clashDecay, clashEnvGen, clashSpring, clashLevel = 0.6;\n\nflutter = 4.collect(\n { \n |i|\n LFNoise0.kr(rrand(3, 16), flutterAmt, 1).lag(0.48);\n }\n);\n\nhumPitch = humPitch * StandardL.ar(2, 3.7).range(0.97, 1.03);\n\nhum = Mix(SyncSaw.ar([humPitch, humPitch * 1.001] * flutter.copyRange(0, 1), [humPitch * 1.003, humPitch * 1.0025] * flutter.copyRange(2, 3)));\nhum = hum * LFNoise0.kr(8.77224).range(0.2, 1.0).lag(0.4);\nhum = RLPF.ar(hum, LFNoise0.kr(21).range(200, 1800).lag(1.2), 0.5) * 0.1 * humLevel;\n\nhumPitch = humPitch * StandardL.ar(3.8, 2.9).range(0.93, 1.07);\n\nswingNoise = LFNoise1.kr(16.2).range(0, 1);\nswingSwitch = if(swingNoise > swingThresh, 1, 0).lag2(0.9, 1.3);\nswingLevel = swingLevel * swingSwitch;\n\nhumPitch = humPitch * StandardL.ar(3.8, 2.9).range(0.97, 1.03) * (1 + (swingSwitch * 0.2));\n\nswing = SyncSaw.ar(humPitch * 0.501, humPitch * 1.09);\nswing = LPF.ar(swing, 4300);\nswing = swing * swingLevel;\n\nclashTrig = Trig.kr(\n Schmidt.kr(1 - swingSwitch, swingThresh, swingThresh + 0.01),\n 0.01\n);\n\nclashDecay = TRand.kr(0.1, 1.6, clashTrig);\nclashEnvGen = Decay.kr(clashTrig, clashDecay) * TRand.kr(0.8, 1.0, clashTrig);\nclashSpring = Spring.kr(clashTrig, TRand.kr(5, 20, clashTrig), TRand.kr(0.001, 0.07, clashTrig));\nclash = SinOsc.ar(8000 * clashSpring + TRand.kr(600, 2342, clashTrig), SinOsc.ar(TRand.kr(452, 662, clashTrig), 0, 2));\nclash = clash + BPF.ar(WhiteNoise.ar(2), SinOsc.kr(2.6).range(3326, 4444), 0.16);\nclash = clash * clashEnvGen;\nclash = clash + ( clash * SinOsc.ar(39) * SinOsc.ar(3013) * 0.3);\nclash = clash * 0.1 * clashLevel;\n\noutput = hum + swing + clash; \n\n(output * amp) ! 2\n\n}.play\n\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Integer.numBits` do?"}, {"role": "assistant", "content": "32-bit Integer number Returns: number of required bits"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Re: midified arpeggiator/auto-accompaniment using patterns?"}, {"role": "assistant", "content": "```supercollider\n(\ns.waitForBoot({\n var right, left;\n\n MIDIdef.freeAll;\n if (~midi_initilized.isNil) {\n MIDIClient.init;\n MIDIIn.connectAll;\n ~midi_initialized = 1;\n };\n\n ~n = (\n table: Order(),\n noteOn: {|n,note| n.table[note] = 1},\n noteOff: {|n,note| n.table.removeAt(note)},\n get: {|n,i| \n n.table.indices[i] ?? n.table.indices.first ?? Rest(1)\n },\n seq: {|n,notes|\n notes.asArray.collect{|i| Plazy{n.get(i)}}\n }\n );\n \n MIDIdef.noteOn(\n \\mynoteonhandler, // just a name for this handler\n {\n |val, num, chan, src|\n ~n.noteOn(num)\n }\n );\n\n MIDIdef.noteOff(\n \\mynoteoffhandler, // just a name for this handler\n {\n |val, num, chan, src|\n ~n.noteOff(num) // update note table and update ~n\n /*\n // only enable the following lines if you want the arpeggio to stop as soon as you release the keys\n ~n.table.clear\n */\n }\n );\n\n right = Pbind(\n \\instrument, \\default,\n \\midinote, Pseq(~n.seq(\n [ 0, 2, 1, 2] ++ (([ 0, 2, 1, 2] + 12)!2).flatten\n )),\n \\dur, 2*Pseq([1, 1, 1, 1, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5 ].normalizeSum)\n );\n left = Pbind(\n \\instrument, \\default,\n \\midinote, Pseq(~n.seq([ 0, 2, 0, 2, 0, 2, 0, 2] - 12)),\n \\dur, 2*Pseq([1, 1, 1, 1, 1, 1, 1, 1].normalizeSum)\n );\n if (~player.notNil) { ~player.stop; };\n ~player = Pn(Ppar([right,left])).play;\n});\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `PMantissaMask` in SuperCollider briefly."}, {"role": "assistant", "content": "PMantissaMask — UGenPatterns quark library Based on MantissaMask Category: Streams-Patterns-Events > UGenPatterns > Generators."}]} -{"conversations": [{"role": "user", "content": "My pattern keeps playing after I press Ctrl+."}, {"role": "assistant", "content": "Ctrl+. (CmdPeriod) stops everything scheduled on the clocks, including Patterns. If yours survives, it is not scheduled on a clock — most often it is a `Synth` created directly, or a `Task`/`Routine` started on `SystemClock` in a way that outlived the period. Do you still see the node in `s.plotTree`?"}, {"role": "user", "content": "Yes, there's a synth."}, {"role": "assistant", "content": "Then the sound is a node, not a pattern: `s.freeAll` will stop it. The likely cause is a SynthDef whose EnvGen has no `doneAction`, or a drone with `gate = 1` that nothing releases. Add `doneAction: 2` to the envelope, or keep a reference and `x.set(\\gate, 0)` when you want it to end."}]} -{"conversations": [{"role": "user", "content": "Explain `PmonoPar` in SuperCollider briefly."}, {"role": "assistant", "content": "PmonoPar — monophonic event pattern for an arbitrary number of timed setting streams This is similar to Pmono, but allows an arbitrary number of differently timed setting streams in parallel. Category: Libraries > miSCellaneous > Other patterns."}]} -{"conversations": [{"role": "user", "content": "What does doneAction do?"}, {"role": "assistant", "content": "It tells the server what to do to the enclosing Synth when the UGen finishes. The one that matters most is `doneAction: 2`, which frees the Synth: that is how a percussive sound cleans itself up instead of leaking silent nodes. `doneAction: 0` does nothing, so the Synth keeps running. EnvGen, Line, XLine, LinePan and friends all accept it, which is why `EnvGen.kr(Env.perc(0.01, 1), doneAction: 2)` is the standard envelope idiom."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes sclang fun )."}, {"role": "assistant", "content": "```supercollider\n( // whatever\nNdef(\\ff_twist, {\n var tempo = 156/60;//TempoClock.tempo;\n var bands = 4.rrand(16).debug('bands');\n var sync = bands.factors.scramble.pop.debug('sync');\n var gen = [LFNoise1,LFNoise2,LFNoise0];\n var sig = Splay.ar(\n VarSaw.ar(//LFSaw.kr(Array.rand(bands/sync, 8, 390).stutter(sync)).range(0.97,1.03) * \n Array.exprand(bands, 50, 400) * ({ gen.choose.kr(1/1.rrand(10)).exprange(1, 10) } ! (bands/sync)).stutter(sync), \n 0, \n { gen.choose.kr(1/1.rrand(10)).range(0.1,1) } ! bands, \n { gen.choose.kr(1/1.rrand(10)).range(0.1,1) } ! bands\n ) * ({ EnvGen.kr(Env.perc(0.008.exprand(0.03), tempo.reciprocal / [1,2,4,8].choose, 1, rrand(-7,-1.0)).circle) } ! (bands/sync)).stutter(sync)\n );\n sig = sig * 0.7 + GVerb.ar(sig, mul:0.3);\n sig = Rotate2.ar(\n sig[0], sig[1], \n LFSaw.kr( Duty.kr(tempo.reciprocal * (2,8..24).choose, 0, Drand((1..4)*tempo, inf)) )\n );\n sig;\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Plotter`?"}, {"role": "assistant", "content": "Plotter — Plot numerical data on a window or view"}, {"role": "user", "content": "What does `Plotter.plotGraph` do?"}, {"role": "assistant", "content": "`{ |x| sin(x) }.plotGraph(300, 0, 2*pi);`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\na = { (0..10).scramble.normalize }.dup(2).plot;\na.editMode = true;\na.editFunc = { |...args| args.postln };\n);\n\n// using plotter as a control interface\n(\na = { (0..10).scramble.normalize(300, 400) }.dup.plot;\na.specs = \\freq; a.plotMode = \\bars;\na.editMode = true;\nx = {\n var phase = SinOsc.ar(\\rate.kr(a.value[1]));\n SinOsc.ar(\\freq.kr(a.value[0]), phase).mean * 0.1\n}.play;\na.editFunc = { |plotter, plotIndex, i, val|\n x.setn(\\freq, a.value[0]);\n x.setn(\\rate, a.value[1]);\n};\na.parent.onClose = { x.release };\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// as a frequency control\n{ SinOsc.ar(StandardL.ar(40, MouseX.kr(0.9, 4))*800+900)*0.4 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// as a frequency control\n{ SinOsc.ar(StandardL.ar(40, MouseX.kr(0.9, 4))*800+900)*0.4 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes sclang fun )."}, {"role": "assistant", "content": "```supercollider\n( // whatever\nNdef(\\ff_twist, {\n var tempo = 156/60;//TempoClock.tempo;\n var bands = 4.rrand(16).debug('bands');\n var sync = bands.factors.scramble.pop.debug('sync');\n var gen = [LFNoise1,LFNoise2,LFNoise0];\n var sig = Splay.ar(\n VarSaw.ar(//LFSaw.kr(Array.rand(bands/sync, 8, 390).stutter(sync)).range(0.97,1.03) * \n Array.exprand(bands, 50, 400) * ({ gen.choose.kr(1/1.rrand(10)).exprange(1, 10) } ! (bands/sync)).stutter(sync), \n 0, \n { gen.choose.kr(1/1.rrand(10)).range(0.1,1) } ! bands, \n { gen.choose.kr(1/1.rrand(10)).range(0.1,1) } ! bands\n ) * ({ EnvGen.kr(Env.perc(0.008.exprand(0.03), tempo.reciprocal / [1,2,4,8].choose, 1, rrand(-7,-1.0)).circle) } ! (bands/sync)).stutter(sync)\n );\n sig = sig * 0.7 + GVerb.ar(sig, mul:0.3);\n sig = Rotate2.ar(\n sig[0], sig[1], \n LFSaw.kr( Duty.kr(tempo.reciprocal * (2,8..24).choose, 0, Drand((1..4)*tempo, inf)) )\n );\n sig;\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `PbindProxy.at` do?"}, {"role": "assistant", "content": "return a pattern at that key. this can be used to set quant value individually, so different elementary patterns can be quantized differently. `x.at(\\freq).quant ="}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Linear Mess #1 (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n~buffer = Buffer.read(s, \"/Users/a---/Desktop/archive/_solfège/solfège soundMusic/musica electronica/solfège electroacoustic/triptych part 1/37/Solfegge Sound Processing, And Sample Bank For Live Electronics #37 - 17 (the stems).aiff\");\n\n(\n{\n~a={Warp1.ar(~buffer.numChannels, ~buffer.bufnum, LFDNoise0.kr(0.125) + TRand.kr(0, 0.01, Impulse.kr(40)), 1, 20, overlaps: 1, interp: 4, mul: 0.6)};\n~b={Warp1.ar(~buffer.numChannels, ~buffer.bufnum, LFDNoise0.kr(0.125) + TRand.kr(0, 0.01, Impulse.kr(40)), 2, 20, overlaps: 1, interp: 4, mul: 0.6)};\n~c={Warp1.ar(~buffer.numChannels, ~buffer.bufnum, LFDNoise0.kr(0.125) + TRand.kr(0, 0.01, Impulse.kr(40)), 0.125, 20, overlaps: 1, interp: 4, mul: 0.6)};\n~d={PlayBuf.ar(~buffer.numChannels, ~buffer.bufnum, 1, 1, loop:1)};\n~e={PlayBuf.ar(~buffer.numChannels, ~buffer.bufnum, 2, 1, loop:1)};\n~f={PlayBuf.ar(~buffer.numChannels, ~buffer.bufnum, 0.125, 1, loop:1)};\n ~f2={PlayBuf.ar(~buffer.numChannels, ~buffer.bufnum, 0.125, ((LFDNoise0.kr(19)*2)+0.125), loop:1)};\n\n ~g={Warp1.ar(~buffer.numChannels, ~buffer.bufnum, SinOsc.kr(0.0001) + TRand.kr(0, 0.01, Impulse.kr(40)), 1, 0.2, overlaps: 1, interp: 4, mul: 0.3)};\n~h={Warp1.ar(~buffer.numChannels, ~buffer.bufnum, SinOsc.kr(0.0001) + TRand.kr(0, 0.01, Impulse.kr(40)), 2, 0.2, overlaps: 1, interp: 4, mul: 0.3)};\n~i={Warp1.ar(~buffer.numChannels, ~buffer.bufnum, SinOsc.kr(0.0001) + TRand.kr(0, 0.01, Impulse.kr(40)), 0.125, 0.2, overlaps: 1, interp: 4, mul: 0.3)};\n ~j={Resonz.ar(GVerb.ar(WhiteNoise.ar(SinOsc.kr(SinOsc.kr(0.005))) * 0.03), 432)};\n ~k={GVerb.ar(Resonz.ar(Dust.ar(1), 432))};\n\n Out.ar(0, ~a+~b+~c+~d+~e+~f+~g+~h+~i+~j+~k+~f2);\n}.scope\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Snow (a SuperCollider snippet)?"}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\snow, { arg freq=200, pan=0, amp=0.1, speed=1;\n var sig;\n var size = 20;\n var trig = Impulse.ar({ rrand(1/1,15.0) } ! size * \\density.kr(1));\n sig = { WhiteNoise.ar } ! size;\n sig = sig.collect({ arg sig, x;\n var bpfreq = exprand(50.0,16000) * \\tone.kr(1);\n var bpfrq = 0.1 * SinOsc.ar(( x+1 ) * 1/153 * speed).exprange(0.1,4) * \\blur.kr(1);\n sig = BPF.ar(sig, bpfreq, bpfrq) * 34;\n sig = BPF.ar(sig, bpfreq, bpfrq) * 4;\n sig = sig * EnvGen.ar(Env([0,1,0],[0.1,0.8]), trig[x]);\n //sig = sig.fold2( LFNoise0.kr(1/23 * ( x+1 ) * speed).range(0.01,8) ) * 4;\n sig = sig * SinOsc.ar(1/700 * ( x+1 ) * speed).range(0.01,1);\n });\n sig = Pan2.ar(sig, ( { rrand(-1.0,1) } ! size * SinOsc.ar(1/132 * (1..size) * speed).range(0,1) ), amp).mean;\n}).play;\n);\nNdef(\\snow).fadeTime = 16;\nNdef(\\snow).edit;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var a, freq, trig;\n a = Dswitch1([1, 3, MouseY.kr(1, 15), 2, Dwhite(0, 3, 2)], MouseX.kr(0, 4));\n trig = Impulse.kr(3);\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n);\n\n(\n{\n var a, freq, trig;\n a = Dswitch1({ |i| Dseq((0..i*3), inf) } ! 5, MouseX.kr(0, 4));\n trig = Impulse.kr(6);\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var a, freq, trig;\n a = Dswitch1([1, 3, MouseY.kr(1, 15), 2, Dwhite(0, 3, 2)], MouseX.kr(0, 4));\n trig = Impulse.kr(3);\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n);\n\n(\n{\n var a, freq, trig;\n a = Dswitch1({ |i| Dseq((0..i*3), inf) } ! 5, MouseX.kr(0, 4));\n trig = Impulse.kr(6);\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Blip.ar(Blip.kr(4, 5, 500, 60), 59, 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Blip.ar(Blip.kr(4, 5, 500, 60), 59, 0.1) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n{Mix({|i|var j=Impulse,t=TChoose.kr(j.kr(1/8),[1,6,3]/8),r=Ringz.ar(j.ar(i*t+0.25),600*t*i+[0,9]);CombC.ar(r,1,0.5,4,0.1,r)}!4).tanh/4}.play\n```"}, {"role": "assistant", "content": "Hi colliders, this is my first post here, and also my very first sc tweet! \r\nIt's nothing special, just a little rhythmic Ringz thingy...\r\nAs a beginner, I found this really useful getting the hang of some syntax shortcuts:\r\nhttp://schemawound.com/post/25710867587/supercollider-tweets-background-tips."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\nx = { SinOsc.ar((Line.kr(0, 10, 10).snap(1, 0.3, 1) + 60).poll.midicps, 0, -24.dbamp }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\nx = { SinOsc.ar((Line.kr(0, 10, 10).snap(1, 0.3, 1) + 60).poll.midicps, 0, -24.dbamp) }.play\n```"}]} -{"conversations": [{"role": "user", "content": "What is `ProxySpace`?"}, {"role": "assistant", "content": "ProxySpace — an environment of references on a server"}, {"role": "user", "content": "What does `ProxySpace.push` do?"}, {"role": "assistant", "content": "replace the currentEnvironment with a new ProxySpace and clear the current one, if it is a ProxySpace (this is to avoid piling up proxy spaces). In order to move to another ProxySpace while keeping the current, use pop and then push a new one. To have multiple levels of proxy spaces, use .new.push;"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\np = ProxySpace.new;\np.fadeTime = 2; // fadeTime specifies crossfade\np[\\out].play; // monitor an empty placeholder through hardware output\n// set its source\np[\\out] = { SinOsc.ar([350, 351.3], 0, 0.2) };\np[\\out] = { Pulse.ar([350, 351.3] / 4, 0.4) * 0.2 };\np[\\out] = Pbind(\\dur, 0.03, \\freq, Pbrown(0, 1, 0.1, inf).linexp(0, 1, 200, 350));\n\n// route one proxy through another:\np[\\out] = { Ringz.ar(p[\\in].ar, [350, 351.3] * 8, 0.2) * 4 };\np[\\in] = { Impulse.ar([5, 7]/2, [0, 0.5]) };\n\np.clear(3); // clear after 3 seconds\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// crucial-library - sends midi clock and song position pointer\n// x.add( MIDIClockOut(\"IAC Driver\", \"IAC Bus 1\") )\n\nMxUnit.register('MIDIClockOut',\n(\n make: { arg mco;\n ~source = mco;\n MxUnit(mco, [], [])\n },\n spawnToBundle: { arg b;\n b.addFunction({~source.start}.inEnvir)\n },\n stopToBundle: { arg b;\n b.addFunction({~source.stop}.inEnvir)\n }\n /*,\n gotoBeat: { arg beat, atBeat, bundle;\n [beat, atBeat, bundle].debug;\n ~source.gotoBeatAtBeat(beat, atBeat)\n }*/\n\n));\n```"}, {"role": "assistant", "content": "crucial-library - sends midi clock and song position pointer x.add( MIDIClockOut(\"IAC Driver\", \"IAC Bus 1\") )."}]} -{"conversations": [{"role": "user", "content": "What does `NodeMap.unmapArgsToBundle` do?"}, {"role": "assistant", "content": "returns the arguments for an OSC message to unmap any mapped"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nf.add(p.asStream, 40\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nf.add(p.asStream, 40)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ControlName`."}, {"role": "assistant", "content": "```supercollider\n(\nd = SynthDef(\\tone, { |out = 0, freq = 200|\n var sig;\n\n freq.spec = ControlSpec(20, 20000);\n sig = SinOsc.ar(freq);\n\n Out.ar(out, sig);\n}).add;\n);\n\nd.specs.freq.postln;\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Pattern transcription of intro chords of this song."}, {"role": "assistant", "content": "```supercollider\n// Crystal Waters \"Gypsy Woman (She's Homeless)\" - chords\n(\n~bpm = TempoClock.new(120/60);\nPbind(\n \\midinote, Pseq([\n Pn([45, 57, 67, 72, 76], 2),\n Pn([46, 58, 69, 74, 77], 3),\n Pn([43, 55, 67, 70, 74, 77], 2), \n Pn([48, 60, 67, 70, 73, 76], 3),\n Pseq([\n Pn([50, 62, 65, 69, 72, 76], 2),\n Pn([50, 62, 65, 69, 72, 74], 3)\n ], 2),\n Pn([45, 57, 67, 72, 76], 2),\n Pn([46, 58, 69, 74, 77], 3),\n Pn([52, 64, 76, 79, 83, 86], 2),\n Pn([51, 63, 75, 79, 82, 86], 3),\n Pseq([\n Pn([50, 62, 65, 69, 72, 76], 2),\n Pn([50, 62, 65, 69, 72, 74], 3)\n ], 2),\n ], inf),\n \\ctranspose, -12,\n \\dur, Pseq([1, Pn(3/4, 4)], inf),\n \\amp, 0.2,\n \\legato, Pseq([0.5, 0.5, Pwhite(0.2, 0.3, 3)], inf)\n).play(~bpm);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes SyncSaw madness."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\fun, {\n var src, freq = 25;\n var lagTime = \\lagTime.kr(0);\n var vibrato = \\vibrato.kr([ 1.3515662384033, 1.3061940193176, 0.604791264534, 1.2328997278214, 0.33569867610931, 0.40528120040894, 1.0865307760239, 1.22394572258, 1.7781081724167, 0.15319232463837 ], lagTime);\n \n var vibRatio = \\vibRatio.kr([ 2.9047239411079, 0.39578121743921, 0.10932490532285, 0.051738858660565, 0.17840235868831, 0.024495380749894, 3.9689920754869, 4.1139229659643, 0.23327501819885, 0.97643604193256 ], lagTime);\n \n var freqVary = \\freqVary.kr([ 143.76541377614, 14.25479545154, 6.6728691888342, 58.434807398325, 154.89385962072, 34.112274650688, 3.1140823758236, 10.42040949808, 158.59959972037, 1.2163188440936 ], lagTime);\n \n \n var numSrcs = vibrato.size;\n\n src = numSrcs.collect{|i|\n var freq2 = (freq * freqVary[i]) * LFNoise2.kr(0.01).range(1, 1.5);\n     \n SyncSaw.ar(freq2, freq2 * SinOsc.ar(Line.kr(1, vibrato[i], 20) * vibRatio[i], Rand(0, 0.8)).range(pi, pi * 0.1)) * rrand(0.05, 0.1)\n };\n \n src = Splay.ar(src);\n \n}).play\n);\n\nNdef(\\fun).fadeTime = 20;\n\nNdef(\\fun).rebuild\n\n(\nNdef(\\fun).setn(\n \\lagTime, [5],\n \\vibRatio, {exprand(0.1, 3)}!10,\n \\freqVary, {exprand(1, 150)}!10,\n \\vibrato, {exprand(0.3, 3)}!10\n)\n);\n(\nNdef(\\fun).setn(\n \\lagTime, [200],\n \\vibRatio, ({exprand(0.1, 3)}!10).sort,\n \\freqVary, ({exprand(1, 150)}!10).sort,\n \\vibrato, ({exprand(0.3, 3)}!10).sort\n)\n);\n\n(\nNdef(\\fun).xsetn(\n \\lagTime, [100],\n \\vibRatio, {exprand(0.1, 3)}!10,\n \\freqVary, {exprand(1, 150)}!10,\n \\vibrato, {exprand(0.3, 3)}!10\n))\n```"}]} -{"conversations": [{"role": "user", "content": "What does `MxQuery.channels` do?"}, {"role": "assistant", "content": "If a query set includes units or iolets then this will return a query set with just the channels that those items are Returns: an MxQuery with just channels"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nPbind(*[\n stepsPerOctave: Pstep(Pseq((2..12).mirror, inf), 12), // 3 - 12 tone e.t. scales\n note: Pseq((0..12).mirror, inf), // play full notes up and down\n ctranspose: Pwhite(-0.2, 0.2), // detune up to +-20 cents\n detune: Pwhite(-1.0, 1.0), // detune up to 1 Hz\n sustain: Prand([0.2, 0.2, 0.2, 4], inf), // notes last 0.2 or 4 seconds\n // 1 in 6 chance waits 0.8 seconds:\n dur: Prand([0.2, 0.2, 0.2, 0.2, 0.2, 0.8], inf),\n db: Pstep(P\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nPbind(*[\n stepsPerOctave: Pstep(Pseq((2..12).mirror, inf), 12), // 3 - 12 tone e.t. scales\n note: Pseq((0..12).mirror, inf), // play full notes up and down\n ctranspose: Pwhite(-0.2, 0.2), // detune up to +-20 cents\n detune: Pwhite(-1.0, 1.0), // detune up to 1 Hz\n sustain: Prand([0.2, 0.2, 0.2, 4], inf), // notes last 0.2 or 4 seconds\n // 1 in 6 chance waits 0.8 seconds:\n dur: Prand([0.2, 0.2, 0.2, 0.2, 0.2, 0.8], inf),\n db: Pstep(Pseq([-15, -25, -20, -25], inf), 0.8) // 4 beat accent structure\n]).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Nuclear Fallout (a SuperCollider snippet)?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n var saw, bpf;\n saw = Saw.ar(\n freq: [60,150],\n mul: LFPulse.kr(\n freq: [2,3],\n width: 0.15));\n \n { BPF.ar(\n in: WhiteNoise.ar(mul: 1),\n freq: 1000,\n rq: 0.9\n )\n}\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//This example requires the FluCoMa tools to be installed from::\n//https://www.flucoma.org/download/\n\n(\nAlga.boot({\n //Sine oscillator with frequency modulation\n a = AN({ SinOsc.ar(\\freq.kr(10) + \\fm.ar(0)) }).play(chans:2);\n\n //Sine oscillator\n b = AN({ SinOsc.ar(\\freq.kr(440)) });\n\n //Pitch analyser\n c = AN({ FluidPitch.kr(\\in.ar) });\n\n //Patch first oscillator into the pitch analyser.\n a >> c;\n\n //Patch the pitch analyser into the \\freq input of the second oscillator\n c >>.freq b;\n\n //Create feedback: patch b's output to a's \\fm input, mapping -1 / 1 to -200 / 300\n a.from(b, \\fm, scale:[-200, 300], time:0.5);\n});\n);\n\n//Try with different scalings (change the values)\na.from(b, \\fm, scale:[-1432, 679], time:3);\n\n//Try new base frequencies (change the value)\na.from(100, \\freq, time:2);\n\n//Bye bye\n(\na.clear({\n b.clear;\n c.clear;\n}, time:3)\n);\n```"}, {"role": "assistant", "content": "This example requires the FluCoMa tools to be installed from https://www.flucoma.org/download/."}]} -{"conversations": [{"role": "user", "content": "What is the difference between the language and the server?"}, {"role": "assistant", "content": "sclang runs your code, the clock and Patterns, and builds UGen graphs. scsynth performs the DSP in real time. They communicate over OSC, which is why a language-side mistake can leave a sound running, and why s.freeAll stops it."}]} -{"conversations": [{"role": "user", "content": "What does `AbstractSFP.bpm` do? What arguments does it take?"}, {"role": "assistant", "content": "base class for SoundFilePlayer classes Arguments: b."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for reflection on seasonal change )."}, {"role": "assistant", "content": "```supercollider\n(\n{ \n LPF.ar(\n DynKlank.ar(\n `[[900, 971, 1153, 1823, 1401], nil, [\n SinOsc.kr(0.2).range(0.1,1), \n SinOsc.kr(0.6).range(0.1,1), \n SinOsc.kr(0.8).range(0.1,1), \n SinOsc.kr(1.2).range(0.1,1), \n SinOsc.kr(2).range(0.1,1)]\n ], \n Limiter.ar(Dust.ar(2, 0.65) + Impulse.ar(1,0,0.9))\n )\n ) ! 2 \n}.play;\n{ \n Pan2.ar(\n DynKlank.ar(`[[800, 1071, 1353, 723 + SinOsc.ar(SinOsc.ar(0.2).range(0, 10)).range(0,330)], nil, [1, 1, 0.5, 1]], PinkNoise.ar(0.007)),\n TRand.kr(-1, 1, trig: Pulse.ar(10))\n )\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// decoder - make sure you boot the server first!!\n~decoder = FoaDecoderKernel.newCIPIC\n\n// inspect\n~decoder.kernelSize\n\n// calculate delay in samples\n(~decoder.kernelSize-1)/2 + ~decoder.kernelSize - s.options.blockSize\n\n// calculate delay in seconds\n((~decoder.kernelSize-1)/2 + ~decoder.kernelSize - s.options.blockSize / s.sampleRate\n\n// don't forget to free!!\n~decoder.free\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// decoder - make sure you boot the server first!!\n~decoder = FoaDecoderKernel.newCIPIC\n\n// inspect\n~decoder.kernelSize\n\n// calculate delay in samples\n(~decoder.kernelSize-1)/2 + ~decoder.kernelSize - s.options.blockSize\n\n// calculate delay in seconds\n((~decoder.kernelSize-1)/2 + ~decoder.kernelSize - s.options.blockSize) / s.sampleRate\n\n// don't forget to free!!\n~decoder.free\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Henon2DN.ar(SampleRate.ir/4, SampleRate.ir, MouseX.kr(1,1.4), MouseY.kr(0,0.3)) * 0.2 }.play(s);\n\n(\n{ Henon2DN.ar(\n 2200, 8800,\n LFNoise2.kr(1, 0.2, 1.2),\n LFNoise2.kr(1, 0.15, 0.15)\n) * 0.2 }.play(s);\n)\n\n{ SinOsc.ar(Henon2DN.ar(20, 40, MouseX.kr(1,1.4), MouseY.kr(0,0.3))*800+900)*0.4 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Henon2DN.ar(SampleRate.ir/4, SampleRate.ir, MouseX.kr(1,1.4), MouseY.kr(0,0.3)) * 0.2 }.play(s);\n\n(\n{ Henon2DN.ar(\n 2200, 8800,\n LFNoise2.kr(1, 0.2, 1.2),\n LFNoise2.kr(1, 0.15, 0.15)\n) * 0.2 }.play(s);\n)\n\n{ SinOsc.ar(Henon2DN.ar(20, 40, MouseX.kr(1,1.4), MouseY.kr(0,0.3))*800+900)*0.4 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "What is `ControlPatchIn` in SuperCollider?"}, {"role": "assistant", "content": "ControlPatchIn — manages a Player's input when connecting to other Players Category: Libraries > crucial > internals."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Another Star Wars inspired sound effect."}, {"role": "assistant", "content": "```supercollider\n(\n\n{\n\nvar flutter, flutterAmt = 0.02, humPitch = 88, hum, humLevel = 0.3, amp = 1.0, output;\nvar swing, swingNoise, swingLevel = 1.0, swingSwitch, swingThresh = 0.87;\nvar clash, clashTrig, clashDecay, clashEnvGen, clashSpring, clashLevel = 0.6;\n\nflutter = 4.collect(\n { \n |i|\n LFNoise0.kr(rrand(3, 16), flutterAmt, 1).lag(0.48);\n }\n);\n\nhumPitch = humPitch * StandardL.ar(2, 3.7).range(0.97, 1.03);\n\nhum = Mix(SyncSaw.ar([humPitch, humPitch * 1.001] * flutter.copyRange(0, 1), [humPitch * 1.003, humPitch * 1.0025] * flutter.copyRange(2, 3)));\nhum = hum * LFNoise0.kr(8.77224).range(0.2, 1.0).lag(0.4);\nhum = RLPF.ar(hum, LFNoise0.kr(21).range(200, 1800).lag(1.2), 0.5) * 0.1 * humLevel;\n\nhumPitch = humPitch * StandardL.ar(3.8, 2.9).range(0.93, 1.07);\n\nswingNoise = LFNoise1.kr(16.2).range(0, 1);\nswingSwitch = if(swingNoise > swingThresh, 1, 0).lag2(0.9, 1.3);\nswingLevel = swingLevel * swingSwitch;\n\nhumPitch = humPitch * StandardL.ar(3.8, 2.9).range(0.97, 1.03) * (1 + (swingSwitch * 0.2));\n\nswing = SyncSaw.ar(humPitch * 0.501, humPitch * 1.09);\nswing = LPF.ar(swing, 4300);\nswing = swing * swingLevel;\n\nclashTrig = Trig.kr(\n Schmidt.kr(1 - swingSwitch, swingThresh, swingThresh + 0.01),\n 0.01\n);\n\nclashDecay = TRand.kr(0.1, 1.6, clashTrig);\nclashEnvGen = Decay.kr(clashTrig, clashDecay) * TRand.kr(0.8, 1.0, clashTrig);\nclashSpring = Spring.kr(clashTrig, TRand.kr(5, 20, clashTrig), TRand.kr(0.001, 0.07, clashTrig));\nclash = SinOsc.ar(8000 * clashSpring + TRand.kr(600, 2342, clashTrig), SinOsc.ar(TRand.kr(452, 662, clashTrig), 0, 2));\nclash = clash + BPF.ar(WhiteNoise.ar(2), SinOsc.kr(2.6).range(3326, 4444), 0.16);\nclash = clash * clashEnvGen;\nclash = clash + ( clash * SinOsc.ar(39) * SinOsc.ar(3013) * 0.3);\nclash = clash * 0.1 * clashLevel;\n\noutput = hum + swing + clash; \n\n(output * amp) ! 2\n\n}.play\n\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nb = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n\n// This is very cool!\n\n(\n{\n Spring.ar(PlayBuf.ar(1, b, loop: 1)*Saw.ar(4));\n}.play;\n)\n```"}, {"role": "assistant", "content": "Feeding sound file multiplied by a slow saw wave into the spring physical model. Fascinating results ensue."}]} -{"conversations": [{"role": "user", "content": "Buffer.read fails and I get a path error. What should the path look like?"}, {"role": "assistant", "content": "On Windows use forward slashes or escaped backslashes inside the string: `Buffer.read(s, \"C:/sounds/kick.wav\")`. A single backslash starts an escape sequence, which is why `\"C:\\sounds\\kick.wav\"` fails. Also check the extension is real (`.wav`, `.aiff`, `.flac`) and that the file is not on a network path — the server reads it, not the language, and it may resolve differently. For sounds that ship with SuperCollider, `Platform.resourceDir +/+ \"sounds/a11wlk01.wav\"` is the portable form."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// the same, using hang\n\n(\nc = Condition.new;\n\nRoutine {\n 1.wait;\n \"waited for 1 second\".postln;\n 1.wait;\n \"waited for another second, now waiting for you ... \".postln;\n c.hang;\n \"the condition has stopped waiting.\".postln;\n 1.wait;\n \"waited for another second\".postln;\n \"waiting for you ... \".postln;\n c.hang;\n \"the condition has stopped waiting.\".postln;\n}.play;\n;\n\n// continue\nc.unhang;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// the same, using hang\n\n(\nc = Condition.new;\n\nRoutine {\n 1.wait;\n \"waited for 1 second\".postln;\n 1.wait;\n \"waited for another second, now waiting for you ... \".postln;\n c.hang;\n \"the condition has stopped waiting.\".postln;\n 1.wait;\n \"waited for another second\".postln;\n \"waiting for you ... \".postln;\n c.hang;\n \"the condition has stopped waiting.\".postln;\n}.play;\n);\n\n// continue\nc.unhang;\n```"}]} -{"conversations": [{"role": "user", "content": "Speech to midi converter?"}, {"role": "assistant", "content": "SuperCollider forum — Speech to midi converter?\n\nHello!\n\nI want to make a speech to midi converter in Supercollider.\n\nI’ve started off trying to find a way to convert FFT data to midi-numbers to send to a midi-instrument, but I’m stuck:\n\n```supercollider\n~file = Buffer.read(s, \"path_to_file\", bufnum:1);\n\n(\n{\n var buf = Buffer.alloc(s, 2048, bufnum:2);\n var sig = PlayBuf.ar(2, 1, loop:1);\n var chain = FFT(buf, sig);\n var trig = Impulse.kr(30);\n chain[0].pvcalc(80, {\n |phas, mag|\n SendReply.kr(trig, \"/anal\", mag);\n });\n}.play\n);\n\n(\nOSCdef.new(\\midiConverter, {\n |msg|\n msg.postln;\n}, \"/anal\");\n)\n```\n\nthe output looks like this:\n\n[ /anal, 1000, -1, 0.0, 3.0463190078735, 2.1142015457153, -0.64955651760101, 2.3432319164276, -0.23956227302551, -3.1334409713745, -2.1829152107239, 1.1417833566666, -2.2972648143768, -0.74415707588196, -0.88793164491653, 1.9947071075439, -1.1327115297318, 2.6084003448486, etc...]\n\nI’m not sure how to interpret theese numbers. And I’m not sure pvcalc is even the best way to get the data I need. I want to somehow be able to control the resolution on how many of the loudest bins I’m going to convert to frequency and then from frequency to midi-number to send to a midi-instrument as the soundfile plays through.\n\nAny ideas?"}]} -{"conversations": [{"role": "user", "content": "Explain `GrainBuf` in SuperCollider briefly."}, {"role": "assistant", "content": "GrainBuf — Granular synthesis with sound stored in a buffer Category: UGens > Buffer, UGens > Generators > Granular."}]} -{"conversations": [{"role": "user", "content": "What is the difference between ~foo and a local variable?"}, {"role": "assistant", "content": "`var foo` is a local: it exists only inside the function or file block that declares it. `~foo` is an environment variable: it lives in the current Environment, survives between executions of the same block, and is visible to everything running in that environment. That is why `~buf = Buffer.read(s, path)` works in one cell and `PlayBuf.ar(1, ~buf)` works in the next, while a `var` would be gone."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Polyrhythmic and dynamic FM drone."}, {"role": "assistant", "content": "```supercollider\n// https://recarteblog.wordpress.com/\n//droneFM01\n\n// 1. Añadir al servidor\n(\nSynthDef(\\droneFM, {\n arg f1Freq=0.1, f2Freq=1.1, f3Freq=2.2, nFreq=440, m1Ratio=1, m2Ratio=2, m3Ratio=3,\n amp=0.1, dur=55, ampM=0.84 , pan=0;\n var sig, car1, mod1, car2, mod2, car3, mod3, env, index;\n index = LFNoise1.kr(0.2).range(2, 12);\n env = EnvGen.kr(Env.new([0, 0.70, 0.70, 0], [dur*0.333, dur*0.333, dur*0.333]), doneAction:2);\n mod1 = SinOsc.ar([nFreq * m1Ratio, nFreq+0.7 * m1Ratio], mul:nFreq * m1Ratio * index) * ampM;\n car1 = SinOsc.ar(f1Freq + mod1);\n mod2 = SinOsc.ar([nFreq * m2Ratio, nFreq+1.4 * m2Ratio], mul:nFreq * m2Ratio * index) * ampM;\n car2 = SinOsc.ar(f2Freq + mod2);\n mod3 = SinOsc.ar([nFreq * m3Ratio, nFreq+0.35 * m3Ratio], mul:nFreq * m3Ratio * index) * ampM;\n car3 = SinOsc.ar(f3Freq + mod3) * 0.4;\n sig = car1 + car2 + car3 * env * amp;\n sig = Pan2.ar(sig, pan);\n Out.ar(0, sig);\n}).add;\n);\n\n// 2. Ejecutar los Synths\n(\nSynth(\\droneFM, [\\nFreq, 50.midicps]);\nSynth(\\droneFM, [\\nFreq, 57.midicps]);\nSynth(\\droneFM, [\\nFreq, 41.midicps]);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Supernova, Groups, Threads, Ndef?"}, {"role": "assistant", "content": "SuperCollider forum — Supernova, Groups, Threads, Ndef?\n\nAbout Ndef:\n\nAFAIK you can manually move a NodeProxy’s group into another group:\n\n```supercollider\n~pargroup = ParGroup(s);\n\nNdef(\\a, { Silent.ar(1) });\n\nNdef(\\a).group.moveToHead(~pargroup);\n```\n\nBut...\n\nNodeProxies use InFeedback.\n\nI was a little suspicious about this for parallel processing. As I recalled, InFeedback’s result depends on the order of execution:\n\n-\nIf the source node for the bus finished processing before the server reaches InFeedback, then InFeedback will output the block of audio being processed now.\n\n-\nIf the source node comes after the node containing InFeedback, then it will output the previous block of audio.\n\nIn both cases, these are the most recently available audio blocks. But, if the order of evaluation is not consistent, then the output may not be consistent.\n\nLet’s test that:\n\n```supercollider\nb = Bus.audio(s, 1);\n\na = { SinOsc.ar(200, 0, 0.1) }.play(outbus: b);\n\nc = { InFeedback.ar(b, 1).dup }.play(target: a, addAction: \\addAfter);\n\n(\nfork {\n var order = Pseq([\\moveBefore, \\moveAfter], inf).asStream;\n loop {\n c.perform(order.next, a);\n 1.0.wait;\n }\n}\n)\n```\n\nOops.\n\nThis means you can’t randomly throw Ndefs into ParGroups. If one Ndef reads a signal from another, then you have to make sure that the target Ndef comes later in a serial (regular) Group. (Correctness of the result should be more important than “optimal” usage of multiple cores.)\n\nIf you don’t, and if supernova happens to put the source and target Ndefs onto separate cores at roughly the same time, then the target might evaluate InFeedback either before or after the source finishes, and there’s no guarantee of this being consistent. So you might get clicks.\n\nhjh"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// load a synthdef\ns.boot;\nSynthDef(\"pdef_grainlet\",\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.3), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n\nTdef(\\z, Pseq([1, 1, 1, 0.5, 0.5], inf));\n\n(\nPset(\\instrument, \\pdef_grainlet,\n Ppar([\n Pbind(\n \\dur, Tdef(\\z),\n \\note, Pseq([1, 3, 2, 1, 0], inf),\n \\x, Pfunc\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// load a synthdef\ns.boot;\nSynthDef(\"pdef_grainlet\",\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.3), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n\nTdef(\\z, Pseq([1, 1, 1, 0.5, 0.5], inf));\n\n(\nPset(\\instrument, \\pdef_grainlet,\n Ppar([\n Pbind(\n \\dur, Tdef(\\z),\n \\note, Pseq([1, 3, 2, 1, 0], inf),\n \\x, Pfunc { TempoClock.default.elapsedBeats.postln } // posts the onset times\n ),\n Pbind(\n \\dur, 4, // reference beat\n \\sustain, 0.1,\n \\note, 8\n )\n ])\n).play(quant: 1);\n);\n\n\nTdef(\\z, Prand([1, 1, 0.23, 0.5, 0.5], inf)); // exchange time pattern\nTdef(\\z, Pseq([1, 1, 1, 1], inf)); // pattern stays in sync.\nTdef(\\z, Pseq([1, 1, 1, 0.5, 0.5], inf)); // but might be in different order.\n // to avoid this, set quant to an appropriate value.\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// one last example\n(\nb = Buffer.alloc(s, 512, 1);\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, true, true);\n);\n\n(\n{\n var input = SoundIn.ar(0);\n var framesize = 512;\n Convolution2L.ar(input, b, 0, framesize, 1, 0.5);\n}.play\n;\n\nb.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// one last example\n(\nb = Buffer.alloc(s, 512, 1);\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, true, true);\n);\n\n(\n{\n var input = SoundIn.ar(0);\n var framesize = 512;\n Convolution2L.ar(input, b, 0, framesize, 1, 0.5);\n}.play\n);\n\nb.free;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// only works with the internal server\ns = Server.internal;\ns.boot;\n);\n\n(\nSynthDef(\"help-SharedIn1\", {\n Out.ar(0, SinOsc.ar(Lag.kr(SharedIn.kr(0, 1), 0.01), 0, 0.2));\n}).add;\nSynthDef(\"help-SharedIn2\", {\n Out.ar(1, SinOsc.ar(Lag.kr(SharedIn.kr(0, 1), 0.01, 1.5), 0, 0.2));\n}).add;\n);\n\n(\ns.setSharedControl(0, 300); // an initial value\ns.sendMsg(\\s_new, \"help-SharedIn1\", x = s.nextNodeID, 0, 1);\ns\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// only works with the internal server\ns = Server.internal;\ns.boot;\n);\n\n(\nSynthDef(\"help-SharedIn1\", {\n Out.ar(0, SinOsc.ar(Lag.kr(SharedIn.kr(0, 1), 0.01), 0, 0.2));\n}).add;\nSynthDef(\"help-SharedIn2\", {\n Out.ar(1, SinOsc.ar(Lag.kr(SharedIn.kr(0, 1), 0.01, 1.5), 0, 0.2));\n}).add;\n);\n\n(\ns.setSharedControl(0, 300); // an initial value\ns.sendMsg(\\s_new, \"help-SharedIn1\", x = s.nextNodeID, 0, 1);\ns.sendMsg(\\s_new, \"help-SharedIn2\", y = s.nextNodeID, 0, 1);\n\nRoutine({\n 30.do({\n s.setSharedControl(0, 300 * (10.rand + 1));\n 0.2.wait;\n });\n s.sendMsg(\\n_free, x);\n s.sendMsg(\\n_free, y);\n}).play;\n);\n\n\ns.quit;\n```"}]} -{"conversations": [{"role": "user", "content": "I made a synth and I hear nothing. Where do I start?"}, {"role": "assistant", "content": "Start with the node tree, not the code: evaluate `s.plotTree`. If your Synth is not there, it never started or it already freed itself; if it is there, the problem is in the signal. Which of the two do you see?"}, {"role": "user", "content": "It's in the tree."}, {"role": "assistant", "content": "Then the node lives and the signal is being lost. Check three things in order: does the SynthDef reach `Out.ar(0, ...)` with bus 0; is any `amp`/`mul` zero; and is a filter closed, e.g. `LPF.ar(sig, 50)` on a 440 Hz sine. Paste the SynthDef and I will read it."}, {"role": "user", "content": "SynthDef(\\x, { |out = 0| Out.ar(out, LPF.ar(Saw.ar(60), 80) * 0.1) }).add; Synth(\\x, [\\out, 2]);"}, {"role": "assistant", "content": "Two things. You wrote a low-pass at 80 Hz over a 60 Hz saw, which leaves almost nothing above the fundamental — the patch is nearly a sine at 60 Hz at very low level. And you passed `\\out, 2`, so it is going to bus 2, not the master. Try `Synth(\\x)` with the default out and a cutoff of 800:\n\n```supercollider\nSynthDef(\\x, { |out = 0, cutoff = 800| Out.ar(out, LPF.ar(Saw.ar(60), cutoff) * 0.1) }).add;\nSynth(\\x);\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n{ BufRd.ar(1, b, Sweep.ar(Impulse.ar(BufDur.kr(b).reciprocal), BufSampleRate.kr(b)) }.play;\n\nb.free\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n{ BufRd.ar(1, b, Sweep.ar(Impulse.ar(BufDur.kr(b).reciprocal), BufSampleRate.kr(b))) }.play;\n\nb.free\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n Ndef(\\x, {\n var output;\n var delayTime;\n var delayMax = 0.2;\n var delayAdd = 0.1;\n var pulseFreq = 0.5;\n var proxyMul = 2;\n var pulseMin = 40;\n var pulseMax = 130;\n var numOfEchos = 2;\n\n var mainPulse = LFPulse.ar(pulseFreq, 0, 0.5).range(pulseMin, pulseMax);\n var proxy = Ndef(\\x).ar * proxyMul;\n var ampModFreq = SinOsc.ar(0.01, 0).range(0.3, 30);\n var ampMod = LFNoise1.ar(ampModFreq, 6);\n output = SinOsc.ar(mainPulse + proxy, 0, ampMod).tanh;\n numOfEchos.do{\n delayTime = {delayMax.rand + delayAdd}!2;\n output = AllpassL.ar(output, 0.1, delayTime, 5);\n };\n output.tanh;\n }).play\n)\n```"}, {"role": "assistant", "content": "Something I put together a while back by forking Dark Sea Horns."}]} -{"conversations": [{"role": "user", "content": "What can you do?"}, {"role": "assistant", "content": "Write and explain SuperCollider: SynthDefs, UGens, Patterns, Ndef, buses and envelopes, and tell you why a patch is silent or will not compile. I am 198M parameters, so I am narrow on purpose."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nSynthDef(\\dubecho,{|in, out, length = 1, fb = 0.8, sep = 0.012|\n var input = In.ar(in, 2);\n var feedback = LocalIn.ar(2);\n var output = LeakDC.ar(feedback*fb + input);\n output = HPF.ar(output, 400);\n output = LPF.ar(output, 5000);\n output = output.tanh;\n LocalOut.ar(DelayC.ar(output, 1, LFNoise2.ar(12).range([length,length+sep],[length+sep,length])).reverse);\n ReplaceOut.ar(out, output);\n}).add;\n\n// Example as effecet bus\n~bus = Bus.audio(s, 2);\n~echo = Synth(\\dubecho, [\\in, ~bus, \\length, TempoClock.default.tempo*(3/8), \\fb, 0.7, \\sep, 0.0012], addAction: \\addToTail);\n\n// send something\nplay{ Out.ar(~bus, LFGauss.ar(1, 0.1, loop:0, doneAction:2) * Blip.ar(80!2, 8)) }\n\n// turn it off\n~echo.free;\n```"}, {"role": "assistant", "content": "Fork of Bjorn's Dub echo, rewritten w/o the Feedback Quark (using LocalIn + LocalOut) and adding a ping pong (can be removed by deleting the .reverse method in the LocalOut line)."}]} -{"conversations": [{"role": "user", "content": "What does `UGen.lag2` do?"}, {"role": "assistant", "content": "Wraps the receiver in a Lag2 UGen, smoothing its output by `t1` seconds lagtime. If a second argument is given, it wraps it in a Lag2UD"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ RLPFD.ar(Mix(LFSaw.ar([120, 180], 0, 0.33)), LinExp.kr(LFCub.kr(0.1, 0.5*pi), -1, 1, 280, 1500), 0.6, 0.5, mul:3.dup }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ RLPFD.ar(Mix(LFSaw.ar([120, 180], 0, 0.33)), LinExp.kr(LFCub.kr(0.1, 0.5*pi), -1, 1, 280, 1500), 0.6, 0.5, mul:3).dup }.play\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DigitalOut`."}, {"role": "assistant", "content": "```supercollider\n// write a sine oscillator's output to a pin\n\n(\nSynthDef(\"help-DigitalOut\", { |out = 0|\n DigitalOut.ar(0, SinOsc.ar(10));\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\ns.plotTree;\n\n// Define and play a repeating pattern that generates a new synth every 0.4 seconds:\nx = Pn((dur: 0.4, midinote: 69, amp: 0.1)).play;\n\n/*\nThe NodeTreeView window dynamically displays active synth nodes.\nInitially, it shows the first node, and upon each refresh, it retains the previous node while adding a new one.\nThis results in the display of one or two subsequent nodes at each interval.\n*/\n\n// stop updating plotTree:\ns.nodeTreeView.stop;\n\n// start updating plotTree:\ns.nodeTreeView.start;\n\n// stop the playback of the pattern:\nx.stop;\n\ns.nodeTreeV\n// …\n```"}, {"role": "assistant", "content": "Define and play a repeating pattern that generates a new synth every 0.4 seconds: stop updating plotTree: (Server: Object representing a server application)"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\HOABinaural;\n~description = \"Binaural decoder using the HOABinaural class from SC-HOA\";\n\n~function = { |in = 0, order|\n HOABinaural.ar(\n order: order,\n in: in\n );\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nSynthDef(\"help-PrintVal\",{PrintVal.kr(SinOsc.kr(440,0,0.1), 100)}).play\n\n\n//two at once\n(\nSynthDef(\"help-PrintVal\",{\n\nPrintVal.kr(SinOsc.kr(440,0,0.1), 100, 1);\n\nPrintVal.kr(LFNoise1.kr(100,0.1), 10, 2);\n\n}).play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nSynthDef(\"help-PrintVal\",{PrintVal.kr(SinOsc.kr(440,0,0.1), 100)}).play\n\n\n//two at once\n(\nSynthDef(\"help-PrintVal\",{\n\nPrintVal.kr(SinOsc.kr(440,0,0.1), 100, 1);\n\nPrintVal.kr(LFNoise1.kr(100,0.1), 10, 2);\n\n}).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Signal.integral` do?"}, {"role": "assistant", "content": "Return the integral of a signal. `Signal[1, 2, 3,"}]} -{"conversations": [{"role": "user", "content": "What is `UnaryOpUGen`?"}, {"role": "assistant", "content": "UnaryOpUGen — Apply a unary operation to the values of an input ugen"}, {"role": "user", "content": "What does `UnaryOpUGen.new` do?"}, {"role": "assistant", "content": "return a new instance that applies the operator `selector` to the ugen `a`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na = WhiteNoise.ar; // a WhiteNoise\nb = a.squared; // a UnaryOpUGen.\nb.operator; // squared\n\n// sound example\n\n{ var a = LFSaw.ar(300).range(0, 2pi); a.sin * 0.1 }.play;\n\n// Plotting the \"abs\" unary operator (via the server):\n\n{ SinOsc.ar(300).abs }.plot\n```"}]} -{"conversations": [{"role": "user", "content": "What does `EventSource.enAr` do?"}, {"role": "assistant", "content": "Implementation of Functional Reactive Programming."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes song of forest."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\sound, {\n arg i_bus = 0, amp = 0.1, freq = 440, sustain = 1, pan = 0;\n var env, osc, out;\n env = EnvGen.kr(Env.perc(0.01, sustain, amp),doneAction:2);\n osc = SinOsc.ar([freq, freq * 1.005, freq * 0.995], mul:env);\n out = Pan2.ar(osc, pan);\n Out.ar(i_bus, out);\n}).send(s);\n);\n\n(\n~amp = 0.1;\na = Pdef(\\a,\n Pbind(\n \\instrument, \\sound,\n \\amp, ~amp * 1.5,\n \\degree, Pseq([2, 4, 5, 6, 1] - 1, inf),\n \\dur, Pseq([1, 1, 1, 1, 2] / 4, inf)\n )\n).quant_([3, 0, 0, 1]);\n\nb = Pdef(\\b,\n Pbind(\n \\instrument, \\sound,\n \\amp, ~amp,\n \\degree, Pseq([8, 6, 5, 3, 4, 6] - 1, inf),\n \\dur, Pseq([1, 1, 1, 1, 1, 1] / 4, inf)\n )\n).quant_([3, 0, 0, 1]);\n\nc = Pdef(\\c,\n Pbind(\n \\instrument, \\sound,\n \\amp, ~amp * 0.6,\n \\degree, Pseq([1, 6, 8, 6, Pwrand([11,13], [2, 1].normalizeSum)] - 1, inf),\n \\amp, Pseq([0, 1, 1, 1, 1] / 10, inf),\n \\dur, Pseq([8, 1, 1, 1, 1] / 8, inf),\n \\sustain, 0.1\n )\n).quant_([3, 0, 0, 1]);\n);\n\n(\nSystemClock.sched(0, Routine({\n a.play; 12.yield;\n b.play; 12.yield;\n c.play; 12.yield;\n c.pause; 6.yield;\n a.pause; 6.yield;\n\n b.pause; a.play; 12.yield;\n b.play; 12.yield;\n c.play; 12.yield;\n c.pause; a.pause; 6.yield;\n b.pause; 6.yield;\n}));\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// allocate buffer\nb = Buffer.alloc(s, 44100, 1);\n\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nBufDelayL.ar(b.bufnum, z, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\nb.free;\n\n\n// multichannel\n\n// two channels, two buffers\nb = Buffer.allocConsecutive(2, s, 32768, 1);\n\na = { |bufs = #[0, 1]|\n var sig = SinOsc.ar([440, 880\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// allocate buffer\nb = Buffer.alloc(s, 44100, 1);\n\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nBufDelayL.ar(b.bufnum, z, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\nb.free;\n\n\n// multichannel\n\n// two channels, two buffers\nb = Buffer.allocConsecutive(2, s, 32768, 1);\n\na = { |bufs = #[0, 1]|\n var sig = SinOsc.ar([440, 880]) * Decay2.kr(Impulse.kr([2, 4]), 0.01, 0.15);\n sig + BufDelayL.ar(bufs, sig, delaytime: 0.125)\n}.play(args: [bufs: b]);\n\na.free;\nb.do(_.free);\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// Handy code for quick class demonstrations.\n// Comparing a few intervals - Just Intonation versus 12-tone Equal Tempered\n\n// Major third (just)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 60.midicps * 5/4], mul: 0.1) }).play\n// Major third (ET12)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 64.midicps], mul: 0.1) }).play;\n\n// Major second (just)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 60.midicps * 9/8], mul: 0.1) }).play\n// Major second (ET)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 62.midicps], mul: 0.1) }).play;\n\n// Perfect fifth (just)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 60.midicps * 3/2], mul: 0.1) }).play\n// Perfect fifth (ET)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 67.midicps], mul: 0.1) });\n```"}, {"role": "assistant", "content": "Simple handy code for quick class demonstrations. Hear and compare a few intervals in Just Intonation versus 12-tone Equal Tempered tuning."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Pattern adapted from James Harkins' \"A Practical Guide to Patterns\":\ns.boot\n\np = Pbind(\n \\midinote, Pif(Pwhite(0.0, 1.0, inf) < 0.7, Pwhite(60, 80.5, inf), Pwhite(45, 55.5, inf)),\n \\dur, Prand([0.125, 0.25, 0.5], inf)\n;\n\np.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Pattern adapted from James Harkins' \"A Practical Guide to Patterns\":\ns.boot\n\np = Pbind(\n \\midinote, Pif(Pwhite(0.0, 1.0, inf) < 0.7, Pwhite(60, 80.5, inf), Pwhite(45, 55.5, inf)),\n \\dur, Prand([0.125, 0.25, 0.5], inf)\n);\n\np.play\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Just an exploration with Substractive synthesis?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n\n 2.do{\n {BPF.ar (WhiteNoise.ar, [73,81].midicps, 1e-4, Env.sine(10,50).kr(2)).sum!2}.play; gauss (7,0.2).wait;\n {BPF.ar (WhiteNoise.ar, [71,80].midicps, 1e-4, Env.sine(10).kr(2)).sum!2*50}.play; gauss (7,0.2).wait;\n {BPF.ar (WhiteNoise.ar, [69,78].midicps, 1e-4, Env.sine(10).kr(2)).sum!2*50}.play; gauss (7,0.2).wait;\n {BPF.ar (WhiteNoise.ar, [68,80].midicps, 1e-4, Env.sine(10).kr(2)).sum!2*50}.play; gauss (7,0.2).wait;\n}\n}.fork\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `EnvGen`."}, {"role": "assistant", "content": "```supercollider\n{ PinkNoise.ar(EnvGen.kr(Env.perc, doneAction: Done.freeSelf)) }.play\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SinOscFB`."}, {"role": "assistant", "content": "```supercollider\n{ SinOscFB.ar(440, MouseX.kr(0, 4))*0.1 }.play\n\n\n{ SinOscFB.ar(MouseY.kr(10, 1000, 'exponential'), MouseX.kr(0.5pi, pi))*0.1 }.play\n\n\n{ SinOscFB.ar(100*SinOscFB.ar(MouseY.kr(1, 1000, 'exponential'))+200, MouseX.kr(0.5pi, pi))*0.1 }.play\n\n\n// Scope the wave form\n{ SinOscFB.ar([400, 301], MouseX.kr(0, 4), 0.3) }.scope;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `AbstractFunction.distort` do?"}, {"role": "assistant", "content": "An object which responds to a set of messages that represent mathematical functions"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// For most cases the symmetric symplectic procedures with prefix 'sym' should be used (default 'sym2').\n// They deliver best results with regard to long-term stability, see links at top.\n// In case you suspect instability coming from numerics \n// you can take symplectic variants of higher order: \n// \\sym2, \\sym4, \\sym6, \\sym8, \\sym12, \\sym16, \\sym32, \\sym64.\n\n// Note that already a simple harmonic oscillator can fail with a standard procedure\n\n// This is decaying after a few seconds with classical Runge-Kutta 3rd order !\n// ATTENTION: with other non-symplectic procedures this can lead to immediate blow\n// …\n```"}, {"role": "assistant", "content": "For most cases the symmetric symplectic procedures with prefix 'sym' should be used (default 'sym2'). They deliver best results with regard to long-term stability, see links at top. (Fb1_ODE: general ordinary differential equation integrator pseudo ugen)"}]} -{"conversations": [{"role": "user", "content": "What does `SimpleNumber.ibetaDerivative` do?"}, {"role": "assistant", "content": "Returns the partial derivative with respect to `x` of the incomplete beta function `ibeta(a, b,"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot\nb = Bus.audio(s, 2);\na = { SinOsc.ar([330, 440], 0, 0.4) }.play(s, b // you won't hear this if you only have two channels\nb.scope\n\na.free;\nb.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot\nb = Bus.audio(s, 2);\na = { SinOsc.ar([330, 440], 0, 0.4) }.play(s, b) // you won't hear this if you only have two channels\nb.scope\n\na.free;\nb.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n/* Audio plugin definition\n\n Each audio plugin should define the following global variables:\n ~name: (symbol) name of the spatializer\n ~description: (string) a short description\n ~function: the actual definition of the plugin\n\n*/\n\n~name = \\Limiter;\n~description = \"A simple limiter\";\n~channelLayout = \\mono;\n\n~function = { arg in, level=0.7, dur=0.01, outputDB=0;\n outputDB.dbamp * Limiter.ar(In.ar(in), level, dur);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nx = {\n |loDev = -6, hiDev = 5, lookBack = 2|\n var trig = Impulse.ar(5);\n // define maxLookBack, minLoDev and maxHiDev\n var midi = Demand.ar(trig, 0, DIdev(72, 11, -6, 5, lookBack, loDev, hiDev));\n midi.poll(5, label: \\midi);\n SinOsc.ar(midi.midicps.lag(0.007)) ! 2 * 0.1\n}.play;\n);\n\n\n// as lookBack equals 2, this defines a fixed sequence (up or down anyway)\n\n(\nx.set(\\loDev, -1);\nx.set(\\hiDev, 1)\n);\n\n\n// widen range\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nx = {\n |loDev = -6, hiDev = 5, lookBack = 2|\n var trig = Impulse.ar(5);\n // define maxLookBack, minLoDev and maxHiDev\n var midi = Demand.ar(trig, 0, DIdev(72, 11, -6, 5, lookBack, loDev, hiDev));\n midi.poll(5, label: \\midi);\n SinOsc.ar(midi.midicps.lag(0.007)) ! 2 * 0.1\n}.play;\n);\n\n\n// as lookBack equals 2, this defines a fixed sequence (up or down anyway)\n\n(\nx.set(\\loDev, -1);\nx.set(\\hiDev, 1)\n);\n\n\n// widen range\n\n(\nx.set(\\loDev, -6);\nx.set(\\hiDev, 5);\n);\n\n\n// force a twelve-tone row\n\nx.set(\\lookBack, 11)\n\n\n// contradictory input, lookBack 11 not possible within range, causes repetitions\n\n(\nx.set(\\loDev, -3);\nx.set(\\hiDev, 2)\n);\n\nx.release\n```"}]} -{"conversations": [{"role": "user", "content": "What happens when I call .play on a function?"}, {"role": "assistant", "content": "`.play` on a Function builds a SynthDef from the function body, adds it to the server under an anonymous name, and starts one Synth of it. You get back the Synth, so `x = { SinOsc.ar(440) * 0.1 }.play; x.free;` stops it. It is the fastest way to hear something, but it is not how you write a piece: nothing is named, nothing can be reused, and the definition is lost when the Synth is freed."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Compander`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var z;\n\n // signal (clean)\n z = Decay2.ar(\n Impulse.ar(8, 0, LFSaw.kr(0.3, 1, -0.3, 0.3)),\n 0.001,\n 0.3\n )\n * Mix.ar(Pulse.ar([80, 81], 0.3));\n\n // apply gate (mouse x sets treshold)\n Compander.ar(z, z,\n thresh: MouseX.kr(0.001, 1),\n slopeBelow: 10,\n slopeAbove: 1,\n clampTime: 0.01,\n relaxTime: 0.01\n )\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n{\n\nvar in, fft, dissonance;\n\n//in = SinOsc.ar(MouseX.kr(100,1000),0,0.1);\n//in = Mix(SinOsc.ar([440,MouseX.kr(440,880)],0,0.1)); \nin= SoundIn.ar; \n\nfft = FFT(LocalBuf(2048), in);\n\ndissonance=SensoryDissonance.kr(fft);\n\ndissonance.poll; \n\nOut.ar(0,Pan2.ar(0.1*Blip.ar(100,(dissonance.sqrt)*200))); \n}.play\n);\n\n\n\n//different fftsize, max num peaks, own normalisation, avoid clamping by setting high value (more CPU cost) \n(\n// …\n```"}, {"role": "assistant", "content": "in = SinOsc.ar(MouseX.kr(100,1000),0,0.1); in = Mix(SinOsc.ar([440,MouseX.kr(440,880)],0,0.1)); (SensoryDissonance: Perceptual feature modeling sensory dissonance)"}]} -{"conversations": [{"role": "user", "content": "Synth Iteration Help?"}, {"role": "assistant", "content": "SuperCollider forum — Synth Iteration Help\n\n```supercollider\n(\nSynthDef (\\sine_tone) {\narg freq = 440, amp = 1, len = 1, bus = 0;\nvar sig, env;\nenv = Env.step ([ amp ], [ len ]);\nenv = EnvGen.kr (env, doneAction: 2);\nsig = SinOsc.ar (freq, 0, env);\nOut.ar (bus % 2, sig); // bus modulo 2 here to wrap to stereo\n}.add;\n)\n```\n\nmaybe try wrapping the bus array to [ 0, 1 ] by using modulo: bus % 2. this should let you hear what is going on using a stereo output\n\nby using a Pbind, each “note” is being instantiated as a separate synth with its own length, amplitude, frequency and bus. the doneAction: 2 argument in the EnvGen.kr ugen just means each synth will free itself once it is done playing the note it has been assigned."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//spinning box / cube\n//after Shiffman https://codingtrain.github.io/website-archive/CodingChallenges/112-3d-rendering.html\n\n(\nvar width= 640, height= 480, w,\ntheta= 0, speed= 0.01, box;\n\nw= RedWindow(\"3Dbox\", Rect(128, 64, width, height)).front;\nbox= Red3DBox();\n\n//--loop\nw.draw{\n theta= theta+speed;\n box.rotation= RedVector3D[theta, theta, theta];\n box.update;\n\n //--render\n box.render(1, 100); //1= exaggerate, 2= standard\n Pen.translate(width*0.5, height*0.5);\n Pen.strokeColor= Color.white;\n box.drawOutlines;\n Pen.fillColor= Color.white;\n box.draw;\n};\nw.play;\nCmdPeriod.doOnce({w.close});\n)\n```"}, {"role": "assistant", "content": "spinning box / cube after Shiffman https://codingtrain.github.io/website-archive/CodingChallenges/112-3d-rendering.html."}]} -{"conversations": [{"role": "user", "content": "What is `Condition`?"}, {"role": "assistant", "content": "Condition — Block the execution of a thread"}, {"role": "user", "content": "What does `Condition.new` do?"}, {"role": "assistant", "content": "Create a new instance, set the test variable."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nc = Condition.new(false);\n\nRoutine {\n 1.wait;\n \"waited for 1 second\".postln;\n 1.wait;\n \"waited for another second, now waiting for you ... \".postln;\n c.wait;\n \"the condition has stopped waiting.\".postln;\n 1.wait;\n \"waited for another second\".postln;\n \"waiting for you ... \".postln;\n c.test = false;\n c.wait;\n \"the condition has stopped waiting.\".postln;\n 1.wait;\n \"the end\".postln;\n}.play;\n);\n\n// continue\n(\nc.test = true;\nc.signal;\n);\n\n// a typical use is a routine that can pause under certain conditions:\n(\nc = Condition.new;\nfork { loop { 1.wait; \"going\".postln; c.wait } };\n);\nc.test = true; c.signal;\nc.test = false;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Detuneable fat-saw with a pattern (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\fatsaw,\n {\n arg freq=440, amp=0.3, fat=0.0033, ffreq=2000, atk=0.001, dec=0.3, sus=0.5, rls=0.1,gate=1;\n\n var f1,f2,f3,f4,synth;\n\n f1=freq-(freq*fat);\n f2=freq-(freq*fat/2);\n f3=freq+(freq*fat/2);\n f4=freq+(freq*fat);\n\n synth = LFSaw.ar([f1,f2,f3,f4],[0,0.001,0.002,0.004,0.008]);\n synth = synth * EnvGen.kr(Env([0,1,sus,0],[atk,dec,rls],'lin',2),gate,doneAction:0);\n synth=Splay.ar(synth,0.7);\n synth=RLPF.ar(synth,ffreq*Linen.kr(gate,0.1,0.4,0.2,0),0.4);\n Out.ar([0,1],synth*amp);\n},[0.1,0.3,4,2]).add;\n);\n(\nTempoClock.default = TempoClock.new(2);\nfork{\n\n z = Synth(\\fatsaw,[\\gate,0,\\ffreq,500,\\fat,0.5]);\n\n a=Pseq([0,7,12,5],inf).asStream; // musical degrees\n c = Pseq([40,38,45,47],inf).asStream; // root midi notes\n e = Pseq([0.825,0.375,0.25,0.25],inf).asStream; // note durations\n f = Pseq([1000,1500,2000,2500],inf).asStream; // filter freq value\n\n 0.1.wait;\n z.set(\\gate,1);\n\n //set first root note\n d = c.next;\n\n 8.do{\n\n // move filter freq once every 4 notes\n z.set(\\ffreq, f.next);\n 4.do {\n z.set(\\gate,1);\n z.set(\\freq,(a.next + d).midicps);\n x=[0.451,0.45,0.449].choose;\n x.wait;\n z.set(\\gate,0);\n\n e.next.wait;\n };\n\n d = c.next;\n };\n 2.wait;\n z.free;\n};\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Pfunc`."}, {"role": "assistant", "content": "```supercollider\nq = Pbind(\\freq, 300, \\dur, Pn(0.3, 2));\nq.trace.play;\n\n// Sound-wise ineffective modification of the incoming stream\np = Pbind(\\degree, 6) <> q;\np.trace.play;\n\n// Instead\np = Pbind(\\degree, 6) <> Pfunc { |ev| ev.freq = nil } <> q;\np.trace.play;\n\n// Alternatively\np = Pbind(\\degree, Pfunc { |ev| ev.freq = nil; 6 }) <> q;\np.trace.play;\n\n// Just setting a key to nil from a Pbind pair will end the stream\np = Pbind(\\freq, nil, \\degree, 6) <> q;\np.trace.play; // silent because it outputs no events\n```"}]} -{"conversations": [{"role": "user", "content": "What is `AllpassN` in SuperCollider?"}, {"role": "assistant", "content": "AllpassN — Schroeder allpass delay line with no interpolation. A Schroeder allpass filter is given by the difference equations Category: UGens > Delays."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Blowing ambient with lots of reverb."}, {"role": "assistant", "content": "```supercollider\nfork{\n // notes sequence\n var seq = Pxrand([0,3,5,7,8],inf).asStream;\n loop{\n var dur = 8;\n var num = 8;\n var root = 36;\n var freq = (seq.next+root).midicps;\n var spread = rrand(0.4,0.8);\n var attack = rrand(0.05, 0.3);\n \n // play the cluster\n play{\n var harm = Array.geom(num, 1, 1.5);\n var harma = Array.geom(num, 0.5, 0.8);\n var detune = Array.fill(num, { LFNoise2.kr(1,0.01,1) });\n var source = PinkNoise.ar;\n var bandwidth = Rand(0.001,0.01);\n var generator = [\n SinOsc.ar(freq*harm*detune, mul:harma*0.3).scramble,\n Resonz.ar(source, freq*harm*detune, bandwidth, mul:harma).scramble * 50\n ].wchoose([0.2,0.8]);\n var snd = Splay.ar(generator,spread);\n snd * LFGauss.ar(dur, attack, loop:0, doneAction:2);\n };\n dur.wait;\n };\n \n};\n\n// global triple super gverb\n{\n var in = In.ar(0,2);\n in = (in*0.2) + GVerb.ar(in, 220, 12, mul:0.6);\n in = (in*0.2) + GVerb.ar(in, 220, 12, mul:0.6);\n in = (in*0.2) + GVerb.ar(in, 220, 12, mul:0.6);\n ReplaceOut.ar(0, Limiter.ar(LeakDC.ar(in)))\n}.play(addAction:\\addToTail)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `JITGui.nameView` do?"}, {"role": "assistant", "content": "(specific in the JITGui class) displays the object's key or name if"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\"help-EnvDetect\",{Out.ar(0,Pan2.ar(\nSinOsc.ar(440,0,0.3*EnvDetect.ar(LFNoise1.ar(20), MouseX.kr(0.001,0.1,'exponential'), MouseY.kr(0.001,0.1,'exponential'))) \n,0.0))\n}).play\n);\n\n\n(\nSynthDef(\"help-EnvDetect\",{Out.ar(0,Pan2.ar(\nLFSaw.ar(EnvDetect.ar(LFNoise1.ar(11,100,200), MouseX.kr(2,0.0001,'exponential'), MouseY.kr(2,0.0001,'exponential')),0,0.3*En\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\"help-EnvDetect\",{Out.ar(0,Pan2.ar(\nSinOsc.ar(440,0,0.3*EnvDetect.ar(LFNoise1.ar(20), MouseX.kr(0.001,0.1,'exponential'), MouseY.kr(0.001,0.1,'exponential'))) \n,0.0))\n}).play\n);\n\n\n(\nSynthDef(\"help-EnvDetect\",{Out.ar(0,Pan2.ar(\nLFSaw.ar(EnvDetect.ar(LFNoise1.ar(11,100,200), MouseX.kr(2,0.0001,'exponential'), MouseY.kr(2,0.0001,'exponential')),0,0.3*EnvDetect.ar(LFSaw.ar(7), MouseX.kr(0.001,1,'exponential'), MouseY.kr(0.001,1,'exponential'))) \n,0.0))\n}).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// It might also be desirable to start with a fade from silence.\n// This can be done with a negative initOutOffset:\n\n(\nx = {\n var lfo = XLine.ar(1, 0.5, 60);\n DXMix.ar(\n Dseq([0, 4, 1, 5, 2, 6, 3, 7], inf),\n `(Saw.ar((1..8) * 70 * lfo, 0.075)),\n fadeTime: 2,\n width: 2,\n initOutOffset: -1\n ) ! 2\n}.play\n);\n\nx.release\n\n\n// overlap scheme with width = 2 and initOutOffset = -1:\n```"}, {"role": "assistant", "content": "It might also be desirable to start with a fade from silence. This can be done with a negative initOutOffset: (DXMix: crossfades between signals according to demand-rate control)"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Custom event type for wiring up effects?"}, {"role": "assistant", "content": "```supercollider\n(\n// add custom event\nEvent.addEventType(\\nbind, {arg server;\n\n var id = (currentEnvironment[\\ndef] ? currentEnvironment[\\instrument]).asSymbol;\n var type = \\note;\n\n if (Ndef(id).isPlaying.not) {\n Ndef(id).play;\n };\n\n ~type = type;\n ~group = Ndef(id).group;\n ~out = Ndef(id).bus;\n\n currentEnvironment.play;\n});\n\n// synth\nSynthDef(\\synth1, {arg freq = 440, out = 0;\n \n var env = Env.perc.kr(doneAction:2);\n var sig = SinOscFB.ar(freq * [1, 1.01], 0.7);\n sig = sig * env;\n OffsetOut.ar(out, Splay.ar(sig));\n \n}).add;\n\n// set up first set of fx\nNdef(\\fx1).play;\nNdef(\\fx1)[0] = \\filter -> {arg in;\n in.abs;\n};\n\n// set up additional fx\nNdef(\\fx2).play;\nNdef(\\fx2)[0] = \\filter -> {arg in;\n in + AllpassC.ar(in, 0.2, 0.2, [3, 5]);\n};\n\n);\n\n// play a pattern\nPbind(\\instrument, \\synth1, \n // specify custom event type\n \\type, \\nbind, \n // switch between fx\n \\ndef, Pseq([\\fx1, \\fx2], inf),\n \\degree, Pwhite(0, 5, inf)\n).play;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ Pan2.ar(SinOsc.ar(440) * 0.2, SinOsc.kr(0.1)) }.play;\n```"}, {"role": "assistant", "content": "A sine that slowly moves between the speakers.\n\n`SinOsc.kr(0.1)` is a control-rate sine at 0.1 Hz — one cycle every 10 seconds — running between -1 and 1.\n`Pan2.ar(sig, pos)` treats that as the pan position, where -1 is hard left, 0 centre, 1 hard right, so the\nsound drifts across the stereo field. Pan2 is equal-power, so the centre is -3 dB per channel rather than\nhalf amplitude on each. The `* 0.2` sets the level before panning."}]} -{"conversations": [{"role": "user", "content": "How should I check an answer you give me?"}, {"role": "assistant", "content": "Three quick checks, cheapest first. Does it evaluate without a syntax error — the post window points at the exact character. Does the node appear in `s.plotTree` — if yes, the problem is signal rather than lifecycle. Does it reach `Out.ar(0, ...)` with a non-zero amplitude and an open filter. If those three pass and it is still silent, the class's own help page will show the argument order you may have assumed wrong."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\nx = { SinOsc.ar((Line.kr(0, 10, 10).snap(1, 0.3, 1) + 60).poll.midicps, 0, -24.dbamp }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\nx = { SinOsc.ar((Line.kr(0, 10, 10).snap(1, 0.3, 1) + 60).poll.midicps, 0, -24.dbamp) }.play\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// multiple usage of the same name:\na = { SinOsc.ar(\\freq.kr(440, 1.0)) + Saw.ar(\\freq.kr(440, 1.0) * 0.5) * 0.1 }.play;\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n\n// with different lag values:\na = { SinOsc.ar(\\freq.kr(440).lag(3.5)) + Saw.ar(\\freq.kr(440).lag(0.05) * 0.5) * 0.1 }.play;\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n\n// control saved to a variable:\n(\na = {\n var freq = \\freq.kr(440);\n SinOsc\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// multiple usage of the same name:\na = { SinOsc.ar(\\freq.kr(440, 1.0)) + Saw.ar(\\freq.kr(440, 1.0) * 0.5) * 0.1 }.play;\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n\n// with different lag values:\na = { SinOsc.ar(\\freq.kr(440).lag(3.5)) + Saw.ar(\\freq.kr(440).lag(0.05) * 0.5) * 0.1 }.play;\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n\n// control saved to a variable:\n(\na = {\n var freq = \\freq.kr(440);\n SinOsc.ar(freq.lag(3.5)) + Saw.ar(freq.lag(0.05) * 0.5) * 0.1;\n}.play;\n);\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `PatternProxy.embedInStream` do? What arguments does it take?"}, {"role": "assistant", "content": "Given a Stream like e.g. Routine, yield all values from the pattern in the proxy before continuing. One pattern proxy can be used to produce values for any number of independent Arguments: inval — The inval is passed into all substreams and can be used to control how they behave from the outside.; embed — See Object#-streamArg for explanation.; default — Replacement for `nil` outputs of the source pattern. One use case is #-endless. `a = PatternProxy.new;`."}]} -{"conversations": [{"role": "user", "content": "The server stopped responding. What do I do?"}, {"role": "assistant", "content": "In order: `Ctrl+.` (CmdPeriod) to reset scheduling, then `s.reboot` if the server itself is wedged.\nA reboot drops every SynthDef and buffer, so re-add them — which is why real projects keep their SynthDefs\nin a file you can re-evaluate rather than typing them in the REPL.\n\nIf the boot itself fails, the post window has the reason: usually the audio device (another application\nholding exclusive access) or a sample-rate mismatch. `Server.default.options.device` picks a device before\n`s.boot`."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n(\nSynthDef(\"fm\", {| out = 0, amp = 0.2, midinote=1, octave = 5, carrier, modulator, depth,\n dur = 1, detune = 0|\n\n var carrierOsc, modulation, env, degree, ratio;\n\n\n // adjust the octave. This assumes the fregencies we give for analysis generate a tone in the octave around middle C\n degree = midinote - 60;\n degree = degree + (12 * (octave - 5));\n\n // now compute a ratio\n ratio = degree.midiratio;\n\n // multiple the ratio by all of the FM values\n carrier = (carrier * ratio) + detune; // Pbinds sometimes use a detune value\n modulator = modul\n// …\n```"}, {"role": "assistant", "content": "adjust the octave. This assumes the fregencies we give for analysis generate a tone in the octave around middle C now compute a ratio (DissonanceCurve: Analyzes timbres in order to create tunings)"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Re: Re: the perfect frequencies?"}, {"role": "assistant", "content": "```supercollider\n(\nf = {\n var rep = [4, 8, 16, 32];\n var n = rep.choose;\n var x = [\n\n 54, 60, 66, 72, 81, 90, 96, 102,\n 108, 128, 132, 144, 162, 180, 192, 204,\n 216, 240, 264, 288, 324, 360, 384, 408,\n 432, 480, 528, 576, 648, 720, 768, 816,\n 864, 960, 1056, 1152, 1296, 1440, 1536, 1632,\n 1728, 1920, 2112, 2304, 2592, 2880, 3072, 3264,\n 3456, 3840, 4224, 4608, 5184, 5760, 6144, 6528,\n 6912, 7680, 8448, 9216, 10368, 11520, 12288, 528\n\n ];\n var fac1 = [1,10,100,1000].choose;\n var fac2 = [1,10,100,1000].choose;\n var fac3 = [1,10,100,1000].choose;\n Mix.fill(n,\n {\n var detune = 5.rand;\n var saw;\n var sin;\n detune = XLine.kr(0.1,1+250.0.rand ,2+9.0.rand) * 2.0.rand* [1,-1].choose;\n sin = SinOsc.ar(x.choose * ( 1 + ( SinOsc.ar(x.choose/fac1) * x.choose/fac2 )) + detune, 4.rand, 0.25);\n saw = RLPF.ar(Saw.ar(x.choose*0.01+detune, 0.75), x.choose, 2.rand);\n saw = [\n saw,\n saw.fold2( SinOsc.ar(x.choose/fac3).range(0.1,1) ),\n saw.wrap2( SinOsc.ar(x.choose/fac3).range(0.1,1) ),\n saw * SinOsc.ar(x.choose/2),\n ( saw * SinOsc.ar(x.choose/fac3).range(1,20) ).tanh/2,\n ].choose;\n Pan2.ar((sin+saw) * EnvGen.kr(Env.sine(12, 1/n), 1, doneAction:2),\n 1.rand2) \n }\n );\n};\n);\n\n(\n// DEFINE A ROUTINE\nr = Routine({\n\n inf.do({\n f.play;\n 10.wait;\n })\n});\n);\n\nr.reset.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Color.rand` do? What arguments does it take?"}, {"role": "assistant", "content": "A random RGB Color where the colors are randomly chosen between `lo` and `hi`. See Arguments: lo — An instance of Float between 0 and 1.; hi — An instance of Float between 0 and 1.."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ReplaceOut`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"ReplaceOutHelp\", { |out = 0, freq = 440|\n var source;\n source = SinOsc.ar(freq, 0, 0.1);\n\n // write to the bus, replacing previous contents\n ReplaceOut.ar(out, source);\n\n}).add;\n);\n\n// each Synth replaces the output of the previous one\nx = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 500]);\ny = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 600]);\nz = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 700]);\n\n// release them in reverse order; the older Synths are still there.\nz.free;\ny.free;\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// won't work (the output is 0.5*0.0), which is why we need the DC UGen!\n{ 0.5 }.play\n\n// constantly zero\n{ DC.ar(0.0) }.play;\n\n\n// DC offset; will click on start and finish\n{ DC.ar(0.5) + SinOsc.ar(440, 0, 0.1) }.play;\n\n\n// test - note the transient before LeakDC adapts and suppresses the offset\n{ LeakDC.ar(DC.ar(0.5)) }.play;\n\n\n// show scope\ns.scope\n```"}, {"role": "assistant", "content": "won't work (the output is 0.5*0.0), which is why we need the DC UGen! DC offset; will click on start and finish (DC: Create a constant amplitude signal)"}]} -{"conversations": [{"role": "user", "content": "Explain `Dwhite` in SuperCollider briefly."}, {"role": "assistant", "content": "Dwhite — Demand rate white noise random generator. Dwhite returns numbers in the continuous range between `lo` and `hi` . Category: UGens > Demand."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// example from ServerErrorGui in crucial lib\n\nf = OSCresponderNode(s.addr, '/fail', { |time, responder, msg|\n {\n var mins, secs;\n mins = (time/60).round(1);\n secs = (time%60).round(0.1);\n if(secs<10, { secs = \"0\"++secs.asString }, { secs = secs.asString });\n // put this on a gui\n // errors.label = \"% % (%:%)\".format(msg[1], msg[2], mins, secs);\n // errors.stringColor = Color.white;\n \"% % (%:%)\".format(msg[1], msg[2], mins, secs).postln;\n }.defer\n});\nf.add;\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// example from ServerErrorGui in crucial lib\n\nf = OSCresponderNode(s.addr, '/fail', { |time, responder, msg|\n {\n var mins, secs;\n mins = (time/60).round(1);\n secs = (time%60).round(0.1);\n if(secs<10, { secs = \"0\"++secs.asString }, { secs = secs.asString });\n // put this on a gui\n // errors.label = \"% % (%:%)\".format(msg[1], msg[2], mins, secs);\n // errors.stringColor = Color.white;\n \"% % (%:%)\".format(msg[1], msg[2], mins, secs).postln;\n }.defer\n});\nf.add;\n\n// cause a failure\nSynth(\"gthhhhppppppp!\");\n\nf.remove\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Compare:\n\n{ WhiteNoise.ar(0.25) }.play;\n\n{ HPZ2.ar(WhiteNoise.ar(0.25)) }.play;\n\n// HPZ2 is useful to detect changes in a signal:\n// see also HPZ1\n(\n{\n var changingSignal = LFNoise0.ar(1000);\n var hpz2 = HPZ2.ar(changingSignal);\n [hpz2, hpz2 > 0]\n}.plot\n;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Compare:\n\n{ WhiteNoise.ar(0.25) }.play;\n\n{ HPZ2.ar(WhiteNoise.ar(0.25)) }.play;\n\n// HPZ2 is useful to detect changes in a signal:\n// see also HPZ1\n(\n{\n var changingSignal = LFNoise0.ar(1000);\n var hpz2 = HPZ2.ar(changingSignal);\n [hpz2, hpz2 > 0]\n}.plot\n);\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Pdef`?"}, {"role": "assistant", "content": "Pdef — stream reference definition"}, {"role": "user", "content": "What does `Pdef.all` do?"}, {"role": "assistant", "content": "A global IdentityDictionary with all proxies."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\nPdef(\\x, Pbind(\\note, Pbrown(0, 6, 0.1, inf)));\nPdef(\\x).quant = 0; // no waiting.\nPbindf(Pdef(\\x), \\dur, 0.03).play;\nPbindf(Pdef(\\x), \\dur, 0.1, \\ctranspose, 15).play;\nPbindf(Pdef(\\x), \\dur, 0.3, \\ctranspose, 2).play;\n// now change the definition\nPdef(\\x, Pbind(\\note, Pseq([0, 3, 5, 7, 9, 11], inf)));\nPdef(\\x, Pbind(\\freq, Pseq([1000, 1923, 245.2, 1718] / 1.2 + 0.1, inf)));\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Synth`?"}, {"role": "assistant", "content": "Synth — Client-side representation of a synth node on the server"}, {"role": "user", "content": "What does `Synth.new` do?"}, {"role": "assistant", "content": "Create and return a new Synth object, and immediately start the corresponding synth node on the server."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n// create a Synth at the head of the default Server's default group\n// based on the SynthDef \"default\"\nx = Synth.new(\"default\");\ns.queryAllNodes; // note the default group (ID 1)\nx.free;\n\n// Using an arrayed control\n// run this block first to make the SynthDef\n(\nSynthDef(\"help-synth\", { |freq = #[440, 450, 460], out = 0|\n Out.ar(out, Mix(SinOsc.ar(freq, 0, 0.1)));\n}).add;\n);\n\n// then this a short while later\nx = Synth(\"help-synth\", [freq: [500, 501, 510]]);\n\nx = Synth(\"help-synth\", [freq: [500, 501, 510]]);\nx.set(\\freq, [1, 2, 3] * 400 + [1, 2, 3], \\out, 1);\nx.set(\\freq, [3] * 400 + [1, 2, 3], \\out, 1);\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `UnaryOpFunction`."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nvar a = { 19.rand };\nvar b = a.sqrt;\nfork {\n 15.do {\n (instrument: \\default, note: [a.value, b.value]).play;\n 0.3.wait;\n }\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Canvas3D.background` do? What arguments does it take?"}, {"role": "assistant", "content": "Set the background Arguments: b — A Color."}]} -{"conversations": [{"role": "user", "content": "What does `SClusterDistortions.def` do?"}, {"role": "assistant", "content": "the definition that send out control data on bus Returns: a LINKClasses/SynthDef."}]} -{"conversations": [{"role": "user", "content": "What does `Patch.rand` do? What arguments does it take?"}, {"role": "assistant", "content": "call .rand on all inputs that support .rand; specifically NumberEditors will do a gaussian distribution randomization centered on the default value of the Arguments: standardDeviation — for the gaussian randomization in NumberEditors. default 0.15. Returns: this"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n//Its not the spline that loops (that would be a loop in 2 dimensional space) but the SplineGen that is set to loop.\n\n// the spline does NOT loop,\nb = BSpline( Array.fill(16,{ arg i; [ i * 0.25,1.0.rand ] }), 3.0,false );\n\nb.gui(nil,1200@300);\n\n\n);\n(\n// the SplineGen loops\n{\n Saw.ar(SplineGen(b,loop:true).kr.linexp(0.0,1.0,40,500).clip(40,500)).dup * 0.4\n}.play\n)\n```"}, {"role": "assistant", "content": "Its not the spline that loops (that would be a loop in 2 dimensional space) but the SplineGen that is set to loop. the spline does NOT loop, (SplineGen: Like EnvGen but for Splines)"}]} -{"conversations": [{"role": "user", "content": "What is `Collection`?"}, {"role": "assistant", "content": "Collection — Abstract superclass of all collections"}, {"role": "user", "content": "What does `Collection.newFrom` do?"}, {"role": "assistant", "content": "Creates a new Collection from another collection. This supports the interface for the method \"as\". `Array.newFrom(Set[4, 2, 1]);`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n~closet = [\\hat, \\hat, \\hat, \\coat, \\coat, \\shoe, \\shoe];\n~closet.removeAll([\\hat, \\coat, \\shoe, \\shoe]); // Doesn't empty the closet, just removes what we wanted to\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes beats to bar printing."}, {"role": "assistant", "content": "```supercollider\n(\nf = ();\nf.beatAndBar = {\n var t = currentEnvironment.clock; // t= TempoClock.new;\n var text = \"xB: \";\n\n var nBeatsPerBar = { arg n, beats, clock;\n var nBpb = clock.beatsPerBar * n;\n \"\" ++ n ++ text ++ (nBpb - (beats%(nBpb))).asInteger\n };\n\n t.play({arg beats, time, clock;\n ( //[\"beat: \" ++ (t.beatInBar + 1).asInteger] ++ //uncomment for beat in bar\n [1,2,4,8,16,32].collect( {|n,i| nBeatsPerBar.value(n, beats, clock)})\n ).postln;\n 1});\n \"beatAntBar\";\n}\n);\n\nf[\\beatAndBar].value;\n\n(\nf[\\beatAndBar].value;\nCmdPeriod.add(f[\\beatAndBar]);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for mixolydian flat six meditation in pythagorean?"}, {"role": "assistant", "content": "```supercollider\n// last updated on sccode.org fri 7. jun, 14:57 CET\n\n( // load this first - synth def\nSynthDef(\\harpsi, { \n arg outbus = 0, freq = 440, ffreq = 2, amp = 1, gate = 1, release = 1;\n var out;\n freq = freq * Rand(1, 1.005);\n out = EnvGen.ar(Env.adsr(releaseTime:release), gate, doneAction: Done.freeSelf)\n * amp * Pulse.ar([freq,freq*1.005]/1, 0.25, mul:0.75 );\n out = out * [Rand(0.0, 1.0), Rand(0.0, 1.0)];\n out = RLPF.ar(out, freq * (ffreq / 4) + 1 );\n Out.ar(outbus, out); \n}).add; \n);\n\n\n( // then run this - sequence\nTempoClock.default.tempo = 1.4;\n~scale = Scale.new(#[0,2,4,5,7,8,10],tuning: \\pythagorean, name: \"mixolydianb6\");\np = Pbind(\n \\instrument, \\harpsi,\n \\root, -12,\n \\scale, ~scale,\n \\ffreq, Pseq(((1..2) ++ (3..1)),inf),\n \\degree, Pseq([\n Pseries({ rrand(0, 7) }, { ([1,2]).choose }, { rrand(4, 8) }),\n Pseries({ rrand(0, 7) }, {([1,2]).choose}, { rrand(4, 8) }),\n Pseries({ rrand(7, 14) }, 0-{([1,2]).choose}, { rrand(4, 8) })\n ], inf),\n \\release, Prand([5,6,7,8],inf),\n \\dur, Prand((1..8)/4, inf),\n \\amp, Prand(((1..8)/8)+1, inf)\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Saw`."}, {"role": "assistant", "content": "```supercollider\n// modulating the frequency\n\n{ Saw.ar(XLine.kr(40, 4000, 6), 0.2) }.play;\n\n// two band limited sawtooth waves through a resonant low pass filter\n\n{ RLPF.ar(Saw.ar([100, 250], 0.1), XLine.kr(8000, 400, 5), 0.05) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n~name = \\defaultMapper;\n\n// default mapper does nothing. It could have been named 'identity'\n~function = { |aziDeg = 0, eleDeg = 0, gainDB = -99, delayMs = 1, lpHz = 15000, hpHz = 5, spread = 0.01, nfIndex = 0|\n [[aziDeg, eleDeg, gainDB, delayMs, lpHz, hpHz, spread, nfIndex]];\n };\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "What does `AbstractFunction.sinh` do?"}, {"role": "assistant", "content": "An object which responds to a set of messages that represent mathematical functions"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// vary frequency - these parameters are for \"one-pulse\" orbit\n{ RosslerL.ar(MouseX.kr(20, SampleRate.ir), 0.36, 0.35, 4.5) * 0.3 }.play(s);\n\n// randomly modulate params\n(\n{ RosslerL.ar(\n SampleRate.ir, \n 0.2, // First variable tends to lead to NaN if modulated in this example\n LFNoise0.kr(1, 0.01, 0.2),\n LFNoise0.kr(1, 0.2, 0.7)\n) * 0.2 }.play(s);\n)\n\n// as a frequency control\n{ SinOsc.ar(Lag.ar(RosslerL.ar(MouseX.kr(1, 200)))*800+900)*0.4 }.play\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// vary frequency - these parameters are for \"one-pulse\" orbit\n{ RosslerL.ar(MouseX.kr(20, SampleRate.ir), 0.36, 0.35, 4.5) * 0.3 }.play(s);\n\n// randomly modulate params\n(\n{ RosslerL.ar(\n SampleRate.ir, \n 0.2, // First variable tends to lead to NaN if modulated in this example\n LFNoise0.kr(1, 0.01, 0.2),\n LFNoise0.kr(1, 0.2, 0.7)\n) * 0.2 }.play(s);\n)\n\n// as a frequency control\n{ SinOsc.ar(Lag.ar(RosslerL.ar(MouseX.kr(1, 200)))*800+900)*0.4 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "How do I set the tempo?"}, {"role": "assistant", "content": "TempoClock.default.tempo = 120/60; the argument is beats per second, so 120 BPM is 2.0. Patterns scheduled on the default clock then follow it."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes sound of an alien weapon firing."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"raygun\", {arg amp = 0.5, sinfreq = 1000, glissf = 0.001, att = 0.01, rel = 0.9;\n var gliss = XLine.kr(sinfreq, sinfreq*glissf, rel);\n var snd = SinOsc.ar(gliss);\n var env = EnvGen.kr(Env.perc(att, rel), doneAction: 2);\n snd = snd * env * amp;\n Out.ar(0, snd);\n}).add;\n);\n\n(\nPbind(\n \\instrument, \"raygun\",\n \\dur, Pseq([0.75,0.75,0.75,0.75,0.25,0.25,0.25]*0.5, inf),\n \\amp, 0.4\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `LFNoise2` in SuperCollider?"}, {"role": "assistant", "content": "LFNoise2 — Quadratic noise. Generates quadratically interpolated random values at a rate given by the nearest integer division of the sample rate by the `freq` argument. Category: UGens > Generators > Stochastic."}]} -{"conversations": [{"role": "user", "content": "What does `MIDIdef.program` do?"}, {"role": "assistant", "content": "A convenience method to create a new MIDIdef which responds to MIDI program change messages. See #*new for argument Returns: An instance of MIDIdef which responds to MIDI program change messages."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n\n ~needed_interval = 20;\n\n ~funk = {\n\n // if last time isn't defined, create it with 1000 seconds ago time\n if( ~last_time.isNil ) {\n ~last_time = Date.getDate.bootSeconds;\n ~last_time = ~last_time - 1000;\n };\n\n // if needed interval has passed, execute the funkie\n if( ( Date.getDate.bootSeconds - ~last_time ) > ~needed_interval ) {\n\n // safe last execution time, so next calls will have to wait the needed interval\n ~last_time = Date.getDate.bootSeconds;\n\n ( \"SOMETHING HAPPENS HERE AT MAXIMUN RATE OF 1 TIME EACH\" + ~needed_interval + \" SECONDS \" );\n\n } {\n ( \"YOU STILL HAVE TO WAIT\" );\n }\n };\n);\n\n~funk.value()\n```"}, {"role": "assistant", "content": "A friend of mine asked me how to limit a function to happen at maximun rate of 1 time every N seconds.."}]} -{"conversations": [{"role": "user", "content": "Explain `PV_MagGate` in SuperCollider briefly."}, {"role": "assistant", "content": "PV_MagGate — reduces magnitudes above or below thresh For positive values of thresh, acts something like a noise reduction. For negative values, highlights smaller sounds. Category: UGens > FFT."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n// Function to check an array for repetitions within a maximum test span\n\n~repetitionCheck = { |array, maxTestSpan|\n maxTestSpan.do { |i|\n var result = (array.drop(i+1) - array).drop((i+1).neg).includes(0).not;\n (\"no repetitions within a span of \" ++ (i+2).asString ++ \" items: \").post;\n result.postln;\n }\n}\n);\n\n// test case\n// no repetitions within a maximum span of 6 (lookBack == 5)\n\n(\np = PIdev(Pbrown(0, 20, 0.3).round.asInteger, 5, -7, 7).iter;\na = p.nextN(10000);\na.plot;\n~repetitionCheck.(a, 10);\n)\n```"}, {"role": "assistant", "content": "Function to check an array for repetitions within a maximum test span no repetitions within a maximum span of 6 (lookBack == 5) (PIdev: pattern searching for numbers with integer distance from a source pattern, optionally avoiding repetitions within a span)"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nb = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n\n(\n{\n var snd, envTime, knee, out;\n snd = PlayBuf.ar(1, b, BufRateScale.kr(b), loop: 1);\n envTime = MouseX.kr(1.0e-3, 0.1e-3);\n knee = MouseY.kr(0, -90).dbamp;\n out = DelayC.ar(snd, 0.01, envTime * 0.5) * EnvFollow.ar(snd, 1 - (envTime * SampleRate.ir).reciprocal).max(knee).reciprocal;\n out * 0.1!2\n}.play;\n)\n```"}, {"role": "assistant", "content": "a replication of the legendary LADSPA plugin of the same name, originally written by steve harris. a compressor with a super fast attack which results in harsh distortion fx. requires sc3-plugins."}]} -{"conversations": [{"role": "user", "content": "What does `AbstractVector.isOrthogonal` do?"}, {"role": "assistant", "content": "`RealVector[0,0,1,0].isOrthogonal(RealVector[1,0,0,0])`"}]} -{"conversations": [{"role": "user", "content": "[ 1, 2, 1, 1, 2, 1, 1 ] how to find adjacent elements in an array?"}, {"role": "assistant", "content": "SuperCollider forum — [ 1, 2, 1, 1, 2, 1, 1 ] how to find adjacent elements in an array\n\nRandColors:\n\nI need to find the index, the how many times (the adjacent values are equal) and what is the adjacent value.\n\nThis is perhaps a bit verbose and clunky, but it meets the above specification:\n\n```supercollider\n(\n~repeats = {|array|\n // return [index, number of repeats, the value] for each repeated value\n var results = [];\n var thisIndex = 0;\n var thisCount = 1;\n var thisValue = array[0];\n array[1..].do{|val, i|\n if(val == thisValue,\n {thisCount = thisCount + 1},\n {\n if(\n thisCount > 1,\n {results = results.add([thisIndex, thisCount, thisValue])},\n );\n thisValue = val;\n thisIndex = i + 1;\n thisCount = 1;\n }\n )\n };\n if(thisCount > 1, {results = results.add([thisIndex, thisCount, thisValue])});\n results;\n}\n);\n\na = [1, 2, 1, 1, 1, 2, 1, 1];\nb = ~repeats.value(a);\n\na = [2, 3, 5, 5];\nb = ~repeats.value(a);\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// proceed with caution. start at min volume, and not with your expensive speakers.\n\nfork{b=Buffer.alloc(s,512,1);inf.do{b.cheby({[1,0].choose}!2);{(Shaper.ar(b,SinOsc.ar(55,0,Line.kr(1,0,2,1,0,2))))!2}.play;0.1.wait;}};\n```"}, {"role": "assistant", "content": "can anyone tell me what the loud click is, and how to control it?\r\n\r\ni kind of really like it, but it sounds scary, \r\n\r\nand the resulting waveform is bizarre, too.\r\n\r\n[http://soundcloud.com/tengototen/m-chtegern-ikeda](http://soundcloud.com/tengototen/m-chtegern-ikeda)\r\n\r\n\r\nupdate: some discussion, and lots of interesting things to try out, [on the list](http://new-supercollider-mailing-lists-foru."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// trig with MouseY crossing center of screen\n{\n var in, chain;\n in = Mix.ar(SinOsc.ar(200 * (1..10), 0, Array.fill(10, { rrand(0.1, 0.2) })));\n chain = FFT(LocalBuf(2048), in);\n chain = PV_Diffuser(chain, MouseY.kr > 0.5);\n 0.5 * IFFT(chain).dup;\n}.play\n);\n\n(\nb = Buffer.read(s, ExampleFiles.child);\n\n// trig with MouseY crossing center of screen\n{\n var in, chain;\n in = PlayBuf.ar(1, b, BufRateScale.kr(b), loop: 1);\n chain = FFT(Local\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// trig with MouseY crossing center of screen\n{\n var in, chain;\n in = Mix.ar(SinOsc.ar(200 * (1..10), 0, Array.fill(10, { rrand(0.1, 0.2) })));\n chain = FFT(LocalBuf(2048), in);\n chain = PV_Diffuser(chain, MouseY.kr > 0.5);\n 0.5 * IFFT(chain).dup;\n}.play\n);\n\n(\nb = Buffer.read(s, ExampleFiles.child);\n\n// trig with MouseY crossing center of screen\n{\n var in, chain;\n in = PlayBuf.ar(1, b, BufRateScale.kr(b), loop: 1);\n chain = FFT(LocalBuf(2048), in);\n chain = PV_Diffuser(chain, MouseY.kr > 0.5);\n 0.5 * IFFT(chain).dup;\n}.play\n);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Routine.p` do?"}, {"role": "assistant", "content": "Convert the routine to a (subclass of) Returns: A Prout that (in response to `asStream`) acts as a generator of independent copies of the original routine (the receiver of `p`)."}]} -{"conversations": [{"role": "user", "content": "What does `SplineGui.setZoom` do? What arguments does it take?"}, {"role": "assistant", "content": "Zoom along the horizontal domain to a subset of the entire Arguments: argFromX — X value at the left edge; argToX — X value at the right edge."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a, b;\na = Pfinval(5, Pseq(#[1, 2, 3], inf));\nb = a.asStream;\n9.do({ b.next.postln });\n);\n\n\n// Pfinval used as a sequence of pitches\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\nvar c, b;\nc = Pn(Pfinval({ rrand(3, 5) }, Pseq([1, 2, 3\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a, b;\na = Pfinval(5, Pseq(#[1, 2, 3], inf));\nb = a.asStream;\n9.do({ b.next.postln });\n);\n\n\n// Pfinval used as a sequence of pitches\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\nvar c, b;\nc = Pn(Pfinval({ rrand(3, 5) }, Pseq([1, 2, 3, 4, 5, 6], inf)*4+65), inf);\nb = c.asStream;\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, b.next.midicps]);\n 0.12.wait;\n })\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// default initial params\n{ LatoocarfianL.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// default initial params\n{ LatoocarfianL.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar nome,layout;\nnome = Patch({ arg beat,freq,amp;\n Decay2.ar(\n K2A.ar(beat), 0.01,0.11,\n SinOsc.ar( freq, 0, amp )\n )\n },[\n BeatClockPlayer.new(4.0),\n StreamKrDur(\n Pseq([ 750, 500, 300, 500, 750, 500, 400, 500, 750, 500, 400, 500, 750, 500, 400, 500 ],inf),\n 1.0),\n StreamKrDur(\n Pseq([1,0.25,0.5,0.25,0.75,0.25,0.5,0.25,0.75,0.25,0.5,0.25,0.75,0.25\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar nome,layout;\nnome = Patch({ arg beat,freq,amp;\n Decay2.ar(\n K2A.ar(beat), 0.01,0.11,\n SinOsc.ar( freq, 0, amp )\n )\n },[\n BeatClockPlayer.new(4.0),\n StreamKrDur(\n Pseq([ 750, 500, 300, 500, 750, 500, 400, 500, 750, 500, 400, 500, 750, 500, 400, 500 ],inf),\n 1.0),\n StreamKrDur(\n Pseq([1,0.25,0.5,0.25,0.75,0.25,0.5,0.25,0.75,0.25,0.5,0.25,0.75,0.25,0.5,0.25] * 0.01,inf),\n 1.0)\n ]);\nlayout = FlowView.new;\n\nToggleButton(layout,\"Nome\",{\n if(nome.isPlaying.not,{ nome.play(atTime: 4) })\n},{\n if(nome.isPlaying,{ nome.stop })\n},minWidth: 250);\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Pdef(\\y, Pseq([Pdef(\\y), Pbind(\\instrument, \\gpdef)], inf);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Pdef(\\y, Pseq([Pdef(\\y), Pbind(\\instrument, \\gpdef)], inf));\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = {LFTri.ar(50+(1000*Maths2.ar(10, 10, 0.5, 1)[0]), 0, 0.1)}.play //notice how I am taking the [0]th channel of the Maths and ignoring the [1st channel.\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = {LFTri.ar(50+(1000*Maths2.ar(10, 10, 0.5, 1)[0]), 0, 0.1)}.play //notice how I am taking the [0]th channel of the Maths and ignoring the [1]st channel.\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Cleanroom (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n~t = 1; TempoClock.default.tempo = ~t;\n(\nSynthDef(\\ambifall3, { arg out=0, gate=1, amp=0.1, pan=0, freq=200;\n var sig;\n //thisThread.randSeed = 1923;\n\n sig = SinOsc.ar(freq);\n sig = Pan2.ar(sig, pan, amp);\n sig = ( WhiteNoise.ar + 0.8 ) * LFSaw.ar({ exprand(10.0,10000) }!20 * ( 1 + ( SinOsc.ar((1..4).rand(0.0)/18 * XLine.kr(1,121200,80)) * 1/41 * XLine.kr(1,0.1,60) )));\n sig = DelayC.ar(sig, 0.2, {rrand(1/5,1/10000) * ( 1 + ( SinOsc.ar((1..2).rand(0.0)/18 * XLine.kr(42,11200,60)) * 1/41 * XLine.kr(1,180,60) ))}!4) + sig / 2;\n sig = DelayC.ar(sig, 0.2, {rrand(1/5,1/10000) * XLine.kr(1/1000,1/20001,14)}!4) + sig / 2;\n sig = sig + BPF.ar(\n sig, \n { ( exprand(100.0,10000) * LFNoise1.ar(1/100.0.rand).range(1,2) ).clip(20,20000) }!10,\n { ( rand(0.01,1) * LFNoise1.ar(1/100.0.rand).range(1,2) ).clip(0.01,1) }!10\n );\n sig = BRF.ar(\n sig, \n { ( exprand(100.0,10000) * LFNoise1.ar(1/100.0.rand).range(1,2) ).clip(20,20000) }!10,\n { ( rand(0.01,1) * LFNoise1.ar(1/100.0.rand).range(1,2) ).clip(0.01,1) }!10\n );\n sig = LeakDC.ar(sig);\n sig = LPF.ar(sig, 17000 * XLine.kr(1,1/100,4));\n sig = sig * 5 * 3;\n sig = sig.mean;\n //sig = sig.clip;\n //sig = Compander.ar(sig, sig, \\cpt.kr(0.4), \\cpbelow.kr(1.001), \\cpabove.kr(0.009), \\cpclamp.kr(0.01), \\cprelax.kr(0.1));\n sig = Limiter.ar(sig, 1);\n sig = sig * EnvGen.kr(\\adsr.kr(Env.adsr(0.1,0.1,0.8,4.1)), gate, doneAction:2);\n sig = sig * amp;\n Out.ar(out, sig);\n}).add;\n);\n(\nPdef(\\part, Pdef(\\ambifall3, \n Ppar([\n Pseq([\n Pmono(\\ambifall3,\n \\freq, 2,\n \\dur, Pseq([1],4),\n \\amp, 0.1,\n ),\n Event.silent(4),\n ],inf),\n ])\n)).play;\n);\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `Pwalk` in SuperCollider briefly."}, {"role": "assistant", "content": "Pwalk — A one-dimensional random walk over a list of values that are embedded Category: Streams-Patterns-Events > Patterns > List."}]} -{"conversations": [{"role": "user", "content": "Write a bell in SuperCollider."}, {"role": "assistant", "content": "A bell is a set of inharmonic partials with a long percussive decay. The ratios below are the\nclassic bell ones; the envelope frees the Synth when it ends.\n\n```supercollider\n(\nSynthDef(\\bell, { |out = 0, freq = 440, amp = 0.2, dur = 3|\n var partials = [1, 2.76, 5.4, 8.93];\n var amps = [1, 0.5, 0.3, 0.15];\n var sig = SinOsc.ar(freq * partials) * amps;\n var env = EnvGen.kr(Env.perc(0.001, dur, 1, -6), doneAction: 2);\n Out.ar(out, Pan2.ar(Mix(sig) * env * amp, 0));\n}).add;\n);\nSynth(\\bell, [\\freq, 660, \\dur, 4]);\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Out.ar(87, SinOsc.ar(MouseX.kr(240, 1000, 1) * [1, 2, 3], 0, 0.2)) }.play; // play three sine tone on channels 87, 88, and 89\nx = Monitor.new; // create a new monitor\nx.play(fromIndex: 87, fromNumChannels: 3, toIndex: 0, toNumChannels: 2; // play them back to the stereo hardware channels\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Out.ar(87, SinOsc.ar(MouseX.kr(240, 1000, 1) * [1, 2, 3], 0, 0.2)) }.play; // play three sine tone on channels 87, 88, and 89\nx = Monitor.new; // create a new monitor\nx.play(fromIndex: 87, fromNumChannels: 3, toIndex: 0, toNumChannels: 2); // play them back to the stereo hardware channels\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// This question comes up sometimes.\n// one way to do it is to define an event type:\n\n\n(\nEvent.addEventType(\\dnote, { |server|\n \n var instrument = ~instrument.asDefName;\n var synthLib = ~synthLib ?? { SynthDescLib.global };\n var desc = synthLib.at(instrument);\n \n \n if (desc.notNil) {\n desc.controls.do { |x|\n x.defaultValue !? { x.name.asSymbol.envirPut(x.defaultValue) }\n };\n // for efficiency, get this now\n ~hasGate = desc.hasGate;\n ~msgFunc = desc.msgFunc;\n };\n ~type = \\note;\n \n currentEnvironment.play;\n});\n);\n\n(\nSynthDef(\\test, { |out, freq = 1000| \n Out.ar(out, Line.ar(0.1, 0, 0.1, doneAction:2) * SinOsc.ar(freq)) \n}).add\n);\n\nPbind(\\type, \\dnote, \\instrument, \\test, \\dur, 0.3).play;\n```"}, {"role": "assistant", "content": "One answer to the question \"how to use the SynthDef's default argument in an Event?\"."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\ns.scope(16);\n\n{ Out.ar(87, SinOsc.ar(MouseX.kr(40, 10000, 1) * [1, 2, 3], 0, 0.2)) }.play;\nx = Monitor.new;\nx.play(87, 3, 1, 2);\nx.out = 0;\nx.stop(3.0);\nx.play(87, 1, 0, 1); // in > out : now mixes down (wrapping)\nx.play(89, 1, 0, 2); // in < out : now distributes to 2 channels\nx.stop;\n\n// multiple play\nx.play(87, 1, 0, 2, multi: true);\nx.play(88, 1, 0, 2, multi: true);\nx.play(89, 1, 0, 2, multi: true;\nx.stop;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\ns.scope(16);\n\n{ Out.ar(87, SinOsc.ar(MouseX.kr(40, 10000, 1) * [1, 2, 3], 0, 0.2)) }.play;\nx = Monitor.new;\nx.play(87, 3, 1, 2);\nx.out = 0;\nx.stop(3.0);\nx.play(87, 1, 0, 1); // in > out : now mixes down (wrapping)\nx.play(89, 1, 0, 2); // in < out : now distributes to 2 channels\nx.stop;\n\n// multiple play\nx.play(87, 1, 0, 2, multi: true);\nx.play(88, 1, 0, 2, multi: true);\nx.play(89, 1, 0, 2, multi: true);\nx.stop;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for number 10 for Quiz 4a."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var tri, bpf;\n tri = LFTri.ar(\n freq: [440,340, 513],\n mul: LFPulse.kr(\n freq: [6,3,2],\n width: 0.15));\n bpf = SinOsc.ar(in: tri, freq: LFNoise2.kr(4).range(400,1000));\n Splay.ar(tri,bpf);\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `View.parent` do?"}, {"role": "assistant", "content": "The basic visible element of GUI Returns: The view's parent view, or nil if the view is a top view."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// zig zag partial dome\na = VBAPSpeakerArray.new(3, [[-22.5, 14.97], [22.5, 14.97], [-67.5, 14.97], [67.5, 14.97], [-112.5, 14.97], [112.5, 14.97], [-157.5, 14.97], [157.5, 14.97], [-45, 0], [45, 0], [-90, 0], [90, 0], [-135, 0], [135, 0], [0, 0], [180, 0]]);\n\nb = Buffer.loadCollection(s, a.getSetsAndMatrices);\n\n(\n// pan around the circle up and down\nx = { |azi = 0, ele = 0, spr = 0|\n var source;\n source = PinkNoise.ar(0\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// zig zag partial dome\na = VBAPSpeakerArray.new(3, [[-22.5, 14.97], [22.5, 14.97], [-67.5, 14.97], [67.5, 14.97], [-112.5, 14.97], [112.5, 14.97], [-157.5, 14.97], [157.5, 14.97], [-45, 0], [45, 0], [-90, 0], [90, 0], [-135, 0], [135, 0], [0, 0], [180, 0]]);\n\nb = Buffer.loadCollection(s, a.getSetsAndMatrices);\n\n(\n// pan around the circle up and down\nx = { |azi = 0, ele = 0, spr = 0|\n var source;\n source = PinkNoise.ar(0.2);\n VBAP.ar(16, source, b.bufnum, LFSaw.kr(0.5, 0).range(-180, 180) * -1, SinOsc.kr(3, 0).range(0, 14.97), spr);\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `DetectSilence`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"detectSilence-help\", { |out|\n var z;\n z = SinOsc.ar(Rand(400, 700), 0, LFDNoise3.kr(8).max(0)).softclip * 0.3;\n DetectSilence.ar(z, doneAction: Done.freeSelf);\n Out.ar(out, z);\n}).add;\n);\n\nSynth(\"detectSilence-help\");\nSynth(\"detectSilence-help\");\nSynth(\"detectSilence-help\");\n\n\n(\nTask({\n loop({\n Synth(\"detectSilence-help\");\n [0.5, 1].choose.wait;\n })\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n(\nx = {\n |lookBack = 3, thr = 1|\n var trig = Impulse.ar(7);\n // for a non-integer source it makes sense to take a sufficiently large threshold thr\n var midi = Demand.ar(trig, 0, DIdev(SinOsc.ar(0.2, 0, 15, 82), 5, -6, 5, lookBack, thr: thr));\n midi.poll(7, label: \\midi);\n SinOsc.ar(midi.midicps.lag(0.007)) ! 2 * 0.1\n}.play;\n);\n\n// close floats can occur here \nx.set(\\thr, 0.01)\n\n// not here\nx.set(\\thr, 2)\n\nx.release\n```"}, {"role": "assistant", "content": "for a non-integer source it makes sense to take a sufficiently large threshold thr close floats can occur here (DIdev: pseudo drate ugen, searches for numbers with integer distance from a source signal, optionally avoiding repetitions within a span)"}]} -{"conversations": [{"role": "user", "content": "What does `SplineGui.setDomainSpec` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: dsp — (describe argument here); setGridLines — (describe argument here). Returns: ControlSpec"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Multichannel Convolution Reverb (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\n~numIRs = 4;\n~fftsize = 2048;\ns.waitForBoot {\n var irs, irbuffs, bufsizes, nextmod, numSamples;\n nextmod = 100;\n numSamples = 40000 ;\n \n /* an array of multiple IRs */\n irs = ~numIRs.collect{ arg nth;\n // nth is here not used, but can be useful to scale decay time.\n [0] ++ 0.dup(100) ++ Array.fill(\n numSamples, { arg i;\n (i%nextmod==0).if\n {\n nextmod= rrand(80, 120);\n (i.asFloat/numSamples).squared * 0.3\n } {\n 0\n }\n }\n )\n };\n { irs.plot }.defer; // to show irs.\n \n /* an array of buffers. */\n irbuffs = ~numIRs.collect{ arg i; Buffer.loadCollection(s, irs[i]) };\n irbuffs.postln; // to show irbuffs info.\n s.sync;\n \n bufsizes= irbuffs.collect{ |nth|PartConv.calcBufSize(~fftsize, nth) };\n ~irSpctrms = bufsizes.collect{ arg size, i;\n Buffer\n .alloc(s, size, 1)\n .preparePartConv(irbuffs[i], ~fftsize)\n };\n s.sync; \n \n ~numIRs.do{|i| irbuffs[i].free}\n}\n);\n\n(\nfork{\n ~target= Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n s.sync;\n {\n var in, krnl;\n in= PlayBuf.ar(1, ~target, loop:1);\n \n /* an array of multiple instances of PartConv */\n krnl= ~numIRs.collect{ arg i;\n PartConv.ar(in, ~fftsize, ~irSpctrms[i].bufnum, 0.2)};\n // By iterating, each PartConv processes a mono-channel buffer in the array ~irSpctrms.\n \n Out.ar(0, krnl);\n }.play\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `BufferProxy.prepareToBundle` do? What arguments does it take?"}, {"role": "assistant", "content": "allocates a Buffer on play Arguments: group; bundle."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Impulse`."}, {"role": "assistant", "content": "```supercollider\n{ Impulse.ar(800, 0.0, 0.5, 0) }.play\n\n{ Impulse.ar(XLine.kr(800, 100, 5), 0.0, 0.5, 0) }.play\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Logistic`."}, {"role": "assistant", "content": "```supercollider\n// default values\n{ Logistic.ar }.play\n\n// onset of chaos\n{ Logistic.ar(Line.kr(3.55, 3.6, 5), 1000) }.play\n\n// explore via Mouse\n{ Logistic.ar(MouseX.kr(3, 3.99), MouseY.kr(10, 10000, 'exponential'), 0.25, 0.5) }.play\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `TaskProxy`."}, {"role": "assistant", "content": "```supercollider\n(\n#a, c = { TaskProxy.new } ! 2;\na.source = { \"one\".postln; 1.wait; \"two\".postln };\nc.source = { var z; z = Synth(\\default); 0.5.wait; z.release };\nr = Task {\n \"counting...\".postln;\n 2.wait;\n a.embedInStream;\n 1.wait;\n c.embedInStream;\n \"done.\".postln;\n};\n);\n\nr.play; // play a stream\n\nc.source = { var z; z = Synth(\\default, [\\freq, 300]); 1.5.wait; z.release }; // change the def\n\nr.reset;\nr.play;\n\n// of course TaskProxies can be used in other Tdefs:\n(\nb = TaskProxy.new;\nb.source = {\n \"counting...\".postln;\n 2.wait;\n a.embedInStream;\n 1.wait;\n c.embedInStream;\n \"done.\".postln;\n};\n);\nb.playOnce;\n\n// if one wants to branch off a stream in a separate thread, asStream is used.\n(\nRoutine {\n c.asStream.play;\n 0.1.wait;\n c.asStream.play;\n 0.1.wait;\n a.asStream.play;\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns.waitForBoot {\n // Open a plotTree window with a refresh rate of 2 seconds:\n s.plotTree(2);\n\n // Define and play a repeating pattern that generates a new synth every 0.5 seconds:\n x = Pn((dur: 0.5, midinote: 69, amp: 0.1)).play;\n\n /*\n Since the plotTree window refreshes every 2 seconds,\n displaying only the most recent node,\n the first node will appear after a 2-second delay (once four notes have played),\n meaning only every fourth synth node is visible.\n */\n\n 5.wait; // wait for 5 seconds.\n\n x.stop; // stop the playback of the pattern\n\n 2.wait; // wait for 2 seconds.\n\n s.nodeTreeV\n// …\n```"}, {"role": "assistant", "content": "Open a plotTree window with a refresh rate of 2 seconds: Define and play a repeating pattern that generates a new synth every 0.5 seconds: (Server: Object representing a server application)"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// NTMI.zoom sets all the influx'es inScalers AND RandomOrbit's excursion from current state.\n\nNTMI.zoom = NTMI.zoom?1;\n\n// tune this for jitter on zoom pot on NTMI\nSpec.add(\\zoom, [0, 1, \\lin, 0.025]);\n\nNTMI.setZoom = {|ev, val|\n val = \\zoom.asSpec.constrain(val);\n // \"global ZOOM f. RandomOrbits and Influxes: %\\n\".postf(val);\n NTMI.zoom = val;\n\n NTMI.inphlux.inScaler = NTMI.zoom;\n \"zoom: %\\n\".postf(NTMI.zoom);\n // return value\n val\n};\n// increment / decrement\nNTMI.incZoom = {|ev, inc=0.1|\n NTMI.setZoom((NTMI.zoom + inc));\n};\n```"}, {"role": "assistant", "content": "NTMI.zoom sets all the influx'es inScalers AND RandomOrbit's excursion from current state."}]} -{"conversations": [{"role": "user", "content": "What does `ServerLog.remove` do?"}, {"role": "assistant", "content": "records OSC traffic to and from a Server and displays this in a browseable searchable interface Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "What is Env.perc and what does it take?"}, {"role": "assistant", "content": "`Env.perc(attackTime, releaseTime, level, curve)` — an attack to `level` (default 1) then a decay to zero, with curve defaulting to -4 (an exponential-ish decay). `Env.perc(0.01, 1)` is the default percussive envelope, and it is a complete Env, not a generator: pair it with EnvGen to hear it."}]} -{"conversations": [{"role": "user", "content": "What does `PMouseX.new` do? What arguments does it take?"}, {"role": "assistant", "content": "UGenPatterns quark library Arguments: minval; maxval; warp — 0 for linear and 1 for exponential. The symbols CODE\\linear and CODE\\exponential also work.; lag; length — Number of values produced.."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nt = TempoClock(120/60).permanent_(true);\n\n(\n~change_clock_tempo = {|clock, tempo, beats=1|\n beats.do {|beat|\n var stepTempo = beat.linexp(0, beats-1, clock.tempo, tempo);\n clock.schedAbs(clock.nextBar + beat, {\n \"New Tempo: \".post; (stepTempo*60).post; \" BPM\".postln;\n clock.tempo_(stepTempo);\n });\n };\n nil;\n};\nPbindef(\\n,\n \\octave, 4,\n \\dur, 0.5,\n \\degree, Pseq((0..7), inf)\n).play(t, quant: 4);\n);\n\n~change_clock_tempo.value(t, 200/60, 16);\n~change_clock_tempo.value(t, 50/60, 8);\nt.tempo*60\n```"}, {"role": "assistant", "content": "This gradually changes the tempo of a TempoClock, each beat of a specified number of beats, and starting at the next bar.\r\n\r\n\r\nPersonally, I was not able to heavily distinguish between `.linlin` and `.linexp` for reasonable musical tempos.\r\n\r\n\r\nThere may be a mathematically smoother way of handling this at the control rate.\r\n\r\n\r\nThis function does not gracefully handle multiple simultaneous invoca."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n var saw, bpf;\n saw = Saw.ar(\n freq: [1700,2000],\n mul: LFPulse.kr(\n freq: [2,7],\n width: 0.115));\n bpf = LPF.ar(in: saw, freq: SinOsc.kr(1/3).range(250, 4000)); \n}.play;\n)\n```"}, {"role": "assistant", "content": "Quiz 4a for MUSC 115, pp. 62-84 from Gentle Intro to SuperCollider."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// modulate frequency\n{ Pulse .ar(XLine.kr(40,4000,6),0.1, 0.2) }.play;\n{ PulseDPW.ar(XLine.kr(40,4000,6),0.1, 0.2) }.play;\n\n// two band limited square waves thru a resonant low pass filter\n{ RLPF.ar(Pulse .ar([100,250],0.5,0.1), XLine.kr(8000,400,5), 0.05) }.play;\n{ RLPF.ar(PulseDPW.ar([100,250],0.5,0.1), XLine.kr(8000,400,5), 0.05) }.play;\n```"}, {"role": "assistant", "content": "modulate frequency two band limited square waves thru a resonant low pass filter (PulseDPW: super-efficient square-wave oscillator with low aliasing)"}]} -{"conversations": [{"role": "user", "content": "What does `LevelIndicator.critical` do? What arguments does it take?"}, {"role": "assistant", "content": "Set the warning and critical thresholds. If meter value is above either threshold, #-warningColor or #-criticalColor will be shown, respectively (by default, yellow and red). If #-drawsPeak is true warning color will be displayed based on #-peakLevel rather than Arguments: val — A Float. `a = LevelIndicator(bounds: Rect(10, 10, 20, 160)).front;`."}]} -{"conversations": [{"role": "user", "content": "Explain `AbstractSFPGui` in SuperCollider briefly."}, {"role": "assistant", "content": "AbstractSFPGui — gui class Category: Libraries > crucial > GuiClasses."}]} -{"conversations": [{"role": "user", "content": "What are the arguments of Pan2?"}, {"role": "assistant", "content": "`Pan2.ar(in, pos, level)` — in is the mono signal, pos is -1 (left) to 1 (right) with 0 in the middle, and level scales the output. It is equal-power, so a centred signal is -3 dB per channel rather than half amplitude. `Pan2.ar(sig, SinOsc.kr(0.1))` is the simplest autopan."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for reverbio (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"reverb\", {arg freq=440, release=0.1;\n var in, s1,out, mod1, depth, mfreq;\n s1 = SoundIn.ar(0,mul:2);\n out=FreeVerb.ar(s1,mix:1,room:MouseX.kr(0,1),damp:MouseY.kr(0,1));\n Out.ar(0,out);\n Out.ar(1,out);\n}).load(s);\n);\na = Synth(\"reverb\");\na.free\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot // Boot the server, if you need to\n\n// read a whole sound into memory\n\n// ExampleFiles helps locate audio files used in examples\np = ExampleFiles.child;\n// peek at the path to see location and the format of a path\np.postln;\n// read the file into a buffer\nb = Buffer.read(s, p); // remember to free the buffer later.\n\nSynthDef(\\help_PlayBuf, { |out = 0, bufnum = 0|\n Out.ar(out,\n PlayBuf.ar(1, bufnum, BufRateScale.kr(bufnum), doneAction: Done.freeSelf)\n )\n}).play(s, [\\out, 0, \\bufnum, b];\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot // Boot the server, if you need to\n\n// read a whole sound into memory\n\n// ExampleFiles helps locate audio files used in examples\np = ExampleFiles.child;\n// peek at the path to see location and the format of a path\np.postln;\n// read the file into a buffer\nb = Buffer.read(s, p); // remember to free the buffer later.\n\nSynthDef(\\help_PlayBuf, { |out = 0, bufnum = 0|\n Out.ar(out,\n PlayBuf.ar(1, bufnum, BufRateScale.kr(bufnum), doneAction: Done.freeSelf)\n )\n}).play(s, [\\out, 0, \\bufnum, b]);\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Env`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var env = Env([0.0, 0.5, 0.0, 1.0, 0.9, 0.0], [0.05, 0.1, 0.01, 1.0, 1.5], -4);\n var envgen = EnvGen.ar(env, doneAction: Done.freeSelf);\n env.plot;\n SinOsc.ar(\n envgen * 1000 + 440\n ) * envgen * 0.1\n}.play\n);\n```"}]} {"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// Resonator, must subtract blockSize for correct tuning\n(\nSynthDef(\"testRes\", {\n \nvar freq = 300, localIn, input, limitLevel = 0.2, output;\nvar feedbackAmt = 0.999;\n\nfreq = MouseY.kr(20, 678, \\exponential).poll;\nfeedbackAmt = MouseX.kr(0.2, 0.99999).poll;\nlocalIn = LocalIn.ar(1); \ninput = LFNoise1.ar(freq * 16, 0.2);\ninput = input + Dust2.ar(freq);\n\n\nLocalOut.ar(\n HPF.ar(LPF.ar(DelayC.ar(input + (localIn * feedbackAmt), 2, freq.reciprocal - ControlRate.ir.reciprocal), freq * 8), freq * 0.125)\n);\n\noutput = Limiter.ar(localIn, limitLevel, 0.01) * limitLevel.reciprocal;\nOffsetOut.ar(0, output ! 2);\n\n}).play(s);\n\n)\n```"}, {"role": "assistant", "content": "Using filtered feedback with a noise input to produce a tone. Some bass notes turn a little noisy if the freq is left at one value for a few seconds. It's worth scoping this too.\r\nRoom for improvement: some of the vars could / should be arguments."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `NdefGui`."}, {"role": "assistant", "content": "```supercollider\n(\np = ProxySpace.push(s.boot);\n\nl = NdefGui(nil, 3).moveTo(10, 120);\nm = NdefGui(nil, 3).moveTo(10, 240);\nn = NdefGui(nil, 3).moveTo(10, 360);\no = NdefGui(nil, 3).moveTo(10, 480);\n\nSpec.add(\\dens, [0.1, 300, \\exp]);\n\n// make 3 kinds of proxies: using tilde/proxyspace, Ndef, and unnamed.\n~spacy = { |dens = 5| Formlet.ar(Dust.ar(dens ! 2), LFDNoise0.kr(20 ! 2).lag(0.1).linexp(-1, 1, 300, 5000), 0.003, 0.03) };\nNdef(\\ndeffy, { GrayNoise.ar(0.1 ! 2) });\nc = NodeProxy.audio.source_({ PinkNoise.ar(0.1 ! 2) });\n\n// put one in each editor\nl.object_(~spacy);\nm.object_(Ndef(\\ndeffy));\nn.object_(c);\n);\n// One should also be able to drag and drop text into the drag,\n// but this is also not working yet.\n( Ndef(\\a) )\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nSynthDef(\\dubecho,{|in, out, length = 1, fb = 0.8, sep = 0.012|\n var input = In.ar(in, 2);\n var feedback = LocalIn.ar(2);\n var output = LeakDC.ar(feedback*fb + input);\n output = HPF.ar(output, 400);\n output = LPF.ar(output, 5000);\n output = output.tanh;\n LocalOut.ar(DelayC.ar(output, 1, LFNoise2.ar(12).range([length,length+sep],[length+sep,length])).reverse);\n ReplaceOut.ar(out, output);\n}).add;\n\n// Example as effecet bus\n~bus = Bus.audio(s, 2);\n~echo = Synth(\\dubecho, [\\in, ~bus, \\length, TempoClock.default.tempo*(3/8), \\fb, 0.7, \\sep, 0.0012], addAction: \\addToTail);\n\n// send something\nplay{ Out.ar(~bus, LFGauss.ar(1, 0.1, loop:0, doneAction:2) * Blip.ar(80!2, 8)) }\n\n// turn it off\n~echo.free;\n```"}, {"role": "assistant", "content": "Fork of Bjorn's Dub echo, rewritten w/o the Feedback Quark (using LocalIn + LocalOut) and adding a ping pong (can be removed by deleting the .reverse method in the LocalOut line)."}]} -{"conversations": [{"role": "user", "content": "Explain `Ppoisson` in SuperCollider briefly."}, {"role": "assistant", "content": "Ppoisson — random values that follow a Poisson Distribution (positive integer values) Category: Streams-Patterns-Events > Patterns > Random."}]} -{"conversations": [{"role": "user", "content": "What does `History.recordLocally` do?"}, {"role": "assistant", "content": "get and set flag to turn recording local code evaluation on and"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for tired pads."}, {"role": "assistant", "content": "```supercollider\n// this is what I write when I didn't sleep last night.. zzzzzz\n// easy subsynth with dynklank and simple scale\n\n(\n\nfork{ \n loop{\n var time;\n time = 5.rand;\n {\n var sound, freqs, envs, rings, numvoices, env;\n numvoices = 40;\n freqs = {(Scale.major(\\just).degrees+26+\n (0,12..110).choose).choose}.dup(numvoices).midicps;\n rings = {1.0.rand}.dup(numvoices);\n envs = { EnvGen.kr(Env.linen( time/3.0.rand, \n time/3.0.rand, time/3.0.rand, 1.0.rand ) ) }.dup(numvoices);\n \n sound = PinkNoise.ar(numvoices.reciprocal!2);\n sound = DynKlank.ar(`[freqs,envs,rings], sound );\n sound = sound * EnvGen.kr(Env.linen(time.rand,time/3,time.rand),doneAction:2);\n \n sound = HPF.ar(sound, 120);\n \n 4.do{sound = DelayC.ar(sound, 0.4, [0.4.rand,0.4.rand], 1/8, sound) };\n \n //good call - lets turn this down \n sound*0.2;\n }.play;\n time.rand.wait;\n }\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes ~chaos2 (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\n~chaos2={\n var signal, myFrequency, frequencyMin=0.1, frequencyMax=30, myAmplitude, amplitudeMin=0.01, amplitudeMax=0.6, myPhase, phaseMin=0, phaseMax=1.5;\n myFrequency = Array.fill(2, {[rrand(frequencyMin, frequencyMax)]});\n myAmplitude = Array.fill(2, {[rrand(amplitudeMin, amplitudeMax)]});\n myPhase = Array.fill(2, {[rrand(phaseMin, phaseMax)]});\n signal = LeakDC.ar(ChaosGen.allSubclasses.choose.ar(myFrequency, myPhase, myAmplitude));\n myFrequency = (myFrequency + Array.fill(2, {[rrand(frequencyMin, frequencyMax)]})) * (signal);\n myAmplitude = (myAmplitude + Array.fill(2, {[rrand(amplitudeMin, amplitudeMax)]})) * (signal);\n myPhase = (myPhase + Array.fill(2, {[rrand(phaseMin, phaseMax)]}))* (signal);\n signal = LeakDC.ar(ChaosGen.allSubclasses.choose.ar(myFrequency, myPhase, myAmplitude));\n myFrequency = (myFrequency + Array.fill(2, {[rrand(frequencyMin, frequencyMax)]})) * (signal);\n myAmplitude = (myAmplitude + Array.fill(2, {[rrand(amplitudeMin, amplitudeMax)]})) * (signal);\n myPhase = (myPhase + Array.fill(2, {[rrand(phaseMin, phaseMax)]}))* (signal);\n signal = LeakDC.ar(ChaosGen.allSubclasses.choose.ar(myFrequency, myPhase, myAmplitude));\n Out.ar(0, LeakDC.ar(signal * 0.3));\n};\n);\n\n~chaosmegafeedback={Mix.new(~chaos2 ! 16) * 0.00000000000000000000000003}.scope;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SharedBus.releaseBus` do? What arguments does it take?"}, {"role": "assistant", "content": "this will not actually release the bus unless the supposedOwner really is the owner. so the children will try to free it, but only the parent can actually Arguments: supposedOwner."}]} -{"conversations": [{"role": "user", "content": "What is `UserView` in SuperCollider?"}, {"role": "assistant", "content": "UserView — A custom drawn view using Pen An empty view on which you can draw using the Pen class. Category: GUI > Views."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for it goes beyond vibrato too."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"vibrato\", {arg freq=440, release=0.1;\n var x, sig,out, mod1, depth, mfreq,maxfreq, maxdepth, maxdelay, basedelay;\n maxfreq=5;\n maxdelay=0.1;\n basedelay=maxdelay/2;\n maxdepth=basedelay/2;\n depth = MouseY.kr(0,maxdepth);\n mfreq = MouseX.kr(0,maxfreq);\n mod1 = SinOsc.ar(mfreq,0,depth);\n sig = SoundIn.ar(0,mul:2);\n x = DelayC.ar(sig, maxdelay,basedelay+ mod1);\n out = x;// FreeVerb.ar(x,MouseX.kr(0,1),MouseY.kr(0,1), 0.1);\n Out.ar(0,out);\n Out.ar(1,out);\n}).load(s);\n);\n\na = Synth(\"vibrato\");\na.free\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Change arg values of MIDIdef after instantiation."}, {"role": "assistant", "content": "```supercollider\n~mdef =\n{\n |key, func, msgNum, permanent = true|\n\n MIDIdef(key, func ?? { MIDIdef(key).func }, msgNum ? MIDIdef(key).msgNum, MIDIdef(key).chan, MIDIdef(key).msgType, MIDIdef(key).srcID).permanent_(permanent)\n}\n```"}]} -{"conversations": [{"role": "user", "content": "What is `MIDIFuncSrcMessageMatcher` in SuperCollider?"}, {"role": "assistant", "content": "MIDIFuncSrcMessageMatcher — Matches incoming MIDI messages to responder funcs based on message source This is used by MIDIMessageDispatcher to match incoming MIDI messages to instances of MIDIFunc or MIDIdef using message source. This class is private, and generally users should not need to address instances directly. Category: External Control > MIDI > Matchers."}]} -{"conversations": [{"role": "user", "content": "Explain `OnePole` in SuperCollider briefly."}, {"role": "assistant", "content": "OnePole — One pole filter. A one pole filter. Implements the formula: Category: UGens > Filters > Linear."}]} -{"conversations": [{"role": "user", "content": "What is `Node`?"}, {"role": "assistant", "content": "Node — Abstract superclass of Synth and Group"}, {"role": "user", "content": "What does `Node.free` do?"}, {"role": "assistant", "content": "Stop this Node and free it from its parent group on the server. Once a Node has been freed, you cannot restart it."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\nx = Synth(\"default\");\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Hilbert.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Applies the Hilbert transform to an input signal. Arguments: in — The input signal to transform.; mul — Output will be multiplied by this value.; add — This value will be added to the output.."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Nested ifs in a SynthDef?"}, {"role": "assistant", "content": "```supercollider\n(\n{\nvar noise, out;\nnoise = LFNoise0.kr(8);\n\nout = if( noise > 0.0,\n if(noise > 0.5, \n if(noise > 0.9, WhiteNoise.ar(0.2), Pulse.ar(60, 0.5, 0.4)),\n SinOsc.ar(500, 0, 0.25)\n ),\n Saw.ar(160, 0.5)\n);\n\nout ! 2\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `SendPeakRMS`?"}, {"role": "assistant", "content": "SendPeakRMS — Track peak and power of a signal for GUI applications."}, {"role": "user", "content": "What does `SendPeakRMS.ar` do?"}, {"role": "assistant", "content": "Unlike with other unit generators, the `ar` and `kr` methods do not specify the rate of the computation, but the granularity. When the SendPeakRMS ugen is instantiated with `kr`, the reply rate is quantized to control-rate blocks."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\n{\n SendPeakRMS.kr(Dust.ar(20), 20, 3, \"/replyAddress\")\n}.play;\n);\n\n(\no = OSCFunc({ |msg|\n \"peak: %, rms: %\".format(msg[3], msg[4]).postln\n}, '/replyAddress');\n);\no.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Where does the magic frequency 261.6255653006 come from?"}, {"role": "assistant", "content": "SuperCollider forum — Where does the magic frequency 261.6255653006 come from?\n\nThinking about this a bit more, on one hand it might be useful if set (and everything else in Event) could fetch not only the msgFunc from the synthDesc, which it does (if args are set to []), but perhaps also the default values for the synth controls... and then used those in preference to Event defaults if “nothing is specified” for some key in the event. Alas “nothing is specified” is tedious to detect in Event, as it does its own calculations which have a lot of inputs (esp. for the frequency stuff). So, one could implement such a policy more explicitly in a \\finish callback that e.g. looks up in synthDesc only specific keys (say specified in a defArgs, possibly with [] meaning all found in the synthDesc) and sets only those if “not set” in event.\n\nI almost started coding this idea, but I realised that’s actually inferior to just putting the synth defaults in another event/environment, and chaining that before the event... which is exactly what I usually do with a Pdef.envir. That approach, besides sidestepping the issue of detecting what’s “not set” in the Event, has an extra advantage that a persistent set of defaults, after being initialized with the synthdef ones, can be easily tweaked in a gui. When I find myself that I often change the default value of some control like that, I go back and change the synthdef default. Because of that workflow, in which I always have the defaults loaded in an chained envir, I didn’t even have much realization of Event defaults for things like amp, freq etc. And I didn’t need type: \\set much until recently... for which getting the args constructed in that case is also rather easy as Pdef(...).controlKeys. Even without Pdefs, that’s straightforward (past loading those defaults into an event)\n\n```supercollider\ne = SynthDescLib.global.synthDescs.at(\\default).controls.inject((), { |e, c| e[c.name] = c.defaultValue });\n(instrument: \\default, dur: 1, amp: 0.2).next(e).play\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for our first work and posting."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"pulse\",{ arg freq,delayTime,amp = 1.0,attack = 0.01;\n var out,out2,env;\n env = EnvGen.kr(Env.perc(attack, 1, 5, 10),doneAction: 2);\n z = SinOsc.ar(freq,0,0.7);\n a = Pan2.ar(ToggleFF.ar(TDelay.ar(z,delayTime)) * SinOsc.ar(freq),\n SinOsc.kr(3,0), 0.6);\n out = Pan2.ar(z, SinOsc.kr(5,1.0pi),0.7 ) + a;\n out = out * env;\n out = out.clip2(1);\n \n Out.ar(0,FreeVerb.ar(out,0.7,1.0,0.4, amp)); \n}).send(s);\n\nSynthDef(\"droneee\", { arg freq = 440, amp = 1.0, outbus = 0, phase = 0;\n var out, env;\n env = EnvGen.kr(Env.sine(10),doneAction: 2);\n out = LFPulse.ar(freq , 0.15);\n out = RLPF.ar(out,SinOsc.kr(0.3, 0, 200, 1500), 0.1);\n out = FreeVerb.ar(out, 0.5, 0.5, 0.5) * env;\n out = Pan2.ar(out, SinOsc.kr(1/10, phase),amp);\n \n Out.ar(outbus, out);\n}).send(s);\n\n\nSynthDef(\"bass\",{\n arg freq,amp,outbus=0;\n var env,out;\n out = SinOsc.ar(freq,0,amp);\n env = EnvGen.kr(Env.perc(0.5,1,1,0),doneAction: 2); \n out = out*env;\n out = Pan2.ar(out,0);\n Out.ar(outbus,out);\n \n \n}).send(s);\n);\n\n\n(\n\np = Prand( [31,40, 45,64,68,69], inf).asStream;\nq = Prand( [3,0.7,1,0.5], inf ).asStream;\ne = Prand([59,72,76,79,81,88,90],inf).asStream;\n\nt = Task({\n inf.do({\n \n if( 0.1.coin, {\n Synth(\"pulse\",\n [\\freq,e.value.midicps,\n \\amp,0.07.rand +0.2,\n \\attack,7.0.rand,\n \\delayTime, 0.02;\n ]);\n });\n\n\n Synth(\"droneee\",\n [\\outBus,0,\n \\freq, p.value.midicps,\n \\amp, (0.02.rand2 + 0.05) * 0.7,\n \\phase,[0,1.5pi].wchoose([0.5,0.5]);\n ]);\n q.value.wait;\n \n Synth(\"bass\",[\\freq,31.value.midicps,\\amp,0.3]);\n\n });\n});\n\nt.start;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `NodeProxy.defaultFadeTime` do?"}, {"role": "assistant", "content": "The overlap time between successive source replacements which all instances have by default. Each instance has its own value which can be set via"}]} -{"conversations": [{"role": "user", "content": "How does multi-channel expansion work?"}, {"role": "assistant", "content": "If any argument of a UGen is an Array, the UGen is built once per element and the results are returned as an Array. So `SinOsc.ar([220, 330, 440])` is three oscillators, and `SinOsc.ar(220 * [1, 1.5])` is two. This is not a special stereo feature: it is uniform expansion, which is why `Splay.ar(SinOsc.ar([220,330,440]) * 0.1)` gives you a spread stereo field from three mono sources."}]} -{"conversations": [{"role": "user", "content": "I get 'Buffer UGen: no buffer data'. What does it mean?"}, {"role": "assistant", "content": "The UGen got a bufnum that the server has no data for. `Buffer.read` is asynchronous: the Buffer object exists immediately but the samples arrive later, so a Synth created straight after `Buffer.read` reads nothing. Wait for it — `s.sync` after the read, or `Buffer.read(s, path, action: { |b| ... })` and create the Synth in the action. The other cause is a nil or wrong buffer: `PlayBuf.ar(1, ~buf)` where ~buf was never assigned passes 0, which is 'no buffer'."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for redo_minimalish sketch."}, {"role": "assistant", "content": "```supercollider\n//redFrik - redo_minimalish sketch\n(\ns.waitForBoot{\n \n SynthDef(\\p, {|out= 0, freq= 400, amp= 0.1, gate= 1, detune= 0|\n var env= EnvGen.ar(Env.perc(Rand(0.001, 0.01), LinRand(0.2, 0.4), amp, Rand(-9, -1)), doneAction:2);\n var snd= Mix(SinOsc.ar(freq+[0, detune*0.1], env*2pi));\n Out.ar(out, Pan2.ar(snd*env, Rand(-1, 1)));\n }).add;\n Ndef(\\p, Pspawn(Pbind(\\method,\\par,\\delta,1/8,\\pattern,{Pbind(\\instrument, \\p, \\dur,a=Pseq((1..9).sputter),\\sustain,1/8/a,\\degree,a,\\detune,a)})));\n Ndef(\\p).play(vol:0.5);\n \n Ndef(\\t, {\n var mod= Saw.ar([3, 4], Saw.ar(1, 32, 128), Duty.ar(1, 0, flop(Dseq([0, 8, 1, 5])*[1, 4, 8])));\n var snd= SinOsc.ar(Saw.ar(2, 64, 99), mod)/9;\n CombN.ar(snd, 1/4, 1/4.125, SinOsc.kr(0.005, 1.5pi).range(0, 6));\n });\n Ndef(\\t).play(vol:0.5);\n \n Routine.run({\n var cnt= 1;\n loop{\n var syn;\n cnt= cnt%8+1;\n syn= {\n var del= DelayN.ar(InFeedback.ar(0, 2)+(InFeedback.ar(100, 2)), 1, 1);\n SinOsc.ar(cnt*99+[0, 2], del[1..0])/4;\n }.play(outbus: 64);\n {syn.release(16)}.defer(9-cnt);\n wait(9-cnt);\n };\n });\n Ndef(\\c, {InFeedback.ar(64, 2)}).play(vol:0.5);\n \n Ndef(\\r, {\n var lfos= LFNoise1.ar(0.5!2);\n var snd= Crackle.ar(lfos.range(1.8, 1.98));\n Formlet.ar(snd, TExpRand.ar(200, 2000, lfos).lag(2), lfos.range(5e-4, 1e-3), 0.0012);\n });\n Ndef(\\r).play(vol:0.25);\n \n Routine.run({\n loop{\n var syn= {\n var snd= Pluck.ar(Crackle.ar([1.9, 1.8]), Mix(Impulse.ar({5.linrand+1}!2, -0.125)), 0.05, 0.05.linrand);\n BPF.ar(snd, 2000.rand+100, 0.25.rrand(1.75));\n }.play(s, 62, 18);\n {syn.release(69)}.defer(18);\n wait(18);\n };\n });\n Ndef(\\m, {InFeedback.ar(62, 2)*SinOsc.kr(0.006).range(0.25, 1)}).play(vol:0.5);\n \n NdefMixer(s);\n s.meter;\n};\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `View.resizeTo` do? What arguments does it take?"}, {"role": "assistant", "content": "Resize the view, preserving its Arguments: width — An Int: the new horizontal size of the view.; height — An Int: the new vertical size of the view.."}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n~buf = Buffer.read(s, \"C:/sounds/break.wav\");\nPlayBuf.ar(1, ~buf, BufRateScale.kr(~buf), loop: 1);\n```"}, {"role": "assistant", "content": "Loads a sound file into server memory, then plays it in a loop at the file's original pitch.\n\n- `Buffer.read(s, path)` allocates a buffer on the server and fills it from the file. It is asynchronous:\n the Buffer object returns immediately, the samples arrive later.\n- `PlayBuf.ar(1, buf, ...)` needs the channel count first — 1 for a mono file. A wrong count is the usual\n cause of a buffer that plays wrongly or not at all.\n- `BufRateScale.kr(buf)` compensates when the file's sample rate differs from the server's, so `rate: 1` is\n the file's true speed.\n- `loop: 1` restarts at the end instead of stopping.\n\nBecause the read is asynchronous, this line pair is only safe if a `s.sync` or a wait happened in between;\notherwise PlayBuf sees a buffer with no data yet."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Verschwende deine Jugend (bassline cover)?"}, {"role": "assistant", "content": "```supercollider\n/* An approach to try to reproduce the 'famous' bassline of \"Verschwende deine Jugend\" by D.A.F. */\n\nSynthDef(\\daf_bass,{ |out, freq=440, sustain=1, gate=1, amp=0.1|\n var snd, env, fenv, harm;\n \n harm = [1,1.01,2,2.02,3.5,4.01,5.501];\n harm = harm ++ (harm*2);\n \n snd = SinOsc.ar(freq*harm).sum.distort.squared * 6;\n snd = snd + SinOsc.ar(freq / [1, 2]).sum!2;\n\n fenv = EnvGen.kr(Env.adsr(0.075,0.05,0.1,0.25));\n\n snd = RLPF.ar(snd, fenv.range(freq*2, freq*8), 0.75, 2) + (snd * 0.25);\n env = EnvGen.kr(Env.adsr(0.001,0.2,0.9,0.25), gate, amp, doneAction:2);\n \n snd = LeakDC.ar(Limiter.ar(snd * env));\n OffsetOut.ar(out, (snd!2));\n}).add;\n\n// approx 65 bpm\nTempoClock.default.tempo = 65/60;\n\n// approx bass pattern + modulation of Verschwende Deine Jugend bassline\nPdef(\\daf_bass,\n PmonoArtic(\\daf_bass,\n \\scale, Scale.minor,\n \\octave, [3],\n \\root, 2,\n \\ctranspose,Pseq([\n Pn(0, 8*4),\n Pn(-5, 8*4)\n ], inf),\n \\degree, Pseq([7,7s,1,8,1,1,7,1]-1,inf),\n \\dur, 0.18\n )\n).play;\n\n// link: http://www.youtube.com/watch?v=KjqrnUBdLqY\n```"}]} -{"conversations": [{"role": "user", "content": "What does `BelaScopeOut.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Bela's Oscilloscope interface Arguments: offset — The Bela Oscilloscope's channel where to start writing. This is read only at construction time and thus it's not modulatable.; channelsArray — An array of UGens to be scoped.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ var source = SinOsc.ar(40); var env = EnvFollow.ar(source, 0.999); [source,env] }.plot(0.5)\n\n\n{ var source = SoundIn.ar; var env = EnvFollow.ar(source, MouseX.kr(0.9,0.999); env }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ var source = SinOsc.ar(40); var env = EnvFollow.ar(source, 0.999); [source,env] }.plot(0.5)\n\n\n{ var source = SoundIn.ar; var env = EnvFollow.ar(source, MouseX.kr(0.9,0.999)); env }.play\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// what can it sound like? see: https://www.youtube.com/watch?v=dRmY3tEwZyE \n// the youtube version has been sent through an additional reverb pedal, but\n// you don't need the pedal to get something that sounds interesting\n\n(\ns.options.memSize_(16384*10);\ns.reboot;\ns.waitForBoot({\n \n Ndef(\\bits, {\n var t = PulseCount.ar(Impulse.ar(8e3));\n var u = PulseCount.ar(Impulse.ar(7009));\n var sig = HPF.ar(\n (\n ((t * 15) & (t >> 5)) |\n ((t * 5) & (t >> [3, 4])) |\n ((t * 2) & (t >> 9)) |\n ((t * 8) & (t >> 11)) |\n (((t*t) & t) | (t >> 3))\n - 3 % 256\n ) / 127-1 * 3\n , 20\n ) * 0.1;\n var sig2 = LPF.ar(HPF.ar(gcd(t*u, u+t), WhiteNoise.ar()*2000 + 1000), 20);\n sig2 = sig2*sig;\n sig = 0.3*Splay.ar(Limiter.ar(Greyhole.ar(sig + sig2, sig, 0.5, sig), 0.5).flatten);\n }).play;\n});\n)\n```"}, {"role": "assistant", "content": "a surprisingly rich soundscape in a few lines of code (lucky accident)."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for get different result each time running the pattern."}, {"role": "assistant", "content": "```supercollider\nTempoClock.default.tempo = 156/60;\n\n(\nSynthDef(\\spring, { |freq = 400, out = 0, pan = 0, gate = 1, dur = 0.15, curve = -4, amp = 1, index = 1|\n var sig = FreeVerb.ar(Pan2.ar(Blip.ar(freq, index), pan));\n var env = EnvGen.ar(Env.perc(0.01, dur, amp, curve), gate, doneAction:2);\n Out.ar(0, sig * env);\n}).add;\n);\n\n(\nPbind(*[\n instrument: \\spring,\n dur: Pseq([4, 1, 2, 1, 1, 1].scramble/ 4 / TempoClock.default.tempo, inf),\n degree: Pseq(#[1,2,3,4], inf) * Pkey(\\dur).reciprocal,\n octave: Pseq([2,3,4,4,4,3].scramble, inf),\n pan: Pxrand(Array.fill(100, { 0.gaussian(1).clip2(1) }), inf),\n amp: Pseq(#[0.95,1,0.8],inf),\n index: Pstutter(Pseq(#[4,8,12],inf), Pseq([2,3,4,5,6,8].scramble, inf))\n]).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `TextView.selectedString` do? What arguments does it take?"}, {"role": "assistant", "content": "The plain text contained in the current selection. When getting this variable and there is no selection, the entire line at text cursor is returned (equivalent to #-currentLine). Setting this variable will replace text in the selection with the argument, or do nothing if there is no Arguments: A String.. Returns: A String."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for some scale stuff by a novice-SC lovable unicorn."}, {"role": "assistant", "content": "```supercollider\n(\ns.newBusAllocators;\ns.options.numOutputBusChannels = 2;\n~reverbBus = Bus.audio(s,2);\n\ns.waitForBoot({\n\n Buffer.freeAll;\n ~scale1 = Buffer.loadCollection(\n s,Scale.new(#[0,7,15.93,5,9.7,12,17.5,13.1],12));\n\n SynthDef(\\rainbow,{\n arg buf, samp=0.2,root=37,atk=0.1,decay=10, amp=0.3;\n var sig, index, tonic, freq, env;\n index = LFSaw.kr(samp).range(\\bottom.ir(4),\\top.ir(9));\n index = index*BufFrames.kr(buf);\n tonic = DegreeToKey.kr(buf,index)+root;\n freq = tonic.midicps;\n env = EnvGen.ar(Env.perc(atk,decay,0.7,-2),doneAction:2);\n sig = SyncSaw.ar(root.midicps,freq, mul:0.5)*env;\n sig = BPF.ar(sig, \\cfreq.kr(1000),\\rq.ir(0.3))*amp;\n sig = Pan2.ar(\n sig,\n SinOsc.kr(\n \\rate.kr(0.05).range(-0.9,0.9)+{Rand(-0.6,0.6)}),\n \\level.kr(1),\n );\n Out.ar(\\out.ir(~reverbBus),sig);\n }).add;\n\n SynthDef(\\reverb, {\n arg in=0, out=0, revdecay=5;\n var wet,dry, sig;\n wet = In.ar(~reverbBus,2);\n dry = In.ar(~reverbBus,2);\n wet = CombL.ar(\n wet,\n 0.1,\n SinOsc.kr(0.01).range(0.04,0.1),\n revdecay,\n 0.7);\n wet = LPF.ar(wet,\\lpf.kr(4800));\n sig = XFade2.ar(wet,dry,\\mix.kr(0.2),\\amp.kr(0.3));\n Out.ar(out,sig);\n }).add;\n});\n\nSynth(\\reverb,[\\mix,-0.5],addAction:'addToTail');\n\n~rainbow = Pbind(\n \\instrument, \\rainbow,\n \\dur, Prand([0.2,1.3],inf),\n \\buf, ~scale1,\n \\root, Prand([23,30,35,37],inf),\n \\amp, Pwhite(0.15,0.5,inf),\n \\bottom, Prand([2,5],inf),\n \\top, Pwhite(7.0,9.1,inf),\n \\samp, Pexprand(0.07,0.5,inf),\n \\rate, Pexprand(0.1,3,inf),\n \\cfreq, Pseq([\n Pseries(120,30,76),\n Pseries(2400,-30,76),\n ],inf),\n \\rq, Pkey(\\samp)+Pwhite(0.1,0.15,inf).asStream,\n \\atk, Pexprand(0.04,0.3,inf),\n \\decay, Pexprand(6,15,inf),\n \\level, Env(#[0,1,0],#[100,110],'lin'),\n \\out, ~reverbBus,\n);\n~rainbow.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `ProxyMonitorGui` in SuperCollider briefly."}, {"role": "assistant", "content": "ProxyMonitorGui — controls the top-level of a nodeproxy and its monitor is a GUI for controlling the top-level of a nodeproxy and its monitor. It is e.g. used in ProxyMixer, and NodeProxyEditor, and it is cross-platform. Category: JITLib > GUI, Live Coding."}]} -{"conversations": [{"role": "user", "content": "What is Env.perc and what does it take?"}, {"role": "assistant", "content": "`Env.perc(attackTime, releaseTime, level, curve)` — an attack to `level` (default 1) then a decay to zero, with curve defaulting to -4 (an exponential-ish decay). `Env.perc(0.01, 1)` is the default percussive envelope, and it is a complete Env, not a generator: pair it with EnvGen to hear it."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `EnvGate`."}, {"role": "assistant", "content": "```supercollider\na = { LPF.ar(Saw.ar(200), 600) * EnvGate.new }.play;\na.set(\\fadeTime, 2);\na.release;\n\n// the same as:\na.set(\\gate, 0);\n\n// several env gates can coexist in one synth def.\n(\na = {\n var sound1 = LPF.ar(Saw.ar(80), 600) * EnvGate.new;\n var sound2 = RLPF.ar(Saw.ar(200) * 0.5, 6000 * EnvGate.new + 60, 0.1) * EnvGate.new;\n sound1 + sound2\n}.play;\n);\na.set(\\fadeTime, 5);\na.release;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `RedTrk` in SuperCollider briefly."}, {"role": "assistant", "content": "RedTrk — a sort of timeline - slave track RedTrk is controlled by the master ( RedMst ). Each track must have a name, an item to play and an array specifying when to play (sections when active). Category: Red > redMst."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// Pn advances Pgate each time its subpattern is repeated\n(\nPbind(\n \\degree, Pn(Pseq((0..7)), inf, \\step),\n \\mtranspose, Pgate(Pwhite(0, 5), inf, \\step),\n \\dur, 0.2\n).play\n);\n\n\n// Two different Pgates advanced at two different rates\n(\nPbind(\n\n \\scale, Scale.minor,\n \\foo, Pn(Pseq((0..2)), inf, \\step1),\n \\degree, Pn(Pseq((0..7).mirror), inf, \\step),\n \\ctranspose, Pgate(Pwhite(0, 5), inf, \\step) + Pgate(Pseq([0, 7, 0, -7], inf), inf, \\step1),\n \\dur, 0.\n// …\n```"}, {"role": "assistant", "content": "Pn advances Pgate each time its subpattern is repeated Two different Pgates advanced at two different rates (Pgate: A gated stream that only advances when a particular event key is true.)"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for seeking an Array!."}, {"role": "assistant", "content": "```supercollider\n(// * //watch the postWindow\na=[\"m\",\"x\",\"f\",\"k\",\"d\",\"p\"];\nx=Array;\ny=x.newClear(6);\n~mxfkdp=Task({\n inf.do({y.put(x.series(6,0,1).choose,a.scramble).postln;\n 0.03.wait;})}).play;\nm=fork({inf.do({\n \"array num:\".postcln;\n if(y[x.series(6,0,1).choose.postcln]==a,\n {\"lo encontraste!/found it!\".postcln;\n 1.do({GVerb.ar(\n EnvGen.ar(Env.perc(0.01,8),1,doneAction:2)*\n Blip.ar(XLine.kr(440,1600,8)),50,10,0.02)}.play);\n ~mxfkdp.stop;\n m.stop;}, \n {\"buscando.../seeking...\".postcln;});\n 0.03.wait})});\n);\n//.SCtweetLong\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes random 303."}, {"role": "assistant", "content": "```supercollider\n(\n{ var lk = [0,3,7,9], jx = [3,4,2,4,2], n, ox = 10, qw, cx, oi,z,w, faz, mp,\n cs = [Select,Stepper,RLPF,LFTri,Pulse,PulseDivider,Lag2,Lag,EnvGen,\n Saw, LPF, PitchShift, AllpassN, Env, LocalIn, LocalOut, Impulse ];\n var fa,ffa, ra, eca, era, fsa, xc, fxc, rq, ec, er,xcs, o,e;\n mp = {… |n,alk| alk = alk ? lk; \n {midicps(jx .choose * 12 + lk.choose) } !n }; \n faz = [ mp.(3)* 2.midiratio, mp.( 3 )\n *1. midiratio, mp.( 2,[ 0,3,9 ])*5.midiratio,mp.(1 )*1.midiratio ]; \n fa = faz[[3,0,3,1,2,2,2,2, 1,1,1,1,0,3]].flat; \n n = fa.size; \n qw = Impulse.kr(10); \n cx = PulseDivider.kr(qw, n); \n oi = Stepper.kr(qw,0,0,n-1); \n fsa = { [0,0,0, 0.02,0.08,0.1 ].choose }!div(n,4); \n xcs = Select.kr( Stepper.kr( qw,0,0,fsa.size-1 ), fsa); \n xc = Lag2.kr( Select.kr(oi, fa), xcs ); \n ffa = { rrand( 20, 90 ) } ! n;\n ffa.size.do({ |i| var pn = [2,4,8].choose;\n if ( 0.2.coin, { ffa[i] = Select.kr(Stepper.kr(cx, 0,0,pn-1), { rrand( 4, 70 ) } ! n) }) });\n fxc = Lag2.kr( Select.kr(oi, ffa), 0.04);\n ra = { rrand(0.05,0.5) } ! n;\n rq = Lag.kr( cs[0].kr(oi, ra), 0.04);\n eca = { [-4,0,-1].choose } ! n;\n ec = Select.kr(oi,eca);\n o = Saw.ar(xc) + Pulse.ar(xc * 0.01.midiratio,1-rq) + Pulse.ar(xc *0.04.midiratio,LFTri.ar(ox/n).range(0.1,0.9),0.02) + Pulse.ar(xc *\n 24.midiratio,LFTri.ar(ox/n/4).range(0.8,0.01),0.05);\n era = { rrand(0.8,0.4) } ! 4;\n er = Select.kr(cs[1].kr(qw, 0,0,3), era);\n e = Env.new([0,1,0],[xcs/5,er],ec);\n e = EnvGen.kr(e, gate:qw);\n fxc = fxc * [1.02, 0.98];\n xc = xc * [0.8,1.2].scramble;\n z = cs[2].ar(o, (fxc * e).midiratio * xc, rq) + (cs[2].ar(o.neg, fxc * (50 * e)\n .midiratio, 0.4) *0.05) + (cs[2].ar(o.neg, fxc * (65 * e).midiratio, rq/2) *0.01) * e;\n z = (z + (cs[11].ar(z,0.001,0.5,0.1,0.1).distort * 0.5)).distort;\n w = z+ cs[14].ar (2). distort;\n 10.do({ w = cs[12].ar(w,0.4,{0.03.rand}!2,{0.06.rand}!2) });\n cs[15].ar(cs[10].ar( w*0.9,800 )); (w *0.1 ) + (z * 0.7) }.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes random 303."}, {"role": "assistant", "content": "```supercollider\n(\n{ var lk = [0,3,7,9], jx = [3,4,2,4,2], n, ox = 10, qw, cx, oi,z,w, faz, mp,\n cs = [Select,Stepper,RLPF,LFTri,Pulse,PulseDivider,Lag2,Lag,EnvGen,\n Saw, LPF, PitchShift, AllpassN, Env, LocalIn, LocalOut, Impulse ];\n var fa,ffa, ra, eca, era, fsa, xc, fxc, rq, ec, er,xcs, o,e;\n mp = {… |n,alk| alk = alk ? lk; \n {midicps(jx .choose * 12 + lk.choose) } !n }; \n faz = [ mp.(3)* 2.midiratio, mp.( 3 )\n *1. midiratio, mp.( 2,[ 0,3,9 ])*5.midiratio,mp.(1 )*1.midiratio ]; \n fa = faz[[3,0,3,1,2,2,2,2, 1,1,1,1,0,3]].flat; \n n = fa.size; \n qw = Impulse.kr(10); \n cx = PulseDivider.kr(qw, n); \n oi = Stepper.kr(qw,0,0,n-1); \n fsa = { [0,0,0, 0.02,0.08,0.1 ].choose }!div(n,4); \n xcs = Select.kr( Stepper.kr( qw,0,0,fsa.size-1 ), fsa); \n xc = Lag2.kr( Select.kr(oi, fa), xcs ); \n ffa = { rrand( 20, 90 ) } ! n;\n ffa.size.do({ |i| var pn = [2,4,8].choose;\n if ( 0.2.coin, { ffa[i] = Select.kr(Stepper.kr(cx, 0,0,pn-1), { rrand( 4, 70 ) } ! n) }) });\n fxc = Lag2.kr( Select.kr(oi, ffa), 0.04);\n ra = { rrand(0.05,0.5) } ! n;\n rq = Lag.kr( cs[0].kr(oi, ra), 0.04);\n eca = { [-4,0,-1].choose } ! n;\n ec = Select.kr(oi,eca);\n o = Saw.ar(xc) + Pulse.ar(xc * 0.01.midiratio,1-rq) + Pulse.ar(xc *0.04.midiratio,LFTri.ar(ox/n).range(0.1,0.9),0.02) + Pulse.ar(xc *\n 24.midiratio,LFTri.ar(ox/n/4).range(0.8,0.01),0.05);\n era = { rrand(0.8,0.4) } ! 4;\n er = Select.kr(cs[1].kr(qw, 0,0,3), era);\n e = Env.new([0,1,0],[xcs/5,er],ec);\n e = EnvGen.kr(e, gate:qw);\n fxc = fxc * [1.02, 0.98];\n xc = xc * [0.8,1.2].scramble;\n z = cs[2].ar(o, (fxc * e).midiratio * xc, rq) + (cs[2].ar(o.neg, fxc * (50 * e)\n .midiratio, 0.4) *0.05) + (cs[2].ar(o.neg, fxc * (65 * e).midiratio, rq/2) *0.01) * e;\n z = (z + (cs[11].ar(z,0.001,0.5,0.1,0.1).distort * 0.5)).distort;\n w = z+ cs[14].ar (2). distort;\n 10.do({ w = cs[12].ar(w,0.4,{0.03.rand}!2,{0.06.rand}!2) });\n cs[15].ar(cs[10].ar( w*0.9,800 )); (w *0.1 ) + (z * 0.7) }.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `PatternProxy.asStream` do?"}, {"role": "assistant", "content": "Return a Stream from this pattern. One pattern proxy can be used to produce any number of independent streams. `a ="}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(//*********PREPARE**********\np.pop;\n//Any code that needs to access your own environment goes here\np = ProxySpace.push(s);\n~fxLoop.play.fadeTime_(5);\n);\n\n(//*********FXLoop**********\n~fxLoop = {\n var in = SoundIn.ar([0,1]);\n in;\n}\n)\n```"}, {"role": "assistant", "content": "Code for using Supercollider as a realtime livecode FX processor for audio input. Blog post explaing this code: http://schemawound.com/post/53528545022/fxloop."}]} -{"conversations": [{"role": "user", "content": "What is `List`?"}, {"role": "assistant", "content": "List — list of items of variable size"}, {"role": "user", "content": "What does `List.new` do?"}, {"role": "assistant", "content": "Creates a List with the initial capacity given by size."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// Create a new empty collections with size 3:\nx = Array.new(3);\ny = Array.new(3);\nz = List.new(3);\n\n// Try to add 7 items to the array and list.\n// If the array exceeds maxSize, it will only\n// grow to an internally specified max size.\n(\n7.do { |i|\n x.add(i);\n y = y.add(i); // reassign array y on each add\n z.add(i);\n};\n);\n\n// Attempt to access the 5th item:\nx.at(4); // -> nil (out of bounds)\ny.at(4); // -> 4\nz.at(4); // -> 4\n\n// x grew only to size 4\nx.postln; // -> [ 0, 1, 2, 3 ]\ny.postln; // -> [ 0, 1, 2, 3, 4, 5, 6 ]\nz.postln; // -> List[ 0, 1, 2, 3, 4, 5, 6 ]\n```"}]} -{"conversations": [{"role": "user", "content": "What does `StreamKrDur.spec` do?"}, {"role": "assistant", "content": "a 'control' rate player that combines a stream of values with a stream of durations and plays them"}]} -{"conversations": [{"role": "user", "content": "What is `ParGroup`?"}, {"role": "assistant", "content": "ParGroup — Client-side representation of a parallel group node on the server"}, {"role": "user", "content": "What does `ParGroup.basicNew` do?"}, {"role": "assistant", "content": "Create and return a ParGroup object without creating a group node on the server. (This method is inherited from Node and is documented here only for convenience.)"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nfork {\n p = ParGroup.new;\n loop {\n (\n degree: rrand(0.0, 12.0).round(1/4),\n group: p,\n db: rrand(-30, -25),\n pan: rrand(-1.0, 1.0)\n ).play;\n 0.2.wait;\n }\n}\n```"}]} -{"conversations": [{"role": "user", "content": "What is `BinaryOpUGen`?"}, {"role": "assistant", "content": "BinaryOpUGen — Apply a binary operation to the values of an input UGen"}, {"role": "user", "content": "What does `BinaryOpUGen.new` do?"}, {"role": "assistant", "content": "return a new instance that applies the operator `selector` to the UGens `a` and `b` normally, this is implicitly called when applying an operator to a UGen."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na = WhiteNoise.ar; // a WhiteNoise\nb = a + 2; // a BinaryOpUGen.\nb.operator; // +\n\n// sound example\n(\n{\n var a = LFSaw.ar(300);\n var b = LFSaw.ar(329.1);\n a % b * 0.1\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// see the delta values in the resulting events\n(\nvar a, b, c, t;\na = Pbind(\\x, Pseq([1, 2, 3, 4]), \\dur, 1);\nb = Pbind(\\x, Pseq([10, 20, 30, 40]), \\dur, 0.4);\nc = Ptpar([0.0, a, 1.3, b]);\nt = c.asStream;\n20.do({ t.next(Event.default).postln });\n);\n\n// sound example\n(\nvar a, b;\na = Pbind(\\note, Pseq([7, 4, 0], 4), \\dur, Pseq([1, 0.5, 1.5], inf));\nb = Pbind(\\note, Pseq([5, 10, 12], 4), \\dur, 1);\nPtpar\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// see the delta values in the resulting events\n(\nvar a, b, c, t;\na = Pbind(\\x, Pseq([1, 2, 3, 4]), \\dur, 1);\nb = Pbind(\\x, Pseq([10, 20, 30, 40]), \\dur, 0.4);\nc = Ptpar([0.0, a, 1.3, b]);\nt = c.asStream;\n20.do({ t.next(Event.default).postln });\n);\n\n// sound example\n(\nvar a, b;\na = Pbind(\\note, Pseq([7, 4, 0], 4), \\dur, Pseq([1, 0.5, 1.5], inf));\nb = Pbind(\\note, Pseq([5, 10, 12], 4), \\dur, 1);\nPtpar([0.0, a, 1.3, b]).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `CheckBox` in SuperCollider?"}, {"role": "assistant", "content": "CheckBox — A view that toggles between two states. A view that toggles between two states when clicked, displaying or hiding a check mark accordingly. Category: GUI > Views."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for mrcl snippets #3: feedback timer (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\fbTimer){\n m = (Dust.ar(0.5!2)*20).tanh+\\in.ar(0!2);\n r = Timer.kr(Onsets.kr(FFT(LocalBuf(128)!2,m)));\n c = CombL.ar(m+(LocalIn.ar(2)*0.8),4,r.clip(0.0001,4),r*4);\n l = Resonz.ar(c,TRand.kr(20,20000,m),0.1,1000).tanh;\n LocalOut.ar(m+l);\n m+c;\n}.play\n);\n\n\n(\nNdef(\\fbTimerSel){\n m = (Dust.ar(0.5!2)*20).tanh+\\in.ar(0!2);\n r = Timer.kr(Onsets.kr(FFT(LocalBuf(128)!2,m)));\n c = CombL.ar(m+(LocalIn.ar(2)*0.8),4,r.clip(0.0001,4),r*4);\n l = Resonz.ar(c,TRand.kr(20,20000,m),0.1,1000).tanh;\n n = SelectX.ar(LFNoise0.kr(r.linlin(0,4,0.1,10)).range(0,4),[m,K2A.ar(r),c,l]);\n\n LocalOut.ar(n);\n n\n\n}.play\n);\n\n\n(\nNdef(\\fbTimer3){\n var localin = (LocalIn.ar(2)*0.98)+\\in.ar(0!2);\n var dust = (Dust.ar(Rand(0.5,10)!2)*200)+\\in.ar;\n var timer = Timer.ar(dust);\n var comb = CombL.ar(dust+localin,4,timer.clip(0.0001,4),timer*4);\n var filt = Resonz.ar(comb,TRand.kr(20,Rand(20,20000),dust),0.1,1000).tanh;\n LocalOut.ar(dust+filt);\n comb+dust;\n comb+dust*timer;\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// server has hardwareBufferSize 512 for this example.\ns.options.hardwareBufferSize = 512; s.reboot;\n// do something that sends messages with server latency\nPbind(\\degree, Pbrown(-14, 14, 3), \\dur, 1/8).play;\ns.latency;\ns.latency = 0.1; // tune down ...\ns.latency = 0.05;\ns.latency = 0.025;\ns.latency = 0.012; // ... until every message posts \"late 0.01....\" now\ns.latency = 0.018; // go back up -> fewer late messages\ns.latency = 0.021; // go back up until ...\ns.latency = 0.024; // late mess\n// …\n```"}, {"role": "assistant", "content": "server has hardwareBufferSize 512 for this example. do something that sends messages with server latency (Latency: Measure audio latency for multiple channels)"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Migration from the old SourceForge wiki."}, {"role": "assistant", "content": "```supercollider\n// Sing whatever pitch you like into the microphone, but have the output conform to the key you press on your connected MIDI keyboard, like a very low-rent Autotune.\n// by nonprivate April 2009\n// best used with headphones\n// execute one by one...\n\ns = Server.local.boot;\nb = 200; // no. of control bus to use for pitch control\n(\n SynthDef(\"straightenUp\",\n { |baseFreq = 100|\n \n var in, freq, hasFreq, out;\n in = Mix.new(SoundIn.ar([0,1]));\n # freq, hasFreq = Pitch.kr(in, ampThreshold: 0.02, median: 7);\n out = PitchShift.ar(in, 0.08, (baseFreq / freq), 0.0, 0.0);\n Out.ar(0,[out, out])\n }\n ).send(s);\n);\n\ns.sendMsg(\"/s_new\", \"straightenUp\", n = s.nextNodeID, 1, 0);\n\ns.sendMsg(\"/n_map\", n, \"baseFreq\", b);\n\n(\n c = NoteOnResponder(\n { |src,chan,note,vel|\n \n s.sendMsg(\"/c_set\", b, note.midicps);\n \n },\n nil, // any source\n nil, // any channel\n nil, // any note\n nil // any vel\n );\n \n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var env = Env([0, 0.6, 0.3, 1.0, 0], [0.1, 0.02, 0.4, 1.1], [\\lin, \\exp, -6, \\sin]);\n var envgen = IEnvGen.kr(env, MouseX.kr(0, env.times.sum));\n env.plot;\n SinOsc.ar(envgen * 500 + 440)\n}.play;\n);\n\n// index with an SinOsc ... mouse controls amplitude of SinOsc\n// use offset so negative values of SinOsc will map into the Env\n(\n{\n var sin = SinOsc.ar(440, 0, MouseX.kr(0, 1));\n // use offset so negative values of SinOsc will map into the Env\n v\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var env = Env([0, 0.6, 0.3, 1.0, 0], [0.1, 0.02, 0.4, 1.1], [\\lin, \\exp, -6, \\sin]);\n var envgen = IEnvGen.kr(env, MouseX.kr(0, env.times.sum));\n env.plot;\n SinOsc.ar(envgen * 500 + 440)\n}.play;\n);\n\n// index with an SinOsc ... mouse controls amplitude of SinOsc\n// use offset so negative values of SinOsc will map into the Env\n(\n{\n var sin = SinOsc.ar(440, 0, MouseX.kr(0, 1));\n // use offset so negative values of SinOsc will map into the Env\n var env = Env([-1, -0.7, 0.7, 1], [0.8666, 0.2666, 0.8668], \\lin, offset: -1.0);\n IEnvGen.ar(env, sin) * 0.1\n}.play;\n);\n\n// index with Amplitude of input, control freq of SinOsc (uses SoundIn)\n(\n{\n var point = Amplitude.ar(SoundIn.ar(0), 0.01, 0.2);\n // use offset so negative values of SinOsc will map into the Env\n var env = Env.xyc([[0, 330, \\exp], [0.5, 440, \\exp], [1.0, 1760]]);\n SinOsc.ar(IEnvGen.kr(env, point)) * 0.2\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a warm pad in SuperCollider."}, {"role": "assistant", "content": "Detuned saws through a slow filter envelope and a long release: the detune is what makes it wide.\n\n```supercollider\n(\nSynthDef(\\pad, { |out = 0, freq = 220, amp = 0.15, gate = 1|\n var detune = [-0.06, -0.02, 0.02, 0.06];\n var sig = Mix(Saw.ar(freq * (1 + detune))) * 0.25;\n var env = EnvGen.kr(Env.adsr(1.2, 0.5, 0.7, 3), gate, doneAction: 2);\n var cutoff = SinOsc.kr(0.05).exprange(300, 2000);\n sig = RLPF.ar(sig, cutoff, 0.4);\n Out.ar(out, Splay.ar([sig, DelayN.ar(sig, 0.02, 0.012)]) * env * amp);\n}).add;\n);\n~pad = Synth(\\pad, [\\freq, 165]);\n~pad.set(\\gate, 0);\n```\n`gate` is what makes a sustained sound controllable: `\\gate, 0` releases it and `doneAction: 2` then\nfrees the Synth."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Red alert."}, {"role": "assistant", "content": "```supercollider\n//Fig 58.7: Red alert\n//Complete patch, saw + second harmonic, resonators, distortion and post filters to create \n//fixed resonance. Contains the subpatch shown in fig 58.6.\n\n(\n SynthDef(\\red, {\n \n var env, redAlert, dfbe, aIn, bIn, cIn, aOut, bOut, cOut;\n \n # aIn, bIn, cIn = LocalIn.ar(7).clumps([5,1,1]);\n \n env = [\n EnvGen.ar(Env.new([0,1,1,0], [0.9, 0.3, 0.0])), \n EnvGen.ar(Env.new([0,1,1,0], [0.01, 0.88, 0.01]))\n ];\n env[0] = LFSaw.ar(env[0].sqrt * 487 + 360, 1, 0.5, 0.5);\n env[0] = (env[0] - 0.5) + ((env[0] * 2 * 2pi).cos * 0.3);\n redAlert = (env[0] - OnePole.ar(env[0], exp(-2pi * (1 * SampleDur.ir)))) * env[1];\n redAlert = redAlert + (cIn * 0.006) * 0.2;\n \n \n // fig 58.6: Delay feedback element\n dfbe = 0!6;\n redAlert = redAlert + (aIn * 0.7);\n 5.do{|i| dfbe[i] = DelayN.ar(redAlert[i], 0.1, [0.015, 0.022, 0.035, 0.024, 0.011][i])};\n aOut = dfbe[0..4]; \n \n redAlert = redAlert[0..4].sum;\n redAlert = (redAlert - OnePole.ar(redAlert, exp(-2pi * (12 * SampleDur.ir))));\n \n dfbe[5] = redAlert + (bIn * 0.7);\n dfbe[5] = DelayN.ar(dfbe[5], 0.1, 0.061);\n # bOut, cOut = dfbe[5]!2;\n LocalOut.ar(aOut ++ bOut ++ cOut);\n \n redAlert = Clip.ar(redAlert * 4, -1, 1);\n redAlert = BPF.ar(redAlert, [740, 1400, 1500, 1600], (12!4).reciprocal) ++ (redAlert * 0.5);\n Out.ar(0, (redAlert.sum * 0.2)!2);\n \n}).add;\n);\n \n// ALL HANDS!! BATTLESTATIONS!\ne = Synth(\\red);\n\n\n\n// code also available here: \n// http://en.wikibooks.org/wiki/Designing_Sound_in_SuperCollider/Red_alert\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Various gong-like sounds using FM synthesis?"}, {"role": "assistant", "content": "```supercollider\n// https://recarteblog.wordpress.com/\n//gongFM_SC\n\n// 1. Añadir al servidor\n\n(\nSynthDef(\\gongFM, {\n arg ratio1=0.9, ratio2=0.55, ratio3=1.03, index2=2, index3=4, amp=0.7, dur=7, pan=0;\n var sig, op1, op2, op3, env1, env2, env3;\n env3 = EnvGen.kr(Env.new([0, 1, 1, 0], [0.4, 0.3, dur]), doneAction:2);\n env2 = EnvGen.kr(Env.new([0, 1, 1, 0], [0, 0.3, dur]), doneAction:2);\n env1 = EnvGen.kr(Env.new([0, 1, 1, 0], [0.003, 0.3, dur - 0.5]), doneAction:2);\n op3 = SinOsc.ar(([67, 70, 74].midicps * ratio3), mul:[67, 70, 74].midicps * ratio3 * index3) * env3;\n op2 = SinOsc.ar((([67, 70, 74].midicps * ratio2) + op3), mul:[67, 70, 74].midicps * ratio2 * index2) * env2;\n op1 = SinOsc.ar(([67, 70, 74].midicps * ratio1) + op2);\n sig = op1 * env1 * amp;\n sig = Splay.ar(sig);\n sig = Balance2.ar(sig[0], sig[1], pan);\n Out.ar(0, sig);\n}).add;\n);\n\n\n// 2. Ejecutar los Synths\n\nSynth(\\gongFM);\n\nSynth(\\gongFM, [\\ratio1, 0.503, \\ratio2, 0.50, \\ratio3, 1.35, \\index2, 1.53, \\index3, 4.33]);\n\nSynth(\\gongFM, [\\ratio1, 0.59, \\ratio2, 0.17, \\ratio3, 0.75, \\index2, 1.54, \\index3, 3.29]);\n\nSynth(\\gongFM, [\\ratio1, 0.49, \\ratio2, 0.17, \\ratio3, 0.34, \\index2, 1.33, \\index3, 4.31]);\n\nSynth(\\gongFM, [\\ratio1, 1.11, \\ratio2, 0.2, \\ratio3, 0.80, \\index2, 1.97, \\index3, 5.06]);\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Let's extract the DC component - i.e. the magnitude at binindex zero.\n(\n{\n var sig, chain, stream, windowStarts, demand;\n var fftsize = 1024;\n\n sig = SinOsc.ar(LFDNoise3.kr(LFNoise0.kr(1) * 40 + 60) * 700 + 800);\n\n chain = FFT(LocalBuf(fftsize), sig);\n stream = Unpack1FFT(chain, bufsize: fftsize, binindex: 0, whichmeasure: 0);\n\n // each time an FFT window starts, the unpacker returns a new value\n windowStarts = chain > -1;\n demand = Demand.kr(windowStarts, 0, stream);\n demand.poll(\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Let's extract the DC component - i.e. the magnitude at binindex zero.\n(\n{\n var sig, chain, stream, windowStarts, demand;\n var fftsize = 1024;\n\n sig = SinOsc.ar(LFDNoise3.kr(LFNoise0.kr(1) * 40 + 60) * 700 + 800);\n\n chain = FFT(LocalBuf(fftsize), sig);\n stream = Unpack1FFT(chain, bufsize: fftsize, binindex: 0, whichmeasure: 0);\n\n // each time an FFT window starts, the unpacker returns a new value\n windowStarts = chain > -1;\n demand = Demand.kr(windowStarts, 0, stream);\n demand.poll(windowStarts);\n\n sig * 0.05\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pmulpre`."}, {"role": "assistant", "content": "```supercollider\n(\nvar a, b;\na = Pmulpre(\\note, 2, Pbind(\\note, Pseq([1, 2, 3])));\nx = a.asStream;\n9.do({ x.next(Event.default).postln });\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `CondVar.signalAll` do?"}, {"role": "assistant", "content": "Wakes all threads waiting on this Condition. Threads are woken in the order in which they called `wait` or `waitFor`. If threads were waiting with predicates and their predicates are still `false` after being woken, they will block again in the same order as before this method was Returns: this object"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nSynthDef(\\dubecho,{|in, out, length = 1, fb = 0.8, sep = 0.012|\n var input = In.ar(in, 2);\n var feedback = LocalIn.ar(2);\n var output = LeakDC.ar(feedback*fb + input);\n output = HPF.ar(output, 400);\n output = LPF.ar(output, 5000);\n output = output.tanh;\n LocalOut.ar(DelayC.ar(output, 1, LFNoise2.ar(12).range([length,length+sep],[length+sep,length])).reverse);\n ReplaceOut.ar(out, output);\n}).add;\n\n// Example as effecet bus\n~bus = Bus.audio(s, 2);\n~echo = Synth(\\dubecho, [\\in, ~bus, \\length, TempoClock.default.tempo*(3/8), \\fb, 0.7, \\sep, 0.0012], addAction: \\addToTail);\n\n// send something\nplay{ Out.ar(~bus, LFGauss.ar(1, 0.1, loop:0, doneAction:2) * Blip.ar(80!2, 8)) }\n\n// turn it off\n~echo.free;\n```"}, {"role": "assistant", "content": "Fork of Bjorn's Dub echo, rewritten w/o the Feedback Quark (using LocalIn + LocalOut) and adding a ping pong (can be removed by deleting the .reverse method in the LocalOut line)."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nx = {OteyPiano.ar(50,0.5)}.play;\n);\nx.free;\n\n//Define piano synthdef\n(\nSynthDef(\\help_oteypiano, { |out=0, freq=440,gate=1, amp=0.5,rho=1|\n var son = OteyPiano.ar(freq, amp, rho:rho)*EnvGen.ar(Env.asr(0,1,0.1),gate,doneAction:2);\n Out.ar(out, Pan2.ar(son * 0.1, LinLin.kr(freq,36.midicps,90.midicps,-0.75,0.75)));\n}).add;\n);\n\n//Use it.\n(\nPbind(\n \\in\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nx = {OteyPiano.ar(50,0.5)}.play;\n);\nx.free;\n\n//Define piano synthdef\n(\nSynthDef(\\help_oteypiano, { |out=0, freq=440,gate=1, amp=0.5,rho=1|\n var son = OteyPiano.ar(freq, amp, rho:rho)*EnvGen.ar(Env.asr(0,1,0.1),gate,doneAction:2);\n Out.ar(out, Pan2.ar(son * 0.1, LinLin.kr(freq,36.midicps,90.midicps,-0.75,0.75)));\n}).add;\n);\n\n//Use it.\n(\nPbind(\n \\instrument, \\help_oteypiano,\n \\delta, 1,\n \\dur, 3,\n \\degree, Pseq([1,3,5], inf),\n \\rho, Pwhite(0.1,3) //comment this line to get standard sound\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n{\n\nvar in, fft, dissonance;\n\n//in = SinOsc.ar(MouseX.kr(100,1000),0,0.1);\n//in = Mix(SinOsc.ar([440,MouseX.kr(440,880)],0,0.1)); \nin= SoundIn.ar; \n\nfft = FFT(LocalBuf(2048), in);\n\ndissonance=SensoryDissonance.kr(fft);\n\ndissonance.poll; \n\nOut.ar(0,Pan2.ar(0.1*Blip.ar(100,(dissonance.sqrt)*200))); \n}.play\n);\n\n\n\n//different fftsize, max num peaks, own normalisation, avoid clamping by setting high value (more CPU cost) \n(\n// …\n```"}, {"role": "assistant", "content": "in = SinOsc.ar(MouseX.kr(100,1000),0,0.1); in = Mix(SinOsc.ar([440,MouseX.kr(440,880)],0,0.1)); (SensoryDissonance: Perceptual feature modeling sensory dissonance)"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Blip thru Formlet, pseudo-vocal synthesis."}, {"role": "assistant", "content": "```supercollider\n// Blip thru Formlet, pseudo-vocal synthesis.\n// hh&adc, since beijing 2005\n// 2019 made quad/MC\n\n// keywords: vocal, voice, formants\n\n/*\nNdef(\\formSing).gui;\nNdef(\\formSing).play;\nNdef(\\formSing).getHalo(\\stepFdev).value;\n*/\nNdef(\\formSing).addSpec(\\root, [20, 500, 6]);\nNdef(\\formSing).addSpec(\\formfrq, [50, 5000, \\exp]);\nNdef(\\formSing).addSpec(\\harm, [1, 256, \\exp]);\nNdef(\\formSing).addSpec(\\formLag, [0.01, 100, \\exp]);\nNdef(\\formSing).addSpec(\\ndiv, [0.01, 1, \\exp]);\nNdef(\\formSing).addSpec(\\fdev, [0, 24, \\amp]);\nNdef(\\formSing).addSpec(\\round, [0, 3, \\amp, 0.05]);\n\n(\n// modulating formant frequency\nNdef(\\formSing, { arg amp=0, root=150, formfrq=500, harm=20, fdev=2, ndiv = 0.2, formLag=0.1, round = 1.5;\n var freqCompare = 1; // ((formfrq / root).log2).abs.min(1).linexp(0, 1, 0.25, 1);\n var in = Blip.ar(\n root.lag(formLag) * LFNoise0.kr(root * ndiv ! q.numChans, fdev.max(0.01) ).midiratio,\n harm.lag(formLag), // .max(formfrq / root * 0.25),\n 0.1\n ) * GrayNoise.ar(0.1 ! q.numChans, 1);\n\n Limiter.ar(Formlet.ar(in, formfrq.lag(formLag), 0.005, 0.02) * (freqCompare * amp.lag(0.1)))\n .softclip;\n});\n);\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for muffled thump?"}, {"role": "assistant", "content": "```supercollider\n(\n{ var nse, env, kic;\n kic = tanh(Ringz.ar(LPF.ar(Trig.ar(Impulse.ar(1.0),SampleDur.ir),1000),30,0.25,7).sin*2);\n env = Env.perc(0.05, 1, 1, -4);\n nse = BrownNoise.ar(2) + PinkNoise.ar(0.5) * EnvGen.kr(env,Impulse.kr(1), doneAction: 2);\n\n nse = Mix.ar(BPF.ar(nse,[100,1200,80,40,20],MouseX.kr(0,1),[1,0.2,1,1,1]));\n nse = LPF.ar(nse + kic, MouseY.kr(100,1000))! 2\n\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Receiving NIMate generated OSC messages."}, {"role": "assistant", "content": "```supercollider\n//NIMate \"Full Skeleton\" Kinect Theremin\n\n//Start server\n\ns.boot;\n\n\n//Start buses and OSC receivers\n\nb=Bus.control(s,3);\nc=Bus.control(s,3);\n\n\nOSCdef.new(\n \\rh_xyz,\n {\n |msg, time, addr, recvPort|\n postln(msg);\n b.setnSynchronous([msg[1],(msg[2]+1)/2,msg[3]+0.3]);\n },\n \"/Right_Hand\", nil, 7000\n);\n\n\nOSCdef.new(\n \\lh_xyz,\n {\n |msg, time, addr, recvPort|\n postln(msg);\n c.setnSynchronous([msg[1]+0.9,(msg[2]+1)/2,msg[3]+0.3]);\n },\n \"/Left_Hand\", nil, 7000\n);\n\n\nOSCdef(\\lh_xyz).enable;\nOSCdef(\\rh_xyz).enable;\n\n\n//Synth definition and bus mapping\n\nSynthDef(\\theremin,\n {\n |ctrl=#[0,0,0], ctrr=#[0,0,0]|\n var f, a, vibrate, tremrate;\n\n f = LinExp.kr(ctrr[0],0,1,100,1000);\n vibrate = LinExp.kr(ctrl[0],0,1,1,500);\n tremrate = 100*ctrl[1];\n\n a = SinOsc.ar(f + (f *\n SinOsc.ar(vibrate,0,0.1)),0,\n mul: ctrr[1])*\n SinOsc.kr(tremrate);\n\n Out.ar([0,1], a)\n }).add;\n\nx=Synth.new(\\theremin);\n\nx.map(\\ctrr,b);\nx.map(\\ctrl,c);\n\n\n//Clean up\n\nx.free;\nb.free;\nc.free;\ns.stop;\ns.quit;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes alone in the storm (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\alone, { arg amp=0.5;\n var source, local, lfo;\n\n lfo = LFNoise1.kr(0.32).abs*50+[70,0.01];\n source = Decay.ar(Impulse.ar(lfo), 0.1) * WhiteNoise.ar(0.2);\n source = source * [LFNoise1.ar(0.17,0.4,1.1), LFNoise1.ar(0.57,1,1)];\n source = source;\n\n local = LocalIn.ar(2) + source;\n\n local = LPF.ar(local, 400 + LFNoise1.kr(0.1,300,100)) * 1.5;\n local = HPF.ar(local, 100 + LFNoise1.kr(0.15,050,050)) * 1.0;\n local = DelayN.ar(local, 0.2, 0.1);\n\n local = Limiter.ar(local.reverse,0.5);\n LocalOut.ar(local * 0.6);\n local = [local, Decay.ar(Impulse.ar(LFNoise1.kr(2.12).exprange(2,400)), 0.2 + LFNoise1.kr(0.11,0.1)) * local];\n local = FreqShift.ar(local, LFNoise1.kr(LFNoise1.kr(0.21).exprange(0.1,5)).exprange(0.1,500));\n local = HPF.ar(local, LFNoise1.kr(0.4).range(50,170), LFNoise1.kr(0.1).range(0.1,0.7));\n\n Splay.ar(local, LFNoise1.kr(0.21).range(0,1)) * amp;\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `File.readAllSignal` do?"}, {"role": "assistant", "content": "Open the file at the given path, call #-readAllSignal, and return the signal. Whether the process succeeds or fails, the file will always be"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{ var nse, env, kic;\n kic = tanh(Ringz.ar(LPF.ar(Trig.ar(Impulse.ar(1.0),SampleDur.ir),1000),30,0.25,7).sin*2);\n env = Env.perc(0.05, 1, 1, -4);\n nse = BrownNoise.ar(2) + PinkNoise.ar(0.5) * EnvGen.kr(env,Impulse.kr(1), doneAction: 2);\n\n nse = Mix.ar(BPF.ar(nse,[100,1200,80,40,20],MouseX.kr(0,1),[1,0.2,1,1,1]));\n nse = LPF.ar(nse + kic, MouseY.kr(100,1000))! 2\n\n}.play\n)\n```"}, {"role": "assistant", "content": "A muffled thump. An attempt at a Jurassic Park © glass of water sort of thing - or breaking into a silo."}]} -{"conversations": [{"role": "user", "content": "What does `OpenBCIboard.off` do? What arguments does it take?"}, {"role": "assistant", "content": "turn off (mute) one ore more Arguments: channel — can be an Integer or an Array of Integers. `c.off(1) //turn off the first channel`."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for minor scale filtered pulsewave demands?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n arg amp=0.1;\n var a, trig, basefreq, snd, cutoffmod, rqmod;\n \n a = Dseq([0, 2, 3, 5, 7, 8, 10, 12], inf);\n trig = Impulse.kr(4);\n basefreq = Demand.kr(trig, 0, a) + 38;\n basefreq = basefreq.midicps;\n cutoffmod = LFNoise2.ar(0.2).range(100,1500);\n rqmod = LFNoise2.ar(0.2).range(1,0.05);\n\n snd = (Pulse.ar(basefreq + 1 * SinOsc.kr(0.1.rand).range(0.99,1.010)) * amp) \n + (Pulse.ar(basefreq + 2 * SinOsc.kr(0.1.rand).range(0.99,1.010)) * amp) \n + (Pulse.ar(basefreq + 3 * SinOsc.kr(0.1.rand).range(0.99,1.01)) * amp)\n + (Pulse.ar(basefreq + 4 * SinOsc.kr(0.1.rand).range(0.99,1.01)) * amp)\n + (Pulse.ar(basefreq + 5 * SinOsc.kr(0.1.rand).range(0.99,1.01)) * amp)\n + (Pulse.ar(basefreq + 2 * SinOsc.kr(0.1.rand).range(0.99,1.010)) * amp) \n + (Pulse.ar(basefreq + 3 * SinOsc.kr(0.1.rand).range(0.99,1.01)) * amp)\n + (Pulse.ar(basefreq + 4 * SinOsc.kr(0.1.rand).range(0.99,1.01)) * amp)\n + (Pulse.ar(basefreq + 5 * SinOsc.kr(0.1.rand).range(0.99,1.01)) * amp)\n + (Pulse.ar(basefreq + 6 * SinOsc.kr(0.1.rand).range(0.99,1.01)) * amp);\n \n \n snd = LeakDC.ar(snd);\n snd = RLPF.ar(snd, cutoffmod, rqmod);\n snd = Limiter.ar(in: snd, level: 0.8, dur:0.001);\n snd.dup;\n \n}.play)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n\np = EnvelopedPlayer(\n Patch({\n SinOsc.ar * 0.1\n }),\n Env.adsr(releaseTime: 2.0),\n 1\n);\n\np.play;\n\n/*\nGroup(0)\n Group(1)\n Synth(\"-tIRuC\" : 1000) Patch[ f-1833258691 ]:synth\n Synth(\"EnvelopedPlayer1yeG~u\" : 1001) an EnvelopedPlayer:synth\n*/\n;\n\np.release;\n\np.status\n\np.free\n\np.insp\n\n\np.group\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n\np = EnvelopedPlayer(\n Patch({\n SinOsc.ar * 0.1\n }),\n Env.adsr(releaseTime: 2.0),\n 1\n);\n\np.play;\n\n/*\nGroup(0)\n Group(1)\n Synth(\"-tIRuC\" : 1000) Patch[ f-1833258691 ]:synth\n Synth(\"EnvelopedPlayer1yeG~u\" : 1001) an EnvelopedPlayer:synth\n*/\n);\n\np.release;\n\np.status\n\np.free\n\np.insp\n\n\np.group\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Semideterministic JitLib Code for Experimental Livecoding."}, {"role": "assistant", "content": "```supercollider\n// NX102\n// 2012-08-07_23_05_45\n\n// La ment no té límits.\n\n// Use with Jitlib:\n\np = ProxySpace.push(s.boot);\n\n// Read one sample on your collection:\n\nb = Buffer.read(s,Platform.userAppSupportDir +/+\"/audio/a11wlk01.wav\",bufnum:1);\n\n// Play and fun:\n\n~nx102.play;\n\n~nx102 = {\n Pan2.ar(LeakDC.ar(Normalizer.ar(\n BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(FreeVerb.ar(\n RHPF.ar(RLPF.ar(\n Pulse.ar(\n (PlayBuf.kr(1,1,Rand(50,100),1,0,1)*Rand(100,1000)).clip(\n Rand(5,12),Rand(12,20))) \n ,Rand(100,5000),Rand(0.005,0.1))\n ,Rand(5000,20000),Rand(0.005,0.1))\n ,0.0,0.0,0.0)\n ,100,6.0,6),1000,6.0,0),5000,6.0,0),10000,6.0,6)\n ,(1.25/0.999)*1.0,0.1)),0)\n};\n\n~nx102 = nil;\nb.free;\n```"}]} -{"conversations": [{"role": "user", "content": "My pattern keeps playing after I press Ctrl+."}, {"role": "assistant", "content": "Ctrl+. (CmdPeriod) stops everything scheduled on the clocks, including Patterns. If yours survives, it is not scheduled on a clock — most often it is a `Synth` created directly, or a `Task`/`Routine` started on `SystemClock` in a way that outlived the period. Do you still see the node in `s.plotTree`?"}, {"role": "user", "content": "Yes, there's a synth."}, {"role": "assistant", "content": "Then the sound is a node, not a pattern: `s.freeAll` will stop it. The likely cause is a SynthDef whose EnvGen has no `doneAction`, or a drone with `gate = 1` that nothing releases. Add `doneAction: 2` to the envelope, or keep a reference and `x.set(\\gate, 0)` when you want it to end."}]} -{"conversations": [{"role": "user", "content": "What does `AudacityLabels.read` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a new instance an read labels into the Arguments: labelPath — Path to the file that contains the label information."}]} -{"conversations": [{"role": "user", "content": "What does `AbstractPlayer.simplifyStoreArgs` do? What arguments does it take?"}, {"role": "assistant", "content": "the base class for all Players : a playable object Arguments: args."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Now with a little more stick?"}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\cowbell, {\n | out=0, amp=0.3, gate=1, fund_freq=540, pan=0.0 |\n var sig, env, hash;\n\n // hash = DC.ar(0);\n hash = BPF.ar(\n Hasher.ar(Sweep.ar(rate: TRand.kr(1.0, 10.0))), \n fund_freq * 1.4, \n 0.5,\n 2\n ).tanh * Env.perc(0.001, 0.02).ar(0);\n sig = Pulse.ar( fund_freq * [ 1, 1.5085 ], [ 0.565, 0.445 ], [ 0.4, 0.6 ] ).atan;\n env = EnvGen.ar(\n Env(\n [ 0, 0.05, 1, 0.1, 0 ], [ 0.003, 0.002, 0.05, 0.5 ], [2, -4, -4, -4]\n ),\n gate: gate,\n timeScale: [ 1.0, 1.5 ],\n doneAction: 2\n );\n sig = Mix( (hash + sig) * env );\n sig = BPF.ar( sig, fund_freq * 2, 1.808 );\n\n Out.ar( out, Pan2.ar( sig, pan, amp ) );\n}).add;\n);\n\nSynth(\\cowbell);\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n//a SynthDef\n(\nSynthDef(\"plucking\", {arg amp = 0.1, freq = 220, decay = 5, coef = 0.1;\n\nvar env, snd;\nenv = EnvGen.kr(Env.linen(0, decay, 0.5), doneAction: 2);\nsnd = Pluck.ar(\n in: Saw.ar(freq, 0.5*amp),\n trig: Impulse.kr(0),\n\n maxdelaytime: 0.1,\n delaytime: freq.reciprocal,\n decaytime: decay,\n coef: coef);\n Out.ar(0, [snd, snd]);\n}).add;\n);\n\n//Bugger soundtrack\n(\nPbind(\n \\instrument, \"plucking\",\n \\scale, Scale.lydian,\n \\degree, Prand([[-2.5, -4.001], [-7.002, -5], [-1, -3.003], [1.005, 0.51]], inf),\n \\amp, Pseq([0.1, 0.2, 0.3, 0.4, 0.5, 0.5, 0.5, 0.5], inf),\n \\decay, Pseq([0.25,1, 0.5, 0.125], inf),\n \\coef, Pseq([0.7, 0.8, 0.9], inf),\n \\dur, Pseq([0.01, 0.0025, 0.2475, 0.24, 0.5], inf)\n).play;\n)\n```"}, {"role": "assistant", "content": "This will be the sound track for Bugger, a Frogger clone that started as a school assignment.\r\nSimple SynthDef using Pluck, and a few Pbinds. \r\n\r\nBugger can be found on [GitLab](https://gitlab.com/Modanung/Bugger)."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Scale`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\na = Scale.major;\na.degrees; // [0, 2, 4, 5, 7, 9, 11]\na.semitones; // [0, 2, 4, 5, 7, 9, 11]\na.cents; // [0, 200, 300, 500, 700, 900, 1100]\na.ratios; // [1, 1.1224620483089, 1.2599210498937, 1.3348398541685, etc.]\n\nPbind(\\scale, a, \\degree, Pseq((0..7) ++ (6..0) ++ [\\rest], 1), \\dur, 0.25).play;\n\n// use non-standard tuning\na.tuning_(\\just);\na.degrees; // no change; degrees are independent of tuning\na.semitones; // [0, 2.0391000173077, 3.1564128700055, 4.9804499913461, etc.]\na.ratios.collect(_.round(0.001)); // [1, 1.125, 1.2, 1.333, 1.5, 1.667, 1.875]\n\nPbind(\\scale, a, \\degree, Pseq((0..7) ++ (6..0) ++ [\\rest], 1), \\dur, 0.25).play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for get different result each time running the pattern."}, {"role": "assistant", "content": "```supercollider\nTempoClock.default.tempo = 156/60;\n\n(\nSynthDef(\\spring, { |freq = 400, out = 0, pan = 0, gate = 1, dur = 0.15, curve = -4, amp = 1, index = 1|\n var sig = FreeVerb.ar(Pan2.ar(Blip.ar(freq, index), pan));\n var env = EnvGen.ar(Env.perc(0.01, dur, amp, curve), gate, doneAction:2);\n Out.ar(0, sig * env);\n}).add;\n);\n\n(\nPbind(*[\n instrument: \\spring,\n dur: Pseq([4, 1, 2, 1, 1, 1].scramble/ 4 / TempoClock.default.tempo, inf),\n degree: Pseq(#[1,2,3,4], inf) * Pkey(\\dur).reciprocal,\n octave: Pseq([2,3,4,4,4,3].scramble, inf),\n pan: Pxrand(Array.fill(100, { 0.gaussian(1).clip2(1) }), inf),\n amp: Pseq(#[0.95,1,0.8],inf),\n index: Pstutter(Pseq(#[4,8,12],inf), Pseq([2,3,4,5,6,8].scramble, inf))\n]).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `RedGIFImage.interlaced` do?"}, {"role": "assistant", "content": "A boolean. Indicates that this image needs to be drawn in separate"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for julian rohrhuber (c 2007)."}, {"role": "assistant", "content": "```supercollider\n// julian rohrhuber (c 2007)\n\n(\nSynthDef(\"deepsea\", { arg out, pan=0, amp=0.1, variation=0.9;\n var dt, n, freq, mul, t, u;\n n = Rand(7, 46);\n dt = 25.0 + Rand(-1.7, 1.7);\n dt = dt + LFNoise2.kr(2, variation) * 0.001;\n freq = 901 + Rand(0, 65);\n t = Impulse.ar(dt.reciprocal, 0, 100);\n mul = PulseCount.ar(t) < n;\n u = BPF.ar(mul * t, freq, 0.1);\n u = BPF.ar(u, freq, 0.2);\n DetectSilence.ar(u, doneAction:2);\n Out.ar(out, Pan2.ar(u, pan, amp));\n}).add;\n);\n\n(\nSynthDef(\"deepsea\", { arg out, pan=0, amp=0.1, variation=0.9;\n var dt, n, freq, mul, t, u, count;\n n = Rand(7, 46);\n dt = 25.0 + Rand(-1.7, 1.7);\n dt = dt + LFNoise2.kr(2, variation) * 0.001;\n freq = 901 + Rand(0, 65);\n t = Impulse.ar(dt.reciprocal, 0, 100);\n count = PulseCount.ar(t);\n mul = count < n;\n u = BPF.ar(mul * t, freq, 0.1);\n u = BPF.ar(u, freq * (count % LFNoise1.kr(1).range(2, 20) + 1), 0.2);\n DetectSilence.ar(u, doneAction:2);\n Out.ar(out, Pan2.ar(u, pan, amp * 10));\n}).add;\n);\n\n\n\ns.sendMsg(\"/s_new\", \"deepsea\", -1);\n\n\np = ProxySpace.push(s.boot);\n\n~out.play;\n~out.fadeTime = 10;\n\n(\n~fish = Pbind(\n \\instrument, \\deepsea,\n \\dur, Pfunc #{ rrand(9.0, 2.0) },\n \\pan, Pfunc #{ 1.0.rand2 }\n );\n);\n\n~out = ~fish;\n~out[1] = \\filter -> #{ arg in; BPF.ar(in * 5, 700, 0.1) };\n\n(\n~out[2] = \\filter -> #{ arg in;\n CombL.ar(LPF.ar(in * LFNoise1.kr(0.1).max(0), 800), 0.5, 0.5) + in.reverse\n};\n);\n\n(\n~out[3] = \\filter -> #{ arg in; var x; x = in;\n 5.do { x = AllpassN.ar(x, 0.18, {0.06.rand} ! 2 + 0.06, 8) };\n LPF.ar(x + in, 400) + (LFNoise1.kr(0.2) * in)\n };\n\n);\n\n\n\n~out[1] = nil;\n~out[2] = nil;\n\n\np.clear(10).pop;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Tempo.secs2beats` do? What arguments does it take?"}, {"role": "assistant", "content": "for control of tempo and for use in tempo based calculations Arguments: secs."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `CondVar`."}, {"role": "assistant", "content": "```supercollider\n(\nc = CondVar();\n\nRoutine {\n 1.wait;\n \"waited for 1 second\".postln;\n 1.wait;\n \"waited for another second, now waiting for you to run 'c.signalOne'...\".postln;\n c.wait;\n \"the condition is no longer waiting\".postln;\n 1.wait;\n \"waited for another second, now waiting for you...\".postln;\n c.wait;\n \"the condition is no longer waiting\".postln;\n 1.wait;\n \"the end\".postln;\n}.play;\n);\n\n// Run this line to unblock the routine\nc.signalOne;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// using an event to store values\nq = (n: 10, x: [1, 2, 3]);\nq[\\y] = q[\\x] * q[\\n]; // similar to ~y = ~x * ~n, but in a separate name space\nq.y = q.x * q.n; // shorter way to do the same (pseudo-methods)\nq.y; // [100, 200, 300\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// using an event to store values\nq = (n: 10, x: [1, 2, 3]);\nq[\\y] = q[\\x] * q[\\n]; // similar to ~y = ~x * ~n, but in a separate name space\nq.y = q.x * q.n; // shorter way to do the same (pseudo-methods)\nq.y; // [100, 200, 300]\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n().play; // the default note\n(freq: 500, pan: -1) .play; // 500 Hz, panned left\n(play: { ~what.postln }, what: \"hello happening\".play; // something else\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n().play; // the default note\n(freq: 500, pan: -1) .play; // 500 Hz, panned left\n(play: { ~what.postln }, what: \"hello happening\").play; // something else\n```"}]} -{"conversations": [{"role": "user", "content": "What does `MIDIFunc.trace` do? What arguments does it take?"}, {"role": "assistant", "content": "A convenience method which dumps all incoming MIDI Arguments: bool — A Boolean indicating whether dumping is on or off.."}]} -{"conversations": [{"role": "user", "content": "What does `JITGui.object` do?"}, {"role": "assistant", "content": "put an object in the gui - if the gui accepts"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// The done action is invoked after maxFadeNum.\n\n(\nx = {\n var lfo = LFDNoise3.kr(0.2);\n DXMix.ar(\n Dseq([0, 1], inf),\n `[\n Saw.ar(lfo.range(40, 90) * [1, 1.02], 0.03),\n { BPF.ar(PinkNoise.ar(0.05), lfo.range(200, 5000), 0.1) } ! 2\n ],\n fadeTime: 0.5,\n stepTime: 1,\n fadeMode: 0, // check with other modes too\n maxFadeNum: 5,\n doneAction: 2\n )\n}.play\n;\n\nx.release\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// The done action is invoked after maxFadeNum.\n\n(\nx = {\n var lfo = LFDNoise3.kr(0.2);\n DXMix.ar(\n Dseq([0, 1], inf),\n `[\n Saw.ar(lfo.range(40, 90) * [1, 1.02], 0.03),\n { BPF.ar(PinkNoise.ar(0.05), lfo.range(200, 5000), 0.1) } ! 2\n ],\n fadeTime: 0.5,\n stepTime: 1,\n fadeMode: 0, // check with other modes too\n maxFadeNum: 5,\n doneAction: 2\n )\n}.play\n);\n\nx.release\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for IP detector."}, {"role": "assistant", "content": "```supercollider\n// The following strings are to avoid listing network bridges which seem to be created by Parallels Desktop:\n// | grep -Fv \"inet 10.\" \n\n(\n~getLocalIPs = {\n var winCMD, macCMD, linCMD, ips;\n \n winCMD = {\n \"ipconfig | findstr /C:IPv4\"\n .unixCmdGetStdOut\n .replace(\" IPv4 Address. . . . . . . . . . . : \", \"\");\n };\n \n macCMD = {\n (\"ifconfig | grep -Fv\" + \"inet 10.\"\n .quote + \"| grep\" + \"inet \"\n .quote + \"| grep -Fv 127.0.0.1 | awk '{print $2}'\"\n ).unixCmdGetStdOut;\n };\n \n linCMD = {\n (\"ip address | grep \\\"inet \\\" | grep -Fv 127.0.0.1 | awk '{print $2}' | cut -d '/' -f1\")\n .unixCmdGetStdOut;\n };\n //linCMD = { (\n // \"ifconfig | grep\" + \"inet \".quote +\n // \"| grep -Fv 127.0.0.1 | awk '{print $2}'\" \n //).unixCmdGetStdOut };\n \n ips = Platform.case(\n \\osx, { macCMD.() },\n \\linux, { linCMD.() },\n \\windows, { winCMD.() }\n );\n \n ips = ips.split(Char.nl);\n ips.removeAt(ips.size-1);\n ips\n}\n);\n\n~getLocalIPs.()\n```"}]} -{"conversations": [{"role": "user", "content": "How do I add reverb with FreeVerb?"}, {"role": "assistant", "content": "`FreeVerb.ar(in, mix, room, damp)` — mix 0..1 is dry/wet, room 0..1 is the size (0.5 is a small room, 0.9 is a hall), damp 0..1 rolls off the high end of the tail. Put it after your sound: `FreeVerb.ar(SinOsc.ar(440) * 0.1, 0.4, 0.8, 0.5)`. For a send-style reverb, write the dry signal to Out.ar(0, …) and the same signal through FreeVerb to a second bus."}]} -{"conversations": [{"role": "user", "content": "What does `Patch.defName` do?"}, {"role": "assistant", "content": "Pairs an Instr with inputs that that will be passed to the Instr"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\"help-InKr\", { |out = 0, in = 0|\n Out.ar(out,\n SinOsc.ar(In.kr(in, 1), 0, 0.1)\n )\n}).add;\nSynthDef(\"help-lfo\", { |out = 0|\n Out.kr(out, LFNoise1.kr(0.3, 200, 800))\n}).add;\n);\n\n\nb = Bus.control(s, 1);\nb.set(800);\n\nSynth(\"help-InKr\", [\\in, b.index]);\nb.set(400);\nb.set(300);\nSynth(\"help-lfo\", [\\out, b.index];\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\"help-InKr\", { |out = 0, in = 0|\n Out.ar(out,\n SinOsc.ar(In.kr(in, 1), 0, 0.1)\n )\n}).add;\nSynthDef(\"help-lfo\", { |out = 0|\n Out.kr(out, LFNoise1.kr(0.3, 200, 800))\n}).add;\n);\n\n\nb = Bus.control(s, 1);\nb.set(800);\n\nSynth(\"help-InKr\", [\\in, b.index]);\nb.set(400);\nb.set(300);\nSynth(\"help-lfo\", [\\out, b.index]);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `UScoreEditor.muteEvents` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: events — (describe argument here). Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "What is `Condition`?"}, {"role": "assistant", "content": "Condition — Block the execution of a thread"}, {"role": "user", "content": "What does `Condition.new` do?"}, {"role": "assistant", "content": "Create a new instance, set the test variable."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nc = Condition.new(false);\n\nRoutine {\n 1.wait;\n \"waited for 1 second\".postln;\n 1.wait;\n \"waited for another second, now waiting for you ... \".postln;\n c.wait;\n \"the condition has stopped waiting.\".postln;\n 1.wait;\n \"waited for another second\".postln;\n \"waiting for you ... \".postln;\n c.test = false;\n c.wait;\n \"the condition has stopped waiting.\".postln;\n 1.wait;\n \"the end\".postln;\n}.play;\n);\n\n// continue\n(\nc.test = true;\nc.signal;\n);\n\n// a typical use is a routine that can pause under certain conditions:\n(\nc = Condition.new;\nfork { loop { 1.wait; \"going\".postln; c.wait } };\n);\nc.test = true; c.signal;\nc.test = false;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// allocate buffer\nb = Buffer.alloc(s, 44100, 1);\n\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nBufDelayL.ar(b.bufnum, z, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\nb.free;\n\n\n// multichannel\n\n// two channels, two buffers\nb = Buffer.allocConsecutive(2, s, 32768, 1);\n\na = { |bufs = #[0, 1]|\n var sig = SinOsc.ar([440, 880\n// …\n```"}, {"role": "assistant", "content": "Dust randomly triggers Decay to create an exponential decay envelope for the WhiteNoise input source (BufDelayL: Buffer based simple delay line with linear interpolation.)"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for more tweets (pitchshift feedback + sinoscfb)?"}, {"role": "assistant", "content": "```supercollider\n// probably horrible for speakers... \n\n// glitchift\n{l=LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j**[l,k],k),[0.05,0.03],j);LocalOut.ar(s);s}.play;\n// drone\n{l=LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j**[2,2.1],k),[0.05,0.03],j);LocalOut.ar(s);s}.play;\n\n\n// few more I was mucking around with (remove tanh loop for < 140c)\n{l = LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j**l,k),[0.05,0.03],j);5.do{s=s.tanh+(s*0.1)};LocalOut.ar(s);s}.play;\n\n{l = LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j**2,k),[0.05,0.03],j);5.do{s=s.tanh+(s*0.1)};LocalOut.ar(s);s}.play;\n\n{l = LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j*20,k),[0.05,0.03],j);5.do{s=s.tanh+(s*0.1)};LocalOut.ar(s);s}.play;\n\n{l = LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j**j,k),[0.05,0.03],j);5.do{s=s.tanh+(s*0.1)};LocalOut.ar(s);s}.play;\n\n{l = LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j**l.abs,k),[0.05,0.03],j);5.do{s=s.tanh+(s*0.1)};LocalOut.ar(s);s}.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `BusPlug.defaultNumControl` do?"}, {"role": "assistant", "content": "Default number of channels when initializing in control rate and no specific number is given (default:"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Converting an environment in a prototype object."}, {"role": "assistant", "content": "```supercollider\n~constructPseudoMethods = { |envir|\n var newEnvir = envir.collect { |value|\n var argNames, argBlock, namesBlock, code, func;\n if(value.isKindOf(Function)) {\n func = value;\n argNames = func.def.argumentString(withDefaultValues: true);\n namesBlock = func.def.argumentString(withDefaultValues: false);\n argBlock = if(argNames.notNil) { \"|self, \" ++ argNames ++ \"|\" };\n code = \"{ |func, envir| { % envir.use { func.value(%) } } }\".format(argBlock ? \"\", namesBlock ? \"\");\n //code.postln;\n code.interpret.value(func, envir)\n } {\n value\n }\n };\n newEnvir.know = true; // we want a prototype object style environment\n};\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SOMTrain.kr` do? What arguments does it take?"}, {"role": "assistant", "content": "Create (train) a Self-Organising Map Arguments: bufnum — A reference to the buffer where the map will be created. Initialising the map is up to you (see below).; inputdata — An Array of the input signals for the net to learn.; netsize — The size of the neural net along one dimension.; numdims — The dimensionality of the neural net. Choose from 1, 2, 3, or 4.; traindur — The length of the training period; the number of data frames that will come in before the net gradually \"freezes\" into its final state; nhood — The initial size of the neighbourhood used in training. (The size always shrinks to zero as the training progresses.) The size is expressed as a fraction of netsize. Default is 0.5, and you probably don't need to change it.; gate — A simple on-or-off control. When off (gate<=0) the incoming data is ignored.; initweight — How heavily the algorithm weights the data points at first (the weighting always tails off to zero as the training progresses, in a reciprocal curve). Default is 1, and you usually don't need to change this.. Returns: The UGen outputs an array of three values: the number of data points still to come in before training finishes; the \"reconstruction error\" of the single data point that has most recently been input (t"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// ControlSpec-map can also be used to map ugens\n(\nvar spec;\nspec = [100, 18000, \\exp].asSpec;\n{\n var freq, osc;\n osc = SinOsc.kr(0.1).range(0, 1);\n freq = spec.map(osc);\n\n freq.dump; // BinaryOpUGen\n\n SinOsc.ar(\n freq.poll\n )\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// ControlSpec-map can also be used to map ugens\n(\nvar spec;\nspec = [100, 18000, \\exp].asSpec;\n{\n var freq, osc;\n osc = SinOsc.kr(0.1).range(0, 1);\n freq = spec.map(osc);\n\n freq.dump; // BinaryOpUGen\n\n SinOsc.ar(\n freq.poll\n )\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\np = PbindFx([\n \\instrument, \\source,\n \\dur, 0.2,\n \\amp, 0.3,\n\n // downwards tendency + chord sequence\n \\midinote, Pseq((90, 80..50), inf) +\n Pn(Pshuf([[0, 5], 0, [0, 2.5], [-2.5, 12.5], [-3, 0]])),\n\n \\fxOrder, Prand([1, [1,2], [1,2]], inf),\n\n // lag must be adapted to maxEchoDelta\n \\lag, Pfunc { |e| e.fxOrder.isArray.if { 0 }{ 0.2 } },\n\n // echo -> shorter source decay\n \\decayTime, Pfunc { |e| e.fxOrder.isArray.if { 0.1\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\np = PbindFx([\n \\instrument, \\source,\n \\dur, 0.2,\n \\amp, 0.3,\n\n // downwards tendency + chord sequence\n \\midinote, Pseq((90, 80..50), inf) +\n Pn(Pshuf([[0, 5], 0, [0, 2.5], [-2.5, 12.5], [-3, 0]])),\n\n \\fxOrder, Prand([1, [1,2], [1,2]], inf),\n\n // lag must be adapted to maxEchoDelta\n \\lag, Pfunc { |e| e.fxOrder.isArray.if { 0 }{ 0.2 } },\n\n // echo -> shorter source decay\n \\decayTime, Pfunc { |e| e.fxOrder.isArray.if { 0.1 }{ 0.7 } },\n \\cleanupDelay, Pkey(\\decayTime)\n ],[\n \\fx, \\spat,\n \\maxDelayTime, 0.005,\n \\cleanupDelay, Pkey(\\maxDelayTime)\n ],[\n \\fx, \\echo,\n \\echoDelta, Pseq((1..5)/50, inf),\n \\decayTime, 1,\n \\cleanupDelay, Pkey(\\decayTime)\n ]\n);\n\nq = p.play;\n);\n\nq.stop;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `SelectButtonSet` in SuperCollider briefly."}, {"role": "assistant", "content": "SelectButtonSet — a set of radio buttons Radio button style set, fashioned as a single object. Category: Libraries > crucial > GUI."}]} -{"conversations": [{"role": "user", "content": "What does `Error.backtrace` do?"}, {"role": "assistant", "content": "Returns the underlying backtrace created when the exception was thrown. Returns `nil` if it was never"}]} -{"conversations": [{"role": "user", "content": "What does `Instr.remove` do? What arguments does it take?"}, {"role": "assistant", "content": "remove an Instr from the Arguments: instr. Returns: returns the removed Instr or nil it wasn't defined"}]} -{"conversations": [{"role": "user", "content": "How do I pan notes around the stereo field in a pattern?"}, {"role": "assistant", "content": "Put `\\pan` in the Pbind: the default instrument understands it and passes it to Pan2.\n\n```supercollider\n(\nPbind(\n \\scale, Scale.minorPentatonic,\n \\degree, Pseq([0, 2, 4, 7, 9, 7, 4, 2], inf),\n \\dur, 0.2,\n \\pan, Pseq([-1, -0.5, 0, 0.5, 1, 0.5, 0, -0.5], inf),\n \\amp, 0.15\n).play;\n)\n```\n\nTo pan an arbitrary synth, add a `pan = 0` argument to the SynthDef and wrap the output in\n`Pan2.ar(sig, pan)`."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for 2 channels of chuckling sawtooths."}, {"role": "assistant", "content": "```supercollider\n//hall of mirrors\n{[AllpassC.ar(HPF.ar(RLPF.ar(Saw.ar(LFPar.kr(0.25).range(220,440)),LFPar.kr(MouseX.kr(0,8),pi).range(220,20000),0.3),LFPar.kr(MouseY.kr(0,8)).range(220,20000)),2,MouseX.kr(0,0.5),2),AllpassC.ar(HPF.ar(RLPF.ar(Saw.ar(LFPar.kr(0.25,pi).range(440,220)),LFPar.kr(MouseX.kr(8,0),pi).range(20000,220),0.3),LFPar.kr(MouseY.kr(8,0),pi).range(20000,220)),2,MouseX.kr(0.5,0),2)]}.play\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Class.superclassesDo` do?"}, {"role": "assistant", "content": "Call a function passing each superclass of the receiver. `List.superclassesDo { |x| x.postln"}]} -{"conversations": [{"role": "user", "content": "What does `ProxySpace.fadeTime` do?"}, {"role": "assistant", "content": "set the fadetime of all proxies as well as the default fade"}]} -{"conversations": [{"role": "user", "content": "What does `PlayerMixer.numChannels` do?"}, {"role": "assistant", "content": "takes multiple players as input, mixes them to a single (stereo) output"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PV_MagAbove`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\nb = Buffer.read(s, ExampleFiles.child);\n\n\n(\nSynthDef(\"help-magAbove\", { |out = 0|\n var in, chain;\n in = SinOsc.ar(SinOsc.kr(SinOsc.kr(0.08, 0, 6, 6.2).squared, 0, 100, 800));\n // in = WhiteNoise.ar(0.2);\n chain = FFT(LocalBuf(2048), in);\n chain = PV_MagAbove(chain, 310);\n Out.ar(out, 0.1 * IFFT(chain).dup);\n}).play(s);\n);\n\n(\nSynthDef(\"help-magAbove2\", { |out = 0|\n var in, chain;\n in = WhiteNoise.ar(0.2);\n chain = FFT(LocalBuf(2048), in);\n chain = PV_MagAbove(chain, MouseX.kr(0, 10));\n Out.ar(out, 0.1 * IFFT(chain).dup);\n}).play(s);\n);\n\n(\nSynthDef(\"help-magAbove3\", { |out = 0, soundBufnum = 2|\n var in, chain;\n in = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);\n chain = FFT(LocalBuf(2048), in);\n chain = PV_MagAbove(chain, MouseX.kr(0, 310));\n Out.ar(out, 0.1 * IFFT(chain).dup);\n}).play(s, [\\soundBufnum, b]);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SplineGen.dimension` do?"}, {"role": "assistant", "content": "get/set the dimension that represents time. Usually 0. The value dimension is then considered to be Returns: Integer"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Midterm Q1 (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef( \"pulsey\",{arg freq, amp;\n var env, snd;\n env = Env.perc(attackTime: 0.2,\n releaseTime: 4,\n level: amp).kr(doneAction:2);\n snd = Pulse.ar(\n freq: freq*LFNoise2.kr([4, 5, 7]).range(0.988, 1.011),\n mul:env);\n snd = LPF.ar(in: snd, freq: 1000);\n snd = Splay.ar(snd);\n Out.ar(0, snd);\n\n\n}).add;\n);\n\n(\nm = [72, 79, 77, 79, 82, 79, 87, 86, 84, 82, 84, 79];\n\n\nPbind(\n \\instrument, \"pulsey\",\n \\midinote, Pseq(m, inf),\n \\dur, Pseq([Pn(0.5, 5), 1.5], inf),\n \\amp, Pwhite(0.15, 0.2)\n).play;\n\n\nPbind(\n \\instrument, \"pulsey\",\n \\midinote, Pseq(m.reverse, inf),\n \\dur, Pseq([Pn(0.5, 5), 1.5], inf),\n \\ctranspose, Pwrand([-12, -7, -24], [0.8, 0.1, 0.1], inf),\n \\amp, 0.08,\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `XFade2`."}, {"role": "assistant", "content": "```supercollider\n{ XFade2.ar(Saw.ar, SinOsc.ar, LFTri.kr(0.1)) }.play\n```"}]} -{"conversations": [{"role": "user", "content": "What is `ArrayedCollection`?"}, {"role": "assistant", "content": "ArrayedCollection — Abstract superclass of Collections of fixed maximum size"}, {"role": "user", "content": "What does `ArrayedCollection.newClear` do?"}, {"role": "assistant", "content": "Creates a new instance with indexedSize indexable slots. The slots are filled with Nil, zero or something else appropriate to the type of indexable slots in the object. `Array.newClear(4).postln;`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n pitches.size.do{ |i|\n {\n var freq = pitches[i].midicps;\n var env = Env.perc.ar(Done.freeSelf);\n SinOsc.ar(freq) * 0.1 * env\n }.play;\n 0.2.wait\n }\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for electric guitar (a SuperCollider snippet)?"}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\noisecomb2, { arg out, gate=1, pan=0, freq=300, amp=0.1, noiselevel=0.2,\n minfreq=100, decaytime=1, doneAction=2, ffreq=500, rq=0.3, spread=0.8;\n var sig, env;\n sig = WhiteNoise.ar(noiselevel);\n sig = sig + ClipNoise.ar(noiselevel);\n sig = sig + AllpassC.ar(sig, 1/minfreq, 1/freq, decaytime);\n sig = RLPF.ar(sig, ffreq * \\ffreqtab.kr(1!10), rq);\n env = EnvGen.kr(\\adsr.kr(Env.adsr(0.6,0.1,0.8,0.1)), gate, doneAction:doneAction);\n sig = sig * env;\n sig = Splay.ar(sig, spread, 1, pan);\n sig = sig * amp;\n Out.ar(out, sig);\n}).store;\n);\n\n(\nPdef(\\plopbla, Pbind(\n \\instrument, \\noisecomb2,\n \\note, Pseq([[0,7],[1,8],[-1,5]]-2,inf),\n //\\note, Pseq([0,1,2,3,4],inf)\n \\octave, Pstep(Pseq([3,4],inf),Pseq([5,0.75],inf)),\n \\minfreq, 50,\n \\decaytime, 1.0,\n \\adsr, Pseq([\n [Env.adsr(0.02,0.1,0.8,0.4,curve:0.5)],\n [Env.adsr(0.02,0.1,0.8,0.4,curve:0.5)],\n [Env.adsr(0.02,0.1,0.8,0.4,curve:0.5)],\n [Env.adsr(0.03,0.1,0.8,0.1,curve:0.5)],\n [Env.adsr(0.03,0.1,0.8,0.1,curve:0.5)],\n [Env.adsr(0.03,0.1,0.8,0.1,curve:0.5)],\n ],inf),\n \\legato, 1.0,\n //\\ffreq, [500,610,820,140],\n \\ffreq, 500,\n //\\ffreqtab, [[0.8,1,1.1,1.2, 2,4,5,6, 8,10].scramble.postln],\n //\\ffreqtab, Pfunc{ [[ 0.1, 0.2, 0.3, 0.5, 1,2,3,8, 10, 12 ].scramble] + rrand(0.01,1.0); },\n //\\ffreqtab, [ 6, 4, 5, 10, 1, 1.2, 0.8, 1.1, 2, 8 ], // also nice\n \\ffreqtab, [[ 6, 4, 5, 10, 1, 1.2, 0.8, 0.4, 2, 8 ]],\n \\dur, Pseq([3,1,1, 0.25,0.25,0.25],inf),\n \\amp, 1.1\n)).play;\n);\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// for the members of the cult of q\n// who don't want to ~tilde\n\n\n//-- INIT\nq = q ? ();\n\nq.local = currentEnvironment;\n\nq.local.pattern = Pbind(\\note, Pbrown(0, { 17.rand + 1 } ! 12), \\dur, 0.05, \\amp, 0.01);\n\n\n//-- PLAY\n\nq.local.player = q.local.pattern.play;\n\n\n\n\n//-- STOP\n\nq.local.player.stop;\n\n//-- FREE\n\nq.local = nil;\n```"}, {"role": "assistant", "content": "for the members of the cult of q who don't want to ~tilde -- INIT."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//spinning hypercube / tesseract\n//after Shiffman https://codingtrain.github.io/website-archive/CodingChallenges/113-hypercube.html\n\n\n(\nvar width= 640, height= 480, w,\ntheta= 0, speed= 0.005, hypercube;\n\nw= RedWindow(\"3Dhypercube\", Rect(128, 64, width, height)).front;\nhypercube= Red4DTesseract();\n\n//--loop\nw.draw{\n theta= theta+speed;\n hypercube.rotation= RedVector[theta, 0, 0, 0, 0, theta];\n hypercube.update;\n\n //--render\n hypercube.render(2, 500); //1= exaggerate, 2= standard\n Pen.translate(width*0.5, height*0.5);\n Pen.fillColor= Color.white;\n hypercube.draw;\n Pen.strokeColor= Color.white;\n hypercube.drawOutlines;\n};\nw.play;\nCmdPeriod.doOnce({w.close});\n)\n```"}, {"role": "assistant", "content": "spinning hypercube / tesseract after Shiffman https://codingtrain.github.io/website-archive/CodingChallenges/113-hypercube.html."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for some initial thoughts on psytrance bassline."}, {"role": "assistant", "content": "```supercollider\n(\n{ | dur = 0.15, atk = 0.005, amp = 1 |\n SinOsc.ar(\n EnvGen.ar( Env(\n NamedControl.kr(\\freq_l, [2960, 70, 90]),\n NamedControl.kr(\\freq_d, [0.07, 0.2]),\n NamedControl.kr(\\freq_c, [-13, -1]),\n ) ),\n mul:amp * EnvGen.ar(\n Env.perc( atk, dur - atk, curve: NamedControl.kr(\\amp_c, [-1, 6])),\n doneAction: 2\n ); \n ) ! 2;\n}.asSynthDef.name_(\"kick\").add;\n\n{ | atk = 0.01, dur = 0.15, freq = 50, amp=0.8 |\n BPF.ar(LFSaw.ar(freq), freq, 2, mul: EnvGen.kr( Env.perc( atk, dur-atk, amp, 6 ), doneAction: 2 )) ! 2;\n}.asSynthDef.name_(\"bass\").add;\n\n{ | dur = 0.15, freq = 50, amp = 0.8, index = 10 |\n PMOsc.ar(freq, freq + 5, index, mul: amp * EnvGen.kr( Env.triangle( dur ), doneAction: 2 )) ! 2;\n}.asSynthDef.name_(\"bazz\").add;\n);\n\n\n(\nPpar([\n Pbind(*[\n instrument: \\kick,\n delta: 1,\n dur: Pfunc({ thisThread.clock.beatDur }) / 4,\n amp: Pseq([\n Pseq([1], 16),\n Pseq([0.8, 1], 8), \n Pseq([1], 16),\n Pseq([0.8, 0.8, 0.9, 1], 8)\n ], inf) * 0.8,\n freq_l: Pstutter(Prand(2.pow((1..4)),inf), Pseq([\n `[2960,70,90],\n `[1260,60,110],\n `[4360,60,120]\n ],inf))\n ]),\n Pbind(*[\n instrument: \\bass,\n delta: 1/4,\n dur: Pkey(\\delta) * Pfunc({ thisThread.clock.beatDur }),\n freq: Pseq([\\r, 50,60,70], inf),\n amp:0.6\n ]),\n Pbind(*[\n instrument: \\bazz,\n delta: 1/4,\n dur: Pkey(\\delta) * Pfunc({ thisThread.clock.beatDur }),\n freq: Pseq([\\r, 30,35,40], inf),\n amp:0.2\n ])\n]).play(TempoClock(156/60), quant:[1])\n);\n\n// kick from above?\n(\nPbind(*[\n instrument: \\kick,\n delta: Pseq(Array.geom(540, 1, 1.015).reciprocal.reverse),\n dur: Pkey(\\delta) * Pfunc({ thisThread.clock.beatDur }),\n atk: Pkey(\\dur) / 6,\n amp: 0.8\n]).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\ns.boot;\n\nb = Buffer.alloc(s, 100);\nb.zero;\nb.set(33, 1.034);\n// This should detect the 33rd value as the highest...\nx = {BufMax.kr(b).poll}.play;\n\n// ...until we set a new winner...\nb.set(74, 1.038);\n```"}, {"role": "assistant", "content": "This should detect the 33rd value as the highest... ...until we set a new winner... (BufMax: detect the largest value (and its position) in an array of UGens)"}]} -{"conversations": [{"role": "user", "content": "Explain `Klank` in SuperCollider briefly."}, {"role": "assistant", "content": "Klank — Bank of resonators Klank is a bank of fixed frequency resonators which can be used to simulate the resonant modes of an object. Each mode is given a ring time, which is the time for the mode to decay by 60 dB. Category: UGens > Generators > Deterministic, UGens > Filters > Linear."}]} -{"conversations": [{"role": "user", "content": "Explain `HairCell` in SuperCollider briefly."}, {"role": "assistant", "content": "HairCell — Simple cochlear hair cell model Simple hair cell model. Greater size input (positive values only, ie only in one direction as in real inner hair cells) opens the ion channels more to receive chemicals at rate minrate+(input*rate). If the accumulated chemical reaches 1.0 units, the cell fires, going to output value 1.0, and then decaying each sample with a loss factor. There is a limited store of chemicals, which is constantly be Category: UGens > Analysis, UGens > Filters."}]} -{"conversations": [{"role": "user", "content": "Explain `Pfset` in SuperCollider briefly."}, {"role": "assistant", "content": "Pfset — Insert an environment into the event prototype before evaluating the supplied pattern Good for setting default values or loading server objects. Category: Streams-Patterns-Events > Patterns > Data Sharing."}]} -{"conversations": [{"role": "user", "content": "What does `ArrayedCollection.removeAt` do?"}, {"role": "assistant", "content": "Remove and return the item at index, specified as an integer or a float starting from 0, shrinking the size of the ArrayedCollection. `y = [1, 2, 3,"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `UnaryOpUGen`."}, {"role": "assistant", "content": "```supercollider\na = WhiteNoise.ar; // a WhiteNoise\nb = a.squared; // a UnaryOpUGen.\nb.operator; // squared\n\n// sound example\n\n{ var a = LFSaw.ar(300).range(0, 2pi); a.sin * 0.1 }.play;\n\n// Plotting the \"abs\" unary operator (via the server):\n\n{ SinOsc.ar(300).abs }.plot\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for reqs: sc3-plugins."}, {"role": "assistant", "content": "```supercollider\n(\nfork {\n TempoClock.tempo = 1;//156/60;\n Ndef(\\ttso).play;\n loop {\n var seed = thisThread.randSeed = 100000000.rand.debug('seed');\n var wait = 20.rrand(60).debug('wait');\n Ndef(\\ttso, {\n var gamma= {[rrand(30,50),rrand(50,70),rrand(50,70),rrand(70,100)].choose.midicps*LFNoise2.kr(1,0.01,1)}!24;\n Pan2.ar(\n LeakDC.ar(\n Normalizer.ar(\n BPeakEQ.ar(\n FreeVerb.ar(\n Splay.ar(RLPF.ar(LFSaw.ar(gamma)/4,gamma*LFCub.kr(rrand(0.01,0.1),0,2,3),LFNoise2.kr(1/8,0.6,0.7))),\n 0.1,0.1,0.1\n ),\n [100.rrand(200),1000.rrand(2000),5000.rrand(7000),10000.rrand(15000)],Array.rand(4,0,6),Array.rand(4,0,6)\n ).mean,\n 0.8,0.1\n )\n ),\n LFNoise2.kr(0.1.exprand(10)).range(-0.1,0.1),\n SelectX.kr(\n [SinOsc,LFTri].choose.kr(2.rrand(25).reciprocal).range(0,2),\n [\n 0.7.rrand(1),\n LFGauss.kr(\n Latch.kr(\n LFNoise2.kr(1).range(1/5,5.rrand(20)).reciprocal, \n Impulse.kr(LFNoise2.kr(3.rrand(10).reciprocal).range(0.5,3.rrand(6)))\n ),\n SinOsc.kr(3.rrand(15).reciprocal).range(0.07.rrand(0.16),0.25.rrand(0.4))\n ),\n 0.1.rrand(0.5)\n ]\n )\n )\n }).fadeTime_(3.rrand(6));\n wait.wait;\n }\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes song of forest."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\sound, {\n arg i_bus = 0, amp = 0.1, freq = 440, sustain = 1, pan = 0;\n var env, osc, out;\n env = EnvGen.kr(Env.perc(0.01, sustain, amp),doneAction:2);\n osc = SinOsc.ar([freq, freq * 1.005, freq * 0.995], mul:env);\n out = Pan2.ar(osc, pan);\n Out.ar(i_bus, out);\n}).send(s);\n);\n\n(\n~amp = 0.1;\na = Pdef(\\a,\n Pbind(\n \\instrument, \\sound,\n \\amp, ~amp * 1.5,\n \\degree, Pseq([2, 4, 5, 6, 1] - 1, inf),\n \\dur, Pseq([1, 1, 1, 1, 2] / 4, inf)\n )\n).quant_([3, 0, 0, 1]);\n\nb = Pdef(\\b,\n Pbind(\n \\instrument, \\sound,\n \\amp, ~amp,\n \\degree, Pseq([8, 6, 5, 3, 4, 6] - 1, inf),\n \\dur, Pseq([1, 1, 1, 1, 1, 1] / 4, inf)\n )\n).quant_([3, 0, 0, 1]);\n\nc = Pdef(\\c,\n Pbind(\n \\instrument, \\sound,\n \\amp, ~amp * 0.6,\n \\degree, Pseq([1, 6, 8, 6, Pwrand([11,13], [2, 1].normalizeSum)] - 1, inf),\n \\amp, Pseq([0, 1, 1, 1, 1] / 10, inf),\n \\dur, Pseq([8, 1, 1, 1, 1] / 8, inf),\n \\sustain, 0.1\n )\n).quant_([3, 0, 0, 1]);\n);\n\n(\nSystemClock.sched(0, Routine({\n a.play; 12.yield;\n b.play; 12.yield;\n c.play; 12.yield;\n c.pause; 6.yield;\n a.pause; 6.yield;\n\n b.pause; a.play; 12.yield;\n b.play; 12.yield;\n c.play; 12.yield;\n c.pause; a.pause; 6.yield;\n b.pause; 6.yield;\n}));\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `TwoZero`."}, {"role": "assistant", "content": "```supercollider\n{ TwoZero.ar(WhiteNoise.ar(0.125), XLine.kr(20, 20000, 8), 1) }.play\n```"}]} -{"conversations": [{"role": "user", "content": "How to know the hardware buffer size?"}, {"role": "assistant", "content": "SuperCollider forum — How to know the hardware buffer size\n\nSay you want to use a UGen to control an external hardware device, independently of the soundcard. At first, one would think that this calculation is time-locked to the control rate, so e.g. at 1.5 kHz for a 48 kHz sample rate and a block size of 32.\n\nBut no, of course this calculation is time-locked to the hardware buffer size (I/O buffer size) of the soundcard you happen to use. EDIT: For a typical (low) setting, this is something like 256, so that would be about 190 Hz (5 ms). This may be too much delay for some applications, so we may want a smaller buffer size.\n\nIn scsynth, we can set a value for this size via ServerOptions:\n\n```supercollider\n // reduce to block size\ns.options.hardwareBufferSize = s.options.blockSize;\ns.reboot;\n```\n\nUnfortunately, not all soundcards support low block sizes. Also high quality sound cards may have very large ones, actually – this is a cultural thing, when you use them for recording, it is not a problem. But for live I/O it introduces delay (a quarter second is like an eternity then).\n\nSo now my question: how do I know if the above setting has been actually successful? How do I know what buffer size is current?\n\nI am sure that on different OSes there are ways to derive this in different ways. Maybe there is a way in supercollider as well?"}]} -{"conversations": [{"role": "user", "content": "What does `SequenceableCollection.selectIndices` do?"}, {"role": "assistant", "content": "Return a new collection of same type as receiver which consists of all indices of those elements of the receiver for which function answers `true`. The function is passed two arguments, the item and an integer index. `#[a, b, c, g, h, h, j, h].selectIndices({ |item, i| item ===` If you want to control what type of collection is returned, use"}]} -{"conversations": [{"role": "user", "content": "What does `Pseed.new` do? What arguments does it take?"}, {"role": "assistant", "content": "set the random seed in subpattern Arguments: randSeed — integer number, pattern or stream that returns an integer number.; pattern."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a, b;\na = Pslide([1, 2, 3, 4, 5], inf, 3, 1, 0);\nx = a.asStream;\n13.do({ x.next.postln });\n);\n\n// Pslide used as a sequence of pitches:\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\nc = Pslide(#[1, 2, 3, 4, 5], inf, 3, 1, 0) * 3 + 67;\nx\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a, b;\na = Pslide([1, 2, 3, 4, 5], inf, 3, 1, 0);\nx = a.asStream;\n13.do({ x.next.postln });\n);\n\n// Pslide used as a sequence of pitches:\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\nc = Pslide(#[1, 2, 3, 4, 5], inf, 3, 1, 0) * 3 + 67;\nx = c.asStream;\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, x.next.midicps]);\n 0.17.wait;\n })\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `MxUnitApp` in SuperCollider briefly."}, {"role": "assistant", "content": "MxUnitApp — scripting interface object for a unit A unit holds an object like an Instr, NDef, Bus, Spline, SFP (soundfile player) etc. Category: Mx."}]} -{"conversations": [{"role": "user", "content": "What does `UScore.prStartTasks` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: targets — (describe argument here); startPos — (describe argument here); assumePrepared — (describe argument here); updatePosition — (describe argument here); startEventsActiveAtStartPos — (describe argument here); loop — (describe argument here). Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes old school noise from needle on vinyl."}, {"role": "assistant", "content": "```supercollider\n{\n var sig, sig1, sig2, lpf, popHz, lagtime, noise, popHzMul,\n pan1, pan2, panmod1, panmod2;\n popHzMul = Decay.kr(Dust.kr(0.15), 3, 10, 0.8);\n popHz = LFNoise1.kr(20).exprange(0.1,10) * popHzMul;\n sig = Dust2.ar(popHz);\n lpf = LFNoise1.kr(10).exprange(1000,20000);\n lagtime = LFNoise1.kr(20).range(0.008,0.0001);\n sig = LPF.ar(sig, lpf);\n sig = Lag.ar(sig, lagtime);\n sig = sig + FreeVerb.ar(sig, 0.8, 1, mul:0.11);\n panmod1 = LFNoise1.kr(5).range(0.2,0.7);\n panmod2 = LFNoise1.kr(5).range(0.2,0.7);\n pan1 = SinOsc.kr(panmod1).range(-0.2,0.2);\n pan2 = SinOsc.kr(panmod2).range(-0.2,0.2);\n sig1 = Pan2.ar(sig, pan1, 0.5);\n sig2 = Pan2.ar(sig, pan2, 0.5);\n sig = sig1 + sig2;\n sig = sig + BPF.ar(BrownNoise.ar([0.0025,0.0025]), 7200, 0.4);\n sig = sig + HPF.ar(Crackle.ar([1.999,1.999], 0.0025),2000);\n Out.ar(0, sig*6);\n}.play\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for mixolydian flat six meditation in pythagorean?"}, {"role": "assistant", "content": "```supercollider\n// last updated on sccode.org fri 7. jun, 14:57 CET\n\n( // load this first - synth def\nSynthDef(\\harpsi, { \n arg outbus = 0, freq = 440, ffreq = 2, amp = 1, gate = 1, release = 1;\n var out;\n freq = freq * Rand(1, 1.005);\n out = EnvGen.ar(Env.adsr(releaseTime:release), gate, doneAction: Done.freeSelf)\n * amp * Pulse.ar([freq,freq*1.005]/1, 0.25, mul:0.75 );\n out = out * [Rand(0.0, 1.0), Rand(0.0, 1.0)];\n out = RLPF.ar(out, freq * (ffreq / 4) + 1 );\n Out.ar(outbus, out); \n}).add; \n);\n\n\n( // then run this - sequence\nTempoClock.default.tempo = 1.4;\n~scale = Scale.new(#[0,2,4,5,7,8,10],tuning: \\pythagorean, name: \"mixolydianb6\");\np = Pbind(\n \\instrument, \\harpsi,\n \\root, -12,\n \\scale, ~scale,\n \\ffreq, Pseq(((1..2) ++ (3..1)),inf),\n \\degree, Pseq([\n Pseries({ rrand(0, 7) }, { ([1,2]).choose }, { rrand(4, 8) }),\n Pseries({ rrand(0, 7) }, {([1,2]).choose}, { rrand(4, 8) }),\n Pseries({ rrand(7, 14) }, 0-{([1,2]).choose}, { rrand(4, 8) })\n ], inf),\n \\release, Prand([5,6,7,8],inf),\n \\dur, Prand((1..8)/4, inf),\n \\amp, Prand(((1..8)/8)+1, inf)\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `CountLimit.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Counts how many items have been presented to it. returns true until limit false thereafter Arguments: limit."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// 2012.05.04\n// Work for NX014 Class\n// Inspiration: A Rukano Tweet. Thanks rukano!\n// Comment: Cosmic Organ.\n\np = ProxySpace.push(s.boot);\n\n~a.play;\n\n~a = { var alpha,gamma;\n alpha= LFNoise2;\n gamma= {[rrand(30,50),rrand(50,70),rrand(50,70),rrand(70,100)].choose.midicps*alpha.kr(1,0.01,1)}!24;\n Pan2.ar(LeakDC.ar(Normalizer.ar(\n BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(FreeVerb.ar(\n Splay.ar(RLPF.ar(LFSaw.ar(gamma)/4,gamma*LFCub.kr(rrand(0.01,0.1),0,2,3),alpha.kr(1/8,0.6,0.7))) \n ,0.1,0.1,0.1)\n ,100,6.0,6),1000,6.0,0),5000,6.0,0),10000,6.0,6)\n ,(0.8/0.999)*1,0.1)),0)\n};\n\n~a = nil;\n```"}, {"role": "assistant", "content": "A cosmic organ with a inspiration of rukano tweet. Thanks rukano!."}]} -{"conversations": [{"role": "user", "content": "What does `MultiTrackAudioSpec.new` do? What arguments does it take?"}, {"role": "assistant", "content": "datatype specifying multiple 'audio' rate tracks Arguments: tracks; numChannels."}]} -{"conversations": [{"role": "user", "content": "What model are you?"}, {"role": "assistant", "content": "I am sc-mind: a 198M MiniMind-3-MoE, eight layers, 768 wide, four experts with top-1 routing. I was trained from scratch on the SuperCollider documentation, class library and help pages, then fine-tuned on questions and answers about them."}]} -{"conversations": [{"role": "user", "content": "What does `VSFP.pchRatio` do? What arguments does it take?"}, {"role": "assistant", "content": "Varispeed sound file player Arguments: p."}]} -{"conversations": [{"role": "user", "content": "What does `Pgbrown.new` do? What arguments does it take?"}, {"role": "assistant", "content": "geometric brownian motion pattern Arguments: lo — lower boundary of values.; hi — upper boundary of values.; step — maximum multiplication factor per step (omega) - the distribution is xrand2.; length — number of values produced.."}]} -{"conversations": [{"role": "user", "content": "What does `MultiLevelIdentityDictionary.choose` do?"}, {"role": "assistant", "content": "Choose a branch at each level, descend the tree until a leaf is chosen. By using arguments key1, key2 ... keyN, one can start at an address within the tree, descend the tree until a leaf is"}]} -{"conversations": [{"role": "user", "content": "How do I pan notes around the stereo field in a pattern?"}, {"role": "assistant", "content": "Put `\\pan` in the Pbind: the default instrument understands it and passes it to Pan2.\n\n```supercollider\n(\nPbind(\n \\scale, Scale.minorPentatonic,\n \\degree, Pseq([0, 2, 4, 7, 9, 7, 4, 2], inf),\n \\dur, 0.2,\n \\pan, Pseq([-1, -0.5, 0, 0.5, 1, 0.5, 0, -0.5], inf),\n \\amp, 0.15\n).play;\n)\n```\n\nTo pan an arbitrary synth, add a `pan = 0` argument to the SynthDef and wrap the output in\n`Pan2.ar(sig, pan)`."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ LFNoise2.ar(1000, 0.25) }.play;\n\n// modulate frequency\n\n{ LFNoise2.ar(XLine.kr(1000, 10000, 10), 0.25) }.play;\n\n// as frequency modulator\n(\n{ SinOsc.ar(\n LFNoise2.ar(4, 400, 450),\n 0, 0.2\n )\n}.play;\n)\n\n// freq is the rate of interpolation points\n{ var freq = 1000; [LFNoise2.ar(freq), Impulse.ar(freq) }.plot\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ LFNoise2.ar(1000, 0.25) }.play;\n\n// modulate frequency\n\n{ LFNoise2.ar(XLine.kr(1000, 10000, 10), 0.25) }.play;\n\n// as frequency modulator\n(\n{ SinOsc.ar(\n LFNoise2.ar(4, 400, 450),\n 0, 0.2\n )\n}.play;\n)\n\n// freq is the rate of interpolation points\n{ var freq = 1000; [LFNoise2.ar(freq), Impulse.ar(freq)] }.plot\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nVowel(\\u).ampAt(100); \n \n~range = {|i|i*2}!2000; \nVowel(\\u).ampAt(~range ).plot;\nVowel(\\u).ampAt(~range ).ampdb.plot(minval: -100, maxval: 0); \n\nVowel(\\u).ampAt(~range, 0.5 ).plot;\nVowel(\\u).ampAt(~range, 0.5 ).ampdb.plot(minval: -100, maxval: 0);\n\nVowel(\\u).ampAt(~range, 3 ).plot;\nVowel(\\u).ampAt(~range, 3 ).ampdb.plot(minval: -100, maxval: 0);\n\nVowel(\\u).ampAt(~range, [3,1,0.5,2\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nVowel(\\u).ampAt(100); \n \n~range = {|i|i*2}!2000; \nVowel(\\u).ampAt(~range ).plot;\nVowel(\\u).ampAt(~range ).ampdb.plot(minval: -100, maxval: 0); \n\nVowel(\\u).ampAt(~range, 0.5 ).plot;\nVowel(\\u).ampAt(~range, 0.5 ).ampdb.plot(minval: -100, maxval: 0);\n\nVowel(\\u).ampAt(~range, 3 ).plot;\nVowel(\\u).ampAt(~range, 3 ).ampdb.plot(minval: -100, maxval: 0);\n\nVowel(\\u).ampAt(~range, [3,1,0.5,2] ).plot\nVowel(\\u).ampAt(~range, [3,1,0.5,2] ).ampdb.plot(minval: -100, maxval: 0)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `ScoreClock.beginScore` do?"}, {"role": "assistant", "content": "Start capturing. This must be called once before the code that you want to"}]} -{"conversations": [{"role": "user", "content": "What does `Node.group` do?"}, {"role": "assistant", "content": "Abstract superclass of Synth and Group Returns: an instance of Group or RootNode corresponding to this Node's group on the server."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n/* Audio plugin definition\n\n Each audio plugin should define the following global variables:\n ~name: (symbol) name of the spatializer\n ~description: (string) a short description\n ~function: the actual definition of the plugin\n\n*/\n\n~name = \\emptySource;\n~description = \"dummy/template\";\n~channelLayout = \\mono;\n\n~function = {\n DC.ar(0);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "What does `AbstractPlayerGui.topGui` do? What arguments does it take?"}, {"role": "assistant", "content": "does synthConsole saveConsole does writeName does guiBody then shrinks the window to Arguments: parent; bounds; ... args."}]} -{"conversations": [{"role": "user", "content": "What does `SynthiX.refresh` do?"}, {"role": "assistant", "content": "refresh the view. Also updates any values (the little yellow Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "What's the difference between Env.perc and Env.adsr?"}, {"role": "assistant", "content": "`Env.perc(attack, release)` goes up once and decays to zero — one-shot sounds. `Env.adsr(a, d, s, r)` holds at a sustain level while its gate is open and only releases when the gate closes — notes you start and stop."}, {"role": "user", "content": "So which do I use for a pad?"}, {"role": "assistant", "content": "adsr, with `gate` as a Synth argument and `doneAction: 2` on the EnvGen:\n\n```supercollider\nSynthDef(\\pad, { |out = 0, freq = 220, gate = 1|\n var env = EnvGen.kr(Env.adsr(0.8, 0.4, 0.7, 2), gate, doneAction: 2);\n Out.ar(out, Saw.ar(freq) * env * 0.1)\n}).add;\n```\n\nThen `x.set(\\gate, 0)` releases it over the 2 seconds of release time."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// play to buses silently\n\n(\na = Bus.audio(s, 5);\n\nx = {\n Out.ar(a.index, [\n BrownNoise.ar(0.1),\n PinkNoise.ar(0.2),\n WhiteNoise.ar(0.05),\n ClipNoise.ar(0.03),\n GrayNoise.ar(0.05)\n ])\n}.play\n);\n\n// mix from buses, mind node order\n\n(\ny = {\n DXMixIn.ar(\n Dxrand((0..4), inf) + a.index,\n fadeTime: 0.5,\n )\n}.play(addAction: \\addToTail)\n);\n\ny.release\n\n\n// cleanup\n\n(\nx.free;\na.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// play to buses silently\n\n(\na = Bus.audio(s, 5);\n\nx = {\n Out.ar(a.index, [\n BrownNoise.ar(0.1),\n PinkNoise.ar(0.2),\n WhiteNoise.ar(0.05),\n ClipNoise.ar(0.03),\n GrayNoise.ar(0.05)\n ])\n}.play\n);\n\n// mix from buses, mind node order\n\n(\ny = {\n DXMixIn.ar(\n Dxrand((0..4), inf) + a.index,\n fadeTime: 0.5,\n )\n}.play(addAction: \\addToTail)\n);\n\ny.release\n\n\n// cleanup\n\n(\nx.free;\na.free;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//simple particlesystem.\n//with mouse controlling world gravity and system position\n\n(\nvar width= 300, height= 300, w, world,\nsys;\n\n//--world\nw= RedWindow(\"particlesystem test\", Rect(128, 64, width, height)).front;\nworld= RedWorld3(RedVector2D[width, height], 0, 20, -0.25); //dim,grav,maxvel,damp\n\n//--system\nsys= RedParticleSystem.new;\n\n//--loop\nw.draw{\n world.gravity= RedVector2D.newFrom(w.mouse/([width, height])-0.5);\n\n //--add new particles and update old\n sys.add(RedParticle(world, w.mouse+5.rand2, 0, RedVector2D[2.rand2, 10.rand], 1.5, 5.rand).age_(40.rrand(50)));\n sys.addForce(world.gravity);\n sys.update;\n\n //--render\n sys.do{|o| //iterate all particles in the system\n Pen.fillColor= Color.grey((o.age/50), 1);\n Pen.fillOval(Rect.aboutRedObject2D(o));\n };\n};\nw.play;\nCmdPeriod.doOnce({w.close});\n)\n```"}, {"role": "assistant", "content": "simple particlesystem. with mouse controlling world gravity and system position."}]} -{"conversations": [{"role": "user", "content": "Interfacing SC with external software: MIDI or OSC?"}, {"role": "assistant", "content": "SuperCollider forum — Interfacing SC with external software: MIDI or OSC?\n\nI found this partial solution on sccode.org :\n\n```supercollider\n // declare an event type which sends OSC commands to Renoise\n\n(\nEvent.addEventType(\\renoise, { |server|\n var renoiseOscServer = NetAddr(\"127.0.0.1\", 8000);\n var notes = [~midinote.value, ~ctranspose.value, ~velocity.value, ~sustain.value, ~lag.value, ~timingOffset.value, ~instr.value, ~track.value].flop;\n var timeNoteOn, timeNoteOff, instrument, track, velocity;\n var serverLatency;\n\n serverLatency = server.latency ? 0;\n\n notes.do {|note|\n instrument = note[6] ? -1;\n track = note[7] ? -1;\n velocity = note[2].asInt.clip(0,127);\n\n // sustain and timingOffset are in beats, lag is in seconds\n timeNoteOn = (thisThread.clock.tempo.reciprocal*note[5])+note[4]+server.latency;\n timeNoteOff = (thisThread.clock.tempo.reciprocal*(note[3]+note[5]))+note[4]+server.latency;\n SystemClock.sched(timeNoteOn, {renoiseOscServer.sendMsg(\"/renoise/trigger/note_on\", instrument.asInt, track.asInt, (note[0]+note[1]).asInt, velocity )});\n SystemClock.sched(timeNoteOff, {renoiseOscServer.sendMsg(\"/renoise/trigger/note_off\", instrument.asInt, track.asInt, (note[0]+note[1]).asInt)});\n }\n});\n);\n\n// Now start Renoise OSC server, load a sample, and try some patterns\n\n// straight timing\n(\nPbind(*[\n type: \\renoise,\n legato: Pgauss(0.2,0.05,inf),\n dur: 0.2,\n degree: [2,5,12],\n track: Prand([0,1], inf),\n ctranspose: Pseq([0,0,0,0,4,4,4,4,5,5,5,5],inf),\n velocity: Pgauss(64,10,inf),\n]).play;\n)\n```\n\nhttp://sccode.org/1-4SN\n\nBut what I couldn’t find there was a simple syntax for sending Note Events or Midi Events as OSC messages... Do I really need to re-implement the whole SC’s defaultParentEvent as new OSC Event to send it using regular pattern’s syntax?"}]} -{"conversations": [{"role": "user", "content": "What is `GrainFM` in SuperCollider?"}, {"role": "assistant", "content": "GrainFM — Granular synthesis with frequency modulated sine tones Category: UGens > Generators > Granular."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Schemawound track from the SIGNALVOID compilation."}, {"role": "assistant", "content": "```supercollider\n/*\nSchemawound track from the SIGNALVOID compilation.\nSIGNALVOID is a noise compilation. Participants were asked to create up to three tracks, each of exactly one minute in length, with no gaps of silence at the beginning or end. Download the free compilation here: http://archive.org/details/SignalvoidMp3 or http://archive.org/details/SignalvoidFlac\nPhysical copies are available here http://signalvoid.bandcamp.com/merch/signalvoid-2\n\nBlog post about the creation of this track http://schemawound.tumblr.com/post/29065985817/signalvoid-1-burn-it-to-disc-then-burn-the-disc\n*/\n\n(\n {\n var saw1 = Saw.ar((10..100));\n var saw2 = Mix(Saw.ar(saw1).range(100, 600));\n var sin0 = SinOsc.ar(0.002).range(5,75);\n var sin1 = SinOsc.ar(0.1).range(1,sin0);\n var sin2 = SinOsc.ar(0.15).range(2,10);\n var sinMod = (sin1 * sin2)!2;\n var sin66 = SinOsc.ar(0.0164).range(600,1000);\n var saw3 = Saw.ar(sinMod).range(200, sin66);\n var saw4 = Saw.ar(saw3);\n var sin3 = Mix(SinOsc.ar((1..100)));\n var sum1 = (saw2 * saw4) * sin3;\n var comb1 = CombL.ar(sum1, 1, 0.2, 1) + sum1;\n var sin4 = SinOsc.ar(0.12).range(3, 1000);\n var comb2 = comb1.tanh;\n var sin5 = SinOsc.ar(sin4);\n var sin6 = SinOsc.ar(0.001);\n var comb3 = comb2 * sin5 * sin6;\n var sum2 = (comb2 + comb3) * 0.3;\n var verb1 = sum2;\n var line1 = Line.ar(1, 0.001, 60, doneAction: 2);\n var line2 = Line.ar(0, 1, 60);\n var comb4 = CombL.ar(verb1, 1, line1, 0.1) * line2;\n var sum3 = comb4 + verb1;\n sum3 * 0.5;\n }.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `DigitalIn` in SuperCollider?"}, {"role": "assistant", "content": "DigitalIn — Read data from a digital input Reads digital data from a digital sensor input (e.g.: a button or trigger input). Category: UGens > Bela."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nPbindef(\\x, note: Pseq([0, 7, 9]), dur: 0.2.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nPbindef(\\x, note: Pseq([0, 7, 9]), dur: 0.2).play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a closed hi-hat in SuperCollider."}, {"role": "assistant", "content": "High-passed noise with a very short envelope — the filter is what makes it a hat rather than a hiss.\n\n```supercollider\n(\nSynthDef(\\hat, { |out = 0, amp = 0.3, dur = 0.06|\n var env = EnvGen.kr(Env.perc(0.001, dur, 1, -6), doneAction: 2);\n Out.ar(out, Pan2.ar(HPF.ar(WhiteNoise.ar, 7000) * env * amp));\n}).add;\n);\nSynth(\\hat, [\\dur, 0.04]);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DiskOut`."}, {"role": "assistant", "content": "```supercollider\ns.boot; // start the server\n(\n// something to record\nSynthDef(\"bubbles\", { |out|\n var f, zout;\n f = LFSaw.kr(0.4, 0, 24, LFSaw.kr([8, 7.23], 0, 3, 80)).midicps; // glissando function\n zout = CombN.ar(SinOsc.ar(f, 0, 0.04), 0.2, 0.2, 4); // echoing sine wave\n Out.ar(out, zout)\n}).add;\n\n// this will record to the disk\nSynthDef(\"help-Diskout\", { |bufnum|\n DiskOut.ar(bufnum, In.ar(0, 2));\n}).add;\n\n// this will play it back\nSynthDef(\"help-Diskin-2chan\", { |out, bufnum = 0|\n Out.ar(out, DiskIn.ar(2, bufnum))\n}).add;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// setsrc\n(\nNdef(\\x,\n \\setsrc -> Pbind(\\source,\n Pseq([\n { LFTri.ar(280 * Line.kr(1.1, 0.4, rrand(2, 3)) + [0, 1]) * 0.1 },\n { Pulse.ar(40 + [0, 1]) * 0.1 },\n { LFTri.ar(LFTri.kr(1).round(1.0.rand) + 1 * 180 + [0, 1], 0.04) * 0.3 },\n ], inf),\n \\dur, Prand([3, 2, 4], inf)\n )\n).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// setsrc\n(\nNdef(\\x,\n \\setsrc -> Pbind(\\source,\n Pseq([\n { LFTri.ar(280 * Line.kr(1.1, 0.4, rrand(2, 3)) + [0, 1]) * 0.1 },\n { Pulse.ar(40 + [0, 1]) * 0.1 },\n { LFTri.ar(LFTri.kr(1).round(1.0.rand) + 1 * 180 + [0, 1], 0.04) * 0.3 },\n ], inf),\n \\dur, Prand([3, 2, 4], inf)\n )\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Process.nowExecutingPath` do?"}, {"role": "assistant", "content": "Usage: `thisProcess.nowExecutingPath` Returns the full path to the file containing the code that is currently executing interactively in the interpreter. Usually this is the current document. If the code block executes another file on disk, using String#-load or String#-loadPaths, `nowExecutingPath` will be the location of the executed"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `TIRand`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-TIRand\", {\n var trig, outBus;\n trig = Dust.kr(10);\n outBus = TIRand.kr(0, 1, trig); // play on random channel between 0 and 1\n Out.ar(outBus, PinkNoise.ar(0.2))\n\n}).play;\n);\n\n(\n{\n var trig = Dust.kr(10);\n SinOsc.ar(\n TIRand.kr(4, 12, trig) * 100\n ) * 0.1\n}.play;\n);\n\n(\n{\n var trig = Dust.ar(MouseX.kr(1, 8000, 1));\n SinOsc.ar(\n TIRand.ar(4, 12, trig) * 100\n ) * 0.1\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `FoaDirectO` in SuperCollider briefly."}, {"role": "assistant", "content": "FoaDirectO — First Order Ambisonic (FOA) directivity transformer Adjust the soundfield directivity of a First Order Ambisonic signal (B-format) across the origin. Category: Libraries > Ambisonic Toolkit > UGens > FOA > Transformer, UGens > Multichannel > Ambisonics."}]} +{"conversations": [{"role": "user", "content": "What does `PatternProxy.source` do?"}, {"role": "assistant", "content": "set the source. If a quantization is given, schedule this change to the next"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\ns.boot;\n// create a Synth at the head of the default Server's default group\n// based on the SynthDef \"default\"\nx = Synth.new(\"default\");\ns.queryAllNodes; // note the default group (ID 1)\nx.free;\n\n// Using an arrayed control\n// run this block first to make the SynthDef\n(\nSynthDef(\"help-synth\", { |freq = #[440, 450, 460], out = 0|\n Out.ar(out, Mix(SinOsc.ar(freq, 0, 0.1)));\n}).add;\n);\n\n// then this a short while later\nx = Synth(\"help-synth\", [freq: [500, 501, 510]]);\n\nx = Synth(\"help-synth\",\n// …\n```"}, {"role": "assistant", "content": "create a Synth at the head of the default Server's default group based on the SynthDef \"default\" (Synth: Client-side representation of a synth node on the server)"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Warp1`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\nb.free;\nb = Buffer.read(s, ExampleFiles.apollo11);\n{\n var pointer = Phasor.ar(0, SampleDur.ir / BufDur.ir(b) * XLine.kr(1, 0.25, 20));\n var sound = Warp1.ar(1, b, pointer, 1, 0.3, -1, 16, Line.kr(0, 1, 40), 4);\n Pan2.ar(sound, pointer * 2 - 1, 0.25)\n}.play\n);\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\"help-PinkNoise\", { |out = 0|\n Out.ar(out,\n PinkNoise.ar(0.4)\n )\n}).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\"help-PinkNoise\", { |out = 0|\n Out.ar(out,\n PinkNoise.ar(0.4)\n )\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ PinkNoise.ar(1) * Line.kr(1, 0, 2, doneAction: Done.freeSelf }.play.onFree { \"done\".postln };\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ PinkNoise.ar(1) * Line.kr(1, 0, 2, doneAction: Done.freeSelf) }.play.onFree { \"done\".postln };\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Dictionary.keys` do?"}, {"role": "assistant", "content": "Return a Set of all keys. `d = Dictionary.newFrom([\\hello, 9, \\whello,"}]} +{"conversations": [{"role": "user", "content": "What does `ProxySpace.document` do? What arguments does it take?"}, {"role": "assistant", "content": "creates a new document with the current proxyspace state. This does not allow open functions as proxy sources. see: Arguments: keys — list of keys to document a subset of proxies; onlyAudibleOutput — a boolean.; includeSettings — a boolean.."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LinPan2`."}, {"role": "assistant", "content": "```supercollider\n// hear the difference, LinPan having a slight drop in the middle (yeah, it's subtle)...\n{ LinPan2.ar(SinOsc.ar(440), Line.kr(-1, 1, 5)) }.play;\n\n// ... whereas Pan2 is more smooth\n{ Pan2.ar(SinOsc.ar(440), Line.kr(-1, 1, 5)) }.play;\n\n// other examples\n{ LinPan2.ar(PinkNoise.ar(0.4), FSinOsc.kr(2)) }.play;\n\n{ LinPan2.ar(FSinOsc.ar(800, 0, 0.1), FSinOsc.kr(3)) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Detune idea is from James Harkins. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\na = {\n |freq = 40, wid = 0.5|\n Mix(LFPulse.ar(freq *((Array.fill(40, Pxrand((1, 2..20), inf).iter)/1000)+1),\n 0, wid, 0.05)\n ).dup\n}.play;\n);\n\n//more distorsion\n~widlfo = {Saw.kr(0.5).range(0,1)};\na.set(\\wid, ~widlfo);\n\n//stop\na.release;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `RedLZW` in SuperCollider?"}, {"role": "assistant", "content": "RedLZW — lzw compression/decompression See http://en.wikipedia.org/wiki/LZW and http://marknelson.us/1989/10/01/lzw-data-compression/ Category: Red > redTools."}]} +{"conversations": [{"role": "user", "content": "Explain `FoaMirror` in SuperCollider briefly."}, {"role": "assistant", "content": "FoaMirror — First Order Ambisonic (FOA) mirror transformer Mirror a First Order Ambisonic signal (B-format) across an arbitrary plane. Category: Libraries > Ambisonic Toolkit > UGens > FOA > Transformer, UGens > Multichannel > Ambisonics."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\Mirror;\n~description = \"Mirror soundfield\";\n\n~function = {|in = 0, order = 1, mirrorFrontBack = 0, mirrorLeftRight = 0, mirrorUpDown = 0 |\nHOATransMirror.ar(order, in, mirrorFrontBack, mirrorLeftRight, mirrorUpDown);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(//*********PREPARE**********\np.pop;\n//Any code that needs to access your own environment goes here\np = ProxySpace.push(s);\n~fxLoop.play.fadeTime_(5);\n);\n\n(//*********FXLoop**********\n~fxLoop = {\n var in = SoundIn.ar([0,1]);\n in;\n}\n)\n```"}, {"role": "assistant", "content": "Code for using Supercollider as a realtime livecode FX processor for audio input. Blog post explaing this code: http://schemawound.com/post/53528545022/fxloop."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `BufRd`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_playbuf, { |out = 0, bufnum = 0, rate = 1, startPos = 0, amp = 0.1, sustain = 1, pan = 0, loop = 1|\n var audio;\n rate = rate * BufRateScale.ir(bufnum);\n startPos = startPos * BufFrames.ir(bufnum);\n\n audio = BufRd.ar(1, bufnum, Phasor.ar(0, rate, startPos, BufFrames.ir(bufnum)), 1, 1);\n audio = EnvGen.ar(Env.sine, 1, timeScale: sustain, doneAction: Done.freeSelf) * audio;\n audio = Pan2.ar(audio, pan, amp);\n OffsetOut.ar(out, audio);\n}).add; // use .store for rendering example below\n\na = Pproto({\n ~newgroup = (type: \\group).yield;\n ~sf1 = (type: \\allocRead, path: ExampleFiles.apollo11).yield;\n},\n Pbind(*[\n instrument: \\help_playbuf,\n dur: Pseg([0, 0, 0.25, 0.5, 0.75, 1], 10).linexp(0, 1, 0.01, 2),\n legato: 4,\n startPos: Pn(Pseg([0, 1], 20), inf),\n rate: Pwhite(1, 1).midiratio,\n loop: 0,\n group: Pkey(\\newgroup),\n bufnum: Pkey(\\sf1)\n ])\n);\na.play;\n)\n\n// a.render(\"sounds/test.aif\", 40)\n// SoundFile.openRead(\"sounds/test.aif\").play\n```"}]} +{"conversations": [{"role": "user", "content": "Speech to midi converter?"}, {"role": "assistant", "content": "SuperCollider forum — Speech to midi converter?\n\nHello!\n\nI want to make a speech to midi converter in Supercollider.\n\nI’ve started off trying to find a way to convert FFT data to midi-numbers to send to a midi-instrument, but I’m stuck:\n\n```supercollider\n~file = Buffer.read(s, \"path_to_file\", bufnum:1);\n\n(\n{\n var buf = Buffer.alloc(s, 2048, bufnum:2);\n var sig = PlayBuf.ar(2, 1, loop:1);\n var chain = FFT(buf, sig);\n var trig = Impulse.kr(30);\n chain[0].pvcalc(80, {\n |phas, mag|\n SendReply.kr(trig, \"/anal\", mag);\n });\n}.play\n);\n\n(\nOSCdef.new(\\midiConverter, {\n |msg|\n msg.postln;\n}, \"/anal\");\n)\n```\n\nthe output looks like this:\n\n[ /anal, 1000, -1, 0.0, 3.0463190078735, 2.1142015457153, -0.64955651760101, 2.3432319164276, -0.23956227302551, -3.1334409713745, -2.1829152107239, 1.1417833566666, -2.2972648143768, -0.74415707588196, -0.88793164491653, 1.9947071075439, -1.1327115297318, 2.6084003448486, etc...]\n\nI’m not sure how to interpret theese numbers. And I’m not sure pvcalc is even the best way to get the data I need. I want to somehow be able to control the resolution on how many of the loudest bins I’m going to convert to frequency and then from frequency to midi-number to send to a midi-instrument as the soundfile plays through.\n\nAny ideas?"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ TwoPole.ar(WhiteNoise.ar(0.005), 2000, 0.95) }.play\n\n{ TwoPole.ar(WhiteNoise.ar(0.005), XLine.kr(800, 8000, 8), 0.95) }.play\n\n{ TwoPole.ar(WhiteNoise.ar(0.005), MouseX.kr(800, 8000, 1), 0.95 }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ TwoPole.ar(WhiteNoise.ar(0.005), 2000, 0.95) }.play\n\n{ TwoPole.ar(WhiteNoise.ar(0.005), XLine.kr(800, 8000, 8), 0.95) }.play\n\n{ TwoPole.ar(WhiteNoise.ar(0.005), MouseX.kr(800, 8000, 1), 0.95) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// try wiggling the mouse quickly;\n// LFNoise frequently seems stuck, LFDNoise changes smoothly.\n\n{ LFClipNoise.ar(MouseX.kr(0.1, 1000, 1), 0.1) }.play\n\n{ LFDClipNoise.ar(MouseX.kr(0.1, 1000, 1), 0.1) }.play\n\n// silent for 2 secs before going up in freq\n\n{ LFClipNoise.ar(XLine.kr(0.5, 10000, 3), 0.1) }.scope;\n\n{ LFDClipNoise.ar(XLine.kr(0.5, 10000, 3), 0.1) }.scope;\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFClipNoise.ar\n// …\n```"}, {"role": "assistant", "content": "try wiggling the mouse quickly; LFNoise frequently seems stuck, LFDNoise changes smoothly. (LFDClipNoise: Dynamic clipped noise)"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Convolution2L`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// one last example\n(\nb = Buffer.alloc(s, 512, 1);\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, true, true);\n);\n\n(\n{\n var input = SoundIn.ar(0);\n var framesize = 512;\n Convolution2L.ar(input, b, 0, framesize, 1, 0.5);\n}.play\n);\n\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "I get \"Message 'ar' not understood\". Why?"}, {"role": "assistant", "content": "You called a rate method on something that is not a UGen. `Env.ar(...)` and `Buffer.ar(...)` are the classic cases: Env is a language-side description and is played by `EnvGen.ar(env, ...)`; a Buffer is server memory and is played by `PlayBuf.ar` or `BufRd.ar`. The UGen is the thing with a rate method — if it is a description or a container, there is another UGen that consumes it."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for some initial thoughts on psytrance bassline. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\n{ | dur = 0.15, atk = 0.005, amp = 1 |\n SinOsc.ar(\n EnvGen.ar( Env(\n NamedControl.kr(\\freq_l, [2960, 70, 90]),\n NamedControl.kr(\\freq_d, [0.07, 0.2]),\n NamedControl.kr(\\freq_c, [-13, -1]),\n ) ),\n mul:amp * EnvGen.ar(\n Env.perc( atk, dur - atk, curve: NamedControl.kr(\\amp_c, [-1, 6])),\n doneAction: 2\n ); \n ) ! 2;\n}.asSynthDef.name_(\"kick\").add;\n\n{ | atk = 0.01, dur = 0.15, freq = 50, amp=0.8 |\n BPF.ar(LFSaw.ar(freq), freq, 2, mul: EnvGen.kr( Env.perc( atk, dur-atk, amp, 6 ), doneAction: 2 )) ! 2;\n}.asSynthDef.name_(\"bass\").add;\n\n{ | dur = 0.15, freq = 50, amp = 0.8, index = 10 |\n PMOsc.ar(freq, freq + 5, index, mul: amp * EnvGen.kr( Env.triangle( dur ), doneAction: 2 )) ! 2;\n}.asSynthDef.name_(\"bazz\").add;\n);\n\n\n(\nPpar([\n Pbind(*[\n instrument: \\kick,\n delta: 1,\n dur: Pfunc({ thisThread.clock.beatDur }) / 4,\n amp: Pseq([\n Pseq([1], 16),\n Pseq([0.8, 1], 8), \n Pseq([1], 16),\n Pseq([0.8, 0.8, 0.9, 1], 8)\n ], inf) * 0.8,\n freq_l: Pstutter(Prand(2.pow((1..4)),inf), Pseq([\n `[2960,70,90],\n `[1260,60,110],\n `[4360,60,120]\n ],inf))\n ]),\n Pbind(*[\n instrument: \\bass,\n delta: 1/4,\n dur: Pkey(\\delta) * Pfunc({ thisThread.clock.beatDur }),\n freq: Pseq([\\r, 50,60,70], inf),\n amp:0.6\n ]),\n Pbind(*[\n instrument: \\bazz,\n delta: 1/4,\n dur: Pkey(\\delta) * Pfunc({ thisThread.clock.beatDur }),\n freq: Pseq([\\r, 30,35,40], inf),\n amp:0.2\n ])\n]).play(TempoClock(156/60), quant:[1])\n);\n\n// kick from above?\n(\nPbind(*[\n instrument: \\kick,\n delta: Pseq(Array.geom(540, 1, 1.015).reciprocal.reverse),\n dur: Pkey(\\delta) * Pfunc({ thisThread.clock.beatDur }),\n atk: Pkey(\\dur) / 6,\n amp: 0.8\n]).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `EaseOutAtan` in SuperCollider briefly."}, {"role": "assistant", "content": "EaseOutAtan — Atan ease-out Easing equation for an atan ease-out, decelerating from zero velocity. The a parameter is curvature. Category: Ease."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Trig.ar(Dust.ar(1), 0.2) * FSinOsc.ar(800, 0.5) }.play\n\n{ Trig.ar(Dust.ar(4), 0.1 }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Trig.ar(Dust.ar(1), 0.2) * FSinOsc.ar(800, 0.5) }.play\n\n{ Trig.ar(Dust.ar(4), 0.1) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "What does `RedTime.addSec` do? What arguments does it take?"}, {"role": "assistant", "content": "calculate with time Arguments: sec — A SimpleNumber.."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Paddp` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\freq, Pseq([500, 600, 700]), \\instrument, \\sinegrain);\na = Paddp(\\freq, Pseq([30, 90, -100], inf), a);\na.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `CondVar.signalAll` do?"}, {"role": "assistant", "content": "Wakes all threads waiting on this Condition. Threads are woken in the order in which they called `wait` or `waitFor`. If threads were waiting with predicates and their predicates are still `false` after being woken, they will block again in the same order as before this method was Returns: this object"}]} +{"conversations": [{"role": "user", "content": "Explain `BufSamples` in SuperCollider briefly."}, {"role": "assistant", "content": "BufSamples — Current number of samples in buffer. Returns the current number of allocated samples. A sample is not the same as a frame (compare with BufFrames); a frame includes the samples in each channel of the buffer. Only for a mono buffer are samples the same as frames. `samples = frames * numChannels` Category: UGens > Buffer > Info."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// examples:\n\n(\n{\n var mod = SinOsc.kr(Line.kr(1, 10, 10));\n SinOsc.ar(LinLin.kr(mod, -1, 1, 100, 900)) * 0.1\n}.play;\n);\n\n// modulating destination values.\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(LinLin.ar(mod, -1, 1, MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1))) * 0.1\n}.play;\n);\n\n// modulating source and destination values.\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(\n LinLin.ar(mod,\n SinOsc.kr(0.2), SinOsc.kr\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// examples:\n\n(\n{\n var mod = SinOsc.kr(Line.kr(1, 10, 10));\n SinOsc.ar(LinLin.kr(mod, -1, 1, 100, 900)) * 0.1\n}.play;\n);\n\n// modulating destination values.\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(LinLin.ar(mod, -1, 1, MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1))) * 0.1\n}.play;\n);\n\n// modulating source and destination values.\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(\n LinLin.ar(mod,\n SinOsc.kr(0.2), SinOsc.kr(0.2543),\n MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1)\n )\n ) * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `PbindProxy`?"}, {"role": "assistant", "content": "PbindProxy — incremental event pattern reference"}, {"role": "user", "content": "What does `PbindProxy.new` do?"}, {"role": "assistant", "content": "Return a new instance of PbindProxy with the given patternpairs. Unlike Pbindef, it has no internal name. `a = PbindProxy(\\note, Pseq([0, 7, 9], inf), \\dur, 0.2).play;` It also supports keyword argument syntax: `a = PbindProxy(note: Pseq([0, 7, 9]), dur: 0.2).play;`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na = PbindProxy(\\note, Pseq([0, 7, 9], inf), \\dur, 0.2).play;\na.set(\\note, Pseq([0, 6, 10]));\na.stop;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `RandID` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// start a noise patch and set the id of the generator\n(\nSynthDef(\"help-RandID\", { |out = 0, id = 1|\n RandID.ir(id);\n Out.ar(out,\n WhiteNoise.ar(0.05) + Dust2.ar(70)\n )\n}).add;\n);\n\n// reset the seed of my rgen at a variable rate\n(\nSynthDef(\"help-RandSeed\", { |seed = 1910, id = 1|\n RandID.kr(id);\n RandSeed.kr(Impulse.kr(FSinOsc.kr(0.2, 0, 10, 11)), seed);\n}).add;\n\n);\n\n// start two noise synths on left and right channel with a different randgen id\na = Synth(\"help-RandID\", [\\out, 0, \\id, 1]);\nb = Synth(\"help-RandID\", [\\out, 1, \\id, 2]);\n\n// reset the seed of randgen 1\nx = Synth(\"help-RandSeed\", [\\id, 1]);\n\n// change the target randgen to 2 (affects right channel)\nx.set(\\id, 2);\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n// restricting fm to harmonic sidebands after\n// [Chowning, 1973] Chowning, J. (1973). The synthesis of complex spectra by means of frequency modulation. Journal of the Audio Engineering Society, 21(7):526–534.\n// restriction actually happens because of the specs, not server-side.\n\nSpec.add(\\index, [0, 40]);\nSpec.add(\\harm1, [0, 20, \\lin, 1]);\nSpec.add(\\harm2, [0, 20, \\lin, 1]);\nSpec.add(\\fundFreq, \\freq);\n\nNdef(\\fmk, {\n \n PMOsc.ar(\n \\carFreq.kr(100, 0.1), \n (\\harm1.kr(1, 1)/(\\harm2.kr(1, 1)) * LFNoise1.ar(50).range(0.995, 1.001))*\\carFreq.kr(100), \n \\index.kr(1, 0.1) * SinOsc.ar(2.5).range(0.995, 1.005)\n ) \n})\n);\nNdef(\\fmk).gui\n```"}, {"role": "assistant", "content": "Restricting fm to harmonic sidebands after[Chowning, 1973]. Restriction actually happens because of the specs, not server-side.\r\n----- \r\nChowning, J. (1973). The synthesis of complex spectra by means of frequency modulation. Journal of the Audio Engineering Society, 21(7):526–534."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a;\na = Pgeom(1.0, 1.1, inf);\na.asStream.nextN(100).plot;\n);\n\n\n// sound example\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05, amp = 0.1|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2, amp), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n(\nvar a;\na = Pgeom(300, 1.03, 70).asStream;\n{\n a.do { |val|\n Synth(\\help_sinegrain, [\\freq,\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a;\na = Pgeom(1.0, 1.1, inf);\na.asStream.nextN(100).plot;\n);\n\n\n// sound example\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05, amp = 0.1|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2, amp), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n(\nvar a;\na = Pgeom(300, 1.03, 70).asStream;\n{\n a.do { |val|\n Synth(\\help_sinegrain, [\\freq, val]);\n 0.02.wait;\n }\n}.fork;\n);\n\n(\nPbind(\n \\dur, 0.01,\n \\instrument, \\help_sinegrain,\n \\freq, Pgeom(800, Pbrown(0.99, 1.01, 0.01, inf), inf)\n).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Pulse`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\\harpsi, { |outbus = 0, freq = 440, amp = 0.1, gate = 1|\n var out;\n out = EnvGen.ar(Env.adsr, gate, doneAction: Done.freeSelf) * amp *\n Pulse.ar(freq, 0.25, 0.75);\n Out.ar(outbus, out ! 2);\n}).add; // see below for more on .add\n\np = Pbind(\n // Use \\harpsi, not \\default\n \\instrument, \\harpsi,\n \\degree, Pseries(0, 1, 8),\n \\dur, 0.25\n).play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// hear the difference, LinPan having a slight drop in the middle (yeah, it's subtle)...\n{ LinPan2.ar(SinOsc.ar(440), Line.kr(-1, 1, 5)) }.play;\n\n// ... whereas Pan2 is more smooth\n{ Pan2.ar(SinOsc.ar(440), Line.kr(-1, 1, 5)) }.play;\n\n// other examples\n{ LinPan2.ar(PinkNoise.ar(0.4), FSinOsc.kr(2)) }.play;\n\n{ LinPan2.ar(FSinOsc.ar(800, 0, 0.1), FSinOsc.kr(3)) }.play;\n```"}, {"role": "assistant", "content": "hear the difference, LinPan having a slight drop in the middle (yeah, it's subtle)... ... whereas Pan2 is more smooth (LinPan2: Two channel linear pan.)"}]} +{"conversations": [{"role": "user", "content": "Resizing FreqScope?"}, {"role": "assistant", "content": "SuperCollider forum — Resizing FreqScope?\n\nOddly, this seems to work:\n\n```supercollider\n// max partial = 20 kHz\n// do not play this loudly\na = { Blip.ar(100, 200, 0.02).dup }.play;\n\nv = FreqScope(800, 600); // top partial is shown below 1.75 kHz (?)\n\nv.scope.scope.xZoom = 1; // seems correct, by eyeballing\n\n// let's try another resolution\nv = FreqScope(600, 500);\nv.scope.scope.xZoom = 1; // hm, zoom = 1 seems OK here too\n```\n\nFreqScope includes the line scope.xZoom_((scope.bufSize*0.25) / width); so it may be that this calculation is incorrect. I’m unclear, for instance, why it’s dividing by width – apparently zooming out for larger windows...?\n\nBut I tried three different widths (800x600, 600x500, 200x150), and for all of them, xZoom = 1 appeared to be correct. It’s possible that this calculation is vestigial, then – maybe we needed it for the older version of frequency scope, but the Qt version might not need it at all.\n\nhjh"}]} +{"conversations": [{"role": "user", "content": "What does `BlitB3Square.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Bipolar BLIT derived square waveform Arguments: freq — You start to hear aliasing over 4000 Hz or so, otherwise perceptually indistinguishable from an analogue waveform. Max frequency is half the sampling rate, but you'll hear aliasing well before that. Note that frequency can only be changed at the close of each period, so for very low frequencies, the; leak — leaky coefficient for integration. 0 would give back the impulses, higher numbers (up to near 1.0) fill out the inter-impulse space, integrating the waveform.."}]} +{"conversations": [{"role": "user", "content": "How do I structure a live-coding performance in one file?"}, {"role": "assistant", "content": "One Tdef per musical layer, each with its own loop, so you can start and stop layers while the set\nruns.\n\n```supercollider\n(\nTdef(\\kick, {\n loop {\n Synth(\\kick);\n 0.5.wait;\n }\n}).play;\n\nTdef(\\hats, {\n loop {\n Synth(\\hat, [\\amp, 0.15]);\n (1/8).wait;\n }\n}).play;\n)\n```\n`Tdef(\\kick).stop` stops one layer, `Tdef(\\kick).reset` restarts it at the next cycle, and\n`CmdPeriod.run` stops everything."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `JITGui`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// typically, only subclasses of JITGui are used,\n // so here are just some basic usage and layout tests\n\n // make its own window - defPos, minSize is used\ng = JITGui(Ndef(\\a));\n\n // make its own window, specific size\ng = JITGui(Ndef(\\a), bounds: 390@20);\n\n // provide full bounds\ng = JITGui(Ndef(\\a), bounds: Rect(200, 500, 390, 24));\n\n // extent is 0@0: minSize x, y is used\ng = JITGui(Ndef(\\a), bounds: Rect(200, 500, 0, 0));\ng = JITGui(Ndef(\\a), bounds: Rect(200, 500, 0, 50));\ng = JITGui(Ndef(\\a), bounds: Rect(200, 500, 500, 0));\n\n\n( // put a JITGui in an existing window:\nw = Window().front;\ng = JITGui(Ndef(\\a), 0, w, bounds: 300@48);\n);\n\n( // 5 lines high\nw = Window().front;\ng = JITGui(Ndef(\\a), 5, w);\n);\n\n( // recommended: use a FlowLayout.\nw = Window().front;\nw.addFlowLayout;\nEZSlider(w, 300@100, \\test, []);\ng = JITGui(Ndef(\\a), 0, w, bounds: 300@40);\n);\n\n// test changing color schemes for JITguis\n// this scheme is admittedly ugly but different\n\nGUI.skins.put(\\jit, (\n fontSpecs: [\"Inconsolata\", 12],\n fontColor: Color.white,\n background: Color(0.2, 0.85, 0.7, 0.5),\n foreground: Color.grey(0.1),\n onColor: Color(0.5, 0, 0.5),\n onColor2: Color(0.0, 0.5, 0.5),\n offColor: Color.grey(0.2, 0.5),\n hiliteColor: Color.green(1.0, 0.5),\n gap: 0 @ 0,\n margin: 2@2,\n buttonHeight: 18,\n headHeight: 24)\n);\n\n// make some JITGuis to check\nn = NdefGui(Ndef(\\a));\nNdef(\\a, { SinOsc.ar(\\freq.kr(250)) });\nNdef(\\a).clear;\nn = NdefMixer(s);\n\nTdefAllGui();\nTdef(\\a).set(\\amp, 0.25);\nTdefGui(Tdef(\\a), 5);\n\nEnvirGui((a: 123));\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// logistic map\n// equation: x1 = -r*x0^2 + r*x0\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n QuadL.ar(SampleRate.ir/4, r.neg, r, 0, 0.1) * 0.4;\n}.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// logistic map\n// equation: x1 = -r*x0^2 + r*x0\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n QuadL.ar(SampleRate.ir/4, r.neg, r, 0, 0.1) * 0.4;\n}.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `CutMixer` in SuperCollider briefly."}, {"role": "assistant", "content": "CutMixer — BBCut2 volume and panning control The CutMixer organises the final output from a given rendering CutGroup. It defaults to outputting a stereo centred signal at full volume on busses 0 and 1. Whilst the main rendering in bbcut2 is mono, the final output is thus rendered to stereo. A stereo buffer cutup would use a simpler CutMixer where no panning occurs. Category: Libraries > BBCut > Cut synths."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// This can go towards granulation\n\n// load sound file\n\nb = Buffer.read(s, Platform.miSCellaneousDirs[0] +/+ \"Sounds\" +/+ \"kitchen_sounds_1.wav\");\n\n\n// switch between looping PlayBufs\n\n(\nx = {\n var sig = {\n DXMix.ar(\n Dxrand([0, 1, 2], inf),\n `(PlayBuf.ar(1, b, BufRateScale.kr(b) * [0.4, 1, 2.2], loop: 1)),\n stepTime: 0.2,\n fadeTime: 0.01,\n fadeMode: 1,\n width: 2\n ) } ! 2;\n // do a bit correlation\n Splay.ar(sig, 0.8\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// This can go towards granulation\n\n// load sound file\n\nb = Buffer.read(s, Platform.miSCellaneousDirs[0] +/+ \"Sounds\" +/+ \"kitchen_sounds_1.wav\");\n\n\n// switch between looping PlayBufs\n\n(\nx = {\n var sig = {\n DXMix.ar(\n Dxrand([0, 1, 2], inf),\n `(PlayBuf.ar(1, b, BufRateScale.kr(b) * [0.4, 1, 2.2], loop: 1)),\n stepTime: 0.2,\n fadeTime: 0.01,\n fadeMode: 1,\n width: 2\n ) } ! 2;\n // do a bit correlation\n Splay.ar(sig, 0.8)\n}.play\n);\n\nx.release\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Pbus.new` do? What arguments does it take?"}, {"role": "assistant", "content": "isolate a pattern by restricting it to a bus Arguments: pattern; dur — delay to allow inner patterns to decay.; fadeTime — fading out the inner pattern after dur over this time.; numChannels — number of channels of the bus (should match the synthdef).; rate — bus rate.."}]} +{"conversations": [{"role": "user", "content": "What is `BHiPass`?"}, {"role": "assistant", "content": "BHiPass — 12db/oct rolloff - 2nd order resonant Hi Pass Filter"}, {"role": "user", "content": "What does `BHiPass.sc` do?"}, {"role": "assistant", "content": "calculate filter coefficients."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n(\nz = {\n BHiPass.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(10, 20000, \\exponential), // cutoff freq.\n MouseY.kr(0.0, 1.0, \\linear), // rq\n 0.5); // mul\n}.play\n);\nz.release;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `ProxyMonitorGui` in SuperCollider briefly."}, {"role": "assistant", "content": "ProxyMonitorGui — controls the top-level of a nodeproxy and its monitor is a GUI for controlling the top-level of a nodeproxy and its monitor. It is e.g. used in ProxyMixer, and NodeProxyEditor, and it is cross-platform. Category: JITLib > GUI, Live Coding."}]} +{"conversations": [{"role": "user", "content": "What does `EnvSpec.defaultControl` do? What arguments does it take?"}, {"role": "assistant", "content": "datatype specifying an Env Arguments: env."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Synth`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n(\n// send a synth def to server\nSynthDef(\"tpulse\", { |out = 0, freq = 700, sawFreq = 440.0|\n Out.ar(out, SyncSaw.ar(freq, sawFreq, 0.1));\n}).add;\n);\n\n// Here the defaults for *new will result in a Synth at the head of the default group\n// of the default Server. This will use the SynthDef's default arguments;\ny = Synth.new(\"tpulse\");\ny.free;\n\n// The same done explicitly\ny = Synth.new(\"tpulse\", nil, s, \\addToHead);\ny.free;\n\n// With some arguments\ny = Synth.new(\"tpulse\", [\\freq, 350, \\sawFreq, 220]);\ny.free;\n\n// make a new synth\ny = Synth(\"tpulse\");\n\n// pause\ny.run(false);\n\ny.run(true);\n\n// set a control by argument name\ny.set(\"freq\", 200);\n\n// or by index\ny.set(2, 100.0);\n\n// modulate out to bus number 1 (the right speaker)\ny.set(0, 1);\n\n// multiple set commands in one message\ny.set(\"out\", 0, \"freq\", 300);\n\n// free the synth from the server\ny.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SharedBus.releaseBus` do? What arguments does it take?"}, {"role": "assistant", "content": "this will not actually release the bus unless the supposedOwner really is the owner. so the children will try to free it, but only the parent can actually Arguments: supposedOwner."}]} +{"conversations": [{"role": "user", "content": "What does `AudioMulchClock.startAction` do?"}, {"role": "assistant", "content": "A Function that is evaluated when the external clock is started (a `\\t_start` is"}]} +{"conversations": [{"role": "user", "content": "What does `RedSamp.prepareForPlay` do? What arguments does it take?"}, {"role": "assistant", "content": "Attach a soundfile to a key (number or symbol) and create buffers - one for each overlapping voice. This method is also has the alias `preload` for backward Arguments: key — A number or a symbol.; buffer — A Buffer instance.; startFrame — In samples.; numFrames — How much of the file to load in samples. Leave as `nil` to load the complete file.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// logistic map\n// equation: x1 = -r*x0^2 + r*x0\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n QuadL.ar(SampleRate.ir/4, r.neg, r, 0, 0.1) * 0.4;\n}.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// logistic map\n// equation: x1 = -r*x0^2 + r*x0\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n QuadL.ar(SampleRate.ir/4, r.neg, r, 0, 0.1) * 0.4;\n}.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ RLPFD.ar(Mix(LFSaw.ar([120, 180], 0, 0.33)), LinExp.kr(LFCub.kr(0.1, 0.5*pi), -1, 1, 280, 1500), 0.6, 0.5, mul:3.dup }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ RLPFD.ar(Mix(LFSaw.ar([120, 180], 0, 0.33)), LinExp.kr(LFCub.kr(0.1, 0.5*pi), -1, 1, 280, 1500), 0.6, 0.5, mul:3).dup }.play\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Saw`."}, {"role": "assistant", "content": "```supercollider\n// modulating the frequency\n\n{ Saw.ar(XLine.kr(40, 4000, 6), 0.2) }.play;\n\n// two band limited sawtooth waves through a resonant low pass filter\n\n{ RLPF.ar(Saw.ar([100, 250], 0.1), XLine.kr(8000, 400, 5), 0.05) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `DebugFrame.context` do?"}, {"role": "assistant", "content": "Returns another DebugFrame of the compiling context, rarely"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{ var nse, env, kic;\n kic = tanh(Ringz.ar(LPF.ar(Trig.ar(Impulse.ar(1.0),SampleDur.ir),1000),30,0.25,7).sin*2);\n env = Env.perc(0.05, 1, 1, -4);\n nse = BrownNoise.ar(2) + PinkNoise.ar(0.5) * EnvGen.kr(env,Impulse.kr(1), doneAction: 2);\n\n nse = Mix.ar(BPF.ar(nse,[100,1200,80,40,20],MouseX.kr(0,1),[1,0.2,1,1,1]));\n nse = LPF.ar(nse + kic, MouseY.kr(100,1000))! 2\n\n}.play\n)\n```"}, {"role": "assistant", "content": "A muffled thump. An attempt at a Jurassic Park © glass of water sort of thing - or breaking into a silo."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `OneZero`."}, {"role": "assistant", "content": "```supercollider\n{ OneZero.ar(WhiteNoise.ar(0.5), 0.5) }.play\n\n{ OneZero.ar(WhiteNoise.ar(0.5), -0.5) }.play\n\n{ OneZero.ar(WhiteNoise.ar(0.5), Line.kr(-0.5, 0.5, 10)) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Normalizer`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n// example signal to process\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n z * 0.8\n}.play\n);\n\n(\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n [z, Normalizer.ar(z, 0.4, 0.01)] * 0.5\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `InstrBrowser.topBarFunc` do?"}, {"role": "assistant", "content": "Browse your instrument library, with customizable actions"}]} +{"conversations": [{"role": "user", "content": "What is `RedArduino` in SuperCollider?"}, {"role": "assistant", "content": "RedArduino — for uploading sketches to arduino This class can be used for uploading sketches to an Arduino from SuperCollider via the soundcard. No FTDI chip needed! It's a very cheap way to program barebone arduino boards. Category: Red > redTools."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// randomly modulate params\n(\n{ LinCongC.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(0.1, 0.5, 1.4),\n LFNoise2.kr(0.1, 0.1, 0.1),\n LFNoise2.kr(0.1)\n) * 0.2 }.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// randomly modulate params\n(\n{ LinCongC.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(0.1, 0.5, 1.4),\n LFNoise2.kr(0.1, 0.1, 0.1),\n LFNoise2.kr(0.1)\n) * 0.2 }.play(s);\n)\n```"}]} {"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nm = SimpleMIDIFile.read( \"~/Téléchargements/Super Mario Bros 2 - Mario Dreams.mid\" ); \n(\n TempoClock.default.tempo = m.tempo/60;\n Pdef(\\bla, \n Pbind(\n \\instrument, \\default,\n [\\midinote, \\dur, \\sustain, \\amp], Prout({ arg ev;\n var timescale = 1/16/60;\n var prevev;\n m.noteSustainEvents.collect({ arg item, idx;\n // [track, absTime, \\noteOn, channel, note, velo, dur, upVelo]\n if(idx == 0) {\n prevev = [item[4], item[1], item[6] * timescale, item[5]/127]\n } {\n prevev[1] = item[1] - prevev[1] * timescale;\n ev = prevev.yield;\n prevev = [item[4], item[1], item[6] * timescale, item[5]/127];\n };\n });\n prevev[1] = prevev[2];\n ev = prevev.yield;\n }),\n )\n ).play\n)\n```"}, {"role": "assistant", "content": "There is the .p method (see http://sccode.org/1-5aT) but here is also a way to retrieve the values directly."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\na = Ptime.new;\nx = a.asStream;\n);\n\nx.next;\nx.next;\nx.next;\n\n// post time in a playing event stream\n(\nPbind(\n \\pfunc, Ptime.new.trace,\n \\dur, Pseries(0.5, 0.5, 5)\n).play;\n);\n\n\n// change degree independant of number of events that have been playing\n\n(\nvar a, b;\na = Pbind(\n \\degree, Pswitch(#[0, 2b, 3], Ptime(8).round(2) / 2),\n \\dur, Prand(#[0.2, 0.5, 1.1, 0.25, 0.15], inf)\n);\nb = Pbind(\n \\degree, Pseq(#[0, 2b, 3], 1),\n \\dur, 2,\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\na = Ptime.new;\nx = a.asStream;\n);\n\nx.next;\nx.next;\nx.next;\n\n// post time in a playing event stream\n(\nPbind(\n \\pfunc, Ptime.new.trace,\n \\dur, Pseries(0.5, 0.5, 5)\n).play;\n);\n\n\n// change degree independant of number of events that have been playing\n\n(\nvar a, b;\na = Pbind(\n \\degree, Pswitch(#[0, 2b, 3], Ptime(8).round(2) / 2),\n \\dur, Prand(#[0.2, 0.5, 1.1, 0.25, 0.15], inf)\n);\nb = Pbind(\n \\degree, Pseq(#[0, 2b, 3], 1),\n \\dur, 2,\n \\ctranspose, -7\n);\nPseq([Event.silent(1.25), Ppar([a, b])], inf).play;\n);\n\n\n// test tempo changes\n\n(\nvar a, b;\na = Pbind(\n \\degree, Pswitch(#[0, 2b, 3], Ptime(8).round(2) / 2),\n \\dur, Prand(#[0.2, 0.5, 1.1, 0.25, 0.15], 9)\n);\nb = Pbind(\n \\degree, Pseq(#[0, 2b, 3], 1),\n \\dur, 2,\n \\ctranspose, -7\n);\nPn(\n Pfset({ ~tempo = #[1, 2, 4].choose.postln },\n Pseq([\n Event.silent(1.25),\n Ppar([a, b])\n ])\n )\n).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `RedHarmonicTree.sorted` do? What arguments does it take?"}, {"role": "assistant", "content": "sorted harmonic tree Arguments: base — Base frequency.; num — Number of partials.; range — 1 and 2 will only produce unison and octaves.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// randomly modulate params\n(\n{ LorenzL.ar(\n SampleRate.ir,\n LFNoise0.kr(1, 2, 10),\n LFNoise0.kr(1, 20, 38),\n LFNoise0.kr(1, 1.5, 2)\n) * 0.2 }.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// randomly modulate params\n(\n{ LorenzL.ar(\n SampleRate.ir,\n LFNoise0.kr(1, 2, 10),\n LFNoise0.kr(1, 20, 38),\n LFNoise0.kr(1, 1.5, 2)\n) * 0.2 }.play(s);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for muffled thump?"}, {"role": "assistant", "content": "```supercollider\n(\n{ var nse, env, kic;\n kic = tanh(Ringz.ar(LPF.ar(Trig.ar(Impulse.ar(1.0),SampleDur.ir),1000),30,0.25,7).sin*2);\n env = Env.perc(0.05, 1, 1, -4);\n nse = BrownNoise.ar(2) + PinkNoise.ar(0.5) * EnvGen.kr(env,Impulse.kr(1), doneAction: 2);\n\n nse = Mix.ar(BPF.ar(nse,[100,1200,80,40,20],MouseX.kr(0,1),[1,0.2,1,1,1]));\n nse = LPF.ar(nse + kic, MouseY.kr(100,1000))! 2\n\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Interpolate between Envs with Pseg?"}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\sin, { arg out=0, gate=1, amp=0.1, pan=0, freq=200;\n var sig;\n sig = SinOsc.ar(freq);\n sig = sig * EnvGen.kr(\\adsr.kr(Env.adsr(0.1,0.1,0.8,0.1)), gate, doneAction:2);\n sig = Pan2.ar(sig, pan, amp);\n Out.ar(out, sig);\n}).add;\n);\n\n(\n// sequence Envs\n// need [] else it is inlined or does pattern multichannel expansion\nPdef(\\demo, \n Pbind(\n \\instrument, \\sin,\n \\degree, Pseq([0, Pwhite(0,7,1)],inf),\n \\legato, 0.5,\n \\adsr, Pseq([\n [ Env.adsr(1.1,0.1,0.8,1.01) ],\n [ Env.adsr(0.01,0.1,0.8,0.01) ],\n [ Env.adsr(0.01,1.1,0.3,0.01) ],\n ],inf),\n )\n).play;\n);\n\n(\n// interpolate using Pseg\n// need .asArray\nPdef(\\demo, \n Pbind(\n \\instrument, \\sin,\n \\degree, Pseq([0, Pwhite(0,7,1)],inf),\n \\legato, 0.5,\n \\adsr, Pseg(Pseq([\n [ Env.adsr(1.1,0.1,0.8,1.01).asArray ],\n [ Env.adsr(0.01,0.1,0.8,0.01).asArray ],\n [ Env.adsr(0.01,1.1,0.3,0.01).asArray ],\n ],inf),8),\n )\n).play;\n);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `PopUpMenu.action` do?"}, {"role": "assistant", "content": "The action object evaluated whenever the user changes the selected item from the menu. See #-allowsReselection for"}]} -{"conversations": [{"role": "user", "content": "I get 'syntax error, unexpected NAME' on a block that looks fine."}, {"role": "assistant", "content": "Almost always a missing semicolon between two statements — SuperCollider does not insert them.\n\n```supercollider\n// broken: two statements, no separator\n{ var sig = SinOsc.ar(440) sig = sig * 0.1; sig }.play\n```\n\n```supercollider\n// fixed\n{ var sig = SinOsc.ar(440); sig = sig * 0.1; sig }.play\n```\nThe error points at the second statement, not at the missing semicolon before it, which is why it looks\nfine. If it is not a semicolon, count the brackets: `.ar(` open, `)` closed."}]} -{"conversations": [{"role": "user", "content": "What does `RedTapeRecorder.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "sampling and looping Arguments: buffer; in — Input signal.; gate — 1= record, 0= looped playback.; interpol — 1= no, 2= linear, 4= cubic.; muteWhileRecording — when on (1) the sound is muted while recording.; lag — mute fade in and out time. only useful when muteWhileRecording is on. a small value here might reduce some clicks.."}]} -{"conversations": [{"role": "user", "content": "What does `CutPan1.new` do? What arguments does it take?"}, {"role": "assistant", "content": "CutMixer panning algorithm Arguments: directfunc — A function, called every block, that determines the direction to change the pan. If nil, defaults to a function that randomly returns -1 or 1.; outrate — The common difference of the arithmetic sequence. Defaults to 0.2. This can also be a function, in which case it is called every repeat.."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Variations for Z1 sawtooth."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var mod = SinOsc.ar([0.1,0.15,0.2]).range(0,1);\n var saw = LFSaw.ar([10,12,15]);\n var out = (saw - ((saw>0)*mod)+(mod*0.5));\n Splay.ar(out)*0.4;\n}.play;\n\n{\n var mod = SinOsc.ar([0.1,0.15,0.2]).range(0,1);\n var saw = SinOsc.ar(LFSaw.ar([10,12,15]).range(200,300));\n var out = (saw - ((saw>0)*mod)+(mod*0.5));\n Splay.ar(out)*0.4;\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n//distortion creeps in under 200Hz\n{ DPW3Tri.ar(XLine.kr(2000, 20, 10)) }.play; \n\n//very fast sweeps can have transient distortion effects\n{ DPW3Tri.ar(MouseX.kr(200,12000,'exponential')) }.play;\n\n//compare:\n{LFTri.ar(MouseX.kr(200,12000,'exponential'))}.play\n\n\n//less efficient than LFTri\n{ Mix(DPW3Tri.ar(Array.rand(10,50,5000))*0.1) }.play;\n\n{ Mix(LFTri.ar(Array.rand(10,50,5000))*0.1) }.play;\n\n\n//triangle is integration of square wave; warning loud, not so kind \n{Int\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n//distortion creeps in under 200Hz\n{ DPW3Tri.ar(XLine.kr(2000, 20, 10)) }.play; \n\n//very fast sweeps can have transient distortion effects\n{ DPW3Tri.ar(MouseX.kr(200,12000,'exponential')) }.play;\n\n//compare:\n{LFTri.ar(MouseX.kr(200,12000,'exponential'))}.play\n\n\n//less efficient than LFTri\n{ Mix(DPW3Tri.ar(Array.rand(10,50,5000))*0.1) }.play;\n\n{ Mix(LFTri.ar(Array.rand(10,50,5000))*0.1) }.play;\n\n\n//triangle is integration of square wave; warning loud, not so kind \n{Integrator.ar(Pulse.ar(MouseX.kr(440,8800),0.5),0.99)}.play\n\n//differentiation of triangle is square\n{HPZ1.ar(2.0*DPW3Tri.ar(MouseX.kr(440,8800)))}.play\n\n//compare\n{Pulse.ar(MouseX.kr(440,8800),0.5)}.play\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes song of forest."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\sound, {\n arg i_bus = 0, amp = 0.1, freq = 440, sustain = 1, pan = 0;\n var env, osc, out;\n env = EnvGen.kr(Env.perc(0.01, sustain, amp),doneAction:2);\n osc = SinOsc.ar([freq, freq * 1.005, freq * 0.995], mul:env);\n out = Pan2.ar(osc, pan);\n Out.ar(i_bus, out);\n}).send(s);\n);\n\n(\n~amp = 0.1;\na = Pdef(\\a,\n Pbind(\n \\instrument, \\sound,\n \\amp, ~amp * 1.5,\n \\degree, Pseq([2, 4, 5, 6, 1] - 1, inf),\n \\dur, Pseq([1, 1, 1, 1, 2] / 4, inf)\n )\n).quant_([3, 0, 0, 1]);\n\nb = Pdef(\\b,\n Pbind(\n \\instrument, \\sound,\n \\amp, ~amp,\n \\degree, Pseq([8, 6, 5, 3, 4, 6] - 1, inf),\n \\dur, Pseq([1, 1, 1, 1, 1, 1] / 4, inf)\n )\n).quant_([3, 0, 0, 1]);\n\nc = Pdef(\\c,\n Pbind(\n \\instrument, \\sound,\n \\amp, ~amp * 0.6,\n \\degree, Pseq([1, 6, 8, 6, Pwrand([11,13], [2, 1].normalizeSum)] - 1, inf),\n \\amp, Pseq([0, 1, 1, 1, 1] / 10, inf),\n \\dur, Pseq([8, 1, 1, 1, 1] / 8, inf),\n \\sustain, 0.1\n )\n).quant_([3, 0, 0, 1]);\n);\n\n(\nSystemClock.sched(0, Routine({\n a.play; 12.yield;\n b.play; 12.yield;\n c.play; 12.yield;\n c.pause; 6.yield;\n a.pause; 6.yield;\n\n b.pause; a.play; 12.yield;\n b.play; 12.yield;\n c.play; 12.yield;\n c.pause; a.pause; 6.yield;\n b.pause; 6.yield;\n}));\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// a Buffer for the UGens to use\nb = Buffer.alloc(s, 44100, 1);\n\n// write a signal into a delay, tap it at multiple times\nSynthDef(\\write, { |buffer, cout|\n var src, tapPhase, tap1, tap2, tap3;\n src = WhiteNoise.ar(0.2) * Decay.kr(Dust.kr(3), 0.7);\n tapPhase = DelTapWr.ar(buffer, src);\n Out.kr(cout, tapPhase);\n }).add;\n\nSynthDef(\\readFilt, { |out, buffer, cin|\n var phase, src, filt;\n phase = In.kr(cin);\n src = DelTapRd\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// a Buffer for the UGens to use\nb = Buffer.alloc(s, 44100, 1);\n\n// write a signal into a delay, tap it at multiple times\nSynthDef(\\write, { |buffer, cout|\n var src, tapPhase, tap1, tap2, tap3;\n src = WhiteNoise.ar(0.2) * Decay.kr(Dust.kr(3), 0.7);\n tapPhase = DelTapWr.ar(buffer, src);\n Out.kr(cout, tapPhase);\n }).add;\n\nSynthDef(\\readFilt, { |out, buffer, cin|\n var phase, src, filt;\n phase = In.kr(cin);\n src = DelTapRd.ar(buffer, phase, [0.01, 0.2]);\n filt = BPF.ar(src, 880, 0.01) * 10;\n Out.ar(out, filt);\n}).add;\n\nc = Bus.control;\n\nx = Synth(\\write, [\\buffer, b, \\cout, c]);\ny = Synth(\\readFilt, [\\buffer, b, \\cin, c]);\n\nx.free;\nb.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `RedOscillator.update` do?"}, {"role": "assistant", "content": "Calculate new phase and delta. Always call LINK#-couple before"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for some pattern exprimenting."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\brumm, { |dur = 1, pan = 2, freq = 40, index = 20|\n var sig = Pan2.ar(\n Blip.ar(freq, index),\n pan\n ) * EnvGen.ar(Env.perc(0.01, dur), doneAction: 2);\n Out.ar(0, sig);\n}).add;\n);\n\n(\nPbind(*[\n dur: Pseq([1.2, 0.2, 0.5, Pseries(0.1, -0.001, 100)], inf),\n pan: Pxrand(#[-0.5, 0.5, 0.1, -0.1, 0.8, -1], inf),\n freq: 40,\n instrument: \\brumm\n]).play();\n);\n\n(\nPbind(*[\n dur: Pseq([1.2, 0.2, 0.5, Pseries(0.1, -0.001, 100)], inf),\n pan: Pxrand(#[-0.5, 0.5, 0.1, -0.1, 0.8, -1], inf),\n freq: Pseq([Pseries(140, 0.5, 200)], inf),\n instrument: \\brumm\n]).play;\n);\n\n(\nPbind(*[\n dur: Pseq(Signal.chebyFill(1024, Array.rand(10, 0.0, 10.0)).abs + 0.05, inf),\n pan: Pxrand(#[-0.5, 0.5, 0.1, -0.1, 0.8, -1], inf),\n freq: Pseq(Signal.chebyFill(1024, Array.rand(10, 0.0, 10.0)).abs * 18000 + 120, inf),\n instrument: \\brumm\n]).play;\n);\n\n\n(\nPbind(*[\n dur: Pseq([1.2, 0.2, 0.5, Pseries(0.1, -0.002, 50)], inf),\n pan: Pxrand(#[-0.5, 0.5, 0.1, -0.1, 0.8, -1, 1, -0.8], inf),\n freq: Pseq([Pseries(740, 0.5, 200), Pxrand(Array.series(740, 0.5, 200), 50)], inf),\n instrument: \\brumm\n]).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Rand or rand difference?"}, {"role": "assistant", "content": "SuperCollider forum — Rand or rand difference?\n\nI think you meant to compare Rand and rrand (not rand) – both generate a random number between a given low and high, but Rand is intended to be used inside a SynthDef and the behavior is slightly different. Compare:\n\n```supercollider\n(\nSynthDef(\\test, {\n var freq = rrand(400, 600);\n Out.ar(0, SinOsc.ar(freq) * 0.2);\n}).add;\n);\n\nSynth(\\test); // run and stop multiple times: always same freq\n\n(\nSynthDef(\\test2, {\n var freq = Rand(400, 600);\n Out.ar(0, SinOsc.ar(freq) * 0.2);\n}).add;\n);\n\nSynth(\\test2); // run and stop multiple times: every time a different freq\n```\n\nAs you can read in the help file, Rand is intended to be used inside SynthDefs when you want the particular behavior of a newly generated random frequency for each Synth called. You can use rrand(lo, hi) inside a SynthDef too, if you want the random number to be generated only once at time of SynthDef creation (it gets “inscribed in the recipe” for good), so all future and all Synth calls based on that SynthDef to use on that same random number.\n\nAs a side note, rand (as opposed to rrand) generates a random number between zero and the receiver:\n\n```supercollider\nrand(8); // random numbers between 0 and and 8 (excluding 8)\n\nrand(0.5, 8); // random numbers between 0 and 0.5; second argument is ignored here\n```\n\nAlso in regards to the specific way you present the example (as Functions, indicated by the curly braces): note the difference when you evaluate them:\n\n```supercollider\n{Rand(0.5,8)}.value; // returns 'a Rand'\n{rrand(0.5,8)}.value; // returns an actual random choice between lo and hi\n```\n\nHope this helps,\n\nB"}]} -{"conversations": [{"role": "user", "content": "Splay - not getting spread, wrong use?"}, {"role": "assistant", "content": "SuperCollider forum — Splay - not getting spread, wrong use?\n\nYou need to undestand that if you have two identical signal coming from left and right it will always be mono. No stereo spread possible. So you need to introduce (at least) two different signals - and just different amplification will not really work.\n\nTo expand your first example, we can introduce an array of values for paramtere pos:\n\n```supercollider\n(\nx = { arg spread=1, level=0.2, center=0.0;\n Splay.ar(\n GrainBuf.ar(numChannels: 1,\n trigger: Impulse.kr(1.2875),\n dur: Impulse.kr(1.2875),\n sndbuf: b,\n pos:[0,0.5],\n interp: 1\n ),\n spread,\n level,\n center\n );\n}.play;\n);\n\nx.set(\\spread, 1, \\center, 0); // full stereo\nx.set(\\spread, 0, \\center, 0); // mono center\n```\n\nBy way of Multichannel Expansion this creates two different signals (channels, an array of 2 UGen graphs) that you can hear as different and therefore observe the stereo spread.\n\nAnd similarly, to use your other example with In.ar where I have added in=2, so that it takes my mic in (but you can specify another bus) and wrapped it into a feedback delay with an array of two values for delayTime. Multichannel expansion thus creates two channels that are different because they have different delaytimes but the rest of UGen graph is the same (a copy). Changing spread now works:\n\n```supercollider\n(\nSynthDef(\\stereo,{|out=0, in=2, spread=1, level=1, center=0.0|\n Out.ar(out,\n Splay.ar(\n CombN.ar(\n In.ar(in, 1), 1, [0.3,0.4], 2)\n ,spread,level,center));\n}).play;\n)\n```\n\nI hope that clarifies the issue better."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// create an audio-rate sine wave at 200 Hz,\n// starting with phase 0 and an amplitude of 0.5\n{ SinOsc.ar(200, 0, 0.5) }.play;\n\n// modulate the frequency with an exponential ramp\n{ SinOsc.ar(XLine.kr(2000, 200), 0, 0.5) }.play;\n\n// more complex frequency modulation\n{ SinOsc.ar(SinOsc.ar(XLine.kr(1, 1000, 9), 0, 200, 800), 0, 0.25) }.play;\n\n// phase modulation (see also PMOsc)\n{ SinOsc.ar(800, SinOsc.ar(XLine.kr(1, 1000, 9), 0, 2pi), 0.25) }.play;\n```"}, {"role": "assistant", "content": "create an audio-rate sine wave at 200 Hz, starting with phase 0 and an amplitude of 0.5 (SinOsc: Interpolating sine wavetable oscillator.)"}]} -{"conversations": [{"role": "user", "content": "Resetting start count with PulseDivider?"}, {"role": "assistant", "content": "SuperCollider forum — Resetting start count with PulseDivider?\n\ni think in your example Sweep is receiving a trigger while going from 0 to 1 causing the discontinuity in the phase because the duration between one trigger and the next is unknown.\n\nwith this example you get at least a continiuous phase with random triggers to drive the hanning window (evaluate it several times). but its not multichannel with distributed phases / windows accross channels:\n\n```supercollider\n(\nvar randomTrigPhase = { |triggerRate = 10, randomness = 1|\n var minDuration = (2 ** randomness) / triggerRate;\n var maxDuration = (2 ** (-1 * randomness)) / triggerRate;\n var demand = Dunique(minDuration * ((maxDuration / minDuration) ** Dwhite(0, 1)));\n var duration = Duty.ar(demand, DC.ar(0), demand);\n var phase = Phasor.ar(DC.ar(0), (1 / duration) / SampleRate.ir, 0, 1);\n (phase: phase, trigger: HPZ1.ar(phase) < 0);\n};\n\nvar hanningWindow = { |phase|\n (1 - (phase * 2pi).cos) / 2 * (phase < 1);\n};\n\n{\n var rate = 100;\n var phase = randomTrigPhase.(rate, 1).phase;\n hanningWindow.(phase);\n}.plot(0.1);\n)\n```\n\nim not sure if this is helping it just reminded me of some issue with multichannel random triggers and continiuous phases i have been trying to solve."}]} -{"conversations": [{"role": "user", "content": "What does `ZArchive.write` do? What arguments does it take?"}, {"role": "assistant", "content": "open an archive for Arguments: pathName — path that the file will be written to. Returns: a ZArchive"}]} -{"conversations": [{"role": "user", "content": "What is `GbmanN` in SuperCollider?"}, {"role": "assistant", "content": "GbmanN — Gingerbreadman map chaotic generator A non-interpolating sound generator based on the difference equations: Category: UGens > Generators > Chaotic."}]} -{"conversations": [{"role": "user", "content": "What is `Pluck` in SuperCollider?"}, {"role": "assistant", "content": "Pluck — A Karplus-Strong UGen Category: UGens > Delays."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n var time = 30;\n var line = Line.kr(3000, 290, time);\n var line2 = Line.kr(280, 290, time);\n var line3 = Line.kr(0.01, 10, time);\n var sin = Mix.ar(SinOsc.ar([line, line2]) * SinOsc.ar(line3));\n var comb = CombC.ar(sin, time, SinOsc.kr(0.1).range(0.1, 0.2), time);\n var env = EnvGen.ar(Env.linen(0.01, time, 10), 1, doneAction:2);\n comb * env * 0.05!2;\n}.play\n)\n```"}, {"role": "assistant", "content": "Here is some quick code that sounds like an old sci-fi UFO landing."}]} -{"conversations": [{"role": "user", "content": "What does `Integer.asStringToBase` do?"}, {"role": "assistant", "content": "32-bit Integer number Returns: a string with `width`-rightmost digits in base `base`."}]} -{"conversations": [{"role": "user", "content": "What does `Collection.includesEqual` do?"}, {"role": "assistant", "content": "Answer whether anObject is contained in the receiver. In contrast to #-includes this tests for equality - not identity. `List[\"a\", \"b\", \"c\"].includesEqual(\"c\"); //"}]} -{"conversations": [{"role": "user", "content": "How does multi-channel expansion work?"}, {"role": "assistant", "content": "If any argument of a UGen is an Array, the UGen is built once per element and the results are returned as an Array. So `SinOsc.ar([220, 330, 440])` is three oscillators, and `SinOsc.ar(220 * [1, 1.5])` is two. This is not a special stereo feature: it is uniform expansion, which is why `Splay.ar(SinOsc.ar([220,330,440]) * 0.1)` gives you a spread stereo field from three mono sources."}]} -{"conversations": [{"role": "user", "content": "What does `Red4D.vectors` do?"}, {"role": "assistant", "content": "An array of RedVector4D. This holds the current positions of all points (corners) after rotation is applied. This is calculated when calling"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Pmulpre` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain);\nb = Pmulpre(\\freq, Pseq([1, 2, 3], inf), a);\nb.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for Interpolate between Envs with Pseg: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\sin, { arg out=0, gate=1, amp=0.1, pan=0, freq=200;\n var sig;\n sig = SinOsc.ar(freq);\n sig = sig * EnvGen.kr(\\adsr.kr(Env.adsr(0.1,0.1,0.8,0.1)), gate, doneAction:2);\n sig = Pan2.ar(sig, pan, amp);\n Out.ar(out, sig);\n}).add;\n);\n\n(\n// sequence Envs\n// need [] else it is inlined or does pattern multichannel expansion\nPdef(\\demo, \n Pbind(\n \\instrument, \\sin,\n \\degree, Pseq([0, Pwhite(0,7,1)],inf),\n \\legato, 0.5,\n \\adsr, Pseq([\n [ Env.adsr(1.1,0.1,0.8,1.01) ],\n [ Env.adsr(0.01,0.1,0.8,0.01) ],\n [ Env.adsr(0.01,1.1,0.3,0.01) ],\n ],inf),\n )\n).play;\n);\n\n(\n// interpolate using Pseg\n// need .asArray\nPdef(\\demo, \n Pbind(\n \\instrument, \\sin,\n \\degree, Pseq([0, Pwhite(0,7,1)],inf),\n \\legato, 0.5,\n \\adsr, Pseg(Pseq([\n [ Env.adsr(1.1,0.1,0.8,1.01).asArray ],\n [ Env.adsr(0.01,0.1,0.8,0.01).asArray ],\n [ Env.adsr(0.01,1.1,0.3,0.01).asArray ],\n ],inf),8),\n )\n).play;\n);\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `FFTPeak` in SuperCollider briefly."}, {"role": "assistant", "content": "FFTPeak — Find peak value in an FFT frame Given an FFT chain, this finds the bin with the strongest magnitude. It outputs the frequency of that bin, and its magnitude. No interpolation is done on the values. Category: UGens > Analysis, UGens > FFT."}]} +{"conversations": [{"role": "user", "content": "Synth Iteration Help?"}, {"role": "assistant", "content": "SuperCollider forum — Synth Iteration Help\n\n```supercollider\n(\nSynthDef (\\sine_tone) {\narg freq = 440, amp = 1, len = 1, bus = 0;\nvar sig, env;\nenv = Env.step ([ amp ], [ len ]);\nenv = EnvGen.kr (env, doneAction: 2);\nsig = SinOsc.ar (freq, 0, env);\nOut.ar (bus % 2, sig); // bus modulo 2 here to wrap to stereo\n}.add;\n)\n```\n\nmaybe try wrapping the bus array to [ 0, 1 ] by using modulo: bus % 2. this should let you hear what is going on using a stereo output\n\nby using a Pbind, each “note” is being instantiated as a separate synth with its own length, amplitude, frequency and bus. the doneAction: 2 argument in the EnvGen.kr ugen just means each synth will free itself once it is done playing the note it has been assigned."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// We'll hear the sawtooth wave when the two sine oscillators are both in the region x = 0.0 to 0.5, y = 0.5 to 1.0\n(\n{\n InRect.ar(\n SinOsc.ar(1), SinOsc.ar(1.3), Rect(0, 0.5, 0.5, 0.5)\n ) * LFSaw.ar(44, 0, 0.1)\n}.play\n);\n\n// Stereo effect\n(\n{\n InRect.ar(\n LFNoise0.ar([140, 141]), LFNoise0.ar(143), Rect(0, 0, 0.5, 1)\n ).lag(0.1) * LFSaw.ar(SinOsc.ar(10, 0, 5, 400), 0, 0.1)\n}.play\n);\n\n// For the Rect, create as left\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// We'll hear the sawtooth wave when the two sine oscillators are both in the region x = 0.0 to 0.5, y = 0.5 to 1.0\n(\n{\n InRect.ar(\n SinOsc.ar(1), SinOsc.ar(1.3), Rect(0, 0.5, 0.5, 0.5)\n ) * LFSaw.ar(44, 0, 0.1)\n}.play\n);\n\n// Stereo effect\n(\n{\n InRect.ar(\n LFNoise0.ar([140, 141]), LFNoise0.ar(143), Rect(0, 0, 0.5, 1)\n ).lag(0.1) * LFSaw.ar(SinOsc.ar(10, 0, 5, 400), 0, 0.1)\n}.play\n);\n\n// For the Rect, create as left, 'top', width, height;\nr = Rect(0, 0, 1, 1)\n\nr.left\nr.top\nr.right\nr.bottom\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SDrone.type` do?"}, {"role": "assistant", "content": "a LINKClasses/Symbol describing the type of sound produced. For example"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n//difficult to find active parameters, forced to try resetting! \n\n{Out.ar(0,Pan2.ar(0.5*TermanWang.ar(2.0,Impulse.kr(MouseX.kr(1,1000)),0.1,0.01,1.0,1.0,1.0,MouseX.kr(0.4,1.2), MouseY.kr(2.0,4.0)),0.0))}.play;\n\n\n{Out.ar(0,Pan2.ar(0.5*TermanWang.ar(LFNoise1.ar(LFNoise0.kr(0.5,500,500),1.0,3.0),Impulse.kr(MouseX.kr(1,10000, 'exponential')),0.01,0.01,1.0,1.0,1.\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n//difficult to find active parameters, forced to try resetting! \n\n{Out.ar(0,Pan2.ar(0.5*TermanWang.ar(2.0,Impulse.kr(MouseX.kr(1,1000)),0.1,0.01,1.0,1.0,1.0,MouseX.kr(0.4,1.2), MouseY.kr(2.0,4.0)),0.0))}.play;\n\n\n{Out.ar(0,Pan2.ar(0.5*TermanWang.ar(LFNoise1.ar(LFNoise0.kr(0.5,500,500),1.0,3.0),Impulse.kr(MouseX.kr(1,10000, 'exponential')),0.01,0.01,1.0,1.0,1.0,MouseX.kr(0.4,1.2), MouseY.kr(2.0,4.0)),0.0))}.play;\n\n\n{Out.ar(0,Pan2.ar(FreeVerb.ar(0.5*TermanWang.ar(2.0+ SinOsc.ar(MouseX.kr(10,10000,'exponential'),0,MouseY.kr(0.1,100.0,'exponential')),Impulse.kr(MouseX.kr(1,10000, 'exponential')),0.01,0.01,1.0,1.0,1.0,MouseX.kr(0.4,1.2), MouseY.kr(2.0,4.0)),0.5)))}.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `UGenInstr.path` do?"}, {"role": "assistant", "content": "converts a single UGen into an Instr eg. UGenInstr(RLPF)"}]} +{"conversations": [{"role": "user", "content": "Explain `PSVsect_o` in SuperCollider briefly."}, {"role": "assistant", "content": "PSVsect_o — Sieve pattern for intersection of integer generators with offsets and point output Pattern for intersection of integer generators with offsets and point output. Corresponds to Sieve's methods Sieve#*sect_o and Sieve#-sect_o. For an introduction and more examples see Sieves_and_Psieve_patterns. Category: Libraries > miSCellaneous > Sieves and Psieve Patterns, Streams-Patterns-Events > Sieves and Psieve Patterns."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Out`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-out\", { |out = 0, freq = 440|\n var source;\n source = SinOsc.ar(freq, 0, 0.1);\n\n // write to the bus, adding to previous contents\n Out.ar(out, source);\n\n}).add;\n);\n\n\nSynth(\"help-out\", [\\freq, 500]);\nSynth(\"help-out\", [\\freq, 600]);\nSynth(\"help-out\", [\\freq, 700]);\n```"}]} +{"conversations": [{"role": "user", "content": "What is the difference between TempoClock and SystemClock?"}, {"role": "assistant", "content": "SystemClock runs in real time and is what `.wait` uses by default. TempoClock runs in beats and has a tempo, so it can be changed while things are playing and Patterns scheduled on it follow. `TempoClock.default` is the clock Patterns use unless told otherwise, which is why `TempoClock.default.tempo = 2` changes the speed of everything you already have running."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\na = NodeProxy.new.play; // play to hardware output.\na.fadeTime = 2; // fadeTime specifies crossfade\n// set the source\na.source = { SinOsc.ar([350, 351.3], 0, 0.2) };\na.source = { Pulse.ar([350, 351.3] / 4, 0.4) * 0.2 };\na.source = Pbind(\\dur, 0.03, \\freq, Pbrown(0, 1, 0.1, inf).linexp(0, 1, 200, 350));\n\nb = NodeProxy.new;\na.source = { Ringz.ar(b.ar, [350, 351.3] * 8, 0.2) * 4 };\nb.source = { Impulse.ar([\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\na = NodeProxy.new.play; // play to hardware output.\na.fadeTime = 2; // fadeTime specifies crossfade\n// set the source\na.source = { SinOsc.ar([350, 351.3], 0, 0.2) };\na.source = { Pulse.ar([350, 351.3] / 4, 0.4) * 0.2 };\na.source = Pbind(\\dur, 0.03, \\freq, Pbrown(0, 1, 0.1, inf).linexp(0, 1, 200, 350));\n\nb = NodeProxy.new;\na.source = { Ringz.ar(b.ar, [350, 351.3] * 8, 0.2) * 4 };\nb.source = { Impulse.ar([5, 7]/2, [0, 0.5]) };\n\na.clear(3); // clear after 3 seconds\nb.clear(3);\n```"}]} +{"conversations": [{"role": "user", "content": "What is `TimeStretch2` in SuperCollider?"}, {"role": "assistant", "content": "TimeStretch2 — Server Side Time Stretch Though much slower, TimeStretch is preferred, as it sounds much better. TimeStretch2 is provided more as an experimental convenience, and I cannot guarantee its accuracy. TimeStretch2 also does not work on files with a sample rate other than 44100. Category: UGens > FFT."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `CoinGate`."}, {"role": "assistant", "content": "```supercollider\n(\na = SynthDef(\"help-TCoin\", { |out = 0, prob = 0.5|\n var trig;\n trig = CoinGate.kr(prob, Impulse.kr(10));\n Out.ar(out,\n SinOsc.ar(\n TRand.kr(300.0, 400.0, trig), 0, 0.2\n )\n )\n}).play;\n);\n\na.set(\\prob, 1.0);\na.set(\\prob, 0.0);\na.set(\\prob, 0.1);\n\n\n(\na = SynthDef(\"help-TCoin\", { |out = 0, prob = 0.5|\n var trig;\n trig = Impulse.ar(20, 0, SinOsc.kr(0.5, 0, 1, 1));\n Out.ar(out,\n Mix.fill(3, { Ringz.ar(CoinGate.ar(prob, trig*0.5), #[1, 1.5]*Rand(1000, 9000), 0.01) })\n )\n}).play;\n);\n\na.set(\\prob, 1.0);\na.set(\\prob, 0.0);\na.set(\\prob, 0.1);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Buffer.allocConsecutive` do? What arguments does it take?"}, {"role": "assistant", "content": "Allocates a range of consecutively-numbered buffers, for use with UGens like VOsc and VOsc3 that require a contiguous block of buffers, and returns an array of corresponding Buffer Arguments: numBufs — The number of consecutively indexed buffers to allocate.; server — The server on which to allocate the buffers. The default is the default Server.; numFrames — The number of frames to allocate in each buffer. Actual memory use will correspond to numFrames * numChannels. (A floating-point value is truncated to integer.); numChannels — The number of channels for each buffer. The default is 1. (A floating-point value is truncated to integer.); completionMessage — A valid OSC message or a Function which will return one. A Function will be passed each Buffer and its index in the array as arguments when evaluated.; bufnum — An explicitly specified buffer number. Supplying a number bypasses the server's buffer allocator, which can lead to conflicts. The best practice is to leave this unset and let the buffer number allocator choose the next available bufnum.; sampleRate — The sample rate of the buffer. The default is the sample rate of the server.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ PinkNoise.ar(1) * Line.kr(1, 0, 2, doneAction: Done.freeSelf }.play.onFree { \"done\".postln };\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ PinkNoise.ar(1) * Line.kr(1, 0, 2, doneAction: Done.freeSelf) }.play.onFree { \"done\".postln };\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Scale`."}, {"role": "assistant", "content": "```supercollider\n(\nr = {\n var scale = Scale.choose.postln;\n SinOsc.ar(\n (\n DegreeToKey.kr(\n scale.as(LocalBuf),\n MouseX.kr(0, 15), // mouse indexes into scale\n scale.stepsPerOctave,\n 1, // mul = 1\n 60 // offset by 72 notes\n )\n + LFNoise1.kr([3, 3], 0.04) // add some low freq stereo detuning\n ).midicps, // convert midi notes to hertz\n 0,\n 0.25\n )\n}.play;\n);\n\nr.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `CutPan1` in SuperCollider?"}, {"role": "assistant", "content": "CutPan1 — CutMixer panning algorithm CutPan1 is intended to be used in the panfunc parameter of CutMixer . It pans repeats in each block in an arithmetic sequence starting from 0. The pan is automatically clipped if it goes outside of the range [-1, 1]. Category: Libraries > BBCut > Cut FX."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ XFade2.ar(Saw.ar, SinOsc.ar, LFTri.kr(0.1) }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ XFade2.ar(Saw.ar, SinOsc.ar, LFTri.kr(0.1)) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PinkNoise`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-PinkNoise\", { |out = 0|\n Out.ar(out,\n PinkNoise.ar(0.4)\n )\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n Instr(\\helpTempoPlayer,{\n Impulse.ar( Tempo.kr )\n });\n\n Patch(\\helpTempoPlayer).play(atTime:1)\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n Instr(\\helpTempoPlayer,{\n Impulse.ar( Tempo.kr )\n });\n\n Patch(\\helpTempoPlayer).play(atTime:1)\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `BufSampleRate`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n// compares a 1102.5 Hz sine tone (11025 * 0.1, left) with a 1100 Hz tone (right)\n// the apollo sample has a sample rate of 11.025 kHz\n(\n{\n var freq;\n freq = [BufSampleRate.kr(b) * 0.1, 1100];\n SinOsc.ar(freq, 0, 0.1)\n}.play;\n);\n\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `QuadL`."}, {"role": "assistant", "content": "```supercollider\n// default params\n{ QuadL.ar(SampleRate.ir/4) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\"help-Dust2\", { |out = 0|\n Out.ar(out,\n Dust2.ar(200, 0.5)\n )\n}).play;\n);\n\n(\nSynthDef(\"help-Dust2\", { |out = 0|\n Out.ar(out,\n Dust2.ar(XLine.kr(20000, 2, 10), 0.5)\n )\n}).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\"help-Dust2\", { |out = 0|\n Out.ar(out,\n Dust2.ar(200, 0.5)\n )\n}).play;\n);\n\n(\nSynthDef(\"help-Dust2\", { |out = 0|\n Out.ar(out,\n Dust2.ar(XLine.kr(20000, 2, 10), 0.5)\n )\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\na = AllGui.new;\n // test adding things that should show up: \na = 12;\nz = 42;\n~bar = 345;\n~foo = 345;\nTdef(\\a); \nTdef(\\b); \nPdef(\\a);\nPdef(\\b);\nPdefn(\\trala);\nPdefn(\\hopsa);\nNdef(\\a);\nNdef(\\b);\n // then try clicking the open button on one!\n\n // all these guis are reasonably non-overlapping / tiled:\na = AllGui(12);\nAllGui.openFuncs.do(_.value(8)); // small screens\nAllGui.openFuncs.do(_.value(12));\n```"}, {"role": "assistant", "content": "test adding things that should show up: then try clicking the open button on one! (AllGui: Overview of many globally stored objects)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain);\nb = Paddpre(\\freq, Pseq([10, 30, 100], inf), a);\nb.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain);\nb = Paddpre(\\freq, Pseq([10, 30, 100], inf), a);\nb.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// a stereo signal, both channels at 0dB\n{ [SinOsc.ar(440), SinOsc.ar(440)] }.play\n\n// using Balance on a stereo signal with the position parameter at 0, effectively the same sound but both channels at -3dB\n{ Balance2.ar(SinOsc.ar(440), SinOsc.ar(440), 0) }.play\n\n// pan sweep from left to right\n{ Balance2.ar(SinOsc.ar(440), SinOsc.ar(1000), Line.kr(-1, 1, 5)) }.play\n\n// other examples\n{ Balance2.ar(LFSaw.ar(44), Pulse.ar(33), FSinOsc.kr(0.5), 0.1) }.play;\n{ var source; source = SinOsc\n// …\n```"}, {"role": "assistant", "content": "a stereo signal, both channels at 0dB using Balance on a stereo signal with the position parameter at 0, effectively the same sound but both channels at -3dB (Balance2: Stereo signal balancer)"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `RandID` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// start a noise patch and set the id of the generator\n(\nSynthDef(\"help-RandID\", { |out = 0, id = 1|\n RandID.ir(id);\n Out.ar(out,\n WhiteNoise.ar(0.05) + Dust2.ar(70)\n )\n}).add;\n);\n\n// reset the seed of my rgen at a variable rate\n(\nSynthDef(\"help-RandSeed\", { |seed = 1910, id = 1|\n RandID.kr(id);\n RandSeed.kr(Impulse.kr(FSinOsc.kr(0.2, 0, 10, 11)), seed);\n}).add;\n\n);\n\n// start two noise synths on left and right channel with a different randgen id\na = Synth(\"help-RandID\", [\\out, 0, \\id, 1]);\nb = Synth(\"help-RandID\", [\\out, 1, \\id, 2]);\n\n// reset the seed of randgen 1\nx = Synth(\"help-RandSeed\", [\\id, 1]);\n\n// change the target randgen to 2 (affects right channel)\nx.set(\\id, 2);\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `GanglionSerial` in SuperCollider briefly."}, {"role": "assistant", "content": "GanglionSerial — for communicating with a Ganglion board (4ch) this class is for communication via bluetooth serial (dongle). use GanglionWifi for the wifi shield. Category: External Control."}]} +{"conversations": [{"role": "user", "content": "Resizing FreqScope?"}, {"role": "assistant", "content": "SuperCollider forum — Resizing FreqScope?\n\nOddly, this seems to work:\n\n```supercollider\n// max partial = 20 kHz\n// do not play this loudly\na = { Blip.ar(100, 200, 0.02).dup }.play;\n\nv = FreqScope(800, 600); // top partial is shown below 1.75 kHz (?)\n\nv.scope.scope.xZoom = 1; // seems correct, by eyeballing\n\n// let's try another resolution\nv = FreqScope(600, 500);\nv.scope.scope.xZoom = 1; // hm, zoom = 1 seems OK here too\n```\n\nFreqScope includes the line scope.xZoom_((scope.bufSize*0.25) / width); so it may be that this calculation is incorrect. I’m unclear, for instance, why it’s dividing by width – apparently zooming out for larger windows...?\n\nBut I tried three different widths (800x600, 600x500, 200x150), and for all of them, xZoom = 1 appeared to be correct. It’s possible that this calculation is vestigial, then – maybe we needed it for the older version of frequency scope, but the Qt version might not need it at all.\n\nhjh"}]} +{"conversations": [{"role": "user", "content": "What does `ControlSpec.unmap` do?"}, {"role": "assistant", "content": "Maps and constrains a value between minval and maxval to the range between 0 and 1. `g = ControlSpec(0.01, 2000, \\exp, 0.1, 220,"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Pan2` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\ng = Group.new;\n\n// make 4 synths in g\n// 1.0.rand2 returns a random number from -1 to 1.\n4.do({ { arg amp = 0.1; Pan2.ar(SinOsc.ar(440 + 110.rand, 0, amp), 1.0.rand2) }.play(g); });\n\ng.set(\\amp, 0.005); // turn them all down\n\ng.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Can you listen to the sound you generate?"}, {"role": "assistant", "content": "No. I am 198M parameters trained on SuperCollider's documentation and class library; I have no audio input and no way to hear a result. What I can do is reason about the code: whether it reaches an output bus, whether the envelope will ever open, whether a filter at that cutoff leaves anything audible. Treat my patches as a starting point you listen to, not as a judgement about how they sound."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\"help-Max\",{Out.ar(0,Pan2.ar(\nSinOsc.ar(Max.kr(SinOsc.ar(2,0,300,400).abs,6400),0,0.1) \n,0.0))\n}).play\n);\n\n//compare\n(\nSynthDef(\"help-Max\",{Out.ar(0,Pan2.ar(\nSinOsc.ar(SinOsc.ar(2,0,300,400),0,0.1) \n,0.0))\n}).play\n);\n\n(\nSynthDef(\"help-Max\",{Out.ar(0,Pan2.ar(\nSinOsc.ar(Max.kr(LFNoise0.ar(20,300,400),3200),0,0.1) \n,0.0))\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\"help-Max\",{Out.ar(0,Pan2.ar(\nSinOsc.ar(Max.kr(SinOsc.ar(2,0,300,400).abs,6400),0,0.1) \n,0.0))\n}).play\n);\n\n//compare\n(\nSynthDef(\"help-Max\",{Out.ar(0,Pan2.ar(\nSinOsc.ar(SinOsc.ar(2,0,300,400),0,0.1) \n,0.0))\n}).play\n);\n\n(\nSynthDef(\"help-Max\",{Out.ar(0,Pan2.ar(\nSinOsc.ar(Max.kr(LFNoise0.ar(20,300,400),3200),0,0.1) \n,0.0))\n}).play\n);\n\n//compare\n(\nSynthDef(\"help-Max\",{Out.ar(0,Pan2.ar(\nSinOsc.ar(LFNoise0.ar(20,300,400),0,0.1) \n,0.0))\n}).play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Array.pyramidg` do?"}, {"role": "assistant", "content": "Like pyramid, but keep the resulting values grouped in subarrays. `//"}]} +{"conversations": [{"role": "user", "content": "What does `Mx.frameRate` do?"}, {"role": "assistant", "content": "Units in an Mx can declared Frame Rate Devices that will be ticked at this rate. SplineFr is an example of a pure Frame Rate Device. Default is 24/beat. The timeline engine uses a frame rate device for its Returns: int"}]} +{"conversations": [{"role": "user", "content": "What does `Server.volume` do?"}, {"role": "assistant", "content": "Get an instance of Volume that runs after the default group, or sets the Volume of the Server's output to level. Level is in"}]} +{"conversations": [{"role": "user", "content": "What does `SequenceableCollection.flatBelow` do? What arguments does it take?"}, {"role": "assistant", "content": "Flatten all subarrays deeper than Arguments: level — Specifies from what level onward to flatten. level 0 is outermost, so flatBelow(0) is like flat. `a = [1, 2, [3, 4, [5, 6, [7, 8, [9, 0]]]]];`."}]} +{"conversations": [{"role": "user", "content": "Who are you?"}, {"role": "assistant", "content": "I am sc-mind, a 198M MiniMind-3-MoE trained from scratch on the SuperCollider source and help corpus. I write and explain SuperCollider: SynthDefs, UGens, Patterns, Ndef, the language/server split, and how to make sound that is not silence."}]} +{"conversations": [{"role": "user", "content": "What does `AbstractSplineGui.crossHairsColor` do?"}, {"role": "assistant", "content": "get/set the cross hairs that are displayed when selecting and moving a Returns: Color"}]} +{"conversations": [{"role": "user", "content": "What is `OteyPiano` in SuperCollider?"}, {"role": "assistant", "content": "OteyPiano — Piano physical model. Should not use this class but OteyPianoString instead (see example) for having only one soundboard for all strings which is more efficient. Category: UGens > PhysicalModels."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Splay` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\nx = { |spread = 1, level = 0.1, center = 0|\n var n = 20;\n var snd = Splay.ar(LFPulse.ar({ 100.exprand(2000) } ! n).range(-1, 1),\n spread, level, center);\n Peak.ar(snd, 0.01, 1).ampdb.poll(1);\n snd\n}.play;\n);\n\n// at full spread, level -20, pan to center:\n// peak is higher at -11 db\nx.set(\\spread, 1, \\center, 0);\n// with no spread, i.e. all panned center, slightly higher -10\nx.set(\\spread, 0, \\center, 0);\n// worst case: no spread, pan full left: -8db\nx.set(\\spread, 0, \\center, -1); // -8\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LinSelectX`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar(300),\n Pulse.ar(230)\n ];\n\n LinSelectX.ar(MouseX.kr(0, 1) * a.size, a) * 0.2\n}.play;\n);\n\n(\n{\n var a;\n a = [\n SinOsc.kr(0.25),\n LFSaw.kr(10),\n LFPulse.kr(0.3)\n ];\n\n SinOsc.ar(LinSelectX.kr(MouseX.kr(0, 1) * a.size, a) * 300 + 400) * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `LFSaw`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\nfork {\n ~group = Group();\n\n 2.wait;\n\n SynthDef(\\buzz, {\n |out = 0, freq = 300, amp = 0.1, filter = 1.7|\n var sig = LFSaw.ar(freq * [1, 3, 5], 0, amp * [1, 0.5, 0.25]).sum;\n sig = LPF.ar(sig, freq * filter);\n Out.ar(out, sig);\n }).add;\n\n [50, 53, 58, 46, 60].midicps.do {\n |f, i|\n Synth(\\buzz, [\n \\out: 0, \\freq, f, \\filter: (i / 2) + 1\n ], target:~group);\n 2.wait;\n };\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nSynthDef(\\dubecho,{|in, out, length = 1, fb = 0.8, sep = 0.012|\n var input = In.ar(in, 2);\n var feedback = LocalIn.ar(2);\n var output = LeakDC.ar(feedback*fb + input);\n output = HPF.ar(output, 400);\n output = LPF.ar(output, 5000);\n output = output.tanh;\n LocalOut.ar(DelayC.ar(output, 1, LFNoise2.ar(12).range([length,length+sep],[length+sep,length])).reverse);\n ReplaceOut.ar(out, output);\n}).add;\n\n// Example as effecet bus\n~bus = Bus.audio(s, 2);\n~echo = Synth(\\dubecho, [\\in, ~bus, \\length, TempoClock.default.tempo*(3/8), \\fb, 0.7, \\sep, 0.0012], addAction: \\addToTail);\n\n// send something\nplay{ Out.ar(~bus, LFGauss.ar(1, 0.1, loop:0, doneAction:2) * Blip.ar(80!2, 8)) }\n\n// turn it off\n~echo.free;\n```"}, {"role": "assistant", "content": "Fork of Bjorn's Dub echo, rewritten w/o the Feedback Quark (using LocalIn + LocalOut) and adding a ping pong (can be removed by deleting the .reverse method in the LocalOut line)."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Event` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\pm, { |out = 0, freq = 440, amp = 0.1, pan = 0, gate = 1, ratio = 1, index = 1, ar = 0.1, dr = 0.1|\n var z;\n z = LPF.ar(\n PMOsc.ar(freq, freq * ratio, Linen.kr(gate, ar, index, dr), 0, 0.3),\n XLine.kr(Rand(4000, 5000), Rand(2500, 3200), 1)\n ) * Linen.kr(gate, 0.01, 0.7, dr, 2);\n OffsetOut.ar(out, Pan2.ar(z, pan, amp));\n}).add;\n);\n\n(instrument: \\pm).play;\n\n(instrument: \\pm, ratio: 3.42, index: 12, freq: 150, ar: 8, dr: 3, sustain: 10).play;\n```"}]} +{"conversations": [{"role": "user", "content": "Saving \"Presets\"?"}, {"role": "assistant", "content": "SuperCollider forum — Saving \"Presets\"?\n\nIf you don’t care too much about it being human readable, just use writeArchive and readArchive:\n\n```supercollider\na = Array.fill(400, {rrand(0,2200)});\n\na.writeArchive(\"/Users/spluta1/Documents/SC/test\");\n\nb = Object.readArchive(\"/Users/spluta1/Documents/SC/test\");\n\nb.postln;\n```\n\nSam"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `RunningSum`."}, {"role": "assistant", "content": "```supercollider\n// distorts of course - would need scaling\n{ RunningSum.ar(SoundIn.ar) }.play\n\n// Running Average over x samples\n(\n{\n var x = 100;\n RunningSum.ar(LFSaw.ar, x) * (x.reciprocal)\n }.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `MouseY`."}, {"role": "assistant", "content": "```supercollider\n{ SinOsc.ar(MouseY.kr(40, 10000, 1), 0, 0.1) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `SynthDef`?"}, {"role": "assistant", "content": "SynthDef — Client-side representation of a synth definition"}, {"role": "user", "content": "What does `SynthDef.new` do?"}, {"role": "assistant", "content": "Create a SynthDef instance, evaluate the ugenGraphFunc and build the ugenGraph."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_notRand, { |out|\n Out.ar(out,\n SinOsc.ar(rrand(400, 800), 0, 0.2) * Line.kr(1, 0, 1, doneAction: Done.freeSelf)\n )\n}).add;\n);\na = Synth(\\help_notRand);\nb = Synth(\\help_notRand); // the same freq as a\n```"}]} +{"conversations": [{"role": "user", "content": "What does `ServerGui.input` do? What arguments does it take?"}, {"role": "assistant", "content": "an alternate small server view Arguments: layout; width."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n( //testing RecCutProc\nvar sf;\nvar rcdat;\n\nRoutine.run({\n\nsf= BBCutBuffer(Platform.resourceDir +/+ \"sounds/break.aiff\",8);\n\ns.sync;\n\n//argument 1-cut positions, 16 is wraparound, necessary for calculating differences\n//arg 2- offsets at any given of the 16 quantised positions along the sample length\n//arg 3- but cut up choosing blocks of size 3, 4, etc units (units must total 16 here)\n//units are taken across phraselength, so with phrase 8.0, one unit= 8.0/16= 0.5 = eighth notes\nrcdat= RCutData.new([0,4,7,10,12,15,16],[0\n// …\n```"}, {"role": "assistant", "content": "argument 1-cut positions, 16 is wraparound, necessary for calculating differences arg 2- offsets at any given of the 16 quantised positions along the sample length (RecCutProc: Recursive breakbeat cutting)"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n var freqs = [200, 600, 400, 450, 150, 20, 800];\n var amps = Saw.ar(freq: [2,3, 5]).range(1, 0.5, 0.3, 0.8);\n var snd = LFTri.ar(freq: freqs, mul: amps);\n Mix.ar(snd)\n}.play;\n)\n```"}, {"role": "assistant", "content": "LFTri that plays in a single channel with frequent amplitude shifts."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `JITGui`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// typically, only subclasses of JITGui are used,\n // so here are just some basic usage and layout tests\n\n // make its own window - defPos, minSize is used\ng = JITGui(Ndef(\\a));\n\n // make its own window, specific size\ng = JITGui(Ndef(\\a), bounds: 390@20);\n\n // provide full bounds\ng = JITGui(Ndef(\\a), bounds: Rect(200, 500, 390, 24));\n\n // extent is 0@0: minSize x, y is used\ng = JITGui(Ndef(\\a), bounds: Rect(200, 500, 0, 0));\ng = JITGui(Ndef(\\a), bounds: Rect(200, 500, 0, 50));\ng = JITGui(Ndef(\\a), bounds: Rect(200, 500, 500, 0));\n\n\n( // put a JITGui in an existing window:\nw = Window().front;\ng = JITGui(Ndef(\\a), 0, w, bounds: 300@48);\n);\n\n( // 5 lines high\nw = Window().front;\ng = JITGui(Ndef(\\a), 5, w);\n);\n\n( // recommended: use a FlowLayout.\nw = Window().front;\nw.addFlowLayout;\nEZSlider(w, 300@100, \\test, []);\ng = JITGui(Ndef(\\a), 0, w, bounds: 300@40);\n);\n\n// test changing color schemes for JITguis\n// this scheme is admittedly ugly but different\n\nGUI.skins.put(\\jit, (\n fontSpecs: [\"Inconsolata\", 12],\n fontColor: Color.white,\n background: Color(0.2, 0.85, 0.7, 0.5),\n foreground: Color.grey(0.1),\n onColor: Color(0.5, 0, 0.5),\n onColor2: Color(0.0, 0.5, 0.5),\n offColor: Color.grey(0.2, 0.5),\n hiliteColor: Color.green(1.0, 0.5),\n gap: 0 @ 0,\n margin: 2@2,\n buttonHeight: 18,\n headHeight: 24)\n);\n\n// make some JITGuis to check\nn = NdefGui(Ndef(\\a));\nNdef(\\a, { SinOsc.ar(\\freq.kr(250)) });\nNdef(\\a).clear;\nn = NdefMixer(s);\n\nTdefAllGui();\nTdef(\\a).set(\\amp, 0.25);\nTdefGui(Tdef(\\a), 5);\n\nEnvirGui((a: 123));\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n{ Hasher.ar(Line.ar(0, 1, 1), 0.2) }.play;\n\n// Even adding a small amount to the input can result in a very different output. Compare these two examples:\n(\n{\n SinOsc.ar(\n Hasher.kr(MouseX.kr(0, 10).round(1), 300, 500)\n ) * 0.1\n}.play;\n);\n\n(\n{\n SinOsc.ar(\n Hasher.kr(MouseX.kr(0, 10).round(1) + 0.0001, 300, 500)\n ) * 0.1\n}.play;\n);\n\n// Output stays constant while not moving the mouse.\n(\n{\n SinOsc.ar(\n Hasher.kr(MouseX.kr(0, 10), 300, 500)\n ) * 0.1\n}.play;\n)\n```"}, {"role": "assistant", "content": "Even adding a small amount to the input can result in a very different output. Compare these two examples: Output stays constant while not moving the mouse. (Hasher: Scrambled value with a hash function.)"}]} +{"conversations": [{"role": "user", "content": "What is `PSloop` in SuperCollider?"}, {"role": "assistant", "content": "PSloop — Pattern to derive loops from a given Pattern Although PSloop is not a subclass of PStream, instances of PSloop have a state by storing a PStream of the source pattern in an instance variable. So the specific characteristics of PSx patterns are indirectly inherited by PSloop. This especially concerns the way to generate new, fresh PSloop streams, see examples in PSx_stream_patterns. Category: Libraries > miSCellaneous > PSx stream patterns, Streams-Patterns-Events > PSx stream patterns."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// mouse-controlled param\n{ StandardN.ar(SampleRate.ir/2, MouseX.kr(0.9, 4)) * 0.3 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// mouse-controlled param\n{ StandardN.ar(SampleRate.ir/2, MouseX.kr(0.9, 4)) * 0.3 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for simple smooth arp. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\smooth, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.linen(0.05, sustain, 0.1), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = { |x, root = 60| x + root }; b = a.midicps; [a.value(9), b.value(9)];\na = Pseries(60, 1, inf).midicps; a.asStream.nextN(12);\n{ a = LFNoise1.ar(1) * 5 + 60; Pulse.ar(a.round.midicps * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = { |x, root = 60| x + root }; b = a.midicps; [a.value(9), b.value(9)];\na = Pseries(60, 1, inf).midicps; a.asStream.nextN(12);\n{ a = LFNoise1.ar(1) * 5 + 60; Pulse.ar(a.round.midicps) * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `ObjectWithArgs.keys` do?"}, {"role": "assistant", "content": "(put short description here) Returns: array of keys"}]} {"conversations": [{"role": "user", "content": "What is `Node`?"}, {"role": "assistant", "content": "Node — Abstract superclass of Synth and Group"}, {"role": "user", "content": "What does `Node.free` do?"}, {"role": "assistant", "content": "Stop this Node and free it from its parent group on the server. Once a Node has been freed, you cannot restart it."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\nx = Synth(\"default\");\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for strange device found in space )\r\n\r\np.s?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n Limiter.ar(HPF.ar(\n GVerb.ar(\n Pan2.ar(\n PMOsc.ar(\n Demand.kr(\n Impulse.kr(\n SinOsc.kr(SinOsc.kr(1/30).range(1/10, 1/15)).range(0, 25)\n * LFPulse.kr(0.2).range(0.5, 1)\n + \n LFDNoise3.kr(1/10, 10, 10)\n ), \n 0, \n Dxrand(Array.geom(100, 50, 1.06), inf) + Dgeom(1, 1.005)\n ),\n [[3,5],[7,11]] + SinOsc.ar([1/60, 1/45]).range(0, 1300),\n Demand.kr(\n Impulse.kr(SinOsc.kr(0.1).range(0.1, 20)),\n 0,\n Dxrand(Array.series(13, 0, 0.5), inf)\n )\n ).sum,\n SinOsc.ar(1, mul:0.5),\n LFPar.ar([1/5,1/3]).range(0.3, 1)\n ), \n 250, \n 0.5, \n damping:SinOsc.kr(1/20).range(0.2,0.7), \n drylevel: SinOsc.kr(1/15).range(0.2,0.7), \n earlyreflevel:0.3\n ) * 0.1\n +\n LFDNoise3.ar(SinOsc.kr(1/15, [0, pi/4]).range(100,350), 0.3),\n [SinOsc.ar(1/45, [0,pi/2]).range(20, 120)]\n ))\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\nb = Bus.control(s, 1); b.set(880);\nc = Bus.control(s, 1); c.set(884);\nx = SynthDef(\"help-Node-map\", { |out, freq1 = 440, freq2 = 440|\n Out.ar(out, SinOsc.ar([freq1, freq2], 0, 0.1));\n}).play\n);\nx.map(\\freq1, b, \\freq2, c);\nx.free; b.free; c.free;\n\n// same as above with a multichannel Bus and Control\n(\nb = Bus.control(s, 2);\nb.set(880, 884);\nx = SynthDef(\"help-Node-map2\", { |out, freqs =\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\nb = Bus.control(s, 1); b.set(880);\nc = Bus.control(s, 1); c.set(884);\nx = SynthDef(\"help-Node-map\", { |out, freq1 = 440, freq2 = 440|\n Out.ar(out, SinOsc.ar([freq1, freq2], 0, 0.1));\n}).play\n);\nx.map(\\freq1, b, \\freq2, c);\nx.free; b.free; c.free;\n\n// same as above with a multichannel Bus and Control\n(\nb = Bus.control(s, 2);\nb.set(880, 884);\nx = SynthDef(\"help-Node-map2\", { |out, freqs = #[440, 440]|\n Out.ar(out, SinOsc.ar(freqs, 0, 0.1));\n}).play\n);\n\nx.map(\\freqs, b);\nx.free; b.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for some initial thoughts on psytrance bassline."}, {"role": "assistant", "content": "```supercollider\n(\n{ | dur = 0.15, atk = 0.005, amp = 1 |\n SinOsc.ar(\n EnvGen.ar( Env(\n NamedControl.kr(\\freq_l, [2960, 70, 90]),\n NamedControl.kr(\\freq_d, [0.07, 0.2]),\n NamedControl.kr(\\freq_c, [-13, -1]),\n ) ),\n mul:amp * EnvGen.ar(\n Env.perc( atk, dur - atk, curve: NamedControl.kr(\\amp_c, [-1, 6])),\n doneAction: 2\n ); \n ) ! 2;\n}.asSynthDef.name_(\"kick\").add;\n\n{ | atk = 0.01, dur = 0.15, freq = 50, amp=0.8 |\n BPF.ar(LFSaw.ar(freq), freq, 2, mul: EnvGen.kr( Env.perc( atk, dur-atk, amp, 6 ), doneAction: 2 )) ! 2;\n}.asSynthDef.name_(\"bass\").add;\n\n{ | dur = 0.15, freq = 50, amp = 0.8, index = 10 |\n PMOsc.ar(freq, freq + 5, index, mul: amp * EnvGen.kr( Env.triangle( dur ), doneAction: 2 )) ! 2;\n}.asSynthDef.name_(\"bazz\").add;\n);\n\n\n(\nPpar([\n Pbind(*[\n instrument: \\kick,\n delta: 1,\n dur: Pfunc({ thisThread.clock.beatDur }) / 4,\n amp: Pseq([\n Pseq([1], 16),\n Pseq([0.8, 1], 8), \n Pseq([1], 16),\n Pseq([0.8, 0.8, 0.9, 1], 8)\n ], inf) * 0.8,\n freq_l: Pstutter(Prand(2.pow((1..4)),inf), Pseq([\n `[2960,70,90],\n `[1260,60,110],\n `[4360,60,120]\n ],inf))\n ]),\n Pbind(*[\n instrument: \\bass,\n delta: 1/4,\n dur: Pkey(\\delta) * Pfunc({ thisThread.clock.beatDur }),\n freq: Pseq([\\r, 50,60,70], inf),\n amp:0.6\n ]),\n Pbind(*[\n instrument: \\bazz,\n delta: 1/4,\n dur: Pkey(\\delta) * Pfunc({ thisThread.clock.beatDur }),\n freq: Pseq([\\r, 30,35,40], inf),\n amp:0.2\n ])\n]).play(TempoClock(156/60), quant:[1])\n);\n\n// kick from above?\n(\nPbind(*[\n instrument: \\kick,\n delta: Pseq(Array.geom(540, 1, 1.015).reciprocal.reverse),\n dur: Pkey(\\delta) * Pfunc({ thisThread.clock.beatDur }),\n atk: Pkey(\\dur) / 6,\n amp: 0.8\n]).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n/* Audio plugin definition\n\n Each audio plugin should define the following global variables:\n ~name: (symbol) name of the spatializer\n ~description: (string) a short description\n ~function: the actual definition of the plugin\n\n*/\n\n~name = \\testtone;\n~description = \"a standard test tone (sine)\";\n~channelLayout = \\mono;\n\n~function = {| sfreq = 200 |\n FSinOsc.ar(sfreq)\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nx = SynthDef(\\test, {\n Out.ar(0, \n Formants.ar(420, Vowel(\\a).addControls(3)) * 0.01\n )\n}).play\n);\n\nx.inspect\n\nx.setn(*Vowel(\\i).asKeyValuePairs(3);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nx = SynthDef(\\test, {\n Out.ar(0, \n Formants.ar(420, Vowel(\\a).addControls(3)) * 0.01\n )\n}).play\n);\n\nx.inspect\n\nx.setn(*Vowel(\\i).asKeyValuePairs(3));\n```"}]} -{"conversations": [{"role": "user", "content": "Rand or rand difference?"}, {"role": "assistant", "content": "SuperCollider forum — Rand or rand difference?\n\nI think you meant to compare Rand and rrand (not rand) – both generate a random number between a given low and high, but Rand is intended to be used inside a SynthDef and the behavior is slightly different. Compare:\n\n```supercollider\n(\nSynthDef(\\test, {\n var freq = rrand(400, 600);\n Out.ar(0, SinOsc.ar(freq) * 0.2);\n}).add;\n);\n\nSynth(\\test); // run and stop multiple times: always same freq\n\n(\nSynthDef(\\test2, {\n var freq = Rand(400, 600);\n Out.ar(0, SinOsc.ar(freq) * 0.2);\n}).add;\n);\n\nSynth(\\test2); // run and stop multiple times: every time a different freq\n```\n\nAs you can read in the help file, Rand is intended to be used inside SynthDefs when you want the particular behavior of a newly generated random frequency for each Synth called. You can use rrand(lo, hi) inside a SynthDef too, if you want the random number to be generated only once at time of SynthDef creation (it gets “inscribed in the recipe” for good), so all future and all Synth calls based on that SynthDef to use on that same random number.\n\nAs a side note, rand (as opposed to rrand) generates a random number between zero and the receiver:\n\n```supercollider\nrand(8); // random numbers between 0 and and 8 (excluding 8)\n\nrand(0.5, 8); // random numbers between 0 and 0.5; second argument is ignored here\n```\n\nAlso in regards to the specific way you present the example (as Functions, indicated by the curly braces): note the difference when you evaluate them:\n\n```supercollider\n{Rand(0.5,8)}.value; // returns 'a Rand'\n{rrand(0.5,8)}.value; // returns an actual random choice between lo and hi\n```\n\nHope this helps,\n\nB"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n{var a=LFNoise0,b=SinOscFB,c=Pulse;b.ar(a.ar([2,3])*(c.ar([5,7],b.kr([7,5]))*(a.ar([3,2]))*[800,1200]),(c.kr([100,80])*[2,3]))}.play\n```"}, {"role": "assistant", "content": "dirty and noisy \"result\" of remembering/learning sc again. still dont understand why it does not work when i move .ar/kr to var definition. hh... will turn it into synthdef..."}]} -{"conversations": [{"role": "user", "content": "What does `SimpleNumber.sphNeumann` do?"}, {"role": "assistant", "content": "Returns the result of the spherical Bessel functions of the first kind. Requires `x` >"}]} -{"conversations": [{"role": "user", "content": "Do is not ¨returning¨ array (campanology)?"}, {"role": "assistant", "content": "SuperCollider forum — Do is not ̈returning ̈ array (campanology)\n\nYou can remove the need for all mutable variables by computing the indexes to swap first - these are stored in indexesEven and indexesOdd.\n\nThen an array of functions is made (swappers)...i.e.[indexesEven, indexesOdd, indexesEven....]\n\nFinally, .inject is used to chain these together, taking the previous result as the input to the next and building an array.\n\n```supercollider\n(\n~swap_sort_steps = {\n |parts|\n var swapConsequtiveIndexes = {|from, to|\n (from..to).clump(2).collect{|p| p.reverse }.flat\n };\n var indexesEven = swapConsequtiveIndexes.(0, parts - 1);\n var indexesOdd = [0] ++ swapConsequtiveIndexes.(1, parts - 1);\n var swappers = parts.collect{ |n|\n {|toSwap| if(n.even)\n { indexesEven.collect{|i| toSwap[i]} }\n { indexesOdd.collect{|i| toSwap[i]} }\n }\n };\n postf(\"indexesEven : %\\nindexesOdd : %\\n\", indexesEven, indexesOdd);\n swappers.inject( [(0..parts-1)], {\n |col, f|\n col ++ [f.(col.last)]\n });\n};\n)\n```\n\nAlso, as I’m sure you know, if anyone else is reading who doesn’t know what this is... its a swap sort algorithm."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes morning on Gliese 667Cb."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var gen = { rrand(1,10).reciprocal };\n BPF.ar(\n SelectX.ar(LFNoise2.kr(gen!4).exprange(0.02,2), [BrownNoise.ar, WhiteNoise.ar, PinkNoise.ar]).mean,\n LFNoise2.ar(gen!8).exprange(20,2e4),\n LFNoise2.ar(gen!8).exprange(0.1,2),\n LFNoise2.ar(gen!8).range(0.1,1)\n ).clump(2).mean\n + FreeVerb.ar(\n LFPar.ar(\n LFNoise2.ar(gen!8).exprange(20,2e4) * SinOsc.ar(1/gen!8).exprange(1,1.2), 0,\n LFNoise2.ar(gen!8).exprange(0.08,0.5) * EnvGen.ar(\n Env.perc.blend(Env.sine, LFNoise2.kr(gen!8)).circle, \n timeScale: gen!8 // LFNoise2.ar(gen!8).range(1/5, 5)\n )\n ).clump(2).mean,\n LFNoise2.ar(1/5)\n ) \n + Pan2.ar(\n Pluck.ar(\n WhiteNoise.ar ! 2,\n Dust.ar(LFNoise2.kr(gen!2).exprange(1/5,5)), \n 1/200, LFNoise2.kr(gen!2).exprange(1/14000,1/200),\n LFNoise2.kr(gen!2).range(1,10),\n LFNoise2.kr(gen!2).range(0,1),\n LFNoise2.kr(gen!2).exprange(0.2,1)\n ),\n LFNoise2.kr(gen!2).range(-1,1)\n ).sum\n / 3;\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\smooth, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.linen(0.05, sustain, 0.1), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n)\n```"}, {"role": "assistant", "content": "plays an arpeggio on the \"left hand\" and an arpeggio on the \"right hand\"."}]} -{"conversations": [{"role": "user", "content": "What does `Function.performKeyValuePairs` do? What arguments does it take?"}, {"role": "assistant", "content": "`a = { |a, b, c| postf(\"% plus % plus % is %\\n\", a, b, c, a Arguments: selector — A Symbol representing a method selector.; pairs — Array or List with key-value pairs.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a, b;\na = Pset(\\freq, 801, Pbind(\\dur, 0.5));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a, b;\na = Pset(\\freq, 801, Pbind(\\dur, 0.5));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is Env.perc and what does it take?"}, {"role": "assistant", "content": "`Env.perc(attackTime, releaseTime, level, curve)` — an attack to `level` (default 1) then a decay to zero, with curve defaulting to -4 (an exponential-ish decay). `Env.perc(0.01, 1)` is the default percussive envelope, and it is a complete Env, not a generator: pair it with EnvGen to hear it."}]} -{"conversations": [{"role": "user", "content": "What does `ArrayedCollection.plot` do?"}, {"role": "assistant", "content": "Plot values in a GUI window. See plot for more details. When the receiver contains `nil` items, the plot fails with an"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Random deep fryer?"}, {"role": "assistant", "content": "```supercollider\n// random deep fryer. can turn in to rain, waves and other stuff.\n// nice with multichannel iteration. Change number at \"!2\".\n// volume compensation for high quality filter with \"1/q.sqrt\" for mul in BPF.\n// variable \"dist\" for distortion, increasing can go loud, decrease \"amp\" if so.\n// LFNoise1 with noisefreq,noisemul,noiseoffset gives it the wavy feel.\n\n(\nSynthDef(\\friture, {\n arg amp=0.5, dist=2, dens=12, dustamp=1, offset=0, noisefreq=2, noisemul=2,\n noiseoffset=0, frq1=200, frq2=2500, rq1=0.5, rq2=0.1, out=0;\n\n var sig, env;\n\n sig = {BPF.ar((Dust2.ar(dens, dustamp, offset)*LFNoise1.ar(noisefreq,noisemul,noiseoffset)),rrand(frq1,frq2),q=rrand(rq1,rq2),1/q.sqrt)}!2;\n sig = (sig*dist).tanh*amp;\n\n\n Out.ar(out,sig);\n\n }).add;\n);\n\ny = Synth.new(\\friture);\ny.free;\n\ny.set(\\dens,161);\ny.set(\\amp,0.5);\ny.set(\\dist,1);\ny.set(\\rq1,0.2);\ny.set(\\rq2,0.4);\ny.set(\\frq1,133);\ny.set(\\frq2,193);\ny.set(\\noisefreq,1);\ny.set(\\noisemul,2);\ny.set(\\noiseoffset,(-2));\ny.set(\\out,0);\n```"}]} -{"conversations": [{"role": "user", "content": "How do I play a sample from disk?"}, {"role": "assistant", "content": "Load it into a Buffer on the server, then play the buffer. `BufRateScale` keeps the pitch right when\nthe file's sample rate differs from the server's.\n\n```supercollider\n(\ns.waitForBoot {\n ~buf = Buffer.read(s, \"C:/sounds/break.wav\");\n SynthDef(\\player, { |out = 0, buf = 0, amp = 0.6, rate = 1|\n var sig = PlayBuf.ar(2, buf, BufRateScale.kr(buf) * rate, loop: 1);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n ~player = Synth(\\player, [\\buf, ~buf]);\n};\n)\n```\nUse `numChannels` 1 for a mono file; a mismatch is silent or wrong-sounding rather than an error."}]} -{"conversations": [{"role": "user", "content": "What does `PLhprand.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new PLhprand Arguments: lo — Symbol or Phprand lo arg. If a Symbol is passed, list can be assigned to an envir variable later on. Can be dynamically replaced by Patterns or Streams. Defaults to 0.; hi — Symbol or Phprand hi arg. If a Symbol is passed, list can be assigned to an envir variable later on. Can be dynamically replaced by Patterns or Streams. Defaults to 1.; length — Symbol or Phprand length arg. If a Symbol is passed, list can be assigned to an envir variable later on. Defaults to inf.; envir — Dictionary or one of the Symbols \\top, \\t (topEnvironment), \\current, \\c (currentEnvironment). Dictionary to be taken for variable reference. Defaults to \\current.."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Extra Demos for \\apadMH SynthDef."}, {"role": "assistant", "content": "```supercollider\n// Extra Demos for \\apadMH SynthDef\n\n\n(\n// made by Diya Menon\n// inspired by Eastside\n// demo\nPbindef(\\dmapadMH2,\n \\instrument, \"apadMH\",\n \\midinote, Pseq([\n 73, 73, 73, 73, 69, 71, 71, 71, 69, 69, 69, 69, 69, 64, 69, 69, 69, 69,\n [57, 61, 52, 69, 73, 64],\n [56, 59, 51, 68, 71, 63],\n [61, 64, 56, 73, 76, 68],\n [54, 57, 49, 66, 69, 61],\n [54, 57, 49, 66, 69, 61],\n [56, 59, 51, 68, 71, 63],\n [57, 61, 52, 69, 73, 64],\n ]),\n \\amp, Pseq([\n Pn([0.075], 18),\n 0.081, 0.065, 0.075, 0.1, 0.065, 0.05, 0.1\n ]),\n \\dur, Pseq([\n Pn(0.17, 3), 0.34,\n Pseq([Pn(0.17, 4), 0.34], 2),\n Pn(0.17, 4),\n 1.5, 0.75, 0.75, 1.5, 0.75, 0.75, 1.5]),\n \\rel, Pgeom(0.01, 1.25),\n \\reverbMix, 0\n).play;\n);\n\n(\n// by Bruno Ruviaro\nPbindef(\\apadMH2,\n \\instrument, \"apadMH\",\n \\degree, Pwhite(-10, 15, inf),\n \\amp, Pwhite(0.06, 0.2, inf),\n \\mtranspose, Prand([\n 0,\n [0, 4],\n 0,\n [0, 5, 7]\n ], inf),\n \\dur, Prand([1, 2, 2.6], inf),\n \\att, Pwhite(0.9, 1.5),\n \\rel, 6, //Pn(Pgeom(0.01, 1.25), inf),\n \\legato, 1,\n \\vibratoRate, Pwhite(2.0, 4.0, inf),\n \\vibratoDepth, Pwhite(0.005, 0.02, inf),\n \\reverbMix, 0.2\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for blaplop (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\bla, { arg out=0, amp=0.1, gate=1, pan=0, freq=200;\n var sig;\n var tab;\n tab = \\tab.kr(1 ! 15);\n sig = LFSaw.ar(freq * tab.abs);\n sig = sig.sum;\n sig = RLPF.ar(sig, Rand(10,freq*2) + 100 * SinOsc.ar(tab.abs).range(0.01,Rand(2,7)));\n sig = sig.sum;\n sig = sig / 100;\n sig = sig.tanh;\n sig = sig * EnvGen.ar(Env.adsr(0.01,0.1,0.8,0.1+ExpRand(0.001,0.2)),gate,doneAction:2);\n sig = Pan2.ar(sig, pan, amp);\n Out.ar(out, sig);\n}).add;\n);\n\n(\nPdef(\\plop, Pbind(\n \\instrument, \\bla,\n \\degree, Pstep(Pseq([\n Pseq([0,2,4],4),\n Pseq([0,12,6],4),\n Pseq([0,12,6]+7,1),\n ],inf), 1),\n \\octave, 3,\n \\tab, Pfunc {\n var tab;\n [\n //tab = { arg n; (n + 1.asFloat.rand + 1).tanh / (n.rand+1) } ! 15;\n tab = { arg n; (n + 2.asFloat.rand + 1) / (n+1) } ! 15;\n tab.postln;\n ]\n },\n \\dur, PdurStutter( Prand([1,2,4],inf), Pseq([1,2,3]/2,inf)),\n \\amp, 0.4\n)).play;\n);\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `Psetpre` in SuperCollider briefly."}, {"role": "assistant", "content": "Psetpre — set values of one key in an event before it is passed up Sets a value in an event, before it is passed up the stream. To set the value after it has been passed to the stream, use Pset. `(` Category: Streams-Patterns-Events > Patterns > Filter."}]} +{"conversations": [{"role": "user", "content": "What does `PLbindefPar.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new PLbindefPar object or sets sources of an existing Arguments: ... args — First arg should be the name, followed by num, the number of parallel PLbindefs, and the key/value pairs. Values are assigned to single PLbindefs according to the convention of PLbindefParEnvironment#-put, see there and examples below. The last arg can be an optional environment which determines whe."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Mix`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var n;\n n = 8; // number of 'voices'\n Mix.new( // mix all stereo pairs down.\n Pan2.ar( // pan the voice to a stereo position\n CombL.ar( // a comb filter used as a string resonator\n Dust.ar( // random impulses as an excitation function\n // an array to cause expansion of Dust to n channels\n // 1 means one impulse per second on average\n Array.fill(n, 1),\n 0.3 // amplitude\n ),\n 0.01, // max delay time in seconds\n // array of different random lengths for each 'string'\n Array.fill(n, {0.004.rand+0.0003}),\n 4 // decay time in seconds\n ),\n Array.fill(n,{1.0.rand2}) // give each voice a different pan position\n )\n )\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nVowel().brightenLin(-1).dBs.postln; \nVowel().brightenLin( 0).dBs.postln;\nVowel().brightenLin( 1).dBs.postln;\n\n// refFormant = 0 loud on the left\n{Formants.ar(100, Vowel().brightenLin(MouseX.kr(0, 20), 0 )) * 0.1}.play\n// refFormant = 1\n{Formants.ar(100, Vowel().brightenLin(MouseX.kr(0, 20), 1 )) * 0.1}.play\n// refFormant = 2\n{Formants.ar(100, Vowel().brightenLin(MouseX.kr(0, 20), 2 )) * 0.1}.play\n// refFormant = 3\n{Formants.ar\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nVowel().brightenLin(-1).dBs.postln; \nVowel().brightenLin( 0).dBs.postln;\nVowel().brightenLin( 1).dBs.postln;\n\n// refFormant = 0 loud on the left\n{Formants.ar(100, Vowel().brightenLin(MouseX.kr(0, 20), 0 )) * 0.1}.play\n// refFormant = 1\n{Formants.ar(100, Vowel().brightenLin(MouseX.kr(0, 20), 1 )) * 0.1}.play\n// refFormant = 2\n{Formants.ar(100, Vowel().brightenLin(MouseX.kr(0, 20), 2 )) * 0.1}.play\n// refFormant = 3\n{Formants.ar(100, Vowel().brightenLin(MouseX.kr(0, 20), 3 )) * 0.1}.play\n// refFormant = 4 loud on the right\n{Formants.ar(100, Vowel().brightenLin(MouseX.kr(0, 20), 4 )) * 0.1}.play\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BrownNoise`."}, {"role": "assistant", "content": "```supercollider\n{ BrownNoise.ar(0.1) }.play;\n{ WhiteNoise.ar(0.1) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `PulseDivider`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\"help-PulseDivider\", { |out = 0|\n var p, a, b;\n p = Impulse.ar(8);\n a = SinOsc.ar(1200, 0, Decay2.ar(p, 0.005, 0.1));\n b = SinOsc.ar(600, 0, Decay2.ar(PulseDivider.ar(p, 4), 0.005, 0.5));\n\n Out.ar(out, (a + b) * 0.4)\n}).play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a;\na = Pexprand.new(0.0001, 1, inf);\nc = a.asStream.nextN(500);\n// plot the values\nc.plot(bounds: Rect(10, 10, 520, 380), discrete: true, parent: w);\n// a histogram of the values\nc.histo(500).plot(bounds: Rect(10, 410, 520, 380), parent: w);\n);\n\n// sound example\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq,\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a;\na = Pexprand.new(0.0001, 1, inf);\nc = a.asStream.nextN(500);\n// plot the values\nc.plot(bounds: Rect(10, 10, 520, 380), discrete: true, parent: w);\n// a histogram of the values\nc.histo(500).plot(bounds: Rect(10, 410, 520, 380), parent: w);\n);\n\n// sound example\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n(\nvar a;\na = Pexprand(0.0001, 1.0, inf).asStream;\n{\n loop {\n Synth(\\help_sinegrain, [\\freq, a.next * 600 + 300]);\n 0.02.wait;\n }\n}.fork;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for electric hum: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\eHum).addSpec(\\fFreq, ControlSpec(25, 1000, \\lin, step: 25));\nNdef(\\eHum).addSpec(\\fRq, [0.01, 0.2]);\nNdef(\\eHum).addSpec(\\fFreqIdx, [0, 8, \\lin, 0.2]);\nNdef(\\eHum).fadeTime = 2;\n\nNdef(\\eHum, {|fFreqIdx = 1, fRq = 0.1|\n var src = Impulse.ar([50, 75, 100]); // three sources\n var fFreq = (25 * (2 ** fFreqIdx));\n\n Splay.ar((BPF.ar(src, fFreq, fRq))* 8)\n})\n);\n\nNdef(\\eHum).gui;\n```"}]} +{"conversations": [{"role": "user", "content": "In what order should I learn SuperCollider?"}, {"role": "assistant", "content": "The order that pays off fastest:\n\n1. **One UGen and Out** — `{ SinOsc.ar(440) * 0.2 }.play`. Learn that a graph must reach Out.\n2. **Envelopes and doneAction** — the difference between a sound and a click.\n3. **SynthDef and Synth** — naming a graph, controlling it with arguments, freeing it with a gate.\n4. **Patterns** — `Pbind` for sequence, so you stop writing loops by hand.\n5. **Buses and effects** — chaining, sends, groups.\n6. **JITLib** — Ndef for patches you modify while they play.\n\nVocabulary to carry: UGen, SynthDef, Synth, bus, group, envelope, gate, doneAction, Pattern, clock. Every\nconfusion in SuperCollider tends to be one of those words."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// default params\n{ QuadN.ar(SampleRate.ir/4) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// default params\n{ QuadN.ar(SampleRate.ir/4) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `CondVar.signalOne` do?"}, {"role": "assistant", "content": "Wakes one thread waiting on this Condition. Threads are woken in the order in which they called `wait` or `waitFor`. If a thread is woken and was waiting with a predicate, and that predicate is still `false`, it will `wait` again and be placed at the end of the queue of threads waiting on this CondVar. Another thread will not be woken in that Returns: this object"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// logistic map\n// equation: x1 = -r*x0^2 + r*x0\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n QuadN.ar(SampleRate.ir/4, r.neg, r, 0, 0.1) * 0.4;\n}.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// logistic map\n// equation: x1 = -r*x0^2 + r*x0\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n QuadN.ar(SampleRate.ir/4, r.neg, r, 0, 0.1) * 0.4;\n}.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Pulse`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\\harpsi, { |outbus = 0, freq = 440, amp = 0.1, gate = 1|\n var out;\n out = EnvGen.ar(Env.adsr, gate, doneAction: Done.freeSelf) * amp *\n Pulse.ar(freq, 0.25, 0.75);\n Out.ar(outbus, out ! 2);\n}).add; // see below for more on .add\n\np = Pbind(\n // Use \\harpsi, not \\default\n \\instrument, \\harpsi,\n \\degree, Pseries(0, 1, 8),\n \\dur, 0.25\n).play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `ServerLog.remove` do?"}, {"role": "assistant", "content": "records OSC traffic to and from a Server and displays this in a browseable searchable interface Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Pwrap` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Pn(\n Pwrap(\n Pgeom(200, 1.07, 96),\n 200,\n 1000.0\n ),\n inf\n);\nx = a.asStream;\n\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, x.next.debug, \\dur, 0.3]);\n 0.12.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Sieve.segmentBetween` do? What arguments does it take?"}, {"role": "assistant", "content": "Returns a new Sieve of mode 'points' with Integers greater than lo and less than hi. This method is more efficient than applying segmentGreater plus Arguments: lo — Integer.; hi — Integer.."}]} +{"conversations": [{"role": "user", "content": "Explain `BusSpec` in SuperCollider briefly."}, {"role": "assistant", "content": "BusSpec — datatype specifying a Bus object Category: Spec, Libraries > crucial > Spec."}]} +{"conversations": [{"role": "user", "content": "What is a SynthDef?"}, {"role": "assistant", "content": "A SynthDef is a named, compiled server-side instrument: a UGen graph plus named controls. You build one with SynthDef(\\name, { |args| ... }).add, and then play instances with Synth(\\name)."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Stethoscope`."}, {"role": "assistant", "content": "```supercollider\ns.boot\n{ SinOsc.ar([330, 440], 0, 0.4) }.play;\nStethoscope(s, 2);\n```"}]} +{"conversations": [{"role": "user", "content": "In what order should I learn SuperCollider?"}, {"role": "assistant", "content": "The order that pays off fastest:\n\n1. **One UGen and Out** — `{ SinOsc.ar(440) * 0.2 }.play`. Learn that a graph must reach Out.\n2. **Envelopes and doneAction** — the difference between a sound and a click.\n3. **SynthDef and Synth** — naming a graph, controlling it with arguments, freeing it with a gate.\n4. **Patterns** — `Pbind` for sequence, so you stop writing loops by hand.\n5. **Buses and effects** — chaining, sends, groups.\n6. **JITLib** — Ndef for patches you modify while they play.\n\nVocabulary to carry: UGen, SynthDef, Synth, bus, group, envelope, gate, doneAction, Pattern, clock. Every\nconfusion in SuperCollider tends to be one of those words."}]} +{"conversations": [{"role": "user", "content": "What is `Stethoscope` in SuperCollider?"}, {"role": "assistant", "content": "Stethoscope — An oscilloscope Stethoscope provides a complete oscilloscope GUI. It displays a window containing a bus-plotting ScopeView and an interface to configure the plotting and choose among the buses. Category: GUI > Interfaces."}]} +{"conversations": [{"role": "user", "content": "What does `ScoreClock.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a new individual ScoreClock, mainly useful when there is need to run serveral clocks with different Arguments: tmp — Tempo in beats per second.."}]} +{"conversations": [{"role": "user", "content": "What is the difference between an audio bus and a control bus?"}, {"role": "assistant", "content": "Both are numbered channels on the server used to move signal between nodes. An audio bus carries audio-rate signal and holds one or more audio channels; a control bus carries one value per block, like a parameter. You write with Out.ar / Out.kr and read with In.ar / In.kr, or with `.asMap` / `\\param, bus.asMap` to drive a Synth's control from a bus. Buses are how effects are chained: a synth writes to a private bus, the effect reads it and writes to Out.ar(0, …)."}]} +{"conversations": [{"role": "user", "content": "What is `ProxySpace`?"}, {"role": "assistant", "content": "ProxySpace — an environment of references on a server"}, {"role": "user", "content": "What does `ProxySpace.push` do?"}, {"role": "assistant", "content": "replace the currentEnvironment with a new ProxySpace and clear the current one, if it is a ProxySpace (this is to avoid piling up proxy spaces). In order to move to another ProxySpace while keeping the current, use pop and then push a new one. To have multiple levels of proxy spaces, use .new.push;"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\np = ProxySpace.new;\np.fadeTime = 2; // fadeTime specifies crossfade\np[\\out].play; // monitor an empty placeholder through hardware output\n// set its source\np[\\out] = { SinOsc.ar([350, 351.3], 0, 0.2) };\np[\\out] = { Pulse.ar([350, 351.3] / 4, 0.4) * 0.2 };\np[\\out] = Pbind(\\dur, 0.03, \\freq, Pbrown(0, 1, 0.1, inf).linexp(0, 1, 200, 350));\n\n// route one proxy through another:\np[\\out] = { Ringz.ar(p[\\in].ar, [350, 351.3] * 8, 0.2) * 4 };\np[\\in] = { Impulse.ar([5, 7]/2, [0, 0.5]) };\n\np.clear(3); // clear after 3 seconds\n```"}]} +{"conversations": [{"role": "user", "content": "What does `LFDClipNoise.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Dynamic clipped noise Arguments: freq — Approximate rate at which to generate random values.; mul — Output will be multiplied by this value.; add — This value will be added to the output.."}]} +{"conversations": [{"role": "user", "content": "What does `Window.moveToBottom` do? What arguments does it take?"}, {"role": "assistant", "content": "Moves the window to the lowest usable screen position without overlapping system-reserved areas (e.g., taskbars, Arguments: margin — Adds vertical offset from the bottom.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Blip.ar(LFNoise0.kr(9, 400, 500), 4, 0.2 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Blip.ar(LFNoise0.kr(9, 400, 500), 4, 0.2) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Limiter` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\n// example signal to process\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n z * 0.8\n}.play\n);\n\n(\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n [z, Limiter.ar(z, 0.4, 0.01)] * 0.5\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `PLatch` in SuperCollider briefly."}, {"role": "assistant", "content": "PLatch — UGenPatterns quark library Based on Latch Category: Streams-Patterns-Events > UGenPatterns > Modifiers."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var f = { |l,h| SinOsc.kr(0.1, {pi.rand}).range(l, h) } ;\n Pulse.ar({ f.(20, 1000) }!6, { f.(0.0, 1) }!6, { f.(0.0, 1.0) }!6)\n}.play;\n);\n\nc = s.scope;\nc.numChannels = 6;\nc.scopeView.waveColors = [Color.red, Color.red, Color.cyan, Color.cyan, Color.white, Color.white;\nc.style = 2;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var f = { |l,h| SinOsc.kr(0.1, {pi.rand}).range(l, h) } ;\n Pulse.ar({ f.(20, 1000) }!6, { f.(0.0, 1) }!6, { f.(0.0, 1.0) }!6)\n}.play;\n);\n\nc = s.scope;\nc.numChannels = 6;\nc.scopeView.waveColors = [Color.red, Color.red, Color.cyan, Color.cyan, Color.white, Color.white];\nc.style = 2;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Change MembraneCircle to MembraneHexagon for a different shaped\n// circular drum head\ns.boot;\ns.reboot;\n(\n{ var excitation = EnvGen.kr(Env.perc,\n MouseButton.kr(0, 1, 0),\n timeScale: 0.1, doneAction: 0\n ) * PinkNoise.ar(0.4);\n var tension = MouseX.kr(0.01, 0.1);\n var loss = MouseY.kr(0.999999, 0.999, 1);\n MembraneCircle.ar(excitation, tension, loss);\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Change MembraneCircle to MembraneHexagon for a different shaped\n// circular drum head\ns.boot;\ns.reboot;\n(\n{ var excitation = EnvGen.kr(Env.perc,\n MouseButton.kr(0, 1, 0),\n timeScale: 0.1, doneAction: 0\n ) * PinkNoise.ar(0.4);\n var tension = MouseX.kr(0.01, 0.1);\n var loss = MouseY.kr(0.999999, 0.999, 1);\n MembraneCircle.ar(excitation, tension, loss);\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pulse`."}, {"role": "assistant", "content": "```supercollider\n// modulate frequency\n{ Pulse.ar(XLine.kr(40, 4000, 6), 0.1, 0.2) }.play;\n\n// modulate pulse width\n{ Pulse.ar(200, SinOsc.kr(0.2).range(0.01, 0.99), 0.2) }.play;\n\n// two band limited square waves thru a resonant low pass filter\n{ RLPF.ar(Pulse.ar([100, 250], 0.5, 0.1), XLine.kr(8000, 400, 5), 0.05) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Symbol`?"}, {"role": "assistant", "content": "Symbol — a unique name for something"}, {"role": "user", "content": "What does `Symbol.isClassName` do?"}, {"role": "assistant", "content": "Answer whether the symbol can be a class name. This does not say if the class exists. `\\Array.isClassName;`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na = { SinOsc.ar(\\freq.kr(440, 1.2)) }.play;\na.set(\\freq, 330);\na.release;\na = { SinOsc.ar(\\freq.kr([440, 460], 1.2)) }.play;\na.setn(\\freq, [330, 367]);\na.release;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// logistic map as frequency control\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n SinOsc.ar(QuadL.ar(40, r.neg, r, 0, 0.1, 800, 900)) * 0.4;\n}.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// logistic map as frequency control\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n SinOsc.ar(QuadL.ar(40, r.neg, r, 0, 0.1, 800, 900)) * 0.4;\n}.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SimpleNumber.fallingFactorial` do?"}, {"role": "assistant", "content": "Returns the falling factorial of `x` and `i`: `x(x-1)(x-2)(x-3)...(x-i+1)` This function is only defined for positive `i`. Argument `x` can be either positive or"}]} +{"conversations": [{"role": "user", "content": "What is `CondVar` in SuperCollider?"}, {"role": "assistant", "content": "CondVar — Condition variable: block one or more threads until some condition is true Category: Scheduling."}]} +{"conversations": [{"role": "user", "content": "What does `DataSequencer.factor` do?"}, {"role": "assistant", "content": "get or set the time scaling factor. For safety keep this slightly under"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nx = {\n |lookBack = 3, thr = 1|\n var trig = Impulse.ar(7);\n // for a non-integer source it makes sense to take a sufficiently large threshold thr\n var midi = Demand.ar(trig, 0, DIdev(SinOsc.ar(0.2, 0, 15, 82), 5, -6, 5, lookBack, thr: thr));\n midi.poll(7, label: \\midi);\n SinOsc.ar(midi.midicps.lag(0.007)) ! 2 * 0.1\n}.play;\n);\n\n// close floats can occur here \nx.set(\\thr, 0.01)\n\n// not here\nx.set(\\thr, 2\n\nx.release\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nx = {\n |lookBack = 3, thr = 1|\n var trig = Impulse.ar(7);\n // for a non-integer source it makes sense to take a sufficiently large threshold thr\n var midi = Demand.ar(trig, 0, DIdev(SinOsc.ar(0.2, 0, 15, 82), 5, -6, 5, lookBack, thr: thr));\n midi.poll(7, label: \\midi);\n SinOsc.ar(midi.midicps.lag(0.007)) ! 2 * 0.1\n}.play;\n);\n\n// close floats can occur here \nx.set(\\thr, 0.01)\n\n// not here\nx.set(\\thr, 2)\n\nx.release\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Collection.storeOn` do?"}, {"role": "assistant", "content": "Write a compilable representation of the collection to a"}]} +{"conversations": [{"role": "user", "content": "What does `PathName.entries` do?"}, {"role": "assistant", "content": "returns a list of all the files+folders inside the folder represented by this path."}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nPbind(\\degree, Pseq([0, 2, 4, 7], inf), \\dur, 0.25).play;\n```"}, {"role": "assistant", "content": "It plays a four-note major arpeggio in a loop, one note every 250 ms.\n\n`Pbind` builds an event stream: each event is the current value of every key. `Pseq([0, 2, 4, 7], inf)`\ncycles the degrees forever, and `\\dur, 0.25` sets the time between events in beats on the default\nTempoClock. With no `\\instrument`, the `\\default` SynthDef is used, which converts `\\degree` to a\nfrequency through the current scale (major, rooted at C by default). `.play` schedules it on the clock\nand returns an EventStreamPlayer."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n(\n~loDev = -6;\n~hiDev = 5;\n~lookBack = 2;\n\np = Pbind(\n \\dur, 0.2,\n \\midinote, PIdev(72, 11, Pfunc { ~loDev }, Pfunc { ~hiDev }, Pfunc { ~lookBack }).trace(prefix: \"midi \"),\n).play;\n);\n\n// change on the fly\n// as lookBack equals 2, this defines a fixed sequence (up or down anyway)\n\n(\n~loDev = -1;\n~hiDev = 1;\n);\n\n// widen range\n\n(\n~loDev = -6;\n~hiDev = 5;\n);\n\n// force a twelve-tone row\n\n~lookBack = 11;\n\n\n// cont\n// …\n```"}, {"role": "assistant", "content": "as lookBack equals 2, this defines a fixed sequence (up or down anyway) force a twelve-tone row (PIdev: pattern searching for numbers with integer distance from a source pattern, optionally avoiding repetitions within a span)"}]} +{"conversations": [{"role": "user", "content": "What is `Ramp` in SuperCollider?"}, {"role": "assistant", "content": "Ramp — Break a continuous signal into line segments Break a continuous signal into linearly interpolated segments with specific durations. Category: UGens > Filters > Linear."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n SinOsc.ar(\n Peak.ar(Dust.ar(20), Impulse.ar(0.4)) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// follow a sine lfo, reset rate controlled by mouse x\n(\n{\n SinOsc.ar(\n Peak.kr(SinOsc.kr(0.2), Impulse.kr(MouseX.kr(0.01, 2, 1))) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n SinOsc.ar(\n Peak.ar(Dust.ar(20), Impulse.ar(0.4)) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// follow a sine lfo, reset rate controlled by mouse x\n(\n{\n SinOsc.ar(\n Peak.kr(SinOsc.kr(0.2), Impulse.kr(MouseX.kr(0.01, 2, 1))) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\"help-IRand\", {\n Out.ar(\n IRand(0, 1), // play on random channel between 0 and 1\n FSinOsc.ar(500,\n 0, Line.kr(0.2, 0, 0.1, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n(\nRoutine({\n 16.do({\n Synth.new(\"help-IRand\"); 0.5.wait;\n })\n}).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\"help-IRand\", {\n Out.ar(\n IRand(0, 1), // play on random channel between 0 and 1\n FSinOsc.ar(500,\n 0, Line.kr(0.2, 0, 0.1, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n(\nRoutine({\n 16.do({\n Synth.new(\"help-IRand\"); 0.5.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ Pan2.ar(SinOsc.ar(440) * 0.2, SinOsc.kr(0.1)) }.play;\n```"}, {"role": "assistant", "content": "A sine that slowly moves between the speakers.\n\n`SinOsc.kr(0.1)` is a control-rate sine at 0.1 Hz — one cycle every 10 seconds — running between -1 and 1.\n`Pan2.ar(sig, pos)` treats that as the pan position, where -1 is hard left, 0 centre, 1 hard right, so the\nsound drifts across the stereo field. Pan2 is equal-power, so the centre is -3 dB per channel rather than\nhalf amplitude on each. The `* 0.2` sets the level before panning."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(SynthDef(\\x, {|midi = 60, amp = 0.8| Out.ar(0, Pan2.ar(SinOsc.ar(midi.midicps, mul: EnvGen.kr(Env.perc(0, 0.5), timeScale: 0.5, levelScale: 0.3)), Rand(-1, 1)) * EnvGen.kr(Env.perc(0, 0.5), timeScale: 1.3*0.5, levelScale: Rand(0.3, 0.5), doneAction:2));}).add;)\n\n(~phase = Pbind(*[ instrument: \\x, dur: 0.5, midi: Pseq([0, 4, 7] + 60, inf)]);\n5.do({|val| ~phase.play(TempoClock.new((110 + (0.5 * val)) / 60))}); )\n```"}, {"role": "assistant", "content": "Experimenting with some Reich style phasings\r\n\r\nAudio: http://soundcloud.com/schemawound/goodnightworld."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Blip`."}, {"role": "assistant", "content": "```supercollider\n// modulate frequency\n{ Blip.ar(XLine.kr(20000, 200, 6), 100, 0.2) }.play;\n\n// modulate numharmonics\n{ Blip.ar(200, Line.kr(1, 100, 20), 0.2) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `ArrayedCollection` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n pitches.size.do{ |i|\n {\n var freq = pitches[i].midicps;\n var env = Env.perc.ar(Done.freeSelf);\n SinOsc.ar(freq) * 0.1 * env\n }.play;\n 0.2.wait\n }\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nPbind(\\degree, Pseq([0, 2, 4, 7], inf), \\dur, 0.25).play;\n```"}, {"role": "assistant", "content": "It plays a four-note major arpeggio in a loop, one note every 250 ms.\n\n`Pbind` builds an event stream: each event is the current value of every key. `Pseq([0, 2, 4, 7], inf)`\ncycles the degrees forever, and `\\dur, 0.25` sets the time between events in beats on the default\nTempoClock. With no `\\instrument`, the `\\default` SynthDef is used, which converts `\\degree` to a\nfrequency through the current scale (major, rooted at C by default). `.play` schedules it on the clock\nand returns an EventStreamPlayer."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// Note that constructions like SynthDef(...) and Synth(...) are short for SynthDef.new(...), etc.\n// With SynthDef it is common to chain this with calls on the resulting instance,\n// e.g. SynthDef(...).add or SynthDef(...).play\n\n// make a simple def and send it to the server\n\ns.boot;\nSynthDef(\\SimpleSine, { |freq = 440, out| Out.ar(out, SinOsc.ar(freq, 0, 0.2)) }).add;\n\n// the above is essentially the same as the following:\nd = SynthDef(\\SimpleSine, { |freq = 440, out| Out.ar(out, SinOsc.ar(freq, 0, 0.2)) });\nd.add;\n// …\n```"}, {"role": "assistant", "content": "Note that constructions like SynthDef(...) and Synth(...) are short for SynthDef.new(...), etc. With SynthDef it is common to chain this with calls on the resulting instance, (SynthDef: Client-side representation of a synth definition)"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Simple animated 2D user interface. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// needs shared memory interface (SC 3.5+)\n\nServer.default = s = Server.local;\ns.waitForBoot{\n if (s.hasShmInterface) {\n w = Window().front;\n u = UserView(w, w.view.bounds);\n f = { |x, y|\n var size = 20 + (y/4);\n k = k.center_(Point(x, y));\n k = k.size_(Size(size, size));\n b.setSynchronous(x.linlin(0,u.bounds.width, 1/4, 16));\n c.setSynchronous(50*(y/4));\n };\n w.onClose = { Ndef(\\sound).end(1) };\n u.background = Color.blue(0.5);\n u.animate = true;\n k = Rect(100, 100, 50, 50);\n u.drawFunc = {\n var osc = Ndef(\\osc).bus.getSynchronous * 0.5 + 0.5;\n Pen.strokeColor = Color.blue;\n Pen.addOval(k);\n Pen.fillRadialGradient(\n k.center,\n k.center,\n k.width/8,\n k.width,\n Color(1,1,1,0),\n Color(1,0,0,osc)\n );\n };\n \n u.mouseMoveAction = { |u, x, y| f.(x, y) }; \n u.mouseDownAction = { |u, x, y| f.(x, y) }; \n \n b = Bus.control(s);\n c = Bus.control(s);\n b.setSynchronous(4);\n c.setSynchronous(500);\n \n Ndef(\\osc, { SinOsc.kr(b.kr) });\n Ndef(\\sound).fadeTime = 1;\n Ndef(\\sound, { MoogFF.ar(LFSaw.ar(50+[0,1]), Ndef(\\osc).kr.linexp(-1,1,50,c.kr)) }).play;\n } {\n \"get SC 3.5 or higher ;)\".warn;\n };\n};\n```"}]} +{"conversations": [{"role": "user", "content": "What does `List.foldAt` do?"}, {"role": "assistant", "content": "Similar to #-at, but guarantees that any value for index is valid by reflecting values outside the collection's bounds. Values greater than `size - 1` are reflected back toward lower indices. Similarly, if the index is below `0` (negative), it folds in the opposite direction. This creates a symmetrical mapping of any index within the collection's boundaries. The index can also be an array of indices to extract the specified"}]} +{"conversations": [{"role": "user", "content": "My sustained synth never stops, even when I set the gate to 0."}, {"role": "assistant", "content": "A sustained EnvGen only releases when the gate goes from positive to non-positive *after* the envelope has started, and the Synth only disappears if that EnvGen has `doneAction: 2`. Check three things: the SynthDef actually takes a `gate = 1` argument, the Env is a sustained shape (Env.adsr or Env.asr, not Env.perc), and you call `x.set(\\gate, 0)` on the Synth object. Setting the gate on a different Synth, or on a Group, does nothing."}]} +{"conversations": [{"role": "user", "content": "Explain `PulseDPW` in SuperCollider briefly."}, {"role": "assistant", "content": "PulseDPW — super-efficient square-wave oscillator with low aliasing Use this just like the Pulse UGen - as with SawDPW, this uses the \"Differentiated Parabolic Wave\" technique to create a waveform extremely efficiently and with low (but not zero) aliasing. Category: UGens > Generators."}]} +{"conversations": [{"role": "user", "content": "What does `PdefGui.editStrings` do? What arguments does it take?"}, {"role": "assistant", "content": "a compileString that recreates the Pdef's envir at Arguments: edKeys — Default value is nil. `// assume g from above is still there`."}]} +{"conversations": [{"role": "user", "content": "I made a synth and I hear nothing. Where do I start?"}, {"role": "assistant", "content": "Start with the node tree, not the code: evaluate `s.plotTree`. If your Synth is not there, it never started or it already freed itself; if it is there, the problem is in the signal. Which of the two do you see?"}, {"role": "user", "content": "It's in the tree."}, {"role": "assistant", "content": "Then the node lives and the signal is being lost. Check three things in order: does the SynthDef reach `Out.ar(0, ...)` with bus 0; is any `amp`/`mul` zero; and is a filter closed, e.g. `LPF.ar(sig, 50)` on a 440 Hz sine. Paste the SynthDef and I will read it."}, {"role": "user", "content": "SynthDef(\\x, { |out = 0| Out.ar(out, LPF.ar(Saw.ar(60), 80) * 0.1) }).add; Synth(\\x, [\\out, 2]);"}, {"role": "assistant", "content": "Two things. You wrote a low-pass at 80 Hz over a 60 Hz saw, which leaves almost nothing above the fundamental — the patch is nearly a sine at 60 Hz at very low level. And you passed `\\out, 2`, so it is going to bus 2, not the master. Try `Synth(\\x)` with the default out and a cutoff of 800:\n\n```supercollider\nSynthDef(\\x, { |out = 0, cutoff = 800| Out.ar(out, LPF.ar(Saw.ar(60), cutoff) * 0.1) }).add;\nSynth(\\x);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DelayC`."}, {"role": "assistant", "content": "```supercollider\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nDelayC.ar(z, 0.2, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\n(\n// recursive application of delay.\n{\nz = Decay2.ar(Dust.ar(1, 0.5), 0.01, 0.1, Saw.ar(100 + [0, 1]));\n5.do { |i| z = DelayC.ar(RLPF.ar(z, Rand(100, 3000), 0.03), 1, 1 / (2**i), 1, z * 0.5) };\nz\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `RecordBuf.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Record or overdub into a Buffer. Arguments: inputArray — An Array of input channels.; bufnum — The index of the buffer to use.; offset — An offset into the buffer in samples.; recLevel — Value to multiply by input before mixing with existing data.; preLevel — Value to multiply to existing data in buffer before mixing with input.; run — If zero, then recording stops, otherwise recording proceeds.; loop — If zero then don't loop, otherwise do. This is modulatable.; trigger — a trigger causes a jump to the start of the Buffer. A trigger occurs when a signal changes from negative value to positive value.."}]} +{"conversations": [{"role": "user", "content": "What does `PHS.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new PHS Arguments: helpSynth — A HS object.; helpSynthArgs — Collection of key / value pairs for the HS synth.; ... pbindArgs — dur1, pbindData1, ... , durN, pbindDataN where dur is duration value or pattern / stream of durations for corresponding Pbind(s) and pbindData is a collection of Pbind pairs or a collection of Pbind pair collections, defining possibly several Pbinds with the same event timing.."}]} +{"conversations": [{"role": "user", "content": "Synth Iteration Help?"}, {"role": "assistant", "content": "SuperCollider forum — Synth Iteration Help\n\n```supercollider\n(\nSynthDef (\\sine_tone) {\narg freq = 440, amp = 1, len = 1, bus = 0;\nvar sig, env;\nenv = Env.step ([ amp ], [ len ]);\nenv = EnvGen.kr (env, doneAction: 2);\nsig = SinOsc.ar (freq, 0, env);\nOut.ar (bus % 2, sig); // bus modulo 2 here to wrap to stereo\n}.add;\n)\n```\n\nmaybe try wrapping the bus array to [ 0, 1 ] by using modulo: bus % 2. this should let you hear what is going on using a stereo output\n\nby using a Pbind, each “note” is being instantiated as a separate synth with its own length, amplitude, frequency and bus. the doneAction: 2 argument in the EnvGen.kr ugen just means each synth will free itself once it is done playing the note it has been assigned."}]} +{"conversations": [{"role": "user", "content": "How do I record my output to a file?"}, {"role": "assistant", "content": "`s.record(path)` starts recording the server's output; `s.stopRecording` stops it.\n\n```supercollider\ns.record(\"C:/audio/take1.wav\");\n// play for a while\ns.stopRecording;\n```\n\nThe path must be writable and the format follows the extension (.wav, .aiff, .flac). The file is written\nby the server, so it captures exactly what the master bus produces — including your effects, which is what\nyou want. `s.record` also accepts `duration:` to stop by itself, which is the reproducible form for a take."}]} +{"conversations": [{"role": "user", "content": "What does `Platform.case` do?"}, {"role": "assistant", "content": "Perform actions depending on the current platform (name), just like Object:switch:"}]} {"conversations": [{"role": "user", "content": "Explain `RealVector` in SuperCollider briefly."}, {"role": "assistant", "content": "RealVector — an element of R^N Represents an element of R^N. Usual operations are implemented. Category: Math."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DetectSilence`."}, {"role": "assistant", "content": "```supercollider\n// this frees after the Decay has become quiet enough for a long enough time\n{ var signal = Decay.ar(Impulse.ar(0), 2, PinkNoise.ar(0.2)); DetectSilence.ar(signal, doneAction: Done.freeSelf); signal }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What are you good at?"}, {"role": "assistant", "content": "SuperCollider. I can explain its classes and UGens, write SynthDefs and patches, read a patch back to you, and tell you why one does not compile. I am 198M parameters; I am not a general assistant."}]} -{"conversations": [{"role": "user", "content": "What is `PopUpEditor` in SuperCollider?"}, {"role": "assistant", "content": "PopUpEditor — selects from an integer => name option array This is somewhat misnamed. As an Editor it edits/selects from an integer => name option array. The gui interface is a PopUp. Category: Libraries > crucial > Editors."}]} -{"conversations": [{"role": "user", "content": "Where does the magic frequency 261.6255653006 come from?"}, {"role": "assistant", "content": "SuperCollider forum — Where does the magic frequency 261.6255653006 come from?\n\nThinking about this a bit more, on one hand it might be useful if set (and everything else in Event) could fetch not only the msgFunc from the synthDesc, which it does (if args are set to []), but perhaps also the default values for the synth controls... and then used those in preference to Event defaults if “nothing is specified” for some key in the event. Alas “nothing is specified” is tedious to detect in Event, as it does its own calculations which have a lot of inputs (esp. for the frequency stuff). So, one could implement such a policy more explicitly in a \\finish callback that e.g. looks up in synthDesc only specific keys (say specified in a defArgs, possibly with [] meaning all found in the synthDesc) and sets only those if “not set” in event.\n\nI almost started coding this idea, but I realised that’s actually inferior to just putting the synth defaults in another event/environment, and chaining that before the event... which is exactly what I usually do with a Pdef.envir. That approach, besides sidestepping the issue of detecting what’s “not set” in the Event, has an extra advantage that a persistent set of defaults, after being initialized with the synthdef ones, can be easily tweaked in a gui. When I find myself that I often change the default value of some control like that, I go back and change the synthdef default. Because of that workflow, in which I always have the defaults loaded in an chained envir, I didn’t even have much realization of Event defaults for things like amp, freq etc. And I didn’t need type: \\set much until recently... for which getting the args constructed in that case is also rather easy as Pdef(...).controlKeys. Even without Pdefs, that’s straightforward (past loading those defaults into an event)\n\n```supercollider\ne = SynthDescLib.global.synthDescs.at(\\default).controls.inject((), { |e, c| e[c.name] = c.defaultValue });\n(instrument: \\default, dur: 1, amp: 0.2).next(e).play\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Very quick-and-dirty hack to show stereo phase."}, {"role": "assistant", "content": "```supercollider\n(\nb = Bus.audio(s, 2);\na = { |inbus = 0|\n var sig = In.ar(inbus, 2);\n // x axis is side, oriented toward right;\n // y axis is mid\n [sig[1] - sig[0], sig.sum]\n}.play(s.defaultGroup, outbus: b, addAction: \\addAfter);\nc = s.scope;\nc.style = 2;\nc.bus = b;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Ball` in SuperCollider?"}, {"role": "assistant", "content": "Ball — physical model of bouncing object Ball models the path of a bouncing object that is reflected by a vibrating surface. Category: UGens > Filters > Nonlinear, UGens > Generators > PhysicalModels."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PparGroup`."}, {"role": "assistant", "content": "```supercollider\n(\nvar p, q, r, o;\np = Pbind(\\degree, Prand((0..7), 12), \\dur, 0.3, \\legato, 0.2);\n\nPparGroup(p).play;\n\n// post the node structure:\nfork {\n s.queryAllNodes;\n 3.wait;\n s.queryAllNodes;\n 2.wait;\n s.queryAllNodes;\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Space` in SuperCollider?"}, {"role": "assistant", "content": "Space — A spatial tool for Ndefs A tool for automatially spatialising Ndefs. Category: Libraries > Radicles."}]} -{"conversations": [{"role": "user", "content": "What does `Mx.frameRate` do?"}, {"role": "assistant", "content": "Units in an Mx can declared Frame Rate Devices that will be ticked at this rate. SplineFr is an example of a pure Frame Rate Device. Default is 24/beat. The timeline engine uses a frame rate device for its Returns: int"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n Instr(\\beatClockPlayerTest,{ arg gate=0.0,freq=300;\n var a,t;\n\n t = gate;\n a = Decay2.kr(t,0.01,0.1).clip2(1.0);\n a * SinOsc.ar(freq);\n },[\n \\gate\n ]);\n\n PlayerMixer([\n Patch.new(\\beatClockPlayerTest,\n [\n BeatClockPlayer(4), // trig / gate\n 300\n ]),\n Patch.new(\\beatClockPlayerTest,\n [\n Stream2Trig(1.0,1.0),\n 600\n ])\n ]).play;\n\n Tempo.default.gui\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n Instr(\\beatClockPlayerTest,{ arg gate=0.0,freq=300;\n var a,t;\n\n t = gate;\n a = Decay2.kr(t,0.01,0.1).clip2(1.0);\n a * SinOsc.ar(freq);\n },[\n \\gate\n ]);\n\n PlayerMixer([\n Patch.new(\\beatClockPlayerTest,\n [\n BeatClockPlayer(4), // trig / gate\n 300\n ]),\n Patch.new(\\beatClockPlayerTest,\n [\n Stream2Trig(1.0,1.0),\n 600\n ])\n ]).play;\n\n Tempo.default.gui\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Pbindf`?"}, {"role": "assistant", "content": "Pbindf — bind several value patterns to one existing event stream by binding keys to values"}, {"role": "user", "content": "What does `Pbindf.new` do?"}, {"role": "assistant", "content": "The arguments to Pbindf is the initial pattern followed by an alternating sequence of keys and patterns. A pattern can also be bound to an array of keys. In this case, the pattern must specify a sequence whose elements are arrays with at least as many elements as there are keys."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\na = Pbind(\\x, Pseq([1, 2, 3]), \\zzz, 9000); // input stream\nb = Pbindf(a, \\y, Prand([100, 300, 200], inf), \\zzz, 99);\nx = b.asStream;\n);\n\nx.next(()); // pass in an event ()\nx.next(());\nx.next(());\nx.next(()); // end: nil\n\n\n\n// sound examples\n\n// using the default synth def\na = Pbind(\\dur, 0.1);\nPbindf(a, \\freq, Prand([300, 500, 231.2, 399.2], inf)).play;\nPbindf(a, \\freq, Prand([1, 1.2, 2, 2.5, 3, 4], inf) * 200).play;\n\n\n(\n// a SynthDef\nSynthDef(\\test, { |out, freq = 440, amp = 0.1, nharms = 10, pan = 0, gate = 1|\n var audio = Blip.ar(freq, nharms, amp);\n var env = Linen.kr(gate, doneAction: Done.freeSelf);\n OffsetOut.ar(out, Pan2.ar(audio, pan, env));\n}).add;\n);\n\na = Pbind(\\instrument, \\test, \\dur, 0.1);\n\nPbindf(a, \\freq, Prand([1, 1.2, 2, 2.5, 3, 4], inf) * 200).play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `InstrAt.prepareToBundle` do? What arguments does it take?"}, {"role": "assistant", "content": "a reference to an Instr by name. obsolete Arguments: group; bundle."}]} -{"conversations": [{"role": "user", "content": "How do I see what a signal is doing?"}, {"role": "assistant", "content": "`.poll` prints values to the post window — `SinOsc.kr(1).poll` prints once per control block, and `.poll(10)` limits it to every 10th. `s.scope` opens an oscilloscope on the main output, and `.scope` on a UGen shows just that signal. For a numeric snapshot of many signals at once, `s.meter` shows the output levels, and `\".dump\".postln` style probes are common while debugging."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a;\na = Pgeom(1.0, 1.1, inf);\na.asStream.nextN(100).plot;\n);\n\n\n// sound example\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\nvar a;\na = Pseries(300, 20, 70).asStream;\n{\n a.do { |val|\n Synth(\\help_sinegrain, [\\freq, val]);\n 0.02.wait;\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a;\na = Pgeom(1.0, 1.1, inf);\na.asStream.nextN(100).plot;\n);\n\n\n// sound example\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\nvar a;\na = Pseries(300, 20, 70).asStream;\n{\n a.do { |val|\n Synth(\\help_sinegrain, [\\freq, val]);\n 0.02.wait;\n }\n}.fork;\n);\n\n(\nPbind(\n \\dur, 0.01,\n \\instrument, \\help_sinegrain,\n \\freq, Pseries(800.0, Pbrown(-1.0, 3.0, 0.1, inf), inf)\n).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `PulseDivider`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\"help-PulseDivider\", { |out = 0|\n var p, a, b;\n p = Impulse.ar(8);\n a = SinOsc.ar(1200, 0, Decay2.ar(p, 0.005, 0.1));\n b = SinOsc.ar(600, 0, Decay2.ar(PulseDivider.ar(p, 4), 0.005, 0.5));\n\n Out.ar(out, (a + b) * 0.4)\n}).play;\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `AbstractFunction`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\na = { |x| #[440, 720, 801, 1020.2].at(x) }; b = a.cpsmidi; [a.value(3), b.value(3)];\na = Pseries(220, 220, inf).cpsmidi; a.asStream.nextN(12); // overtone series as midinotes\n// follow but round to next midinote\n{ a = Pitch.kr(SoundIn.ar).at(1); Pulse.ar(a.cpsmidi.round.midicps) * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "I get 'Buffer UGen: no buffer data'. What does it mean?"}, {"role": "assistant", "content": "The UGen got a bufnum that the server has no data for. `Buffer.read` is asynchronous: the Buffer object exists immediately but the samples arrive later, so a Synth created straight after `Buffer.read` reads nothing. Wait for it — `s.sync` after the read, or `Buffer.read(s, path, action: { |b| ... })` and create the Synth in the action. The other cause is a nil or wrong buffer: `PlayBuf.ar(1, ~buf)` where ~buf was never assigned passes 0, which is 'no buffer'."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `QuadC`."}, {"role": "assistant", "content": "```supercollider\n// logistic map\n// equation: x1 = -r*x0^2 + r*x0\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n QuadC.ar(SampleRate.ir/4, r.neg, r, 0, 0.1) * 0.4;\n}.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `NAryOpStream` in SuperCollider briefly."}, {"role": "assistant", "content": "NAryOpStream — several streams combined by an n-ary operator A NAryOpStream is created as a result of a n-ary math operation on a Stream. It is defined to respond to next by returning the result of the math operation on the next value from the stream. It responds to reset by resetting the Stream. Category: Streams-Patterns-Events."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for batuhan's buzzer parametrized that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n// A beautiful sc140 tweet by Batuhan Bozkurt, parametrized for real-time changes\n(\n// Start sound here\na = { | rateL = 5, rateR = 6, blipMul = 100, blipAdd = 50, fMul = 50, kMul = 1 |\n f = LocalIn.ar(2).tanh;\n k = Latch.kr(f[0].abs,Impulse.kr(1/4)) * kMul;\n LocalOut.ar(\n f +\n CombC.ar(Blip.ar([rateL, rateR], blipMul * k + blipAdd, 0.9), 1, k*0.3, fMul * f));f\n}.play\n);\n\n// Set parameters for changing sound here: \n\na.set(\\rateL, 10);\n\na.set(\\rateR, 8);\n\na.set(\\blipMul, 25);\n\na.set(\\blipAdd, 70);\n\na.set(\\fMul, 30);\n\n\na.set(\\kMul, 0.01);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BufFrames`."}, {"role": "assistant", "content": "```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n// indexing with a phasor\n{ BufRd.ar(1, b, Phasor.ar(0, BufRateScale.kr(b), 0, BufFrames.kr(b))) }.play;\n\n// indexing by hand\n{ BufRd.ar(1, b, K2A.ar(MouseX.kr(0, BufFrames.kr(b)))) }.play;\n\nb.free\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\Mirror;\n~description = \"Mirror soundfield\";\n\n~function = {|in = 0, order = 1, mirrorFrontBack = 0, mirrorLeftRight = 0, mirrorUpDown = 0 |\nHOATransMirror.ar(order, in, mirrorFrontBack, mirrorLeftRight, mirrorUpDown);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "Explain `Fb1_HopfAFDC` in SuperCollider briefly."}, {"role": "assistant", "content": "Fb1_HopfAFDC — Adaptive Hopf pseudo ugen with fast dynamical coupling This is an adaptive variant of Hopf, which enhances the adaption mechanism of #[1], see #[2] (4.1.) for a description. The parameter naming follows the convention of #[2]. Category: Libraries > miSCellaneous > Nonlinear."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\Identity;\n~description = \"Output the Ambisonics stream to outputs channels, useful for NRT rendering\";\n\n~function = {|in = 0|\nin;\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ BlitB3Tri.ar(XLine.kr(1000, 20, 10)) }.play;\n\n//unfortunately, aliasing returns at higher frequencies (over 5000Hz or so) with a vengence\n{ BlitB3Tri.ar(MouseX.kr(20,8000,'exponential').poll,0.99,MouseY.kr(0.001,0.99)) }.play;\n\n//more efficient, some aliasing from 3000, but not so scary over 5000. Duller sound (less high harmonics included for lower fundamentals)\n{ LFTri.ar(MouseX.kr(20,8000,'exponential').poll) }.play;\n\n\n//comparison\n//LFTri version cheaper, and less aliasing! \nx = { LFTri.ar(\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ BlitB3Tri.ar(XLine.kr(1000, 20, 10)) }.play;\n\n//unfortunately, aliasing returns at higher frequencies (over 5000Hz or so) with a vengence\n{ BlitB3Tri.ar(MouseX.kr(20,8000,'exponential').poll,0.99,MouseY.kr(0.001,0.99)) }.play;\n\n//more efficient, some aliasing from 3000, but not so scary over 5000. Duller sound (less high harmonics included for lower fundamentals)\n{ LFTri.ar(MouseX.kr(20,8000,'exponential').poll) }.play;\n\n\n//comparison\n//LFTri version cheaper, and less aliasing! \nx = { LFTri.ar(4000) }.play;\nx = { BlitB3Tri.ar(4000) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What is a UGen graph in SuperCollider?"}, {"role": "assistant", "content": "A UGen graph is the directed acyclic graph of unit generators that a SynthDef describes: sources (SinOsc, WhiteNoise) feed processors (LPF, EnvGen, Pan2) and end at an output such as Out.ar. The language builds the graph; the server instantiates it once per Synth. A signal path is drawn by passing one UGen's output as another's input, and because UGens are multi-channel by default, the same expression can build a stereo or 8-channel graph depending on the arrays inside it."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LeastChange`."}, {"role": "assistant", "content": "```supercollider\n(\nd = { |freq = 440|\n var internalFreq;\n internalFreq = LFNoise0.ar(0.3, 300, 800);\n SinOsc.ar(\n LeastChange.kr(freq, internalFreq) // two sources of change: one external, one internal\n ) * 0.1\n}.play\n);\n\nd.set(\\freq, 800);\nd.set(\\freq, 900);\nd.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `KeyCodeResponder.new` do?"}, {"role": "assistant", "content": "register responder functions for keycode and modifier combinations"}]} +{"conversations": [{"role": "user", "content": "What does `QPenPrinter.pageRect` do?"}, {"role": "assistant", "content": "Get the page bounds, which is the printable area and usually smaller than #-paperRect due to Returns: a Rect"}]} +{"conversations": [{"role": "user", "content": "What is `FoaSFWL` in SuperCollider?"}, {"role": "assistant", "content": "FoaSFWL — First Order Ambisonic (FOA) Soundfield Energy Level Return the Soundfield Energy Level, SFWL, of a first order ambisonic (B-format) signal, in dB. Category: Libraries > Ambisonic Toolkit > UGens > FOA > Analyzer, UGens > Multichannel > Ambisonics, UGens > Analysis > Ambisonics."}]} +{"conversations": [{"role": "user", "content": "Explain `EaseOutInBack` in SuperCollider briefly."}, {"role": "assistant", "content": "EaseOutInBack — Back ease-out/in Easing equation for a back (overshooting cubic easing: (a+1)*t^3 - a*t^2) ease-out/in, decelerating until halfway, then accelerating. The a parameter controls overshoot, the default producing a 10% overshoot. Category: Ease."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `IEnvGen`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var env = Env([0, 0.6, 0.3, 1.0, 0], [0.1, 0.02, 0.4, 1.1], [\\lin, \\exp, -6, \\sin]);\n var envgen = IEnvGen.kr(env, MouseX.kr(0, env.times.sum));\n env.plot;\n SinOsc.ar(envgen * 500 + 440)\n}.play;\n);\n\n// index with an SinOsc ... mouse controls amplitude of SinOsc\n// use offset so negative values of SinOsc will map into the Env\n(\n{\n var sin = SinOsc.ar(440, 0, MouseX.kr(0, 1));\n // use offset so negative values of SinOsc will map into the Env\n var env = Env([-1, -0.7, 0.7, 1], [0.8666, 0.2666, 0.8668], \\lin, offset: -1.0);\n IEnvGen.ar(env, sin) * 0.1\n}.play;\n);\n\n// index with Amplitude of input, control freq of SinOsc (uses SoundIn)\n(\n{\n var point = Amplitude.ar(SoundIn.ar(0), 0.01, 0.2);\n // use offset so negative values of SinOsc will map into the Env\n var env = Env.xyc([[0, 330, \\exp], [0.5, 440, \\exp], [1.0, 1760]]);\n SinOsc.ar(IEnvGen.kr(env, point)) * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Re: the perfect frequencies. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// Rumush\n// https://mycelialcordsblog.wordpress.com/\n// https://fungorumush.bandcamp.com/releases\n// https://soundcloud.com/fungorum\n\n(\nf = {\n var rep = [4, 8, 16, 32];\n var n = rep.choose;\n var x = [\n\n 54, 60, 66, 72, 81, 90, 96, 102,\n 108, 128, 132, 144, 162, 180, 192, 204,\n 216, 240, 264, 288, 324, 360, 384, 408,\n 432, 480, 528, 576, 648, 720, 768, 816,\n 864, 960, 1056, 1152, 1296, 1440, 1536, 1632,\n 1728, 1920, 2112, 2304, 2592, 2880, 3072, 3264,\n 3456, 3840, 4224, 4608, 5184, 5760, 6144, 6528,\n 6912, 7680, 8448, 9216, 10368, 11520, 12288, 528\n\n ];\n Mix.fill(n,\n {\n var detune = 5.rand;\n var sin = SinOsc.ar(x.choose, 4.rand, 0.25);\n var saw = RLPF.ar(Saw.ar(x.choose*0.01+detune, 0.75), x.choose, 2.rand).tanh;\n Pan2.ar((sin+saw) * EnvGen.kr(Env.sine(12, 1/n), 1, doneAction:2),\n 1.rand2) }\n );\n};\n);\n\n(\n// DEFINE A ROUTINE\nr = Routine({\n\n inf.do({\n f.play;\n 10.wait;\n })\n});\n);\n\nr.reset.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\np = PHS(h, [], 0.15, [ \\midinote, Pkey(\\val) ]).play;\n\n// also:\n// p = PHS(h, [], 0.15, [ \\midinote, Pfunc { |e| e.use { ~val } } ]).play;\n\n// stop allows resuming, cleanup with free or Cmd-. \n\np.stop; // HS synth still playing \n\np.play; // resume the PHSplayer\n\np.stop(true); // HS synth also paused \n\np.play; // resume the PHSplayer together with HS synth\n\np.free; // also stop HS synth and cleanup - PHSplayer and HS object are freed\n```"}, {"role": "assistant", "content": "p = PHS(h, [], 0.15, [ \\midinote, Pfunc { |e| e.use { ~val } } ]).play; stop allows resuming, cleanup with free or Cmd-. (HS: object for use of synth values in the language by event patterns)"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SortedList`."}, {"role": "assistant", "content": "```supercollider\nt = SortedList.new(8, {|a,b| a.first < b.first });\nt.add([10, \"last\"]);\nt.add([1, \"first\"]);\nt.postln;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `DecodeB2`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var w, x, y, p, a, b, c, d;\n\n p = PinkNoise.ar; // source\n\n // B-format encode\n #w, x, y = PanB2.ar(p, MouseX.kr(-1, 1), 0.1);\n\n // B-format decode to quad\n #a, b, c, d = DecodeB2.ar(4, w, x, y);\n\n [a, b, d, c] // reorder to my speaker arrangement: Lf Rf Lr Rr\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Balance2`."}, {"role": "assistant", "content": "```supercollider\n// a stereo signal, both channels at 0dB\n{ [SinOsc.ar(440), SinOsc.ar(440)] }.play\n\n// using Balance on a stereo signal with the position parameter at 0, effectively the same sound but both channels at -3dB\n{ Balance2.ar(SinOsc.ar(440), SinOsc.ar(440), 0) }.play\n\n// pan sweep from left to right\n{ Balance2.ar(SinOsc.ar(440), SinOsc.ar(1000), Line.kr(-1, 1, 5)) }.play\n\n// other examples\n{ Balance2.ar(LFSaw.ar(44), Pulse.ar(33), FSinOsc.kr(0.5), 0.1) }.play;\n{ var source; source = SinOsc.ar([440, 550]); Balance2.ar(source[0], source[1], LFNoise0.kr(4), 0.3) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// make a storage place for various objects:\nq = (); // Event\n\nq[\\a_long_array] = Array.rand(128, 0.0, 1.0);\nq[\\pi_squared] = pi * pi;\nq[\\favourite_sound] = { { SinOsc.ar([300, 330]).sum * LFPulse.kr(2 + [0, 0.01]) * 0.1 }.play };\nq[\\same_long_array] = q[\\a_long_array]; // same objects may appear several times\n\nArchive.global.put(\\myData, q);\n\n\nArchive.global.at(\\myData).postcs;\n\n// after a recompile:\ns.boot;\n\nq = Archive.global.at(\\myData);\nq\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// make a storage place for various objects:\nq = (); // Event\n\nq[\\a_long_array] = Array.rand(128, 0.0, 1.0);\nq[\\pi_squared] = pi * pi;\nq[\\favourite_sound] = { { SinOsc.ar([300, 330]).sum * LFPulse.kr(2 + [0, 0.01]) * 0.1 }.play };\nq[\\same_long_array] = q[\\a_long_array]; // same objects may appear several times\n\nArchive.global.put(\\myData, q);\n\n\nArchive.global.at(\\myData).postcs;\n\n// after a recompile:\ns.boot;\n\nq = Archive.global.at(\\myData);\nq.postcs;\nq[\\favourite_sound].value;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `CuspL` in SuperCollider?"}, {"role": "assistant", "content": "CuspL — Cusp map chaotic generator A linear-interpolating sound generator based on the difference equation: Category: UGens > Generators > Chaotic."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LatoocarfianC`."}, {"role": "assistant", "content": "```supercollider\n// randomly modulate all params\n(\n{ LatoocarfianC.ar(\n SampleRate.ir/4,\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5)\n) * 0.2 }.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Clothesline.addScore` do? What arguments does it take?"}, {"role": "assistant", "content": "Register a code file from a given Arguments: path — The full path (use `resolveRelative`) for relative paths.; callInContext — If true, make a persistent separate environment for each code file, which has the captured environment as parent. This allows you to access global data, but also use the local environment in each code without messing up other environments.."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Rand`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-Rand\", { |out = 0|\n Out.ar(out,\n FSinOsc.ar(\n Rand(200.0, 400.0),\n 0, Line.kr(0.2, 0, 1, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n(\nRoutine({\n 8.do({\n Synth.new(\"help-Rand\"); 1.0.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Splay`?"}, {"role": "assistant", "content": "Splay — Splay spreads an array of channels across the stereo field"}, {"role": "user", "content": "What does `Splay.arFill` do?"}, {"role": "assistant", "content": "In analogy to Mix:arFill, this method takes a function that produces the channels. The counting index is passed to it."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// splay 10 chans of sound into 2\n(\nx = { |spread = 1, level = 0.2, center = 0.0|\n var numchans = 10;\n Splay.ar(\n SinOsc.ar({ |i| LFNoise2.kr(1).exprange(200, 4000) } ! numchans),\n spread,\n level,\n center\n // use levelComp default true\n );\n}.play;\n);\n\ns.meter;\ns.scope;\n\n// change settings dynamically:\n\nx.set(\\spread, 1, \\center, 0); // full stereo\nx.set(\\spread, 0.5, \\center, 0); // less wide\nx.set(\\spread, 0, \\center, 0); // mono center\nx.set(\\spread, 0.5, \\center, 0.5); // spread from center to right\nx.set(\\spread, 0, \\center, -1); // all left\nx.set(\\spread, 1, \\center, 0); // full stereo\n\n// A similar example written with arFill:\n(\nx = { |spread = 1, level = 0.2, center = 0.0|\n var numchans = 10;\n Splay.arFill(numchans,\n { |i| SinOsc.ar(LFNoise2.kr(rrand(10, 20), 200, i + 3 * 100)) },\n spread,\n level,\n center\n );\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for little homage to \"Come Out\" by Steve Reich: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n/* A little homage to \"Come Out\" by Steve Reich.\n It explores ryhtmic aspects created by phasing, retriggering, and pitch shifting.\n It \"detours\" the original audio message available here\n http://www.freesound.org/people/ERH/sounds/34667/\n in which a police patrol recites\n \"We don't want to scare your children, that's the last thing we wanna do\".\n \n */\n\n\ns.options.memSize=128*1024;\ns.boot;\n\n~bus=Bus.audio(s,2);\n~buf=Buffer.readChannel(s,\"/home/***/Supercollider/sounds/v.wav\");\n\n(\nSynthDef(\\playbuff,{arg in=0,out=0,t_trig=0;\n var i=EnvGen.kr(Env([0,40,0.3,0.4,40,0],[0,60,20,20,30]),gate:1);\n var r=EnvGen.kr(Env([0,10,-0.9,-0.9],[40,20,15]),gate:t_trig,doneAction:2);\n var sig1=PlayBuf.ar(1,in,rate:1+r,trigger:Impulse.kr(i),loop:1);\n var sig2=PlayBuf.ar(1,in,rate:1+r,trigger:Impulse.kr(i+0.01),loop:1);\nOut.ar(out,Splay.ar([sig1,sig2],0.5));\n};\n).add;\n\nSynthDef(\\rev,{arg in=0,out=0;\n var sig=In.ar(in,2);\n sig=Compander.ar(sig,sig,0.8,1/3);\n sig=FreeVerb.ar(sig,mix:0.4);\nOut.ar(out,sig);\n};\n).add;\n);\n\nSynth(\\rev,[\\in:~bus]);\n\nfork{\nx=Synth(\\playbuff,[\\out:~bus]);\n75.wait;\nx.set(\\t_trig,1);\n};\n\ns.quit;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ LPF.ar(Saw.ar(200, 0.1), SinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3600, 4000)) }.play;\n\n// kr:\n(\n{ var ctl = LPF.kr(LFPulse.kr(8), SinOsc.kr(XLine.kr(1, 30, 5)) + 2);\n SinOsc.ar(ctl * 200 + 400)\n}.play;\n);\n\n(\n{ var ctl = LPF.kr(LFPulse.kr(8), MouseX.kr(2, 50, 1));\n SinOsc.ar(ctl * 200 + 400)\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ LPF.ar(Saw.ar(200, 0.1), SinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3600, 4000)) }.play;\n\n// kr:\n(\n{ var ctl = LPF.kr(LFPulse.kr(8), SinOsc.kr(XLine.kr(1, 30, 5)) + 2);\n SinOsc.ar(ctl * 200 + 400)\n}.play;\n);\n\n(\n{ var ctl = LPF.kr(LFPulse.kr(8), MouseX.kr(2, 50, 1));\n SinOsc.ar(ctl * 200 + 400)\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `AbstractFunction`."}, {"role": "assistant", "content": "```supercollider\na = { |x| #[440, 720, 801, 1020.2].at(x) }; b = a.cpsmidi; [a.value(3), b.value(3)];\na = Pseries(220, 220, inf).cpsmidi; a.asStream.nextN(12); // overtone series as midinotes\n// follow but round to next midinote\n{ a = Pitch.kr(SoundIn.ar).at(1); Pulse.ar(a.cpsmidi.round.midicps) * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `OscN` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// compare examples below with interpolating Osc examples.\n\n(\ns = Server.local;\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, false, true);\nb = Buffer.alloc(s, 512, 1);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum, 500, 0, 0.5)\n )\n}).play(s, [0, 0, 1, b.bufnum]);\n\n);\nb.free;\n\n\n\n(\n// noninterpolating - there are noticeable artifacts\n// modulate freq\n\ns = Server.local;\nb.sine1(1.0/[1, 2, 3, 4, 5, 6].squared, true, false, true);\nb = Buffer.alloc(s, 512, 1);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum, XLine.kr(2000, 200), 0, 0.5)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n\n);\nb.free;\n\n(\n// sounds very different than the Osc example\ns = Server.local;\nb = Buffer.alloc(s, 512, 1);\nb.sine1([1.0], true, true, true);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum,\n OscN.ar(bufnum,\n XLine.kr(1, 1000, 9),\n 0,\n 200,\n 800),\n 0,\n 0.25)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n\n);\nb.free;\n\n(\n// modulate phase\ns = Server.local;\nb = Buffer.alloc(s, 512, 1);\nb.sine1([1.0], true, true, true);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum,\n 800,\n OscN.ar(bufnum,\n XLine.kr(20, 8000, 10),\n 0,\n 2pi),\n 0.25)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n);\nb.free;\n\n\n(\n// change the buffer while its playing\ns = Server.local;\nb = Buffer.alloc(s, 4096, 1);\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, true, true);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum, [80, 80.2], 0, 0.2)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n);\n\n(\nRoutine({\n var n = 32;\n 50.do({\n b.sine1(Array.rand(n, 0, 1).cubed, true, true, true);\n 0.25.wait;\n });\n}).play;\n);\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// fadeTimes should be above blockSize\n// for shorter grains you can use smaller blocksizes\n\n(\ns.options.blockSize = 2;\ns.reboot;\n);\n\n// as the effect is AM on single outs we get side bands\n\n(\ns.doWhenBooted {\n x = {\n var lfo = LFDNoise3.ar(0.2);\n DXFan.ar(\n Dseq((0..7), inf),\n SinOsc.ar(lfo.range(800, 1500), 0, 0.03),\n size: 8,\n fadeTime: 0.0002\n )\n }.play\n};\n);\n\nx.release\n\n\n// go back to default\n\n(\ns.options.blockSize = 64;\ns.reboot;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// fadeTimes should be above blockSize\n// for shorter grains you can use smaller blocksizes\n\n(\ns.options.blockSize = 2;\ns.reboot;\n);\n\n// as the effect is AM on single outs we get side bands\n\n(\ns.doWhenBooted {\n x = {\n var lfo = LFDNoise3.ar(0.2);\n DXFan.ar(\n Dseq((0..7), inf),\n SinOsc.ar(lfo.range(800, 1500), 0, 0.03),\n size: 8,\n fadeTime: 0.0002\n )\n }.play\n};\n);\n\nx.release\n\n\n// go back to default\n\n(\ns.options.blockSize = 64;\ns.reboot;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `SystemSynthDefs`?"}, {"role": "assistant", "content": "SystemSynthDefs — SynthDefs assumed to exist on the server"}, {"role": "user", "content": "What does `SystemSynthDefs.numChannels` do?"}, {"role": "assistant", "content": "The SystemSynthDefs class generates SynthDefs with different number of channels that are chosen according to need. This class variable specifies the maximum number of channels."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na = { SinOsc.ar * 0.01 }.play;\na.defName; // has the prefix 'temp__', followed by a number\n```"}]} +{"conversations": [{"role": "user", "content": "What does `VSFP.pchRatio` do? What arguments does it take?"}, {"role": "assistant", "content": "Varispeed sound file player Arguments: p."}]} +{"conversations": [{"role": "user", "content": "Explain `USession` in SuperCollider briefly."}, {"role": "assistant", "content": "USession — (put short description here) (put long description here) Category: UnitLib."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `ReplaceOut`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"ReplaceOutHelp\", { |out = 0, freq = 440|\n var source;\n source = SinOsc.ar(freq, 0, 0.1);\n\n // write to the bus, replacing previous contents\n ReplaceOut.ar(out, source);\n\n}).add;\n);\n\n// each Synth replaces the output of the previous one\nx = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 500]);\ny = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 600]);\nz = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 700]);\n\n// release them in reverse order; the older Synths are still there.\nz.free;\ny.free;\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain);\nb = Pmulpre(\\freq, Pseq([1, 2, 3], inf), a);\nb.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain);\nb = Pmulpre(\\freq, Pseq([1, 2, 3], inf), a);\nb.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `GrayNoise` in SuperCollider briefly."}, {"role": "assistant", "content": "GrayNoise — Bit-flipping Noise Generates noise which results from flipping random bits in a word.foot Generated through mathX_{0} = 1;\\;X_{n+1} = X_{n} \\oplus z, where math\\oplus is bitwise exclusive or, and mathz is a 32-bit binary number with exactly one nonzero digit; the position of the nonzero digit is a uniform random variable. Category: UGens > Generators > Stochastic."}]} +{"conversations": [{"role": "user", "content": "What is `IdentityBag`?"}, {"role": "assistant", "content": "IdentityBag — A Bag according to identity"}, {"role": "user", "content": "What does `IdentityBag.add` do?"}, {"role": "assistant", "content": "Add anObject to the Bag. A Bag may contain multiple entries of the same object. `IdentityBag[1, 2, 3].add(4);`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nIdentityBag[1, 2, 3].add(4);\nIdentityBag[1, 2, 3].add(3);\nIdentityBag[\"abc\", \"def\", \"ghi\"].add(\"jkl\");\nIdentityBag[\"abc\", \"def\", \"ghi\"].add(\"def\");\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n b = {|x,y|\n var arr = List[];\n case\n {y % x.size == 0} // condition 1\n {\n var per = y / x.size;\n x.size.do{|oo|\n var pp = 1,i = 1;\n arr.add( x[oo] );\n while({i < per},{\n arr.add(0);\n i = i+1;\n });\n }\n }\n {x.size % y == 0} // condition 2\n {\n var pp = x.size / y, i = 0, sz = x.size;\n while({i < sz},{\n if(i % pp == 0)\n { arr.add(x[i]) };\n i=i+1;\n });\n };\n arr\n };\n a = [1,1,1,1];\n c = b.value(a,16) \n // [ 1, 1, 1, 1 ]\n // becomes\n // [ 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 ]\n\n b.value(c,4); \n // [ 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 ]\n // becomes\n // [ 1, 1, 1, 1 ]\n)\n```"}, {"role": "assistant", "content": "useful for expanding or reducing arrays by 2^x.\r\nI would like to know if there is a more concise way to write this!\r\nAny suggestions?\r\n\r\n(duplicate post, sorry! forgot to log in!)."}]} +{"conversations": [{"role": "user", "content": "What is `IdentityDictionary`?"}, {"role": "assistant", "content": "IdentityDictionary — associative collection mapping keys to values"}, {"role": "user", "content": "What does `IdentityDictionary.new` do?"}, {"role": "assistant", "content": "The #-parent and #-proto instance variables allow additional IdentityDictionary's to provide default values. The precedence order for determining the value of a key is the IdentityDictionary, its prototype, its parent. When the instance variable #-know is True, the IdentityDictionary responds to unknown messages by looking up the selector and evaluating the result with the dictionary as an argumen"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_sinegrain, { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0.5pi, env))\n}).add;\n\na = Pbind(\\instrument, \\help_sinegrain, \\note, Pseq([0, 7, 2, 9, 11, 10, 9, 8], inf), \\dur, 1);\na.play(quant: (quant: 1, phase: 0));\na.play(quant: (quant: 1, phase: 1/3));\na.play(quant: (quant: 1, phase: 1.0.rand));\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `PrintVal.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "debug assistance Arguments: in — input to sample (.kr rate); numblocks — print the value after this number of control periods (44100/64 is about 689 per second); id — give a tag to the printing so that you can use more than one in a patch to test multiple things."}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for little experiment with periodicity: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n/* An little experiment with periodicity. \n Maybe there can be some sync artifact...\n */\n\ns.boot;\n\nSynthDef(\\mallet,{arg in=0,out=0,f=0,f2=0,a=0.1,r=1.8;\n\n var sig=Array.fill(3,{|n| SinOsc.ar(f*(n+1),mul:a/(n*n+1))}).sum;\n var env=EnvGen.kr(Env.perc(0.001,r),gate:Impulse.kr(f2),doneAction:0);\n\nOut.ar(out,sig*env!2);\n};\n).add;\n\n~root=60;\n~degrees=[0,4,5,7,9,12,16,17,19,21].scramble;\n~num=10;\n~coeff=0.75;\n\nArray.fill(~num,{|n| Synth.new(\\mallet,[\\f:(~root +~degrees[n]).midicps,\\a:0.2/~num,\\f2:(1+(n*~coeff))*0.1])});\n\ns.quit;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\nq = Patch({ Saw.ar(40.midicps) * 0.05 });\nr = Patch({ Saw.ar(52.midicps) * 0.05 });\np = PlayerSocket.new(\\audio,1);\np.play;\n);\n// then get the socked to alternately spawn q and r\np.prepareAndQSpawn(q,0.1);\np.prepareAndQSpawn(r,0.1);\np.prepareAndQSpawn(q,0.1);\np.prepareAndQSpawn(r,0.1);\n\n\n(\np.prepareAndSpawn(\n Patch({ arg freq=400,gate=1.0;\n Saw.ar(freq) * EnvGen.kr(Env.adsr(0.1,2.\n// …\n```"}, {"role": "assistant", "content": "then get the socked to alternately spawn q and r the current player in the socket is set to : p.source (PlayerSocket: a player that can play other players using a cross-faded and fuse-protected socket)"}]} +{"conversations": [{"role": "user", "content": "What does `MIDIIn.program` do? What arguments does it take?"}, {"role": "assistant", "content": "receive MIDI messages Arguments: value — a Function evaluated whenever a MIDI program change message is received. It is passed the following arguments:."}]} +{"conversations": [{"role": "user", "content": "What does `PlayerMixer.addPlayer` do? What arguments does it take?"}, {"role": "assistant", "content": "takes multiple players as input, mixes them to a single (stereo) output Arguments: player."}]} +{"conversations": [{"role": "user", "content": "What does `KrNumberEditor.init` do? What arguments does it take?"}, {"role": "assistant", "content": "a number box and slider for editing a float value [\\kr rate] Arguments: val; aspec."}]} +{"conversations": [{"role": "user", "content": "What does `MxChannel.move` do? What arguments does it take?"}, {"role": "assistant", "content": "a group of MxUnits Arguments: fromIndex; toIndex."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Create a new empty collections with size 3:\nx = Array.new(3);\ny = Array.new(3);\nz = List.new(3);\n\n// Try to add 7 items to the array and list.\n// If the array exceeds maxSize, it will only\n// grow to an internally specified max size.\n(\n7.do { |i|\n x.add(i);\n y = y.add(i); // reassign array y on each add\n z.add(i);\n};\n);\n\n// Attempt to access the 5th item:\nx.at(4); // -> nil (out of bounds)\ny.at(4); // -> 4\nz.at(4); // -> 4\n\n// x grew only to size 4\nx.postln; // -> [ 0, 1, 2, 3 ]\ny.postln; // -> [ 0, 1, 2\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Create a new empty collections with size 3:\nx = Array.new(3);\ny = Array.new(3);\nz = List.new(3);\n\n// Try to add 7 items to the array and list.\n// If the array exceeds maxSize, it will only\n// grow to an internally specified max size.\n(\n7.do { |i|\n x.add(i);\n y = y.add(i); // reassign array y on each add\n z.add(i);\n};\n);\n\n// Attempt to access the 5th item:\nx.at(4); // -> nil (out of bounds)\ny.at(4); // -> 4\nz.at(4); // -> 4\n\n// x grew only to size 4\nx.postln; // -> [ 0, 1, 2, 3 ]\ny.postln; // -> [ 0, 1, 2, 3, 4, 5, 6 ]\nz.postln; // -> List[ 0, 1, 2, 3, 4, 5, 6 ]\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `LFPulse` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\ns.meter;\ns.scope;\n\n// synthesize 2 test signals at level 0.1 (-20 dB), first on separate channels\n(\n{ var n = 2, level = 0.1, spread = 1, pan = 0;\n LFPulse.ar({ 100.exprand(2000) } ! n).range(-1, 1) * level\n}.play;\n);\n\n// now mix/pan these 2 signals using Splay, level at 0.1 (-20dB)\n(\nx = { |spread = 1, level = 0.1, center = 0|\n var n = 2;\n var snd = LFPulse.ar({ 100.exprand(2000) } ! n).range(-1, 1);\n var stereo = Splay.ar(snd, spread, level, center);\n Peak.ar(stereo, Impulse.kr(2)).ampdb.poll(2);\n stereo\n}.play;\n);\n\n// when we set full spread, panned to center:\n// the 2 signals are discrete, left and right\n// we see the energy-based levelComp applied (1/2.sqrt).ampdb = -3\nx.set(\\spread, 1, \\center, 0); // -20 - 3 = -23dB\n\n// no spread, panned center:\n// each signal decreases by 3dB as they move to the center (from the panning function)\n// and the two signals mix on each channel, so we get -20 dB\nx.set(\\spread, 0, \\center, 0); // -20dB\n\n// no spread, panned fully right:\n// the signals fully mix in the right channel (+6 dB)\nx.set(\\spread, 0, \\center, 1); // -23 + 6 = -17db\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for sound of an alien weapon firing. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"raygun\", {arg amp = 0.5, sinfreq = 1000, glissf = 0.001, att = 0.01, rel = 0.9;\n var gliss = XLine.kr(sinfreq, sinfreq*glissf, rel);\n var snd = SinOsc.ar(gliss);\n var env = EnvGen.kr(Env.perc(att, rel), doneAction: 2);\n snd = snd * env * amp;\n Out.ar(0, snd);\n}).add;\n);\n\n(\nPbind(\n \\instrument, \"raygun\",\n \\dur, Pseq([0.75,0.75,0.75,0.75,0.25,0.25,0.25]*0.5, inf),\n \\amp, 0.4\n).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `LinkClock.numPeers` do?"}, {"role": "assistant", "content": "Gets the number of peers connected to the current Link session. When peers join or leave the session, the LinkClock broadcasts a `\\numPeers` notification"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = [1, 2, 3]\na.wrapAt(2) // same as at\na.wrapAt(3) // wraps\na.wrapAt([-1, 3, 1]) // array of indices\na@@3 //syntactic shortcut\n\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n 32.do{ |i|\n {\n var freq = pitches.wrapAt(i).midicps;\n var env = Env.perc.ar(Done.freeSelf);\n SinOsc.ar(freq) * 0.1 * env\n }.play;\n 0.2.wait\n }\n}\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = [1, 2, 3]\na.wrapAt(2) // same as at\na.wrapAt(3) // wraps\na.wrapAt([-1, 3, 1]) // array of indices\na@@3 //syntactic shortcut\n\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n 32.do{ |i|\n {\n var freq = pitches.wrapAt(i).midicps;\n var env = Env.perc.ar(Done.freeSelf);\n SinOsc.ar(freq) * 0.1 * env\n }.play;\n 0.2.wait\n }\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// alternating major and minor chords as a test\n(\n{\n var in, fft, resample;\n var key, transientdetection;\n\n in = Mix(SinOsc.ar((60 + [0, MouseX.kr(3, 4).round(1), 7]).midicps, 0, 0.1));\n\n // major dom 7 and minor 7; major keys preferred here\n // in = Mix(SinOsc.ar((60 + (MouseY.kr(0, 11).round(1.0)) + [0, MouseX.kr(3, 4).round(1), 7, 10]).midicps, 0, 0.1));\n\n fft = FFT(LocalBuf(4096), in); // for sampling rates 44100 and 48000\n\n key = KeyTrack.kr(fft);\n\n key\n// …\n```"}, {"role": "assistant", "content": "alternating major and minor chords as a test major dom 7 and minor 7; major keys preferred here (KeyTrack: Key tracker)"}]} +{"conversations": [{"role": "user", "content": "Explain `Pbjorklund` in SuperCollider briefly."}, {"role": "assistant", "content": "Pbjorklund — Euclidean Algorithm for generating traditional musical rhythms After an algorithm by E. Bjorklund. See paper by Godfried Toussaint. Category: Streams-Patterns-Events > Patterns > List."}]} +{"conversations": [{"role": "user", "content": "What is a UGen?"}, {"role": "assistant", "content": "A UGen is a unit generator: the primitive signal-processing node of the server. SinOsc, Saw, WhiteNoise, LPF and EnvGen are UGens, and they are wired into a graph inside a SynthDef."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `FoldIndex`."}, {"role": "assistant", "content": "```supercollider\n// indexing into a table\n(\n{\n var buf = LocalBuf.newFrom([200, 300, 400, 500, 600, 800]);\n var freq = FoldIndex.kr(buf, MouseX.kr(0, BufFrames.ir(buf) * 3));\n SinOsc.ar(freq) * 0.1\n}.play;\n);\n\n// the same using a global buffer\n(\nt = [200, 300, 400, 500, 600, 800];\nb = Buffer(s, t.size, 1);\n\n// alloc and set the values\ns.listSendMsg(b.allocMsg(b.setnMsg(0, t)).postln);\n\nSynthDef(\\help_Index, { |out = 0, bufnum = 0|\n Out.ar(out,\n SinOsc.ar(\n FoldIndex.kr(\n bufnum,\n MouseX.kr(0, BufFrames.ir(bufnum) * 3)\n ),\n 0,\n 0.5\n )\n )\n}).play(s, [\\bufnum, b.bufnum]);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `PsymNilSafe.maxNull` do?"}, {"role": "assistant", "content": "Getter and setter for PsymNilSafe's variable"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `AnalogOut`."}, {"role": "assistant", "content": "```supercollider\n// write a sine oscillator's output to a pin\n\n(\nSynthDef(\"help-AnalogOut\", { |out = 0|\n AnalogOut.ar(0, SinOsc.ar(10));\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = [1, 2, 3]\na.foldAt(2) // same as at\na.foldAt(3) // folds back\na.foldAt([-1, 3, 1]) // array of indices\na@|@3 //syntactic shortcut\n\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n 32.do{ |i|\n {\n var freq = pitches.foldAt(i).midicps;\n var env = Env.perc.ar(Done.freeSelf);\n SinOsc.ar(freq) * 0.1 * env\n }.play;\n 0.2.wait\n }\n}\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = [1, 2, 3]\na.foldAt(2) // same as at\na.foldAt(3) // folds back\na.foldAt([-1, 3, 1]) // array of indices\na@|@3 //syntactic shortcut\n\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n 32.do{ |i|\n {\n var freq = pitches.foldAt(i).midicps;\n var env = Env.perc.ar(Done.freeSelf);\n SinOsc.ar(freq) * 0.1 * env\n }.play;\n 0.2.wait\n }\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `EZNumber.font` do? What arguments does it take?"}, {"role": "assistant", "content": "Set the Font used by all the Arguments: font — An instance of Font.."}]} +{"conversations": [{"role": "user", "content": "Buffer.read fails and I get a path error. What should the path look like?"}, {"role": "assistant", "content": "On Windows use forward slashes or escaped backslashes inside the string: `Buffer.read(s, \"C:/sounds/kick.wav\")`. A single backslash starts an escape sequence, which is why `\"C:\\sounds\\kick.wav\"` fails. Also check the extension is real (`.wav`, `.aiff`, `.flac`) and that the file is not on a network path — the server reads it, not the language, and it may resolve differently. For sounds that ship with SuperCollider, `Platform.resourceDir +/+ \"sounds/a11wlk01.wav\"` is the portable form."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n~x.play;\n\n~x = { var alpha,beta; alpha = rrand(99,399); beta = alpha = rrand(99,399);Pan2.ar(LeakDC.ar(Normalizer.ar(BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(\nFreeVerb.ar(Formant.ar(TRand.kr(alpha,alpha+(rrand(5,20)),Impulse.kr(rrand(10,100))), TRand.kr(beta,beta+(rrand(5,20)),Impulse.kr(rrand(10,100))), EnvGen.kr(Env.adsr,Impulse.kr(rrand(100,666)))*rrand(666,3333),0.125),\nrrand(0.5,1.0),rrand(0.5,1.0),rrand(0.5,1.0))\n,100,6.0,12),1000,6.0,0),5000,6.0,0),10000,6.0,12),0.6,0.1)),0)\n};\n```"}, {"role": "assistant", "content": "A drone insect-string from:\r\n\r\nhttp://musicnumbers.wordpress.com/2011/11/25/nx010/."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ SinOscFB.ar(440, MouseX.kr(0, 4))*0.1 }.play\n\n\n{ SinOscFB.ar(MouseY.kr(10, 1000, 'exponential'), MouseX.kr(0.5pi, pi))*0.1 }.play\n\n\n{ SinOscFB.ar(100*SinOscFB.ar(MouseY.kr(1, 1000, 'exponential'))+200, MouseX.kr(0.5pi, pi))*0.1 }.play\n\n\n// Scope the wave form\n{ SinOscFB.ar([400, 301], MouseX.kr(0, 4), 0.3 }.scope;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ SinOscFB.ar(440, MouseX.kr(0, 4))*0.1 }.play\n\n\n{ SinOscFB.ar(MouseY.kr(10, 1000, 'exponential'), MouseX.kr(0.5pi, pi))*0.1 }.play\n\n\n{ SinOscFB.ar(100*SinOscFB.ar(MouseY.kr(1, 1000, 'exponential'))+200, MouseX.kr(0.5pi, pi))*0.1 }.play\n\n\n// Scope the wave form\n{ SinOscFB.ar([400, 301], MouseX.kr(0, 4), 0.3) }.scope;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// multiple usage of the same name:\na = { SinOsc.ar(\\freq.kr(440, 1.0)) + Saw.ar(\\freq.kr(440, 1.0) * 0.5) * 0.1 }.play;\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n\n// with different lag values:\na = { SinOsc.ar(\\freq.kr(440).lag(3.5)) + Saw.ar(\\freq.kr(440).lag(0.05) * 0.5) * 0.1 }.play;\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n\n// control saved to a variable:\n(\na = {\n var freq = \\freq.kr(440);\n SinOsc\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// multiple usage of the same name:\na = { SinOsc.ar(\\freq.kr(440, 1.0)) + Saw.ar(\\freq.kr(440, 1.0) * 0.5) * 0.1 }.play;\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n\n// with different lag values:\na = { SinOsc.ar(\\freq.kr(440).lag(3.5)) + Saw.ar(\\freq.kr(440).lag(0.05) * 0.5) * 0.1 }.play;\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n\n// control saved to a variable:\n(\na = {\n var freq = \\freq.kr(440);\n SinOsc.ar(freq.lag(3.5)) + Saw.ar(freq.lag(0.05) * 0.5) * 0.1;\n}.play;\n);\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n```"}]} +{"conversations": [{"role": "user", "content": "Supernova, Groups, Threads, Ndef?"}, {"role": "assistant", "content": "SuperCollider forum — Supernova, Groups, Threads, Ndef?\n\nAbout Ndef:\n\nAFAIK you can manually move a NodeProxy’s group into another group:\n\n```supercollider\n~pargroup = ParGroup(s);\n\nNdef(\\a, { Silent.ar(1) });\n\nNdef(\\a).group.moveToHead(~pargroup);\n```\n\nBut...\n\nNodeProxies use InFeedback.\n\nI was a little suspicious about this for parallel processing. As I recalled, InFeedback’s result depends on the order of execution:\n\n-\nIf the source node for the bus finished processing before the server reaches InFeedback, then InFeedback will output the block of audio being processed now.\n\n-\nIf the source node comes after the node containing InFeedback, then it will output the previous block of audio.\n\nIn both cases, these are the most recently available audio blocks. But, if the order of evaluation is not consistent, then the output may not be consistent.\n\nLet’s test that:\n\n```supercollider\nb = Bus.audio(s, 1);\n\na = { SinOsc.ar(200, 0, 0.1) }.play(outbus: b);\n\nc = { InFeedback.ar(b, 1).dup }.play(target: a, addAction: \\addAfter);\n\n(\nfork {\n var order = Pseq([\\moveBefore, \\moveAfter], inf).asStream;\n loop {\n c.perform(order.next, a);\n 1.0.wait;\n }\n}\n)\n```\n\nOops.\n\nThis means you can’t randomly throw Ndefs into ParGroups. If one Ndef reads a signal from another, then you have to make sure that the target Ndef comes later in a serial (regular) Group. (Correctness of the result should be more important than “optimal” usage of multiple cores.)\n\nIf you don’t, and if supernova happens to put the source and target Ndefs onto separate cores at roughly the same time, then the target might evaluate InFeedback either before or after the source finishes, and there’s no guarantee of this being consistent. So you might get clicks.\n\nhjh"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LatoocarfianC`."}, {"role": "assistant", "content": "```supercollider\n// default initial params\n{ LatoocarfianC.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `BinaryOpUGen`."}, {"role": "assistant", "content": "```supercollider\n// trigger an envelope\n(\n{\n var trig;\n trig = SinOsc.ar(1) > 0.1;\n EnvGen.kr(Env.perc, trig, doneAction: Done.none) * SinOsc.ar(440, 0, 0.1)\n}.play\n) // > outputs 0 or 1\n```"}]} +{"conversations": [{"role": "user", "content": "What does `EventPatternProxy.new` do?"}, {"role": "assistant", "content": "create a new instance with a pattern (the source). The pattern should be an event pattern (see"}]} +{"conversations": [{"role": "user", "content": "What model are you?"}, {"role": "assistant", "content": "I am sc-mind: a 198M MiniMind-3-MoE, eight layers, 768 wide, four experts with top-1 routing. I was trained from scratch on the SuperCollider documentation, class library and help pages, then fine-tuned on questions and answers about them."}]} +{"conversations": [{"role": "user", "content": "What does `MxUnit.gotoBeat` do? What arguments does it take?"}, {"role": "assistant", "content": "Container for a musical object (Instr, NDef, Spline etc); this is a single unit that has inlets and outlets which can be connected to other units Arguments: beat; atBeat; bundle."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// same as above, but we use a NetAddr with a port of nil, so we can receive from a specific host, but from any port\n\nn = NetAddr(\"127.0.0.1\", nil); // the url should be the one of computer of app 2\no = OSCresponderNode(n, '/test', { |t, r, msg| msg.postln }).add;\no.remove;\n```"}, {"role": "assistant", "content": "same as above, but we use a NetAddr with a port of nil, so we can receive from a specific host, but from any port (OSCresponderNode: client side network responder)"}]} +{"conversations": [{"role": "user", "content": "What does `MxUnit.parentEnvir` do? What arguments does it take?"}, {"role": "assistant", "content": "Container for a musical object (Instr, NDef, Spline etc); this is a single unit that has inlets and outlets which can be connected to other units Arguments: env."}]} +{"conversations": [{"role": "user", "content": "What is `PSVop` in SuperCollider?"}, {"role": "assistant", "content": "PSVop — Sieve pattern for arbitrary set operations of integer generators with point output Pattern for arbitrary set operations of integer generators with point output. For an introduction and more examples see Sieves_and_Psieve_patterns. Category: Libraries > miSCellaneous > Sieves and Psieve Patterns, Streams-Patterns-Events > Sieves and Psieve Patterns."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Looping sampler with crossfading. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\\simpler, {\n arg buf=0\n ,freq=220\n ,sampleStart=0\n ,loopStart=0\n ,loopLen=1 // between 0 (min) and 1 (max)\n ,fadeTime=0.1\n ,gate=1\n ,attack=0.01\n ,sustain=1\n ,release=1\n ,f0=220;\n\n var rate = freq / f0;\n var sr = rate*BufSampleRate.kr(buf);\n var fadeFrames = fadeTime*sr;\n var loopEnd = loopLen*(BufFrames.kr(buf) - loopStart) + loopStart;\n var loopFrames = loopEnd - loopStart + 1;\n var loopTime = (loopFrames - fadeFrames)/sr;\n var startUpTime = (loopStart - sampleStart)/sr;\n\n var trigLoop = TDuty.ar(Dseq([startUpTime + loopTime, Dseq([loopTime], inf)]), gapFirst:1);\n\n var phaseA = Phasor.ar(trigLoop, rate, sampleStart, inf, loopStart);\n var phaseB = Phasor.ar(trigLoop, rate, loopEnd - fadeFrames, inf, loopEnd - fadeFrames);\n\n var srcA = BufRd.ar(buf.numChannels, buf, phaseA);\n var srcB = BufRd.ar(buf.numChannels, buf, phaseB);\n\n var startLoop = SetResetFF.ar(trigLoop);\n var loopPan = Phasor.ar(trigLoop, 2/fadeFrames * rate, -1, inf, -1).clip(-1,1);\n\n var out = Select.ar(startLoop, [srcA, LinXFade2.ar(srcB, srcA, pan:loopPan)]);\n var env = EnvGen.ar(Env.asr(attack, sustain, release, 1), gate, doneAction:2);\n\n Out.ar(0, Splay.ar(out) * env);\n}).add;\n\n// Try it out:\n~buf = Buffer.read(s, Platform.resourceDir +/+ 'sounds/a11wlk01.wav');\n\nPdef(\\p, Pbind(*[\n instrument: \\simpler\n ,buf: ~buf\n ,octave: Prand([3,4,5],inf)\n ,degree: Pn(Plazy({Pseq([-4,0,5,7,9,12].scramble.clump(2),2)}))\n ,dur: 0.5\n ,strum: Prand([0, 0.125, 0.25], inf)\n ,strumEndsTogether: false\n ,loopStart: Pwhite(90000, 150000)\n ,sampleStart: Pwhite(50000, 85000)\n ,loopLen: 0.4\n ,fadeTime: 0.15\n ,attack: 0.25\n ,release: 4\n])).play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Trig`."}, {"role": "assistant", "content": "```supercollider\n{ Trig.ar(Dust.ar(1), 0.2) * FSinOsc.ar(800, 0.5) }.play\n\n{ Trig.ar(Dust.ar(4), 0.1) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Since the allpass delay has no audible effect as a resonator on\n// steady-state sound ...\n\n{ AllpassC.ar(WhiteNoise.ar(0.1), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// ...these examples add the input to the effected sound and compare variants so that you can hear\n// the effect of the phase comb:\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassN.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2)\n}.play)\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassL.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Since the allpass delay has no audible effect as a resonator on\n// steady-state sound ...\n\n{ AllpassC.ar(WhiteNoise.ar(0.1), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// ...these examples add the input to the effected sound and compare variants so that you can hear\n// the effect of the phase comb:\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassN.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2)\n}.play)\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassL.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2)\n}.play)\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassC.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2)\n}.play)\n\n\n// used as an echo - doesn't really sound different than Comb,\n// but it outputs the input signal immediately (inverted) and the echoes\n// are lower in amplitude.\n{ AllpassC.ar(Decay.ar(Dust.ar(1, 0.5), 0.2, WhiteNoise.ar), 0.2, 0.2, 3) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Buffer.read fails and I get a path error. What should the path look like?"}, {"role": "assistant", "content": "On Windows use forward slashes or escaped backslashes inside the string: `Buffer.read(s, \"C:/sounds/kick.wav\")`. A single backslash starts an escape sequence, which is why `\"C:\\sounds\\kick.wav\"` fails. Also check the extension is real (`.wav`, `.aiff`, `.flac`) and that the file is not on a network path — the server reads it, not the language, and it may resolve differently. For sounds that ship with SuperCollider, `Platform.resourceDir +/+ \"sounds/a11wlk01.wav\"` is the portable form."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nSynthDef(\"help-PulseCount\", { |out = 0|\n Out.ar(out,\n SinOsc.ar(\n PulseCount.ar(Impulse.ar(10), Impulse.ar(0.4)) * 200,\n 0, 0.05\n )\n )\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nSynthDef(\"help-PulseCount\", { |out = 0|\n Out.ar(out,\n SinOsc.ar(\n PulseCount.ar(Impulse.ar(10), Impulse.ar(0.4)) * 200,\n 0, 0.05\n )\n )\n}).play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// default initial params\n{ LatoocarfianN.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// default initial params\n{ LatoocarfianN.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `ZArchive.write` do? What arguments does it take?"}, {"role": "assistant", "content": "open an archive for Arguments: pathName — path that the file will be written to. Returns: a ZArchive"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n~chaos={\n var signal, myFrequency, frequencyMin=0.1, frequencyMax=30, myAmplitude, amplitudeMin=0.01, amplitudeMax=0.6, myPhase, phaseMin=0, phaseMax=1.5;\n myFrequency = Array.fill(2, {[rrand(frequencyMin, frequencyMax)]});\n myAmplitude = Array.fill(2, {[rrand(amplitudeMin, amplitudeMax)]});\n myPhase = Array.fill(2, {[rrand(phaseMin, phaseMax)]});\n signal = LeakDC.ar(ChaosGen.allSubclasses.choose.ar(myFrequency, myPhase, myAmplitude));\n Out.ar(0, signal);\n};\n);\n\n~chaos.scope\n```"}, {"role": "assistant", "content": "chaos gen modular function for modular pseudo ugen prototyping."}]} +{"conversations": [{"role": "user", "content": "What is `Stream`?"}, {"role": "assistant", "content": "Stream — Stream is the base class for classes that define streams"}, {"role": "user", "content": "What does `Stream.play` do?"}, {"role": "assistant", "content": "Streams that return numbers can be played directly with the play message. Streams that return events need to be wrapped in an EventStreamPlayer. See #-asEventStreamPlayer."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// play at the next beat, with offset 0.4\n(\nRoutine({ loop {\n \"***\".postln; 0.5.wait;\n \"_*_\".postln; 0.1.wait;\n} }).play(quant: [1, 0.4]);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "How do I stop all sound?"}, {"role": "assistant", "content": "s.freeAll stops every node on the server. On the language side, Ndef.clear and Pdef.clear clear the proxies. If a Pattern is still running, Pdef(\\name).stop does it; CmdPeriod immediately stops everything scheduled on the default clock."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `In` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n(\nSynthDef(\"help-PinkNoise\", { |out = 0|\n Out.ar(out, PinkNoise.ar(0.1))\n}).add;\n\nSynthDef(\"help-In\", { |out = 0, in = 0|\n var input;\n input = In.ar(in, 1);\n Out.ar(out, input);\n\n}).add;\n);\n\n// play noise on the right channel\nx = Synth(\"help-PinkNoise\", [\\out, 1]);\n\n// read the input and play it out on the left channel\nSynth.after(x, \"help-In\", [\\out, 0, \\in, 1]);\n```"}]} +{"conversations": [{"role": "user", "content": "What is the difference between ~foo and a local variable?"}, {"role": "assistant", "content": "`var foo` is a local: it exists only inside the function or file block that declares it. `~foo` is an environment variable: it lives in the current Environment, survives between executions of the same block, and is visible to everything running in that environment. That is why `~buf = Buffer.read(s, path)` works in one cell and `PlayBuf.ar(1, ~buf)` works in the next, while a `var` would be gone."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// NTMI.zoom sets all the influx'es inScalers AND RandomOrbit's excursion from current state.\n\nNTMI.zoom = NTMI.zoom?1;\n\n// tune this for jitter on zoom pot on NTMI\nSpec.add(\\zoom, [0, 1, \\lin, 0.025]);\n\nNTMI.setZoom = {|ev, val|\n val = \\zoom.asSpec.constrain(val);\n // \"global ZOOM f. RandomOrbits and Influxes: %\\n\".postf(val);\n NTMI.zoom = val;\n\n NTMI.inphlux.inScaler = NTMI.zoom;\n \"zoom: %\\n\".postf(NTMI.zoom);\n // return value\n val\n};\n// increment / decrement\nNTMI.incZoom = {|ev, inc=0.1|\n NTMI.setZoom((NTMI.zoom + inc));\n};\n```"}, {"role": "assistant", "content": "NTMI.zoom sets all the influx'es inScalers AND RandomOrbit's excursion from current state."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\n// The mul and add arguments of SinOsc themselves use MulAdd!\n// These two examples will create precisely the same synth graph:\nx = { SinOsc.ar(440, 0, 0.1, 0.05) }.play(s);\nx.trace; // You should see a \"MulAdd\" in the trace\nx.free;\n\nx = { MulAdd(SinOsc.ar(440, 0), 0.1, 0.05) }.play(s);\nx.trace;\nx.free;\n\n// In fact this will produce the same graph too - the separate multiply and add are optimised into one MulAdd\nx = { SinOsc.ar(440, 0) * 0.1 + 0.05 }.play(s;\nx.trace;\nx.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\n// The mul and add arguments of SinOsc themselves use MulAdd!\n// These two examples will create precisely the same synth graph:\nx = { SinOsc.ar(440, 0, 0.1, 0.05) }.play(s);\nx.trace; // You should see a \"MulAdd\" in the trace\nx.free;\n\nx = { MulAdd(SinOsc.ar(440, 0), 0.1, 0.05) }.play(s);\nx.trace;\nx.free;\n\n// In fact this will produce the same graph too - the separate multiply and add are optimised into one MulAdd\nx = { SinOsc.ar(440, 0) * 0.1 + 0.05 }.play(s);\nx.trace;\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Simple animated 2D user interface. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// needs shared memory interface (SC 3.5+)\n\nServer.default = s = Server.local;\ns.waitForBoot{\n if (s.hasShmInterface) {\n w = Window().front;\n u = UserView(w, w.view.bounds);\n f = { |x, y|\n var size = 20 + (y/4);\n k = k.center_(Point(x, y));\n k = k.size_(Size(size, size));\n b.setSynchronous(x.linlin(0,u.bounds.width, 1/4, 16));\n c.setSynchronous(50*(y/4));\n };\n w.onClose = { Ndef(\\sound).end(1) };\n u.background = Color.blue(0.5);\n u.animate = true;\n k = Rect(100, 100, 50, 50);\n u.drawFunc = {\n var osc = Ndef(\\osc).bus.getSynchronous * 0.5 + 0.5;\n Pen.strokeColor = Color.blue;\n Pen.addOval(k);\n Pen.fillRadialGradient(\n k.center,\n k.center,\n k.width/8,\n k.width,\n Color(1,1,1,0),\n Color(1,0,0,osc)\n );\n };\n \n u.mouseMoveAction = { |u, x, y| f.(x, y) }; \n u.mouseDownAction = { |u, x, y| f.(x, y) }; \n \n b = Bus.control(s);\n c = Bus.control(s);\n b.setSynchronous(4);\n c.setSynchronous(500);\n \n Ndef(\\osc, { SinOsc.kr(b.kr) });\n Ndef(\\sound).fadeTime = 1;\n Ndef(\\sound, { MoogFF.ar(LFSaw.ar(50+[0,1]), Ndef(\\osc).kr.linexp(-1,1,50,c.kr)) }).play;\n } {\n \"get SC 3.5 or higher ;)\".warn;\n };\n};\n```"}]} +{"conversations": [{"role": "user", "content": "What does `UScore.<<` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: score — (describe argument here). Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nSynthDef(\\dubecho,{|in, out, length = 1, fb = 0.8, sep = 0.012|\n var input = In.ar(in, 2);\n var feedback = LocalIn.ar(2);\n var output = LeakDC.ar(feedback*fb + input);\n output = HPF.ar(output, 400);\n output = LPF.ar(output, 5000);\n output = output.tanh;\n LocalOut.ar(DelayC.ar(output, 1, LFNoise2.ar(12).range([length,length+sep],[length+sep,length])).reverse);\n ReplaceOut.ar(out, output);\n}).add;\n\n// Example as effecet bus\n~bus = Bus.audio(s, 2);\n~echo = Synth(\\dubecho, [\\in, ~bus, \\length, TempoClock.default.tempo*(3/8), \\fb, 0.7, \\sep, 0.0012], addAction: \\addToTail);\n\n// send something\nplay{ Out.ar(~bus, LFGauss.ar(1, 0.1, loop:0, doneAction:2) * Blip.ar(80!2, 8)) }\n\n// turn it off\n~echo.free;\n```"}, {"role": "assistant", "content": "Fork of Bjorn's Dub echo, rewritten w/o the Feedback Quark (using LocalIn + LocalOut) and adding a ping pong (can be removed by deleting the .reverse method in the LocalOut line)."}]} +{"conversations": [{"role": "user", "content": "Explain `IRand` in SuperCollider briefly."}, {"role": "assistant", "content": "IRand — Single integer random number generator. Generates a single random integer value in uniform distribution from `lo` to `hi` . It generates this when the SynthDef first starts playing, and remains fixed for the duration of the synth's existence. Category: UGens > Random."}]} +{"conversations": [{"role": "user", "content": "What does `PathName.isFolder` do?"}, {"role": "assistant", "content": "returns a Boolean indicating whether or not the path represents a folder (not a file)."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// NTMI.zoom sets all the influx'es inScalers AND RandomOrbit's excursion from current state.\n\nNTMI.zoom = NTMI.zoom?1;\n\n// tune this for jitter on zoom pot on NTMI\nSpec.add(\\zoom, [0, 1, \\lin, 0.025]);\n\nNTMI.setZoom = {|ev, val|\n val = \\zoom.asSpec.constrain(val);\n // \"global ZOOM f. RandomOrbits and Influxes: %\\n\".postf(val);\n NTMI.zoom = val;\n\n NTMI.inphlux.inScaler = NTMI.zoom;\n \"zoom: %\\n\".postf(NTMI.zoom);\n // return value\n val\n};\n// increment / decrement\nNTMI.incZoom = {|ev, inc=0.1|\n NTMI.setZoom((NTMI.zoom + inc));\n};\n```"}, {"role": "assistant", "content": "NTMI.zoom sets all the influx'es inScalers AND RandomOrbit's excursion from current state."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\ns.bind {\n a = { |freq = 100| SinOsc.ar(freq, LFTri.ar(freq)) * 0.2 }.play;\n s.sync;\n a.set(\\freq, 400);\n}\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\ns.bind {\n a = { |freq = 100| SinOsc.ar(freq, LFTri.ar(freq)) * 0.2 }.play;\n s.sync;\n a.set(\\freq, 400);\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a bell in SuperCollider."}, {"role": "assistant", "content": "A bell is a set of inharmonic partials with a long percussive decay. The ratios below are the\nclassic bell ones; the envelope frees the Synth when it ends.\n\n```supercollider\n(\nSynthDef(\\bell, { |out = 0, freq = 440, amp = 0.2, dur = 3|\n var partials = [1, 2.76, 5.4, 8.93];\n var amps = [1, 0.5, 0.3, 0.15];\n var sig = SinOsc.ar(freq * partials) * amps;\n var env = EnvGen.kr(Env.perc(0.001, dur, 1, -6), doneAction: 2);\n Out.ar(out, Pan2.ar(Mix(sig) * env * amp, 0));\n}).add;\n);\nSynth(\\bell, [\\freq, 660, \\dur, 4]);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Object.writeArchive` do? What arguments does it take?"}, {"role": "assistant", "content": "Write an object to disk as a text Arguments: pathname — A String containing the resulting file's path.."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n{\n // LFSaw begins at 0, illustrates attack time better\n var sig = LFSaw.ar(440);\n var amps = Amplitude.ar(\n sig,\n attackTime: [0.001, 0.01],\n releaseTime: [0.01, 0.2]\n );\n [sig] ++ amps\n}.plot\n.superpose_(true)\n.plotColor_([Color.black, Color.green, Color.blue]);\n);\n\n(\n// use input amplitude to control SinOsc frequency\n{\n SinOsc.ar(\n Amplitude.kr(\n Blip.ar(3, 20) * LFNoise1.kr(0.1).range(0, 1),\n MouseX.kr(0.00\n// …\n```"}, {"role": "assistant", "content": "LFSaw begins at 0, illustrates attack time better use input amplitude to control SinOsc frequency (Amplitude: Amplitude follower)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n//listen to x and y output\n{Out.ar(0,Brusselator.ar(Impulse.kr(MouseY.kr(1,50,'exponential')),MouseX.kr(0.01,1,'exponential')))}.play\n\n//avoid DC offset (default gamma is 1.0, listening to x only, so take off gamma\n{Out.ar(0,Pan2.ar((Brusselator.ar(Impulse.kr(MouseY.kr(1,50,'exponential')),MouseX.kr(0.01,1,'exponential')))[0] - 1.0) )}.play\n\n\n//fun time, stable oscillation with these parameters\n{var mu = MouseY.kr(1.0,1.5); Out.ar(0,Pan2.\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n//listen to x and y output\n{Out.ar(0,Brusselator.ar(Impulse.kr(MouseY.kr(1,50,'exponential')),MouseX.kr(0.01,1,'exponential')))}.play\n\n//avoid DC offset (default gamma is 1.0, listening to x only, so take off gamma\n{Out.ar(0,Pan2.ar((Brusselator.ar(Impulse.kr(MouseY.kr(1,50,'exponential')),MouseX.kr(0.01,1,'exponential')))[0] - 1.0) )}.play\n\n\n//fun time, stable oscillation with these parameters\n{var mu = MouseY.kr(1.0,1.5); Out.ar(0,Pan2.ar(Brusselator.ar(0.0,MouseX.kr(0.01,0.1,'exponential'),mu,0.25)[0] ) )}.play\n\n\n{ Out.ar(0,Pan2.ar(Brusselator.ar(Impulse.kr(10),MouseX.kr(0.01,0.1,'exponential'),1.5,0.25,MouseY.kr(-1.0,1.0),0.0)[0]) )}.play\n\n\n{ Out.ar(0,Brusselator.ar(Impulse.kr(MouseY.kr(1,500,'exponential')),MouseX.kr(0.01,0.1,'exponential'),1.15,0.5,0.5,1.0) )}.play\n```"}]} +{"conversations": [{"role": "user", "content": "What does `WebView.toHtml` do? What arguments does it take?"}, {"role": "assistant", "content": "Fetch the HTML of the current Arguments: A callback function. Called with the resulting HTML string when the operation is finished.."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Plambda`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n/*\n\nA simple example:\nTwo patterns playing in parallel,\nsharing data between eachother\n\n*/\n(\n // a melody playing random scale degrees\n a = Pbind(\n \\dur, 0.125,\n \\octave, 4,\n \\degree, Plet(\\melody, pattern: Pwhite(0, 7))\n );\n\n // the bass, scale degrees sampled from the \\melody variable defined above\n b = Pbind(\n \\dur, 0.5,\n \\octave, 3,\n \\degree, Pget(\\melody, default: 1, repeats: inf).trace\n );\n\n // Play the patterns in parallel\n Plambda(\n Ppar([a, b], inf)\n ).play;\n);\n/*\n\nA more complex example:\nThree patterns running in parallel\n\n*/\n(\nSynthDef(\\sine,\n { |out = 0, freq = 440, sustain = 0.05, pan = 0, amp = 0.1|\n var env;\n env = EnvGen.kr(Env.perc(Rand(0.001, 0.02), sustain, AmpCompA.kr(freq)*amp), doneAction: Done.freeSelf);\n Out.ar(out, Pan2.ar(SinOsc.ar(freq), pan, env))\n }).add;\n);\n\n(\na = Plambda(\n Pseq([\n Pfindur(5,\n Ppar([\n Pbind(\\note, Plet(\\x, Prand([1, 5, 1, [10, 14]], inf)), \\dur, 8/3, \\pan, -1),\n Pbind(\\note, Plet(\\y, Pseq([5, 3, 2, 0, [0, 5, 6, 9]], inf)), \\dur, 0.5, \\pan, 1),\n Pbind(\\note, Pseq([Pget(\\x), Pget(\\y)], inf) + 12, \\pan, 0, \\dur, 2/3)\n ])\n ),\n Pbind(\\note, Pget(\\x, 0, 6) + [0, 5], \\dur, Pdup(inf, Prand([2/3, 1/6])))\n ], inf).trace(\\eventScope) // internally, the values are shared via \\eventScope\n);\n\nb = Pbindf(a, \\instrument, \\sine, \\legato, 0.1);\nb.play\n);\n\n// Play two copies of the complex pattern above in parallel, one of them transposed and playing with shorter durations\nPpar([b, Pbindf(b, \\ctranspose, 24, \\dur, Pkey(\\dur) * 0.25)]).play;\n```"}]} {"conversations": [{"role": "user", "content": "What are the arguments of Pan2?"}, {"role": "assistant", "content": "`Pan2.ar(in, pos, level)` — in is the mono signal, pos is -1 (left) to 1 (right) with 0 in the middle, and level scales the output. It is equal-power, so a centred signal is -3 dB per channel rather than half amplitude. `Pan2.ar(sig, SinOsc.kr(0.1))` is the simplest autopan."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Pchain`."}, {"role": "assistant", "content": "```supercollider\n// implicitly, the composition operator <> returns a Pchain when applied to a pattern.\n// so that a <> b creates a Pchain (a, b).\n// as seen above, in Pchain(a, b), a specifies (and overrides) b: b is the input to a.\n\n// the above example is equivalent to:\n\n(Pbind(\\degree, Pseq([1, 2, 3], inf)) <> (detune: [0, 4])).trace.play;\n\n(\na = Pbind(\\degree, Pseq([1, 2, 3], inf), \\dur, Prand([0.2, 0.4], inf));\nb = Pbind(\\detune, Pseq([-30, 0, [0, 40]], inf), \\dur, 0.1);\nc = b <> a;\nc.play; // see that the \\dur key of a is overridden by b\n);\n\n// also value streams can be composed\n(\na = Pfunc { |x| x + 1.33 };\nb = Pfunc { |x| x * 3 };\nc = Pseries(1, 2, inf);\n);\n\n// post some values from the composite streams:\n\nt = (a <> b).asStream;\n10.do { t.value(10).postln };\n\nt = (a <> b <> c).asStream;\n10.do { t.value(10).postln };\n\nt = (b <> c <> a).asStream;\n10.do { t.value(10).postln };\n```"}]} -{"conversations": [{"role": "user", "content": "I made a synth and I hear nothing. Where do I start?"}, {"role": "assistant", "content": "Start with the node tree, not the code: evaluate `s.plotTree`. If your Synth is not there, it never started or it already freed itself; if it is there, the problem is in the signal. Which of the two do you see?"}, {"role": "user", "content": "It's in the tree."}, {"role": "assistant", "content": "Then the node lives and the signal is being lost. Check three things in order: does the SynthDef reach `Out.ar(0, ...)` with bus 0; is any `amp`/`mul` zero; and is a filter closed, e.g. `LPF.ar(sig, 50)` on a 440 Hz sine. Paste the SynthDef and I will read it."}, {"role": "user", "content": "SynthDef(\\x, { |out = 0| Out.ar(out, LPF.ar(Saw.ar(60), 80) * 0.1) }).add; Synth(\\x, [\\out, 2]);"}, {"role": "assistant", "content": "Two things. You wrote a low-pass at 80 Hz over a 60 Hz saw, which leaves almost nothing above the fundamental — the patch is nearly a sine at 60 Hz at very low level. And you passed `\\out, 2`, so it is going to bus 2, not the master. Try `Synth(\\x)` with the default out and a cutoff of 800:\n\n```supercollider\nSynthDef(\\x, { |out = 0, cutoff = 800| Out.ar(out, LPF.ar(Saw.ar(60), cutoff) * 0.1) }).add;\nSynth(\\x);\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\np = PlayerMixer([\n Patch({ arg tempo;\n Impulse.ar( tempo )\n }\n ,[\n TempoPlayer.new\n ]),\n MIDIClockOut(\"IAC Driver\", \"IAC Bus 1\")\n ]);\n\np.play(atTime: 1)\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\np = PlayerMixer([\n Patch({ arg tempo;\n Impulse.ar( tempo )\n }\n ,[\n TempoPlayer.new\n ]),\n MIDIClockOut(\"IAC Driver\", \"IAC Bus 1\")\n ]);\n\np.play(atTime: 1)\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `List.permute` do?"}, {"role": "assistant", "content": "Returns a new List whose elements are the nthPermutation of the elements of the receiver. The receiver is unchanged."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes simple peak detection algorithm."}, {"role": "assistant", "content": "```supercollider\nq = q ? ();\n\n(\nq.s1 = {|q, left, item, right, rContextSize|\n //[left, item, right].postln;\n ((maxItem(item - left) ? 0) + (maxItem(item - right) ? 0)) * 0.5\n};\n\nq.peak1 = {|q, signal, windowSize = 4|\n var mean, sDev, aAbs, peaksSize;\n var rWindowSize = windowSize.reciprocal;\n var h = 3; // 1<= h <= 3\n var idxs = List[];\n var a = signal.collect{|val, i|\n // compute peak function value for each of the N points in T\n q.s1(\n signal.copyRange(i-windowSize, i-1), \n val, \n signal.copyRange(i+1, i + windowSize), \n val\n );\n };\n // Compute the mean m and standard deviation s of all positive values in array a;\n aAbs = a.abs;\n mean = aAbs.mean;\n sDev = aAbs.stdDev;\n\n// mean.postln;\n// sDev.postln;\n \n\n a.do{|val, i| // collect all indices that are concidered big \n if ((a[i]>0) && ((a[i]-mean) > (h*sDev))) {\n idxs.add(i);\n }\n };\n peaksSize = idxs.size.postln;\n\n // retain only one peak of any set of peaks within windowSize of each other\n idxs.inject([0], {|last, now, i|\n ((now - last.last) <= windowSize).if({\n (signal[now] > signal[last.last]).if({\n last.pop;\n last ++ now;\n }, {\n last;\n })\n }, {\n last ++ now; \n })\n })\n}\n);\n\n// apply peak1 to any \"signal\", i.e. a 1-dimensional sequence of numbers, play around with the windowSize param (and possibly h, see above).\nq.res = q.peak1(q.wireWset.amps, 4);q.res\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// q.zoom sets all the influx'es inScalers AND RandomOrbit's excursion from current state.\n\nq.zoom = q.zoom?1;\n\nq.setZoom = {|ev, val|\n val = val.clip(0.05, 1.0).round(0.05);\n // \"global ZOOM f. RandomOrbits and Influxes: %\\n\".postf(val);\n q.zoom = val;\n // do external funcs here\n try{ q.prez.ezs.value = q.zoom };\n q.inphlux.inScaler = q.zoom;\n // return value\n val\n};\n// increment / decrement\nq.incZoom = {|ev, inc=0.1|\n q.setZoom((q.zoom + inc));\n};\n\n\n// set it to poti on ana in 8 (it was 7, not worked)\nMKtl(\\xosc).elAt('inA').at(7).action.add(\\setZoom, {|el|\n var val = el.value.clip(0.05, 1).round(0.05);\n if (val != q.zoom) {\n \"zoom from xosc: %\\n\".postf(val);\n q.setZoom(val)\n };\n});\n```"}, {"role": "assistant", "content": "q.zoom sets all the influx'es inScalers AND RandomOrbit's excursion from current state."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ RLPF.ar(Saw.ar(200, 0.1), SinOsc.ar(XLine.kr(0.7, 300, 20), 0, 3600, 4000), 0.2) }.play;\n\n\n(\n{ var ctl = RLPF.ar(Saw.ar(5, 0.1), 25, 0.03);\n SinOsc.ar(ctl * 200 + 400) * 0.1;\n}.play;\n);\n\n\n(\n{ var ctl = RLPF.ar(Saw.ar(5, 0.1), MouseX.kr(2, 200, 1), MouseY.kr(0.01, 1, 1));\n SinOsc.ar(ctl * 200 + 400) * 0.1;\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ RLPF.ar(Saw.ar(200, 0.1), SinOsc.ar(XLine.kr(0.7, 300, 20), 0, 3600, 4000), 0.2) }.play;\n\n\n(\n{ var ctl = RLPF.ar(Saw.ar(5, 0.1), 25, 0.03);\n SinOsc.ar(ctl * 200 + 400) * 0.1;\n}.play;\n);\n\n\n(\n{ var ctl = RLPF.ar(Saw.ar(5, 0.1), MouseX.kr(2, 200, 1), MouseY.kr(0.01, 1, 1));\n SinOsc.ar(ctl * 200 + 400) * 0.1;\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n({ [5, 6, 2].choose.postln } sqrsum: { [2, -1, 3].choose.postln }).value\n\n(\n{ a = SinOsc.ar(335); b = SinOsc.ar(MouseX.kr(1, 1000, 1));\nsqrsum(a, b) * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n({ [5, 6, 2].choose.postln } sqrsum: { [2, -1, 3].choose.postln }).value\n\n(\n{ a = SinOsc.ar(335); b = SinOsc.ar(MouseX.kr(1, 1000, 1));\nsqrsum(a, b) * 0.1 }.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for little study on piano improvisation."}, {"role": "assistant", "content": "```supercollider\n/* Piano Gestures: A Little Study by mimetik\n\n This is a little study on piano improvisation, in particular on \"gestures\", by which I mean here little improvised phrasings.\n\n*/\n\nMIDIClient.init;\n\n/*\nChoose from the list of devices your internal MIDI router, so to send the notes to piano intrument in your favourite DAW\n*/\n\n~mOut = MIDIOut.new(3);\n\n//Set the scale to be Cmajor\n~scale=[0,2,4,5,7,9,11];\n\n//Define pattern proxies which will be modified by the task t below\n\na=PatternProxy(Pxrand([3,3,3,1,3,3],inf));\nb=PatternProxy(Pseq([1/2],inf));\nr=PatternProxy(Pseq([12],inf));\nn=Prand([4,8,16],inf).asStream;\n\nt=Task({\nPdef(\\x,Pbind(\\type,\\midi,\\chan,0,\n \\midiout,~mOut,\n \\scale,~scale,\n \\root,-12,\n \\degree,Pxrand([[0,3,5],[3,5,7],[4,6,8],[5,7,11]],inf),\n \\legato,1,\n \\amp,[{rrand(0.6,0.8)},{rrand(0.5,0.6)},{rrand(0.5,0.6)}]*0.7, \\dur,Prand([Pseq([1,1,1,1],1),Pseq([1,1,2],1),Pseq([1,2,1],1)],inf))).play(quant:1);\n\nPdef(\\y,Pbind(\\type,\\midi,\\chan,0,\n \\midiout,~mOut,\n \\scale,~scale,\n \\root,r,\n \\degree,a,\n \\legato,1,\n \\amp,{rrand(0.5,0.6)},\n\\dur,b)).play(quant:1);\n\n10.wait;\n\nt=Task({\n inf.do({\n if (0.7.coin,{ \n c=[[3,0,7,1,9,11,0,4],[[3,7],0,7,Rest,9,[0,11],0,4]].choose.scramble;\n r.source=Pseq([[12,24].wchoose([0.7,0.3])],inf);\n d=n.next;\n a.source=Pseq([Pxrand(c,d),Pxrand([3,3,3,1,3,3],inf)]);\n b.source=Pseq([Pseq([1/8],d),Pseq([1/2],inf)]);\n });\n rrand(3,4).wait;})}).play(quant:1);\n };\n).play(quant:1);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Button.doAction` do? What arguments does it take?"}, {"role": "assistant", "content": "The method called by the primitive upon releasing the Arguments: modifiers — A key modifier number, which is passed to the action as its second argument upon mouse-releasing the button.."}]} -{"conversations": [{"role": "user", "content": "What does `RedDiskInSampler.voicesLeft` do?"}, {"role": "assistant", "content": "Return number of free voices for this key i.e. the number of non-playing"}]} -{"conversations": [{"role": "user", "content": "How do I make a piece reproducible instead of a different take every time?"}, {"role": "assistant", "content": "Three things make a SuperCollider piece repeatable: a fixed seed, a fixed tempo, and no live input.\n\n```supercollider\n(\nthisThread.randSeed = 1234;\nTempoClock.default.tempo = 2;\nPbind(\\degree, Pwhite(0, 7, inf), \\dur, 0.25).play;\n)\n```\n\n`thisThread.randSeed` fixes the random sequence of the current thread, so `Pwhite`, `Prand` and friends give\nthe same values again. Recording with `s.record(path, duration: 30)` then makes the take an artifact rather\nthan a performance. Input from `MouseX` or a MIDI controller is the usual remaining source of difference."}]} -{"conversations": [{"role": "user", "content": "Who made you?"}, {"role": "assistant", "content": "I was trained by the person who runs this project, on top of the MiniMind architecture. My weights started from random numbers and learned from the SuperCollider sources — no teacher model, no distillation."}]} -{"conversations": [{"role": "user", "content": "What does `MxQuery.collect` do? What arguments does it take?"}, {"role": "assistant", "content": "Collects the resultset returning an array of whatever your function Arguments: function — an array."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// sound example\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n(\nvar a;\na = Pbrown(0.0, 1.0, 0.1, inf).asStream;\n{\n loop {\n Synth(\\help_sinegrain, [\\freq, a.next * 600 + 300]);\n 0.02.wait;\n }\n}.fork;\n);\n\n\n\n// parallel browninan motions\n(\nvar a\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// sound example\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n(\nvar a;\na = Pbrown(0.0, 1.0, 0.1, inf).asStream;\n{\n loop {\n Synth(\\help_sinegrain, [\\freq, a.next * 600 + 300]);\n 0.02.wait;\n }\n}.fork;\n);\n\n\n\n// parallel browninan motions\n(\nvar a, x, f;\na = Pbrown(0.0, 1.0, 0.1, inf);\n\nf = { |pattern, dt = 0.02, min = 300, max = 900|\n {\n var x = pattern.asStream;\n loop {\n Synth.grain(\\help_sinegrain, [\\freq, x.next.linexp(0, 1, min, max), \\sustain, dt]);\n dt.wait;\n }\n }.fork;\n}.flop;\n\n// 3 parallel motions\nf.(a, [0.02, 0.08, 0.16]);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Digital Bird sounds."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\birdy, {arg freq=1500, amp=0.5, rate=10;\n var osc, son, convIn, rand;\n osc=LFCub;\n rand = LFNoise1.ar(rate);\n convIn=LinCongN.ar(rate);\n son = osc.ar(Convolution.ar(convIn,convIn));\n freq = Latch.kr(rand.range(0,1).round(0.1), rand) * freq;\n freq = osc.ar(osc.ar(rand)*rand.range(0,10)).range(freq, freq*3);\n son = Formlet.ar(son, freq, convIn.abs*0.1, rand.abs);\n son = Normalizer.ar(son, 0.9, 0.1) * convIn.abs * LFPulse.kr(LFPulse.kr(rand.abs), 0, rand.abs);\n son = son + GVerb.ar(son, 99, 2, mul: rand.range(0,0.3));\n son * amp\n}).play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PulseCount`."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\"help-PulseCount\", { |out = 0|\n Out.ar(out,\n SinOsc.ar(\n PulseCount.ar(Impulse.ar(10), Impulse.ar(0.4)) * 200,\n 0, 0.05\n )\n )\n}).play;\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `BiPanB2`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var w, x, y, p, q, a, b, c, d;\n\n p = LFSaw.ar(200);\n q = LFSaw.ar(301);\n\n // B-format encode\n #w, x, y = BiPanB2.ar(p, q, MouseX.kr(-1, 1), 0.1);\n\n // B-format decode to quad\n #a, b, c, d = DecodeB2.ar(4, w, x, y);\n\n [a, b, d, c] // reorder to my speaker arrangement: Lf Rf Lr Rr\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `BusPlug`."}, {"role": "assistant", "content": "```supercollider\nb = BusPlug.new;\n{ Blip.ar(b + 5) }.play;\nb.bus.set(12);\n```"}]} +{"conversations": [{"role": "user", "content": "What is `LocalBuf`?"}, {"role": "assistant", "content": "LocalBuf — Allocate a buffer local to the synth"}, {"role": "user", "content": "What does `LocalBuf.newFrom` do?"}, {"role": "assistant", "content": "Allocates a new buffer from a given list of values"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\\bigLocalBuf, {\n LocalBuf(88200).set(Array.fill(88200, { #[0, 0.25, 0.5, 0.75, 1.0].choose }))\n}).add;\n\nSynthDescLib.at(\\bigLocalBuf).constants;\n// prints: FloatArray[1, 88200, 0, 0.75, 0.5, 0.25]\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = List[1, 2, 3]\na.wrapAt(2) // same as at\na.wrapAt(3) // wraps\na.wrapAt([-1, 3, 1]) // array of indices (returns not a list, but an array)\na@@3 //syntactic shortcut\n\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n 32.do{ |i|\n {\n var freq = pitches.wrapAt(i).midicps;\n var env = Env.perc.ar(Done.freeSelf);\n SinOsc.ar(freq) * 0.1 * env\n }.play;\n 0.2.wait\n }\n}\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = List[1, 2, 3]\na.wrapAt(2) // same as at\na.wrapAt(3) // wraps\na.wrapAt([-1, 3, 1]) // array of indices (returns not a list, but an array)\na@@3 //syntactic shortcut\n\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n 32.do{ |i|\n {\n var freq = pitches.wrapAt(i).midicps;\n var env = Env.perc.ar(Done.freeSelf);\n SinOsc.ar(freq) * 0.1 * env\n }.play;\n 0.2.wait\n }\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n# x,y,z = RosslerL.ar(MouseX.kr(1, 200));\nPan2.ar(Pulse.ar(x.range(100,1000), y.range(0,1), 0.3), z)\n}.play(s)\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n# x,y,z = RosslerL.ar(MouseX.kr(1, 200));\nPan2.ar(Pulse.ar(x.range(100,1000), y.range(0,1), 0.3), z)\n}.play(s)\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `Semaphore` in SuperCollider briefly."}, {"role": "assistant", "content": "Semaphore — control parallel execution of threads Category: Scheduling."}]} +{"conversations": [{"role": "user", "content": "Build a slowly evolving drone with Ndef."}, {"role": "assistant", "content": "Ndef gives you a named patch you can redefine while it plays; the filter is a separate node in the\nchain so you can change it on its own.\n\n```supercollider\n(\nNdef(\\drone, { |freq = 55, amp = 0.12|\n var detune = [0, 0.07, -0.11];\n var sig = Mix(Saw.ar(freq * (1 + detune))) * amp;\n LPF.ar(sig, 400);\n}).play;\n\nNdef(\\drone)[1] = \\filter -> { |in| RLPF.ar(in, LFNoise1.kr(0.1).exprange(200, 1800), 0.3) };\n)\n```\n\nRedefining Ndef(\\drone, { ... }) later crossfades to the new definition; Ndef(\\drone).stop stops it."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `BufSampleRate`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n// compares a 1102.5 Hz sine tone (11025 * 0.1, left) with a 1100 Hz tone (right)\n// the apollo sample has a sample rate of 11.025 kHz\n(\n{\n var freq;\n freq = [BufSampleRate.kr(b) * 0.1, 1100];\n SinOsc.ar(freq, 0, 0.1)\n}.play;\n);\n\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Crackle`."}, {"role": "assistant", "content": "```supercollider\n{ Crackle.ar(1.95, 0.5) }.play;\n\n// modulate chaos parameter\n{ Crackle.ar(Line.kr(1.0, 2.0, 3), 0.5, 0.5) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\"help-LFClipNoise\", { |out = 0|\n Out.ar(out,\n LFClipNoise.ar(1000, 0.25)\n )\n}).play;\n);\n\n// modulate frequency\n(\nSynthDef(\"help-LFClipNoise\", { |out = 0|\n Out.ar(out,\n LFClipNoise.ar(XLine.kr(1000, 10000, 10), 0.25)\n )\n}).play;\n);\n\n// use as frequency control\n(\nSynthDef(\"help-LFClipNoise\", { |out = 0|\n Out.ar(out,\n SinOsc.ar(\n LFClipNoise.ar(4, 200, 600),\n 0, 0.2\n )\n )\n}).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\"help-LFClipNoise\", { |out = 0|\n Out.ar(out,\n LFClipNoise.ar(1000, 0.25)\n )\n}).play;\n);\n\n// modulate frequency\n(\nSynthDef(\"help-LFClipNoise\", { |out = 0|\n Out.ar(out,\n LFClipNoise.ar(XLine.kr(1000, 10000, 10), 0.25)\n )\n}).play;\n);\n\n// use as frequency control\n(\nSynthDef(\"help-LFClipNoise\", { |out = 0|\n Out.ar(out,\n SinOsc.ar(\n LFClipNoise.ar(4, 200, 600),\n 0, 0.2\n )\n )\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LFPulse`."}, {"role": "assistant", "content": "```supercollider\n{ LFPulse.ar(XLine.kr(1, 200, 10), 0, 0.2, 0.1) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nx = {OteyPiano.ar(50,0.5)}.play;\n);\nx.free;\n\n//Define piano synthdef\n(\nSynthDef(\\help_oteypiano, { |out=0, freq=440,gate=1, amp=0.5,rho=1|\n var son = OteyPiano.ar(freq, amp, rho:rho)*EnvGen.ar(Env.asr(0,1,0.1),gate,doneAction:2);\n Out.ar(out, Pan2.ar(son * 0.1, LinLin.kr(freq,36.midicps,90.midicps,-0.75,0.75)));\n}).add;\n);\n\n//Use it.\n(\nPbind(\n \\in\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nx = {OteyPiano.ar(50,0.5)}.play;\n);\nx.free;\n\n//Define piano synthdef\n(\nSynthDef(\\help_oteypiano, { |out=0, freq=440,gate=1, amp=0.5,rho=1|\n var son = OteyPiano.ar(freq, amp, rho:rho)*EnvGen.ar(Env.asr(0,1,0.1),gate,doneAction:2);\n Out.ar(out, Pan2.ar(son * 0.1, LinLin.kr(freq,36.midicps,90.midicps,-0.75,0.75)));\n}).add;\n);\n\n//Use it.\n(\nPbind(\n \\instrument, \\help_oteypiano,\n \\delta, 1,\n \\dur, 3,\n \\degree, Pseq([1,3,5], inf),\n \\rho, Pwhite(0.1,3) //comment this line to get standard sound\n).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `ContiguousBlockAllocator.reserve` do?"}, {"role": "assistant", "content": "Mark a specific range of addresses as used so that the alloc method will not return any addresses within that"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Create a new empty collections with size 3:\nx = Array.new(3);\ny = Array.new(3);\nz = List.new(3);\n\n// Try to add 7 items to the array and list.\n// If the array exceeds maxSize, it will only\n// grow to an internally specified max size.\n(\n7.do { |i|\n x.add(i);\n y = y.add(i); // reassign array y on each add\n z.add(i);\n};\n);\n\n// Attempt to access the 5th item:\nx.at(4); // -> nil (out of bounds)\ny.at(4); // -> 4\nz.at(4); // -> 4\n\n// x grew only to size 4\nx.postln; // -> [ 0, 1, 2, 3 ]\ny.postln; // -> [ 0, 1, 2\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Create a new empty collections with size 3:\nx = Array.new(3);\ny = Array.new(3);\nz = List.new(3);\n\n// Try to add 7 items to the array and list.\n// If the array exceeds maxSize, it will only\n// grow to an internally specified max size.\n(\n7.do { |i|\n x.add(i);\n y = y.add(i); // reassign array y on each add\n z.add(i);\n};\n);\n\n// Attempt to access the 5th item:\nx.at(4); // -> nil (out of bounds)\ny.at(4); // -> 4\nz.at(4); // -> 4\n\n// x grew only to size 4\nx.postln; // -> [ 0, 1, 2, 3 ]\ny.postln; // -> [ 0, 1, 2, 3, 4, 5, 6 ]\nz.postln; // -> List[ 0, 1, 2, 3, 4, 5, 6 ]\n```"}]} +{"conversations": [{"role": "user", "content": "What does `PV_Control.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Tracks Magnitudes and Reduces Output of Bins Arguments: buffer0 — Buffer created by the FFT when analysing the incoming signal.; buffer1 — Buffer to which PV_Control writes the alterations to be made to the magnitude of each bin. These values are scaled to be sent to MidEQ UGens, which will reduce the magnitude of the bins being attenuated. thresh=0.6, mulFactor=0.8, limiter=10, attackReleaseFrames=50, sustainZeroFrames= 100, waitGoFra; thresh — Magnitude is summed over time and multiplied by mulFactor. When a bin accumulates magnitude that crosses this threshold, it will be zeroed out. Lower numbers == quicker detection of feedback.; mulFactor — Summed amplitude over time is multiplied by this number. Lower numbers == quicker detection of feedback.; limiter — Limits the maximum magnitude of each of the bins.; attackReleaseFrames — The number of frames the algorithm takes to ramp the magnitude of the bin down from 1*mag to 0*mag.; sustainZeroFrames — The number of frames the bin is held to a magnitude of 0.; waitGoFrames — The number of frames algorithm waits before it starts to duck the incoming signal.."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `BPF`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// synthdefs to play with\n(\nSynthDef(\\noise_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, rq = 0.1, amp = 0.1|\n var sig = { WhiteNoise.ar } ! 2;\n sig = BPF.ar(sig, freq, rq) *\n EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2) *\n (rq ** -1) * (250 / (freq ** 0.8));\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\sin_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { SinOsc.ar(freq, Rand(0, 2pi)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n\n\nSynthDef(\\saw_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { VarSaw.ar(freq, Rand(0, 1)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `LinSelectX`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar(300),\n Pulse.ar(230)\n ];\n\n LinSelectX.ar(MouseX.kr(0, 1) * a.size, a) * 0.2\n}.play;\n);\n\n(\n{\n var a;\n a = [\n SinOsc.kr(0.25),\n LFSaw.kr(10),\n LFPulse.kr(0.3)\n ];\n\n SinOsc.ar(LinSelectX.kr(MouseX.kr(0, 1) * a.size, a) * 300 + 400) * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n(\np = Pbind(\n \\instrument, \\synth_1a,\n \\preAmp, PL(\\preAmp), \n \\amp, PL(\\amp), \n \\midinote, PLseq(\\seq) + PL(\\seqAdd), \n \\dur, 0.2\n);\n\n~spec = 4.collect { |i| [\\seq, [12*i + 24, 12*i + 48, \\lin, 1, 24*i + 36] ! 5, \n \\seqAdd, [0, 12, \\lin, 1, 0],\n \\amp, [0, 0.15, \\lin, 0.01, 0.07 - (0.01 * i)],\n \\preAmp, [5, 50, \\lin, 0.01, 20]] };\n);\n\n// run all players in sync by passing a quant arg\n\nv = VarG\n// …\n```"}, {"role": "assistant", "content": "run all players in sync by passing a quant arg EventStreamPlayers derived from Pbind are run in (VarGui: slider / player gui to set envir variables and synth controllers and play synths, event patterns and tasks)"}]} +{"conversations": [{"role": "user", "content": "What does `Lorenz2DN.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "lorenz 2D chaotic generator Arguments: minfreq — minimum frequency in Hertz; maxfreq — maximum frequency in Hertz; s, r, b — equation variables; h — integration time step; x0 — initial value of x; y0 — initial value of y; z0 — initial value of z."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `LFSaw`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\nfork {\n ~group = Group();\n\n 2.wait;\n\n SynthDef(\\buzz, {\n |out = 0, freq = 300, amp = 0.1, filter = 1.7|\n var sig = LFSaw.ar(freq * [1, 3, 5], 0, amp * [1, 0.5, 0.25]).sum;\n sig = LPF.ar(sig, freq * filter);\n Out.ar(out, sig);\n }).add;\n\n [50, 53, 58, 46, 60].midicps.do {\n |f, i|\n Synth(\\buzz, [\n \\out: 0, \\freq, f, \\filter: (i / 2) + 1\n ], target:~group);\n 2.wait;\n };\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `TwoZero`."}, {"role": "assistant", "content": "```supercollider\n{ TwoZero.ar(WhiteNoise.ar(0.125), XLine.kr(20, 20000, 8), 1) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "What is `PV_ChainUGen`?"}, {"role": "assistant", "content": "PV_ChainUGen — Base class for UGens that operate on FFT chains"}, {"role": "user", "content": "What does `PV_ChainUGen.fftSize` do?"}, {"role": "assistant", "content": "Returns the FFT chain buffer's size. `(`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var chain = FFT(LocalBuf(1024));\n chain.fftSize.poll;\n 0.0\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// The done action is invoked after maxFadeNum.\n\n(\nx = {\n var lfo = LFDNoise3.kr(0.2);\n DXMix.ar(\n Dseq([0, 1], inf),\n `[\n Saw.ar(lfo.range(40, 90) * [1, 1.02], 0.03),\n { BPF.ar(PinkNoise.ar(0.05), lfo.range(200, 5000), 0.1) } ! 2\n ],\n fadeTime: 0.5,\n stepTime: 1,\n fadeMode: 0, // check with other modes too\n maxFadeNum: 5,\n doneAction: 2\n )\n}.play\n;\n\nx.release\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// The done action is invoked after maxFadeNum.\n\n(\nx = {\n var lfo = LFDNoise3.kr(0.2);\n DXMix.ar(\n Dseq([0, 1], inf),\n `[\n Saw.ar(lfo.range(40, 90) * [1, 1.02], 0.03),\n { BPF.ar(PinkNoise.ar(0.05), lfo.range(200, 5000), 0.1) } ! 2\n ],\n fadeTime: 0.5,\n stepTime: 1,\n fadeMode: 0, // check with other modes too\n maxFadeNum: 5,\n doneAction: 2\n )\n}.play\n);\n\nx.release\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `Environment` in SuperCollider briefly."}, {"role": "assistant", "content": "Environment — A dictionary which can serve as a 'name space' for functions An Environment is an IdentityDictionary with additional features that allow it to serve as a 'name space' within which functions can be defined and/or evaluated. Category: Collections > Unordered."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BiPanB2`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var w, x, y, p, q, a, b, c, d;\n\n p = LFSaw.ar(200);\n q = LFSaw.ar(301);\n\n // B-format encode\n #w, x, y = BiPanB2.ar(p, q, MouseX.kr(-1, 1), 0.1);\n\n // B-format decode to quad\n #a, b, c, d = DecodeB2.ar(4, w, x, y);\n\n [a, b, d, c] // reorder to my speaker arrangement: Lf Rf Lr Rr\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for exploring of morphing cycled envelopes (i.e: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\ro_v19, {\n var freq = 40.rrand(90).debug('base freq');\n var seed = thisThread.randSeed = 1000000000.rand.debug('seed');\n var gen = [LFNoise2,LFNoise0,SinOsc,LFPulse,LFSaw];\n var sig = Splay.ar({\n var i = 4.exprand(40).asInteger;\n Median.ar(\n 3.exprand(18),\n EnvGen.ar(\n Env( // wave form\n [0] ++ Array.fill(i-1, { \n gen.choose.kr(\n 0.25.coin.if({ gen.choose.kr(0.01.exprand(0.1)).exprange(0.1,1) }, { 0.1.exprand(1) }), \n mul: 0.25.coin.if({ gen.choose.kr(0.05.exprand(10)).range(0.1,1) }, { 0.1.rrand(1) })\n )\n }) ++ [0],\n Array.rand(i-1, 0.1,1.0).normalizeSum,\n [[-5.0.rrand(5),\\sin].choose] ++ Array.fill(i-2, {\n [\\sin ! 1.rrand(6), -5.0.rrand(5) ! 1.rrand(4)].flat.choose\n }) ++ [[-5.0.rrand(5),\\sin].choose]\n ).circle,\n timeScale: Duty.kr( // freq\n Drand([4,8,16,24], inf), 0,\n Dwrand([1,2,4,8,16,32,64]*freq, ((14..7) ** 1.rrand(3)).normalizeSum, inf) // octave\n * 0.75.coin.if({ Duty.kr( // note\n [Dxrand, Drand].choose.new([0.125,0.25,0.5,1,2,4,6,8,12], inf), 0,\n Dshuf({ (0..11).choose.midiratio } ! 1.exprand(8), inf)\n ) }, { (0..11).choose.midiratio })\n ).reciprocal\n )\n ) * EnvGen.kr( // rhythm\n Env.perc(\n 0.01.exprand(0.4) * 0.25.coin.if({ Duty.kr( // atk\n Drand([0.5,1,2,4,8,12,16], inf), 0,\n Dshuf({ [1,2,3,4].choose } ! 1.exprand(8), inf)\n ) }, { 1 }),\n 0.1.exprand(4) * 0.75.coin.if({ Duty.kr( // release\n Drand([0.5,1,2,4,8,12,16], inf), 0,\n Dshuf({ [1,2,4,8,16].choose.reciprocal } ! 1.exprand(8), inf)\n ) }, { 1 }),\n LFNoise2.kr(0.1.exprand(10)).range(0.05,1), // appearance\n LFNoise2.kr(0.1.exprand(10)).range(-4,4),\n ).circle\n );\n } ! 3.rrand(9).debug('source'));\n BHiShelf.ar(\n GVerb.ar(\n Rotate2.ar(sig[0], sig[1], Duty.kr(Drand([2,4,8],inf), 0, Drand([-1,1,0],inf)) * LFSaw.kr(0.1.exprand(1))),\n 40.rrand(150).debug('room')\n ),\n LFNoise2.kr(0.1.exprand(0.5)).range(4000,6500),\n LFNoise2.kr(0.1.exprand(1)).range(1,3),\n LFNoise2.kr(0.1.exprand(1)).range(-24,-16)\n );\n}).play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// compare this:\n(\na = {\n var x, y;\n x = NamedControl.kr(\\freq, 440).lag(3.5);\n y = NamedControl.kr(\\freq, 440).lag(1);\n SinOsc.ar([x, y] * [2, 1.2]) * 0.1\n}.play;\n);\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n\n// to this:\n(\na = {\n var x, y;\n x = Control.names([\\freq]).kr(440).lag(3.5);\n y = Control.names([\\freq]).kr(440).lag(1); // this hangs when set\n SinOsc.ar([x, y] * [2, 1.2]) * 0.1\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// compare this:\n(\na = {\n var x, y;\n x = NamedControl.kr(\\freq, 440).lag(3.5);\n y = NamedControl.kr(\\freq, 440).lag(1);\n SinOsc.ar([x, y] * [2, 1.2]) * 0.1\n}.play;\n);\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n\n// to this:\n(\na = {\n var x, y;\n x = Control.names([\\freq]).kr(440).lag(3.5);\n y = Control.names([\\freq]).kr(440).lag(1); // this hangs when set\n SinOsc.ar([x, y] * [2, 1.2]) * 0.1\n}.play;\n);\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ SinOsc.ar(MouseX.kr(40, 10000, 1), 0, 0.1) }.play;\n{ SinOsc.ar(MouseX.kr(500, 10000, 1).poll, 0, 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ SinOsc.ar(MouseX.kr(40, 10000, 1), 0, 0.1) }.play;\n{ SinOsc.ar(MouseX.kr(500, 10000, 1).poll, 0, 0.1) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a snare drum in SuperCollider."}, {"role": "assistant", "content": "Two ingredients: a short tonal body and band-passed noise for the rattle.\n\n```supercollider\n(\nSynthDef(\\snare, { |out = 0, amp = 0.6|\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -6), doneAction: 2);\n var body = SinOsc.ar(180) * 0.4;\n var rattle = BPF.ar(WhiteNoise.ar, 1800, 0.4) * 3;\n Out.ar(out, Pan2.ar((body + rattle) * env * amp));\n}).add;\n);\nSynth(\\snare);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `WebView.title` do?"}, {"role": "assistant", "content": "The title of the current Returns: A String."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// The following files are test materials on my machine; you will subsitute your own filenames here\n// A major\nd = Buffer.read(s, \"/Volumes/data/stevebeattrack/samples/100.wav\");\n// F major; hard to track!\nd = Buffer.read(s, \"/Volumes/data/stevebeattrack/samples/115.wav\");\n\n// straight forward since no transients; training set from MIREX2006\n// 01 = A major\n// 57 = b minor\n// 78 e minor\n// 08 Bb major\n\nd = Buffer.read(s, \"/Users/nickcollins/Desktop/ML/training_wav/78.wav\")\n\n(\n{\n var in, fft, resample;\n var\n// …\n```"}, {"role": "assistant", "content": "The following files are test materials on my machine; you will subsitute your own filenames here F major; hard to track! (KeyTrack: Key tracker)"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(//*********PREPARE**********\np.pop;\n//Any code that needs to access your own environment goes here\np = ProxySpace.push(s);\n~fxLoop.play.fadeTime_(5);\n);\n\n(//*********FXLoop**********\n~fxLoop = {\n var in = SoundIn.ar([0,1]);\n in;\n}\n)\n```"}, {"role": "assistant", "content": "Code for using Supercollider as a realtime livecode FX processor for audio input. Blog post explaing this code: http://schemawound.com/post/53528545022/fxloop."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Resonz` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// 1st, evaluate a synthdef\n(\nSynthDef(\"pitchFromNoise\", { arg out = 0;\n Out.ar(\n out,\n Resonz.ar(\n WhiteNoise.ar(15),\n LFNoise0.kr(2, 110, 660),\n 0.005\n )\n )\n}).add;\n);\n\n// 2nd, make 2 synths\n(\nSynth(\"ringModulation\");\nSynth(\"pitchFromNoise\", [\\out, 1]);\n);\n\n// 3rd, tell the server to list its nodes\n(\ns.queryAllNodes;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// this does not work:\n(\n{\n var trig = Dust.ar(4);\n Trig.kr(trig, 0.1) * SinOsc.ar(800) * 0.1\n}.play;\n);\n\n// this works:\n(\n{\n var trig = T2K.kr(Dust.ar(4));\n Trig.kr(trig, 0.1) * SinOsc.ar(800) * 0.1\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// this does not work:\n(\n{\n var trig = Dust.ar(4);\n Trig.kr(trig, 0.1) * SinOsc.ar(800) * 0.1\n}.play;\n);\n\n// this works:\n(\n{\n var trig = T2K.kr(Dust.ar(4));\n Trig.kr(trig, 0.1) * SinOsc.ar(800) * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is Ndef used for?"}, {"role": "assistant", "content": "Ndef is the JITLib node proxy: a named placeholder for a running signal chain that you can redefine while it plays. `Ndef(\\drone, { SinOsc.ar(55) * 0.1 }).play` starts it, and calling Ndef(\\drone, { ... }) again crossfades to the new definition without restarting the sound. It also supports chaining, `Ndef(\\drone)[1] = \\filter -> { |in| LPF.ar(in, 800) }`, which is the idiomatic way to build and modify a live patch."}]} +{"conversations": [{"role": "user", "content": "What is `PV_BinShift` in SuperCollider?"}, {"role": "assistant", "content": "PV_BinShift — Shift and stretch bin position. Shift and scale the positions of the bins. Can be used as a very crude frequency shifter/scaler. Category: UGens > FFT."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Just a dirty FM bass shuffling. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\nfork{\n SynthDef(\\basicFM, {|out = 0, gate = 1, amp = 1, carFreq = 1000, modFreq = 100, modAmount = 2000, clipAmount = 0.1|\n var modEnv = EnvGen.ar(Env.adsr(0.5, 0.5, 0.7, 0.1, peakLevel: modAmount), gate);\n var mod = SinOsc.ar(modFreq) * modEnv;\n var car = SinOsc.ar(carFreq + mod);\n var ampEnv = EnvGen.ar(Env.adsr(0.1, 0.3, 0.7, 0.2, peakLevel: amp), gate, doneAction: 2);\n var clip = clipAmount * 500;\n Out.ar(out, (car * ampEnv * clip).clip(-0.7, 0.7) * 0.1);\n }).add;\n\n s.sync;\n\n Pbind(*[\n instrument: \\basicFM,\n out: [0, 1],\n dur: Pseq([1/7, 1/3] / 1.2, inf),\n sustain: Pkey(\\dur),\n amp: 1/4,\n carFreq: Pseq([1, 1, 1, 2] * 350, inf),\n modFreq: Pkey(\\carFreq) * (1/8),\n modAmount: Pseq([2, 1, 0.5, 2, 1, 0.5, 2, 1, 2, 1, 0.5, 2, 1, 0.5, 2, 4] * 500, inf),\n clipAmount: Pseq([Pn(0.1, 32), Pn(1, 32)], inf)\n ]).play;\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `NRand`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-NRand\", { |out = 0, n = 0|\n Out.ar(out,\n FSinOsc.ar(\n NRand(1200.0, 4000.0, n),\n 0, Line.kr(0.2, 0, 0.01, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n(\nn = 0;\nRoutine({\n inf.do({ |i|\n Synth.new(\"help-NRand\", [\\n, n]); 0.05.wait;\n })\n}).play;\n);\n\nn = 1;\nn = 2;\nn = 4;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `PLFPulse.new` do? What arguments does it take?"}, {"role": "assistant", "content": "UGenPatterns quark library Arguments: freq; iphase — Fixed.; width; mul; add; length — Number of values produced.."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `JITGui`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// typically, only subclasses of JITGui are used,\n // so here are just some basic usage and layout tests\n\n // make its own window - defPos, minSize is used\ng = JITGui(Ndef(\\a));\n\n // make its own window, specific size\ng = JITGui(Ndef(\\a), bounds: 390@20);\n\n // provide full bounds\ng = JITGui(Ndef(\\a), bounds: Rect(200, 500, 390, 24));\n\n // extent is 0@0: minSize x, y is used\ng = JITGui(Ndef(\\a), bounds: Rect(200, 500, 0, 0));\ng = JITGui(Ndef(\\a), bounds: Rect(200, 500, 0, 50));\ng = JITGui(Ndef(\\a), bounds: Rect(200, 500, 500, 0));\n\n\n( // put a JITGui in an existing window:\nw = Window().front;\ng = JITGui(Ndef(\\a), 0, w, bounds: 300@48);\n);\n\n( // 5 lines high\nw = Window().front;\ng = JITGui(Ndef(\\a), 5, w);\n);\n\n( // recommended: use a FlowLayout.\nw = Window().front;\nw.addFlowLayout;\nEZSlider(w, 300@100, \\test, []);\ng = JITGui(Ndef(\\a), 0, w, bounds: 300@40);\n);\n\n// test changing color schemes for JITguis\n// this scheme is admittedly ugly but different\n\nGUI.skins.put(\\jit, (\n fontSpecs: [\"Inconsolata\", 12],\n fontColor: Color.white,\n background: Color(0.2, 0.85, 0.7, 0.5),\n foreground: Color.grey(0.1),\n onColor: Color(0.5, 0, 0.5),\n onColor2: Color(0.0, 0.5, 0.5),\n offColor: Color.grey(0.2, 0.5),\n hiliteColor: Color.green(1.0, 0.5),\n gap: 0 @ 0,\n margin: 2@2,\n buttonHeight: 18,\n headHeight: 24)\n);\n\n// make some JITGuis to check\nn = NdefGui(Ndef(\\a));\nNdef(\\a, { SinOsc.ar(\\freq.kr(250)) });\nNdef(\\a).clear;\nn = NdefMixer(s);\n\nTdefAllGui();\nTdef(\\a).set(\\amp, 0.25);\nTdefGui(Tdef(\\a), 5);\n\nEnvirGui((a: 123));\n```"}]} +{"conversations": [{"role": "user", "content": "What does `ArrayedCollection.takeThese` do?"}, {"role": "assistant", "content": "Removes all items in the receiver for which the func answers true. The function is passed two arguments, the item and an integer index. Note that order is not preserved. See #-takeAt. `y = [1, 2, 3,"}]} +{"conversations": [{"role": "user", "content": "What does `BPZ2.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Two zero fixed midpass. Arguments: in — The input signal.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nNdef(\\x, { SinOsc.ar(Rand(500, 900)) * 0.1 }).play;\nNdef(\\x).copy(\\y);\nNdef(\\y.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nNdef(\\x, { SinOsc.ar(Rand(500, 900)) * 0.1 }).play;\nNdef(\\x).copy(\\y);\nNdef(\\y).play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// The indices arg might get a pattern which can generate Functions as well as arrays.\n// Start with sufficient number of zeros as lookBack to fill buffer.\n\n(\np = PSloop(\n Pbind(\n \\dur, Pn(Pshuf([1, 1, 2]/6)),\n \\midinote, Prand((60..80), inf)\n ),\n bufSize: 10,\n lookBack: Pseq([Pn(0, 7), Pstutter(4, Pwhite(3, 5, 1))], inf).trace,\n indices: Pseq([1!2, { |l| (l-1..0).postln }], inf).trace\n).trace.play\n);\n\np.stop\n```"}, {"role": "assistant", "content": "The indices arg might get a pattern which can generate Functions as well as arrays. Start with sufficient number of zeros as lookBack to fill buffer. (PSloop: Pattern to derive loops from a given Pattern)"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\nn = NetAddr(\"localhost\", 12345);\nn = s.addr;\n\n// Example sending symbols, integers, and a float\nn.sendMsg('/s_new', \\default, 2000, 0, s.defaultGroup.nodeID, \\freq, 60.midicps);\n\n// The initial forward slash can be omitted\nn.sendMsg(\\n_set, 2000, \\gate, 0);\n\n// Using the performList syntax, you can use an array to store an OSC message\n~msg = [\\n_set, 2000, \\gate, 0];\nn.sendMsg(*~msg);\n```"}, {"role": "assistant", "content": "Example sending symbols, integers, and a float The initial forward slash can be omitted (NetAddr: network address)"}]} +{"conversations": [{"role": "user", "content": "What is `Dpoll` in SuperCollider?"}, {"role": "assistant", "content": "Dpoll — Print the current output value of a demand rate UGen Print the current output value of a demand rate UGen. Category: UGens > Demand, UGens > Info."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LinLin`."}, {"role": "assistant", "content": "```supercollider\n// examples:\n\n(\n{\n var mod = SinOsc.kr(Line.kr(1, 10, 10));\n SinOsc.ar(LinLin.kr(mod, -1, 1, 100, 900)) * 0.1\n}.play;\n);\n\n// modulating destination values.\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(LinLin.ar(mod, -1, 1, MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1))) * 0.1\n}.play;\n);\n\n// modulating source and destination values.\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(\n LinLin.ar(mod,\n SinOsc.kr(0.2), SinOsc.kr(0.2543),\n MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1)\n )\n ) * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Demand`."}, {"role": "assistant", "content": "```supercollider\n{\nvar a, b, t = Impulse.kr(2);\na = { Dseq([1, 2, 3, 4, 5], inf) } * 100;\nb = a + 1;\nDemand.kr(t, 0, [a, b]).poll(t)\n}.play\n```"}]} +{"conversations": [{"role": "user", "content": "What is the difference between .ar, .kr and .ir?"}, {"role": "assistant", "content": "The rate method decides how often a UGen is evaluated. `.ar` runs at the audio rate, once per sample, and produces an audio signal. `.kr` runs at the control rate, once per block of 64 samples by default, so it is cheaper and is used for parameters that do not need sample accuracy. `.ir` is evaluated once when the Synth is created and then never again, for constants such as SampleRate.ir or a size. Using .kr where you need audio-rate modulation gives stepped, zipper-noise-like control; using .ar where .kr would do costs CPU."}]} +{"conversations": [{"role": "user", "content": "What can you do?"}, {"role": "assistant", "content": "Write and explain SuperCollider: SynthDefs, UGens, Patterns, Ndef, buses and envelopes, and tell you why a patch is silent or will not compile. I am 198M parameters, so I am narrow on purpose."}]} +{"conversations": [{"role": "user", "content": "Supernova, Groups, Threads, Ndef?"}, {"role": "assistant", "content": "SuperCollider forum — Supernova, Groups, Threads, Ndef?\n\nAbout Ndef:\n\nAFAIK you can manually move a NodeProxy’s group into another group:\n\n```supercollider\n~pargroup = ParGroup(s);\n\nNdef(\\a, { Silent.ar(1) });\n\nNdef(\\a).group.moveToHead(~pargroup);\n```\n\nBut...\n\nNodeProxies use InFeedback.\n\nI was a little suspicious about this for parallel processing. As I recalled, InFeedback’s result depends on the order of execution:\n\n-\nIf the source node for the bus finished processing before the server reaches InFeedback, then InFeedback will output the block of audio being processed now.\n\n-\nIf the source node comes after the node containing InFeedback, then it will output the previous block of audio.\n\nIn both cases, these are the most recently available audio blocks. But, if the order of evaluation is not consistent, then the output may not be consistent.\n\nLet’s test that:\n\n```supercollider\nb = Bus.audio(s, 1);\n\na = { SinOsc.ar(200, 0, 0.1) }.play(outbus: b);\n\nc = { InFeedback.ar(b, 1).dup }.play(target: a, addAction: \\addAfter);\n\n(\nfork {\n var order = Pseq([\\moveBefore, \\moveAfter], inf).asStream;\n loop {\n c.perform(order.next, a);\n 1.0.wait;\n }\n}\n)\n```\n\nOops.\n\nThis means you can’t randomly throw Ndefs into ParGroups. If one Ndef reads a signal from another, then you have to make sure that the target Ndef comes later in a serial (regular) Group. (Correctness of the result should be more important than “optimal” usage of multiple cores.)\n\nIf you don’t, and if supernova happens to put the source and target Ndefs onto separate cores at roughly the same time, then the target might evaluate InFeedback either before or after the source finishes, and there’s no guarantee of this being consistent. So you might get clicks.\n\nhjh"}]} +{"conversations": [{"role": "user", "content": "What does `SequenceableCollection.modSeaside` do?"}, {"role": "assistant", "content": "Pre-3.14 modulo with unexpected behavior for negative integer modulus; see Integer#-modSeaside. Calling `modSeaside` on a non-integer operand will fall back to `mod` behavior; see"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Out` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-out\", { |out = 0, freq = 440|\n var source;\n source = SinOsc.ar(freq, 0, 0.1);\n\n // write to the bus, adding to previous contents\n Out.ar(out, source);\n\n}).add;\n);\n\n\nSynth(\"help-out\", [\\freq, 500]);\nSynth(\"help-out\", [\\freq, 600]);\nSynth(\"help-out\", [\\freq, 700]);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Atk.getAtkMatrixSubPath` do?"}, {"role": "assistant", "content": "A shortcut for `Atk.getAtkOpSubPath(set, op,"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n/* Audio plugin definition\n\n Each audio plugin should define the following global variables:\n ~name: (symbol) name of the spatializer\n ~description: (string) a short description\n ~function: the actual definition of the plugin\n\n*/\n\n~name = \\MonoIn;\n~description = \"A direct input\";\n~channelLayout = \\mono;\n\n~function = {\n |gate = 0, bus = 0, attack = 0.02, susL = 0.9, release = 0.1, curve = -4|\n var env = Env.asr(attack, susL, release, curve);\n SoundIn.ar(bus, EnvGen.kr(env, gate));\n}\n```"}, {"role": "assistant", "content": "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see ."}]} +{"conversations": [{"role": "user", "content": "What does `Error.backtrace` do?"}, {"role": "assistant", "content": "Returns the underlying backtrace created when the exception was thrown. Returns `nil` if it was never"}]} +{"conversations": [{"role": "user", "content": "My Synth runs but I hear nothing. How do I debug it?"}, {"role": "assistant", "content": "Check in this order, because each step eliminates a whole class of causes:\n\n1. **Is anything coming out of the bus you write to?** `Out.ar(0, sig)` for the master. A typo like\n `Out.ar(2, ...)` is silence.\n2. **Is the amplitude non-zero?** Multiply chain of `mul`/`add`, `amp`, and `env` all have to be positive;\n an envelope with `level: 0` or a gate that never opens is silent.\n3. **Did the Synth free itself immediately?** `doneAction: 2` on an EnvGen whose envelope is already\n finished at creation kills the node instantly. `s.plotTree` shows whether the node exists at all.\n4. **Is the envelope actually moving?** `env.poll` inside the SynthDef prints it per block.\n5. **Is the filter closed?** A `LPF.ar(sig, 50)` on a 440 Hz sine leaves almost nothing.\n\nThe fastest single tool is `s.plotTree`: if the Synth is not in the tree, the problem is lifecycle; if it\nis, the problem is signal."}]} +{"conversations": [{"role": "user", "content": "Explain `IrNumberEditor` in SuperCollider briefly."}, {"role": "assistant", "content": "IrNumberEditor — a number box and slider for editing a float value [\\ir rate] When used with Patch or InstrSpawner this will result in an .ir rate control. This means you can only change the value before the synth starts, no 'control' rate modulation. Category: Libraries > crucial > Editors."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = NodeProxy(s);\na.play;\na.source = { Pulse.ar(130, Saw.kr(0.3) * 0.1 }; // change this line while running\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = NodeProxy(s);\na.play;\na.source = { Pulse.ar(130, Saw.kr(0.3)) * 0.1 }; // change this line while running\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ MoogLadder.ar(Mix(LFSaw.ar([120, 180], 0, 0.33)), LinExp.kr(LFCub.kr(0.1, 0.5*pi), -1, 1, 180, 8500), 0.75.dup }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ MoogLadder.ar(Mix(LFSaw.ar([120, 180], 0, 0.33)), LinExp.kr(LFCub.kr(0.1, 0.5*pi), -1, 1, 180, 8500), 0.75).dup }.play\n```"}]} +{"conversations": [{"role": "user", "content": "What does `AbsApp.new` do? What arguments does it take?"}, {"role": "assistant", "content": "These objects are created by accessing them from the Mx. You do not create them manually. `x = Mx.new.app; // Arguments: model; mxapp."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// These examples compare the variants, so that you can hear the difference in interpolation\n\n// Comb used as a resonator. The resonant fundamental is equal to\n// reciprocal of the delay time.\n{ CombN.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ CombL.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ CombC.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// with negative feedback:\n{ CombN.ar(WhiteNoise.ar(0.01), 0\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// These examples compare the variants, so that you can hear the difference in interpolation\n\n// Comb used as a resonator. The resonant fundamental is equal to\n// reciprocal of the delay time.\n{ CombN.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ CombL.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ CombC.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// with negative feedback:\n{ CombN.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ CombL.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ CombC.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n// used as an echo.\n{ CombL.ar(Decay.ar(Dust.ar(1, 0.5), 0.2, WhiteNoise.ar), 0.2, 0.2, 3) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "[ 1, 2, 1, 1, 2, 1, 1 ] how to find adjacent elements in an array?"}, {"role": "assistant", "content": "SuperCollider forum — [ 1, 2, 1, 1, 2, 1, 1 ] how to find adjacent elements in an array\n\nRandColors:\n\nI need to find the index, the how many times (the adjacent values are equal) and what is the adjacent value.\n\nThis is perhaps a bit verbose and clunky, but it meets the above specification:\n\n```supercollider\n(\n~repeats = {|array|\n // return [index, number of repeats, the value] for each repeated value\n var results = [];\n var thisIndex = 0;\n var thisCount = 1;\n var thisValue = array[0];\n array[1..].do{|val, i|\n if(val == thisValue,\n {thisCount = thisCount + 1},\n {\n if(\n thisCount > 1,\n {results = results.add([thisIndex, thisCount, thisValue])},\n );\n thisValue = val;\n thisIndex = i + 1;\n thisCount = 1;\n }\n )\n };\n if(thisCount > 1, {results = results.add([thisIndex, thisCount, thisValue])});\n results;\n}\n);\n\na = [1, 2, 1, 1, 1, 2, 1, 1];\nb = ~repeats.value(a);\n\na = [2, 3, 5, 5];\nb = ~repeats.value(a);\n```"}]} +{"conversations": [{"role": "user", "content": "What is `BufDelayN` in SuperCollider?"}, {"role": "assistant", "content": "BufDelayN — Buffer based simple delay line with no interpolation. Simple delay line with no interpolation which uses a buffer for its internal memory. See also BufDelayL which uses linear interpolation, and BufDelayC which uses cubic interpolation. Cubic interpolation is more computationally expensive than linear, but more accurate. Category: UGens > Delays > Buffer."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n//Define pluck synthdef\n(\nSynthDef(\\help_dwgplucked, { |out=0, freq=440, amp=0.5, gate=1, c3=20, pan=0|\n var env = Env.new([0,1, 1, 0],[0.001,0.006, 0.0005],[5,-5, -8]);\n var inp = amp * LFClipNoise.ar(2000) * EnvGen.ar(env,gate);\n var son = DWGPlucked.ar(freq, amp, gate,0.1,1,c3,inp);\n DetectSilence.ar(son, 0.001, doneAction:2);\n Out.ar(out, Pan2.ar(son * 0.1, pan));\n}).add\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n//Define pluck synthdef\n(\nSynthDef(\\help_dwgplucked, { |out=0, freq=440, amp=0.5, gate=1, c3=20, pan=0|\n var env = Env.new([0,1, 1, 0],[0.001,0.006, 0.0005],[5,-5, -8]);\n var inp = amp * LFClipNoise.ar(2000) * EnvGen.ar(env,gate);\n var son = DWGPlucked.ar(freq, amp, gate,0.1,1,c3,inp);\n DetectSilence.ar(son, 0.001, doneAction:2);\n Out.ar(out, Pan2.ar(son * 0.1, pan));\n}).add;\n);\n\n//Use it.\n(\na = Scale.new(\n #[0, 1, 3, 5, 7, 8, 10],\n 12,\n Tuning.new([0, 0.75, 2, 3.5, 4, 5, 6, 7, 8, 9, 10, 11]),\n \"Custom\"\n);\n\nPbind(\n \\instrument, \\help_dwgplucked,\n \\scale ,a,\n \\delta , Pseq([1,0.5,0.5,0.5,0.5,0.5,0.5,1,0.5,0.5,1,1]*0.25,inf),\n \\dur , 2,\n \\degree, Pseq([1,8,8,8,8,8,8,-6,Prand([9,10,11],1),1,7,8]-8, inf),\n \\amp , Pwhite(0.2,0.8),\n \\c3 , Pseq([Pseq([1400],24),Pseq([300],24)],inf),\n \\pan , Pwhite(-1,1),\n).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `BufCombN` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// These examples compare the variants, so that you can hear the difference in interpolation\n\n// allocate buffer\nb = Buffer.alloc(s, 44100, 1);\n\n// Comb used as a resonator. The resonant fundamental is equal to\n// reciprocal of the delay time.\n{ BufCombN.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ BufCombL.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ BufCombC.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// with negative feedback:\n{ BufCombN.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ BufCombL.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ BufCombC.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n// used as an echo.\n{ BufCombL.ar(b.bufnum, Decay.ar(Dust.ar(1, 0.5), 0.2, WhiteNoise.ar), 0.2, 3) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SimpleNumber.airyBi` do?"}, {"role": "assistant", "content": "Returns the result of the Airy function Bi at"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// mouse-controlled param\n{ StandardL.ar(SampleRate.ir/2, MouseX.kr(0.9, 4)) * 0.3 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// mouse-controlled param\n{ StandardL.ar(SampleRate.ir/2, MouseX.kr(0.9, 4)) * 0.3 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// no, it doesn't take a ugen in ...\n(\n{\n EnvGen.kr(\n Env.asr(0.1, 1.0, 0.5, \\welch),\n 1.0,\n FSinOsc.ar(1.0).range(0.0, 1.0),\n timeScale: 0.1\n ) * SinOsc.ar(440, 0, 0.3)\n}.play;\n);\n\n// ...but an .ir rate input, a float or an ir rate ugen like Rand would work\n(\n{\n EnvGen.kr(\n Env.asr(0.1, 1.0, 0.5, \\welch),\n 1.0,\n Rand(0.1, 1.0),\n timeScale: 0.1\n ) * SinOsc.ar(440, 0, 0.3)\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// no, it doesn't take a ugen in ...\n(\n{\n EnvGen.kr(\n Env.asr(0.1, 1.0, 0.5, \\welch),\n 1.0,\n FSinOsc.ar(1.0).range(0.0, 1.0),\n timeScale: 0.1\n ) * SinOsc.ar(440, 0, 0.3)\n}.play;\n);\n\n// ...but an .ir rate input, a float or an ir rate ugen like Rand would work\n(\n{\n EnvGen.kr(\n Env.asr(0.1, 1.0, 0.5, \\welch),\n 1.0,\n Rand(0.1, 1.0),\n timeScale: 0.1\n ) * SinOsc.ar(440, 0, 0.3)\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// shifting a 100Hz tone by 1 Hz rising to 500Hz\n{ FreqShift.ar(SinOsc.ar(100), XLine.kr(1, 500, 5), 0, [0.1, 0.1]) }.play(s);\n\n// shifting a complex tone by 1 Hz rising to 500Hz\n{ FreqShift.ar(Klang.ar(`[[101, 303, 606, 808]]), XLine.kr(1, 500, 10), 0, [0.1, 0.1]) }.play(s);\n\n// modulating shift and phase\n{ FreqShift.ar(SinOsc.ar(10), LFNoise2.ar(0.3, 1500), SinOsc.ar(500).range(0, 2pi), [0.1, 0.1]) }.play(s);\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// shifting a 100Hz tone by 1 Hz rising to 500Hz\n{ FreqShift.ar(SinOsc.ar(100), XLine.kr(1, 500, 5), 0, [0.1, 0.1]) }.play(s);\n\n// shifting a complex tone by 1 Hz rising to 500Hz\n{ FreqShift.ar(Klang.ar(`[[101, 303, 606, 808]]), XLine.kr(1, 500, 10), 0, [0.1, 0.1]) }.play(s);\n\n// modulating shift and phase\n{ FreqShift.ar(SinOsc.ar(10), LFNoise2.ar(0.3, 1500), SinOsc.ar(500).range(0, 2pi), [0.1, 0.1]) }.play(s);\n\n// the ubiquitous houston example\n(\nb = Buffer.read(s, ExampleFiles.child);\n{ FreqShift.ar(PlayBuf.ar(1, b.bufnum, BufRateScale.kr(b.bufnum), loop: 1), LFNoise0.kr(0.45, 1000), 0, [1, 1]) }.play(s);\n)\n\n// shifting bandpassed noise\n{ FreqShift.ar(BPF.ar(WhiteNoise.ar(0.2), 1000, 0.001), LFNoise0.kr(5.5, 1000), 0, [32, 32]) }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// default initial params\n{ HenonN.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n\n// mouse-control of params\n{ HenonN.ar(SampleRate.ir/4, MouseX.kr(1, 1.4), MouseY.kr(0, 0.3)) * 0.2 }.play(s);\n\n// randomly modulate params\n(\n{ HenonN.ar(\n SampleRate.ir/8,\n LFNoise2.kr(1, 0.2, 1.2),\n LFNoise2.kr(1, 0.15, 0.15)\n) * 0.2 }.play(s);\n)\n\n// as a frequency control\n{ SinOsc.ar(HenonN.ar(40, MouseX.kr(1, 1.4), MouseY\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// default initial params\n{ HenonN.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n\n// mouse-control of params\n{ HenonN.ar(SampleRate.ir/4, MouseX.kr(1, 1.4), MouseY.kr(0, 0.3)) * 0.2 }.play(s);\n\n// randomly modulate params\n(\n{ HenonN.ar(\n SampleRate.ir/8,\n LFNoise2.kr(1, 0.2, 1.2),\n LFNoise2.kr(1, 0.15, 0.15)\n) * 0.2 }.play(s);\n)\n\n// as a frequency control\n{ SinOsc.ar(HenonN.ar(40, MouseX.kr(1, 1.4), MouseY.kr(0, 0.3))*800+900)*0.4 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What is `NodeControl` in SuperCollider?"}, {"role": "assistant", "content": "NodeControl — Encapsulates in an object a node and an index. This object can be held by a client and have its value set without otherwise having to store the details about where the node's input is. Category: Server > Nodes."}]} +{"conversations": [{"role": "user", "content": "Write a kick drum in SuperCollider."}, {"role": "assistant", "content": "A pitch-swept sine with a fast decay: the frequency envelope is what makes it read as a kick.\n\n```supercollider\n(\nSynthDef(\\kick, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 50, 40], [0.03, 0.15], -4));\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -6), doneAction: 2);\n Out.ar(out, Pan2.ar(SinOsc.ar(pitch) * env * amp));\n}).add;\n);\nSynth(\\kick);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `MulAdd`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n// The mul and add arguments of SinOsc themselves use MulAdd!\n// These two examples will create precisely the same synth graph:\nx = { SinOsc.ar(440, 0, 0.1, 0.05) }.play(s);\nx.trace; // You should see a \"MulAdd\" in the trace\nx.free;\n\nx = { MulAdd(SinOsc.ar(440, 0), 0.1, 0.05) }.play(s);\nx.trace;\nx.free;\n\n// In fact this will produce the same graph too - the separate multiply and add are optimised into one MulAdd\nx = { SinOsc.ar(440, 0) * 0.1 + 0.05 }.play(s);\nx.trace;\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for get different result each time running the pattern: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\nTempoClock.default.tempo = 156/60;\n\n(\nSynthDef(\\spring, { |freq = 400, out = 0, pan = 0, gate = 1, dur = 0.15, curve = -4, amp = 1, index = 1|\n var sig = FreeVerb.ar(Pan2.ar(Blip.ar(freq, index), pan));\n var env = EnvGen.ar(Env.perc(0.01, dur, amp, curve), gate, doneAction:2);\n Out.ar(0, sig * env);\n}).add;\n);\n\n(\nPbind(*[\n instrument: \\spring,\n dur: Pseq([4, 1, 2, 1, 1, 1].scramble/ 4 / TempoClock.default.tempo, inf),\n degree: Pseq(#[1,2,3,4], inf) * Pkey(\\dur).reciprocal,\n octave: Pseq([2,3,4,4,4,3].scramble, inf),\n pan: Pxrand(Array.fill(100, { 0.gaussian(1).clip2(1) }), inf),\n amp: Pseq(#[0.95,1,0.8],inf),\n index: Pstutter(Pseq(#[4,8,12],inf), Pseq([2,3,4,5,6,8].scramble, inf))\n]).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n{ BlitB3Square.ar(XLine.kr(1000, 20, 10)) }.play;\n\n{ BlitB3Square.ar(MouseX.kr(20,1000,'exponential'),MouseY.kr(0.001,0.999)) }.play;\n\n//comparison\n//blit version is cheaper, but aliases once pushed over 4000 or so at 44100 SR\n{ Pulse.ar(4000, 0.5) }.play;\n{ BlitB3Square.ar(4000) }.play;\n\n\n//spot the difference in CPU usage\n{ Mix.fill(100, {Pan2.ar(0.1*BlitB3Square.ar( ((LFNoise0.kr(rrand(2,3))).range(0,36)+36).midic\n// …\n```"}, {"role": "assistant", "content": "blit version is cheaper, but aliases once pushed over 4000 or so at 44100 SR spot the difference in CPU usage (BlitB3Square: Bipolar BLIT derived square waveform)"}]} +{"conversations": [{"role": "user", "content": "What does `Server.default` do?"}, {"role": "assistant", "content": "Get or set the default server. By default this is the local server (see"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ LFNoise2.ar(1000, 0.25) }.play;\n\n// modulate frequency\n\n{ LFNoise2.ar(XLine.kr(1000, 10000, 10), 0.25) }.play;\n\n// as frequency modulator\n(\n{ SinOsc.ar(\n LFNoise2.ar(4, 400, 450),\n 0, 0.2\n )\n}.play;\n)\n\n// freq is the rate of interpolation points\n{ var freq = 1000; [LFNoise2.ar(freq), Impulse.ar(freq) }.plot\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ LFNoise2.ar(1000, 0.25) }.play;\n\n// modulate frequency\n\n{ LFNoise2.ar(XLine.kr(1000, 10000, 10), 0.25) }.play;\n\n// as frequency modulator\n(\n{ SinOsc.ar(\n LFNoise2.ar(4, 400, 450),\n 0, 0.2\n )\n}.play;\n)\n\n// freq is the rate of interpolation points\n{ var freq = 1000; [LFNoise2.ar(freq), Impulse.ar(freq)] }.plot\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// use NamedControl to create a number of multichannel controls:\n\na = { SinOsc.ar(NamedControl.kr(\\freq, [300, 330, 370], [1, 0.3, 0.02])).sum * 0.1 }.play;\na.setn(\\freq, [700, 705, 890]);\na.setn(\\freq, [0, 2, 5].midiratio * 400);\n\n// synonymous:\na = { SinOsc.ar(\\freq.kr([300, 330, 370], [1, 0.3, 0.02]).sum * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// use NamedControl to create a number of multichannel controls:\n\na = { SinOsc.ar(NamedControl.kr(\\freq, [300, 330, 370], [1, 0.3, 0.02])).sum * 0.1 }.play;\na.setn(\\freq, [700, 705, 890]);\na.setn(\\freq, [0, 2, 5].midiratio * 400);\n\n// synonymous:\na = { SinOsc.ar(\\freq.kr([300, 330, 370], [1, 0.3, 0.02])).sum * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// default initial params\n{ LatoocarfianL.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// default initial params\n{ LatoocarfianL.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `AnalogOut`."}, {"role": "assistant", "content": "```supercollider\n// write a sine oscillator's output to a pin\n\n(\nSynthDef(\"help-AnalogOut\", { |out = 0|\n AnalogOut.ar(0, SinOsc.ar(10));\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `JITGui`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// typically, only subclasses of JITGui are used,\n // so here are just some basic usage and layout tests\n\n // make its own window - defPos, minSize is used\ng = JITGui(Ndef(\\a));\n\n // make its own window, specific size\ng = JITGui(Ndef(\\a), bounds: 390@20);\n\n // provide full bounds\ng = JITGui(Ndef(\\a), bounds: Rect(200, 500, 390, 24));\n\n // extent is 0@0: minSize x, y is used\ng = JITGui(Ndef(\\a), bounds: Rect(200, 500, 0, 0));\ng = JITGui(Ndef(\\a), bounds: Rect(200, 500, 0, 50));\ng = JITGui(Ndef(\\a), bounds: Rect(200, 500, 500, 0));\n\n\n( // put a JITGui in an existing window:\nw = Window().front;\ng = JITGui(Ndef(\\a), 0, w, bounds: 300@48);\n);\n\n( // 5 lines high\nw = Window().front;\ng = JITGui(Ndef(\\a), 5, w);\n);\n\n( // recommended: use a FlowLayout.\nw = Window().front;\nw.addFlowLayout;\nEZSlider(w, 300@100, \\test, []);\ng = JITGui(Ndef(\\a), 0, w, bounds: 300@40);\n);\n\n// test changing color schemes for JITguis\n// this scheme is admittedly ugly but different\n\nGUI.skins.put(\\jit, (\n fontSpecs: [\"Inconsolata\", 12],\n fontColor: Color.white,\n background: Color(0.2, 0.85, 0.7, 0.5),\n foreground: Color.grey(0.1),\n onColor: Color(0.5, 0, 0.5),\n onColor2: Color(0.0, 0.5, 0.5),\n offColor: Color.grey(0.2, 0.5),\n hiliteColor: Color.green(1.0, 0.5),\n gap: 0 @ 0,\n margin: 2@2,\n buttonHeight: 18,\n headHeight: 24)\n);\n\n// make some JITGuis to check\nn = NdefGui(Ndef(\\a));\nNdef(\\a, { SinOsc.ar(\\freq.kr(250)) });\nNdef(\\a).clear;\nn = NdefMixer(s);\n\nTdefAllGui();\nTdef(\\a).set(\\amp, 0.25);\nTdefGui(Tdef(\\a), 5);\n\nEnvirGui((a: 123));\n```"}]} +{"conversations": [{"role": "user", "content": "I get 'index out of range' when playing a buffer."}, {"role": "assistant", "content": "A read position is past the end of the buffer. `PlayBuf` with a `startPos` in frames beyond `~buf.numFrames`, or a `BufRd`/`GrainBuf` whose phase goes above 1, produces this. For GrainBuf, pos is normalised 0..1, so pass `LFNoise1.kr(1).range(0, 1)` rather than a frame count; for PlayBuf, cap the position at `~buf.numFrames - 1`. If you just loaded the file, check `~buf.numFrames` — a failed read gives 0 frames and every position is out of range."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DelayC`."}, {"role": "assistant", "content": "```supercollider\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nDelayC.ar(z, 0.2, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\n(\n// recursive application of delay.\n{\nz = Decay2.ar(Dust.ar(1, 0.5), 0.01, 0.1, Saw.ar(100 + [0, 1]));\n5.do { |i| z = DelayC.ar(RLPF.ar(z, Rand(100, 3000), 0.03), 1, 1 / (2**i), 1, z * 0.5) };\nz\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "I get 'server not running' or nothing happens at all."}, {"role": "assistant", "content": "The server is not booted. In the IDE press Ctrl+B, or evaluate `s.boot`. If code depends on a SynthDef being there, put it inside `s.waitForBoot { ... }`. When a script runs headless you can do `s.boot; s.sync;` and continue. `s.serverRunning` tells you the truth; if it is false, look at the post window for the boot error (usually an audio device problem)."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// If a Function is passed to indices it takes the current lookBack arg as argument.\n\n// mirroring the full lookBack size\n// start without loop\n\n(\n~lookBack = 0;\n\np = PSloop(\n Pbind(\n \\dur, Pn(Pshuf([1, 1, 2]/6)),\n \\midinote, Prand((60..80), inf)\n ),\n bufSize: 10,\n lookBack: { ~lookBack },\n indices: { |l| (0..l-1).mirror }\n).trace.play\n);\n\n// wait a bit to fill buffer\n// mirrored loop i.e. loop with added retrograde\n\n~lookBack = 3\n\n\n// go on and loop again\n\n~lookBack = 0\n\n~lookBack = 3\n\np.stop\n```"}, {"role": "assistant", "content": "If a Function is passed to indices it takes the current lookBack arg as argument. mirroring the full lookBack size (PSloop: Pattern to derive loops from a given Pattern)"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n//var board= CytonSerial(\"/dev/tty.usbserial-DM00DRM0\", initAction: {|b| b.start});\nvar board= SyntheticData(initAction: {|b| b.start});\n~board= board;\n);\n\n~board.accelAction= {|xyz| xyz.postln}; //start posting synthetic accelerometer data\n\n~board.stop;\n~board.start;\n~board.close;\n```"}, {"role": "assistant", "content": "var board= CytonSerial(\"/dev/tty.usbserial-DM00DRM0\", initAction: {|b| b.start}); (SyntheticData: for generating synthetic test data coming from a board)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\"help-ExpRand\", { |out = 0|\n Out.ar(out,\n FSinOsc.ar(\n ExpRand(100.0, 8000.0),\n 0, Line.kr(0.2, 0, 0.01, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n(\nRoutine({\n inf.do({ |i|\n Synth.new(\"help-ExpRand\"); 0.05.wait;\n })\n}).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\"help-ExpRand\", { |out = 0|\n Out.ar(out,\n FSinOsc.ar(\n ExpRand(100.0, 8000.0),\n 0, Line.kr(0.2, 0, 0.01, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n(\nRoutine({\n inf.do({ |i|\n Synth.new(\"help-ExpRand\"); 0.05.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Instr.asDefName` do? What arguments does it take?"}, {"role": "assistant", "content": "calculates the unique SynthDef name for the supplied arguments. this is fairly efficient and is even used when spawning Events in Arguments: args — array or dict the objects that determine the unique SynthDef. they may determine the rate, whether a control input is added or not and they may insert unique objects into the SynthDef.. Returns: string"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n var mod = SinOsc.ar([0.1,0.15,0.2]).range(0,1);\n var saw = LFSaw.ar([10,12,15]);\n var out = (saw - ((saw>0)*mod)+(mod*0.5));\n Splay.ar(out)*0.4;\n}.play;\n\n{\n var mod = SinOsc.ar([0.1,0.15,0.2]).range(0,1);\n var saw = SinOsc.ar(LFSaw.ar([10,12,15]).range(200,300));\n var out = (saw - ((saw>0)*mod)+(mod*0.5));\n Splay.ar(out)*0.4;\n}.play\n)\n```"}, {"role": "assistant", "content": "Made with code from Jonatan Liljedahl and Glen Fraser. Based on the Korg Z1 sawtooth oscilator."}]} +{"conversations": [{"role": "user", "content": "What does `SimpleNumber.zeta` do?"}, {"role": "assistant", "content": "Returns the zeta function of `z`. Requires `z !="}]} +{"conversations": [{"role": "user", "content": "What does `EnvGen.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Envelope generator Arguments: envelope — An Env instance, or an Array of Controls. (See Control and the example below for how to use this.) The envelope is polled when the EnvGen is triggered, and at the start of a new envelope segment. The Env inputs can be other UGens.; gate — This triggers the envelope and holds it open while > 0. If the Env is fixed-length (e.g. Env.linen, Env.perc), the gate argument is used as a simple trigger. If it is an sustaining envelope (e.g. Env.adsr, Env.asr), the envelope is held open until the gate becomes 0, at which point is released. If g; levelScale — The levels of the breakpoints are multiplied by this value. This value can be modulated, but is only sampled at the start of a new envelope segment.; levelBias — This value is added as an offset to the levels of the breakpoints. This value can be modulated, but is only sampled at the start of a new envelope segment.; timeScale — The durations of the segments are multiplied by this value. This value can be modulated, but is only sampled at the start of a new envelope segment.; doneAction — An integer representing an action to be executed when the env is finished playing. This can be used to free the enclosing synth, etc. See Done for more detail.."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `BufWr` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\n// allocate a buffer for writinig into\ns = Server.local;\ns.sendMsg(\"/b_alloc\", 0, 44100 * 2);\n);\n\n\n// write into the buffer with a BufWr\n(\ny = { |rate = 1|\n var in;\n in = SinOsc.ar(LFNoise1.kr(2, 300, 400), 0, 0.1);\n BufWr.ar(in, 0, Phasor.ar(0, BufRateScale.kr(0) * rate, 0, BufFrames.kr(0)));\n 0.0 // quiet\n}.play;\n);\n\n// read it with a BufRd\n(\nx = { |rate = 1|\n BufRd.ar(1, 0, Phasor.ar(0, BufRateScale.kr(0) * rate, 0, BufFrames.kr(0)))\n}.play(s);\n);\n\n\n\nx.set(\\rate, 5);\ny.set(\\rate, 2.0.rand);\nx.set(\\rate, 2);\n```"}]} +{"conversations": [{"role": "user", "content": "How do I record my output to a file?"}, {"role": "assistant", "content": "`s.record(path)` starts recording the server's output; `s.stopRecording` stops it.\n\n```supercollider\ns.record(\"C:/audio/take1.wav\");\n// play for a while\ns.stopRecording;\n```\n\nThe path must be writable and the format follows the extension (.wav, .aiff, .flac). The file is written\nby the server, so it captures exactly what the master bus produces — including your effects, which is what\nyou want. `s.record` also accepts `duration:` to stop by itself, which is the reproducible form for a take."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// ===========================\n// extra demos for pluck\n// ===========================\n\n\n(\n// Made by Meha Gupta\n// Inspired by Happy by Julia Michaels\nPbindef(\\dmpluck,\n \\instrument, \"pluck\",\n \\midinote, Pseq([\n Pseq([\n [57, 69, 73, 76],\n [57, 69, 73, 76],\n [57, 71, 73, 80],\n [52, 78, 76, 80],\n [52, 78, 76, 80],\n [59, 71, 75],\n [59, 71, 75]], 2),\n 64]),\n \\amp, Pseq([0.2, 0.1, 0.2, 0.2, 0.1, 0.1, 0.1], inf) * 0.5,\n \\dur, Pseq([Pn(Pseq([0.25, 0.75, 1, 0.5, 0.5, 0.5, 0.5]), 2), 1]),\n \\decay, Pseq([1, 3, 3, 2, 2, 3, 3, 1, 3, 3, 2, 2, 3, 3, 4]),\n).play;\n)\n```"}, {"role": "assistant", "content": "=========================== extra demos for pluck ===========================."}]} +{"conversations": [{"role": "user", "content": "What does `PLbindefPar.remove` do?"}, {"role": "assistant", "content": "Removes not only the PLbindefPar but also associated PLbindefs from global"}]} {"conversations": [{"role": "user", "content": "Explain `BinaryOpStream` in SuperCollider briefly."}, {"role": "assistant", "content": "BinaryOpStream — two streams combined by a binary operator A BinaryOpStream is created as a result of a binary math operation on a pair of Streams. It is defined to respond to next by returning the result of the math operation on the next value from both streams. It responds to reset by resetting both Streams. Category: Streams-Patterns-Events."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Penvir`."}, {"role": "assistant", "content": "```supercollider\n(\nx = (a: 8);\ny = Penvir(\n x,\n Pfunc { ~a * 2 }\n);\n\nt = y.asStream;\n);\n\nt.next;\n\n\n\n(\nx = (a: 8);\ny = Penvir(\n x,\n Pfunc { ~a = ~a * 2 }\n);\n\nt = y.asStream;\nz = y.asStream;\n);\n\nt.next;\nt.next;\nx.postln; // x stays unchanged\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Verschwende deine Jugend (bassline cover)?"}, {"role": "assistant", "content": "```supercollider\n/* An approach to try to reproduce the 'famous' bassline of \"Verschwende deine Jugend\" by D.A.F. */\n\nSynthDef(\\daf_bass,{ |out, freq=440, sustain=1, gate=1, amp=0.1|\n var snd, env, fenv, harm;\n \n harm = [1,1.01,2,2.02,3.5,4.01,5.501];\n harm = harm ++ (harm*2);\n \n snd = SinOsc.ar(freq*harm).sum.distort.squared * 6;\n snd = snd + SinOsc.ar(freq / [1, 2]).sum!2;\n\n fenv = EnvGen.kr(Env.adsr(0.075,0.05,0.1,0.25));\n\n snd = RLPF.ar(snd, fenv.range(freq*2, freq*8), 0.75, 2) + (snd * 0.25);\n env = EnvGen.kr(Env.adsr(0.001,0.2,0.9,0.25), gate, amp, doneAction:2);\n \n snd = LeakDC.ar(Limiter.ar(snd * env));\n OffsetOut.ar(out, (snd!2));\n}).add;\n\n// approx 65 bpm\nTempoClock.default.tempo = 65/60;\n\n// approx bass pattern + modulation of Verschwende Deine Jugend bassline\nPdef(\\daf_bass,\n PmonoArtic(\\daf_bass,\n \\scale, Scale.minor,\n \\octave, [3],\n \\root, 2,\n \\ctranspose,Pseq([\n Pn(0, 8*4),\n Pn(-5, 8*4)\n ], inf),\n \\degree, Pseq([7,7s,1,8,1,1,7,1]-1,inf),\n \\dur, 0.18\n )\n).play;\n\n// link: http://www.youtube.com/watch?v=KjqrnUBdLqY\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for We all could use a little more?"}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\cowbell, {\n | out=0, amp=0.3, gate=1, fund_freq=540, pan=0.0 |\n var sig, env;\n\n sig = Pulse.ar( fund_freq * [ 1, 1.5085 ], [ 0.565, 0.445 ], [ 0.4, 0.6 ] ).distort;\n env = EnvGen.ar(\n Env(\n [ 0, 0.05, 1, 0.1, 0 ], [ 0.003, 0.002, 0.05, 0.5 ], [2, -4, -4, -4]\n ),\n gate: gate,\n timeScale: [ 1.0, 1.5 ],\n doneAction: 2\n );\n sig = Mix( sig * env );\n sig = BPF.ar( sig, fund_freq * 2, 1.808 );\n\n Out.ar( out, Pan2.ar( sig, pan, amp ) );\n}).add;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `WebView.setFontFamily` do? What arguments does it take?"}, {"role": "assistant", "content": "Sets a specific font family to be used in place of a CSS-specified generic font Arguments: The CSS generic font family to assign a font to; one of QWebFontFamily; A font family name to be assigned to the generic family; a String.."}]} -{"conversations": [{"role": "user", "content": "What does `OSCSched.initClass` do?"}, {"role": "assistant", "content": "scheduling utility for just-in-time scheduling of OSC bundles"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n// create a Synth at the head of the default Server's default group\n// based on the SynthDef \"default\"\nx = Synth.new(\"default\");\ns.queryAllNodes; // note the default group (ID 1)\nx.free;\n\n// Using an arrayed control\n// run this block first to make the SynthDef\n(\nSynthDef(\"help-synth\", { |freq = #[440, 450, 460], out = 0|\n Out.ar(out, Mix(SinOsc.ar(freq, 0, 0.1)));\n}).add;\n);\n\n// then this a short while later\nx = Synth(\"help-synth\", [freq: [500, 501, 510]]);\n\nx = Synth(\"help-synth\",\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n// create a Synth at the head of the default Server's default group\n// based on the SynthDef \"default\"\nx = Synth.new(\"default\");\ns.queryAllNodes; // note the default group (ID 1)\nx.free;\n\n// Using an arrayed control\n// run this block first to make the SynthDef\n(\nSynthDef(\"help-synth\", { |freq = #[440, 450, 460], out = 0|\n Out.ar(out, Mix(SinOsc.ar(freq, 0, 0.1)));\n}).add;\n);\n\n// then this a short while later\nx = Synth(\"help-synth\", [freq: [500, 501, 510]]);\n\nx = Synth(\"help-synth\", [freq: [500, 501, 510]]);\nx.set(\\freq, [1, 2, 3] * 400 + [1, 2, 3], \\out, 1);\nx.set(\\freq, [3] * 400 + [1, 2, 3], \\out, 1);\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Resetting start count with PulseDivider?"}, {"role": "assistant", "content": "SuperCollider forum — Resetting start count with PulseDivider?\n\ni think in your example Sweep is receiving a trigger while going from 0 to 1 causing the discontinuity in the phase because the duration between one trigger and the next is unknown.\n\nwith this example you get at least a continiuous phase with random triggers to drive the hanning window (evaluate it several times). but its not multichannel with distributed phases / windows accross channels:\n\n```supercollider\n(\nvar randomTrigPhase = { |triggerRate = 10, randomness = 1|\n var minDuration = (2 ** randomness) / triggerRate;\n var maxDuration = (2 ** (-1 * randomness)) / triggerRate;\n var demand = Dunique(minDuration * ((maxDuration / minDuration) ** Dwhite(0, 1)));\n var duration = Duty.ar(demand, DC.ar(0), demand);\n var phase = Phasor.ar(DC.ar(0), (1 / duration) / SampleRate.ir, 0, 1);\n (phase: phase, trigger: HPZ1.ar(phase) < 0);\n};\n\nvar hanningWindow = { |phase|\n (1 - (phase * 2pi).cos) / 2 * (phase < 1);\n};\n\n{\n var rate = 100;\n var phase = randomTrigPhase.(rate, 1).phase;\n hanningWindow.(phase);\n}.plot(0.1);\n)\n```\n\nim not sure if this is helping it just reminded me of some issue with multichannel random triggers and continiuous phases i have been trying to solve."}]} -{"conversations": [{"role": "user", "content": "Explain `RedArduino` in SuperCollider briefly."}, {"role": "assistant", "content": "RedArduino — for uploading sketches to arduino This class can be used for uploading sketches to an Arduino from SuperCollider via the soundcard. No FTDI chip needed! It's a very cheap way to program barebone arduino boards. Category: Red > redTools."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// play to buses silently\n\n(\na = Bus.audio(s, 5);\nx = { Out.ar(a.index, SinOsc.ar((3..7) * 100, 0, 0.05)) }.play\n);\n\n\n// mix the source\n// a Drate ugen with arrays causes multichannel expansion\n// thus the drate ugen for fadeTime needs to be wrapped into a Function\n\n(\nz = {\n DXMixIn.ar(\n Drand([[0, 1], [2, 3], [4, 0], [1, 2], [3, 4]], inf) + a.index,\n fadeTime: { Dwhite(0.5, 5) }\n )\n}.play(addAction: \\addToTail)\n);\n\n// stop DXMixIn, source still running\n\nz.release\n\n\n// get source\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// play to buses silently\n\n(\na = Bus.audio(s, 5);\nx = { Out.ar(a.index, SinOsc.ar((3..7) * 100, 0, 0.05)) }.play\n);\n\n\n// mix the source\n// a Drate ugen with arrays causes multichannel expansion\n// thus the drate ugen for fadeTime needs to be wrapped into a Function\n\n(\nz = {\n DXMixIn.ar(\n Drand([[0, 1], [2, 3], [4, 0], [1, 2], [3, 4]], inf) + a.index,\n fadeTime: { Dwhite(0.5, 5) }\n )\n}.play(addAction: \\addToTail)\n);\n\n// stop DXMixIn, source still running\n\nz.release\n\n\n// get source with other rhythm\n\n(\nz = {\n DXMixIn.ar(\n Dseq([[0, 1], [2, 3], [4, 0], [1, 2], [3, 4]], inf) + a.index,\n fadeTime: [0.05, 2]\n )\n}.play(addAction: \\addToTail)\n);\n\nz.release\n\n// cleanup\n\n(\nx.free;\na.free;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for reflection on seasonal change )."}, {"role": "assistant", "content": "```supercollider\n(\n{ \n LPF.ar(\n DynKlank.ar(\n `[[900, 971, 1153, 1823, 1401], nil, [\n SinOsc.kr(0.2).range(0.1,1), \n SinOsc.kr(0.6).range(0.1,1), \n SinOsc.kr(0.8).range(0.1,1), \n SinOsc.kr(1.2).range(0.1,1), \n SinOsc.kr(2).range(0.1,1)]\n ], \n Limiter.ar(Dust.ar(2, 0.65) + Impulse.ar(1,0,0.9))\n )\n ) ! 2 \n}.play;\n{ \n Pan2.ar(\n DynKlank.ar(`[[800, 1071, 1353, 723 + SinOsc.ar(SinOsc.ar(0.2).range(0, 10)).range(0,330)], nil, [1, 1, 0.5, 1]], PinkNoise.ar(0.007)),\n TRand.kr(-1, 1, trig: Pulse.ar(10))\n )\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `NodeProxy`."}, {"role": "assistant", "content": "```supercollider\nb = NodeProxy.new.play;\nb.source = { PinkNoise.ar(0.2.dup) };\n// now I want to filter b through a new proxy.\na = NodeProxy.new;\na <-- b; a.source = { HPF.ar(b.ar, 7000) };\na.source = { HPF.ar(b.ar, 3000) }; // changing the source\na.clear; b.clear;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `ArraySpec.storeArgs` do?"}, {"role": "assistant", "content": "datatype specifying an array with an itemSpec which describes its items"}]} -{"conversations": [{"role": "user", "content": "What is the difference between Env and EnvGen?"}, {"role": "assistant", "content": "Env is a language-side description: a list of levels, times and a curve, e.g. `Env.perc(0.01, 1)` or `Env.adsr(0.01, 0.1, 0.5, 0.8)`. EnvGen is the UGen that plays it on the server: `EnvGen.kr(env, gate, doneAction: 2)`. The same Env can be played by many EnvGens, and Env also has language-side uses such as `.asStream` inside Patterns and `.plot`."}]} -{"conversations": [{"role": "user", "content": "What does `PClip.new` do? What arguments does it take?"}, {"role": "assistant", "content": "UGenPatterns quark library Arguments: pattern; lo; hi."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DelTapWr`."}, {"role": "assistant", "content": "```supercollider\n// a Buffer for the UGens to use, one second at the current sample rate\nb = Buffer.alloc(s, s.sampleRate * 1, 1);\n\n// write a signal into a delay, tap it at multiple times\nSynthDef(\\test, { |out, buffer|\n var src, tapPhase, tap1, tap2, tap3;\n src = WhiteNoise.ar(0.2) * Decay.kr(Dust.kr(3), 0.2);\n tapPhase = DelTapWr.ar(buffer, src);\n #tap1, tap2, tap3 = DelTapRd.ar(buffer, tapPhase,\n [0.2, 0.27, 0.303], // tap times\n 1, // no interp\n [1.0, 0.4, 0.2] // muls for each tap\n );\n Out.ar(out, [src + tap2, tap1 + tap3])\n}).add;\n\nx = Synth(\\test, [\\buffer, b]);\nx.free;\nb.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What is `BufSamples` in SuperCollider?"}, {"role": "assistant", "content": "BufSamples — Current number of samples in buffer. Returns the current number of allocated samples. A sample is not the same as a frame (compare with BufFrames); a frame includes the samples in each channel of the buffer. Only for a mono buffer are samples the same as frames. `samples = frames * numChannels` Category: UGens > Buffer > Info."}]} -{"conversations": [{"role": "user", "content": "What does `DataBuffer.dataActive` do?"}, {"role": "assistant", "content": "a Boolean flag indicating if data should be buffered or"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\nb = Buffer.alloc(s, 2048, 1);\nc = Buffer.alloc(s, 2048, 1);\nd = Buffer.read(s, \"sounds/a11wlk01.wav\");\n);\n\n(\nSynthDef(\"help-commonMag\", { arg out=0, bufnumA=0, bufnumB=1, soundBufnum=2;\n var inA, inB, chainA, chainB, chain;\n inA = HPF.ar(Mix(LFSaw.ar([100, 150], 0, 0.2)), 1200);\n inB = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);\n chainA = FFT(bufnumA, inA);\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\nb = Buffer.alloc(s, 2048, 1);\nc = Buffer.alloc(s, 2048, 1);\nd = Buffer.read(s, \"sounds/a11wlk01.wav\");\n);\n\n(\nSynthDef(\"help-commonMag\", { arg out=0, bufnumA=0, bufnumB=1, soundBufnum=2;\n var inA, inB, chainA, chainB, chain;\n inA = HPF.ar(Mix(LFSaw.ar([100, 150], 0, 0.2)), 1200);\n inB = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);\n chainA = FFT(bufnumA, inA);\n chainB = FFT(bufnumB, inB);\n chain = PV_CommonMag(chainA, chainB, MouseX.kr(0, 50), MouseY.kr);\n Out.ar(out, IFFT(chain).dup);\n}).play(s,[\\out, 0, \\bufnumA, b.bufnum, \\bufnumB, c.bufnum, \\soundBufnum, d.bufnum]);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "How should I organise a SuperCollider project on disk?"}, {"role": "assistant", "content": "One folder per piece, with a fixed shape:\n\n```text\nmy-piece/\n synthdefs.scd // only SynthDef(...).add, loaded first\n material.scd // buffers, samples, scales\n piece.scd // the performance: Tdefs, Pbinds, Ndefs\n README.md // tempo, required samples, how to run it\n```\n\nThen the workflow is: open `synthdefs.scd`, Ctrl+A Ctrl+Enter to load it, load `material.scd`, and work in\n`piece.scd`. Keeping definitions out of the performance file is what makes a reboot survivable and a piece\nre-runnable six months later."}]} -{"conversations": [{"role": "user", "content": "What does `File.readAllStringRTF` do?"}, {"role": "assistant", "content": "Open the file at the given path, call #-readAllStringRTF, and return the string. Whether the process succeeds or fails, the file will always be"}]} -{"conversations": [{"role": "user", "content": "What is `WalshHadamard` in SuperCollider?"}, {"role": "assistant", "content": "WalshHadamard — decomposition into square waves, and reconstruction WalshHadamard transform to a basis of square wave like functions rather than the more conventional sine waves of Fourier analysis. The advantage is that the transform is really efficient (no need for trigonometric functions) but the interpretation in a space of 'sequencies' and amplitudes is less intuitively comprehensible. Category: UGens > Analysis."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LPF`."}, {"role": "assistant", "content": "```supercollider\n{ LPF.ar(Saw.ar(200, 0.1), SinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3600, 4000)) }.play;\n\n// kr:\n(\n{ var ctl = LPF.kr(LFPulse.kr(8), SinOsc.kr(XLine.kr(1, 30, 5)) + 2);\n SinOsc.ar(ctl * 200 + 400)\n}.play;\n);\n\n(\n{ var ctl = LPF.kr(LFPulse.kr(8), MouseX.kr(2, 50, 1));\n SinOsc.ar(ctl * 200 + 400)\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PV_BinWipe`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\nb = Buffer.read(s, ExampleFiles.child);\n\n(\nSynthDef(\"help-binWipe\", { |out = 0|\n var inA, chainA, inB, chainB, chain;\n inA = WhiteNoise.ar(0.2);\n inB = LFSaw.ar(100, 0, 0.2);\n chainA = FFT(LocalBuf(2048), inA);\n chainB = FFT(LocalBuf(2048), inB);\n chain = PV_BinWipe(chainA, chainB, MouseX.kr(-1, 1));\n Out.ar(out, 0.1 * IFFT(chain).dup);\n}).play(s);\n);\n\n(\nSynthDef(\"help-binWipe2\", { |out = 0, soundBufnum = 2|\n var inA, chainA, inB, chainB, chain;\n inA = WhiteNoise.ar(0.2);\n inB = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);\n chainA = FFT(LocalBuf(2048), inA);\n chainB = FFT(LocalBuf(2048), inB);\n chain = PV_BinWipe(chainA, chainB, MouseX.kr(-1, 1));\n Out.ar(out, 0.1 * IFFT(chain).dup);\n}).play(s, [\\soundBufnum, b]);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Instr.head` do? What arguments does it take?"}, {"role": "assistant", "content": "spawn a Synth into the Group, adding it as the first node in that Arguments: anode; args — array or dict; bundle; atTime — see atTime; out — out bus index. Returns: a Synth"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nPdef(\\zed, \n Pbind(\n \\osc, Pseq([SinOsc, LFSaw],inf),\n \\instrument, Prout({ arg ev;\n SynthDef(\\zed, { arg out=0, gate=1, amp=0.1, pan=0, freq=200;\n var sig;\n sig = ev[\\osc].ar(freq);\n sig = sig * EnvGen.kr(\\adsr.kr(Env.adsr(0.1,0.1,0.8,0.1)), gate, doneAction:2);\n sig = Pan2.ar(sig, pan, amp);\n Out.ar(out, sig);\n }).add.yield;\n }).loop,\n \\degree, Pseq([0],inf),\n \\dur, 1,\n \\amp, 0.1,\n )\n).play;\n);\n```"}, {"role": "assistant", "content": "synthdef building should take less time than s.latency for this to work."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nNdef(\\bitshift, {\n var t = PulseCount.ar(Impulse.ar(8e3));\n var sig = HPF.ar(\n ( \n ((t * 15) & (t >> 5)) |\n ((t * 5) & (t >> [3, 4])) |\n ((t * 2) & (t >> 9)) |\n ((t * 8) & (t >> 11))\n - 3 % 256\n ) / 127-1 * 3\n , 20\n ).distort * 0.2; \n sig = Greyhole.ar(sig, sig, 0.5, sig).flop.mean/4;\n}).play;\n)\n```"}, {"role": "assistant", "content": "Not very original since I copied the bit code from http://schemawound.com/post/58980873930/bitwise and added a greyhole. But it sound so amazing I want to share it =)."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SynthDesc`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"test\", { |out, freq, xFade|\n XOut.ar(out, xFade, SinOsc.ar(freq))\n}).store\n);\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Monzo function?"}, {"role": "assistant", "content": "```supercollider\n// https://en.xen.wiki/w/Monzo\n//Monzo notation of JI ratios is often used in combination with Vals for temperament theory. I wrote this not for temperament, but rather to use monzos as a possible alternative to otonality and utonality, espescially when sonifying streams that include negative numbers.\n\n(//function that takes a collection representing a monzo as an argument, and outputs the ratio it encodes\n~zo = {\n arg exponentCollection;\n var ratio = 1;\n exponentCollection.do({arg item, i; ratio = ratio * (i.nthPrime).pow(item);});\n ratio;\n};\n);\n\n//5-limit\n~zo.([-1, 1]); // 3/2\n~zo.([-2, 0, 1]); // 5/4\n~zo.([-3, 2]); // 9/8\n~zo.([-4, 4, -1]); // 81/80\n~zo.([-4, 4, -1]); // 81/80\n\n//7-limit\n~zo.([-2, 0, 0, 1]); // 7/4\n~zo.([-1, -1, 0, 1]); // 7/6\n~zo.([0, 0, -1, 1]); // 7/5\n\n//fractional monzos\n~zo.([-1/2, 3.3, 4, -5]); //sure\n//it might be fun to do monzo glissandos in different places?\n```"}]} -{"conversations": [{"role": "user", "content": "What does `EaseOutInCubic.value` do? What arguments does it take?"}, {"role": "assistant", "content": "Cubic ease-out/in Arguments: t — a Float between 0.0 and 1.0.."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `EventPatternProxy`."}, {"role": "assistant", "content": "```supercollider\na = EventPatternProxy.new;\na.source = Pbind(\\freq, Pgeom(100, Pwhite(1.01, 1.2), 4));\nr = Routine { |inval| loop { a.embedInStream(inval) } };\nr.nextN(12, ()); // the next 12 values from r\na.source = Pbind(\\freq, Pgeom([100, 200], Pwhite(1.01, 1.2), 4)); // replace the source\nr.nextN(12, ()); // the next 12 values from r\n```"}]} -{"conversations": [{"role": "user", "content": "What does `KrNumberEditor.copy` do?"}, {"role": "assistant", "content": "a number box and slider for editing a float value [\\kr rate]"}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nx = { |freq = 440, amp = 0.2| SinOsc.ar(freq) * amp }.play;\nx.set(\\freq, 660);\n```"}, {"role": "assistant", "content": "Starts an anonymous synth with two controls, then changes one of them while it plays.\n\nThe `|freq = 440, amp = 0.2|` are arguments of the function, and `.play` turns each into a Synth control\nwith that default value. `x` holds the Synth node. `.set(\\freq, 660)` sends a `/n_set` message to the\nserver, so the oscillator changes frequency without being restarted — that is why the sound glides rather\nthan re-triggering. Note that `\\freq` is a Symbol: the backslash is part of the name."}]} -{"conversations": [{"role": "user", "content": "What does `EZNumber.setColors` do? What arguments does it take?"}, {"role": "assistant", "content": "Wrapper class for label and number box Arguments: stringBackground — An instance of Color. The `background` of the label and unit views.; stringColor — An instance of Color. The `stringColor` of the label and unit views.; numBackground — An instance of Color. The `background` of the number view.; numStringColor — An instance of Color. The `stringColor` of the number view.; numNormalColor — An instance of Color. The `normalColor` of the number view.; numTypingColor — An instance of Color. The `typingColor` of the number view.; background — An instance of Color. The `background` of the enclosing view.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n SendPeakRMS.kr(Dust.ar(20), 20, 3, \"/replyAddress\")\n}.play;\n);\n\n(\no = OSCFunc({ |msg|\n \"peak: %, rms: %\".format(msg[3], msg[4]).postln\n}, '/replyAddress');\n;\no.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n SendPeakRMS.kr(Dust.ar(20), 20, 3, \"/replyAddress\")\n}.play;\n);\n\n(\no = OSCFunc({ |msg|\n \"peak: %, rms: %\".format(msg[3], msg[4]).postln\n}, '/replyAddress');\n);\no.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Process.run` do?"}, {"role": "assistant", "content": "called when the user chooses the Run menu command. Override this in class Main to do whatever you"}]} -{"conversations": [{"role": "user", "content": "What is `AbstractServerAction`?"}, {"role": "assistant", "content": "AbstractServerAction — register actions to be taken for a server"}, {"role": "user", "content": "What does `AbstractServerAction.functionSelector` do?"}, {"role": "assistant", "content": "Subclasses return specific function selectors for objects that implement this as interface. Selectors are:"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// ServerBoot\ns.boot;\nf = { |server| \"------------The server '%' has booted.------------\\n\".postf(server) };\nServerBoot.add(f, \\default);\ns.quit; // quit the server and observe the post\ns.boot;\nServerBoot.remove(f, \\default); // remove it again\ns.quit;\ns.boot; // no post.\nServerBoot.add(f, Server.internal);\nServer.internal.quit;\nServer.internal.boot;\nServerBoot.removeAll; // clear all\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Creaking door or roulette wheel?."}, {"role": "assistant", "content": "```supercollider\n(\n\n{\n\nvar output, basePitch = 387, macroPitch, macroPitchAmt = 400;\nvar modOsc, modAmt = 1.3, amp = 0.8;\nvar creakRate, creakTrig, creakEnvGen, noise, combs, oscFreq;\n\nnoise = LFNoise1.ar(LFNoise0.kr(4.8).lag(0.4).range(3646, 7777), 0.6);\n\ncreakRate = EnvGen.kr(\n Env(\n [40, 25, 15, 2],\n [0.9, 0.6, 1.0],\n -4\n ),\n doneAction: 2\n\n);\ncreakTrig = Impulse.kr(creakRate);\n\ncreakEnvGen = EnvGen.kr(\n Env(\n [0.0, 1.0, 0.0],\n [0.02, 0.1],\n [5, -8]\n ),\n creakTrig,\n timeScale: SinOsc.kr(1.5).range(0.12, 0.26) * Line.kr(0.5, 2.3, 2)\n\n);\n\nmacroPitch = EnvGen.kr(\n Env(\n [0.0, 4, 0.1, 0.3, 0.4, 0.7, 0.9],\n [0.2, 0.2, 0.4, 0.3, 0.48, 0.59],\n [2, 2, -4, -3, -2, -4]\n )\n\n);\nmodOsc = SinOsc.ar( (basePitch + (macroPitch * macroPitchAmt)) * 0.17);\nmodOsc = SinOsc.ar( (basePitch + (macroPitch * macroPitchAmt)) * 0.232, modOsc * 0.3);\n\noscFreq = basePitch + (macroPitch * macroPitchAmt);\noscFreq = oscFreq * (1 + (creakEnvGen * 2));\noutput = SinOsc.ar(oscFreq, modOsc * modAmt, 1);\noutput = output * SinOsc.ar(SinOsc.kr(1.6).range(1220, 1355));\noutput = output + noise;\noutput = output.clip(-0.5, 0.5) * creakEnvGen * amp * TRand.kr(0.8, 1.0, creakTrig);\n\ncombs = Mix([CombC.ar(output, 0.2, 0.0084, 0.12), CombC.ar(output, 0.2, 0.00181, 0.03)]);\noutput = output + (combs * 0.2);\noutput ! 2\n}.play\n\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `MultiTap`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\nb = Buffer.alloc(s, s.sampleRate);\n(\n{\n MultiTap.ar(`[0.1, 0.2, 0.3, 0.4], `[0.1, 0.2, 0.4, 0.8],\n Decay.ar(Dust.ar(2), 0.1, PinkNoise.ar), bufnum: b.bufnum)\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PV_BrickWall`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n(\n{\n var in, chain;\n in = WhiteNoise.ar(0.2);\n chain = FFT(LocalBuf(2048), in);\n chain = PV_BrickWall(chain, SinOsc.kr(0.1));\n IFFT(chain);\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Plotter`."}, {"role": "assistant", "content": "```supercollider\n(\na = { (0..10).scramble.normalize }.dup(2).plot;\na.editMode = true;\na.editFunc = { |...args| args.postln };\n);\n\n// using plotter as a control interface\n(\na = { (0..10).scramble.normalize(300, 400) }.dup.plot;\na.specs = \\freq; a.plotMode = \\bars;\na.editMode = true;\nx = {\n var phase = SinOsc.ar(\\rate.kr(a.value[1]));\n SinOsc.ar(\\freq.kr(a.value[0]), phase).mean * 0.1\n}.play;\na.editFunc = { |plotter, plotIndex, i, val|\n x.setn(\\freq, a.value[0]);\n x.setn(\\rate, a.value[1]);\n};\na.parent.onClose = { x.release };\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Feedback with beats."}, {"role": "assistant", "content": "```supercollider\nNdef(\\a, {\n var src, loc, delay=0.01;\n src = Decay2.ar(Impulse.ar(1/8), LFNoise2.kr(4).range(0.001, 0.0001),\n LFNoise2.kr(4).range(0.005, 0.05))!2\n * Saw.ar(LFNoise2.kr(4).exprange(40, 4000));\n loc = BPF.ar(LocalIn.ar(2) + [src, 0], LFNoise0.kr(1/4).range(100, 1200).lag, 3.2);\n loc = GVerb.ar(loc, 100, 4, mul:0.02, add:loc);\n loc = Compander.ar(loc, loc, 0.9, 1, 0.001);\n loc = (loc * 0.501).tanh;\n loc = Compander.ar(loc, loc, 0.1, 1, 0.1); \n loc = DelayC.ar(loc, delay * 2, delay * 1);\n LocalOut.ar(loc.reverse * 0.49);\n Out.ar(0, loc * 0.9)\n}).play;\n\nNdef(\\b, {\n var src, loc, del;\n del = 1/100;\n src = Decay2.ar(TDuty.ar(1/4,0,Dseq([1, 0.5, 0.3, 0.1],inf)), \n LFNoise2.kr(4).range(0.001, 0.0001), LFNoise2.kr(4).range(0.005, 0.05))!2\n * Saw.ar(LFNoise2.kr(200).exprange(40, 14000));\n loc = BPF.ar(LocalIn.ar(2) + [src, 0], LFNoise2.kr(0.1).range(40, 400), 3.2);\n loc = GVerb.ar(loc, 100, 4, mul:0.02, add:loc);\n loc = Compander.ar(loc, loc, 0.9, 1, 0.001);\n loc = (loc * 0.51).tanh;\n loc = Compander.ar(loc, loc, 0.1, 1, 0.1); \n loc = DelayC.ar(loc, del * 2, del * 1);\n LocalOut.ar(loc.reverse * 0.45);\n Out.ar(0, Compander.ar(loc,loc,0.1, 1, 0.05) * 1.2)\n}).play;\n\nNdef(\\c, {\n var src, loc, del=1/4;\n src = Decay2.ar(Impulse.ar(1), 0.0001, 0.05) * SinOsc.ar(60);\n loc = src + LocalIn.ar(2);\n loc = BPF.ar(loc, 800, 3.2).softclip;\n loc = DelayN.ar(loc, del, [0, del]);\n LocalOut.ar(loc.reverse * 0.99);\n Out.ar(0, loc * 2)\n}).play;\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for micro-beat repeat, based on delay."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\stutter,{\n arg in=0, out=0;\n var sig, delayTime, increment, trigger;\n var reset=\\reset.kr(0);\n var delayPitch=\\pitch.kr(12);\n var offsetms=\\offsetms.kr(0)/1000;\n var strobe=\\strobe.kr(1);\n var on=\\onoff.kr(0);\n var envGen, sustainTime;\n var atkTime=0.002, relTime=0.002;\n\n reset=reset*on;\n // Convert pitch to delay time in seconds\n delayTime = delayPitch.midicps.reciprocal;\n\n // Trigger for incrementing delay time\n trigger = Impulse.ar(delayTime.reciprocal);\n\n // Calculate sustain time to ensure envelope stays high for the chunk duration minus attack and release\n sustainTime = delayTime - (atkTime + relTime);\n\n // Ensure sustainTime is not negative\n sustainTime = max(sustainTime, 0)*strobe;\n\n // Increment delay time\n increment = Dseries(0, delayTime, inf)*on;\n increment = Demand.ar(trigger, reset, increment);\n\n // Generate an envelope to soften clicks\n envGen = EnvGen.ar(Env([0, 1, 1, 0], [atkTime, sustainTime, relTime], 'lin'), trigger);\n\n\n // Get input signal\n sig = In.ar(in, 1); // Assuming stereo input\n\n // Apply delay\n sig = DelayC.ar(sig, 24, increment+offsetms);\n\n // Apply envGen\n sig=sig*envGen;\n\n // Output\n Out.ar(out, sig);\n}).add();\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Pushing air."}, {"role": "assistant", "content": "```supercollider\n/*\n0050\n\"pushing air\" => \".--. ..- ... .... .. -. --. / .- .. .-.\"\n*/\n\n~morsestr = \".--. ..- ... .... .. -. --. / .- .. .-. / \";\n\n~ctlbus1 = Bus.control(s);\nMIDIIn.connectAll;\n\n(\nSynthDef(\\perc, {|freq=280|\n var ampEnv, snd, attack, release, sat, mod;\n release = 3;\n attack = ~ctlbus1.kr;\n sat = -2;\n mod = SinOsc.ar(4, 0, 2);\n ampEnv = EnvGen.ar(Env.perc(attack, release, 1), doneAction:2);\n snd = ampEnv * SinOsc.ar([freq, (1.005*freq)+mod], [Rand(0,3.14),Rand(0,3.14)]);\n snd = 2/(1 + (sat*snd).exp) - 1;\n Out.ar(0,snd);\n}).add;\n);\n\n~t = TempoClock.new;\n~t.tempo = 3;\nTdef(\\morse).play(~t);\n\n\n(\nMIDIdef.cc(\\attackTime, \n {|val, num, chan, src| \n var attackTime;\n\n attackTime = val.linlin(0,127,0,2);\n ~ctlbus1.set(attackTime);\n (\"attackTime: \" ++ attackTime).postln;\n },2);\n\nMIDIdef.cc(\\tempo, \n {|val, num, chan, src| \n var index;\n var tempoArray = [3,6,12];\n \n index = val.linlin(0,127,0,2);\n ~t.tempo = val.linlin(0,127,1,12);//tempoArray[index];\n val.linlin(0,127,1,12).postln;//tempoArray[index].postln;\n },14);\n);\n\n(\nTdef(\\morse,\n{ \n inf.do{ |i| \n \n var f0 = 180 * (2**(0/12));\n var freq = 2**(([-7,-3,0,2,5,9,12].choose)/12) * f0;\n var char = ~morsestr.wrapAt(i).asString;\n \n switch(char,\n \".\", { \".\".post; \n //x = Synth(\\default); \n x = Synth(\\perc, [\\freq, freq]); \n 1.wait;\n //x.release;\n },\n \"-\", { \"-\".post; \n //x = Synth(\\default); \n x = Synth(\\perc, [\\freq, freq]); \n 3.wait;\n //x.release;\n },\n \" \", { \" \".post; \n 1.wait;\n },\n \"/\", { \"/\".post;\n 3.wait;\n }, {});\n };\n})\n);\n\nTdef(\\morse).reset;\nTdef(\\morse).pause;\nTdef(\\morse).stop;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// 2012.05.04\n// Work for NX014 Class\n// Inspiration: A Rukano Tweet. Thanks rukano!\n// Comment: Cosmic Organ.\n\np = ProxySpace.push(s.boot);\n\n~a.play;\n\n~a = { var alpha,gamma;\n alpha= LFNoise2;\n gamma= {[rrand(30,50),rrand(50,70),rrand(50,70),rrand(70,100)].choose.midicps*alpha.kr(1,0.01,1)}!24;\n Pan2.ar(LeakDC.ar(Normalizer.ar(\n BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(FreeVerb.ar(\n Splay.ar(RLPF.ar(LFSaw.ar(gamma)/4,gamma*LFCub.kr(rrand(0.01,0.1),0,2,3),alpha.kr(1/8,0.6,0.7))) \n ,0.1,0.1,0.1)\n ,100,6.0,6),1000,6.0,0),5000,6.0,0),10000,6.0,6)\n ,(0.8/0.999)*1,0.1)),0)\n};\n\n~a = nil;\n```"}, {"role": "assistant", "content": "A cosmic organ with a inspiration of rukano tweet. Thanks rukano!."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// if NTMI.helloSnd is not already defined in startup file, do this:\nfork {\n NTMI.numChans.do { |i|\n { LFDNoise3.ar(\n XLine.kr(\n exprand(2000, 5000),\n exprand(2000, 20000),\n 0.25, doneAction: 2),\n 0.1\n )\n }.play(outbus: i);\n 0.25.wait;\n };\n}\n```"}, {"role": "assistant", "content": "if NTMI.helloSnd is not already defined in startup file, do this:."}]} -{"conversations": [{"role": "user", "content": "What does `SelectButtonSet.new` do? What arguments does it take?"}, {"role": "assistant", "content": "a set of radio buttons Arguments: layout; labelArrayOrQnty; action; color; selectedColor; width; height."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// play to buses silently\n\n(\na = Bus.audio(s, 5);\nx = { Out.ar(a.index, SinOsc.ar((3..7) * 100, 0, 0.05)) }.play\n);\n\n\n// mix the source\n// a Drate ugen with arrays causes multichannel expansion\n// thus the drate ugen for fadeTime needs to be wrapped into a Function\n\n(\nz = {\n DXMixIn.ar(\n Drand([[0, 1], [2, 3], [4, 0], [1, 2], [3, 4]], inf) + a.index,\n fadeTime: { Dwhite(0.5, 5) }\n )\n}.play(addAction: \\addToTail)\n);\n\n// stop DXMixIn, source still running\n\nz.release\n\n\n// get source\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// play to buses silently\n\n(\na = Bus.audio(s, 5);\nx = { Out.ar(a.index, SinOsc.ar((3..7) * 100, 0, 0.05)) }.play\n);\n\n\n// mix the source\n// a Drate ugen with arrays causes multichannel expansion\n// thus the drate ugen for fadeTime needs to be wrapped into a Function\n\n(\nz = {\n DXMixIn.ar(\n Drand([[0, 1], [2, 3], [4, 0], [1, 2], [3, 4]], inf) + a.index,\n fadeTime: { Dwhite(0.5, 5) }\n )\n}.play(addAction: \\addToTail)\n);\n\n// stop DXMixIn, source still running\n\nz.release\n\n\n// get source with other rhythm\n\n(\nz = {\n DXMixIn.ar(\n Dseq([[0, 1], [2, 3], [4, 0], [1, 2], [3, 4]], inf) + a.index,\n fadeTime: [0.05, 2]\n )\n}.play(addAction: \\addToTail)\n);\n\nz.release\n\n// cleanup\n\n(\nx.free;\na.free;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `ArraySpec.size` do?"}, {"role": "assistant", "content": "datatype specifying an array with an itemSpec which describes its items"}]} -{"conversations": [{"role": "user", "content": "What does `BusPool.alloc` do? What arguments does it take?"}, {"role": "assistant", "content": "bus allocator with retain/release counting for shared busses Arguments: rate; server; numChannels; client; name."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a, b;\na = Pser([1, 2, 3], 5); // return 5 items\nb = a.asStream;\n6.do({ b.next.postln });\n);\n\n// Pser used as a sequence of pitches:\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Pser([Pser(#[60, 61, 63, 65, 72], 3)], inf).asStream;\nRoutine({\n loop({\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a, b;\na = Pser([1, 2, 3], 5); // return 5 items\nb = a.asStream;\n6.do({ b.next.postln });\n);\n\n// Pser used as a sequence of pitches:\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Pser([Pser(#[60, 61, 63, 65, 72], 3)], inf).asStream;\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, a.next.midicps]);\n 0.2.wait;\n })\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n \n// definition for future reference in arbitrary Environments\n\np = PLbrown(\\lo, \\hi, \\step);\n\n\n// prepare current Environment\n// PLseq repeats arg defaults to inf\n\n(\n~lo = 55;\n~hi = 80;\n~step = Pstutter(10, PLseq([0.05, 3.5]));\n);\n\n\n// run\n\n(\nx = Pbind(\n \\midinote, Ptuple(p!2), \n \\dur, 0.1\n).play;\n);\n\n// replace\n\n(\n~lo = Pseq((50..90));\n~hi = Pseq((50..90) + 15);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n \n// definition for future reference in arbitrary Environments\n\np = PLbrown(\\lo, \\hi, \\step);\n\n\n// prepare current Environment\n// PLseq repeats arg defaults to inf\n\n(\n~lo = 55;\n~hi = 80;\n~step = Pstutter(10, PLseq([0.05, 3.5]));\n);\n\n\n// run\n\n(\nx = Pbind(\n \\midinote, Ptuple(p!2), \n \\dur, 0.1\n).play;\n);\n\n// replace\n\n(\n~lo = Pseq((50..90));\n~hi = Pseq((50..90) + 15);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pluck`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n// excitation signal is WhiteNoise, triggered twice a second with varying OnePole coef\n(\n { Pluck.ar(WhiteNoise.ar(0.1), Impulse.kr(2), 440.reciprocal, 440.reciprocal, 10,\n coef: MouseX.kr(-0.999, 0.999))\n }.play(s)\n);\ns.quit;\n// a group of angry fretless mandolin players\n(\n {\n var freq, numparts;\n numparts = 50;\n freq = SinOsc.kr(Array.fill(numparts, { Rand(0.05, 0.2) }),\n Array.fill(numparts, { Rand(0, 1.0) })).range(1000, 3000);\n LeakDC.ar(\n Pan2.ar(\n Pluck.ar(\n WhiteNoise.ar(0.1).dup(numparts),\n Impulse.kr(Array.fill(numparts, { Rand(10, 12) })),\n 100.reciprocal, freq.reciprocal, 2, Rand(0.01, 0.2), mul: 1),\n Array.fill(numparts, { Rand.new(-1.0, 1.0) }))\n .sum\n );\n }.play(s);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is the difference between an audio bus and a control bus?"}, {"role": "assistant", "content": "Both are numbered channels on the server used to move signal between nodes. An audio bus carries audio-rate signal and holds one or more audio channels; a control bus carries one value per block, like a parameter. You write with Out.ar / Out.kr and read with In.ar / In.kr, or with `.asMap` / `\\param, bus.asMap` to drive a Synth's control from a bus. Buses are how effects are chained: a synth writes to a private bus, the effect reads it and writes to Out.ar(0, …)."}]} -{"conversations": [{"role": "user", "content": "What does `String.unixCmd` do? What arguments does it take?"}, {"role": "assistant", "content": "Executes an operating system command asynchronously using the standard shell (`sh` on *nix, `cmd` on Windows). If you want to run a command without a shell, please use Arguments: action — A Function that is called when the process has exited. It is passed two arguments: the exit code and pid of the exited process.; postOutput — A Boolean that controls whether or not the output of the process is displayed in the post window.. Returns: An Integer - the pid of the shell running the command, not of the command itself (see note below for exceptions). To get the actual pid of the command, use SequenceableCollection#-unixCmd, which does "}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nSynthDef(\\Synth3,\n {arg ress = 0;\n var klank, env;\n klank = Klank.ar(`[{Rand(70,21000)}!7, {Rand(0.128,0.700)}!7],BrownNoise.ar(0.7));\n klank = klank;\n env = EnvGen.kr(Env.perc(0.07, ress), doneAction:2);\n Out.ar(0, klank*env.dup*0.0128);\n}).add;\n)\n\n\n{inf.do{x = rrand(0.01,0.7); Synth(\\Synth3, [\\ress, x+(7*x)]); x.wait;}}.fork\n```"}, {"role": "assistant", "content": "Play around with {Rand(70, 21000)}!7\r\n\r\nA simple example for the begginers... hope I can contribute to something =)."}]} -{"conversations": [{"role": "user", "content": "Do is not ¨returning¨ array (campanology)?"}, {"role": "assistant", "content": "SuperCollider forum — Do is not ̈returning ̈ array (campanology)\n\nYou can remove the need for all mutable variables by computing the indexes to swap first - these are stored in indexesEven and indexesOdd.\n\nThen an array of functions is made (swappers)...i.e.[indexesEven, indexesOdd, indexesEven....]\n\nFinally, .inject is used to chain these together, taking the previous result as the input to the next and building an array.\n\n```supercollider\n(\n~swap_sort_steps = {\n |parts|\n var swapConsequtiveIndexes = {|from, to|\n (from..to).clump(2).collect{|p| p.reverse }.flat\n };\n var indexesEven = swapConsequtiveIndexes.(0, parts - 1);\n var indexesOdd = [0] ++ swapConsequtiveIndexes.(1, parts - 1);\n var swappers = parts.collect{ |n|\n {|toSwap| if(n.even)\n { indexesEven.collect{|i| toSwap[i]} }\n { indexesOdd.collect{|i| toSwap[i]} }\n }\n };\n postf(\"indexesEven : %\\nindexesOdd : %\\n\", indexesEven, indexesOdd);\n swappers.inject( [(0..parts-1)], {\n |col, f|\n col ++ [f.(col.last)]\n });\n};\n)\n```\n\nAlso, as I’m sure you know, if anyone else is reading who doesn’t know what this is... its a swap sort algorithm."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Idea: network of loosely connected nodes?"}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\nodeTest, {\n // the input\n// var input = Impulse.ar([1, 3, 5].reciprocal * 1, phase: [0, 0.25, 0.5]).sum;\n\n //var input = Impulse.ar([2, 3], phase: [0, 0.25]).sum;\n// var input = Select.ar(Line.kr(0, 1, 10) * SinOsc.ar(0.01).range(0, 1), [Impulse.ar([0.2, 0.3], phase: [0, 0.25]).sum, LocalIn.ar(1)]);\n\n var input = Select.ar(Line.kr(0, 1, 10), [Impulse.ar(0.134), LocalIn.ar(1)]);\n // the nodes, each takes its predecessor as input and estimates the duration between two events.\n var nodes = (1..20).inject([input], {|last, item|\n var dur = Gate.ar(\n Timer.ar(TDelay.ar(last.first, Rand(1, 4))),\n last.first\n );\n\n [TDuty.ar(\n dur.lag(20),\n TDelay.ar(last.first, dur.lag(20)),\n 1\n )] ++ last\n });\n\n\n LocalOut.ar(nodes.first);\n\n // add a pitch to each\n nodes = nodes.collect{|node, i| SinOsc.ar((500 + (i*250)), 0.9pi)\n// * Decay2.ar(node, 0.01, 0.2)\n * EnvGen.ar(Env.perc(0.0001, 0.1), gate: node)\n * 2 * (25-i) * 0.01};\n\n // splay in stereo field\n //nodes.sum!2;\n Splay.ar(nodes)// + (SinOsc.ar(2000) * Decay2.ar(input, 0.01, 0.2) * 0.1);\n\n}).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\nv = Signal.sineFill(128, 1.0 / [1, 2, 3, 4, 5, 6]);\nb = Buffer.alloc(s, 128);\n);\n(\nb.loadCollection(v, action: { |buf|\n x = { PlayBuf.ar(buf.numChannels, buf, BufRateScale.kr(buf), loop: 1)\n * 0.2 }.play;\n});\n);\nx.free; b.free;\n\n// interleave a multi-dimensional array\n(\nl = Signal.sineFill(16384, Array.fill(200, { 0 }).add(1));\nr = Array.fill(16384, { 1.0.rand2 });\nm = [Array.newFrom(l), r]; //\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\nv = Signal.sineFill(128, 1.0 / [1, 2, 3, 4, 5, 6]);\nb = Buffer.alloc(s, 128);\n);\n(\nb.loadCollection(v, action: { |buf|\n x = { PlayBuf.ar(buf.numChannels, buf, BufRateScale.kr(buf), loop: 1)\n * 0.2 }.play;\n});\n);\nx.free; b.free;\n\n// interleave a multi-dimensional array\n(\nl = Signal.sineFill(16384, Array.fill(200, { 0 }).add(1));\nr = Array.fill(16384, { 1.0.rand2 });\nm = [Array.newFrom(l), r]; // a multi-dimensional array\nm = m.lace(32768); // interleave the two collections\nb = Buffer.alloc(s, 16384, 2);\n);\n(\nb.loadCollection(m, 0, { |buf|\n x = { PlayBuf.ar(2, buf, BufRateScale.kr(buf), loop: 1) * 0.5 }.play;\n});\n);\nb.plot;\nx.free; b.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Polyrhythmic and dynamic FM drone."}, {"role": "assistant", "content": "```supercollider\n// https://recarteblog.wordpress.com/\n//droneFM01\n\n// 1. Añadir al servidor\n(\nSynthDef(\\droneFM, {\n arg f1Freq=0.1, f2Freq=1.1, f3Freq=2.2, nFreq=440, m1Ratio=1, m2Ratio=2, m3Ratio=3,\n amp=0.1, dur=55, ampM=0.84 , pan=0;\n var sig, car1, mod1, car2, mod2, car3, mod3, env, index;\n index = LFNoise1.kr(0.2).range(2, 12);\n env = EnvGen.kr(Env.new([0, 0.70, 0.70, 0], [dur*0.333, dur*0.333, dur*0.333]), doneAction:2);\n mod1 = SinOsc.ar([nFreq * m1Ratio, nFreq+0.7 * m1Ratio], mul:nFreq * m1Ratio * index) * ampM;\n car1 = SinOsc.ar(f1Freq + mod1);\n mod2 = SinOsc.ar([nFreq * m2Ratio, nFreq+1.4 * m2Ratio], mul:nFreq * m2Ratio * index) * ampM;\n car2 = SinOsc.ar(f2Freq + mod2);\n mod3 = SinOsc.ar([nFreq * m3Ratio, nFreq+0.35 * m3Ratio], mul:nFreq * m3Ratio * index) * ampM;\n car3 = SinOsc.ar(f3Freq + mod3) * 0.4;\n sig = car1 + car2 + car3 * env * amp;\n sig = Pan2.ar(sig, pan);\n Out.ar(0, sig);\n}).add;\n);\n\n// 2. Ejecutar los Synths\n(\nSynth(\\droneFM, [\\nFreq, 50.midicps]);\nSynth(\\droneFM, [\\nFreq, 57.midicps]);\nSynth(\\droneFM, [\\nFreq, 41.midicps]);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var a, freq, trig;\n a = Dwrand([0, 1, 2, 7], [0.4, 0.4, 0.1, 0.1], inf).dpoll;\n trig = Impulse.kr(MouseX.kr(1, 400, 1));\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var a, freq, trig;\n a = Dwrand([0, 1, 2, 7], [0.4, 0.4, 0.1, 0.1], inf).dpoll;\n trig = Impulse.kr(MouseX.kr(1, 400, 1));\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar sf, clock;\n\nclock= ExternalClock(TempoClock(2.1));\n\nclock.play;\n\nRoutine.run({\n\nsf= BBCutBuffer(Platform.resourceDir +/+ \"sounds/break.aiff\",8);\n\ns.sync; //this forces a wait for the Buffer to load\n\n//0.3.coin chance of random offset starting position for cut playback\nBBCut2(CutBuf1(sf,0.3), BBCutProc11.new).play(clock);\n});\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar sf, clock;\n\nclock= ExternalClock(TempoClock(2.1));\n\nclock.play;\n\nRoutine.run({\n\nsf= BBCutBuffer(Platform.resourceDir +/+ \"sounds/break.aiff\",8);\n\ns.sync; //this forces a wait for the Buffer to load\n\n//0.3.coin chance of random offset starting position for cut playback\nBBCut2(CutBuf1(sf,0.3), BBCutProc11.new).play(clock);\n});\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nz = Pbind(\\degree, Pdefn(\\x, \\), \\dur, 0.25).play;\nPdefn(\\x, Pseq((0..5), inf)).condition_({ |val, i| i.postln % 6 == 0 });\nPdefn(\\x, Pseq((7..0), inf)).condition_({ |val, i| i.postln % 8 == 0 });\n\n\n// the above is equvalent to:\nPdefn(\\x, Pseq((7..0), inf)).count(8;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nz = Pbind(\\degree, Pdefn(\\x, \\), \\dur, 0.25).play;\nPdefn(\\x, Pseq((0..5), inf)).condition_({ |val, i| i.postln % 6 == 0 });\nPdefn(\\x, Pseq((7..0), inf)).condition_({ |val, i| i.postln % 8 == 0 });\n\n\n// the above is equvalent to:\nPdefn(\\x, Pseq((7..0), inf)).count(8);\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Idea: network of loosely connected nodes?"}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\nodeTest, {\n // the input\n// var input = Impulse.ar([1, 3, 5].reciprocal * 1, phase: [0, 0.25, 0.5]).sum;\n\n //var input = Impulse.ar([2, 3], phase: [0, 0.25]).sum;\n// var input = Select.ar(Line.kr(0, 1, 10) * SinOsc.ar(0.01).range(0, 1), [Impulse.ar([0.2, 0.3], phase: [0, 0.25]).sum, LocalIn.ar(1)]);\n\n var input = Select.ar(Line.kr(0, 1, 10), [Impulse.ar(0.134), LocalIn.ar(1)]);\n // the nodes, each takes its predecessor as input and estimates the duration between two events.\n var nodes = (1..20).inject([input], {|last, item|\n var dur = Gate.ar(\n Timer.ar(TDelay.ar(last.first, Rand(1, 4))),\n last.first\n );\n\n [TDuty.ar(\n dur.lag(20),\n TDelay.ar(last.first, dur.lag(20)),\n 1\n )] ++ last\n });\n\n\n LocalOut.ar(nodes.first);\n\n // add a pitch to each\n nodes = nodes.collect{|node, i| SinOsc.ar((500 + (i*250)), 0.9pi)\n// * Decay2.ar(node, 0.01, 0.2)\n * EnvGen.ar(Env.perc(0.0001, 0.1), gate: node)\n * 2 * (25-i) * 0.01};\n\n // splay in stereo field\n //nodes.sum!2;\n Splay.ar(nodes)// + (SinOsc.ar(2000) * Decay2.ar(input, 0.01, 0.2) * 0.1);\n\n}).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "How big are you?"}, {"role": "assistant", "content": "198M parameters in total, 64M active per token because the feed-forward layers are a mixture of four experts with top-1 routing. That is small enough to train in minutes on one GPU."}]} -{"conversations": [{"role": "user", "content": "Explain `ParGroup` in SuperCollider briefly."}, {"role": "assistant", "content": "ParGroup — Client-side representation of a parallel group node on the server Parallel Groups are server-side node containers that work similar to Groups, but without ordering constraints for the contained nodes. This means that on parallel architectures the elements of a Parallel Group can be executed concurrently. Category: Server > Nodes, Server > Abstractions."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes playing Pbinds with a MIDI controller (QuNeo, etc)."}, {"role": "assistant", "content": "```supercollider\n// Running Fifths\n// (QuNeo demo)\n//\n//\n// Ctrl + A, then Ctrl + Enter\n\ns.waitForBoot({\n\n MIDIIn.connectAll;\n\n a = Array.fill(8, {arg count; [count, count+7] });\n\n f = {arg velocity, midinote;\n var notes = if(midinote>=44, {a.reverse+midinote}, {a+midinote});\n p = Pbind(\n \\midinote, Pstutter(Pwrand([1, 3, 5], [0.1, 0.8, 0.1], inf), Pseq(notes)),\n \\dur, 0.1,\n \\amp, velocity/127 * 0.8,\n \\legato, 0.1,\n \\ctranspose, Pstutter(8, Pwhite(0, 36))\n ).play(quant: 0.1);\n };\n\n MIDIdef.noteOn(\\test, { arg vel, note; /*note.postln;*/ f.value(vel, note) });\n\n});\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SharedIn`."}, {"role": "assistant", "content": "```supercollider\n(\n// only works with the internal server\ns = Server.internal;\ns.boot;\n);\n\n(\nSynthDef(\"help-SharedIn1\", {\n Out.ar(0, SinOsc.ar(Lag.kr(SharedIn.kr(0, 1), 0.01), 0, 0.2));\n}).add;\nSynthDef(\"help-SharedIn2\", {\n Out.ar(1, SinOsc.ar(Lag.kr(SharedIn.kr(0, 1), 0.01, 1.5), 0, 0.2));\n}).add;\n);\n\n(\ns.setSharedControl(0, 300); // an initial value\ns.sendMsg(\\s_new, \"help-SharedIn1\", x = s.nextNodeID, 0, 1);\ns.sendMsg(\\s_new, \"help-SharedIn2\", y = s.nextNodeID, 0, 1);\n\nRoutine({\n 30.do({\n s.setSharedControl(0, 300 * (10.rand + 1));\n 0.2.wait;\n });\n s.sendMsg(\\n_free, x);\n s.sendMsg(\\n_free, y);\n}).play;\n);\n\n\ns.quit;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// set() creates a local environment that overrides the outer currentEnvironment\n\nPdefn(\\z).set(\\a, 1, \\b, 5);\n(\nPdefn(\\z, { |e|\n loop { yield((e.a + e.b) + 0.1.rand.round(0.01)) }\n})\n); // [1]\n\nt = Pdefn(\\z).asStream;\n\nt.nextN(3);\n\n(\nPdefn(\\z, { |e|\n // (e.a + e.b) + 0.1.rand.round(0.01) 1\n Pseq([1, 2, e.a], 1)\n})\n);\n\nPdefn(\\z, Pseq([1, 2, 3], 1));\n\ne = Pdefn(\\z).envir\n\n\nPdefn(\\z).set(\\a, 3);\n\nt.next\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// set() creates a local environment that overrides the outer currentEnvironment\n\nPdefn(\\z).set(\\a, 1, \\b, 5);\n(\nPdefn(\\z, { |e|\n loop { yield((e.a + e.b) + 0.1.rand.round(0.01)) }\n})\n); // [1]\n\nt = Pdefn(\\z).asStream;\n\nt.nextN(3);\n\n(\nPdefn(\\z, { |e|\n // (e.a + e.b) + 0.1.rand.round(0.01) 1\n Pseq([1, 2, e.a], 1)\n})\n);\n\nPdefn(\\z, Pseq([1, 2, 3], 1));\n\ne = Pdefn(\\z).envir\n\n\nPdefn(\\z).set(\\a, 3);\n\nt.next;\n\nPdefn(\\z).set(\\a, Pseq([1, 2, 3], inf));\n\nt.reset;\nt.nextN(3);\n\nPdefn(\\z).envir; // post the envir\n\n\n\n// if you want to keep using the currentEnvironment at the same time,\n// assign the currentEnvironment to the envir's parent (or proto) field\n// (this shouldn't be a proxy space of course.)\n\nPdefn(\\z).envir.parent = currentEnvironment;\n~a = 9;\n~b = 10;\n\nt.nextN(3);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a random pentatonic melody that plays by itself."}, {"role": "assistant", "content": "Pick degrees from a pentatonic scale; `\\scale` and `\\root` define the pitch space, and `\\degree`\npicks within it.\n\n```supercollider\n(\nPbind(\n \\instrument, \\default,\n \\scale, Scale.minorPentatonic,\n \\root, 3,\n \\degree, Pwhite(0, 9, inf),\n \\octave, 5,\n \\dur, Pwhite(0.12, 0.28, inf),\n \\amp, 0.2,\n \\legato, 0.8\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `ExponentialGridLines` in SuperCollider?"}, {"role": "assistant", "content": "ExponentialGridLines — Calculates the numerical values suitable for exponentially-spaced grid lines to be used for plotting or other UI elements. `ExponentialGridLines` is a strategy object that finds suitable intervals for plotting grid lines and labels. The values span the range defined by a corresponding ControlSpec. Most of the functionality of `ExponentialGridLines` is inherited from its superclass, AbstractGridLines. The instance methods are used by DrawGrid (which is in turn used by Plotter) which handles the drawing of the lines and Category: GUI > Accessories."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Timing variations."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\sound, {\n arg i_bus = 0, amp = 0.1, freq = 440, sustain = 1, pan = 0;\n var env, osc, out;\n env = EnvGen.kr(Env.perc(0.01, sustain, amp),doneAction:2);\n osc = SinOsc.ar([freq, freq * 1.005, freq * 0.995], mul:env);\n out = Pan2.ar(osc, pan);\n Out.ar(i_bus, out);\n}).send(s);\n);\n\n(\n~amp = 0.1;\na = Pdef(\\a,\n Pbind(\n \\instrument, \\sound,\n \\amp, ~amp * 1.5,\n \\degree, Pseq([2, 4, 5, 6, 1] - 1, inf),\n \\dur, Pseq([1, 1, 1, 1, 2] / 4, inf)\n )\n).quant_([3, 0, 0, 1]);\n\nb = Pdef(\\b,\n Pbind(\n \\instrument, \\sound,\n \\amp, ~amp,\n \\degree, Pseq(([8, 6, 5, 3, 4, 6]!3).flat[0..(6*3)-2] - 1, inf),\n \\dur, Prand([Pseq([1, 1, 1, 1, 1, 1] / 4, 4), Prand([1/8, 3/8], 1)], inf)\n )\n).quant_([3, 0, 0, 1]);\n\nc = Pdef(\\c,\n Pbind(\n \\instrument, \\sound,\n \\amp, ~amp * 0.6,\n \\degree, Pseq([1, 6, 8, 6, Pwrand([11,13], [2, 1].normalizeSum)] - 1, inf),\n \\amp, Pseq([0, 1, 1, 1, 1] / 10, inf),\n \\dur, Pseq([8, 1, 1, 1, 1] / 8, inf),\n \\sustain, 0.1\n )\n).quant_([3, 0, 0, 1]);\n);\n\n(\nSystemClock.sched(0, Routine({\n a.play; 12.yield;\n b.play; 12.yield;\n c.play; 12.yield;\n c.pause; 6.yield;\n a.pause; 6.yield;\n\n b.pause; a.play; 12.yield;\n b.play; 12.yield;\n c.play; 12.yield;\n c.pause; a.pause; 6.yield;\n b.pause; 6.yield;\n}));\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `MassEditUChain.fadeOut` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: fadeOut — (describe argument here). Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "What is `Dictionary`?"}, {"role": "assistant", "content": "Dictionary — associative collection mapping keys to values"}, {"role": "user", "content": "What does `Dictionary.new` do?"}, {"role": "assistant", "content": "Creates a Dictionary with an initial capacity for n key value mappings."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nd = Dictionary.new;\nd.add(\\monkey -> 0).postln;\nd.add(\\robot -> 1).postln; // Add robot as a key with a value of 1\nd.add(\\monkey -> 2).postln; // Replaces the value for the key monkey with 2\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LinExp`."}, {"role": "assistant", "content": "```supercollider\n// linexp\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(mod.linexp(-1, 1, MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1))) * 0.1\n}.play;\n);\n\n// exprange\n(\n{\n var mod = LFNoise2.ar(80).exprange(MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1));\n SinOsc.ar(mod) * 0.1\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Control`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_Control, { |freq = 200|\n\n freq.inspect; // at the time of compiling the def\n\n}).add\n);\n\n// synonym:\n(\nSynthDef(\\help_Control, {\n\n \\freq.kr(200).inspect; // at the time of compiling the def\n\n}).add\n);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes an experiment with roots of unity in supercollider."}, {"role": "assistant", "content": "```supercollider\n(\n\n~divisors = {\n arg n;\n ~divs = List.newClear(0);\n for( 1, floor(sqrt(n)), {arg i; if(n%i==0,{\n //i.postln;\n ~divs.add(i);\n // (i==n.div(i)).postln;\n if(i==n.div(i),{},{~divs.add(n.div(i))});\n },{});\n });\n ~divs.sort;\n ~divs;\n};\n\n\nSynthDef(\\rootsOfUnitySum, { |out=0,freq=1,amp=1,n=1,ks=#[1]|\n var l,sigl,sigr,env;\n\n\n sigl = SinOsc.ar(freq:0,mul:0);\n sigr = SinOsc.ar(freq:0,mul:0);\n ks.do({arg item,i;\n k = item;\n sigr = sigr+SinOsc.ar(freq:freq*2pi*k/n,mul:amp,phase:0.5*pi);\n sigl = sigl+SinOsc.ar(freq:freq*2pi*k/n,mul:amp);\n });\n env = EnvGen.kr(Env.linen(attackTime: 0.001, sustainTime: 1, releaseTime: 0.01, level: 1.0, curve: 'lin'), doneAction: Done.freeSelf);\n sigr = sigr*env;\n sigl = sigl*env;\n\n Out.ar(out, [sigl,sigr])\n}).add;\n\n\n~getPbind = { arg n, amps, durs, freq;\n ~nums = ~divisors.value(n);\n r = Pbind(\\instrument,\\rootsOfUnitySum,\n \\amp,amps,\n \\dur,durs,\n \\freq,freq,\n \\n,Pseq([n],~nums.size),\n \\ks , Pseq(all{:~divisors.value(n),n<-~nums},1)).trace();\n r\n};\n\n~seq = (1..13);\n~tau = all{:~divisors.value(n).size,n<-~seq};\n\n\n~r = Pseq(all{:~getPbind.value(\n n:n,\n amps:Pseq(all{:0.5/t,t<-~tau},1),\n durs:Pseq(all{:0.3333/t,t<-~tau},1),\n freq:220/3),n<-~seq},1);\n\n~s = Pseq(all{:~getPbind.value(\n n:n,\n amps:Pseq(all{:0.5/t,t<-~tau},1),\n durs:Pseq(all{:0.5/t,t<-~tau},1),\n freq:110),n<-~seq},1);\n\n~t = Pseq(all{:~getPbind.value(\n n:n,\n amps:Pseq(all{:0.5/t,t<-~tau},1),\n durs:Pseq(all{:1/t,t<-~tau},1),\n freq:220),n<-~seq},1);\n\n~x = Pseq([\n Ppar([~t],1),\n Ppar([~s],1),\n Ppar([~s,~t],1),\n Ppar([~r],1),\n Ppar([~r,~t],1),\n Ppar([~r,~s],1),\n Ppar([~r,~s,~t],1),\n ],inf);\n\n);\n\nPdef(\\mplayer, ~x).clock_(TempoClock(100/60)).play;\nPdef(\\mplayer, Pn(Event.silent)).fadeTime_(8);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PV_ChainUGen`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var chain = FFT(LocalBuf(1024));\n chain.fftSize.poll;\n 0.0\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is the difference between TempoClock and SystemClock?"}, {"role": "assistant", "content": "SystemClock runs in real time and is what `.wait` uses by default. TempoClock runs in beats and has a tempo, so it can be changed while things are playing and Patterns scheduled on it follow. `TempoClock.default` is the clock Patterns use unless told otherwise, which is why `TempoClock.default.tempo = 2` changes the speed of everything you already have running."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Hymn #15 - generative melody by array rewriting?"}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\ping, {\n arg freq = 440, pan = 0;\n var sig;\n sig = SinOsc.ar(freq, 0, 0.3);\n sig = sig * EnvGen.ar(Env.perc(0.01, 1), doneAction:2);\n sig = Pan2.ar(sig, pan);\n Out.ar(0, sig)\n}).add;\n);\n\n(\n~scramb = {|pan|\nvar notes = [0,4,7,14,9,12,4,7,9,7];\nvar dur = [1,1,2,3,6,3,4,5,2,1,13];\nvar transp = [0, 5, 7, 3, 2];\nvar scrambRand = {|array|\n var rand = rrand(0, array.size-3);\n var end = rand + rrand(1,2);\n var range = (rand..end);\n var reverseRange = range.reverse;\n var temp = array.copy;\n range.postln;\n range.do({|item, index|\n array[item] = temp[reverseRange[index]];\n });\n array;\n};\nvar octRand = {|array|\n var rand = rrand(0, array.size-1);\n array[rand] = array[rand] + [-12,0,12].choose;\n };\nvar task = Task {\n var step = 0;\n var transpStep = 0;\n loop {\n var freq = (notes.wrapAt(step) + 60 + transp.wrapAt(transpStep)).midicps;\n Synth(\\ping, [\\freq, freq, \\pan, pan]);\n (dur.wrapAt(step) * 0.15).wait;\n step = step + 1 % (notes.size * 12;);\n if (step%32 == 0, {scrambRand.value(notes)});\n if (step%20 == 0, {scrambRand.value(dur)});\n if (step%66 == 0, {transpStep = transpStep + 1 % (transp.size)});\n if (step%24 == 0, {notes = notes.rotate(rrand(-1, 1))});\n if (step%56 ==0, {octRand.value(notes)});\n }\n}.play;\n};\n);\n\n(\n~scramb.value(-0.7);~scramb.value(0.7);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// Find/make a dataset of points:\nx = 15.collect{[1.0.rand, 1.0.rand]};\n// Append the index onto the end, for later reference\nx = x.collect{|data, i| data ++ i };\n// Use the KDTree quark and the .makeBufferData method to put the data in the searchable format\n~treedata = NearestN.makeBufferData(KDTree(x, lastIsLabel: true));\n// Load the data to the server\n~treebuf = Buffer.sendCollection(s, ~treedata.flat, 5);\n// Run a synth with the ugen and some kind of query data\n~synth = { NearestN.kr(~treebuf, {LFNoise0.kr\n// …\n```"}, {"role": "assistant", "content": "Find/make a dataset of points: Append the index onto the end, for later reference (NearestN: Find the nearest-neighbours in a set of points)"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = {LFTri.ar(100+(1000*Maths.ar(MouseX.kr, MouseY.kr, 0.2, 1-MouseButton.kr(lag:0.001))[0]), 0, 0.1)}.play //notice how I am taking the [0th channel of the Maths and ignoring the other outputs\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = {LFTri.ar(100+(1000*Maths.ar(MouseX.kr, MouseY.kr, 0.2, 1-MouseButton.kr(lag:0.001))[0]), 0, 0.1)}.play //notice how I am taking the [0]th channel of the Maths and ignoring the other outputs\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SDrone.type` do?"}, {"role": "assistant", "content": "a LINKClasses/Symbol describing the type of sound produced. For example"}]} -{"conversations": [{"role": "user", "content": "What does `Main.addOSCRecvFunc` do? What arguments does it take?"}, {"role": "assistant", "content": "Register a Function to be evaluated whenever SuperCollider language (the client) receives an OSC message. This will not overwrite any previously registered Arguments: func — A Function or similar object to be added. When evaluated, this function will be passed the arguments msg, time, replyAddr, and recvPort, corresponding to the message itself as an Array, the time the message was sent, the NetAddr of the sender, and the port on which the message was received. Note tha."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n/// measuring lastUpdateTime from MKtls,\n/// to display which interfaces were recently active\n~time = ();\n~time.actives = [ MKtl(\\ntmi), MKtl(\\uc4), MKtl(\\ferrari) ];\n~time.times = ();\n~time.spec = [1000, 1, \\exp].asSpec;\n~time.actives.do { |mk| ~time.times.addSpec(mk.name, ~time.spec) };\n\n~time.egui = EnvirGui(~time.times);\n\n~time.times.getSpec\n\n~time.skip.stop.free;\n~time.skip = SkipJack({\n ~time.actives.do { |mk|\n ~time.times.put(mk.name, mk.timeSinceLast)\n }\n});\n~time.skip.dt = 0.5;\n\nMKtl(\\ntmi).elAt(\\battery).action.cs;\n\nl = List.new(1024);\nMKtl(\\ntmi).elAt(\\battery).action = { |el|\n var val = el.deviceValue;\n // l.add(val);\n // val.postln;\n // if (val > 0) { val.postln };\n};\n\nl.postcs;\n```"}, {"role": "assistant", "content": "measuring lastUpdateTime from MKtls, to display which interfaces were recently active."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for The quest for the prime numbers?"}, {"role": "assistant", "content": "```supercollider\n//Prime numbers\n \nServer.default.boot;\n(\n//maximum number\n~max=100;\n\n//synthdefs: 2 filtered sawteeth for number and divisor\nSynthDef ( \\gsaw, {arg g;\n Out.ar(1, \n RLPF.ar ( Saw.ar(20*g), 10000*(1-(g/~max)), 0.2, 0.2)\n )\n}).add;\n\nSynthDef ( \\dsaw, {arg d, g;\n Out.ar(0,\n RLPF.ar( Saw.ar(20*d), 10000*d/sqrt(g), 0.2, 0.2)\n // the square root is important: if you search for the divisors of a number,\n // don't search beyond the square root of the number. There won't be any.\n )\n}).add;\n\n//a fm-sound with carrier 20*number and modulator 20*divisor, modulation index = 10\nSynthDef (\\fm, {arg m, c;\n Out.ar(0,\n Pan2.ar(SinOsc.ar(20*c+(SinOsc.ar(20*m, 0, 200*m, 0))), 0)\n )\n}).add;\n\n);\n(\nr=Routine({\n var number, divisor;\n //the list of prime numbers\n l=Array.newClear(indexedSize: 0);\n\n for (2, ~max,{arg number;\n x=Synth(\\gsaw, [\\g, number]); //play the number\n divisor=2;\n p=true; //prime number?\n while ({((divisor <= (number.sqrt)).and(p == true))},\n { \n y=Synth(\\dsaw, [\\d, divisor, \\g, number]); //play the divisor\n z=Synth(\\fm, [\\m, divisor, \\c, number]); //play the fm sound of number and divisor\n 1.wait; //1 second should be enough to hear if a sound is harmonic\n // harmonic sound means: not a prime number\n y.free; \n z.free; \n if( number.mod(divisor) == 0, {p = false} ); //not a prime number\n divisor = divisor + 1;\n }\n );\n x.free;\n if (p == true){ //primenumber!\n l=l.add(number); //add primenumber to the list\n for (1, l.size, { arg i; //play the list of prime numbers\n z=Synth(\\fm, [\\m, l.size, \\c, l[i]]);\n 0.1.wait;\n z.free;\n });\n }\n\n });\n});\n);\nr.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PatternProxy`."}, {"role": "assistant", "content": "```supercollider\na = PatternProxy(Pseq([1, 2, 3], inf));\n\nx = Pseq([0, 0, a], inf).asStream;\n\nt = Task({ loop({ x.next.postln; 0.3.wait }) }).play;\n\n\na.source = Pseq([55, 66, 77], inf);\na.source = Pseq([55, 66, 77], 1);\n\nt.stop;\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Paddp`."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\freq, Pseq([500, 600, 700]), \\instrument, \\sinegrain);\na = Paddp(\\freq, Pseq([30, 90, -100], inf), a);\na.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//spinning hypercube / tesseract\n//after Shiffman https://codingtrain.github.io/website-archive/CodingChallenges/113-hypercube.html\n\n\n(\nvar width= 640, height= 480, w,\ntheta= 0, speed= 0.005, hypercube;\n\nw= RedWindow(\"3Dhypercube\", Rect(128, 64, width, height)).front;\nhypercube= Red4DTesseract();\n\n//--loop\nw.draw{\n theta= theta+speed;\n hypercube.rotation= RedVector[theta, 0, 0, 0, 0, theta];\n hypercube.update;\n\n //--render\n hypercube.render(2, 500); //1= exaggerate, 2= standard\n Pen.translate(width*0.5, height*0.5);\n Pen.fillColor= Color.white;\n hypercube.draw;\n Pen.strokeColor= Color.white;\n hypercube.drawOutlines;\n};\nw.play;\nCmdPeriod.doOnce({w.close});\n)\n```"}, {"role": "assistant", "content": "spinning hypercube / tesseract after Shiffman https://codingtrain.github.io/website-archive/CodingChallenges/113-hypercube.html."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\n// FreeVerb - 1x1 ugen\n(\nz = SynthDef(\\src, { |out, mix = 0.25, room = 0.15, damp = 0.5|\n Out.ar(out,\n FreeVerb.ar(\n Decay.ar(Impulse.ar(1), 0.25, LFCub.ar(1200, 0, 0.1)), // mono src\n mix, // mix 0-1\n room, // room 0-1\n damp // damp 0-1 duh\n ) ! 2 // fan out...\n );\n}).play\n);\nz.set(\\room, 0.7)\nz.set(\\mix, 0.4)\nz.set(\\damp, 0.2)\n\nz.free\n\n// it expands as any ugen does\n(\nz = SynthDef\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\n// FreeVerb - 1x1 ugen\n(\nz = SynthDef(\\src, { |out, mix = 0.25, room = 0.15, damp = 0.5|\n Out.ar(out,\n FreeVerb.ar(\n Decay.ar(Impulse.ar(1), 0.25, LFCub.ar(1200, 0, 0.1)), // mono src\n mix, // mix 0-1\n room, // room 0-1\n damp // damp 0-1 duh\n ) ! 2 // fan out...\n );\n}).play\n);\nz.set(\\room, 0.7)\nz.set(\\mix, 0.4)\nz.set(\\damp, 0.2)\n\nz.free\n\n// it expands as any ugen does\n(\nz = SynthDef(\\src, { |out, mix = 0.25, room = 0.15, damp = 0.5|\n Out.ar(out,\n FreeVerb.ar(\n Pan2.ar(\n Decay.ar(Impulse.ar(1), 0.25, LFCub.ar(1200, 0, 0.1)),\n LFNoise1.ar(1).range(-1, 1)\n ),\n mix,\n room,\n damp\n )\n );\n}).play\n);\nz.set(\\room, 0.7)\nz.set(\\mix, 0.4)\nz.set(\\damp, 0.2)\n\nz.free\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Fdef`."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\ns.boot;\nSynthDef(\"gpdef\",\n { |out = 0, freq = 440, sustain = 0.05, amp = 0.1|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain), doneAction: Done.freeSelf) * amp;\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n// fork a thread that plays some sounds\n(\nFdef(\\freq, 440);\nFdef(\\dur, 0.2);\n\nfork {\n loop {\n s.sendMsg(\"/s_new\", \"gpdef\", -1, 1, 1, \\freq, Fdef(\\freq).value);\n Fdef(\\dur).value.wait;\n }\n};\n);\n\n// some modifications\n\nFdef(\\freq, Fdef(\\midinote, 60).midicps);\nFdef(\\midinote, { [67, 64, 65].choose });\nFdef(\\midinote, { [67, 64, 65].choose } + Fdef(\\offset));\nFdef(\\offset, { 4.rand });\nFdef(\\dur, 0.23);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Plotter`."}, {"role": "assistant", "content": "```supercollider\n(\na = { (0..10).scramble.normalize }.dup(2).plot;\na.editMode = true;\na.editFunc = { |...args| args.postln };\n);\n\n// using plotter as a control interface\n(\na = { (0..10).scramble.normalize(300, 400) }.dup.plot;\na.specs = \\freq; a.plotMode = \\bars;\na.editMode = true;\nx = {\n var phase = SinOsc.ar(\\rate.kr(a.value[1]));\n SinOsc.ar(\\freq.kr(a.value[0]), phase).mean * 0.1\n}.play;\na.editFunc = { |plotter, plotIndex, i, val|\n x.setn(\\freq, a.value[0]);\n x.setn(\\rate, a.value[1]);\n};\na.parent.onClose = { x.release };\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pevent`."}, {"role": "assistant", "content": "```supercollider\na = Pbind(\\note, Prand([1, 2, 3], inf)).asStream;\na.next; // returns nil\na = Pevent(Pbind(\\note, Prand([1, 2, 3], inf))).asStream;\na.next; // returns an event\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Synth.head` do?"}, {"role": "assistant", "content": "Create and return a Synth. If `aGroup` is a Group add it at the head of that group. If it is a Server, add it at the head of the default_group of that server. If it is nil, add it at the head of the default_group of the default server. If it is an integer, it is created relative to a group with that"}]} -{"conversations": [{"role": "user", "content": "What does `UScore.stop` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: releaseTime — (describe argument here); changed — (describe argument here). Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "What does `Integer.modSeaside` do?"}, {"role": "assistant", "content": "Pre-3.14 modulo with unexpected behavior for negative integer modulus. For dividends smaller than a negative divisor, modSeaside pulls the resulting remainder below the divisor. It thereby leaves zero as peaks on the zero line. Like in the usual mod, all larger dividends result in remainders above zero."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\"help-GaussTrig\", { arg out=0;\n Out.ar(out,\n Ringz.ar(\n WhiteNoise.ar(\n Decay.kr(\n GaussTrig.kr(10.dup, MouseX.kr(0, 0.9), 0.5),\n 0.02,\n 0.2\n )\n ),\n 2000,\n 0.02\n ).fold2(0.2)\n )\n}).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\"help-GaussTrig\", { arg out=0;\n Out.ar(out,\n Ringz.ar(\n WhiteNoise.ar(\n Decay.kr(\n GaussTrig.kr(10.dup, MouseX.kr(0, 0.9), 0.5),\n 0.02,\n 0.2\n )\n ),\n 2000,\n 0.02\n ).fold2(0.2)\n )\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Color.fromArray` do? What arguments does it take?"}, {"role": "assistant", "content": "Same as Arguments: array — An instance of Array. 1-4 values between 0 and 1. See #*new.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nDelayN.ar(z, 0.2, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\n(\n// recursive application of delay.\n{\nz = Decay2.ar(Dust.ar(1, 0.5), 0.01, 0.1, Saw.ar(100 + [0, 1]));\n5.do { |i| z = DelayN.ar(RLPF.ar(z, Rand(100, 3000), 0.03), 1, 1 / (2**i), 1, z * 0.5) };\nz\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nDelayN.ar(z, 0.2, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\n(\n// recursive application of delay.\n{\nz = Decay2.ar(Dust.ar(1, 0.5), 0.01, 0.1, Saw.ar(100 + [0, 1]));\n5.do { |i| z = DelayN.ar(RLPF.ar(z, Rand(100, 3000), 0.03), 1, 1 / (2**i), 1, z * 0.5) };\nz\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Do is not ¨returning¨ array (campanology)?"}, {"role": "assistant", "content": "SuperCollider forum — Do is not ̈returning ̈ array (campanology)\n\nYou can remove the need for all mutable variables by computing the indexes to swap first - these are stored in indexesEven and indexesOdd.\n\nThen an array of functions is made (swappers)...i.e.[indexesEven, indexesOdd, indexesEven....]\n\nFinally, .inject is used to chain these together, taking the previous result as the input to the next and building an array.\n\n```supercollider\n(\n~swap_sort_steps = {\n |parts|\n var swapConsequtiveIndexes = {|from, to|\n (from..to).clump(2).collect{|p| p.reverse }.flat\n };\n var indexesEven = swapConsequtiveIndexes.(0, parts - 1);\n var indexesOdd = [0] ++ swapConsequtiveIndexes.(1, parts - 1);\n var swappers = parts.collect{ |n|\n {|toSwap| if(n.even)\n { indexesEven.collect{|i| toSwap[i]} }\n { indexesOdd.collect{|i| toSwap[i]} }\n }\n };\n postf(\"indexesEven : %\\nindexesOdd : %\\n\", indexesEven, indexesOdd);\n swappers.inject( [(0..parts-1)], {\n |col, f|\n col ++ [f.(col.last)]\n });\n};\n)\n```\n\nAlso, as I’m sure you know, if anyone else is reading who doesn’t know what this is... its a swap sort algorithm."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// linexp\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(mod.linexp(-1, 1, MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1))) * 0.1\n}.play;\n);\n\n// exprange\n(\n{\n var mod = LFNoise2.ar(80).exprange(MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1));\n SinOsc.ar(mod) * 0.1\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// linexp\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(mod.linexp(-1, 1, MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1))) * 0.1\n}.play;\n);\n\n// exprange\n(\n{\n var mod = LFNoise2.ar(80).exprange(MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1));\n SinOsc.ar(mod) * 0.1\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for short piece which plays random major music."}, {"role": "assistant", "content": "```supercollider\np = ProxySpace.push(s.boot);\n~a.play.quant_(4); ~b.play.quant_(4);\n~c = { LFNoise1.kr(8).range(0,15).round };\n~a = Pbind(\\degree, Pstutter(4, Pseq([0,2,3,4], inf)), \\octave, [3,4], \\dur, 0.25, \\amp, 0.3);\n~b = Pbind(\\octave, 4, \\scale, Scale.majorPentatonic, \\degree, ~c, \\dur, 1/4, \\legato, 0.5);\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Snow (a SuperCollider snippet)?"}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\snow, { arg freq=200, pan=0, amp=0.1, speed=1;\n var sig;\n var size = 20;\n var trig = Impulse.ar({ rrand(1/1,15.0) } ! size * \\density.kr(1));\n sig = { WhiteNoise.ar } ! size;\n sig = sig.collect({ arg sig, x;\n var bpfreq = exprand(50.0,16000) * \\tone.kr(1);\n var bpfrq = 0.1 * SinOsc.ar(( x+1 ) * 1/153 * speed).exprange(0.1,4) * \\blur.kr(1);\n sig = BPF.ar(sig, bpfreq, bpfrq) * 34;\n sig = BPF.ar(sig, bpfreq, bpfrq) * 4;\n sig = sig * EnvGen.ar(Env([0,1,0],[0.1,0.8]), trig[x]);\n //sig = sig.fold2( LFNoise0.kr(1/23 * ( x+1 ) * speed).range(0.01,8) ) * 4;\n sig = sig * SinOsc.ar(1/700 * ( x+1 ) * speed).range(0.01,1);\n });\n sig = Pan2.ar(sig, ( { rrand(-1.0,1) } ! size * SinOsc.ar(1/132 * (1..size) * speed).range(0,1) ), amp).mean;\n}).play;\n);\nNdef(\\snow).fadeTime = 16;\nNdef(\\snow).edit;\n```"}]} -{"conversations": [{"role": "user", "content": "I edited a SynthDef and the running sound did not change."}, {"role": "assistant", "content": "Redefining a SynthDef only affects Synths created after the new definition reaches the server; existing instances keep the graph they were built with. Free and recreate them: `~s.free; ~s = Synth(\\name)`. In JITLib, Ndef is the tool designed for this — redefining `Ndef(\\name, { ... })` crossfades to the new graph while it plays."}]} +{"conversations": [{"role": "user", "content": "What is `RedVector2D` in SuperCollider?"}, {"role": "assistant", "content": "RedVector2D — a vector with two dimensions This is an optimised version of RedVector. It also adds the #-asPoint method. Category: Red > redUniverse."}]} +{"conversations": [{"role": "user", "content": "What does `SCDoc.parseFilePartial` do? What arguments does it take?"}, {"role": "assistant", "content": "Parse a file without header, for merging of document Arguments: Full path to .ext.schelp file. Returns: An SCDocNode tree"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n‎{h={|f|1-LFTri.ar(f)};l={|s,e|Line.ar(s,e,1200,1,0,2)};FreeVerb.ar(h.(l.(147,5147))*h.(l.(1117,17))*h.(100)*h.([55,55.1])*0.05,0.7,1)}.play\n\n//Explanation of this piece - http://schemawound.com/post/40100438722/11-13-2012-tweet-explained\n```"}, {"role": "assistant", "content": "Explanation of this piece - http://schemawound.com/post/40100438722/11-13-2012-tweet-explained."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `FSinOsc`."}, {"role": "assistant", "content": "```supercollider\n{ FSinOsc.ar(800) * 0.2 }.play;\n\n{ FSinOsc.ar(XLine.kr(200, 4000, 1)) * 0.2 }.play;\n\n// loses amplitude towards the end\n{ FSinOsc.ar(FSinOsc.ar(XLine.kr(4, 401, 8), 0.0, 200, 800)) * 0.2 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for SOUND 1, from orig Influx Example. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n// SOUND 1, from orig Influx Example\n(\n// // // if JITLibExtensions are used, you can make space local:\n// Ndef(\\dog).addSpec(\\intv, [-24, 24]);\n// Ndef(\\dog).addSpec(\\timescale, [0.01, 10, \\exp]);\n// Ndef(\\dog).addSpec(\\curve, [-10, 10]);\n// Ndef(\\dog).addSpec(\\ffreq, \\freq);\n//\n// Ndef(\\dog).addSpec(\\loopnode, [0, 12]);\n// Ndef(\\dog).addSpec(\\dens, [10, 1000, \\exp]);\n// Ndef(\\dog).addSpec(\\resfreq, \\freq);\n// Ndef(\\dog).addSpec(\\ringtime, [0.01, 1, \\exp]);\n\nSpec.add(\\intv, [-24, 24]);\nSpec.add(\\timescale, [0.01, 10, \\exp]);\nSpec.add(\\curve, [-10, 10]);\nSpec.add(\\ffreq, \\freq);\n\nSpec.add(\\loopnode, [0, 12]);\nSpec.add(\\dens, [10, 1000, \\exp]);\nSpec.add(\\resfreq, \\freq);\nSpec.add(\\ringtime, [0.01, 1, \\exp]);\n\n\nNdef(\\dog, { |amp=0, freq=250, intv=19, timescale=1, curve=0, loopnode=0, dens = 10, resfreq = 500, ringtime = 0.01|\n var n = 15;\n var env = EnvGen.kr(\n Env({ 1.0.rand2 }!(n+1), {1.0.rand}!n, curve, releaseNode: n-1, loopNode: loopnode.min(n-3)),\n timeScale: timescale);\n var pitch = (env * [1, 0.33, -1] * intv).midiratio * freq;\n var form = Formant.ar(pitch, pitch.rotate(1) * 1.6, pitch.rotate(2) * 2.6);\n\n var dusty = Ringz.ar(\n Dust.ar(dens!3),\n resfreq * LFNoise0.kr([3, 5, 7], 0.5, 1),\n ringtime)\n * ((dens ** -0.5) * (ringtime ** -0.3)\n );\n\n Splay.ar(form * dusty, level: amp) ;\n});\n);\n\nNdef(\\dog).set(\\amp, 0.2).vol_(0.2);\nNdef(\\dog).gui.moveTo(400, 380);\n\n/*\n// Ndef(\\dog).addHalo(\\orderedNames, Ndef(\\dog).controlKeys);\nNdef(\\dog).controlKeys;\nNdef(\\dog).vol_(0.5);\nNdefPreset( Ndef(\\dog) ).loadSettings;\nNdef(\\dog).play;\nNdef(\\dog).gui;\n*/\n```"}]} {"conversations": [{"role": "user", "content": "How to know the hardware buffer size?"}, {"role": "assistant", "content": "SuperCollider forum — How to know the hardware buffer size\n\nSay you want to use a UGen to control an external hardware device, independently of the soundcard. At first, one would think that this calculation is time-locked to the control rate, so e.g. at 1.5 kHz for a 48 kHz sample rate and a block size of 32.\n\nBut no, of course this calculation is time-locked to the hardware buffer size (I/O buffer size) of the soundcard you happen to use. EDIT: For a typical (low) setting, this is something like 256, so that would be about 190 Hz (5 ms). This may be too much delay for some applications, so we may want a smaller buffer size.\n\nIn scsynth, we can set a value for this size via ServerOptions:\n\n```supercollider\n // reduce to block size\ns.options.hardwareBufferSize = s.options.blockSize;\ns.reboot;\n```\n\nUnfortunately, not all soundcards support low block sizes. Also high quality sound cards may have very large ones, actually – this is a cultural thing, when you use them for recording, it is not a problem. But for live I/O it introduces delay (a quarter second is like an eternity then).\n\nSo now my question: how do I know if the above setting has been actually successful? How do I know what buffer size is current?\n\nI am sure that on different OSes there are ways to derive this in different ways. Maybe there is a way in supercollider as well?"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Those were the times."}, {"role": "assistant", "content": "```supercollider\n(\ns.waitForBoot({\n\n SynthDef(\\singer, {\n | out=0, freq=440, amp=0.5, vibrato=6|\n var lfo, lfo2, lfo3, sig;\n lfo = SinOsc.kr(1/5, 0).range(250,1000);\n lfo2 = SinOsc.kr(1/5, 0).range(0.1,0.9);\n lfo3 = SinOsc.kr(vibrato).range(0.3, 1);\n sig = lfo3*RLPF.ar(in:VarSaw.ar(freq:Lag.ar(in:K2A.ar(freq), lagTime:0.3), iphase:0, width:lfo2, mul:amp), freq:lfo, rq:200/lfo);\n Out.ar(out, sig!2);\n }).add;\n\n s.sync;\n\n Pdef.defaultQuant_(0);\n Pdef(\\bass, Pmono(\\default, \\dur, Pwhite(0.01, 0.1, inf), \\freq, (Pgbrown(1,8,5) * 20).round(10), \\amp, Pbrown(0.2,0.6,0.05)));\n Pdef(\\computer, Pmono(\\default, \\dur, Pwhite(0.01, 0.1, inf), \\freq, (Pgbrown(1,8,9) * 100).round(20), \\amp, Pbrown(0.2,0.6,0.05)));\n Pdef(\\soprano, Pmono(\\singer, \\dur, Pwhite(0.01, 0.1, inf), \\freq, Pgbrown(1,8,0.05) * 200, \\amp, Pbrown(0.2,0.6,0.05)/5, \\vibrato, Pbrown(4,7,0.125)));\n Pdef(\\soprano2, Pmono(\\singer, \\dur, Pwhite(0.01, 0.1, inf), \\freq, Pbrown(3,6,0.1) * 100, \\amp, Pbrown(0.2,0.6,0.05)/5, \\vibrato, Pbrown(3,8,0.125)));\n\n fork {\n Pdef(\\bass).play;\n 10.wait;\n Pdef(\\computer).play;\n 10.wait;\n Pdef(\\soprano).play;\n 10.wait;\n Pdef(\\soprano2).play;\n 10.wait;\n Pdef(\\computer).stop;\n 20.wait;\n Pdef(\\bass).stop;\n 10.wait;\n Pdef(\\soprano).stop;\n Pdef(\\soprano2).stop;\n Pdef(\\bass).play;\n Pdef(\\soprano).play;\n 10.wait;\n Pdef(\\soprano2).play;\n 10.wait;\n Pdef(\\computer).play;\n 20.wait;\n Pdef(\\bass).stop;\n Pdef(\\computer).stop;\n Pdef(\\soprano).stop;\n Pdef(\\soprano2).stop;\n }\n\n});\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `FoaMagA.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "First Order Ambisonic (FOA) Magnitude of Soundfield Complex Admittance Vector Arguments: in — The B-format signal, an array: [w, x, y, z]; size — Analysis filter kernel size.; method — The Soundfield analysis method:."}]} -{"conversations": [{"role": "user", "content": "What does `PatchOut.scalar` do? What arguments does it take?"}, {"role": "assistant", "content": "manages a Player's output when connecting to other Players Arguments: source; group; bus."}]} -{"conversations": [{"role": "user", "content": "What does `RedTest.speaker` do? What arguments does it take?"}, {"role": "assistant", "content": "Pink noise speaker Arguments: channels — Should be an array of output channel indices.; amp — used to scale amplitude; dur — used to change duration between notes."}]} -{"conversations": [{"role": "user", "content": "What is `PlaneTree` in SuperCollider?"}, {"role": "assistant", "content": "PlaneTree — Tree classifier using (hyper)planes – UGen or language-side // Server-side (for use in synths): Category: UGens."}]} -{"conversations": [{"role": "user", "content": "What does `PlayerSocket.env` do?"}, {"role": "assistant", "content": "a player that can play other players using a cross-faded and fuse-protected socket"}]} -{"conversations": [{"role": "user", "content": "What is `BusSpec` in SuperCollider?"}, {"role": "assistant", "content": "BusSpec — datatype specifying a Bus object Category: Spec, Libraries > crucial > Spec."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Using sine waves to generate a saw waveform."}, {"role": "assistant", "content": "```supercollider\nq={|f,e|a=Array.fill(e,{|j|e-j}).reverse;(Mix.ar(a.collect{|x|SinOsc.ar(f*x,0,1/x)})/2)!2};{q.(60,300)}.play //saw from sine #supercollider\n\n//Change the values passed to q to control the frequency and how many sines are used.\n```"}]} -{"conversations": [{"role": "user", "content": "What does `View.mouseDown` do?"}, {"role": "assistant", "content": "Handles response to a mouse button press event. Evaluates #-mouseDownAction. See #Mouse actions for explanation of"}]} -{"conversations": [{"role": "user", "content": "I get 'index out of range' when playing a buffer."}, {"role": "assistant", "content": "A read position is past the end of the buffer. `PlayBuf` with a `startPos` in frames beyond `~buf.numFrames`, or a `BufRd`/`GrainBuf` whose phase goes above 1, produces this. For GrainBuf, pos is normalised 0..1, so pass `LFNoise1.kr(1).range(0, 1)` rather than a frame count; for PlayBuf, cap the position at `~buf.numFrames - 1`. If you just loaded the file, check `~buf.numFrames` — a failed read gives 0 frames and every position is out of range."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// associations can be a good way to store named data in order:\n(\na = [\\x -> 700, \\y -> 200, \\z -> 900];\n\nfork {\n a.do { |assoc|\n assoc.key.postln;\n assoc.value.postln;\n (freq: assoc.value).play;\n 2.wait;\n }\n};\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// associations can be a good way to store named data in order:\n(\na = [\\x -> 700, \\y -> 200, \\z -> 900];\n\nfork {\n a.do { |assoc|\n assoc.key.postln;\n assoc.value.postln;\n (freq: assoc.value).play;\n 2.wait;\n }\n};\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes 8-bit synth (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"AM2\", { arg freq = 440, modfreq = 12, amp = 0.5, attack = 0.01, dur = 1, pos = 0;\n var carrier, modulator, env;\n modulator = LFSaw.kr(modfreq).range(0, 1);\n carrier = LFSaw.ar(freq: freq, mul: modulator);\n env = Env.perc(attackTime: attack, releaseTime: dur - attack, level: amp).kr(2);\n carrier = carrier * env;\n Out.ar(0, Pan2.ar(carrier, pos))\n}).add;\n);\n\n//Example Melody\n\n(\na=Pbind(\n\\instrument, \"AM2\",\n\\degree, Pseq([0,1,2,3,4,5,6,7,6,5,4,3,2,1],inf),\n\\amp, 0.70,\n\\dur, 0.125,\n\\modfreq, 12, // add different values\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `StandardL`."}, {"role": "assistant", "content": "```supercollider\n// vary frequency\n{ StandardL.ar(MouseX.kr(20, SampleRate.ir)) * 0.3 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `ApplicationStart` in SuperCollider briefly."}, {"role": "assistant", "content": "ApplicationStart — register functions to be evaluated on Application start Available in macOS SuperCollider.app only. Category: Control, Platform > macOS."}]} -{"conversations": [{"role": "user", "content": "What does Splay.ar do?"}, {"role": "assistant", "content": "`Splay.ar(inArray, spread, level, center, levelComp)` takes an array of mono signals and distributes them across the stereo field, so `Splay.ar(SinOsc.ar([220, 330, 440]) * 0.1)` is a three-source stereo chord rather than three separate synths. spread (0..1) controls how far the voices fan out and center shifts the middle. It is the shorthand for 'make this array stereo'."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for muffled thump?"}, {"role": "assistant", "content": "```supercollider\n(\n{ var nse, env, kic;\n kic = tanh(Ringz.ar(LPF.ar(Trig.ar(Impulse.ar(1.0),SampleDur.ir),1000),30,0.25,7).sin*2);\n env = Env.perc(0.05, 1, 1, -4);\n nse = BrownNoise.ar(2) + PinkNoise.ar(0.5) * EnvGen.kr(env,Impulse.kr(1), doneAction: 2);\n\n nse = Mix.ar(BPF.ar(nse,[100,1200,80,40,20],MouseX.kr(0,1),[1,0.2,1,1,1]));\n nse = LPF.ar(nse + kic, MouseY.kr(100,1000))! 2\n\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\nx = {\nvar son = SinOsc.ar(mul: SinOsc.ar(0.3).range(0,1) * Line.ar(0, 1, 20, doneAction: 2));\nTextVU.ar(2, son, \"Sin\");\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\nx = {\nvar son = SinOsc.ar(mul: SinOsc.ar(0.3).range(0,1) * Line.ar(0, 1, 20, doneAction: 2));\nTextVU.ar(2, son, \"Sin\");\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `IEnvGen` in SuperCollider?"}, {"role": "assistant", "content": "IEnvGen — Envelope generator for polling values from an Env Envelope generator for polling values from an envelope. IEnvGen plays back break point envelopes from the `index` point. The envelopes are instances of the Env class. Category: UGens > Envelopes."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nd = SynthDef(\"help-NodeControl\", { |out = 0, freq = 400|\n Out.ar(out,\n SinOsc.ar(freq, 0, 0.5)\n )\n});\ny = d.play; // the synth\n\nc = NodeControl(y, 1;\n\nc.value = 500;\n\nc.value = 300;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nd = SynthDef(\"help-NodeControl\", { |out = 0, freq = 400|\n Out.ar(out,\n SinOsc.ar(freq, 0, 0.5)\n )\n});\ny = d.play; // the synth\n\nc = NodeControl(y, 1);\n\nc.value = 500;\n\nc.value = 300;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Synth.grain` do?"}, {"role": "assistant", "content": "A convenience method which will create a synth node with an node ID of -1. Such a node cannot be messaged after creation. As such this method does not create an object, and returns nil. For details of its arguments see `new` Returns: nil"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nb = SoundFile.collectIntoBuffers(\"yourSoundFileFolder/*\"); // By Bjørn Houdorf, December 21, 2012\n\n(\n{\nvar number = b.numChannels, randomNumber, trigger, delayed, panned, sound, mixedSound, rotatedSound;\ntrigger = Dust.kr(Array.fill(number,1), 1, -0.5); // Generates random impulses from -0.5 to 0.5. as a excitation function\nrandomNumber = TRand.kr(1, number, trigger);\nsound = PlayBuf.ar(Array.fill(number,1) ,randomNumber,1,trigger,0,0); // play sound files\ndelayed = DelayL.ar(sound, trigger, trigger); // delaying the sound files\npanned = Pan2.ar(delayed, Array.fill(number,{1.0.rand2})); // pan them out in the stereo field\nmixedSound = 0.05*Mix.new(panned);// and mix them to one stereo signal\nrotatedSound = Rotate2.ar(mixedSound[0], mixedSound[1], LFSaw.kr(0.05)); // rotate stereo signal\n}.play; // play it all\n)\n```"}, {"role": "assistant", "content": "Put your sound files in the sound file folder. The code plays random sound files panned out in the stereo field. A swarm of sound files."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Event` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\pm, { |out = 0, freq = 440, amp = 0.1, pan = 0, gate = 1, ratio = 1, index = 1, ar = 0.1, dr = 0.1|\n var z;\n z = LPF.ar(\n PMOsc.ar(freq, freq * ratio, Linen.kr(gate, ar, index, dr), 0, 0.3),\n XLine.kr(Rand(4000, 5000), Rand(2500, 3200), 1)\n ) * Linen.kr(gate, 0.01, 0.7, dr, 2);\n OffsetOut.ar(out, Pan2.ar(z, pan, amp));\n}).add;\n);\n\n(instrument: \\pm).play;\n\n(instrument: \\pm, ratio: 3.42, index: 12, freq: 150, ar: 8, dr: 3, sustain: 10).play;\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Pulse`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\\harpsi, { |outbus = 0, freq = 440, amp = 0.1, gate = 1|\n var out;\n out = EnvGen.ar(Env.adsr, gate, doneAction: Done.freeSelf) * amp *\n Pulse.ar(freq, 0.25, 0.75);\n Out.ar(outbus, out ! 2);\n}).add; // see below for more on .add\n\np = Pbind(\n // Use \\harpsi, not \\default\n \\instrument, \\harpsi,\n \\degree, Pseries(0, 1, 8),\n \\dur, 0.25\n).play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `EnvGen` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// as amplitude envelope\n(\n{\n var env = Env([0, 1, 0.5, 1, 0], [0.01, 0.5, 0.02, 0.5]);\n SinOsc.ar(470) * EnvGen.kr(env, doneAction: Done.freeSelf)\n}.play\n);\n\n// as amplitude and modulation envelope\n(\n{\n var env = Env([0, 1, 0.5, 0.8, 0, 1.2, 0], [0.01, 0.5, 0.02, 0.5, 0.2, 0.5]);\n var gate = Impulse.kr(MouseX.kr(0.2, 3), 0.5);\n var gen = EnvGen.kr(env, gate);\n SinOsc.ar(270, SinOsc.ar(gen * 473)) * gen * 0.2\n}.play\n);\n// EnvGen multichannel expands when passed a multichannel envelope\n(\n{\n SinOsc.ar(\n EnvGen.kr(\n Env.circle([0, 1, 0, (2..4), 0, LFNoise1.kr(0.1 ! 5) * 10, 0], [0.01, 0.6])\n )\n * 240 + 300\n ).sum * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `RandID` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// start a noise patch and set the id of the generator\n(\nSynthDef(\"help-RandID\", { |out = 0, id = 1|\n RandID.ir(id);\n Out.ar(out,\n WhiteNoise.ar(0.05) + Dust2.ar(70)\n )\n}).add;\n);\n\n// reset the seed of my rgen at a variable rate\n(\nSynthDef(\"help-RandSeed\", { |seed = 1910, id = 1|\n RandID.kr(id);\n RandSeed.kr(Impulse.kr(FSinOsc.kr(0.2, 0, 10, 11)), seed);\n}).add;\n\n);\n\n// start two noise synths on left and right channel with a different randgen id\na = Synth(\"help-RandID\", [\\out, 0, \\id, 1]);\nb = Synth(\"help-RandID\", [\\out, 1, \\id, 2]);\n\n// reset the seed of randgen 1\nx = Synth(\"help-RandSeed\", [\\id, 1]);\n\n// change the target randgen to 2 (affects right channel)\nx.set(\\id, 2);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nx = {\n // A collection of different tones:\n var son = SinOsc.ar((100, 100.3 .. 110));\n var val = ArrayMin.ar(son).at(0);\n val = LeakDC.ar(val); // the operation tends to induce DC offset\n Pan2.ar(val)\n}.play\n;\nx.free\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nx = {\n // A collection of different tones:\n var son = SinOsc.ar((100, 100.3 .. 110));\n var val = ArrayMin.ar(son).at(0);\n val = LeakDC.ar(val); // the operation tends to induce DC offset\n Pan2.ar(val)\n}.play\n);\nx.free\n```"}]} +{"conversations": [{"role": "user", "content": "What are the arguments of GrainBuf.ar?"}, {"role": "assistant", "content": "`GrainBuf.ar(numChannels, trigger, dur, sndbuf, rate, pos, interp, pan, envbufnum, maxGrains, mul, add)`. The ones you always pass are numChannels (1 or 2), trigger (a UGen that fires grains, e.g. Impulse.kr(20)), dur (grain length in seconds), sndbuf (an integer buffer number, or `~buf`), rate (playback rate per grain), and pos (read position 0..1 into the buffer). Raise maxGrains if the server complains about too many grains rather than lowering density."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n//code that utilizes the glitch.\n//warning! extremely loud.\n//note: might not sound the same on all soundcards\n(\n{GlitchRHPF.ar(\n BrownNoise.ar(1.dup),\n 0.5,\n Saw.kr(1, 10)\n)}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n//code that utilizes the glitch.\n//warning! extremely loud.\n//note: might not sound the same on all soundcards\n(\n{GlitchRHPF.ar(\n BrownNoise.ar(1.dup),\n 0.5,\n Saw.kr(1, 10)\n)}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Instr.spawnEvent` do? What arguments does it take?"}, {"role": "assistant", "content": "sets the Event 'type' = 'instr' and 'instr' = this and then .plays the Arguments: event."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nNdef(\\bitshift, {\n var t = PulseCount.ar(Impulse.ar(8e3));\n var sig = HPF.ar(\n ( \n ((t * 15) & (t >> 5)) |\n ((t * 5) & (t >> [3, 4])) |\n ((t * 2) & (t >> 9)) |\n ((t * 8) & (t >> 11))\n - 3 % 256\n ) / 127-1 * 3\n , 20\n ).distort * 0.2; \n sig = Greyhole.ar(sig, sig, 0.5, sig).flop.mean/4;\n}).play;\n)\n```"}, {"role": "assistant", "content": "Not very original since I copied the bit code from http://schemawound.com/post/58980873930/bitwise and added a greyhole. But it sound so amazing I want to share it =)."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Warp1`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\nb.free;\nb = Buffer.read(s, ExampleFiles.apollo11);\n{\n var pointer = Phasor.ar(0, SampleDur.ir / BufDur.ir(b) * XLine.kr(1, 0.25, 20));\n var sound = Warp1.ar(1, b, pointer, 1, 0.3, -1, 16, Line.kr(0, 1, 40), 4);\n Pan2.ar(sound, pointer * 2 - 1, 0.25)\n}.play\n);\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Compander` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var z;\n\n // signal (clean)\n z = Decay2.ar(\n Impulse.ar(8, 0, LFSaw.kr(0.3, 1, -0.3, 0.3)),\n 0.001,\n 0.3\n )\n * Mix.ar(Pulse.ar([80, 81], 0.3));\n\n // apply gate (mouse x sets treshold)\n Compander.ar(z, z,\n thresh: MouseX.kr(0.001, 1),\n slopeBelow: 10,\n slopeAbove: 1,\n clampTime: 0.01,\n relaxTime: 0.01\n )\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ LPF.ar(Saw.ar(100), SinOsc.kr(0.5).exprange(200, 2000)) * 0.2 }.play;\n```"}, {"role": "assistant", "content": "A sawtooth through a low-pass filter whose cutoff is swept slowly up and down — a classic filter\nsweep.\n\n- `Saw.ar(100)` is a 100 Hz sawtooth, rich in harmonics.\n- `SinOsc.kr(0.5)` is a control-rate sine at 0.5 Hz, so one full cycle takes 2 seconds.\n- `.exprange(200, 2000)` maps that -1..1 sine exponentially onto 200..2000 Hz — exponential is the right\n mapping for frequency, because we hear pitch logarithmically.\n- `LPF.ar(sig, cutoff)` removes harmonics above the cutoff; as it opens and closes you hear the tone\n brighten and darken.\n- `* 0.2` keeps the output from clipping."}]} +{"conversations": [{"role": "user", "content": "Synth Iteration Help?"}, {"role": "assistant", "content": "SuperCollider forum — Synth Iteration Help\n\n```supercollider\n(\nSynthDef (\\sine_tone) {\narg freq = 440, amp = 1, len = 1, bus = 0;\nvar sig, env;\nenv = Env.step ([ amp ], [ len ]);\nenv = EnvGen.kr (env, doneAction: 2);\nsig = SinOsc.ar (freq, 0, env);\nOut.ar (bus % 2, sig); // bus modulo 2 here to wrap to stereo\n}.add;\n)\n```\n\nmaybe try wrapping the bus array to [ 0, 1 ] by using modulo: bus % 2. this should let you hear what is going on using a stereo output\n\nby using a Pbind, each “note” is being instantiated as a separate synth with its own length, amplitude, frequency and bus. the doneAction: 2 argument in the EnvGen.kr ugen just means each synth will free itself once it is done playing the note it has been assigned."}]} +{"conversations": [{"role": "user", "content": "What does `MKtl.elementGroup` do?"}, {"role": "assistant", "content": "All the control elements (MKtlElement) on the device you may want to listen or talk to. this returns an MKtlElementGroup containing a hierarchical tree of MKtlElements, organised via MKtlElementGroup. (elements is a deprecated alias of elementGroup)."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Ndef`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\nNdef(\\a).play; // play to hardware output.\nNdef(\\a).fadeTime = 2; // fadeTime specifies crossfade\n// set the source\nNdef(\\a, { SinOsc.ar([350, 351.3], 0, 0.2) });\nNdef(\\a, { Pulse.ar([350, 351.3] / 4, 0.4, 0.2) });\nNdef(\\a, Pbind(\\dur, 0.03, \\freq, Pbrown(0, 1, 0.1, inf).linexp(0, 1, 200, 350)));\n\nNdef(\\a, { Ringz.ar(Ndef.ar(\\b), [350, 351.3] * 2, 0.4) });\nNdef(\\b, { Impulse.ar([5, 7]/2, [0, 0.5], 0.15) });\n\nNdef.clear(3); // clear all after 3 seconds\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Mix`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var n;\n n = 8; // number of 'voices'\n Mix.new( // mix all stereo pairs down.\n Pan2.ar( // pan the voice to a stereo position\n CombL.ar( // a comb filter used as a string resonator\n Dust.ar( // random impulses as an excitation function\n // an array to cause expansion of Dust to n channels\n // 1 means one impulse per second on average\n Array.fill(n, 1),\n 0.3 // amplitude\n ),\n 0.01, // max delay time in seconds\n // array of different random lengths for each 'string'\n Array.fill(n, {0.004.rand+0.0003}),\n 4 // decay time in seconds\n ),\n Array.fill(n,{1.0.rand2}) // give each voice a different pan position\n )\n )\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a granular texture in SuperCollider."}, {"role": "assistant", "content": "Read a sound file into a buffer, then trigger grains from it. Grain density is the Impulse rate and\ngrain length is dur; keep the density times the length under maxGrains or raise it.\n\n```supercollider\n(\ns.waitForBoot {\n ~buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n SynthDef(\\grain, { |out = 0, amp = 0.4, density = 30, dur = 0.08|\n var trig = Impulse.kr(density);\n var sig = GrainBuf.ar(2, trig, dur, ~buf, 1, LFNoise0.kr(2).range(0, 1), 2, 0, -1, 512);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n Synth(\\grain);\n};\n)\n```"}]} +{"conversations": [{"role": "user", "content": "In what order should I learn SuperCollider?"}, {"role": "assistant", "content": "The order that pays off fastest:\n\n1. **One UGen and Out** — `{ SinOsc.ar(440) * 0.2 }.play`. Learn that a graph must reach Out.\n2. **Envelopes and doneAction** — the difference between a sound and a click.\n3. **SynthDef and Synth** — naming a graph, controlling it with arguments, freeing it with a gate.\n4. **Patterns** — `Pbind` for sequence, so you stop writing loops by hand.\n5. **Buses and effects** — chaining, sends, groups.\n6. **JITLib** — Ndef for patches you modify while they play.\n\nVocabulary to carry: UGen, SynthDef, Synth, bus, group, envelope, gate, doneAction, Pattern, clock. Every\nconfusion in SuperCollider tends to be one of those words."}]} +{"conversations": [{"role": "user", "content": "How do I pan notes around the stereo field in a pattern?"}, {"role": "assistant", "content": "Put `\\pan` in the Pbind: the default instrument understands it and passes it to Pan2.\n\n```supercollider\n(\nPbind(\n \\scale, Scale.minorPentatonic,\n \\degree, Pseq([0, 2, 4, 7, 9, 7, 4, 2], inf),\n \\dur, 0.2,\n \\pan, Pseq([-1, -0.5, 0, 0.5, 1, 0.5, 0, -0.5], inf),\n \\amp, 0.15\n).play;\n)\n```\n\nTo pan an arbitrary synth, add a `pan = 0` argument to the SynthDef and wrap the output in\n`Pan2.ar(sig, pan)`."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `StandardL`."}, {"role": "assistant", "content": "```supercollider\n// mouse-controlled param\n{ StandardL.ar(SampleRate.ir/2, MouseX.kr(0.9, 4)) * 0.3 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LinCongC`."}, {"role": "assistant", "content": "```supercollider\n// randomly modulate params\n(\n{ LinCongC.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(0.1, 0.5, 1.4),\n LFNoise2.kr(0.1, 0.1, 0.1),\n LFNoise2.kr(0.1)\n) * 0.2 }.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `ProxySpace`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\np = ProxySpace.new;\np.fadeTime = 2; // fadeTime specifies crossfade\np[\\out].play; // monitor an empty placeholder through hardware output\n// set its source\np[\\out] = { SinOsc.ar([350, 351.3], 0, 0.2) };\np[\\out] = { Pulse.ar([350, 351.3] / 4, 0.4) * 0.2 };\np[\\out] = Pbind(\\dur, 0.03, \\freq, Pbrown(0, 1, 0.1, inf).linexp(0, 1, 200, 350));\n\n// route one proxy through another:\np[\\out] = { Ringz.ar(p[\\in].ar, [350, 351.3] * 8, 0.2) * 4 };\np[\\in] = { Impulse.ar([5, 7]/2, [0, 0.5]) };\n\np.clear(3); // clear after 3 seconds\n```"}]} +{"conversations": [{"role": "user", "content": "Why does every UGen have mul and add arguments?"}, {"role": "assistant", "content": "They are a convenience applied to the UGen's output: the result is `ugens_result * mul + add`. So `SinOsc.ar(440, 0, 0.2)` is the same as `SinOsc.ar(440) * 0.2`, and `SinOsc.ar(440, 0, 0.5, 1800)` is usable directly as a frequency. They exist because multiplying and offsetting is so common that folding it into the UGen saves a node in the graph and a line in the source."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// try wiggling mouse quickly;\n// LFNoise frequently seems stuck, LFDNoise changes smoothly.\n\n{ SinOsc.ar(LFNoise1.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n{ SinOsc.ar(LFDNoise1.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFNoise1.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n\n{ LFDNoise1.ar(XLine.kr(2000, 20000, 8), 0.1 }.scope;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// try wiggling mouse quickly;\n// LFNoise frequently seems stuck, LFDNoise changes smoothly.\n\n{ SinOsc.ar(LFNoise1.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n{ SinOsc.ar(LFDNoise1.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFNoise1.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n\n{ LFDNoise1.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Char` in SuperCollider?"}, {"role": "assistant", "content": "Char — ASCII character A Char is a signed 8-bit integer (-128 to 127) that is used to represent that bytes inside a String. You can also make a Char with an ASCII literal by prefixing an ASCII character with a dollar symbol: code:$x:. These ASCII values are in the range 0-127. Some special characters can be expressed as literals using escape sequences (for example, `$\\n` for newline). See Literals#Characters for more in Category: Core."}]} +{"conversations": [{"role": "user", "content": "What is `PlayBuf` in SuperCollider?"}, {"role": "assistant", "content": "PlayBuf — Sample playback oscillator. Plays back a sample resident in memory. Category: UGens > Buffer."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `WhiteNoise`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-WhiteNoise\", { |out = 0|\n Out.ar(out,\n WhiteNoise.ar(0.25)\n )\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `HLayoutView` in SuperCollider briefly."}, {"role": "assistant", "content": "HLayoutView — A container view that arranges its children horizontally Category: GUI > Views."}]} {"conversations": [{"role": "user", "content": "What can you do?"}, {"role": "assistant", "content": "Write and explain SuperCollider: SynthDefs, UGens, Patterns, Ndef, buses and envelopes, and tell you why a patch is silent or will not compile. I am 198M parameters, so I am narrow on purpose."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes random 303."}, {"role": "assistant", "content": "```supercollider\n(\n{ var lk = [0,3,7,9], jx = [3,4,2,4,2], n, ox = 10, qw, cx, oi,z,w, faz, mp,\n cs = [Select,Stepper,RLPF,LFTri,Pulse,PulseDivider,Lag2,Lag,EnvGen,\n Saw, LPF, PitchShift, AllpassN, Env, LocalIn, LocalOut, Impulse ];\n var fa,ffa, ra, eca, era, fsa, xc, fxc, rq, ec, er,xcs, o,e;\n mp = {… |n,alk| alk = alk ? lk; \n {midicps(jx .choose * 12 + lk.choose) } !n }; \n faz = [ mp.(3)* 2.midiratio, mp.( 3 )\n *1. midiratio, mp.( 2,[ 0,3,9 ])*5.midiratio,mp.(1 )*1.midiratio ]; \n fa = faz[[3,0,3,1,2,2,2,2, 1,1,1,1,0,3]].flat; \n n = fa.size; \n qw = Impulse.kr(10); \n cx = PulseDivider.kr(qw, n); \n oi = Stepper.kr(qw,0,0,n-1); \n fsa = { [0,0,0, 0.02,0.08,0.1 ].choose }!div(n,4); \n xcs = Select.kr( Stepper.kr( qw,0,0,fsa.size-1 ), fsa); \n xc = Lag2.kr( Select.kr(oi, fa), xcs ); \n ffa = { rrand( 20, 90 ) } ! n;\n ffa.size.do({ |i| var pn = [2,4,8].choose;\n if ( 0.2.coin, { ffa[i] = Select.kr(Stepper.kr(cx, 0,0,pn-1), { rrand( 4, 70 ) } ! n) }) });\n fxc = Lag2.kr( Select.kr(oi, ffa), 0.04);\n ra = { rrand(0.05,0.5) } ! n;\n rq = Lag.kr( cs[0].kr(oi, ra), 0.04);\n eca = { [-4,0,-1].choose } ! n;\n ec = Select.kr(oi,eca);\n o = Saw.ar(xc) + Pulse.ar(xc * 0.01.midiratio,1-rq) + Pulse.ar(xc *0.04.midiratio,LFTri.ar(ox/n).range(0.1,0.9),0.02) + Pulse.ar(xc *\n 24.midiratio,LFTri.ar(ox/n/4).range(0.8,0.01),0.05);\n era = { rrand(0.8,0.4) } ! 4;\n er = Select.kr(cs[1].kr(qw, 0,0,3), era);\n e = Env.new([0,1,0],[xcs/5,er],ec);\n e = EnvGen.kr(e, gate:qw);\n fxc = fxc * [1.02, 0.98];\n xc = xc * [0.8,1.2].scramble;\n z = cs[2].ar(o, (fxc * e).midiratio * xc, rq) + (cs[2].ar(o.neg, fxc * (50 * e)\n .midiratio, 0.4) *0.05) + (cs[2].ar(o.neg, fxc * (65 * e).midiratio, rq/2) *0.01) * e;\n z = (z + (cs[11].ar(z,0.001,0.5,0.1,0.1).distort * 0.5)).distort;\n w = z+ cs[14].ar (2). distort;\n 10.do({ w = cs[12].ar(w,0.4,{0.03.rand}!2,{0.06.rand}!2) });\n cs[15].ar(cs[10].ar( w*0.9,800 )); (w *0.1 ) + (z * 0.7) }.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Harmonics`."}, {"role": "assistant", "content": "```supercollider\na.ramp(1.0, 1.0); // returns a harmonic series\n\nb = Buffer.alloc(s, 512, 1);\n// harmonic series for freqs, ramp down for amps\nb.sine2(a.ramp(1.0, 1.0).postln, a.ramp(0.5, -0.025).postln, true, true, true);\n(\nz = SynthDef(\"help-Osc\", { |out = 0, bufnum = 0|\n Out.ar(out,\n Osc.ar(bufnum, 200, 0, 0.5)\n )\n});\n);\ny = z.play(s, [\\out, 0, \\bufnum, b]);\ny.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n//try passing a signal through the hair cell; it won't come out like a pure sine, more like an impulse train stimulated by that input\n{ Pan2.ar(HairCell.ar(SinOsc.ar(440)),0.0) }.play;\n\n//modulation effects\n{ Pan2.ar(HairCell.ar(Saw.ar(MouseX.kr(1,1000)),0.0,MouseY.kr(0.0,1000.0)),0.0) }.play;\n\n//constantly self oscillates at 5 Hz, talk through it to modulate from base rate... \n{ Pan2.ar(HairCell.ar(SoundIn.ar,5.0,100),0.0) }.play;\n\n//sweeps and beeps\n{ Pan2.ar(HairCell.ar(Saw\n// …\n```"}, {"role": "assistant", "content": "try passing a signal through the hair cell; it won't come out like a pure sine, more like an impulse train stimulated by that input constantly self oscillates at 5 Hz, talk through it to modulate from base rate... (HairCell: Simple cochlear hair cell model)"}]} -{"conversations": [{"role": "user", "content": "What does `CytonWifi.close` do?"}, {"role": "assistant", "content": "stops main loop and free the internal osc"}]} -{"conversations": [{"role": "user", "content": "What does `PLbindefPar.remove` do?"}, {"role": "assistant", "content": "Removes not only the PLbindefPar but also associated PLbindefs from global"}]} -{"conversations": [{"role": "user", "content": "Explain `MIDIFuncChanMessageMatcher` in SuperCollider briefly."}, {"role": "assistant", "content": "MIDIFuncChanMessageMatcher — Matches incoming MIDI messages to responder funcs based on message channel This is used by MIDIMessageDispatcher to match incoming MIDI messages to instances of MIDIFunc or MIDIdef using MIDI channel. This class is private, and generally users should not need to address instances directly. Category: External Control > MIDI > Matchers."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// default params\n{ QuadN.ar(SampleRate.ir/4) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// default params\n{ QuadN.ar(SampleRate.ir/4) * 0.2 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `InFeedback`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-InFeedback\", { |out = 0, in = 0|\n var input, sound;\n input = InFeedback.ar(in, 1);\n sound = SinOsc.ar(input * 1300 + 300, 0, 0.4);\n Out.ar(out, sound);\n\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is SuperCollider?"}, {"role": "assistant", "content": "SuperCollider is a platform for audio synthesis and algorithmic composition, written in C++ and SuperCollider. It splits into a language client (sclang) that runs your code and builds UGen graphs, and an audio server (scsynth) that does the DSP in real time. They talk over OSC."}]} -{"conversations": [{"role": "user", "content": "What does `EnvelopeView.drawLines` do? What arguments does it take?"}, {"role": "assistant", "content": "Whether to draw the connections between the Arguments: A Boolean.."}]} -{"conversations": [{"role": "user", "content": "Write a random pentatonic melody that plays by itself."}, {"role": "assistant", "content": "Pick degrees from a pentatonic scale; `\\scale` and `\\root` define the pitch space, and `\\degree`\npicks within it.\n\n```supercollider\n(\nPbind(\n \\instrument, \\default,\n \\scale, Scale.minorPentatonic,\n \\root, 3,\n \\degree, Pwhite(0, 9, inf),\n \\octave, 5,\n \\dur, Pwhite(0.12, 0.28, inf),\n \\amp, 0.2,\n \\legato, 0.8\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Oregonator` in SuperCollider?"}, {"role": "assistant", "content": "Oregonator — Chemical reaction modelling Oscillator Euler ODE solver implementation of the Oregonator equations (http://www.scholarpedia.org/article/Oregonator). Category: UGens > Generators > Chaotic //SLUGens released under the GNU GPL as extensions for SuperCollider 3, by Nick Collins, http://composerprogrammer.com/index.html."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SequenceableCollection`."}, {"role": "assistant", "content": "```supercollider\n// using numbers as score\n[3, [1, 2, 1], 1].convertRhythm; // List[0.75, 1.5, 0.75]\n[2, [1, 3, [1, [2, 1, 1, 1]], 1, 3], 1].convertRhythm;\n[2, [1, [1, [2, 1, 1, 1]]], 1].convertRhythm;\n[2, [1, [1, [2, 1, 1, 1]]], 2].convertRhythm; // repeat\n[2, [1, [1, [2, 1, 1, -1]]], 2].convertRhythm; // negative value is tied over.\n\n// sound example\nPbind(\\degree, Pseries(0, 1, inf), \\dur, Pseq([2, [1, [1, [2, 1, 1, -1]]], 2].convertRhythm)).play;\n```"}]} -{"conversations": [{"role": "user", "content": "Resetting start count with PulseDivider?"}, {"role": "assistant", "content": "SuperCollider forum — Resetting start count with PulseDivider?\n\ni think in your example Sweep is receiving a trigger while going from 0 to 1 causing the discontinuity in the phase because the duration between one trigger and the next is unknown.\n\nwith this example you get at least a continiuous phase with random triggers to drive the hanning window (evaluate it several times). but its not multichannel with distributed phases / windows accross channels:\n\n```supercollider\n(\nvar randomTrigPhase = { |triggerRate = 10, randomness = 1|\n var minDuration = (2 ** randomness) / triggerRate;\n var maxDuration = (2 ** (-1 * randomness)) / triggerRate;\n var demand = Dunique(minDuration * ((maxDuration / minDuration) ** Dwhite(0, 1)));\n var duration = Duty.ar(demand, DC.ar(0), demand);\n var phase = Phasor.ar(DC.ar(0), (1 / duration) / SampleRate.ir, 0, 1);\n (phase: phase, trigger: HPZ1.ar(phase) < 0);\n};\n\nvar hanningWindow = { |phase|\n (1 - (phase * 2pi).cos) / 2 * (phase < 1);\n};\n\n{\n var rate = 100;\n var phase = randomTrigPhase.(rate, 1).phase;\n hanningWindow.(phase);\n}.plot(0.1);\n)\n```\n\nim not sure if this is helping it just reminded me of some issue with multichannel random triggers and continiuous phases i have been trying to solve."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n{ Pan2.ar(Klank.ar(`[[1, 2.2, 3.5, 4.9], nil, Array.series(4, 1, -0.2)], PinkNoise.ar(EnvGen.ar(Env.perc(0.001,0.01), Impulse.ar(4))), 0), 0); }.play;\n```"}, {"role": "assistant", "content": "I accidentally set the freqscale of a Klank to 0. What resulted was a surprisingly varied and dynamic bit of glitch. The joy of typos in SC :)."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for electric guitar (a SuperCollider snippet)?"}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\noisecomb2, { arg out, gate=1, pan=0, freq=300, amp=0.1, noiselevel=0.2,\n minfreq=100, decaytime=1, doneAction=2, ffreq=500, rq=0.3, spread=0.8;\n var sig, env;\n sig = WhiteNoise.ar(noiselevel);\n sig = sig + ClipNoise.ar(noiselevel);\n sig = sig + AllpassC.ar(sig, 1/minfreq, 1/freq, decaytime);\n sig = RLPF.ar(sig, ffreq * \\ffreqtab.kr(1!10), rq);\n env = EnvGen.kr(\\adsr.kr(Env.adsr(0.6,0.1,0.8,0.1)), gate, doneAction:doneAction);\n sig = sig * env;\n sig = Splay.ar(sig, spread, 1, pan);\n sig = sig * amp;\n Out.ar(out, sig);\n}).store;\n);\n\n(\nPdef(\\plopbla, Pbind(\n \\instrument, \\noisecomb2,\n \\note, Pseq([[0,7],[1,8],[-1,5]]-2,inf),\n //\\note, Pseq([0,1,2,3,4],inf)\n \\octave, Pstep(Pseq([3,4],inf),Pseq([5,0.75],inf)),\n \\minfreq, 50,\n \\decaytime, 1.0,\n \\adsr, Pseq([\n [Env.adsr(0.02,0.1,0.8,0.4,curve:0.5)],\n [Env.adsr(0.02,0.1,0.8,0.4,curve:0.5)],\n [Env.adsr(0.02,0.1,0.8,0.4,curve:0.5)],\n [Env.adsr(0.03,0.1,0.8,0.1,curve:0.5)],\n [Env.adsr(0.03,0.1,0.8,0.1,curve:0.5)],\n [Env.adsr(0.03,0.1,0.8,0.1,curve:0.5)],\n ],inf),\n \\legato, 1.0,\n //\\ffreq, [500,610,820,140],\n \\ffreq, 500,\n //\\ffreqtab, [[0.8,1,1.1,1.2, 2,4,5,6, 8,10].scramble.postln],\n //\\ffreqtab, Pfunc{ [[ 0.1, 0.2, 0.3, 0.5, 1,2,3,8, 10, 12 ].scramble] + rrand(0.01,1.0); },\n //\\ffreqtab, [ 6, 4, 5, 10, 1, 1.2, 0.8, 1.1, 2, 8 ], // also nice\n \\ffreqtab, [[ 6, 4, 5, 10, 1, 1.2, 0.8, 0.4, 2, 8 ]],\n \\dur, Pseq([3,1,1, 0.25,0.25,0.25],inf),\n \\amp, 1.1\n)).play;\n);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\n{ Mix.new([PinkNoise.ar(0.1), FSinOsc.ar(801, 0.1), LFSaw.ar(40, 0.1)]) }.play\n\n(\nplay({\n Mix.new(Array.fill(8, { SinOsc.ar(500 + 500.0.rand, 0, 0.05) }));\n}))\n\n(\nplay({\n Mix.fill(8, { SinOsc.ar(500 + 500.0.rand, 0, 0.05) });\n})\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\n{ Mix.new([PinkNoise.ar(0.1), FSinOsc.ar(801, 0.1), LFSaw.ar(40, 0.1)]) }.play\n\n(\nplay({\n Mix.new(Array.fill(8, { SinOsc.ar(500 + 500.0.rand, 0, 0.05) }));\n}))\n\n(\nplay({\n Mix.fill(8, { SinOsc.ar(500 + 500.0.rand, 0, 0.05) });\n}))\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n/* Audio plugin definition\n\n Each audio plugin should define the following global variables:\n ~name: (symbol) name of the spatializer\n ~description: (string) a short description\n ~function: the actual definition of the plugin\n\n*/\n\n~name = \\MonoIn;\n~description = \"A direct input\";\n~channelLayout = \\mono;\n\n~function = {\n |gate = 0, bus = 0, attack = 0.02, susL = 0.9, release = 0.1, curve = -4|\n var env = Env.asr(attack, susL, release, curve);\n SoundIn.ar(bus, EnvGen.kr(env, gate));\n}\n```"}, {"role": "assistant", "content": "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see ."}]} +{"conversations": [{"role": "user", "content": "What does `Block.addNum` do? What arguments does it take?"}, {"role": "assistant", "content": "A Block Arguments: Number of blocks; Number of channels."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var w, x, y, p, a, b, c, d;\n\n p = PinkNoise.ar; // source\n\n // B-format encode\n #w, x, y = PanB2.ar(p, MouseX.kr(-1, 1), 0.1);\n\n // B-format decode to quad\n #a, b, c, d = DecodeB2.ar(4, w, x, y);\n\n [a, b, d, c] // reorder to my speaker arrangement: Lf Rf Lr Rr\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var w, x, y, p, a, b, c, d;\n\n p = PinkNoise.ar; // source\n\n // B-format encode\n #w, x, y = PanB2.ar(p, MouseX.kr(-1, 1), 0.1);\n\n // B-format decode to quad\n #a, b, c, d = DecodeB2.ar(4, w, x, y);\n\n [a, b, d, c] // reorder to my speaker arrangement: Lf Rf Lr Rr\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `BStore.remove` do? What arguments does it take?"}, {"role": "assistant", "content": "Removes BStore Arguments: type setting.; settings.; format.."}]} +{"conversations": [{"role": "user", "content": "What is `BelaScope`?"}, {"role": "assistant", "content": "BelaScope — Bela's Oscilloscope interface"}, {"role": "user", "content": "What does `BelaScope.scope` do?"}, {"role": "assistant", "content": "Send an array of UGen data to Bela's oscilloscope."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n{ BelaScope.scope(0, SinOsc.ar) }.play;\n// same using UGen\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// Here we start with initOutOffset = 0.5, fadeMode = 1 (step first),\n// channels with indices 0 and 4 (base tone and 5th partial) are equally weighted.\n\n(\nx = {\n var lfo = XLine.ar(1, 0.5, 60);\n DXMix.ar(\n Dseq([0, 4, 1, 5, 2, 6, 3, 7], inf),\n `(Saw.ar((1..8) * 70 * lfo, 0.075)),\n fadeTime: 0.1,\n stepTime: 2,\n fadeMode: 1,\n width: 3,\n maxWidth: 8,\n initOutOffset: 0.5\n ) ! 2\n}.play\n);\n\nx.release\n\n\n// overlap scheme with width = 3 and initOutOffset = 0.5:\n```"}, {"role": "assistant", "content": "Here we start with initOutOffset = 0.5, fadeMode = 1 (step first), channels with indices 0 and 4 (base tone and 5th partial) are equally weighted. (DXMix: crossfades between signals according to demand-rate control)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Lorenz2DL.ar(11025, 44100) }.play(s);\n\n// randomly modulate params\n(\n{ Lorenz2DL.ar(\n 11025, 44100,\n LFNoise0.kr(1, 2, 10),\n 20,\n LFNoise0.kr(1, 1.5, 2),\n 0.02\n) * 0.2 }.play(s);\n)\n\n// as a frequency control\n{ SinOsc.ar(Lorenz2DL.ar(40, 80, h:0.02)*800+900)*0.4 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Lorenz2DL.ar(11025, 44100) }.play(s);\n\n// randomly modulate params\n(\n{ Lorenz2DL.ar(\n 11025, 44100,\n LFNoise0.kr(1, 2, 10),\n 20,\n LFNoise0.kr(1, 1.5, 2),\n 0.02\n) * 0.2 }.play(s);\n)\n\n// as a frequency control\n{ SinOsc.ar(Lorenz2DL.ar(40, 80, h:0.02)*800+900)*0.4 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n//Chaos engine hum\n(\n{\n SinOsc.ar(10 + (50 * SinOsc.kr([50, 51], 0, SinOsc.kr(101, Saw.kr(0.12345, 678, 9), 0.2, 0.8), Pulse.kr([25, 25.5], 0.25, 0.125, -0.25))), 0, 0.5, 0);\n}.play();\n)\n```"}, {"role": "assistant", "content": "A deep binaural cycle reminiscent of the engine of a space ship."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `RunningMin`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n SinOsc.ar(\n RunningMin.ar(Dust.ar(20), Impulse.ar(0.4)) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// follow a sine lfo, reset rate controlled by mouse x\n(\n{\n SinOsc.ar(\n RunningMin.kr(SinOsc.kr(0.2), Impulse.kr(MouseX.kr(0.01, 2, 1))) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `KeyDownResponderGroup` in SuperCollider?"}, {"role": "assistant", "content": "KeyDownResponderGroup — for concatenating differing classes of key/unicode responders For concatenating differing class of responder including KeyCodeResponder/UnicodeResponder/SwitchableKeyDownResponder or even straight functions Category: Libraries > crucial > GUI > internals."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\nSynthDef(\\sine, { |freq = 400, amp = 0.1| Out.ar(0, SinOsc.ar(freq, mul: amp)) }).add;\nSynthDef(\\pulse, { |freq = 400, amp = 0.1| Out.ar(0, Pulse.ar(freq, mul: amp)) }).add;\n);\n\n(\nx = Synth(\\sine).register;\ny = Synth(\\pulse).register;\n);\n\n// pause pulse \n\ny.run(false);\n\n// VarGui checks state, definition is known, new Synths of same definition can be started\n\nv = VarGui(synth: [x,y]).gui;\n\n\n// With nodeIDs or non-regist\n// …\n```"}, {"role": "assistant", "content": "VarGui checks state, definition is known, new Synths of same definition can be started With nodeIDs or non-registered Synths VarGui demands addtional state info (VarGui: slider / player gui to set envir variables and synth controllers and play synths, event patterns and tasks)"}]} +{"conversations": [{"role": "user", "content": "What does `AbstractSFP.bpm` do? What arguments does it take?"}, {"role": "assistant", "content": "base class for SoundFilePlayer classes Arguments: b."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `LFClipNoise`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-LFClipNoise\", { |out = 0|\n Out.ar(out,\n LFClipNoise.ar(1000, 0.25)\n )\n}).play;\n);\n\n// modulate frequency\n(\nSynthDef(\"help-LFClipNoise\", { |out = 0|\n Out.ar(out,\n LFClipNoise.ar(XLine.kr(1000, 10000, 10), 0.25)\n )\n}).play;\n);\n\n// use as frequency control\n(\nSynthDef(\"help-LFClipNoise\", { |out = 0|\n Out.ar(out,\n SinOsc.ar(\n LFClipNoise.ar(4, 200, 600),\n 0, 0.2\n )\n )\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\"help-Max\",{Out.ar(0,Pan2.ar(\nSinOsc.ar(Max.kr(SinOsc.ar(2,0,300,400).abs,6400),0,0.1) \n,0.0))\n}).play\n);\n\n//compare\n(\nSynthDef(\"help-Max\",{Out.ar(0,Pan2.ar(\nSinOsc.ar(SinOsc.ar(2,0,300,400),0,0.1) \n,0.0))\n}).play\n);\n\n(\nSynthDef(\"help-Max\",{Out.ar(0,Pan2.ar(\nSinOsc.ar(Max.kr(LFNoise0.ar(20,300,400),3200),0,0.1) \n,0.0))\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\"help-Max\",{Out.ar(0,Pan2.ar(\nSinOsc.ar(Max.kr(SinOsc.ar(2,0,300,400).abs,6400),0,0.1) \n,0.0))\n}).play\n);\n\n//compare\n(\nSynthDef(\"help-Max\",{Out.ar(0,Pan2.ar(\nSinOsc.ar(SinOsc.ar(2,0,300,400),0,0.1) \n,0.0))\n}).play\n);\n\n(\nSynthDef(\"help-Max\",{Out.ar(0,Pan2.ar(\nSinOsc.ar(Max.kr(LFNoise0.ar(20,300,400),3200),0,0.1) \n,0.0))\n}).play\n);\n\n//compare\n(\nSynthDef(\"help-Max\",{Out.ar(0,Pan2.ar(\nSinOsc.ar(LFNoise0.ar(20,300,400),0,0.1) \n,0.0))\n}).play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Function`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\nx = { |freq = 440| SinOsc.ar(freq, 0, 0.3) }.play; // this returns a Synth object;\nx.set(\\freq, 880); // note you can set the freq argument\nx.defName; // the name of the resulting SynthDef\nx.release(4); // fadeout over 4 seconds\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `OSCBundle`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// create a new, empty instance\na = OSCBundle.new;\n\n// a synthdef that needs to be sent to the server, an operation that is asynchronous,\n// i.e. we have to wait until it is finished.\nx = SynthDef(\"test\", { OffsetOut.ar(0, BPF.ar(Impulse.ar(4) * 10, Rand(9000, 1000), 0.1)) });\n// this is why addPrepare is used.\na.addPrepare([\"/d_recv\", x.asBytes]);\n// add is used with synchronous operations, like starting synths.\na.add([\"/s_new\", \"test\", -1]);\n\n// the bundle has now the synchronous separated from the asynchronous bundles:\na.messages;\na.preparationMessages;\n\n// this can be simply sent - the bundle takes care of the server client communication\n// like waiting for the synthdef to be loaded. the synth is started when the preparation\n// is finished.\n\ns.boot; // boot the server\na.send(s);\n\ns.freeAll; // free all nodes on the server\n\n// scheduled sending: the synths are started on the next beat.\n\na.schedSend(s, TempoClock.default, 1);\na.schedSend(s, TempoClock.default, 1);\na.schedSend(s, TempoClock.default, 1);\n\ns.freeAll; // free all nodes on the server\n\n// the bundle can contain several preparation messages and messages at a time.\n// the proparationMessages are sent first and only when they are all completed,\n// the other bundles are sent.\n// the bundle can also be reused, if there is no specific allocated buffers/node ids.\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Limiter` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\n// example signal to process\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n z * 0.8\n}.play\n);\n\n(\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n [z, Limiter.ar(z, 0.4, 0.01)] * 0.5\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n(\nx = {\n |lookBack = 3, thr = 1|\n var trig = Impulse.ar(7);\n // for a non-integer source it makes sense to take a sufficiently large threshold thr\n var midi = Demand.ar(trig, 0, DIdev(SinOsc.ar(0.2, 0, 15, 82), 5, -6, 5, lookBack, thr: thr));\n midi.poll(7, label: \\midi);\n SinOsc.ar(midi.midicps.lag(0.007)) ! 2 * 0.1\n}.play;\n);\n\n// close floats can occur here \nx.set(\\thr, 0.01)\n\n// not here\nx.set(\\thr, 2)\n\nx.release\n```"}, {"role": "assistant", "content": "for a non-integer source it makes sense to take a sufficiently large threshold thr close floats can occur here (DIdev: pseudo drate ugen, searches for numbers with integer distance from a source signal, optionally avoiding repetitions within a span)"}]} +{"conversations": [{"role": "user", "content": "What does `IBVAfile.generateHeaderString` do? What arguments does it take?"}, {"role": "assistant", "content": "return a string with a Arguments: ibva — an instance of IBVA."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// vibrato at 1 Hz, note the use of DC.ar UGen; a constant of 400.0 doesn't work\n{ SinOsc.ar(Vibrato.ar(DC.ar(400.0), 1, 0.02)) }.play\n\n// compare: k-rate freq input can be a constant\n{ SinOsc.ar(Vibrato.kr(400.0, 1, 0.02)) }.play\n\n// control rate and rateVariation\n{ SinOsc.ar(Vibrato.ar(DC.ar(400.0), MouseX.kr(2.0, 100.0), 0.1, 1.0, 1.0, MouseY.kr(0.0, 1.0), 0.1)) }.play\n\n// control depth and depthVariation\n{ SinOsc.ar(Vibrato.ar(DC.ar(4\n// …\n```"}, {"role": "assistant", "content": "vibrato at 1 Hz, note the use of DC.ar UGen; a constant of 400.0 doesn't work compare: k-rate freq input can be a constant (Vibrato: The Vibrato oscillator models a slow frequency modulation.)"}]} +{"conversations": [{"role": "user", "content": "How do I make a delay line?"}, {"role": "assistant", "content": "`CombN.ar(in, maxdelaytime, delaytime, decaytime)` is a feedback delay: maxdelaytime is the buffer size, delaytime the actual delay (and it can modulate), decaytime how long the repeats take to die. For a clean single echo use `DelayN.ar(in, maxdelaytime, delaytime)`, which has no feedback. Both replace the `in` with the delayed signal, so mix with the dry: `dry + CombN.ar(dry, 0.5, 0.3, 2) * 0.4`."}]} +{"conversations": [{"role": "user", "content": "Explain `NamedControl` in SuperCollider briefly."}, {"role": "assistant", "content": "NamedControl — Named reference to a control A NamedControl directly combines a ControlName and a Control UGen conveniently. Also this makes it safe even if several identical controls exist (see example below). Category: UGens > Synth control."}]} +{"conversations": [{"role": "user", "content": "What does Splay.ar do?"}, {"role": "assistant", "content": "`Splay.ar(inArray, spread, level, center, levelComp)` takes an array of mono signals and distributes them across the stereo field, so `Splay.ar(SinOsc.ar([220, 330, 440]) * 0.1)` is a three-source stereo chord rather than three separate synths. spread (0..1) controls how far the voices fan out and center shifts the middle. It is the shorthand for 'make this array stereo'."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n pitches.size.do{ |i|\n {\n var freq = pitches[i].midicps;\n var env = Env.perc.ar(Done.freeSelf);\n SinOsc.ar(freq) * 0.1 * env\n }.play;\n 0.2.wait\n }\n}\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n pitches.size.do{ |i|\n {\n var freq = pitches[i].midicps;\n var env = Env.perc.ar(Done.freeSelf);\n SinOsc.ar(freq) * 0.1 * env\n }.play;\n 0.2.wait\n }\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n+ String {\n decodeHex {\n var new = String.new, stream = CollStream(this), ch, int;\n while {\n ch = stream.next;\n ch.notNil\n } {\n if(ch == $%) {\n ch = stream.next;\n if(ch.notNil) {\n int = ch.digit << 4;\n } {\n // If the string ends with %, then 'ch' after that is nil\n // so we can just append the %\n ^new.add($%);\n };\n ch = stream.next;\n if(ch.notNil) {\n ch = (int + ch.digit).asAscii;\n } {\n // If we got this far, we know there was one (only one) char after %\n // so add them both\n ^new.add($%).add(this.last);\n };\n };\n new = new.add(ch);\n };\n ^new\n }\n}\n```"}, {"role": "assistant", "content": "A quick utility function for decoding UTF-8 characters in %hex codes (such as for web URLs). Save the code into a .sc file in your Extensions/ directory, recompile, and then:\r\n\r\n\"%E5%A4%A7%E5%AE%B6%E5%A5%BD\".decodeHex;\r\n-> 大家好\r\n\r\nThis probably works only for UTF-8. SC can save the individual bytes of Unicode characters into String objects, and the IDE will print UTF-8 code points correctly, but th."}]} +{"conversations": [{"role": "user", "content": "My sustained synth never stops, even when I set the gate to 0."}, {"role": "assistant", "content": "A sustained EnvGen only releases when the gate goes from positive to non-positive *after* the envelope has started, and the Synth only disappears if that EnvGen has `doneAction: 2`. Check three things: the SynthDef actually takes a `gate = 1` argument, the Env is a sustained shape (Env.adsr or Env.asr, not Env.perc), and you call `x.set(\\gate, 0)` on the Synth object. Setting the gate on a different Synth, or on a Group, does nothing."}]} +{"conversations": [{"role": "user", "content": "How do I use a metronome or check my timing?"}, {"role": "assistant", "content": "A click on the clock you are using, plus a counter to see where you are in the bar:\n\n```supercollider\n(\nTdef(\\click, {\n var count = 0;\n loop {\n (Synth(\\hat, [\\amp, if (count % 4 == 0) { 0.25 } { 0.08 }]));\n count = count + 1;\n 1.wait;\n }\n}).play;\n)\n```\n\nBecause it waits on `TempoClock.default`, it stays in sync with every Pbind you start, which makes it a\ntempo reference rather than a separate sound."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Klank`."}, {"role": "assistant", "content": "```supercollider\n{ Klank.ar(`[[800, 1071, 1153, 1723], nil, [1, 1, 1, 1]], Impulse.ar(2, 0, 0.1)) }.play;\n\n{ Klank.ar(`[[800, 1071, 1353, 1723], nil, [1, 1, 1, 1]], Dust.ar(8, 0.1)) }.play;\n\n{ Klank.ar(`[[800, 1071, 1353, 1723], nil, [1, 1, 1, 1]], PinkNoise.ar(0.007)) }.play;\n\n{ Klank.ar(`[[200, 671, 1153, 1723], nil, [1, 1, 1, 1]], PinkNoise.ar([0.007, 0.007])) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n Ndef(\\x, {\n var output;\n var delayTime;\n var delayMax = 0.2;\n var delayAdd = 0.1;\n var pulseFreq = 0.5;\n var proxyMul = 2;\n var pulseMin = 40;\n var pulseMax = 130;\n var numOfEchos = 2;\n\n var mainPulse = LFPulse.ar(pulseFreq, 0, 0.5).range(pulseMin, pulseMax);\n var proxy = Ndef(\\x).ar * proxyMul;\n var ampModFreq = SinOsc.ar(0.01, 0).range(0.3, 30);\n var ampMod = LFNoise1.ar(ampModFreq, 6);\n output = SinOsc.ar(mainPulse + proxy, 0, ampMod).tanh;\n numOfEchos.do{\n delayTime = {delayMax.rand + delayAdd}!2;\n output = AllpassL.ar(output, 0.1, delayTime, 5);\n };\n output.tanh;\n }).play\n)\n```"}, {"role": "assistant", "content": "Something I put together a while back by forking Dark Sea Horns."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var a;\n a = [\n Saw.ar(LFSaw.kr(3 * [1, 1.01], 0, 100, 230)),\n SinOsc.ar,\n Pulse.ar(LFPulse.kr(3 * [1, 1.02], 0, 0.4, 100, 230)),\n SinOsc.ar(SinOsc.kr(4 * [1, 1.03], 0, 200, 300))\n ];\n\n SelectXFocus.ar(MouseX.kr(0, 1) * a.size, a, MouseY.kr(0, a.size)) * 0.2\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var a;\n a = [\n Saw.ar(LFSaw.kr(3 * [1, 1.01], 0, 100, 230)),\n SinOsc.ar,\n Pulse.ar(LFPulse.kr(3 * [1, 1.02], 0, 0.4, 100, 230)),\n SinOsc.ar(SinOsc.kr(4 * [1, 1.03], 0, 200, 300))\n ];\n\n SelectXFocus.ar(MouseX.kr(0, 1) * a.size, a, MouseY.kr(0, a.size)) * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "SC can't open or read files?"}, {"role": "assistant", "content": "SuperCollider forum — SC can't open or read files\n\nIt looks as though it’s finally working!\n\nI moved the file to a folder I created in the user support directory for SuperCollider and then changed the quotes to ascii.\n\nI think the issue was that at first I had the file name listed without the extension, then I added the extension to the file name and added the file extension to the file path in the code and this must have created a conflict.\n\nIn the first instance SC needed the file extension, ascii quotes, and since I’m on windows the path needed double \\ in the path file.\n\nThe final working code looks like this:\n\n```supercollider\nb = Buffer.readChannel(s, \"C:\\\\Users\\\\44774\\\\AppData\\\\Local\\\\SuperCollider\\\\Tables\\\\wubsquare.wav\", startFrame:0, numFrames: -1);\n```\n\nThe wav file is simply named wubsquare and I included the file extension in the code."}]} +{"conversations": [{"role": "user", "content": "What is `Bus`?"}, {"role": "assistant", "content": "Bus — Representation of a bus on the server"}, {"role": "user", "content": "What does `Bus.control` do?"}, {"role": "assistant", "content": "Allocate a control bus on the server."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\na = Bus.control(s, 1).set(440);\nb = Bus.control(s, 1).set(0.01);\n);\n(\nSynthDef(\\rlpf, { |out, ffreq, rq|\n Out.ar(out, RLPF.ar(WhiteNoise.ar(0.2), ffreq, rq))\n}).play(s, [\\ffreq, a.asMap, \\rq, b.asMap]);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// This SynthDef has a harder attack than the default, illustrating rearticulation more clearly.\n(\nSynthDef(\\sawpulse, { |out, freq = 440, gate = 0.5, plfofreq = 6, mw = 0, ffreq = 2000, rq = 0.3, freqlag = 0.05, amp = 1|\n var sig, plfo, fcurve;\n plfo = SinOsc.kr(plfofreq, mul: mw, add: 1);\n freq = Lag.kr(freq, freqlag) * plfo;\n fcurve = EnvGen.kr(Env.adsr(0, 0.3, 0.1, 20), gate);\n fcurve = (fcurve - 1).madd(0.7\n// …\n```"}, {"role": "assistant", "content": "This SynthDef has a harder attack than the default, illustrating rearticulation more clearly. (PmonoArtic: partly monophonic event stream)"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// Periphonic (3D) encoder, a 1/2 dome of 13 loudspeakers\n// [[0, 0], [45, 0], [90, 0], [135, 0], [-180, 0], [-135, 0], [-90, 0], [-45, 0],\n// [45, 35.3], [135, 35.3], [-135, 35.3], [-45, 35.3], [0, 90]]\n\n~directions = [[0, 0], [45, 0], [90, 0], [135, 0], [-180, 0], [-135, 0], [-90, 0],\n [-45, 0], [45, 35.3], [135, 35.3], [-135, 35.3], [-45, 35.3], [0, 90]].degrad;\n~encoder = FoaE\n// …\n```"}, {"role": "assistant", "content": "Periphonic (3D) encoder, a 1/2 dome of 13 loudspeakers [[0, 0], [45, 0], [90, 0], [135, 0], [-180, 0], [-135, 0], [-90, 0], [-45, 0], (FoaEncoderMatrix: First Order Ambisonic (FOA) encoder matrices)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n // LFSaw begins at 0, illustrates attack time better\n var sig = LFSaw.ar(440);\n var amps = Amplitude.ar(\n sig,\n attackTime: [0.001, 0.01],\n releaseTime: [0.01, 0.2]\n );\n [sig] ++ amps\n}.plot\n.superpose_(true)\n.plotColor_([Color.black, Color.green, Color.blue]);\n);\n\n(\n// use input amplitude to control SinOsc frequency\n{\n SinOsc.ar(\n Amplitude.kr(\n Blip.ar(3, 20) * LFNoise1.kr(0.1).range(0, 1),\n MouseX.kr(0.00\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n // LFSaw begins at 0, illustrates attack time better\n var sig = LFSaw.ar(440);\n var amps = Amplitude.ar(\n sig,\n attackTime: [0.001, 0.01],\n releaseTime: [0.01, 0.2]\n );\n [sig] ++ amps\n}.plot\n.superpose_(true)\n.plotColor_([Color.black, Color.green, Color.blue]);\n);\n\n(\n// use input amplitude to control SinOsc frequency\n{\n SinOsc.ar(\n Amplitude.kr(\n Blip.ar(3, 20) * LFNoise1.kr(0.1).range(0, 1),\n MouseX.kr(0.001, 1, 1),\n MouseY.kr(0.001, 1, 1),\n 1200,\n 400\n ),\n 0, 0.3)\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `RedTime.asSeconds` do?"}, {"role": "assistant", "content": "Calculates the number of seconds using Returns: A SimpleNumber."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Server-side sequencing (a SuperCollider snippet) that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n(\nf = { |f0=200, rate=4|\n {\n var seq = Dseq(f0*[1/2,3/4, Dstutter(4, Drand([1/2,1,2,3,4,5,6],1)), 2,3/2,3,4/3], inf);\n var trig = Impulse.ar(rate);\n var freq = Demand.ar(trig,0, seq);\n var env = Decay2.ar(trig,1e-3,1);\n FreeVerb.ar(\n Splay.ar(SinOsc.ar(freq*[0.995, 1, 1.005]).fold(-0.995,0.995)*0.25*env),\n 0.5,\n 0.5\n );\n }\n};\n\nfork{ 4.do{\n fork{\n f.(100,2).play;\n (1/8).wait;\n f.(200,4).play;\n (1/4).wait;\n f.(100*4/3,8).play;\n (1/2).wait;\n f.(400,4).play;\n };\n (1/4).wait;\n}}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `BufFrames` in SuperCollider?"}, {"role": "assistant", "content": "BufFrames — Current number of frames allocated in the buffer. Get the current number of allocated frames. Category: UGens > Buffer > Info."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Pfsm` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n(\na = Pfsm([\n #[0, 1],\n 67, #[0, 0, 3],\n 72, #[2],\n 73, #[0, 2],\n Pseq([74, 75, 76, 77]), #[2, 3, 3],\n nil, nil\n ], inf).asStream;\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, a.next.midicps]);\n 0.1.wait;\n })\n}).play;\n);\n\n(\nPfsm([\n #[5, 6, 7], // entry states\n\n // e1 (== state 0)\n Pbind(\\dur, Pseq([1/8, 3/8]), \\midinote, Pseq([86, 75])),\n // #[1], // as given in CMJ\n // my de-boredom-ated version..\n #[1, 1, 1, 1, 1, 1, 1, 8],\n // e2 (== state 1)\n Pbind(\\dur, 1/2, \\midinote, Pseq([69])),\n #[0, 1],\n // e3 (== state 2)\n Pbind(\\dur, 1/3, \\midinote, Pseq([55, 60, 66])),\n #[0, 1, 2, 2, 2, 2, 3, 3, 3, 3],\n // e4 (== state 3)\n Pbind(\\dur, 1/4, \\midinote, Pseq([81, 80, 77, 76])),\n #[1, 4, 4, 4, 4],\n // e5 (== state 4)\n Pbind(\\dur, Pseq([1, 2/3, 2/3, 2/3, 1]), \\midinote, Pseq([\\, 70, 70, 70, \\])),\n #[2, 3],\n // e6 (== state 5)\n Pbind(\\dur, 1/4, \\midinote, Pseq([59, 61])),\n #[0, 2, 4, 5, 5, 5, 5, 5, 5, 5],\n // e7 (== state 6)\n Pbind(\\dur, 1/4, \\midinote, Pseq([87, 88], 2)),\n #[4, 4, 4, 4, 6, 6, 6, 7, 7, 7],\n // e8 (== state 7)\n Pbind(\\dur, 1, \\midinote, Pseq([56])),\n #[1, 3, 6, 6, 6],\n // terminal state\n nil, nil\n]).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `HasItemSpec` in SuperCollider briefly."}, {"role": "assistant", "content": "HasItemSpec — abstract parent class for datatypes that wrap other datatypes eg. ArraySpec Category: Spec, Libraries > crucial > Spec."}]} +{"conversations": [{"role": "user", "content": "What does `JITGui.object` do?"}, {"role": "assistant", "content": "put an object in the gui - if the gui accepts"}]} +{"conversations": [{"role": "user", "content": "What does `Pen.moveTo` do? What arguments does it take?"}, {"role": "assistant", "content": "Move the Pen to Arguments: point — An instance of Point."}]} +{"conversations": [{"role": "user", "content": "What does `InstrSynthDef.onTrig` do? What arguments does it take?"}, {"role": "assistant", "content": "Extends SynthDef enabling the extra capabilities of Instr with Patch Arguments: trig; func; value."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// vary frequency - these parameters are for \"one-pulse\" orbit\n{ RosslerL.ar(MouseX.kr(20, SampleRate.ir), 0.36, 0.35, 4.5) * 0.3 }.play(s);\n\n// randomly modulate params\n(\n{ RosslerL.ar(\n SampleRate.ir, \n 0.2, // First variable tends to lead to NaN if modulated in this example\n LFNoise0.kr(1, 0.01, 0.2),\n LFNoise0.kr(1, 0.2, 0.7)\n) * 0.2 }.play(s);\n)\n\n// as a frequency control\n{ SinOsc.ar(Lag.ar(RosslerL.ar(MouseX.kr(1, 200)))*800+900)*0.4 }.play\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// vary frequency - these parameters are for \"one-pulse\" orbit\n{ RosslerL.ar(MouseX.kr(20, SampleRate.ir), 0.36, 0.35, 4.5) * 0.3 }.play(s);\n\n// randomly modulate params\n(\n{ RosslerL.ar(\n SampleRate.ir, \n 0.2, // First variable tends to lead to NaN if modulated in this example\n LFNoise0.kr(1, 0.01, 0.2),\n LFNoise0.kr(1, 0.2, 0.7)\n) * 0.2 }.play(s);\n)\n\n// as a frequency control\n{ SinOsc.ar(Lag.ar(RosslerL.ar(MouseX.kr(1, 200)))*800+900)*0.4 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Array.poll` do?"}, {"role": "assistant", "content": "apply an array of Poll units to an array of UGens (see those helpfiles for more details)."}]} +{"conversations": [{"role": "user", "content": "Explain `AbstractPlayerProxy` in SuperCollider briefly."}, {"role": "assistant", "content": "AbstractPlayerProxy — base class for players that act as proxies for another player Defers all responsiblities for playing to another object. This is a superclass. Category: Libraries > crucial > Players > abstract."}]} +{"conversations": [{"role": "user", "content": "What does `KeyCodeResponder.normalModifier` do?"}, {"role": "assistant", "content": "register responder functions for keycode and modifier combinations"}]} +{"conversations": [{"role": "user", "content": "What does `SparseArray.reduceArray` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a new SparseArray holding the same data as array. `a = [4, 7, 4, 4, 4, 4, 4, 4, 9, 9, Arguments: array — Any ArrayedCollection.; default — The default value, i.e. the value that all slots should take at first. For best memory efficiency, you should supply the most common value found in the collection.."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// create an audio-rate sine wave at 200 Hz,\n// starting with phase 0 and an amplitude of 0.5\n{ SinOsc.ar(200, 0, 0.5) }.play;\n\n// modulate the frequency with an exponential ramp\n{ SinOsc.ar(XLine.kr(2000, 200), 0, 0.5) }.play;\n\n// more complex frequency modulation\n{ SinOsc.ar(SinOsc.ar(XLine.kr(1, 1000, 9), 0, 200, 800), 0, 0.25) }.play;\n\n// phase modulation (see also PMOsc)\n{ SinOsc.ar(800, SinOsc.ar(XLine.kr(1, 1000, 9), 0, 2pi), 0.25) }.play;\n```"}, {"role": "assistant", "content": "create an audio-rate sine wave at 200 Hz, starting with phase 0 and an amplitude of 0.5 (SinOsc: Interpolating sine wavetable oscillator.)"}]} +{"conversations": [{"role": "user", "content": "Explain `SwitchableKeyDownResponder` in SuperCollider briefly."}, {"role": "assistant", "content": "SwitchableKeyDownResponder — like Select but for key responders : dynamically switches between different responders Useful for mode changes Category: Libraries > crucial > GUI, External Control > Keyboard."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n \n// definition for future reference in arbitrary Environments\n\n(\np = Pbind(\n \\midinote, PLnaryop('+', \\src, [\\dev]),\n \\dur, 0.1\n);\n);\n\n\n// define Environment and play\n\n(\ne = (src: PLseq([61,62]), dev: Pbrown(-5, 5, 0.2) );\n\ne.use { x = p.play };\n);\n\n\n// replace\n\ne.dev = PLseq((0, 0.5..7));\n\ne.dev = Pbrown(-5, 5, 0.2);\n\ne.src = PLseq([61,64,65]);\n// …\n```"}, {"role": "assistant", "content": "definition for future reference in arbitrary Environments define Environment and play (PLnaryop: dynamic scope Pnaryop variant)"}]} {"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//spinning box / cube\n//after Shiffman https://codingtrain.github.io/website-archive/CodingChallenges/112-3d-rendering.html\n\n(\nvar width= 640, height= 480, w,\ntheta= 0, speed= 0.01, box;\n\nw= RedWindow(\"3Dbox\", Rect(128, 64, width, height)).front;\nbox= Red3DBox();\n\n//--loop\nw.draw{\n theta= theta+speed;\n box.rotation= RedVector3D[theta, theta, theta];\n box.update;\n\n //--render\n box.render(1, 100); //1= exaggerate, 2= standard\n Pen.translate(width*0.5, height*0.5);\n Pen.strokeColor= Color.white;\n box.drawOutlines;\n Pen.fillColor= Color.white;\n box.draw;\n};\nw.play;\nCmdPeriod.doOnce({w.close});\n)\n```"}, {"role": "assistant", "content": "spinning box / cube after Shiffman https://codingtrain.github.io/website-archive/CodingChallenges/112-3d-rendering.html."}]} -{"conversations": [{"role": "user", "content": "What does `TraerAttraction.getStrength` do?"}, {"role": "assistant", "content": "Positive strength is attraction, negative strength is Returns: a LINKClasses/Float"}]} -{"conversations": [{"role": "user", "content": "What is `SOS` in SuperCollider?"}, {"role": "assistant", "content": "SOS — Second order filter section (biquad). A standard second order filter section. Filter coefficients are given directly rather than calculated for you. Formula is equivalent to: Category: UGens > Filters > Linear."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Benoit XVI (a SuperCollider snippet)?"}, {"role": "assistant", "content": "```supercollider\n// a supercollider port of Coloscope's Pure-data organ. \n\nSynthDef(\\benoit, {\n arg out=0, amp=0.5, freq=440, semione=12, semitwo=24, trackingmul=2, gate=1, sus=1, rel=1;\n var env, sig, sig1, sig2, sig3, ringmod, tracking, sig4;\n\n sig1 = Pulse.ar(freq, 0.17);\n sig2 = Pulse.ar((freq.cpsmidi - semione).midicps, 0.17);\n sig3 = Pulse.ar((freq.cpsmidi + semitwo).midicps, 0.17);\n\n sig4 = LFTri.ar((freq.cpsmidi - semitwo).midicps);\n\n env = EnvGen.ar(Env.linen(0,sus,rel), gate, doneAction:2);\n\n tracking = ((freq * 1) + freq) * trackingmul;\n sig = sig1 + sig2 + sig3 + (sig4 * 2);\n\n\n sig = RLPF.ar(sig, tracking, 1, 0.33);\n sig = FreeVerb.ar(sig, 0.12);\n sig = sig.tanh;\n sig = sig * env;\n\n\n Out.ar(out, (sig * amp));\n\n}).add;\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for aurora borealis?"}, {"role": "assistant", "content": "```supercollider\n(\n~root = -13;\n~revSend = Bus.audio(s, 2);\n);\n(\ns.waitForBoot(\n {\n \n SynthDef(\\bell, {\n |\n freq=556, findex=0, frate=2,\n dur=5, pos=0,\n amp=0.25,\n out=0\n |\n var sigA, sigB, sigC, sig, env, fmod;\n env = EnvGen.ar(Env.triangle(5), doneAction:2);\n fmod = findex * SinOsc.kr(frate, mul:0.5, add:0.5) * Line.kr(0, 1, 7);\n sigA = Pulse.ar(freq + fmod, LFNoise2.kr(1).range(0.2, 0.8) );\n sigB = VarSaw.ar(freq + fmod);\n sigC = WhiteNoise.ar() * 0.125;\n sig = SelectX.ar(LFNoise2.kr(2).range(0, 2), [sigA, sigB, sigC]);\n sig = LPF.ar(sig, freq*4 );\n sig = sig * env * amp;\n Out.ar(out, Pan2.ar(sig, pos));\n }).add;\n\n s.sync;\n\n SynthDef(\\rev, {\n arg in=0, out=0, mix=1, room=0.8;\n var sig;\n sig = In.ar(in, 2);\n sig = FreeVerb.ar(sig, mix, room);\n Out.ar(out, sig);\n }).add;\n\n s.sync;\n\n ~rev = Synth(\\rev, [\\in, ~revSend]);\n\n x = Pbind(\n \\instrument, \\bell,\n \\out, ~revSend,\n \\root, Pfunc({~root}),\n \\octave, Pwrand([4, 5, 6, 7], [6,8,3,1].normalizeSum, inf),\n \\degree, Prand(Scale.lydian.degrees, inf),\n \\ctranspose, Pwhite( -0.05, 0.05, inf),\n \\amp, 1.1 * Pexprand(0.001, 0.7) * (1/(Pkey(\\octave)+1)),\n \\findex, Pexprand(2, 20),\n \\frate, Pwhite(1, 25, inf),\n \\pos, Pwhite(-0.8, 0.8, inf),\n \\dur, Pwhite(0.1, 0.5),\n ).asEventStreamPlayer;\n x.play;\n\n wait(15);\n r = Routine({\n \"starting\".postln;\n loop({\n ~root = [-13, -1, 4, 7].choose;\n wait( 10.rrand(25) );\n });\n });\n r.play;\n});\n)\n```"}]} +{"conversations": [{"role": "user", "content": "I get 'index out of range' when playing a buffer."}, {"role": "assistant", "content": "A read position is past the end of the buffer. `PlayBuf` with a `startPos` in frames beyond `~buf.numFrames`, or a `BufRd`/`GrainBuf` whose phase goes above 1, produces this. For GrainBuf, pos is normalised 0..1, so pass `LFNoise1.kr(1).range(0, 1)` rather than a frame count; for PlayBuf, cap the position at `~buf.numFrames - 1`. If you just loaded the file, check `~buf.numFrames` — a failed read gives 0 frames and every position is out of range."}]} +{"conversations": [{"role": "user", "content": "What is a SynthDef?"}, {"role": "assistant", "content": "A SynthDef is a named, compiled server-side instrument: a UGen graph plus named controls. You build one with SynthDef(\\name, { |args| ... }).add, and then play instances with Synth(\\name)."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n//distortion creeps in under 200Hz\n{ DPW3Tri.ar(XLine.kr(2000, 20, 10)) }.play; \n\n//very fast sweeps can have transient distortion effects\n{ DPW3Tri.ar(MouseX.kr(200,12000,'exponential')) }.play;\n\n//compare:\n{LFTri.ar(MouseX.kr(200,12000,'exponential'))}.play\n\n\n//less efficient than LFTri\n{ Mix(DPW3Tri.ar(Array.rand(10,50,5000))*0.1) }.play;\n\n{ Mix(LFTri.ar(Array.rand(10,50,5000))*0.1) }.play;\n\n\n//triangle is integration of square wave; warning loud, not so kind \n{Int\n// …\n```"}, {"role": "assistant", "content": "distortion creeps in under 200Hz very fast sweeps can have transient distortion effects (DPW3Tri: Triangle via 3rd order differerentiated polynomial waveform)"}]} +{"conversations": [{"role": "user", "content": "What does `Patch.defName` do?"}, {"role": "assistant", "content": "Pairs an Instr with inputs that that will be passed to the Instr"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n Lag2.kr( // lag the modulator\n LFPulse.kr(4, 0, 0.5, 50, 400), // frequency modulator\n Line.kr(0, 1, 15) // modulate lag time\n ),\n 0, // phase\n 0.3 // sine amplitude\n )\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n Lag2.kr( // lag the modulator\n LFPulse.kr(4, 0, 0.5, 50, 400), // frequency modulator\n Line.kr(0, 1, 15) // modulate lag time\n ),\n 0, // phase\n 0.3 // sine amplitude\n )\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ArrayedCollection`."}, {"role": "assistant", "content": "```supercollider\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n pitches.size.do{ |i|\n {\n var freq = pitches[i].midicps;\n var env = Env.perc.ar(Done.freeSelf);\n SinOsc.ar(freq) * 0.1 * env\n }.play;\n 0.2.wait\n }\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `SynthiX` in SuperCollider briefly."}, {"role": "assistant", "content": "SynthiX — A patching matrix for Mx inspired by the EMS Synthi A Category: Mx."}]} +{"conversations": [{"role": "user", "content": "What does `CrossoverDistortion.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "class B/AB power amp distortion simulation Arguments: in — The input signal.; amp — Controls the point at which the output signal becomes linear.; smooth — Controls degree of smoothing of the crossover point.; mul — Output will be multiplied by this value.; add — This value will be added to the output.."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LatoocarfianN`."}, {"role": "assistant", "content": "```supercollider\n// randomly modulate all params\n(\n{ LatoocarfianN.ar(\n SampleRate.ir/4,\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5)\n) * 0.2 }.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `HoaBalance` in SuperCollider?"}, {"role": "assistant", "content": "HoaBalance — Higher Order Ambisonic (HOA) balance transformer Apply balance to a Higher Order Ambisonic signal (HOA). Category: Libraries > Ambisonic Toolkit > UGens > HOA > Transformer, UGens > Multichannel > Ambisonics."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Latch`."}, {"role": "assistant", "content": "```supercollider\n{ Blip.ar(Latch.ar(WhiteNoise.ar, Impulse.ar(9)) * 400 + 500, 4, 0.2) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Who are you?"}, {"role": "assistant", "content": "I am sc-mind, a 198M MiniMind-3-MoE trained from scratch on the SuperCollider source and help corpus. I write and explain SuperCollider: SynthDefs, UGens, Patterns, Ndef, the language/server split, and how to make sound that is not silence."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns.waitForBoot {\n // Open a plotTree window with a refresh rate of 2 seconds:\n s.plotTree(2);\n\n // Define and play a repeating pattern that generates a new synth every 0.5 seconds:\n x = Pn((dur: 0.5, midinote: 69, amp: 0.1)).play;\n\n /*\n Since the plotTree window refreshes every 2 seconds,\n displaying only the most recent node,\n the first node will appear after a 2-second delay (once four notes have played),\n meaning only every fourth synth node is visible.\n */\n\n 5.wait; // wait for 5 seconds.\n\n x.stop; // stop the playback of the pattern\n\n 2.wait; // wait for 2 seconds.\n\n s.nodeTreeV\n// …\n```"}, {"role": "assistant", "content": "Open a plotTree window with a refresh rate of 2 seconds: Define and play a repeating pattern that generates a new synth every 0.5 seconds: (Server: Object representing a server application)"}]} {"conversations": [{"role": "user", "content": "I get 'Message not understood' on a nil variable."}, {"role": "assistant", "content": "`~buffer` (or any variable) was never assigned, or it was assigned in a different environment. Environment variables are per-environment: a `~buf` set in one server-side file block is not visible in another. Check with `~buf.postln` before using it. The other common cause is an assignment that failed silently, e.g. `~buf = Buffer.read(...)` where the file was missing — the error is posted but ~buf stays nil."}]} -{"conversations": [{"role": "user", "content": "What does `WebView.onLoadStarted` do?"}, {"role": "assistant", "content": "Sets the object to be evaluated when a page load"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Psubdivide`."}, {"role": "assistant", "content": "```supercollider\n(\na = Psubdivide(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,4,4,0,4,4], inf),\n Pseq((80 + [0, 2, 3, 5, 7, 9, 10]).midicps, inf)\n);\nx = a.asStream;\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, x.next.postln]);\n 0.25.wait\n })\n}).play(TempoClock.default);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `MxInletApp.index` do?"}, {"role": "assistant", "content": "The integer index of this Returns: integer"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Interpolate between Envs with Pseg?"}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\sin, { arg out=0, gate=1, amp=0.1, pan=0, freq=200;\n var sig;\n sig = SinOsc.ar(freq);\n sig = sig * EnvGen.kr(\\adsr.kr(Env.adsr(0.1,0.1,0.8,0.1)), gate, doneAction:2);\n sig = Pan2.ar(sig, pan, amp);\n Out.ar(out, sig);\n}).add;\n);\n\n(\n// sequence Envs\n// need [] else it is inlined or does pattern multichannel expansion\nPdef(\\demo, \n Pbind(\n \\instrument, \\sin,\n \\degree, Pseq([0, Pwhite(0,7,1)],inf),\n \\legato, 0.5,\n \\adsr, Pseq([\n [ Env.adsr(1.1,0.1,0.8,1.01) ],\n [ Env.adsr(0.01,0.1,0.8,0.01) ],\n [ Env.adsr(0.01,1.1,0.3,0.01) ],\n ],inf),\n )\n).play;\n);\n\n(\n// interpolate using Pseg\n// need .asArray\nPdef(\\demo, \n Pbind(\n \\instrument, \\sin,\n \\degree, Pseq([0, Pwhite(0,7,1)],inf),\n \\legato, 0.5,\n \\adsr, Pseg(Pseq([\n [ Env.adsr(1.1,0.1,0.8,1.01).asArray ],\n [ Env.adsr(0.01,0.1,0.8,0.01).asArray ],\n [ Env.adsr(0.01,1.1,0.3,0.01).asArray ],\n ],inf),8),\n )\n).play;\n);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PV_BinScramble`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\nb = Buffer.read(s, ExampleFiles.child);\n\n(\n// trig with MouseY\nSynthDef(\"help-binScramble\", { |out = 0, soundBufnum = 2|\n var in, chain;\n in = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);\n chain = FFT(LocalBuf(2048), in);\n chain = PV_BinScramble(chain, MouseX.kr, 0.1, MouseY.kr > 0.5);\n Out.ar(out, 0.1 * IFFT(chain).dup);\n}).play(s, [\\soundBufnum, b]);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// For more SynthDefs and examples please head to: https://mycelialcordsblog.wordpress.com/ \n\n(\nSynthDef(\\hasherTest,\n{\narg rate = 1, freq = 60, index = 1000, tRate = 100,\nout = 0, fRate = 0.1;\n\nvar t_trig = LFPulse.kr(0.5/fRate, 0.5);\nvar random = LFNoise0.ar(rate, add:1);\nvar noise = Hasher.ar(random);\nvar sound = Saw.ar((freq+(noise*index)), Decay.kr(Impulse.kr(tRate), noise*0.001)).tanh;\nsound = Pan2.ar(sound, noise-0.3*2);\nFreeSelf.kr(t_trig);\nOut.ar(out, sound);\n}).store;\n);\n\n(\nPbind(\n\\instrument, \\hasherTest,\n\\dur, 5,\n\\rate, Pfuncn({100.rand}, inf),\n\\freq, Pfuncn({10000.rand}, inf),\n\\index, Pfuncn({20000.rand}, inf),\n\\tRate, Pfuncn({1000.rand}, inf),\n\\fRate, 5,\n).play;\n)\n```"}, {"role": "assistant", "content": "It is a simple SynthDef I made after having a look at Hasher UGen with a pattern to play it. It creates nice and varied glitch sounds."}]} -{"conversations": [{"role": "user", "content": "Explain `TExpRand` in SuperCollider briefly."}, {"role": "assistant", "content": "TExpRand — Triggered exponential random number generator. Generates a random float value in exponential distribution from `lo` to `hi` each time the trigger signal changes from nonpositive to positive values `lo` and `hi` must both have the same sign and be non-zero. Category: UGens > Random, UGens > Triggers."}]} -{"conversations": [{"role": "user", "content": "Resetting start count with PulseDivider?"}, {"role": "assistant", "content": "SuperCollider forum — Resetting start count with PulseDivider?\n\ni think in your example Sweep is receiving a trigger while going from 0 to 1 causing the discontinuity in the phase because the duration between one trigger and the next is unknown.\n\nwith this example you get at least a continiuous phase with random triggers to drive the hanning window (evaluate it several times). but its not multichannel with distributed phases / windows accross channels:\n\n```supercollider\n(\nvar randomTrigPhase = { |triggerRate = 10, randomness = 1|\n var minDuration = (2 ** randomness) / triggerRate;\n var maxDuration = (2 ** (-1 * randomness)) / triggerRate;\n var demand = Dunique(minDuration * ((maxDuration / minDuration) ** Dwhite(0, 1)));\n var duration = Duty.ar(demand, DC.ar(0), demand);\n var phase = Phasor.ar(DC.ar(0), (1 / duration) / SampleRate.ir, 0, 1);\n (phase: phase, trigger: HPZ1.ar(phase) < 0);\n};\n\nvar hanningWindow = { |phase|\n (1 - (phase * 2pi).cos) / 2 * (phase < 1);\n};\n\n{\n var rate = 100;\n var phase = randomTrigPhase.(rate, 1).phase;\n hanningWindow.(phase);\n}.plot(0.1);\n)\n```\n\nim not sure if this is helping it just reminded me of some issue with multichannel random triggers and continiuous phases i have been trying to solve."}]} -{"conversations": [{"role": "user", "content": "What does `SpecPcile.kr` do? What arguments does it take?"}, {"role": "assistant", "content": "Find a percentile of FFT magnitude spectrum Arguments: buffer — an FFT chain.; fraction; interpolate; binout."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for radio static with tuning noise (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"radiostatic\", {arg out=0;\n var hum, sineSweep, tuning, dustNoise, staticNoise, humFreq, numHarms;\n \n numHarms = 7;\n humFreq = 100;\n hum = Array.fill(numHarms, {|i| SinOsc.ar( (i+1) * humFreq, 0, 1/numHarms)});\n hum = hum.sum;\n dustNoise = Dust.ar(LFNoise1.ar(0.5).range(1000,8000));\n staticNoise = hum * dustNoise * LFNoise1.ar(1).range(0.5, 2);\n \n sineSweep = SinOsc.ar(LFNoise2.ar(1).range(20, 11000));\n tuning = SinOsc.ar(10000).ring4(sineSweep) * LFNoise2.ar(1.1).range(0.05, 0.1);\n\n Out.ar(out, Pan2.ar(staticNoise + tuning, 0));\n}).add;\n);\n \na = Synth(\"radiostatic\");\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BiPanB2`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var w, x, y, p, q, a, b, c, d;\n\n p = LFSaw.ar(200);\n q = LFSaw.ar(301);\n\n // B-format encode\n #w, x, y = BiPanB2.ar(p, q, MouseX.kr(-1, 1), 0.1);\n\n // B-format decode to quad\n #a, b, c, d = DecodeB2.ar(4, w, x, y);\n\n [a, b, d, c] // reorder to my speaker arrangement: Lf Rf Lr Rr\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes DelayPannerSawSine (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n//delaypannersawsine\n{XFade2.ar(AllpassC.ar(HPF.ar(RLPF.ar(Saw.ar(LFPar.kr(0.25).range(220,440)),LFPar.kr(MouseX.kr(0,8),pi).range(220,20000),0.3),LFPar.kr(MouseY.kr(0,8)).range(220,20000)),2,MouseX.kr(0,2),2),AllpassC.ar(HPF.ar(RLPF.ar(WhiteNoise.ar * Saw.ar(LFPar.kr(0.25).range(220,440)),LFPar.kr(MouseX.kr(0,8),pi).range(220,20000),0.3),LFPar.kr(MouseY.kr(0,8)).range(220,20000)),2,MouseY.kr(0,2),2),MouseX.kr(-1,1))}.play\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Pdefn`?"}, {"role": "assistant", "content": "Pdefn — non event stream reference definition"}, {"role": "user", "content": "What does `Pdefn.all` do?"}, {"role": "assistant", "content": "A global IdentityDictionary with all proxies."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\nPdefn(\\x, Pbrown(0, 6, 0.1, inf));\nPbind(\\note, Pdefn(\\x), \\dur, 0.3).play;\nPbind(\\note, Pdefn(\\x), \\dur, 0.1, \\ctranspose, 15).play;\n// now change the definition\nPdefn(\\x, Pseq([0, 3, 5, 7, 9, 11], inf));\nPdefn(\\x, Pseq([0, 3, 3, 7], inf) + Pseq([0, [0, 3], [0, 5, 7]], inf));\n```"}]} -{"conversations": [{"role": "user", "content": "Splay - not getting spread, wrong use?"}, {"role": "assistant", "content": "SuperCollider forum — Splay - not getting spread, wrong use?\n\nYou need to undestand that if you have two identical signal coming from left and right it will always be mono. No stereo spread possible. So you need to introduce (at least) two different signals - and just different amplification will not really work.\n\nTo expand your first example, we can introduce an array of values for paramtere pos:\n\n```supercollider\n(\nx = { arg spread=1, level=0.2, center=0.0;\n Splay.ar(\n GrainBuf.ar(numChannels: 1,\n trigger: Impulse.kr(1.2875),\n dur: Impulse.kr(1.2875),\n sndbuf: b,\n pos:[0,0.5],\n interp: 1\n ),\n spread,\n level,\n center\n );\n}.play;\n);\n\nx.set(\\spread, 1, \\center, 0); // full stereo\nx.set(\\spread, 0, \\center, 0); // mono center\n```\n\nBy way of Multichannel Expansion this creates two different signals (channels, an array of 2 UGen graphs) that you can hear as different and therefore observe the stereo spread.\n\nAnd similarly, to use your other example with In.ar where I have added in=2, so that it takes my mic in (but you can specify another bus) and wrapped it into a feedback delay with an array of two values for delayTime. Multichannel expansion thus creates two channels that are different because they have different delaytimes but the rest of UGen graph is the same (a copy). Changing spread now works:\n\n```supercollider\n(\nSynthDef(\\stereo,{|out=0, in=2, spread=1, level=1, center=0.0|\n Out.ar(out,\n Splay.ar(\n CombN.ar(\n In.ar(in, 1), 1, [0.3,0.4], 2)\n ,spread,level,center));\n}).play;\n)\n```\n\nI hope that clarifies the issue better."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for attempt at emulating a breathing sound."}, {"role": "assistant", "content": "```supercollider\n(\n//s.options.memSize_(64000);\nTempoClock.tempo_(1.0);\n\ns.waitForBoot({\n SynthDef(\\breathe_in, {\n | out = 0, gate = 1, in1=0.11, in2=0.63, in3=0.18, amdb= -10 |\n var menv = EnvGen.kr(Env.new([0,1,1,0],[in1, in2, in3], curve:'lin'),\n gate,\n doneAction:Done.freeSelf);\n var noise = WhiteNoise.ar(amdb.dbamp);\n var f1 = BPF.ar(in:noise, freq:5790, rq:0.1, mul:-29.dbamp);\n var f2 = BPF.ar(in:noise, freq:3400, rq:0.2, mul:-16.dbamp);\n var f3 = BPF.ar(in:noise, freq:1990, rq:0.1, mul:-23.dbamp);\n var f4 = BPF.ar(in:noise, freq:1250, rq:0.1, mul:-26.dbamp);\n Out.ar(out, menv*(f1+f2+f3+f4)!2);\n }).add;\n\n SynthDef(\\breathe_out, {\n | out = 0, gate=1, out1=0.343, out2=0.387, amdb= -4.33 |\n var menv = EnvGen.kr(Env.new([0, 1, 0], [out1,out2], curve:'lin'),\n gate,\n doneAction:Done.freeSelf);\n var noise = WhiteNoise.ar(amdb.dbamp);\n var f1 = BPF.ar(in:noise, freq:2290, rq:0.1, mul:-17.dbamp);\n var f2 = BPF.ar(in:noise, freq:1290, rq:0.1, mul:-19.dbamp);\n var f3 = BPF.ar(in:noise, freq:490, rq:0.1, mul:-18.dbamp);\n Out.ar(out, menv*(f1+f2+f3)!2);\n }).add;\n\n\n s.sync;\n\n fork {\n 50.do({\n var in1 = 0.11.rrand(0.22);\n var in2 = 0.6.rrand(0.8);\n var in3 = 0.16.rrand(0.30);\n var pausein = 0.11.rrand(0.20);\n var out1 = 0.30.rrand(0.50);\n var out2 = 0.36.rrand(0.50);\n var pauseout = 0.11.rrand(0.20);\n var amdb = -10.0.rrand(-14.0);\n var amdb2 = amdb/2.5;\n //(\"in1: \" ++ in1 ++ \" in2: \" ++ in2 ++ \" in3: \" ++ in3 ++ \" pausein: \" ++ pausein ++ \" out1: \" ++ out1 ++ \" out2: \" ++ out2 + \" pauseout: \" ++ pauseout).postln;\n Synth(\\breathe_in, [\\in1, in1, \\in2, in2, \\in3, in3, \\amdb, amdb]);\n (in1+in2+in3+pausein).wait;\n Synth(\\breathe_out, [\\out1, out1, \\out2, out2, \\amdb, amdb2]);\n (out1+out2+pauseout).wait;\n });\n };\n\n});\n);\n```"}]} -{"conversations": [{"role": "user", "content": "What is `NumberEditorGui` in SuperCollider?"}, {"role": "assistant", "content": "NumberEditorGui — gui class Category: Libraries > crucial > GuiClasses."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for tired pads."}, {"role": "assistant", "content": "```supercollider\n// this is what I write when I didn't sleep last night.. zzzzzz\n// easy subsynth with dynklank and simple scale\n\n(\n\nfork{ \n loop{\n var time;\n time = 5.rand;\n {\n var sound, freqs, envs, rings, numvoices, env;\n numvoices = 40;\n freqs = {(Scale.major(\\just).degrees+26+\n (0,12..110).choose).choose}.dup(numvoices).midicps;\n rings = {1.0.rand}.dup(numvoices);\n envs = { EnvGen.kr(Env.linen( time/3.0.rand, \n time/3.0.rand, time/3.0.rand, 1.0.rand ) ) }.dup(numvoices);\n \n sound = PinkNoise.ar(numvoices.reciprocal!2);\n sound = DynKlank.ar(`[freqs,envs,rings], sound );\n sound = sound * EnvGen.kr(Env.linen(time.rand,time/3,time.rand),doneAction:2);\n \n sound = HPF.ar(sound, 120);\n \n 4.do{sound = DelayC.ar(sound, 0.4, [0.4.rand,0.4.rand], 1/8, sound) };\n \n //good call - lets turn this down \n sound*0.2;\n }.play;\n time.rand.wait;\n }\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n// timing offset = 0\np = Pbind(\\freq, 440, \\pan, -1, \\delta, 1.0, \\sustain, 0.1).play(quant: [2, 0, 0]);\n// timing offest = 0.1\nq = Pbind(\\freq, 880, \\pan, 1, \\delta, 0.5, \\sustain, 0.1).play(quant: [2, 0, 0.1]);\n);\n\n// p's nextBeat is x.0 - q's is x.4 or x.9 (e.g., halves of a beat minus 0.1)\n[p.nextBeat, q.nextBeat]\n\np.stop; q.stop;\n```"}, {"role": "assistant", "content": "timing offest = 0.1 p's nextBeat is x.0 - q's is x.4 or x.9 (e.g., halves of a beat minus 0.1) (Quant: encapsulate quantization issues associated with EventStreamPlayer and TempoClock)"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for more tweets (pitchshift feedback + sinoscfb)?"}, {"role": "assistant", "content": "```supercollider\n// probably horrible for speakers... \n\n// glitchift\n{l=LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j**[l,k],k),[0.05,0.03],j);LocalOut.ar(s);s}.play;\n// drone\n{l=LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j**[2,2.1],k),[0.05,0.03],j);LocalOut.ar(s);s}.play;\n\n\n// few more I was mucking around with (remove tanh loop for < 140c)\n{l = LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j**l,k),[0.05,0.03],j);5.do{s=s.tanh+(s*0.1)};LocalOut.ar(s);s}.play;\n\n{l = LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j**2,k),[0.05,0.03],j);5.do{s=s.tanh+(s*0.1)};LocalOut.ar(s);s}.play;\n\n{l = LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j*20,k),[0.05,0.03],j);5.do{s=s.tanh+(s*0.1)};LocalOut.ar(s);s}.play;\n\n{l = LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j**j,k),[0.05,0.03],j);5.do{s=s.tanh+(s*0.1)};LocalOut.ar(s);s}.play;\n\n{l = LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j**l.abs,k),[0.05,0.03],j);5.do{s=s.tanh+(s*0.1)};LocalOut.ar(s);s}.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `AbstractSInstrument.arguments` do?"}, {"role": "assistant", "content": "a dictionary keeping track of the latest set"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nf = { |g = 0, h = 0, dur = 1|\n Pbind(\\degree, Pseq([g, g, h, g, h], 2), \\dur, Pseries(dur, 0.1))\n};\n// compare:\na = Pchain(PlazyEnvirN(f), (g: [1, 2], h: 3, dur: 0.2)).trace(\\degree).asStream;\nc = Pchain(Plazy(f), (g: [1, 2], h: 3, dur: 0.2)).asStream;\n);\n\na.nextN(4);\nc.nextN(4; // no degrees, because stream ends\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nf = { |g = 0, h = 0, dur = 1|\n Pbind(\\degree, Pseq([g, g, h, g, h], 2), \\dur, Pseries(dur, 0.1))\n};\n// compare:\na = Pchain(PlazyEnvirN(f), (g: [1, 2], h: 3, dur: 0.2)).trace(\\degree).asStream;\nc = Pchain(Plazy(f), (g: [1, 2], h: 3, dur: 0.2)).asStream;\n);\n\na.nextN(4);\nc.nextN(4); // no degrees, because stream ends\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes danger loud click."}, {"role": "assistant", "content": "```supercollider\n// proceed with caution. start at min volume, and not with your expensive speakers.\n\nfork{b=Buffer.alloc(s,512,1);inf.do{b.cheby({[1,0].choose}!2);{(Shaper.ar(b,SinOsc.ar(55,0,Line.kr(1,0,2,1,0,2))))!2}.play;0.1.wait;}};\n```"}]} -{"conversations": [{"role": "user", "content": "What does `MFCC.kr` do? What arguments does it take?"}, {"role": "assistant", "content": "Mel frequency cepstral coefficients Arguments: chain — [fft] Audio input to track, which has been pre-analysed by the FFT UGen; see examples below for the expected FFT size.; numcoeff — [s] Number of coefficients, defaults to 13, maximum of 42; more efficient to use less of course!. Returns: `#coeff1, coeff2, ...`"}]} -{"conversations": [{"role": "user", "content": "What does `Server.local` do?"}, {"role": "assistant", "content": "get/set the local server, stored in classvar `local` (created already on"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DecodeB2`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var w, x, y, p, a, b, c, d;\n\n p = PinkNoise.ar; // source\n\n // B-format encode\n #w, x, y = PanB2.ar(p, MouseX.kr(-1, 1), 0.1);\n\n // B-format decode to quad\n #a, b, c, d = DecodeB2.ar(4, w, x, y);\n\n [a, b, d, c] // reorder to my speaker arrangement: Lf Rf Lr Rr\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `ServerLog.tail` do?"}, {"role": "assistant", "content": "print all OSC messages to console as they are sent to server. like unix"}]} +{"conversations": [{"role": "user", "content": "What is `Event`?"}, {"role": "assistant", "content": "Event — an environment that represents an action"}, {"role": "user", "content": "What does `Event.parentEvents` do?"}, {"role": "assistant", "content": "An extendible IdentityDictionary of useful parent events."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na = (x: 6, y: 7, play: { (~x * ~y).postln });\na.play; // returns 6 * 7\n```"}]} +{"conversations": [{"role": "user", "content": "How does multi-channel expansion work?"}, {"role": "assistant", "content": "If any argument of a UGen is an Array, the UGen is built once per element and the results are returned as an Array. So `SinOsc.ar([220, 330, 440])` is three oscillators, and `SinOsc.ar(220 * [1, 1.5])` is two. This is not a special stereo feature: it is uniform expansion, which is why `Splay.ar(SinOsc.ar([220,330,440]) * 0.1)` gives you a spread stereo field from three mono sources."}]} +{"conversations": [{"role": "user", "content": "Explain `PV_BrickWall` in SuperCollider briefly."}, {"role": "assistant", "content": "PV_BrickWall — Zero bins. Clears bins above or below a cutoff point. Category: UGens > FFT."}]} +{"conversations": [{"role": "user", "content": "What does `View.globalKeyDownAction` do?"}, {"role": "assistant", "content": "A settable class variable containing an object (e.g. an instance of Function or FunctionList) which is evaluated (i.e. Object#-value#value method is called on it) whenever a key is pressed, independently of keyboard focus. See also #-addAction. When the action object is evaluated, it is passed the following arguments: view, char, modifiers, unicode, keycode,"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\nb = Buffer.new(s);\nb.allocRead(ExampleFiles.child);\nx = { PlayBuf.ar(1, b, BufRateScale.kr(b), loop: 1 * 0.5 }.play;\nx.free; b.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\nb = Buffer.new(s);\nb.allocRead(ExampleFiles.child);\nx = { PlayBuf.ar(1, b, BufRateScale.kr(b), loop: 1) * 0.5 }.play;\nx.free; b.free;\n```"}]} +{"conversations": [{"role": "user", "content": "I get 'syntax error, unexpected NAME' on a block that looks fine."}, {"role": "assistant", "content": "Almost always a missing semicolon between two statements — SuperCollider does not insert them.\n\n```supercollider\n// broken: two statements, no separator\n{ var sig = SinOsc.ar(440) sig = sig * 0.1; sig }.play\n```\n\n```supercollider\n// fixed\n{ var sig = SinOsc.ar(440); sig = sig * 0.1; sig }.play\n```\nThe error points at the second statement, not at the missing semicolon before it, which is why it looks\nfine. If it is not a semicolon, count the brackets: `.ar(` open, `)` closed."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// syntax can be more condensed with EventShortcuts, turn it on, post defaults\n\nEventShortcuts.on\n\nEventShortcuts.postCurrent\n\n\n(\nPLbindef(\\u,\n \\i, \\saw_grain,\n \\d, 0.2,\n \\m, Pwhite(60, 90)\n)\n);\n\n~u.play\n\n~u.d = 0.1\n\n\n~u.m = Pn(Plazy { Pseries(rrand(50, 70), 1.5, 20) })\n\n~u.m = ~u.m + [0, 4, 7]\n\n~u.i = PLseq([\\sin_grain, \\saw_grain])\n\n\n~u.a = Pn(Pseries(0.05, 0.01, 20))\n// …\n```"}, {"role": "assistant", "content": "syntax can be more condensed with EventShortcuts, turn it on, post defaults stop + cleanup in one (PLbindef: wrapper for Pbindef which allows replacement in object prototyping style)"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `RunningSum`."}, {"role": "assistant", "content": "```supercollider\n// distorts of course - would need scaling\n{ RunningSum.ar(SoundIn.ar) }.play\n\n// Running Average over x samples\n(\n{\n var x = 100;\n RunningSum.ar(LFSaw.ar, x) * (x.reciprocal)\n }.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Sieve.symdif_o` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new Sieve object in mode 'points' with offsets, generated by the symmetrical difference of sets Arguments: ... data — Alternating generators and integer offsets plus an optional integer limit, wrapped into a Ref, which is included when reached. Allowed generators: Integers, Streams or Patterns producing intervals or Sieves itself. Integers and Stream/Pattern output must be strictly positive. Integers as generators ."}]} +{"conversations": [{"role": "user", "content": "What is the difference between TempoClock and SystemClock?"}, {"role": "assistant", "content": "SystemClock runs in real time and is what `.wait` uses by default. TempoClock runs in beats and has a tempo, so it can be changed while things are playing and Patterns scheduled on it follow. `TempoClock.default` is the clock Patterns use unless told otherwise, which is why `TempoClock.default.tempo = 2` changes the speed of everything you already have running."}]} +{"conversations": [{"role": "user", "content": "What is `Bag`?"}, {"role": "assistant", "content": "Bag — Unordered collection of objects"}, {"role": "user", "content": "What does `Bag.new` do?"}, {"role": "assistant", "content": "Creates a Bag with an initial capacity for n objects."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nBag[1, 2, 3].add(4).postln;\n\nBag[1, 2, 3].add(3).postln;\n\nBag[\"abc\", \"def\", \"ghi\"].add(\"jkl\").postln;\n\nBag[\"abc\", \"def\", \"ghi\"].add(\"def\").postln;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// implicitly, the composition operator <> returns a Pchain when applied to a pattern.\n// so that a <> b creates a Pchain (a, b).\n// as seen above, in Pchain(a, b), a specifies (and overrides) b: b is the input to a.\n\n// the above example is equivalent to:\n\n(Pbind(\\degree, Pseq([1, 2, 3], inf)) <> (detune: [0, 4])).trace.play;\n\n(\na = Pbind(\\degree, Pseq([1, 2, 3], inf), \\dur, Prand([0.2, 0.4], inf));\nb = Pbind(\\detune, Pseq([-30, 0, [0, 40]], inf), \\dur, 0.1);\nc = b <> a;\nc.play; // see that the\n// …\n```"}, {"role": "assistant", "content": "implicitly, the composition operator <> returns a Pchain when applied to a pattern. so that a <> b creates a Pchain (a, b). (Pchain: pass values from stream to stream)"}]} +{"conversations": [{"role": "user", "content": "What does `Button.doAction` do? What arguments does it take?"}, {"role": "assistant", "content": "The method called by the primitive upon releasing the Arguments: modifiers — A key modifier number, which is passed to the action as its second argument upon mouse-releasing the button.."}]} +{"conversations": [{"role": "user", "content": "Why does every UGen have mul and add arguments?"}, {"role": "assistant", "content": "They are a convenience applied to the UGen's output: the result is `ugens_result * mul + add`. So `SinOsc.ar(440, 0, 0.2)` is the same as `SinOsc.ar(440) * 0.2`, and `SinOsc.ar(440, 0, 0.5, 1800)` is usable directly as a frequency. They exist because multiplying and offsetting is so common that folding it into the UGen saves a node in the graph and a line in the source."}]} +{"conversations": [{"role": "user", "content": "What does `Interface.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Sets up an environment in which you can build a player, a GUI and responders for midi and keyboard control Arguments: interfaceDef; args."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `FreqScopeView`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// Start server\ns.boot;\n\n// Create analyzer in a window\n(\nw = Window(\"My Analyzer\", Rect(0, 0, 511, 300)); // width should be 511\nf = FreqScopeView(w, w.view.bounds);\nf.active_(true); // turn it on the first time;\n\nw.onClose_({ f.kill }); // you must have this\nw.front;\n{ SinOsc.ar([500, 1000], 0, 0.25).mean.dup }.play(s); // start two sine waves\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I put reverb on everything?"}, {"role": "assistant", "content": "Send it: one private bus, one FreeVerb instance reading it, and every instrument writing dry to the master and wet to the bus.\n\n```supercollider\n~verb = Bus.audio(s, 2);\nSynthDef(\\verb, { |in = 0| Out.ar(0, FreeVerb.ar(In.ar(in, 2), 0.5, 0.85, 0.5) * 0.7) }).add;\nSynth(\\verb, [\\in, ~verb]);\n```"}, {"role": "user", "content": "Too much reverb now."}, {"role": "assistant", "content": "Lower the wet mix and the return level, not the room size: the room is what makes it sound like a space, the mix is how much of it you hear. `FreeVerb.ar(In.ar(in, 2), 0.25, 0.85, 0.5) * 0.5`. To change it live without restarting, add a control and `.set` it: `|mix = 0.5|` then `~verbSynth.set(\\mix, 0.25)`."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Stockmarket Sonification (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\dollar, { |out, freq = 440, amp = 0.1, pan = 0, sustain = 1.0|\n var env = EnvGen.kr(Env([amp, amp, 0], [sustain, 0.01]), doneAction: 2);\n var decay = freq ** -0.5 * 100;\n var string = CombL.ar(Decay2.ar(Impulse.ar(0), 0.0001, 0.001), 1/freq, 1/freq, decay);\n var damped = string; //LPF.ar(string, Line.kr(11000, 3000, decay));\n OffsetOut.ar(out, Pan2.ar(damped * env, pan));\n}).add;\n);\n\n(\nSynthDef(\\euro, { |out, freq = 440, amp = 0.1, pan = 0, sustain = 1.0|\n var env = EnvGen.kr(Env.perc(0.001, sustain), doneAction: 2);\n var decay = freq ** -0.5 * 100;\n var thing;\n freq = freq * (1..7).nthPrime;\n thing = SinOsc.ar(freq , 0, amp * AmpComp.kr(freq)).mean;\n OffsetOut.ar(out, Pan2.ar(thing * env, pan));\n}).add;\n);\n\n\n(\nPdef(\\stock, { |note = 0, sustain = 1|\n Pbind(\n \\instrument, [\\dollar, \\euro].choose,\n \\note, note.value + Pseq((12..0).curdle(0.1).scramble.flat * 3), \n \\dur, sustain.value / 12\n )\n})\n);\n\n(\nPdef(\\ett, \n Pbind(\n \\type, \\phrase,\n \\instrument, \\stock,\n \\dur, 4,\n \\legato, Prand((1..5), inf),\n \\note, Prand((0..12), inf) + Prand([[0, 2], [0, 6], [0, 7], 0, 0], inf)\n )\n).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LinCongL`."}, {"role": "assistant", "content": "```supercollider\n// randomly modulate params\n(\n{ LinCongL.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(0.1, 0.5, 1.4),\n LFNoise2.kr(0.1, 0.1, 0.1),\n LFNoise2.kr(0.1)\n) * 0.2 }.play(s);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `NAryOpFunction`."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nvar a = { 1.0.rand };\nvar b = a.linexp(0, 1, 40, 20000);\nfork {\n 15.do {\n (instrument: \\default, freq: b.value).play;\n 0.3.wait;\n }\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a filter sweep over a saw."}, {"role": "assistant", "content": "An LFO on the cutoff of a resonant low-pass; XLine or an LFO both work, the LFO is the loopable one.\n\n```supercollider\n{ LPF.ar(Saw.ar([60, 60.2]), SinOsc.kr(0.2).exprange(150, 4000), 0.4) * 0.2 }.play;\n```\n\n`.exprange` is the exponential mapping you want for frequency; a linear `.range` sweep sounds uneven."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n//Chaos engine hum\n(\n{\n SinOsc.ar(10 + (50 * SinOsc.kr([50, 51], 0, SinOsc.kr(101, Saw.kr(0.12345, 678, 9), 0.2, 0.8), Pulse.kr([25, 25.5], 0.25, 0.125, -0.25))), 0, 0.5, 0);\n}.play();\n)\n```"}, {"role": "assistant", "content": "A deep binaural cycle reminiscent of the engine of a space ship."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Recorder`."}, {"role": "assistant", "content": "```supercollider\nr = Recorder(s);\n{ GVerb.ar(Dust.ar(4)) }.play; // play on bus 64\nr.record(numChannels: 2);\nr.stopRecording;\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `In`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-InKr\", { |out = 0, in = 0|\n Out.ar(out,\n SinOsc.ar(In.kr(in, 1), 0, 0.1)\n )\n}).add;\nSynthDef(\"help-lfo\", { |out = 0|\n Out.kr(out, LFNoise1.kr(0.3, 200, 800))\n}).add;\n);\n\n\nb = Bus.control(s, 1);\nb.set(800);\n\nSynth(\"help-InKr\", [\\in, b.index]);\nb.set(400);\nb.set(300);\nSynth(\"help-lfo\", [\\out, b.index]);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a random pentatonic melody that plays by itself."}, {"role": "assistant", "content": "Pick degrees from a pentatonic scale; `\\scale` and `\\root` define the pitch space, and `\\degree`\npicks within it.\n\n```supercollider\n(\nPbind(\n \\instrument, \\default,\n \\scale, Scale.minorPentatonic,\n \\root, 3,\n \\degree, Pwhite(0, 9, inf),\n \\octave, 5,\n \\dur, Pwhite(0.12, 0.28, inf),\n \\amp, 0.2,\n \\legato, 0.8\n).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nSynthDef(\\madtraffic, {|out, sig, gate=1, freq=440|\n // doneAction: 2 rilascia la synth quando EvnGen ha finito\n sig = (Blip.ar(freq)*0.7+Blip.ar(freq/2+Rand(1,12))*0.7)\n*EnvGen.kr(Env.asr(0.1, 0.3, 0.3), gate, doneAction:2);\n sig = RLPF.ar(sig,SinOsc.kr(0.3, 0, 200, 1500), 0.1);\n sig = FreeVerb.ar(sig, 0.5, 0.5, 0.5);\n Out.ar(out, sig);\n\n}).add;\n);\n\n(\nPbind(\n \\instrument, \\madtraffic,\n \\freq, Pseq([137, 373, Prand([237, 473, 713],1)], inf),\n \\legato, Pseq([1.7, 0.3], inf),\n \\dur, 0.3,\n \\out, Pseq([1, 0], inf)\n).play;\n)\n```"}, {"role": "assistant", "content": "\"It's the lack of eye contact that makes us more idiots, to the point that convertible riders give less to escalation. Closed in the car, explain the psychologists, we regress to childhood and react by shouting, or with that surrogate of the shock that is the horn.\"\r\n\r\n\r\n\r\nhttp://bz-buzz.blogspot.com/2018/09/mad-traffic.html\r\n\r\nhttp://bzakirasantjago.blogspot.it/."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// example signal to process\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n z * 0.8\n}.play\n);\n\n(\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n [z, Limiter.ar(z, 0.4, 0.01)] * 0.5\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// example signal to process\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n z * 0.8\n}.play\n);\n\n(\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n [z, Limiter.ar(z, 0.4, 0.01)] * 0.5\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `OnePole`."}, {"role": "assistant", "content": "```supercollider\n{ OnePole.ar(WhiteNoise.ar(0.5), 0.95) }.play\n\n{ OnePole.ar(WhiteNoise.ar(0.5), -0.95) }.play\n\n{ OnePole.ar(WhiteNoise.ar(0.5), Line.kr(-0.99, 0.99, 10)) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `SampleRate`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// compares a 441 Hz sine tone derived from sample rate (44100 * 0.01, left)\n// with a 440 Hz tone (right), resulting in a 1 Hz beating\n(\n{\n var freq;\n freq = [SampleRate.ir * 0.01, 440];\n SinOsc.ar(freq, 0, 0.1)\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Wavetable.chebyFill` do? What arguments does it take?"}, {"role": "assistant", "content": "Fill a Wavetable of the given size with a sum of Chebyshev polynomials at the given amplitudes for use in waveshaping by the Shaper Arguments: size — must be a power of 2 plus 1, eventual wavetable is next power of two size up.; amplitudes — an Array of amplitudes for each Chebyshev polynomial beginning with order 1.; normalize — a Boolean indicating whether to normalize the resulting Wavetable. If the zeroOffset argument is true, the normalization is done for use as a transfer function, using Signal#-normalizeTransfer#normalizeTransfer, otherwise it just uses Signal#-normalize#normalize to make the absolute peak value 1. De; zeroOffset — a Boolean indicating whether to offset the middle of each polynomial to zero. If true, then a zero input will always result in a zero output when used as a Shaper##waveshaper. If false, then the \"raw\" (unshifted) Chebyshev polynomials are used. Default is false.."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `RecordBuf` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// Execute the following in order\n(\n// allocate a Buffer\ns = Server.local;\nb = Buffer.alloc(s, 44100 * 4.0, 1); // a four second 1 channel Buffer\n);\n\n// record for four seconds\n(\nSynthDef(\\help_RecordBuf, { |out = 0, bufnum = 0|\n var formant;\n formant = Formant.ar(XLine.kr(400, 1000, 4), 2000, 800, 0.125);\n RecordBuf.ar(formant, bufnum, doneAction: Done.freeSelf, loop: 0);\n}).play(s, [\\out, 0, \\bufnum, b]);\n);\n\n// play it back\n(\nSynthDef(\\help_RecordBuf_playback, { |out = 0, bufnum = 0|\n var playbuf;\n playbuf = PlayBuf.ar(1, bufnum);\n FreeSelfWhenDone.kr(playbuf); // frees the synth when the PlayBuf is finished\n Out.ar(out, playbuf);\n}).play(s, [\\out, 0, \\bufnum, b]);\n);\n\n// overdub\n(\nSynthDef(\\help_RecordBuf_overdub, { |out = 0, bufnum = 0|\n var formant;\n formant = Formant.ar(XLine.kr(200, 1000, 4), 2000, 800, 0.125);\n // mixes equally with existing data\n RecordBuf.ar(formant, bufnum, 0, 0.3, 0.5, doneAction: Done.freeSelf, loop: 0);\n}).play(s, [\\out, 0, \\bufnum, b]);\n);\n\n// play back the overdubbed version\nSynth.new(\\help_RecordBuf_playback, [\\out, 0, \\bufnum, b], s);\n\n// write the contents of the buffer to a file (see Buffer for more options)\n(\nb.write(sampleFormat: 'int16');\nthisProcess.platform.recordingsDir +/+ \"SC_\" ++ Date.localtime.stamp ++ \".aiff\"; // generated path\n);\n\nb.close; b.free; // cleanup\n```"}]} +{"conversations": [{"role": "user", "content": "What happens when I call .play on a function?"}, {"role": "assistant", "content": "`.play` on a Function builds a SynthDef from the function body, adds it to the server under an anonymous name, and starts one Synth of it. You get back the Synth, so `x = { SinOsc.ar(440) * 0.1 }.play; x.free;` stops it. It is the fastest way to hear something, but it is not how you write a piece: nothing is named, nothing can be reused, and the definition is lost when the Synth is freed."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// ===========================\n// extra demos for pluck\n// ===========================\n\n\n(\n// Made by Meha Gupta\n// Inspired by Happy by Julia Michaels\nPbindef(\\dmpluck,\n \\instrument, \"pluck\",\n \\midinote, Pseq([\n Pseq([\n [57, 69, 73, 76],\n [57, 69, 73, 76],\n [57, 71, 73, 80],\n [52, 78, 76, 80],\n [52, 78, 76, 80],\n [59, 71, 75],\n [59, 71, 75]], 2),\n 64]),\n \\amp, Pseq([0.2, 0.1, 0.2, 0.2, 0.1, 0.1, 0.1], inf) * 0.5,\n \\dur, Pseq([Pn(Pseq([0.25, 0.75, 1, 0.5, 0.5, 0.5, 0.5]), 2), 1]),\n \\decay, Pseq([1, 3, 3, 2, 2, 3, 3, 1, 3, 3, 2, 2, 3, 3, 4]),\n).play;\n)\n```"}, {"role": "assistant", "content": "=========================== extra demos for pluck ===========================."}]} +{"conversations": [{"role": "user", "content": "What does `PrettyPrintStream.storeArgs` do? What arguments does it take?"}, {"role": "assistant", "content": "a CollStream subclass that supports indenting with tabs Arguments: args; itemsPerLine."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Normalizer`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n// example signal to process\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n z * 0.8\n}.play\n);\n\n(\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n [z, Normalizer.ar(z, 0.4, 0.01)] * 0.5\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `InFeedback`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-InFeedback\", { |out = 0, in = 0|\n Out.ar(out,\n InFeedback.ar(in, 1)\n );\n}).add;\nSynthDef(\"help-SinOsc\", { |out = 0, freq = 440|\n Out.ar(out, SinOsc.ar(freq, 0, 0.1))\n}).add;\n);\n\nx = Bus.audio(s, 1);\n\n// read from bus n play to bus 0 (silent)\na = Synth(\"help-InFeedback\", [\\in, x.index, \\out, 0]);\n\n// now play a synth after this one, playing to bus x\nb = Synth.after(a, \"help-SinOsc\", [\\out, x.index]);\n\n// add another synth before a which also writes to bus x\n// now you can't hear b, as its data is one cycle old, and is overwritten by c\nc = Synth.before(a, \"help-SinOsc\", [\\out, x.index, \\freq, 800]);\n\n// free c and you can hear b again\nc.free;\nx.free;\n\na.free; b.free;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n {\n var freq;\n freq = Duty.kr(\n Dseq([0.2, 0.3, 0.4, Dseq([1, 1, 1, 2, 1, 2], inf)]) / 2,\n Dust.kr(1), // control rate reset\n Dseq([0, 1, 2, Dseq([1, 2, 3, 4, 5], inf)])\n ) * 30 + 250;\n SinOsc.ar(freq * [1, 1.01]) * 0.1\n\n }.play;\n);\n\n(\n {\n var freq;\n freq = Duty.kr(\n Dseq([0.2, 0.3, 0.4, Dseq([1, 1, 1, 2, 1, 2], inf)]) / 2,\n Dseq([1, 2, 4, 5], inf), // demand rate reset\n Dseq\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n {\n var freq;\n freq = Duty.kr(\n Dseq([0.2, 0.3, 0.4, Dseq([1, 1, 1, 2, 1, 2], inf)]) / 2,\n Dust.kr(1), // control rate reset\n Dseq([0, 1, 2, Dseq([1, 2, 3, 4, 5], inf)])\n ) * 30 + 250;\n SinOsc.ar(freq * [1, 1.01]) * 0.1\n\n }.play;\n);\n\n(\n {\n var freq;\n freq = Duty.kr(\n Dseq([0.2, 0.3, 0.4, Dseq([1, 1, 1, 2, 1, 2], inf)]) / 2,\n Dseq([1, 2, 4, 5], inf), // demand rate reset\n Dseq([0, 1, 2, Dseq([1, 2, 3, 4, 5], inf)])\n ) * 30 + 250;\n SinOsc.ar(freq * [1, 1.01]) * 0.1\n\n }.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Saving \"Presets\"?"}, {"role": "assistant", "content": "SuperCollider forum — Saving \"Presets\"?\n\nIf you don’t care too much about it being human readable, just use writeArchive and readArchive:\n\n```supercollider\na = Array.fill(400, {rrand(0,2200)});\n\na.writeArchive(\"/Users/spluta1/Documents/SC/test\");\n\nb = Object.readArchive(\"/Users/spluta1/Documents/SC/test\");\n\nb.postln;\n```\n\nSam"}]} +{"conversations": [{"role": "user", "content": "How do I add reverb with FreeVerb?"}, {"role": "assistant", "content": "`FreeVerb.ar(in, mix, room, damp)` — mix 0..1 is dry/wet, room 0..1 is the size (0.5 is a small room, 0.9 is a hall), damp 0..1 rolls off the high end of the tail. Put it after your sound: `FreeVerb.ar(SinOsc.ar(440) * 0.1, 0.4, 0.8, 0.5)`. For a send-style reverb, write the dry signal to Out.ar(0, …) and the same signal through FreeVerb to a second bus."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\delay;\n~description = \"Simple delay line\";\n~channelLayout = \\mono;\n~function = {|in = 0, del = 0.5|\n DelayC.ar(in, 2, del);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `StandardN`."}, {"role": "assistant", "content": "```supercollider\n// mouse-controlled param\n{ StandardN.ar(SampleRate.ir/2, MouseX.kr(0.9, 4)) * 0.3 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a kick drum in SuperCollider."}, {"role": "assistant", "content": "A pitch-swept sine with a fast decay: the frequency envelope is what makes it read as a kick.\n\n```supercollider\n(\nSynthDef(\\kick, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 50, 40], [0.03, 0.15], -4));\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -6), doneAction: 2);\n Out.ar(out, Pan2.ar(SinOsc.ar(pitch) * env * amp));\n}).add;\n);\nSynth(\\kick);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Simple animated 2D user interface. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// needs shared memory interface (SC 3.5+)\n\nServer.default = s = Server.local;\ns.waitForBoot{\n if (s.hasShmInterface) {\n w = Window().front;\n u = UserView(w, w.view.bounds);\n f = { |x, y|\n var size = 20 + (y/4);\n k = k.center_(Point(x, y));\n k = k.size_(Size(size, size));\n b.setSynchronous(x.linlin(0,u.bounds.width, 1/4, 16));\n c.setSynchronous(50*(y/4));\n };\n w.onClose = { Ndef(\\sound).end(1) };\n u.background = Color.blue(0.5);\n u.animate = true;\n k = Rect(100, 100, 50, 50);\n u.drawFunc = {\n var osc = Ndef(\\osc).bus.getSynchronous * 0.5 + 0.5;\n Pen.strokeColor = Color.blue;\n Pen.addOval(k);\n Pen.fillRadialGradient(\n k.center,\n k.center,\n k.width/8,\n k.width,\n Color(1,1,1,0),\n Color(1,0,0,osc)\n );\n };\n \n u.mouseMoveAction = { |u, x, y| f.(x, y) }; \n u.mouseDownAction = { |u, x, y| f.(x, y) }; \n \n b = Bus.control(s);\n c = Bus.control(s);\n b.setSynchronous(4);\n c.setSynchronous(500);\n \n Ndef(\\osc, { SinOsc.kr(b.kr) });\n Ndef(\\sound).fadeTime = 1;\n Ndef(\\sound, { MoogFF.ar(LFSaw.ar(50+[0,1]), Ndef(\\osc).kr.linexp(-1,1,50,c.kr)) }).play;\n } {\n \"get SC 3.5 or higher ;)\".warn;\n };\n};\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Tap.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Single tap into a delay line Arguments: bufnum — The index of the buffer to use; numChannels — Number of channels of the buffer; delaytime — Tap delay; cannot be modulated."}]} +{"conversations": [{"role": "user", "content": "What does `MIDIMKtlDevice.send` do? What arguments does it take?"}, {"role": "assistant", "content": "Send the value of the element to the MIDI device; called if you set the value of an MKtlElement that is an Arguments: key — The key of the element.; val — The value to which it is set.."}]} +{"conversations": [{"role": "user", "content": "What is `WhiteNoise` in SuperCollider?"}, {"role": "assistant", "content": "WhiteNoise — White noise. Generates noise whose spectrum has equal power at all frequencies. Category: UGens > Generators > Stochastic."}]} +{"conversations": [{"role": "user", "content": "What is `Main`?"}, {"role": "assistant", "content": "Main — The concrete instance of Process"}, {"role": "user", "content": "What does `Main.thisProcess` do?"}, {"role": "assistant", "content": "The singleton instance of Main is available through the special keyword thisProcess. For example, to find out what platform you're on: `thisProcess.platform; // --> e.g. \"an OSXPlatform\", \"a Linux`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nShutDown.add({ \"Good bye!!\".postln });\n```"}]} +{"conversations": [{"role": "user", "content": "What does `HistoryGui.postDoc` do?"}, {"role": "assistant", "content": "find the codeline at index in History, and post it on the"}]} +{"conversations": [{"role": "user", "content": "What does `SimpleNumber.cylBesselJ` do?"}, {"role": "assistant", "content": "Returns the result of the Bessel functions of the first kind. The functions return the result of `domain_error` whenever the result is undefined or complex. This occurs when `x < 0` and `v` is not an integer, or when `x == 0` and `v !="}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `NamedControl` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// compare this:\n(\na = {\n var x, y;\n x = NamedControl.kr(\\freq, 440).lag(3.5);\n y = NamedControl.kr(\\freq, 440).lag(1);\n SinOsc.ar([x, y] * [2, 1.2]) * 0.1\n}.play;\n);\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n\n// to this:\n(\na = {\n var x, y;\n x = Control.names([\\freq]).kr(440).lag(3.5);\n y = Control.names([\\freq]).kr(440).lag(1); // this hangs when set\n SinOsc.ar([x, y] * [2, 1.2]) * 0.1\n}.play;\n);\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `String` in SuperCollider briefly."}, {"role": "assistant", "content": "String — array of Chars String represents an array of Char##Chars. Category: Collections > Ordered."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for gabber kick (a SuperCollider snippet) that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\gabberkick, {\n var snd;\n snd = SinOsc.ar(Env([1000, 69, 60], [0.015, 0.1], \\exp).ar * [-0.1, 0, 0.1].midiratio);\n snd = Mix(snd);\n snd = (snd * 10).tanh;\n snd = (snd * 5.1).atan;\n snd = BPeakEQ.ar(snd, XLine.kr(2000, 100, 0.3), 2.0, 8);\n snd = snd + DelayC.ar(snd, 0.01, SinOsc.ar(4).range(0.0, 0.001));\n snd = RLPF.ar(snd, 8000, 0.7);\n snd = snd * Env([0, 1, 0.7, 0.7, 0], [0.001, 0.01, 0.3, 0.02]).ar(2);\n snd = (snd * 0.6).clip(-1, 1);\n Out.ar(\\out.kr(0), Pan2.ar(snd, \\pan.kr(0), \\amp.kr(0.1)));\n}).add;\n);\n\nSynth(\\gabberkick, [amp: 0.6])\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// straight usage as value pattern for midinotes\n\n(\n// lookBack determines number of items to loop, must start with 0 (no loop),\n// doSkip determines if loops should be completed or not with new lookBack values.\n\n// Passing both via Functions enables to set on the fly,\n// enable immediate loop change by setting doSkip to 1\n\n~lookBack = 0;\n~doSkip = true;\n\np = Pbind(\n \\dur, 1/5,\n \\midinote, PSloop(\n Prand((60..80), inf),\n bufSize: 10,\n lookBack: { ~lookBack },\n doSkip: { ~doSkip }\n )\n).play\n);\n\n// wait a bit to fill buffer\n// keep running, set loop lengths immediately\n\n~\n// …\n```"}, {"role": "assistant", "content": "straight usage as value pattern for midinotes lookBack determines number of items to loop, must start with 0 (no loop), (PSloop: Pattern to derive loops from a given Pattern)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// hear the difference, LinPan having a slight drop in the middle (yeah, it's subtle)...\n{ LinPan2.ar(SinOsc.ar(440), Line.kr(-1, 1, 5)) }.play;\n\n// ... whereas Pan2 is more smooth\n{ Pan2.ar(SinOsc.ar(440), Line.kr(-1, 1, 5)) }.play;\n\n// other examples\n{ LinPan2.ar(PinkNoise.ar(0.4), FSinOsc.kr(2)) }.play;\n\n{ LinPan2.ar(FSinOsc.ar(800, 0, 0.1), FSinOsc.kr(3) }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// hear the difference, LinPan having a slight drop in the middle (yeah, it's subtle)...\n{ LinPan2.ar(SinOsc.ar(440), Line.kr(-1, 1, 5)) }.play;\n\n// ... whereas Pan2 is more smooth\n{ Pan2.ar(SinOsc.ar(440), Line.kr(-1, 1, 5)) }.play;\n\n// other examples\n{ LinPan2.ar(PinkNoise.ar(0.4), FSinOsc.kr(2)) }.play;\n\n{ LinPan2.ar(FSinOsc.ar(800, 0, 0.1), FSinOsc.kr(3)) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\freq, Pseq([500, 600, 700]), \\instrument, \\sinegrain);\na = Pmulp(\\freq, Pseq([0.5, 0.9, 0.8], inf), a);\na.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\freq, Pseq([500, 600, 700]), \\instrument, \\sinegrain);\na = Pmulp(\\freq, Pseq([0.5, 0.9, 0.8], inf), a);\na.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `SGlissAmplitudes` in SuperCollider briefly."}, {"role": "assistant", "content": "SGlissAmplitudes — control SGliss amplitudes Amplitude control for LINKClasses/SGliss. Category: SInstruments."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LatoocarfianL`."}, {"role": "assistant", "content": "```supercollider\n// randomly modulate all params\n(\n{ LatoocarfianL.ar(\n SampleRate.ir/4,\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5)\n) * 0.2 }.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `QPalette.auto` do? What arguments does it take?"}, {"role": "assistant", "content": "Instantiates a new palette, with colors automatically derived from the given colors for 'button' and 'window' color roles. All colors are considered to be set (see Arguments: buttonColor — The Color assigned to the button role.; windowColor — The Color assigned to the window role.."}]} +{"conversations": [{"role": "user", "content": "What is `ParGroup` in SuperCollider?"}, {"role": "assistant", "content": "ParGroup — Client-side representation of a parallel group node on the server Parallel Groups are server-side node containers that work similar to Groups, but without ordering constraints for the contained nodes. This means that on parallel architectures the elements of a Parallel Group can be executed concurrently. Category: Server > Nodes, Server > Abstractions."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ClipNoise`."}, {"role": "assistant", "content": "```supercollider\n{ ClipNoise.ar(0.2) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LinPan2`."}, {"role": "assistant", "content": "```supercollider\n// hear the difference, LinPan having a slight drop in the middle (yeah, it's subtle)...\n{ LinPan2.ar(SinOsc.ar(440), Line.kr(-1, 1, 5)) }.play;\n\n// ... whereas Pan2 is more smooth\n{ Pan2.ar(SinOsc.ar(440), Line.kr(-1, 1, 5)) }.play;\n\n// other examples\n{ LinPan2.ar(PinkNoise.ar(0.4), FSinOsc.kr(2)) }.play;\n\n{ LinPan2.ar(FSinOsc.ar(800, 0, 0.1), FSinOsc.kr(3)) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `OscN` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// compare examples below with interpolating Osc examples.\n\n(\ns = Server.local;\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, false, true);\nb = Buffer.alloc(s, 512, 1);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum, 500, 0, 0.5)\n )\n}).play(s, [0, 0, 1, b.bufnum]);\n\n);\nb.free;\n\n\n\n(\n// noninterpolating - there are noticeable artifacts\n// modulate freq\n\ns = Server.local;\nb.sine1(1.0/[1, 2, 3, 4, 5, 6].squared, true, false, true);\nb = Buffer.alloc(s, 512, 1);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum, XLine.kr(2000, 200), 0, 0.5)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n\n);\nb.free;\n\n(\n// sounds very different than the Osc example\ns = Server.local;\nb = Buffer.alloc(s, 512, 1);\nb.sine1([1.0], true, true, true);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum,\n OscN.ar(bufnum,\n XLine.kr(1, 1000, 9),\n 0,\n 200,\n 800),\n 0,\n 0.25)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n\n);\nb.free;\n\n(\n// modulate phase\ns = Server.local;\nb = Buffer.alloc(s, 512, 1);\nb.sine1([1.0], true, true, true);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum,\n 800,\n OscN.ar(bufnum,\n XLine.kr(20, 8000, 10),\n 0,\n 2pi),\n 0.25)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n);\nb.free;\n\n\n(\n// change the buffer while its playing\ns = Server.local;\nb = Buffer.alloc(s, 4096, 1);\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, true, true);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum, [80, 80.2], 0, 0.2)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n);\n\n(\nRoutine({\n var n = 32;\n 50.do({\n b.sine1(Array.rand(n, 0, 1).cubed, true, true, true);\n 0.25.wait;\n });\n}).play;\n);\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for blaplop (a SuperCollider snippet) that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\bla, { arg out=0, amp=0.1, gate=1, pan=0, freq=200;\n var sig;\n var tab;\n tab = \\tab.kr(1 ! 15);\n sig = LFSaw.ar(freq * tab.abs);\n sig = sig.sum;\n sig = RLPF.ar(sig, Rand(10,freq*2) + 100 * SinOsc.ar(tab.abs).range(0.01,Rand(2,7)));\n sig = sig.sum;\n sig = sig / 100;\n sig = sig.tanh;\n sig = sig * EnvGen.ar(Env.adsr(0.01,0.1,0.8,0.1+ExpRand(0.001,0.2)),gate,doneAction:2);\n sig = Pan2.ar(sig, pan, amp);\n Out.ar(out, sig);\n}).add;\n);\n\n(\nPdef(\\plop, Pbind(\n \\instrument, \\bla,\n \\degree, Pstep(Pseq([\n Pseq([0,2,4],4),\n Pseq([0,12,6],4),\n Pseq([0,12,6]+7,1),\n ],inf), 1),\n \\octave, 3,\n \\tab, Pfunc {\n var tab;\n [\n //tab = { arg n; (n + 1.asFloat.rand + 1).tanh / (n.rand+1) } ! 15;\n tab = { arg n; (n + 2.asFloat.rand + 1) / (n+1) } ! 15;\n tab.postln;\n ]\n },\n \\dur, PdurStutter( Prand([1,2,4],inf), Pseq([1,2,3]/2,inf)),\n \\amp, 0.4\n)).play;\n);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `AbstractResponderFunc.dispatcher` do?"}, {"role": "assistant", "content": "et this object's dispatcher. This is the object which matches incoming messages with responder funcs. Instances can use custom dispatchers to support arbitrary matching Returns: An instance of an appropriate subclass of AbstractDispatcher. (The return type will depend on subclass.)"}]} +{"conversations": [{"role": "user", "content": "I get \"Message 'ar' not understood\". Why?"}, {"role": "assistant", "content": "You called a rate method on something that is not a UGen. `Env.ar(...)` and `Buffer.ar(...)` are the classic cases: Env is a language-side description and is played by `EnvGen.ar(env, ...)`; a Buffer is server memory and is played by `PlayBuf.ar` or `BufRd.ar`. The UGen is the thing with a rate method — if it is a description or a container, there is another UGen that consumes it."}]} +{"conversations": [{"role": "user", "content": "Explain `Volume` in SuperCollider briefly."}, {"role": "assistant", "content": "Volume — Model for the global volume of the synthesis server Internally used by Server. When volume value != 0 dB or muted, a server's volume object will create a synth for controlling the volume on the main outputs for the number of channels given. For shared use of this volume synth with remote clients on this server, volume has its own group with fixed nodeID 2, and the synth (when present) uses the fixed nodeID 3. Category: Server."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `RandID` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// start a noise patch and set the id of the generator\n(\nSynthDef(\"help-RandID\", { |out = 0, id = 1|\n RandID.ir(id);\n Out.ar(out,\n WhiteNoise.ar(0.05) + Dust2.ar(70)\n )\n}).add;\n);\n\n// reset the seed of my rgen at a variable rate\n(\nSynthDef(\"help-RandSeed\", { |seed = 1910, id = 1|\n RandID.kr(id);\n RandSeed.kr(Impulse.kr(FSinOsc.kr(0.2, 0, 10, 11)), seed);\n}).add;\n\n);\n\n// start two noise synths on left and right channel with a different randgen id\na = Synth(\"help-RandID\", [\\out, 0, \\id, 1]);\nb = Synth(\"help-RandID\", [\\out, 1, \\id, 2]);\n\n// reset the seed of randgen 1\nx = Synth(\"help-RandSeed\", [\\id, 1]);\n\n// change the target randgen to 2 (affects right channel)\nx.set(\\id, 2);\n```"}]} +{"conversations": [{"role": "user", "content": "What is `SynthDef`?"}, {"role": "assistant", "content": "SynthDef — Client-side representation of a synth definition"}, {"role": "user", "content": "What does `SynthDef.new` do?"}, {"role": "assistant", "content": "Create a SynthDef instance, evaluate the ugenGraphFunc and build the ugenGraph."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_notRand, { |out|\n Out.ar(out,\n SinOsc.ar(rrand(400, 800), 0, 0.2) * Line.kr(1, 0, 1, doneAction: Done.freeSelf)\n )\n}).add;\n);\na = Synth(\\help_notRand);\nb = Synth(\\help_notRand); // the same freq as a\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n// use input amplitude to control SinOsc frequency - use headphones to prevent feedback.\n{\n SinOsc.ar(\n Amplitude.kr(\n SoundIn.ar(0),\n 0.01,\n 0.01,\n 1200,\n 400\n ),\n 0, 0.3)\n}.play;\n)\n```"}, {"role": "assistant", "content": "use input amplitude to control SinOsc frequency - use headphones to prevent feedback. (Amplitude: Amplitude follower)"}]} +{"conversations": [{"role": "user", "content": "What does `NodeProxy.copyState` do? What arguments does it take?"}, {"role": "assistant", "content": "Copy the internal settings of one proxy into another. Old state is Arguments: proxy — The proxy whose internal state is copied.."}]} +{"conversations": [{"role": "user", "content": "What does `Object.perform` do?"}, {"role": "assistant", "content": "The selector argument must be a Symbol. Sends the method named by the selector with the given arguments to the receiver. If the first argument is an Array or List, this method behaves like `performMsg`. However, this usage is discouraged, and `performMsg` ought to be used"}]} {"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LinSelectX`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar(300),\n Pulse.ar(230)\n ];\n\n LinSelectX.ar(MouseX.kr(0, 1) * a.size, a) * 0.2\n}.play;\n);\n\n(\n{\n var a;\n a = [\n SinOsc.kr(0.25),\n LFSaw.kr(10),\n LFPulse.kr(0.3)\n ];\n\n SinOsc.ar(LinSelectX.kr(MouseX.kr(0, 1) * a.size, a) * 300 + 400) * 0.2\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Latch`."}, {"role": "assistant", "content": "```supercollider\n{ Blip.ar(Latch.ar(WhiteNoise.ar, Impulse.ar(9)) * 400 + 500, 4, 0.2) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// example signal to process\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n z * 0.8\n}.play\n);\n\n(\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n [z, Limiter.ar(z, 0.4, 0.01)] * 0.5\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// example signal to process\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n z * 0.8\n}.play\n);\n\n(\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n [z, Limiter.ar(z, 0.4, 0.01)] * 0.5\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for smooth arpeggio, updated envelope (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\bass, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.perc(0.2), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Object`?"}, {"role": "assistant", "content": "Object — abstract superclass of all objects"}, {"role": "user", "content": "What does `Object.readArchive` do?"}, {"role": "assistant", "content": "Read in an object from a text archive. `(`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// embedding an event\na = (z: 77);\nb = Pset(\\y, 8, a.streamArg(true)).asStream;\nc = Pset(\\y, 8, a.streamArg(false)).asStream;\nb.nextN(3, ()); // this ends\nc.nextN(3, ()); // this loops\n\n// embedding a pattern\na = Pbind(\\note, Pseq([1, 2]));\nb = Pset(\\y, 8, a.streamArg(true)).asStream;\nc = Pset(\\y, 8, a.streamArg(false)).asStream;\nb.nextN(3, ()); // this ends\nc.nextN(3, ()); // this ends, too\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nRoutine({ loop { Synth(\\kick); 0.5.wait } }).play;\n```"}, {"role": "assistant", "content": "It starts a kick every half second, forever.\n\nA Routine is a language-side coroutine: `.play` runs it on the clock, and `wait` suspends it until the next\nbeat without blocking anything else. Inside the `loop`, `Synth(\\kick)` creates a kick and `0.5.wait` waits\nhalf a beat on the current TempoClock — the tempo, not seconds, so changing the clock changes the rate.\nBecause the kick SynthDef frees itself with `doneAction: 2`, the loop can run for hours without leaking\nnodes."}]} -{"conversations": [{"role": "user", "content": "What does `RedMRCM.makeWindow` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a Window and draws. Mainly for Arguments: bounds — a Rect that define window size and position; background — a Color."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Just a lunch time tweet."}, {"role": "assistant", "content": "```supercollider\n{CombC.ar(Klang.ar(`[[100,101,1000,1001]],1,0)*0.1,0.33,LFTri.ar(0.1, 0, 0.1, 0.11)+LFTri.ar(0.17, 0, 0.1, 0.22),10)!2}.play;\n\n//Variation\n‎{CombC.ar(Klang.ar(`[[100,101,1000,1001]],1,0)*0.1,1.33,LFTri.ar(0.3, 0, 0.1, 0.71)+LFTri.ar(0.7, 0, 0.1, 0.52),10)!2}.play;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\nOpenObject.start;\nOpenObject.openProxies; // register all proxy classes\nn = NetAddr(\"127.0.0.1\", 57120); // loopback IP for this test\n\nPdef(\\xx, Pbind(\\dur, Pseries(0.2, 0.1, 6), \\note, Prand([0, 2, 3, 4, 8, 9], inf)));\nn.sendMsg(\"/oo\", \\Pdef_xx, \\play);\n\nNdef(\\zz, { |freq=20, numharm = 200| Blip.ar(freq * [1, 1.2], numharm) * 0.3 } );\nn.sendMsg(\"/oo\", \\Ndef_zz, \\play);\nn.sendMsg(\"/oo\", \\Ndef_zz,\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\nOpenObject.start;\nOpenObject.openProxies; // register all proxy classes\nn = NetAddr(\"127.0.0.1\", 57120); // loopback IP for this test\n\nPdef(\\xx, Pbind(\\dur, Pseries(0.2, 0.1, 6), \\note, Prand([0, 2, 3, 4, 8, 9], inf)));\nn.sendMsg(\"/oo\", \\Pdef_xx, \\play);\n\nNdef(\\zz, { |freq=20, numharm = 200| Blip.ar(freq * [1, 1.2], numharm) * 0.3 } );\nn.sendMsg(\"/oo\", \\Ndef_zz, \\play);\nn.sendMsg(\"/oo\", \\Ndef_zz, \\fadeTime_, 2);\nn.sendMsg(\"/oo\", \\Ndef_zz, \\xset, \\freq, rrand(17, 80), \\numharm, rrand(3, 100));\nn.sendMsg(\"/oo\", \\Ndef_zz, \\end);\n\np = ProxySpace.push(s);\np.publish(\\psp);\n\n~zz = { |freq=30, numharm = 200| Blip.ar(freq * [1, 1.2], numharm) * 0.3 };\nn.sendMsg(\"/oo\", \\psp_zz, \\play);\nn.sendMsg(\"/oo\", \\psp_zz, \\fadeTime_, 2);\nn.sendMsg(\"/oo\", \\psp_zz, \\xset, \\freq, exprand(20, 1000), \\numharm, rand(80, 500));\nn.sendMsg(\"/oo\", \\psp_zz, \\end, 3);\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Pdefn`."}, {"role": "assistant", "content": "```supercollider\nz = Pbind(\\degree, Pdefn(\\x, \\), \\dur, 0.25).play;\nPdefn(\\x, Pseq((0..5), inf)).condition_({ |val, i| i.postln % 6 == 0 });\nPdefn(\\x, Pseq((7..0), inf)).condition_({ |val, i| i.postln % 8 == 0 });\n\n\n// the above is equvalent to:\nPdefn(\\x, Pseq((7..0), inf)).count(8);\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// examples\n\np = ProxySpace.push(s.boot); // use ProxySpace as current environment.\n\n~out.play;\n\n~out = { SinOsc.ar([400, 407] * 0.9, 0, 0.2) };\n\n~out = { SinOsc.ar([400, 437] * 0.9, 0, 0.2) * LFPulse.kr([1, 1.3]) };\n\n~out = { SinOsc.ar([400, 437] * 0.9, 0, 0.2) * ~x.kr(2) };\n\n~x = { LFPulse.kr([1, 1.3] * MouseX.kr(1, 30, 1)) };\n\n~out = { SinOsc.ar([400, 437] * Lag.kr(0.1 + ~\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// examples\n\np = ProxySpace.push(s.boot); // use ProxySpace as current environment.\n\n~out.play;\n\n~out = { SinOsc.ar([400, 407] * 0.9, 0, 0.2) };\n\n~out = { SinOsc.ar([400, 437] * 0.9, 0, 0.2) * LFPulse.kr([1, 1.3]) };\n\n~out = { SinOsc.ar([400, 437] * 0.9, 0, 0.2) * ~x.kr(2) };\n\n~x = { LFPulse.kr([1, 1.3] * MouseX.kr(1, 30, 1)) };\n\n~out = { SinOsc.ar([400, 437] * Lag.kr(0.1 + ~x, 0.3), 0, 0.2) * ~x };\n\np.fadeTime = 5;\n\n~out = { SinOsc.ar([400, 437] * 1.1, 0, 0.2) * ~x.kr(2) };\n\np.clear(8); // end and clear all in 8 sec.\n\n\np.pop; // move out.\n```"}]} -{"conversations": [{"role": "user", "content": "What is the difference between a Synth and a SynthDef?"}, {"role": "assistant", "content": "A SynthDef is a definition: a compiled UGen graph with named controls, registered on the server once. A Synth is one running instance of that definition. You create the definition with `SynthDef(\\bell, { |freq = 440| ... }).add` and then instances with `Synth(\\bell, [\\freq, 660])`. Defining the same SynthDef twice replaces it for future instances; already running Synths keep the old graph until they are freed."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Simple example\ns = Server.local.boot; //Server.internal.boot;\nb = Buffer.alloc(s,2048,1);\n(\nx = {\nvar in, chain, powers, cutfreqs;\nin = LPF.ar(WhiteNoise.ar, MouseX.kr(10,10000, 1));\nchain = FFT(b.bufnum, in);\n\npowers = FFTSubbandPower.kr(chain, [100, 200, 400, 800, 1600, 3200, 6400, 12800]);\n\nOut.ar(0, in * 0.1);\npowers.collect{|pow, index| pow.poll(label: \"band\"+index)};\npowers.sum.poll(label: \"sum\");\nF\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Simple example\ns = Server.local.boot; //Server.internal.boot;\nb = Buffer.alloc(s,2048,1);\n(\nx = {\nvar in, chain, powers, cutfreqs;\nin = LPF.ar(WhiteNoise.ar, MouseX.kr(10,10000, 1));\nchain = FFT(b.bufnum, in);\n\npowers = FFTSubbandPower.kr(chain, [100, 200, 400, 800, 1600, 3200, 6400, 12800]);\n\nOut.ar(0, in * 0.1);\npowers.collect{|pow, index| pow.poll(label: \"band\"+index)};\npowers.sum.poll(label: \"sum\");\nFFTPower.kr(chain).poll(label: \"pow\");\n}.play(s);\n);\n\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Beam me up scotty."}, {"role": "assistant", "content": "```supercollider\n{\nvar time = 8;\nvar freq = (40-12).midicps;\nvar a = VarSaw.ar(freq/2, width: XLine.ar(0.5,1,time)).range(0,XLine.ar(1,1/1000,time));\nvar tone = SinOsc.ar(freq).fold(-1*a,a);\nOut.ar(0, tone.dup);\n}.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//multiple objects within a world with gravity force\n//color and size depends on object's mass\n\n(\nvar width= 300, height= 300, w, wgrav, world, n= 80;\n\n//--world\nw= RedWindow(\"vector test\", Rect(128, 64, width, height)).front;\nwgrav= RedVector2D[-0.1, 0.98]; //world xy gravity\nworld= RedWorld3(RedVector2D[width, height], wgrav, 20, 0.2); //dim,grav,maxvel,damp\n\n//--objects\n{\n var mass= 1.0.rrand(4); //random mass for each object\n RedObject(world, RedVector2D[width, 20].rand, 0, 0, mass, mass*5); //world,loc,vel,acc,mass,size\n}.dup(n);\n\n//--loop\nw.draw{\n world.objects.do{|o|\n o.addForce(world.gravity);\n o.update;\n world.contain(o);\n\n //--render\n Pen.strokeColor= Color.grey(o.mass/4);\n Pen.strokeRect(Rect.aboutRedObject2D(o));\n };\n};\nw.play;\nCmdPeriod.doOnce({w.close});\n)\n```"}, {"role": "assistant", "content": "multiple objects within a world with gravity force color and size depends on object's mass."}]} -{"conversations": [{"role": "user", "content": "Explain `ServerBoot` in SuperCollider briefly."}, {"role": "assistant", "content": "ServerBoot — register actions to be taken when a server has booted The singleton ServerBoot provides a place for registering functions and objects for events that should happen when a given server has booted. Category: Control."}]} -{"conversations": [{"role": "user", "content": "What does `DataBuffer.readAccel` do?"}, {"role": "assistant", "content": "read the accelerometer buffer and clear it. This should be called at regular intervals. Faster than the buffer is filling up (depends on sample Returns: a List of arrays with xyz values."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// augmentation of nonlinearity:\n// GFIS itself used as time-varying control of another GFIS\n\nb = Buffer.read(s, Platform.miSCellaneousDirs[0] +/+ \"Sounds\" +/+ \"kitchen_sounds_1.wav\");\n\n// load to array and fill new buffer for iteration\n\nb.loadToFloatArray(action: { |array| a = array; \"done\".postln });\n\nd = a[3150..3300].normalize;\n\nc = Buffer.loadCollection(s, d);\n\n\n(\ny = {\n var r = LFDNoise3.ar(3).range(2.7, 3.4);\n var add = GFIS.ar({ |x| sin(r * x) }, 0.5, 3\n// …\n```"}, {"role": "assistant", "content": "augmentation of nonlinearity: GFIS itself used as time-varying control of another GFIS (GFIS: generalized functional iteration synthesis pseudo ugen)"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Der Mussolini (bassline cover)?"}, {"role": "assistant", "content": "```supercollider\n/* An approach to try to reproduce the 'famous' bassline of \"Der Mussolini\" by D.A.F. */\n\n// very bad simulated analogue distorted bass synth\n// too distorted compared to the original...\n\nSynthDef(\\daf_bass,{ |out, freq=440, sustain=1, gate=1, amp=0.1|\n var snd, env, fenv, harm;\n harm = [1,1.01,2,2.02,3.5,4.01,5.501];\n harm = harm ++ (harm*2);\n snd = SinOsc.ar(freq*harm).sum.distort * 2;\n snd = snd + SinOsc.ar(freq / [1, 2]).sum!2;\n env = EnvGen.kr(Env.adsr(0.001,0.2,0.9,0.25), gate, amp, doneAction:2);\n snd = snd * env;\n OffsetOut.ar(out, (snd!2));\n}).add;\n\n// approx 63 bpm\nTempoClock.default.tempo = 63/60;\n\n// approx bass pattern + modulation of Mussolini bassline\nPdef(\\daf_bass,\n Pbind(\n \\instrument, \\daf_bass,\n \\scale, Scale.minor,\n \\octave, [3], // try out [2,3] or [3,4] for octave bass leetness\n \\ctranspose,Pseq([\n Pn(-1,16*4),\n Pn(1,16*2)\n ], inf),\n // -1 for thinking in musical degrees...\n \\degree, Pseq([1, 4, 1, 10, 1, 8, 1, 1, 8, 1, 8, 1, 8, 7, 1, 8]-1,inf),\n \\legato, Pwhite(0.75, 0.8),\n \\dur, 0.2\n )\n).play;\n\n// link: http://www.youtube.com/watch?v=15ScQivK5DY\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for smooth arpeggio, updated envelope (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\bass, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.perc(0.2), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `HasPatchIns.connectPatchIns` do?"}, {"role": "assistant", "content": "parent class for Players that have PatchIns such as Patch"}]} -{"conversations": [{"role": "user", "content": "What does `CXMenu.gui` do? What arguments does it take?"}, {"role": "assistant", "content": "a basic nav menu Arguments: parent; windowWidth; height; argButtonWidth."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `NamedControl`."}, {"role": "assistant", "content": "```supercollider\n// use NamedControl to create a number of multichannel controls:\n\na = { SinOsc.ar(NamedControl.kr(\\freq, [300, 330, 370], [1, 0.3, 0.02])).sum * 0.1 }.play;\na.setn(\\freq, [700, 705, 890]);\na.setn(\\freq, [0, 2, 5].midiratio * 400);\n\n// synonymous:\na = { SinOsc.ar(\\freq.kr([300, 330, 370], [1, 0.3, 0.02])).sum * 0.1 }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `WalshHadamard.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "decomposition into square waves, and reconstruction Arguments: input — Original signal to effect; which — Basis elements whose Indices are below this number will be zeroed. The default 0 means the identity transform, all basis elements will be used in the reconstruction.."}]} -{"conversations": [{"role": "user", "content": "Explain `SplineFr` in SuperCollider briefly."}, {"role": "assistant", "content": "SplineFr — Mx frame rate driven time domain spline for automation curves Mx supports Frame Rate Devices which are called at frame rate (24/beat by default). This object translates a spline into a of stream of time domain interpolated values for use as an automation control to be patched to other units. Category: Mx."}]} -{"conversations": [{"role": "user", "content": "What does `SCDoc.parseFilePartial` do? What arguments does it take?"}, {"role": "assistant", "content": "Parse a file without header, for merging of document Arguments: Full path to .ext.schelp file. Returns: An SCDocNode tree"}]} -{"conversations": [{"role": "user", "content": "What does `SequenceableCollection.rand` do?"}, {"role": "assistant", "content": "Fill a SequenceableCollection with random values in the range minVal to maxVal. `Array.rand(8, 1,"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a;\na = Pgeom(1.0, 1.1, inf);\na.asStream.nextN(100).plot;\n);\n\n\n// sound example\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\nvar a;\na = Pseries(300, 20, 70).asStream;\n{\n a.do { |val|\n Synth(\\help_sinegrain, [\\freq, val]);\n 0.02.wait;\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a;\na = Pgeom(1.0, 1.1, inf);\na.asStream.nextN(100).plot;\n);\n\n\n// sound example\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\nvar a;\na = Pseries(300, 20, 70).asStream;\n{\n a.do { |val|\n Synth(\\help_sinegrain, [\\freq, val]);\n 0.02.wait;\n }\n}.fork;\n);\n\n(\nPbind(\n \\dur, 0.01,\n \\instrument, \\help_sinegrain,\n \\freq, Pseries(800.0, Pbrown(-1.0, 3.0, 0.1, inf), inf)\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `SVF` in SuperCollider briefly."}, {"role": "assistant", "content": "SVF — 12db/Oct State Variable Filter Total, 100% Plastic... Category: UGens > Filters."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\smooth, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.linen(0.05, sustain, 0.1), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n)\n```"}, {"role": "assistant", "content": "plays an arpeggio on the \"left hand\" and an arpeggio on the \"right hand\"."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nx = { |freq = 440| SinOsc.ar(freq, 0, 0.3) }.play; // this returns a Synth object;\nx.set(\\freq, 880); // note you can set the freq argument\nx.defName; // the name of the resulting SynthDef\nx.release(4; // fadeout over 4 seconds\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nx = { |freq = 440| SinOsc.ar(freq, 0, 0.3) }.play; // this returns a Synth object;\nx.set(\\freq, 880); // note you can set the freq argument\nx.defName; // the name of the resulting SynthDef\nx.release(4); // fadeout over 4 seconds\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Gates (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\plop).put(0, { arg freq=200, rq=0.1, pan=0, amp=0.1;\n var sig;\n var sig1, sig2, sig3, sig4, sig5, sig6, sig7, sig8;\n sig1 = WhiteNoise.ar(1, 0);\n sig2 = LPF.ar(WhiteNoise.ar(1, 0), SinOsc.kr(1/16 * [1,2,3,4]/2).range(100,9001));\n sig3 = LFSaw.ar(( freq* [1/2,1,2,1] ).clip(20,15000)) * [1,4,1/2,2];\n sig1 = SelectX.ar(\\mixg.kr(0.5)*2, [sig1, sig2, sig3]);\n sig = Gate.ar(sig1, LFPulse.ar( SinOsc.kr(1/8 * [1,2,3,4].reverse/2).range(30,100), 0.5));\n sig = Gate.ar(sig, LFPulse.ar( freq ));\n sig = RLPF.ar(sig, ( freq * SinOsc.kr([1,2,3,4]/4).range(1,4) ).clip(20,15000), rq * [1,2,3,4]);\n sig1 = LFPulse.ar(freq * [1,1/2]) * [1,1/2];\n sig = SelectX.ar(\\mix.kr(0.8)*2, [sig, sig1 * sig, sig1]);\n sig1 = BPF.ar(sig, ( freq*2 ).clip(20,15000), rq) * 5;\n sig2 = BPF.ar(sig, freq, rq) * 5;\n sig3 = BPF.ar(sig, freq/2, rq) * 5;\n sig = SelectX.ar(\\mix2.kr(0.6) * 3, [sig, sig1, sig2, sig3]);\n sig = Pan2.ar(sig, LFNoise1.kr(1/2 * [1,2,3,4]).range(-1.0,1.0) * 0.3, amp).mean;\n}).play;\n\nSpec.add(\\mix, \\unipolar);\nSpec.add(\\mix2, \\unipolar);\nSpec.add(\\mixg, \\unipolar);\n);\n\nNdef(\\plop).edit;\n\nNdef(\\plop).unset(\\freq);\n\n(\n Ndef(\\plop).put(1, \\set -> Pbind(\n \\degree, Pseq([\n 0,3,2,3,\n 4,2,2,3,\n ],inf),\n \\octave, 4,\n \\dur, Pseq([1,2,4,1],inf)/4,\n )\n);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Band-limited hard sync oscillator."}, {"role": "assistant", "content": "```supercollider\n(\n~syncSaw = {\n arg syncFreq=440, sawFreq=440, maxRatio=20, minFreq = 10;\n var maxDelay = 1/minFreq;\n var n = floor(maxRatio);\n var b = LocalBuf(Server.default.sampleRate*maxDelay ,1).clear;\n var baseWaveform = Saw.ar(syncFreq);\n var sig = 0;\n n.do {\n arg i;\n var delay = i/sawFreq;\n var amplitude = (sawFreq/syncFreq-i) min: 1 max: 0;\n sig = sig + (BufDelayL.ar(b,baseWaveform,delay)*amplitude);\n };\n sig;\n};\n);\n\n(\n// test it\nplay {~syncSaw.(100,MouseX.kr.range(100,2000).lag)!2}\n);\n\n(\n// compare with aliased version\nplay {SyncSaw.ar(100,MouseX.kr.range(100,2000).lag)!2}\n);\n\n\n(\n// audio rate modulation of sawFreq results in a waveform that's not strictly\n// correct, but sounds good.\nplay {~syncSaw.(MouseY.kr(50,200),MouseX.kr.range(100,2000).lag+SinOsc.ar(20,mul:150))!2}\n// (audio rate modulation of syncFreq doesn't really work.)\n);\n\n(\n// aliased version of the above\nplay {SyncSaw.ar(MouseY.kr(50,200),MouseX.kr.range(100,2000).lag+SinOsc.ar(20,mul:150))!2}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for some pattern exprimenting."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\brumm, { |dur = 1, pan = 2, freq = 40, index = 20|\n var sig = Pan2.ar(\n Blip.ar(freq, index),\n pan\n ) * EnvGen.ar(Env.perc(0.01, dur), doneAction: 2);\n Out.ar(0, sig);\n}).add;\n);\n\n(\nPbind(*[\n dur: Pseq([1.2, 0.2, 0.5, Pseries(0.1, -0.001, 100)], inf),\n pan: Pxrand(#[-0.5, 0.5, 0.1, -0.1, 0.8, -1], inf),\n freq: 40,\n instrument: \\brumm\n]).play();\n);\n\n(\nPbind(*[\n dur: Pseq([1.2, 0.2, 0.5, Pseries(0.1, -0.001, 100)], inf),\n pan: Pxrand(#[-0.5, 0.5, 0.1, -0.1, 0.8, -1], inf),\n freq: Pseq([Pseries(140, 0.5, 200)], inf),\n instrument: \\brumm\n]).play;\n);\n\n(\nPbind(*[\n dur: Pseq(Signal.chebyFill(1024, Array.rand(10, 0.0, 10.0)).abs + 0.05, inf),\n pan: Pxrand(#[-0.5, 0.5, 0.1, -0.1, 0.8, -1], inf),\n freq: Pseq(Signal.chebyFill(1024, Array.rand(10, 0.0, 10.0)).abs * 18000 + 120, inf),\n instrument: \\brumm\n]).play;\n);\n\n\n(\nPbind(*[\n dur: Pseq([1.2, 0.2, 0.5, Pseries(0.1, -0.002, 50)], inf),\n pan: Pxrand(#[-0.5, 0.5, 0.1, -0.1, 0.8, -1, 1, -0.8], inf),\n freq: Pseq([Pseries(740, 0.5, 200), Pxrand(Array.series(740, 0.5, 200), 50)], inf),\n instrument: \\brumm\n]).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is the difference between an audio bus and a control bus?"}, {"role": "assistant", "content": "Both are numbered channels on the server used to move signal between nodes. An audio bus carries audio-rate signal and holds one or more audio channels; a control bus carries one value per block, like a parameter. You write with Out.ar / Out.kr and read with In.ar / In.kr, or with `.asMap` / `\\param, bus.asMap` to drive a Synth's control from a bus. Buses are how effects are chained: a synth writes to a private bus, the effect reads it and writes to Out.ar(0, …)."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n Instr(\\beatClockPlayerTest,{ arg gate=0.0;\n var a,t;\n\n t = gate;\n a = Decay2.kr(t,0.01,0.1).clip2(1.0);\n a * SinOsc.ar(300);\n },[\n \\gate\n ]);\n\n p=Patch.new(\\beatClockPlayerTest,\n [\n BeatClockPlayer(16) // trig / gate\n ]);\n\n p.play;\n;\n\nTempo.bpm = 10;\nTempo.bpm = 100;\n\np.stop;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n Instr(\\beatClockPlayerTest,{ arg gate=0.0;\n var a,t;\n\n t = gate;\n a = Decay2.kr(t,0.01,0.1).clip2(1.0);\n a * SinOsc.ar(300);\n },[\n \\gate\n ]);\n\n p=Patch.new(\\beatClockPlayerTest,\n [\n BeatClockPlayer(16) // trig / gate\n ]);\n\n p.play;\n);\n\nTempo.bpm = 10;\nTempo.bpm = 100;\n\np.stop;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// play SinOscs silently and wait for granulation envelopes\n\n(\na = Bus.audio(s, 10);\nx = { Splay.ar(In.ar(a, 10) * SinOsc.ar((3..12) * 100, 0, 0.05)) }.play\n);\n\n// send envelope to buses in parallel\n\n(\nz = {\n DXEnvFanOut.ar(\n [0, 3] + Dseq((0..3) + a.index, inf) + Diwhite(0, 3),\n \n // with newer SC versions you can also write:\n // [0, 3] + Dseq((0..3), inf) + Diwhite(0, 3) + a.index,\n \n fadeTime: 0.05,\n width: 1,\n initOutOffset: -0.5\n )\n// …\n```"}, {"role": "assistant", "content": "play SinOscs silently and wait for granulation envelopes send envelope to buses in parallel (DXEnvFanOut: sends crossfade envelopes to out buses according to demand-rate control)"}]} +{"conversations": [{"role": "user", "content": "What does `CoinGate.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Statistical gate. Arguments: prob — Value between 0.0 and 1.0 determines probability of either possibilities.; in — The trigger input.."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `HPF`."}, {"role": "assistant", "content": "```supercollider\n{ HPF.ar(Saw.ar(200, 0.1), FSinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3600, 4000), 5) }.play;\n\n(\n{ var ctl = HPF.kr(LFSaw.kr(5), SinOsc.kr(XLine.kr(0.07, 30, 20), 0, 35, 40)) ;\n SinOsc.ar(ctl * 200 + 500);\n}.play;\n);\n\n(\n{ var ctl = HPF.kr(LFSaw.kr(5, 0.1), MouseX.kr(2, 200, 1));\n SinOsc.ar(ctl * 200 + 400) * 0.1;\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `MxIOletsApp.out` do?"}, {"role": "assistant", "content": "usually returns the first outlet if there is one. This is a useful shorthand if you are working with objects that you dont know what name was used for the output, and you dont much care, you just want to connect the Returns: an MxInletApp or MxOuletApp"}]} +{"conversations": [{"role": "user", "content": "Explain `ObjectGui` in SuperCollider briefly."}, {"role": "assistant", "content": "ObjectGui — Controller class for MVC architecture, superclass for all XYZGui classes In the MVC architecture this is the Controller, which creates Views for manipulating the properties of your Model, and receives messages from the View and enacts the changes on the Model. Category: GUI."}]} +{"conversations": [{"role": "user", "content": "What does `MKtl.loadDescsMatching` do?"}, {"role": "assistant", "content": "load device description file(s) matching with name from indicated"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `CombL`."}, {"role": "assistant", "content": "```supercollider\n// These examples compare the variants, so that you can hear the difference in interpolation\n\n// Comb used as a resonator. The resonant fundamental is equal to\n// reciprocal of the delay time.\n{ CombN.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ CombL.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ CombC.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// with negative feedback:\n{ CombN.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ CombL.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ CombC.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n// used as an echo.\n{ CombL.ar(Decay.ar(Dust.ar(1, 0.5), 0.2, WhiteNoise.ar), 0.2, 0.2, 3) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for exploring of morphing cycled envelopes (i.e: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\ro_v19, {\n var freq = 40.rrand(90).debug('base freq');\n var seed = thisThread.randSeed = 1000000000.rand.debug('seed');\n var gen = [LFNoise2,LFNoise0,SinOsc,LFPulse,LFSaw];\n var sig = Splay.ar({\n var i = 4.exprand(40).asInteger;\n Median.ar(\n 3.exprand(18),\n EnvGen.ar(\n Env( // wave form\n [0] ++ Array.fill(i-1, { \n gen.choose.kr(\n 0.25.coin.if({ gen.choose.kr(0.01.exprand(0.1)).exprange(0.1,1) }, { 0.1.exprand(1) }), \n mul: 0.25.coin.if({ gen.choose.kr(0.05.exprand(10)).range(0.1,1) }, { 0.1.rrand(1) })\n )\n }) ++ [0],\n Array.rand(i-1, 0.1,1.0).normalizeSum,\n [[-5.0.rrand(5),\\sin].choose] ++ Array.fill(i-2, {\n [\\sin ! 1.rrand(6), -5.0.rrand(5) ! 1.rrand(4)].flat.choose\n }) ++ [[-5.0.rrand(5),\\sin].choose]\n ).circle,\n timeScale: Duty.kr( // freq\n Drand([4,8,16,24], inf), 0,\n Dwrand([1,2,4,8,16,32,64]*freq, ((14..7) ** 1.rrand(3)).normalizeSum, inf) // octave\n * 0.75.coin.if({ Duty.kr( // note\n [Dxrand, Drand].choose.new([0.125,0.25,0.5,1,2,4,6,8,12], inf), 0,\n Dshuf({ (0..11).choose.midiratio } ! 1.exprand(8), inf)\n ) }, { (0..11).choose.midiratio })\n ).reciprocal\n )\n ) * EnvGen.kr( // rhythm\n Env.perc(\n 0.01.exprand(0.4) * 0.25.coin.if({ Duty.kr( // atk\n Drand([0.5,1,2,4,8,12,16], inf), 0,\n Dshuf({ [1,2,3,4].choose } ! 1.exprand(8), inf)\n ) }, { 1 }),\n 0.1.exprand(4) * 0.75.coin.if({ Duty.kr( // release\n Drand([0.5,1,2,4,8,12,16], inf), 0,\n Dshuf({ [1,2,4,8,16].choose.reciprocal } ! 1.exprand(8), inf)\n ) }, { 1 }),\n LFNoise2.kr(0.1.exprand(10)).range(0.05,1), // appearance\n LFNoise2.kr(0.1.exprand(10)).range(-4,4),\n ).circle\n );\n } ! 3.rrand(9).debug('source'));\n BHiShelf.ar(\n GVerb.ar(\n Rotate2.ar(sig[0], sig[1], Duty.kr(Drand([2,4,8],inf), 0, Drand([-1,1,0],inf)) * LFSaw.kr(0.1.exprand(1))),\n 40.rrand(150).debug('room')\n ),\n LFNoise2.kr(0.1.exprand(0.5)).range(4000,6500),\n LFNoise2.kr(0.1.exprand(1)).range(1,3),\n LFNoise2.kr(0.1.exprand(1)).range(-24,-16)\n );\n}).play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `NdefGui`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\np = ProxySpace.push(s.boot);\n\nl = NdefGui(nil, 3).moveTo(10, 120);\nm = NdefGui(nil, 3).moveTo(10, 240);\nn = NdefGui(nil, 3).moveTo(10, 360);\no = NdefGui(nil, 3).moveTo(10, 480);\n\nSpec.add(\\dens, [0.1, 300, \\exp]);\n\n// make 3 kinds of proxies: using tilde/proxyspace, Ndef, and unnamed.\n~spacy = { |dens = 5| Formlet.ar(Dust.ar(dens ! 2), LFDNoise0.kr(20 ! 2).lag(0.1).linexp(-1, 1, 300, 5000), 0.003, 0.03) };\nNdef(\\ndeffy, { GrayNoise.ar(0.1 ! 2) });\nc = NodeProxy.audio.source_({ PinkNoise.ar(0.1 ! 2) });\n\n// put one in each editor\nl.object_(~spacy);\nm.object_(Ndef(\\ndeffy));\nn.object_(c);\n);\n// One should also be able to drag and drop text into the drag,\n// but this is also not working yet.\n( Ndef(\\a) )\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n \n// definition for future reference in arbitrary Environments\n\n(\np = Pbind(\n \\freq, Pn(PLgeom(\\start, \\grow, 50)) % 2000 + 400,\n \\dur, 0.1\n);\n);\n\n// prepare current Environment\n\n(\n~start = 100;\n~grow = 1.1;\n);\n\n\n// from ascending to random\n\nx = p.play;\n\n\n// replace\n\n~grow = 0.99;\n\n~grow = 1.4;\n\n\nx.stop;\n```"}, {"role": "assistant", "content": "definition for future reference in arbitrary Environments prepare current Environment (PLgeom: dynamic scope Pgeom variant)"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Normalizer`."}, {"role": "assistant", "content": "```supercollider\n(\n// example signal to process\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n z * 0.8\n}.play\n);\n\n(\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n [z, Normalizer.ar(z, 0.4, 0.01)] * 0.5\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is a SynthDef?"}, {"role": "assistant", "content": "A SynthDef is a named, compiled server-side instrument: a UGen graph plus named controls. You build one with SynthDef(\\name, { |args| ... }).add, and then play instances with Synth(\\name)."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `BufSampleRate`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n// compares a 1102.5 Hz sine tone (11025 * 0.1, left) with a 1100 Hz tone (right)\n// the apollo sample has a sample rate of 11.025 kHz\n(\n{\n var freq;\n freq = [BufSampleRate.kr(b) * 0.1, 1100];\n SinOsc.ar(freq, 0, 0.1)\n}.play;\n);\n\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `FBSineL`."}, {"role": "assistant", "content": "```supercollider\n// increase feedback\n{ FBSineL.ar(SampleRate.ir, 1, Line.kr(0.01, 4, 10), 1, 0.1) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `AbstractSController.free` do?"}, {"role": "assistant", "content": "free the internal synth and bus that was created for this controller"}]} +{"conversations": [{"role": "user", "content": "What is `DigitalIn` in SuperCollider?"}, {"role": "assistant", "content": "DigitalIn — Read data from a digital input Reads digital data from a digital sensor input (e.g.: a button or trigger input). Category: UGens > Bela."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Klank`."}, {"role": "assistant", "content": "```supercollider\n(\n{\nKlank.ar([ // the multichannel-expansion\n `[[500, 1078, 1201.5, 1723], nil, [1, 1, 0.5, 0.3]], // left channel\n `[[700, 1071, 1053, 1723], nil, [1, 1, 1, 1]] // right channel\n ], Impulse.ar([1.5, 1.875], 0, 0.1))\n}.play\n);\n\n// expanding specs within the parameter array\n{ Klank.ar(`[[[800, 6000], 1071, [1153, 8000], 1723], nil, [1, 1, 1, 1]], Impulse.ar([2, 3], 0, 0.1)) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Plambda` in SuperCollider?"}, {"role": "assistant", "content": "Plambda — create a scope (namespace) for enclosed streams Category: Streams-Patterns-Events > Patterns > Data Sharing."}]} +{"conversations": [{"role": "user", "content": "What does `SDrone.defName` do?"}, {"role": "assistant", "content": "a LINKClasses/Symbol used for the internal"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `HPZ2`."}, {"role": "assistant", "content": "```supercollider\n// Compare:\n\n{ WhiteNoise.ar(0.25) }.play;\n\n{ HPZ2.ar(WhiteNoise.ar(0.25)) }.play;\n\n// HPZ2 is useful to detect changes in a signal:\n// see also HPZ1\n(\n{\n var changingSignal = LFNoise0.ar(1000);\n var hpz2 = HPZ2.ar(changingSignal);\n [hpz2, hpz2 > 0]\n}.plot\n);\n```"}]} +{"conversations": [{"role": "user", "content": "How big are you?"}, {"role": "assistant", "content": "198M parameters in total, 64M active per token because the feed-forward layers are a mixture of four experts with top-1 routing. That is small enough to train in minutes on one GPU."}]} +{"conversations": [{"role": "user", "content": "What does `Window.bounds` do? What arguments does it take?"}, {"role": "assistant", "content": "The position and size of the window. The position is relative to the bottom-left corner of the Arguments: A Rect or a Point interpreted Point#-asRect#as Rect.. Returns: A Rect."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// Change MembraneCircle to MembraneHexagon for a different shaped\n// circular drum head\ns.boot;\ns.reboot;\n(\n{ var excitation = EnvGen.kr(Env.perc,\n MouseButton.kr(0, 1, 0),\n timeScale: 0.1, doneAction: 0\n ) * PinkNoise.ar(0.4);\n var tension = MouseX.kr(0.01, 0.1);\n var loss = MouseY.kr(0.999999, 0.999, 1);\n MembraneCircle.ar(excitation, tension, loss);\n}.play;\n)\n```"}, {"role": "assistant", "content": "Change MembraneCircle to MembraneHexagon for a different shaped circular drum head (MembraneCircle: Waveguide mesh physical models of drum membranes)"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `GrayNoise`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-GrayNoise\", { |out = 0|\n Out.ar(out,\n GrayNoise.ar(-20.dbamp)\n )\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `CXLabel` in SuperCollider briefly."}, {"role": "assistant", "content": "CXLabel — a simple convience class to create a label Category: Libraries > crucial > GUI."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n/* Audio plugin definition\n\n Each audio plugin should define the following global variables:\n ~name: (symbol) name of the spatializer\n ~description: (string) a short description\n ~function: the actual definition of the plugin\n\n*/\n\n~name = \\PinkSin;\n~description = \"Mix of pink noise and sine wave\";\n~channelLayout = \\mono;\n\n~function = {| sfreq = 200, amp = 1 |\n amp*(PinkNoise.ar() + FSinOsc.ar(sfreq))\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "What does `MultiSplineFr.guiClass` do?"}, {"role": "assistant", "content": "Multi dimensional spline frame rate device"}]} +{"conversations": [{"role": "user", "content": "What does `Method.ownerClass` do?"}, {"role": "assistant", "content": "Code that implements an operation upon instances of a Class. Returns: The Class for which the method is part of the implementation."}]} +{"conversations": [{"role": "user", "content": "I get 'Message not understood' on a nil variable."}, {"role": "assistant", "content": "`~buffer` (or any variable) was never assigned, or it was assigned in a different environment. Environment variables are per-environment: a `~buf` set in one server-side file block is not visible in another. Check with `~buf.postln` before using it. The other common cause is an assignment that failed silently, e.g. `~buf = Buffer.read(...)` where the file was missing — the error is posted but ~buf stays nil."}]} +{"conversations": [{"role": "user", "content": "Build a slowly evolving drone with Ndef."}, {"role": "assistant", "content": "Ndef gives you a named patch you can redefine while it plays; the filter is a separate node in the\nchain so you can change it on its own.\n\n```supercollider\n(\nNdef(\\drone, { |freq = 55, amp = 0.12|\n var detune = [0, 0.07, -0.11];\n var sig = Mix(Saw.ar(freq * (1 + detune))) * amp;\n LPF.ar(sig, 400);\n}).play;\n\nNdef(\\drone)[1] = \\filter -> { |in| RLPF.ar(in, LFNoise1.kr(0.1).exprange(200, 1800), 0.3) };\n)\n```\n\nRedefining Ndef(\\drone, { ... }) later crossfades to the new definition; Ndef(\\drone).stop stops it."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `PLbindef`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n// synthdefs to play with\n\n(\nSynthDef(\\noise_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, rq = 0.1, amp = 0.1|\n var sig = { WhiteNoise.ar } ! 2;\n sig = BPF.ar(sig, freq, rq) *\n EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2) *\n (rq ** -1) * (250 / (freq ** 0.8));\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\sin_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { SinOsc.ar(freq, Rand(0, 2pi)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\saw_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { VarSaw.ar(freq, Rand(0, 1)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n// Simple polling of mean values - you could do this without a UGen!\nx = {|val=1, t_trig=0| MeanTriggered.kr(val, t_trig, 3).poll(t_trig, \"Mean of recent 3 values\"); }.play;\nx.set(\\val, 10.rand.postln, \\t_trig, 1); // Execute this repeatedly\n\nx.free;\n\n// Using it as an audio filter - compare the sounds of these:\nx = {WhiteNoise.ar(0.1)}.play;\nx.free;\nx = {MeanTriggered.ar(WhiteNoise.ar(0.1), 1, 3)}.play; // Note that \".sum\" would be more efficient here...\nx.free;\nx = {MeanT\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n// Simple polling of mean values - you could do this without a UGen!\nx = {|val=1, t_trig=0| MeanTriggered.kr(val, t_trig, 3).poll(t_trig, \"Mean of recent 3 values\"); }.play;\nx.set(\\val, 10.rand.postln, \\t_trig, 1); // Execute this repeatedly\n\nx.free;\n\n// Using it as an audio filter - compare the sounds of these:\nx = {WhiteNoise.ar(0.1)}.play;\nx.free;\nx = {MeanTriggered.ar(WhiteNoise.ar(0.1), 1, 3)}.play; // Note that \".sum\" would be more efficient here...\nx.free;\nx = {MeanTriggered.ar(WhiteNoise.ar(0.1), 1, 11)}.play; // Note that \".sum\" would be more efficient here...\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What is the correct way to stop everything?"}, {"role": "assistant", "content": "Depends on what is playing, and they are different layers:\n\n- `s.freeAll` — frees every node on the server (all sound stops, definitions survive).\n- `CmdPeriod.run` — stops everything scheduled on the clocks (Patterns, Routines, Tasks).\n- `Ndef.clear; Pdef.clear` — clears the JITLib proxies.\n- `s.quit` — shuts the server down entirely.\n\nIn a session the habit is `CmdPeriod.run` first (stops the sequencing), then `s.freeAll` if a drone is still\nsounding."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `BufRd` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n// indexing with a phasor\n{ BufRd.ar(1, b, Phasor.ar(0, BufRateScale.kr(b), 0, BufFrames.kr(b))) }.play;\n\n// indexing by hand\n{ BufRd.ar(1, b, K2A.ar(MouseX.kr(0, BufFrames.kr(b)))) }.play;\n\nb.free\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n{Mix({|i|var j=Impulse,t=TChoose.kr(j.kr(1/8),[1,6,3]/8),r=Ringz.ar(j.ar(i*t+0.25),600*t*i+[0,9]);CombC.ar(r,1,0.5,4,0.1,r)}!4).tanh/4}.play\n```"}, {"role": "assistant", "content": "Hi colliders, this is my first post here, and also my very first sc tweet! \r\nIt's nothing special, just a little rhythmic Ringz thingy...\r\nAs a beginner, I found this really useful getting the hang of some syntax shortcuts:\r\nhttp://schemawound.com/post/25710867587/supercollider-tweets-background-tips."}]} +{"conversations": [{"role": "user", "content": "What does `Document.dir` do? What arguments does it take?"}, {"role": "assistant", "content": "Get/set the default document directory. The default is dependent on Arguments: path — The file system path to the directory. An instance of String.."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n~name = \\test_noise_burst;\n~description = \"A short burst of enveloped noise that goes well with Patterns\";\n~channelLayout = \\mono;\n\n~function = { arg amp=1, trimDB = 0, attack = 0.01, release = 0.3;\n var env;\n env = EnvGen.ar(Env.perc(attack, release, 0.5), doneAction: Done.freeSelf);\n trimDB.dbamp*amp*PinkNoise.ar(1);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LPZ2`."}, {"role": "assistant", "content": "```supercollider\n// Compare:\n\n{ WhiteNoise.ar(0.25) }.play;\n\n{ LPZ2.ar(WhiteNoise.ar(0.25)) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n{\n NLFiltN.ar(\n LFSaw.ar([120, 180], 0, mul:0.1),\n 0.5,\n -0.04,\n 0.8,\n 0.2,\n LFCub.kr(0.2, [0, 0.5 * pi], 63, 103)\n )\n}.play\n);\n\n(\n{\n NLFiltN.ar(\n LFSaw.ar(XLine.kr([60, 90], [360, 540], 20), 0, mul:0.1),\n 0.0,\n 0.0,\n 0.7,\n 0.4,\n LFCub.kr(0.2, [0, 0.5 * pi], 3, 9)\n )\n}.play\n);\n\n(\n// internal mirroring keeps it from blowing up and makes for some gross distortion\n// this is\n// …\n```"}, {"role": "assistant", "content": "internal mirroring keeps it from blowing up and makes for some gross distortion this is a little loud (NLFiltN: Non-linear Filter)"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Demand`."}, {"role": "assistant", "content": "```supercollider\n{\nvar a, b, t = Impulse.kr(2);\na = { Dseq([1, 2, 3, 4, 5], inf) } * 100;\nb = a + 1;\nDemand.kr(t, 0, [a, b]).poll(t)\n}.play\n```"}]} +{"conversations": [{"role": "user", "content": "What does `RedComb.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "comb delay line with crossfade Arguments: in — Input signal.; maxdelaytime; delaytime; decaytime; lagTime — Time for crossfade.; mul; add."}]} +{"conversations": [{"role": "user", "content": "What does `SoundFileView.setSelection` do? What arguments does it take?"}, {"role": "assistant", "content": "Sets the selection at Arguments: index — An Integer between 0 an 63.; selection — An Array of the form `[start, size]`, where start and size are Integers and denote frames.."}]} +{"conversations": [{"role": "user", "content": "What does `SimpleTrigger.instrArgFromControl` do? What arguments does it take?"}, {"role": "assistant", "content": "a player that emits a trigger on button push or .trig Arguments: control."}]} +{"conversations": [{"role": "user", "content": "What is `ParGroup`?"}, {"role": "assistant", "content": "ParGroup — Client-side representation of a parallel group node on the server"}, {"role": "user", "content": "What does `ParGroup.basicNew` do?"}, {"role": "assistant", "content": "Create and return a ParGroup object without creating a group node on the server. (This method is inherited from Node and is documented here only for convenience.)"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nfork {\n p = ParGroup.new;\n loop {\n (\n degree: rrand(0.0, 12.0).round(1/4),\n group: p,\n db: rrand(-30, -25),\n pan: rrand(-1.0, 1.0)\n ).play;\n 0.2.wait;\n }\n}\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Normalizer`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n// example signal to process\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n z * 0.8\n}.play\n);\n\n(\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n [z, Normalizer.ar(z, 0.4, 0.01)] * 0.5\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `VarGui`."}, {"role": "assistant", "content": "```supercollider\n// synth definition with raising frequency\n\n(\nSynthDef(\\synth_0, { |devFactor = 0.1, devFreq = 10, amp = 0.1|\n var freq = XLine.kr(400, 1200, 10); \n Out.ar(0, SinOsc.ar(SinOsc.ar(devFreq, 0, devFactor * freq, freq), mul: amp).dup(2) * EnvGate.new) \n}).add;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Splay` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\nx = { |spread = 1, level = 0.1, center = 0|\n var n = 20;\n var snd = Splay.ar(LFPulse.ar({ 100.exprand(2000) } ! n).range(-1, 1),\n spread, level, center);\n Peak.ar(snd, 0.01, 1).ampdb.poll(1);\n snd\n}.play;\n);\n\n// at full spread, level -20, pan to center:\n// peak is higher at -11 db\nx.set(\\spread, 1, \\center, 0);\n// with no spread, i.e. all panned center, slightly higher -10\nx.set(\\spread, 0, \\center, 0);\n// worst case: no spread, pan full left: -8db\nx.set(\\spread, 0, \\center, -1); // -8\n```"}]} +{"conversations": [{"role": "user", "content": "What is `TrigSpec` in SuperCollider?"}, {"role": "assistant", "content": "TrigSpec — datatype specifying a 'trig' rate input or output Category: Spec, Libraries > crucial > Spec."}]} +{"conversations": [{"role": "user", "content": "What is `Pbindf`?"}, {"role": "assistant", "content": "Pbindf — bind several value patterns to one existing event stream by binding keys to values"}, {"role": "user", "content": "What does `Pbindf.new` do?"}, {"role": "assistant", "content": "The arguments to Pbindf is the initial pattern followed by an alternating sequence of keys and patterns. A pattern can also be bound to an array of keys. In this case, the pattern must specify a sequence whose elements are arrays with at least as many elements as there are keys."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\na = Pbind(\\x, Pseq([1, 2, 3]), \\zzz, 9000); // input stream\nb = Pbindf(a, \\y, Prand([100, 300, 200], inf), \\zzz, 99);\nx = b.asStream;\n);\n\nx.next(()); // pass in an event ()\nx.next(());\nx.next(());\nx.next(()); // end: nil\n\n\n\n// sound examples\n\n// using the default synth def\na = Pbind(\\dur, 0.1);\nPbindf(a, \\freq, Prand([300, 500, 231.2, 399.2], inf)).play;\nPbindf(a, \\freq, Prand([1, 1.2, 2, 2.5, 3, 4], inf) * 200).play;\n\n\n(\n// a SynthDef\nSynthDef(\\test, { |out, freq = 440, amp = 0.1, nharms = 10, pan = 0, gate = 1|\n var audio = Blip.ar(freq, nharms, amp);\n var env = Linen.kr(gate, doneAction: Done.freeSelf);\n OffsetOut.ar(out, Pan2.ar(audio, pan, env));\n}).add;\n);\n\na = Pbind(\\instrument, \\test, \\dur, 0.1);\n\nPbindf(a, \\freq, Prand([1, 1.2, 2, 2.5, 3, 4], inf) * 200).play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Bus.index` do?"}, {"role": "assistant", "content": "Get the Bus' index. Normally you should not need to do this since instances of Bus can be passed directly as UGen inputs or Synth"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Gbman2DC.ar(MouseX.kr(20, SampleRate.ir*0.25), MouseX.kr(80, SampleRate.ir), 0.1) }.play(s);\n\n{ Gbman2DC.ar(11025, 22050, -0.7, -2.7, 0.1) }.play(s);\n\n{ Gbman2DC.ar(2200, 8800, 1.2, 2.0002, 0.1) }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Gbman2DC.ar(MouseX.kr(20, SampleRate.ir*0.25), MouseX.kr(80, SampleRate.ir), 0.1) }.play(s);\n\n{ Gbman2DC.ar(11025, 22050, -0.7, -2.7, 0.1) }.play(s);\n\n{ Gbman2DC.ar(2200, 8800, 1.2, 2.0002, 0.1) }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `BufCombN` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// These examples compare the variants, so that you can hear the difference in interpolation\n\n// allocate buffer\nb = Buffer.alloc(s, 44100, 1);\n\n// Comb used as a resonator. The resonant fundamental is equal to\n// reciprocal of the delay time.\n{ BufCombN.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ BufCombL.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ BufCombC.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// with negative feedback:\n{ BufCombN.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ BufCombL.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ BufCombC.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n// used as an echo.\n{ BufCombL.ar(b.bufnum, Decay.ar(Dust.ar(1, 0.5), 0.2, WhiteNoise.ar), 0.2, 3) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `AbstractFunction`."}, {"role": "assistant", "content": "```supercollider\na = { |x| #[440, 720, 801, 1020.2].at(x) }; b = a.cpsmidi; [a.value(3), b.value(3)];\na = Pseries(220, 220, inf).cpsmidi; a.asStream.nextN(12); // overtone series as midinotes\n// follow but round to next midinote\n{ a = Pitch.kr(SoundIn.ar).at(1); Pulse.ar(a.cpsmidi.round.midicps) * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LPF`."}, {"role": "assistant", "content": "```supercollider\n{ LPF.ar(Saw.ar(200, 0.1), SinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3600, 4000)) }.play;\n\n// kr:\n(\n{ var ctl = LPF.kr(LFPulse.kr(8), SinOsc.kr(XLine.kr(1, 30, 5)) + 2);\n SinOsc.ar(ctl * 200 + 400)\n}.play;\n);\n\n(\n{ var ctl = LPF.kr(LFPulse.kr(8), MouseX.kr(2, 50, 1));\n SinOsc.ar(ctl * 200 + 400)\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Pnsym`?"}, {"role": "assistant", "content": "Pnsym — use a pattern of symbols to embed Pdefns"}, {"role": "user", "content": "What does `Pnsym.dict` do?"}, {"role": "assistant", "content": "set the dictionary to be used."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\n// load a synthdef\ns.boot;\nSynthDef(\"gpdef\",\n { |out = 0, freq = 440, sustain = 0.05, amp = 0.1, pan|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain), doneAction: Done.freeSelf) * amp;\n Out.ar(out, Pan2.ar(SinOsc.ar(freq, 0, env), pan))\n }).add;\n);\n\nPdefn(\\x, Pn(1, 3));\nPdefn(\\y, Prand([5, 9, 1], 2));\nPdefn(\\z, Pdefn(\\y) * 2);\n\n(\nPdef(\\play,\n Pbind(\n \\instrument, \\gpdef,\n \\harmonic, Pnsym(Pseq([\\x, \\x, Prand([\\x, \\y]), [\\z, \\y], \\y], inf)).trace,\n \\dur, 0.2, \\note, 10\n )\n).play;\n);\n\n// change root pattern:\nPdefn(\\x, Pn(2, 3));\nPdefn(\\x, Pseq([1, 3, 1, 2, 1, 4, 5]));\nPdefn(\\x, Pseq([1, 3, 1, 2, [1, 3], 4, 5]));\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n \n// definition for future reference in arbitrary Environments\n\np = PLmeanrand(\\lo, \\hi);\n\n\n// prepare current Environment\n// PLseq repeats arg defaults to inf\n\n(\n~lo = PLseq((60, 60.25..70));\n~hi = PLseq((70, 69.75..60));\n);\n\n\n// run\n\n(\nx = Pbind(\n \\midinote, Ptuple([p, 65]), \n \\amp, [0.1, 0.06], \n \\dur, 0.1\n).play;\n);\n\n\n// replace\n\n(\n~lo = 60.5;\n~hi = 61;\n);\n\nx.st\n// …\n```"}, {"role": "assistant", "content": "definition for future reference in arbitrary Environments prepare current Environment (PLmeanrand: dynamic scope Pmeanrand variant)"}]} +{"conversations": [{"role": "user", "content": "What does `MxUnitApp.copy` do? What arguments does it take?"}, {"role": "assistant", "content": "Copies the unit to a specific point, overwriting anything that might be Arguments: toPoint — destination point. Returns: new unit"}]} +{"conversations": [{"role": "user", "content": "What is `Condition`?"}, {"role": "assistant", "content": "Condition — Block the execution of a thread"}, {"role": "user", "content": "What does `Condition.new` do?"}, {"role": "assistant", "content": "Create a new instance, set the test variable."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nc = Condition.new(false);\n\nRoutine {\n 1.wait;\n \"waited for 1 second\".postln;\n 1.wait;\n \"waited for another second, now waiting for you ... \".postln;\n c.wait;\n \"the condition has stopped waiting.\".postln;\n 1.wait;\n \"waited for another second\".postln;\n \"waiting for you ... \".postln;\n c.test = false;\n c.wait;\n \"the condition has stopped waiting.\".postln;\n 1.wait;\n \"the end\".postln;\n}.play;\n);\n\n// continue\n(\nc.test = true;\nc.signal;\n);\n\n// a typical use is a routine that can pause under certain conditions:\n(\nc = Condition.new;\nfork { loop { 1.wait; \"going\".postln; c.wait } };\n);\nc.test = true; c.signal;\nc.test = false;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `UserView.drawFunc` do? What arguments does it take?"}, {"role": "assistant", "content": "Sets the Function to evaluate whenever the view is asked to redraw itself. This may be, for example, due to being hidden and shown again, being resized, another view moving on top of it, or after the View#-refresh method has been called. Within that Function you are allowed to use the Pen class to draw within the bounds of the view. All the coordinates given to the methods of Pen are relative to the top-left corner of the view. Usage of Pen is not allowed outside of that Arguments: A Function.."}]} +{"conversations": [{"role": "user", "content": "I get 'server not running' or nothing happens at all."}, {"role": "assistant", "content": "The server is not booted. In the IDE press Ctrl+B, or evaluate `s.boot`. If code depends on a SynthDef being there, put it inside `s.waitForBoot { ... }`. When a script runs headless you can do `s.boot; s.sync;` and continue. `s.serverRunning` tells you the truth; if it is false, look at the post window for the boot error (usually an audio device problem)."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `FoldIndex`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// indexing into a table\n(\n{\n var buf = LocalBuf.newFrom([200, 300, 400, 500, 600, 800]);\n var freq = FoldIndex.kr(buf, MouseX.kr(0, BufFrames.ir(buf) * 3));\n SinOsc.ar(freq) * 0.1\n}.play;\n);\n\n// the same using a global buffer\n(\nt = [200, 300, 400, 500, 600, 800];\nb = Buffer(s, t.size, 1);\n\n// alloc and set the values\ns.listSendMsg(b.allocMsg(b.setnMsg(0, t)).postln);\n\nSynthDef(\\help_Index, { |out = 0, bufnum = 0|\n Out.ar(out,\n SinOsc.ar(\n FoldIndex.kr(\n bufnum,\n MouseX.kr(0, BufFrames.ir(bufnum) * 3)\n ),\n 0,\n 0.5\n )\n )\n}).play(s, [\\bufnum, b.bufnum]);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `MxQuery.disconnect` do?"}, {"role": "assistant", "content": "Disconnect all matched items. Outlets and inlets disconnect all cables. Units disconnect all of their"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\nz = {\n BHiPass4.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(10, 20000, \\exponential), // cutoff freq.\n MouseY.kr(0.1, 1.0, \\linear), // rq\n 0.5); // mul\n}.play\nz.release;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\nz = {\n BHiPass4.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(10, 20000, \\exponential), // cutoff freq.\n MouseY.kr(0.1, 1.0, \\linear), // rq\n 0.5); // mul\n}.play)\nz.release;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n var gspring;\n gspring = { |freq|\n var delay, sinc, env, line, impul;\n\n delay = freq.reciprocal;\n impul = Impulse.ar(0);\n env = Env.perc(0.001, 0.01).ar;\n line = Line.ar(1000, 50, 0.01 );\n sinc = SinOsc.ar(line);\n\n Pluck.ar( sinc * env, impul, delay, delay, 5, 0.5);\n };\n\n\nSynthDef.new('eguitar',\n { arg amp=1, freq=150, out_bus=0, pan=0;\n\n var snd;\n\n snd = gspring.value(freq-50) +\n gspring.value(freq) +\n gspring.value(freq+50);\n\n snd = (snd * 32.dbamp).tanh;\n snd = RLPF.ar(snd, 2800+freq, 0.5);\n snd = (snd * 32.dbamp).tanh;\n snd = RLPF.ar(snd, 300+freq, 0.5);\n snd = (snd * 32.dbamp).tanh;\n\n snd * -20.dbamp;\n\n Out.ar(out_bus, snd );\n}).add\n);\n\nSynth('eguitar', [freq: 360]);\n```"}, {"role": "assistant", "content": "just a very limited attempt for reference purpose of a hoped for eguitar synth ´\r\nbased on https://sccode.org/1-5aC#c982."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Blip`."}, {"role": "assistant", "content": "```supercollider\n// modulate frequency\n{ Blip.ar(XLine.kr(20000, 200, 6), 100, 0.2) }.play;\n\n// modulate numharmonics\n{ Blip.ar(200, Line.kr(1, 100, 20), 0.2) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `UserView.background` do? What arguments does it take?"}, {"role": "assistant", "content": "Sets the color used to fill the whole area occupied by the view below the drawing done in #-drawFunc. You can set the background at any moment, even within the `drawFunc`, but any drawing done in that Function will always be displayed on top of the Arguments: A Color.."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Splay` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\nx = { |spread = 1, level = 0.1, center = 0|\n var n = 20;\n var snd = Splay.ar(LFPulse.ar({ 100.exprand(2000) } ! n).range(-1, 1),\n spread, level, center);\n Peak.ar(snd, 0.01, 1).ampdb.poll(1);\n snd\n}.play;\n);\n\n// at full spread, level -20, pan to center:\n// peak is higher at -11 db\nx.set(\\spread, 1, \\center, 0);\n// with no spread, i.e. all panned center, slightly higher -10\nx.set(\\spread, 0, \\center, 0);\n// worst case: no spread, pan full left: -8db\nx.set(\\spread, 0, \\center, -1); // -8\n```"}]} +{"conversations": [{"role": "user", "content": "What is the difference between the language and the server?"}, {"role": "assistant", "content": "sclang runs your code, the clock and Patterns, and builds UGen graphs. scsynth performs the DSP in real time. They communicate over OSC, which is why a language-side mistake can leave a sound running, and why s.freeAll stops it."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `OscN` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// compare examples below with interpolating Osc examples.\n\n(\ns = Server.local;\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, false, true);\nb = Buffer.alloc(s, 512, 1);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum, 500, 0, 0.5)\n )\n}).play(s, [0, 0, 1, b.bufnum]);\n\n);\nb.free;\n\n\n\n(\n// noninterpolating - there are noticeable artifacts\n// modulate freq\n\ns = Server.local;\nb.sine1(1.0/[1, 2, 3, 4, 5, 6].squared, true, false, true);\nb = Buffer.alloc(s, 512, 1);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum, XLine.kr(2000, 200), 0, 0.5)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n\n);\nb.free;\n\n(\n// sounds very different than the Osc example\ns = Server.local;\nb = Buffer.alloc(s, 512, 1);\nb.sine1([1.0], true, true, true);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum,\n OscN.ar(bufnum,\n XLine.kr(1, 1000, 9),\n 0,\n 200,\n 800),\n 0,\n 0.25)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n\n);\nb.free;\n\n(\n// modulate phase\ns = Server.local;\nb = Buffer.alloc(s, 512, 1);\nb.sine1([1.0], true, true, true);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum,\n 800,\n OscN.ar(bufnum,\n XLine.kr(20, 8000, 10),\n 0,\n 2pi),\n 0.25)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n);\nb.free;\n\n\n(\n// change the buffer while its playing\ns = Server.local;\nb = Buffer.alloc(s, 4096, 1);\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, true, true);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum, [80, 80.2], 0, 0.2)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n);\n\n(\nRoutine({\n var n = 32;\n 50.do({\n b.sine1(Array.rand(n, 0, 1).cubed, true, true, true);\n 0.25.wait;\n });\n}).play;\n);\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\"help-PinkNoise\", { |out = 0|\n Out.ar(out,\n PinkNoise.ar(0.4)\n )\n}).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\"help-PinkNoise\", { |out = 0|\n Out.ar(out,\n PinkNoise.ar(0.4)\n )\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `OnePole`."}, {"role": "assistant", "content": "```supercollider\n{ OnePole.ar(WhiteNoise.ar(0.5), 0.95) }.play\n\n{ OnePole.ar(WhiteNoise.ar(0.5), -0.95) }.play\n\n{ OnePole.ar(WhiteNoise.ar(0.5), Line.kr(-0.99, 0.99, 10)) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "What is `RedParticle` in SuperCollider?"}, {"role": "assistant", "content": "RedParticle — an object that ages with time Category: Red > redUniverse."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n//Version 1\n//P(eace)Bind\n//If error messages could experience Nirvanna, it would sound like this.\n(\n{\nSaw.ar(\n freq: SinOsc.kr([60, 63, 67, 70]).range(440,880),\n mul:LFNoise0.kr(freq: [0.25,1]).range(0,1),\n )\n}.play\n\n);\n\n\n//Version 2\n//SuperCollider\n//Sometimes in life, you feel like you need to collide with things.\n(\n{\nPulse.ar(\n freq: SinOsc.kr([60, 63, 67, 70]).range(30,70),\n mul: LFPulse.kr(freq: [0.25,1]).range(0,1)\n )\n}.play\n\n)\n```"}, {"role": "assistant", "content": "Quiz 4a for MUSC 115, pp. 62-84 from Gentle Intro to SuperCollider."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Paddp`."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\freq, Pseq([500, 600, 700]), \\instrument, \\sinegrain);\na = Paddp(\\freq, Pseq([30, 90, -100], inf), a);\na.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n//difficult to find active parameters, forced to try resetting! \n\n{Out.ar(0,Pan2.ar(0.5*TermanWang.ar(2.0,Impulse.kr(MouseX.kr(1,1000)),0.1,0.01,1.0,1.0,1.0,MouseX.kr(0.4,1.2), MouseY.kr(2.0,4.0)),0.0))}.play;\n\n\n{Out.ar(0,Pan2.ar(0.5*TermanWang.ar(LFNoise1.ar(LFNoise0.kr(0.5,500,500),1.0,3.0),Impulse.kr(MouseX.kr(1,10000, 'exponential')),0.01,0.01,1.0,1.0,1.\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n//difficult to find active parameters, forced to try resetting! \n\n{Out.ar(0,Pan2.ar(0.5*TermanWang.ar(2.0,Impulse.kr(MouseX.kr(1,1000)),0.1,0.01,1.0,1.0,1.0,MouseX.kr(0.4,1.2), MouseY.kr(2.0,4.0)),0.0))}.play;\n\n\n{Out.ar(0,Pan2.ar(0.5*TermanWang.ar(LFNoise1.ar(LFNoise0.kr(0.5,500,500),1.0,3.0),Impulse.kr(MouseX.kr(1,10000, 'exponential')),0.01,0.01,1.0,1.0,1.0,MouseX.kr(0.4,1.2), MouseY.kr(2.0,4.0)),0.0))}.play;\n\n\n{Out.ar(0,Pan2.ar(FreeVerb.ar(0.5*TermanWang.ar(2.0+ SinOsc.ar(MouseX.kr(10,10000,'exponential'),0,MouseY.kr(0.1,100.0,'exponential')),Impulse.kr(MouseX.kr(1,10000, 'exponential')),0.01,0.01,1.0,1.0,1.0,MouseX.kr(0.4,1.2), MouseY.kr(2.0,4.0)),0.5)))}.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n// restricting fm to harmonic sidebands after\n// [Chowning, 1973] Chowning, J. (1973). The synthesis of complex spectra by means of frequency modulation. Journal of the Audio Engineering Society, 21(7):526–534.\n// restriction actually happens because of the specs, not server-side.\n\nSpec.add(\\index, [0, 40]);\nSpec.add(\\harm1, [0, 20, \\lin, 1]);\nSpec.add(\\harm2, [0, 20, \\lin, 1]);\nSpec.add(\\fundFreq, \\freq);\n\nNdef(\\fmk, {\n \n PMOsc.ar(\n \\carFreq.kr(100, 0.1), \n (\\harm1.kr(1, 1)/(\\harm2.kr(1, 1)) * LFNoise1.ar(50).range(0.995, 1.001))*\\carFreq.kr(100), \n \\index.kr(1, 0.1) * SinOsc.ar(2.5).range(0.995, 1.005)\n ) \n})\n);\nNdef(\\fmk).gui\n```"}, {"role": "assistant", "content": "Restricting fm to harmonic sidebands after[Chowning, 1973]. Restriction actually happens because of the specs, not server-side.\r\n----- \r\nChowning, J. (1973). The synthesis of complex spectra by means of frequency modulation. Journal of the Audio Engineering Society, 21(7):526–534."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\ns.boot;\n\n(\nSynthDef(\"help-PinkNoise\", { |out = 0|\n Out.ar(out, PinkNoise.ar(0.1))\n}).add;\n\nSynthDef(\"help-In\", { |out = 0, in = 0|\n var input;\n input = In.ar(in, 1);\n Out.ar(out, input);\n\n}).add;\n);\n\n// play noise on the right channel\nx = Synth(\"help-PinkNoise\", [\\out, 1]);\n\n// read the input and play it out on the left channel\nSynth.after(x, \"help-In\", [\\out, 0, \\in, 1]);\n```"}, {"role": "assistant", "content": "play noise on the right channel read the input and play it out on the left channel (In: Read a signal from a bus.)"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\ns.boot;\n\n// create a new analyzer\nFreqScope.new(400, 200, 0, server: s);\n\n// basic sine\n{ SinOsc.ar(2000, 0, 0.25) }.play(s);\n\n// random saw\n{ RLPF.ar(Saw.ar(110, 0.2), LFNoise2.kr(1, 1e4, 1e4), LFNoise2.kr(1, 0.2, 0.22)) }.play(s);\n\n// modulate phase\n{ SinOsc.ar(800, SinOsc.ar(XLine.kr(20, 8000, 10), 0, 2pi), 0.25) }.play(s);\n\n// all harmonics\n{ Blip.ar(200, Line.kr(1, 100, 10), 0.2) }.play(s);\n\n// access the Fre\n// …\n```"}, {"role": "assistant", "content": "create a new analyzer access the FreqScopeView object to set properties of the Qt Object: (FreqScope: Frequency spectrum visualizer)"}]} +{"conversations": [{"role": "user", "content": "What is `Rest`?"}, {"role": "assistant", "content": "Rest — Represents a rest in event patterns"}, {"role": "user", "content": "What does `Rest.new` do?"}, {"role": "assistant", "content": "Create an instance of Rest, with a value to be used in the resulting rest event."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// do nothing for 2 seconds\n(note: Rest(), dur: 2).play;\n\n// intersperse pauses in pattern\nPbind(\\note, Pseq([0, 4, 7, 11], inf), \\dur, Pseq([2, 1, Rest(1)], inf) / 5).play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Crackle`."}, {"role": "assistant", "content": "```supercollider\n{ Crackle.ar(1.95, 0.5) }.play;\n\n// modulate chaos parameter\n{ Crackle.ar(Line.kr(1.0, 2.0, 3), 0.5, 0.5) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Integer.pidRunning` do?"}, {"role": "assistant", "content": "32-bit Integer number Returns: a Boolean for whether or not the specified pid is running."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot\n\n{ Ringz.ar(PinkNoise.ar([0.1, 0.2]).scope(\\pink), 2000, 1, 0.25 }.play; // multichannel works\ns.scope; // can still separately scope the output of the server\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot\n\n{ Ringz.ar(PinkNoise.ar([0.1, 0.2]).scope(\\pink), 2000, 1, 0.25) }.play; // multichannel works\ns.scope; // can still separately scope the output of the server\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `RecordBuf` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// Execute the following in order\n(\n// allocate a Buffer\ns = Server.local;\nb = Buffer.alloc(s, 44100 * 4.0, 1); // a four second 1 channel Buffer\n);\n\n// record for four seconds\n(\nSynthDef(\\help_RecordBuf, { |out = 0, bufnum = 0|\n var formant;\n formant = Formant.ar(XLine.kr(400, 1000, 4), 2000, 800, 0.125);\n RecordBuf.ar(formant, bufnum, doneAction: Done.freeSelf, loop: 0);\n}).play(s, [\\out, 0, \\bufnum, b]);\n);\n\n// play it back\n(\nSynthDef(\\help_RecordBuf_playback, { |out = 0, bufnum = 0|\n var playbuf;\n playbuf = PlayBuf.ar(1, bufnum);\n FreeSelfWhenDone.kr(playbuf); // frees the synth when the PlayBuf is finished\n Out.ar(out, playbuf);\n}).play(s, [\\out, 0, \\bufnum, b]);\n);\n\n// overdub\n(\nSynthDef(\\help_RecordBuf_overdub, { |out = 0, bufnum = 0|\n var formant;\n formant = Formant.ar(XLine.kr(200, 1000, 4), 2000, 800, 0.125);\n // mixes equally with existing data\n RecordBuf.ar(formant, bufnum, 0, 0.3, 0.5, doneAction: Done.freeSelf, loop: 0);\n}).play(s, [\\out, 0, \\bufnum, b]);\n);\n\n// play back the overdubbed version\nSynth.new(\\help_RecordBuf_playback, [\\out, 0, \\bufnum, b], s);\n\n// write the contents of the buffer to a file (see Buffer for more options)\n(\nb.write(sampleFormat: 'int16');\nthisProcess.platform.recordingsDir +/+ \"SC_\" ++ Date.localtime.stamp ++ \".aiff\"; // generated path\n);\n\nb.close; b.free; // cleanup\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// allocate a buffer for writinig into\ns = Server.local;\ns.sendMsg(\"/b_alloc\", 0, 44100 * 2);\n);\n\n\n// write into the buffer with a BufWr\n(\ny = { |rate = 1|\n var in;\n in = SinOsc.ar(LFNoise1.kr(2, 300, 400), 0, 0.1);\n BufWr.ar(in, 0, Phasor.ar(0, BufRateScale.kr(0) * rate, 0, BufFrames.kr(0)));\n 0.0 // quiet\n}.play;\n);\n\n// read it with a BufRd\n(\nx = { |rate = 1|\n BufRd.ar(1, 0, Phasor.ar(0, BufRateS\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// allocate a buffer for writinig into\ns = Server.local;\ns.sendMsg(\"/b_alloc\", 0, 44100 * 2);\n);\n\n\n// write into the buffer with a BufWr\n(\ny = { |rate = 1|\n var in;\n in = SinOsc.ar(LFNoise1.kr(2, 300, 400), 0, 0.1);\n BufWr.ar(in, 0, Phasor.ar(0, BufRateScale.kr(0) * rate, 0, BufFrames.kr(0)));\n 0.0 // quiet\n}.play;\n);\n\n// read it with a BufRd\n(\nx = { |rate = 1|\n BufRd.ar(1, 0, Phasor.ar(0, BufRateScale.kr(0) * rate, 0, BufFrames.kr(0)))\n}.play(s);\n);\n\n\n\nx.set(\\rate, 5);\ny.set(\\rate, 2.0.rand);\nx.set(\\rate, 2);\n```"}]} +{"conversations": [{"role": "user", "content": "How should I check an answer you give me?"}, {"role": "assistant", "content": "Three quick checks, cheapest first. Does it evaluate without a syntax error — the post window points at the exact character. Does the node appear in `s.plotTree` — if yes, the problem is signal rather than lifecycle. Does it reach `Out.ar(0, ...)` with a non-zero amplitude and an open filter. If those three pass and it is still silent, the class's own help page will show the argument order you may have assumed wrong."}]} +{"conversations": [{"role": "user", "content": "Explain `PLseq` in SuperCollider briefly."}, {"role": "assistant", "content": "PLseq — dynamic scope Pseq variant Takes Symbol args for later reference by the Streams, which will read from variables in the Environments of their instantiation. See PLx_suite. Category: Libraries > miSCellaneous > PLx suite, Streams-Patterns-Events > PLx suite."}]} +{"conversations": [{"role": "user", "content": "What is `PLnaryop` in SuperCollider?"}, {"role": "assistant", "content": "PLnaryop — dynamic scope Pnaryop variant Takes Symbol args for later reference by the Streams, which will read from variables in the Environments of their instantiation. See PLx_suite. For replacing operators dynamically take PLnaryFunc with the operator wrapped into a Function. Category: Libraries > miSCellaneous > PLx suite, Streams-Patterns-Events > PLx suite."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// Initial values - system state y0 at time t0: y(t0) = y0 - are essential for an ODE solution.\n// In this example with the MSD model (and constant f !) time isn't explicit,\n// therefore it makes no difference if we start at t = 0 or t = 10, time is only shifted.\n\n// However the position, described here by y, is time-dependent,\n// so it makes a difference to start with different values\n\n// y'(t) = w(t)\n// w'(t) = (f(t) - (dampen * w(t)) - (spring * y(t))) / mass\n\n(\nx = {\n var f = 0.2, mass = 0.001, spring = 50, dampen = 0.0005,\n\n sig = Fb1_ODE.ar(\\MSD,\n [f, mass, spring\n// …\n```"}, {"role": "assistant", "content": "Initial values - system state y0 at time t0: y(t0) = y0 - are essential for an ODE solution. In this example with the MSD model (and constant f !) time isn't explicit, (Fb1_ODE: general ordinary differential equation integrator pseudo ugen)"}]} +{"conversations": [{"role": "user", "content": "What are you not good at?"}, {"role": "assistant", "content": "Everything outside SuperCollider. I have no audio input, no live data, and my knowledge ends at the documentation snapshot I was trained on — so I can be confidently wrong about Quarks and new UGens."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// using timer to modulate sine frequency: the slower the trigger is the higher the frequency\n(\n{ var trig;\n trig = Impulse.kr(MouseX.kr(0.5, 20, 1));\n SinOsc.ar(Timer.kr(trig) * 500 + 500, 0, 0.2)\n}.play;\n)\n```"}, {"role": "assistant", "content": "using timer to modulate sine frequency: the slower the trigger is the higher the frequency (Timer: Returns time since last triggered.)"}]} +{"conversations": [{"role": "user", "content": "What is `SVF` in SuperCollider?"}, {"role": "assistant", "content": "SVF — 12db/Oct State Variable Filter Total, 100% Plastic... Category: UGens > Filters."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Lag`."}, {"role": "assistant", "content": "```supercollider\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n Lag.kr( // lag the modulator\n LFPulse.kr(4, 0, 0.5, 50, 400), // frequency modulator\n Line.kr(0, 1, 15) // modulate lag time\n ),\n 0, // phase\n 0.3 // sine amplitude\n )\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nx = List[1, 2, 3] //-> [1, 2, 3]\n\n// Retrieve the value at index 1:\nx.at(1) //-> 2\n// Equivalent shorthand syntax:\nx[1] //-> 2\n\n// An index can also be retrieved from an array (returns not a list, but an array):\ny = [0, 0, 2, 2, 1] //-> [0, 0, 2, 2, 1]\nx[y]; //-> [1, 1, 3, 3, 2]\n\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n pitches.size.do{ |i|\n {\n var freq = pitches[i].midicps;\n var env = Env.perc\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nx = List[1, 2, 3] //-> [1, 2, 3]\n\n// Retrieve the value at index 1:\nx.at(1) //-> 2\n// Equivalent shorthand syntax:\nx[1] //-> 2\n\n// An index can also be retrieved from an array (returns not a list, but an array):\ny = [0, 0, 2, 2, 1] //-> [0, 0, 2, 2, 1]\nx[y]; //-> [1, 1, 3, 3, 2]\n\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n pitches.size.do{ |i|\n {\n var freq = pitches[i].midicps;\n var env = Env.perc.ar(Done.freeSelf);\n SinOsc.ar(freq) * 0.1 * env\n }.play;\n 0.2.wait\n }\n}\n)\n```"}]} {"conversations": [{"role": "user", "content": "What is `CodonPattern` in SuperCollider?"}, {"role": "assistant", "content": "CodonPattern — A pattern that translates a genome string to a stream of aminoacid triplets (codons). Category: Streams-Patterns-Events, Sonification."}]} -{"conversations": [{"role": "user", "content": "What does `AbstractPlayer.annotate` do? What arguments does it take?"}, {"role": "assistant", "content": "the base class for all Players : a playable object Arguments: thing; note."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\envfol;\n~description = \"Envelope follower (audio rate)\";\n~channelLayout = \\mono;\n~function = {|in = 0, decaycoeff = 0.99, amp = 10.0, lpf = 20 |\n var env, out;\n in.scope;\n env = LPF.ar(PeakFollower.ar(in), lpf, mul: 50, add:-1);\n env.scope;\n env;\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n {\n var freq;\n freq = Duty.kr(\n Drand([0.01, 0.2, 0.4], inf), // demand ugen as durations\n 0,\n Dseq([204, 400, 201, 502, 300, 200], inf)\n );\n SinOsc.ar(freq * [1, 1.01]) * 0.1\n\n }.play;\n);\n\n(\n {\n var freq;\n freq = Duty.kr(\n MouseX.kr(0.001, 2, 1), // control rate ugen as durations\n 0,\n Dseq([204, 400, 201, 502, 300, 200], inf)\n );\n SinOsc.ar(freq * [1, 1.01]) * 0.1\n\n }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n {\n var freq;\n freq = Duty.kr(\n Drand([0.01, 0.2, 0.4], inf), // demand ugen as durations\n 0,\n Dseq([204, 400, 201, 502, 300, 200], inf)\n );\n SinOsc.ar(freq * [1, 1.01]) * 0.1\n\n }.play;\n);\n\n(\n {\n var freq;\n freq = Duty.kr(\n MouseX.kr(0.001, 2, 1), // control rate ugen as durations\n 0,\n Dseq([204, 400, 201, 502, 300, 200], inf)\n );\n SinOsc.ar(freq * [1, 1.01]) * 0.1\n\n }.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Class.help` do?"}, {"role": "assistant", "content": "Opens the help file for this Class if it exists. It may take a little while until the help window responds."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Nuclear Fallout (a SuperCollider snippet)?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n var saw, bpf;\n saw = Saw.ar(\n freq: [60,150],\n mul: LFPulse.kr(\n freq: [2,3],\n width: 0.15));\n \n { BPF.ar(\n in: WhiteNoise.ar(mul: 1),\n freq: 1000,\n rq: 0.9\n )\n}\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//simple particlesystem.\n//with mouse controlling world gravity and system position\n\n(\nvar width= 300, height= 300, w, world,\nsys;\n\n//--world\nw= RedWindow(\"particlesystem test\", Rect(128, 64, width, height)).front;\nworld= RedWorld3(RedVector2D[width, height], 0, 20, -0.25); //dim,grav,maxvel,damp\n\n//--system\nsys= RedParticleSystem.new;\n\n//--loop\nw.draw{\n world.gravity= RedVector2D.newFrom(w.mouse/([width, height])-0.5);\n\n //--add new particles and update old\n sys.add(RedParticle(world, w.mouse+5.rand2, 0, RedVector2D[2.rand2, 10.rand], 1.5, 5.rand).age_(40.rrand(50)));\n sys.addForce(world.gravity);\n sys.update;\n\n //--render\n sys.do{|o| //iterate all particles in the system\n Pen.fillColor= Color.grey((o.age/50), 1);\n Pen.fillOval(Rect.aboutRedObject2D(o));\n };\n};\nw.play;\nCmdPeriod.doOnce({w.close});\n)\n```"}, {"role": "assistant", "content": "simple particlesystem. with mouse controlling world gravity and system position."}]} -{"conversations": [{"role": "user", "content": "What does `TreeViewItem.==` do?"}, {"role": "assistant", "content": "Implements equality comparison between two TreeViewItem instances. Two instances are equal if they represent the same item in Returns: A Boolean."}]} -{"conversations": [{"role": "user", "content": "What is `HilbertWIm` in SuperCollider?"}, {"role": "assistant", "content": "HilbertWIm — Applies the Imaginary part of the Hilbert Transform to an input signal. [1] Offers the Hilbert Transform of an input signal via Weaver's Third Method. footWeaver, Donald. “A Third Method of Generation and Detection of Single-Sideband Signals.” Proceedings of the IRE, vol. 44, no. 12, 1956, pp. 1703–1705. Category: Libraries > Hilbert > Pseudo-UGens, UGens > Filters > Nonlinear."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes SyncSaw madness."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\fun, {\n var src, freq = 25;\n var lagTime = \\lagTime.kr(0);\n var vibrato = \\vibrato.kr([ 1.3515662384033, 1.3061940193176, 0.604791264534, 1.2328997278214, 0.33569867610931, 0.40528120040894, 1.0865307760239, 1.22394572258, 1.7781081724167, 0.15319232463837 ], lagTime);\n \n var vibRatio = \\vibRatio.kr([ 2.9047239411079, 0.39578121743921, 0.10932490532285, 0.051738858660565, 0.17840235868831, 0.024495380749894, 3.9689920754869, 4.1139229659643, 0.23327501819885, 0.97643604193256 ], lagTime);\n \n var freqVary = \\freqVary.kr([ 143.76541377614, 14.25479545154, 6.6728691888342, 58.434807398325, 154.89385962072, 34.112274650688, 3.1140823758236, 10.42040949808, 158.59959972037, 1.2163188440936 ], lagTime);\n \n \n var numSrcs = vibrato.size;\n\n src = numSrcs.collect{|i|\n var freq2 = (freq * freqVary[i]) * LFNoise2.kr(0.01).range(1, 1.5);\n     \n SyncSaw.ar(freq2, freq2 * SinOsc.ar(Line.kr(1, vibrato[i], 20) * vibRatio[i], Rand(0, 0.8)).range(pi, pi * 0.1)) * rrand(0.05, 0.1)\n };\n \n src = Splay.ar(src);\n \n}).play\n);\n\nNdef(\\fun).fadeTime = 20;\n\nNdef(\\fun).rebuild\n\n(\nNdef(\\fun).setn(\n \\lagTime, [5],\n \\vibRatio, {exprand(0.1, 3)}!10,\n \\freqVary, {exprand(1, 150)}!10,\n \\vibrato, {exprand(0.3, 3)}!10\n)\n);\n(\nNdef(\\fun).setn(\n \\lagTime, [200],\n \\vibRatio, ({exprand(0.1, 3)}!10).sort,\n \\freqVary, ({exprand(1, 150)}!10).sort,\n \\vibrato, ({exprand(0.3, 3)}!10).sort\n)\n);\n\n(\nNdef(\\fun).xsetn(\n \\lagTime, [100],\n \\vibRatio, {exprand(0.1, 3)}!10,\n \\freqVary, {exprand(1, 150)}!10,\n \\vibrato, {exprand(0.3, 3)}!10\n))\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for in the jungle."}, {"role": "assistant", "content": "```supercollider\n({\nvar nz = { |...args| LFDNoise3.kr(*args) };\nvar sig = Limiter.ar(\n BPF.ar(\n RHPF.ar(\n RLPF.ar(\n WhiteNoise.ar(nz.(1/[9,10],0.25,0.75)),\n nz.(5!2).exprange(1000, 2000),\n nz.(1/5!2).range(0.1,1)),\n nz.(5!2).exprange(50,150),\n nz.(1/5!2).range(0.1,1)),\n nz.(5!2).exprange(150,1000),\n nz.(1/5!2).range(0.1,1)))\n* LFGauss.ar([3,4],0.33) * LFGauss.ar(1/[4,9],0.25)\n* SinOsc.ar(Lag2UD.kr(Duty.kr(1,0,{Dibrown(300,2400,250)}!2),0.25,0.8));\nRotate2.ar(sig[0], sig[1], LFSaw.kr(1/5));\n}.play)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `RedMixerChannel.miGain` do?"}, {"role": "assistant", "content": "Get and set channel equalizer middle band gain (in dB). Note: activate band first with `eqMi="}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n// trig with MouseY crossing center of screen\n{\n var in, chain;\n in = Mix.ar(SinOsc.ar(200 * (1..10), 0, Array.fill(10, { rrand(0.1, 0.2) })));\n chain = FFT(LocalBuf(2048), in);\n chain = PV_Diffuser(chain, MouseY.kr > 0.5);\n 0.5 * IFFT(chain).dup;\n}.play\n);\n\n(\nb = Buffer.read(s, ExampleFiles.child);\n\n// trig with MouseY crossing center of screen\n{\n var in, chain;\n in = PlayBuf.ar(1, b, BufRateScale.kr(b), loop: 1);\n chain = FFT(Local\n// …\n```"}, {"role": "assistant", "content": "trig with MouseY crossing center of screen trig with MouseY crossing center of screen (PV_Diffuser: Random phase shifting.)"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n~chaos={\n var signal, myFrequency, frequencyMin=0.1, frequencyMax=30, myAmplitude, amplitudeMin=0.01, amplitudeMax=0.6, myPhase, phaseMin=0, phaseMax=1.5;\n myFrequency = Array.fill(2, {[rrand(frequencyMin, frequencyMax)]});\n myAmplitude = Array.fill(2, {[rrand(amplitudeMin, amplitudeMax)]});\n myPhase = Array.fill(2, {[rrand(phaseMin, phaseMax)]});\n signal = LeakDC.ar(ChaosGen.allSubclasses.choose.ar(myFrequency, myPhase, myAmplitude));\n Out.ar(0, signal);\n};\n);\n\n~chaos.scope\n```"}, {"role": "assistant", "content": "chaos gen modular function for modular pseudo ugen prototyping."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `AnalogOut`."}, {"role": "assistant", "content": "```supercollider\n// write a sine oscillator's output to a pin\n\n(\nSynthDef(\"help-AnalogOut\", { |out = 0|\n AnalogOut.ar(0, SinOsc.ar(10));\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// Compare with Ex. 2 from DXFan help.\n// As DXFanOut, other than DXFan, doesn't return an array, a mix is not necessary, \n// by internal use of Out ugens the signal is mixed to the referred buses anyway.\n\n// For the same reason a normal release doesn't work, to get this option we can add an EnvGate.\n\n(\nx = {\n var lfo = { LFDNoise3.kr(0.2) };\n DXFanOut.ar(\n [Dseq([0, 1], inf), Dseq([1, 0], inf)],\n [\n LFTri.ar(150 * lfo.().range(1, 2), 0, 0.05),\n BPF.ar(PinkNoise.ar(), lfo.().range(1000, 3000),\n// …\n```"}, {"role": "assistant", "content": "Compare with Ex. 2 from DXFan help. As DXFanOut, other than DXFan, doesn't return an array, a mix is not necessary, (DXFanOut: crossfades signals between out buses according to demand-rate control)"}]} +{"conversations": [{"role": "user", "content": "What does `Color.storeArgs` do?"}, {"role": "assistant", "content": "Returns an array with `[red, green, blue,"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = ProxySynthDef(\"xtest\", { SinOsc.ar(400) * 0.1 });\n\na.add;\n\nx = Synth(\"xtest\");\nx.release;\n\n\n/*\n\n if the resulting number of channels is larger than a given channelConstraint,\n it behaves according to the rate: audio rate signals are wrapped around\n a smaller channel size, control rate signals are not (the exceeding channels are left out\n\n*/\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = ProxySynthDef(\"xtest\", { SinOsc.ar(400) * 0.1 });\n\na.add;\n\nx = Synth(\"xtest\");\nx.release;\n\n\n/*\n\n if the resulting number of channels is larger than a given channelConstraint,\n it behaves according to the rate: audio rate signals are wrapped around\n a smaller channel size, control rate signals are not (the exceeding channels are left out)\n\n*/\n```"}]} +{"conversations": [{"role": "user", "content": "What is `LevelIndicator` in SuperCollider?"}, {"role": "assistant", "content": "LevelIndicator — a level indicator GUI widget A level indicator view, suitable for use as a level or peak meter, etc. Category: GUI > Views."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `In`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-InKr\", { |out = 0, in = 0|\n Out.ar(out,\n SinOsc.ar(In.kr(in, 1), 0, 0.1)\n )\n}).add;\nSynthDef(\"help-lfo\", { |out = 0|\n Out.kr(out, LFNoise1.kr(0.3, 200, 800))\n}).add;\n);\n\n\nb = Bus.control(s, 1);\nb.set(800);\n\nSynth(\"help-InKr\", [\\in, b.index]);\nb.set(400);\nb.set(300);\nSynth(\"help-lfo\", [\\out, b.index]);\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Impulse`."}, {"role": "assistant", "content": "```supercollider\n{ Impulse.ar(4, [0, MouseX.kr(0, 1)], 0.2) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Date.format` do?"}, {"role": "assistant", "content": "Obtain a date string with a given format. The character % is replaced by the appropriate value, which is derived from the letter that follows. `Date.getDate.format(\"Today is %A. It is around %I o'clock"}]} +{"conversations": [{"role": "user", "content": "What is the node tree and what is a Group for?"}, {"role": "assistant", "content": "Everything running on the server is a node: Synths and Groups, arranged in a tree under the root group. Order matters, because audio flows through buses from earlier to later nodes in the same branch. A Group is a container that lets you address many nodes at once, which is what you want for an effect chain — put the instruments in one group, the effect in another, and `freeAll` or a volume change hits the whole group instead of a list of node ids."}]} +{"conversations": [{"role": "user", "content": "What does `Rational.wrap` do?"}, {"role": "assistant", "content": "Map into a range, wrapping or reflecting. These follow"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Out.ar(87, SinOsc.ar(MouseX.kr(240, 1000, 1) * [1, 2, 3], 0, 0.2)) }.play; // play three sine tone on channels 87, 88, and 89\nx = Monitor.new; // create a new monitor\nx.play(fromIndex: 87, fromNumChannels: 3, toIndex: 0, toNumChannels: 2; // play them back to the stereo hardware channels\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Out.ar(87, SinOsc.ar(MouseX.kr(240, 1000, 1) * [1, 2, 3], 0, 0.2)) }.play; // play three sine tone on channels 87, 88, and 89\nx = Monitor.new; // create a new monitor\nx.play(fromIndex: 87, fromNumChannels: 3, toIndex: 0, toNumChannels: 2); // play them back to the stereo hardware channels\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Just going crazy with modulation. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"additivePad\", \n { arg numOfCycles = 100;\n var lfo;\n var lfo2;\n var lfo3;\n lfo = SinOsc.kr([Rand(0.5,1000),Rand(0.5,1000)], 1.5pi, 0.5, 0.5);\n lfo3 = SinOsc.kr([Rand(0.1,0.5),Rand(0.1,0.5)], 1.5pi, 0.5, 0.5);\n lfo2 = SinOsc.kr([(Rand(0.5,1000) * lfo) * lfo3, (Rand(0.5,1000) * (1 - lfo)) * (1 - lfo3)], 1.5pi, 0.5, 0.5);\n Out.ar(\n 0, \n Mix.arFill(\n numOfCycles,\n { \n SinOsc.ar(\n Rand(40,1000),\n 0, \n (numOfCycles.reciprocal * 0.75) * lfo2)\n }\n ) * EnvGen.kr(Env.perc(Rand(0.1,30), Rand(0.1,30)), doneAction: 2)\n )\n }\n).send(s); \n);\n\n(\nr = Routine({\n 200.do({\n x = Synth.new(\"additivePad\"); \n 10.wait;\n });\n});\n);\n\nr.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `TwoPole`."}, {"role": "assistant", "content": "```supercollider\n{ TwoPole.ar(WhiteNoise.ar(0.005), 2000, 0.95) }.play\n\n{ TwoPole.ar(WhiteNoise.ar(0.005), XLine.kr(800, 8000, 8), 0.95) }.play\n\n{ TwoPole.ar(WhiteNoise.ar(0.005), MouseX.kr(800, 8000, 1), 0.95) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "What is `PSVop_i` in SuperCollider?"}, {"role": "assistant", "content": "PSVop_i — Sieve pattern for arbitrary set operations of integer generators with interval output Pattern for arbitrary set operations of integer generators with interval output. For an introduction and more examples see Sieves_and_Psieve_patterns. Category: Libraries > miSCellaneous > Sieves and Psieve Patterns, Streams-Patterns-Events > Sieves and Psieve Patterns."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Blip`."}, {"role": "assistant", "content": "```supercollider\n// modulate frequency\n{ Blip.ar(XLine.kr(20000, 200, 6), 100, 0.2) }.play;\n\n// modulate numharmonics\n{ Blip.ar(200, Line.kr(1, 100, 20), 0.2) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `PHSplayer.stop` do? What arguments does it take?"}, {"role": "assistant", "content": "PHS player object Arguments: hsStop — Boolean. Determines if help synth should stop. Defaults to false.; pbindStop — Boolean. Determines if Pbind player(s) should stop. Defaults to true.; addAction — Function to be evaluated at receive time.."}]} +{"conversations": [{"role": "user", "content": "What is `SynthDesc`?"}, {"role": "assistant", "content": "SynthDesc — Description of a synth definition"}, {"role": "user", "content": "What does `SynthDesc.read` do?"}, {"role": "assistant", "content": "Adds all synthDescs in a path to a dict. You should not use this method or *readFile to read SynthDescs into a SynthDescLib. Use SynthDescLib#read or SynthDescLib#readStream instead."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"test\", { |out, freq, xFade|\n XOut.ar(out, xFade, SinOsc.ar(freq))\n}).store\n);\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `BinaryOpUGen`."}, {"role": "assistant", "content": "```supercollider\n// trigger an envelope\n(\n{\n var trig;\n trig = SinOsc.ar(1) > 0.1;\n EnvGen.kr(Env.perc, trig, doneAction: Done.none) * SinOsc.ar(440, 0, 0.1)\n}.play\n) // > outputs 0 or 1\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Collection.symmetricDifference` do?"}, {"role": "assistant", "content": "Return the set of all items which are not elements of both this and that. this — that `a = [1, 2, 3]; b = [2, 3, 4,"}]} +{"conversations": [{"role": "user", "content": "What does `IdentityDictionary.know` do?"}, {"role": "assistant", "content": "If set to true, the dictionary interprets method calls as look ups. This allows you to implement object prototypes (see"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Plambda`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n/*\n\nA simple example:\nTwo patterns playing in parallel,\nsharing data between eachother\n\n*/\n(\n // a melody playing random scale degrees\n a = Pbind(\n \\dur, 0.125,\n \\octave, 4,\n \\degree, Plet(\\melody, pattern: Pwhite(0, 7))\n );\n\n // the bass, scale degrees sampled from the \\melody variable defined above\n b = Pbind(\n \\dur, 0.5,\n \\octave, 3,\n \\degree, Pget(\\melody, default: 1, repeats: inf).trace\n );\n\n // Play the patterns in parallel\n Plambda(\n Ppar([a, b], inf)\n ).play;\n);\n/*\n\nA more complex example:\nThree patterns running in parallel\n\n*/\n(\nSynthDef(\\sine,\n { |out = 0, freq = 440, sustain = 0.05, pan = 0, amp = 0.1|\n var env;\n env = EnvGen.kr(Env.perc(Rand(0.001, 0.02), sustain, AmpCompA.kr(freq)*amp), doneAction: Done.freeSelf);\n Out.ar(out, Pan2.ar(SinOsc.ar(freq), pan, env))\n }).add;\n);\n\n(\na = Plambda(\n Pseq([\n Pfindur(5,\n Ppar([\n Pbind(\\note, Plet(\\x, Prand([1, 5, 1, [10, 14]], inf)), \\dur, 8/3, \\pan, -1),\n Pbind(\\note, Plet(\\y, Pseq([5, 3, 2, 0, [0, 5, 6, 9]], inf)), \\dur, 0.5, \\pan, 1),\n Pbind(\\note, Pseq([Pget(\\x), Pget(\\y)], inf) + 12, \\pan, 0, \\dur, 2/3)\n ])\n ),\n Pbind(\\note, Pget(\\x, 0, 6) + [0, 5], \\dur, Pdup(inf, Prand([2/3, 1/6])))\n ], inf).trace(\\eventScope) // internally, the values are shared via \\eventScope\n);\n\nb = Pbindf(a, \\instrument, \\sine, \\legato, 0.1);\nb.play\n);\n\n// Play two copies of the complex pattern above in parallel, one of them transposed and playing with shorter durations\nPpar([b, Pbindf(b, \\ctranspose, 24, \\dur, Pkey(\\dur) * 0.25)]).play;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `SClusterAmplitudes` in SuperCollider briefly."}, {"role": "assistant", "content": "SClusterAmplitudes — control SCluster amplitudes Amplitude control for LINKClasses/SCluster. Category: SInstruments."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DecodeB2`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var w, x, y, p, a, b, c, d;\n\n p = PinkNoise.ar; // source\n\n // B-format encode\n #w, x, y = PanB2.ar(p, MouseX.kr(-1, 1), 0.1);\n\n // B-format decode to quad\n #a, b, c, d = DecodeB2.ar(4, w, x, y);\n\n [a, b, d, c] // reorder to my speaker arrangement: Lf Rf Lr Rr\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\"help-NRand\", { |out = 0, n = 0|\n Out.ar(out,\n FSinOsc.ar(\n NRand(1200.0, 4000.0, n),\n 0, Line.kr(0.2, 0, 0.01, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n(\nn = 0;\nRoutine({\n inf.do({ |i|\n Synth.new(\"help-NRand\", [\\n, n]); 0.05.wait;\n })\n}).play;\n;\n\nn = 1;\nn = 2;\nn = 4;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\"help-NRand\", { |out = 0, n = 0|\n Out.ar(out,\n FSinOsc.ar(\n NRand(1200.0, 4000.0, n),\n 0, Line.kr(0.2, 0, 0.01, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n(\nn = 0;\nRoutine({\n inf.do({ |i|\n Synth.new(\"help-NRand\", [\\n, n]); 0.05.wait;\n })\n}).play;\n);\n\nn = 1;\nn = 2;\nn = 4;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `String.standardizePath` do?"}, {"role": "assistant", "content": "Expand ~ to your home directory, and resolve aliases on macOS. See PathName for more complex needs. See File#*realpath if you want to resolve symlinks. `\"~/\".standardizePath; // This will print your home"}]} +{"conversations": [{"role": "user", "content": "Resizing FreqScope?"}, {"role": "assistant", "content": "SuperCollider forum — Resizing FreqScope?\n\nOddly, this seems to work:\n\n```supercollider\n// max partial = 20 kHz\n// do not play this loudly\na = { Blip.ar(100, 200, 0.02).dup }.play;\n\nv = FreqScope(800, 600); // top partial is shown below 1.75 kHz (?)\n\nv.scope.scope.xZoom = 1; // seems correct, by eyeballing\n\n// let's try another resolution\nv = FreqScope(600, 500);\nv.scope.scope.xZoom = 1; // hm, zoom = 1 seems OK here too\n```\n\nFreqScope includes the line scope.xZoom_((scope.bufSize*0.25) / width); so it may be that this calculation is incorrect. I’m unclear, for instance, why it’s dividing by width – apparently zooming out for larger windows...?\n\nBut I tried three different widths (800x600, 600x500, 200x150), and for all of them, xZoom = 1 appeared to be correct. It’s possible that this calculation is vestigial, then – maybe we needed it for the older version of frequency scope, but the Qt version might not need it at all.\n\nhjh"}]} +{"conversations": [{"role": "user", "content": "What does `AbstractFunction.rrand` do?"}, {"role": "assistant", "content": "`a = { |x| sin(x) } rrand: { |x| sin(x) * -1"}]} +{"conversations": [{"role": "user", "content": "What does `In.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Read a signal from a bus. Arguments: bus — The index of the bus to read in from.; numChannels — The number of channels (i.e. adjacent buses) to read in. You cannot modulate this number by assigning it to an argument in a SynthDef.."}]} +{"conversations": [{"role": "user", "content": "What does `Scale.as` do?"}, {"role": "assistant", "content": "Converting. For example `as(Array)`, `as(List)` and `as(LocalBuf)` which is useful for server-side work."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = {LFTri.ar(100+(1000*Maths2.ar(MouseX.kr, MouseY.kr, SinOsc.ar(0.2, 0).range(0,1), 1-MouseButton.kr(lag:0.001))[0]), 0, 0.1}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = {LFTri.ar(100+(1000*Maths2.ar(MouseX.kr, MouseY.kr, SinOsc.ar(0.2, 0).range(0,1), 1-MouseButton.kr(lag:0.001))[0]), 0, 0.1)}.play\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Pan2` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\ng = Group.new;\n\n// make 4 synths in g\n// 1.0.rand2 returns a random number from -1 to 1.\n4.do({ { arg amp = 0.1; Pan2.ar(SinOsc.ar(440 + 110.rand, 0, amp), 1.0.rand2) }.play(g); });\n\ng.set(\\amp, 0.005); // turn them all down\n\ng.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `OSCSched.initClass` do?"}, {"role": "assistant", "content": "scheduling utility for just-in-time scheduling of OSC bundles"}]} +{"conversations": [{"role": "user", "content": "What is `RedSlide` in SuperCollider?"}, {"role": "assistant", "content": "RedSlide — logarithmic lag Very similar to .lagud. Useful for smoothing sensor data. Category: Red > redUGens."}]} +{"conversations": [{"role": "user", "content": "What does `PopUpTreeMenu.tree` do?"}, {"role": "assistant", "content": "Dictionary of dictionaries. Branches terminate if they have an empty dictionary as a value (="}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Synth`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n// create a Synth at the head of the default Server's default group\n// based on the SynthDef \"default\"\nx = Synth.new(\"default\");\ns.queryAllNodes; // note the default group (ID 1)\nx.free;\n\n// Using an arrayed control\n// run this block first to make the SynthDef\n(\nSynthDef(\"help-synth\", { |freq = #[440, 450, 460], out = 0|\n Out.ar(out, Mix(SinOsc.ar(freq, 0, 0.1)));\n}).add;\n);\n\n// then this a short while later\nx = Synth(\"help-synth\", [freq: [500, 501, 510]]);\n\nx = Synth(\"help-synth\", [freq: [500, 501, 510]]);\nx.set(\\freq, [1, 2, 3] * 400 + [1, 2, 3], \\out, 1);\nx.set(\\freq, [3] * 400 + [1, 2, 3], \\out, 1);\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Play your (short) soundfiles with some delay that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n// By Bjørn Houdorf March 2013, Play your (short) soundfiles with some delay.\n\nb = SoundFile.collectIntoBuffers(\"yourSoundFileFolder/*\"); // 1. rund this\n\n( // 2. and then run this\nt = Task({\n({\n var num= b.size.rand;\n var buf= b[num];\n 0.1*Splay.ar(PlayBuf.ar(buf.numChannels, buf, 1, 1, 0, 0));\n}.play;\n) \n});\n);\n\n\n( // 3. Then run this\nz = Task({\nloop({\n t.start;\n 0.1.wait;\n});\n});\n);\n\n\nz.start; // 4. and run this\nz.stop; // 5. and finally run this\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SortedList`."}, {"role": "assistant", "content": "```supercollider\nt = SortedList.new(8, {|a,b| a.first < b.first });\nt.add([10, \"last\"]);\nt.add([1, \"first\"]);\nt.postln;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `InFeedback`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-InFeedback\", { |out = 0, in = 0|\n Out.ar(out,\n InFeedback.ar(in, 1)\n );\n}).add;\nSynthDef(\"help-SinOsc\", { |out = 0, freq = 440|\n Out.ar(out, SinOsc.ar(freq, 0, 0.1))\n}).add;\n);\n\nx = Bus.audio(s, 1);\n\n// read from bus n play to bus 0 (silent)\na = Synth(\"help-InFeedback\", [\\in, x.index, \\out, 0]);\n\n// now play a synth after this one, playing to bus x\nb = Synth.after(a, \"help-SinOsc\", [\\out, x.index]);\n\n// add another synth before a which also writes to bus x\n// now you can't hear b, as its data is one cycle old, and is overwritten by c\nc = Synth.before(a, \"help-SinOsc\", [\\out, x.index, \\freq, 800]);\n\n// free c and you can hear b again\nc.free;\nx.free;\n\na.free; b.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ArrayedCollection`."}, {"role": "assistant", "content": "```supercollider\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n pitches.size.do{ |i|\n {\n var freq = pitches[i].midicps;\n var env = Env.perc.ar(Done.freeSelf);\n SinOsc.ar(freq) * 0.1 * env\n }.play;\n 0.2.wait\n }\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// for the members of the cult of q\n// who don't want to ~tilde\n\n\n//-- INIT\nq = q ? ();\n\nq.local = currentEnvironment;\n\nq.local.pattern = Pbind(\\note, Pbrown(0, { 17.rand + 1 } ! 12), \\dur, 0.05, \\amp, 0.01);\n\n\n//-- PLAY\n\nq.local.player = q.local.pattern.play;\n\n\n\n\n//-- STOP\n\nq.local.player.stop;\n\n//-- FREE\n\nq.local = nil;\n```"}, {"role": "assistant", "content": "for the members of the cult of q who don't want to ~tilde -- INIT."}]} +{"conversations": [{"role": "user", "content": "How current is your SuperCollider knowledge?"}, {"role": "assistant", "content": "It comes from a snapshot of the SuperCollider repository (documentation, class library and examples) plus code I can reason about. So classes and arguments in that snapshot I know well, including argument order. Quarks, newer UGens, and anything outside the official tree I may not know at all, and I will say so rather than invent a method name. If you need certainty about a class, check its help page — `SinOsc.schelp` in the source tree is the authority."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// The finishing of a ZeroXBufRd is not detemined by finite demand rate ugens but by an overall envelope, \n// its release section is triggered by a maximum number of half wavesets ('length') or a maximum time. \n\n// Buffers from Ex.4\n\n{ ZeroXBufRd.ar(b[0], z[0], rate: 1, length: 10, rel: 0.01) }.plot(0.03)\n\n{ ZeroXBufRd.ar(b[0], z[0], rate: 1, maxTime: 0.01, rel: 0.01) }.plot(0.03)\n\n\n// envelopes can be differentiated\n\n{ ZeroXBufRd.ar(b[0..1], z[0..1], rate: 1, maxTime: [0.01, 0.005], rel: [0.00\n// …\n```"}, {"role": "assistant", "content": "The finishing of a ZeroXBufRd is not detemined by finite demand rate ugens but by an overall envelope, its release section is triggered by a maximum number of half wavesets ('length') or a maximum time. (ZeroXBufRd: reads consecutive sequences of segments between zero crossings from one or more buffers with demand-rate control)"}]} +{"conversations": [{"role": "user", "content": "Splay - not getting spread, wrong use?"}, {"role": "assistant", "content": "SuperCollider forum — Splay - not getting spread, wrong use?\n\nYou need to undestand that if you have two identical signal coming from left and right it will always be mono. No stereo spread possible. So you need to introduce (at least) two different signals - and just different amplification will not really work.\n\nTo expand your first example, we can introduce an array of values for paramtere pos:\n\n```supercollider\n(\nx = { arg spread=1, level=0.2, center=0.0;\n Splay.ar(\n GrainBuf.ar(numChannels: 1,\n trigger: Impulse.kr(1.2875),\n dur: Impulse.kr(1.2875),\n sndbuf: b,\n pos:[0,0.5],\n interp: 1\n ),\n spread,\n level,\n center\n );\n}.play;\n);\n\nx.set(\\spread, 1, \\center, 0); // full stereo\nx.set(\\spread, 0, \\center, 0); // mono center\n```\n\nBy way of Multichannel Expansion this creates two different signals (channels, an array of 2 UGen graphs) that you can hear as different and therefore observe the stereo spread.\n\nAnd similarly, to use your other example with In.ar where I have added in=2, so that it takes my mic in (but you can specify another bus) and wrapped it into a feedback delay with an array of two values for delayTime. Multichannel expansion thus creates two channels that are different because they have different delaytimes but the rest of UGen graph is the same (a copy). Changing spread now works:\n\n```supercollider\n(\nSynthDef(\\stereo,{|out=0, in=2, spread=1, level=1, center=0.0|\n Out.ar(out,\n Splay.ar(\n CombN.ar(\n In.ar(in, 1), 1, [0.3,0.4], 2)\n ,spread,level,center));\n}).play;\n)\n```\n\nI hope that clarifies the issue better."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ HPF.ar(Saw.ar(200, 0.1), FSinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3600, 4000), 5) }.play;\n\n(\n{ var ctl = HPF.kr(LFSaw.kr(5), SinOsc.kr(XLine.kr(0.07, 30, 20), 0, 35, 40)) ;\n SinOsc.ar(ctl * 200 + 500);\n}.play;\n);\n\n(\n{ var ctl = HPF.kr(LFSaw.kr(5, 0.1), MouseX.kr(2, 200, 1));\n SinOsc.ar(ctl * 200 + 400) * 0.1;\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ HPF.ar(Saw.ar(200, 0.1), FSinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3600, 4000), 5) }.play;\n\n(\n{ var ctl = HPF.kr(LFSaw.kr(5), SinOsc.kr(XLine.kr(0.07, 30, 20), 0, 35, 40)) ;\n SinOsc.ar(ctl * 200 + 500);\n}.play;\n);\n\n(\n{ var ctl = HPF.kr(LFSaw.kr(5, 0.1), MouseX.kr(2, 200, 1));\n SinOsc.ar(ctl * 200 + 400) * 0.1;\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `LinSelectX`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar(300),\n Pulse.ar(230)\n ];\n\n LinSelectX.ar(MouseX.kr(0, 1) * a.size, a) * 0.2\n}.play;\n);\n\n(\n{\n var a;\n a = [\n SinOsc.kr(0.25),\n LFSaw.kr(10),\n LFPulse.kr(0.3)\n ];\n\n SinOsc.ar(LinSelectX.kr(MouseX.kr(0, 1) * a.size, a) * 300 + 400) * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\np = SFPlayer.new; //shows open file dialog\n\n//specify the file\np = SFPlayer.new(Platform.resourceDir +/+ \"sounds/a11wlk01.wav\";\np.play;\np.stop;\np.gui;\n\n// shows open file dialog and opens the gui\np = SFPlayer.new.gui;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\np = SFPlayer.new; //shows open file dialog\n\n//specify the file\np = SFPlayer.new(Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\np.play;\np.stop;\np.gui;\n\n// shows open file dialog and opens the gui\np = SFPlayer.new.gui;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DetectSilence`."}, {"role": "assistant", "content": "```supercollider\n// this frees after the Decay has become quiet enough for a long enough time\n{ var signal = Decay.ar(Impulse.ar(0), 2, PinkNoise.ar(0.2)); DetectSilence.ar(signal, doneAction: Done.freeSelf); signal }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `List`."}, {"role": "assistant", "content": "```supercollider\n(\n// Create a new empty List with size: 3\nx = List.new(3);\n\nx.postln; // -> List[ ]\n\n// Add numbers 0 to 4 to the List\n5.do({ |i| x.add(i) });\n\n// The list has been modified in-place with each added item\nx.postln; // -> List[ 0, 1, 2, 3, 4 ]\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for Re: Dark sea horns: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\n Ndef(\\x, {\n var output;\n var delayTime;\n var delayMax = 0.2;\n var delayAdd = 0.1;\n var pulseFreq = 0.5;\n var proxyMul = 2;\n var pulseMin = 40;\n var pulseMax = 130;\n var numOfEchos = 2;\n\n var mainPulse = LFPulse.ar(pulseFreq, 0, 0.5).range(pulseMin, pulseMax);\n var proxy = Ndef(\\x).ar * proxyMul;\n var ampModFreq = SinOsc.ar(0.01, 0).range(0.3, 30);\n var ampMod = LFNoise1.ar(ampModFreq, 6);\n output = SinOsc.ar(mainPulse + proxy, 0, ampMod).tanh;\n numOfEchos.do{\n delayTime = {delayMax.rand + delayAdd}!2;\n output = AllpassL.ar(output, 0.1, delayTime, 5);\n };\n output.tanh;\n }).play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `ArrayedCollection.foldPut` do?"}, {"role": "assistant", "content": "Same as #-put, but values for index greater than the ArrayedCollection instance size minus one will be folded"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// vary frequency\n{ StandardN.ar(MouseX.kr(20, SampleRate.ir)) * 0.3 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// vary frequency\n{ StandardN.ar(MouseX.kr(20, SampleRate.ir)) * 0.3 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `SoundIn` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\nu = Server(\\scau, NetAddr(\"127.0.0.1\", 9989)); // Change the port from 9989 to the right one for you\nu.serverRunning = true;\nu.ping(10); // Gives about 0.02 for me - confirms that communication is working\n// Now let's create a quick ring-modulator effect:\nz = { SoundIn.ar([0,1]) * SinOsc.ar(MouseX.kr(100, 1000)) }.play(u);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `BrownNoise`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// 以下のSynthDefは全て共通のコントロール名(mul)を持つ\n(\n// 3つのSynthDefとグループを作成する\nSynthDef(\"synthNumber1\", { arg mul = 0.2;\n Out.ar(\n 0,\n BrownNoise.ar(mul) * LFNoise0.kr([1, 1.01])\n )\n }, [0.1]).add;\nSynthDef(\"synthNumber2\", { arg mul = 0.2;\n Out.ar(\n 0,\n WhiteNoise.ar(mul) * LFNoise1.kr([2.99, 3])\n )\n }, [0.1]).add;\nSynthDef(\"synthNumber3\", { arg mul = 0.2;\n Out.ar(\n 0,\n PinkNoise.ar(mul) * LFNoise2.kr([0.79, 0.67])\n )\n}, [0.1]).add;\n);\n\n(\n// グループを作成する\n~myGroup = Group.new;\n);\n\n(\n// 3つのシンセを加える\nSynth.head(~myGroup, \"synthNumber1\");\nSynth.head(~myGroup, \"synthNumber2\");\nSynth.head(~myGroup, \"synthNumber3\");\n);\n\n// 3つのシンセのそれぞれの\\mulコントロール、新しい(そして同じ)値にセットする\n~myGroup.set(\\mul, 0.05)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\np = ProxySpace.push(s.boot);\n~a.play.quant_(4); ~b.play.quant_(4);\n~c = { LFNoise1.kr(8).range(0,15).round };\n~a = Pbind(\\degree, Pstutter(4, Pseq([0,2,3,4], inf)), \\octave, [3,4], \\dur, 0.25, \\amp, 0.3);\n~b = Pbind(\\octave, 4, \\scale, Scale.majorPentatonic, \\degree, ~c, \\dur, 1/4, \\legato, 0.5);\n```"}, {"role": "assistant", "content": "a short piece which plays random major music. It sounded very happy."}]} {"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nx = { |freq = 440, amp = 0.2| SinOsc.ar(freq) * amp }.play;\nx.set(\\freq, 660);\n```"}, {"role": "assistant", "content": "Starts an anonymous synth with two controls, then changes one of them while it plays.\n\nThe `|freq = 440, amp = 0.2|` are arguments of the function, and `.play` turns each into a Synth control\nwith that default value. `x` holds the Synth node. `.set(\\freq, 660)` sends a `/n_set` message to the\nserver, so the oscillator changes frequency without being restarted — that is why the sound glides rather\nthan re-triggering. Note that `\\freq` is a Symbol: the backslash is part of the name."}]} -{"conversations": [{"role": "user", "content": "What is `Bag`?"}, {"role": "assistant", "content": "Bag — Unordered collection of objects"}, {"role": "user", "content": "What does `Bag.new` do?"}, {"role": "assistant", "content": "Creates a Bag with an initial capacity for n objects."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nBag[1, 2, 3].add(4).postln;\n\nBag[1, 2, 3].add(3).postln;\n\nBag[\"abc\", \"def\", \"ghi\"].add(\"jkl\").postln;\n\nBag[\"abc\", \"def\", \"ghi\"].add(\"def\").postln;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n‎{h={|f|1-LFTri.ar(f)};l={|s,e|Line.ar(s,e,1200,1,0,2)};FreeVerb.ar(h.(l.(147,5147))*h.(l.(1117,17))*h.(100)*h.([55,55.1])*0.05,0.7,1)}.play\n\n//Explanation of this piece - http://schemawound.com/post/40100438722/11-13-2012-tweet-explained\n```"}, {"role": "assistant", "content": "Explanation of this piece - http://schemawound.com/post/40100438722/11-13-2012-tweet-explained."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// larger pitch range and lookBack in upper voice \n// as with most patterns, no automatic array expansion of pattern arguments\n\n(\n~src = Pseg(Pseq([65, 85], inf), 5, \\sin).round;\n\np = Pbind(\n \\dur, 1/7,\n \\midinote, Ptuple([\n PLIdev(\\src, 1, -1, 1),\n PLIdev(\\src, 3, -5, 5) + 8.5\n ]).trace(prefix: \"midi \"),\n).play;\n;\n\np.stop\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// larger pitch range and lookBack in upper voice \n// as with most patterns, no automatic array expansion of pattern arguments\n\n(\n~src = Pseg(Pseq([65, 85], inf), 5, \\sin).round;\n\np = Pbind(\n \\dur, 1/7,\n \\midinote, Ptuple([\n PLIdev(\\src, 1, -1, 1),\n PLIdev(\\src, 3, -5, 5) + 8.5\n ]).trace(prefix: \"midi \"),\n).play;\n);\n\np.stop\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for mrcl snippets #3: feedback timer (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\fbTimer){\n m = (Dust.ar(0.5!2)*20).tanh+\\in.ar(0!2);\n r = Timer.kr(Onsets.kr(FFT(LocalBuf(128)!2,m)));\n c = CombL.ar(m+(LocalIn.ar(2)*0.8),4,r.clip(0.0001,4),r*4);\n l = Resonz.ar(c,TRand.kr(20,20000,m),0.1,1000).tanh;\n LocalOut.ar(m+l);\n m+c;\n}.play\n);\n\n\n(\nNdef(\\fbTimerSel){\n m = (Dust.ar(0.5!2)*20).tanh+\\in.ar(0!2);\n r = Timer.kr(Onsets.kr(FFT(LocalBuf(128)!2,m)));\n c = CombL.ar(m+(LocalIn.ar(2)*0.8),4,r.clip(0.0001,4),r*4);\n l = Resonz.ar(c,TRand.kr(20,20000,m),0.1,1000).tanh;\n n = SelectX.ar(LFNoise0.kr(r.linlin(0,4,0.1,10)).range(0,4),[m,K2A.ar(r),c,l]);\n\n LocalOut.ar(n);\n n\n\n}.play\n);\n\n\n(\nNdef(\\fbTimer3){\n var localin = (LocalIn.ar(2)*0.98)+\\in.ar(0!2);\n var dust = (Dust.ar(Rand(0.5,10)!2)*200)+\\in.ar;\n var timer = Timer.ar(dust);\n var comb = CombL.ar(dust+localin,4,timer.clip(0.0001,4),timer*4);\n var filt = Resonz.ar(comb,TRand.kr(20,Rand(20,20000),dust),0.1,1000).tanh;\n LocalOut.ar(dust+filt);\n comb+dust;\n comb+dust*timer;\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pgtpar`."}, {"role": "assistant", "content": "```supercollider\n// synthdef\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n}).add;\n);\n\n// pattern with different start times\n(\nx = Pbind(\n \\instrument, \\help_sinegrain,\n \\degree, Pseq(#[0, 5, 4, 2, 1, 1, 3], inf),\n \\dur, Pseq(#[0.25, 0.5, 1.0], inf),\n \\scale, #[0, 3, 5, 9, 10]\n);\na = Pbus(Pgtpar([0.0, x, 1.5, x, 2.25, x])).play;\n);\ns.plotTree;\na.stop;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n({ [5, 6, 2].choose.postln } ring2: { [2, -1, 3].choose.postln }).value\n\n(\n{ a = SinOsc.ar(335); b = SinOsc.ar(MouseX.kr(1, 1000, 1));\nring2(a, b) * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n({ [5, 6, 2].choose.postln } ring2: { [2, -1, 3].choose.postln }).value\n\n(\n{ a = SinOsc.ar(335); b = SinOsc.ar(MouseX.kr(1, 1000, 1));\nring2(a, b) * 0.1 }.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `BinaryOpUGen`."}, {"role": "assistant", "content": "```supercollider\n// trigger an envelope\n(\n{\n var trig;\n trig = SinOsc.ar(1) > 0.1;\n EnvGen.kr(Env.perc, trig, doneAction: Done.none) * SinOsc.ar(440, 0, 0.1)\n}.play\n) // > outputs 0 or 1\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Archive`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// make a storage place for various objects:\nq = (); // Event\n\nq[\\a_long_array] = Array.rand(128, 0.0, 1.0);\nq[\\pi_squared] = pi * pi;\nq[\\favourite_sound] = { { SinOsc.ar([300, 330]).sum * LFPulse.kr(2 + [0, 0.01]) * 0.1 }.play };\nq[\\same_long_array] = q[\\a_long_array]; // same objects may appear several times\n\nArchive.global.put(\\myData, q);\n\n\nArchive.global.at(\\myData).postcs;\n\n// after a recompile:\ns.boot;\n\nq = Archive.global.at(\\myData);\nq.postcs;\nq[\\favourite_sound].value;\n```"}]} +{"conversations": [{"role": "user", "content": "What is the difference between \\degree, \\midinote and \\freq in a Pbind?"}, {"role": "assistant", "content": "`\\freq` is the frequency in Hz and is used as-is. `\\midinote` is a MIDI note number, converted to frequency by the default instrument. `\\degree` is a scale degree, quantised to the scale in \\scale (default major) rooted at \\root; degrees can be negative or fractional. If you set both, the more specific conversion wins, so set exactly one."}]} +{"conversations": [{"role": "user", "content": "What does `Number.complex` do?"}, {"role": "assistant", "content": "Create a new Complex number whose real part is the receiver with the given imaginary"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nb = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n\n// This is very cool!\n\n(\n{\n Spring.ar(PlayBuf.ar(1, b, loop: 1)*Saw.ar(4));\n}.play;\n)\n```"}, {"role": "assistant", "content": "Feeding sound file multiplied by a slow saw wave into the spring physical model. Fascinating results ensue."}]} +{"conversations": [{"role": "user", "content": "What is `MultiTap` in SuperCollider?"}, {"role": "assistant", "content": "MultiTap — Multiple tap delay. This is a wrapper which creates a multiple tap delay line using Category: UGens > Buffer, UGens > Delays > Buffer."}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for UI sounds (pt1): bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n// UI sounds\n// this code is an attempt to recreate a sound\n// inspired from some technological/electrical UI interface\n\n// 1. first define the synth\n// Here we are using the FM technique\n(\nSynthDef(\\fmmod, {\n |\n amp=0.2,\n fc=1000,\n fm = 100,\n idx = 100,\n atk=0.01,\n rls=0.1\n |\n var env = EnvGen.ar(Env.perc(atk, rls), doneAction:2);\n var modulator = SinOsc.ar(fm);\n var carrier = SinOsc.ar(fc + (idx*modulator) );\n var sig = carrier * env * amp;\n sig = HPF.ar(sig, 1000);\n Out.ar(0, sig!2);\n}).add;\n);\n\n// 2. then define the Pbind which will play the sequence\n// of UI sounds simulating variuos characters showing up on an\n// imaginary display.\n// Play around FC, FM, ATK and RLS to obtain different sound characters.\n(\np = Pbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 100,\n \\idx, 100,\n \\amp, 0.6,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).asEventStreamPlayer;\n);\n\n// 3. play it\np.play;\n\n// 4. Here are some presets\n\n// \"cricket\" preset\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 100,\n \\idx, 100,\n \\amp, 0.6,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 2\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 1000,\n \\idx, 100,\n \\amp, 0.6,\n \\atk, 0.001,\n \\rls, 0.01,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 3\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 100,\n \\idx, 10,\n \\amp, 0.4,\n \\atk, 0.01,\n \\rls, 0.01,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 4\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 1000,\n \\fm, 100,\n \\idx, 1000,\n \\amp, 0.2,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n\n// preset 5\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 5000,\n \\fm, 1000,\n \\idx, 1000,\n \\amp, 0.4,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 5\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 8000,\n \\fm, 1000,\n \\idx, 1000,\n \\amp, 0.7,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `SpecPcile` in SuperCollider briefly."}, {"role": "assistant", "content": "SpecPcile — Find a percentile of FFT magnitude spectrum Given an FFT chain this calculates the cumulative distribution of the frequency spectrum, and outputs the frequency value which corresponds to the desired percentile. Category: UGens > FFT."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `BinaryOpUGen`."}, {"role": "assistant", "content": "```supercollider\n// trigger an envelope\n(\n{\n var trig;\n trig = SinOsc.ar(1) > 0.1;\n EnvGen.kr(Env.perc, trig, doneAction: Done.none) * SinOsc.ar(440, 0, 0.1)\n}.play\n) // > outputs 0 or 1\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// a Buffer for the UGens to use, one second at the current sample rate\nb = Buffer.alloc(s, s.sampleRate * 1, 1);\n\n// write a signal into a delay, tap it at multiple times\nSynthDef(\\test, { |out, buffer|\n var src, tapPhase, tap1, tap2, tap3;\n src = WhiteNoise.ar(0.2) * Decay.kr(Dust.kr(3), 0.2);\n tapPhase = DelTapWr.ar(buffer, src);\n #tap1, tap2, tap3 = DelTapRd.ar(buffer, tapPhase,\n [0.2, 0.27, 0.303], // tap times\n 1, // no interp\n [1.\n// …\n```"}, {"role": "assistant", "content": "a Buffer for the UGens to use, one second at the current sample rate write a signal into a delay, tap it at multiple times (DelTapWr: Write to a buffer for a DelTapRd UGen)"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Condition`."}, {"role": "assistant", "content": "```supercollider\n(\nc = Condition.new(false);\n\nRoutine {\n 1.wait;\n \"waited for 1 second\".postln;\n 1.wait;\n \"waited for another second, now waiting for you ... \".postln;\n c.wait;\n \"the condition has stopped waiting.\".postln;\n 1.wait;\n \"waited for another second\".postln;\n \"waiting for you ... \".postln;\n c.test = false;\n c.wait;\n \"the condition has stopped waiting.\".postln;\n 1.wait;\n \"the end\".postln;\n}.play;\n);\n\n// continue\n(\nc.test = true;\nc.signal;\n);\n\n// a typical use is a routine that can pause under certain conditions:\n(\nc = Condition.new;\nfork { loop { 1.wait; \"going\".postln; c.wait } };\n);\nc.test = true; c.signal;\nc.test = false;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `LFSaw.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Sawtooth oscillator Arguments: freq — Frequency in Hertz.; iphase — Initial phase offset. For efficiency reasons this is a value ranging from 0 to 2.; mul — Output will be multiplied by this value.; add — This value will be added to the output.."}]} {"conversations": [{"role": "user", "content": "What does `Pen.scale` do?"}, {"role": "assistant", "content": "Scales subsequent drawing. x and y are scaling factors (i.e. 1 is normal, 2 is double size,"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes sound of an alien weapon firing."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"raygun\", {arg amp = 0.5, sinfreq = 1000, glissf = 0.001, att = 0.01, rel = 0.9;\n var gliss = XLine.kr(sinfreq, sinfreq*glissf, rel);\n var snd = SinOsc.ar(gliss);\n var env = EnvGen.kr(Env.perc(att, rel), doneAction: 2);\n snd = snd * env * amp;\n Out.ar(0, snd);\n}).add;\n);\n\n(\nPbind(\n \\instrument, \"raygun\",\n \\dur, Pseq([0.75,0.75,0.75,0.75,0.25,0.25,0.25]*0.5, inf),\n \\amp, 0.4\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for smooth arpeggio, updated envelope (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\bass, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.perc(0.2), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n({ [5, 6, 2].choose.postln } absdif: { [2, -1, 3].choose.postln }).value\n\n(\n{ a = SinOsc.ar(335); b = SinOsc.ar(MouseX.kr(1, 1000, 1));\nabsdif(a, b) * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n({ [5, 6, 2].choose.postln } absdif: { [2, -1, 3].choose.postln }).value\n\n(\n{ a = SinOsc.ar(335); b = SinOsc.ar(MouseX.kr(1, 1000, 1));\nabsdif(a, b) * 0.1 }.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Re: Timpani (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\ns.boot\n\n(\nSynthDef(\\aSynth, { |rel = 0, choose = 0, amp = 0|\n var klank, env;\n\n klank = Klank.ar(`[choose ! 12, {Rand(0.128, 0.7)} ! 12], BrownNoise.ar(0.7));\n env = EnvGen.kr(Env.perc(0.01, rel), doneAction: 2);\n Out.ar(0, klank * env.dup * amp);\n}).add;\n);\n\n(\n{\n 42.do{\n x = [70, 90, 120].choose;\n y = rrand(0.01, 5);\n // attack\n Synth(\\aSynth, [\\rel, y, \\choose, x, \\amp, 128e-6]);\n // resonance\n Synth(\\aSynth, [\\rel, 1, \\choose, x, \\amp, 128e-5]);\n y.wait;\n }\n}.fork;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Modulation sequencing?"}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\rlpf, { arg out=0, amp=0.1, gate=1, pan=0, spread=0.8, freq=200, doneAction=2, ffreq=4000, rq=0.3;\n var sig, sig1, sig2, sig3;\n sig = LFSaw.ar(freq * [1.01,1,0.99]);\n sig = RLPF.ar(sig, ffreq, rq);\n sig = sig * EnvGen.ar(\\adsr.kr(Env.adsr(0.01,0.1,0.8,0.1)),gate,doneAction:doneAction);\n sig = Splay.ar(sig, spread, amp, pan);\n Out.ar(out, sig);\n}).add;\n);\n\n///////// lfo communicating with main pattern\n\n(\nNdef(\\lfo1, { EnvGen.kr(Env([1,4,1],[0.1,0.2]), \\trig.tr(0)) * \\lforange.kr(1000); });\n\nPdef(\\main, Pbind(\n \\instrument, \\rlpf,\n \\midinote, Pseq([60, 62, 64], inf),\n \\legato, 0.5,\n \\move, Pseq([0,1,0, 1,0,0],inf),\n \\lforange, Pseq([1000,2000,3000],inf).stutter(8),\n \\ffreq, Pfunc({ arg ev;\n Ndef(\\lfo1).set(\\trig, ev[\\move], \\lforange, ev[\\lforange]);\n Ndef(\\lfo1);\n }),\n \\dur, 0.5\n)).play \n);\n\n////// sub pattern way\n\n(\n Pdef(\\micro, { arg midinote, move;\n Pbind(\n \\instrument, \\rlpf,\n \\midinote, midinote + \n switch(move,\n \\up, Pseq((0..7)),\n \\down, Pseq((7..0)),\n Pseq(0!8),\n ),\n \\dur, 1/16,\n )\n });\n\n Pdef(\\main,\n Pbind(\n \\instrument, \\micro,\n \\move, Pseq([\\n, \\n, \\up, \\n, \\n, \\down],inf),\n \\type, \\phrase,\n \\midinote, Pseq([60, 62, 64], inf),\n \\dur, 1/2,\n )\n ).play;\n);\n\n//////// same in mono\n\n(\n Pdef(\\micro, { arg midinote, move;\n Pmono(\n \\rlpf,\n \\midinote, midinote + \n switch(move,\n \\up, Pseq((0..7)),\n \\down, Pseq((7..0)),\n Pseq(0!8),\n ),\n \\dur, 1/16,\n )\n });\n\n Pdef(\\main,\n Pbind(\n \\instrument, \\micro,\n \\move, Pseq([\\n, \\n, \\up, \\n, \\n, \\down],inf),\n \\type, \\phrase,\n \\midinote, Pseq([60, 62, 64], inf),\n \\dur, 1/2,\n )\n ).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n/* Audio plugin definition\n\n Each audio plugin should define the following global variables:\n ~name: (symbol) name of the spatializer\n ~description: (string) a short description\n ~function: the actual definition of the plugin\n\n*/\n\n~name = \\Limiter;\n~description = \"A simple limiter\";\n~channelLayout = \\mono;\n\n~function = { arg in, level=0.7, dur=0.01, outputDB=0;\n outputDB.dbamp * Limiter.ar(In.ar(in), level, dur);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\ns.boot;\n\n(\nb = Buffer.read(s, ExampleFiles.apollo11);\nx = { |envbuf = -1|\n var pointer, pitch;\n // pointer - move from beginning to end of soundfile over 15 seconds\n pointer = LFSaw.ar(1/15).range(0, 1);\n // control pitch with MouseX\n pitch = MouseX.kr(0.5, 2);\n Warp1.ar(\n numChannels: 1,\n bufnum: b,\n pointer: pointer,\n freqScale: pitch,\n windowSize: 0.1,\n envbufnum: envbuf,\n overlaps: 8,\n windowRandRatio: 0.1,\n interp: 2\n )\n}.play\n\n);\n\n\n(\n// a custom envelope\n// …\n```"}, {"role": "assistant", "content": "pointer - move from beginning to end of soundfile over 15 seconds control pitch with MouseX (Warp1: Warp a buffer with a time pointer)"}]} -{"conversations": [{"role": "user", "content": "How should I organise a SuperCollider project on disk?"}, {"role": "assistant", "content": "One folder per piece, with a fixed shape:\n\n```text\nmy-piece/\n synthdefs.scd // only SynthDef(...).add, loaded first\n material.scd // buffers, samples, scales\n piece.scd // the performance: Tdefs, Pbinds, Ndefs\n README.md // tempo, required samples, how to run it\n```\n\nThen the workflow is: open `synthdefs.scd`, Ctrl+A Ctrl+Enter to load it, load `material.scd`, and work in\n`piece.scd`. Keeping definitions out of the performance file is what makes a reboot survivable and a piece\nre-runnable six months later."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nNdef(\\birdy, {arg freq=1500, amp=0.5, rate=10;\n var osc, son, convIn, rand;\n osc=LFCub;\n rand = LFNoise1.ar(rate);\n convIn=LinCongN.ar(rate);\n son = osc.ar(Convolution.ar(convIn,convIn));\n freq = Latch.kr(rand.range(0,1).round(0.1), rand) * freq;\n freq = osc.ar(osc.ar(rand)*rand.range(0,10)).range(freq, freq*3);\n son = Formlet.ar(son, freq, convIn.abs*0.1, rand.abs);\n son = Normalizer.ar(son, 0.9, 0.1) * convIn.abs * LFPulse.kr(LFPulse.kr(rand.abs), 0, rand.abs);\n son = son + GVerb.ar(son, 99, 2, mul: rand.range(0,0.3));\n son * amp\n}).play\n)\n```"}, {"role": "assistant", "content": "I just rewrote one of autocsi's tweets and came out with this which sounds like a digital bird of some kind:."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for our first work and posting."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"pulse\",{ arg freq,delayTime,amp = 1.0,attack = 0.01;\n var out,out2,env;\n env = EnvGen.kr(Env.perc(attack, 1, 5, 10),doneAction: 2);\n z = SinOsc.ar(freq,0,0.7);\n a = Pan2.ar(ToggleFF.ar(TDelay.ar(z,delayTime)) * SinOsc.ar(freq),\n SinOsc.kr(3,0), 0.6);\n out = Pan2.ar(z, SinOsc.kr(5,1.0pi),0.7 ) + a;\n out = out * env;\n out = out.clip2(1);\n \n Out.ar(0,FreeVerb.ar(out,0.7,1.0,0.4, amp)); \n}).send(s);\n\nSynthDef(\"droneee\", { arg freq = 440, amp = 1.0, outbus = 0, phase = 0;\n var out, env;\n env = EnvGen.kr(Env.sine(10),doneAction: 2);\n out = LFPulse.ar(freq , 0.15);\n out = RLPF.ar(out,SinOsc.kr(0.3, 0, 200, 1500), 0.1);\n out = FreeVerb.ar(out, 0.5, 0.5, 0.5) * env;\n out = Pan2.ar(out, SinOsc.kr(1/10, phase),amp);\n \n Out.ar(outbus, out);\n}).send(s);\n\n\nSynthDef(\"bass\",{\n arg freq,amp,outbus=0;\n var env,out;\n out = SinOsc.ar(freq,0,amp);\n env = EnvGen.kr(Env.perc(0.5,1,1,0),doneAction: 2); \n out = out*env;\n out = Pan2.ar(out,0);\n Out.ar(outbus,out);\n \n \n}).send(s);\n);\n\n\n(\n\np = Prand( [31,40, 45,64,68,69], inf).asStream;\nq = Prand( [3,0.7,1,0.5], inf ).asStream;\ne = Prand([59,72,76,79,81,88,90],inf).asStream;\n\nt = Task({\n inf.do({\n \n if( 0.1.coin, {\n Synth(\"pulse\",\n [\\freq,e.value.midicps,\n \\amp,0.07.rand +0.2,\n \\attack,7.0.rand,\n \\delayTime, 0.02;\n ]);\n });\n\n\n Synth(\"droneee\",\n [\\outBus,0,\n \\freq, p.value.midicps,\n \\amp, (0.02.rand2 + 0.05) * 0.7,\n \\phase,[0,1.5pi].wchoose([0.5,0.5]);\n ]);\n q.value.wait;\n \n Synth(\"bass\",[\\freq,31.value.midicps,\\amp,0.3]);\n\n });\n});\n\nt.start;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nt = Tuning.et12;\nt.semitones; // [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]\nt.ratios; // [1, 1.0594630943591, 1.1224620483089, 1.1892071150019, etc.]\n\nPbind(\\scale, Scale.major(t), \\degree, Pseq((0..7) ++ (6..0) ++ [\\rest], 1), \\dur, 0.25).play;\n\n// use non-standard tuning\nt = Tuning.just;\nt.semitones; // [0, 1.1173128526978, 2.0391000173077, 3.1564128700055, etc.]\nt.r\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nt = Tuning.et12;\nt.semitones; // [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]\nt.ratios; // [1, 1.0594630943591, 1.1224620483089, 1.1892071150019, etc.]\n\nPbind(\\scale, Scale.major(t), \\degree, Pseq((0..7) ++ (6..0) ++ [\\rest], 1), \\dur, 0.25).play;\n\n// use non-standard tuning\nt = Tuning.just;\nt.semitones; // [0, 1.1173128526978, 2.0391000173077, 3.1564128700055, etc.]\nt.ratios.collect(_.round(0.001)); // [1, 1.067, 1.125, 1.2, 1.25, 1.333, 1.406, 1.5, etc.]\n\nPbind(\\scale, Scale.major(t), \\degree, Pseq((0..7) ++ (6..0) ++ [\\rest], 1), \\dur, 0.25).play;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `RedMixGUI` in SuperCollider briefly."}, {"role": "assistant", "content": "RedMixGUI — gui for RedMixMono, RedMixStereo, RedMixStereoMono gui for redMix objects. Category: Red > redMix."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = Env.adsr;\na.levels;\na.range(42, 45).levels;\na.exprange(42, 45).levels;\na.curverange(42, 45, -4).levels;\n\n(\n// Mapping an Env to an exponential frequency range:\n{\n SinOsc.ar(EnvGen.ar(Env.perc(0.01, 0.7).exprange(40, 10000), doneAction: Done.freeSelf)) * 0.2;\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = Env.adsr;\na.levels;\na.range(42, 45).levels;\na.exprange(42, 45).levels;\na.curverange(42, 45, -4).levels;\n\n(\n// Mapping an Env to an exponential frequency range:\n{\n SinOsc.ar(EnvGen.ar(Env.perc(0.01, 0.7).exprange(40, 10000), doneAction: Done.freeSelf)) * 0.2;\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `EZText.enabled` do? What arguments does it take?"}, {"role": "assistant", "content": "Sets/gets whether the textfield is Arguments: bool — An instance of Boolean. Default is `true`.."}]} -{"conversations": [{"role": "user", "content": "What does `CoinGate.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Statistical gate. Arguments: prob — Value between 0.0 and 1.0 determines probability of either possibilities.; in — The trigger input.."}]} -{"conversations": [{"role": "user", "content": "Explain `Stethoscope` in SuperCollider briefly."}, {"role": "assistant", "content": "Stethoscope — An oscilloscope Stethoscope provides a complete oscilloscope GUI. It displays a window containing a bus-plotting ScopeView and an interface to configure the plotting and choose among the buses. Category: GUI > Interfaces."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// start and pchRatio are streamed\n(\nInstrSpawner({ arg sample,start=0,pchRatio=1.0,env;\n PlayBuf.ar(\n sample.numChannels,\n sample.bufnumIr,\n pchRatio,\n 1,\n start * sample.bufFramesIr,\n 1\n ) * EnvGen.kr(env,doneAction: 2)\n},[\n Sample(\"a11wlk01.wav\"),\n Pbrown(0,1,0.1,inf),\n Prand(\n Array.fill(4,{\n Pseries(rrand(-20,30),[2,-2].choose,rrand(5,20))\n }),inf).midiratio,\n Env.sine(0.2,0.4)\n\n],0.06).\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// start and pchRatio are streamed\n(\nInstrSpawner({ arg sample,start=0,pchRatio=1.0,env;\n PlayBuf.ar(\n sample.numChannels,\n sample.bufnumIr,\n pchRatio,\n 1,\n start * sample.bufFramesIr,\n 1\n ) * EnvGen.kr(env,doneAction: 2)\n},[\n Sample(\"a11wlk01.wav\"),\n Pbrown(0,1,0.1,inf),\n Prand(\n Array.fill(4,{\n Pseries(rrand(-20,30),[2,-2].choose,rrand(5,20))\n }),inf).midiratio,\n Env.sine(0.2,0.4)\n\n],0.06).play\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// =========================\n// extra demos for \\glockenspiel\n// =========================\n\n(\n// made by Diya Menon\n// demo\nPbindef(\\dmglockenspiel,\n \\instrument, \"glockenspiel\",\n \\midinote, Pseq([\n [65, 68, 72, 75],\n 72, 72, 72, 70, 72, 70, 68,\n [61, 65, 70, 73, 77],\n 73, 73, 73, 72, 72, 70, 68], 2),\n \\amp, Pseq([0.015, 0.005, 0.005, 0.0075, 0.0075, 0.01, 0.01, 0.02], 4) * 3,\n \\dur, Pseq([0.3, 0.3, 0.3, 0.15, 0.15, 0.3, 0.15, 0.15], 4),\n \\rel, 3,\n \\exciterRel, 0.03,\n \\att, 0.0005,\n).play;\n)\n```"}, {"role": "assistant", "content": "========================= extra demos for \\glockenspiel =========================."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//simple particlesystem.\n//with mouse controlling world gravity and system position\n\n(\nvar width= 300, height= 300, w, world,\nsys;\n\n//--world\nw= RedWindow(\"particlesystem test\", Rect(128, 64, width, height)).front;\nworld= RedWorld3(RedVector2D[width, height], 0, 20, -0.25); //dim,grav,maxvel,damp\n\n//--system\nsys= RedParticleSystem.new;\n\n//--loop\nw.draw{\n world.gravity= RedVector2D.newFrom(w.mouse/([width, height])-0.5);\n\n //--add new particles and update old\n sys.add(RedParticle(world, w.mouse+5.rand2, 0, RedVector2D[2.rand2, 10.rand], 1.5, 5.rand).age_(40.rrand(50)));\n sys.addForce(world.gravity);\n sys.update;\n\n //--render\n sys.do{|o| //iterate all particles in the system\n Pen.fillColor= Color.grey((o.age/50), 1);\n Pen.fillOval(Rect.aboutRedObject2D(o));\n };\n};\nw.play;\nCmdPeriod.doOnce({w.close});\n)\n```"}, {"role": "assistant", "content": "simple particlesystem. with mouse controlling world gravity and system position."}]} -{"conversations": [{"role": "user", "content": "What does `Set.keyAt` do?"}, {"role": "assistant", "content": "Returns the object at the internal index. This index is not"}]} -{"conversations": [{"role": "user", "content": "What does `EnvelopedPlayer.limit` do?"}, {"role": "assistant", "content": "takes a Player as input and plays it through an Env with fused protection"}]} -{"conversations": [{"role": "user", "content": "What does `PlayerInputProxy.ar` do?"}, {"role": "assistant", "content": "placeholder for Patch inputs for a player that will be supplied later"}]} -{"conversations": [{"role": "user", "content": "What does `Color.symmetricDifference` do? What arguments does it take?"}, {"role": "assistant", "content": "An object which stores color values Arguments: aColor — An instance of Color.; opacity — A value between 0 and 1. Default value is 1.0.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\n// excitation signal is WhiteNoise, triggered twice a second with varying OnePole coef\n(\n { Pluck.ar(WhiteNoise.ar(0.1), Impulse.kr(2), 440.reciprocal, 440.reciprocal, 10,\n coef: MouseX.kr(-0.999, 0.999))\n }.play(s)\n);\ns.quit;\n// a group of angry fretless mandolin players\n(\n {\n var freq, numparts;\n numparts = 50;\n freq = SinOsc.kr(Array.fill(numparts, { Rand(0.05, 0.2) }),\n Array.fill(numparts, { Rand(0, 1.0) })).range(1000,\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\n// excitation signal is WhiteNoise, triggered twice a second with varying OnePole coef\n(\n { Pluck.ar(WhiteNoise.ar(0.1), Impulse.kr(2), 440.reciprocal, 440.reciprocal, 10,\n coef: MouseX.kr(-0.999, 0.999))\n }.play(s)\n);\ns.quit;\n// a group of angry fretless mandolin players\n(\n {\n var freq, numparts;\n numparts = 50;\n freq = SinOsc.kr(Array.fill(numparts, { Rand(0.05, 0.2) }),\n Array.fill(numparts, { Rand(0, 1.0) })).range(1000, 3000);\n LeakDC.ar(\n Pan2.ar(\n Pluck.ar(\n WhiteNoise.ar(0.1).dup(numparts),\n Impulse.kr(Array.fill(numparts, { Rand(10, 12) })),\n 100.reciprocal, freq.reciprocal, 2, Rand(0.01, 0.2), mul: 1),\n Array.fill(numparts, { Rand.new(-1.0, 1.0) }))\n .sum\n );\n }.play(s);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `ServerQuit` in SuperCollider briefly."}, {"role": "assistant", "content": "ServerQuit — register actions to be taken when a server quits The singleton ServerQuit provides a place for registering functions and objects for events that should happen when a given server quits. Category: Control."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(//*********PREPARE**********\np.pop;\n//Any code that needs to access your own environment goes here\np = ProxySpace.push(s);\n~fxLoop.play.fadeTime_(5);\n);\n\n(//*********FXLoop**********\n~fxLoop = {\n var in = SoundIn.ar([0,1]);\n // in = in + (in * SinOsc.ar(LFTri.ar([0.1, 0.09]).range(215, 321)));\n in = in + CombC.ar(in, 2, SinOsc.ar(0.015).range(0.5, 1) * [0.13, 0.17], 7);\n in = in + CombC.ar(in, 2, SinOsc.ar(0.01).range(0.5, 1) * [0.1, 0.15], 7);\n in = in + CombC.ar(in, 2, [1.5, 1.0], 7);\n in = in + GVerb.ar(in, 10);\n in = in / 3;\n in;\n}\n)\n```"}, {"role": "assistant", "content": "Audio Sample: https://soundcloud.com/schemawound/supercollider-guitar-fx-test."}]} -{"conversations": [{"role": "user", "content": "What model are you?"}, {"role": "assistant", "content": "I am sc-mind: a 198M MiniMind-3-MoE, eight layers, 768 wide, four experts with top-1 routing. I was trained from scratch on the SuperCollider documentation, class library and help pages, then fine-tuned on questions and answers about them."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SystemSynthDefs`."}, {"role": "assistant", "content": "```supercollider\na = { SinOsc.ar * 0.01 }.play;\na.defName; // has the prefix 'temp__', followed by a number\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `RedAbstractModule` in SuperCollider briefly."}, {"role": "assistant", "content": "RedAbstractModule — abstract class Category: Red > redModule."}]} -{"conversations": [{"role": "user", "content": "Explain `PLPZ2` in SuperCollider briefly."}, {"role": "assistant", "content": "PLPZ2 — UGenPatterns quark library Based on LPZ2 Category: Streams-Patterns-Events > UGenPatterns > Modifiers."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n{ BlitB3Square.ar(XLine.kr(1000, 20, 10)) }.play;\n\n{ BlitB3Square.ar(MouseX.kr(20,1000,'exponential'),MouseY.kr(0.001,0.999)) }.play;\n\n//comparison\n//blit version is cheaper, but aliases once pushed over 4000 or so at 44100 SR\n{ Pulse.ar(4000, 0.5) }.play;\n{ BlitB3Square.ar(4000) }.play;\n\n\n//spot the difference in CPU usage\n{ Mix.fill(100, {Pan2.ar(0.1*BlitB3Square.ar( ((LFNoise0.kr(rrand(2,3))).range(0,36)+36).midic\n// …\n```"}, {"role": "assistant", "content": "blit version is cheaper, but aliases once pushed over 4000 or so at 44100 SR spot the difference in CPU usage (BlitB3Square: Bipolar BLIT derived square waveform)"}]} -{"conversations": [{"role": "user", "content": "What is `PatchGui` in SuperCollider?"}, {"role": "assistant", "content": "PatchGui — gui class Category: Libraries > crucial > GuiClasses."}]} -{"conversations": [{"role": "user", "content": "What is `List`?"}, {"role": "assistant", "content": "List — list of items of variable size"}, {"role": "user", "content": "What does `List.new` do?"}, {"role": "assistant", "content": "Creates a List with the initial capacity given by size."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// Create a new empty collections with size 3:\nx = Array.new(3);\ny = Array.new(3);\nz = List.new(3);\n\n// Try to add 7 items to the array and list.\n// If the array exceeds maxSize, it will only\n// grow to an internally specified max size.\n(\n7.do { |i|\n x.add(i);\n y = y.add(i); // reassign array y on each add\n z.add(i);\n};\n);\n\n// Attempt to access the 5th item:\nx.at(4); // -> nil (out of bounds)\ny.at(4); // -> 4\nz.at(4); // -> 4\n\n// x grew only to size 4\nx.postln; // -> [ 0, 1, 2, 3 ]\ny.postln; // -> [ 0, 1, 2, 3, 4, 5, 6 ]\nz.postln; // -> List[ 0, 1, 2, 3, 4, 5, 6 ]\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// derived from an answer by Sergio Luque to a mail to the sc-users SuperCollider mailing list on 2013/03/22\n\n(\nvar registerSize = 16;\nvar min =\"C2\".namemidi.asInteger;\nvar max = \"C6\".namemidi.asInteger;\nvar waitTime = 0.05; // in seconds\n//var chance = 0.1;\nvar chance = Pseq([Pseries(0, 0.1, 10), Pseries(1, -0.1, 10)], inf);\nvar change = 10; // step size\n\n\nPbind(\n \\midinote, Pswitch1(\n { \n Pbrown(min, max, Pif(Prout({ chance.trace.coin.embedInStream }), change, 0))\n } ! registerSize, \n Pseq(Array.iota(registerSize), inf)\n ),\n \\dur, waitTime\n).play\n)\n```"}, {"role": "assistant", "content": "wiard noise ring variation using a ringbuffer instead of bitshifting.\r\nRe-implemented according to Julian Parker's m4l patch.\r\nDerived from an answer by Sergio Luque to a mail to the sc-users SuperCollider mailing list on 2013/03/22."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = NodeProxy(s);\na.source = { |freq = 444| Blip.ar(freq * [1, 1.03], 200) * 0.1 };\na.play;\na.set(\\freq, 555);\nb = a.copy;\nb.play;\nb.set(\\freq, 222;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = NodeProxy(s);\na.source = { |freq = 444| Blip.ar(freq * [1, 1.03], 200) * 0.1 };\na.play;\na.set(\\freq, 555);\nb = a.copy;\nb.play;\nb.set(\\freq, 222);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Granular electromaton."}, {"role": "assistant", "content": "```supercollider\n(\nServer.local.waitForBoot({\n(\nz.free;\nz = Buffer.alloc(s, 512, 1);\nz.sine1(1.0 / [1, 2, 3, 4], true, true, true);\n\n fork( { loop {\n SynthDef(\"g1\",{ arg out=0,bufnum=0,dur=1,rate=1,pos=0,sdens=1,edens=1;\n var dens = Line.kr(sdens,edens,dur);\n var trig = [LFNoise0,SinOsc,Impulse,LFPulse,LFSaw].choose.ar(Line.kr(sdens,edens,dur));\n //var env = EnvGen.kr(Env.perc(0.0001.rrand(0.1),dur*0.5.rrand(2)),doneAction:2);\n var env = EnvGen.kr(Env.perc(0.0001.rrand(0.1),dur*(0.5.rrand(4))),doneAction:2);\n Out.ar(out,\n GrainBuf.ar(2,trig,1/dens,bufnum,rate,pos)*env;\n )\n }).add();\n [1,2,4,8,16,32].choose.postln.wait;\n }\n }\n );\n\n\na = Pbind(\\instrument,\\g1,\\dur,Pseq([Pseq([0.25],32),Pseq([0.25,0.125,0.125],32),Pseq([0.125],32)],inf),\\sdens,Pseq([9000,1000,500]/10,inf),\\edens,Prand([Pseq([9000,1000,500]/10,4),Pseq([1],1)],inf),\\rate,Pfunc({-10.0.rrand(10)}),\\pos,Pfunc({1.0.rand}),\\bufnum,z.bufnum);\nb = Pbind(\\instrument,\\g1,\\dur,Pseq([4],inf),\\sdens,Pseq([9000,1000,500]/100,inf),\\edens,Prand([Pseq([9000,1000,500]/10,1),Pseq([1],3)],inf),\\rate,Pfunc({-10.0.rrand(10)}),\\pos,Pfunc({-10.0.rrand(10)}),\\bufnum,z.bufnum);\nc = Pbind(\\instrument,\\g1,\\dur,Pseq([4/3],inf),\\sdens,Pseq([9000,1000,500,25],inf),\\edens,Prand([Pseq([9000,1000,500,25],1),Pseq([1],4)],inf),\\rate,Pfunc({-100.0.rrand(100)}),\\pos,Pfunc({-10.0.rrand(10)}),\\bufnum,z.bufnum);\n\n\na =a.play;\nb =b.play;\nc =c.play;\n\n)\n});\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Padd`."}, {"role": "assistant", "content": "```supercollider\n(\nvar a, b;\na = Padd(\\freq, Pseq([401, 801], 2), Pbind(\\freq, 100));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a kick drum in SuperCollider."}, {"role": "assistant", "content": "A pitch-swept sine with a fast decay: the frequency envelope is what makes it read as a kick.\n\n```supercollider\n(\nSynthDef(\\kick, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 50, 40], [0.03, 0.15], -4));\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -6), doneAction: 2);\n Out.ar(out, Pan2.ar(SinOsc.ar(pitch) * env * amp));\n}).add;\n);\nSynth(\\kick);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `ServerLog.tail` do?"}, {"role": "assistant", "content": "print all OSC messages to console as they are sent to server. like unix"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Node`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n(\nx = SynthDef(\"help-node-set\", { |freq = 440, out = 0|\n Out.ar(out, SinOsc.ar(freq, 0, 0.1))\n}).play\n);\nx.run(false);\nx.run; // default is true\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ LorenzTrig.ar(11025, 44100) }.play(s);\n\n// randomly modulate params\n(\n{ LorenzTrig.ar(\n 11025, 44100,\n LFNoise0.kr(1, 2, 10),\n 20,\n LFNoise0.kr(1, 1.5, 2),\n 0.02\n) * 0.2 }.play(s);\n)\n\n// as a frequency control\n{ SinOsc.ar(Decay.ar(LorenzTrig.ar(1, 8, h:0.02))*800+900)*0.4 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ LorenzTrig.ar(11025, 44100) }.play(s);\n\n// randomly modulate params\n(\n{ LorenzTrig.ar(\n 11025, 44100,\n LFNoise0.kr(1, 2, 10),\n 20,\n LFNoise0.kr(1, 1.5, 2),\n 0.02\n) * 0.2 }.play(s);\n)\n\n// as a frequency control\n{ SinOsc.ar(Decay.ar(LorenzTrig.ar(1, 8, h:0.02))*800+900)*0.4 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SCViewHolder.keyDownResponder` do?"}, {"role": "assistant", "content": "This method is forwarded to the view. Note: this is a cruciallib convention and will be deprecated Returns: The result of calling the method on the proxied view"}]} -{"conversations": [{"role": "user", "content": "What does `BezierSpline.ntic` do?"}, {"role": "assistant", "content": "used internally to cubically interpolate between two points with 3 or more control points between"}]} -{"conversations": [{"role": "user", "content": "How do I get a Euclidean-style rhythm in SuperCollider?"}, {"role": "assistant", "content": "Describe the pattern as a list of hits and rests; `Rest` gives the gap without starting a Synth.\n\n```supercollider\n(\nPbind(\n \\instrument, \\hat,\n \\dur, 0.125,\n \\amp, Pseq([0.3, 0, 0, 0.3, 0, 0.3, 0, 0], inf).collect { |x| x + 0.001 }\n).play;\n)\n```\n\nFor real Euclidean generation use `Pseq([1,0,0,1,0,1,0,0], inf)` on a duration multiplier and wrap rests\nwith `Rest`, or compute the pattern with `bjorklund`-style logic in a Function and `Pseq` the result."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//spinning box / cube\n//after Shiffman https://codingtrain.github.io/website-archive/CodingChallenges/112-3d-rendering.html\n\n(\nvar width= 640, height= 480, w,\ntheta= 0, speed= 0.01, box;\n\nw= RedWindow(\"3Dbox\", Rect(128, 64, width, height)).front;\nbox= Red3DBox();\n\n//--loop\nw.draw{\n theta= theta+speed;\n box.rotation= RedVector3D[theta, theta, theta];\n box.update;\n\n //--render\n box.render(1, 100); //1= exaggerate, 2= standard\n Pen.translate(width*0.5, height*0.5);\n Pen.strokeColor= Color.white;\n box.drawOutlines;\n Pen.fillColor= Color.white;\n box.draw;\n};\nw.play;\nCmdPeriod.doOnce({w.close});\n)\n```"}, {"role": "assistant", "content": "spinning box / cube after Shiffman https://codingtrain.github.io/website-archive/CodingChallenges/112-3d-rendering.html."}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ LPF.ar(Saw.ar(100), SinOsc.kr(0.5).exprange(200, 2000)) * 0.2 }.play;\n```"}, {"role": "assistant", "content": "A sawtooth through a low-pass filter whose cutoff is swept slowly up and down — a classic filter\nsweep.\n\n- `Saw.ar(100)` is a 100 Hz sawtooth, rich in harmonics.\n- `SinOsc.kr(0.5)` is a control-rate sine at 0.5 Hz, so one full cycle takes 2 seconds.\n- `.exprange(200, 2000)` maps that -1..1 sine exponentially onto 200..2000 Hz — exponential is the right\n mapping for frequency, because we hear pitch logarithmically.\n- `LPF.ar(sig, cutoff)` removes harmonics above the cutoff; as it opens and closes you hear the tone\n brighten and darken.\n- `* 0.2` keeps the output from clipping."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nSynthDef(\\dubecho,{|in, out, length = 1, fb = 0.8, sep = 0.012|\n var input = In.ar(in, 2);\n var feedback = LocalIn.ar(2);\n var output = LeakDC.ar(feedback*fb + input);\n output = HPF.ar(output, 400);\n output = LPF.ar(output, 5000);\n output = output.tanh;\n LocalOut.ar(DelayC.ar(output, 1, LFNoise2.ar(12).range([length,length+sep],[length+sep,length])).reverse);\n ReplaceOut.ar(out, output);\n}).add;\n\n// Example as effecet bus\n~bus = Bus.audio(s, 2);\n~echo = Synth(\\dubecho, [\\in, ~bus, \\length, TempoClock.default.tempo*(3/8), \\fb, 0.7, \\sep, 0.0012], addAction: \\addToTail);\n\n// send something\nplay{ Out.ar(~bus, LFGauss.ar(1, 0.1, loop:0, doneAction:2) * Blip.ar(80!2, 8)) }\n\n// turn it off\n~echo.free;\n```"}, {"role": "assistant", "content": "Fork of Bjorn's Dub echo, rewritten w/o the Feedback Quark (using LocalIn + LocalOut) and adding a ping pong (can be removed by deleting the .reverse method in the LocalOut line)."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ SinOsc.ar(SinOsc.ar(0.3).range(440, 660), 0, 0.5 * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ SinOsc.ar(SinOsc.ar(0.3).range(440, 660), 0, 0.5) * 0.1 }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Sieve.dif_oi` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new Sieve object in mode 'intervals' with offsets, generated by the difference of sets of Arguments: ... data — Alternating generators and integer offsets plus an optional integer limit, wrapped into a Ref, which is included when reached. Allowed generators: Integers, Streams or Patterns producing intervals or Sieves itself. Integers and Stream/Pattern output must be strictly positive. Integers as generators ."}]} -{"conversations": [{"role": "user", "content": "What is `DigitalIO`?"}, {"role": "assistant", "content": "DigitalIO — Read or write data to a digital pin"}, {"role": "user", "content": "What does `DigitalIO.ar` do?"}, {"role": "assistant", "content": "The output of this UGen is always the last value read when the digital pin was an input."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// write a sine oscillator's output to a pin, and read the pin value at other times\n\n(\nSynthDef(\"help-DigitalIO\", { |out = 0|\n DigitalIO.ar(0, SinOsc.ar(10), LFPulse.kr(0.1)).poll;\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Re: Variations for Z1 sawtooth?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n var mod = SinOsc.ar([0.1,0.15,0.2]).range(0,1);\n var sig = LFPulse.ar(1.1).range(1,10);\n var sig2 = LFNoise1.ar(0.08).range(0.99,1.01);\n var saw = LFSaw.ar([10,12,15]*sig*sig2);\n var out = (saw - ((saw>0)*mod)+(mod*0.5));\n Splay.ar(out)*0.1;\n}.play;\n\n{\n var mod = SinOsc.ar([0.1,0.15,0.2]).range(0,1);\n var sig = LFPulse.ar(1).range(1,10);\n var sig2 = LFTri.ar(0.1,[0,1,2,3]).range(1,10*sig);\n var sig3 = LFNoise1.ar(0.05).range(0.99,1.01);\n var saw = SinOsc.ar(LFSaw.ar([10,12,15]*sig2*sig3).range(200,300));\n var out = (saw - ((saw>0)*mod)+(mod*0.5));\n Splay.ar(out)*0.1;\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Sieve.new_o` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new Sieve object in mode 'points' with Arguments: gen — A generator. Allowed generators: Integers, Streams or Patterns producing intervals or Sieves itself. Integers and Stream/Pattern output must be strictly positive. Integers as generators produce zero and its positive multiples.; offset — An Integer.; limit — An integer limit, which is included when reached. If no limit is passed, returned integers might go up to default limit 65536.."}]} -{"conversations": [{"role": "user", "content": "What does `TreeView.itemPressedAction` do?"}, {"role": "assistant", "content": "The object to be evaluated when a mouse button is pressed on an item, passing this view as the"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\nb= Buffer.read(s,\"sounds/break\",20000,10000);\n\n//gradual erosion\n(\nSynthDef(\"help-sortbuf\",{arg bufnum;\nOut.ar(0,\nPan2.ar( \nSortBuf.ar(bufnum,LFNoise0.kr(5,50000,60000),0)\n,0.0))\n}).play(s,[\\bufnum, b.bufnum]);\n);\n\nc= Buffer.read(s,\"sounds/break\",20000,10000);\nc.copy(b); //restore buffer\n\n\n//short 2000 sample buffer sorted over about 10 seconds\nb= Buffer.read(s,\"sounds/break\",20000,2000);\n{SortBuf.ar(b.buf\n// …\n```"}, {"role": "assistant", "content": "short 2000 sample buffer sorted over about 10 seconds , MouseY.kr(200,4000),0.1) (SortBuf: Karplus-Strong via a sorting algorithm)"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n# x,y,z = RosslerL.ar(MouseX.kr(1, 200));\nPan2.ar(Pulse.ar(x.range(100,1000), y.range(0,1), 0.3), z)\n}.play(s)\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n# x,y,z = RosslerL.ar(MouseX.kr(1, 200));\nPan2.ar(Pulse.ar(x.range(100,1000), y.range(0,1), 0.3), z)\n}.play(s)\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `NRand`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-NRand\", { |out = 0, n = 0|\n Out.ar(out,\n FSinOsc.ar(\n NRand(1200.0, 4000.0, n),\n 0, Line.kr(0.2, 0, 0.01, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n(\nn = 0;\nRoutine({\n inf.do({ |i|\n Synth.new(\"help-NRand\", [\\n, n]); 0.05.wait;\n })\n}).play;\n);\n\nn = 1;\nn = 2;\nn = 4;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Instr.prMakeSynth` do? What arguments does it take?"}, {"role": "assistant", "content": "An enhanced version of SynthDef with a library Arguments: targetStyle; anode; args — array or dict; bundle; atTime — see atTime; out — out bus index."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n\nSynthDef(\\param, { arg freq = 100, sustain, amp;\n var sig;\n sig = LFPar.ar(freq: freq,\n mul: EnvGen.kr(Env.perc(0, sustain, 0.5), doneAction:2) * amp);\n sig = Splay.ar(sig);\n Out.ar(0, sig);\n}).add;\n\ne = Pbind(\n \\midinote, Prout({\n var tone0, tone1, tone2, interval, freq0, delta;\n loop {\n tone0 = rrand(0,11);\n interval = rrand(2,4);\n tone1 = Scale.minor(\\pythagorean).at(tone0) + [0,12,24].choose + 0.07;\n tone2 = Scale.minor(\\pythagorean).at(tone0 + interval) + [0,12,24].choose;\n freq0 = [tone1,tone2]+48;\n postln(freq0);\n freq0.yield;\n }\n }),\n \\dur, Prand([1,2,4,8,12,16,4,6,8], inf),\n \\instrument, \\param,\n \\amp, 0.5,\n \\sustain, 2,\n).play(quant:1); // returns an EventStream\nTempoClock.default.tempo = 1200/60;\n\n)\n```"}, {"role": "assistant", "content": "minor random bliss in two for Prout (a SuperCollider snippet)."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// start a server program from the cmdLine for testing\n~pid = unixCmd(Server.program + s.options.asOptionsString(57100));\n// kill just that server program by its pid:\nthisProcess.platform.killProcessByID(~pid);\n```"}, {"role": "assistant", "content": "start a server program from the cmdLine for testing kill just that server program by its pid: (Platform: handle cross-platform differencies)"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n EnvGen.kr(\n Env.new([0.001, 1, 0.5, 0], [0.01, 0.3, 1], -4, 2, nil),\n Impulse.kr(10)\n ) * SinOsc.ar(440, 0, 0.1)\n}.play;\n);\n\n(\n{\n EnvGen.kr(\n Env.perc(0.1, 0.0, 0.5, 1, \\welch),\n Impulse.kr(100),\n timeScale: 0.1\n ) * SinOsc.ar(440, 0, 0.3)\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n EnvGen.kr(\n Env.new([0.001, 1, 0.5, 0], [0.01, 0.3, 1], -4, 2, nil),\n Impulse.kr(10)\n ) * SinOsc.ar(440, 0, 0.1)\n}.play;\n);\n\n(\n{\n EnvGen.kr(\n Env.perc(0.1, 0.0, 0.5, 1, \\welch),\n Impulse.kr(100),\n timeScale: 0.1\n ) * SinOsc.ar(440, 0, 0.3)\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `ScoreClock.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a new individual ScoreClock, mainly useful when there is need to run serveral clocks with different Arguments: tmp — Tempo in beats per second.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\"help-SinOsc\", { |freq = 440, out|\n Out.ar(out, SinOsc.ar(freq, 0, 0.1))\n}).add;\n\nSynthDef(\"help-XOut\", { |out = 0, xFade = 1|\n var source;\n source = PinkNoise.ar(0.05);\n\n // write to the bus, crossfading with previous contents\n XOut.ar(out, xFade, source);\n\n}).add;\n);\n\nSynth(\"help-SinOsc\", [\\freq, 500]);\na = Synth.tail(s, \"help-XOut\");\n\n\na.set(\\xFade, 0.7);\na.set(\\xFade, 0.4);\na.set(\\xFade, 0.0;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\"help-SinOsc\", { |freq = 440, out|\n Out.ar(out, SinOsc.ar(freq, 0, 0.1))\n}).add;\n\nSynthDef(\"help-XOut\", { |out = 0, xFade = 1|\n var source;\n source = PinkNoise.ar(0.05);\n\n // write to the bus, crossfading with previous contents\n XOut.ar(out, xFade, source);\n\n}).add;\n);\n\nSynth(\"help-SinOsc\", [\\freq, 500]);\na = Synth.tail(s, \"help-XOut\");\n\n\na.set(\\xFade, 0.7);\na.set(\\xFade, 0.4);\na.set(\\xFade, 0.0);\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// proceed with caution. start at min volume, and not with your expensive speakers.\n\nfork{b=Buffer.alloc(s,512,1);inf.do{b.cheby({[1,0].choose}!2);{(Shaper.ar(b,SinOsc.ar(55,0,Line.kr(1,0,2,1,0,2))))!2}.play;0.1.wait;}};\n```"}, {"role": "assistant", "content": "can anyone tell me what the loud click is, and how to control it?\r\n\r\ni kind of really like it, but it sounds scary, \r\n\r\nand the resulting waveform is bizarre, too.\r\n\r\n[http://soundcloud.com/tengototen/m-chtegern-ikeda](http://soundcloud.com/tengototen/m-chtegern-ikeda)\r\n\r\n\r\nupdate: some discussion, and lots of interesting things to try out, [on the list](http://new-supercollider-mailing-lists-foru."}]} -{"conversations": [{"role": "user", "content": "What is `Server`?"}, {"role": "assistant", "content": "Server — Object representing a server application"}, {"role": "user", "content": "What does `Server.new` do?"}, {"role": "assistant", "content": "Create a new Server instance."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n{ SinOsc.ar * 0.1 }.play(s); // play a synth on the server\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\nq = Pbind(\\freq, 300, \\dur, Pn(0.3, 2));\nq.trace.play;\n\n// Sound-wise ineffective modification of the incoming stream\np = Pbind(\\degree, 6) <> q;\np.trace.play;\n\n// Instead\np = Pbind(\\degree, 6) <> Pfunc { |ev| ev.freq = nil } <> q;\np.trace.play;\n\n// Alternatively\np = Pbind(\\degree, Pfunc { |ev| ev.freq = nil; 6 }) <> q;\np.trace.play;\n\n// Just setting a key to nil from a Pbind pair will end the stream\np = Pbind(\\freq, nil, \\degree, 6) <>\n// …\n```"}, {"role": "assistant", "content": "Sound-wise ineffective modification of the incoming stream Just setting a key to nil from a Pbind pair will end the stream (Pfunc: Function pattern)"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\"help-GaussTrig\", { arg out=0;\n Out.ar(out,\n Ringz.ar(\n WhiteNoise.ar(\n Decay.kr(\n GaussTrig.kr(10.dup, MouseX.kr(0, 0.9), 0.5),\n 0.02,\n 0.2\n )\n ),\n 2000,\n 0.02\n ).fold2(0.2)\n )\n}).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\"help-GaussTrig\", { arg out=0;\n Out.ar(out,\n Ringz.ar(\n WhiteNoise.ar(\n Decay.kr(\n GaussTrig.kr(10.dup, MouseX.kr(0, 0.9), 0.5),\n 0.02,\n 0.2\n )\n ),\n 2000,\n 0.02\n ).fold2(0.2)\n )\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SimpleNumber.booleanValue` do?"}, {"role": "assistant", "content": "one-dimensional value Returns: true, if strictly positive (> 0), otherwise false (see Boolean)"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Midterm Question 3 (a SuperCollider snippet)?"}, {"role": "assistant", "content": "```supercollider\n// This note is made up of 5 freqs, all integer multiples of 100 Hz.\n{ Mix.ar(SinOsc.ar(freq: 100 * [1, 2, 3, 4, 5], mul: 0.1)) }.play;\n\n\n// This note is made up of 5 freqs that are NOT integer multiples of 100 Hz.\n{ Mix.ar(SinOsc.ar(freq: 100 * [1.01, 1.9, 3, 4.2, 7.4], mul: 0.1)) }.play;\n\n\n(\nSynthDef(\"bell\", {arg freq, amp;\n \n var env, snd, partials, relativeAmps;\n partials = [0.5, 1, 1.19, 1.56, 2, 2.51, 2.66, 3.01, 4.1];\n relativeAmps = [0.25, 1, 0.8, 0.5, 0.9, 0.4, 0.3, 0.6, 0.1];\n \n env = Env.perc(attackTime: 0.01, releaseTime: 5, amp: relativeAmps\n \n ).kr(2);\n \n snd = SinOsc.ar(\n freq: 440 , \n mul: 1\n );\n \n snd = Splay.ar(snd);\n \n Out.ar(0, snd * 0.1 ! 2);\n \n}).add;\n);\n\n\n(\nPbind(\n \\instrument, \"bell\",\n \\degree, Pseq([1,4,7,9], inf),\n \\dur, 0.132, \n \n).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BufFrames`."}, {"role": "assistant", "content": "```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n// indexing with a phasor\n{ BufRd.ar(1, b, Phasor.ar(0, BufRateScale.kr(b), 0, BufFrames.kr(b))) }.play;\n\n// indexing by hand\n{ BufRd.ar(1, b, K2A.ar(MouseX.kr(0, BufFrames.kr(b)))) }.play;\n\nb.free\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Phprand.new` do? What arguments does it take?"}, {"role": "assistant", "content": "random values that tend toward hi Arguments: lo — lower boundary of values.; hi — upper boundary of values.; length — number of values produced.."}]} -{"conversations": [{"role": "user", "content": "Explain `PLnaryFunc` in SuperCollider briefly."}, {"role": "assistant", "content": "PLnaryFunc — dynamic scope PnaryFunc variant Takes Symbol args for later reference by the Streams, which will read from variables in the Environments of their instantiation. See PLx_suite. For replacing operators dynamically take PLnaryFunc with the operator wrapped into a Function. Category: Libraries > miSCellaneous > PLx suite, Streams-Patterns-Events > PLx suite."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na.cutoff(3);\n\nb.sine2(a.ramp(1.0, 1.0), a.cutoff(3), true, true, true);\ny = z.play(s, [\\out, 0, \\bufnum, b]);\nb.sine2(a.ramp(1.0, 1.0), a.cutoff(3), true, true, true);\nb.sine2(a.ramp(1.0, 1.0), a.cutoff(5), true, true, true);\nb.sine2(a.ramp(1.0, 1.0), a.cutoff(1), true, true, true;\ny.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na.cutoff(3);\n\nb.sine2(a.ramp(1.0, 1.0), a.cutoff(3), true, true, true);\ny = z.play(s, [\\out, 0, \\bufnum, b]);\nb.sine2(a.ramp(1.0, 1.0), a.cutoff(3), true, true, true);\nb.sine2(a.ramp(1.0, 1.0), a.cutoff(5), true, true, true);\nb.sine2(a.ramp(1.0, 1.0), a.cutoff(1), true, true, true);\ny.free;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var a, freq, trig;\n a = Dseq([1, 3, 2, 7, 8], 3);\n trig = Impulse.kr(MouseX.kr(1, 40, 1));\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n);\n\n// audio rate\n(\n{\n var a, freq, trig;\n a = Dseq({ 10.rand } ! 32, inf);\n trig = Impulse.ar(MouseX.kr(1, 10000, 1));\n freq = Demand.ar(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var a, freq, trig;\n a = Dseq([1, 3, 2, 7, 8], 3);\n trig = Impulse.kr(MouseX.kr(1, 40, 1));\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n);\n\n// audio rate\n(\n{\n var a, freq, trig;\n a = Dseq({ 10.rand } ! 32, inf);\n trig = Impulse.ar(MouseX.kr(1, 10000, 1));\n freq = Demand.ar(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Converting an environment in a prototype object."}, {"role": "assistant", "content": "```supercollider\n~constructPseudoMethods = { |envir|\n var newEnvir = envir.collect { |value|\n var argNames, argBlock, namesBlock, code, func;\n if(value.isKindOf(Function)) {\n func = value;\n argNames = func.def.argumentString(withDefaultValues: true);\n namesBlock = func.def.argumentString(withDefaultValues: false);\n argBlock = if(argNames.notNil) { \"|self, \" ++ argNames ++ \"|\" };\n code = \"{ |func, envir| { % envir.use { func.value(%) } } }\".format(argBlock ? \"\", namesBlock ? \"\");\n //code.postln;\n code.interpret.value(func, envir)\n } {\n value\n }\n };\n newEnvir.know = true; // we want a prototype object style environment\n};\n```"}]} -{"conversations": [{"role": "user", "content": "What does `AbstractSController.new` do? What arguments does it take?"}, {"role": "assistant", "content": "an abstract class for all sInstrument controllers Arguments: numChannels — number of internal control rate channels.; target — used to figure out which server to use for the internal bus and synth. if CODEnil then the default (localhost) server will be used.; args — extra arguments as an LINKClasses/Array with key/value pairs.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nb= Buffer.read(s,\"sounds/break\",20000,10000);\n\n//gradual erosion\n(\nSynthDef(\"help-sortbuf\",{arg bufnum;\nOut.ar(0,\nPan2.ar( \nSortBuf.ar(bufnum,LFNoise0.kr(5,50000,60000),0)\n,0.0))\n}).play(s,[\\bufnum, b.bufnum]);\n);\n\nc= Buffer.read(s,\"sounds/break\",20000,10000);\nc.copy(b); //restore buffer\n\n\n//short 2000 sample buffer sorted over about 10 seconds\nb= Buffer.read(s,\"sounds/break\",20000,2000);\n{SortBuf.ar(b.buf\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nb= Buffer.read(s,\"sounds/break\",20000,10000);\n\n//gradual erosion\n(\nSynthDef(\"help-sortbuf\",{arg bufnum;\nOut.ar(0,\nPan2.ar( \nSortBuf.ar(bufnum,LFNoise0.kr(5,50000,60000),0)\n,0.0))\n}).play(s,[\\bufnum, b.bufnum]);\n);\n\nc= Buffer.read(s,\"sounds/break\",20000,10000);\nc.copy(b); //restore buffer\n\n\n//short 2000 sample buffer sorted over about 10 seconds\nb= Buffer.read(s,\"sounds/break\",20000,2000);\n{SortBuf.ar(b.bufnum,10000,1)}.play\n\n(\ns = Server.local;\nb = Buffer.alloc(s, 512, 1);\nc = Buffer.alloc(s, 512, 1);\nb.sine1(1.0/[1,2,3,4,5,6], true, true, true);\nc.sine1(1.0/[1,2,3,4,5,6], true, true, true);\n);\n\n(\nSynthDef(\"help-sortbuf2\",{ arg out=0,bufnum=0;\n\n SortBuf.ar(b.bufnum,1000,1); //attacking b over time\n\n Out.ar(out,\n //RLPF.ar(\n Osc.ar(b.bufnum, MouseX.kr(20,100), 0, 0.5)\n // , MouseY.kr(200,4000),0.1)\n )\n}).play(s,[\\out, 0]);\n);\n\nc.copyData(b); //restore buffer\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Migration from the old SourceForge wiki."}, {"role": "assistant", "content": "```supercollider\n// Sing whatever pitch you like into the microphone, but have the output conform to the key you press on your connected MIDI keyboard, like a very low-rent Autotune.\n// by nonprivate April 2009\n// best used with headphones\n// execute one by one...\n\ns = Server.local.boot;\nb = 200; // no. of control bus to use for pitch control\n(\n SynthDef(\"straightenUp\",\n { |baseFreq = 100|\n \n var in, freq, hasFreq, out;\n in = Mix.new(SoundIn.ar([0,1]));\n # freq, hasFreq = Pitch.kr(in, ampThreshold: 0.02, median: 7);\n out = PitchShift.ar(in, 0.08, (baseFreq / freq), 0.0, 0.0);\n Out.ar(0,[out, out])\n }\n ).send(s);\n);\n\ns.sendMsg(\"/s_new\", \"straightenUp\", n = s.nextNodeID, 1, 0);\n\ns.sendMsg(\"/n_map\", n, \"baseFreq\", b);\n\n(\n c = NoteOnResponder(\n { |src,chan,note,vel|\n \n s.sendMsg(\"/c_set\", b, note.midicps);\n \n },\n nil, // any source\n nil, // any channel\n nil, // any note\n nil // any vel\n );\n \n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nPdef(\\zed, \n Pbind(\n \\osc, Pseq([SinOsc, LFSaw],inf),\n \\instrument, Prout({ arg ev;\n SynthDef(\\zed, { arg out=0, gate=1, amp=0.1, pan=0, freq=200;\n var sig;\n sig = ev[\\osc].ar(freq);\n sig = sig * EnvGen.kr(\\adsr.kr(Env.adsr(0.1,0.1,0.8,0.1)), gate, doneAction:2);\n sig = Pan2.ar(sig, pan, amp);\n Out.ar(out, sig);\n }).add.yield;\n }).loop,\n \\degree, Pseq([0],inf),\n \\dur, 1,\n \\amp, 0.1,\n )\n).play;\n);\n```"}, {"role": "assistant", "content": "synthdef building should take less time than s.latency for this to work."}]} -{"conversations": [{"role": "user", "content": "What does `InstrSynthDef.onTrig` do? What arguments does it take?"}, {"role": "assistant", "content": "Extends SynthDef enabling the extra capabilities of Instr with Patch Arguments: trig; func; value."}]} -{"conversations": [{"role": "user", "content": "What is `DoubleWell2` in SuperCollider?"}, {"role": "assistant", "content": "DoubleWell2 — Forced DoubleWell Oscillator Improved Euler ODE solver implementation of the chaotic Forced Double Well Oscillator (see Strogatz, Steven H. (1994) Nonlinear Dynamics and Chaos. Addison-Wesley, Reading, MA. pp441-7). Category: UGens > Generators > Chaotic."}]} -{"conversations": [{"role": "user", "content": "What is `PV_MagSmear` in SuperCollider?"}, {"role": "assistant", "content": "PV_MagSmear — Average magnitudes across bins. Average a bin's magnitude with its neighbors. Category: UGens > FFT."}]} -{"conversations": [{"role": "user", "content": "What does `View.fixedHeight` do? What arguments does it take?"}, {"role": "assistant", "content": "Set both minimum and maximum allowed height of the view, thus making it Arguments: height — An Int.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\\vowblend,{|freq = 100, b1 = 0.5, b2 = 0.5, b3 = 0.5, b4 = 0.5 bright = 0, pan = 0|\n var va = Vowel(\\a, \\bass),\n ve = Vowel(\\e, \\tenor),\n vi = Vowel(\\i, \\counterTenor),\n vo = Vowel(\\o, \\alto),\n vu = Vowel(\\u, \\soprano),\n sig;\n \n sig = Formants.ar(\n freq, \n va\n .blend(ve, b1)\n .blend(vi, b2)\n .blend(vo, b3)\n .blend(vu, b4)\n .brightenExp(bright, 1)\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\\vowblend,{|freq = 100, b1 = 0.5, b2 = 0.5, b3 = 0.5, b4 = 0.5 bright = 0, pan = 0|\n var va = Vowel(\\a, \\bass),\n ve = Vowel(\\e, \\tenor),\n vi = Vowel(\\i, \\counterTenor),\n vo = Vowel(\\o, \\alto),\n vu = Vowel(\\u, \\soprano),\n sig;\n \n sig = Formants.ar(\n freq, \n va\n .blend(ve, b1)\n .blend(vi, b2)\n .blend(vo, b3)\n .blend(vu, b4)\n .brightenExp(bright, 1) \n ) \n * EnvGen.kr(Env.perc, 3.0, doneAction: 2);\n\n Out.ar(0, Pan2.ar(sig, pan, 0.1));\n}).add\n);\n\n\n(\nTask({ 32.do({ arg i; \n Synth(\\vowblend, [ \n \\pan, i.linlin(0,32, -1, 1 ),\n \\freq, i.linlin(0,32, 30, 66 ).midicps,\n \\b1, 2.rand,\n \\b2, 2.rand, \n \\b3, 2.rand,\n \\b4, 2.rand, \n \\bright, 1.5.rand\n ]); \n 0.25.wait\n\n});}).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `RedVector` in SuperCollider?"}, {"role": "assistant", "content": "RedVector — a vector of any dimension Category: Red > redUniverse."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Pdef`."}, {"role": "assistant", "content": "```supercollider\nPdef(\\x, Pseq([Pbind(\\instrument, \\gpdef), Pdef(\\x)], inf));\nPdef(\\x).play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PV_RectComb`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var sig, chain;\n sig = WhiteNoise.ar(0.2);\n chain = FFT(LocalBuf(2048), sig);\n chain = PV_RectComb(chain, 8, LFTri.kr(0.097, 0, 0.4, 0.5),\n LFTri.kr(0.24, 0, -0.5, 0.5));\n IFFT(chain).dup\n}.play;\n);\n\n(\n{\n var sig, chain;\n sig = WhiteNoise.ar(0.2);\n chain = FFT(LocalBuf(2048), sig);\n chain = PV_RectComb(chain, MouseX.kr(0, 32), MouseY.kr, 0.2);\n IFFT(chain).dup\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `ListView.enterKeyAction` do?"}, {"role": "assistant", "content": "The action object evaluated whenever the user presses the Enter (Return)"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `List`."}, {"role": "assistant", "content": "```supercollider\n// Create a new empty collections with size 3:\nx = Array.new(3);\ny = Array.new(3);\nz = List.new(3);\n\n// Try to add 7 items to the array and list.\n// If the array exceeds maxSize, it will only\n// grow to an internally specified max size.\n(\n7.do { |i|\n x.add(i);\n y = y.add(i); // reassign array y on each add\n z.add(i);\n};\n);\n\n// Attempt to access the 5th item:\nx.at(4); // -> nil (out of bounds)\ny.at(4); // -> 4\nz.at(4); // -> 4\n\n// x grew only to size 4\nx.postln; // -> [ 0, 1, 2, 3 ]\ny.postln; // -> [ 0, 1, 2, 3, 4, 5, 6 ]\nz.postln; // -> List[ 0, 1, 2, 3, 4, 5, 6 ]\n```"}]} -{"conversations": [{"role": "user", "content": "Interfacing SC with external software: MIDI or OSC?"}, {"role": "assistant", "content": "SuperCollider forum — Interfacing SC with external software: MIDI or OSC?\n\nI found this partial solution on sccode.org :\n\n```supercollider\n // declare an event type which sends OSC commands to Renoise\n\n(\nEvent.addEventType(\\renoise, { |server|\n var renoiseOscServer = NetAddr(\"127.0.0.1\", 8000);\n var notes = [~midinote.value, ~ctranspose.value, ~velocity.value, ~sustain.value, ~lag.value, ~timingOffset.value, ~instr.value, ~track.value].flop;\n var timeNoteOn, timeNoteOff, instrument, track, velocity;\n var serverLatency;\n\n serverLatency = server.latency ? 0;\n\n notes.do {|note|\n instrument = note[6] ? -1;\n track = note[7] ? -1;\n velocity = note[2].asInt.clip(0,127);\n\n // sustain and timingOffset are in beats, lag is in seconds\n timeNoteOn = (thisThread.clock.tempo.reciprocal*note[5])+note[4]+server.latency;\n timeNoteOff = (thisThread.clock.tempo.reciprocal*(note[3]+note[5]))+note[4]+server.latency;\n SystemClock.sched(timeNoteOn, {renoiseOscServer.sendMsg(\"/renoise/trigger/note_on\", instrument.asInt, track.asInt, (note[0]+note[1]).asInt, velocity )});\n SystemClock.sched(timeNoteOff, {renoiseOscServer.sendMsg(\"/renoise/trigger/note_off\", instrument.asInt, track.asInt, (note[0]+note[1]).asInt)});\n }\n});\n);\n\n// Now start Renoise OSC server, load a sample, and try some patterns\n\n// straight timing\n(\nPbind(*[\n type: \\renoise,\n legato: Pgauss(0.2,0.05,inf),\n dur: 0.2,\n degree: [2,5,12],\n track: Prand([0,1], inf),\n ctranspose: Pseq([0,0,0,0,4,4,4,4,5,5,5,5],inf),\n velocity: Pgauss(64,10,inf),\n]).play;\n)\n```\n\nhttp://sccode.org/1-4SN\n\nBut what I couldn’t find there was a simple syntax for sending Note Events or Midi Events as OSC messages... Do I really need to re-implement the whole SC’s defaultParentEvent as new OSC Event to send it using regular pattern’s syntax?"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// 2012.05.04\n// Work for NX014 Class\n// Inspiration: A Rukano Tweet. Thanks rukano!\n// Comment: Cosmic Organ.\n\np = ProxySpace.push(s.boot);\n\n~a.play;\n\n~a = { var alpha,gamma;\n alpha= LFNoise2;\n gamma= {[rrand(30,50),rrand(50,70),rrand(50,70),rrand(70,100)].choose.midicps*alpha.kr(1,0.01,1)}!24;\n Pan2.ar(LeakDC.ar(Normalizer.ar(\n BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(FreeVerb.ar(\n Splay.ar(RLPF.ar(LFSaw.ar(gamma)/4,gamma*LFCub.kr(rrand(0.01,0.1),0,2,3),alpha.kr(1/8,0.6,0.7))) \n ,0.1,0.1,0.1)\n ,100,6.0,6),1000,6.0,0),5000,6.0,0),10000,6.0,6)\n ,(0.8/0.999)*1,0.1)),0)\n};\n\n~a = nil;\n```"}, {"role": "assistant", "content": "A cosmic organ with a inspiration of rukano tweet. Thanks rukano!."}]} -{"conversations": [{"role": "user", "content": "What does `Object.repeat` do?"}, {"role": "assistant", "content": "Repeatedly embeds the receiver in the stream using a Pn (may thus be used for patterns and other objects alike) `a ="}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Monzo function?"}, {"role": "assistant", "content": "```supercollider\n// https://en.xen.wiki/w/Monzo\n//Monzo notation of JI ratios is often used in combination with Vals for temperament theory. I wrote this not for temperament, but rather to use monzos as a possible alternative to otonality and utonality, espescially when sonifying streams that include negative numbers.\n\n(//function that takes a collection representing a monzo as an argument, and outputs the ratio it encodes\n~zo = {\n arg exponentCollection;\n var ratio = 1;\n exponentCollection.do({arg item, i; ratio = ratio * (i.nthPrime).pow(item);});\n ratio;\n};\n);\n\n//5-limit\n~zo.([-1, 1]); // 3/2\n~zo.([-2, 0, 1]); // 5/4\n~zo.([-3, 2]); // 9/8\n~zo.([-4, 4, -1]); // 81/80\n~zo.([-4, 4, -1]); // 81/80\n\n//7-limit\n~zo.([-2, 0, 0, 1]); // 7/4\n~zo.([-1, -1, 0, 1]); // 7/6\n~zo.([0, 0, -1, 1]); // 7/5\n\n//fractional monzos\n~zo.([-1/2, 3.3, 4, -5]); //sure\n//it might be fun to do monzo glissandos in different places?\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LazyList`."}, {"role": "assistant", "content": "```supercollider\n~fib = 0 %% ( 1 %% ( { ~fib.zip( ~fib.tail ).collect{ |t| t.at1 +t.at2 } } ) )\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for lurking line noise."}, {"role": "assistant", "content": "```supercollider\n({var\n rf = 7\n , rt = Impulse.kr(rf)\n , bs = 8.collect({|i| PulseDivider.kr(rt, 16, i*2)})\n , bt = bs[0] + bs[2] + Dust.kr(SinOsc.kr(0.01, 0, 0.25, 0.25))\n , be = Decay.kr(bt, 0.2)\n , se = Decay.kr(bs[5]+bs[6], 0.01)\n , bass = be*SinOsc.ar(SinOsc.ar([5,6], 0, 20, \n Demand.kr(bt, 0, Drand((30..48), inf)).midicps\n ))\n , snar = se*SinOsc.ar(2000+[0, 5])\n , off = (LPF.kr(BrownNoise.kr([1,1]), 10)**(1/3))>0\n , hat = DelayL.kr(Decay.kr(Mix.kr(bs), 0.01), 20, rf.reciprocal*off)*PinkNoise.ar\n , line = Saw.ar(50)*0.1*(LFNoise0.kr(50)>0)*SinOsc.kr(0.1, 0, 0.4, 0.45)\n ;\n Out.ar(0, FreeVerb.ar(bass+snar + hat + line, \n SinOsc.kr(0.01, 0, 0.4, 0.5), \n 0.8, 0.5))\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\ny = {\n var i = LFDNoise3.ar(7).range(0.2, 0.9) * [1, 1.01];\n var r = LFDNoise3.ar(2).range(3.2, 3.6) * [1, 1.01];\n GFIS.ar({ |x| sin(r * x) }, i, 9) * 0.1\n}.play\n;\n\ny.release\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\ny = {\n var i = LFDNoise3.ar(7).range(0.2, 0.9) * [1, 1.01];\n var r = LFDNoise3.ar(2).range(3.2, 3.6) * [1, 1.01];\n GFIS.ar({ |x| sin(r * x) }, i, 9) * 0.1\n}.play\n);\n\ny.release\n```"}]} +{"conversations": [{"role": "user", "content": "Write a bell in SuperCollider."}, {"role": "assistant", "content": "A bell is a set of inharmonic partials with a long percussive decay. The ratios below are the\nclassic bell ones; the envelope frees the Synth when it ends.\n\n```supercollider\n(\nSynthDef(\\bell, { |out = 0, freq = 440, amp = 0.2, dur = 3|\n var partials = [1, 2.76, 5.4, 8.93];\n var amps = [1, 0.5, 0.3, 0.15];\n var sig = SinOsc.ar(freq * partials) * amps;\n var env = EnvGen.kr(Env.perc(0.001, dur, 1, -6), doneAction: 2);\n Out.ar(out, Pan2.ar(Mix(sig) * env * amp, 0));\n}).add;\n);\nSynth(\\bell, [\\freq, 660, \\dur, 4]);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Pbind.embedInStream` do? What arguments does it take?"}, {"role": "assistant", "content": "From within a Stream like e.g. Routine, yield all events from this pattern before continuing. One pattern can be used to produce values for any number of independent Arguments: inevent — An event that is passed into all substreams and is used by them to produce the output events. `a = Pbind(note: Pseq([0, 4, 7]), amp: 0.1, dur: 0.2);`."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for seasonal reflections ) that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n(\nfork { loop { \n Ndef(\\winter_curves, {\n var bands = 5.rrand(15) * 2;\n var freqs = Array.exprand(bands.debug('bands'), 20, 18000);\n Pan2.ar(\n SinOsc.ar(\n freqs, \n Array.rand(bands, 0, pi),\n AmpCompA.kr(freqs, freqs.sort.first)\n ).perform(0.5.coin.if(\\tanh,\\value).debug('kind')),\n FSinOsc.kr(\n Array.exprand(bands, 0.01, 15),\n Array.rand(bands, 0, pi),\n ),\n bands.reciprocal\n * LFGauss.kr(SinOsc.kr(Array.rand(bands, 0.05, 0.1)).range(1,10), 0.3)\n * FSinOsc.kr(\n Array.exprand(bands, 0.1, 15),\n 0.3\n ).range(0,1)\n ).sum\n * SelectX.kr(\n FSinOsc.kr(Array.exprand(bands, 0.1, 15)).range(0,1),\n [\n EnvGen.kr(\n Env.perc(\n FSinOsc.kr(1/16).range(0.01,0.1),\n FSinOsc.kr(1/8).range(0.25,0.3)\n ).blend(\n Env.sine( // 1/4\n FSinOsc.kr(Array.exprand(bands, 0.1, 15)).range(0.05,2)\n ).blend(\n Env.sine(1/4),\n FSinOsc.kr(Array.exprand(bands, 0.1, 15)).range(0.05,2).mean\n ),\n FSinOsc.kr(Array.exprand(bands, 0.1, 15)).range(0,1)\n ).circle,\n 1, 0.8, \n FSinOsc.kr(freqs.linlin(20,18000,0.1,20)).range(0, 0.2).mean\n ),\n 1\n ]\n ).clump(2).mean\n }).fadeTime_(0.5.rrand(2.5)).play;\n 8.rrand(30).debug('len').wait;\n} }\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n(\n// Pbind with default synth\n// ~freq can be a collection, then pitch or chord are shifted by ~freqFac,\n// ascending (~step > 0) or descending (~step < 0) groups of 4 items\n\np = Pbind(\n \\dur, 0.4,\n \\amp, PL(\\amp),\n \\freq, PL(\\step) ** PLseq((0..3)) * PL(\\freq) * PL(\\freqFac) \n);\n\n// Synth producing an ascending line, it ends as envelope params are defined,\n// end notifications will be reflected in the VarGui\n\nSynthDef(\\synth_2, { |out = 0, freq = #[600, 700, 900, 1000], freqFac = 1\n// …\n```"}, {"role": "assistant", "content": "Pbind with default synth ~freq can be a collection, then pitch or chord are shifted by ~freqFac, (VarGui: slider / player gui to set envir variables and synth controllers and play synths, event patterns and tasks)"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LFDNoise1`."}, {"role": "assistant", "content": "```supercollider\n// try wiggling mouse quickly;\n// LFNoise frequently seems stuck, LFDNoise changes smoothly.\n\n{ SinOsc.ar(LFNoise1.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n{ SinOsc.ar(LFDNoise1.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFNoise1.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n\n{ LFDNoise1.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n/// measuring lastUpdateTime from MKtls,\n/// to display which interfaces were recently active\n~time = ();\n~time.actives = [ MKtl(\\ntmi), MKtl(\\uc4), MKtl(\\ferrari) ];\n~time.times = ();\n~time.spec = [1000, 1, \\exp].asSpec;\n~time.actives.do { |mk| ~time.times.addSpec(mk.name, ~time.spec) };\n\n~time.egui = EnvirGui(~time.times);\n\n~time.times.getSpec\n\n~time.skip.stop.free;\n~time.skip = SkipJack({\n ~time.actives.do { |mk|\n ~time.times.put(mk.name, mk.timeSinceLast)\n }\n});\n~time.skip.dt = 0.5;\n\nMKtl(\\ntmi).elAt(\\battery).action.cs;\n\nl = List.new(1024);\nMKtl(\\ntmi).elAt(\\battery).action = { |el|\n var val = el.deviceValue;\n // l.add(val);\n // val.postln;\n // if (val > 0) { val.postln };\n};\n\nl.postcs;\n```"}, {"role": "assistant", "content": "measuring lastUpdateTime from MKtls, to display which interfaces were recently active."}]} +{"conversations": [{"role": "user", "content": "What does `DataFilter.filterN` do? What arguments does it take?"}, {"role": "assistant", "content": "perform the filter calculations in steps. an internal buffer is Arguments: newData — an Array or a single sample.."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LFCub`."}, {"role": "assistant", "content": "```supercollider\n{ LFCub.ar(LFCub.kr(LFCub.kr(0.2, 0, 8, 10), 0, 400, 800), 0, 0.1) }.play\n{ LFCub.ar(LFCub.kr(0.2, 0, 400, 800), 0, 0.1) }.play\n{ LFCub.ar(800, 0, 0.1) }.play\n{ LFCub.ar(XLine.kr(100, 8000, 30), 0, 0.1) }.play\n\n// compare:\n\n{ LFPar.ar(LFPar.kr(LFPar.kr(0.2, 0, 8, 10), 0, 400, 800), 0, 0.1) }.play\n{ LFPar.ar(LFPar.kr(0.2, 0, 400, 800), 0, 0.1) }.play\n{ LFPar.ar(800, 0, 0.1) }.play\n{ LFPar.ar(XLine.kr(100, 8000, 30), 0, 0.1) }.play\n\n\n{ SinOsc.ar(SinOsc.kr(SinOsc.kr(0.2, 0, 8, 10), 0, 400, 800), 0, 0.1) }.play\n{ SinOsc.ar(SinOsc.kr(0.2, 0, 400, 800), 0, 0.1) }.play\n{ SinOsc.ar(800, 0, 0.1) }.play\n{ SinOsc.ar(XLine.kr(100, 8000, 30), 0, 0.1) }.play\n\n{ LFTri.ar(LFTri.kr(LFTri.kr(0.2, 0, 8, 10), 0, 400, 800), 0, 0.1) }.play\n{ LFTri.ar(LFTri.kr(0.2, 0, 400, 800), 0, 0.1) }.play\n{ LFTri.ar(800, 0, 0.1) }.play\n{ LFTri.ar(XLine.kr(100, 8000, 30), 0, 0.1) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `PDust2` in SuperCollider briefly."}, {"role": "assistant", "content": "PDust2 — UGenPatterns quark library Based on Dust2 Category: Streams-Patterns-Events > UGenPatterns > Generators."}]} +{"conversations": [{"role": "user", "content": "What does `LinkClock.newFromTempoClock` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new instance of LinkClock derived from a Arguments: clock — The TempoClock used to create the LinkClock.."}]} +{"conversations": [{"role": "user", "content": "What does `MxUnitApp.point` do?"}, {"role": "assistant", "content": "channel@slot position on the grid. master channel is Returns: Point"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nd = { |freq = 440| SinOsc.ar(LastValue.ar(freq, 20), 0, 0.2) }.play;\n\nd.set(\\freq, 400);\nd.set(\\freq, 200);\nd.set(\\freq, 670);\nd.set(\\freq, 680);\nd.set(\\freq, 695;\nd.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nd = { |freq = 440| SinOsc.ar(LastValue.ar(freq, 20), 0, 0.2) }.play;\n\nd.set(\\freq, 400);\nd.set(\\freq, 200);\nd.set(\\freq, 670);\nd.set(\\freq, 680);\nd.set(\\freq, 695);\nd.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `PHSplayer` in SuperCollider?"}, {"role": "assistant", "content": "PHSplayer — PHS player object Implicitely instantiated when PHS's play method is called, allows stopping and resuming with options also concerning the help synth. Category: Libraries > miSCellaneous > HS and HSpar, Streams-Patterns-Events > HS and HSpar."}]} +{"conversations": [{"role": "user", "content": "What is `AllpassC` in SuperCollider?"}, {"role": "assistant", "content": "AllpassC — Schroeder allpass delay line with cubic interpolation. A Schroeder allpass filter is given by the difference equations Category: UGens > Delays."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `GbmanL`."}, {"role": "assistant", "content": "```supercollider\n// default initial params\n{ GbmanL.ar(MouseX.kr(20, SampleRate.ir)) * 0.1 }.play(s);\n\n// different initial params\n{ GbmanL.ar(MouseX.kr(20, SampleRate.ir), -0.7, -2.7) * 0.1 }.play(s);\n\n// wait for it...\n{ GbmanL.ar(MouseX.kr(20, SampleRate.ir), 1.2, 2.0002) * 0.1 }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(GbmanL.ar(40)*400+500)*0.4 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\ns.scope;\na = { HilbertFIR.ar(SinOsc.ar(100) * -20.dbamp, LocalBuf(2048) }.play;\na.release;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\ns.scope;\na = { HilbertFIR.ar(SinOsc.ar(100) * -20.dbamp, LocalBuf(2048)) }.play;\na.release;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `FoaDecoderMatrix.shelfK` do?"}, {"role": "assistant", "content": "If the decoder is dual-band psychoacoustically optimised, get or set the shelf"}]} +{"conversations": [{"role": "user", "content": "Explain `PLseries` in SuperCollider briefly."}, {"role": "assistant", "content": "PLseries — dynamic scope Pseries variant Takes Symbol args for later reference by the Streams, which will read from variables in the Environments of their instantiation. See PLx_suite. Category: Libraries > miSCellaneous > PLx suite, Streams-Patterns-Events > PLx suite."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n SinOsc.ar(\n RunningMax.ar(Dust.ar(20), Impulse.ar(0.4)) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// follow a sine lfo, reset rate controlled by mouse x\n(\n{\n SinOsc.ar(\n RunningMax.kr(SinOsc.kr(0.2), Impulse.kr(MouseX.kr(0.01, 2, 1))) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n SinOsc.ar(\n RunningMax.ar(Dust.ar(20), Impulse.ar(0.4)) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// follow a sine lfo, reset rate controlled by mouse x\n(\n{\n SinOsc.ar(\n RunningMax.kr(SinOsc.kr(0.2), Impulse.kr(MouseX.kr(0.01, 2, 1))) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Dstutter` in SuperCollider?"}, {"role": "assistant", "content": "Dstutter — Demand rate input replicator Category: UGens > Demand."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nt = TempoClock(120/60).permanent_(true);\n\n(\n~change_clock_tempo = {|clock, tempo, beats=1|\n beats.do {|beat|\n var stepTempo = beat.linexp(0, beats-1, clock.tempo, tempo);\n clock.schedAbs(clock.nextBar + beat, {\n \"New Tempo: \".post; (stepTempo*60).post; \" BPM\".postln;\n clock.tempo_(stepTempo);\n });\n };\n nil;\n};\nPbindef(\\n,\n \\octave, 4,\n \\dur, 0.5,\n \\degree, Pseq((0..7), inf)\n).play(t, quant: 4);\n);\n\n~change_clock_tempo.value(t, 200/60, 16);\n~change_clock_tempo.value(t, 50/60, 8);\nt.tempo*60\n```"}, {"role": "assistant", "content": "This gradually changes the tempo of a TempoClock, each beat of a specified number of beats, and starting at the next bar.\r\n\r\n\r\nPersonally, I was not able to heavily distinguish between `.linlin` and `.linexp` for reasonable musical tempos.\r\n\r\n\r\nThere may be a mathematically smoother way of handling this at the control rate.\r\n\r\n\r\nThis function does not gracefully handle multiple simultaneous invoca."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `SyncSaw` that runs as it is."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n(\n// send a synth def to server\nSynthDef(\"tpulse\", { arg out=0,freq=700,sawFreq=440.0;\n Out.ar(out, SyncSaw.ar(freq, sawFreq,0.1) )\n}).send(s);\n);\n\n// all OSC commands generated in the function contained below will be added to a bundle\n// and executed simultaneously after 2 seconds.\n(\ns.makeBundle(2.0, {\n x = Synth.new(\"tpulse\");\n a = Bus.control.set(440);\n x.map(\\freq, a);\n});\n);\nx.free;\n\n// don't send\n(\nb = s.makeBundle(false, {\n x = { PinkNoise.ar(0.1) * In.kr(0, 1); }.play;\n});\n);\n// now pass b as a pre-existing bundle, and start both synths synchronously\n(\ns.makeBundle(nil, { // nil executes ASAP\n y = { SinOsc.kr(0.2).abs }.play(x, 0, 0, \\addBefore); // sine envelope\n}, b);\n);\nx.free; y.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `LID.deviceRoot` do?"}, {"role": "assistant", "content": "This is the base path where to look for devices. By default this is: `\"/dev/input\"`. With `findAvailable` this is extended with the `name` that is passed in, which has as a default `\"event\"`. Hence, by default we look for devices that match the path: `\"/dev/input/event*\"`. See below for some #Opening devices with alternative"}]} +{"conversations": [{"role": "user", "content": "What does `UnicodeResponder.option` do? What arguments does it take?"}, {"role": "assistant", "content": "register responder functions for unicode and modifier combinations Arguments: ... assns."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a, b;\na = Pslide([1, 2, 3, 4, 5], inf, 3, 1, 0);\nx = a.asStream;\n13.do({ x.next.postln });\n);\n\n// Pslide used as a sequence of pitches:\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\nc = Pslide(#[1, 2, 3, 4, 5], inf, 3, 1, 0) * 3 + 67;\nx\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a, b;\na = Pslide([1, 2, 3, 4, 5], inf, 3, 1, 0);\nx = a.asStream;\n13.do({ x.next.postln });\n);\n\n// Pslide used as a sequence of pitches:\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\nc = Pslide(#[1, 2, 3, 4, 5], inf, 3, 1, 0) * 3 + 67;\nx = c.asStream;\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, x.next.midicps]);\n 0.17.wait;\n })\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `TChoose`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar,\n Pulse.ar\n ];\n TChoose.ar(Dust.ar(MouseX.kr(1, 1000, 1)), a) * 0.2\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for simple melody algorithmically generated with a Markov Chain."}, {"role": "assistant", "content": "```supercollider\n/* Markov Chain Experiment II\n Jacob Joaquin\n\n Get a visual representation of the Markov Chain here:\n http://codehop.com/supercollider-markov-chain/\n*/\n\n(\n// Synthesizer\nSynthDef(\\my_synth, {|dur = 1.0, amp = 1.0, freq = 440|\n var env = EnvGen.ar(Env.new([1, 0.1, 0], [0.06, dur - 0.06]), doneAction: 2);\n Out.ar([0, 1], SinOsc.ar([freq * 0.995, freq * 1.005], 0, env * amp))\n}).add; \n\n// Create task\nt = Task({\n // Set attributes of each node\n // [freq, dur, [[next_state, weighted_random],…]]\n var node_list = [\n [60, 1, [[1, 2]]],\n [62, 0.5, [[0, 1], [2, 1]]],\n [63, 1, [[0, 1], [3, 1]]],\n [65, 0.5, [[0, 1], [3, 4], [4, 1]]],\n [67, 1, [[5, 1]]],\n [70, 1.5, [[4, 1], [6, 2]]],\n [69, 1, [[4, 1], [7, 2]]],\n [72, 0.5, [[4, 1], [7, 4], [0, 2]]]\n ];\n\n var node_index = 0;\n var bps = 133.0 / 60.0; // Beats per second\n \n inf.do({\n var weight = 0;\n var random;\n var accumulator;\n var node = node_list[node_index]; \n var freq = node[0].midicps;\n var dur = node[1] / bps;\n var paths = node[2];\n \n // Get total statistical weight of connected nodes\n (0 .. paths.size - 1).do {|i| weight = weight + paths[i][1]};\n \n // Generate random value for choosing next node\n random = weight.rand;\n\n // Choose next node based on statistical weights\n accumulator = paths[0][1];\n \n node_index = block {|break|\n paths.size.do {|i|\n if ((random < accumulator), {\n break.value(paths[i][0])\n }, {\n accumulator = accumulator + paths[i + 1][1] \n })\n }\n };\n \n // Play\n Synth(\\my_synth, [\\dur, dur, \\amp, -3.dbamp, \\freq, freq]); \n dur.wait;\n })\n});\n\nt.start;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = NodeProxy(s);\na.play;\na.source = { Pulse.ar(130, Saw.kr(0.3) * 0.1 }; // change this line while running\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = NodeProxy(s);\na.play;\na.source = { Pulse.ar(130, Saw.kr(0.3)) * 0.1 }; // change this line while running\n```"}]} -{"conversations": [{"role": "user", "content": "What does `FrameCompare.kr` do? What arguments does it take?"}, {"role": "assistant", "content": "calculates spectral MSE distance of two fft chains Arguments: buffer1 — FFT chain1; buffer2 — FFT chain2; wAmount — Influence of the weight matrix (should be between 0 and 1). Weight matrix helps to minimize errors on regions with more energy.."}]} -{"conversations": [{"role": "user", "content": "Explain `BufAllpassC` in SuperCollider briefly."}, {"role": "assistant", "content": "BufAllpassC — Buffer based all pass delay line with cubic interpolation. All pass delay line with cubic interpolation which uses a buffer for its internal memory. See also BufAllpassN which uses no interpolation, and which BufAllpassL uses linear interpolation. Cubic interpolation is more computationally expensive than linear, but more accurate. Category: UGens > Delays > Buffer."}]} -{"conversations": [{"role": "user", "content": "What does `PatchOut.releaseBusses` do?"}, {"role": "assistant", "content": "manages a Player's output when connecting to other Players"}]} -{"conversations": [{"role": "user", "content": "What does `SequenceableCollection.exprand` do?"}, {"role": "assistant", "content": "Fill a SequenceableCollection with random values in the range minVal to maxVal with exponential distribution. `Array.exprand(8, 1,"}]} -{"conversations": [{"role": "user", "content": "What does `MIDIdef.cc` do?"}, {"role": "assistant", "content": "A convenience method to create a new MIDIdef which responds to MIDI control messages. See #*new for argument Returns: An instance of MIDIdef which responds to MIDI control messages."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Electrode Theremin (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var saw, bpf;\n saw = Saw.ar(\n freq: 30, \n mul: SinOsc.kr(\n freq: LFPulse.ar(freq: [100, 1000]).range(1, 10),\n width: 0.9));\n bpf = BPF.ar(in: saw, freq: MouseY.kr(1000, [6000, 9000]), rq: MouseX.kr(0.1, 0.9), mul: 20);\n Out.ar(0, bpf);\n \n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `String`."}, {"role": "assistant", "content": "```supercollider\n~listing = \"ls Help\".unixCmdGetStdOut; // Grab\n~listing.reverse.as(Array).dupEach.join.postln; // Mangle\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Date.format` do?"}, {"role": "assistant", "content": "Obtain a date string with a given format. The character % is replaced by the appropriate value, which is derived from the letter that follows. `Date.getDate.format(\"Today is %A. It is around %I o'clock"}]} -{"conversations": [{"role": "user", "content": "What does `Image.tileInRect` do? What arguments does it take?"}, {"role": "assistant", "content": "tile the image or a portion of it in a specified rectangle of the current graphic context. This may stretch the image depending on the destination rect. Arguments: rect — the Rect where to draw it; fromRect — the portion of the Image to use; operation — the compositing operation to use. `'sourceOver'` is the default.; opacity — the opacity to use, ranging from 0.0 (fully transparent) to 1.0 (fully opaque)."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Re: winter is coming?"}, {"role": "assistant", "content": "```supercollider\n(\n{ \n Limiter.ar(\n Pan2.ar(\n LPF.ar(\n DynKlank.ar(\n `[\n Array.rand(5, 700, 2000), \n nil, \n Array.rand(5, 0.2, 5).collect({|freq|\n SinOsc.kr(freq).range(0.1,1)\n })\n ], \n Limiter.ar(\n Dust.ar( SinOsc.kr(1).range(1.5, 4), 0.45) \n + \n Impulse.ar( SinOsc.kr(0.03).range(0.5, 1.2) , 0, 0.9)\n )\n ),\n 1600,\n 0.6\n ),\n SinOsc.kr(0.01 + 4.rand, mul:0.5)\n )\n +\n Pan2.ar(\n DynKlank.ar(`[\n Array.rand(5, 700, 2000).collect({ |freq| SinOsc.kr( SinOsc.kr( SinOsc.kr(0.2).range(0, 10) ) ).range(100, freq) }),\n nil, \n Array.rand(5, 0.3, 1)\n ], PinkNoise.ar(0.006) ),\n Lag.kr(TRand.kr(-0.8, 0.8, Pulse.kr(2 + 10.rand)))\n )\n ) * LorenzL.ar(MouseX.kr(0, 230), add: 0.5, mul: 0.5)\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Cleanroom (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n~t = 1; TempoClock.default.tempo = ~t;\n(\nSynthDef(\\ambifall3, { arg out=0, gate=1, amp=0.1, pan=0, freq=200;\n var sig;\n //thisThread.randSeed = 1923;\n\n sig = SinOsc.ar(freq);\n sig = Pan2.ar(sig, pan, amp);\n sig = ( WhiteNoise.ar + 0.8 ) * LFSaw.ar({ exprand(10.0,10000) }!20 * ( 1 + ( SinOsc.ar((1..4).rand(0.0)/18 * XLine.kr(1,121200,80)) * 1/41 * XLine.kr(1,0.1,60) )));\n sig = DelayC.ar(sig, 0.2, {rrand(1/5,1/10000) * ( 1 + ( SinOsc.ar((1..2).rand(0.0)/18 * XLine.kr(42,11200,60)) * 1/41 * XLine.kr(1,180,60) ))}!4) + sig / 2;\n sig = DelayC.ar(sig, 0.2, {rrand(1/5,1/10000) * XLine.kr(1/1000,1/20001,14)}!4) + sig / 2;\n sig = sig + BPF.ar(\n sig, \n { ( exprand(100.0,10000) * LFNoise1.ar(1/100.0.rand).range(1,2) ).clip(20,20000) }!10,\n { ( rand(0.01,1) * LFNoise1.ar(1/100.0.rand).range(1,2) ).clip(0.01,1) }!10\n );\n sig = BRF.ar(\n sig, \n { ( exprand(100.0,10000) * LFNoise1.ar(1/100.0.rand).range(1,2) ).clip(20,20000) }!10,\n { ( rand(0.01,1) * LFNoise1.ar(1/100.0.rand).range(1,2) ).clip(0.01,1) }!10\n );\n sig = LeakDC.ar(sig);\n sig = LPF.ar(sig, 17000 * XLine.kr(1,1/100,4));\n sig = sig * 5 * 3;\n sig = sig.mean;\n //sig = sig.clip;\n //sig = Compander.ar(sig, sig, \\cpt.kr(0.4), \\cpbelow.kr(1.001), \\cpabove.kr(0.009), \\cpclamp.kr(0.01), \\cprelax.kr(0.1));\n sig = Limiter.ar(sig, 1);\n sig = sig * EnvGen.kr(\\adsr.kr(Env.adsr(0.1,0.1,0.8,4.1)), gate, doneAction:2);\n sig = sig * amp;\n Out.ar(out, sig);\n}).add;\n);\n(\nPdef(\\part, Pdef(\\ambifall3, \n Ppar([\n Pseq([\n Pmono(\\ambifall3,\n \\freq, 2,\n \\dur, Pseq([1],4),\n \\amp, 0.1,\n ),\n Event.silent(4),\n ],inf),\n ])\n)).play;\n);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for number 10 for Quiz 4a."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var tri, bpf;\n tri = LFTri.ar(\n freq: [440,340, 513],\n mul: LFPulse.kr(\n freq: [6,3,2],\n width: 0.15));\n bpf = SinOsc.ar(in: tri, freq: LFNoise2.kr(4).range(400,1000));\n Splay.ar(tri,bpf);\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `IrNumberEditor` in SuperCollider?"}, {"role": "assistant", "content": "IrNumberEditor — a number box and slider for editing a float value [\\ir rate] When used with Patch or InstrSpawner this will result in an .ir rate control. This means you can only change the value before the synth starts, no 'control' rate modulation. Category: Libraries > crucial > Editors."}]} -{"conversations": [{"role": "user", "content": "What does `DigitalOut.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Write data to a digital output Arguments: digitalPin — Digital pin number to write to. Pin numbers begin at 0. This value cannot be modulated.; output — Value to write out to the pin - the value will be 1 when the argument is larger than 0, otherwise 0.; mul; add."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for gabber kick (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\gabberkick, {\n var snd;\n snd = SinOsc.ar(Env([1000, 69, 60], [0.015, 0.1], \\exp).ar * [-0.1, 0, 0.1].midiratio);\n snd = Mix(snd);\n snd = (snd * 10).tanh;\n snd = (snd * 5.1).atan;\n snd = BPeakEQ.ar(snd, XLine.kr(2000, 100, 0.3), 2.0, 8);\n snd = snd + DelayC.ar(snd, 0.01, SinOsc.ar(4).range(0.0, 0.001));\n snd = RLPF.ar(snd, 8000, 0.7);\n snd = snd * Env([0, 1, 0.7, 0.7, 0], [0.001, 0.01, 0.3, 0.02]).ar(2);\n snd = (snd * 0.6).clip(-1, 1);\n Out.ar(\\out.kr(0), Pan2.ar(snd, \\pan.kr(0), \\amp.kr(0.1)));\n}).add;\n);\n\nSynth(\\gabberkick, [amp: 0.6])\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `OSCresponderNode`."}, {"role": "assistant", "content": "```supercollider\n// example: two SuperCollider apps communicating\n\n// application 1:\nn = NetAddr(\"127.0.0.1\", 57120); // the url should be the one of computer of app 2 (or nil)\n\no = OSCresponderNode(n, '/chat', { |t, r, msg| (\"time:\" + t).postln; msg[1].postln }).add;\n\n// application 2:\nm = NetAddr(\"127.0.0.1\", 57120); // the url should be the one of computer of app 1\nm.sendMsg(\"/chat\", \"Hello App 1\");\n\n// sending bundles (including timestamps)\n(\nm.sendBundle(2.0, [\"/chat\", \"Hello App 1\"], [\"/chat\", \"Hallo Wurld\"]);\nm.sendBundle(0.0, [\"/chat\", \"Hello App 1\"], [\"/chat\", \"Hallo Wurld\"]);\n);\n\n// end application 1:\no.remove;\n```"}]} -{"conversations": [{"role": "user", "content": "How do I record my output to a file?"}, {"role": "assistant", "content": "`s.record(path)` starts recording the server's output; `s.stopRecording` stops it.\n\n```supercollider\ns.record(\"C:/audio/take1.wav\");\n// play for a while\ns.stopRecording;\n```\n\nThe path must be writable and the format follows the extension (.wav, .aiff, .flac). The file is written\nby the server, so it captures exactly what the master bus produces — including your effects, which is what\nyou want. `s.record` also accepts `duration:` to stop by itself, which is the reproducible form for a take."}]} -{"conversations": [{"role": "user", "content": "What does `RedObject.update` do?"}, {"role": "assistant", "content": "Moves the object by updating the #-loc, #-vel and #-accel instance"}]} -{"conversations": [{"role": "user", "content": "What is `Pproto` in SuperCollider?"}, {"role": "assistant", "content": "Pproto — provide a proto event for an event stream Pproto uses the makeFunction to allocate resources (buffers, buses, groups) and create a protoEvent that makes those resources available to a pattern. It is fully compatible with non-realtime synthesis using render. Category: Streams-Patterns-Events > Patterns > Server Control."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// play around\n(\n{\n var input, numsamp, power;\n numsamp = 500;\n input = SoundIn.ar;\n power = MouseX.kr(0.1, 4);\n\n (RunningSum.ar(input ** power, numsamp)/numsamp) ** (power.reciprocal)\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// play around\n(\n{\n var input, numsamp, power;\n numsamp = 500;\n input = SoundIn.ar;\n power = MouseX.kr(0.1, 4);\n\n (RunningSum.ar(input ** power, numsamp)/numsamp) ** (power.reciprocal)\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a, b;\na = Prand([1, 2, 3, 4, 5], 6); // return 6 items\nb = a.asStream;\n7.do({ b.next.postln });\n);\n\n// return also a subpattern:\n(\nvar a, b;\na = Prand([1, Pseq([10, 20, 30]), 2, 3, 4, 5], 6); // return 6 items\nb = a.asStream;\n7.do({ b.next.postln });\n);\n\n// Prand used as a sequence of pitches:\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneA\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a, b;\na = Prand([1, 2, 3, 4, 5], 6); // return 6 items\nb = a.asStream;\n7.do({ b.next.postln });\n);\n\n// return also a subpattern:\n(\nvar a, b;\na = Prand([1, Pseq([10, 20, 30]), 2, 3, 4, 5], 6); // return 6 items\nb = a.asStream;\n7.do({ b.next.postln });\n);\n\n// Prand used as a sequence of pitches:\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Prand(#[60, 61, 63, 65, 72], inf).asStream;\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, a.next.midicps]);\n 0.2.wait;\n })\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes 003_102 (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\nSynthDef('003_102', {|out=0,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y| Out.ar(out, Pan2.ar(Normalizer.ar(( GbmanL.ar( LPF.ar( SyncSaw.ar(p, k, q, h ), FreqShift.ar(d, r, k, y, a ), h, n ), r, l, Blip.ar(r, f, u, i ), h ))*( LFPar.ar(d, x, Saw.ar(w, k, Formant.ar(s, q, d, DelayL.ar(y, 0.5, w, v, i ), e ) ), y ))*( LFCub.ar(q, a, h, g ))*( Gendy1.ar(r, c, r, QuadL.ar(h, o, j, t, t, v, f ), k, p, g, Pulse.ar(g, g, c, s ), PMOsc.ar(f, u, d, t, d, f ), f, LFNoise0.ar(k, l, e ), d ) )))) }).play(args: #[ a, 0.1, b, 0.83039082494709, c, 7.4736936148092, d, 57.834883574831, e, 0.56638920329924, f, 2.7610572022348, g, -0.60208093272399, h, 0.69731527262978, i, 0.97553825378418, j, 0.47619211673737, k, 0.45142233371735, l, 6.5229251440451, m, 0.34238355327673, n, 3.1624102065486, o, 1, p, 1, q, 5.4898714868897, r, 2.7777416341664, s, 10966.099508885, t, 0.15706503391266, u, 3.1945936724559, v, 20000, w, -4.6151277924266, x, 1.4588773159677, y, 0.0012384873762477 ])\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Sample.tempo` do? What arguments does it take?"}, {"role": "assistant", "content": "tempo of the musical content of the sample if its a rhythmic loop. this co-depends on the beats Arguments: tm."}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for smooth arpeggio, updated envelope (a SuperCollider snippet): bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\bass, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.perc(0.2), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Strange offset behaviour when plotting some .kr uGens?"}, {"role": "assistant", "content": "SuperCollider forum — Strange offset behaviour when plotting some .kr uGens\n\nI’ve got a workaround for this now.\n\n```supercollider\ns.quit;\nServer.local.options.blockSize = 4;\ns.boot;\n\n{[\n LFTri.ar(s.sampleRate/2, 1, 2), // just to show where the samples are\n Impulse.ar(0), // audio rate impulse in correct place\n Impulse.kr(0), // control rate impulse with offset issue\n Trig1.kr(1, 0) // control rate impulse in correct place\n]}.plot(70/s.sampleRate);\n\n{[\n LFTri.ar(s.sampleRate/2, 1, 2), // just to show where the samples are\n Phasor.ar(Impulse.ar(0), 1/8, -2, 2, -0.625), // Phasor as it behaves in audio rate\n Phasor.kr(Impulse.kr(0), 1/2, -2, 2, -0.625), // Phasor as it behaves in control rate\n Phasor.kr(Impulse.kr(0), 1/2, -2, 2, -0.5) + (1.5 * Trig1.kr(1, 0)) // Phasor in control rate patched to match audio rate\n]}.plot(70/s.sampleRate)\n```\n\nI assume the problem is that the first control rate sample is meant to be more of a ‘sample -1’ than ‘sample 0’, hence why plot omits it when the output is at control rate. This would be fine if audio rate uGens started after one control period. Since they don’t, I’m happy to just adjust the code to make the subsequent samples correct, and then use ​ + (x * Trig1.kr(1, 0)) to patch the first sample. The only problem now is that it’s more complicated to do that with some other uGens."}]} +{"conversations": [{"role": "user", "content": "What does `AbstractPlayer.isPrepared` do?"}, {"role": "assistant", "content": "the base class for all Players : a playable object"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n/// Installing sc3-plugins quarks\n\n// If you installed the sc3-plugins to a user location:\n~sc3plugs = Quarks(\nreposPath: \"https://sc3-plugins.svn.sourceforge.net/svnroot/sc3-plugins/build\",\nlocalPath: Platform.userAppSupportDir +/+ \"SC3plugins\"\n);\n\n// If the sc3-plugins were installed to a system wide location:\n~sc3plugs = Quarks(\nreposPath: \"https://sc3-plugins.svn.sourceforge.net/svnroot/sc3-plugins/build\",\nlocalPath: Platform.systemAppSupportDir +/+ \"SC3plugins\"\n);\n\n\n// Get a GUI of the available Quarks and install the ones you want to try out:\n~sc3plugs.gui;\n\n\n// For more general Help on Quarks, see the Quarks helpfile\n```"}, {"role": "assistant", "content": "Installing sc3-plugins quarks If you installed the sc3-plugins to a user location:."}]} +{"conversations": [{"role": "user", "content": "Where does the magic frequency 261.6255653006 come from?"}, {"role": "assistant", "content": "SuperCollider forum — Where does the magic frequency 261.6255653006 come from?\n\nThinking about this a bit more, on one hand it might be useful if set (and everything else in Event) could fetch not only the msgFunc from the synthDesc, which it does (if args are set to []), but perhaps also the default values for the synth controls... and then used those in preference to Event defaults if “nothing is specified” for some key in the event. Alas “nothing is specified” is tedious to detect in Event, as it does its own calculations which have a lot of inputs (esp. for the frequency stuff). So, one could implement such a policy more explicitly in a \\finish callback that e.g. looks up in synthDesc only specific keys (say specified in a defArgs, possibly with [] meaning all found in the synthDesc) and sets only those if “not set” in event.\n\nI almost started coding this idea, but I realised that’s actually inferior to just putting the synth defaults in another event/environment, and chaining that before the event... which is exactly what I usually do with a Pdef.envir. That approach, besides sidestepping the issue of detecting what’s “not set” in the Event, has an extra advantage that a persistent set of defaults, after being initialized with the synthdef ones, can be easily tweaked in a gui. When I find myself that I often change the default value of some control like that, I go back and change the synthdef default. Because of that workflow, in which I always have the defaults loaded in an chained envir, I didn’t even have much realization of Event defaults for things like amp, freq etc. And I didn’t need type: \\set much until recently... for which getting the args constructed in that case is also rather easy as Pdef(...).controlKeys. Even without Pdefs, that’s straightforward (past loading those defaults into an event)\n\n```supercollider\ne = SynthDescLib.global.synthDescs.at(\\default).controls.inject((), { |e, c| e[c.name] = c.defaultValue });\n(instrument: \\default, dur: 1, amp: 0.2).next(e).play\n```"}]} +{"conversations": [{"role": "user", "content": "What does `CheckBadValues.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Test for infinity, not-a-number, and denormals Arguments: in — the UGen whose output is to be tested.; id — an id number to identify this UGen. The default is 0.; post — One of three post modes:."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nb = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n\n(\n{\n var snd, envTime, knee, out;\n snd = PlayBuf.ar(1, b, BufRateScale.kr(b), loop: 1);\n envTime = MouseX.kr(1.0e-3, 0.1e-3);\n knee = MouseY.kr(0, -90).dbamp;\n out = DelayC.ar(snd, 0.01, envTime * 0.5) * EnvFollow.ar(snd, 1 - (envTime * SampleRate.ir).reciprocal).max(knee).reciprocal;\n out * 0.1!2\n}.play;\n)\n```"}, {"role": "assistant", "content": "a replication of the legendary LADSPA plugin of the same name, originally written by steve harris. a compressor with a super fast attack which results in harsh distortion fx. requires sc3-plugins."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `InFeedback`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-InFeedback\", { |out = 0, in = 0|\n Out.ar(out,\n InFeedback.ar(in, 1)\n );\n}).add;\nSynthDef(\"help-SinOsc\", { |out = 0, freq = 440|\n Out.ar(out, SinOsc.ar(freq, 0, 0.1))\n}).add;\n);\n\nx = Bus.audio(s, 1);\n\n// read from bus n play to bus 0 (silent)\na = Synth(\"help-InFeedback\", [\\in, x.index, \\out, 0]);\n\n// now play a synth after this one, playing to bus x\nb = Synth.after(a, \"help-SinOsc\", [\\out, x.index]);\n\n// add another synth before a which also writes to bus x\n// now you can't hear b, as its data is one cycle old, and is overwritten by c\nc = Synth.before(a, \"help-SinOsc\", [\\out, x.index, \\freq, 800]);\n\n// free c and you can hear b again\nc.free;\nx.free;\n\na.free; b.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `ProxySynthDef`?"}, {"role": "assistant", "content": "ProxySynthDef — synth def that wraps ugen graph"}, {"role": "user", "content": "What does `ProxySynthDef.sampleAccurate` do?"}, {"role": "assistant", "content": "always use OffsetOut, if set to true (default: false)"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na = ProxySynthDef(\"xtest\", { SinOsc.ar(400) * 0.1 });\n\na.add;\n\nx = Synth(\"xtest\");\nx.release;\n\n\n/*\n\n if the resulting number of channels is larger than a given channelConstraint,\n it behaves according to the rate: audio rate signals are wrapped around\n a smaller channel size, control rate signals are not (the exceeding channels are left out)\n\n*/\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `SharedIn`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n// only works with the internal server\ns = Server.internal;\ns.boot;\n);\n\n(\nSynthDef(\"help-SharedIn1\", {\n Out.ar(0, SinOsc.ar(Lag.kr(SharedIn.kr(0, 1), 0.01), 0, 0.2));\n}).add;\nSynthDef(\"help-SharedIn2\", {\n Out.ar(1, SinOsc.ar(Lag.kr(SharedIn.kr(0, 1), 0.01, 1.5), 0, 0.2));\n}).add;\n);\n\n(\ns.setSharedControl(0, 300); // an initial value\ns.sendMsg(\\s_new, \"help-SharedIn1\", x = s.nextNodeID, 0, 1);\ns.sendMsg(\\s_new, \"help-SharedIn2\", y = s.nextNodeID, 0, 1);\n\nRoutine({\n 30.do({\n s.setSharedControl(0, 300 * (10.rand + 1));\n 0.2.wait;\n });\n s.sendMsg(\\n_free, x);\n s.sendMsg(\\n_free, y);\n}).play;\n);\n\n\ns.quit;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for gabber kick (a SuperCollider snippet) that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\gabberkick, {\n var snd;\n snd = SinOsc.ar(Env([1000, 69, 60], [0.015, 0.1], \\exp).ar * [-0.1, 0, 0.1].midiratio);\n snd = Mix(snd);\n snd = (snd * 10).tanh;\n snd = (snd * 5.1).atan;\n snd = BPeakEQ.ar(snd, XLine.kr(2000, 100, 0.3), 2.0, 8);\n snd = snd + DelayC.ar(snd, 0.01, SinOsc.ar(4).range(0.0, 0.001));\n snd = RLPF.ar(snd, 8000, 0.7);\n snd = snd * Env([0, 1, 0.7, 0.7, 0], [0.001, 0.01, 0.3, 0.02]).ar(2);\n snd = (snd * 0.6).clip(-1, 1);\n Out.ar(\\out.kr(0), Pan2.ar(snd, \\pan.kr(0), \\amp.kr(0.1)));\n}).add;\n);\n\nSynth(\\gabberkick, [amp: 0.6])\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a;\na = Pexprand.new(0.0001, 1, inf);\nc = a.asStream.nextN(500);\n// plot the values\nc.plot(bounds: Rect(10, 10, 520, 380), discrete: true, parent: w);\n// a histogram of the values\nc.histo(500).plot(bounds: Rect(10, 410, 520, 380), parent: w);\n);\n\n// sound example\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq,\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a;\na = Pexprand.new(0.0001, 1, inf);\nc = a.asStream.nextN(500);\n// plot the values\nc.plot(bounds: Rect(10, 10, 520, 380), discrete: true, parent: w);\n// a histogram of the values\nc.histo(500).plot(bounds: Rect(10, 410, 520, 380), parent: w);\n);\n\n// sound example\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n(\nvar a;\na = Pexprand(0.0001, 1.0, inf).asStream;\n{\n loop {\n Synth(\\help_sinegrain, [\\freq, a.next * 600 + 300]);\n 0.02.wait;\n }\n}.fork;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `StandardN`."}, {"role": "assistant", "content": "```supercollider\n// vary frequency\n{ StandardN.ar(MouseX.kr(20, SampleRate.ir)) * 0.3 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Timer`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// using timer to modulate sine frequency: the slower the trigger is the higher the frequency\n(\n{ var trig;\n trig = Impulse.kr(MouseX.kr(0.5, 20, 1));\n SinOsc.ar(Timer.kr(trig) * 500 + 500, 0, 0.2)\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a, b;\na = Pseq([1, 2, 3], 2);\nb = Pseq([65, 76]);\nc = Pswitch([a, b, 800], Pseq([2, 2, 0, 1], inf));\nx = c.asStream;\n24.do({ x.next.postln });\n);\n\n\n// Pswitch used as a sequence of pitches:\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a, b;\na = Pseq([1, 2, 3], 2);\nb = Pseq([65, 76]);\nc = Pswitch([a, b, 800], Pseq([2, 2, 0, 1], inf));\nx = c.asStream;\n24.do({ x.next.postln });\n);\n\n\n// Pswitch used as a sequence of pitches:\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Pseq([73, 71, 69], 2);\nb = Pseq([0, 0, 0, 4, 0]+64);\nc = Pswitch([a, b, 75], Pseq([2, 2, 0, 1], inf));\nx = c.asStream;\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, x.next.midicps]);\n 0.18.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `GVerb`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\n// CAUTION: THE FOLLOWING CAN BE EXTREMELY LOUD\n// set the following variable to true if you want to run this code\nvar run = false;\nif (run) {\n { GVerb.ar(Dust.ar(5), SinOsc.kr(0.3).range(10, 14), drylevel:0) }.play\n}\n// 3.13 super loud glitch (crackling)! 3.14: super loud glitch (cleaner pitch shifting)!\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Can I run SuperCollider without the IDE?"}, {"role": "assistant", "content": "Yes. `sclang` runs the language and `scsynth` the server, and they are separate processes by design\n— the IDE is only a client. A headless script is a `.scd` run with `sclang my-piece.scd`, and it must boot\nthe server itself:\n\n```supercollider\ns.boot;\ns.waitForBoot {\n // build SynthDefs, play, then wait\n 30.wait;\n s.quit;\n};\n```\n\nThat shape — boot, wait, play, quit, exit — is what makes a piece runnable from a cron job or a\nRaspberry Pi."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\\synth_1a, { |freq = 400, preAmp = 5, amp = 0.1|\n var src = SinOsc.ar(freq, 0, mul: preAmp).tanh ! 2;\n OffsetOut.ar(0, src * amp * EnvGen.ar(Env.perc, doneAction: 2))\n}).add;\n);\n\n(\np = Pbind(\n \\instrument, \\synth_1a,\n \\preAmp, PL(\\preAmp), // or Pfunc { ~preAmp } \n \\amp, PL(\\amp), // or Pfunc { ~amp } \n \\midinote, PLseq(\\seq) + PL(\\seqAdd), \n \\dur, 0.2\n);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\\synth_1a, { |freq = 400, preAmp = 5, amp = 0.1|\n var src = SinOsc.ar(freq, 0, mul: preAmp).tanh ! 2;\n OffsetOut.ar(0, src * amp * EnvGen.ar(Env.perc, doneAction: 2))\n}).add;\n);\n\n(\np = Pbind(\n \\instrument, \\synth_1a,\n \\preAmp, PL(\\preAmp), // or Pfunc { ~preAmp } \n \\amp, PL(\\amp), // or Pfunc { ~amp } \n \\midinote, PLseq(\\seq) + PL(\\seqAdd), \n \\dur, 0.2\n);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Very quick-and-dirty hack to show stereo phase. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\nb = Bus.audio(s, 2);\na = { |inbus = 0|\n var sig = In.ar(inbus, 2);\n // x axis is side, oriented toward right;\n // y axis is mid\n [sig[1] - sig[0], sig.sum]\n}.play(s.defaultGroup, outbus: b, addAction: \\addAfter);\nc = s.scope;\nc.style = 2;\nc.bus = b;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\Mirror;\n~description = \"Mirror soundfield\";\n\n~function = {|in = 0, order = 1, mirrorFrontBack = 0, mirrorLeftRight = 0, mirrorUpDown = 0 |\nHOATransMirror.ar(order, in, mirrorFrontBack, mirrorLeftRight, mirrorUpDown);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ BPF.ar(BrownNoise.ar(0.1.dup), MouseX.kr(40, 17000, 1), 0.2 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ BPF.ar(BrownNoise.ar(0.1.dup), MouseX.kr(40, 17000, 1), 0.2) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `OnePole`."}, {"role": "assistant", "content": "```supercollider\n{ OnePole.ar(WhiteNoise.ar(0.5), 0.95) }.play\n\n{ OnePole.ar(WhiteNoise.ar(0.5), -0.95) }.play\n\n{ OnePole.ar(WhiteNoise.ar(0.5), Line.kr(-0.99, 0.99, 10)) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "What does `PLshuf.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new PLshuf Arguments: list — Symbol or Pshuf list arg. If a Symbol is passed, list can be assigned to an envir variable later on. This lists's elements can be dynamically replaced by Patterns or Streams.; repeats — Symbol or Pshuf repeats arg. If a Symbol is passed, repeats can be assigned to an envir variable later on. Defaults to inf.; cutItems — Symbol or Boolean or Integer (0 or 1) or a Function returning Boolean or Integer. If a Symbol is passed, cutItems can be assigned to an envir variable later on. Determines if list items, which are Patterns or Streams themselves, will be finished if a replacement occurs during their embedding, or if ; envir — Dictionary or one of the Symbols \\top, \\t (topEnvironment), \\current, \\c (currentEnvironment). Dictionary to be taken for variable reference. Defaults to \\current.."}]} +{"conversations": [{"role": "user", "content": "What are the arguments of GrainBuf.ar?"}, {"role": "assistant", "content": "`GrainBuf.ar(numChannels, trigger, dur, sndbuf, rate, pos, interp, pan, envbufnum, maxGrains, mul, add)`. The ones you always pass are numChannels (1 or 2), trigger (a UGen that fires grains, e.g. Impulse.kr(20)), dur (grain length in seconds), sndbuf (an integer buffer number, or `~buf`), rate (playback rate per grain), and pos (read position 0..1 into the buffer). Raise maxGrains if the server complains about too many grains rather than lowering density."}]} +{"conversations": [{"role": "user", "content": "How current is your SuperCollider knowledge?"}, {"role": "assistant", "content": "It comes from a snapshot of the SuperCollider repository (documentation, class library and examples) plus code I can reason about. So classes and arguments in that snapshot I know well, including argument order. Quarks, newer UGens, and anything outside the official tree I may not know at all, and I will say so rather than invent a method name. If you need certainty about a class, check its help page — `SinOsc.schelp` in the source tree is the authority."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Convolution2L`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// one last example\n(\nb = Buffer.alloc(s, 512, 1);\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, true, true);\n);\n\n(\n{\n var input = SoundIn.ar(0);\n var framesize = 512;\n Convolution2L.ar(input, b, 0, framesize, 1, 0.5);\n}.play\n);\n\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Synth.addAfterMsg` do?"}, {"role": "assistant", "content": "See *new above for details on Returns: a message of the type s_new which can be bundled. When sent to the server this message will instantiate this synth, immediately after aNode."}]} +{"conversations": [{"role": "user", "content": "Explain `TreeView` in SuperCollider briefly."}, {"role": "assistant", "content": "TreeView — A view displaying a tree of items with columns A view that displays a hierarchy of items. It is divided into rows and column: each row represents an item, and each column represents a different data field of the items. Category: GUI > Views."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Saw` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\event_set, { |freq = 440, gate = 1, amp = 0.1, lagTime = 0.1,\n ffreq = 2000, detune = 1.005, out = 0|\n var sig = Saw.ar(Lag.kr(freq, lagTime) * [1, detune]).sum * amp\n * EnvGen.kr(Env.adsr, gate, doneAction: Done.freeSelf);\n Out.ar(out, sig ! 2);\n}).add;\n);\n\na = Synth(\\event_set);\n\n(\np = Pbind(\n \\type, \\set,\n \\id, a,\n \\instrument, \\event_set,\n \\args, #[],\n \\freq, Pexprand(200, 600, inf),\n \\dur, Pwhite(1, 5, inf) * 0.125\n).play;\n);\n\np.stop;\na.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a chord progression with Pbind."}, {"role": "assistant", "content": "Put an array of degrees in the pattern, use \\strum to spread the chord, and the default instrument\nplays all notes of each event.\n\n```supercollider\n(\nPbind(\n \\scale, Scale.minor,\n \\root, 2,\n \\degree, Pseq([[0, 4, 7], [-3, 0, 4], [-5, -1, 2], [0, 4, 7]], inf),\n \\dur, 1.5,\n \\strum, 0.02,\n \\amp, 0.12,\n \\legato, 0.9\n).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nSynthDef(\"mini\",{\n Out.ar( 0,\n Instr.ar(\"minimoog.two\", SinOsc.kr(1.0).range(300,500) )\n )\n}).send(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nSynthDef(\"mini\",{\n Out.ar( 0,\n Instr.ar(\"minimoog.two\", SinOsc.kr(1.0).range(300,500) )\n )\n}).send(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Event` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\pm, { |out = 0, freq = 440, amp = 0.1, pan = 0, gate = 1, ratio = 1, index = 1, ar = 0.1, dr = 0.1|\n var z;\n z = LPF.ar(\n PMOsc.ar(freq, freq * ratio, Linen.kr(gate, ar, index, dr), 0, 0.3),\n XLine.kr(Rand(4000, 5000), Rand(2500, 3200), 1)\n ) * Linen.kr(gate, 0.01, 0.7, dr, 2);\n OffsetOut.ar(out, Pan2.ar(z, pan, amp));\n}).add;\n);\n\n(instrument: \\pm).play;\n\n(instrument: \\pm, ratio: 3.42, index: 12, freq: 150, ar: 8, dr: 3, sustain: 10).play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Balance2`."}, {"role": "assistant", "content": "```supercollider\n// a stereo signal, both channels at 0dB\n{ [SinOsc.ar(440), SinOsc.ar(440)] }.play\n\n// using Balance on a stereo signal with the position parameter at 0, effectively the same sound but both channels at -3dB\n{ Balance2.ar(SinOsc.ar(440), SinOsc.ar(440), 0) }.play\n\n// pan sweep from left to right\n{ Balance2.ar(SinOsc.ar(440), SinOsc.ar(1000), Line.kr(-1, 1, 5)) }.play\n\n// other examples\n{ Balance2.ar(LFSaw.ar(44), Pulse.ar(33), FSinOsc.kr(0.5), 0.1) }.play;\n{ var source; source = SinOsc.ar([440, 550]); Balance2.ar(source[0], source[1], LFNoise0.kr(4), 0.3) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `FreqScopeView`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// Start server\ns.boot;\n\n// Create analyzer in a window\n(\nw = Window(\"My Analyzer\", Rect(0, 0, 511, 300)); // width should be 511\nf = FreqScopeView(w, w.view.bounds);\nf.active_(true); // turn it on the first time;\n\nw.onClose_({ f.kill }); // you must have this\nw.front;\n{ SinOsc.ar([500, 1000], 0, 0.25).mean.dup }.play(s); // start two sine waves\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{SmoothDecimator.ar(SinOsc.ar([400, 404], 0, 0.2), MouseX.kr(0, 44100), MouseY.kr(0, 1))}.play\n\n{SmoothDecimator.ar(SoundIn.ar, MouseX.kr(0, 44100), MouseY.kr(0, 1)}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{SmoothDecimator.ar(SinOsc.ar([400, 404], 0, 0.2), MouseX.kr(0, 44100), MouseY.kr(0, 1))}.play\n\n{SmoothDecimator.ar(SoundIn.ar, MouseX.kr(0, 44100), MouseY.kr(0, 1))}.play\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `UserView` in SuperCollider briefly."}, {"role": "assistant", "content": "UserView — A custom drawn view using Pen An empty view on which you can draw using the Pen class. Category: GUI > Views."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n~chaos={\n var signal, myFrequency, frequencyMin=0.1, frequencyMax=30, myAmplitude, amplitudeMin=0.01, amplitudeMax=0.6, myPhase, phaseMin=0, phaseMax=1.5;\n myFrequency = Array.fill(2, {[rrand(frequencyMin, frequencyMax)]});\n myAmplitude = Array.fill(2, {[rrand(amplitudeMin, amplitudeMax)]});\n myPhase = Array.fill(2, {[rrand(phaseMin, phaseMax)]});\n signal = LeakDC.ar(ChaosGen.allSubclasses.choose.ar(myFrequency, myPhase, myAmplitude));\n Out.ar(0, signal);\n};\n);\n\n~chaos.scope\n```"}, {"role": "assistant", "content": "chaos gen modular function for modular pseudo ugen prototyping."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nd = { |gate = 1| { BrownNoise.ar }.dup * EnvGen.kr(Env.asr, gate, doneAction: Done.freeSelf) }.play;\nd.release(3;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nd = { |gate = 1| { BrownNoise.ar }.dup * EnvGen.kr(Env.asr, gate, doneAction: Done.freeSelf) }.play;\nd.release(3);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n\n// define HS, PHS - play\n\n(\nh = HS(s, { |freq = 0.5, dev = 10, center = 65| LFDNoise3.kr(freq, dev, center) });\n\np = PHS(h, nil, // default help synth args\n Prand([0.4, 0.2],inf), [ \\midinote, Pkey(\\val), \\amp, 0.1 ],\n 0.1, [ \\midinote, Pkey(\\val) + 9.5 + Pxrand([0, 2, 5],inf), \\amp, 0.08 ]\n).play;\n);\n\n\n// stop only help synth\n\np.stop(hsStop: true, pbindStop\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n\n// define HS, PHS - play\n\n(\nh = HS(s, { |freq = 0.5, dev = 10, center = 65| LFDNoise3.kr(freq, dev, center) });\n\np = PHS(h, nil, // default help synth args\n Prand([0.4, 0.2],inf), [ \\midinote, Pkey(\\val), \\amp, 0.1 ],\n 0.1, [ \\midinote, Pkey(\\val) + 9.5 + Pxrand([0, 2, 5],inf), \\amp, 0.08 ]\n).play;\n);\n\n\n// stop only help synth\n\np.stop(hsStop: true, pbindStop: false);\n\n\n// stop pbind\n\np.stop;\n\n\n// resume help synth and eventstream player\n\np.play(hsPlay: true, pbindPlay: true);\n\n\n// stop player and free HS\n\np.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for Re: Dark sea horns: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\n Ndef(\\x, {\n var output;\n var delayTime;\n var delayMax = 0.2;\n var delayAdd = 0.1;\n var pulseFreq = 0.5;\n var proxyMul = 2;\n var pulseMin = 40;\n var pulseMax = 130;\n var numOfEchos = 2;\n\n var mainPulse = LFPulse.ar(pulseFreq, 0, 0.5).range(pulseMin, pulseMax);\n var proxy = Ndef(\\x).ar * proxyMul;\n var ampModFreq = SinOsc.ar(0.01, 0).range(0.3, 30);\n var ampMod = LFNoise1.ar(ampModFreq, 6);\n output = SinOsc.ar(mainPulse + proxy, 0, ampMod).tanh;\n numOfEchos.do{\n delayTime = {delayMax.rand + delayAdd}!2;\n output = AllpassL.ar(output, 0.1, delayTime, 5);\n };\n output.tanh;\n }).play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for exploring of morphing cycled envelopes (i.e: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\ro_v19, {\n var freq = 40.rrand(90).debug('base freq');\n var seed = thisThread.randSeed = 1000000000.rand.debug('seed');\n var gen = [LFNoise2,LFNoise0,SinOsc,LFPulse,LFSaw];\n var sig = Splay.ar({\n var i = 4.exprand(40).asInteger;\n Median.ar(\n 3.exprand(18),\n EnvGen.ar(\n Env( // wave form\n [0] ++ Array.fill(i-1, { \n gen.choose.kr(\n 0.25.coin.if({ gen.choose.kr(0.01.exprand(0.1)).exprange(0.1,1) }, { 0.1.exprand(1) }), \n mul: 0.25.coin.if({ gen.choose.kr(0.05.exprand(10)).range(0.1,1) }, { 0.1.rrand(1) })\n )\n }) ++ [0],\n Array.rand(i-1, 0.1,1.0).normalizeSum,\n [[-5.0.rrand(5),\\sin].choose] ++ Array.fill(i-2, {\n [\\sin ! 1.rrand(6), -5.0.rrand(5) ! 1.rrand(4)].flat.choose\n }) ++ [[-5.0.rrand(5),\\sin].choose]\n ).circle,\n timeScale: Duty.kr( // freq\n Drand([4,8,16,24], inf), 0,\n Dwrand([1,2,4,8,16,32,64]*freq, ((14..7) ** 1.rrand(3)).normalizeSum, inf) // octave\n * 0.75.coin.if({ Duty.kr( // note\n [Dxrand, Drand].choose.new([0.125,0.25,0.5,1,2,4,6,8,12], inf), 0,\n Dshuf({ (0..11).choose.midiratio } ! 1.exprand(8), inf)\n ) }, { (0..11).choose.midiratio })\n ).reciprocal\n )\n ) * EnvGen.kr( // rhythm\n Env.perc(\n 0.01.exprand(0.4) * 0.25.coin.if({ Duty.kr( // atk\n Drand([0.5,1,2,4,8,12,16], inf), 0,\n Dshuf({ [1,2,3,4].choose } ! 1.exprand(8), inf)\n ) }, { 1 }),\n 0.1.exprand(4) * 0.75.coin.if({ Duty.kr( // release\n Drand([0.5,1,2,4,8,12,16], inf), 0,\n Dshuf({ [1,2,4,8,16].choose.reciprocal } ! 1.exprand(8), inf)\n ) }, { 1 }),\n LFNoise2.kr(0.1.exprand(10)).range(0.05,1), // appearance\n LFNoise2.kr(0.1.exprand(10)).range(-4,4),\n ).circle\n );\n } ! 3.rrand(9).debug('source'));\n BHiShelf.ar(\n GVerb.ar(\n Rotate2.ar(sig[0], sig[1], Duty.kr(Drand([2,4,8],inf), 0, Drand([-1,1,0],inf)) * LFSaw.kr(0.1.exprand(1))),\n 40.rrand(150).debug('room')\n ),\n LFNoise2.kr(0.1.exprand(0.5)).range(4000,6500),\n LFNoise2.kr(0.1.exprand(1)).range(1,3),\n LFNoise2.kr(0.1.exprand(1)).range(-24,-16)\n );\n}).play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// example; this buffer is mono, so the number of samples matches the number of frames\nb = Buffer.read(s, ExampleFiles.child);\n\n// indexing with a phasor\n{ BufRd.ar(1, b, Phasor.ar(0, BufRateScale.kr(b), 0, BufSamples.kr(b))) }.play;\n\n// indexing by hand\n{ BufRd.ar(1, b, K2A.ar(MouseX.kr(0, BufSamples.kr(b)))) }.play;\n\nb.free;\n```"}, {"role": "assistant", "content": "example; this buffer is mono, so the number of samples matches the number of frames indexing with a phasor (BufSamples: Current number of samples in buffer.)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a;\na = Pexprand.new(0.0001, 1, inf);\nc = a.asStream.nextN(500);\n// plot the values\nc.plot(bounds: Rect(10, 10, 520, 380), discrete: true, parent: w);\n// a histogram of the values\nc.histo(500).plot(bounds: Rect(10, 410, 520, 380), parent: w);\n);\n\n// sound example\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq,\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a;\na = Pexprand.new(0.0001, 1, inf);\nc = a.asStream.nextN(500);\n// plot the values\nc.plot(bounds: Rect(10, 10, 520, 380), discrete: true, parent: w);\n// a histogram of the values\nc.histo(500).plot(bounds: Rect(10, 410, 520, 380), parent: w);\n);\n\n// sound example\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n(\nvar a;\na = Pexprand(0.0001, 1.0, inf).asStream;\n{\n loop {\n Synth(\\help_sinegrain, [\\freq, a.next * 600 + 300]);\n 0.02.wait;\n }\n}.fork;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Red4D.position` do?"}, {"role": "assistant", "content": "Get or set the current position of the shape as a"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `XFade2`."}, {"role": "assistant", "content": "```supercollider\n{ XFade2.ar(Saw.ar, SinOsc.ar, LFTri.kr(0.1)) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// By Bjørn Houdorf March 2013, Play your (short) soundfiles with some delay.\n\nb = SoundFile.collectIntoBuffers(\"yourSoundFileFolder/*\"); // 1. rund this\n\n( // 2. and then run this\nt = Task({\n({\n var num= b.size.rand;\n var buf= b[num];\n 0.1*Splay.ar(PlayBuf.ar(buf.numChannels, buf, 1, 1, 0, 0));\n}.play;\n) \n});\n);\n\n\n( // 3. Then run this\nz = Task({\nloop({\n t.start;\n 0.1.wait;\n});\n});\n);\n\n\nz.start; // 4. and run this\nz.stop; // 5. and finally run this\n```"}, {"role": "assistant", "content": "Play your (short) soundfiles with some delay. Your soundfiles should be in the folder \"yourSoundFileFolder\"."}]} +{"conversations": [{"role": "user", "content": "What does `Class.findRespondingUpperSubclasses` do?"}, {"role": "assistant", "content": "Return a list of all classes down the class tree starting from the receiver, whose instances respond to the message selector or all message selector in an array."}]} +{"conversations": [{"role": "user", "content": "Explain `Line` in SuperCollider briefly."}, {"role": "assistant", "content": "Line — Line generator. Generates a line from the start value to the end value. Category: UGens > Envelopes."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var env = Env([0.0, 0.5, 0.0, 1.0, 0.9, 0.0], [0.05, 0.1, 0.01, 1.0, 1.5], -4);\n var envgen = EnvGen.ar(env, doneAction: Done.freeSelf);\n env.plot;\n SinOsc.ar(\n envgen * 1000 + 440\n ) * envgen * 0.1\n}.play\n;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var env = Env([0.0, 0.5, 0.0, 1.0, 0.9, 0.0], [0.05, 0.1, 0.01, 1.0, 1.5], -4);\n var envgen = EnvGen.ar(env, doneAction: Done.freeSelf);\n env.plot;\n SinOsc.ar(\n envgen * 1000 + 440\n ) * envgen * 0.1\n}.play\n);\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n(\np = Pbind(\n \\midinote, PlaceAll([[60, 61], 70, [80, [81, 81.5], 82]], inf),\n \\dur, 0.2\n);\n\nx = p.play;\n);\n\nx.stop;\n\n\n// to distinguish subarrays from arrays to be taken as output use Refs, \n// as wrapping in another array wouldn't do\n\n(\np = Pbind(\n \\midinote, PlaceAll([[60, 61], 70, [80, `[81, 81.5], 82]], inf),\n \\dur, 0.2\n);\n\nx = p.play;\n) ;\n\n\nx.stop;\n\n\n// Items may also\n// …\n```"}, {"role": "assistant", "content": "to distinguish subarrays from arrays to be taken as output use Refs, as wrapping in another array wouldn't do (PlaceAll: Arbitrarily nested embedding of subarrays)"}]} +{"conversations": [{"role": "user", "content": "Interfacing SC with external software: MIDI or OSC?"}, {"role": "assistant", "content": "SuperCollider forum — Interfacing SC with external software: MIDI or OSC?\n\nI found this partial solution on sccode.org :\n\n```supercollider\n // declare an event type which sends OSC commands to Renoise\n\n(\nEvent.addEventType(\\renoise, { |server|\n var renoiseOscServer = NetAddr(\"127.0.0.1\", 8000);\n var notes = [~midinote.value, ~ctranspose.value, ~velocity.value, ~sustain.value, ~lag.value, ~timingOffset.value, ~instr.value, ~track.value].flop;\n var timeNoteOn, timeNoteOff, instrument, track, velocity;\n var serverLatency;\n\n serverLatency = server.latency ? 0;\n\n notes.do {|note|\n instrument = note[6] ? -1;\n track = note[7] ? -1;\n velocity = note[2].asInt.clip(0,127);\n\n // sustain and timingOffset are in beats, lag is in seconds\n timeNoteOn = (thisThread.clock.tempo.reciprocal*note[5])+note[4]+server.latency;\n timeNoteOff = (thisThread.clock.tempo.reciprocal*(note[3]+note[5]))+note[4]+server.latency;\n SystemClock.sched(timeNoteOn, {renoiseOscServer.sendMsg(\"/renoise/trigger/note_on\", instrument.asInt, track.asInt, (note[0]+note[1]).asInt, velocity )});\n SystemClock.sched(timeNoteOff, {renoiseOscServer.sendMsg(\"/renoise/trigger/note_off\", instrument.asInt, track.asInt, (note[0]+note[1]).asInt)});\n }\n});\n);\n\n// Now start Renoise OSC server, load a sample, and try some patterns\n\n// straight timing\n(\nPbind(*[\n type: \\renoise,\n legato: Pgauss(0.2,0.05,inf),\n dur: 0.2,\n degree: [2,5,12],\n track: Prand([0,1], inf),\n ctranspose: Pseq([0,0,0,0,4,4,4,4,5,5,5,5],inf),\n velocity: Pgauss(64,10,inf),\n]).play;\n)\n```\n\nhttp://sccode.org/1-4SN\n\nBut what I couldn’t find there was a simple syntax for sending Note Events or Midi Events as OSC messages... Do I really need to re-implement the whole SC’s defaultParentEvent as new OSC Event to send it using regular pattern’s syntax?"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// next example\n\nb = Buffer.read(s, ExampleFiles.child);\n\n(\n{\n var input = SoundIn.ar(0);\n var framesize = 2048; // must have power of two\n Convolution2L.ar(input, b, 0, 512, 1, 0.5);\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// next example\n\nb = Buffer.read(s, ExampleFiles.child);\n\n(\n{\n var input = SoundIn.ar(0);\n var framesize = 2048; // must have power of two\n Convolution2L.ar(input, b, 0, 512, 1, 0.5);\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "My sustained synth never stops, even when I set the gate to 0."}, {"role": "assistant", "content": "A sustained EnvGen only releases when the gate goes from positive to non-positive *after* the envelope has started, and the Synth only disappears if that EnvGen has `doneAction: 2`. Check three things: the SynthDef actually takes a `gate = 1` argument, the Env is a sustained shape (Env.adsr or Env.asr, not Env.perc), and you call `x.set(\\gate, 0)` on the Synth object. Setting the gate on a different Synth, or on a Group, does nothing."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Looping sampler with crossfading. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\\simpler, {\n arg buf=0\n ,freq=220\n ,sampleStart=0\n ,loopStart=0\n ,loopLen=1 // between 0 (min) and 1 (max)\n ,fadeTime=0.1\n ,gate=1\n ,attack=0.01\n ,sustain=1\n ,release=1\n ,f0=220;\n\n var rate = freq / f0;\n var sr = rate*BufSampleRate.kr(buf);\n var fadeFrames = fadeTime*sr;\n var loopEnd = loopLen*(BufFrames.kr(buf) - loopStart) + loopStart;\n var loopFrames = loopEnd - loopStart + 1;\n var loopTime = (loopFrames - fadeFrames)/sr;\n var startUpTime = (loopStart - sampleStart)/sr;\n\n var trigLoop = TDuty.ar(Dseq([startUpTime + loopTime, Dseq([loopTime], inf)]), gapFirst:1);\n\n var phaseA = Phasor.ar(trigLoop, rate, sampleStart, inf, loopStart);\n var phaseB = Phasor.ar(trigLoop, rate, loopEnd - fadeFrames, inf, loopEnd - fadeFrames);\n\n var srcA = BufRd.ar(buf.numChannels, buf, phaseA);\n var srcB = BufRd.ar(buf.numChannels, buf, phaseB);\n\n var startLoop = SetResetFF.ar(trigLoop);\n var loopPan = Phasor.ar(trigLoop, 2/fadeFrames * rate, -1, inf, -1).clip(-1,1);\n\n var out = Select.ar(startLoop, [srcA, LinXFade2.ar(srcB, srcA, pan:loopPan)]);\n var env = EnvGen.ar(Env.asr(attack, sustain, release, 1), gate, doneAction:2);\n\n Out.ar(0, Splay.ar(out) * env);\n}).add;\n\n// Try it out:\n~buf = Buffer.read(s, Platform.resourceDir +/+ 'sounds/a11wlk01.wav');\n\nPdef(\\p, Pbind(*[\n instrument: \\simpler\n ,buf: ~buf\n ,octave: Prand([3,4,5],inf)\n ,degree: Pn(Plazy({Pseq([-4,0,5,7,9,12].scramble.clump(2),2)}))\n ,dur: 0.5\n ,strum: Prand([0, 0.125, 0.25], inf)\n ,strumEndsTogether: false\n ,loopStart: Pwhite(90000, 150000)\n ,sampleStart: Pwhite(50000, 85000)\n ,loopLen: 0.4\n ,fadeTime: 0.15\n ,attack: 0.25\n ,release: 4\n])).play;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `GlitchHPF` in SuperCollider briefly."}, {"role": "assistant", "content": "GlitchHPF — backward compatibility after sc3.4 HPF and RHPF were changed to use double-precision floats (svn revision: 10300 - 8sep2010). GlitchHPF and GlitchRHPF can be used as drop-in replacements to get the old behavior back. Good for very noise and glitchy sounds. Category: UGens > Filters > Linear, UGens > Filters > GlitchUGens."}]} +{"conversations": [{"role": "user", "content": "What does `Slider2D.ctrl_scale` do? What arguments does it take?"}, {"role": "assistant", "content": "The factor by which #-step is multiplied when incrementing or decrementing the values by keyboard while the Ctrl key is Arguments: A Float.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ SinOsc.ar(ControlRate.ir * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ SinOsc.ar(ControlRate.ir) * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\n// send a synth def to server\nSynthDef(\"tpulse\", { |out = 0, freq = 700, sawFreq = 440.0|\n Out.ar(out, SyncSaw.ar(freq, sawFreq, 0.1));\n}).add;\n);\n\n// Here the defaults for *new will result in a Synth at the head of the default group\n// of the default Server. This will use the SynthDef's default arguments;\ny = Synth.new(\"tpulse\");\ny.free;\n\n// The same done explicitly\ny = Synth.new(\"tpulse\", nil, s, \\addToHead);\ny.free;\n\n// With some arguments\ny = Synth.new(\"tpulse\", [\\freq\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\n// send a synth def to server\nSynthDef(\"tpulse\", { |out = 0, freq = 700, sawFreq = 440.0|\n Out.ar(out, SyncSaw.ar(freq, sawFreq, 0.1));\n}).add;\n);\n\n// Here the defaults for *new will result in a Synth at the head of the default group\n// of the default Server. This will use the SynthDef's default arguments;\ny = Synth.new(\"tpulse\");\ny.free;\n\n// The same done explicitly\ny = Synth.new(\"tpulse\", nil, s, \\addToHead);\ny.free;\n\n// With some arguments\ny = Synth.new(\"tpulse\", [\\freq, 350, \\sawFreq, 220]);\ny.free;\n\n// make a new synth\ny = Synth(\"tpulse\");\n\n// pause\ny.run(false);\n\ny.run(true);\n\n// set a control by argument name\ny.set(\"freq\", 200);\n\n// or by index\ny.set(2, 100.0);\n\n// modulate out to bus number 1 (the right speaker)\ny.set(0, 1);\n\n// multiple set commands in one message\ny.set(\"out\", 0, \"freq\", 300);\n\n// free the synth from the server\ny.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `MultiTap`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\nb = Buffer.alloc(s, s.sampleRate);\n(\n{\n MultiTap.ar(`[0.1, 0.2, 0.3, 0.4], `[0.1, 0.2, 0.4, 0.8],\n Decay.ar(Dust.ar(2), 0.1, PinkNoise.ar), bufnum: b.bufnum)\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Ndef`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\nNdef(\\sound, { |freq = 56, numHarm = 10| Blip.ar(freq, numHarm, 30) * 0.2 }).play;\nNdef(\\sound).set(\\freq, 15);\nNdef(\\sound).set(\\freq, 15, \\numHarm, 100);\n\nNdef(\\lfo, { LFNoise2.kr(2).exprange(10, 200) });\nNdef(\\sound).map(\\numHarm, Ndef(\\lfo));\nNdef(\\sound).set(\\numHarm, nil); // unmap.\nNdef(\\sound).stop;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ OnePole.ar(WhiteNoise.ar(0.5), 0.95) }.play\n\n{ OnePole.ar(WhiteNoise.ar(0.5), -0.95) }.play\n\n{ OnePole.ar(WhiteNoise.ar(0.5), Line.kr(-0.99, 0.99, 10) }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ OnePole.ar(WhiteNoise.ar(0.5), 0.95) }.play\n\n{ OnePole.ar(WhiteNoise.ar(0.5), -0.95) }.play\n\n{ OnePole.ar(WhiteNoise.ar(0.5), Line.kr(-0.99, 0.99, 10)) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `OffsetOut` in SuperCollider briefly."}, {"role": "assistant", "content": "OffsetOut — Write a signal to a bus with sample accurate timing. Output signal to a bus, the sample offset within the bus is kept exactly; i.e. if the synth is scheduled to be started part way through a control cycle, OffsetOut will maintain the correct offset by buffering the output and delaying it until the exact time that the synth was scheduled for. Category: UGens > InOut."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Stethoscope`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var f = { |l,h| SinOsc.kr(0.1, {pi.rand}).range(l, h) } ;\n Pulse.ar({ f.(20, 1000) }!6, { f.(0.0, 1) }!6, { f.(0.0, 1.0) }!6)\n}.play;\n);\n\nc = s.scope;\nc.numChannels = 6;\nc.scopeView.waveColors = [Color.red, Color.red, Color.cyan, Color.cyan, Color.white, Color.white];\nc.style = 2;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// modulating the frequency\n\n{ Saw.ar(XLine.kr(40, 4000, 6), 0.2) }.play;\n\n// two band limited sawtooth waves through a resonant low pass filter\n\n{ RLPF.ar(Saw.ar([100, 250], 0.1), XLine.kr(8000, 400, 5), 0.05 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// modulating the frequency\n\n{ Saw.ar(XLine.kr(40, 4000, 6), 0.2) }.play;\n\n// two band limited sawtooth waves through a resonant low pass filter\n\n{ RLPF.ar(Saw.ar([100, 250], 0.1), XLine.kr(8000, 400, 5), 0.05) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `RLPF`."}, {"role": "assistant", "content": "```supercollider\n{ RLPF.ar(Saw.ar(200, 0.1), SinOsc.ar(XLine.kr(0.7, 300, 20), 0, 3600, 4000), 0.2) }.play;\n\n\n(\n{ var ctl = RLPF.ar(Saw.ar(5, 0.1), 25, 0.03);\n SinOsc.ar(ctl * 200 + 400) * 0.1;\n}.play;\n);\n\n\n(\n{ var ctl = RLPF.ar(Saw.ar(5, 0.1), MouseX.kr(2, 200, 1), MouseY.kr(0.01, 1, 1));\n SinOsc.ar(ctl * 200 + 400) * 0.1;\n}.play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "What are the server's default sample rate and block size?"}, {"role": "assistant", "content": "44100 Hz and 64 samples per block by default, so the control rate is 44100/64 = 689.06 Hz. You can read them from the language with `s.sampleRate` and `s.options.blockSize`, or from inside a Synth with `SampleRate.ir` and `ControlRate.ir`. A `.kr` signal therefore updates about 689 times a second, which is why it is smooth enough for filters and envelopes but not for audio-rate FM."}]} -{"conversations": [{"role": "user", "content": "Explain `PSVsect_o` in SuperCollider briefly."}, {"role": "assistant", "content": "PSVsect_o — Sieve pattern for intersection of integer generators with offsets and point output Pattern for intersection of integer generators with offsets and point output. Corresponds to Sieve's methods Sieve#*sect_o and Sieve#-sect_o. For an introduction and more examples see Sieves_and_Psieve_patterns. Category: Libraries > miSCellaneous > Sieves and Psieve Patterns, Streams-Patterns-Events > Sieves and Psieve Patterns."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for controlling arrayed args using pattern."}, {"role": "assistant", "content": "```supercollider\n(\nfork {\n var size = 3.rrand(10).debug('envelope size');\n {|dur=1, amp=0.8, pan = 0|\n Pan2.ar( \n SinOsc.ar(\n EnvGen.ar(Env(\\freq_l.kr(400!size), \\freq_d.kr(0.1!(size-1)), \\freq_c.kr(1!(size-1)))), // named controls\n mul: EnvGen.ar(Env.sine(dur, amp), doneAction:2)\n ).tanh, \n pan\n );\n }.asSynthDef.name_(\"dzin\").add;\n Server.default.sync;\n Pbind(*[\n instrument: \\dzin,\n delta: Pseg(Prand(1/2.pow((0..3)), inf), Pwhite(1,4), \\lin),\n dur: Pfunc({ thisThread.clock.beatDur }) * Pkey(\\delta), // set dur to delta duration\n freq_l: Pcollect(`_, Ptuple({ Pbrown(0,1,0.05).linexp(0,1,40,4e3) } ! size, inf)), // array refs - freq envelope levels\n freq_c: Ptuple({ Pcollect(`_, Ptuple({ Pbrown(-4,4,0.5) } ! (size-1), inf)) }!2, inf), // array of arrayrefs - multichannel expansion w/ different curve levels\n freq_d: Pfunc({ |e| Ref(Array.rand(size-1,0.3,1).normalizeSum * e.dur) }), // sending array ref with total dur = Pkey(\\dur)\n pan: Ptuple( { Pbrown() - 0.5 * 2 } ! 2, inf ), // array - multichannel expansion\n amp: Ptuple( { Pbrown() / 10 + 0.1 } ! 2, inf ) // same\n ]).play(TempoClock(156/60));\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `TwoPole`."}, {"role": "assistant", "content": "```supercollider\n{ TwoPole.ar(WhiteNoise.ar(0.005), 2000, 0.95) }.play\n\n{ TwoPole.ar(WhiteNoise.ar(0.005), XLine.kr(800, 8000, 8), 0.95) }.play\n\n{ TwoPole.ar(WhiteNoise.ar(0.005), MouseX.kr(800, 8000, 1), 0.95) }.play\n```"}]} -{"conversations": [{"role": "user", "content": "How do I stop all sound?"}, {"role": "assistant", "content": "s.freeAll stops every node on the server. On the language side, Ndef.clear and Pdef.clear clear the proxies. If a Pattern is still running, Pdef(\\name).stop does it; CmdPeriod immediately stops everything scheduled on the default clock."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// increase phase multiplier\n{ FBSineL.ar(SampleRate.ir, 1, 0, XLine.kr(1, 2, 10), 0.1) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// increase phase multiplier\n{ FBSineL.ar(SampleRate.ir, 1, 0, XLine.kr(1, 2, 10), 0.1) * 0.2 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Magnitude.>` do?"}, {"role": "assistant", "content": "Comparable value in a linear continuum Returns: a Boolean whether the receiver is greater than aMagnitude."}]} -{"conversations": [{"role": "user", "content": "What does `Document.getTextAsync` do? What arguments does it take?"}, {"role": "assistant", "content": "Get a range of text from the document. Asynchronous. The text is passed to the `action` function as an Arguments: action — A function to evaluate after the request is complete. It is passed one argument, a String, for the retrieved contents.; start — An Integer for the starting position to access.; range — An Integer for the number of characters to retrieve. -1 retrieves to the end of the document.."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes flanger (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"flange\", {arg freq=440, release=0.1;\n var x, sig,out, mod1, depth, mfreq,maxfreq, maxdepth, maxdelay, basedelay;\n maxfreq=3;\n maxdelay=0.01;\n basedelay=maxdelay/2;\n maxdepth=basedelay/2;\n depth = MouseY.kr(0,maxdepth);\n mfreq = MouseX.kr(0,maxfreq);\n mod1 = SinOsc.ar(mfreq,0,depth);\n sig = SoundIn.ar(0,mul:2);\n out = DelayC.ar(sig, maxdelay,basedelay+ mod1);\n out = Mix.ar([out,sig]);\n Out.ar(0,out);\n Out.ar(1,out);\n}).load(s);\n);\n\na = Synth(\"flange\");\na.free\n```"}]} -{"conversations": [{"role": "user", "content": "What is `RosslerL` in SuperCollider?"}, {"role": "assistant", "content": "RosslerL — Rossler chaotic generator A strange attractor discovered by Otto Rossler based on work in chemical kinetics. The system is composed of three ordinary differential equations: x' = - y - z y' = x + ay z' = b + z(x - c) Category: UGens > Generators > Chaotic."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// connect will connect to all midi in devices\n// if you need to specify one,\n// check the sources at: MIDIClient.sources\n// and connect using MIDIIn.connect( source_index )\nMIDIIn.connect;\n\n// show incoming control data\n~control = { arg src, chan, num, val; \n [chan,num,val].postln; \n};\n\nMIDIIn.addFuncTo(\\control, ~control);\n```"}, {"role": "assistant", "content": "Simple example showing how to listen for MIDI control messages."}]} -{"conversations": [{"role": "user", "content": "What does `RedLZW.compress` do?"}, {"role": "assistant", "content": "Expects an array of 8bit integers. Returns an array of"}]} -{"conversations": [{"role": "user", "content": "How do I make a piece reproducible instead of a different take every time?"}, {"role": "assistant", "content": "Three things make a SuperCollider piece repeatable: a fixed seed, a fixed tempo, and no live input.\n\n```supercollider\n(\nthisThread.randSeed = 1234;\nTempoClock.default.tempo = 2;\nPbind(\\degree, Pwhite(0, 7, inf), \\dur, 0.25).play;\n)\n```\n\n`thisThread.randSeed` fixes the random sequence of the current thread, so `Pwhite`, `Prand` and friends give\nthe same values again. Recording with `s.record(path, duration: 30)` then makes the take an artifact rather\nthan a performance. Input from `MouseX` or a MIDI controller is the usual remaining source of difference."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n \n// definition for future reference in arbitrary Environments\n\np = PLbrown(\\lo, \\hi, \\step);\n\n\n// prepare current Environment\n// PLseq repeats arg defaults to inf\n\n(\n~lo = 55;\n~hi = 80;\n~step = Pstutter(10, PLseq([0.05, 3.5]));\n);\n\n\n// run\n\n(\nx = Pbind(\n \\midinote, Ptuple(p!2), \n \\dur, 0.1\n).play;\n);\n\n// replace\n\n(\n~lo = Pseq((50..90));\n~hi = Pseq((50..90) + 15);\n)\n```"}, {"role": "assistant", "content": "definition for future reference in arbitrary Environments prepare current Environment (PLbrown: dynamic scope Pbrown variant)"}]} -{"conversations": [{"role": "user", "content": "What is `DigitalIO`?"}, {"role": "assistant", "content": "DigitalIO — Read or write data to a digital pin"}, {"role": "user", "content": "What does `DigitalIO.ar` do?"}, {"role": "assistant", "content": "The output of this UGen is always the last value read when the digital pin was an input."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// write a sine oscillator's output to a pin, and read the pin value at other times\n\n(\nSynthDef(\"help-DigitalIO\", { |out = 0|\n DigitalIO.ar(0, SinOsc.ar(10), LFPulse.kr(0.1)).poll;\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Psubdivide`."}, {"role": "assistant", "content": "```supercollider\n(\na = Psubdivide(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,0,1,3,4,0], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n100.do({ x.next.postln });\n);\n\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Psubdivide(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n);\n\n\n(\na = Psubdivide(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,4,4,0,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for little study on piano improvisation."}, {"role": "assistant", "content": "```supercollider\n/* Piano Gestures: A Little Study by mimetik\n\n This is a little study on piano improvisation, in particular on \"gestures\", by which I mean here little improvised phrasings.\n\n*/\n\nMIDIClient.init;\n\n/*\nChoose from the list of devices your internal MIDI router, so to send the notes to piano intrument in your favourite DAW\n*/\n\n~mOut = MIDIOut.new(3);\n\n//Set the scale to be Cmajor\n~scale=[0,2,4,5,7,9,11];\n\n//Define pattern proxies which will be modified by the task t below\n\na=PatternProxy(Pxrand([3,3,3,1,3,3],inf));\nb=PatternProxy(Pseq([1/2],inf));\nr=PatternProxy(Pseq([12],inf));\nn=Prand([4,8,16],inf).asStream;\n\nt=Task({\nPdef(\\x,Pbind(\\type,\\midi,\\chan,0,\n \\midiout,~mOut,\n \\scale,~scale,\n \\root,-12,\n \\degree,Pxrand([[0,3,5],[3,5,7],[4,6,8],[5,7,11]],inf),\n \\legato,1,\n \\amp,[{rrand(0.6,0.8)},{rrand(0.5,0.6)},{rrand(0.5,0.6)}]*0.7, \\dur,Prand([Pseq([1,1,1,1],1),Pseq([1,1,2],1),Pseq([1,2,1],1)],inf))).play(quant:1);\n\nPdef(\\y,Pbind(\\type,\\midi,\\chan,0,\n \\midiout,~mOut,\n \\scale,~scale,\n \\root,r,\n \\degree,a,\n \\legato,1,\n \\amp,{rrand(0.5,0.6)},\n\\dur,b)).play(quant:1);\n\n10.wait;\n\nt=Task({\n inf.do({\n if (0.7.coin,{ \n c=[[3,0,7,1,9,11,0,4],[[3,7],0,7,Rest,9,[0,11],0,4]].choose.scramble;\n r.source=Pseq([[12,24].wchoose([0.7,0.3])],inf);\n d=n.next;\n a.source=Pseq([Pxrand(c,d),Pxrand([3,3,3,1,3,3],inf)]);\n b.source=Pseq([Pseq([1/8],d),Pseq([1/2],inf)]);\n });\n rrand(3,4).wait;})}).play(quant:1);\n };\n).play(quant:1);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Editor.addToDefName` do? What arguments does it take?"}, {"role": "assistant", "content": "holds a value that can be edited with a GUI, saves as the value Arguments: stream."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Lag2`."}, {"role": "assistant", "content": "```supercollider\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n Lag2.kr( // lag the modulator\n LFPulse.kr(4, 0, 0.5, 50, 400), // frequency modulator\n Line.kr(0, 1, 15) // modulate lag time\n ),\n 0, // phase\n 0.3 // sine amplitude\n )\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `KeyState.kr` do? What arguments does it take?"}, {"role": "assistant", "content": "Respond to the state of a key Arguments: keycode — The keycode value of the key to check. This corresponds to the keycode values passed into the keyDownActions of SCViews. See the example below.; minval — The value to output when the key is not pressed.; maxval — The value to output when the key is pressed.; lag — A lag factor.."}]} +{"conversations": [{"role": "user", "content": "Explain `SimpleButton` in SuperCollider briefly."}, {"role": "assistant", "content": "SimpleButton — a simple button with a title and an action Size is automatic based on the size of the title string. Category: GUI."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n{ SyncSaw.ar(100, Line.kr(100, 800, 12), 0.1) }.play;\n\n\n(\nplot { [\n SyncSaw.ar(800, 1200),\n Impulse.ar(800) // to show sync rate\n] }\n);\n\n(\nplot { [\n SyncSaw.ar(800, Line.kr(800, 1600, 0.01)), // modulate saw freq\n Impulse.ar(800) // to show sync rate\n] }\n);\n\n// scoping the saw: hit 's' when focused on the scope window to compare the channels\n(\nscope {\n var freq = 400;\n [\n SyncSaw.ar(freq, freq * MouseX.kr(1, 3)), // modulate saw freq\n Impulse\n// …\n```"}, {"role": "assistant", "content": "scoping the saw: hit 's' when focused on the scope window to compare the channels (SyncSaw: Hard sync sawtooth wave.)"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// Pantophonic (2D) decoder with four channels arranged in a rectangle:\n// [ 30, -30, -150, 150 ]\n\n// specify 1/2 the desired directions\n~directions = [ 30, -30 ].degrad;\n~decoder = FoaDecoderMatrix.newDiametric(~directions);\n\n// inspect\n~decoder.dirChannels.raddeg\n```"}, {"role": "assistant", "content": "Pantophonic (2D) decoder with four channels arranged in a rectangle: [ 30, -30, -150, 150 ] (FoaDecoderMatrix: First Order Ambisonic (FOA) decoder matrices)"}]} +{"conversations": [{"role": "user", "content": "What is `BinaryOpFunction`?"}, {"role": "assistant", "content": "BinaryOpFunction — represent a binary operation on a function"}, {"role": "user", "content": "What does `BinaryOpFunction.value` do?"}, {"role": "assistant", "content": "Executes each of the operand functions and then performs the selector on the result."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nvar a = { 19.rand };\nvar b = { [5, 8, 9].choose };\nvar c = a + b;\nfork {\n 15.do {\n (instrument: \\default, note: [c.value, a.value]).play;\n 0.3.wait;\n }\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `IdentityDictionary`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_sinegrain, { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0.5pi, env))\n}).add;\n\na = Pbind(\\instrument, \\help_sinegrain, \\note, Pseq([0, 7, 2, 9, 11, 10, 9, 8], inf), \\dur, 1);\na.play(quant: (quant: 1, phase: 0));\na.play(quant: (quant: 1, phase: 1/3));\na.play(quant: (quant: 1, phase: 1.0.rand));\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ProxySpace`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\np = ProxySpace.new;\np.fadeTime = 2; // fadeTime specifies crossfade\np[\\out].play; // monitor an empty placeholder through hardware output\n// set its source\np[\\out] = { SinOsc.ar([350, 351.3], 0, 0.2) };\np[\\out] = { Pulse.ar([350, 351.3] / 4, 0.4) * 0.2 };\np[\\out] = Pbind(\\dur, 0.03, \\freq, Pbrown(0, 1, 0.1, inf).linexp(0, 1, 200, 350));\n\n// route one proxy through another:\np[\\out] = { Ringz.ar(p[\\in].ar, [350, 351.3] * 8, 0.2) * 4 };\np[\\in] = { Impulse.ar([5, 7]/2, [0, 0.5]) };\n\np.clear(3); // clear after 3 seconds\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Maybe.apply` do?"}, {"role": "assistant", "content": "return the value, or the value of the contained object, if it is a Maybe. This method allows recursion, so that recursive calculations can be made. `a = Maybe({ |a, b| a + b"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Ringz` that runs as it is."}, {"role": "assistant", "content": "```supercollider\na = NodeProxy(s);\na[0] = { |freq = 440, dt=0.1, rate=2| Ringz.ar(Impulse.ar(rate * [1, 1.2]), freq, dt)*0.1 };\na.play;\n(\na[1] = \\set -> Pbind(\n \\dur, Prand([1, 0.5], inf),\n \\freq, Pwhite(200.0, 1000, inf),\n \\rate, Pdup(4, Prand([1, 3, 6, 10], inf)),\n \\dt, Pwhite(0.01, 0.1, inf)\n)\n);\n// modify the source in the meanwhile:\na[0] = { |freq = 440, dt=0.1, rate=2| Ringz.ar(Dust.ar(rate * 10.dup), freq, dt)*0.1 };\n\na.nodeMap.postln; // the values are not set in the node map.\na.clear(3);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Sieve.copyWith` do? What arguments does it take?"}, {"role": "assistant", "content": "Takes over mode and offset from receiver and passes an appropriate Arguments: seqCollection — SequenceableCollection.; withCheck — Boolean. Determines if seqCollection is checked according to mode. Defaults to true.."}]} +{"conversations": [{"role": "user", "content": "What does `SerialPort.putAll` do? What arguments does it take?"}, {"role": "assistant", "content": "Write multiple bytes to the Arguments: bytes — Collection may be Int8Array or String.; timeout — Unused, deprecated.."}]} +{"conversations": [{"role": "user", "content": "What does `StackLayout.index` do?"}, {"role": "assistant", "content": "Sets or gets the index of the current view. The current view is placed on top of others, and if #-mode is 0, all the others are"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Event` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\pm, { |out = 0, freq = 440, amp = 0.1, pan = 0, gate = 1, ratio = 1, index = 1, ar = 0.1, dr = 0.1|\n var z;\n z = LPF.ar(\n PMOsc.ar(freq, freq * ratio, Linen.kr(gate, ar, index, dr), 0, 0.3),\n XLine.kr(Rand(4000, 5000), Rand(2500, 3200), 1)\n ) * Linen.kr(gate, 0.01, 0.7, dr, 2);\n OffsetOut.ar(out, Pan2.ar(z, pan, amp));\n}).add;\n);\n\n(instrument: \\pm).play;\n\n(instrument: \\pm, ratio: 3.42, index: 12, freq: 150, ar: 8, dr: 3, sustain: 10).play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot\n{ SinOsc.ar([330, 440], 0, 0.4) }.play;\nStethoscope(s, 2;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot\n{ SinOsc.ar([330, 440], 0, 0.4) }.play;\nStethoscope(s, 2);\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n~constructPseudoMethods = { |envir|\n var newEnvir = envir.collect { |value|\n var argNames, argBlock, namesBlock, code, func;\n if(value.isKindOf(Function)) {\n func = value;\n argNames = func.def.argumentString(withDefaultValues: true);\n namesBlock = func.def.argumentString(withDefaultValues: false);\n argBlock = if(argNames.notNil) { \"|self, \" ++ argNames ++ \"|\" };\n code = \"{ |func, envir| { % envir.use { func.value(%) } } }\".format(argBlock ? \"\", namesBlock ? \"\");\n //code.postln;\n code.interpret.value(func, envir)\n } {\n value\n }\n };\n newEnvir.know = true; // we want a prototype object style environment\n};\n```"}, {"role": "assistant", "content": "/*\r\nI often like to write out a library as an environment, like:\r\n\r\n~start_sound = { |freq, amp| <...> };\r\n~start_high_pitch_sound = { |amp| ~start_sound.(14000, amp) };\r\n\r\n… and then use loadRelative to load that library.\r\n\r\nThis, however has the problem that you can't stick the whole library into an environment that you call from the outside. e.g.\r\n\r\nq = ();\r\nq.use { resolveRelative(\"/library.sc."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pwrap`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Pn(\n Pwrap(\n Pgeom(200, 1.07, 96),\n 200,\n 1000.0\n ),\n inf\n);\nx = a.asStream;\n\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, x.next.debug, \\dur, 0.3]);\n 0.12.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `AbstractSInstrument.arguments` do?"}, {"role": "assistant", "content": "a dictionary keeping track of the latest set"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BufSamples`."}, {"role": "assistant", "content": "```supercollider\n// example; this buffer is mono, so the number of samples matches the number of frames\nb = Buffer.read(s, ExampleFiles.child);\n\n// indexing with a phasor\n{ BufRd.ar(1, b, Phasor.ar(0, BufRateScale.kr(b), 0, BufSamples.kr(b))) }.play;\n\n// indexing by hand\n{ BufRd.ar(1, b, K2A.ar(MouseX.kr(0, BufSamples.kr(b)))) }.play;\n\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `NRand`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-NRand\", { |out = 0, n = 0|\n Out.ar(out,\n FSinOsc.ar(\n NRand(1200.0, 4000.0, n),\n 0, Line.kr(0.2, 0, 0.01, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n(\nn = 0;\nRoutine({\n inf.do({ |i|\n Synth.new(\"help-NRand\", [\\n, n]); 0.05.wait;\n })\n}).play;\n);\n\nn = 1;\nn = 2;\nn = 4;\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for exploring of morphing cycled envelopes (i.e: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\ro_v19, {\n var freq = 40.rrand(90).debug('base freq');\n var seed = thisThread.randSeed = 1000000000.rand.debug('seed');\n var gen = [LFNoise2,LFNoise0,SinOsc,LFPulse,LFSaw];\n var sig = Splay.ar({\n var i = 4.exprand(40).asInteger;\n Median.ar(\n 3.exprand(18),\n EnvGen.ar(\n Env( // wave form\n [0] ++ Array.fill(i-1, { \n gen.choose.kr(\n 0.25.coin.if({ gen.choose.kr(0.01.exprand(0.1)).exprange(0.1,1) }, { 0.1.exprand(1) }), \n mul: 0.25.coin.if({ gen.choose.kr(0.05.exprand(10)).range(0.1,1) }, { 0.1.rrand(1) })\n )\n }) ++ [0],\n Array.rand(i-1, 0.1,1.0).normalizeSum,\n [[-5.0.rrand(5),\\sin].choose] ++ Array.fill(i-2, {\n [\\sin ! 1.rrand(6), -5.0.rrand(5) ! 1.rrand(4)].flat.choose\n }) ++ [[-5.0.rrand(5),\\sin].choose]\n ).circle,\n timeScale: Duty.kr( // freq\n Drand([4,8,16,24], inf), 0,\n Dwrand([1,2,4,8,16,32,64]*freq, ((14..7) ** 1.rrand(3)).normalizeSum, inf) // octave\n * 0.75.coin.if({ Duty.kr( // note\n [Dxrand, Drand].choose.new([0.125,0.25,0.5,1,2,4,6,8,12], inf), 0,\n Dshuf({ (0..11).choose.midiratio } ! 1.exprand(8), inf)\n ) }, { (0..11).choose.midiratio })\n ).reciprocal\n )\n ) * EnvGen.kr( // rhythm\n Env.perc(\n 0.01.exprand(0.4) * 0.25.coin.if({ Duty.kr( // atk\n Drand([0.5,1,2,4,8,12,16], inf), 0,\n Dshuf({ [1,2,3,4].choose } ! 1.exprand(8), inf)\n ) }, { 1 }),\n 0.1.exprand(4) * 0.75.coin.if({ Duty.kr( // release\n Drand([0.5,1,2,4,8,12,16], inf), 0,\n Dshuf({ [1,2,4,8,16].choose.reciprocal } ! 1.exprand(8), inf)\n ) }, { 1 }),\n LFNoise2.kr(0.1.exprand(10)).range(0.05,1), // appearance\n LFNoise2.kr(0.1.exprand(10)).range(-4,4),\n ).circle\n );\n } ! 3.rrand(9).debug('source'));\n BHiShelf.ar(\n GVerb.ar(\n Rotate2.ar(sig[0], sig[1], Duty.kr(Drand([2,4,8],inf), 0, Drand([-1,1,0],inf)) * LFSaw.kr(0.1.exprand(1))),\n 40.rrand(150).debug('room')\n ),\n LFNoise2.kr(0.1.exprand(0.5)).range(4000,6500),\n LFNoise2.kr(0.1.exprand(1)).range(1,3),\n LFNoise2.kr(0.1.exprand(1)).range(-24,-16)\n );\n}).play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `FunctionDef.argumentString` do? What arguments does it take?"}, {"role": "assistant", "content": "Return a string that contains all argument names and their default values for embedding in a string. If there are no arguments, it returns nil. `{ |a = 9, b = 10, c| a + b }.def.argumentString; // \"a = 9, Arguments: withDefaultValues — If set to false, no default values are appended `// \"a, b, c\"`; withEllipsis — If set to true, ellipsis characters (`\" ... \"`) are appended `// \"a = 9, b = 10 ... c\"`; asArray — If set to true, return the string for an array that represents all arguments. The other arguments are set to false. `// \"[a, b] ++ c\"`."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `SampleRate`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// compares a 441 Hz sine tone derived from sample rate (44100 * 0.01, left)\n// with a 440 Hz tone (right), resulting in a 1 Hz beating\n(\n{\n var freq;\n freq = [SampleRate.ir * 0.01, 440];\n SinOsc.ar(freq, 0, 0.1)\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Interfacing SC with external software: MIDI or OSC?"}, {"role": "assistant", "content": "SuperCollider forum — Interfacing SC with external software: MIDI or OSC?\n\nI found this partial solution on sccode.org :\n\n```supercollider\n // declare an event type which sends OSC commands to Renoise\n\n(\nEvent.addEventType(\\renoise, { |server|\n var renoiseOscServer = NetAddr(\"127.0.0.1\", 8000);\n var notes = [~midinote.value, ~ctranspose.value, ~velocity.value, ~sustain.value, ~lag.value, ~timingOffset.value, ~instr.value, ~track.value].flop;\n var timeNoteOn, timeNoteOff, instrument, track, velocity;\n var serverLatency;\n\n serverLatency = server.latency ? 0;\n\n notes.do {|note|\n instrument = note[6] ? -1;\n track = note[7] ? -1;\n velocity = note[2].asInt.clip(0,127);\n\n // sustain and timingOffset are in beats, lag is in seconds\n timeNoteOn = (thisThread.clock.tempo.reciprocal*note[5])+note[4]+server.latency;\n timeNoteOff = (thisThread.clock.tempo.reciprocal*(note[3]+note[5]))+note[4]+server.latency;\n SystemClock.sched(timeNoteOn, {renoiseOscServer.sendMsg(\"/renoise/trigger/note_on\", instrument.asInt, track.asInt, (note[0]+note[1]).asInt, velocity )});\n SystemClock.sched(timeNoteOff, {renoiseOscServer.sendMsg(\"/renoise/trigger/note_off\", instrument.asInt, track.asInt, (note[0]+note[1]).asInt)});\n }\n});\n);\n\n// Now start Renoise OSC server, load a sample, and try some patterns\n\n// straight timing\n(\nPbind(*[\n type: \\renoise,\n legato: Pgauss(0.2,0.05,inf),\n dur: 0.2,\n degree: [2,5,12],\n track: Prand([0,1], inf),\n ctranspose: Pseq([0,0,0,0,4,4,4,4,5,5,5,5],inf),\n velocity: Pgauss(64,10,inf),\n]).play;\n)\n```\n\nhttp://sccode.org/1-4SN\n\nBut what I couldn’t find there was a simple syntax for sending Note Events or Midi Events as OSC messages... Do I really need to re-implement the whole SC’s defaultParentEvent as new OSC Event to send it using regular pattern’s syntax?"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `CuspL`."}, {"role": "assistant", "content": "```supercollider\n// vary frequency\n{ CuspL.ar(MouseX.kr(20, SampleRate.ir), 1.0, 1.99) * 0.3 }.play(s);\n\n// mouse-controlled params\n{ CuspL.ar(SampleRate.ir/4, MouseX.kr(0.9, 1.1, 1), MouseY.kr(1.8, 2, 1)) * 0.3 }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(CuspL.ar(40, MouseX.kr(0.9, 1.1, 1), MouseY.kr(1.8, 2, 1))*800+900)*0.4 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `RedSFPlayer.stop` do? What arguments does it take?"}, {"role": "assistant", "content": "plays soundfiles (from memory) Arguments: fadeTime — In seconds.."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nNdef(\\nodeTest, {\n // the input\n var input = Impulse.ar([1, 3, 5].reciprocal, phase: [0, 0.133, 0.5]).sum;\n\n // the nodes, each takes its predecessor as input and estimates the duration between two events. \n // Unfortunately, the starting point of Timer is '0' which we have to put into reasonable limits. System settles after about 15 seconds\n var nodes = (1..10).inject([input], {|last, item| \n [TDuty.ar(max(0.25, Timer.ar(last.first)), 0, 1)] ++ last\n });\n\n // add a pitch to each\n nodes = nodes.collect{|node, i| SinOsc.ar((4000 + (i*500))) * Decay2.ar(node, 0.01, 0.2)};\n\n // splay in stereo field\n Splay.ar(nodes);\n\n}).play\n)\n```"}, {"role": "assistant", "content": "Idea: network of loosely connected nodes. Each node has a dedicated pulse rate / phase. Inducing an irregular trigger signal influences the nodes to (gradually) adapt their pulsation freq (and phase?) to the one of the input.\r\nsound example: https://soundcloud.com/lfsaw/sync-weakconnection-tduty-time."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Integrator.ar(LFPulse.ar(300, 0.2, 0.1), MouseX.kr(0.001, 0.999, 1)) }.play\n\n// used as an envelope\n{ Integrator.ar(LFPulse.ar(3, 0.2, 0.0004), 0.999, FSinOsc.ar(700), 0) }.play\n\n\n// scope\n\n{ Integrator.ar(LFPulse.ar(1500 / 4, 0.2, 0.1), MouseX.kr(0.01, 0.999, 1) }.scope\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Integrator.ar(LFPulse.ar(300, 0.2, 0.1), MouseX.kr(0.001, 0.999, 1)) }.play\n\n// used as an envelope\n{ Integrator.ar(LFPulse.ar(3, 0.2, 0.0004), 0.999, FSinOsc.ar(700), 0) }.play\n\n\n// scope\n\n{ Integrator.ar(LFPulse.ar(1500 / 4, 0.2, 0.1), MouseX.kr(0.01, 0.999, 1)) }.scope\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `PulseDivider`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\"help-PulseDivider\", { |out = 0|\n var p, a, b;\n p = Impulse.ar(8);\n a = SinOsc.ar(1200, 0, Decay2.ar(p, 0.005, 0.1));\n b = SinOsc.ar(600, 0, Decay2.ar(PulseDivider.ar(p, 4), 0.005, 0.5));\n\n Out.ar(out, (a + b) * 0.4)\n}).play;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// no, it doesn't take a ugen in ...\n(\n{\n EnvGen.kr(\n Env.asr(0.1, 1.0, 0.5, \\welch),\n 1.0,\n FSinOsc.ar(1.0).range(0.0, 1.0),\n timeScale: 0.1\n ) * SinOsc.ar(440, 0, 0.3)\n}.play;\n);\n\n// ...but an .ir rate input, a float or an ir rate ugen like Rand would work\n(\n{\n EnvGen.kr(\n Env.asr(0.1, 1.0, 0.5, \\welch),\n 1.0,\n Rand(0.1, 1.0),\n timeScale: 0.1\n ) * SinOsc.ar(440, 0, 0.3)\n}.play;\n)\n```"}, {"role": "assistant", "content": "no, it doesn't take a ugen in ... ...but an .ir rate input, a float or an ir rate ugen like Rand would work (EnvGen: Envelope generator)"}]} +{"conversations": [{"role": "user", "content": "Synth Iteration Help?"}, {"role": "assistant", "content": "SuperCollider forum — Synth Iteration Help\n\n```supercollider\n(\nSynthDef (\\sine_tone) {\narg freq = 440, amp = 1, len = 1, bus = 0;\nvar sig, env;\nenv = Env.step ([ amp ], [ len ]);\nenv = EnvGen.kr (env, doneAction: 2);\nsig = SinOsc.ar (freq, 0, env);\nOut.ar (bus % 2, sig); // bus modulo 2 here to wrap to stereo\n}.add;\n)\n```\n\nmaybe try wrapping the bus array to [ 0, 1 ] by using modulo: bus % 2. this should let you hear what is going on using a stereo output\n\nby using a Pbind, each “note” is being instantiated as a separate synth with its own length, amplitude, frequency and bus. the doneAction: 2 argument in the EnvGen.kr ugen just means each synth will free itself once it is done playing the note it has been assigned."}]} +{"conversations": [{"role": "user", "content": "Explain `EaseOutBack` in SuperCollider briefly."}, {"role": "assistant", "content": "EaseOutBack — Back ease-out Easing equation for a back (overshooting cubic easing: (a+1)*t^3 - a*t^2) ease-out, decelerating from zero velocity. The a parameter controls overshoot, the default producing a 10% overshoot. Category: Ease."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n var freqs = [200, 600, 400, 450, 150, 20, 800];\n var amps = Saw.ar(freq: [2,3, 5]).range(1, 0.5, 0.3, 0.8);\n var snd = LFTri.ar(freq: freqs, mul: amps);\n Mix.ar(snd)\n}.play;\n)\n```"}, {"role": "assistant", "content": "LFTri that plays in a single channel with frequent amplitude shifts."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `NamedControl`."}, {"role": "assistant", "content": "```supercollider\n// use NamedControl to create a number of multichannel controls:\n\na = { SinOsc.ar(NamedControl.kr(\\freq, [300, 330, 370], [1, 0.3, 0.02])).sum * 0.1 }.play;\na.setn(\\freq, [700, 705, 890]);\na.setn(\\freq, [0, 2, 5].midiratio * 400);\n\n// synonymous:\na = { SinOsc.ar(\\freq.kr([300, 330, 370], [1, 0.3, 0.02])).sum * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `RHPF`."}, {"role": "assistant", "content": "```supercollider\n{ RHPF.ar(Saw.ar(200, 0.1), FSinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3600, 4000), 0.2) }.play;\n\n(\n{ var ctl = RHPF.kr(LFSaw.kr(2), SinOsc.kr(XLine.kr(0.07, 30, 20), 0, 35, 40), 0.05);\n SinOsc.ar(ctl * 200 + 500);\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ XFade2.ar(Saw.ar, SinOsc.ar, LFTri.kr(0.1) }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ XFade2.ar(Saw.ar, SinOsc.ar, LFTri.kr(0.1)) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for batuhan's buzzer parametrized that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n// A beautiful sc140 tweet by Batuhan Bozkurt, parametrized for real-time changes\n(\n// Start sound here\na = { | rateL = 5, rateR = 6, blipMul = 100, blipAdd = 50, fMul = 50, kMul = 1 |\n f = LocalIn.ar(2).tanh;\n k = Latch.kr(f[0].abs,Impulse.kr(1/4)) * kMul;\n LocalOut.ar(\n f +\n CombC.ar(Blip.ar([rateL, rateR], blipMul * k + blipAdd, 0.9), 1, k*0.3, fMul * f));f\n}.play\n);\n\n// Set parameters for changing sound here: \n\na.set(\\rateL, 10);\n\na.set(\\rateR, 8);\n\na.set(\\blipMul, 25);\n\na.set(\\blipAdd, 70);\n\na.set(\\fMul, 30);\n\n\na.set(\\kMul, 0.01);\n```"}]} +{"conversations": [{"role": "user", "content": "What is `BinaryOpFunction`?"}, {"role": "assistant", "content": "BinaryOpFunction — represent a binary operation on a function"}, {"role": "user", "content": "What does `BinaryOpFunction.value` do?"}, {"role": "assistant", "content": "Executes each of the operand functions and then performs the selector on the result."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nvar a = { 19.rand };\nvar b = { [5, 8, 9].choose };\nvar c = a + b;\nfork {\n 15.do {\n (instrument: \\default, note: [c.value, a.value]).play;\n 0.3.wait;\n }\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Routine` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// SynthDefs on the fly\ns.boot;\n(\nt = TempoClock.new;\nr = Routine.new({\n 10.do({\n // could be done with an argument instead of a new def, but proves the point\n SynthDef(\"help-EnvGen\" ++ i, { arg out = 0;\n Out.ar(\n out,\n EnvGen.kr(Env.perc, 1.0, doneAction: Done.freeSelf)\n * SinOsc.ar(100 + (100 * t.elapsedBeats), 0, 0.1)\n )\n }).play(s);\n 1.yield;\n });\n}).play(t); // Note the alternative syntax: Routine.play(aClock)\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `PlayerUnop.new` do? What arguments does it take?"}, {"role": "assistant", "content": "the result of performing a unary op on a Player Arguments: operator; a."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// ============================\n// extra demos for \\waveguideFlute\n// ============================\n\n\n(\n// Made by Meha Gupta\n// Inspired by The Village by Wrabel\nPbindef(\\dmwaveguideFlute,\n \\instrument, \"waveguideFlute\",\n \\midinote, Pseq([57, 60,\n [46, 62], [53, 62], [58, 62], [58, 64], [58, 62], [58, 60],\n [50, 57], [50, 57], [50, 57], [50, 60], [50, 57], [50, 53],\n [53, 55], [53, 55], [53, 55], [53, 57], [53, 55], [41, 53], 52]),\n \\amp, 0.3,\n \\dur, Pseq([0.25, 0.25, 0.5, 0.5, 0.25, 0.25, 0.25, 0.25,\n 0.5, 0.5, 0.25, 0.25, 0.25, 0.25,\n 0.5, 0.5, 0.25, 0.25, 0.25, 0.25, 1]),\n).play;\n)\n```"}, {"role": "assistant", "content": "============================ extra demos for \\waveguideFlute ============================."}]} +{"conversations": [{"role": "user", "content": "Build a slowly evolving drone with Ndef."}, {"role": "assistant", "content": "Ndef gives you a named patch you can redefine while it plays; the filter is a separate node in the\nchain so you can change it on its own.\n\n```supercollider\n(\nNdef(\\drone, { |freq = 55, amp = 0.12|\n var detune = [0, 0.07, -0.11];\n var sig = Mix(Saw.ar(freq * (1 + detune))) * amp;\n LPF.ar(sig, 400);\n}).play;\n\nNdef(\\drone)[1] = \\filter -> { |in| RLPF.ar(in, LFNoise1.kr(0.1).exprange(200, 1800), 0.3) };\n)\n```\n\nRedefining Ndef(\\drone, { ... }) later crossfades to the new definition; Ndef(\\drone).stop stops it."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// default initial params\n{ GbmanN.ar(MouseX.kr(20, SampleRate.ir)) * 0.1 }.play(s);\n\n// change initial params\n{ GbmanN.ar(MouseX.kr(20, SampleRate.ir), -0.7, -2.7) * 0.1 }.play(s);\n\n// wait for it...\n{ GbmanN.ar(MouseX.kr(20, SampleRate.ir), 1.2, 2.0002) * 0.1 }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(GbmanN.ar(40)*400+500)*0.4 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// default initial params\n{ GbmanN.ar(MouseX.kr(20, SampleRate.ir)) * 0.1 }.play(s);\n\n// change initial params\n{ GbmanN.ar(MouseX.kr(20, SampleRate.ir), -0.7, -2.7) * 0.1 }.play(s);\n\n// wait for it...\n{ GbmanN.ar(MouseX.kr(20, SampleRate.ir), 1.2, 2.0002) * 0.1 }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(GbmanN.ar(40)*400+500)*0.4 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Main` in SuperCollider?"}, {"role": "assistant", "content": "Main — The concrete instance of Process Main is the concrete instance of Process (the runtime environment for the virtual machine and interpreter). Main overrides some methods of Process. There are two methods of interest. One is named startup and is called after the class library has been compiled. The other is called shutdown which gets called when the library gets re-compiled. Category: Core > Kernel."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `CoinGate`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\na = SynthDef(\"help-TCoin\", { |out = 0, prob = 0.5|\n var trig;\n trig = CoinGate.kr(prob, Impulse.kr(10));\n Out.ar(out,\n SinOsc.ar(\n TRand.kr(300.0, 400.0, trig), 0, 0.2\n )\n )\n}).play;\n);\n\na.set(\\prob, 1.0);\na.set(\\prob, 0.0);\na.set(\\prob, 0.1);\n\n\n(\na = SynthDef(\"help-TCoin\", { |out = 0, prob = 0.5|\n var trig;\n trig = Impulse.ar(20, 0, SinOsc.kr(0.5, 0, 1, 1));\n Out.ar(out,\n Mix.fill(3, { Ringz.ar(CoinGate.ar(prob, trig*0.5), #[1, 1.5]*Rand(1000, 9000), 0.01) })\n )\n}).play;\n);\n\na.set(\\prob, 1.0);\na.set(\\prob, 0.0);\na.set(\\prob, 0.1);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SimpleNumber.sphHankel2` do?"}, {"role": "assistant", "content": "Returns the result of the spherical Hankel functions of the second"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n{\n\nvar in, fft, entropy;\n\n//in = SinOsc.ar(MouseX.kr(100,1000),0,0.1);\n//in = Mix(SinOsc.ar([440,MouseX.kr(440,880)],0,0.1)); \nin= SoundIn.ar; \n\nfft = FFT(LocalBuf(2048), in);\n\nentropy=SpectralEntropy.kr(fft,2048,1); //one output band (so full spectrum's entropy)\n\nentropy.poll; \n\nOut.ar(0,Pan2.ar(0.1*Blip.ar(100,10*(entropy.sqrt)))); \n}.play\n);\n\n\n\n\n(\n{\n\nvar in, fft, entropy;\nvar amplit\n// …\n```"}, {"role": "assistant", "content": "in = SinOsc.ar(MouseX.kr(100,1000),0,0.1); in = Mix(SinOsc.ar([440,MouseX.kr(440,880)],0,0.1)); (SpectralEntropy: Spectral feature extraction)"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `TExpRand`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var trig = Dust.kr(10);\n SinOsc.ar(\n TExpRand.kr(300.0, 3000.0, trig)\n ) * 0.1\n}.play;\n);\n\n(\n{\n var trig = Dust.ar(MouseX.kr(1, 8000, 1));\n SinOsc.ar(\n TExpRand.ar(300.0, 3000.0, trig)\n ) * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `AbstractFunction.bitHammingDistance` do?"}, {"role": "assistant", "content": "An object which responds to a set of messages that represent mathematical functions"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Warp1`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\nb.free;\nb = Buffer.read(s, ExampleFiles.apollo11);\n{\n var pointer = Phasor.ar(0, SampleDur.ir / BufDur.ir(b) * XLine.kr(1, 0.25, 20));\n var sound = Warp1.ar(1, b, pointer, 1, 0.3, -1, 16, Line.kr(0, 1, 40), 4);\n Pan2.ar(sound, pointer * 2 - 1, 0.25)\n}.play\n);\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Convolution3` in SuperCollider?"}, {"role": "assistant", "content": "Convolution3 — Time based convolver. Strict convolution with fixed kernel which can be updated using a trigger signal. The convolution is performed in the time domain. Category: UGens > Convolution."}]} +{"conversations": [{"role": "user", "content": "Explain `ServerLogGui` in SuperCollider briefly."}, {"role": "assistant", "content": "ServerLogGui — the interface for display and searching the ServerLog Category: Debugging, External Control > OSC."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Duty`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// this is useful when two UGens need to be called, but only one of their outputs is needed\n(\n{\n var a, b, c;\n a = Dseq([1, 2, 3, 4], inf).dpoll(\"a\");\n b = Dseq([1955, 1952, 1823, 1452], inf).dpoll(\"b\");\n c = (a a Filters > Linear."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\smooth, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.linen(0.05, sustain, 0.1), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n)\n```"}, {"role": "assistant", "content": "plays an arpeggio on the \"left hand\" and an arpeggio on the \"right hand\"."}]} +{"conversations": [{"role": "user", "content": "What does `DynKlang.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Dynamic sine oscillator bank Arguments: specificationsArrayRef — a Ref to an Array of three Arrays:; freqscale — a scale factor multiplied by all frequencies at initialization time.; freqoffset — an offset added to all frequencies at initialization time.."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `ReplaceOut` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// ... a reverb adapted from the \"01 Why SuperCollider document\" in the SC2 distribution\n(\nSynthDef(\"preDelay\", { arg inbus = 2;\n ReplaceOut.ar(\n 4,\n DelayN.ar(In.ar(inbus, 1), 0.048, 0.048)\n )\n}).add;\n\nSynthDef(\"combs\", {\n ReplaceOut.ar(\n 6,\n Mix.arFill(7, { CombL.ar(In.ar(4, 1), 0.1, LFNoise1.kr(Rand(0, 0.1), 0.04, 0.05), 15) })\n )\n}).add;\n\nSynthDef(\"allpass\", { arg gain = 0.2;\n var source;\n source = In.ar(6, 1);\n 4.do({ source = AllpassN.ar(source, 0.050, [Rand(0, 0.05), Rand(0, 0.05)], 1) });\n ReplaceOut.ar(\n 8,\n source * gain\n )\n}).add;\n\nSynthDef(\"theMixer\", { arg gain = 1;\n ReplaceOut.ar(\n 0,\n Mix.ar([In.ar(2, 1), In.ar(8, 2)]) * gain\n )\n}).add;\n);\n\n(\nSynth(\"fm1\", [\\bus, 2, \\freq, 440, \\carPartial, 1, \\modPartial, 1.99, \\mul, 0.071]);\nSynth(\"fm1\", [\\bus, 2, \\freq, 442, \\carPartial, 1, \\modPartial, 2.401, \\mul, 0.071]);\nSynth.tail(s, \"preDelay\");\nSynth.tail(s, \"combs\");\nSynth.tail(s, \"allpass\");\nSynth.tail(s, \"theMixer\", [\\gain, 0.64]);\n);\n\n(\ns.queryAllNodes;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `PLhprand.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new PLhprand Arguments: lo — Symbol or Phprand lo arg. If a Symbol is passed, list can be assigned to an envir variable later on. Can be dynamically replaced by Patterns or Streams. Defaults to 0.; hi — Symbol or Phprand hi arg. If a Symbol is passed, list can be assigned to an envir variable later on. Can be dynamically replaced by Patterns or Streams. Defaults to 1.; length — Symbol or Phprand length arg. If a Symbol is passed, list can be assigned to an envir variable later on. Defaults to inf.; envir — Dictionary or one of the Symbols \\top, \\t (topEnvironment), \\current, \\c (currentEnvironment). Dictionary to be taken for variable reference. Defaults to \\current.."}]} +{"conversations": [{"role": "user", "content": "What does `Editor.patchOut` do?"}, {"role": "assistant", "content": "holds a value that can be edited with a GUI, saves as the value"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `JITGui`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// typically, only subclasses of JITGui are used,\n // so here are just some basic usage and layout tests\n\n // make its own window - defPos, minSize is used\ng = JITGui(Ndef(\\a));\n\n // make its own window, specific size\ng = JITGui(Ndef(\\a), bounds: 390@20);\n\n // provide full bounds\ng = JITGui(Ndef(\\a), bounds: Rect(200, 500, 390, 24));\n\n // extent is 0@0: minSize x, y is used\ng = JITGui(Ndef(\\a), bounds: Rect(200, 500, 0, 0));\ng = JITGui(Ndef(\\a), bounds: Rect(200, 500, 0, 50));\ng = JITGui(Ndef(\\a), bounds: Rect(200, 500, 500, 0));\n\n\n( // put a JITGui in an existing window:\nw = Window().front;\ng = JITGui(Ndef(\\a), 0, w, bounds: 300@48);\n);\n\n( // 5 lines high\nw = Window().front;\ng = JITGui(Ndef(\\a), 5, w);\n);\n\n( // recommended: use a FlowLayout.\nw = Window().front;\nw.addFlowLayout;\nEZSlider(w, 300@100, \\test, []);\ng = JITGui(Ndef(\\a), 0, w, bounds: 300@40);\n);\n\n// test changing color schemes for JITguis\n// this scheme is admittedly ugly but different\n\nGUI.skins.put(\\jit, (\n fontSpecs: [\"Inconsolata\", 12],\n fontColor: Color.white,\n background: Color(0.2, 0.85, 0.7, 0.5),\n foreground: Color.grey(0.1),\n onColor: Color(0.5, 0, 0.5),\n onColor2: Color(0.0, 0.5, 0.5),\n offColor: Color.grey(0.2, 0.5),\n hiliteColor: Color.green(1.0, 0.5),\n gap: 0 @ 0,\n margin: 2@2,\n buttonHeight: 18,\n headHeight: 24)\n);\n\n// make some JITGuis to check\nn = NdefGui(Ndef(\\a));\nNdef(\\a, { SinOsc.ar(\\freq.kr(250)) });\nNdef(\\a).clear;\nn = NdefMixer(s);\n\nTdefAllGui();\nTdef(\\a).set(\\amp, 0.25);\nTdefGui(Tdef(\\a), 5);\n\nEnvirGui((a: 123));\n```"}]} +{"conversations": [{"role": "user", "content": "What does `MxMixerGui.updateFaders` do?"}, {"role": "assistant", "content": "Mixing console with faders, mutes, solos and scope"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n~mdef =\n{\n |key, func, msgNum, permanent = true|\n\n MIDIdef(key, func ?? { MIDIdef(key).func }, msgNum ? MIDIdef(key).msgNum, MIDIdef(key).chan, MIDIdef(key).msgType, MIDIdef(key).srcID).permanent_(permanent)\n}\n```"}, {"role": "assistant", "content": "Change arg values of MIDIdef after instantiation (a SuperCollider snippet)."}]} {"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nMIDIIn.connectAll;\n// MIDIClient.init;\n\n\n(\n// A SynthDef with ADSR envelope\nSynthDef(\"quick2\", {arg freq = 440, amp = 0.1, gate = 1;\n var snd, env;\n env = Env.adsr(0.01, 0.1, 0.3, 2, amp).kr(2, gate);\n snd = Saw.ar(freq: [freq, freq*1.5], mul: env);\n Out.ar(0, snd)\n}).add;\n);\n\n// Play it with a MIDI keyboard\n(\nvar noteArray = Array.newClear(128); // array has one slot per possible MIDI note\n\nMIDIdef.noteOn(\\myKeyDown, {arg vel, note;\n noteArray[note] = Synth(\"quick2\", [\\freq, note.midicps, \\amp, vel.linlin(0, 127, 0, 1)]);\n [\"NOTE ON\", note].postln;\n});\n\nMIDIdef.noteOff(\\myKeyUp, {arg vel, note;\n noteArray[note].set(\\gate, 0);\n [\"NOTE OFF\", note].postln;\n});\n)\n// PS. Make sure SC MIDI connections are made (MIDIIn.connectAll)\n```"}, {"role": "assistant", "content": "Basic example - how to use a MIDI keyboard with a simple synth."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for julian rohrhuber (c 2007)."}, {"role": "assistant", "content": "```supercollider\n// julian rohrhuber (c 2007)\n\n(\nSynthDef(\"deepsea\", { arg out, pan=0, amp=0.1, variation=0.9;\n var dt, n, freq, mul, t, u;\n n = Rand(7, 46);\n dt = 25.0 + Rand(-1.7, 1.7);\n dt = dt + LFNoise2.kr(2, variation) * 0.001;\n freq = 901 + Rand(0, 65);\n t = Impulse.ar(dt.reciprocal, 0, 100);\n mul = PulseCount.ar(t) < n;\n u = BPF.ar(mul * t, freq, 0.1);\n u = BPF.ar(u, freq, 0.2);\n DetectSilence.ar(u, doneAction:2);\n Out.ar(out, Pan2.ar(u, pan, amp));\n}).add;\n);\n\n(\nSynthDef(\"deepsea\", { arg out, pan=0, amp=0.1, variation=0.9;\n var dt, n, freq, mul, t, u, count;\n n = Rand(7, 46);\n dt = 25.0 + Rand(-1.7, 1.7);\n dt = dt + LFNoise2.kr(2, variation) * 0.001;\n freq = 901 + Rand(0, 65);\n t = Impulse.ar(dt.reciprocal, 0, 100);\n count = PulseCount.ar(t);\n mul = count < n;\n u = BPF.ar(mul * t, freq, 0.1);\n u = BPF.ar(u, freq * (count % LFNoise1.kr(1).range(2, 20) + 1), 0.2);\n DetectSilence.ar(u, doneAction:2);\n Out.ar(out, Pan2.ar(u, pan, amp * 10));\n}).add;\n);\n\n\n\ns.sendMsg(\"/s_new\", \"deepsea\", -1);\n\n\np = ProxySpace.push(s.boot);\n\n~out.play;\n~out.fadeTime = 10;\n\n(\n~fish = Pbind(\n \\instrument, \\deepsea,\n \\dur, Pfunc #{ rrand(9.0, 2.0) },\n \\pan, Pfunc #{ 1.0.rand2 }\n );\n);\n\n~out = ~fish;\n~out[1] = \\filter -> #{ arg in; BPF.ar(in * 5, 700, 0.1) };\n\n(\n~out[2] = \\filter -> #{ arg in;\n CombL.ar(LPF.ar(in * LFNoise1.kr(0.1).max(0), 800), 0.5, 0.5) + in.reverse\n};\n);\n\n(\n~out[3] = \\filter -> #{ arg in; var x; x = in;\n 5.do { x = AllpassN.ar(x, 0.18, {0.06.rand} ! 2 + 0.06, 8) };\n LPF.ar(x + in, 400) + (LFNoise1.kr(0.2) * in)\n };\n\n);\n\n\n\n~out[1] = nil;\n~out[2] = nil;\n\n\np.clear(10).pop;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `MxOutletApp.name` do?"}, {"role": "assistant", "content": "Spec of the outlet as defined in the objects driver file in"}]} -{"conversations": [{"role": "user", "content": "What is `MxInletApp` in SuperCollider?"}, {"role": "assistant", "content": "MxInletApp — scripting object for a units inlet Category: Mx."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n// a pattern with long notes\np = Pbind(\n \\freq, Pwhite(0, log(32)).exp.round(1) * 36.midicps,\n \\detune, Pfunc({ |ev| ev[\\freq] * rand(0.01) }),\n \\sustain, Pwhite(log(0.1), log(20)).exp,\n \\dur, Prand([0.1, 0.1, 0.1, 0.1, 0.2, 1, 2], inf),\n \\db, Pstep(Pseq([-20, -30, -25, -30], inf), 0.2)\n);\n\n// unrelated cluster pattern running on TempoClock.default\nPbind(\\dur, 2, \\midinote, Pseq([(48..60)], 20), \\db, -30).play;\n// …\n```"}, {"role": "assistant", "content": "a pattern with long notes unrelated cluster pattern running on TempoClock.default (PatternConductor: Simple interactive control for playing patterns)"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// you have to write the sample path in the firts line\n\n~bufferdue = Buffer.read(s,\" WRITE YOUR SAMPLE PATH HERE \", bufnum:2);\n\n(\nSynthDef.new(\\bufbeat, {\n arg amp = 1, out = 0, buf, start, end, freq = 1;\n var sig, ptr;\n ptr = LFNoise1.ar(freq).range(0.0,end);\n sig = BufRd.ar(2, buf, ptr);\n sig = sig * amp;\n Out.ar(out, sig);\n}).add\n);\n\nx = Synth.new(\\bufbeat, [\\buf, ~bufferdue.bufnum, \\start,0, \\end, ~bufferdue.numFrames-1, \\freq, 1, \\amp, 0.5],g);\n\nx.free;\n```"}, {"role": "assistant", "content": "a simple BufRd with the starting point of lecture randomized by LFNoise1."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `FoldIndex`."}, {"role": "assistant", "content": "```supercollider\n// indexing into a table\n(\n{\n var buf = LocalBuf.newFrom([200, 300, 400, 500, 600, 800]);\n var freq = FoldIndex.kr(buf, MouseX.kr(0, BufFrames.ir(buf) * 3));\n SinOsc.ar(freq) * 0.1\n}.play;\n);\n\n// the same using a global buffer\n(\nt = [200, 300, 400, 500, 600, 800];\nb = Buffer(s, t.size, 1);\n\n// alloc and set the values\ns.listSendMsg(b.allocMsg(b.setnMsg(0, t)).postln);\n\nSynthDef(\\help_Index, { |out = 0, bufnum = 0|\n Out.ar(out,\n SinOsc.ar(\n FoldIndex.kr(\n bufnum,\n MouseX.kr(0, BufFrames.ir(bufnum) * 3)\n ),\n 0,\n 0.5\n )\n )\n}).play(s, [\\bufnum, b.bufnum]);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for simple smooth arp. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\smooth, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.linen(0.05, sustain, 0.1), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `UnaryOpUGen`."}, {"role": "assistant", "content": "```supercollider\na = WhiteNoise.ar; // a WhiteNoise\nb = a.squared; // a UnaryOpUGen.\nb.operator; // squared\n\n// sound example\n\n{ var a = LFSaw.ar(300).range(0, 2pi); a.sin * 0.1 }.play;\n\n// Plotting the \"abs\" unary operator (via the server):\n\n{ SinOsc.ar(300).abs }.plot\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LFDClipNoise`."}, {"role": "assistant", "content": "```supercollider\n// try wiggling the mouse quickly;\n// LFNoise frequently seems stuck, LFDNoise changes smoothly.\n\n{ LFClipNoise.ar(MouseX.kr(0.1, 1000, 1), 0.1) }.play\n\n{ LFDClipNoise.ar(MouseX.kr(0.1, 1000, 1), 0.1) }.play\n\n// silent for 2 secs before going up in freq\n\n{ LFClipNoise.ar(XLine.kr(0.5, 10000, 3), 0.1) }.scope;\n\n{ LFDClipNoise.ar(XLine.kr(0.5, 10000, 3), 0.1) }.scope;\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFClipNoise.ar(XLine.kr(1000, 20000, 10), 0.1) }.scope;\n\n{ LFDClipNoise.ar(XLine.kr(1000, 20000, 10), 0.1) }.scope;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `MultiSliderView.isFilled` do? What arguments does it take?"}, {"role": "assistant", "content": "If true, the sliders will have their area between the #-reference and the #-value colored, and the area bounded by the lines connecting the reference and the value points will be colored as Arguments: A Boolean.."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `CoinGate`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\na = SynthDef(\"help-TCoin\", { |out = 0, prob = 0.5|\n var trig;\n trig = CoinGate.kr(prob, Impulse.kr(10));\n Out.ar(out,\n SinOsc.ar(\n TRand.kr(300.0, 400.0, trig), 0, 0.2\n )\n )\n}).play;\n);\n\na.set(\\prob, 1.0);\na.set(\\prob, 0.0);\na.set(\\prob, 0.1);\n\n\n(\na = SynthDef(\"help-TCoin\", { |out = 0, prob = 0.5|\n var trig;\n trig = Impulse.ar(20, 0, SinOsc.kr(0.5, 0, 1, 1));\n Out.ar(out,\n Mix.fill(3, { Ringz.ar(CoinGate.ar(prob, trig*0.5), #[1, 1.5]*Rand(1000, 9000), 0.01) })\n )\n}).play;\n);\n\na.set(\\prob, 1.0);\na.set(\\prob, 0.0);\na.set(\\prob, 0.1);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Just a dirty FM bass shuffling. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\nfork{\n SynthDef(\\basicFM, {|out = 0, gate = 1, amp = 1, carFreq = 1000, modFreq = 100, modAmount = 2000, clipAmount = 0.1|\n var modEnv = EnvGen.ar(Env.adsr(0.5, 0.5, 0.7, 0.1, peakLevel: modAmount), gate);\n var mod = SinOsc.ar(modFreq) * modEnv;\n var car = SinOsc.ar(carFreq + mod);\n var ampEnv = EnvGen.ar(Env.adsr(0.1, 0.3, 0.7, 0.2, peakLevel: amp), gate, doneAction: 2);\n var clip = clipAmount * 500;\n Out.ar(out, (car * ampEnv * clip).clip(-0.7, 0.7) * 0.1);\n }).add;\n\n s.sync;\n\n Pbind(*[\n instrument: \\basicFM,\n out: [0, 1],\n dur: Pseq([1/7, 1/3] / 1.2, inf),\n sustain: Pkey(\\dur),\n amp: 1/4,\n carFreq: Pseq([1, 1, 1, 2] * 350, inf),\n modFreq: Pkey(\\carFreq) * (1/8),\n modAmount: Pseq([2, 1, 0.5, 2, 1, 0.5, 2, 1, 2, 1, 0.5, 2, 1, 0.5, 2, 4] * 500, inf),\n clipAmount: Pseq([Pn(0.1, 32), Pn(1, 32)], inf)\n ]).play;\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `LeastChange`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\nd = { |freq = 440|\n var internalFreq;\n internalFreq = LFNoise0.ar(0.3, 300, 800);\n SinOsc.ar(\n LeastChange.kr(freq, internalFreq) // two sources of change: one external, one internal\n ) * 0.1\n}.play\n);\n\nd.set(\\freq, 800);\nd.set(\\freq, 900);\nd.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SequenceableCollection.rand` do?"}, {"role": "assistant", "content": "Fill a SequenceableCollection with random values in the range minVal to maxVal. `Array.rand(8, 1,"}]} +{"conversations": [{"role": "user", "content": "What does `View.parents` do?"}, {"role": "assistant", "content": "The basic visible element of GUI Returns: An array of all the parents, grandparents, etc., of the view."}]} +{"conversations": [{"role": "user", "content": "What does `Process.nowExecutingPath` do?"}, {"role": "assistant", "content": "Usage: `thisProcess.nowExecutingPath` Returns the full path to the file containing the code that is currently executing interactively in the interpreter. Usually this is the current document. If the code block executes another file on disk, using String#-load or String#-loadPaths, `nowExecutingPath` will be the location of the executed"}]} +{"conversations": [{"role": "user", "content": "What does `RedLSystem.reset` do?"}, {"role": "assistant", "content": "Reset generation counter to zero and the production to the"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `SelectXFocus` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a;\n a = [\n Saw.ar(LFSaw.kr(3 * [1, 1.01], 0, 100, 230)),\n SinOsc.ar,\n Pulse.ar(LFPulse.kr(3 * [1, 1.02], 0, 0.4, 100, 230)),\n SinOsc.ar(SinOsc.kr(4 * [1, 1.03], 0, 200, 300))\n ];\n\n SelectXFocus.ar(MouseX.kr(0, 1) * a.size, a, MouseY.kr(0, a.size)) * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `HPZ1`."}, {"role": "assistant", "content": "```supercollider\n// Compare:\n\n{ WhiteNoise.ar(0.25) }.play;\n\n{ HPZ1.ar(WhiteNoise.ar(0.25)) }.play;\n\n// HPZ1 is useful to detect changes in a signal:\n// see also HPZ2\n(\n{\n var changingSignal = LFNoise0.ar(1000);\n var hpz1 = HPZ1.ar(changingSignal);\n [hpz1, hpz1 > 0, hpz1.abs > 0]\n}.plot\n);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `PLinExp.new` do? What arguments does it take?"}, {"role": "assistant", "content": "UGenPatterns quark library Arguments: pattern; srclo; srchi; dstlo; dsthi."}]} +{"conversations": [{"role": "user", "content": "How does multi-channel expansion work?"}, {"role": "assistant", "content": "If any argument of a UGen is an Array, the UGen is built once per element and the results are returned as an Array. So `SinOsc.ar([220, 330, 440])` is three oscillators, and `SinOsc.ar(220 * [1, 1.5])` is two. This is not a special stereo feature: it is uniform expansion, which is why `Splay.ar(SinOsc.ar([220,330,440]) * 0.1)` gives you a spread stereo field from three mono sources."}]} +{"conversations": [{"role": "user", "content": "What is `Symbol`?"}, {"role": "assistant", "content": "Symbol — a unique name for something"}, {"role": "user", "content": "What does `Symbol.isClassName` do?"}, {"role": "assistant", "content": "Answer whether the symbol can be a class name. This does not say if the class exists. `\\Array.isClassName;`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na = { SinOsc.ar(\\freq.kr(440, 1.2)) }.play;\na.set(\\freq, 330);\na.release;\na = { SinOsc.ar(\\freq.kr([440, 460], 1.2)) }.play;\na.setn(\\freq, [330, 367]);\na.release;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PulseDivider`."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\"help-PulseDivider\", { |out = 0|\n var p, a, b;\n p = Impulse.ar(8);\n a = SinOsc.ar(1200, 0, Decay2.ar(p, 0.005, 0.1));\n b = SinOsc.ar(600, 0, Decay2.ar(PulseDivider.ar(p, 4), 0.005, 0.5));\n\n Out.ar(out, (a + b) * 0.4)\n}).play;\n```"}]} {"conversations": [{"role": "user", "content": "What does `SimpleNumber.smallButNotZero` do? What arguments does it take?"}, {"role": "assistant", "content": "Check if the value is closer to zero than a threshold, but not Arguments: thresh — The threshold to use for comparison.."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes nothing much )."}, {"role": "assistant", "content": "```supercollider\n(\n{|atk=0.05,dur=10,freq=50,amp=0.8|\n PMOsc.ar(\n Line.kr(1,2,dur,freq),\n LFNoise2.kr([1,2]).range(1,2)*freq,\n LFNoise2.kr([2,1]).range(0.1,3.5),\n 0,\n Decay2.ar(\n Impulse.ar(XLine.kr(1, 25, dur)) * SinOsc.ar(4/dur,[0,pi/2],0.05,1),\n 0.023, XLine.ar(1,35,dur).reciprocal,\n Line.ar(1,0.8,dur) * LFNoise2.kr(4/dur,0.05,1).dup\n ) * EnvGen.ar(Env([0,1,1,0],[atk,dur-atk,0.3]),1,amp, doneAction:2)\n )\n // * LFPulse.ar(XLine.kr(5,20,dur,freq * LFNoise2.kr([1,2]).range(0.95,1.05)))\n}.play(args:[\n freq:50.rrand(350).debug('freq'),\n dur:10.rrand(20).debug('dur')\n])\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Very quick-and-dirty hack to show stereo phase."}, {"role": "assistant", "content": "```supercollider\n(\nb = Bus.audio(s, 2);\na = { |inbus = 0|\n var sig = In.ar(inbus, 2);\n // x axis is side, oriented toward right;\n // y axis is mid\n [sig[1] - sig[0], sig.sum]\n}.play(s.defaultGroup, outbus: b, addAction: \\addAfter);\nc = s.scope;\nc.style = 2;\nc.bus = b;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\nvar carrier, modulator, depth, scale;\n\ncarrier = 440;\nmodulator = 650;\ndepth = 355.2;\n\n// generate a 5 step scale, picking the 5 most consonant steps from the dissonance curve\nscale = DissonanceCurve.fm(carrier, modulator, depth, 1202).scale(5);\n\nPbind(\n \\instrument, \\fm,\n \\scale, scale,\n \\degree, Pwhite(0, scale.size), // use scale.size as a limit in case the curve generates fewer than 5 steps\n \\carrier, carrier,\n \\modulator, modulator,\n \\depth, depth\n).play;\n)\n```"}, {"role": "assistant", "content": "generate a 5 step scale, picking the 5 most consonant steps from the dissonance curve (DissonanceCurve: Analyzes timbres in order to create tunings)"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PlazyEnvirN`."}, {"role": "assistant", "content": "```supercollider\n(\nf = { |g = 0, h = 0, dur = 1|\n Pbind(\\degree, Pseq([g, g, h, g, h], 2), \\dur, Pseries(dur, 0.1))\n};\n// compare:\na = Pchain(PlazyEnvirN(f), (g: [1, 2], h: 3, dur: 0.2)).trace(\\degree).asStream;\nc = Pchain(Plazy(f), (g: [1, 2], h: 3, dur: 0.2)).asStream;\n);\n\na.nextN(4);\nc.nextN(4); // no degrees, because stream ends\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes random 303."}, {"role": "assistant", "content": "```supercollider\n(\n{ var lk = [0,3,7,9], jx = [3,4,2,4,2], n, ox = 10, qw, cx, oi,z,w, faz, mp,\n cs = [Select,Stepper,RLPF,LFTri,Pulse,PulseDivider,Lag2,Lag,EnvGen,\n Saw, LPF, PitchShift, AllpassN, Env, LocalIn, LocalOut, Impulse ];\n var fa,ffa, ra, eca, era, fsa, xc, fxc, rq, ec, er,xcs, o,e;\n mp = {… |n,alk| alk = alk ? lk; \n {midicps(jx .choose * 12 + lk.choose) } !n }; \n faz = [ mp.(3)* 2.midiratio, mp.( 3 )\n *1. midiratio, mp.( 2,[ 0,3,9 ])*5.midiratio,mp.(1 )*1.midiratio ]; \n fa = faz[[3,0,3,1,2,2,2,2, 1,1,1,1,0,3]].flat; \n n = fa.size; \n qw = Impulse.kr(10); \n cx = PulseDivider.kr(qw, n); \n oi = Stepper.kr(qw,0,0,n-1); \n fsa = { [0,0,0, 0.02,0.08,0.1 ].choose }!div(n,4); \n xcs = Select.kr( Stepper.kr( qw,0,0,fsa.size-1 ), fsa); \n xc = Lag2.kr( Select.kr(oi, fa), xcs ); \n ffa = { rrand( 20, 90 ) } ! n;\n ffa.size.do({ |i| var pn = [2,4,8].choose;\n if ( 0.2.coin, { ffa[i] = Select.kr(Stepper.kr(cx, 0,0,pn-1), { rrand( 4, 70 ) } ! n) }) });\n fxc = Lag2.kr( Select.kr(oi, ffa), 0.04);\n ra = { rrand(0.05,0.5) } ! n;\n rq = Lag.kr( cs[0].kr(oi, ra), 0.04);\n eca = { [-4,0,-1].choose } ! n;\n ec = Select.kr(oi,eca);\n o = Saw.ar(xc) + Pulse.ar(xc * 0.01.midiratio,1-rq) + Pulse.ar(xc *0.04.midiratio,LFTri.ar(ox/n).range(0.1,0.9),0.02) + Pulse.ar(xc *\n 24.midiratio,LFTri.ar(ox/n/4).range(0.8,0.01),0.05);\n era = { rrand(0.8,0.4) } ! 4;\n er = Select.kr(cs[1].kr(qw, 0,0,3), era);\n e = Env.new([0,1,0],[xcs/5,er],ec);\n e = EnvGen.kr(e, gate:qw);\n fxc = fxc * [1.02, 0.98];\n xc = xc * [0.8,1.2].scramble;\n z = cs[2].ar(o, (fxc * e).midiratio * xc, rq) + (cs[2].ar(o.neg, fxc * (50 * e)\n .midiratio, 0.4) *0.05) + (cs[2].ar(o.neg, fxc * (65 * e).midiratio, rq/2) *0.01) * e;\n z = (z + (cs[11].ar(z,0.001,0.5,0.1,0.1).distort * 0.5)).distort;\n w = z+ cs[14].ar (2). distort;\n 10.do({ w = cs[12].ar(w,0.4,{0.03.rand}!2,{0.06.rand}!2) });\n cs[15].ar(cs[10].ar( w*0.9,800 )); (w *0.1 ) + (z * 0.7) }.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Real-time pattern morphing with Ndef."}, {"role": "assistant", "content": "```supercollider\n(\n~name = \"saw\";\n\nSynthDef(~name, { arg out=0, amp=0.1, gate=1, pan=0, spread=0.8, freq=200, doneAction=2, ffreq=300, rq=0.3;\n var sig;\n sig = LFSaw.ar(freq);\n sig = RLPF.ar(sig, ffreq, rq);\n sig = sig * EnvGen.ar(\\adsr.kr(Env.adsr(0.01,0.1,0.8,0.1)),gate,doneAction:doneAction);\n sig = Splay.ar(sig, spread, amp, pan);\n Out.ar(out, sig);\n}).add;\n\n\n~morph = { arg mainkey, lagtime, pat;\n var base = pat.asStream.next(());\n var bind = List.new;\n var proxy;\n base.keysValuesDo { arg key, val;\n var ndefkey = \"%.%\".format(mainkey, key).asSymbol;\n Ndef(ndefkey, { \n Line.kr(Ndef(ndefkey).kr, val, lagtime)\n });\n proxy = Ndef(ndefkey);\n bind.add(key);\n bind.add(proxy.bus.asMap);\n };\n Pbind(*bind)\n};\n);\n\n\nPdef(~name).play;\n\n\n(\n// preset 1\n\n~a = Pdef(~name, ~morph.(\\bla, 2.1, Pbind(\n \\freq, 100,\n \\ffreq, 1300,\n)) <> Pbind(\n \\instrument, ~name,\n \\dur, 1,\n));\n\n);\n\n(\n// preset 2\n\n~a = Pdef(~name, ~morph.(\\bla, 1, Pbind(\n \\freq, 1500,\n \\ffreq, 200,\n)) <> Pbind(\n \\instrument, ~name,\n \\dur, 1,\n));\n\n);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `TaskProxy`."}, {"role": "assistant", "content": "```supercollider\n// create an empty Tdef and play it.\nx = TaskProxy.new;\nx.play;\n\n\nx.source = { loop { \"ggggggggggggggggg9999ggg999ggg999gg\".scramble.postln; 0.5.wait } };\n\n\nx.source = { loop { \"---------////----------------------\".scramble.postln; 0.25.wait } };\nx.source = { loop { thisThread.seconds.postln; 1.wait } };\nx.source = { loop { thisThread.seconds.postln; 1.01.wait } };\n\nTempoClock.default.tempo = 2;\n\nx.source = { \"the end\".postln };\nx.source = { \"one more\".postln };\nx.source = { 10.do { \"ten more\".scramble.postln; 0.25.wait } };\nx.source = { loop { \"many more\".scramble.postln; 0.25.wait } };\n\nTempoClock.default.tempo = 1;\n\nx.stop;\nx.play;\nx.stop;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// derived from an answer by Sergio Luque to a mail to the sc-users SuperCollider mailing list on 2013/03/22\n\n(\nvar registerSize = 16;\nvar min =\"C2\".namemidi.asInteger;\nvar max = \"C6\".namemidi.asInteger;\nvar waitTime = 0.05; // in seconds\n//var chance = 0.1;\nvar chance = Pseq([Pseries(0, 0.1, 10), Pseries(1, -0.1, 10)], inf);\nvar change = 10; // step size\n\n\nPbind(\n \\midinote, Pswitch1(\n { \n Pbrown(min, max, Pif(Prout({ chance.trace.coin.embedInStream }), change, 0))\n } ! registerSize, \n Pseq(Array.iota(registerSize), inf)\n ),\n \\dur, waitTime\n).play\n)\n```"}, {"role": "assistant", "content": "wiard noise ring variation using a ringbuffer instead of bitshifting.\r\nRe-implemented according to Julian Parker's m4l patch.\r\nDerived from an answer by Sergio Luque to a mail to the sc-users SuperCollider mailing list on 2013/03/22."}]} -{"conversations": [{"role": "user", "content": "What does `GridLines.new` do? What arguments does it take?"}, {"role": "assistant", "content": "A factory class for AbstractGridLines Arguments: spec — A ControlSpec that defines the minimum and maximum values, warp and step.. Returns: A subclass of AbstractGridLines, e.g. LinearGridLines or ExponentialGridLines."}]} -{"conversations": [{"role": "user", "content": "What does `ServerLog.filterByBus` do? What arguments does it take?"}, {"role": "assistant", "content": "records OSC traffic to and from a Server and displays this in a browseable searchable interface Arguments: index; rate. Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// It might also be desirable to start with a fade from silence.\n// This can be done with a negative initOutOffset:\n\n(\nx = {\n var lfo = XLine.ar(1, 0.5, 60);\n DXMix.ar(\n Dseq([0, 4, 1, 5, 2, 6, 3, 7], inf),\n `(Saw.ar((1..8) * 70 * lfo, 0.075)),\n fadeTime: 2,\n width: 2,\n initOutOffset: -1\n ) ! 2\n}.play\n);\n\nx.release\n\n\n// overlap scheme with width = 2 and initOutOffset = -1:\n```"}, {"role": "assistant", "content": "It might also be desirable to start with a fade from silence. This can be done with a negative initOutOffset: (DXMix: crossfades between signals according to demand-rate control)"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Prewrite`."}, {"role": "assistant", "content": "```supercollider\n// A generative song\n(\n// Scale degrees going up\nPdef(\\a, Pbind(\\dur, 0.25, \\degree, Pseq((0..3))));\n\n// Scale degrees going down\nPdef(\\b, Pbind(\\dur, 0.25, \\degree, Pseq((3..0))));\n\n// Random scale degrees\nPdef(\\c, Pbind(\\dur, 0.125, \\degree, Pwhite(0, 10, 8)));\n\n// Use the L-system to put together a sequence of keys\n// Psym will then retrieve the patterns from the global Pdef dictionary\n// See the post window for info about which of these are playing\nPsym(\n Prewrite(\\a, // start with pattern \\a\n (\n \\a: #[\\a, \\b],\n \\b: #[\\c, \\a],\n \\c: #[\\a, \\b]\n ), 4).trace\n).play\n);\n\n// Inspect the L-system to see what data it produces\n(\na = Prewrite(0, // start with 0\n (\n 0: #[2, 0],\n 1: #[0, 0, 1],\n 2: #[1, 0, 1]\n), 4);\nx = a.asStream;\n30.do({ x.next.postln });\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Strange offset behaviour when plotting some .kr uGens?"}, {"role": "assistant", "content": "SuperCollider forum — Strange offset behaviour when plotting some .kr uGens\n\nI’ve got a workaround for this now.\n\n```supercollider\ns.quit;\nServer.local.options.blockSize = 4;\ns.boot;\n\n{[\n LFTri.ar(s.sampleRate/2, 1, 2), // just to show where the samples are\n Impulse.ar(0), // audio rate impulse in correct place\n Impulse.kr(0), // control rate impulse with offset issue\n Trig1.kr(1, 0) // control rate impulse in correct place\n]}.plot(70/s.sampleRate);\n\n{[\n LFTri.ar(s.sampleRate/2, 1, 2), // just to show where the samples are\n Phasor.ar(Impulse.ar(0), 1/8, -2, 2, -0.625), // Phasor as it behaves in audio rate\n Phasor.kr(Impulse.kr(0), 1/2, -2, 2, -0.625), // Phasor as it behaves in control rate\n Phasor.kr(Impulse.kr(0), 1/2, -2, 2, -0.5) + (1.5 * Trig1.kr(1, 0)) // Phasor in control rate patched to match audio rate\n]}.plot(70/s.sampleRate)\n```\n\nI assume the problem is that the first control rate sample is meant to be more of a ‘sample -1’ than ‘sample 0’, hence why plot omits it when the output is at control rate. This would be fine if audio rate uGens started after one control period. Since they don’t, I’m happy to just adjust the code to make the subsequent samples correct, and then use ​ + (x * Trig1.kr(1, 0)) to patch the first sample. The only problem now is that it’s more complicated to do that with some other uGens."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar doc;\ndoc = Document(\"\", \"||\");\n\nTask({\n 1000.do({\n 0.08.wait;\n })\n}).play(AppClock);\n\nTask({\n 100.do({\n 1.01.wait\n })\n}).play(AppClock);\n\nTask({\n 100.do({\n 1.01.wait;\n doc.selectedString_([\"\\\"\\n#\", \"||\", \"-\", \"--\"].choose);\n })\n}).play(AppClock);\n\nTask({\n var co, mul;\n co = 0.1;\n mul = 1.02;\n 100.do({\n 0.16.wait;\n co = co * mul;\n if(co > 0.99, { co = 0.1 });\n });\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar doc;\ndoc = Document(\"\", \"||\");\n\nTask({\n 1000.do({\n 0.08.wait;\n })\n}).play(AppClock);\n\nTask({\n 100.do({\n 1.01.wait\n })\n}).play(AppClock);\n\nTask({\n 100.do({\n 1.01.wait;\n doc.selectedString_([\"\\\"\\n#\", \"||\", \"-\", \"--\"].choose);\n })\n}).play(AppClock);\n\nTask({\n var co, mul;\n co = 0.1;\n mul = 1.02;\n 100.do({\n 0.16.wait;\n co = co * mul;\n if(co > 0.99, { co = 0.1 });\n });\n doc.close;\n}).play(AppClock)\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `RedAbstractMix.isReady` do?"}, {"role": "assistant", "content": "`true` after the server is booted and the internal mixer is added and"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Trig`."}, {"role": "assistant", "content": "```supercollider\n{ Trig.ar(Dust.ar(1), 0.2) * FSinOsc.ar(800, 0.5) }.play\n\n{ Trig.ar(Dust.ar(4), 0.1) }.play\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Stream`?"}, {"role": "assistant", "content": "Stream — Stream is the base class for classes that define streams"}, {"role": "user", "content": "What does `Stream.play` do?"}, {"role": "assistant", "content": "Streams that return numbers can be played directly with the play message. Streams that return events need to be wrapped in an EventStreamPlayer. See #-asEventStreamPlayer."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// play at the next beat, with offset 0.4\n(\nRoutine({ loop {\n \"***\".postln; 0.5.wait;\n \"_*_\".postln; 0.1.wait;\n} }).play(quant: [1, 0.4]);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What are the arguments of PlayBuf.ar?"}, {"role": "assistant", "content": "`PlayBuf.ar(numChannels, bufnum, rate, trigger, startPos, loop)`. numChannels must match what is in the buffer, or you get a channel mismatch; bufnum is the Buffer's integer number; rate is playback speed where 1 is normal and negative plays backwards; trigger restarts playback on each trigger in loop mode; startPos is in frames; loop is 0 or 1. `PlayBuf.ar(1, ~buf, BufRateScale.kr(~buf), loop: 1)` is the standard pitch-correct form."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for little study on piano improvisation."}, {"role": "assistant", "content": "```supercollider\n/* Piano Gestures: A Little Study by mimetik\n\n This is a little study on piano improvisation, in particular on \"gestures\", by which I mean here little improvised phrasings.\n\n*/\n\nMIDIClient.init;\n\n/*\nChoose from the list of devices your internal MIDI router, so to send the notes to piano intrument in your favourite DAW\n*/\n\n~mOut = MIDIOut.new(3);\n\n//Set the scale to be Cmajor\n~scale=[0,2,4,5,7,9,11];\n\n//Define pattern proxies which will be modified by the task t below\n\na=PatternProxy(Pxrand([3,3,3,1,3,3],inf));\nb=PatternProxy(Pseq([1/2],inf));\nr=PatternProxy(Pseq([12],inf));\nn=Prand([4,8,16],inf).asStream;\n\nt=Task({\nPdef(\\x,Pbind(\\type,\\midi,\\chan,0,\n \\midiout,~mOut,\n \\scale,~scale,\n \\root,-12,\n \\degree,Pxrand([[0,3,5],[3,5,7],[4,6,8],[5,7,11]],inf),\n \\legato,1,\n \\amp,[{rrand(0.6,0.8)},{rrand(0.5,0.6)},{rrand(0.5,0.6)}]*0.7, \\dur,Prand([Pseq([1,1,1,1],1),Pseq([1,1,2],1),Pseq([1,2,1],1)],inf))).play(quant:1);\n\nPdef(\\y,Pbind(\\type,\\midi,\\chan,0,\n \\midiout,~mOut,\n \\scale,~scale,\n \\root,r,\n \\degree,a,\n \\legato,1,\n \\amp,{rrand(0.5,0.6)},\n\\dur,b)).play(quant:1);\n\n10.wait;\n\nt=Task({\n inf.do({\n if (0.7.coin,{ \n c=[[3,0,7,1,9,11,0,4],[[3,7],0,7,Rest,9,[0,11],0,4]].choose.scramble;\n r.source=Pseq([[12,24].wchoose([0.7,0.3])],inf);\n d=n.next;\n a.source=Pseq([Pxrand(c,d),Pxrand([3,3,3,1,3,3],inf)]);\n b.source=Pseq([Pseq([1/8],d),Pseq([1/2],inf)]);\n });\n rrand(3,4).wait;})}).play(quant:1);\n };\n).play(quant:1);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `U.prepareAndStart` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: target — (describe argument here); loadDef — (describe argument here). Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes SC radial icon XML(SVG) generator Batuhan Bozkurt 2012."}, {"role": "assistant", "content": "```supercollider\n//SC radial icon XML(SVG) generator\n//Batuhan Bozkurt 2012\n\n(\nvar cids, fids;\nvar circDefs, fillDefs, wrapped;\nvar radFor;\nvar canvasSize = 1024, pos = (canvasSize / 2).asInt;\n\n~color = {|shade| \"rgb(%,%,%)\".format(*((shade * 255).round.asInt ! 3)); };\n\n~linGrad = {|id, xy1, xy2, c1, c2| \"\n \n \n \n \".format(id, xy1.x, xy1.y, xy2.x, xy2.y, ~color.(c1), ~color.(c2)); };\n\n~circle = {|id, r, fill, rotate| \"\n \".format(id, r, fill, rotate) };\n\n~wrapAll = {|w, h, defs, x, y, draws| \"\n\n\n SuperCollider Icon SVG - Batuhan Bozkurt 2012%\n %\n \n\".format(w, h, defs, x, y, draws); };\n\ncids = 7.collect({|cnt| \"circ\" ++ cnt; });\nfids = 7.collect({|cnt| \"fcirc\" ++ cnt; });\nradFor = {|cnt| (90 - (13.5 * cnt)) / 100 * canvasSize / 2; };\n\nfillDefs = 7.collect({|cnt| ~linGrad.(fids[cnt], 50@0, 50@100, cnt.linlin(0, 6, 0, 0.3), 1); });\ncircDefs = 7.collect({|cnt| ~circle.(cids[cnt], radFor.(cnt), fids[cnt], (54 * cnt) % 360); });\nwrapped = ~wrapAll.(canvasSize, canvasSize, fillDefs.join, pos, pos, circDefs.join);\nwrapped.postln;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes 8-bit synth (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"AM2\", { arg freq = 440, modfreq = 12, amp = 0.5, attack = 0.01, dur = 1, pos = 0;\n var carrier, modulator, env;\n modulator = LFSaw.kr(modfreq).range(0, 1);\n carrier = LFSaw.ar(freq: freq, mul: modulator);\n env = Env.perc(attackTime: attack, releaseTime: dur - attack, level: amp).kr(2);\n carrier = carrier * env;\n Out.ar(0, Pan2.ar(carrier, pos))\n}).add;\n);\n\n//Example Melody\n\n(\na=Pbind(\n\\instrument, \"AM2\",\n\\degree, Pseq([0,1,2,3,4,5,6,7,6,5,4,3,2,1],inf),\n\\amp, 0.70,\n\\dur, 0.125,\n\\modfreq, 12, // add different values\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Kepler 22-b atmosphere."}, {"role": "assistant", "content": "```supercollider\n(\nfork { \n Ndef(\\ttwnd).play;//(d,2,addAction:\\addToHead);\n loop {\n var seed = thisThread.randSeed = 100000000.rand.debug('seed');\n Ndef(\\ttwnd, {\n var freq = [20, 7500];\n Splay.ar(\n { \n var bands = 2.rrand(10);\n var sig = { [BPF,RLPF,RHPF].choose.ar(\n LFNoise2.ar(freq[0].rrand(freq[1]), LFNoise2.kr(0.1.exprand(10))),\n Array.rand(bands, freq[0], freq[1]),\n Array.rand(bands, 0.2, 1.8)\n ).mean } ! 2;\n Rotate2.ar(sig[0], sig[1], LFSaw.kr(0.1.exprand(10)));\n } ! 4.rrand(6).debug('source'),\n 0.5.rrand(1)\n );\n }).fadeTime_(1.rrand(4.0));\n 10.0.rrand(40).debug('wait(bts)').wait;\n }\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// alternating major and minor chords as a test\n(\n{\n var in, fft, resample;\n var key, transientdetection;\n\n in = Mix(SinOsc.ar((60 + [0, MouseX.kr(3, 4).round(1), 7]).midicps, 0, 0.1));\n\n // major dom 7 and minor 7; major keys preferred here\n // in = Mix(SinOsc.ar((60 + (MouseY.kr(0, 11).round(1.0)) + [0, MouseX.kr(3, 4).round(1), 7, 10]).midicps, 0, 0.1));\n\n fft = FFT(LocalBuf(4096), in); // for sampling rates 44100 and 48000\n\n key = KeyTrack.kr(fft);\n\n key\n// …\n```"}, {"role": "assistant", "content": "alternating major and minor chords as a test major dom 7 and minor 7; major keys preferred here (KeyTrack: Key tracker)"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a, b;\na = Psetpre(\\freq, 801, Pbind(\\dur, 0.5));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a, b;\na = Psetpre(\\freq, 801, Pbind(\\dur, 0.5));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Detuneable fat-saw with a pattern (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\fatsaw,\n {\n arg freq=440, amp=0.3, fat=0.0033, ffreq=2000, atk=0.001, dec=0.3, sus=0.5, rls=0.1,gate=1;\n\n var f1,f2,f3,f4,synth;\n\n f1=freq-(freq*fat);\n f2=freq-(freq*fat/2);\n f3=freq+(freq*fat/2);\n f4=freq+(freq*fat);\n\n synth = LFSaw.ar([f1,f2,f3,f4],[0,0.001,0.002,0.004,0.008]);\n synth = synth * EnvGen.kr(Env([0,1,sus,0],[atk,dec,rls],'lin',2),gate,doneAction:0);\n synth=Splay.ar(synth,0.7);\n synth=RLPF.ar(synth,ffreq*Linen.kr(gate,0.1,0.4,0.2,0),0.4);\n Out.ar([0,1],synth*amp);\n},[0.1,0.3,4,2]).add;\n);\n(\nTempoClock.default = TempoClock.new(2);\nfork{\n\n z = Synth(\\fatsaw,[\\gate,0,\\ffreq,500,\\fat,0.5]);\n\n a=Pseq([0,7,12,5],inf).asStream; // musical degrees\n c = Pseq([40,38,45,47],inf).asStream; // root midi notes\n e = Pseq([0.825,0.375,0.25,0.25],inf).asStream; // note durations\n f = Pseq([1000,1500,2000,2500],inf).asStream; // filter freq value\n\n 0.1.wait;\n z.set(\\gate,1);\n\n //set first root note\n d = c.next;\n\n 8.do{\n\n // move filter freq once every 4 notes\n z.set(\\ffreq, f.next);\n 4.do {\n z.set(\\gate,1);\n z.set(\\freq,(a.next + d).midicps);\n x=[0.451,0.45,0.449].choose;\n x.wait;\n z.set(\\gate,0);\n\n e.next.wait;\n };\n\n d = c.next;\n };\n 2.wait;\n z.free;\n};\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Interpreter`."}, {"role": "assistant", "content": "```supercollider\na = []; // store all the code evaluated in a\nthis.codeDump = { |code| a = a.add(code) };\n1 + 3;\nf = { \"hallo\" };\na.postcs;\ncodeDump = nil; // reset to nil.\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Restricting fm to harmonic sidebands after[Chowning, 1973]?"}, {"role": "assistant", "content": "```supercollider\n(\n// restricting fm to harmonic sidebands after\n// [Chowning, 1973] Chowning, J. (1973). The synthesis of complex spectra by means of frequency modulation. Journal of the Audio Engineering Society, 21(7):526–534.\n// restriction actually happens because of the specs, not server-side.\n\nSpec.add(\\index, [0, 40]);\nSpec.add(\\harm1, [0, 20, \\lin, 1]);\nSpec.add(\\harm2, [0, 20, \\lin, 1]);\nSpec.add(\\fundFreq, \\freq);\n\nNdef(\\fmk, {\n \n PMOsc.ar(\n \\carFreq.kr(100, 0.1), \n (\\harm1.kr(1, 1)/(\\harm2.kr(1, 1)) * LFNoise1.ar(50).range(0.995, 1.001))*\\carFreq.kr(100), \n \\index.kr(1, 0.1) * SinOsc.ar(2.5).range(0.995, 1.005)\n ) \n})\n);\nNdef(\\fmk).gui\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Rational.*` do?"}, {"role": "assistant", "content": "Multiplication `Rational(3,7) * Rational(9,5) // -> 27 %/"}]} -{"conversations": [{"role": "user", "content": "Explain `HilbertPDNRe` in SuperCollider briefly."}, {"role": "assistant", "content": "HilbertPDNRe — Applies the Real part of the Hilbert Transform to an input signal. [1] Offers the Hilbert Transform of an input signal via Weaver's Second Method,footWeaver, Donald. “A Third Method of Generation and Detection of Single-Sideband Signals.” Proceedings of the IRE, vol. 44, no. 12, 1956, pp. 1703–1705. known as Hartley Phasing,footUS Patent 1,666,206, Modulation System, April 17, 1928, United States Patent and Trademark Office. expressed as a 12th-order Phase Differenci Category: Libraries > Hilbert > Pseudo-UGens, UGens > Filters > Nonlinear."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Both of these do the same thing.\nPbind(a: Pseq([1, 2, 3]), dur: 1).trace.play\nPbind(\\a, Pseq([1, 2, 3]), \\dur, 1).trace.play\n\n\n(\n// a SynthDef\nSynthDef(\\test, {\n |out, freq = 440, amp = 0.1, nharms = 10, pan = 0, gate = 1|\n var audio = Blip.ar(freq, nharms, amp);\n var env = Linen.kr(gate, doneAction: Done.freeSelf);\n OffsetOut.ar(out, Pan2.ar(audio, pan, env));\n}).add;\n);\n\n// Assignment to multiple keys using an Array.\n// Must come\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Both of these do the same thing.\nPbind(a: Pseq([1, 2, 3]), dur: 1).trace.play\nPbind(\\a, Pseq([1, 2, 3]), \\dur, 1).trace.play\n\n\n(\n// a SynthDef\nSynthDef(\\test, {\n |out, freq = 440, amp = 0.1, nharms = 10, pan = 0, gate = 1|\n var audio = Blip.ar(freq, nharms, amp);\n var env = Linen.kr(gate, doneAction: Done.freeSelf);\n OffsetOut.ar(out, Pan2.ar(audio, pan, env));\n}).add;\n);\n\n// Assignment to multiple keys using an Array.\n// Must come before any keyword arguments.\nPbind(\n [\\freq, \\sustain], Ptuple([\n Pseq((1..16) * 50, 4),\n Pseq([1/10, 0.5, 1, 2], inf)\n ]),\n instrument: \\test,\n nharms: Pseq([4, 10, 40], inf),\n dur: Pseq([1, 1, 2, 1]/10, inf),\n).play\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for cosmic organ with a inspiration of rukano tweet."}, {"role": "assistant", "content": "```supercollider\n// 2012.05.04\n// Work for NX014 Class\n// Inspiration: A Rukano Tweet. Thanks rukano!\n// Comment: Cosmic Organ.\n\np = ProxySpace.push(s.boot);\n\n~a.play;\n\n~a = { var alpha,gamma;\n alpha= LFNoise2;\n gamma= {[rrand(30,50),rrand(50,70),rrand(50,70),rrand(70,100)].choose.midicps*alpha.kr(1,0.01,1)}!24;\n Pan2.ar(LeakDC.ar(Normalizer.ar(\n BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(FreeVerb.ar(\n Splay.ar(RLPF.ar(LFSaw.ar(gamma)/4,gamma*LFCub.kr(rrand(0.01,0.1),0,2,3),alpha.kr(1/8,0.6,0.7))) \n ,0.1,0.1,0.1)\n ,100,6.0,6),1000,6.0,0),5000,6.0,0),10000,6.0,6)\n ,(0.8/0.999)*1,0.1)),0)\n};\n\n~a = nil;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nPclutch(Pseq([1, 2, 3, 4, 5], 3), Pseq([0, 0, 1, 0, 0, 0, 1, 1])).asStream.nextN(10);\n\n// sound example\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\nvar a;\na = Pclutch(\n Pseq([1, 2, 3, 4, 5], inf),\n Pseq([0, 0, 1, 0, Pn(0, { 30.rand }), 0\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nPclutch(Pseq([1, 2, 3, 4, 5], 3), Pseq([0, 0, 1, 0, 0, 0, 1, 1])).asStream.nextN(10);\n\n// sound example\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\nvar a;\na = Pclutch(\n Pseq([1, 2, 3, 4, 5], inf),\n Pseq([0, 0, 1, 0, Pn(0, { 30.rand }), 0, 1, 1], inf)\n ).asStream;\n{\n loop {\n Synth(\\help_sinegrain, [\\freq, a.next * 200 + 200]);\n 0.02.wait;\n }\n}.fork;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ LPF.ar(Saw.ar(100), SinOsc.kr(0.5).exprange(200, 2000)) * 0.2 }.play;\n```"}, {"role": "assistant", "content": "A sawtooth through a low-pass filter whose cutoff is swept slowly up and down — a classic filter\nsweep.\n\n- `Saw.ar(100)` is a 100 Hz sawtooth, rich in harmonics.\n- `SinOsc.kr(0.5)` is a control-rate sine at 0.5 Hz, so one full cycle takes 2 seconds.\n- `.exprange(200, 2000)` maps that -1..1 sine exponentially onto 200..2000 Hz — exponential is the right\n mapping for frequency, because we hear pitch logarithmically.\n- `LPF.ar(sig, cutoff)` removes harmonics above the cutoff; as it opens and closes you hear the tone\n brighten and darken.\n- `* 0.2` keeps the output from clipping."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n{Mix({|i|var j=Impulse,t=TChoose.kr(j.kr(1/8),[1,6,3]/8),r=Ringz.ar(j.ar(i*t+0.25),600*t*i+[0,9]);CombC.ar(r,1,0.5,4,0.1,r)}!4).tanh/4}.play\n```"}, {"role": "assistant", "content": "Hi colliders, this is my first post here, and also my very first sc tweet! \r\nIt's nothing special, just a little rhythmic Ringz thingy...\r\nAs a beginner, I found this really useful getting the hang of some syntax shortcuts:\r\nhttp://schemawound.com/post/25710867587/supercollider-tweets-background-tips."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LFClipNoise`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-LFClipNoise\", { |out = 0|\n Out.ar(out,\n LFClipNoise.ar(1000, 0.25)\n )\n}).play;\n);\n\n// modulate frequency\n(\nSynthDef(\"help-LFClipNoise\", { |out = 0|\n Out.ar(out,\n LFClipNoise.ar(XLine.kr(1000, 10000, 10), 0.25)\n )\n}).play;\n);\n\n// use as frequency control\n(\nSynthDef(\"help-LFClipNoise\", { |out = 0|\n Out.ar(out,\n SinOsc.ar(\n LFClipNoise.ar(4, 200, 600),\n 0, 0.2\n )\n )\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// ===========================\n// extra demos for pluck\n// ===========================\n\n\n(\n// Made by Meha Gupta\n// Inspired by Happy by Julia Michaels\nPbindef(\\dmpluck,\n \\instrument, \"pluck\",\n \\midinote, Pseq([\n Pseq([\n [57, 69, 73, 76],\n [57, 69, 73, 76],\n [57, 71, 73, 80],\n [52, 78, 76, 80],\n [52, 78, 76, 80],\n [59, 71, 75],\n [59, 71, 75]], 2),\n 64]),\n \\amp, Pseq([0.2, 0.1, 0.2, 0.2, 0.1, 0.1, 0.1], inf) * 0.5,\n \\dur, Pseq([Pn(Pseq([0.25, 0.75, 1, 0.5, 0.5, 0.5, 0.5]), 2), 1]),\n \\decay, Pseq([1, 3, 3, 2, 2, 3, 3, 1, 3, 3, 2, 2, 3, 3, 4]),\n).play;\n)\n```"}, {"role": "assistant", "content": "=========================== extra demos for pluck ===========================."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for strange device found in space )\r\n\r\np.s?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n Limiter.ar(HPF.ar(\n GVerb.ar(\n Pan2.ar(\n PMOsc.ar(\n Demand.kr(\n Impulse.kr(\n SinOsc.kr(SinOsc.kr(1/30).range(1/10, 1/15)).range(0, 25)\n * LFPulse.kr(0.2).range(0.5, 1)\n + \n LFDNoise3.kr(1/10, 10, 10)\n ), \n 0, \n Dxrand(Array.geom(100, 50, 1.06), inf) + Dgeom(1, 1.005)\n ),\n [[3,5],[7,11]] + SinOsc.ar([1/60, 1/45]).range(0, 1300),\n Demand.kr(\n Impulse.kr(SinOsc.kr(0.1).range(0.1, 20)),\n 0,\n Dxrand(Array.series(13, 0, 0.5), inf)\n )\n ).sum,\n SinOsc.ar(1, mul:0.5),\n LFPar.ar([1/5,1/3]).range(0.3, 1)\n ), \n 250, \n 0.5, \n damping:SinOsc.kr(1/20).range(0.2,0.7), \n drylevel: SinOsc.kr(1/15).range(0.2,0.7), \n earlyreflevel:0.3\n ) * 0.1\n +\n LFDNoise3.ar(SinOsc.kr(1/15, [0, pi/4]).range(100,350), 0.3),\n [SinOsc.ar(1/45, [0,pi/2]).range(20, 120)]\n ))\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Seekers are something you should avoid?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n var time = 0.23;\n var freq = (55).midicps;\n var a = VarSaw.ar(freq/2, width: XLine.ar(0.5,1,time)).range(0,XLine.ar(0.666,1/666,time));\n var tone = SinOsc.ar(freq).fold(-0.23*a,a) * EnvGen.ar(Env([1,0],[time]));\n Out.ar(0, tone.dup);\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//spinning hypercube / tesseract\n//after Shiffman https://codingtrain.github.io/website-archive/CodingChallenges/113-hypercube.html\n\n\n(\nvar width= 640, height= 480, w,\ntheta= 0, speed= 0.005, hypercube;\n\nw= RedWindow(\"3Dhypercube\", Rect(128, 64, width, height)).front;\nhypercube= Red4DTesseract();\n\n//--loop\nw.draw{\n theta= theta+speed;\n hypercube.rotation= RedVector[theta, 0, 0, 0, 0, theta];\n hypercube.update;\n\n //--render\n hypercube.render(2, 500); //1= exaggerate, 2= standard\n Pen.translate(width*0.5, height*0.5);\n Pen.fillColor= Color.white;\n hypercube.draw;\n Pen.strokeColor= Color.white;\n hypercube.drawOutlines;\n};\nw.play;\nCmdPeriod.doOnce({w.close});\n)\n```"}, {"role": "assistant", "content": "spinning hypercube / tesseract after Shiffman https://codingtrain.github.io/website-archive/CodingChallenges/113-hypercube.html."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Dswitch1`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a, freq, trig;\n a = Dswitch1([1, 3, MouseY.kr(1, 15), 2, Dwhite(0, 3, 2)], MouseX.kr(0, 4));\n trig = Impulse.kr(3);\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n);\n\n(\n{\n var a, freq, trig;\n a = Dswitch1({ |i| Dseq((0..i*3), inf) } ! 5, MouseX.kr(0, 4));\n trig = Impulse.kr(6);\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Sweep`."}, {"role": "assistant", "content": "```supercollider\n// using sweep to modulate sine frequency\n(\n{ var trig;\n trig = Impulse.kr(MouseX.kr(0.5, 20, 1));\n SinOsc.ar(Sweep.kr(trig, 700) + 500, 0, 0.2)\n}.play;\n);\n\n\n// using sweep to index into a buffer\nb = Buffer.read(s, ExampleFiles.child);\n\n(\n{ var trig;\n trig = Impulse.kr(MouseX.kr(0.5, 10, 1));\n BufRd.ar(1, b, Sweep.ar(trig, BufSampleRate.ir(0)))\n}.play;\n);\n\n// backwards, variable offset\n(\n{ var trig, pos, rate;\n trig = Impulse.kr(MouseX.kr(0.5, 10, 1));\n rate = BufSampleRate.ir(0);\n pos = Sweep.ar(trig, rate.neg) + (BufFrames.ir(0) * LFNoise0.kr(0.2));\n BufRd.ar(1, b, pos)\n}.play;\n);\n\n// raising rate\n(\n{ var trig, rate;\n trig = Impulse.kr(MouseX.kr(0.5, 10, 1));\n rate = Sweep.kr(trig, 2) + 0.5;\n BufRd.ar(1, b, Sweep.ar(trig, BufSampleRate.ir(0) * rate))\n}.play;\n);\n\nb.free\n```"}]} -{"conversations": [{"role": "user", "content": "What does `CountLimit.value` do?"}, {"role": "assistant", "content": "Counts how many items have been presented to it. returns true until limit false thereafter"}]} -{"conversations": [{"role": "user", "content": "What is `Fb1_HopfAFDC` in SuperCollider?"}, {"role": "assistant", "content": "Fb1_HopfAFDC — Adaptive Hopf pseudo ugen with fast dynamical coupling This is an adaptive variant of Hopf, which enhances the adaption mechanism of #[1], see #[2] (4.1.) for a description. The parameter naming follows the convention of #[2]. Category: Libraries > miSCellaneous > Nonlinear."}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ Pan2.ar(SinOsc.ar(440) * 0.2, SinOsc.kr(0.1)) }.play;\n```"}, {"role": "assistant", "content": "A sine that slowly moves between the speakers.\n\n`SinOsc.kr(0.1)` is a control-rate sine at 0.1 Hz — one cycle every 10 seconds — running between -1 and 1.\n`Pan2.ar(sig, pos)` treats that as the pan position, where -1 is hard left, 0 centre, 1 hard right, so the\nsound drifts across the stereo field. Pan2 is equal-power, so the centre is -3 dB per channel rather than\nhalf amplitude on each. The `* 0.2` sets the level before panning."}]} -{"conversations": [{"role": "user", "content": "What does `Object.alwaysYield` do?"}, {"role": "assistant", "content": "Must be called from inside a Routine. Yields control to the calling thread. The receiver is the result passed to the calling thread's method. The Routine, when called subsequently will always yield the receiver until it is reset. alwaysYield never returns within the"}]} -{"conversations": [{"role": "user", "content": "What does `Index.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Index into a table with a signal Arguments: bufnum — Index of the buffer.; in — The input signal.; mul — Output will be multiplied by this value.; add — This value will be added to the output.."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Blowing ambient with lots of reverb."}, {"role": "assistant", "content": "```supercollider\nfork{\n // notes sequence\n var seq = Pxrand([0,3,5,7,8],inf).asStream;\n loop{\n var dur = 8;\n var num = 8;\n var root = 36;\n var freq = (seq.next+root).midicps;\n var spread = rrand(0.4,0.8);\n var attack = rrand(0.05, 0.3);\n \n // play the cluster\n play{\n var harm = Array.geom(num, 1, 1.5);\n var harma = Array.geom(num, 0.5, 0.8);\n var detune = Array.fill(num, { LFNoise2.kr(1,0.01,1) });\n var source = PinkNoise.ar;\n var bandwidth = Rand(0.001,0.01);\n var generator = [\n SinOsc.ar(freq*harm*detune, mul:harma*0.3).scramble,\n Resonz.ar(source, freq*harm*detune, bandwidth, mul:harma).scramble * 50\n ].wchoose([0.2,0.8]);\n var snd = Splay.ar(generator,spread);\n snd * LFGauss.ar(dur, attack, loop:0, doneAction:2);\n };\n dur.wait;\n };\n \n};\n\n// global triple super gverb\n{\n var in = In.ar(0,2);\n in = (in*0.2) + GVerb.ar(in, 220, 12, mul:0.6);\n in = (in*0.2) + GVerb.ar(in, 220, 12, mul:0.6);\n in = (in*0.2) + GVerb.ar(in, 220, 12, mul:0.6);\n ReplaceOut.ar(0, Limiter.ar(LeakDC.ar(in)))\n}.play(addAction:\\addToTail)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// splay 10 chans of sound into 2\n(\nx = { |spread = 1, level = 0.2, center = 0.0|\n var numchans = 10;\n Splay.ar(\n SinOsc.ar({ |i| LFNoise2.kr(1).exprange(200, 4000) } ! numchans),\n spread,\n level,\n center\n // use levelComp default true\n );\n}.play;\n);\n\ns.meter;\ns.scope;\n\n// change settings dynamically:\n\nx.set(\\spread, 1, \\center, 0); // full stereo\nx.set(\\spread, 0.5, \\center, 0); // less wide\nx.set(\\spread, 0, \\center, 0); // mono center\nx.set(\\spread, 0.5, \\center,\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// splay 10 chans of sound into 2\n(\nx = { |spread = 1, level = 0.2, center = 0.0|\n var numchans = 10;\n Splay.ar(\n SinOsc.ar({ |i| LFNoise2.kr(1).exprange(200, 4000) } ! numchans),\n spread,\n level,\n center\n // use levelComp default true\n );\n}.play;\n);\n\ns.meter;\ns.scope;\n\n// change settings dynamically:\n\nx.set(\\spread, 1, \\center, 0); // full stereo\nx.set(\\spread, 0.5, \\center, 0); // less wide\nx.set(\\spread, 0, \\center, 0); // mono center\nx.set(\\spread, 0.5, \\center, 0.5); // spread from center to right\nx.set(\\spread, 0, \\center, -1); // all left\nx.set(\\spread, 1, \\center, 0); // full stereo\n\n// A similar example written with arFill:\n(\nx = { |spread = 1, level = 0.2, center = 0.0|\n var numchans = 10;\n Splay.arFill(numchans,\n { |i| SinOsc.ar(LFNoise2.kr(rrand(10, 20), 200, i + 3 * 100)) },\n spread,\n level,\n center\n );\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LFSaw`."}, {"role": "assistant", "content": "```supercollider\n{ LFSaw.ar(500, 1, 0.1) }.play\n\n// used as both Oscillator and LFO:\n{ LFSaw.ar(LFSaw.kr(4, 0, 200, 400), 0, 0.1) }.play\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n var time = 30;\n var line = Line.kr(3000, 290, time);\n var line2 = Line.kr(280, 290, time);\n var line3 = Line.kr(0.01, 10, time);\n var sin = Mix.ar(SinOsc.ar([line, line2]) * SinOsc.ar(line3));\n var comb = CombC.ar(sin, time, SinOsc.kr(0.1).range(0.1, 0.2), time);\n var env = EnvGen.ar(Env.linen(0.01, time, 10), 1, doneAction:2);\n comb * env * 0.05!2;\n}.play\n)\n```"}, {"role": "assistant", "content": "Here is some quick code that sounds like an old sci-fi UFO landing."}]} -{"conversations": [{"role": "user", "content": "What is the correct way to stop everything?"}, {"role": "assistant", "content": "Depends on what is playing, and they are different layers:\n\n- `s.freeAll` — frees every node on the server (all sound stops, definitions survive).\n- `CmdPeriod.run` — stops everything scheduled on the clocks (Patterns, Routines, Tasks).\n- `Ndef.clear; Pdef.clear` — clears the JITLib proxies.\n- `s.quit` — shuts the server down entirely.\n\nIn a session the habit is `CmdPeriod.run` first (stops the sequencing), then `s.freeAll` if a drone is still\nsounding."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{Decimator.ar(SinOsc.ar([400, 404], 0, 0.2), MouseX.kr(0, 44100), MouseY.kr(0, 31))}.play\n\n{Decimator.ar(SoundIn.ar, MouseX.kr(0, 44100), MouseY.kr(0, 31)}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{Decimator.ar(SinOsc.ar([400, 404], 0, 0.2), MouseX.kr(0, 44100), MouseY.kr(0, 31))}.play\n\n{Decimator.ar(SoundIn.ar, MouseX.kr(0, 44100), MouseY.kr(0, 31))}.play\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Pattern transcription of intro chords of this song."}, {"role": "assistant", "content": "```supercollider\n// Crystal Waters \"Gypsy Woman (She's Homeless)\" - chords\n(\n~bpm = TempoClock.new(120/60);\nPbind(\n \\midinote, Pseq([\n Pn([45, 57, 67, 72, 76], 2),\n Pn([46, 58, 69, 74, 77], 3),\n Pn([43, 55, 67, 70, 74, 77], 2), \n Pn([48, 60, 67, 70, 73, 76], 3),\n Pseq([\n Pn([50, 62, 65, 69, 72, 76], 2),\n Pn([50, 62, 65, 69, 72, 74], 3)\n ], 2),\n Pn([45, 57, 67, 72, 76], 2),\n Pn([46, 58, 69, 74, 77], 3),\n Pn([52, 64, 76, 79, 83, 86], 2),\n Pn([51, 63, 75, 79, 82, 86], 3),\n Pseq([\n Pn([50, 62, 65, 69, 72, 76], 2),\n Pn([50, 62, 65, 69, 72, 74], 3)\n ], 2),\n ], inf),\n \\ctranspose, -12,\n \\dur, Pseq([1, Pn(3/4, 4)], inf),\n \\amp, 0.2,\n \\legato, Pseq([0.5, 0.5, Pwhite(0.2, 0.3, 3)], inf)\n).play(~bpm);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// same as above, but we use a NetAddr with a port of nil, so we can receive from a specific host, but from any port\n\nn = NetAddr(\"127.0.0.1\", nil); // the url should be the one of computer of app 2\no = OSCresponderNode(n, '/test', { |t, r, msg| msg.postln }).add;\no.remove;\n```"}, {"role": "assistant", "content": "same as above, but we use a NetAddr with a port of nil, so we can receive from a specific host, but from any port (OSCresponderNode: client side network responder)"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// where did I leave my keys?\n(\nvar n = 30, m = 5;\nNdef.clear(3);\nNdef.ar(\\x, n);\nNdef(\\y, { Splay.ar(Ndef.ar(\\x, m, LFNoise1.kr(1/m).range(0, n - m - 1))).clip2 * 0.5 }).play; \nNdef(\\x, { \n { \n var a = Ndef.ar(\\x, 1, LFNoise0.kr(Rand()) * Rand() + Rand() * n);\n a + 0.1 * SinOsc.ar(ExpRand(0.2, 1000)) \n } ! n\n}); \n);\n\n// where did I put my keys?\n(\nvar n = 30, m = 5;\nNdef.clear(3);\nNdef.ar(\\x, n);\nNdef(\\y, { Splay.ar(Ndef.ar(\\x, m, LFNoise1.kr(1/m).range(0, n - m - 1))).clip2 * 0.5 }).play; \nNdef(\\x, { \n {\n var a = Ndef.ar(\\x, 1, LFNoise0.kr(Rand()) * Rand() + Rand() * n);\n SinOsc.ar(ExpRand(0.2, 1000), a) \n } ! n\n}); \n)\n```"}, {"role": "assistant", "content": "Cross-tuning between multiple signal dimensions. The code is finished without listening."}]} -{"conversations": [{"role": "user", "content": "What does `View.remove` do?"}, {"role": "assistant", "content": "Removes the view from its parent view (if any) and destroys the view. After this method is called, the view is not usable"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// won't work (the output is 0.5*0.0), which is why we need the DC UGen!\n{ 0.5 }.play\n\n// constantly zero\n{ DC.ar(0.0) }.play;\n\n\n// DC offset; will click on start and finish\n{ DC.ar(0.5) + SinOsc.ar(440, 0, 0.1) }.play;\n\n\n// test - note the transient before LeakDC adapts and suppresses the offset\n{ LeakDC.ar(DC.ar(0.5)) }.play;\n\n\n// show scope\ns.scope\n```"}, {"role": "assistant", "content": "won't work (the output is 0.5*0.0), which is why we need the DC UGen! DC offset; will click on start and finish (DC: Create a constant amplitude signal)"}]} -{"conversations": [{"role": "user", "content": "Explain `LinkedListNode` in SuperCollider briefly."}, {"role": "assistant", "content": "LinkedListNode — Internally used class for LinkedList nodes LinkedListNode is used to implement the internal nodes of the LinkedList class. You should not need to deal with a LinkedListNode directly. Category: Collections."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n(\n~loDev = -6;\n~hiDev = 5;\n~lookBack = 2;\n\np = Pbind(\n \\dur, 0.2,\n \\midinote, PLIdev(72, 11, \\loDev, \\hiDev, \\lookBack).trace(prefix: \"midi \"),\n).play;\n);\n\n\n// change on the fly\n// as lookBack equals 2, this defines a fixed sequence (up or down anyway)\n\n(\n~loDev = -1;\n~hiDev = 1;\n);\n\n\n// widen range\n\n(\n~loDev = -6;\n~hiDev = 5;\n);\n\n\n// force a twelve-tone row\n\n~lookBack = 11;\n\n\n// contradictory input, lookBack 11 not possible within range, causes\n// …\n```"}, {"role": "assistant", "content": "as lookBack equals 2, this defines a fixed sequence (up or down anyway) force a twelve-tone row (PLIdev: dynamic scope pattern searching for numbers with integer distance from a source pattern, optionally avoiding repetitions within a span)"}]} -{"conversations": [{"role": "user", "content": "Explain `SpectralEntropy` in SuperCollider briefly."}, {"role": "assistant", "content": "SpectralEntropy — Spectral feature extraction Spectral Entropy, with a choice of number of sub-bands. If one band, a measure of general peakiness of the spectral distribution. Category: UGens > Analysis."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for cosmic organ with a inspiration of rukano tweet."}, {"role": "assistant", "content": "```supercollider\n// 2012.05.04\n// Work for NX014 Class\n// Inspiration: A Rukano Tweet. Thanks rukano!\n// Comment: Cosmic Organ.\n\np = ProxySpace.push(s.boot);\n\n~a.play;\n\n~a = { var alpha,gamma;\n alpha= LFNoise2;\n gamma= {[rrand(30,50),rrand(50,70),rrand(50,70),rrand(70,100)].choose.midicps*alpha.kr(1,0.01,1)}!24;\n Pan2.ar(LeakDC.ar(Normalizer.ar(\n BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(FreeVerb.ar(\n Splay.ar(RLPF.ar(LFSaw.ar(gamma)/4,gamma*LFCub.kr(rrand(0.01,0.1),0,2,3),alpha.kr(1/8,0.6,0.7))) \n ,0.1,0.1,0.1)\n ,100,6.0,6),1000,6.0,0),5000,6.0,0),10000,6.0,6)\n ,(0.8/0.999)*1,0.1)),0)\n};\n\n~a = nil;\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Benoit XVI (a SuperCollider snippet)?"}, {"role": "assistant", "content": "```supercollider\n// a supercollider port of Coloscope's Pure-data organ. \n\nSynthDef(\\benoit, {\n arg out=0, amp=0.5, freq=440, semione=12, semitwo=24, trackingmul=2, gate=1, sus=1, rel=1;\n var env, sig, sig1, sig2, sig3, ringmod, tracking, sig4;\n\n sig1 = Pulse.ar(freq, 0.17);\n sig2 = Pulse.ar((freq.cpsmidi - semione).midicps, 0.17);\n sig3 = Pulse.ar((freq.cpsmidi + semitwo).midicps, 0.17);\n\n sig4 = LFTri.ar((freq.cpsmidi - semitwo).midicps);\n\n env = EnvGen.ar(Env.linen(0,sus,rel), gate, doneAction:2);\n\n tracking = ((freq * 1) + freq) * trackingmul;\n sig = sig1 + sig2 + sig3 + (sig4 * 2);\n\n\n sig = RLPF.ar(sig, tracking, 1, 0.33);\n sig = FreeVerb.ar(sig, 0.12);\n sig = sig.tanh;\n sig = sig * env;\n\n\n Out.ar(out, (sig * amp));\n\n}).add;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `MxUnit.init` do?"}, {"role": "assistant", "content": "Container for a musical object (Instr, NDef, Spline etc); this is a single unit that has inlets and outlets which can be connected to other units"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `VarGui`."}, {"role": "assistant", "content": "```supercollider\n// synth definition with raising frequency\n\n(\nSynthDef(\\synth_0, { |devFactor = 0.1, devFreq = 10, amp = 0.1|\n var freq = XLine.kr(400, 1200, 10); \n Out.ar(0, SinOsc.ar(SinOsc.ar(devFreq, 0, devFactor * freq, freq), mul: amp).dup(2) * EnvGate.new) \n}).add;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Scale`."}, {"role": "assistant", "content": "```supercollider\n(\nr = {\n var scale = Scale.choose.postln;\n SinOsc.ar(\n (\n DegreeToKey.kr(\n scale.as(LocalBuf),\n MouseX.kr(0, 15), // mouse indexes into scale\n scale.stepsPerOctave,\n 1, // mul = 1\n 60 // offset by 72 notes\n )\n + LFNoise1.kr([3, 3], 0.04) // add some low freq stereo detuning\n ).midicps, // convert midi notes to hertz\n 0,\n 0.25\n )\n}.play;\n);\n\nr.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Fb1_ODEintdef.reset` do?"}, {"role": "assistant", "content": "Removes all Fb1_ODEintdefs other than the predefined ones from the"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for some initial thoughts on psytrance bassline. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\n{ | dur = 0.15, atk = 0.005, amp = 1 |\n SinOsc.ar(\n EnvGen.ar( Env(\n NamedControl.kr(\\freq_l, [2960, 70, 90]),\n NamedControl.kr(\\freq_d, [0.07, 0.2]),\n NamedControl.kr(\\freq_c, [-13, -1]),\n ) ),\n mul:amp * EnvGen.ar(\n Env.perc( atk, dur - atk, curve: NamedControl.kr(\\amp_c, [-1, 6])),\n doneAction: 2\n ); \n ) ! 2;\n}.asSynthDef.name_(\"kick\").add;\n\n{ | atk = 0.01, dur = 0.15, freq = 50, amp=0.8 |\n BPF.ar(LFSaw.ar(freq), freq, 2, mul: EnvGen.kr( Env.perc( atk, dur-atk, amp, 6 ), doneAction: 2 )) ! 2;\n}.asSynthDef.name_(\"bass\").add;\n\n{ | dur = 0.15, freq = 50, amp = 0.8, index = 10 |\n PMOsc.ar(freq, freq + 5, index, mul: amp * EnvGen.kr( Env.triangle( dur ), doneAction: 2 )) ! 2;\n}.asSynthDef.name_(\"bazz\").add;\n);\n\n\n(\nPpar([\n Pbind(*[\n instrument: \\kick,\n delta: 1,\n dur: Pfunc({ thisThread.clock.beatDur }) / 4,\n amp: Pseq([\n Pseq([1], 16),\n Pseq([0.8, 1], 8), \n Pseq([1], 16),\n Pseq([0.8, 0.8, 0.9, 1], 8)\n ], inf) * 0.8,\n freq_l: Pstutter(Prand(2.pow((1..4)),inf), Pseq([\n `[2960,70,90],\n `[1260,60,110],\n `[4360,60,120]\n ],inf))\n ]),\n Pbind(*[\n instrument: \\bass,\n delta: 1/4,\n dur: Pkey(\\delta) * Pfunc({ thisThread.clock.beatDur }),\n freq: Pseq([\\r, 50,60,70], inf),\n amp:0.6\n ]),\n Pbind(*[\n instrument: \\bazz,\n delta: 1/4,\n dur: Pkey(\\delta) * Pfunc({ thisThread.clock.beatDur }),\n freq: Pseq([\\r, 30,35,40], inf),\n amp:0.2\n ])\n]).play(TempoClock(156/60), quant:[1])\n);\n\n// kick from above?\n(\nPbind(*[\n instrument: \\kick,\n delta: Pseq(Array.geom(540, 1, 1.015).reciprocal.reverse),\n dur: Pkey(\\delta) * Pfunc({ thisThread.clock.beatDur }),\n atk: Pkey(\\dur) / 6,\n amp: 0.8\n]).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `PLswitch` in SuperCollider briefly."}, {"role": "assistant", "content": "PLswitch — dynamic scope Pswitch variant Takes Symbol args for later reference by the Streams, which will read from variables in the Environments of their instantiation. See PLx_suite. Category: Libraries > miSCellaneous > PLx suite, Streams-Patterns-Events > PLx suite."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n pitches.size.do{ |i|\n {\n var freq = pitches[i].midicps;\n var env = Env.perc.ar(Done.freeSelf);\n SinOsc.ar(freq) * 0.1 * env\n }.play;\n 0.2.wait\n }\n}\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n pitches.size.do{ |i|\n {\n var freq = pitches[i].midicps;\n var env = Env.perc.ar(Done.freeSelf);\n SinOsc.ar(freq) * 0.1 * env\n }.play;\n 0.2.wait\n }\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for some pattern exprimenting: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\brumm, { |dur = 1, pan = 2, freq = 40, index = 20|\n var sig = Pan2.ar(\n Blip.ar(freq, index),\n pan\n ) * EnvGen.ar(Env.perc(0.01, dur), doneAction: 2);\n Out.ar(0, sig);\n}).add;\n);\n\n(\nPbind(*[\n dur: Pseq([1.2, 0.2, 0.5, Pseries(0.1, -0.001, 100)], inf),\n pan: Pxrand(#[-0.5, 0.5, 0.1, -0.1, 0.8, -1], inf),\n freq: 40,\n instrument: \\brumm\n]).play();\n);\n\n(\nPbind(*[\n dur: Pseq([1.2, 0.2, 0.5, Pseries(0.1, -0.001, 100)], inf),\n pan: Pxrand(#[-0.5, 0.5, 0.1, -0.1, 0.8, -1], inf),\n freq: Pseq([Pseries(140, 0.5, 200)], inf),\n instrument: \\brumm\n]).play;\n);\n\n(\nPbind(*[\n dur: Pseq(Signal.chebyFill(1024, Array.rand(10, 0.0, 10.0)).abs + 0.05, inf),\n pan: Pxrand(#[-0.5, 0.5, 0.1, -0.1, 0.8, -1], inf),\n freq: Pseq(Signal.chebyFill(1024, Array.rand(10, 0.0, 10.0)).abs * 18000 + 120, inf),\n instrument: \\brumm\n]).play;\n);\n\n\n(\nPbind(*[\n dur: Pseq([1.2, 0.2, 0.5, Pseries(0.1, -0.002, 50)], inf),\n pan: Pxrand(#[-0.5, 0.5, 0.1, -0.1, 0.8, -1, 1, -0.8], inf),\n freq: Pseq([Pseries(740, 0.5, 200), Pxrand(Array.series(740, 0.5, 200), 50)], inf),\n instrument: \\brumm\n]).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `AbstractFunction`."}, {"role": "assistant", "content": "```supercollider\na = { |x| #[440, 720, 801, 1020.2].at(x) }; b = a.cpsmidi; [a.value(3), b.value(3)];\na = Pseries(220, 220, inf).cpsmidi; a.asStream.nextN(12); // overtone series as midinotes\n// follow but round to next midinote\n{ a = Pitch.kr(SoundIn.ar).at(1); Pulse.ar(a.cpsmidi.round.midicps) * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// First we create something to control\nx = { |freq = 440, amp = 0.6| MoogFF.ar(PinkNoise.ar(amp), freq).dup }.play;\n\n// In the following pattern, the first two keys are the ones that create the monophonic behaviour:\n(\np = Pbind(\n \\type, \\set, // This tells it we'll be setting parameters of an existing node...\n \\id, x.nodeID, // ...this tells it whose parameters we'll be setting\n \\args, #[\\freq, \\amp], // and this tells it which parameters to set\n \\freq, Pwhite(100, 1000),\n \\dur, 0.2,\n \\amp, Pseq((1, 0.99 .. 0.1), inf)\n).play;\n);\n\np.stop\nx.\n// …\n```"}, {"role": "assistant", "content": "First we create something to control In the following pattern, the first two keys are the ones that create the monophonic behaviour: (Pmono: monophonic event stream)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ SinOsc.ar(500 + LFPulse.ar(4).bipolar(40), 0, 0.5 * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ SinOsc.ar(500 + LFPulse.ar(4).bipolar(40), 0, 0.5) * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\n{\n SinOsc.ar([225, 450, 900], 0, 0.2)\n + LPF.ar(\n LFPulse.ar(226 * [1, 2, 5], [0, 0.1, 0.1], 0.2, 0.2),\n MouseX.kr(20, 10000, 1)\n )\n}.scope;\n);\n\n// server.scope only changes the properies explicitly given:\n\ns.scope(numChannels: 5);\ns.scope(index: 12);\ns.scope(zoom: 4);\ns.scope(index: 0);\n\ns.scopeWindow.size = 600;\ns.scopeWindow.size = 222;\n\n// scoping buses:\n\na = Bus.audio(s, 4);\n{\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\n{\n SinOsc.ar([225, 450, 900], 0, 0.2)\n + LPF.ar(\n LFPulse.ar(226 * [1, 2, 5], [0, 0.1, 0.1], 0.2, 0.2),\n MouseX.kr(20, 10000, 1)\n )\n}.scope;\n);\n\n// server.scope only changes the properies explicitly given:\n\ns.scope(numChannels: 5);\ns.scope(index: 12);\ns.scope(zoom: 4);\ns.scope(index: 0);\n\ns.scopeWindow.size = 600;\ns.scopeWindow.size = 222;\n\n// scoping buses:\n\na = Bus.audio(s, 4);\n{ WhiteNoise.ar(0.2.dup(4)) }.play(s, a);\n\na.scope;\n\nc = Bus.control(s, 3);\n{ WhiteNoise.kr(1.dup(4) * MouseX.kr) }.play(s, c);\n\nc.scope;\n\n// note that scoping control rate buses shows block size interpolation (this is due to the\n// fact that ScopeOut.kr doesn't work yet.)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `RLPF`."}, {"role": "assistant", "content": "```supercollider\n{ RLPF.ar(Saw.ar(200, 0.1), SinOsc.ar(XLine.kr(0.7, 300, 20), 0, 3600, 4000), 0.2) }.play;\n\n\n(\n{ var ctl = RLPF.ar(Saw.ar(5, 0.1), 25, 0.03);\n SinOsc.ar(ctl * 200 + 400) * 0.1;\n}.play;\n);\n\n\n(\n{ var ctl = RLPF.ar(Saw.ar(5, 0.1), MouseX.kr(2, 200, 1), MouseY.kr(0.01, 1, 1));\n SinOsc.ar(ctl * 200 + 400) * 0.1;\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a bell in SuperCollider."}, {"role": "assistant", "content": "A bell is a set of inharmonic partials with a long percussive decay. The ratios below are the\nclassic bell ones; the envelope frees the Synth when it ends.\n\n```supercollider\n(\nSynthDef(\\bell, { |out = 0, freq = 440, amp = 0.2, dur = 3|\n var partials = [1, 2.76, 5.4, 8.93];\n var amps = [1, 0.5, 0.3, 0.15];\n var sig = SinOsc.ar(freq * partials) * amps;\n var env = EnvGen.kr(Env.perc(0.001, dur, 1, -6), doneAction: 2);\n Out.ar(out, Pan2.ar(Mix(sig) * env * amp, 0));\n}).add;\n);\nSynth(\\bell, [\\freq, 660, \\dur, 4]);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Normalizer`."}, {"role": "assistant", "content": "```supercollider\n(\n// example signal to process\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n z * 0.8\n}.play\n);\n\n(\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n [z, Normalizer.ar(z, 0.4, 0.01)] * 0.5\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Condition` in SuperCollider?"}, {"role": "assistant", "content": "Condition — Block the execution of a thread Category: Scheduling."}]} +{"conversations": [{"role": "user", "content": "What does `BeatClockPlayer.spec` do?"}, {"role": "assistant", "content": "'trig' rate player that plays steady impulse triggers locked to tempo"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `NamedControl`."}, {"role": "assistant", "content": "```supercollider\n// multiple usage of the same name:\na = { SinOsc.ar(\\freq.kr(440, 1.0)) + Saw.ar(\\freq.kr(440, 1.0) * 0.5) * 0.1 }.play;\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n\n// with different lag values:\na = { SinOsc.ar(\\freq.kr(440).lag(3.5)) + Saw.ar(\\freq.kr(440).lag(0.05) * 0.5) * 0.1 }.play;\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n\n// control saved to a variable:\n(\na = {\n var freq = \\freq.kr(440);\n SinOsc.ar(freq.lag(3.5)) + Saw.ar(freq.lag(0.05) * 0.5) * 0.1;\n}.play;\n);\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `IdentityDictionary.nextTimeOnGrid` do?"}, {"role": "assistant", "content": "Use a dictionary to represent timing information."}]} +{"conversations": [{"role": "user", "content": "What does `Env.step` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new envelope specification where all the segments are horizontal lines. Given n values of times only n levels need to be provided, corresponding to the fixed value of each Arguments: levels — an array of levels. The first value is the initial level of the envelope and, when used with EnvGen, is held until the `gate` opens. If a level is a UGen, it's value is updated only when the envelope reaches that node. When a level is itself an array, the envelope returns a multichannel output (for ; times — an array of durations of segments in seconds. It should be the same size as the levels array.; releaseNode — an Integer or `nil`. The envelope will sustain at the release node until released.; loopNode — an Integer or `nil`. If not `nil` the output will loop through those nodes starting at the loop node to the node immediately preceding the release node, before back to the loop node, and so on. Note that the envelope only transitions to the release node when released. Examples are below. The loop is; offset — an offset to all time values (only applies in IEnvGen).."}]} +{"conversations": [{"role": "user", "content": "What does `SimpleNumber.sincPi` do?"}, {"role": "assistant", "content": "Returns the Sinus Cardinal of `x`. Also known as the \"sinc\" function. `sincPi(x) = sin(x) /"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `EnvGate`."}, {"role": "assistant", "content": "```supercollider\na = { LPF.ar(Saw.ar(200), 600) * EnvGate.new }.play;\na.set(\\fadeTime, 2);\na.release;\n\n// the same as:\na.set(\\gate, 0);\n\n// several env gates can coexist in one synth def.\n(\na = {\n var sound1 = LPF.ar(Saw.ar(80), 600) * EnvGate.new;\n var sound2 = RLPF.ar(Saw.ar(200) * 0.5, 6000 * EnvGate.new + 60, 0.1) * EnvGate.new;\n sound1 + sound2\n}.play;\n);\na.set(\\fadeTime, 5);\na.release;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `TaskProxy` in SuperCollider briefly."}, {"role": "assistant", "content": "TaskProxy — event stream reference Keeps a reference to a task (time pattern) that can be replaced while playing. It plays on when the old stream ended and a new stream is set and schedules the changes to the beat. Category: JITLib > Patterns, Live Coding."}]} +{"conversations": [{"role": "user", "content": "What is `AbstractSController` in SuperCollider?"}, {"role": "assistant", "content": "AbstractSController — an abstract class for all sInstrument controllers Multi-channel control rate bus+synth for amplitudes, frequencies, panning positions etc. Category: SInstruments."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nNdef(\\bitshift, {\n var t = PulseCount.ar(Impulse.ar(8e3));\n var sig = HPF.ar(\n ( \n ((t * 15) & (t >> 5)) |\n ((t * 5) & (t >> [3, 4])) |\n ((t * 2) & (t >> 9)) |\n ((t * 8) & (t >> 11))\n - 3 % 256\n ) / 127-1 * 3\n , 20\n ).distort * 0.2; \n sig = Greyhole.ar(sig, sig, 0.5, sig).flop.mean/4;\n}).play;\n)\n```"}, {"role": "assistant", "content": "Not very original since I copied the bit code from http://schemawound.com/post/58980873930/bitwise and added a greyhole. But it sound so amazing I want to share it =)."}]} +{"conversations": [{"role": "user", "content": "What does `UScore.resume` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: targets — (describe argument here). Returns: (returnvalue)"}]} {"conversations": [{"role": "user", "content": "Why LeakDC and not a standard HPF for DC removal?"}, {"role": "assistant", "content": "SuperCollider forum — Why LeakDC and not a standard HPF for DC removal?\n\nHello everyone,\n\nI’m a bit sceptical of the DC removal implementation in LeakDC. As I understand it, DC removal is nothing but a HPF, preferably placed below the audible range. For this purpose, LeakDC seems to be reaching far too high, attenuating the audible low frequencies. You can run the following code and look at the server meter to see the difference in level between the two audio channels (note: there is of course no DC offset in this example that would need fixing):\n\n```supercollider\n( play { [\n SinOsc.ar(50),\n LeakDC.ar(SinOsc.ar(50))\n] * 0.2 } )\n```\n\nAlso, LeakDC’s behaviour is not consistent between sample rates (as is mentioned in the help file).\n\nI ran the it through Plugin Doctor to back up my suspicions and got these results:\n\nstandard coefficient of 0.995:\n\nSR 48 kHz: Filter starts rolling off at 200 Hz, -2dB at 50 Hz.\n\nSR 96 kHz: Filter starts rolling off at 500 hz! It reaches already -2dB at 100 Hz, -5 dB at 50 Hz.\n\ncoefficient of 0.999:\n\nSR 48 kHz: Filter starts rolling off at 50 Hz, -2 dB at 10 Hz.\n\nSR 96 kHz: Filter starts rolling off at 100 Hz, -2 dB at 20 Hz.\n\nI wonder why one wouldn’t just use a standard HPF at 10 Hz (or so) instead? It is consistent between sample rates, it only starts to roll of below 30 Hz and it reaches only -0.5 dB at 20 Hz. So this actually looks much better in the server meter:\n\n```supercollider\n( play { [\n SinOsc.ar(50),\n HPF.ar(SinOsc.ar(50), 10)\n] * 0.2 } )\n```\n\nSo my question is: Is there any reason why the LeakDC implementation would be peferable to such a standard butterworth HPF?\n\nOne difference I can see is that the HPF still has an initial offset spike before settling around zero phase, LeakDC does not show that behaviour:\n\n```supercollider\n{ LeakDC.ar(DC.ar(0.5)) }.plot(0.5);\n{ HPF.ar(DC.ar(0.5), 10) }.plot(0.5);\n\n{ LeakDC.ar(SinOsc.ar + DC.ar(0.5)) }.plot(0.02);\n{ HPF.ar(SinOsc.ar + DC.ar(0.5), 10) }.plot(0.02);\n```\n\nSo this could be a reason – I don’t know enough about filters to understand why this happens though. Any enlightenment would be appreciated."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `DissonanceCurve`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"fm\", {| out = 0, amp = 0.2, midinote=1, octave = 5, carrier, modulator, depth,\n dur = 1, detune = 0|\n\n var carrierOsc, modulation, env, degree, ratio;\n\n\n // adjust the octave. This assumes the fregencies we give for analysis generate a tone in the octave around middle C\n degree = midinote - 60;\n degree = degree + (12 * (octave - 5));\n\n // now compute a ratio\n ratio = degree.midiratio;\n\n // multiple the ratio by all of the FM values\n carrier = (carrier * ratio) + detune; // Pbinds sometimes use a detune value\n modulator = modulator * ratio;\n depth = depth * ratio;\n\n env = EnvGen.kr(Env.sine(dur, 1), doneAction:2);\n\n modulation = SinOsc.ar(modulator, 0, depth);\n carrierOsc = SinOsc.ar(carrier+ modulation, 0, env);\n\n Out.ar(out, carrierOsc.dup* amp);\n\n}).add;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Event.group` do?"}, {"role": "assistant", "content": "Makes the event a control interface to the resultant Group when played. This is experimental, does not work consistently"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Pgroup`."}, {"role": "assistant", "content": "```supercollider\np = Pbind(\\degree, Prand((0..7), inf), \\dur, 0.3, \\legato, 0.2);\n\n // watch the node structure as it changes\ns.waitForBoot({ s.plotTree });\n\n// one group\nPgroup(p).play;\n\n// two nested groups\nPgroup(Pgroup(p)).play;\nPgroup(Ppar([Pgroup(p), Pgroup(p)])).play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes sound of an alien weapon firing."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"raygun\", {arg amp = 0.5, sinfreq = 1000, glissf = 0.001, att = 0.01, rel = 0.9;\n var gliss = XLine.kr(sinfreq, sinfreq*glissf, rel);\n var snd = SinOsc.ar(gliss);\n var env = EnvGen.kr(Env.perc(att, rel), doneAction: 2);\n snd = snd * env * amp;\n Out.ar(0, snd);\n}).add;\n);\n\n(\nPbind(\n \\instrument, \"raygun\",\n \\dur, Pseq([0.75,0.75,0.75,0.75,0.25,0.25,0.25]*0.5, inf),\n \\amp, 0.4\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `MIDIOut`."}, {"role": "assistant", "content": "```supercollider\nMIDIClient.init;\nm = MIDIOut(0); // Linux users: MIDIOut(0, MIDIClient.destinations[0].uid)\n\n// Simplest way for sending \\note-type events to MIDI\n// define a Pattern of note-events:\na = Pbind(degree: Prand([1, 2, 3, [0, 5]], inf));\n\n// chain a \\midi-type event into the pattern and play it (see link\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\na = Ppatmod(\n Pseq([0, 0, 0, 0], 1),\n { |pat, i|\n var list;\n list = pat.list;\n pat.list = list.put(list.size.rand, 2);\n }, inf);\n\nx = a.asStream;\n30.do({ x.next.postln });\n);\n\n\n// Ppatmod used to modify a pattern that produces a sequence of pitches:\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\na = Ppatmod(\n Pseq([0, 0, 0, 0], 1),\n { |pat, i|\n var list;\n list = pat.list;\n pat.list = list.put(list.size.rand, 2);\n }, inf);\n\nx = a.asStream;\n30.do({ x.next.postln });\n);\n\n\n// Ppatmod used to modify a pattern that produces a sequence of pitches:\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Pn(\n Ppatmod(\n Pseq([0, 0, 0, 0], 1),\n { |pat, i|\n var list;\n list = pat.list;\n pat.list = list.put(list.size.rand, 2);\n }, 15),\ninf).asStream;\n\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, (a.next*5+77).midicps]);\n 0.13.wait;\n })\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Font.setDefault` do? What arguments does it take?"}, {"role": "assistant", "content": "Sets the global default font. Properties of the `font` argument will be combined with properties of the default system font, and those of individual views. Optionally, a class can be given, so only views of that class will be affected. Note that this will immediately affect any existing Arguments: font — An instance of Font.; class — A Class (either View or one of its subclasses), or `nil`.."}]} -{"conversations": [{"role": "user", "content": "What does `Bend.time` do? What arguments does it take?"}, {"role": "assistant", "content": "Bend all time related Arguments: ugenFunc — a function that returns a UGen graph, like in *new; freqArgNames — Frequency related arg names (apply a bend). Default: `\\freq, \\rate`; durArgNames — Duration related arg names (apply a reverse bend). Default: `\\dur, \\duration, \\delaytime, \\decaytime` `(`."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `QuadN`."}, {"role": "assistant", "content": "```supercollider\n// default params\n{ QuadN.ar(SampleRate.ir/4) * 0.2 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for more tweets (pitchshift feedback + sinoscfb)?"}, {"role": "assistant", "content": "```supercollider\n// probably horrible for speakers... \n\n// glitchift\n{l=LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j**[l,k],k),[0.05,0.03],j);LocalOut.ar(s);s}.play;\n// drone\n{l=LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j**[2,2.1],k),[0.05,0.03],j);LocalOut.ar(s);s}.play;\n\n\n// few more I was mucking around with (remove tanh loop for < 140c)\n{l = LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j**l,k),[0.05,0.03],j);5.do{s=s.tanh+(s*0.1)};LocalOut.ar(s);s}.play;\n\n{l = LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j**2,k),[0.05,0.03],j);5.do{s=s.tanh+(s*0.1)};LocalOut.ar(s);s}.play;\n\n{l = LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j*20,k),[0.05,0.03],j);5.do{s=s.tanh+(s*0.1)};LocalOut.ar(s);s}.play;\n\n{l = LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j**j,k),[0.05,0.03],j);5.do{s=s.tanh+(s*0.1)};LocalOut.ar(s);s}.play;\n\n{l = LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j**l.abs,k),[0.05,0.03],j);5.do{s=s.tanh+(s*0.1)};LocalOut.ar(s);s}.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes flanger (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"flange\", {arg freq=440, release=0.1;\n var x, sig,out, mod1, depth, mfreq,maxfreq, maxdepth, maxdelay, basedelay;\n maxfreq=3;\n maxdelay=0.01;\n basedelay=maxdelay/2;\n maxdepth=basedelay/2;\n depth = MouseY.kr(0,maxdepth);\n mfreq = MouseX.kr(0,maxfreq);\n mod1 = SinOsc.ar(mfreq,0,depth);\n sig = SoundIn.ar(0,mul:2);\n out = DelayC.ar(sig, maxdelay,basedelay+ mod1);\n out = Mix.ar([out,sig]);\n Out.ar(0,out);\n Out.ar(1,out);\n}).load(s);\n);\n\na = Synth(\"flange\");\na.free\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\\help, { |out|\n var mod = LFNoise2.kr(Rand(1, 6)) * 0.2;\n var snd = mod * Blip.ar(Rand(200, 800) * (mod + 1));\n Out.ar(out, snd);\n FreeSelf.kr(mod < 0);\n}).add;\n);\n\n(\nfork {\n 10.do {\n \"started a synth\".postln;\n Synth(\\help).waitForFree;\n \"This one ended. Wait a second, I will start the next one.\".postln;\n 1.wait;\n };\n \"This is it.\".postln;\n}\n;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\\help, { |out|\n var mod = LFNoise2.kr(Rand(1, 6)) * 0.2;\n var snd = mod * Blip.ar(Rand(200, 800) * (mod + 1));\n Out.ar(out, snd);\n FreeSelf.kr(mod < 0);\n}).add;\n);\n\n(\nfork {\n 10.do {\n \"started a synth\".postln;\n Synth(\\help).waitForFree;\n \"This one ended. Wait a second, I will start the next one.\".postln;\n 1.wait;\n };\n \"This is it.\".postln;\n}\n);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Feedback resonator."}, {"role": "assistant", "content": "```supercollider\n// Resonator, must subtract blockSize for correct tuning\n(\nSynthDef(\"testRes\", {\n \nvar freq = 300, localIn, input, limitLevel = 0.2, output;\nvar feedbackAmt = 0.999;\n\nfreq = MouseY.kr(20, 678, \\exponential).poll;\nfeedbackAmt = MouseX.kr(0.2, 0.99999).poll;\nlocalIn = LocalIn.ar(1); \ninput = LFNoise1.ar(freq * 16, 0.2);\ninput = input + Dust2.ar(freq);\n\n\nLocalOut.ar(\n HPF.ar(LPF.ar(DelayC.ar(input + (localIn * feedbackAmt), 2, freq.reciprocal - ControlRate.ir.reciprocal), freq * 8), freq * 0.125)\n);\n\noutput = Limiter.ar(localIn, limitLevel, 0.01) * limitLevel.reciprocal;\nOffsetOut.ar(0, output ! 2);\n\n}).play(s);\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `PopUpMenu.defaultGetDrag` do?"}, {"role": "assistant", "content": "A view displaying a text item selectable from a drop-down menu. Returns: The #-value."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pfset`."}, {"role": "assistant", "content": "```supercollider\n(\nvar a, b;\na = Pfset({\n ~legato = 0.3;\n ~detune = rrand(0, 30);\n}, Pbind(\\dur, 0.5));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Synth`?"}, {"role": "assistant", "content": "Synth — Client-side representation of a synth node on the server"}, {"role": "user", "content": "What does `Synth.new` do?"}, {"role": "assistant", "content": "Create and return a new Synth object, and immediately start the corresponding synth node on the server."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n// create a Synth at the head of the default Server's default group\n// based on the SynthDef \"default\"\nx = Synth.new(\"default\");\ns.queryAllNodes; // note the default group (ID 1)\nx.free;\n\n// Using an arrayed control\n// run this block first to make the SynthDef\n(\nSynthDef(\"help-synth\", { |freq = #[440, 450, 460], out = 0|\n Out.ar(out, Mix(SinOsc.ar(freq, 0, 0.1)));\n}).add;\n);\n\n// then this a short while later\nx = Synth(\"help-synth\", [freq: [500, 501, 510]]);\n\nx = Synth(\"help-synth\", [freq: [500, 501, 510]]);\nx.set(\\freq, [1, 2, 3] * 400 + [1, 2, 3], \\out, 1);\nx.set(\\freq, [3] * 400 + [1, 2, 3], \\out, 1);\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Buffer.read fails and I get a path error. What should the path look like?"}, {"role": "assistant", "content": "On Windows use forward slashes or escaped backslashes inside the string: `Buffer.read(s, \"C:/sounds/kick.wav\")`. A single backslash starts an escape sequence, which is why `\"C:\\sounds\\kick.wav\"` fails. Also check the extension is real (`.wav`, `.aiff`, `.flac`) and that the file is not on a network path — the server reads it, not the language, and it may resolve differently. For sounds that ship with SuperCollider, `Platform.resourceDir +/+ \"sounds/a11wlk01.wav\"` is the portable form."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Multichannel Convolution Reverb (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\n~numIRs = 4;\n~fftsize = 2048;\ns.waitForBoot {\n var irs, irbuffs, bufsizes, nextmod, numSamples;\n nextmod = 100;\n numSamples = 40000 ;\n \n /* an array of multiple IRs */\n irs = ~numIRs.collect{ arg nth;\n // nth is here not used, but can be useful to scale decay time.\n [0] ++ 0.dup(100) ++ Array.fill(\n numSamples, { arg i;\n (i%nextmod==0).if\n {\n nextmod= rrand(80, 120);\n (i.asFloat/numSamples).squared * 0.3\n } {\n 0\n }\n }\n )\n };\n { irs.plot }.defer; // to show irs.\n \n /* an array of buffers. */\n irbuffs = ~numIRs.collect{ arg i; Buffer.loadCollection(s, irs[i]) };\n irbuffs.postln; // to show irbuffs info.\n s.sync;\n \n bufsizes= irbuffs.collect{ |nth|PartConv.calcBufSize(~fftsize, nth) };\n ~irSpctrms = bufsizes.collect{ arg size, i;\n Buffer\n .alloc(s, size, 1)\n .preparePartConv(irbuffs[i], ~fftsize)\n };\n s.sync; \n \n ~numIRs.do{|i| irbuffs[i].free}\n}\n);\n\n(\nfork{\n ~target= Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n s.sync;\n {\n var in, krnl;\n in= PlayBuf.ar(1, ~target, loop:1);\n \n /* an array of multiple instances of PartConv */\n krnl= ~numIRs.collect{ arg i;\n PartConv.ar(in, ~fftsize, ~irSpctrms[i].bufnum, 0.2)};\n // By iterating, each PartConv processes a mono-channel buffer in the array ~irSpctrms.\n \n Out.ar(0, krnl);\n }.play\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes a Panthera Pardus meditates about his melanism."}, {"role": "assistant", "content": "```supercollider\n// a Panthera Pardus meditates about his melanism\n\n(\n~chrs = {|in, speed| DelayC.ar(in, 0.5, Array.fill(12, {|i| LFNoise2.ar(speed).range(0.022, 0.024);}).sum)};\n~phas = {|in, speed=1| var chain; chain = in+FreqShift.ar(in, 0, SinOsc.kr(speed).range(0, pi)).tanh; chain = chain + FreqShift.ar(chain, 0, SinOsc.kr(speed*0.97).range(0, pi)).tanh; chain=(chain*0.5).tanh; };\n~smear = {|in, bins=50| var chain; chain=FFT(LocalBuf(2048), in); chain=PV_MagSmear(chain, bins); chain=IFFT(chain)*0.5; };\n\nNdef.clear;\nNdef(\\pantheraPardus___).play;\nNdef(\\___hisInner).play;\nNdef(\\pantheraPardus___).fadeTime = 5;\nNdef(\\___hisInner).fadeTime = 50;\n\nNdef(\\pantheraPardus___, {arg amp=1;\n var sig, env, sig0, ctrl;\n ctrl = LFGauss.kr(5, 0.15);\n sig = (Saw.ar([LFNoise1.kr(1).range(15, 30), 0.025], 0.14)) * LFNoise2.kr(1).range(0.5, 1);\n sig = (sig + PinkNoise.ar(0.1) * LFNoise2.kr(1).range(0.1, 0.4)) * ctrl;\n sig = sig*0.25 + ~chrs.(~phas.(sig, [0.2, 0.174]), [0.1, 0.12]);\n sig = DynKlank.ar(`[[100, 200, 300, 1000, 4000, 9000], (ctrl.range(0.2/6, 1/6)*LFNoise2.kr(1).range(0.2, 1))!6, 0.025], sig*0.2);\n sig = ~smear.(sig, 5);\n sig = HPF.ar(LPF.ar(sig, (LFNoise2.kr(1.25).range(100, 2000))), 250); \n sig = Limiter.ar(GVerb.ar(Limiter.ar(sig), 4.5, 0.2, 0.9, 0.1), -6.dbamp)*15;\n});\n\nNdef(\\___hisInner, {arg amp=1;\n var sig = Saw.ar(Duty.kr(Dseq([2, 4, 1, 1/4, 8], inf), 0, Dseq([61+(1/6), [63+(3/6), 58+(3/6)], 64+(3/6)].midicps, inf)), 0.14);\n sig = LPF.ar(sig, LFNoise0.kr(15).range(5120, 9400).lag(0.001), 0.01);\n sig = DynKlank.ar(`[[100, LFNoise0.kr(2).range(300, 320), 4000], 1/3, 0.04], sig);\n sig = ~chrs.(~phas.(sig, [0.2, 0.174]), [0.1, 0.12]);\n sig = HPF.ar(LPF.ar(sig, 1200), 400)*15;\n sig = Limiter.ar(FreeVerb.ar(sig, [0.8, 0.78]), -6.dbamp);\n});\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `ZeroXBufWr` in SuperCollider?"}, {"role": "assistant", "content": "ZeroXBufWr — writes zero crossing analysis from signals to buffers ZeroXBufWr analyses zero crossings from an input signal and writes the signal and the zero crossing indices to buffers. It is intended to be used with ZeroXBufRd and TZeroXBufRd, see these help files for more examples. Category: Libraries > miSCellaneous > ZeroX ugens."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for pitch tracker utility."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\\pitchTrack, {\n var soundin = SoundIn.ar(0);\n var zc = ZeroCrossing.ar(soundin);\n // var pt = Pitch.kr(soundin);\n // var tt = Tartini.kr(soundin);\n SendReply.kr(Impulse.kr(1), '/pitchTrackUtil', [zc, zc.cpsmidi]);\n}).add;\n\n~pitchTrack = {\n if(~pitchTrackSynth.isNil or: { ~pitchTrackSynth.isRunning.not }, {\n ~pitchTrackSynth = Synth(\\pitchTrack);\n ~pitchTrackNW = NodeWatcher.register(~pitchTrackSynth);\n }, {\n ~pitchTrackSynth.free;\n ~pitchTrackSynth = nil;\n \"Pitch tracker stopped.\".postln;\n });\n};\n\n~pitchTrackOSCFunc = {\n OSCFunc({\n | msg |\n (\"Pitch:\"+msg[3].round.asString.padLeft(5)+msg[4].round.asString.padLeft(3)).postln;\n }, '/pitchTrackUtil');\n};\n\n~pitchTrackOSCFunc.();\n\nCmdPeriod.add({~pitchTrackOSCFunc.();});\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `Pstep` in SuperCollider briefly."}, {"role": "assistant", "content": "Pstep — timed, sample-and-hold embedding of values Pstep is a \"sample and hold\" pattern: The value returned by `next` is held at each value in `levels` for the corresponding duration in `durs`. This cycling is similar to Ptuple, in that the current repeat ends when eiher pattern returns nil. Category: Streams-Patterns-Events > Patterns > Time."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Re: winter is coming?"}, {"role": "assistant", "content": "```supercollider\n(\n{ \n Limiter.ar(\n Pan2.ar(\n LPF.ar(\n DynKlank.ar(\n `[\n Array.rand(5, 700, 2000), \n nil, \n Array.rand(5, 0.2, 5).collect({|freq|\n SinOsc.kr(freq).range(0.1,1)\n })\n ], \n Limiter.ar(\n Dust.ar( SinOsc.kr(1).range(1.5, 4), 0.45) \n + \n Impulse.ar( SinOsc.kr(0.03).range(0.5, 1.2) , 0, 0.9)\n )\n ),\n 1600,\n 0.6\n ),\n SinOsc.kr(0.01 + 4.rand, mul:0.5)\n )\n +\n Pan2.ar(\n DynKlank.ar(`[\n Array.rand(5, 700, 2000).collect({ |freq| SinOsc.kr( SinOsc.kr( SinOsc.kr(0.2).range(0, 10) ) ).range(100, freq) }),\n nil, \n Array.rand(5, 0.3, 1)\n ], PinkNoise.ar(0.006) ),\n Lag.kr(TRand.kr(-0.8, 0.8, Pulse.kr(2 + 10.rand)))\n )\n ) * LorenzL.ar(MouseX.kr(0, 230), add: 0.5, mul: 0.5)\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "GrainBuf complains about too many grains."}, {"role": "assistant", "content": "The number of simultaneous grains is `density × dur` in seconds, and it exceeds maxGrains (512 by default). Either lower the trigger rate, shorten the grains, or raise the limit: `GrainBuf.ar(2, trig, dur, buf, 1, pos, 2, 0, -1, 1024)` — the 1024 is maxGrains. Raising it costs server CPU per grain, so prefer halving the density if the sound does not need it."}]} -{"conversations": [{"role": "user", "content": "What does `SplineFr.update` do?"}, {"role": "assistant", "content": "Mx frame rate driven time domain spline for automation curves"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Another fibonaccy melody."}, {"role": "assistant", "content": "```supercollider\n(\nc=13;a=Array.fib(64,0,1);b=Array.fill(size:c,function:{arg i;a[i]%12});\np=1/(21-c);Pdef(\\x,Pbind(\\dur,p,\\degree,Pseq(b,1,0)));\nr=Array.fill(c,{arg i;Pbindf(Pdef(\\x),\\mtranspose,1-b[i]);});\nPseq(r,(1/p)).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n{\n NLFiltN.ar(\n LFSaw.ar([120, 180], 0, mul:0.1),\n 0.5,\n -0.04,\n 0.8,\n 0.2,\n LFCub.kr(0.2, [0, 0.5 * pi], 63, 103)\n )\n}.play\n);\n\n(\n{\n NLFiltN.ar(\n LFSaw.ar(XLine.kr([60, 90], [360, 540], 20), 0, mul:0.1),\n 0.0,\n 0.0,\n 0.7,\n 0.4,\n LFCub.kr(0.2, [0, 0.5 * pi], 3, 9)\n )\n}.play\n);\n\n(\n// internal mirroring keeps it from blowing up and makes for some gross distortion\n// this is\n// …\n```"}, {"role": "assistant", "content": "internal mirroring keeps it from blowing up and makes for some gross distortion this is a little loud (NLFiltN: Non-linear Filter)"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// no, it doesn't take a ugen in ...\n(\n{\n EnvGen.kr(\n Env.asr(0.1, 1.0, 0.5, \\welch),\n 1.0,\n FSinOsc.ar(1.0).range(0.0, 1.0),\n timeScale: 0.1\n ) * SinOsc.ar(440, 0, 0.3)\n}.play;\n);\n\n// ...but an .ir rate input, a float or an ir rate ugen like Rand would work\n(\n{\n EnvGen.kr(\n Env.asr(0.1, 1.0, 0.5, \\welch),\n 1.0,\n Rand(0.1, 1.0),\n timeScale: 0.1\n ) * SinOsc.ar(440, 0, 0.3)\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// no, it doesn't take a ugen in ...\n(\n{\n EnvGen.kr(\n Env.asr(0.1, 1.0, 0.5, \\welch),\n 1.0,\n FSinOsc.ar(1.0).range(0.0, 1.0),\n timeScale: 0.1\n ) * SinOsc.ar(440, 0, 0.3)\n}.play;\n);\n\n// ...but an .ir rate input, a float or an ir rate ugen like Rand would work\n(\n{\n EnvGen.kr(\n Env.asr(0.1, 1.0, 0.5, \\welch),\n 1.0,\n Rand(0.1, 1.0),\n timeScale: 0.1\n ) * SinOsc.ar(440, 0, 0.3)\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// typical usage\na = 4;\nb = 3;\nb = b + a;\n\n// some sound\na = Synth(\\default);\ng = fork { loop { 0.1.wait; a.set(\\freq, 200 + 20.0.rand2.postln } };\ng.stop; a.free;\n\n// an overview of all the variables\nthis.inspect;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// typical usage\na = 4;\nb = 3;\nb = b + a;\n\n// some sound\na = Synth(\\default);\ng = fork { loop { 0.1.wait; a.set(\\freq, 200 + 20.0.rand2.postln) } };\ng.stop; a.free;\n\n// an overview of all the variables\nthis.inspect;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Gradient.at` do? What arguments does it take?"}, {"role": "assistant", "content": "Retrieve the colour at position `pos`, typically a value between zero and one. `at(0)` is `color1`, and `at(1)` is Arguments: pos."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PV_MagSmear`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n(\nb = Buffer.alloc(s, 2048, 1);\nc = Buffer.read(s, ExampleFiles.child);\n);\n\n(\nSynthDef(\"help-magSmear\", { |out = 0, bufnum = 0|\n var in, chain;\n in = LFSaw.ar(500, 0, Decay2.ar(Impulse.ar(2, 0, 0.2), 0.01, 2));\n chain = FFT(bufnum, in);\n chain = PV_MagSmear(chain, MouseX.kr(0, 100));\n Out.ar(out, 0.5 * IFFT(chain).dup);\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n);\n\n(\nSynthDef(\"help-magSmear2\", { |out = 0, bufnum = 0, soundBufnum = 2|\n var in, chain;\n in = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);\n chain = FFT(bufnum, in);\n chain = PV_MagSmear(chain, MouseX.kr(0, 100));\n Out.ar(out, 0.5 * IFFT(chain).dup);\n}).play(s, [\\out, 0, \\bufnum, b.bufnum, \\soundBufnum, c.bufnum]);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Mx.solo` do? What arguments does it take?"}, {"role": "assistant", "content": "A mixer and dynamic patching Arguments: channel; boo."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PeakFollower`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n// no decay\n(\n{\n SinOsc.ar(\n PeakFollower.ar(Dust.ar(20, Line.kr(0, 1, 4)), 1.0) * 1500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// a little decay\n(\n{\n SinOsc.ar(\n PeakFollower.ar(Dust.ar(20, Line.kr(0, 1, 4)), 0.999) * 1500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// mouse x controls decay, center of the\n(\n{\n var decay;\n decay = MouseX.kr(0.99, 1.00001).min(1.0);\n SinOsc.ar(\n PeakFollower.ar(Dust.ar(20), decay) * 1500 + 200,\n 0, 0.2\n );\n\n}.play;\n);\n\n\n\n\n// follow a sine lfo, decay controlled by mouse x\n(\n{\n var decay;\n decay = MouseX.kr(0, 1.1).min(1.0);\n SinOsc.ar(\n PeakFollower.kr(SinOsc.kr(0.2), decay) * 200 + 500,\n 0, 0.2\n )\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Ringz.ar(Dust.ar(3, 0.3), 2000, 2) }.play\n\n{ Ringz.ar(WhiteNoise.ar(0.005), 2000, 0.5) }.play\n\n// modulate frequency\n{ Ringz.ar(WhiteNoise.ar(0.005), XLine.kr(100, 3000, 10), 0.5) }.play\n\n{ Ringz.ar(Impulse.ar(6, 0, 0.3), XLine.kr(100, 3000, 10), 0.5) }.play\n\n// modulate ring time\n{ Ringz.ar(Impulse.ar(6, 0, 0.3), 2000, XLine.kr(4, 0.04, 8)) }.play\n\n// modulate ring time opposite direction\n{ Ringz.ar(Impulse.ar(6, 0\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Ringz.ar(Dust.ar(3, 0.3), 2000, 2) }.play\n\n{ Ringz.ar(WhiteNoise.ar(0.005), 2000, 0.5) }.play\n\n// modulate frequency\n{ Ringz.ar(WhiteNoise.ar(0.005), XLine.kr(100, 3000, 10), 0.5) }.play\n\n{ Ringz.ar(Impulse.ar(6, 0, 0.3), XLine.kr(100, 3000, 10), 0.5) }.play\n\n// modulate ring time\n{ Ringz.ar(Impulse.ar(6, 0, 0.3), 2000, XLine.kr(4, 0.04, 8)) }.play\n\n// modulate ring time opposite direction\n{ Ringz.ar(Impulse.ar(6, 0, 0.3), 2000, XLine.kr(0.04, 4, 8)) }.play\n\n(\n{\n var exciter;\n exciter = WhiteNoise.ar(0.001);\n Mix.arFill(10, {\n Ringz.ar(exciter,\n XLine.kr(exprand(100.0, 5000.0), exprand(100.0, 5000.0), 20),\n 0.5)\n })\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "How do I add reverb with FreeVerb?"}, {"role": "assistant", "content": "`FreeVerb.ar(in, mix, room, damp)` — mix 0..1 is dry/wet, room 0..1 is the size (0.5 is a small room, 0.9 is a hall), damp 0..1 rolls off the high end of the tail. Put it after your sound: `FreeVerb.ar(SinOsc.ar(440) * 0.1, 0.4, 0.8, 0.5)`. For a send-style reverb, write the dry signal to Out.ar(0, …) and the same signal through FreeVerb to a second bus."}]} -{"conversations": [{"role": "user", "content": "What does `SimpleNumber.cylBesselJ` do?"}, {"role": "assistant", "content": "Returns the result of the Bessel functions of the first kind. The functions return the result of `domain_error` whenever the result is undefined or complex. This occurs when `x < 0` and `v` is not an integer, or when `x == 0` and `v !="}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PdurStutter`."}, {"role": "assistant", "content": "```supercollider\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,0,1,3,4,0], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n100.do({ x.next.postln });\n);\n\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n);\n\n\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,4,4,0,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `RedSlide.up` do?"}, {"role": "assistant", "content": "Set or get the amount of lag when using the slide"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// this causes an error\nPatch({ arg audio;\n RLPF.ar(audio,1300)\n},[\n 0.0\n].play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// this causes an error\nPatch({ arg audio;\n RLPF.ar(audio,1300)\n},[\n 0.0\n]).play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for controlling arrayed args using pattern."}, {"role": "assistant", "content": "```supercollider\n(\nfork {\n var size = 3.rrand(10).debug('envelope size');\n {|dur=1, amp=0.8, pan = 0|\n Pan2.ar( \n SinOsc.ar(\n EnvGen.ar(Env(\\freq_l.kr(400!size), \\freq_d.kr(0.1!(size-1)), \\freq_c.kr(1!(size-1)))), // named controls\n mul: EnvGen.ar(Env.sine(dur, amp), doneAction:2)\n ).tanh, \n pan\n );\n }.asSynthDef.name_(\"dzin\").add;\n Server.default.sync;\n Pbind(*[\n instrument: \\dzin,\n delta: Pseg(Prand(1/2.pow((0..3)), inf), Pwhite(1,4), \\lin),\n dur: Pfunc({ thisThread.clock.beatDur }) * Pkey(\\delta), // set dur to delta duration\n freq_l: Pcollect(`_, Ptuple({ Pbrown(0,1,0.05).linexp(0,1,40,4e3) } ! size, inf)), // array refs - freq envelope levels\n freq_c: Ptuple({ Pcollect(`_, Ptuple({ Pbrown(-4,4,0.5) } ! (size-1), inf)) }!2, inf), // array of arrayrefs - multichannel expansion w/ different curve levels\n freq_d: Pfunc({ |e| Ref(Array.rand(size-1,0.3,1).normalizeSum * e.dur) }), // sending array ref with total dur = Pkey(\\dur)\n pan: Ptuple( { Pbrown() - 0.5 * 2 } ! 2, inf ), // array - multichannel expansion\n amp: Ptuple( { Pbrown() / 10 + 0.1 } ! 2, inf ) // same\n ]).play(TempoClock(156/60));\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Tempo.guiClass` do?"}, {"role": "assistant", "content": "for control of tempo and for use in tempo based calculations"}]} -{"conversations": [{"role": "user", "content": "What does `SCDoc.helpTargetDir` do?"}, {"role": "assistant", "content": "get/set the user help target directory. Defaults to `Platform.userAppSupportDir +/+ \"Help\"` and should typically not be changed by the"}]} -{"conversations": [{"role": "user", "content": "What is `ControlName`?"}, {"role": "assistant", "content": "ControlName — Object to store control information of SynthDef (used internally)"}, {"role": "user", "content": "What does `ControlName.index` do?"}, {"role": "assistant", "content": "The index of the control."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nd = SynthDef(\\tone, { |out = 0, freq = 200|\n var sig;\n\n freq.spec = ControlSpec(20, 20000);\n sig = SinOsc.ar(freq);\n\n Out.ar(out, sig);\n}).add;\n);\n\nd.specs.freq.postln;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `FreqScopeView.response` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a scope in a special frequency-response mode. This uses FFT-based spectral division to estimate the frequency response of some effect, on the assumption that the signal to bus1 is transformed to the signal at bus2 by some linear time-invariant Arguments: parent — The parent view.; bounds — An instance of Rect, or a Point indicating `width@height`.; bus1 — The bus on which the \"pre\" signal is found.; bus2 — The bus on which the \"post\" signal is found.; freqMode — Linear (0) or log(1) frequency mode. Defaults to 1.."}]} -{"conversations": [{"role": "user", "content": "SC can't open or read files?"}, {"role": "assistant", "content": "SuperCollider forum — SC can't open or read files\n\nIt looks as though it’s finally working!\n\nI moved the file to a folder I created in the user support directory for SuperCollider and then changed the quotes to ascii.\n\nI think the issue was that at first I had the file name listed without the extension, then I added the extension to the file name and added the file extension to the file path in the code and this must have created a conflict.\n\nIn the first instance SC needed the file extension, ascii quotes, and since I’m on windows the path needed double \\ in the path file.\n\nThe final working code looks like this:\n\n```supercollider\nb = Buffer.readChannel(s, \"C:\\\\Users\\\\44774\\\\AppData\\\\Local\\\\SuperCollider\\\\Tables\\\\wubsquare.wav\", startFrame:0, numFrames: -1);\n```\n\nThe wav file is simply named wubsquare and I included the file extension in the code."}]} -{"conversations": [{"role": "user", "content": "What are the arguments of GrainBuf.ar?"}, {"role": "assistant", "content": "`GrainBuf.ar(numChannels, trigger, dur, sndbuf, rate, pos, interp, pan, envbufnum, maxGrains, mul, add)`. The ones you always pass are numChannels (1 or 2), trigger (a UGen that fires grains, e.g. Impulse.kr(20)), dur (grain length in seconds), sndbuf (an integer buffer number, or `~buf`), rate (playback rate per grain), and pos (read position 0..1 into the buffer). Raise maxGrains if the server complains about too many grains rather than lowering density."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes BD with ringing BPF."}, {"role": "assistant", "content": "```supercollider\n// BD with ringing BPF\n\n(\nSynthDef.new(\\bazedrum,\n {\n arg out = 0, outlevel=0.5, freq = 50, wet=0.5, q = 220, clicklevel =0, decaytrig = 0.1,\n decayfreq = 0.21, mulfreq =2 , decayamp = 1, dist = 17;\n\n var envtrig, envfreq, envamp, trigger,click, sig;\n\n envtrig = EnvGen.ar(Env.perc(1/10**5, decaytrig, 1, -9));\n envfreq = EnvGen.kr(Env.perc(0.003, decayfreq, mulfreq, -5));\n envamp = EnvGen.kr(Env.perc(0.003, decayamp,1, 2),doneAction:2);\n freq = freq * (1 + envfreq);\n trigger = envtrig*HPF.ar(PinkNoise.ar,40)+(envtrig*2);\n click = HPF.ar(envtrig*WhiteNoise.ar,2000*(1-envtrig),clicklevel);\n sig = BPF.ar(trigger, freq,1/q, sqrt(q)*5);\n sig = sig + click;\n\n sig = LeakDC.ar(sig* envamp,0.996);\n\n sig = Balance2.ar(sig,(sig*dist).tanh/3,(wet*2)-1);\n\n sig = Mix.ar(sig/2)*outlevel;\n\n out = 0;\n Out.ar(out, sig!2);\n }\n ).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nPsloth {\n var seed, repeats;\n\n *new { arg seed, repeats=1;\n ^super.newCopyArgs(seed, repeats);\n }\n\n storeArgs{^[seed, repeats]}\n\n embedInStream { arg inval;\n var size=seed.size;\n var pointers=List[];\n repeats.value(inval).do({ arg j;\n j = j+1;\n if(j == j.nextPowerOf(size),{ pointers.add(0); });\n pointers.collect{|i| seed.at(i)}.sum.embedInStream(inval);\n pointers.do{|x, i|\n if((i==0) || (pointers[0..(i-1)].sum==0), {pointers[i] = ((x+1)%size);})\n };\n });\n ^inval\n }\n}\n```"}, {"role": "assistant", "content": "Save this as an extension and recompile class library. You can now use `Psloth([0,1,0], 10)`, for example, instead of declaring a new routine for each pattern.\r\n\r\nI didn't persist the use cases, as this should be saved as a `.sc` file. Please refer to the ancestor code for usage.\r\n\r\nMemory/CPU usage will grow over time, but at a decreasing rate. This can be used for a large amount of repeats. Exte."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ PinkNoise.ar(1) * Line.kr(1, 0, 2, doneAction: Done.freeSelf }.play.onFree { \"done\".postln };\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ PinkNoise.ar(1) * Line.kr(1, 0, 2, doneAction: Done.freeSelf) }.play.onFree { \"done\".postln };\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DelayL`."}, {"role": "assistant", "content": "```supercollider\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nDelayL.ar(z, 0.2, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\n(\n// recursive application of delay.\n{\nz = Decay2.ar(Dust.ar(1, 0.5), 0.01, 0.1, Saw.ar(100 + [0, 1]));\n5.do { |i| z = DelayL.ar(RLPF.ar(z, Rand(100, 3000), 0.03), 1, 1 / (2**i), 1, z * 0.5) };\nz\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Verschwende deine Jugend (bassline cover)?"}, {"role": "assistant", "content": "```supercollider\n/* An approach to try to reproduce the 'famous' bassline of \"Verschwende deine Jugend\" by D.A.F. */\n\nSynthDef(\\daf_bass,{ |out, freq=440, sustain=1, gate=1, amp=0.1|\n var snd, env, fenv, harm;\n \n harm = [1,1.01,2,2.02,3.5,4.01,5.501];\n harm = harm ++ (harm*2);\n \n snd = SinOsc.ar(freq*harm).sum.distort.squared * 6;\n snd = snd + SinOsc.ar(freq / [1, 2]).sum!2;\n\n fenv = EnvGen.kr(Env.adsr(0.075,0.05,0.1,0.25));\n\n snd = RLPF.ar(snd, fenv.range(freq*2, freq*8), 0.75, 2) + (snd * 0.25);\n env = EnvGen.kr(Env.adsr(0.001,0.2,0.9,0.25), gate, amp, doneAction:2);\n \n snd = LeakDC.ar(Limiter.ar(snd * env));\n OffsetOut.ar(out, (snd!2));\n}).add;\n\n// approx 65 bpm\nTempoClock.default.tempo = 65/60;\n\n// approx bass pattern + modulation of Verschwende Deine Jugend bassline\nPdef(\\daf_bass,\n PmonoArtic(\\daf_bass,\n \\scale, Scale.minor,\n \\octave, [3],\n \\root, 2,\n \\ctranspose,Pseq([\n Pn(0, 8*4),\n Pn(-5, 8*4)\n ], inf),\n \\degree, Pseq([7,7s,1,8,1,1,7,1]-1,inf),\n \\dur, 0.18\n )\n).play;\n\n// link: http://www.youtube.com/watch?v=KjqrnUBdLqY\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `TwoPole`."}, {"role": "assistant", "content": "```supercollider\n{ TwoPole.ar(WhiteNoise.ar(0.005), 2000, 0.95) }.play\n\n{ TwoPole.ar(WhiteNoise.ar(0.005), XLine.kr(800, 8000, 8), 0.95) }.play\n\n{ TwoPole.ar(WhiteNoise.ar(0.005), MouseX.kr(800, 8000, 1), 0.95) }.play\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SimpleNumber.sphHankel1` do?"}, {"role": "assistant", "content": "Returns the result of the spherical Hankel functions of the first"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `In`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n(\nSynthDef(\"help-PinkNoise\", { |out = 0|\n Out.ar(out, PinkNoise.ar(0.1))\n}).add;\n\nSynthDef(\"help-In\", { |out = 0, in = 0|\n var input;\n input = In.ar(in, 1);\n Out.ar(out, input);\n\n}).add;\n);\n\n// play noise on the right channel\nx = Synth(\"help-PinkNoise\", [\\out, 1]);\n\n// read the input and play it out on the left channel\nSynth.after(x, \"help-In\", [\\out, 0, \\in, 1]);\n```"}]} -{"conversations": [{"role": "user", "content": "What is `UnaryOpUGen`?"}, {"role": "assistant", "content": "UnaryOpUGen — Apply a unary operation to the values of an input ugen"}, {"role": "user", "content": "What does `UnaryOpUGen.new` do?"}, {"role": "assistant", "content": "return a new instance that applies the operator `selector` to the ugen `a`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na = WhiteNoise.ar; // a WhiteNoise\nb = a.squared; // a UnaryOpUGen.\nb.operator; // squared\n\n// sound example\n\n{ var a = LFSaw.ar(300).range(0, 2pi); a.sin * 0.1 }.play;\n\n// Plotting the \"abs\" unary operator (via the server):\n\n{ SinOsc.ar(300).abs }.plot\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for attempt at a Star Wars sound effect!?"}, {"role": "assistant", "content": "```supercollider\n(\n\n// bye fighter\n{\n\nvar whooshPitch, whooseVol, swish, swishPitch = 970, noise, output, timeScale = 1.5;\nvar trump, trumpPitch = 400, chain, buf;\nvar panning;\n\nwhooshPitch = EnvGen.kr(\n\n Env(\n [0.8, 1.0, 0.9, 0.7, 0.5, 0.3, 0.24, 0.12, 0.0],\n [0.08, 0.2, 0.15, 0.11, 0.08, 0.09, 0.06, 0.18],\n 2\n ),\n timeScale: 1.3 * timeScale\n \n).lag(0.2);\n\nwhooseVol = EnvGen.kr(\n\n Env(\n [0.0, 0.2, 0.7, 0.9, 1.0, 0.8, 0.6, 0.43, 0.22, 0.0],\n [0.4, 0.5, 0.2, 0.15, 0.17, 0.11, 0.1, 0.16, 0.28],\n 2\n ),\n timeScale: 0.9 * timeScale\n \n).lag(0.2, 1.5) * LFNoise1.kr(37.2, 0.2, 1).lag(0.2);\n\nnoise = Mix(CombC.ar(WhiteNoise.ar(0.2), 0.1, [whooshPitch.exprange(0.16, 0.00011), whooshPitch.exprange(0.19, 0.00013)], 0.09));\nnoise = noise + BrownNoise.ar(0.1);\n\nswishPitch = swishPitch * LFNoise0.kr(365, 0.2, 1);\nswishPitch = swishPitch * whooshPitch.range(0.8, 1.3);\nswish = Mix.fill(\n 3,\n {\n |i|\n SinOsc.ar(swishPitch + (i * whooshPitch.exprange(45, 1)), rrand(0.0, 1.0), 0.4);\n }\n);\ntrumpPitch = trumpPitch * whooshPitch.range(0.92, 1.08);\ntrump = Mix.fill(3, { |i| SinOscFB.ar(trumpPitch * LFNoise0.kr(28, 0.06, 1).lag(0.8) * (0.8 + (i * 0.05)), 1.2, 0.8) }) * 0.6;\ntrump = RHPF.ar(trump, whooshPitch.range(120, 335), 0.2);\nchain = FFT(LocalBuf(2048), trump);\nchain = PV_BinShift(chain, WhiteNoise.kr.range(0.96, 1.01), whooshPitch.range(24, 28)); \ntrump = IFFT(chain) * 0.2;\npanning = Line.kr(-0.7, 0.7, 3);\noutput = noise + swish + trump;\noutput = output * whooseVol;\n\nPan2.ar(output, panning, 1.0);\n}.play;\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Just experimental sketch of somewhere audio background."}, {"role": "assistant", "content": "```supercollider\n(\n{ \n Limiter.ar(\n GVerb.ar(\n ( \n BPF.ar(\n WhiteNoise.ar([0.07,0.07]) + Blip.ar([13,19], 200.rand, mul:0.5),\n SinOsc.kr(\n SinOsc.kr([1/108,1/109]).range(1/108, 1/13)\n ).exprange(10, 23000),\n PMOsc.kr(1/54,1/216, 3).range(0.1, 2)\n ) \n * \n SinOsc.ar(Array.rand(20, 1/216, 1), mul: Array.rand(20, 0.2, 1)).reshape(10,2)\n ).sum,\n roomsize:10,\n damping: PMOsc.kr(1/27, 1/108, 3).range(0.5, 1), \n drylevel: SinOsc.kr(1/9).range(0.1, 1)\n )\n +\n GVerb.ar(\n Pan2.ar(\n LPF.ar(\n DynKlank.ar(\n `[\n Array.rand(6, 600, 4000).collect({|freq|\n SinOsc.kr(1/108).range(freq/2,freq)\n }), \n nil, \n Array.rand(6, 1/108, 1/27).collect({|freq|\n SinOsc.kr(freq).range(1/108,1/3)\n })\n ],\n Limiter.ar(\n Dust.ar( SinOsc.kr(1/256).exprange(1/27, 3), TRand.kr(0.15, 0.25, Dust.kr(1/9))) \n + \n Impulse.ar( SinOsc.kr(1/108).exprange(1/54, 3), 0, TRand.kr(0.6, 0.8, Dust.kr(1/3)))\n )\n ),\n 1700,\n LFPar.kr(1/27).exprange(0.05, 0.2)\n ),\n SinOsc.kr(1/9).range(-0.2, 0.2)\n ),\n roomsize: 30,\n drylevel: 0.5\n )\n )\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "How should I check an answer you give me?"}, {"role": "assistant", "content": "Three quick checks, cheapest first. Does it evaluate without a syntax error — the post window points at the exact character. Does the node appear in `s.plotTree` — if yes, the problem is signal rather than lifecycle. Does it reach `Out.ar(0, ...)` with a non-zero amplitude and an open filter. If those three pass and it is still silent, the class's own help page will show the argument order you may have assumed wrong."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = {LFTri.ar(100+(1000*Maths2.ar(MouseX.kr, MouseY.kr, 0.2, 0, 1, MouseButton.kr(lag:0.001))[0]), 0, 0.1}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = {LFTri.ar(100+(1000*Maths2.ar(MouseX.kr, MouseY.kr, 0.2, 0, 1, MouseButton.kr(lag:0.001))[0]), 0, 0.1)}.play\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Pisano Periods are used to generate melodies."}, {"role": "assistant", "content": "```supercollider\n/*\nThe Fibonacci-sequence as controlsignal: melodies from Pisano Periods.\nBecause the sequence runs more or less exponentially, it seems best to assign the values to frequencies. \n*/\ns.boot;\nSynthDef( \\puls, {|freq=30, out|\n Out.ar(out,\n SinOsc.ar(freq, mul: 0.5*EnvGen.kr(Env.perc(0.01,0.75), doneAction: 2)),0)\n}).add;\n(\nm=3000; //max index, 5 minutes = 300 when dur=0.1\na=Array.newClear(m);//two arrays to store numbers from the Pisano Periods\nb=Array.newClear(m);\na.put(0,0); \na.put(1,1);\nd=2; //even divisor\ni=2; //index\nwhile ({i 1,\n {results = results.add([thisIndex, thisCount, thisValue])},\n );\n thisValue = val;\n thisIndex = i + 1;\n thisCount = 1;\n }\n )\n };\n if(thisCount > 1, {results = results.add([thisIndex, thisCount, thisValue])});\n results;\n}\n);\n\na = [1, 2, 1, 1, 1, 2, 1, 1];\nb = ~repeats.value(a);\n\na = [2, 3, 5, 5];\nb = ~repeats.value(a);\n```"}]} +{"conversations": [{"role": "user", "content": "What is `IdentityBag`?"}, {"role": "assistant", "content": "IdentityBag — A Bag according to identity"}, {"role": "user", "content": "What does `IdentityBag.add` do?"}, {"role": "assistant", "content": "Add anObject to the Bag. A Bag may contain multiple entries of the same object. `IdentityBag[1, 2, 3].add(4);`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nIdentityBag[1, 2, 3].add(4);\nIdentityBag[1, 2, 3].add(3);\nIdentityBag[\"abc\", \"def\", \"ghi\"].add(\"jkl\");\nIdentityBag[\"abc\", \"def\", \"ghi\"].add(\"def\");\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Rect.moveToPoint` do?"}, {"role": "assistant", "content": "Returns a new Rect whose upper left corner is moved to"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n//Chaos engine hum\n(\n{\n SinOsc.ar(10 + (50 * SinOsc.kr([50, 51], 0, SinOsc.kr(101, Saw.kr(0.12345, 678, 9), 0.2, 0.8), Pulse.kr([25, 25.5], 0.25, 0.125, -0.25))), 0, 0.5, 0);\n}.play();\n)\n```"}, {"role": "assistant", "content": "A deep binaural cycle reminiscent of the engine of a space ship."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// if NTMI.helloSnd is not already defined in startup file, do this:\nfork {\n NTMI.numChans.do { |i|\n { LFDNoise3.ar(\n XLine.kr(\n exprand(2000, 5000),\n exprand(2000, 20000),\n 0.25, doneAction: 2),\n 0.1\n )\n }.play(outbus: i);\n 0.25.wait;\n };\n}\n```"}, {"role": "assistant", "content": "if NTMI.helloSnd is not already defined in startup file, do this:."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `IEnvGen`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var env = Env([0, 0.6, 0.3, 1.0, 0], [0.1, 0.02, 0.4, 1.1], [\\lin, \\exp, -6, \\sin]);\n var envgen = IEnvGen.kr(env, MouseX.kr(0, env.times.sum));\n env.plot;\n SinOsc.ar(envgen * 500 + 440)\n}.play;\n);\n\n// index with an SinOsc ... mouse controls amplitude of SinOsc\n// use offset so negative values of SinOsc will map into the Env\n(\n{\n var sin = SinOsc.ar(440, 0, MouseX.kr(0, 1));\n // use offset so negative values of SinOsc will map into the Env\n var env = Env([-1, -0.7, 0.7, 1], [0.8666, 0.2666, 0.8668], \\lin, offset: -1.0);\n IEnvGen.ar(env, sin) * 0.1\n}.play;\n);\n\n// index with Amplitude of input, control freq of SinOsc (uses SoundIn)\n(\n{\n var point = Amplitude.ar(SoundIn.ar(0), 0.01, 0.2);\n // use offset so negative values of SinOsc will map into the Env\n var env = Env.xyc([[0, 330, \\exp], [0.5, 440, \\exp], [1.0, 1760]]);\n SinOsc.ar(IEnvGen.kr(env, point)) * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// Handy code for quick class demonstrations.\n// Comparing a few intervals - Just Intonation versus 12-tone Equal Tempered\n\n// Major third (just)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 60.midicps * 5/4], mul: 0.1) }).play\n// Major third (ET12)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 64.midicps], mul: 0.1) }).play;\n\n// Major second (just)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 60.midicps * 9/8], mul: 0.1) }).play\n// Major second (ET)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 62.midicps], mul: 0.1) }).play;\n\n// Perfect fifth (just)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 60.midicps * 3/2], mul: 0.1) }).play\n// Perfect fifth (ET)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 67.midicps], mul: 0.1) });\n```"}, {"role": "assistant", "content": "Simple handy code for quick class demonstrations. Hear and compare a few intervals in Just Intonation versus 12-tone Equal Tempered tuning."}]} +{"conversations": [{"role": "user", "content": "What does `SendReply.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Send an array of values from the server to all notified clients Arguments: trig — a non-positive to positive transition triggers a message.; cmdName — a string or symbol, as a message name.; values — array of ugens, or valid ugen inputs.; replyID — integer id (similar to SendTrig).."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// using timer to modulate sine frequency: the slower the trigger is the higher the frequency\n(\n{ var trig;\n trig = Impulse.kr(MouseX.kr(0.5, 20, 1));\n SinOsc.ar(Timer.kr(trig) * 500 + 500, 0, 0.2)\n}.play;\n)\n```"}, {"role": "assistant", "content": "using timer to modulate sine frequency: the slower the trigger is the higher the frequency (Timer: Returns time since last triggered.)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// increase phase multiplier\n{ FBSineL.ar(SampleRate.ir, 1, 0, XLine.kr(1, 2, 10), 0.1) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// increase phase multiplier\n{ FBSineL.ar(SampleRate.ir, 1, 0, XLine.kr(1, 2, 10), 0.1) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `Dbufwr` in SuperCollider briefly."}, {"role": "assistant", "content": "Dbufwr — Buffer write demand ugen Category: UGens > Buffer, UGens > Demand."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Convolution2L`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// one last example\n(\nb = Buffer.alloc(s, 512, 1);\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, true, true);\n);\n\n(\n{\n var input = SoundIn.ar(0);\n var framesize = 512;\n Convolution2L.ar(input, b, 0, framesize, 1, 0.5);\n}.play\n);\n\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `MassEditUChain.release` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: time — (describe argument here). Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "What model are you?"}, {"role": "assistant", "content": "I am sc-mind: a 198M MiniMind-3-MoE, eight layers, 768 wide, four experts with top-1 routing. I was trained from scratch on the SuperCollider documentation, class library and help pages, then fine-tuned on questions and answers about them."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SharedIn`."}, {"role": "assistant", "content": "```supercollider\n(\n// only works with the internal server\ns = Server.internal;\ns.boot;\n);\n\n(\nSynthDef(\"help-SharedIn1\", {\n Out.ar(0, SinOsc.ar(Lag.kr(SharedIn.kr(0, 1), 0.01), 0, 0.2));\n}).add;\nSynthDef(\"help-SharedIn2\", {\n Out.ar(1, SinOsc.ar(Lag.kr(SharedIn.kr(0, 1), 0.01, 1.5), 0, 0.2));\n}).add;\n);\n\n(\ns.setSharedControl(0, 300); // an initial value\ns.sendMsg(\\s_new, \"help-SharedIn1\", x = s.nextNodeID, 0, 1);\ns.sendMsg(\\s_new, \"help-SharedIn2\", y = s.nextNodeID, 0, 1);\n\nRoutine({\n 30.do({\n s.setSharedControl(0, 300 * (10.rand + 1));\n 0.2.wait;\n });\n s.sendMsg(\\n_free, x);\n s.sendMsg(\\n_free, y);\n}).play;\n);\n\n\ns.quit;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Pwhile` in SuperCollider?"}, {"role": "assistant", "content": "Pwhile — While a condition holds, repeatedly embed stream Repeatedly embed a Stream while the result of `func` is `true`. Category: Streams-Patterns-Events > Patterns > Language Control."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LinCongN`."}, {"role": "assistant", "content": "```supercollider\n// randomly modulate params\n(\n{ LinCongN.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(0.1, 0.5, 1.4),\n LFNoise2.kr(0.1, 0.1, 0.1),\n LFNoise2.kr(0.1)\n) * 0.2 }.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "A starting point to start experimenting with non-standard synthesis?"}, {"role": "assistant", "content": "SuperCollider forum — A starting point to start experimenting with non-standard synthesis?\n\nI while ago I did this noise cloud generator which might serve as inspiration. Other ideas: scramble signals with FFT tools, granular synthesis, FM-synthesis with extreme settings, like index-of-modulation = 4000.\n\n```supercollider\nSynthDef(\\clouds, {\n var num = 10;\n var dur = \\duration.kr(1/6);\n var sig = num.collect{\n var freq = Rand(30, 5000) * SinOsc.kr(LFNoise1.kr(dur).range(30, 1000), 0, LFNoise1.kr(dur)\n .range(0.01, 8)).midiratio;\n var sig = Select.ar(LFNoise0.kr(dur).range(0, 2).round,\n [SinOsc.ar(freq, 0, 0.3), Saw.ar(freq, 0.3), Pulse.ar(freq, 0, 0.3)]);\n var filtFreq = Rand(30, 1000) * LFNoise1.kr(dur).range(1.0, 5.0);\n var filt = Select.ar(LFNoise0.kr(dur).range(0, 2).round,\n [LPF.ar(sig, filtFreq), HPF.ar(sig, filtFreq), BPF.ar(sig, filtFreq)]\n );\n sig = CombL.ar(filt, 0.5, LFNoise1.kr(dur).range(0.02, 0.5), rrand(0.3, 2));\n sig\n };\n var env = Env.perc(\\atk.kr(0.02), \\rel.kr(6), 1, \\cur.kr(-4)).ar(2);\n sig = Splay.ar(sig); // nb! levelComp: true, so if removed signal will be extremely loud!\n sig = LPF.ar(sig, 2000);\n sig = FreeVerb2.ar(sig[0], sig[1], LFNoise1.kr(dur).range(0, 1.0), LFNoise1.kr(dur).range(0.2, 2));\n sig = sig * env * \\amp.kr(1);\n Out.ar(\\out.kr(0), sig)\n}).add;\n\nSynth(\\clouds, [\\atk, rrand(0.01, 2), \\rel, rrand(1, 6.0), \\duration, rrand(0.01, 1)])\n// run it several times, the outcome is highly random\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `ProxySpace`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\np = ProxySpace.new;\np.fadeTime = 2; // fadeTime specifies crossfade\np[\\out].play; // monitor an empty placeholder through hardware output\n// set its source\np[\\out] = { SinOsc.ar([350, 351.3], 0, 0.2) };\np[\\out] = { Pulse.ar([350, 351.3] / 4, 0.4) * 0.2 };\np[\\out] = Pbind(\\dur, 0.03, \\freq, Pbrown(0, 1, 0.1, inf).linexp(0, 1, 200, 350));\n\n// route one proxy through another:\np[\\out] = { Ringz.ar(p[\\in].ar, [350, 351.3] * 8, 0.2) * 4 };\np[\\in] = { Impulse.ar([5, 7]/2, [0, 0.5]) };\n\np.clear(3); // clear after 3 seconds\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ClipNoise`."}, {"role": "assistant", "content": "```supercollider\n{ ClipNoise.ar(0.2) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `UnaryOpUGen` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\na = WhiteNoise.ar; // a WhiteNoise\nb = a.squared; // a UnaryOpUGen.\nb.operator; // squared\n\n// sound example\n\n{ var a = LFSaw.ar(300).range(0, 2pi); a.sin * 0.1 }.play;\n\n// Plotting the \"abs\" unary operator (via the server):\n\n{ SinOsc.ar(300).abs }.plot\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PulseDivider`."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\"help-PulseDivider\", { |out = 0|\n var p, a, b;\n p = Impulse.ar(8);\n a = SinOsc.ar(1200, 0, Decay2.ar(p, 0.005, 0.1));\n b = SinOsc.ar(600, 0, Decay2.ar(PulseDivider.ar(p, 4), 0.005, 0.5));\n\n Out.ar(out, (a + b) * 0.4)\n}).play;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Platform`?"}, {"role": "assistant", "content": "Platform — handle cross-platform differencies"}, {"role": "user", "content": "What does `Platform.case` do?"}, {"role": "assistant", "content": "Perform actions depending on the current platform (name), just like Object:switch: `Platform.case(`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// start a server program from the cmdLine for testing\n~pid = unixCmd(Server.program + s.options.asOptionsString(57100));\n// kill just that server program by its pid:\nthisProcess.platform.killProcessByID(~pid);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\"help-LFNoise2\", { arg out=0;\n Out.ar(out,\n LFBrownNoise2.ar(1000, 1, MouseX.kr(0, 5), 0.25)\n )\n}).play;\n);\n\n//use as frequency control\n(\nSynthDef(\"help-LFNoise2\", { arg out=0;\n Out.ar(out,\n SinOsc.ar(\n LFBrownNoise2.kr(8.dup, 0.2, 0, 400, 450),\n 0, 0.2\n )\n )\n}).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\"help-LFNoise2\", { arg out=0;\n Out.ar(out,\n LFBrownNoise2.ar(1000, 1, MouseX.kr(0, 5), 0.25)\n )\n}).play;\n);\n\n//use as frequency control\n(\nSynthDef(\"help-LFNoise2\", { arg out=0;\n Out.ar(out,\n SinOsc.ar(\n LFBrownNoise2.kr(8.dup, 0.2, 0, 400, 450),\n 0, 0.2\n )\n )\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\nz = {\n BLowPass.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(10, 20000, \\exponential), // cutoff freq.\n MouseY.kr(0.0, 1.0, \\linear), // rq\n 0.5); // mul\n}.play\n;\nz.release;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\nz = {\n BLowPass.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(10, 20000, \\exponential), // cutoff freq.\n MouseY.kr(0.0, 1.0, \\linear), // rq\n 0.5); // mul\n}.play\n);\nz.release;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SCluster.getAmplitudes` do?"}, {"role": "assistant", "content": "read the amplitude control rate bus Returns: an array of floats (0.0 to 1.0)."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `NdefGui`."}, {"role": "assistant", "content": "```supercollider\n(\np = ProxySpace.push(s.boot);\n\nl = NdefGui(nil, 3).moveTo(10, 120);\nm = NdefGui(nil, 3).moveTo(10, 240);\nn = NdefGui(nil, 3).moveTo(10, 360);\no = NdefGui(nil, 3).moveTo(10, 480);\n\nSpec.add(\\dens, [0.1, 300, \\exp]);\n\n// make 3 kinds of proxies: using tilde/proxyspace, Ndef, and unnamed.\n~spacy = { |dens = 5| Formlet.ar(Dust.ar(dens ! 2), LFDNoise0.kr(20 ! 2).lag(0.1).linexp(-1, 1, 300, 5000), 0.003, 0.03) };\nNdef(\\ndeffy, { GrayNoise.ar(0.1 ! 2) });\nc = NodeProxy.audio.source_({ PinkNoise.ar(0.1 ! 2) });\n\n// put one in each editor\nl.object_(~spacy);\nm.object_(Ndef(\\ndeffy));\nn.object_(c);\n);\n// One should also be able to drag and drop text into the drag,\n// but this is also not working yet.\n( Ndef(\\a) )\n```"}]} +{"conversations": [{"role": "user", "content": "What does `TaskProxy.set` do?"}, {"role": "assistant", "content": "set arguments in the environment. If there is none, it is created and the routine pattern is"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\nMIDIClient.init;\nm = MIDIOut(0); // Linux users: MIDIOut(0, MIDIClient.destinations[0].uid)\n\n// Simplest way for sending \\note-type events to MIDI\n// define a Pattern of note-events:\na = Pbind(degree: Prand([1, 2, 3, [0, 5]], inf));\n\n// chain a \\midi-type event into the pattern and play it (see link\n```"}, {"role": "assistant", "content": "Simplest way for sending \\note-type events to MIDI define a Pattern of note-events: (MIDIOut: send MIDI messages)"}]} +{"conversations": [{"role": "user", "content": "What is `DictionaryEditorGui` in SuperCollider?"}, {"role": "assistant", "content": "DictionaryEditorGui — gui class Category: Libraries > crucial > GuiClasses."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ReplaceOut`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"ReplaceOutHelp\", { |out = 0, freq = 440|\n var source;\n source = SinOsc.ar(freq, 0, 0.1);\n\n // write to the bus, replacing previous contents\n ReplaceOut.ar(out, source);\n\n}).add;\n);\n\n// each Synth replaces the output of the previous one\nx = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 500]);\ny = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 600]);\nz = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 700]);\n\n// release them in reverse order; the older Synths are still there.\nz.free;\ny.free;\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.quit;\nf = { Group.new(s.defaultGroup); \"Other code can be evaluated too\".postln };\nServerTree.add(f);\ns.boot;\ns.queryAllNodes; // note the group within the default group\nServerTree.remove(f;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.quit;\nf = { Group.new(s.defaultGroup); \"Other code can be evaluated too\".postln };\nServerTree.add(f);\ns.boot;\ns.queryAllNodes; // note the group within the default group\nServerTree.remove(f);\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// \\b should thus take twice the value of \\a in each event:\np = Pbind(\\a, Pwhite(1, 10, inf), \\b, Pkey(\\a) * 2).asStream;\n\n\np.next(()) // for Pbind, must pass in a default event even if empty\n\n('a': 10, 'b': 20)\n('a': 2, 'b': 4)\n('a': 5, 'b': 10)\n('a': 4, 'b': 8)\n('a': 2, 'b': 4)\n\n// note: to check if a Pkey's result /equals/ another value,\n// be sure to use |==|\np = Pbind(\n \\a, Pseries(1, 1, inf),\n \\b, Pif(\n Pkey(\\a) == 2,\n \"equals 2\",\n \"nope\"\n )\n).asStream;\n\np.next(());\n// …\n```"}, {"role": "assistant", "content": "\\b should thus take twice the value of \\a in each event: note: to check if a Pkey's result /equals/ another value, (Pkey: access a key in an event stream)"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\delay;\n~description = \"Simple delay line\";\n~channelLayout = \\mono;\n~function = {|in = 0, del = 0.5|\n DelayC.ar(in, 2, del);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Ringz` that runs as it is."}, {"role": "assistant", "content": "```supercollider\na = NodeProxy(s);\na[0] = { |freq = 440, dt=0.1, rate=2| Ringz.ar(Impulse.ar(rate * [1, 1.2]), freq, dt)*0.1 };\na.play;\n(\na[1] = \\set -> Pbind(\n \\dur, Prand([1, 0.5], inf),\n \\freq, Pwhite(200.0, 1000, inf),\n \\rate, Pdup(4, Prand([1, 3, 6, 10], inf)),\n \\dt, Pwhite(0.01, 0.1, inf)\n)\n);\n// modify the source in the meanwhile:\na[0] = { |freq = 440, dt=0.1, rate=2| Ringz.ar(Dust.ar(rate * 10.dup), freq, dt)*0.1 };\n\na.nodeMap.postln; // the values are not set in the node map.\na.clear(3);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Psubdivide` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\na = Psubdivide(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,0,1,3,4,0], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n100.do({ x.next.postln });\n);\n\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Psubdivide(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n);\n\n\n(\na = Psubdivide(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,4,4,0,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `Bjorklund2` in SuperCollider briefly."}, {"role": "assistant", "content": "Bjorklund2 — Euclidean Algorithm for generating traditional musical rhythms After an algorithm by E. Bjorklund. See paper by Godfried Toussaint. Category: Collections."}]} +{"conversations": [{"role": "user", "content": "Explain `Dpoll` in SuperCollider briefly."}, {"role": "assistant", "content": "Dpoll — Print the current output value of a demand rate UGen Print the current output value of a demand rate UGen. Category: UGens > Demand, UGens > Info."}]} +{"conversations": [{"role": "user", "content": "What does `SimpleNumber.linexp` do? What arguments does it take?"}, {"role": "assistant", "content": "map the receiver from an assumed linear input range (inMin..inMax) to an exponential output range (outMin..outMax). The output range must not include zero. If the input exceeds the input range, the following behaviours are specified by the clip Arguments: inMin — assumed input minimum; inMax — assumed input maximum; outMin — output minimum; outMax — output maximum; clip — nil (don't clip) \\max (clip ceiling) \\min (clip floor) \\minmax (clip both - this is default).."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nx = {\n // A collection of different tones:\n var son = SinOsc.ar((100, 100.3 .. 110));\n var val = ArrayMax.ar(son).at(0);\n val = LeakDC.ar(val); // the operation tends to induce DC offset\n Pan2.ar(val)\n}.play\n;\nx.free\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nx = {\n // A collection of different tones:\n var son = SinOsc.ar((100, 100.3 .. 110));\n var val = ArrayMax.ar(son).at(0);\n val = LeakDC.ar(val); // the operation tends to induce DC offset\n Pan2.ar(val)\n}.play\n);\nx.free\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// For most cases the symmetric symplectic procedures with prefix 'sym' should be used (default 'sym2').\n// They deliver best results with regard to long-term stability, see links at top.\n// In case you suspect instability coming from numerics \n// you can take symplectic variants of higher order: \n// \\sym2, \\sym4, \\sym6, \\sym8, \\sym12, \\sym16, \\sym32, \\sym64.\n\n// Note that already a simple harmonic oscillator can fail with a standard procedure\n\n// This is decaying after a few seconds with classical Runge-Kutta 3rd order !\n// ATTENTION: with other non-symplectic procedures this can lead to immediate blow\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// For most cases the symmetric symplectic procedures with prefix 'sym' should be used (default 'sym2').\n// They deliver best results with regard to long-term stability, see links at top.\n// In case you suspect instability coming from numerics \n// you can take symplectic variants of higher order: \n// \\sym2, \\sym4, \\sym6, \\sym8, \\sym12, \\sym16, \\sym32, \\sym64.\n\n// Note that already a simple harmonic oscillator can fail with a standard procedure\n\n// This is decaying after a few seconds with classical Runge-Kutta 3rd order !\n// ATTENTION: with other non-symplectic procedures this can lead to immediate blowups !\n// Euler variants are especially bad.\n\n(\nFb1_ODEdef(\\harmonic, { |t, y|\n [y[1], y[0].neg]\n}, 0, [0, 1], 1, 1); \n);\n\n(\nx = {\n var sig = Fb1_ODE.ar(\\harmonic,\n tMul: 1000 * 2pi,\n intType: \\rk3\n );\n Limiter.ar(sig) * 0.1 * EnvGen.ar(Env.asr(0.1, curve: 3))\n}.play\n);\n\nx.release\n```"}]} +{"conversations": [{"role": "user", "content": "What does `RedAbstractMix.isReady` do?"}, {"role": "assistant", "content": "`true` after the server is booted and the internal mixer is added and"}]} +{"conversations": [{"role": "user", "content": "I get 'Buffer UGen: no buffer data'. What does it mean?"}, {"role": "assistant", "content": "The UGen got a bufnum that the server has no data for. `Buffer.read` is asynchronous: the Buffer object exists immediately but the samples arrive later, so a Synth created straight after `Buffer.read` reads nothing. Wait for it — `s.sync` after the read, or `Buffer.read(s, path, action: { |b| ... })` and create the Synth in the action. The other cause is a nil or wrong buffer: `PlayBuf.ar(1, ~buf)` where ~buf was never assigned passes 0, which is 'no buffer'."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Synth`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n// create a Synth at the head of the default Server's default group\n// based on the SynthDef \"default\"\nx = Synth.new(\"default\");\ns.queryAllNodes; // note the default group (ID 1)\nx.free;\n\n// Using an arrayed control\n// run this block first to make the SynthDef\n(\nSynthDef(\"help-synth\", { |freq = #[440, 450, 460], out = 0|\n Out.ar(out, Mix(SinOsc.ar(freq, 0, 0.1)));\n}).add;\n);\n\n// then this a short while later\nx = Synth(\"help-synth\", [freq: [500, 501, 510]]);\n\nx = Synth(\"help-synth\", [freq: [500, 501, 510]]);\nx.set(\\freq, [1, 2, 3] * 400 + [1, 2, 3], \\out, 1);\nx.set(\\freq, [3] * 400 + [1, 2, 3], \\out, 1);\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What is the difference between an audio bus and a control bus?"}, {"role": "assistant", "content": "Both are numbered channels on the server used to move signal between nodes. An audio bus carries audio-rate signal and holds one or more audio channels; a control bus carries one value per block, like a parameter. You write with Out.ar / Out.kr and read with In.ar / In.kr, or with `.asMap` / `\\param, bus.asMap` to drive a Synth's control from a bus. Buses are how effects are chained: a synth writes to a private bus, the effect reads it and writes to Out.ar(0, …)."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n///////////////////// channel offset/object index /////////////////////\n\n\na = NodeProxy.audio(s, 2);\na.play;\na[0] = { Ringz.ar(Impulse.ar(5, 0, 0.1), 1260) };\na.put(1, { Ringz.ar(Impulse.ar(5.3, 0, 0.1), 420) }, 1);\na.put(0, { Ringz.ar(Dust.ar([1, 1]*15.3, 0.1), 720) }, 1);\na.put(1, { Ringz.ar(Impulse.ar(5.3, 0, 0.1), 420) }, 1;\na.end;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n///////////////////// channel offset/object index /////////////////////\n\n\na = NodeProxy.audio(s, 2);\na.play;\na[0] = { Ringz.ar(Impulse.ar(5, 0, 0.1), 1260) };\na.put(1, { Ringz.ar(Impulse.ar(5.3, 0, 0.1), 420) }, 1);\na.put(0, { Ringz.ar(Dust.ar([1, 1]*15.3, 0.1), 720) }, 1);\na.put(1, { Ringz.ar(Impulse.ar(5.3, 0, 0.1), 420) }, 1);\na.end;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `MultiSliderView.fillColor` do? What arguments does it take?"}, {"role": "assistant", "content": "The color used to visualize the areas described in Arguments: A Color.."}]} +{"conversations": [{"role": "user", "content": "What is `Platform`?"}, {"role": "assistant", "content": "Platform — handle cross-platform differencies"}, {"role": "user", "content": "What does `Platform.case` do?"}, {"role": "assistant", "content": "Perform actions depending on the current platform (name), just like Object:switch: `Platform.case(`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// start a server program from the cmdLine for testing\n~pid = unixCmd(Server.program + s.options.asOptionsString(57100));\n// kill just that server program by its pid:\nthisProcess.platform.killProcessByID(~pid);\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nMIDIIn.connectAll;\n// MIDIClient.init;\n\n\n(\n// A SynthDef with ADSR envelope\nSynthDef(\"quick2\", {arg freq = 440, amp = 0.1, gate = 1;\n var snd, env;\n env = Env.adsr(0.01, 0.1, 0.3, 2, amp).kr(2, gate);\n snd = Saw.ar(freq: [freq, freq*1.5], mul: env);\n Out.ar(0, snd)\n}).add;\n);\n\n// Play it with a MIDI keyboard\n(\nvar noteArray = Array.newClear(128); // array has one slot per possible MIDI note\n\nMIDIdef.noteOn(\\myKeyDown, {arg vel, note;\n noteArray[note] = Synth(\"quick2\", [\\freq, note.midicps, \\amp, vel.linlin(0, 127, 0, 1)]);\n [\"NOTE ON\", note].postln;\n});\n\nMIDIdef.noteOff(\\myKeyUp, {arg vel, note;\n noteArray[note].set(\\gate, 0);\n [\"NOTE OFF\", note].postln;\n});\n)\n// PS. Make sure SC MIDI connections are made (MIDIIn.connectAll)\n```"}, {"role": "assistant", "content": "Basic example - how to use a MIDI keyboard with a simple synth."}]} +{"conversations": [{"role": "user", "content": "What does `Pdef.removeAll` do?"}, {"role": "assistant", "content": "Remove all proxies from the global dictionary"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\ns.boot; // start the server\n\n// something to record\n(\nSynthDef(\"bubbles\", { |out|\n var f, sound;\n f = LFSaw.kr(0.4, 0, 24, LFSaw.kr([8, 7.23], 0, 3, 80)).midicps; // glissando function\n sound = CombN.ar(SinOsc.ar(f, 0, 0.04), 0.2, 0.2, 4); // echoing sine wave\n Out.ar(out, sound);\n}).add;\n);\n\nx = Synth.new(\"bubbles\");\n\ns.prepareForRecord; // if you want to start recording at a precise moment in time, you have to call this first.\n\ns.record;\n\ns.pauseRecording; // pausable\n\ns.record\n// …\n```"}, {"role": "assistant", "content": "something to record look in your recordings folder and you'll find a file named for this date and time (Server: Object representing a server application)"}]} +{"conversations": [{"role": "user", "content": "Write a bell in SuperCollider."}, {"role": "assistant", "content": "A bell is a set of inharmonic partials with a long percussive decay. The ratios below are the\nclassic bell ones; the envelope frees the Synth when it ends.\n\n```supercollider\n(\nSynthDef(\\bell, { |out = 0, freq = 440, amp = 0.2, dur = 3|\n var partials = [1, 2.76, 5.4, 8.93];\n var amps = [1, 0.5, 0.3, 0.15];\n var sig = SinOsc.ar(freq * partials) * amps;\n var env = EnvGen.kr(Env.perc(0.001, dur, 1, -6), doneAction: 2);\n Out.ar(out, Pan2.ar(Mix(sig) * env * amp, 0));\n}).add;\n);\nSynth(\\bell, [\\freq, 660, \\dur, 4]);\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for get different result each time running the pattern: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\nTempoClock.default.tempo = 156/60;\n\n(\nSynthDef(\\spring, { |freq = 400, out = 0, pan = 0, gate = 1, dur = 0.15, curve = -4, amp = 1, index = 1|\n var sig = FreeVerb.ar(Pan2.ar(Blip.ar(freq, index), pan));\n var env = EnvGen.ar(Env.perc(0.01, dur, amp, curve), gate, doneAction:2);\n Out.ar(0, sig * env);\n}).add;\n);\n\n(\nPbind(*[\n instrument: \\spring,\n dur: Pseq([4, 1, 2, 1, 1, 1].scramble/ 4 / TempoClock.default.tempo, inf),\n degree: Pseq(#[1,2,3,4], inf) * Pkey(\\dur).reciprocal,\n octave: Pseq([2,3,4,4,4,3].scramble, inf),\n pan: Pxrand(Array.fill(100, { 0.gaussian(1).clip2(1) }), inf),\n amp: Pseq(#[0.95,1,0.8],inf),\n index: Pstutter(Pseq(#[4,8,12],inf), Pseq([2,3,4,5,6,8].scramble, inf))\n]).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `HilbertWRe` in SuperCollider?"}, {"role": "assistant", "content": "HilbertWRe — Applies the Real part of the Hilbert Transform to an input signal. [1] Offers the Hilbert Transform of an input signal via Weaver's Third Method. footWeaver, Donald. “A Third Method of Generation and Detection of Single-Sideband Signals.” Proceedings of the IRE, vol. 44, no. 12, 1956, pp. 1703–1705. Category: Libraries > Hilbert > Pseudo-UGens, UGens > Filters > Nonlinear."}]} +{"conversations": [{"role": "user", "content": "What does `PlayerInputProxy.setNodeControl` do? What arguments does it take?"}, {"role": "assistant", "content": "placeholder for Patch inputs for a player that will be supplied later Arguments: nc."}]} +{"conversations": [{"role": "user", "content": "Explain `Fhn2DL` in SuperCollider briefly."}, {"role": "assistant", "content": "Fhn2DL — FitzHughNagumo Neuron Firing Oscillator `du/dt= rateu*(u-0.3333*u^3 - w)` Category: UGens > Generators > Stochastic."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n var mod = SinOsc.ar([0.1,0.15,0.2]).range(0,1);\n var saw = LFSaw.ar([10,12,15]);\n var out = (saw - ((saw>0)*mod)+(mod*0.5));\n Splay.ar(out)*0.4;\n}.play;\n\n{\n var mod = SinOsc.ar([0.1,0.15,0.2]).range(0,1);\n var saw = SinOsc.ar(LFSaw.ar([10,12,15]).range(200,300));\n var out = (saw - ((saw>0)*mod)+(mod*0.5));\n Splay.ar(out)*0.4;\n}.play\n)\n```"}, {"role": "assistant", "content": "Made with code from Jonatan Liljedahl and Glen Fraser. Based on the Korg Z1 sawtooth oscilator."}]} +{"conversations": [{"role": "user", "content": "Why LeakDC and not a standard HPF for DC removal?"}, {"role": "assistant", "content": "SuperCollider forum — Why LeakDC and not a standard HPF for DC removal?\n\nHello everyone,\n\nI’m a bit sceptical of the DC removal implementation in LeakDC. As I understand it, DC removal is nothing but a HPF, preferably placed below the audible range. For this purpose, LeakDC seems to be reaching far too high, attenuating the audible low frequencies. You can run the following code and look at the server meter to see the difference in level between the two audio channels (note: there is of course no DC offset in this example that would need fixing):\n\n```supercollider\n( play { [\n SinOsc.ar(50),\n LeakDC.ar(SinOsc.ar(50))\n] * 0.2 } )\n```\n\nAlso, LeakDC’s behaviour is not consistent between sample rates (as is mentioned in the help file).\n\nI ran the it through Plugin Doctor to back up my suspicions and got these results:\n\nstandard coefficient of 0.995:\n\nSR 48 kHz: Filter starts rolling off at 200 Hz, -2dB at 50 Hz.\n\nSR 96 kHz: Filter starts rolling off at 500 hz! It reaches already -2dB at 100 Hz, -5 dB at 50 Hz.\n\ncoefficient of 0.999:\n\nSR 48 kHz: Filter starts rolling off at 50 Hz, -2 dB at 10 Hz.\n\nSR 96 kHz: Filter starts rolling off at 100 Hz, -2 dB at 20 Hz.\n\nI wonder why one wouldn’t just use a standard HPF at 10 Hz (or so) instead? It is consistent between sample rates, it only starts to roll of below 30 Hz and it reaches only -0.5 dB at 20 Hz. So this actually looks much better in the server meter:\n\n```supercollider\n( play { [\n SinOsc.ar(50),\n HPF.ar(SinOsc.ar(50), 10)\n] * 0.2 } )\n```\n\nSo my question is: Is there any reason why the LeakDC implementation would be peferable to such a standard butterworth HPF?\n\nOne difference I can see is that the HPF still has an initial offset spike before settling around zero phase, LeakDC does not show that behaviour:\n\n```supercollider\n{ LeakDC.ar(DC.ar(0.5)) }.plot(0.5);\n{ HPF.ar(DC.ar(0.5), 10) }.plot(0.5);\n\n{ LeakDC.ar(SinOsc.ar + DC.ar(0.5)) }.plot(0.02);\n{ HPF.ar(SinOsc.ar + DC.ar(0.5), 10) }.plot(0.02);\n```\n\nSo this could be a reason – I don’t know enough about filters to understand why this happens though. Any enlightenment would be appreciated."}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for some pattern exprimenting: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\brumm, { |dur = 1, pan = 2, freq = 40, index = 20|\n var sig = Pan2.ar(\n Blip.ar(freq, index),\n pan\n ) * EnvGen.ar(Env.perc(0.01, dur), doneAction: 2);\n Out.ar(0, sig);\n}).add;\n);\n\n(\nPbind(*[\n dur: Pseq([1.2, 0.2, 0.5, Pseries(0.1, -0.001, 100)], inf),\n pan: Pxrand(#[-0.5, 0.5, 0.1, -0.1, 0.8, -1], inf),\n freq: 40,\n instrument: \\brumm\n]).play();\n);\n\n(\nPbind(*[\n dur: Pseq([1.2, 0.2, 0.5, Pseries(0.1, -0.001, 100)], inf),\n pan: Pxrand(#[-0.5, 0.5, 0.1, -0.1, 0.8, -1], inf),\n freq: Pseq([Pseries(140, 0.5, 200)], inf),\n instrument: \\brumm\n]).play;\n);\n\n(\nPbind(*[\n dur: Pseq(Signal.chebyFill(1024, Array.rand(10, 0.0, 10.0)).abs + 0.05, inf),\n pan: Pxrand(#[-0.5, 0.5, 0.1, -0.1, 0.8, -1], inf),\n freq: Pseq(Signal.chebyFill(1024, Array.rand(10, 0.0, 10.0)).abs * 18000 + 120, inf),\n instrument: \\brumm\n]).play;\n);\n\n\n(\nPbind(*[\n dur: Pseq([1.2, 0.2, 0.5, Pseries(0.1, -0.002, 50)], inf),\n pan: Pxrand(#[-0.5, 0.5, 0.1, -0.1, 0.8, -1, 1, -0.8], inf),\n freq: Pseq([Pseries(740, 0.5, 200), Pxrand(Array.series(740, 0.5, 200), 50)], inf),\n instrument: \\brumm\n]).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\smooth, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.linen(0.05, sustain, 0.1), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n)\n```"}, {"role": "assistant", "content": "plays an arpeggio on the \"left hand\" and an arpeggio on the \"right hand\"."}]} +{"conversations": [{"role": "user", "content": "What does `GlitchBPF.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "backward compatibility Arguments: in — The input signal.; freq — Centre frequency in Hertz.; rq — The reciprocal of Q. Q is conventionally defined as cutoffFreq / bandwidth, meaning rq = (bandwidth / cutoffFreq).; mul — Output will be multiplied by this value.; add — This value will be added to the output.."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SinOsc`."}, {"role": "assistant", "content": "```supercollider\n// create an audio-rate sine wave at 200 Hz,\n// starting with phase 0 and an amplitude of 0.5\n{ SinOsc.ar(200, 0, 0.5) }.play;\n\n// modulate the frequency with an exponential ramp\n{ SinOsc.ar(XLine.kr(2000, 200), 0, 0.5) }.play;\n\n// more complex frequency modulation\n{ SinOsc.ar(SinOsc.ar(XLine.kr(1, 1000, 9), 0, 200, 800), 0, 0.25) }.play;\n\n// phase modulation (see also PMOsc)\n{ SinOsc.ar(800, SinOsc.ar(XLine.kr(1, 1000, 9), 0, 2pi), 0.25) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Mx.extendChannels` do? What arguments does it take?"}, {"role": "assistant", "content": "A mixer and dynamic patching Arguments: toSize."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Warp1`."}, {"role": "assistant", "content": "```supercollider\n(\nb.free;\nb = Buffer.read(s, ExampleFiles.apollo11);\n{\n var pointer = Phasor.ar(0, SampleDur.ir / BufDur.ir(b) * XLine.kr(1, 0.25, 20));\n var sound = Warp1.ar(1, b, pointer, 1, 0.3, -1, 16, Line.kr(0, 1, 40), 4);\n Pan2.ar(sound, pointer * 2 - 1, 0.25)\n}.play\n);\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LinCongL`."}, {"role": "assistant", "content": "```supercollider\n// randomly modulate params\n(\n{ LinCongL.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(0.1, 0.5, 1.4),\n LFNoise2.kr(0.1, 0.1, 0.1),\n LFNoise2.kr(0.1)\n) * 0.2 }.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `SyncSaw` that runs as it is."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n(\n// send a synth def to server\nSynthDef(\"tpulse\", { arg out=0,freq=700,sawFreq=440.0;\n Out.ar(out, SyncSaw.ar(freq, sawFreq,0.1) )\n}).send(s);\n);\n\n// all OSC commands generated in the function contained below will be added to a bundle\n// and executed simultaneously after 2 seconds.\n(\ns.makeBundle(2.0, {\n x = Synth.new(\"tpulse\");\n a = Bus.control.set(440);\n x.map(\\freq, a);\n});\n);\nx.free;\n\n// don't send\n(\nb = s.makeBundle(false, {\n x = { PinkNoise.ar(0.1) * In.kr(0, 1); }.play;\n});\n);\n// now pass b as a pre-existing bundle, and start both synths synchronously\n(\ns.makeBundle(nil, { // nil executes ASAP\n y = { SinOsc.kr(0.2).abs }.play(x, 0, 0, \\addBefore); // sine envelope\n}, b);\n);\nx.free; y.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `IEnvGen`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var env = Env([0, 0.6, 0.3, 1.0, 0], [0.1, 0.02, 0.4, 1.1], [\\lin, \\exp, -6, \\sin]);\n var envgen = IEnvGen.kr(env, MouseX.kr(0, env.times.sum));\n env.plot;\n SinOsc.ar(envgen * 500 + 440)\n}.play;\n);\n\n// index with an SinOsc ... mouse controls amplitude of SinOsc\n// use offset so negative values of SinOsc will map into the Env\n(\n{\n var sin = SinOsc.ar(440, 0, MouseX.kr(0, 1));\n // use offset so negative values of SinOsc will map into the Env\n var env = Env([-1, -0.7, 0.7, 1], [0.8666, 0.2666, 0.8668], \\lin, offset: -1.0);\n IEnvGen.ar(env, sin) * 0.1\n}.play;\n);\n\n// index with Amplitude of input, control freq of SinOsc (uses SoundIn)\n(\n{\n var point = Amplitude.ar(SoundIn.ar(0), 0.01, 0.2);\n // use offset so negative values of SinOsc will map into the Env\n var env = Env.xyc([[0, 330, \\exp], [0.5, 440, \\exp], [1.0, 1760]]);\n SinOsc.ar(IEnvGen.kr(env, point)) * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Kepler 22-b atmosphere. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\nfork { \n Ndef(\\ttwnd).play;//(d,2,addAction:\\addToHead);\n loop {\n var seed = thisThread.randSeed = 100000000.rand.debug('seed');\n Ndef(\\ttwnd, {\n var freq = [20, 7500];\n Splay.ar(\n { \n var bands = 2.rrand(10);\n var sig = { [BPF,RLPF,RHPF].choose.ar(\n LFNoise2.ar(freq[0].rrand(freq[1]), LFNoise2.kr(0.1.exprand(10))),\n Array.rand(bands, freq[0], freq[1]),\n Array.rand(bands, 0.2, 1.8)\n ).mean } ! 2;\n Rotate2.ar(sig[0], sig[1], LFSaw.kr(0.1.exprand(10)));\n } ! 4.rrand(6).debug('source'),\n 0.5.rrand(1)\n );\n }).fadeTime_(1.rrand(4.0));\n 10.0.rrand(40).debug('wait(bts)').wait;\n }\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = NodeProxy(s);\na.play;\na.source = { Pulse.ar(130, Saw.kr(0.3) * 0.1 }; // change this line while running\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = NodeProxy(s);\na.play;\na.source = { Pulse.ar(130, Saw.kr(0.3)) * 0.1 }; // change this line while running\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Pan2` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\ns.bind {\n SynthDef(\"tpulse2\", { arg out=0, freq=700, sawFreq=440.0;\n Out.ar(out, Pan2.ar(SyncSaw.ar(freq, sawFreq, 0.1), SinOsc.kr(8)) )\n }).send(s);\n s.sync; // wait until synthdef is loaded\n x = Synth.new(\"tpulse2\");\n a = Bus.control.set(440);\n x.map(\\freq, a);\n};\n);\n\na.free; x.free;\n```"}]} +{"conversations": [{"role": "user", "content": "How do I distort a signal?"}, {"role": "assistant", "content": "Drive it into a nonlinearity, then tame the level: `tanh` is soft clipping, `.distort` is harder,\nand a low-pass after the drive keeps it from getting fizzy.\n\n```supercollider\n(\n{\n var sig = SinOsc.ar(110) * 0.3;\n var driven = (sig * 12).tanh;\n LPF.ar(driven, 5000) * 0.4\n}.play;\n)\n```\n\nMore drive means more harmonics; because they are generated, the output is louder as well as brighter, so\nscale the result down after the nonlinearity."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for SOUND 1, from orig Influx Example. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// SOUND 1, from orig Influx Example\n(\nNdef(\\dog).addSpec(\\intv, [-24, 24]);\nNdef(\\dog).addSpec(\\timescale, [0.01, 10, \\exp]);\nNdef(\\dog).addSpec(\\curve, [-10, 10]);\nNdef(\\dog).addSpec(\\ffreq, \\freq);\n\nNdef(\\dog).addSpec(\\loopnode, [0, 12]);\nNdef(\\dog).addSpec(\\dens, [10, 1000]);\nNdef(\\dog).addSpec(\\resfreq, \\freq);\nNdef(\\dog).addSpec(\\ringtime, [0.01, 1, \\exp]);\n\nNdef(\\dog, { |amp=0, freq=250, intv=19, timescale=1, curve=0, loopnode=0, dens = 10, resfreq = 500, ringtime = 0.01|\n var n = 15;\n var env = EnvGen.kr(\n Env({ 1.0.rand2 }!(n+1), {1.0.rand}!n, curve, releaseNode: n-1, loopNode: loopnode.min(n-3)),\n timeScale: timescale);\n var pitch = (env * [1, 0.33, -1] * intv).midiratio * freq;\n var form = Formant.ar(pitch, pitch.rotate(1) * 1.6, pitch.rotate(2) * 2.6);\n\n var dusty = Ringz.ar(\n Dust.ar(dens!3),\n (resfreq * LFNoise0.kr([3, 5, 7], 0.5, 1)).lag(0.3),\n ringtime)\n * ((dens ** -0.5) * (ringtime ** -0.3)\n );\n\n Splay.ar(form * dusty, level: amp * 4) ;\n});\n);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `LFNoise1`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\nb = Bus.control(s, 1);\n\na = {\n var freq;\n freq = LFNoise1.kr(2, 600, 800);\n Out.kr(b, freq); // no need for Impulse here\n SinOsc.ar(freq, 0, 0.3) ! 2\n}.play;\n\nl = List.new;\nr = fork { loop { l.add(b.getSynchronous); 0.1.wait } };\n\nr.stop;\na.free;\n\nl.array.plot; // to view the results graphically\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `NamedControl`."}, {"role": "assistant", "content": "```supercollider\n// multiple usage of the same name:\na = { SinOsc.ar(\\freq.kr(440, 1.0)) + Saw.ar(\\freq.kr(440, 1.0) * 0.5) * 0.1 }.play;\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n\n// with different lag values:\na = { SinOsc.ar(\\freq.kr(440).lag(3.5)) + Saw.ar(\\freq.kr(440).lag(0.05) * 0.5) * 0.1 }.play;\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n\n// control saved to a variable:\n(\na = {\n var freq = \\freq.kr(440);\n SinOsc.ar(freq.lag(3.5)) + Saw.ar(freq.lag(0.05) * 0.5) * 0.1;\n}.play;\n);\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n```"}]} +{"conversations": [{"role": "user", "content": "How do I see what a signal is doing?"}, {"role": "assistant", "content": "`.poll` prints values to the post window — `SinOsc.kr(1).poll` prints once per control block, and `.poll(10)` limits it to every 10th. `s.scope` opens an oscilloscope on the main output, and `.scope` on a UGen shows just that signal. For a numeric snapshot of many signals at once, `s.meter` shows the output levels, and `\".dump\".postln` style probes are common while debugging."}]} +{"conversations": [{"role": "user", "content": "What does `SimpleNumber.gammaQInv` do?"}, {"role": "assistant", "content": "Returns a value x such that `q = gamma_q(a, x)`. Requires `a` > 0 and 1 >= `p,q` >="}]} +{"conversations": [{"role": "user", "content": "What does `ServerLogGui.coloredDef` do? What arguments does it take?"}, {"role": "assistant", "content": "the interface for display and searching the ServerLog Arguments: defName; r. Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// as a frequency control\n{ SinOsc.ar(StandardN.ar(40, MouseX.kr(0.9, 4))*800+900)*0.4 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// as a frequency control\n{ SinOsc.ar(StandardN.ar(40, MouseX.kr(0.9, 4))*800+900)*0.4 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n\n// definition for future reference in arbitrary Environments,\n// Cauchy distribution is not bounded, so do clip !\n\n(\np = Pbind(\n \\midinote, PLcauchy(\\mean, \\spread).clip(60, 90),\n \\dur, 0.1\n);\n);\n\n// prepare current Environment\n\n(\n~mean = 75;\n~spread = 0.1;\n);\n\n\n// run\n\nx = p.play;\n\n\n// move mean value and distribution\n// PLseq defaults to repeats = inf\n\n(\n~mean = PLseq((80, 79.7..70));\n~spread = PLseq([0,\n// …\n```"}, {"role": "assistant", "content": "definition for future reference in arbitrary Environments, Cauchy distribution is not bounded, so do clip ! (PLcauchy: dynamic scope Pcauchy variant)"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `FoldIndex`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// indexing into a table\n(\n{\n var buf = LocalBuf.newFrom([200, 300, 400, 500, 600, 800]);\n var freq = FoldIndex.kr(buf, MouseX.kr(0, BufFrames.ir(buf) * 3));\n SinOsc.ar(freq) * 0.1\n}.play;\n);\n\n// the same using a global buffer\n(\nt = [200, 300, 400, 500, 600, 800];\nb = Buffer(s, t.size, 1);\n\n// alloc and set the values\ns.listSendMsg(b.allocMsg(b.setnMsg(0, t)).postln);\n\nSynthDef(\\help_Index, { |out = 0, bufnum = 0|\n Out.ar(out,\n SinOsc.ar(\n FoldIndex.kr(\n bufnum,\n MouseX.kr(0, BufFrames.ir(bufnum) * 3)\n ),\n 0,\n 0.5\n )\n )\n}).play(s, [\\bufnum, b.bufnum]);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Event` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\pm, { |out = 0, freq = 440, amp = 0.1, pan = 0, gate = 1, ratio = 1, index = 1, ar = 0.1, dr = 0.1|\n var z;\n z = LPF.ar(\n PMOsc.ar(freq, freq * ratio, Linen.kr(gate, ar, index, dr), 0, 0.3),\n XLine.kr(Rand(4000, 5000), Rand(2500, 3200), 1)\n ) * Linen.kr(gate, 0.01, 0.7, dr, 2);\n OffsetOut.ar(out, Pan2.ar(z, pan, amp));\n}).add;\n);\n\n(instrument: \\pm).play;\n\n(instrument: \\pm, ratio: 3.42, index: 12, freq: 150, ar: 8, dr: 3, sustain: 10).play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// start a server program from the cmdLine for testing\n~pid = unixCmd(Server.program + s.options.asOptionsString(57100));\n// kill just that server program by its pid:\nthisProcess.platform.killProcessByID(~pid);\n```"}, {"role": "assistant", "content": "start a server program from the cmdLine for testing kill just that server program by its pid: (Platform: handle cross-platform differencies)"}]} +{"conversations": [{"role": "user", "content": "Interfacing SC with external software: MIDI or OSC?"}, {"role": "assistant", "content": "SuperCollider forum — Interfacing SC with external software: MIDI or OSC?\n\nI found this partial solution on sccode.org :\n\n```supercollider\n // declare an event type which sends OSC commands to Renoise\n\n(\nEvent.addEventType(\\renoise, { |server|\n var renoiseOscServer = NetAddr(\"127.0.0.1\", 8000);\n var notes = [~midinote.value, ~ctranspose.value, ~velocity.value, ~sustain.value, ~lag.value, ~timingOffset.value, ~instr.value, ~track.value].flop;\n var timeNoteOn, timeNoteOff, instrument, track, velocity;\n var serverLatency;\n\n serverLatency = server.latency ? 0;\n\n notes.do {|note|\n instrument = note[6] ? -1;\n track = note[7] ? -1;\n velocity = note[2].asInt.clip(0,127);\n\n // sustain and timingOffset are in beats, lag is in seconds\n timeNoteOn = (thisThread.clock.tempo.reciprocal*note[5])+note[4]+server.latency;\n timeNoteOff = (thisThread.clock.tempo.reciprocal*(note[3]+note[5]))+note[4]+server.latency;\n SystemClock.sched(timeNoteOn, {renoiseOscServer.sendMsg(\"/renoise/trigger/note_on\", instrument.asInt, track.asInt, (note[0]+note[1]).asInt, velocity )});\n SystemClock.sched(timeNoteOff, {renoiseOscServer.sendMsg(\"/renoise/trigger/note_off\", instrument.asInt, track.asInt, (note[0]+note[1]).asInt)});\n }\n});\n);\n\n// Now start Renoise OSC server, load a sample, and try some patterns\n\n// straight timing\n(\nPbind(*[\n type: \\renoise,\n legato: Pgauss(0.2,0.05,inf),\n dur: 0.2,\n degree: [2,5,12],\n track: Prand([0,1], inf),\n ctranspose: Pseq([0,0,0,0,4,4,4,4,5,5,5,5],inf),\n velocity: Pgauss(64,10,inf),\n]).play;\n)\n```\n\nhttp://sccode.org/1-4SN\n\nBut what I couldn’t find there was a simple syntax for sending Note Events or Midi Events as OSC messages... Do I really need to re-implement the whole SC’s defaultParentEvent as new OSC Event to send it using regular pattern’s syntax?"}]} +{"conversations": [{"role": "user", "content": "What does `LID.slot` do? What arguments does it take?"}, {"role": "assistant", "content": "Access a slot by its evtType and evtCode. See also Arguments: evtType — The eventType to access the slot.; evtCode — The eventCode to access the slot.."}]} +{"conversations": [{"role": "user", "content": "What does `ArrayedCollection.asRandomTable` do?"}, {"role": "assistant", "content": "Return an integral table that can be used to generate random numbers with a specified distribution. (see Randomness helpfile for a more detailed example)"}]} {"conversations": [{"role": "user", "content": "I get 'index out of range' when playing a buffer."}, {"role": "assistant", "content": "A read position is past the end of the buffer. `PlayBuf` with a `startPos` in frames beyond `~buf.numFrames`, or a `BufRd`/`GrainBuf` whose phase goes above 1, produces this. For GrainBuf, pos is normalised 0..1, so pass `LFNoise1.kr(1).range(0, 1)` rather than a frame count; for PlayBuf, cap the position at `~buf.numFrames - 1`. If you just loaded the file, check `~buf.numFrames` — a failed read gives 0 frames and every position is out of range."}]} -{"conversations": [{"role": "user", "content": "What is `UniqueID` in SuperCollider?"}, {"role": "assistant", "content": "UniqueID — source for unique numbers Category: Core."}]} -{"conversations": [{"role": "user", "content": "What does `KeyCodeResponder.value` do? What arguments does it take?"}, {"role": "assistant", "content": "register responder functions for keycode and modifier combinations Arguments: view; keycode; modifier; unicode."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n/* Audio plugin definition\n\n Each audio plugin should define the following global variables:\n ~name: (symbol) name of the spatializer\n ~description: (string) a short description\n ~function: the actual definition of the plugin\n\n*/\n\n~name = \\MonoIn;\n~description = \"A direct input\";\n~channelLayout = \\mono;\n\n~function = {\n |gate = 0, bus = 0, attack = 0.02, susL = 0.9, release = 0.1, curve = -4|\n var env = Env.asr(attack, susL, release, curve);\n SoundIn.ar(bus, EnvGen.kr(env, gate));\n}\n```"}, {"role": "assistant", "content": "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see ."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Bus`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\nb = Bus(\\audio, 0, 2);\ns.bind {\n SynthDef(\\sinPerc, { |out = 0|\n var signal = SinOsc.ar * Env.sine(0.1).ar(gate: Impulse.ar(2));\n OffsetOut.ar(out, signal ! 2) }\n ).add;\n s.sync;\n Synth(\\sinPerc, [\\out, b]);\n b.plot(1);\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, gate = 1|\n var env;\n env = EnvGen.kr(Env.asr(0.001, 1, 0.2), gate, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain, \\freq, 440);\nb = Pmul(\\freq, Pseq([1, 2, 3, 4, 5, 6, 7], inf), a);\nb.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, gate = 1|\n var env;\n env = EnvGen.kr(Env.asr(0.001, 1, 0.2), gate, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain, \\freq, 440);\nb = Pmul(\\freq, Pseq([1, 2, 3, 4, 5, 6, 7], inf), a);\nb.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for sound of an alien weapon firing. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"raygun\", {arg amp = 0.5, sinfreq = 1000, glissf = 0.001, att = 0.01, rel = 0.9;\n var gliss = XLine.kr(sinfreq, sinfreq*glissf, rel);\n var snd = SinOsc.ar(gliss);\n var env = EnvGen.kr(Env.perc(att, rel), doneAction: 2);\n snd = snd * env * amp;\n Out.ar(0, snd);\n}).add;\n);\n\n(\nPbind(\n \\instrument, \"raygun\",\n \\dur, Pseq([0.75,0.75,0.75,0.75,0.25,0.25,0.25]*0.5, inf),\n \\amp, 0.4\n).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns.waitForBoot({\n var fftsize = 16384;\n b = Buffer.alloc(s, fftsize)\n})\n);\n\n\n(\nx = {\n // Any input should theoretically be OK, white noise is a good choice\n var son = WhiteNoise.ar;\n// var son = Impulse.ar;\n var out = LPF.ar(son, MouseX.kr(100, 10000, 1));\n var fft1 = FFT(LocalBuf(b.numFrames), son, wintype: 1);\n var fft2 = FFT(b, out, wintype: 1);\n\n // As with most PV_ ugens, the result is *actually* stored in the first fft buf\n var result = PV_Div(fft2, fft1\n// …\n```"}, {"role": "assistant", "content": "Any input should theoretically be OK, white noise is a good choice var son = Impulse.ar; (PV_Div: Complex division)"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `BusPlug` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\ns.boot;\nz = Bus.control(s, 16);\nz.setn({ |i| (i * 5).nthPrime } ! 16 * 5 + 100);\na = BusPlug.for(z);\n{ Splay.ar(SinOsc.ar(a.kr(3, MouseX.kr(0, 25)))) * 0.1 }.play; // selectively play 3 channel of the 16, modulate offset\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// Pseq returns one item in the list after the other\n(\nPseq([\n (note: 2, sustain: 1, dur: 1.5),\n (note: [5, 7], sustain: 0.5, dur: 0.8),\n (note: [2, 6], sustain: 1, dur: 0.8)\n]).play;\n);\n\n// Pbind binds parameters to events:\n(\nPbind(\n \\note, Pseq([2, [5, 7], [2, 6]]),\n \\sustain, Pseq([1, 0.5, 1]),\n \\dur, Pseq([1.5, 0.8, 0.8])\n).play;\n);\n\n// per-event timing may be specified:\n(\nPbind(\n \\note, Pseq([[0, 9], [5, 7], [2, 6]], inf),\n \\s\n// …\n```"}, {"role": "assistant", "content": "Pseq returns one item in the list after the other Pbind binds parameters to events: (Event: an environment that represents an action)"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `BufRd` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n// indexing with a phasor\n{ BufRd.ar(1, b, Phasor.ar(0, BufRateScale.kr(b), 0, BufFrames.kr(b))) }.play;\n\n// indexing by hand\n{ BufRd.ar(1, b, K2A.ar(MouseX.kr(0, BufFrames.kr(b)))) }.play;\n\nb.free\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Resonz`."}, {"role": "assistant", "content": "```supercollider\n{ Resonz.ar(WhiteNoise.ar(0.5), 2000, 0.1) }.play\n\n// modulate frequency\n{ Resonz.ar(WhiteNoise.ar(0.5), XLine.kr(1000, 8000, 10), 0.05) }.play\n\n// modulate bandwidth\n{ Resonz.ar(WhiteNoise.ar(0.5), 2000, XLine.kr(1, 0.001, 8)) }.play\n\n// modulate bandwidth opposite direction\n{ Resonz.ar(WhiteNoise.ar(0.5), 2000, XLine.kr(0.001, 1, 8)) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Blip.ar(Blip.kr(4, 5, 500, 60), 59, 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Blip.ar(Blip.kr(4, 5, 500, 60), 59, 0.1) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `ArraySpec.size` do?"}, {"role": "assistant", "content": "datatype specifying an array with an itemSpec which describes its items"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Re: the perfect frequencies. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// Rumush\n// https://mycelialcordsblog.wordpress.com/\n// https://fungorumush.bandcamp.com/releases\n// https://soundcloud.com/fungorum\n\n(\nf = {\n var rep = [4, 8, 16, 32];\n var n = rep.choose;\n var x = [\n\n 54, 60, 66, 72, 81, 90, 96, 102,\n 108, 128, 132, 144, 162, 180, 192, 204,\n 216, 240, 264, 288, 324, 360, 384, 408,\n 432, 480, 528, 576, 648, 720, 768, 816,\n 864, 960, 1056, 1152, 1296, 1440, 1536, 1632,\n 1728, 1920, 2112, 2304, 2592, 2880, 3072, 3264,\n 3456, 3840, 4224, 4608, 5184, 5760, 6144, 6528,\n 6912, 7680, 8448, 9216, 10368, 11520, 12288, 528\n\n ];\n Mix.fill(n,\n {\n var detune = 5.rand;\n var sin = SinOsc.ar(x.choose, 4.rand, 0.25);\n var saw = RLPF.ar(Saw.ar(x.choose*0.01+detune, 0.75), x.choose, 2.rand).tanh;\n Pan2.ar((sin+saw) * EnvGen.kr(Env.sine(12, 1/n), 1, doneAction:2),\n 1.rand2) }\n );\n};\n);\n\n(\n// DEFINE A ROUTINE\nr = Routine({\n\n inf.do({\n f.play;\n 10.wait;\n })\n});\n);\n\nr.reset.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `MultiSplineFr.removeDimension` do? What arguments does it take?"}, {"role": "assistant", "content": "Multi dimensional spline frame rate device Arguments: di."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `UGen`."}, {"role": "assistant", "content": "```supercollider\n{ Blip.ar(Blip.kr(4, 5, 500, 60), 59, 0.1) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `BufWr` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\n// allocate a buffer for writinig into\ns = Server.local;\ns.sendMsg(\"/b_alloc\", 0, 44100 * 2);\n);\n\n\n// write into the buffer with a BufWr\n(\ny = { |rate = 1|\n var in;\n in = SinOsc.ar(LFNoise1.kr(2, 300, 400), 0, 0.1);\n BufWr.ar(in, 0, Phasor.ar(0, BufRateScale.kr(0) * rate, 0, BufFrames.kr(0)));\n 0.0 // quiet\n}.play;\n);\n\n// read it with a BufRd\n(\nx = { |rate = 1|\n BufRd.ar(1, 0, Phasor.ar(0, BufRateScale.kr(0) * rate, 0, BufFrames.kr(0)))\n}.play(s);\n);\n\n\n\nx.set(\\rate, 5);\ny.set(\\rate, 2.0.rand);\nx.set(\\rate, 2);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// hear the difference, LinPan having a slight drop in the middle...\n{ LinPan2.ar(SinOsc.ar(440), Line.kr(-1, 1, 5)) }.play\n\n// ... whereas Pan2 is more smooth\n{ Pan2.ar(SinOsc.ar(440), Line.kr(-1, 1, 5)) }.play\n\n// other examples\n{ Pan2.ar(PinkNoise.ar(0.4), FSinOsc.kr(2), 0.3 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// hear the difference, LinPan having a slight drop in the middle...\n{ LinPan2.ar(SinOsc.ar(440), Line.kr(-1, 1, 5)) }.play\n\n// ... whereas Pan2 is more smooth\n{ Pan2.ar(SinOsc.ar(440), Line.kr(-1, 1, 5)) }.play\n\n// other examples\n{ Pan2.ar(PinkNoise.ar(0.4), FSinOsc.kr(2), 0.3) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `AbstractFunction`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\na = { |x| #[440, 720, 801, 1020.2].at(x) }; b = a.cpsmidi; [a.value(3), b.value(3)];\na = Pseries(220, 220, inf).cpsmidi; a.asStream.nextN(12); // overtone series as midinotes\n// follow but round to next midinote\n{ a = Pitch.kr(SoundIn.ar).at(1); Pulse.ar(a.cpsmidi.round.midicps) * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n(\np = Pbind(\n \\instrument, \\synth_1a,\n \\preAmp, PL(\\preAmp), \n \\amp, PL(\\amp), \n \\midinote, PLseq(\\seq) + PL(\\seqAdd), \n \\dur, 0.2\n);\n\n~spec = 4.collect { |i| [\\seq, [12*i + 24, 12*i + 48, \\lin, 1, 24*i + 36] ! 5, \n \\seqAdd, [0, 12, \\lin, 1, 0],\n \\amp, [0, 0.15, \\lin, 0.01, 0.07 - (0.01 * i)],\n \\preAmp, [5, 50, \\lin, 0.01, 20]] };\n);\n\n// run all players in sync by passing a quant arg\n\nv = VarG\n// …\n```"}, {"role": "assistant", "content": "run all players in sync by passing a quant arg EventStreamPlayers derived from Pbind are run in (VarGui: slider / player gui to set envir variables and synth controllers and play synths, event patterns and tasks)"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LinCongN`."}, {"role": "assistant", "content": "```supercollider\n// default initial params\n{ LinCongN.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = {LFTri.ar(50+(1000*Maths.ar(10, 10, 0.5, 1)[0]), 0, 0.1)}.play //notice how I am taking the [0]th channel of the Maths and ignoring the [1st channel.\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = {LFTri.ar(50+(1000*Maths.ar(10, 10, 0.5, 1)[0]), 0, 0.1)}.play //notice how I am taking the [0]th channel of the Maths and ignoring the [1]st channel.\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Sieve.sect_i` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new Sieve object in mode 'intervals', generated by the intersection of sets of Arguments: ... data — Generators and an optional integer limit, wrapped into a Ref, which is included when reached. Allowed generators: Integers, Streams or Patterns producing intervals or Sieves itself. Integers and Stream/Pattern output must be strictly positive. Integers as generators produce constant intervals. If no."}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for some kick drums i wrote back in january: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\kick1, {\n var snd;\n snd = DC.ar(0);\n snd = snd + (SinOsc.ar(XLine.ar(800, 400, 0.01)) * Env.perc(0.0005, 0.01).ar);\n snd = snd + (BPF.ar(Hasher.ar(Sweep.ar), XLine.ar(800, 100, 0.01), 0.6) * Env.perc(0.001, 0.02).delay(0.001).ar);\n snd = snd + (SinOsc.ar(XLine.ar(172, 50, 0.01)) * Env.perc(0.0001, 0.3, 1, \\lin).delay(0.005).ar(2));\n snd = snd.tanh;\n Out.ar(\\out.kr(0), Pan2.ar(snd, \\pan.kr(0), \\amp.kr(0.1)));\n}).add;\n);\n\nSynth(\\kick1, [amp: 0.4]);\n\n(\nSynthDef(\\kick2, {\n var snd;\n snd = DC.ar(0);\n snd = snd + (HPF.ar(Hasher.ar(Sweep.ar), 1320) * Env.perc(0.003, 0.03).ar * 0.5);\n snd = snd + (SinOsc.ar(XLine.ar(750, 161, 0.02)) * Env.perc(0.0005, 0.02).ar);\n snd = snd + (SinOsc.ar(XLine.ar(167, 52, 0.04)) * Env.perc(0.0005, 0.3).ar(2));\n snd = snd.tanh;\n Out.ar(\\out.kr(0), Pan2.ar(snd, \\pan.kr(0), \\amp.kr(0.1)));\n}).add;\n);\n\nSynth(\\kick2, [amp: 0.4]);\n\n(\nSynthDef(\\kick3, {\n var snd;\n snd = DC.ar(0);\n snd = snd + (SinOsc.ar(XLine.ar(1500, 800, 0.01)) * Env.perc(0.0005, 0.01, curve: \\lin).ar);\n snd = snd + (BPF.ar(Impulse.ar(0) * SampleRate.ir / 48000, 6100, 1.0) * 3.dbamp);\n snd = snd + (BPF.ar(Hasher.ar(Sweep.ar), 300, 0.9) * Env.perc(0.001, 0.02).ar);\n snd = snd + (SinOsc.ar(XLine.ar(472, 60, 0.045)) * Env.perc(0.0001, 0.3, curve: \\lin).delay(0.005).ar(2));\n snd = snd.tanh;\n Out.ar(\\out.kr(0), Pan2.ar(snd, \\pan.kr(0), \\amp.kr(0.1)));\n}).add;\n);\n\nSynth(\\kick3, [amp: 0.4]);\n\n\n/*\ncontributors so far: nathan ho\n\ni use Hasher.ar(Sweep.ar) as a quick way to generate deterministic white noise, so i can get exactly the same kick each time for a precise digital sampler effect. you are free to replace it with WhiteNoise.ar.\n\nthe DC.ar(0) does nothing, it's just so i can reorder all the \"snd = snd +\" lines and/or comment out parts of the synth.\n\nsome of the attacks are so fast that Env:kr doesn't correctly handle them. that's why i always use Env:ar, so i don't have to think about ar/kr when i'm messing with sharp envelope attacks. i'm sure many of them could be refactored to kr for CPU, but idc\n*/\n```"}]} +{"conversations": [{"role": "user", "content": "What does `UnicodeResponder.remove` do?"}, {"role": "assistant", "content": "register responder functions for unicode and modifier combinations"}]} +{"conversations": [{"role": "user", "content": "Explain `Ptuple` in SuperCollider briefly."}, {"role": "assistant", "content": "Ptuple — combine a list of streams to a stream of lists At each iteration, Ptuple returns a tuple (array) combining the output of each of the patterns in the list. When any of the patterns returns a nil, Ptuple ends that 'repeat' and restarts all of the streams. Category: Streams-Patterns-Events > Patterns > List."}]} +{"conversations": [{"role": "user", "content": "Explain `TDuty` in SuperCollider briefly."}, {"role": "assistant", "content": "TDuty — Demand results as trigger from demand rate UGens. A value is demanded each UGen in the list and output as a trigger according to a stream of duration values. The unit generators in the list should be 'demand' rate. Category: UGens > Demand."}]} +{"conversations": [{"role": "user", "content": "What does `Prout.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Returns a routine from the Arguments: routineFunc — routine function.."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Pwrap` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Pn(\n Pwrap(\n Pgeom(200, 1.07, 96),\n 200,\n 1000.0\n ),\n inf\n);\nx = a.asStream;\n\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, x.next.debug, \\dur, 0.3]);\n 0.12.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `MIDIFuncSrcMessageMatcher` in SuperCollider?"}, {"role": "assistant", "content": "MIDIFuncSrcMessageMatcher — Matches incoming MIDI messages to responder funcs based on message source This is used by MIDIMessageDispatcher to match incoming MIDI messages to instances of MIDIFunc or MIDIdef using message source. This class is private, and generally users should not need to address instances directly. Category: External Control > MIDI > Matchers."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\nb= Buffer.read(s,\"sounds/break\",20000,10000);\n\n//gradual erosion\n(\nSynthDef(\"help-sortbuf\",{arg bufnum;\nOut.ar(0,\nPan2.ar( \nSortBuf.ar(bufnum,LFNoise0.kr(5,50000,60000),0)\n,0.0))\n}).play(s,[\\bufnum, b.bufnum]);\n);\n\nc= Buffer.read(s,\"sounds/break\",20000,10000);\nc.copy(b); //restore buffer\n\n\n//short 2000 sample buffer sorted over about 10 seconds\nb= Buffer.read(s,\"sounds/break\",20000,2000);\n{SortBuf.ar(b.buf\n// …\n```"}, {"role": "assistant", "content": "short 2000 sample buffer sorted over about 10 seconds , MouseY.kr(200,4000),0.1) (SortBuf: Karplus-Strong via a sorting algorithm)"}]} +{"conversations": [{"role": "user", "content": "What does `AmpCompA.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Basic psychoacoustic amplitude compensation (ANSI A-weighting curve). Arguments: freq — Input frequency value. For freq == root, the output is rootAmp.; root — Root freq relative to which the curve is calculated (usually lowest freq). Non-modulatable.; minAmp — Amplitude at the minimum point of the curve (around 2512 Hz). Non-modulatable.; rootAmp — Amplitude at the root frequency. Non-modulatable.."}]} +{"conversations": [{"role": "user", "content": "What is the difference between a Synth and a SynthDef?"}, {"role": "assistant", "content": "A SynthDef is a definition: a compiled UGen graph with named controls, registered on the server once. A Synth is one running instance of that definition. You create the definition with `SynthDef(\\bell, { |freq = 440| ... }).add` and then instances with `Synth(\\bell, [\\freq, 660])`. Defining the same SynthDef twice replaces it for future instances; already running Synths keep the old graph until they are freed."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n//MUST be a buffer with data in format [sizeofcurrentsieve,sieveentry1,sieveentry2,...] where currentsize always less than initially allocated buffer length -1. \n\n{ Sieve1.ar(LocalBuf.newFrom([10]++({0.75.rand}!10)),MouseX.kr(2,100))*0.2}.play\n\n{ Sieve1.ar(LocalBuf.newFrom([88]++({[0.1.rand,0.5.rand].wchoose([0.8,0.2])}!88)),MouseX.kr(1,100))*0.2}.play\n\nb = Buffer.alloc(s,300); \n\nb.setn(0, [88]++({[0.1.rand,0.5.rand]\n// …\n```"}, {"role": "assistant", "content": "MUST be a buffer with data in format [sizeofcurrentsieve,sieveentry1,sieveentry2,...] where currentsize always less than initially allocated buffer length -1. dynamically swap buffer (Sieve1: Fuzzy sieve based synthesis)"}]} +{"conversations": [{"role": "user", "content": "What is `NodeMap`?"}, {"role": "assistant", "content": "NodeMap — store control values and bus mappings"}, {"role": "user", "content": "What does `NodeMap.map` do?"}, {"role": "assistant", "content": "map arguments of a node (synonymous with `set`, mapping is done automatically when a suitable argument is passed)."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n(\nSynthDef(\"modsine\",\n { |out, freq = 320, amp = 0.2|\n Out.ar(out, SinOsc.ar(freq, 0, amp));\n }).add;\nSynthDef(\"lfo\",\n { |out, rate = 2|\n Out.kr(out, LFPulse.kr(rate, 0, 0.1, 0.2))\n }).add;\n);\n\n// start nodes\n(\nb = Bus.control(s, 1);\nx = Synth(\"modsine\");\ny = Synth.before(x, \"lfo\", [\\out, b]);\n);\n\n// create some node maps\n(\nh = NodeMap.new;\nh.set(\\freq, 800);\nh.map(\\amp, b);\n\nk = NodeMap.new;\nk.set(\\freq, 400);\nk.unmap(\\amp);\n);\n\n// apply the maps\n\nh.sendToNode(x); // the first time a new bundle is made\nk.sendToNode(x);\n\nh.sendToNode(x); // the second time the cache is used\nk.sendToNode(x);\n\nh.set(\\freq, 600);\n\nh.sendToNode(x); // when a value was changed, a new bundle is made\n\n// free all\nx.free; b.free; y.free;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// start a noise patch and set the id of the generator\n(\nSynthDef(\"help-RandID\", { |out = 0, id = 1|\n RandID.ir(id);\n Out.ar(out,\n WhiteNoise.ar(0.05) + Dust2.ar(70)\n )\n}).add;\n);\n\n// reset the seed of my rgen at a variable rate\n(\nSynthDef(\"help-RandSeed\", { |seed = 1910, id = 1|\n RandID.kr(id);\n RandSeed.kr(Impulse.kr(FSinOsc.kr(0.2, 0, 10, 11)), seed);\n}).add;\n\n);\n\n// start two noise synths on left and right channel with a different randgen id\na = Synth(\"help-RandID\", [\\\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// start a noise patch and set the id of the generator\n(\nSynthDef(\"help-RandID\", { |out = 0, id = 1|\n RandID.ir(id);\n Out.ar(out,\n WhiteNoise.ar(0.05) + Dust2.ar(70)\n )\n}).add;\n);\n\n// reset the seed of my rgen at a variable rate\n(\nSynthDef(\"help-RandSeed\", { |seed = 1910, id = 1|\n RandID.kr(id);\n RandSeed.kr(Impulse.kr(FSinOsc.kr(0.2, 0, 10, 11)), seed);\n}).add;\n\n);\n\n// start two noise synths on left and right channel with a different randgen id\na = Synth(\"help-RandID\", [\\out, 0, \\id, 1]);\nb = Synth(\"help-RandID\", [\\out, 1, \\id, 2]);\n\n// reset the seed of randgen 1\nx = Synth(\"help-RandSeed\", [\\id, 1]);\n\n// change the target randgen to 2 (affects right channel)\nx.set(\\id, 2);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `AbstractPlayerProxy.socketStatus` do?"}, {"role": "assistant", "content": "base class for players that act as proxies for another player"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pause`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\nSynthDef(\\a, { Out.ar(0, SinOsc.ar(800, 0, 0.2)) }).add;\n\nSynthDef(\\b, { |gate = 1| Out.ar(1, PinkNoise.ar(0.3)); Pause.kr(gate, 1001) }).add;\n\ns.sendMsg(\\s_new, \\a, 1001, 0, 0);\n\ns.sendMsg(\\s_new, \\b, 1002, 0, 0);\n\ns.sendMsg(\\n_set, 1002, \\gate, 0);\n\ns.sendMsg(\\n_set, 1002, \\gate, 1);\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n var saw, bpf;\n saw = Pulse.ar(\n freq: [100,150],\n mul: LFPulse.kr(\n freq: [0, 0.03, 0.04],\n width: 0.15));\n bpf = LPF.ar(in: saw, freq: SinOsc.kr(-10, -5, 3).range(200, 400));\n Out.ar(0, bpf);\n}.play;\n)\n```"}, {"role": "assistant", "content": "//Pulse is the UGen. There is multichannel expansion due to the lists in the freqs. The range is a big part of the reason this sounds so deep."}]} +{"conversations": [{"role": "user", "content": "What is SuperCollider?"}, {"role": "assistant", "content": "SuperCollider is a platform for audio synthesis and algorithmic composition, written in C++ and SuperCollider. It splits into a language client (sclang) that runs your code and builds UGen graphs, and an audio server (scsynth) that does the DSP in real time. They talk over OSC."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `EnvGen`."}, {"role": "assistant", "content": "```supercollider\n// as amplitude envelope\n(\n{\n var env = Env([0, 1, 0.5, 1, 0], [0.01, 0.5, 0.02, 0.5]);\n SinOsc.ar(470) * EnvGen.kr(env, doneAction: Done.freeSelf)\n}.play\n);\n\n// as amplitude and modulation envelope\n(\n{\n var env = Env([0, 1, 0.5, 0.8, 0, 1.2, 0], [0.01, 0.5, 0.02, 0.5, 0.2, 0.5]);\n var gate = Impulse.kr(MouseX.kr(0.2, 3), 0.5);\n var gen = EnvGen.kr(env, gate);\n SinOsc.ar(270, SinOsc.ar(gen * 473)) * gen * 0.2\n}.play\n);\n// EnvGen multichannel expands when passed a multichannel envelope\n(\n{\n SinOsc.ar(\n EnvGen.kr(\n Env.circle([0, 1, 0, (2..4), 0, LFNoise1.kr(0.1 ! 5) * 10, 0], [0.01, 0.6])\n )\n * 240 + 300\n ).sum * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `MAbstractElement.action` do?"}, {"role": "assistant", "content": "Get and set the action to evaluate when element is"}]} +{"conversations": [{"role": "user", "content": "What is `Main`?"}, {"role": "assistant", "content": "Main — The concrete instance of Process"}, {"role": "user", "content": "What does `Main.thisProcess` do?"}, {"role": "assistant", "content": "The singleton instance of Main is available through the special keyword thisProcess. For example, to find out what platform you're on: `thisProcess.platform; // --> e.g. \"an OSXPlatform\", \"a Linux`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nShutDown.add({ \"Good bye!!\".postln });\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n \n// definition for future reference in arbitrary Environments\n\np = PLwhite(\\lo, \\hi);\n\n\n// prepare current Environment\n// PLseq repeats defaults to inf\n\n(\n~lo = PLseq((60..70));\n~hi = PLseq((62..72));\n);\n\n\n// run\n\n(\nx = Pbind(\n \\midinote, p, \n \\dur, 0.1 \n).play;\n);\n\n\n// replace, converging bounds, stops when ~lo ends (Pseq default repeats = 1)\n\n(\n~lo = Pseq((60..80) ++ (80!5));\n~hi = 8\n// …\n```"}, {"role": "assistant", "content": "definition for future reference in arbitrary Environments prepare current Environment (PLwhite: dynamic scope Pwhite variant)"}]} +{"conversations": [{"role": "user", "content": "What does `RedHuffman.pad` do?"}, {"role": "assistant", "content": "Semi-private counter for number of padded zeros. Set by #*binaryStringToBytes and read by"}]} +{"conversations": [{"role": "user", "content": "What does `PlayerSocket.name` do?"}, {"role": "assistant", "content": "a player that can play other players using a cross-faded and fuse-protected socket"}]} +{"conversations": [{"role": "user", "content": "What is SuperCollider?"}, {"role": "assistant", "content": "SuperCollider is a platform for audio synthesis and algorithmic composition, written in C++ and SuperCollider. It splits into a language client (sclang) that runs your code and builds UGen graphs, and an audio server (scsynth) that does the DSP in real time. They talk over OSC."}]} +{"conversations": [{"role": "user", "content": "List of exit codes?"}, {"role": "assistant", "content": "SuperCollider forum — List of exit codes?\n\n7068696c:\n\n```supercollider\no = s.options;\no.inDevice = nil;\no.outDevice = \"ASIO : ASIO4ALL\";\n```\n\nHmmmm... In earlier SC versions, it wouldn’t have worked to have a nil input device in scsynth either (which is admittedly a problem for devices with no inputs). This was fixed in scsynth but it’s possible that it wasn’t fully fixed in supernova.\n\n@MarcinP – any thoughts about this? (I remember you worked on scsynth device selection but I don’t recall who ported that to supernova.)\n\nhjh"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n//MUST be a buffer with data in format [sizeofcurrentsieve,sieveentry1,sieveentry2,...] where currentsize always less than initially allocated buffer length -1. \n\n{ Sieve1.ar(LocalBuf.newFrom([10]++({0.75.rand}!10)),MouseX.kr(2,100))*0.2}.play\n\n{ Sieve1.ar(LocalBuf.newFrom([88]++({[0.1.rand,0.5.rand].wchoose([0.8,0.2])}!88)),MouseX.kr(1,100))*0.2}.play\n\nb = Buffer.alloc(s,300); \n\nb.setn(0, [88]++({[0.1.rand,0.5.rand]\n// …\n```"}, {"role": "assistant", "content": "MUST be a buffer with data in format [sizeofcurrentsieve,sieveentry1,sieveentry2,...] where currentsize always less than initially allocated buffer length -1. dynamically swap buffer (Sieve1: Fuzzy sieve based synthesis)"}]} +{"conversations": [{"role": "user", "content": "What does `BezierSpline.fromPoints` do? What arguments does it take?"}, {"role": "assistant", "content": "An alternate Arguments: points — The points for each segment.; controlPoints — Optional, defaulting to no controlPoints. An array of controlPoints arrays, one controlPoint array for each segment. It is of size one less than the number of points, as each controlPoint array is inbetween each point. controlPoint arrays may have 0 or more controlPoints. controlPoints should be of ; isClosed — if the spline loops back to the first point. Returns: a BezierSpline"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `BufWr` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\n// allocate a buffer for writinig into\ns = Server.local;\ns.sendMsg(\"/b_alloc\", 0, 44100 * 2);\n);\n\n\n// write into the buffer with a BufWr\n(\ny = { |rate = 1|\n var in;\n in = SinOsc.ar(LFNoise1.kr(2, 300, 400), 0, 0.1);\n BufWr.ar(in, 0, Phasor.ar(0, BufRateScale.kr(0) * rate, 0, BufFrames.kr(0)));\n 0.0 // quiet\n}.play;\n);\n\n// read it with a BufRd\n(\nx = { |rate = 1|\n BufRd.ar(1, 0, Phasor.ar(0, BufRateScale.kr(0) * rate, 0, BufFrames.kr(0)))\n}.play(s);\n);\n\n\n\nx.set(\\rate, 5);\ny.set(\\rate, 2.0.rand);\nx.set(\\rate, 2);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `UScoreEditor.unpackSelectedFolders` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: events — (describe argument here). Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// create an audio-rate sine wave at 200 Hz,\n// starting with phase 0 and an amplitude of 0.5\n{ SinOsc.ar(200, 0, 0.5) }.play;\n\n// modulate the frequency with an exponential ramp\n{ SinOsc.ar(XLine.kr(2000, 200), 0, 0.5) }.play;\n\n// more complex frequency modulation\n{ SinOsc.ar(SinOsc.ar(XLine.kr(1, 1000, 9), 0, 200, 800), 0, 0.25) }.play;\n\n// phase modulation (see also PMOsc)\n{ SinOsc.ar(800, SinOsc.ar(XLine.kr(1, 1000, 9), 0, 2pi), 0.25 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// create an audio-rate sine wave at 200 Hz,\n// starting with phase 0 and an amplitude of 0.5\n{ SinOsc.ar(200, 0, 0.5) }.play;\n\n// modulate the frequency with an exponential ramp\n{ SinOsc.ar(XLine.kr(2000, 200), 0, 0.5) }.play;\n\n// more complex frequency modulation\n{ SinOsc.ar(SinOsc.ar(XLine.kr(1, 1000, 9), 0, 200, 800), 0, 0.25) }.play;\n\n// phase modulation (see also PMOsc)\n{ SinOsc.ar(800, SinOsc.ar(XLine.kr(1, 1000, 9), 0, 2pi), 0.25) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Monitor`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\ns.scope(16);\n\n{ Out.ar(87, SinOsc.ar(MouseX.kr(40, 10000, 1) * [1, 2, 3], 0, 0.2)) }.play;\nx = Monitor.new;\nx.play(87, 3, 1, 2);\nx.out = 0;\nx.stop(3.0);\nx.play(87, 1, 0, 1); // in > out : now mixes down (wrapping)\nx.play(89, 1, 0, 2); // in < out : now distributes to 2 channels\nx.stop;\n\n// multiple play\nx.play(87, 1, 0, 2, multi: true);\nx.play(88, 1, 0, 2, multi: true);\nx.play(89, 1, 0, 2, multi: true);\nx.stop;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Integer.isInteger` do?"}, {"role": "assistant", "content": "32-bit Integer number Returns: true (the receiver is an integer)."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DigitalOut`."}, {"role": "assistant", "content": "```supercollider\n// write a sine oscillator's output to a pin\n\n(\nSynthDef(\"help-DigitalOut\", { |out = 0|\n DigitalOut.ar(0, SinOsc.ar(10));\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `ScoreClock.default` do?"}, {"role": "assistant", "content": "A global default ScoreClock, similar to TempoClock.default. ScoreClock has classmethods that redirects to the default clock, so you can use simply"}]} +{"conversations": [{"role": "user", "content": "Explain `SawDPW` in SuperCollider briefly."}, {"role": "assistant", "content": "SawDPW — super-efficient sawtooth oscillator with low aliasing A sawtooth oscillator using the \"Differentiated Parabolic Wave\" technique, which suppresses aliasing at a wide range of frequencies, yet is about 3 times as CPU-efficient as SuperCollider's Saw ugen. Category: UGens > Generators."}]} +{"conversations": [{"role": "user", "content": "What does `AbsApp.dereference` do?"}, {"role": "assistant", "content": "Abstract super class for the various MxApp scripting objects"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `DelayN` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// これは(SC2の配布物の中の)\"01 Why SuperCollider document\"からのリバーブ\n(\nSynthDef(\"preDelay\", { arg inbus = 2;\n Out.ar(\n 4,\n DelayN.ar(In.ar(inbus, 1), 0.048, 0.048)\n )\n}).add;\n\nSynthDef(\"combs\", {\n Out.ar(\n 6,\n Mix.arFill(7, { CombL.ar(In.ar(4, 1), 0.1, LFNoise1.kr(Rand(0, 0.1), 0.04, 0.05), 15) })\n )\n}).add;\n\nSynthDef(\"allpass\", { arg gain = 0.2;\n var source;\n source = In.ar(6, 1);\n 4.do({ source = AllpassN.ar(source, 0.050, [Rand(0, 0.05), Rand(0, 0.05)], 1) });\n Out.ar(\n 8,\n source * gain\n )\n}).add;\n\nSynthDef(\"theMixer\", { arg gain = 1;\n Out.ar(\n 0,\n Mix.ar([In.ar(2, 1), In.ar(8, 2)]) * gain\n )\n}).add;\n);\n\n(\nSynth(\"fm1\", [\\bus, 2, \\freq, 440, \\carPartial, 1, \\modPartial, 1.99, \\mul, 0.071]);\nSynth(\"fm1\", [\\bus, 2, \\freq, 442, \\carPartial, 1, \\modPartial, 2.401, \\mul, 0.071]);\nSynth.tail(s, \"preDelay\");\nSynth.tail(s, \"combs\");\nSynth.tail(s, \"allpass\");\nSynth.tail(s, \"theMixer\", [\\gain, 0.64]);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LatoocarfianL`."}, {"role": "assistant", "content": "```supercollider\n// randomly modulate all params\n(\n{ LatoocarfianL.ar(\n SampleRate.ir/4,\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5)\n) * 0.2 }.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `InTrig`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\ns = Server.local;\nb = Bus.control(s, 1);\n\nSynthDef(\"help-InTrig\", { |out = 0, busnum = 0|\n var inTrig;\n inTrig = InTrig.kr(busnum);\n Out.ar(out,\n EnvGen.kr(Env.perc, gate: inTrig, levelScale: inTrig) * SinOsc.ar\n )\n}).play(s, [\\out, 0, \\busnum, b.index]);\n\n\nb.set(1.0);\n\nb.value = 1.0;\n\nb.value = 0.2;\n\nb.value = 0.1;\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Scale`."}, {"role": "assistant", "content": "```supercollider\n(\nr = {\n var scale = Scale.choose.postln;\n SinOsc.ar(\n (\n DegreeToKey.kr(\n scale.as(LocalBuf),\n MouseX.kr(0, 15), // mouse indexes into scale\n scale.stepsPerOctave,\n 1, // mul = 1\n 60 // offset by 72 notes\n )\n + LFNoise1.kr([3, 3], 0.04) // add some low freq stereo detuning\n ).midicps, // convert midi notes to hertz\n 0,\n 0.25\n )\n}.play;\n);\n\nr.free;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n///////////////////// beat accurate playing /////////////////////\n\n\n\n\na = NodeProxy.audio(s, 2);\na.play;\n\na.quant = 2.0; // quantize changes to the next 2.0-beat multiple\na.source = { Ringz.ar(Impulse.ar(0.5, 0, 0.3), 3000, 0.01) };\na[1] = { Ringz.ar(Impulse.ar([0.5, 1], 0, 0.3), 1000, 0.01) };\na[2] = { Ringz.ar(Impulse.ar([3, 5]/2, 0, 0.3), 8000, 0.01) };\na[3] = { Ringz.ar(Impulse.ar([3, 5]*16, 0, 0.3), 5000,\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n///////////////////// beat accurate playing /////////////////////\n\n\n\n\na = NodeProxy.audio(s, 2);\na.play;\n\na.quant = 2.0; // quantize changes to the next 2.0-beat multiple\na.source = { Ringz.ar(Impulse.ar(0.5, 0, 0.3), 3000, 0.01) };\na[1] = { Ringz.ar(Impulse.ar([0.5, 1], 0, 0.3), 1000, 0.01) };\na[2] = { Ringz.ar(Impulse.ar([3, 5]/2, 0, 0.3), 8000, 0.01) };\na[3] = { Ringz.ar(Impulse.ar([3, 5]*16, 0, 0.3), 5000, 0.01) * LFPulse.kr(0.5, 0, 0.05) };\n\na.removeLast;\na.removeAt(2);\n\na.clear;\n```"}]} +{"conversations": [{"role": "user", "content": "What does doneAction do?"}, {"role": "assistant", "content": "It tells the server what to do to the enclosing Synth when the UGen finishes. The one that matters most is `doneAction: 2`, which frees the Synth: that is how a percussive sound cleans itself up instead of leaking silent nodes. `doneAction: 0` does nothing, so the Synth keeps running. EnvGen, Line, XLine, LinePan and friends all accept it, which is why `EnvGen.kr(Env.perc(0.01, 1), doneAction: 2)` is the standard envelope idiom."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `SelectX` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar(300),\n Pulse.ar(230)\n ];\n\n SelectX.ar(MouseX.kr(0, 1) * a.size, a) * 0.2\n}.play;\n);\n\n(\n{\n var a;\n a = [\n SinOsc.kr(0.25),\n LFSaw.kr(10),\n LFPulse.kr(0.3)\n ];\n\n SinOsc.ar(SelectX.kr(MouseX.kr(0, 1) * a.size, a) * 300 + 400) * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\n// send a synth def to server\nSynthDef(\"tpulse\", { |out = 0, freq = 700, sawFreq = 440.0|\n Out.ar(out, SyncSaw.ar(freq, sawFreq, 0.1));\n}).add;\n);\n\n// Here the defaults for *new will result in a Synth at the head of the default group\n// of the default Server. This will use the SynthDef's default arguments;\ny = Synth.new(\"tpulse\");\ny.free;\n\n// The same done explicitly\ny = Synth.new(\"tpulse\", nil, s, \\addToHead);\ny.free;\n\n// With some arguments\ny = Synth.new(\"tpulse\", [\\freq\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\n// send a synth def to server\nSynthDef(\"tpulse\", { |out = 0, freq = 700, sawFreq = 440.0|\n Out.ar(out, SyncSaw.ar(freq, sawFreq, 0.1));\n}).add;\n);\n\n// Here the defaults for *new will result in a Synth at the head of the default group\n// of the default Server. This will use the SynthDef's default arguments;\ny = Synth.new(\"tpulse\");\ny.free;\n\n// The same done explicitly\ny = Synth.new(\"tpulse\", nil, s, \\addToHead);\ny.free;\n\n// With some arguments\ny = Synth.new(\"tpulse\", [\\freq, 350, \\sawFreq, 220]);\ny.free;\n\n// make a new synth\ny = Synth(\"tpulse\");\n\n// pause\ny.run(false);\n\ny.run(true);\n\n// set a control by argument name\ny.set(\"freq\", 200);\n\n// or by index\ny.set(2, 100.0);\n\n// modulate out to bus number 1 (the right speaker)\ny.set(0, 1);\n\n// multiple set commands in one message\ny.set(\"out\", 0, \"freq\", 300);\n\n// free the synth from the server\ny.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// what can it sound like? see: https://www.youtube.com/watch?v=dRmY3tEwZyE \n// the youtube version has been sent through an additional reverb pedal, but\n// you don't need the pedal to get something that sounds interesting\n\n(\ns.options.memSize_(16384*10);\ns.reboot;\ns.waitForBoot({\n \n Ndef(\\bits, {\n var t = PulseCount.ar(Impulse.ar(8e3));\n var u = PulseCount.ar(Impulse.ar(7009));\n var sig = HPF.ar(\n (\n ((t * 15) & (t >> 5)) |\n ((t * 5) & (t >> [3, 4])) |\n ((t * 2) & (t >> 9)) |\n ((t * 8) & (t >> 11)) |\n (((t*t) & t) | (t >> 3))\n - 3 % 256\n ) / 127-1 * 3\n , 20\n ) * 0.1;\n var sig2 = LPF.ar(HPF.ar(gcd(t*u, u+t), WhiteNoise.ar()*2000 + 1000), 20);\n sig2 = sig2*sig;\n sig = 0.3*Splay.ar(Limiter.ar(Greyhole.ar(sig + sig2, sig, 0.5, sig), 0.5).flatten);\n }).play;\n});\n)\n```"}, {"role": "assistant", "content": "a surprisingly rich soundscape in a few lines of code (lucky accident)."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for rough sketch of chicago minor chord pad thing. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\\ChicagoPad, { |out = 0, freq = 440, cutoff = 500, amp = 0.2|\n var snd;\n freq = freq + SinOsc.kr(0.1, 0, 1, 20);\n snd = Saw.ar([freq, freq+1, freq-1, freq*3/2, freq*6/5])*0.1;\n snd = snd + VarSaw.ar(0.99*[freq, freq+1, freq-1,freq*3/2, freq*6/5],0, LFTri.kr(0.3).range(0.25,0.9))*0.1;\n snd = Mix(snd);\n snd = RLPF.ar(snd, SinOsc.kr(0.1, 0, 100, 5000), 0.1);\n snd = GVerb.ar(snd ,40, 10, 0.6, 0.6, -3, -9, -11)*0.2;\n \n //snd = RLPF.ar(snd, SinOsc.kr(0.08, 0.5, cutoff/10, cutoff), 0.2);\n snd = MoogFF.ar(snd, SinOsc.kr(0.08, 0.5, cutoff/10, cutoff), 3, 0);\n snd = DelayC.ar(snd, 1.5, 1,0.8);\n //snd = snd * EnvGen.ar(Env.linen(0.001, 0.01,0.01,1), doneAction:2);\n Out.ar(out, [snd, AllpassC.ar(snd, 0.5, 0.05, 0.3)]*amp);\n}).send;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `NdefGui`?"}, {"role": "assistant", "content": "NdefGui — a gui for a NodeProxy or Ndef"}, {"role": "user", "content": "What does `NdefGui.big` do?"}, {"role": "assistant", "content": "two lines of controls for a big NdefGui, usually in its own window"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\np = ProxySpace.push(s.boot);\n\nl = NdefGui(nil, 3).moveTo(10, 120);\nm = NdefGui(nil, 3).moveTo(10, 240);\nn = NdefGui(nil, 3).moveTo(10, 360);\no = NdefGui(nil, 3).moveTo(10, 480);\n\nSpec.add(\\dens, [0.1, 300, \\exp]);\n\n// make 3 kinds of proxies: using tilde/proxyspace, Ndef, and unnamed.\n~spacy = { |dens = 5| Formlet.ar(Dust.ar(dens ! 2), LFDNoise0.kr(20 ! 2).lag(0.1).linexp(-1, 1, 300, 5000), 0.003, 0.03) };\nNdef(\\ndeffy, { GrayNoise.ar(0.1 ! 2) });\nc = NodeProxy.audio.source_({ PinkNoise.ar(0.1 ! 2) });\n\n// put one in each editor\nl.object_(~spacy);\nm.object_(Ndef(\\ndeffy));\nn.object_(c);\n);\n// One should also be able to drag and drop text into the drag,\n// but this is also not working yet.\n( Ndef(\\a) )\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Paddp`."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\freq, Pseq([500, 600, 700]), \\instrument, \\sinegrain);\na = Paddp(\\freq, Pseq([30, 90, -100], inf), a);\na.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ CheckBadValues.kr(SinOsc.ar); 0 }.play // nothing wrong here\n\n{ CheckBadValues.kr(1 / 0, 1).poll; 0 }.play // check infinity\n\nx = { |test = -1| CheckBadValues.kr(test); 0 }.play // check NaN\nx.set(\\test, -1.sqrt);\n\n// don't post, but do something with the output\n(\nx = { |freq = 440|\n var good;\n good = BinaryOpUGen('==', CheckBadValues.kr(freq, 0, 0), 0);\n SinOsc.ar(freq, 0, 0.1) * good // silence the output if freq is bad\n}.play;\n);\nx.set(\\freq, -1.sqrt);\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ CheckBadValues.kr(SinOsc.ar); 0 }.play // nothing wrong here\n\n{ CheckBadValues.kr(1 / 0, 1).poll; 0 }.play // check infinity\n\nx = { |test = -1| CheckBadValues.kr(test); 0 }.play // check NaN\nx.set(\\test, -1.sqrt);\n\n// don't post, but do something with the output\n(\nx = { |freq = 440|\n var good;\n good = BinaryOpUGen('==', CheckBadValues.kr(freq, 0, 0), 0);\n SinOsc.ar(freq, 0, 0.1) * good // silence the output if freq is bad\n}.play;\n);\nx.set(\\freq, -1.sqrt);\n\n// the UGen method checkBadValues passes through the input for quick testing\n{ SinOsc.ar(440, 0, 0.1).checkBadValues }.play\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// start a noise patch and set the id of the generator\n(\nSynthDef(\"help-RandID\", { |out = 0, id = 1|\n RandID.ir(id);\n Out.ar(out,\n WhiteNoise.ar(0.05) + Dust2.ar(70)\n )\n}).add;\n);\n\n// reset the seed of my rgen at a variable rate\n(\nSynthDef(\"help-RandSeed\", { |seed = 1910, id = 1|\n RandID.kr(id);\n RandSeed.kr(Impulse.kr(FSinOsc.kr(0.2, 0, 10, 11)), seed);\n}).add;\n\n);\n\n// start two noise synths on left and right channel with a different randgen id\na = Synth(\"help-RandID\", [\\\n// …\n```"}, {"role": "assistant", "content": "start a noise patch and set the id of the generator reset the seed of my rgen at a variable rate (RandID: Set the synth's random generator ID.)"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `BufCombN` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// These examples compare the variants, so that you can hear the difference in interpolation\n\n// allocate buffer\nb = Buffer.alloc(s, 44100, 1);\n\n// Comb used as a resonator. The resonant fundamental is equal to\n// reciprocal of the delay time.\n{ BufCombN.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ BufCombL.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ BufCombC.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// with negative feedback:\n{ BufCombN.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ BufCombL.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ BufCombC.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n// used as an echo.\n{ BufCombC.ar(b.bufnum, Decay.ar(Dust.ar(1, 0.5), 0.2, WhiteNoise.ar), 0.2, 3) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `MulAdd`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n// The mul and add arguments of SinOsc themselves use MulAdd!\n// These two examples will create precisely the same synth graph:\nx = { SinOsc.ar(440, 0, 0.1, 0.05) }.play(s);\nx.trace; // You should see a \"MulAdd\" in the trace\nx.free;\n\nx = { MulAdd(SinOsc.ar(440, 0), 0.1, 0.05) }.play(s);\nx.trace;\nx.free;\n\n// In fact this will produce the same graph too - the separate multiply and add are optimised into one MulAdd\nx = { SinOsc.ar(440, 0) * 0.1 + 0.05 }.play(s);\nx.trace;\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `HistoryGui.showLineAt` do?"}, {"role": "assistant", "content": "show the line at that index in History.lines in the"}]} +{"conversations": [{"role": "user", "content": "What does `MxIOletsApp.first` do?"}, {"role": "assistant", "content": "returns first Returns: an MxInletApp or MxOuletApp"}]} +{"conversations": [{"role": "user", "content": "What does `RedLZ77.compress` do?"}, {"role": "assistant", "content": "Returns an array with length, distance and"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `NodeProxy` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\na = NodeProxy.new.play; // play to hardware output.\na.fadeTime = 2; // fadeTime specifies crossfade\n// set the source\na.source = { SinOsc.ar([350, 351.3], 0, 0.2) };\na.source = { Pulse.ar([350, 351.3] / 4, 0.4) * 0.2 };\na.source = Pbind(\\dur, 0.03, \\freq, Pbrown(0, 1, 0.1, inf).linexp(0, 1, 200, 350));\n\nb = NodeProxy.new;\na.source = { Ringz.ar(b.ar, [350, 351.3] * 8, 0.2) * 4 };\nb.source = { Impulse.ar([5, 7]/2, [0, 0.5]) };\n\na.clear(3); // clear after 3 seconds\nb.clear(3);\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Harmonics`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\na.ramp(1.0, 1.0); // returns a harmonic series\n\nb = Buffer.alloc(s, 512, 1);\n// harmonic series for freqs, ramp down for amps\nb.sine2(a.ramp(1.0, 1.0).postln, a.ramp(0.5, -0.025).postln, true, true, true);\n(\nz = SynthDef(\"help-Osc\", { |out = 0, bufnum = 0|\n Out.ar(out,\n Osc.ar(bufnum, 200, 0, 0.5)\n )\n});\n);\ny = z.play(s, [\\out, 0, \\bufnum, b]);\ny.free;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = NodeProxy(s); a.play;\na.source = { Splay.ar(Blip.ar(\\freq.kr(18 ! 4))) * 0.2 };\na.set(\\freq, [1, 3, 56, 13]);\na.source = { Splay.ar(SinOsc.ar(LFSaw.ar(\\freq.kr(18 ! 4)) * 250 + 400)) * 0.2 };\nb = NodeProxy(s); b.source = { MouseX.kr(0, 3) * [1, 3, 56, 13] };\na.set(\\freq, b;\na.clear; b.clear;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = NodeProxy(s); a.play;\na.source = { Splay.ar(Blip.ar(\\freq.kr(18 ! 4))) * 0.2 };\na.set(\\freq, [1, 3, 56, 13]);\na.source = { Splay.ar(SinOsc.ar(LFSaw.ar(\\freq.kr(18 ! 4)) * 250 + 400)) * 0.2 };\nb = NodeProxy(s); b.source = { MouseX.kr(0, 3) * [1, 3, 56, 13] };\na.set(\\freq, b);\na.clear; b.clear;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `RedMixerChannelGUI` in SuperCollider briefly."}, {"role": "assistant", "content": "RedMixerChannelGUI — gui for RedMixerChannel An embeddable GUI for RedMixerChannel. If no parent given then a new Window will be created. Category: Red > redMixer."}]} {"conversations": [{"role": "user", "content": "What is a SynthDef?"}, {"role": "assistant", "content": "A SynthDef is a named, compiled server-side instrument: a UGen graph plus named controls. You build one with SynthDef(\\name, { |args| ... }).add, and then play instances with Synth(\\name)."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\ns.boot;\n\n(\nSynthDef(\"lazerdrone\", {\n var in, freq, hasFreq;\n\n \n in = SinOsc.ar(440 * LFSaw.kr(100, 1000));\n\n # freq, hasFreq = Pitch.kr(\n in,\n ampThreshold: 0.09,\n median: 1);\n freq = freq * hasFreq;\n //freq.poll;\n \n SinOsc.kr(freq).poll;\n \n Out.ar(0, in + \n SinOsc.ar(440, \n 0, \n Clip.kr(\n SinOsc.kr(freq), \n 0)\n )\n );\n}).play;\n)\n```"}, {"role": "assistant", "content": "A lazer sound then a drone with morse-code like bleeps. A byproduct of testing the triggering algorithm in the mono2eN SynthDef."}]} -{"conversations": [{"role": "user", "content": "What does `UpdatingScalarPatchOut.control` do? What arguments does it take?"}, {"role": "assistant", "content": "utility for connecting NumberEditor > Synth Arguments: controlPatchIn; needsValueSetNow."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// 8 channel ring\na = VBAPSpeakerArray.new(2, [0, 45, 90, 135, 180, -135, -90, -45]);\n~lsBufferData = a.getSetsAndMatrices;\nb = Buffer.loadCollection(s, ~lsBufferData;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// 8 channel ring\na = VBAPSpeakerArray.new(2, [0, 45, 90, 135, 180, -135, -90, -45]);\n~lsBufferData = a.getSetsAndMatrices;\nb = Buffer.loadCollection(s, ~lsBufferData);\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// per convention keys after \\dur are the ones to be set\n// playing ends after end of last stream\n\n(\np = PmonoPar([\n [\n \\dur, 1.0,\n \\pan, Pser([-0.9, 0, 0.9], 8) \n ],[\n \\dur, 0.4,\n \\freq, Pexprand(300, 1000, 24) \n ],[\n \\dur, 0.2,\n \\amp, Pseq([0.05, 0.3], 30) \n ]\n]).trace.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// per convention keys after \\dur are the ones to be set\n// playing ends after end of last stream\n\n(\np = PmonoPar([\n [\n \\dur, 1.0,\n \\pan, Pser([-0.9, 0, 0.9], 8) \n ],[\n \\dur, 0.4,\n \\freq, Pexprand(300, 1000, 24) \n ],[\n \\dur, 0.2,\n \\amp, Pseq([0.05, 0.3], 30) \n ]\n]).trace.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `KeyCodeResponder.at` do? What arguments does it take?"}, {"role": "assistant", "content": "register responder functions for keycode and modifier combinations Arguments: address."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `CuspN`."}, {"role": "assistant", "content": "```supercollider\n// vary frequency\n{ CuspN.ar(MouseX.kr(20, SampleRate.ir), 1.0, 1.99) * 0.3 }.play(s);\n\n// mouse-controlled params\n{ CuspN.ar(SampleRate.ir/4, MouseX.kr(0.9, 1.1, 1), MouseY.kr(1.8, 2, 1)) * 0.3 }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(CuspN.ar(40, MouseX.kr(0.9, 1.1, 1), MouseY.kr(1.8, 2, 1))*800+900)*0.4 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\"help-GaussTrig\", { arg out=0;\n Out.ar(out,\n Ringz.ar(\n WhiteNoise.ar(\n Decay.kr(\n GaussTrig.kr(10.dup, MouseX.kr(0, 0.9), 0.5),\n 0.02,\n 0.2\n )\n ),\n 2000,\n 0.02\n ).fold2(0.2)\n )\n}).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\"help-GaussTrig\", { arg out=0;\n Out.ar(out,\n Ringz.ar(\n WhiteNoise.ar(\n Decay.kr(\n GaussTrig.kr(10.dup, MouseX.kr(0, 0.9), 0.5),\n 0.02,\n 0.2\n )\n ),\n 2000,\n 0.02\n ).fold2(0.2)\n )\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `RedMixerChannel.eqMi` do?"}, {"role": "assistant", "content": "Activate channel equalizer middle band (0=off, 1=on). Also"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Streson.ar(LFSaw.ar([220, 180], 0, mul:EnvGen.kr(Env.asr(0.5, 1, 0.02), 1.0) * 0.2), LinExp.kr(LFCub.kr(0.1, 0.5*pi), -1, 1, 280, 377).reciprocal, 0.9, 0.3 }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Streson.ar(LFSaw.ar([220, 180], 0, mul:EnvGen.kr(Env.asr(0.5, 1, 0.02), 1.0) * 0.2), LinExp.kr(LFCub.kr(0.1, 0.5*pi), -1, 1, 280, 377).reciprocal, 0.9, 0.3) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// as frequency control...\n(\n{\nSinOsc.ar(\n LinCongC.ar(\n 40,\n LFNoise2.kr(0.1, 0.1, 1),\n LFNoise2.kr(0.1, 0.1, 0.1),\n LFNoise2.kr(0.1),\n 0, 500, 600\n )\n) * 0.4 }.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// as frequency control...\n(\n{\nSinOsc.ar(\n LinCongC.ar(\n 40,\n LFNoise2.kr(0.1, 0.1, 1),\n LFNoise2.kr(0.1, 0.1, 0.1),\n LFNoise2.kr(0.1),\n 0, 500, 600\n )\n) * 0.4 }.play(s);\n)\n```"}]} {"conversations": [{"role": "user", "content": "What does `StreamKrDur.resetRoutine` do?"}, {"role": "assistant", "content": "a 'control' rate player that combines a stream of values with a stream of durations and plays them"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for cosmic organ expansion )."}, {"role": "assistant", "content": "```supercollider\n(\nfork {\n TempoClock.tempo = 1;\n Ndef(\\ttso).play;\n loop {\n var seed = thisThread.randSeed = 100000000.rand.debug('seed');\n var wait = 20.rrand(60).debug('wait');\n Ndef(\\ttso, {\n var gamma= {[rrand(30,50),rrand(50,70),rrand(50,70),rrand(70,100)].choose.midicps*LFNoise2.kr(1,0.01,1)}!24;\n Pan2.ar(\n LeakDC.ar(\n Normalizer.ar(\n BPeakEQ.ar(\n FreeVerb.ar(\n Splay.ar(RLPF.ar(LFSaw.ar(gamma)/4,gamma*LFCub.kr(rrand(0.01,0.1),0,2,3),LFNoise2.kr(1/8,0.6,0.7))),\n 0.1,0.1,0.1\n ),\n [100.rrand(200),1000.rrand(2000),5000.rrand(7000),10000.rrand(15000)],Array.rand(4,0,6),Array.rand(4,0,6)\n ).mean,\n 0.8,0.1\n )\n ),\n LFNoise2.kr(0.1.exprand(10)).range(-0.1,0.1),\n SelectX.kr(\n [SinOsc,LFTri].choose.kr(2.rrand(25).reciprocal).range(0,2),\n [\n 0.7.rrand(1),\n LFGauss.kr(\n Latch.kr(\n LFNoise2.kr(1).range(1/5,5.rrand(20)).reciprocal, \n Impulse.kr(LFNoise2.kr(3.rrand(10).reciprocal).range(0.5,3.rrand(6)))\n ),\n SinOsc.kr(3.rrand(15).reciprocal).range(0.07.rrand(0.16),0.25.rrand(0.4))\n ),\n 0.1.rrand(0.5)\n ]\n )\n )\n }).fadeTime_(3.rrand(6));\n wait.wait;\n }\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `AnnotatedDebugNodeWatcher.getAnnotation` do? What arguments does it take?"}, {"role": "assistant", "content": "Watches server replies for node ended/started events using AbstractPlayer's Node annotation system Arguments: server; nodeID."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\ns.boot;\n\n(\nSynthDef(\"help-PinkNoise\", { |out = 0|\n Out.ar(out, PinkNoise.ar(0.1))\n}).add;\n\nSynthDef(\"help-In\", { |out = 0, in = 0|\n var input;\n input = In.ar(in, 1);\n Out.ar(out, input);\n\n}).add;\n);\n\n// play noise on the right channel\nx = Synth(\"help-PinkNoise\", [\\out, 1]);\n\n// read the input and play it out on the left channel\nSynth.after(x, \"help-In\", [\\out, 0, \\in, 1]);\n```"}, {"role": "assistant", "content": "play noise on the right channel read the input and play it out on the left channel (In: Read a signal from a bus.)"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DigitalOut`."}, {"role": "assistant", "content": "```supercollider\n// write a sine oscillator's output to a pin\n\n(\nSynthDef(\"help-DigitalOut\", { |out = 0|\n DigitalOut.ar(0, SinOsc.ar(10));\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for little homage to \"Come Out\" by Steve Reich."}, {"role": "assistant", "content": "```supercollider\n/* A little homage to \"Come Out\" by Steve Reich.\n It explores ryhtmic aspects created by phasing, retriggering, and pitch shifting.\n It \"detours\" the original audio message available here\n http://www.freesound.org/people/ERH/sounds/34667/\n in which a police patrol recites\n \"We don't want to scare your children, that's the last thing we wanna do\".\n \n */\n\n\ns.options.memSize=128*1024;\ns.boot;\n\n~bus=Bus.audio(s,2);\n~buf=Buffer.readChannel(s,\"/home/***/Supercollider/sounds/v.wav\");\n\n(\nSynthDef(\\playbuff,{arg in=0,out=0,t_trig=0;\n var i=EnvGen.kr(Env([0,40,0.3,0.4,40,0],[0,60,20,20,30]),gate:1);\n var r=EnvGen.kr(Env([0,10,-0.9,-0.9],[40,20,15]),gate:t_trig,doneAction:2);\n var sig1=PlayBuf.ar(1,in,rate:1+r,trigger:Impulse.kr(i),loop:1);\n var sig2=PlayBuf.ar(1,in,rate:1+r,trigger:Impulse.kr(i+0.01),loop:1);\nOut.ar(out,Splay.ar([sig1,sig2],0.5));\n};\n).add;\n\nSynthDef(\\rev,{arg in=0,out=0;\n var sig=In.ar(in,2);\n sig=Compander.ar(sig,sig,0.8,1/3);\n sig=FreeVerb.ar(sig,mix:0.4);\nOut.ar(out,sig);\n};\n).add;\n);\n\nSynth(\\rev,[\\in:~bus]);\n\nfork{\nx=Synth(\\playbuff,[\\out:~bus]);\n75.wait;\nx.set(\\t_trig,1);\n};\n\ns.quit;\n```"}]} -{"conversations": [{"role": "user", "content": "What is `RedMstGUI` in SuperCollider?"}, {"role": "assistant", "content": "RedMstGUI — gui window for RedMst Use this class for lowest CPU usage. RedMstGUI2 and RedMstGUI3 adds metronome and transport view but takes a little bit more to update. Category: Red > redMst."}]} -{"conversations": [{"role": "user", "content": "Interfacing SC with external software: MIDI or OSC?"}, {"role": "assistant", "content": "SuperCollider forum — Interfacing SC with external software: MIDI or OSC?\n\nI found this partial solution on sccode.org :\n\n```supercollider\n // declare an event type which sends OSC commands to Renoise\n\n(\nEvent.addEventType(\\renoise, { |server|\n var renoiseOscServer = NetAddr(\"127.0.0.1\", 8000);\n var notes = [~midinote.value, ~ctranspose.value, ~velocity.value, ~sustain.value, ~lag.value, ~timingOffset.value, ~instr.value, ~track.value].flop;\n var timeNoteOn, timeNoteOff, instrument, track, velocity;\n var serverLatency;\n\n serverLatency = server.latency ? 0;\n\n notes.do {|note|\n instrument = note[6] ? -1;\n track = note[7] ? -1;\n velocity = note[2].asInt.clip(0,127);\n\n // sustain and timingOffset are in beats, lag is in seconds\n timeNoteOn = (thisThread.clock.tempo.reciprocal*note[5])+note[4]+server.latency;\n timeNoteOff = (thisThread.clock.tempo.reciprocal*(note[3]+note[5]))+note[4]+server.latency;\n SystemClock.sched(timeNoteOn, {renoiseOscServer.sendMsg(\"/renoise/trigger/note_on\", instrument.asInt, track.asInt, (note[0]+note[1]).asInt, velocity )});\n SystemClock.sched(timeNoteOff, {renoiseOscServer.sendMsg(\"/renoise/trigger/note_off\", instrument.asInt, track.asInt, (note[0]+note[1]).asInt)});\n }\n});\n);\n\n// Now start Renoise OSC server, load a sample, and try some patterns\n\n// straight timing\n(\nPbind(*[\n type: \\renoise,\n legato: Pgauss(0.2,0.05,inf),\n dur: 0.2,\n degree: [2,5,12],\n track: Prand([0,1], inf),\n ctranspose: Pseq([0,0,0,0,4,4,4,4,5,5,5,5],inf),\n velocity: Pgauss(64,10,inf),\n]).play;\n)\n```\n\nhttp://sccode.org/1-4SN\n\nBut what I couldn’t find there was a simple syntax for sending Note Events or Midi Events as OSC messages... Do I really need to re-implement the whole SC’s defaultParentEvent as new OSC Event to send it using regular pattern’s syntax?"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nMIDIIn.connectAll;\n// MIDIClient.init;\n\n\n(\n// A SynthDef with ADSR envelope\nSynthDef(\"quick2\", {arg freq = 440, amp = 0.1, gate = 1;\n var snd, env;\n env = Env.adsr(0.01, 0.1, 0.3, 2, amp).kr(2, gate);\n snd = Saw.ar(freq: [freq, freq*1.5], mul: env);\n Out.ar(0, snd)\n}).add;\n);\n\n// Play it with a MIDI keyboard\n(\nvar noteArray = Array.newClear(128); // array has one slot per possible MIDI note\n\nMIDIdef.noteOn(\\myKeyDown, {arg vel, note;\n noteArray[note] = Synth(\"quick2\", [\\freq, note.midicps, \\amp, vel.linlin(0, 127, 0, 1)]);\n [\"NOTE ON\", note].postln;\n});\n\nMIDIdef.noteOff(\\myKeyUp, {arg vel, note;\n noteArray[note].set(\\gate, 0);\n [\"NOTE OFF\", note].postln;\n});\n)\n// PS. Make sure SC MIDI connections are made (MIDIIn.connectAll)\n```"}, {"role": "assistant", "content": "Basic example - how to use a MIDI keyboard with a simple synth."}]} -{"conversations": [{"role": "user", "content": "What does `BufferProxy.freeToBundle` do? What arguments does it take?"}, {"role": "assistant", "content": "allocates a Buffer on play Arguments: bundle."}]} -{"conversations": [{"role": "user", "content": "What is `RedLZSS` in SuperCollider?"}, {"role": "assistant", "content": "RedLZSS — lzss compression/decompression See http://michael.dipperstein.com/lzss/ and http://en.wikipedia.org/wiki/Lempel-Ziv-Storer-Szymanski Category: Red > > redTools."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ SinOsc.ar(BrownNoise.ar(100, 200) * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ SinOsc.ar(BrownNoise.ar(100, 200)) * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Env`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var env = Env([0.0, 0.5, 0.0, 1.0, 0.9, 0.0], [0.05, 0.1, 0.01, 1.0, 1.5], -4);\n var envgen = EnvGen.ar(env, doneAction: Done.freeSelf);\n env.plot;\n SinOsc.ar(\n envgen * 1000 + 440\n ) * envgen * 0.1\n}.play\n);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for sound of an alien weapon firing. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"raygun\", {arg amp = 0.5, sinfreq = 1000, glissf = 0.001, att = 0.01, rel = 0.9;\n var gliss = XLine.kr(sinfreq, sinfreq*glissf, rel);\n var snd = SinOsc.ar(gliss);\n var env = EnvGen.kr(Env.perc(att, rel), doneAction: 2);\n snd = snd * env * amp;\n Out.ar(0, snd);\n}).add;\n);\n\n(\nPbind(\n \\instrument, \"raygun\",\n \\dur, Pseq([0.75,0.75,0.75,0.75,0.25,0.25,0.25]*0.5, inf),\n \\amp, 0.4\n).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for attempt at emulating a breathing sound. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\n//s.options.memSize_(64000);\nTempoClock.tempo_(1.0);\n\ns.waitForBoot({\n SynthDef(\\breathe_in, {\n | out = 0, gate = 1, in1=0.11, in2=0.63, in3=0.18, amdb= -10 |\n var menv = EnvGen.kr(Env.new([0,1,1,0],[in1, in2, in3], curve:'lin'),\n gate,\n doneAction:Done.freeSelf);\n var noise = WhiteNoise.ar(amdb.dbamp);\n var f1 = BPF.ar(in:noise, freq:5790, rq:0.1, mul:-29.dbamp);\n var f2 = BPF.ar(in:noise, freq:3400, rq:0.2, mul:-16.dbamp);\n var f3 = BPF.ar(in:noise, freq:1990, rq:0.1, mul:-23.dbamp);\n var f4 = BPF.ar(in:noise, freq:1250, rq:0.1, mul:-26.dbamp);\n Out.ar(out, menv*(f1+f2+f3+f4)!2);\n }).add;\n\n SynthDef(\\breathe_out, {\n | out = 0, gate=1, out1=0.343, out2=0.387, amdb= -4.33 |\n var menv = EnvGen.kr(Env.new([0, 1, 0], [out1,out2], curve:'lin'),\n gate,\n doneAction:Done.freeSelf);\n var noise = WhiteNoise.ar(amdb.dbamp);\n var f1 = BPF.ar(in:noise, freq:2290, rq:0.1, mul:-17.dbamp);\n var f2 = BPF.ar(in:noise, freq:1290, rq:0.1, mul:-19.dbamp);\n var f3 = BPF.ar(in:noise, freq:490, rq:0.1, mul:-18.dbamp);\n Out.ar(out, menv*(f1+f2+f3)!2);\n }).add;\n\n\n s.sync;\n\n fork {\n 50.do({\n var in1 = 0.11.rrand(0.22);\n var in2 = 0.6.rrand(0.8);\n var in3 = 0.16.rrand(0.30);\n var pausein = 0.11.rrand(0.20);\n var out1 = 0.30.rrand(0.50);\n var out2 = 0.36.rrand(0.50);\n var pauseout = 0.11.rrand(0.20);\n var amdb = -10.0.rrand(-14.0);\n var amdb2 = amdb/2.5;\n //(\"in1: \" ++ in1 ++ \" in2: \" ++ in2 ++ \" in3: \" ++ in3 ++ \" pausein: \" ++ pausein ++ \" out1: \" ++ out1 ++ \" out2: \" ++ out2 + \" pauseout: \" ++ pauseout).postln;\n Synth(\\breathe_in, [\\in1, in1, \\in2, in2, \\in3, in3, \\amdb, amdb]);\n (in1+in2+in3+pausein).wait;\n Synth(\\breathe_out, [\\out1, out1, \\out2, out2, \\amdb, amdb2]);\n (out1+out2+pauseout).wait;\n });\n };\n\n});\n);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `EZRanger.value` do? What arguments does it take?"}, {"role": "assistant", "content": "Gets/sets the `lo` and `hi` Arguments: vals — An instance of Array `[lo, hi]`.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// vary frequency\n{ CuspL.ar(MouseX.kr(20, SampleRate.ir), 1.0, 1.99) * 0.3 }.play(s);\n\n// mouse-controlled params\n{ CuspL.ar(SampleRate.ir/4, MouseX.kr(0.9, 1.1, 1), MouseY.kr(1.8, 2, 1)) * 0.3 }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(CuspL.ar(40, MouseX.kr(0.9, 1.1, 1), MouseY.kr(1.8, 2, 1))*800+900)*0.4 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// vary frequency\n{ CuspL.ar(MouseX.kr(20, SampleRate.ir), 1.0, 1.99) * 0.3 }.play(s);\n\n// mouse-controlled params\n{ CuspL.ar(SampleRate.ir/4, MouseX.kr(0.9, 1.1, 1), MouseY.kr(1.8, 2, 1)) * 0.3 }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(CuspL.ar(40, MouseX.kr(0.9, 1.1, 1), MouseY.kr(1.8, 2, 1))*800+900)*0.4 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `CoinGate`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\na = SynthDef(\"help-TCoin\", { |out = 0, prob = 0.5|\n var trig;\n trig = CoinGate.kr(prob, Impulse.kr(10));\n Out.ar(out,\n SinOsc.ar(\n TRand.kr(300.0, 400.0, trig), 0, 0.2\n )\n )\n}).play;\n);\n\na.set(\\prob, 1.0);\na.set(\\prob, 0.0);\na.set(\\prob, 0.1);\n\n\n(\na = SynthDef(\"help-TCoin\", { |out = 0, prob = 0.5|\n var trig;\n trig = Impulse.ar(20, 0, SinOsc.kr(0.5, 0, 1, 1));\n Out.ar(out,\n Mix.fill(3, { Ringz.ar(CoinGate.ar(prob, trig*0.5), #[1, 1.5]*Rand(1000, 9000), 0.01) })\n )\n}).play;\n);\n\na.set(\\prob, 1.0);\na.set(\\prob, 0.0);\na.set(\\prob, 0.1);\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `UnaryOpStream` in SuperCollider briefly."}, {"role": "assistant", "content": "UnaryOpStream — stream modified by a unary operator A UnaryOpStream is created as a result of a unary math operation on a Stream. It is defined to respond to next by returning the result of the math operation on the next value from the stream. It responds to reset by resetting the Stream. Category: Streams-Patterns-Events."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n Instr(\\helpTempoPlayer,{\n Impulse.ar( Tempo.kr )\n });\n\n Patch(\\helpTempoPlayer).play(atTime:1)\n;\nTempo.bpm = 100;\n\nTempo.bpm = 180;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n Instr(\\helpTempoPlayer,{\n Impulse.ar( Tempo.kr )\n });\n\n Patch(\\helpTempoPlayer).play(atTime:1)\n);\nTempo.bpm = 100;\n\nTempo.bpm = 180;\n```"}]} {"conversations": [{"role": "user", "content": "I edited a SynthDef and the running sound did not change."}, {"role": "assistant", "content": "Redefining a SynthDef only affects Synths created after the new definition reaches the server; existing instances keep the graph they were built with. Free and recreate them: `~s.free; ~s = Synth(\\name)`. In JITLib, Ndef is the tool designed for this — redefining `Ndef(\\name, { ... })` crossfades to the new graph while it plays."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Nuclear Fallout (a SuperCollider snippet)?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n var saw, bpf;\n saw = Saw.ar(\n freq: [60,150],\n mul: LFPulse.kr(\n freq: [2,3],\n width: 0.15));\n \n { BPF.ar(\n in: WhiteNoise.ar(mul: 1),\n freq: 1000,\n rq: 0.9\n )\n}\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `TdefGui.editString` do?"}, {"role": "assistant", "content": "a compileString that recreates the Tdef's envir at"}]} -{"conversations": [{"role": "user", "content": "What does `SCDocHTMLRenderer.htmlForLink` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a html string for the given scdoc Arguments: link — An scdoc link, such as a document key like \"Classes/SinOsc\", or an URL, or link to other file installed with the help.; escape — a boolean to set whether to escape special characters.. Returns: A String"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes alone in the storm (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\alone, { arg amp=0.5;\n var source, local, lfo;\n\n lfo = LFNoise1.kr(0.32).abs*50+[70,0.01];\n source = Decay.ar(Impulse.ar(lfo), 0.1) * WhiteNoise.ar(0.2);\n source = source * [LFNoise1.ar(0.17,0.4,1.1), LFNoise1.ar(0.57,1,1)];\n source = source;\n\n local = LocalIn.ar(2) + source;\n\n local = LPF.ar(local, 400 + LFNoise1.kr(0.1,300,100)) * 1.5;\n local = HPF.ar(local, 100 + LFNoise1.kr(0.15,050,050)) * 1.0;\n local = DelayN.ar(local, 0.2, 0.1);\n\n local = Limiter.ar(local.reverse,0.5);\n LocalOut.ar(local * 0.6);\n local = [local, Decay.ar(Impulse.ar(LFNoise1.kr(2.12).exprange(2,400)), 0.2 + LFNoise1.kr(0.11,0.1)) * local];\n local = FreqShift.ar(local, LFNoise1.kr(LFNoise1.kr(0.21).exprange(0.1,5)).exprange(0.1,500));\n local = HPF.ar(local, LFNoise1.kr(0.4).range(50,170), LFNoise1.kr(0.1).range(0.1,0.7));\n\n Splay.ar(local, LFNoise1.kr(0.21).range(0,1)) * amp;\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `DXEnvFanOut` in SuperCollider briefly."}, {"role": "assistant", "content": "DXEnvFanOut — sends crossfade envelopes to out buses according to demand-rate control DXEnvFanOut sends multichannel envelopes, which are used by DXMix / DXMixIn / DXFan / DXFanOut implicitely, to a sequence of out buses, which, together with fadeTimes and stepTimes, can be passed as demand rate ugens. It can be used as envelope and trigger at the same time, which leads to applications such as crossfading PlayBufs and different kinds of granulation, using a buffer or not. Category: Libraries > miSCellaneous > DX suite."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `FBSineC`."}, {"role": "assistant", "content": "```supercollider\n// increase feedback\n{ FBSineC.ar(SampleRate.ir, 1, Line.kr(0.01, 4, 10), 1, 0.1) * 0.2 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// you have to write the sample path in the firts line\n\n~bufferdue = Buffer.read(s,\" WRITE YOUR SAMPLE PATH HERE \", bufnum:2);\n\n(\nSynthDef.new(\\bufbeat, {\n arg amp = 1, out = 0, buf, start, end, freq = 1;\n var sig, ptr;\n ptr = LFNoise1.ar(freq).range(0.0,end);\n sig = BufRd.ar(2, buf, ptr);\n sig = sig * amp;\n Out.ar(out, sig);\n}).add\n);\n\nx = Synth.new(\\bufbeat, [\\buf, ~bufferdue.bufnum, \\start,0, \\end, ~bufferdue.numFrames-1, \\freq, 1, \\amp, 0.5],g);\n\nx.free;\n```"}, {"role": "assistant", "content": "a simple BufRd with the starting point of lecture randomized by LFNoise1."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Abusing Convolution2 to make pitch."}, {"role": "assistant", "content": "```supercollider\n// fixed (unchanging) impulse response\n// cmd-. to stop\n\n(\ns.waitForBoot {\n var c = Condition.new, cleanfunc = { CmdPeriod.remove(cleanfunc); b.free };\n fork {\n b = Buffer.alloc(s, 2048, 1);\n CmdPeriod.add(cleanfunc);\n s.sync;\n a = {\n RecordBuf.ar(BrownNoise.ar * EnvGen.ar(Env(#[0, 1, 0], #[0.5, 0.5], \\sin), timeScale: b.duration, doneAction: 2), b, loop: 0);\n 0\n }.play;\n OSCpathResponder(s.addr, ['/n_end', a.nodeID], { |time, resp, msg|\n resp.remove;\n c.unhang;\n }).add;\n c.hang;\n a = {\n var freq = MouseX.kr(150, 450, warp: 1, lag: 0.1);\n LeakDC.ar(Convolution2.ar(Impulse.ar(freq), b, framesize: b.numFrames) * -35.dbamp) ! 2;\n }.play;\n };\n};\n);\n\n\n\n// multiple impulse responses for timbre control\n(\ns.waitForBoot {\n var c = Condition.new, cleanfunc = { CmdPeriod.remove(cleanfunc); b.free };\n fork {\n b = Buffer.allocConsecutive(3, s, 2048, 1);\n CmdPeriod.add(cleanfunc);\n s.sync;\n a = {\n var sig = [BrownNoise.ar, PinkNoise.ar, WhiteNoise.ar];\n sig.do { |chan, i|\n RecordBuf.ar(chan * EnvGen.ar(Env(#[0, 1, 0], #[0.5, 0.5], \\sin), timeScale: b[i].duration, doneAction: 2), b[i], loop: 0);\n 0\n };\n }.play;\n OSCpathResponder(s.addr, ['/n_end', a.nodeID], { |time, resp, msg|\n resp.remove;\n c.unhang;\n }).add;\n c.hang;\n a = {\n var freq = MouseX.kr(150, 450, warp: 1, lag: 0.1),\n index = MouseY.kr(0, 1.99, lag: 0.1),\n iWhole = index.trunc(2),\n iFrac = index - iWhole,\n iAdjust = iFrac >= 1.0,\n trig = Impulse.ar(freq),\n convolvers = b.collect { |buf, i|\n LeakDC.ar(Convolution2.ar(trig, buf, framesize: buf.numFrames))\n };\n (\n XFade2.ar(\n Select.ar(iWhole + (2 * iAdjust), convolvers),\n Select.ar(iWhole + 1, convolvers),\n iFrac.fold(0, 1) * 2 - 1\n ) * -30.dbamp\n ) ! 2;\n }.play;\n };\n};\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// Change MembraneHexagon to MembraneCircle for a different shaped\n// circular drum head\ns.boot;\ns.reboot;\n(\n{ var excitation = EnvGen.kr(Env.perc,\n MouseButton.kr(0, 1, 0),\n timeScale: 0.1, doneAction: 0\n ) * PinkNoise.ar(0.4);\n var tension = MouseX.kr(0.01, 0.1);\n var loss = MouseY.kr(0.999999, 0.999, 1);\n MembraneHexagon.ar(excitation, tension, loss);\n}.play;\n)\n```"}, {"role": "assistant", "content": "Change MembraneHexagon to MembraneCircle for a different shaped circular drum head (MembraneHexagon: Waveguide mesh physical models of drum membranes)"}]} -{"conversations": [{"role": "user", "content": "What does `EaseOutQuart.value` do? What arguments does it take?"}, {"role": "assistant", "content": "Quartic ease-out Arguments: t — a Float between 0.0 and 1.0.."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Receiving NIMate generated OSC messages."}, {"role": "assistant", "content": "```supercollider\n//NIMate \"Full Skeleton\" Kinect Theremin\n\n//Start server\n\ns.boot;\n\n\n//Start buses and OSC receivers\n\nb=Bus.control(s,3);\nc=Bus.control(s,3);\n\n\nOSCdef.new(\n \\rh_xyz,\n {\n |msg, time, addr, recvPort|\n postln(msg);\n b.setnSynchronous([msg[1],(msg[2]+1)/2,msg[3]+0.3]);\n },\n \"/Right_Hand\", nil, 7000\n);\n\n\nOSCdef.new(\n \\lh_xyz,\n {\n |msg, time, addr, recvPort|\n postln(msg);\n c.setnSynchronous([msg[1]+0.9,(msg[2]+1)/2,msg[3]+0.3]);\n },\n \"/Left_Hand\", nil, 7000\n);\n\n\nOSCdef(\\lh_xyz).enable;\nOSCdef(\\rh_xyz).enable;\n\n\n//Synth definition and bus mapping\n\nSynthDef(\\theremin,\n {\n |ctrl=#[0,0,0], ctrr=#[0,0,0]|\n var f, a, vibrate, tremrate;\n\n f = LinExp.kr(ctrr[0],0,1,100,1000);\n vibrate = LinExp.kr(ctrl[0],0,1,1,500);\n tremrate = 100*ctrl[1];\n\n a = SinOsc.ar(f + (f *\n SinOsc.ar(vibrate,0,0.1)),0,\n mul: ctrr[1])*\n SinOsc.kr(tremrate);\n\n Out.ar([0,1], a)\n }).add;\n\nx=Synth.new(\\theremin);\n\nx.map(\\ctrr,b);\nx.map(\\ctrl,c);\n\n\n//Clean up\n\nx.free;\nb.free;\nc.free;\ns.stop;\ns.quit;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a chord progression with Pbind."}, {"role": "assistant", "content": "Put an array of degrees in the pattern, use \\strum to spread the chord, and the default instrument\nplays all notes of each event.\n\n```supercollider\n(\nPbind(\n \\scale, Scale.minor,\n \\root, 2,\n \\degree, Pseq([[0, 4, 7], [-3, 0, 4], [-5, -1, 2], [0, 4, 7]], inf),\n \\dur, 1.5,\n \\strum, 0.02,\n \\amp, 0.12,\n \\legato, 0.9\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pseg`."}, {"role": "assistant", "content": "```supercollider\n// change a parameter\n(\nPbind(\n \\note, Pseg(Pseq([1, 5], inf), Pseq([4, 1], inf), \\linear),\n \\dur, 0.1\n).play;\n);\n\n(\nPbind(\n \\freq, Pseg(Pseq([400, 1500], inf), Pseq([4, 4], inf), Pseq([\\linear, \\exp], inf)),\n \\dur, 0.1\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// use input amplitude to control SinOsc frequency - use headphones to prevent feedback.\n{\n SinOsc.ar(\n Amplitude.kr(\n SoundIn.ar(0),\n 0.01,\n 0.01,\n 1200,\n 400\n ),\n 0, 0.3)\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// use input amplitude to control SinOsc frequency - use headphones to prevent feedback.\n{\n SinOsc.ar(\n Amplitude.kr(\n SoundIn.ar(0),\n 0.01,\n 0.01,\n 1200,\n 400\n ),\n 0, 0.3)\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\n(\nSynthDef(\"help-phaseShift\", { |out = 0|\n var in, chain;\n in = SinOsc.ar(500);\n chain = FFT(LocalBuf(2048), in);\n chain = PV_PhaseShift(chain, LFNoise2.kr(1, 180, 180));\n Out.ar(out, 0.1 * IFFT(chain).dup);\n}).play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\n(\nSynthDef(\"help-phaseShift\", { |out = 0|\n var in, chain;\n in = SinOsc.ar(500);\n chain = FFT(LocalBuf(2048), in);\n chain = PV_PhaseShift(chain, LFNoise2.kr(1, 180, 180));\n Out.ar(out, 0.1 * IFFT(chain).dup);\n}).play(s);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `MIDIClockOut.prepareToBundle` do? What arguments does it take?"}, {"role": "assistant", "content": "a Player that sends MIDI Clock Out Arguments: group; b."}]} -{"conversations": [{"role": "user", "content": "Explain `MovingSum` in SuperCollider briefly."}, {"role": "assistant", "content": "MovingSum — The sum of samples over a variable number of frames. A running sum over a variable number of samples. Useful for time averaging operations. Also see MovingAverage. Category: UGens > Analysis, UGens > Maths."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\ns.waitForBoot({\n var fftsize = 16384;\n b = Buffer.alloc(s, fftsize)\n})\n);\n\n\n(\nx = {\n // Any input should theoretically be OK, white noise is a good choice\n var son = WhiteNoise.ar;\n// var son = Impulse.ar;\n var out = LPF.ar(son, MouseX.kr(100, 10000, 1));\n var fft1 = FFT(LocalBuf(b.numFrames), son, wintype: 1);\n var fft2 = FFT(b, out, wintype: 1);\n\n // As with most PV_ ugens, the result is *actually* stored in the first fft buf\n var result = PV_Div(fft2, fft1\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\ns.waitForBoot({\n var fftsize = 16384;\n b = Buffer.alloc(s, fftsize)\n})\n);\n\n\n(\nx = {\n // Any input should theoretically be OK, white noise is a good choice\n var son = WhiteNoise.ar;\n// var son = Impulse.ar;\n var out = LPF.ar(son, MouseX.kr(100, 10000, 1));\n var fft1 = FFT(LocalBuf(b.numFrames), son, wintype: 1);\n var fft2 = FFT(b, out, wintype: 1);\n\n // As with most PV_ ugens, the result is *actually* stored in the first fft buf\n var result = PV_Div(fft2, fft1);\n\n out.dup * 0.1\n}.play;\n);\n\n// Now we can grab the FFT buffer and peek at the magnitudes\n(\np = Plotter.new;\nt = Task {\n loop {\n 0.1.wait;\n b.loadToFloatArray(action: { |data|\n {\n p.value = data[2..]\n .clump(2)\n .collect { |a| a[0].squared + a[1].squared }\n .collect { |a| if(a.isNaN) { 0.post } { a } }\n }.defer\n })\n} }.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `NonControlSpec` in SuperCollider?"}, {"role": "assistant", "content": "NonControlSpec — datatype specifying an input to an Instr that will not be in the SynthDef/Synth Category: Spec, Libraries > crucial > Spec."}]} -{"conversations": [{"role": "user", "content": "Explain `RedLZ77` in SuperCollider briefly."}, {"role": "assistant", "content": "RedLZ77 — lz77 compression/decompression See http://michael.dipperstein.com/lzss/ and http://www.binaryessence.com/dct/en000138.htm Category: Red > > redTools."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Algorithmic melancholy (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nvar n = 20, baseFreq = 45.midicps;\nvar lsin, rsin, arg1, arg2, sig;\nvar bus, busIndex, scale, freq, freqIndex, amp;\nvar responder;\n\nscale = Scale.nikriz.ratios * baseFreq;\n\nbus = Bus.control( s, 2 * n );\nbus.setn( { 1.0.rand2 } ! ( 2 * n ) );\nbusIndex = bus.index;\n\nfreq = Bus.control( s, n );\nfreqIndex = freq.index;\n\nresponder = OSCFunc({ | id |\n freq.setAt( id[2] , scale.choose * 1.rrand( 3 ) );\n},'/tr', s.addr);\n\nCmdPeriod.doOnce { [ bus, freq, responder ].free; };\n\nn.do {|i|\n freq.setn( { scale.choose * rrand( 1, 3) } ! n );\n {\n #arg1, arg2 = In.kr( 2 * i + busIndex, 2 );\n\n #lsin, rsin = SinOsc.kr( [ arg1, arg2 ], { 2.0.rrand(20.0) } ! 2 * [ arg2, arg1 ] ); \n\n sig = Formant.ar( \n LFNoise0.kr( 0.05, 2.5, 7) * arg1, \n arg2,\n 500.0.rrand(700) \n );\n\n ReplaceOut.kr( 2 * i + busIndex, [ rsin, lsin ] );\n\n sig = Pluck.ar( \n BrownNoise.ar(0.5), \n sig, \n 0.025, \n freq.kr( 1, i ).reciprocal, \n 3.7\n ) * 0.6;\n\n amp = Line.kr( dur: rrand( 1.0, 20.0) ) * max( 0, LFNoise1.kr( 0.05, 0.6, 0.4 ) ) ;\n sig = sig * amp;\n SendTrig.kr( amp <= 0, i, i );\n\n Pan2.ar( sig, 0.8.rand2 )\n }.play\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes an experiment with roots of unity in supercollider."}, {"role": "assistant", "content": "```supercollider\n(\n\n~divisors = {\n arg n;\n ~divs = List.newClear(0);\n for( 1, floor(sqrt(n)), {arg i; if(n%i==0,{\n //i.postln;\n ~divs.add(i);\n // (i==n.div(i)).postln;\n if(i==n.div(i),{},{~divs.add(n.div(i))});\n },{});\n });\n ~divs.sort;\n ~divs;\n};\n\n\nSynthDef(\\rootsOfUnitySum, { |out=0,freq=1,amp=1,n=1,ks=#[1]|\n var l,sigl,sigr,env;\n\n\n sigl = SinOsc.ar(freq:0,mul:0);\n sigr = SinOsc.ar(freq:0,mul:0);\n ks.do({arg item,i;\n k = item;\n sigr = sigr+SinOsc.ar(freq:freq*2pi*k/n,mul:amp,phase:0.5*pi);\n sigl = sigl+SinOsc.ar(freq:freq*2pi*k/n,mul:amp);\n });\n env = EnvGen.kr(Env.linen(attackTime: 0.001, sustainTime: 1, releaseTime: 0.01, level: 1.0, curve: 'lin'), doneAction: Done.freeSelf);\n sigr = sigr*env;\n sigl = sigl*env;\n\n Out.ar(out, [sigl,sigr])\n}).add;\n\n\n~getPbind = { arg n, amps, durs, freq;\n ~nums = ~divisors.value(n);\n r = Pbind(\\instrument,\\rootsOfUnitySum,\n \\amp,amps,\n \\dur,durs,\n \\freq,freq,\n \\n,Pseq([n],~nums.size),\n \\ks , Pseq(all{:~divisors.value(n),n<-~nums},1)).trace();\n r\n};\n\n~seq = (1..13);\n~tau = all{:~divisors.value(n).size,n<-~seq};\n\n\n~r = Pseq(all{:~getPbind.value(\n n:n,\n amps:Pseq(all{:0.5/t,t<-~tau},1),\n durs:Pseq(all{:0.3333/t,t<-~tau},1),\n freq:220/3),n<-~seq},1);\n\n~s = Pseq(all{:~getPbind.value(\n n:n,\n amps:Pseq(all{:0.5/t,t<-~tau},1),\n durs:Pseq(all{:0.5/t,t<-~tau},1),\n freq:110),n<-~seq},1);\n\n~t = Pseq(all{:~getPbind.value(\n n:n,\n amps:Pseq(all{:0.5/t,t<-~tau},1),\n durs:Pseq(all{:1/t,t<-~tau},1),\n freq:220),n<-~seq},1);\n\n~x = Pseq([\n Ppar([~t],1),\n Ppar([~s],1),\n Ppar([~s,~t],1),\n Ppar([~r],1),\n Ppar([~r,~t],1),\n Ppar([~r,~s],1),\n Ppar([~r,~s,~t],1),\n ],inf);\n\n);\n\nPdef(\\mplayer, ~x).clock_(TempoClock(100/60)).play;\nPdef(\\mplayer, Pn(Event.silent)).fadeTime_(8);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `CheckBox.defaultCanReceiveDrag` do?"}, {"role": "assistant", "content": "A view that toggles between two states. Returns: True if the current drag data is a Boolean."}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ var sig = SinOsc.ar(440) * 0.2; Out.ar(0, sig) }.play;\n```"}, {"role": "assistant", "content": "The minimal SynthDef idiom: a source multiplied by an amplitude, written to the master bus.\n\n`var sig = SinOsc.ar(440) * 0.2` builds the signal; `Out.ar(0, sig)` is the only mandatory part, because a\nUGen graph that never reaches an output produces no sound. `Out`'s first argument is the bus number — 0 is\nthe main stereo output — and the second is the signal. The function's return value does not matter here,\nwhich is why the `Out.ar` can sit on its own line. `.play` compiles this into an anonymous SynthDef and\nstarts one instance."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes old school noise from needle on vinyl."}, {"role": "assistant", "content": "```supercollider\n{\n var sig, sig1, sig2, lpf, popHz, lagtime, noise, popHzMul,\n pan1, pan2, panmod1, panmod2;\n popHzMul = Decay.kr(Dust.kr(0.15), 3, 10, 0.8);\n popHz = LFNoise1.kr(20).exprange(0.1,10) * popHzMul;\n sig = Dust2.ar(popHz);\n lpf = LFNoise1.kr(10).exprange(1000,20000);\n lagtime = LFNoise1.kr(20).range(0.008,0.0001);\n sig = LPF.ar(sig, lpf);\n sig = Lag.ar(sig, lagtime);\n sig = sig + FreeVerb.ar(sig, 0.8, 1, mul:0.11);\n panmod1 = LFNoise1.kr(5).range(0.2,0.7);\n panmod2 = LFNoise1.kr(5).range(0.2,0.7);\n pan1 = SinOsc.kr(panmod1).range(-0.2,0.2);\n pan2 = SinOsc.kr(panmod2).range(-0.2,0.2);\n sig1 = Pan2.ar(sig, pan1, 0.5);\n sig2 = Pan2.ar(sig, pan2, 0.5);\n sig = sig1 + sig2;\n sig = sig + BPF.ar(BrownNoise.ar([0.0025,0.0025]), 7200, 0.4);\n sig = sig + HPF.ar(Crackle.ar([1.999,1.999], 0.0025),2000);\n Out.ar(0, sig*6);\n}.play\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n(\nx = {\n |loDev = -6, hiDev = 5, lookBack = 2|\n var trig = Impulse.ar(5);\n // define maxLookBack, minLoDev and maxHiDev\n var midi = Demand.ar(trig, 0, DIdev(72, 11, -6, 5, lookBack, loDev, hiDev));\n midi.poll(5, label: \\midi);\n SinOsc.ar(midi.midicps.lag(0.007)) ! 2 * 0.1\n}.play;\n);\n\n\n// as lookBack equals 2, this defines a fixed sequence (up or down anyway)\n\n(\nx.set(\\loDev, -1);\nx.set(\\hiDev, 1)\n);\n\n\n// widen range\n// …\n```"}, {"role": "assistant", "content": "define maxLookBack, minLoDev and maxHiDev as lookBack equals 2, this defines a fixed sequence (up or down anyway) (DIdev: pseudo drate ugen, searches for numbers with integer distance from a source signal, optionally avoiding repetitions within a span)"}]} -{"conversations": [{"role": "user", "content": "What does `MIDIIn.polytouch` do? What arguments does it take?"}, {"role": "assistant", "content": "receive MIDI messages Arguments: value — a Function evaluated whenever a MIDI polytouch message is received. It is passed the following arguments:."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nPbind(\\note, PdegreeToKey(\n Pseq([1, 2, 3, 2, 5, 4, 3, 4, 2, 1], 2),\n #[0, 2, 3, 6, 7, 9],\n 12\n ),\n \\dur, 0.25\n).play;\n);\n\n\n(\nvar scales;\nscales = #[[0, 2, 3, 6, 7, 9], [0, 1, 5, 6, 7, 9, 11], [0, 2, 3]];\nPbind(\\note, PdegreeToKey(\n Pseq([1, 2, 3, 2, 5, 4, 3, 4, 2, 1], 4),\n Pdup(3, Prand(scales, inf)),\n 12\n ),\n \\dur, 0.25\n).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nPbind(\\note, PdegreeToKey(\n Pseq([1, 2, 3, 2, 5, 4, 3, 4, 2, 1], 2),\n #[0, 2, 3, 6, 7, 9],\n 12\n ),\n \\dur, 0.25\n).play;\n);\n\n\n(\nvar scales;\nscales = #[[0, 2, 3, 6, 7, 9], [0, 1, 5, 6, 7, 9, 11], [0, 2, 3]];\nPbind(\\note, PdegreeToKey(\n Pseq([1, 2, 3, 2, 5, 4, 3, 4, 2, 1], 4),\n Pdup(3, Prand(scales, inf)),\n 12\n ),\n \\dur, 0.25\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for reverbio (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"reverb\", {arg freq=440, release=0.1;\n var in, s1,out, mod1, depth, mfreq;\n s1 = SoundIn.ar(0,mul:2);\n out=FreeVerb.ar(s1,mix:1,room:MouseX.kr(0,1),damp:MouseY.kr(0,1));\n Out.ar(0,out);\n Out.ar(1,out);\n}).load(s);\n);\na = Synth(\"reverb\");\na.free\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Just experimental sketch of somewhere audio background."}, {"role": "assistant", "content": "```supercollider\n(\n{ \n Limiter.ar(\n GVerb.ar(\n ( \n BPF.ar(\n WhiteNoise.ar([0.07,0.07]) + Blip.ar([13,19], 200.rand, mul:0.5),\n SinOsc.kr(\n SinOsc.kr([1/108,1/109]).range(1/108, 1/13)\n ).exprange(10, 23000),\n PMOsc.kr(1/54,1/216, 3).range(0.1, 2)\n ) \n * \n SinOsc.ar(Array.rand(20, 1/216, 1), mul: Array.rand(20, 0.2, 1)).reshape(10,2)\n ).sum,\n roomsize:10,\n damping: PMOsc.kr(1/27, 1/108, 3).range(0.5, 1), \n drylevel: SinOsc.kr(1/9).range(0.1, 1)\n )\n +\n GVerb.ar(\n Pan2.ar(\n LPF.ar(\n DynKlank.ar(\n `[\n Array.rand(6, 600, 4000).collect({|freq|\n SinOsc.kr(1/108).range(freq/2,freq)\n }), \n nil, \n Array.rand(6, 1/108, 1/27).collect({|freq|\n SinOsc.kr(freq).range(1/108,1/3)\n })\n ],\n Limiter.ar(\n Dust.ar( SinOsc.kr(1/256).exprange(1/27, 3), TRand.kr(0.15, 0.25, Dust.kr(1/9))) \n + \n Impulse.ar( SinOsc.kr(1/108).exprange(1/54, 3), 0, TRand.kr(0.6, 0.8, Dust.kr(1/3)))\n )\n ),\n 1700,\n LFPar.kr(1/27).exprange(0.05, 0.2)\n ),\n SinOsc.kr(1/9).range(-0.2, 0.2)\n ),\n roomsize: 30,\n drylevel: 0.5\n )\n )\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nm = SimpleMIDIFile.read( \"~/Téléchargements/Super Mario Bros 2 - Mario Dreams.mid\" ); \n(\n TempoClock.default.tempo = m.tempo/60;\n Pdef(\\bla, \n Pbind(\n \\instrument, \\default,\n [\\midinote, \\dur, \\sustain, \\amp], Prout({ arg ev;\n var timescale = 1/16/60;\n var prevev;\n m.noteSustainEvents.collect({ arg item, idx;\n // [track, absTime, \\noteOn, channel, note, velo, dur, upVelo]\n if(idx == 0) {\n prevev = [item[4], item[1], item[6] * timescale, item[5]/127]\n } {\n prevev[1] = item[1] - prevev[1] * timescale;\n ev = prevev.yield;\n prevev = [item[4], item[1], item[6] * timescale, item[5]/127];\n };\n });\n prevev[1] = prevev[2];\n ev = prevev.yield;\n }),\n )\n ).play\n)\n```"}, {"role": "assistant", "content": "There is the .p method (see http://sccode.org/1-5aT) but here is also a way to retrieve the values directly."}]} -{"conversations": [{"role": "user", "content": "What does `CombN.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Comb delay line with no interpolation. Arguments: in — The input signal.; maxdelaytime — The maximum delay time in seconds. Used to initialize the delay buffer size.; delaytime — Delay time in seconds.; decaytime — Time for the echoes to decay by 60 decibels. If this time is negative, then the feedback coefficient will be negative, thus emphasizing only odd harmonics at an octave lower. Large decay times are sensitive to DC bias, so use a LeakDC if this is an issue. Infinite decay times are permitted. A decay ; mul — Output will be multiplied by this value.; add — This value will be added to the output.."}]} +{"conversations": [{"role": "user", "content": "What does `MFCC.kr` do? What arguments does it take?"}, {"role": "assistant", "content": "Mel frequency cepstral coefficients Arguments: chain — [fft] Audio input to track, which has been pre-analysed by the FFT UGen; see examples below for the expected FFT size.; numcoeff — [s] Number of coefficients, defaults to 13, maximum of 42; more efficient to use less of course!. Returns: `#coeff1, coeff2, ...`"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `MoogFF`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n// Play it with the mouse...\nx = { MoogFF.ar(WhiteNoise.ar(01.1), MouseY.kr(100, 10000, 1), MouseX.kr(0, 4)) }.play(s);\nx.free;\n\n// Mmmm, throbby\n(\nx = {\n MoogFF.ar(\n Pulse.ar([40, 121], [0.3, 0.7]),\n SinOsc.kr(LFNoise0.kr(0.42).range(0.001, 2.2)).range(30, 4200),\n 0.83 * 4) }.play(s);\n);\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ RLPFD.ar(Mix(LFSaw.ar([120, 180], 0, 0.33)), LinExp.kr(LFCub.kr(0.1, 0.5*pi), -1, 1, 280, 1500), 0.6, 0.5, mul:3.dup }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ RLPFD.ar(Mix(LFSaw.ar([120, 180], 0, 0.33)), LinExp.kr(LFCub.kr(0.1, 0.5*pi), -1, 1, 280, 1500), 0.6, 0.5, mul:3).dup }.play\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `FormantTable` in SuperCollider briefly."}, {"role": "assistant", "content": "FormantTable — Lookup table for emulating vocal tracts Returns a set of frequencies+resonances+amplitudes for a set of 5 bandpass filters, useful for emulating the main 5 formants of a vocal tract. To see the available voice types run this line: Category: Collections."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Resonz`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"noiseToPitch\", { arg out = 0, mul = 1;\n Out.ar(\n out,\n Resonz.ar(\n WhiteNoise.ar(mul),\n LFNoise0.kr(4, 110, 660),\n [0.005, 0.005]\n )\n )\n}).add;\n);\n\n(\n// activate left and right channels\nSynth(\"noiseToPitch\", [\\out, 0, \\mul, 1]);\nSynth(\"noiseToPitch\", [\\out, 1, \\mul, 1]);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n\nSynthDef(\\param, { arg freq = 100, sustain, amp;\n var sig;\n sig = LFPar.ar(freq: freq,\n mul: EnvGen.kr(Env.perc(0, sustain, 0.5), doneAction:2) * amp);\n sig = Splay.ar(sig);\n Out.ar(0, sig);\n}).add;\n\ne = Pbind(\n \\midinote, Prout({\n var tone0, tone1, tone2, interval, freq0, delta;\n loop {\n tone0 = rrand(0,11);\n interval = rrand(2,4);\n tone1 = Scale.minor(\\pythagorean).at(tone0) + [0,12,24].choose + 0.07;\n tone2 = Scale.minor(\\pythagorean).at(tone0 + interval) + [0,12,24].choose;\n freq0 = [tone1,tone2]+48;\n postln(freq0);\n freq0.yield;\n }\n }),\n \\dur, Prand([1,2,4,8,12,16,4,6,8], inf),\n \\instrument, \\param,\n \\amp, 0.5,\n \\sustain, 2,\n).play(quant:1); // returns an EventStream\nTempoClock.default.tempo = 1200/60;\n\n)\n```"}, {"role": "assistant", "content": "minor random bliss in two for Prout (a SuperCollider snippet)."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BrownNoise`."}, {"role": "assistant", "content": "```supercollider\n{ BrownNoise.ar(0.1) }.play;\n{ WhiteNoise.ar(0.1) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LeastChange`."}, {"role": "assistant", "content": "```supercollider\n(\nd = { |freq = 440|\n var internalFreq;\n internalFreq = LFNoise0.ar(0.3, 300, 800);\n SinOsc.ar(\n LeastChange.kr(freq, internalFreq) // two sources of change: one external, one internal\n ) * 0.1\n}.play\n);\n\nd.set(\\freq, 800);\nd.set(\\freq, 900);\nd.free;\n```"}]} +{"conversations": [{"role": "user", "content": "How big are you?"}, {"role": "assistant", "content": "198M parameters in total, 64M active per token because the feed-forward layers are a mixture of four experts with top-1 routing. That is small enough to train in minutes on one GPU."}]} +{"conversations": [{"role": "user", "content": "Saving \"Presets\"?"}, {"role": "assistant", "content": "SuperCollider forum — Saving \"Presets\"?\n\nIf you don’t care too much about it being human readable, just use writeArchive and readArchive:\n\n```supercollider\na = Array.fill(400, {rrand(0,2200)});\n\na.writeArchive(\"/Users/spluta1/Documents/SC/test\");\n\nb = Object.readArchive(\"/Users/spluta1/Documents/SC/test\");\n\nb.postln;\n```\n\nSam"}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nMix.ar([SinOsc.ar(220, 0, 0.1), SinOsc.ar(330, 0, 0.1)])\n```"}, {"role": "assistant", "content": "Sums two sine waves into one signal — a perfect fifth, 220 Hz and 330 Hz, at 0.1 amplitude each.\n\n`[SinOsc.ar(220, 0, 0.1), SinOsc.ar(330, 0, 0.1)]` is an Array of two audio-rate signals (each UGen\nreturns a signal; an array of them is just a list). `Mix.ar` adds the elements together. The alternative\n`+` operator does the same for two signals, and `Splay.ar` would spread them across the stereo field\ninstead of summing them."}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for seeking an Array!: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(// * //watch the postWindow\na=[\"m\",\"x\",\"f\",\"k\",\"d\",\"p\"];\nx=Array;\ny=x.newClear(6);\n~mxfkdp=Task({\n inf.do({y.put(x.series(6,0,1).choose,a.scramble).postln;\n 0.03.wait;})}).play;\nm=fork({inf.do({\n \"array num:\".postcln;\n if(y[x.series(6,0,1).choose.postcln]==a,\n {\"lo encontraste!/found it!\".postcln;\n 1.do({GVerb.ar(\n EnvGen.ar(Env.perc(0.01,8),1,doneAction:2)*\n Blip.ar(XLine.kr(440,1600,8)),50,10,0.02)}.play);\n ~mxfkdp.stop;\n m.stop;}, \n {\"buscando.../seeking...\".postcln;});\n 0.03.wait})});\n);\n//.SCtweetLong\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Main`?"}, {"role": "assistant", "content": "Main — The concrete instance of Process"}, {"role": "user", "content": "What does `Main.thisProcess` do?"}, {"role": "assistant", "content": "The singleton instance of Main is available through the special keyword thisProcess. For example, to find out what platform you're on: `thisProcess.platform; // --> e.g. \"an OSXPlatform\", \"a Linux`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nShutDown.add({ \"Good bye!!\".postln });\n```"}]} {"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `HPZ2`."}, {"role": "assistant", "content": "```supercollider\n// Compare:\n\n{ WhiteNoise.ar(0.25) }.play;\n\n{ HPZ2.ar(WhiteNoise.ar(0.25)) }.play;\n\n// HPZ2 is useful to detect changes in a signal:\n// see also HPZ1\n(\n{\n var changingSignal = LFNoise0.ar(1000);\n var hpz2 = HPZ2.ar(changingSignal);\n [hpz2, hpz2 > 0]\n}.plot\n);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `View.minWidth` do? What arguments does it take?"}, {"role": "assistant", "content": "Set minimum allowed width of the view, the view will not be able to shrink smaller in width, neither by user interaction nor Arguments: width — An Int.."}]} -{"conversations": [{"role": "user", "content": "What does `KeyCodeResponder.optionModifier` do?"}, {"role": "assistant", "content": "register responder functions for keycode and modifier combinations"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Stethoscope`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n(\n{\n SinOsc.ar([225, 450, 900], 0, 0.2)\n + LPF.ar(\n LFPulse.ar(226 * [1, 2, 5], [0, 0.1, 0.1], 0.2, 0.2),\n MouseX.kr(20, 10000, 1)\n )\n}.scope;\n);\n\n// server.scope only changes the properies explicitly given:\n\ns.scope(numChannels: 5);\ns.scope(index: 12);\ns.scope(zoom: 4);\ns.scope(index: 0);\n\ns.scopeWindow.size = 600;\ns.scopeWindow.size = 222;\n\n// scoping buses:\n\na = Bus.audio(s, 4);\n{ WhiteNoise.ar(0.2.dup(4)) }.play(s, a);\n\na.scope;\n\nc = Bus.control(s, 3);\n{ WhiteNoise.kr(1.dup(4) * MouseX.kr) }.play(s, c);\n\nc.scope;\n\n// note that scoping control rate buses shows block size interpolation (this is due to the\n// fact that ScopeOut.kr doesn't work yet.)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Nuclear Fallout (a SuperCollider snippet)?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n var saw, bpf;\n saw = Saw.ar(\n freq: [60,150],\n mul: LFPulse.kr(\n freq: [2,3],\n width: 0.15));\n \n { BPF.ar(\n in: WhiteNoise.ar(mul: 1),\n freq: 1000,\n rq: 0.9\n )\n}\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Mx.updateVarPooling` do?"}, {"role": "assistant", "content": "set up parent chain of unit environments that participate in"}]} -{"conversations": [{"role": "user", "content": "How to generate paradiddles?"}, {"role": "assistant", "content": "SuperCollider forum — How to generate paradiddles?\n\nHi Rodet, I’m teaching jazz at college, and sometimes paradiddles come up in conversation (although I’m not a drummer). A paradiddle is basically a way of ‘evenly’ playing a roll (single/double/triple/whatever). If you take your drumsticks/fingers and play evenly:\n\nright, left, right, right, left, right, left, left, right, left, right, right, etc\n\nyou’ll notice that it’s possible to get an even rhythm, which when played fast becomes a roll. The idea of the single/double/triple is just to place the accents (lightly, or not) on the left, right hand, which if I understand helps keep an even stroke (and makes better sense to follow).\n\nSo, although I don’t know the goal of your idea, a simple code which would give you the solution could be a pattern. You’ll notice I’ve put in a SynthDef to give the ‘snare’ sound - not very real, but just for the demonstration. If you run these patterns, un-commenting the line needed (single, double or triple - don’t forget to comment out the lines you don’t need), you’ll hear the accents a paradiddle gives.\n\nIn this example Pbind ‘a’ gives the pulse, and Pbind ‘b’ the accents. And, if you play along with them (using your chart), you’ll notice the accents pass from right hand to left hand (or vice versa). This is (more or less) what paradiddles do, although a drummer will explain better how they ‘accent’ strokes to get more complicated/subtle rhythms.\n\n```supercollider\n(\nSynthDef(\\snare, {\n arg out=0, sus=0.1;\n var sig, env;\n sig = WhiteNoise.ar(0.1);\n env = EnvGen.kr(Env.perc(0.001, sus), doneAction:2);\n sig = sig*env;\n Out.ar(out, sig!2);\n}).add;\n);\n\n(\nt=TempoClock(80/60);\na=Pbind(\n \\instrument, \\snare,\n \\dur, 1/2,\n \\sus, 0.01\n);\nb=Pbind(\n \\instrument, \\snare,\n \\dur, 1,\n \\sus, Pseq([0.02, 0.01],inf), // single\n //\\sus, Pseq([0.02, 0.01, 0.01],inf), // double\n //\\sus, Pseq([0.02, 0.01, 0.01, 0.01],inf), // triple\n);\nPpar([a, b]).play(t);\n)\n```\n\nI hope that puts you on the right track.\n\np.s. Don’t forget to try out changing the speed to get the real effect. Try something like 320/60 on the TempoClock."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for XoX pattern helper."}, {"role": "assistant", "content": "```supercollider\n(\n~xox = {|str| str.collectAs({|l| switch(l.toLower,$x, {1}, $o, {Rest(1)})}, Array)};\n);\n\n\n(\nSynthDef(\\acid, { arg out, freq = 1000, gate = 1, pan = 1, cut = 4000, rez = 0.8, amp = 1, sustain = 1, release = 0.5;\n var sig, env;\n env = EnvGen.kr(Env.linen(0.01, sustain, sustain * release), gate, amp, doneAction: Done.freeSelf);\n sig = Pulse.ar([freq,freq*1.001], 0.5);\n sig = sig + Pulse.ar(freq*0.501, 0.01, [0,0.5]);\n sig = sig + Pulse.ar(freq*1.99, 0.11, [0.5,0]);\n sig = RLPF.ar(sig, cut, rez);\n sig = Pan2.ar(sig);\n sig = sig * env;\n\n Out.ar(out, sig);\n}).add;\n);\n\n(\nPbind(\n \\instrument, \\acid,\n \\dur, Pseq(~xox.(\"xxooxoxo\") * 8/120, inf),\n \\scale, Scale.minor,\n \\degree, Pseq([0,4,5,3,3], inf),\n \\cut, Pwhite(100, 1500),\n \\rez, Pwhite(0.1, 0.8),\n \\amp, -10.dbamp,\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `OteyPiano` in SuperCollider?"}, {"role": "assistant", "content": "OteyPiano — Piano physical model. Should not use this class but OteyPianoString instead (see example) for having only one soundboard for all strings which is more efficient. Category: UGens > PhysicalModels."}]} -{"conversations": [{"role": "user", "content": "What does `ArraySpec.canAccept` do? What arguments does it take?"}, {"role": "assistant", "content": "datatype specifying an array with an itemSpec which describes its items Arguments: ting."}]} -{"conversations": [{"role": "user", "content": "Explain `ListPattern` in SuperCollider briefly."}, {"role": "assistant", "content": "ListPattern — abstract class that holds a list Category: Streams-Patterns-Events > Patterns > List."}]} -{"conversations": [{"role": "user", "content": "What is `PbindProxy`?"}, {"role": "assistant", "content": "PbindProxy — incremental event pattern reference"}, {"role": "user", "content": "What does `PbindProxy.new` do?"}, {"role": "assistant", "content": "Return a new instance of PbindProxy with the given patternpairs. Unlike Pbindef, it has no internal name. `a = PbindProxy(\\note, Pseq([0, 7, 9], inf), \\dur, 0.2).play;` It also supports keyword argument syntax: `a = PbindProxy(note: Pseq([0, 7, 9]), dur: 0.2).play;`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na = PbindProxy(\\note, Pseq([0, 7, 9], inf), \\dur, 0.2).play;\na.set(\\note, Pseq([0, 6, 10]));\na.stop;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Sieve.sect_o` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new Sieve object in mode 'points' with offsets, generated by the intersection of sets of Arguments: ... data — Alternating generators and integer offsets plus an optional integer limit, wrapped into a Ref, which is included when reached. Allowed generators: Integers, Streams or Patterns producing intervals or Sieves itself. Integers and Stream/Pattern output must be strictly positive. Integers as generators ."}]} -{"conversations": [{"role": "user", "content": "What does `HilbertH.calcImagCoeffs` do? What arguments does it take?"}, {"role": "assistant", "content": "Generate imaginary Arguments: size — The size of the kernel used for Hartley Phasing filtering.."}]} -{"conversations": [{"role": "user", "content": "What does `AudioMulchClock.startAction` do?"}, {"role": "assistant", "content": "A Function that is evaluated when the external clock is started (a `\\t_start` is"}]} -{"conversations": [{"role": "user", "content": "Explain `SwitchDelay` in SuperCollider briefly."}, {"role": "assistant", "content": "SwitchDelay — feedback delay line implementing switch-and-ramp buffer jumping A feedback delay line which allows moving the buffer read position using the switch-and-ramp technique as described by Miller S. Puckette in his Theory and Techniques of Electronic Music book. http://msp.ucsd.edu/techniques/latest/book-html/node63.html Category: UGens > Delays."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for how to generate the synthdef with a pattern?"}, {"role": "assistant", "content": "```supercollider\n(\nPdef(\\zed, \n Pbind(\n \\osc, Pseq([SinOsc, LFSaw],inf),\n \\instrument, Prout({ arg ev;\n SynthDef(\\zed, { arg out=0, gate=1, amp=0.1, pan=0, freq=200;\n var sig;\n sig = ev[\\osc].ar(freq);\n sig = sig * EnvGen.kr(\\adsr.kr(Env.adsr(0.1,0.1,0.8,0.1)), gate, doneAction:2);\n sig = Pan2.ar(sig, pan, amp);\n Out.ar(out, sig);\n }).add.yield;\n }).loop,\n \\degree, Pseq([0],inf),\n \\dur, 1,\n \\amp, 0.1,\n )\n).play;\n);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `XOut`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-SinOsc\", { |freq = 440, out|\n Out.ar(out, SinOsc.ar(freq, 0, 0.1))\n}).add;\n\nSynthDef(\"help-XOut\", { |out = 0, xFade = 1|\n var source;\n source = PinkNoise.ar(0.05);\n\n // write to the bus, crossfading with previous contents\n XOut.ar(out, xFade, source);\n\n}).add;\n);\n\nSynth(\"help-SinOsc\", [\\freq, 500]);\na = Synth.tail(s, \"help-XOut\");\n\n\na.set(\\xFade, 0.7);\na.set(\\xFade, 0.4);\na.set(\\xFade, 0.0);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BufFrames`."}, {"role": "assistant", "content": "```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n// indexing with a phasor\n{ BufRd.ar(1, b, Phasor.ar(0, BufRateScale.kr(b), 0, BufFrames.kr(b))) }.play;\n\n// indexing by hand\n{ BufRd.ar(1, b, K2A.ar(MouseX.kr(0, BufFrames.kr(b)))) }.play;\n\nb.free\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n// compares a 1102.5 Hz sine tone (11025 * 0.1, left) with a 1100 Hz tone (right)\n// the apollo sample has a sample rate of 11.025 kHz\n(\n{\n var freq;\n freq = [BufSampleRate.kr(b) * 0.1, 1100];\n SinOsc.ar(freq, 0, 0.1)\n}.play;\n);\n\nb.free;\n```"}, {"role": "assistant", "content": "compares a 1102.5 Hz sine tone (11025 * 0.1, left) with a 1100 Hz tone (right) the apollo sample has a sample rate of 11.025 kHz (BufSampleRate: Buffer sample rate.)"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Re: Variations for Z1 sawtooth?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n var mod = SinOsc.ar([0.1,0.15,0.2]).range(0,1);\n var sig = LFPulse.ar(1.1).range(1,10);\n var sig2 = LFNoise1.ar(0.08).range(0.99,1.01);\n var saw = LFSaw.ar([10,12,15]*sig*sig2);\n var out = (saw - ((saw>0)*mod)+(mod*0.5));\n Splay.ar(out)*0.1;\n}.play;\n\n{\n var mod = SinOsc.ar([0.1,0.15,0.2]).range(0,1);\n var sig = LFPulse.ar(1).range(1,10);\n var sig2 = LFTri.ar(0.1,[0,1,2,3]).range(1,10*sig);\n var sig3 = LFNoise1.ar(0.05).range(0.99,1.01);\n var saw = SinOsc.ar(LFSaw.ar([10,12,15]*sig2*sig3).range(200,300));\n var out = (saw - ((saw>0)*mod)+(mod*0.5));\n Splay.ar(out)*0.1;\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Server.setSharedControl` do?"}, {"role": "assistant", "content": "set the current value of a shared control bus to value. num is the index of the bus to set. This command is synchronous and only works with the internal"}]} -{"conversations": [{"role": "user", "content": "What does `MxChannelApp.db` do? What arguments does it take?"}, {"role": "assistant", "content": "get or set level by Arguments: db — dB. Returns: dB"}]} -{"conversations": [{"role": "user", "content": "Explain `Fb1_Duffing` in SuperCollider briefly."}, {"role": "assistant", "content": "Fb1_Duffing — Duffing pseudo ugen Fb1_ODE wrapper for the Duffing ODE system with external f: Category: Libraries > miSCellaneous > Nonlinear."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n\n{\n var input, kernel;\n\n input = SoundIn.ar(0);\n kernel = Mix.ar(LFSaw.ar([300, 500, 800, 1000] * MouseX.kr(1.0, 2.0), 0, 1.0));\n\n // must have power of two framesize\n Convolution.ar(input, kernel, 1024, 0.5)\n}.play;\n\n);\n\n(\n// must have power of two framesize- FFT size will be sorted by Convolution to be double this\n// maximum is currently a = 8192 for FFT of size 16384\n\na = 2048;\ns = Server.local;\n\n// kernel buffer\ng = Buffer.alloc(s, a, 1);\n);\n\n(\n\n// random impulse response\n\ng.set(0, 1.\n// …\n```"}, {"role": "assistant", "content": "must have power of two framesize must have power of two framesize- FFT size will be sorted by Convolution to be double this (Convolution: Real-time convolver.)"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Restricting fm to harmonic sidebands after[Chowning, 1973]?"}, {"role": "assistant", "content": "```supercollider\n(\n// restricting fm to harmonic sidebands after\n// [Chowning, 1973] Chowning, J. (1973). The synthesis of complex spectra by means of frequency modulation. Journal of the Audio Engineering Society, 21(7):526–534.\n// restriction actually happens because of the specs, not server-side.\n\nSpec.add(\\index, [0, 40]);\nSpec.add(\\harm1, [0, 20, \\lin, 1]);\nSpec.add(\\harm2, [0, 20, \\lin, 1]);\nSpec.add(\\fundFreq, \\freq);\n\nNdef(\\fmk, {\n \n PMOsc.ar(\n \\carFreq.kr(100, 0.1), \n (\\harm1.kr(1, 1)/(\\harm2.kr(1, 1)) * LFNoise1.ar(50).range(0.995, 1.001))*\\carFreq.kr(100), \n \\index.kr(1, 0.1) * SinOsc.ar(2.5).range(0.995, 1.005)\n ) \n})\n);\nNdef(\\fmk).gui\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Compare with Ex. 2 from DXFan help.\n// As DXFanOut, other than DXFan, doesn't return an array, a mix is not necessary, \n// by internal use of Out ugens the signal is mixed to the referred buses anyway.\n\n// For the same reason a normal release doesn't work, to get this option we can add an EnvGate.\n\n(\nx = {\n var lfo = { LFDNoise3.kr(0.2) };\n DXFanOut.ar(\n [Dseq([0, 1], inf), Dseq([1, 0], inf)],\n [\n LFTri.ar(150 * lfo.().range(1, 2), 0, 0.05),\n BPF.ar(PinkNoise.ar(), lfo.().range(1000, 3000),\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Compare with Ex. 2 from DXFan help.\n// As DXFanOut, other than DXFan, doesn't return an array, a mix is not necessary, \n// by internal use of Out ugens the signal is mixed to the referred buses anyway.\n\n// For the same reason a normal release doesn't work, to get this option we can add an EnvGate.\n\n(\nx = {\n var lfo = { LFDNoise3.kr(0.2) };\n DXFanOut.ar(\n [Dseq([0, 1], inf), Dseq([1, 0], inf)],\n [\n LFTri.ar(150 * lfo.().range(1, 2), 0, 0.05),\n BPF.ar(PinkNoise.ar(), lfo.().range(1000, 3000), 0.1, 0.7)\n ] * EnvGate(),\n fadeTime: 0.07,\n width: 1\n )\n}.play\n);\n\nx.release\n```"}]} -{"conversations": [{"role": "user", "content": "What is `AbsMxAdapter` in SuperCollider?"}, {"role": "assistant", "content": "AbsMxAdapter — internal usage. describes the behavior of a source object inlet or outlet These classes are used internally to describe the behavior of an outlet or inlet of a unit. For instance a unit may play on a bus, so its behavior type is identified as MxPlaysOnBus. The MxPlaysOnBus object is supplied methods for getting that bus and for getting the group and server where relevant. Category: Mx."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `FFTTrigger`."}, {"role": "assistant", "content": "```supercollider\n// Reminder: This isn't the intended typical usage! It's OK to do this though.\n(\nx = {\n var mags, phases, chain, sig;\n // Create simple undulating magnitudes\n mags = { FSinOsc.kr(ExpRand(0.1, 1)).range(0, 1) }.dup(100);\n // Then give them a \"rolloff\" to make the sound less unpleasant\n mags = mags * ((1, 0.99 .. 0.01).squared);\n // Let's turn the bins on and off at different rates, I'm *sure* that'll sound interesting\n mags = mags * { LFPulse.kr(2 ** IRand(-3, 5)).range(0, 1) }.dup(100);\n // Let's ignore phase for now\n phases = 0.dup(100);\n chain = FFTTrigger(LocalBuf(512), 0.5);\n // Now we can do the packing\n chain = PackFFT(chain, 512, [mags, phases].flop.flatten, 0, 99, 1);\n sig = IFFT(chain);\n sig.dup\n}.play\n);\nx.free;\nb.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What is `PSVop_i` in SuperCollider?"}, {"role": "assistant", "content": "PSVop_i — Sieve pattern for arbitrary set operations of integer generators with interval output Pattern for arbitrary set operations of integer generators with interval output. For an introduction and more examples see Sieves_and_Psieve_patterns. Category: Libraries > miSCellaneous > Sieves and Psieve Patterns, Streams-Patterns-Events > Sieves and Psieve Patterns."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n//you must have run this line before any of the examples below\nf= BBCutBuffer(Platform.resourceDir +/+ \"sounds/break.aiff\",8);\n\nTempoClock.default.tempo_(2.3);\n\n//default\na=BBCut2(CutBuf1(f),CageCut.new).play;\n\na.end;\n\n//weirder\na=BBCut2(CutBuf1(f),CageCut(8.0,[0.2,0.3,0.4,0.1])).play;\n\na.end;\n\n//using your own permutation function\na=BBCut2(CutBuf1(f),CageCut(16.0,[1,3,3,1,1,2,2,1],{arg array; array.scramble\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n//you must have run this line before any of the examples below\nf= BBCutBuffer(Platform.resourceDir +/+ \"sounds/break.aiff\",8);\n\nTempoClock.default.tempo_(2.3);\n\n//default\na=BBCut2(CutBuf1(f),CageCut.new).play;\n\na.end;\n\n//weirder\na=BBCut2(CutBuf1(f),CageCut(8.0,[0.2,0.3,0.4,0.1])).play;\n\na.end;\n\n//using your own permutation function\na=BBCut2(CutBuf1(f),CageCut(16.0,[1,3,3,1,1,2,2,1],{arg array; array.scramble; })).play;\n\na.end;\n\n//lots of stuff happening\na=BBCut2([CutBuf2(f, pbsfunc:SQPushFXPitch2.new),CutMod1(1.0,100,1.3,1.3)],CageCut({[16.0,8.0,4.0].wchoose([0.6,0.3,0.1])},[4,1,2,1,4,2,2],{arg array; if(0.2.coin,{array.reverse;},{array}); })).play;\n\na.end;\n\n\n//old jazzy backdrop\na=BBCut2([CutBuf2(f, 0.3),CutBPF1.new],CageCut({[16.0,8.0,4.0].wchoose([0.6,0.3,0.1])},[4,3,2,5,2,1,7],{arg array; if(0.2.coin,{array.scramble;},{array.permute(10.rand)}); })).play;\n\na.end;\n```"}]} -{"conversations": [{"role": "user", "content": "What is `IFFT` in SuperCollider?"}, {"role": "assistant", "content": "IFFT — Inverse Fast Fourier Transform The inverse fast fourier transform converts from frequency content to a signal. Category: UGens > FFT."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Nuclear Fallout (a SuperCollider snippet)?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n var saw, bpf;\n saw = Saw.ar(\n freq: [60,150],\n mul: LFPulse.kr(\n freq: [2,3],\n width: 0.15));\n \n { BPF.ar(\n in: WhiteNoise.ar(mul: 1),\n freq: 1000,\n rq: 0.9\n )\n}\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for reqs: sc3-plugins."}, {"role": "assistant", "content": "```supercollider\n(\nfork {\n TempoClock.tempo = 1;//156/60;\n Ndef(\\ttso).play;\n loop {\n var seed = thisThread.randSeed = 100000000.rand.debug('seed');\n var wait = 20.rrand(60).debug('wait');\n Ndef(\\ttso, {\n var gamma= {[rrand(30,50),rrand(50,70),rrand(50,70),rrand(70,100)].choose.midicps*LFNoise2.kr(1,0.01,1)}!24;\n Pan2.ar(\n LeakDC.ar(\n Normalizer.ar(\n BPeakEQ.ar(\n FreeVerb.ar(\n Splay.ar(RLPF.ar(LFSaw.ar(gamma)/4,gamma*LFCub.kr(rrand(0.01,0.1),0,2,3),LFNoise2.kr(1/8,0.6,0.7))),\n 0.1,0.1,0.1\n ),\n [100.rrand(200),1000.rrand(2000),5000.rrand(7000),10000.rrand(15000)],Array.rand(4,0,6),Array.rand(4,0,6)\n ).mean,\n 0.8,0.1\n )\n ),\n LFNoise2.kr(0.1.exprand(10)).range(-0.1,0.1),\n SelectX.kr(\n [SinOsc,LFTri].choose.kr(2.rrand(25).reciprocal).range(0,2),\n [\n 0.7.rrand(1),\n LFGauss.kr(\n Latch.kr(\n LFNoise2.kr(1).range(1/5,5.rrand(20)).reciprocal, \n Impulse.kr(LFNoise2.kr(3.rrand(10).reciprocal).range(0.5,3.rrand(6)))\n ),\n SinOsc.kr(3.rrand(15).reciprocal).range(0.07.rrand(0.16),0.25.rrand(0.4))\n ),\n 0.1.rrand(0.5)\n ]\n )\n )\n }).fadeTime_(3.rrand(6));\n wait.wait;\n }\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Will nobody switch the damn thing off??"}, {"role": "assistant", "content": "```supercollider\n(\n\n{\nvar dseq, trig;\n\ndseq = Dseq([SinOsc.ar(45).range(-5, 12), SinOsc.ar(SinOsc.ar(0.285).range(42, 48)).range(-9, 19), 9, 0, -12], inf);\ntrig = Impulse.ar(SinOsc.ar(0.2).range(44, 46));\nSinOsc.ar(\n (77 + Demand.ar(trig, 0, dseq)).midicps,\n 0,\n 0.5\n) ! 2\n\n\n}.play\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\nn = NetAddr(\"localhost\", 12345);\nn = s.addr;\n\n// Example sending symbols, integers, and a float\nn.sendMsg('/s_new', \\default, 2000, 0, s.defaultGroup.nodeID, \\freq, 60.midicps);\n\n// The initial forward slash can be omitted\nn.sendMsg(\\n_set, 2000, \\gate, 0);\n\n// Using the performList syntax, you can use an array to store an OSC message\n~msg = [\\n_set, 2000, \\gate, 0];\nn.sendMsg(*~msg);\n```"}, {"role": "assistant", "content": "Example sending symbols, integers, and a float The initial forward slash can be omitted (NetAddr: network address)"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// python preprocessor, given that you have python installed\n// thanks to tasos tsesmetzis\n\n(\nthis.preProcessor = PreProcessor.new.startDelimiter_(\"{-\").endDelimiter_(\"-}\");\n\n// a simple python call\ne = (\n lang: \\python,\n languages:\n (\n python: // code is the incoming string, event is the event for parameters and output\n {|code, event|\n var input, pipe, output;\n code = e[\\prefix] ++ \"print\" ++ \"(\" ++ code ++ \")\";\n input = \"python -c '%'\".format(code);\n pipe = Pipe(input, \"r\");\n output = pipe.readUpTo;\n pipe.close;\n event.put(\\result, output)\n }\n ),\n prefix: \"import math;\"\n);\n);\n\n// ok, assuming such a little interpreter exists for a given language,\n// one can now use it in code.\n\n(\ne =\n{-\n math.factorial(61)\n-}.value(e);\ne.result;\n);\n\ne.calc_result = e.result.as(Array).collect { |x| x.asString.interpret };\n\nPbind(\\note, Pseq(e.calc_result), \\dur, 0.1).play;\n```"}, {"role": "assistant", "content": "python preprocessor, given that you have python installed thanks to tasos tsesmetzis."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for LFDNoise Modular version?"}, {"role": "assistant", "content": "```supercollider\n(\n~lfd={\n var signal, myFrequency, frequencyMin=0.1, frequencyMax=30, myAmplitude, amplitudeMin=0.01, amplitudeMax=0.6, myPhase, phaseMin=0, phaseMax=1.5;\n myFrequency = Array.fill(2, {[rrand(frequencyMin, frequencyMax)]});\n myAmplitude = Array.fill(2, {[rrand(amplitudeMin, amplitudeMax)]});\n myPhase = Array.fill(2, {[rrand(phaseMin, phaseMax)]});\n signal = LeakDC.ar([LFDNoise1, LFDNoise0, LFDNoise3, LFDClipNoise].choose.ar(myFrequency, myPhase, myAmplitude));\n Out.ar(0, signal);\n};\n);\n\n~lfd.scope\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for simple melody algorithmically generated with a Markov Chain."}, {"role": "assistant", "content": "```supercollider\n/* Markov Chain Experiment II\n Jacob Joaquin\n\n Get a visual representation of the Markov Chain here:\n http://codehop.com/supercollider-markov-chain/\n*/\n\n(\n// Synthesizer\nSynthDef(\\my_synth, {|dur = 1.0, amp = 1.0, freq = 440|\n var env = EnvGen.ar(Env.new([1, 0.1, 0], [0.06, dur - 0.06]), doneAction: 2);\n Out.ar([0, 1], SinOsc.ar([freq * 0.995, freq * 1.005], 0, env * amp))\n}).add; \n\n// Create task\nt = Task({\n // Set attributes of each node\n // [freq, dur, [[next_state, weighted_random],…]]\n var node_list = [\n [60, 1, [[1, 2]]],\n [62, 0.5, [[0, 1], [2, 1]]],\n [63, 1, [[0, 1], [3, 1]]],\n [65, 0.5, [[0, 1], [3, 4], [4, 1]]],\n [67, 1, [[5, 1]]],\n [70, 1.5, [[4, 1], [6, 2]]],\n [69, 1, [[4, 1], [7, 2]]],\n [72, 0.5, [[4, 1], [7, 4], [0, 2]]]\n ];\n\n var node_index = 0;\n var bps = 133.0 / 60.0; // Beats per second\n \n inf.do({\n var weight = 0;\n var random;\n var accumulator;\n var node = node_list[node_index]; \n var freq = node[0].midicps;\n var dur = node[1] / bps;\n var paths = node[2];\n \n // Get total statistical weight of connected nodes\n (0 .. paths.size - 1).do {|i| weight = weight + paths[i][1]};\n \n // Generate random value for choosing next node\n random = weight.rand;\n\n // Choose next node based on statistical weights\n accumulator = paths[0][1];\n \n node_index = block {|break|\n paths.size.do {|i|\n if ((random < accumulator), {\n break.value(paths[i][0])\n }, {\n accumulator = accumulator + paths[i + 1][1] \n })\n }\n };\n \n // Play\n Synth(\\my_synth, [\\dur, dur, \\amp, -3.dbamp, \\freq, freq]); \n dur.wait;\n })\n});\n\nt.start;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(SynthDef(\\x, {|midi = 60, amp = 0.8| Out.ar(0, Pan2.ar(SinOsc.ar(midi.midicps, mul: EnvGen.kr(Env.perc(0, 0.5), timeScale: 0.5, levelScale: 0.3)), Rand(-1, 1)) * EnvGen.kr(Env.perc(0, 0.5), timeScale: 1.3*0.5, levelScale: Rand(0.3, 0.5), doneAction:2));}).add;)\n\n(~phase = Pbind(*[ instrument: \\x, dur: 0.5, midi: Pseq([0, 4, 7] + 60, inf)]);\n5.do({|val| ~phase.play(TempoClock.new((110 + (0.5 * val)) / 60))}); )\n```"}, {"role": "assistant", "content": "Experimenting with some Reich style phasings\r\n\r\nAudio: http://soundcloud.com/schemawound/goodnightworld."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// =========================\n// extra demos for \\glockenspiel\n// =========================\n\n(\n// made by Diya Menon\n// demo\nPbindef(\\dmglockenspiel,\n \\instrument, \"glockenspiel\",\n \\midinote, Pseq([\n [65, 68, 72, 75],\n 72, 72, 72, 70, 72, 70, 68,\n [61, 65, 70, 73, 77],\n 73, 73, 73, 72, 72, 70, 68], 2),\n \\amp, Pseq([0.015, 0.005, 0.005, 0.0075, 0.0075, 0.01, 0.01, 0.02], 4) * 3,\n \\dur, Pseq([0.3, 0.3, 0.3, 0.15, 0.15, 0.3, 0.15, 0.15], 4),\n \\rel, 3,\n \\exciterRel, 0.03,\n \\att, 0.0005,\n).play;\n)\n```"}, {"role": "assistant", "content": "========================= extra demos for \\glockenspiel =========================."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n VarLag.kr( // lag the modulator\n LFPulse.kr(1).range(100, 400), // frequency modulator\n 0.2, // lag time\n Line.kr(-8, 8, 15, doneAction: Done.freeSelf) // modulate shape\n ),\n 0, // sine phase\n 0.3 // sine amplitude\n )\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n VarLag.kr( // lag the modulator\n LFPulse.kr(1).range(100, 400), // frequency modulator\n 0.2, // lag time\n Line.kr(-8, 8, 15, doneAction: Done.freeSelf) // modulate shape\n ),\n 0, // sine phase\n 0.3 // sine amplitude\n )\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n//a SynthDef\n(\nSynthDef(\"plucking\", {arg amp = 0.1, freq = 220, decay = 5, coef = 0.1;\n\nvar env, snd;\nenv = EnvGen.kr(Env.linen(0, decay, 0.5), doneAction: 2);\nsnd = Pluck.ar(\n in: Saw.ar(freq, 0.5*amp),\n trig: Impulse.kr(0),\n\n maxdelaytime: 0.1,\n delaytime: freq.reciprocal,\n decaytime: decay,\n coef: coef);\n Out.ar(0, [snd, snd]);\n}).add;\n);\n\n//Bugger soundtrack\n(\nPbind(\n \\instrument, \"plucking\",\n \\scale, Scale.lydian,\n \\degree, Prand([[-2.5, -4.001], [-7.002, -5], [-1, -3.003], [1.005, 0.51]], inf),\n \\amp, Pseq([0.1, 0.2, 0.3, 0.4, 0.5, 0.5, 0.5, 0.5], inf),\n \\decay, Pseq([0.25,1, 0.5, 0.125], inf),\n \\coef, Pseq([0.7, 0.8, 0.9], inf),\n \\dur, Pseq([0.01, 0.0025, 0.2475, 0.24, 0.5], inf)\n).play;\n)\n```"}, {"role": "assistant", "content": "This will be the sound track for Bugger, a Frogger clone that started as a school assignment.\r\nSimple SynthDef using Pluck, and a few Pbinds. \r\n\r\nBugger can be found on [GitLab](https://gitlab.com/Modanung/Bugger)."}]} -{"conversations": [{"role": "user", "content": "What does `FoaEncoderMatrix.numOutputs` do?"}, {"role": "assistant", "content": "Answers the number of outputs for the encoder. 3 for 2D and 4 for"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\na = RecNodeProxy.audio(s, 2);\na.source = { SinOsc.ar([400, 500], 0, 0.1) };\na.play; // monitor;\na.open(\"xproxySpace.aif\");\na.record(false);\n\na.source = { SinOsc.ar([400, 700], 0, 0.1) };\na.source = { SinOsc.ar([410, 510], 0, 0.1) };\na.source = { SinOsc.ar([LFNoise1.kr(80, 100, 300), 500], 0, 0.1 };\n\n// stop recording and close file\na.close;\n\n// monitor off\na.stop;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\na = RecNodeProxy.audio(s, 2);\na.source = { SinOsc.ar([400, 500], 0, 0.1) };\na.play; // monitor;\na.open(\"xproxySpace.aif\");\na.record(false);\n\na.source = { SinOsc.ar([400, 700], 0, 0.1) };\na.source = { SinOsc.ar([410, 510], 0, 0.1) };\na.source = { SinOsc.ar([LFNoise1.kr(80, 100, 300), 500], 0, 0.1) };\n\n// stop recording and close file\na.close;\n\n// monitor off\na.stop;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Interface.keyDownAction` do?"}, {"role": "assistant", "content": "Sets up an environment in which you can build a player, a GUI and responders for midi and keyboard control"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SinOsc`."}, {"role": "assistant", "content": "```supercollider\n// create an audio-rate sine wave at 200 Hz,\n// starting with phase 0 and an amplitude of 0.5\n{ SinOsc.ar(200, 0, 0.5) }.play;\n\n// modulate the frequency with an exponential ramp\n{ SinOsc.ar(XLine.kr(2000, 200), 0, 0.5) }.play;\n\n// more complex frequency modulation\n{ SinOsc.ar(SinOsc.ar(XLine.kr(1, 1000, 9), 0, 200, 800), 0, 0.25) }.play;\n\n// phase modulation (see also PMOsc)\n{ SinOsc.ar(800, SinOsc.ar(XLine.kr(1, 1000, 9), 0, 2pi), 0.25) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `QPenPrinter.pageRect` do?"}, {"role": "assistant", "content": "Get the page bounds, which is the printable area and usually smaller than #-paperRect due to Returns: a Rect"}]} -{"conversations": [{"role": "user", "content": "What is `Stream`?"}, {"role": "assistant", "content": "Stream — Stream is the base class for classes that define streams"}, {"role": "user", "content": "What does `Stream.play` do?"}, {"role": "assistant", "content": "Streams that return numbers can be played directly with the play message. Streams that return events need to be wrapped in an EventStreamPlayer. See #-asEventStreamPlayer."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// play at the next beat, with offset 0.4\n(\nRoutine({ loop {\n \"***\".postln; 0.5.wait;\n \"_*_\".postln; 0.1.wait;\n} }).play(quant: [1, 0.4]);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is the difference between the language and the server?"}, {"role": "assistant", "content": "sclang runs your code, the clock and Patterns, and builds UGen graphs. scsynth performs the DSP in real time. They communicate over OSC, which is why a language-side mistake can leave a sound running, and why s.freeAll stops it."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Another Star Wars inspired sound effect."}, {"role": "assistant", "content": "```supercollider\n(\n\n{\n\nvar flutter, flutterAmt = 0.02, humPitch = 88, hum, humLevel = 0.3, amp = 1.0, output;\nvar swing, swingNoise, swingLevel = 1.0, swingSwitch, swingThresh = 0.87;\nvar clash, clashTrig, clashDecay, clashEnvGen, clashSpring, clashLevel = 0.6;\n\nflutter = 4.collect(\n { \n |i|\n LFNoise0.kr(rrand(3, 16), flutterAmt, 1).lag(0.48);\n }\n);\n\nhumPitch = humPitch * StandardL.ar(2, 3.7).range(0.97, 1.03);\n\nhum = Mix(SyncSaw.ar([humPitch, humPitch * 1.001] * flutter.copyRange(0, 1), [humPitch * 1.003, humPitch * 1.0025] * flutter.copyRange(2, 3)));\nhum = hum * LFNoise0.kr(8.77224).range(0.2, 1.0).lag(0.4);\nhum = RLPF.ar(hum, LFNoise0.kr(21).range(200, 1800).lag(1.2), 0.5) * 0.1 * humLevel;\n\nhumPitch = humPitch * StandardL.ar(3.8, 2.9).range(0.93, 1.07);\n\nswingNoise = LFNoise1.kr(16.2).range(0, 1);\nswingSwitch = if(swingNoise > swingThresh, 1, 0).lag2(0.9, 1.3);\nswingLevel = swingLevel * swingSwitch;\n\nhumPitch = humPitch * StandardL.ar(3.8, 2.9).range(0.97, 1.03) * (1 + (swingSwitch * 0.2));\n\nswing = SyncSaw.ar(humPitch * 0.501, humPitch * 1.09);\nswing = LPF.ar(swing, 4300);\nswing = swing * swingLevel;\n\nclashTrig = Trig.kr(\n Schmidt.kr(1 - swingSwitch, swingThresh, swingThresh + 0.01),\n 0.01\n);\n\nclashDecay = TRand.kr(0.1, 1.6, clashTrig);\nclashEnvGen = Decay.kr(clashTrig, clashDecay) * TRand.kr(0.8, 1.0, clashTrig);\nclashSpring = Spring.kr(clashTrig, TRand.kr(5, 20, clashTrig), TRand.kr(0.001, 0.07, clashTrig));\nclash = SinOsc.ar(8000 * clashSpring + TRand.kr(600, 2342, clashTrig), SinOsc.ar(TRand.kr(452, 662, clashTrig), 0, 2));\nclash = clash + BPF.ar(WhiteNoise.ar(2), SinOsc.kr(2.6).range(3326, 4444), 0.16);\nclash = clash * clashEnvGen;\nclash = clash + ( clash * SinOsc.ar(39) * SinOsc.ar(3013) * 0.3);\nclash = clash * 0.1 * clashLevel;\n\noutput = hum + swing + clash; \n\n(output * amp) ! 2\n\n}.play\n\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `IndexL.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Index into a table with a signal, linear interpolated Arguments: bufnum — index of the buffer.; in — the input signal.."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Midterm Question 2 (a SuperCollider snippet)?"}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"sawSynth\", {arg freq, amp;\n \n Out.ar(0, Splay.ar(LPF.ar(in: Saw.ar(freq * [0.99, 1.0, 1.001, 1.008], mul:Env.perc(attackTime:0.1, releaseTime:2, level:amp).kr(2)),freq: 2000)))\n\n}).add;\n);\n\n(\nPbind(\n \\instrument, \"sawSynth\",\n \\degree, Pseq([1,3,5,7], inf),\n \\dur, 0.111, \n \n).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n~buf = BBCutBuffer(Platform.resourceDir +/+ \"sounds/break.aiff\", 8);\n\nBBCut2(CutGroup([CutBuf3(~buf2, 0.3, pbsfunc: CutPBS1(0.5))]), BBCutProc11()).play(2.5;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n~buf = BBCutBuffer(Platform.resourceDir +/+ \"sounds/break.aiff\", 8);\n\nBBCut2(CutGroup([CutBuf3(~buf2, 0.3, pbsfunc: CutPBS1(0.5))]), BBCutProc11()).play(2.5);\n```"}]} -{"conversations": [{"role": "user", "content": "I get 'FAILURE IN SERVER /s_new SynthDef not found'. What is wrong?"}, {"role": "assistant", "content": "The server does not know that SynthDef. Three usual causes, in order of likelihood:\n\n1. **The SynthDef was added before the server booted.** `SynthDef(...).add` is asynchronous; wrap the work\n in `s.waitForBoot { ... }` or put `s.sync` after `.add`.\n2. **The name does not match.** `SynthDef(\\bell, ...)` is played by `Synth(\\bell)`, not `\\Bell` — symbols\n are case-sensitive.\n3. **`.add` was never called.** Writing `SynthDef(\\bell, { ... })` without `.add` builds the definition in\n the language and sends nothing.\n\nCheck with `SynthDescLib.global.dict.keys` — if the name is not there, it never reached the server."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar(300),\n Pulse.ar(230)\n ];\n\n LinSelectX.ar(MouseX.kr(0, 1) * a.size, a) * 0.2\n}.play;\n);\n\n(\n{\n var a;\n a = [\n SinOsc.kr(0.25),\n LFSaw.kr(10),\n LFPulse.kr(0.3)\n ];\n\n SinOsc.ar(LinSelectX.kr(MouseX.kr(0, 1) * a.size, a) * 300 + 400) * 0.2\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar(300),\n Pulse.ar(230)\n ];\n\n LinSelectX.ar(MouseX.kr(0, 1) * a.size, a) * 0.2\n}.play;\n);\n\n(\n{\n var a;\n a = [\n SinOsc.kr(0.25),\n LFSaw.kr(10),\n LFPulse.kr(0.3)\n ];\n\n SinOsc.ar(LinSelectX.kr(MouseX.kr(0, 1) * a.size, a) * 300 + 400) * 0.2\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pnsym`."}, {"role": "assistant", "content": "```supercollider\n(\n// load a synthdef\ns.boot;\nSynthDef(\"gpdef\",\n { |out = 0, freq = 440, sustain = 0.05, amp = 0.1, pan|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain), doneAction: Done.freeSelf) * amp;\n Out.ar(out, Pan2.ar(SinOsc.ar(freq, 0, env), pan))\n }).add;\n);\n\nPdefn(\\x, Pn(1, 3));\nPdefn(\\y, Prand([5, 9, 1], 2));\nPdefn(\\z, Pdefn(\\y) * 2);\n\n(\nPdef(\\play,\n Pbind(\n \\instrument, \\gpdef,\n \\harmonic, Pnsym(Pseq([\\x, \\x, Prand([\\x, \\y]), [\\z, \\y], \\y], inf)).trace,\n \\dur, 0.2, \\note, 10\n )\n).play;\n);\n\n// change root pattern:\nPdefn(\\x, Pn(2, 3));\nPdefn(\\x, Pseq([1, 3, 1, 2, 1, 4, 5]));\nPdefn(\\x, Pseq([1, 3, 1, 2, [1, 3], 4, 5]));\n```"}]} -{"conversations": [{"role": "user", "content": "What is the difference between ~foo and a local variable?"}, {"role": "assistant", "content": "`var foo` is a local: it exists only inside the function or file block that declares it. `~foo` is an environment variable: it lives in the current Environment, survives between executions of the same block, and is visible to everything running in that environment. That is why `~buf = Buffer.read(s, path)` works in one cell and `PlayBuf.ar(1, ~buf)` works in the next, while a `var` would be gone."}]} -{"conversations": [{"role": "user", "content": "What does `Env.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Instead of using an EnvGen inside a UGen graph, this message does the same implicitly for convenience. Its argument order corresponds to the most common Arguments: doneAction — An integer representing an action to be executed when the env is finished playing. This can be used to free the enclosing synth, etc. See Done for more detail.; gate — This triggers the envelope and holds it open while > 0. If the Env is fixed-length (e.g. Env.linen, Env.perc), the gate argument is used as a simple trigger. If it is an sustaining envelope (e.g. Env.adsr, Env.asr), the envelope is held open until the gate becomes 0, at which point is released. If g; timeScale — The durations of the segments are multiplied by this value. This value can be modulated, but is only sampled at the start of a new envelope segment.; levelScale — The levels of the breakpoints are multiplied by this value. This value can be modulated, but is only sampled at the start of a new envelope segment.; levelBias — This value is added as an offset to the levels of the breakpoints. This value can be modulated, but is only sampled at the start of a new envelope segment.."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for UI sounds (pt1)."}, {"role": "assistant", "content": "```supercollider\n// UI sounds\n// this code is an attempt to recreate a sound\n// inspired from some technological/electrical UI interface\n\n// 1. first define the synth\n// Here we are using the FM technique\n(\nSynthDef(\\fmmod, {\n |\n amp=0.2,\n fc=1000,\n fm = 100,\n idx = 100,\n atk=0.01,\n rls=0.1\n |\n var env = EnvGen.ar(Env.perc(atk, rls), doneAction:2);\n var modulator = SinOsc.ar(fm);\n var carrier = SinOsc.ar(fc + (idx*modulator) );\n var sig = carrier * env * amp;\n sig = HPF.ar(sig, 1000);\n Out.ar(0, sig!2);\n}).add;\n);\n\n// 2. then define the Pbind which will play the sequence\n// of UI sounds simulating variuos characters showing up on an\n// imaginary display.\n// Play around FC, FM, ATK and RLS to obtain different sound characters.\n(\np = Pbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 100,\n \\idx, 100,\n \\amp, 0.6,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).asEventStreamPlayer;\n);\n\n// 3. play it\np.play;\n\n// 4. Here are some presets\n\n// \"cricket\" preset\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 100,\n \\idx, 100,\n \\amp, 0.6,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 2\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 1000,\n \\idx, 100,\n \\amp, 0.6,\n \\atk, 0.001,\n \\rls, 0.01,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 3\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 100,\n \\idx, 10,\n \\amp, 0.4,\n \\atk, 0.01,\n \\rls, 0.01,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 4\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 1000,\n \\fm, 100,\n \\idx, 1000,\n \\amp, 0.2,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n\n// preset 5\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 5000,\n \\fm, 1000,\n \\idx, 1000,\n \\amp, 0.4,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 5\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 8000,\n \\fm, 1000,\n \\idx, 1000,\n \\amp, 0.7,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Variations for Z1 sawtooth."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var mod = SinOsc.ar([0.1,0.15,0.2]).range(0,1);\n var saw = LFSaw.ar([10,12,15]);\n var out = (saw - ((saw>0)*mod)+(mod*0.5));\n Splay.ar(out)*0.4;\n}.play;\n\n{\n var mod = SinOsc.ar([0.1,0.15,0.2]).range(0,1);\n var saw = SinOsc.ar(LFSaw.ar([10,12,15]).range(200,300));\n var out = (saw - ((saw>0)*mod)+(mod*0.5));\n Splay.ar(out)*0.4;\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Real-time pattern morphing with Ndef."}, {"role": "assistant", "content": "```supercollider\n(\n~name = \"saw\";\n\nSynthDef(~name, { arg out=0, amp=0.1, gate=1, pan=0, spread=0.8, freq=200, doneAction=2, ffreq=300, rq=0.3;\n var sig;\n sig = LFSaw.ar(freq);\n sig = RLPF.ar(sig, ffreq, rq);\n sig = sig * EnvGen.ar(\\adsr.kr(Env.adsr(0.01,0.1,0.8,0.1)),gate,doneAction:doneAction);\n sig = Splay.ar(sig, spread, amp, pan);\n Out.ar(out, sig);\n}).add;\n\n\n~morph = { arg mainkey, lagtime, pat;\n var base = pat.asStream.next(());\n var bind = List.new;\n var proxy;\n base.keysValuesDo { arg key, val;\n var ndefkey = \"%.%\".format(mainkey, key).asSymbol;\n Ndef(ndefkey, { \n Line.kr(Ndef(ndefkey).kr, val, lagtime)\n });\n proxy = Ndef(ndefkey);\n bind.add(key);\n bind.add(proxy.bus.asMap);\n };\n Pbind(*bind)\n};\n);\n\n\nPdef(~name).play;\n\n\n(\n// preset 1\n\n~a = Pdef(~name, ~morph.(\\bla, 2.1, Pbind(\n \\freq, 100,\n \\ffreq, 1300,\n)) <> Pbind(\n \\instrument, ~name,\n \\dur, 1,\n));\n\n);\n\n(\n// preset 2\n\n~a = Pdef(~name, ~morph.(\\bla, 1, Pbind(\n \\freq, 1500,\n \\ffreq, 200,\n)) <> Pbind(\n \\instrument, ~name,\n \\dur, 1,\n));\n\n);\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// vary frequency - these parameters are for \"one-pulse\" orbit\n{ RosslerL.ar(MouseX.kr(20, SampleRate.ir), 0.36, 0.35, 4.5) * 0.3 }.play(s);\n\n// randomly modulate params\n(\n{ RosslerL.ar(\n SampleRate.ir, \n 0.2, // First variable tends to lead to NaN if modulated in this example\n LFNoise0.kr(1, 0.01, 0.2),\n LFNoise0.kr(1, 0.2, 0.7)\n) * 0.2 }.play(s);\n)\n\n// as a frequency control\n{ SinOsc.ar(Lag.ar(RosslerL.ar(MouseX.kr(1, 200)))*800+900)*0.4 }.play\n// …\n```"}, {"role": "assistant", "content": "vary frequency - these parameters are for \"one-pulse\" orbit randomly modulate params (RosslerL: Rossler chaotic generator)"}]} -{"conversations": [{"role": "user", "content": "What does `AbstractWrappingDispatcher.getKeysForFuncProxy` do? What arguments does it take?"}, {"role": "assistant", "content": "Subclasses should override this to return an Array containing all the keys at which the specified responder func's functions are stored in this dispatchers active Arguments: funcProxy — An instance of a subclass of AbstractResponderFunc.. Returns: An Array."}]} -{"conversations": [{"role": "user", "content": "What does `NetAddr.localIP` do? What arguments does it take?"}, {"role": "assistant", "content": "Get the local IP address as a Arguments: network — An optional IP string to select a particular network. This might be necessary if your machine is connected to multiple networks. Typically, you would use the IP address of the router, but it can really be any address within the network.."}]} -{"conversations": [{"role": "user", "content": "What does `KDRMaskTester.value` do? What arguments does it take?"}, {"role": "assistant", "content": "KeyCodeResponder utility for comparing modifier masks Arguments: view; char; modifier; unicode; keycode."}]} +{"conversations": [{"role": "user", "content": "How current is your SuperCollider knowledge?"}, {"role": "assistant", "content": "It comes from a snapshot of the SuperCollider repository (documentation, class library and examples) plus code I can reason about. So classes and arguments in that snapshot I know well, including argument order. Quarks, newer UGens, and anything outside the official tree I may not know at all, and I will say so rather than invent a method name. If you need certainty about a class, check its help page — `SinOsc.schelp` in the source tree is the authority."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n/* Audio plugin definition\n\n Each audio plugin should define the following global variables:\n ~name: (symbol) name of the spatializer\n ~description: (string) a short description\n ~function: the actual definition of the plugin\n\n*/\n\n~name = \\testtone;\n~description = \"a standard test tone (sine)\";\n~channelLayout = \\mono;\n\n~function = {| sfreq = 200 |\n FSinOsc.ar(sfreq)\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nMix.ar([SinOsc.ar(220, 0, 0.1), SinOsc.ar(330, 0, 0.1)])\n```"}, {"role": "assistant", "content": "Sums two sine waves into one signal — a perfect fifth, 220 Hz and 330 Hz, at 0.1 amplitude each.\n\n`[SinOsc.ar(220, 0, 0.1), SinOsc.ar(330, 0, 0.1)]` is an Array of two audio-rate signals (each UGen\nreturns a signal; an array of them is just a list). `Mix.ar` adds the elements together. The alternative\n`+` operator does the same for two signals, and `Splay.ar` would spread them across the stereo field\ninstead of summing them."}]} +{"conversations": [{"role": "user", "content": "What does `WebView.onUrlChanged` do?"}, {"role": "assistant", "content": "Sets the object to be evaluated when the url of the displayed page"}]} {"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\na = Synth(\\MoaningDialogue)\n\n//COOL TWEAKS\n//AngryTweak\na.set(\\feedback, 29,\\freq, 6)\n//CalmTweak\na.set(\\feedback, 60, \\freq, 0.8)\n//WeirdTweak\na.set(\\feedback, 2.8, \\freq, 2)\n\n(\nSynthDef(\\MoaningDialogue, {\n |rateL = 0.2, rateR = 0.3, freq = 2, feedback = 50, mul = 1 , lpfreq = 2500|\n Out.ar(0,\n FreeVerb.ar(\n BLowPass.ar(\n SinOscFB.ar(\n LFDNoise1.kr([rateL, rateR], freq), feedback;\n , mul),\n lpfreq,\n 0.2\n ),\n 0.3,\n 0.0\n )\n )}\n).add\n)\n```"}, {"role": "assistant", "content": "One of the first synths I made.\r\nA frog-like sounding synth, with a dialogue between the left and the right channel.\r\nI've also notated some simple tweaks."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n// a pattern with long notes\np = Pbind(\n \\freq, Pwhite(0, log(32)).exp.round(1) * 36.midicps,\n \\detune, Pfunc({ |ev| ev[\\freq] * rand(0.01) }),\n \\sustain, Pwhite(log(0.1), log(20)).exp,\n \\dur, Prand([0.1, 0.1, 0.1, 0.1, 0.2, 1, 2], inf),\n \\db, Pstep(Pseq([-20, -30, -25, -30], inf), 0.2)\n);\n\n// unrelated cluster pattern running on TempoClock.default\nPbind(\\dur, 2, \\midinote, Pseq([(48..60)], 20), \\db, -30).play;\n// …\n```"}, {"role": "assistant", "content": "a pattern with long notes unrelated cluster pattern running on TempoClock.default (PatternConductor: Simple interactive control for playing patterns)"}]} -{"conversations": [{"role": "user", "content": "Explain `PatchIn` in SuperCollider briefly."}, {"role": "assistant", "content": "PatchIn — manages a Player's input when connecting to other Players These objects hold information about a Player's inputs and outputs. They are used to make connections to other Players, and to manage that connection and all subsequent repatching or disconnections. Category: Libraries > crucial > internals."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes sine ocean."}, {"role": "assistant", "content": "```supercollider\n(\n//fundamental pitch triad\n~notes = [45,55,60].midicps;\n\ns.waitForBoot({\n Routine{\n\n SynthDef.new(\\tone, {\n arg freq=440, pan=0, rel=0.05;\n var sig;\n sig = SinOsc.ar(freq);\n sig = sig * EnvGen.kr(Env.perc(0.005,rel), doneAction:2);\n sig = Pan2.ar(sig, pan, 0.05);\n Out.ar(0, sig);\n }).add;\n\n s.sync;\n\n 50.do{\n Pbind(\n \\instrument, \\tone,\n\n //trace some event times just for fun\n \\dur, Pseq(Array.geom(50, rrand(1.5,1.51), rrand(0.923,0.929)).mirror,inf).trace,\n\n \\freq, exprand(~notes[0],8000).round(~notes[0]),\n \\pan, rrand(-1.0,1.0),\n \\rel, exprand(0.005,0.35),\n ).play;\n\n Pbind(\n \\instrument, \\tone,\n \\dur, Pseq(Array.geom(50, rrand(1.5,1.51), rrand(0.923,0.929)).mirror,inf),\n \\freq, exprand(~notes[1],11000).round(~notes[1]),\n \\pan, rrand(-1.0,1.0),\n \\rel, exprand(0.005,0.35),\n ).play;\n\n Pbind(\n \\instrument, \\tone,\n \\dur, Pseq(\n Array.geom(50, rrand(1.5,1.51), rrand(0.923,0.929)).mirror,inf\n ),\n \\freq, exprand(~notes[2],15000).round(~notes[2]),\n \\pan, rrand(-1.0,1.0),\n \\rel, exprand(0.005,0.35),\n ).play;\n };\n }.play(AppClock);\n});\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// shortcut in class\n{ RunningSum.rms(SoundIn.ar }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// shortcut in class\n{ RunningSum.rms(SoundIn.ar) }.play\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for smooth arpeggio, updated envelope (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\bass, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.perc(0.2), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `FreqScope`?"}, {"role": "assistant", "content": "FreqScope — Frequency spectrum visualizer"}, {"role": "user", "content": "What does `FreqScope.getInstance` do?"}, {"role": "assistant", "content": "Returns the (singleton) instance of the FreqScope."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n// create a new analyzer\nFreqScope.new(400, 200, 0, server: s);\n\n// basic sine\n{ SinOsc.ar(2000, 0, 0.25) }.play(s);\n\n// random saw\n{ RLPF.ar(Saw.ar(110, 0.2), LFNoise2.kr(1, 1e4, 1e4), LFNoise2.kr(1, 0.2, 0.22)) }.play(s);\n\n// modulate phase\n{ SinOsc.ar(800, SinOsc.ar(XLine.kr(20, 8000, 10), 0, 2pi), 0.25) }.play(s);\n\n// all harmonics\n{ Blip.ar(200, Line.kr(1, 100, 10), 0.2) }.play(s);\n\n// access the FreqScopeView object to set properties of the Qt Object:\nFreqScope.getInstance // get the FreqScope instance\n .scope // and its FreqScopeView\n .setProperty(\\updateInterval, 1000)\n // set updateInterval to 1000 ms because of reasons\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Tempo.beats2secsKr` do? What arguments does it take?"}, {"role": "assistant", "content": "when used in an Instr in a Patch this will convert beats to seconds, inserting a control rate UGen with the Arguments: beats."}]} -{"conversations": [{"role": "user", "content": "Splay - not getting spread, wrong use?"}, {"role": "assistant", "content": "SuperCollider forum — Splay - not getting spread, wrong use?\n\nYou need to undestand that if you have two identical signal coming from left and right it will always be mono. No stereo spread possible. So you need to introduce (at least) two different signals - and just different amplification will not really work.\n\nTo expand your first example, we can introduce an array of values for paramtere pos:\n\n```supercollider\n(\nx = { arg spread=1, level=0.2, center=0.0;\n Splay.ar(\n GrainBuf.ar(numChannels: 1,\n trigger: Impulse.kr(1.2875),\n dur: Impulse.kr(1.2875),\n sndbuf: b,\n pos:[0,0.5],\n interp: 1\n ),\n spread,\n level,\n center\n );\n}.play;\n);\n\nx.set(\\spread, 1, \\center, 0); // full stereo\nx.set(\\spread, 0, \\center, 0); // mono center\n```\n\nBy way of Multichannel Expansion this creates two different signals (channels, an array of 2 UGen graphs) that you can hear as different and therefore observe the stereo spread.\n\nAnd similarly, to use your other example with In.ar where I have added in=2, so that it takes my mic in (but you can specify another bus) and wrapped it into a feedback delay with an array of two values for delayTime. Multichannel expansion thus creates two channels that are different because they have different delaytimes but the rest of UGen graph is the same (a copy). Changing spread now works:\n\n```supercollider\n(\nSynthDef(\\stereo,{|out=0, in=2, spread=1, level=1, center=0.0|\n Out.ar(out,\n Splay.ar(\n CombN.ar(\n In.ar(in, 1), 1, [0.3,0.4], 2)\n ,spread,level,center));\n}).play;\n)\n```\n\nI hope that clarifies the issue better."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// connect a MIDI device, allNotesOff with CmdPeriod useful\n\nMIDIClient.init;\nm = MIDIOut(0);\ng = { 16.do({ |i| m.allNotesOff(i) }) };\nCmdPeriod.add(g); \n\n\np = Pbind(\n \\type, \\midi,\n \\midiout, m, \n \\chan, 0,\n\n \\amp, PL(\\amp),\n \\midinote, PLseq(\\seq) + PL(\\seqAdd), \n \\dur, 0.2\n);\n);\n\n(\nv = VarGui([\\seq, [36, 60, \\lin, 1, 36] ! 5, \n \\seqAdd, [0, 12, \\lin, 1, 0],\n \\amp, [0, 1, \\\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// connect a MIDI device, allNotesOff with CmdPeriod useful\n\nMIDIClient.init;\nm = MIDIOut(0);\ng = { 16.do({ |i| m.allNotesOff(i) }) };\nCmdPeriod.add(g); \n\n\np = Pbind(\n \\type, \\midi,\n \\midiout, m, \n \\chan, 0,\n\n \\amp, PL(\\amp),\n \\midinote, PLseq(\\seq) + PL(\\seqAdd), \n \\dur, 0.2\n);\n);\n\n(\nv = VarGui([\\seq, [36, 60, \\lin, 1, 36] ! 5, \n \\seqAdd, [0, 12, \\lin, 1, 0],\n \\amp, [0, 1, \\lin, 0.01, 0.8]],\n stream: p\n).gui;\n);\n\n// remove if not needed anymore\n\nCmdPeriod.remove(g);\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n \n// definition for future reference in arbitrary Environments\n\n(\np = Pbind(\n \\freq, Pn(PLgeom(\\start, \\grow, 50)) % 2000 + 400,\n \\dur, 0.1\n);\n);\n\n// prepare current Environment\n\n(\n~start = 100;\n~grow = 1.1;\n);\n\n\n// from ascending to random\n\nx = p.play;\n\n\n// replace\n\n~grow = 0.99;\n\n~grow = 1.4;\n\n\nx.stop;\n```"}, {"role": "assistant", "content": "definition for future reference in arbitrary Environments prepare current Environment (PLgeom: dynamic scope Pgeom variant)"}]} -{"conversations": [{"role": "user", "content": "How do I make a delay line?"}, {"role": "assistant", "content": "`CombN.ar(in, maxdelaytime, delaytime, decaytime)` is a feedback delay: maxdelaytime is the buffer size, delaytime the actual delay (and it can modulate), decaytime how long the repeats take to die. For a clean single echo use `DelayN.ar(in, maxdelaytime, delaytime)`, which has no feedback. Both replace the `in` with the delayed signal, so mix with the dry: `dry + CombN.ar(dry, 0.5, 0.3, 2) * 0.4`."}]} -{"conversations": [{"role": "user", "content": "What is `Tap` in SuperCollider?"}, {"role": "assistant", "content": "Tap — Single tap into a delay line The Tap UGen allows a single tap at a delay into a buffer. Category: UGens > Buffer, UGens > Delays > Buffer."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for electric guitar (a SuperCollider snippet)?"}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\noisecomb2, { arg out, gate=1, pan=0, freq=300, amp=0.1, noiselevel=0.2,\n minfreq=100, decaytime=1, doneAction=2, ffreq=500, rq=0.3, spread=0.8;\n var sig, env;\n sig = WhiteNoise.ar(noiselevel);\n sig = sig + ClipNoise.ar(noiselevel);\n sig = sig + AllpassC.ar(sig, 1/minfreq, 1/freq, decaytime);\n sig = RLPF.ar(sig, ffreq * \\ffreqtab.kr(1!10), rq);\n env = EnvGen.kr(\\adsr.kr(Env.adsr(0.6,0.1,0.8,0.1)), gate, doneAction:doneAction);\n sig = sig * env;\n sig = Splay.ar(sig, spread, 1, pan);\n sig = sig * amp;\n Out.ar(out, sig);\n}).store;\n);\n\n(\nPdef(\\plopbla, Pbind(\n \\instrument, \\noisecomb2,\n \\note, Pseq([[0,7],[1,8],[-1,5]]-2,inf),\n //\\note, Pseq([0,1,2,3,4],inf)\n \\octave, Pstep(Pseq([3,4],inf),Pseq([5,0.75],inf)),\n \\minfreq, 50,\n \\decaytime, 1.0,\n \\adsr, Pseq([\n [Env.adsr(0.02,0.1,0.8,0.4,curve:0.5)],\n [Env.adsr(0.02,0.1,0.8,0.4,curve:0.5)],\n [Env.adsr(0.02,0.1,0.8,0.4,curve:0.5)],\n [Env.adsr(0.03,0.1,0.8,0.1,curve:0.5)],\n [Env.adsr(0.03,0.1,0.8,0.1,curve:0.5)],\n [Env.adsr(0.03,0.1,0.8,0.1,curve:0.5)],\n ],inf),\n \\legato, 1.0,\n //\\ffreq, [500,610,820,140],\n \\ffreq, 500,\n //\\ffreqtab, [[0.8,1,1.1,1.2, 2,4,5,6, 8,10].scramble.postln],\n //\\ffreqtab, Pfunc{ [[ 0.1, 0.2, 0.3, 0.5, 1,2,3,8, 10, 12 ].scramble] + rrand(0.01,1.0); },\n //\\ffreqtab, [ 6, 4, 5, 10, 1, 1.2, 0.8, 1.1, 2, 8 ], // also nice\n \\ffreqtab, [[ 6, 4, 5, 10, 1, 1.2, 0.8, 0.4, 2, 8 ]],\n \\dur, Pseq([3,1,1, 0.25,0.25,0.25],inf),\n \\amp, 1.1\n)).play;\n);\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `BusPlug`."}, {"role": "assistant", "content": "```supercollider\nb = BusPlug.new;\n{ Blip.ar(b + 5) }.play;\nb.bus.set(12);\n```"}]} -{"conversations": [{"role": "user", "content": "I get \"Message 'ar' not understood\". Why?"}, {"role": "assistant", "content": "You called a rate method on something that is not a UGen. `Env.ar(...)` and `Buffer.ar(...)` are the classic cases: Env is a language-side description and is played by `EnvGen.ar(env, ...)`; a Buffer is server memory and is played by `PlayBuf.ar` or `BufRd.ar`. The UGen is the thing with a rate method — if it is a description or a container, there is another UGen that consumes it."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BeatTrack2`."}, {"role": "assistant", "content": "```supercollider\n// track audio in (try clapping a beat or beatboxing, but allow up to 6 seconds for tracking to begin) and spawning stuff at quarters, eighths and sixteenths\n(\nSynthDef(\\help_beattrack2_2, { |out|\n var trackb, trackh, trackq, tempo;\n var source, kbus;\n var bsound, hsound, qsound;\n\n source = SoundIn.ar(0);\n\n // downsampling automatic via kr from ar\n kbus = Out.kr(0, LPF.ar(source, 1000)); // ([feature1, feature3]++feature2);\n\n #trackb, trackh, trackq, tempo = BeatTrack2.kr(0, 1, weightingscheme: e.bufnum);\n\n bsound = Pan2.ar(LPF.ar(WhiteNoise.ar * (Decay.kr(trackb, 0.05)), 1000), 0.0);\n hsound = Pan2.ar(BPF.ar(WhiteNoise.ar * (Decay.kr(trackh, 0.05)), 3000, 0.66), -0.5);\n qsound = Pan2.ar(HPF.ar(WhiteNoise.ar * (Decay.kr(trackq, 0.05)), 5000), 0.5);\n\n Out.ar(out, source + bsound + hsound + qsound);\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for imitation of a ship's horn."}, {"role": "assistant", "content": "```supercollider\n(\n// by Nóslo Tredamus //\nSynthDef(\\Bocina3, {\n\n arg freq = 200, out = 0, amp = 1, gate = 1, bend = 21, relTime = 0.05, pitchRelTime = 0.015;\n var sig, env, mod, noise, pitchEnv;\n\n env = EnvGen.kr(Env.asr(0.1, 1, relTime), gate, doneAction: 0);\n pitchEnv = EnvGen.kr(\n Env(\n levels: [freq - bend, freq, freq, freq - bend],\n times: [0.3, 0, pitchRelTime],\n curve: [\\sine, 0, -8],\n releaseNode: 2\n ),\n gate\n );\n\n mod = LFNoise1.kr(3).exprange(pitchEnv * 1.5, pitchEnv * 3);\n sig = Mix([\n Saw.ar(pitchEnv, mul: amp),\n SinOsc.ar(pitchEnv * 2.098, mul: amp * 0.3),\n SinOsc.ar(pitchEnv * 2.3814, mul: amp * 0.3),\n SinOsc.ar(pitchEnv * 0.996, mul: amp * 0.3),\n Saw.ar(pitchEnv * 1.015, mul: amp * 0.8),\n Saw.ar(pitchEnv * 1.1907, mul: amp * 0.7),\n SinOsc.ar(pitchEnv * 1.503, mul: amp * 0.7),\n Saw.ar(pitchEnv * 0.498, mul: amp)\n ]);\n\n noise = PinkNoise.ar(amp * 0.9) * env;\n sig = sig + noise;\n sig = HPF.ar(sig, freq * 0.5);\n sig = LPF.ar(sig, mod);\n sig = sig * env;\n sig = GVerb.ar(sig, roomsize: 300, revtime: 0.6, drylevel: 1, mul: 0.9);\n sig = Limiter.ar(sig, 0.99);\n DetectSilence.ar(sig, amp: 0.001, time: 0.05, doneAction: 2);\n Out.ar(out, sig);\n}).add;\n);\n~claxon3 = Synth(\\Bocina3);\n~claxon3.set(\\gate, 0);\ns.record;\ns.stopRecording;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `PLIdev` in SuperCollider briefly."}, {"role": "assistant", "content": "PLIdev — dynamic scope pattern searching for numbers with integer distance from a source pattern, optionally avoiding repetitions within a span DIdev / PIdef / PLIdev search for numbers with integer distance from a source signal / pattern up to a given deviation. Repetitions within a lookback span are avoided, DIdev / PIdef / PLIdev randomly choose from possible solutions. Intended for search within integer grids (pitches, indices etc.), however applications with non-integer sources are possible, see examples. Category: Libraries > miSCellaneous > Other patterns, Libraries > miSCellaneous > Idev suite."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for radio static with tuning noise (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"radiostatic\", {arg out=0;\n var hum, sineSweep, tuning, dustNoise, staticNoise, humFreq, numHarms;\n \n numHarms = 7;\n humFreq = 100;\n hum = Array.fill(numHarms, {|i| SinOsc.ar( (i+1) * humFreq, 0, 1/numHarms)});\n hum = hum.sum;\n dustNoise = Dust.ar(LFNoise1.ar(0.5).range(1000,8000));\n staticNoise = hum * dustNoise * LFNoise1.ar(1).range(0.5, 2);\n \n sineSweep = SinOsc.ar(LFNoise2.ar(1).range(20, 11000));\n tuning = SinOsc.ar(10000).ring4(sineSweep) * LFNoise2.ar(1.1).range(0.05, 0.1);\n\n Out.ar(out, Pan2.ar(staticNoise + tuning, 0));\n}).add;\n);\n \na = Synth(\"radiostatic\");\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes DelayPannerSawSine (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n//delaypannersawsine\n{XFade2.ar(AllpassC.ar(HPF.ar(RLPF.ar(Saw.ar(LFPar.kr(0.25).range(220,440)),LFPar.kr(MouseX.kr(0,8),pi).range(220,20000),0.3),LFPar.kr(MouseY.kr(0,8)).range(220,20000)),2,MouseX.kr(0,2),2),AllpassC.ar(HPF.ar(RLPF.ar(WhiteNoise.ar * Saw.ar(LFPar.kr(0.25).range(220,440)),LFPar.kr(MouseX.kr(0,8),pi).range(220,20000),0.3),LFPar.kr(MouseY.kr(0,8)).range(220,20000)),2,MouseY.kr(0,2),2),MouseX.kr(-1,1))}.play\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `ArrayedCollection` in SuperCollider briefly."}, {"role": "assistant", "content": "ArrayedCollection — Abstract superclass of Collections of fixed maximum size `ArrayedCollection` is an abstract class, a subclass of SequenceableCollection whose items are held in a vector of slots, indexable by a SimpleNumber starting from 0. If a float is used as index, it will be truncated. Instances of `ArrayedCollection` have a fixed maximum size beyond which they may not grow. Category: Collections > Ordered."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for imitation of a ship's horn."}, {"role": "assistant", "content": "```supercollider\n(\n// by Nóslo Tredamus //\nSynthDef(\\Bocina3, {\n\n arg freq = 200, out = 0, amp = 1, gate = 1, bend = 21, relTime = 0.05, pitchRelTime = 0.015;\n var sig, env, mod, noise, pitchEnv;\n\n env = EnvGen.kr(Env.asr(0.1, 1, relTime), gate, doneAction: 0);\n pitchEnv = EnvGen.kr(\n Env(\n levels: [freq - bend, freq, freq, freq - bend],\n times: [0.3, 0, pitchRelTime],\n curve: [\\sine, 0, -8],\n releaseNode: 2\n ),\n gate\n );\n\n mod = LFNoise1.kr(3).exprange(pitchEnv * 1.5, pitchEnv * 3);\n sig = Mix([\n Saw.ar(pitchEnv, mul: amp),\n SinOsc.ar(pitchEnv * 2.098, mul: amp * 0.3),\n SinOsc.ar(pitchEnv * 2.3814, mul: amp * 0.3),\n SinOsc.ar(pitchEnv * 0.996, mul: amp * 0.3),\n Saw.ar(pitchEnv * 1.015, mul: amp * 0.8),\n Saw.ar(pitchEnv * 1.1907, mul: amp * 0.7),\n SinOsc.ar(pitchEnv * 1.503, mul: amp * 0.7),\n Saw.ar(pitchEnv * 0.498, mul: amp)\n ]);\n\n noise = PinkNoise.ar(amp * 0.9) * env;\n sig = sig + noise;\n sig = HPF.ar(sig, freq * 0.5);\n sig = LPF.ar(sig, mod);\n sig = sig * env;\n sig = GVerb.ar(sig, roomsize: 300, revtime: 0.6, drylevel: 1, mul: 0.9);\n sig = Limiter.ar(sig, 0.99);\n DetectSilence.ar(sig, amp: 0.001, time: 0.05, doneAction: 2);\n Out.ar(out, sig);\n}).add;\n);\n~claxon3 = Synth(\\Bocina3);\n~claxon3.set(\\gate, 0);\ns.record;\ns.stopRecording;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ SinOsc.ar(ControlRate.ir * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ SinOsc.ar(ControlRate.ir) * 0.1 }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for delay effect with accelerating echoes?"}, {"role": "assistant", "content": "```supercollider\n~buf = Buffer.alloc(s, s.sampleRate * 5);\n\n(\n{\n var trig, freq;\n var dry, snd, phase, iois;\n var cumulDelay;\n var decayFactor, lpfCutoff, numEchoes, ioiScale, ioiDecayFactor;\n\n // play with these!\n decayFactor = 0.65;\n lpfCutoff = 500;\n numEchoes = 16;\n ioiScale = 0.4;\n ioiDecayFactor = 0.75;\n\n // example input -- you can substitute other stuff here\n trig = Dust.ar(1);\n dry = Pulse.ar(100 * TIRand.ar(1, 12, trig));\n dry = dry * Decay2.ar(trig, 0.01, 0.2);\n\n phase = DelTapWr.ar(~buf, dry);\n iois = Array.geom(numEchoes, ioiScale, ioiDecayFactor);\n cumulDelay = iois.sum;\n (cumulDelay > ~buf.duration).if {\n Error(\"use a larger buffer\").throw;\n };\n snd = Silent.ar;\n iois.reverse.do { |ioi|\n snd = (snd + DelTapRd.ar(~buf, phase, cumulDelay, interp: 4)) * decayFactor;\n // one-pole lowpass -- LPF was too aggressive\n snd = OnePole.ar(snd, lpfCutoff / SampleRate.ir);\n cumulDelay = cumulDelay - ioi;\n };\n snd = snd + dry;\n \n snd * 0.5!2;\n}.play;\n\n// contributors so far: Nathan Ho\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `Pair` in SuperCollider briefly."}, {"role": "assistant", "content": "Pair — LISP-like two element cells Category: Collections > Ordered."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LFPulse`."}, {"role": "assistant", "content": "```supercollider\n{ LFPulse.ar(50) * 0.1 }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for load all files for the hyperdisco setup."}, {"role": "assistant", "content": "```supercollider\n//// load all files for the hyperdisco setup.\n\nq = q ? ();\nq.hyperfolder = q.hyperfolder ?? { thisProcess.nowExecutingPath.dirname };\n\n(q.hyperfolder +/+ \"libs/_SynthLib.scd\").loadPaths;\n(q.hyperfolder +/+ \"libs/_FXLib.scd\").loadPaths;\n(q.hyperfolder +/+ \"setup_files/2_makeHistory.scd\").loadPaths;\n\nif (Platform.hasQt) {\n (q.hyperfolder +/+ \"setup_files/1a_Butz.scd\").loadPaths;\n (q.hyperfolder +/+ \"setup_files/1b_winbounds.scd\").loadPaths;\n (q.hyperfolder +/+ \"setup_files/2b_makeHistoryGUI.scd\").loadPaths;\n};\n\n// this may be too harsh - comment out if not needed!\nServer.killAll;\n\nTask {\n try { (q.hyperfolder +/+ \"setup_files/1_logMeIn.scd\").loadPaths } {\n \"*** setup_files/1_logMeIn.scd failed!\".postln;\n };\n 1.wait;\n\n (q.hyperfolder +/+ \"setup_files/3_runCode*.scd\").loadPaths;\n\n // this could be problematic,\n if (Platform.hasQt) {\n // maybe we need a non-doc- SyncText version?\n (q.hyperfolder +/+ \"setup_files/4_makeSyncedEditor.scd\").loadPaths;\n // sent drawing code will just be ignored ...\n /// would be nice if it did get shown!\n (q.hyperfolder +/+ \"setup_files/5_drawer.scd\").loadPaths;\n };\n\n s.options.memSize = (2 ** 18).asInteger;\n s.waitForBoot {\n s.sync;\n (q.hyperfolder +/+ \"setup_files/6_HyperMasterFX.scd\").loadPaths;\n };\n\n}.play(AppClock);\n```"}]} -{"conversations": [{"role": "user", "content": "What is the difference between TempoClock and SystemClock?"}, {"role": "assistant", "content": "SystemClock runs in real time and is what `.wait` uses by default. TempoClock runs in beats and has a tempo, so it can be changed while things are playing and Patterns scheduled on it follow. `TempoClock.default` is the clock Patterns use unless told otherwise, which is why `TempoClock.default.tempo = 2` changes the speed of everything you already have running."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Detuneable fat-saw with a pattern (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\fatsaw,\n {\n arg freq=440, amp=0.3, fat=0.0033, ffreq=2000, atk=0.001, dec=0.3, sus=0.5, rls=0.1,gate=1;\n\n var f1,f2,f3,f4,synth;\n\n f1=freq-(freq*fat);\n f2=freq-(freq*fat/2);\n f3=freq+(freq*fat/2);\n f4=freq+(freq*fat);\n\n synth = LFSaw.ar([f1,f2,f3,f4],[0,0.001,0.002,0.004,0.008]);\n synth = synth * EnvGen.kr(Env([0,1,sus,0],[atk,dec,rls],'lin',2),gate,doneAction:0);\n synth=Splay.ar(synth,0.7);\n synth=RLPF.ar(synth,ffreq*Linen.kr(gate,0.1,0.4,0.2,0),0.4);\n Out.ar([0,1],synth*amp);\n},[0.1,0.3,4,2]).add;\n);\n(\nTempoClock.default = TempoClock.new(2);\nfork{\n\n z = Synth(\\fatsaw,[\\gate,0,\\ffreq,500,\\fat,0.5]);\n\n a=Pseq([0,7,12,5],inf).asStream; // musical degrees\n c = Pseq([40,38,45,47],inf).asStream; // root midi notes\n e = Pseq([0.825,0.375,0.25,0.25],inf).asStream; // note durations\n f = Pseq([1000,1500,2000,2500],inf).asStream; // filter freq value\n\n 0.1.wait;\n z.set(\\gate,1);\n\n //set first root note\n d = c.next;\n\n 8.do{\n\n // move filter freq once every 4 notes\n z.set(\\ffreq, f.next);\n 4.do {\n z.set(\\gate,1);\n z.set(\\freq,(a.next + d).midicps);\n x=[0.451,0.45,0.449].choose;\n x.wait;\n z.set(\\gate,0);\n\n e.next.wait;\n };\n\n d = c.next;\n };\n 2.wait;\n z.free;\n};\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n~loDev = -6;\n~hiDev = 5;\n~lookBack = 2;\n\np = Pbind(\n \\dur, 0.2,\n \\midinote, PLIdev(72, 11, \\loDev, \\hiDev, \\lookBack).trace(prefix: \"midi \"),\n).play;\n);\n\n\n// change on the fly\n// as lookBack equals 2, this defines a fixed sequence (up or down anyway)\n\n(\n~loDev = -1;\n~hiDev = 1;\n);\n\n\n// widen range\n\n(\n~loDev = -6;\n~hiDev = 5;\n);\n\n\n// force a twelve-tone row\n\n~lookBack = 11;\n\n\n// contradictory input, lookBack 11 not possible within range, causes\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n~loDev = -6;\n~hiDev = 5;\n~lookBack = 2;\n\np = Pbind(\n \\dur, 0.2,\n \\midinote, PLIdev(72, 11, \\loDev, \\hiDev, \\lookBack).trace(prefix: \"midi \"),\n).play;\n);\n\n\n// change on the fly\n// as lookBack equals 2, this defines a fixed sequence (up or down anyway)\n\n(\n~loDev = -1;\n~hiDev = 1;\n);\n\n\n// widen range\n\n(\n~loDev = -6;\n~hiDev = 5;\n);\n\n\n// force a twelve-tone row\n\n~lookBack = 11;\n\n\n// contradictory input, lookBack 11 not possible within range, causes repetitions\n\n(\n~loDev = -3;\n~hiDev = 2;\n);\n\np.stop\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Interpreter`."}, {"role": "assistant", "content": "```supercollider\n// typical usage\na = 4;\nb = 3;\nb = b + a;\n\n// some sound\na = Synth(\\default);\ng = fork { loop { 0.1.wait; a.set(\\freq, 200 + 20.0.rand2.postln) } };\ng.stop; a.free;\n\n// an overview of all the variables\nthis.inspect;\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Monzo function?"}, {"role": "assistant", "content": "```supercollider\n// https://en.xen.wiki/w/Monzo\n//Monzo notation of JI ratios is often used in combination with Vals for temperament theory. I wrote this not for temperament, but rather to use monzos as a possible alternative to otonality and utonality, espescially when sonifying streams that include negative numbers.\n\n(//function that takes a collection representing a monzo as an argument, and outputs the ratio it encodes\n~zo = {\n arg exponentCollection;\n var ratio = 1;\n exponentCollection.do({arg item, i; ratio = ratio * (i.nthPrime).pow(item);});\n ratio;\n};\n);\n\n//5-limit\n~zo.([-1, 1]); // 3/2\n~zo.([-2, 0, 1]); // 5/4\n~zo.([-3, 2]); // 9/8\n~zo.([-4, 4, -1]); // 81/80\n~zo.([-4, 4, -1]); // 81/80\n\n//7-limit\n~zo.([-2, 0, 0, 1]); // 7/4\n~zo.([-1, -1, 0, 1]); // 7/6\n~zo.([0, 0, -1, 1]); // 7/5\n\n//fractional monzos\n~zo.([-1/2, 3.3, 4, -5]); //sure\n//it might be fun to do monzo glissandos in different places?\n```"}]} -{"conversations": [{"role": "user", "content": "What are the arguments of EnvGen?"}, {"role": "assistant", "content": "`EnvGen.ar(envelope, gate, levelScale, levelBias, timeScale, doneAction)` — or the .kr form. Envelope is an Env; gate is the signal that holds the envelope open (a number for a one-shot, a trigger or gate control for a sustained sound); levelScale and levelBias scale and offset the output; timeScale stretches durations. Use `doneAction: 2` on a one-shot so the Synth frees itself."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n{ Pan2.ar(Klank.ar(`[[1, 2.2, 3.5, 4.9], nil, Array.series(4, 1, -0.2)], PinkNoise.ar(EnvGen.ar(Env.perc(0.001,0.01), Impulse.ar(4))), 0), 0); }.play;\n```"}, {"role": "assistant", "content": "I accidentally set the freqscale of a Klank to 0. What resulted was a surprisingly varied and dynamic bit of glitch. The joy of typos in SC :)."}]} -{"conversations": [{"role": "user", "content": "What does `Red4D.rotation` do? What arguments does it take?"}, {"role": "assistant", "content": "Get or set the current rotation of the Arguments: redVec — A 6-dimensional RedVector.."}]} -{"conversations": [{"role": "user", "content": "What does `PatternProxy.new` do?"}, {"role": "assistant", "content": "create a new instance with a pattern (the source). the pattern should be a value pattern (see Pdefn). for event pattern proxy, see: EventPatternProxy. instead of a pattern, a function can be passed in, creating a"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\envfol;\n~description = \"Envelope follower (audio rate)\";\n~channelLayout = \\mono;\n~function = {|in = 0, decaycoeff = 0.99, amp = 10.0, lpf = 20 |\n var env, out;\n in.scope;\n env = LPF.ar(PeakFollower.ar(in), lpf, mul: 50, add:-1);\n env.scope;\n env;\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "What is `PHSplayer` in SuperCollider?"}, {"role": "assistant", "content": "PHSplayer — PHS player object Implicitely instantiated when PHS's play method is called, allows stopping and resuming with options also concerning the help synth. Category: Libraries > miSCellaneous > HS and HSpar, Streams-Patterns-Events > HS and HSpar."}]} -{"conversations": [{"role": "user", "content": "What does `Object.cs` do?"}, {"role": "assistant", "content": "Shorthand for #-asCompileString. `{ 10.do { 10.postln }"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nPdef(\\zed, \n Pbind(\n \\osc, Pseq([SinOsc, LFSaw],inf),\n \\instrument, Prout({ arg ev;\n SynthDef(\\zed, { arg out=0, gate=1, amp=0.1, pan=0, freq=200;\n var sig;\n sig = ev[\\osc].ar(freq);\n sig = sig * EnvGen.kr(\\adsr.kr(Env.adsr(0.1,0.1,0.8,0.1)), gate, doneAction:2);\n sig = Pan2.ar(sig, pan, amp);\n Out.ar(out, sig);\n }).add.yield;\n }).loop,\n \\degree, Pseq([0],inf),\n \\dur, 1,\n \\amp, 0.1,\n )\n).play;\n);\n```"}, {"role": "assistant", "content": "synthdef building should take less time than s.latency for this to work."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nt = TempoClock(120/60).permanent_(true);\n\n(\n~change_clock_tempo = {|clock, tempo, beats=1|\n beats.do {|beat|\n var stepTempo = beat.linexp(0, beats-1, clock.tempo, tempo);\n clock.schedAbs(clock.nextBar + beat, {\n \"New Tempo: \".post; (stepTempo*60).post; \" BPM\".postln;\n clock.tempo_(stepTempo);\n });\n };\n nil;\n};\nPbindef(\\n,\n \\octave, 4,\n \\dur, 0.5,\n \\degree, Pseq((0..7), inf)\n).play(t, quant: 4);\n);\n\n~change_clock_tempo.value(t, 200/60, 16);\n~change_clock_tempo.value(t, 50/60, 8);\nt.tempo*60\n```"}, {"role": "assistant", "content": "This gradually changes the tempo of a TempoClock, each beat of a specified number of beats, and starting at the next bar.\r\n\r\n\r\nPersonally, I was not able to heavily distinguish between `.linlin` and `.linexp` for reasonable musical tempos.\r\n\r\n\r\nThere may be a mathematically smoother way of handling this at the control rate.\r\n\r\n\r\nThis function does not gracefully handle multiple simultaneous invoca."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Just a lunch time tweet."}, {"role": "assistant", "content": "```supercollider\n{CombC.ar(Klang.ar(`[[100,101,1000,1001]],1,0)*0.1,0.33,LFTri.ar(0.1, 0, 0.1, 0.11)+LFTri.ar(0.17, 0, 0.1, 0.22),10)!2}.play;\n\n//Variation\n‎{CombC.ar(Klang.ar(`[[100,101,1000,1001]],1,0)*0.1,1.33,LFTri.ar(0.3, 0, 0.1, 0.71)+LFTri.ar(0.7, 0, 0.1, 0.52),10)!2}.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `TExpRand`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var trig = Dust.kr(10);\n SinOsc.ar(\n TExpRand.kr(300.0, 3000.0, trig)\n ) * 0.1\n}.play;\n);\n\n(\n{\n var trig = Dust.ar(MouseX.kr(1, 8000, 1));\n SinOsc.ar(\n TExpRand.ar(300.0, 3000.0, trig)\n ) * 0.1\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SimpleNumber.bitNot` do?"}, {"role": "assistant", "content": "one-dimensional value Returns: ones complement"}]} -{"conversations": [{"role": "user", "content": "What does `View.removeAction` do? What arguments does it take?"}, {"role": "assistant", "content": "Adds/removes 'func' to or from the list of objects in the variable determined by 'selector'. If 'selector' is not an Array or a List, it will become one, containing the previous object plus 'func'. This is useful for adding functionality to existing frameworks that have action functions Arguments: func — Any object to add as an action, usually a Function.; selector — A Symbol containing the name of the action variable to which 'func' will be added. In other words, 'add' method will be invoked on that variable; by default that is \\action, but any other (sensible) instance or class variable of the view could work (e.g. \\globalKeyDownAction or \\mouseUpAction or \\on."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for bankrupt robot's dance-machine )."}, {"role": "assistant", "content": "```supercollider\n({var // rhythmoid\nr = 87/59/*MouseX.kr(1,10).linexp(1,10,1/10,10)*/, d = 1/r, l = 8, // tempo, bar dur, beat levels\ni = Impulse.ar(r*(2**l)), // base beat\npd = {|...a|PulseDivider.ar(*a)},\nq = {|n,s=0,p=0| n=n+l; pd.(i, 2**n, s*2.pow(n-(p?0)-1)) }, // quantizer\ne = {|p,d,a|EnvGen.ar(Env.perc(a?0.01,d?0.5),p)}, // perc envelope\ns = {|...a|Stepper.ar(*a)},\nz=DC.ar(0)\n+Ringz.ar(LPF.ar(q.(0),1800),50,d).tanh\n+SinOsc.ar(60,0,e.(q.(0)bitXor:q.(1))*3).tanh.madd(0.3)\n+Ringz.ar(LPF.ar(q.(-2)bitXor:q.(0),[400,800]),90,d/2,1/2).mean.tanh\n+BrownNoise.ar(e.(q.(0,1),d/4)/12*s.(q.(1),0,1,2))\n+WhiteNoise.ar(e.(q.(1,1,2),d/4)/30)\n+Blip.ar(360,4,e.(q.(-3)bitXor:q.(-2,1),d/8)/14)\n+Formlet.ar(LPF.ar(q.(0)bitXor:q.(1,1,2),2300),350,d/8,d/2,1/2)\n+Formlet.ar(LPF.ar(q.(-2,1)bitXor:q.(1,1,3),s.(q.(2),0,80,105,3).midicps),s.(q.(3),0,50,80,5).midicps,d/6,d/4,1/6)\n+Saw.ar(400,e.(q.(2,(1..4),3), d/8)*s.(q.(-2),0,0,3)/2)\n+Ringz.ar(LPF.ar(q.(-2),[400,800])/2,160,d,s.(q.(2),0,7,14)/14).mean.tanh\n+PMOsc.ar(300,490,2,0,e.(q.(2))/6)\n+PMOsc.ar(200,890,3,0,e.(q.(2,1))/8)\n+Pulse.ar(2900,mul:e.(q.(3)bitXor:q.(2,1),d/3)/12)\n+LFPar.ar(1900,mul:e.(q.(0,[1,2],[1,3])bitXor:q.(1,1,2),d/3,5e-3)/7)\n+SelectX.ar(s.([q.(1),q.(0)].choose,0,0,3.rrand(7)), Saw.ar(Array.rand(7,500,4500),mul:e.(q.(-2)bitXor:q.(0,3,1), d/3))/19)\n+Pulse.ar(s.(q.(3),0,60,80,3).midicps,0.5,e.(q.(-1,2,1),d/4)*2).tanh.madd(1/24)\n+LFCub.ar(s.(q.(3),0,80,108,6).midicps).madd(Saw.ar(2490)*e.(pd.(q.(-4)bitXor:q.(-3,1),8,1), d/3)/16)\n+Pluck.ar(Impulse.ar(s.(q.(4),0,80,108,6).midicps), q.(-2)bitXor:q.(0,3,1), d, d/18, d/2, -0.4).madd(e.(q.(2),d*8)/3) \n;z!2/8}.play)\n```"}]} -{"conversations": [{"role": "user", "content": "What does Lag do?"}, {"role": "assistant", "content": "`Lag.ar(in, lagTime)` and `Lag.kr(in, lagTime)` smooth a signal with an exponential lag towards its target, which removes the clicks and zipper noise a stepped control would produce. Lag.kr on a mouse or MIDI input is the standard way to make a parameter feel analogue: `Lag.kr(MouseX.kr(200, 4000), 0.2)`. Lag2 and Lag3 are the second- and third-order versions, smoother and slower."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// logistic map as frequency control\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n SinOsc.ar(QuadL.ar(40, r.neg, r, 0, 0.1, 800, 900)) * 0.4;\n}.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// logistic map as frequency control\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n SinOsc.ar(QuadL.ar(40, r.neg, r, 0, 0.1, 800, 900)) * 0.4;\n}.play(s);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `PL.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new PL Arguments: item — Symbol or other Object. If a Symbol is passed, item can be assigned to an envir variable later on. Can be dynamically replaced by Patterns or Streams.; repeats — Symbol or repeats arg. If a Symbol is passed, repeats can be assigned to an envir variable later on. Defaults to inf.; type — Expects 1 or inf. Defines how items other than Patterns or Streams should be embedded. Defaults to 1. Rather to be used by other PLx Patterns than by the user.; envir — Dictionary or one of the Symbols \\top, \\t (topEnvironment), \\current, \\c (currentEnvironment). Dictionary to be taken for variable reference. Defaults to \\current.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na.sine(8, 0, 1, 0);\n\nb.sine2(a.ramp(1.0, 1.0), a.sine(8, 0, 1, 0).postln, true, true, true);\ny = z.play(s, [\\out, 0, \\bufnum, b]);\nb.sine2(a.ramp(1.0, 1.0), a.sine(4, 0, 1, 0).postln, true, true, true);\nb.sine2(a.ramp(1.0, 1.0), a.sine(2.2, 0.5pi, 0.4, 0.2).postln, true, true, true);\nb.sine2(a.ramp(1.0, 1.0), a.sine(pi, 0.25pi, 0.5, 0).postln, true, true, true;\ny.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na.sine(8, 0, 1, 0);\n\nb.sine2(a.ramp(1.0, 1.0), a.sine(8, 0, 1, 0).postln, true, true, true);\ny = z.play(s, [\\out, 0, \\bufnum, b]);\nb.sine2(a.ramp(1.0, 1.0), a.sine(4, 0, 1, 0).postln, true, true, true);\nb.sine2(a.ramp(1.0, 1.0), a.sine(2.2, 0.5pi, 0.4, 0.2).postln, true, true, true);\nb.sine2(a.ramp(1.0, 1.0), a.sine(pi, 0.25pi, 0.5, 0).postln, true, true, true);\ny.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\np = ProxySpace.push(s.boot);\n\nl = NdefGui(nil, 3).moveTo(10, 120);\nm = NdefGui(nil, 3).moveTo(10, 240);\nn = NdefGui(nil, 3).moveTo(10, 360);\no = NdefGui(nil, 3).moveTo(10, 480);\n\nSpec.add(\\dens, [0.1, 300, \\exp]);\n\n// make 3 kinds of proxies: using tilde/proxyspace, Ndef, and unnamed.\n~spacy = { |dens = 5| Formlet.ar(Dust.ar(dens ! 2), LFDNoise0.kr(20 ! 2).lag(0.1).linexp(-1, 1, 300, 5000), 0.003,\n// …\n```"}, {"role": "assistant", "content": "make 3 kinds of proxies: using tilde/proxyspace, Ndef, and unnamed. put one in each editor (NdefGui: a gui for a NodeProxy or Ndef)"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DiskIn`."}, {"role": "assistant", "content": "```supercollider\ns.boot; // start the server\n\n// examples below will use this synthdef\n(\nSynthDef(\"help-Diskin\", { |out, bufnum = 0|\n Out.ar(out, DiskIn.ar(1, bufnum));\n}).add\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Pproto`."}, {"role": "assistant", "content": "```supercollider\nPbind(*[freq: 700, amp: 0.1])\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n Pbind(*[\n instrument: \\multi,\n freq: Prand([\n [[100, 141, 103]],\n [[100, 310, 190]],\n [[100, 100.1, 110]],\n ], inf),\n dur: 0.2,\n sustain: 0.3\n ]).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n Pbind(*[\n instrument: \\multi,\n freq: Prand([\n [[100, 141, 103]],\n [[100, 310, 190]],\n [[100, 100.1, 110]],\n ], inf),\n dur: 0.2,\n sustain: 0.3\n ]).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Ringz`."}, {"role": "assistant", "content": "```supercollider\n(\na = {\n // rectangular pulse exciter (deterministic input)\n var exc = EnvGen.ar(Env([1, 1, 0], [0.01, 0], \\lin)),\n sig = Ringz.ar(exc, 440, decaytime: 0.2),\n rms = sqrt(Integrator.ar(sig.squared) * (0.2 / SampleRate.ir)),\n end = DetectSilence.ar(sig, doneAction: 2);\n rms.poll(end);\n Silent.ar(1)\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// modulating the frequency\n\n{ Saw.ar(XLine.kr(40, 4000, 6), 0.2) }.play;\n\n// two band limited sawtooth waves through a resonant low pass filter\n\n{ RLPF.ar(Saw.ar([100, 250], 0.1), XLine.kr(8000, 400, 5), 0.05 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// modulating the frequency\n\n{ Saw.ar(XLine.kr(40, 4000, 6), 0.2) }.play;\n\n// two band limited sawtooth waves through a resonant low pass filter\n\n{ RLPF.ar(Saw.ar([100, 250], 0.1), XLine.kr(8000, 400, 5), 0.05) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n//try passing a signal through the hair cell; it won't come out like a pure sine, more like an impulse train stimulated by that input\n{ Pan2.ar(HairCell.ar(SinOsc.ar(440)),0.0) }.play;\n\n//modulation effects\n{ Pan2.ar(HairCell.ar(Saw.ar(MouseX.kr(1,1000)),0.0,MouseY.kr(0.0,1000.0)),0.0) }.play;\n\n//constantly self oscillates at 5 Hz, talk through it to modulate from base rate... \n{ Pan2.ar(HairCell.ar(SoundIn.ar,5.0,100),0.0) }.play;\n\n//sweeps and beeps\n{ Pan2.ar(HairCell.ar(Saw\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n//try passing a signal through the hair cell; it won't come out like a pure sine, more like an impulse train stimulated by that input\n{ Pan2.ar(HairCell.ar(SinOsc.ar(440)),0.0) }.play;\n\n//modulation effects\n{ Pan2.ar(HairCell.ar(Saw.ar(MouseX.kr(1,1000)),0.0,MouseY.kr(0.0,1000.0)),0.0) }.play;\n\n//constantly self oscillates at 5 Hz, talk through it to modulate from base rate... \n{ Pan2.ar(HairCell.ar(SoundIn.ar,5.0,100),0.0) }.play;\n\n//sweeps and beeps\n{ Pan2.ar(HairCell.ar(Saw.ar(MouseX.kr(1,10)),0,MouseY.kr(0,10000)),0.0) }.play;\n\n//store can run out of chemicals \n{ Pan2.ar(HairCell.ar(SinOsc.ar(440),0,440,MouseX.kr(0,1000)),0.0) }.play;\n\n//raucous\n{ Pan2.ar(HairCell.ar(Saw.ar( HairCell.ar(SoundIn.ar,0,MouseY.kr(0,10000))*1000.0),MouseX.kr(0.0,1000.0),MouseY.kr(0.0,1000.0)),0.0) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Document.keyUpAction` do? What arguments does it take?"}, {"role": "assistant", "content": "Get/set the action to be performed on Arguments: action — An instance of Function or FunctionList. The arguments passed to the function are: `document`, `char`, `modifiers`, `unicode`, `keycode`. See View#Key actions for details on these arguments.."}]} -{"conversations": [{"role": "user", "content": "What does `PathName.isFile` do?"}, {"role": "assistant", "content": "returns a Boolean indicating whether or not the path represents a file (not a folder)."}]} -{"conversations": [{"role": "user", "content": "What does `DataFilter.filterN` do? What arguments does it take?"}, {"role": "assistant", "content": "perform the filter calculations in steps. an internal buffer is Arguments: newData — an Array or a single sample.."}]} -{"conversations": [{"role": "user", "content": "What does `Dwhite.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Demand rate white noise random generator. Arguments: lo — Minimum value.; hi — Maximum value.; length — Number of values to create.."}]} -{"conversations": [{"role": "user", "content": "What is `IdentitySet`?"}, {"role": "assistant", "content": "IdentitySet — a set according to identity"}, {"role": "user", "content": "What does `IdentitySet.add` do?"}, {"role": "assistant", "content": "Add anObject to the IdentitySet. An object which is equal to an object already in the IdentitySet will not be added. `IdentitySet[1, 2, 3].add(4);`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nIdentitySet[1, 2, 3].add(4);\nIdentitySet[1, 2, 3].add(3);\n// the two strings are equal but not identical\nIdentitySet[\"abc\", \"def\", \"ghi\"].add(\"def\");\n// symbols are guaranteed to be identical if they are equal\nIdentitySet['abc', 'def', 'ghi'].add('def');\nIdentitySet['abc', 'def', 'ghi'].add('jkl');\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nMIDIIn.connectAll;\n// MIDIClient.init;\n\n\n(\n// A SynthDef with ADSR envelope\nSynthDef(\"quick2\", {arg freq = 440, amp = 0.1, gate = 1;\n var snd, env;\n env = Env.adsr(0.01, 0.1, 0.3, 2, amp).kr(2, gate);\n snd = Saw.ar(freq: [freq, freq*1.5], mul: env);\n Out.ar(0, snd)\n}).add;\n);\n\n// Play it with a MIDI keyboard\n(\nvar noteArray = Array.newClear(128); // array has one slot per possible MIDI note\n\nMIDIdef.noteOn(\\myKeyDown, {arg vel, note;\n noteArray[note] = Synth(\"quick2\", [\\freq, note.midicps, \\amp, vel.linlin(0, 127, 0, 1)]);\n [\"NOTE ON\", note].postln;\n});\n\nMIDIdef.noteOff(\\myKeyUp, {arg vel, note;\n noteArray[note].set(\\gate, 0);\n [\"NOTE OFF\", note].postln;\n});\n)\n// PS. Make sure SC MIDI connections are made (MIDIIn.connectAll)\n```"}, {"role": "assistant", "content": "Basic example - how to use a MIDI keyboard with a simple synth."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `RHPF`."}, {"role": "assistant", "content": "```supercollider\n{ RHPF.ar(Saw.ar(200, 0.1), FSinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3600, 4000), 0.2) }.play;\n\n(\n{ var ctl = RHPF.kr(LFSaw.kr(2), SinOsc.kr(XLine.kr(0.07, 30, 20), 0, 35, 40), 0.05);\n SinOsc.ar(ctl * 200 + 500);\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "How do I set the tempo?"}, {"role": "assistant", "content": "TempoClock.default.tempo = 120/60; the argument is beats per second, so 120 BPM is 2.0. Patterns scheduled on the default clock then follow it."}]} -{"conversations": [{"role": "user", "content": "What is `Bus`?"}, {"role": "assistant", "content": "Bus — Representation of a bus on the server"}, {"role": "user", "content": "What does `Bus.control` do?"}, {"role": "assistant", "content": "Allocate a control bus on the server."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\na = Bus.control(s, 1).set(440);\nb = Bus.control(s, 1).set(0.01);\n);\n(\nSynthDef(\\rlpf, { |out, ffreq, rq|\n Out.ar(out, RLPF.ar(WhiteNoise.ar(0.2), ffreq, rq))\n}).play(s, [\\ffreq, a.asMap, \\rq, b.asMap]);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n//swap each phrase\n(\nvar sf, clock, synth;\n\ns=Server.default;\n\nclock= ExternalClock(TempoClock(2.1)).play;\n\nRoutine.run({\n\nsf= BBCutBuffer.array([Platform.resourceDir +/+ \"sounds/break.aiff\",Platform.resourceDir +/+ \"sounds/break2.aiff\"],[8,4]);\n\ns.sync;\n\nBBCut2(CutBuf2(BufSelector(sf,{|block,lastindex| if(block.blocknum==1,{1-lastindex},{lastindex})}),0.2), WarpCutProc1.new).play(c\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n//swap each phrase\n(\nvar sf, clock, synth;\n\ns=Server.default;\n\nclock= ExternalClock(TempoClock(2.1)).play;\n\nRoutine.run({\n\nsf= BBCutBuffer.array([Platform.resourceDir +/+ \"sounds/break.aiff\",Platform.resourceDir +/+ \"sounds/break2.aiff\"],[8,4]);\n\ns.sync;\n\nBBCut2(CutBuf2(BufSelector(sf,{|block,lastindex| if(block.blocknum==1,{1-lastindex},{lastindex})}),0.2), WarpCutProc1.new).play(clock);\n\n});\n\n);\n\n\n\n//testing with CutBuf3 and three soundfiles\n(\nvar sf, clock, synth;\n\ns=Server.default;\n\nclock= ExternalClock(TempoClock(2.1)).play;\n\nRoutine.run({\n\nsf= BBCutBuffer.array([\"sounds/a11wlk01-44_1.aiff\",Platform.resourceDir +/+ \"sounds/break.aiff\",Platform.resourceDir +/+ \"sounds/break2.aiff\"],[4,8,4]);\n\ns.sync;\n\nBBCut2(CutBuf3(BufSelector(sf,{|block,lastindex| if(block.cuts.size<3,{0},{rrand(1,2)})}),0.2), WarpCutProc1.new).play(clock);\n\n});\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// They describe populations of predators and prey, e.g. foxes and rabbits.\n// https://en.wikipedia.org/wiki/Lotka%E2%80%93Volterra_equations\n\n\n// v'(t) = (alpha * v(t)) - (beta * v(t) * w(t))\n// w'(t) = (delta * v(t) * w(t)) - (gamma * w(t))\n\n\n(\nFb1_ODEdef(\\LotkaVolterra, { |t, y, alpha = 0.1, beta = 0.1,\n gamma = 0.1, delta = 0.1|\n [\n { y[0] * (beta.neg * y[1] + alpha) },\n { y[1].neg * (delta.neg\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// They describe populations of predators and prey, e.g. foxes and rabbits.\n// https://en.wikipedia.org/wiki/Lotka%E2%80%93Volterra_equations\n\n\n// v'(t) = (alpha * v(t)) - (beta * v(t) * w(t))\n// w'(t) = (delta * v(t) * w(t)) - (gamma * w(t))\n\n\n(\nFb1_ODEdef(\\LotkaVolterra, { |t, y, alpha = 0.1, beta = 0.1,\n gamma = 0.1, delta = 0.1|\n [\n { y[0] * (beta.neg * y[1] + alpha) },\n { y[1].neg * (delta.neg * y[0] + gamma) }\n ]\n}, 0, [1, 1], 1, 1);\n);\n\n// with standard parameter usage the audio results are brass-like and not spectacular\n\n(\nx = {\n Fb1_ODE.ar(\\LotkaVolterra,\n [0.2, MouseX.kr(0.1, 0.9), MouseY.kr(0.1, 0.9), 0.8],\n tMul: 3000\n ) * 0.1\n}.play\n);\n\nx.release\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\nvar trigger, fund, flashInst;\nflashInst = Array.fill(7,\n{\ntrigger = Dust.kr(2)*PinkNoise.ar(1);\nfund = rrand(100, 137);\nPan2.ar(\nMix.ar(\nArray.fill(7,\n{arg counter;\nvar partial;\npartial = counter + 3;\n//HenonC.ar(fund*partial).atan *\nDPW3Tri.ar(fund*partial).atan *\nEnvGen.kr(Env.adsr(0.01, 0, 0.1, 7.0),\ntrigger, 1/partial) *AY.ar(713)* max(0, LFNoise1.kr(rrand(37.0, 73.0)))\n})\n)*0.2,\n1.0.rand2)\n});\nMix.ar(flashInst)*0.6\n}.play\n)\n```"}, {"role": "assistant", "content": "\"High-energy Radio Bursts, generated by an old coffee machine of Arab origin, manifest themselves as noise and audio signals, and trigger a magnetic alteration with unpredictable effects;\"\r\n\r\n\r\n\r\nhttp://bz-buzz.blogspot.com/2018/10/radio-bursts-from-old-coffee-pot.html\r\n\r\nhttp://bzakirasantjago.blogspot.com/."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n \n// definition for future reference in arbitrary Environments\n\nq = PLhprand(\\lo, \\hi);\n\n\n// prepare current Environment\n// PLseq repeats arg defaults to inf\n\n(\n~lo = 60;\n~hi = PLseq((92..62));\n);\n\n\n\n// run\n\n(\ny = Pbind(\n \\midinote, Ptuple(q!5), \n \\dur, 0.1,\n \\amp, 0.05\n).play;\n);\n\n\n// replace, converging bounds\n\n(\n~lo = PLseq((40..70) ++ (70!5));\n~hi = 70.5;\n);\n\ny.stop;\n```"}, {"role": "assistant", "content": "definition for future reference in arbitrary Environments prepare current Environment (PLhprand: dynamic scope Phprand variant)"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Timing variations."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\sound, {\n arg i_bus = 0, amp = 0.1, freq = 440, sustain = 1, pan = 0;\n var env, osc, out;\n env = EnvGen.kr(Env.perc(0.01, sustain, amp),doneAction:2);\n osc = SinOsc.ar([freq, freq * 1.005, freq * 0.995], mul:env);\n out = Pan2.ar(osc, pan);\n Out.ar(i_bus, out);\n}).send(s);\n);\n\n(\n~amp = 0.1;\na = Pdef(\\a,\n Pbind(\n \\instrument, \\sound,\n \\amp, ~amp * 1.5,\n \\degree, Pseq([2, 4, 5, 6, 1] - 1, inf),\n \\dur, Pseq([1, 1, 1, 1, 2] / 4, inf)\n )\n).quant_([3, 0, 0, 1]);\n\nb = Pdef(\\b,\n Pbind(\n \\instrument, \\sound,\n \\amp, ~amp,\n \\degree, Pseq(([8, 6, 5, 3, 4, 6]!3).flat[0..(6*3)-2] - 1, inf),\n \\dur, Prand([Pseq([1, 1, 1, 1, 1, 1] / 4, 4), Prand([1/8, 3/8], 1)], inf)\n )\n).quant_([3, 0, 0, 1]);\n\nc = Pdef(\\c,\n Pbind(\n \\instrument, \\sound,\n \\amp, ~amp * 0.6,\n \\degree, Pseq([1, 6, 8, 6, Pwrand([11,13], [2, 1].normalizeSum)] - 1, inf),\n \\amp, Pseq([0, 1, 1, 1, 1] / 10, inf),\n \\dur, Pseq([8, 1, 1, 1, 1] / 8, inf),\n \\sustain, 0.1\n )\n).quant_([3, 0, 0, 1]);\n);\n\n(\nSystemClock.sched(0, Routine({\n a.play; 12.yield;\n b.play; 12.yield;\n c.play; 12.yield;\n c.pause; 6.yield;\n a.pause; 6.yield;\n\n b.pause; a.play; 12.yield;\n b.play; 12.yield;\n c.play; 12.yield;\n c.pause; a.pause; 6.yield;\n b.pause; 6.yield;\n}));\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `LevelIndicator.numMajorTicks` do? What arguments does it take?"}, {"role": "assistant", "content": "The number of ticks in the view's scale which will be large Arguments: number — An Integer >= 0. `(`."}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ Pan2.ar(SinOsc.ar(440) * 0.2, SinOsc.kr(0.1)) }.play;\n```"}, {"role": "assistant", "content": "A sine that slowly moves between the speakers.\n\n`SinOsc.kr(0.1)` is a control-rate sine at 0.1 Hz — one cycle every 10 seconds — running between -1 and 1.\n`Pan2.ar(sig, pos)` treats that as the pan position, where -1 is hard left, 0 centre, 1 hard right, so the\nsound drifts across the stereo field. Pan2 is equal-power, so the centre is -3 dB per channel rather than\nhalf amplitude on each. The `* 0.2` sets the level before panning."}]} -{"conversations": [{"role": "user", "content": "Explain `FoaEncode` in SuperCollider briefly."}, {"role": "assistant", "content": "FoaEncode — First Order Ambisonic (FOA) encoder Encodes signals in a variety of configurations to a First Order Ambisonic signal (B-format). PanB is a SuperCollider inbuilt equivalent. Category: Libraries > Ambisonic Toolkit > UGens > FOA > Encoder, UGens > Multichannel > Ambisonics."}]} -{"conversations": [{"role": "user", "content": "What does `OpenObject.openInterpreter` do? What arguments does it take?"}, {"role": "assistant", "content": "Open the interpreter for external access. Do this only if you know what you are Arguments: addr — Address from which the messages come. `nil` means any. If a replyID (an Integer) is given, sends back a reply: The results are sent back to the sender under the OSC command `\"/oo_reply\" replyID val1 val2 …` `\"/oo_i\" string`."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// examples for direct pattern usage:\nMKtlDesc.postLoadable\nn = MKtl(\\nk1, \"korg-nanokontrol\");\nx = n.elementsDict[\\play]; // the play button\n\n// test asStream method - simple endless lookup\np = Pbind(\\test, x).trace.play;\n// switch value while playing, pattern gets current value\nx.value = 1;\nx.value = 0;\n\np.stop;\n\n// test embedInStream method:\n(\np = Pbind(\n \\test, Pseq([x, 4, 7], 8),\n \\dur, 0.5\n).trace.play;\n;\n// change value while playing\nx.value = 1;\nx.value = 0;\n\np.stop;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// examples for direct pattern usage:\nMKtlDesc.postLoadable\nn = MKtl(\\nk1, \"korg-nanokontrol\");\nx = n.elementsDict[\\play]; // the play button\n\n// test asStream method - simple endless lookup\np = Pbind(\\test, x).trace.play;\n// switch value while playing, pattern gets current value\nx.value = 1;\nx.value = 0;\n\np.stop;\n\n// test embedInStream method:\n(\np = Pbind(\n \\test, Pseq([x, 4, 7], 8),\n \\dur, 0.5\n).trace.play;\n);\n// change value while playing\nx.value = 1;\nx.value = 0;\n\np.stop;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `LevelIndicator.numTicks` do? What arguments does it take?"}, {"role": "assistant", "content": "The number of ticks to display in the view's Arguments: number — An Integer >= 0. `(`."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var a, freq, trig;\n a = Dswitch1([1, 3, MouseY.kr(1, 15), 2, Dwhite(0, 3, 2)], MouseX.kr(0, 4));\n trig = Impulse.kr(3);\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n);\n\n(\n{\n var a, freq, trig;\n a = Dswitch1({ |i| Dseq((0..i*3), inf) } ! 5, MouseX.kr(0, 4));\n trig = Impulse.kr(6);\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var a, freq, trig;\n a = Dswitch1([1, 3, MouseY.kr(1, 15), 2, Dwhite(0, 3, 2)], MouseX.kr(0, 4));\n trig = Impulse.kr(3);\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n);\n\n(\n{\n var a, freq, trig;\n a = Dswitch1({ |i| Dseq((0..i*3), inf) } ! 5, MouseX.kr(0, 4));\n trig = Impulse.kr(6);\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `CutBPF1` in SuperCollider?"}, {"role": "assistant", "content": "CutBPF1 — BBCut2 bandpass filter CutBPF1 adds a bandpass filter to BBCut2. The rq value modulates by a geometric series. Category: Libraries > BBCut > Cut FX."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// hear the difference, LinPan having a slight drop in the middle...\n{ LinPan2.ar(SinOsc.ar(440), Line.kr(-1, 1, 5)) }.play\n\n// ... whereas Pan2 is more smooth\n{ Pan2.ar(SinOsc.ar(440), Line.kr(-1, 1, 5)) }.play\n\n// other examples\n{ Pan2.ar(PinkNoise.ar(0.4), FSinOsc.kr(2), 0.3) }.play;\n```"}, {"role": "assistant", "content": "hear the difference, LinPan having a slight drop in the middle... ... whereas Pan2 is more smooth (Pan2: Two channel equal power pan.)"}]} -{"conversations": [{"role": "user", "content": "What does `Plotter.showUnits` do? What arguments does it take?"}, {"role": "assistant", "content": "Get/set whether the corresponding ControlSpec#-units are displayed as labels. The state of #-unitLocation determines whether the units are shown as axis labels or appended to the tick Arguments: bool — A `Boolean`.."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Enveloppes sizes are fixed."}, {"role": "assistant", "content": "```supercollider\n(\n~resize_enveloppe = { | levels, times |\n var reverted_levels, index;\n index = 0;\n reverted_levels = levels.reverse;\n while( { reverted_levels[index] == 0 && reverted_levels[index+1] == 0 }, { times[ times.size - 1 - index] = 0.01; index = index + 1 } );\n};\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Function.getToFloatArray` do? What arguments does it take?"}, {"role": "assistant", "content": "Stream the function audio values to the client using a series of getn messages and put the results into a Arguments: duration — Amount of data to record in seconds; target — A server, synth, or group where to place the synth that plays the function; action — A function to call when writing is finished.; wait — The amount of time in seconds to wait between sending getn messages. Longer times are safer. The default is 0.01 seconds which seems reliable under normal circumstances. A setting of 0 is not recommended.; timeout — The amount of time in seconds after which to post a warning if all replies have not yet been received. the default is 3.."}]} -{"conversations": [{"role": "user", "content": "What does `UScore.moveEventToEmptyTrack` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: evt — (describe argument here). Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for load all files for the hyperdisco setup."}, {"role": "assistant", "content": "```supercollider\n//// load all files for the hyperdisco setup.\n\nq = q ? ();\nq.hyperfolder = q.hyperfolder ?? { thisProcess.nowExecutingPath.dirname };\n\n(q.hyperfolder +/+ \"libs/_SynthLib.scd\").loadPaths;\n(q.hyperfolder +/+ \"libs/_FXLib.scd\").loadPaths;\n(q.hyperfolder +/+ \"setup_files/2_makeHistory.scd\").loadPaths;\n\nif (Platform.hasQt) {\n (q.hyperfolder +/+ \"setup_files/1a_Butz.scd\").loadPaths;\n (q.hyperfolder +/+ \"setup_files/1b_winbounds.scd\").loadPaths;\n (q.hyperfolder +/+ \"setup_files/2b_makeHistoryGUI.scd\").loadPaths;\n};\n\n// this may be too harsh - comment out if not needed!\nServer.killAll;\n\nTask {\n try { (q.hyperfolder +/+ \"setup_files/1_logMeIn.scd\").loadPaths } {\n \"*** setup_files/1_logMeIn.scd failed!\".postln;\n };\n 1.wait;\n\n (q.hyperfolder +/+ \"setup_files/3_runCode*.scd\").loadPaths;\n\n // this could be problematic,\n if (Platform.hasQt) {\n // maybe we need a non-doc- SyncText version?\n (q.hyperfolder +/+ \"setup_files/4_makeSyncedEditor.scd\").loadPaths;\n // sent drawing code will just be ignored ...\n /// would be nice if it did get shown!\n (q.hyperfolder +/+ \"setup_files/5_drawer.scd\").loadPaths;\n };\n\n s.options.memSize = (2 ** 18).asInteger;\n s.waitForBoot {\n s.sync;\n (q.hyperfolder +/+ \"setup_files/6_HyperMasterFX.scd\").loadPaths;\n };\n\n}.play(AppClock);\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for cosmic organ expansion )."}, {"role": "assistant", "content": "```supercollider\n(\nfork {\n TempoClock.tempo = 1;\n Ndef(\\ttso).play;\n loop {\n var seed = thisThread.randSeed = 100000000.rand.debug('seed');\n var wait = 20.rrand(60).debug('wait');\n Ndef(\\ttso, {\n var gamma= {[rrand(30,50),rrand(50,70),rrand(50,70),rrand(70,100)].choose.midicps*LFNoise2.kr(1,0.01,1)}!24;\n Pan2.ar(\n LeakDC.ar(\n Normalizer.ar(\n BPeakEQ.ar(\n FreeVerb.ar(\n Splay.ar(RLPF.ar(LFSaw.ar(gamma)/4,gamma*LFCub.kr(rrand(0.01,0.1),0,2,3),LFNoise2.kr(1/8,0.6,0.7))),\n 0.1,0.1,0.1\n ),\n [100.rrand(200),1000.rrand(2000),5000.rrand(7000),10000.rrand(15000)],Array.rand(4,0,6),Array.rand(4,0,6)\n ).mean,\n 0.8,0.1\n )\n ),\n LFNoise2.kr(0.1.exprand(10)).range(-0.1,0.1),\n SelectX.kr(\n [SinOsc,LFTri].choose.kr(2.rrand(25).reciprocal).range(0,2),\n [\n 0.7.rrand(1),\n LFGauss.kr(\n Latch.kr(\n LFNoise2.kr(1).range(1/5,5.rrand(20)).reciprocal, \n Impulse.kr(LFNoise2.kr(3.rrand(10).reciprocal).range(0.5,3.rrand(6)))\n ),\n SinOsc.kr(3.rrand(15).reciprocal).range(0.07.rrand(0.16),0.25.rrand(0.4))\n ),\n 0.1.rrand(0.5)\n ]\n )\n )\n }).fadeTime_(3.rrand(6));\n wait.wait;\n }\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `MKtlElement.deviceSpec` do?"}, {"role": "assistant", "content": "The spec that maps between the numerical value range the device sends and/or receives, and the the unipolar range in the"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// randomly modulate all params\n(\n{ LatoocarfianC.ar(\n SampleRate.ir/4,\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5)\n) * 0.2 }.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// randomly modulate all params\n(\n{ LatoocarfianC.ar(\n SampleRate.ir/4,\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5)\n) * 0.2 }.play(s);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `WAmp.kr` do? What arguments does it take?"}, {"role": "assistant", "content": "windowed amplitude follower Arguments: in — Signal input.; winSize — The window size in seconds. Not modulatable.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Boot desired server first...\n// ... choose an invalid subject\n~encoder = FoaDecoderKernel.newCIPIC(0\n\n// make sure you scroll up to see the resulting valid subjects!\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Boot desired server first...\n// ... choose an invalid subject\n~encoder = FoaDecoderKernel.newCIPIC(0)\n\n// make sure you scroll up to see the resulting valid subjects!\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Object.perform` do?"}, {"role": "assistant", "content": "The selector argument must be a Symbol. Sends the method named by the selector with the given arguments to the receiver. If the first argument is an Array or List, this method behaves like `performMsg`. However, this usage is discouraged, and `performMsg` ought to be used"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PinkNoise`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-PinkNoise\", { |out = 0|\n Out.ar(out,\n PinkNoise.ar(0.4)\n )\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Blip`."}, {"role": "assistant", "content": "```supercollider\n// modulate frequency\n{ Blip.ar(XLine.kr(20000, 200, 6), 100, 0.2) }.play;\n\n// modulate numharmonics\n{ Blip.ar(200, Line.kr(1, 100, 20), 0.2) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//This is almost exactly the same as kick3.scd, they've been morphed into kik3.scd!\n\n\nSynthDef(\"kik\", { |basefreq = 50, ratio = 7, sweeptime = 0.05, preamp = 1, amp = 1, decay1 = 0.3, decay1L = 0.8, decay2 = 0.15, out|\n var fcurve = EnvGen.kr(Env([basefreq * ratio, basefreq], [sweeptime], \\exp)),\n env = EnvGen.kr(Env([1, decay1L, 0], [decay1, decay2], -4), doneAction: 2),\n sig = SinOsc.ar(fcurve, 0.5pi, preamp).distort * env * amp;\n Out.ar(out, sig ! 2)\n}).add;\n```"}, {"role": "assistant", "content": "This is almost exactly the same as kick3.scd, they've been morphed into kik3.scd!."}]} -{"conversations": [{"role": "user", "content": "What is `Select` in SuperCollider?"}, {"role": "assistant", "content": "Select — Select output from an array of inputs. The output is selected from an array of inputs. Category: UGens > Multichannel > Select."}]} -{"conversations": [{"role": "user", "content": "What does `Maybe.apply` do?"}, {"role": "assistant", "content": "return the value, or the value of the contained object, if it is a Maybe. This method allows recursion, so that recursive calculations can be made. `a = Maybe({ |a, b| a + b"}]} -{"conversations": [{"role": "user", "content": "What are the arguments of Pan2?"}, {"role": "assistant", "content": "`Pan2.ar(in, pos, level)` — in is the mono signal, pos is -1 (left) to 1 (right) with 0 in the middle, and level scales the output. It is equal-power, so a centred signal is -3 dB per channel rather than half amplitude. `Pan2.ar(sig, SinOsc.kr(0.1))` is the simplest autopan."}]} -{"conversations": [{"role": "user", "content": "What does `AbstractDispatcher.all` do?"}, {"role": "assistant", "content": "Get a collection of all currently active Returns: An IdentitySet."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// ServerBoot\ns.boot;\nf = { |server| \"------------The server '%' has booted.------------\\n\".postf(server) };\nServerBoot.add(f, \\default);\ns.quit; // quit the server and observe the post\ns.boot;\nServerBoot.remove(f, \\default); // remove it again\ns.quit;\ns.boot; // no post.\nServerBoot.add(f, Server.internal;\nServer.internal.quit;\nServer.internal.boot;\nServerBoot.removeAll; // clear all\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// ServerBoot\ns.boot;\nf = { |server| \"------------The server '%' has booted.------------\\n\".postf(server) };\nServerBoot.add(f, \\default);\ns.quit; // quit the server and observe the post\ns.boot;\nServerBoot.remove(f, \\default); // remove it again\ns.quit;\ns.boot; // no post.\nServerBoot.add(f, Server.internal);\nServer.internal.quit;\nServer.internal.boot;\nServerBoot.removeAll; // clear all\n```"}]} -{"conversations": [{"role": "user", "content": "What does `History.end` do?"}, {"role": "assistant", "content": "end adding interpreted code to (current)"}]} -{"conversations": [{"role": "user", "content": "How to know the hardware buffer size?"}, {"role": "assistant", "content": "SuperCollider forum — How to know the hardware buffer size\n\nSay you want to use a UGen to control an external hardware device, independently of the soundcard. At first, one would think that this calculation is time-locked to the control rate, so e.g. at 1.5 kHz for a 48 kHz sample rate and a block size of 32.\n\nBut no, of course this calculation is time-locked to the hardware buffer size (I/O buffer size) of the soundcard you happen to use. EDIT: For a typical (low) setting, this is something like 256, so that would be about 190 Hz (5 ms). This may be too much delay for some applications, so we may want a smaller buffer size.\n\nIn scsynth, we can set a value for this size via ServerOptions:\n\n```supercollider\n // reduce to block size\ns.options.hardwareBufferSize = s.options.blockSize;\ns.reboot;\n```\n\nUnfortunately, not all soundcards support low block sizes. Also high quality sound cards may have very large ones, actually – this is a cultural thing, when you use them for recording, it is not a problem. But for live I/O it introduces delay (a quarter second is like an eternity then).\n\nSo now my question: how do I know if the above setting has been actually successful? How do I know what buffer size is current?\n\nI am sure that on different OSes there are ways to derive this in different ways. Maybe there is a way in supercollider as well?"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nSynthDef(\"additivePad\", \n { arg numOfCycles = 100;\n var lfo;\n var lfo2;\n var lfo3;\n lfo = SinOsc.kr([Rand(0.5,1000),Rand(0.5,1000)], 1.5pi, 0.5, 0.5);\n lfo3 = SinOsc.kr([Rand(0.1,0.5),Rand(0.1,0.5)], 1.5pi, 0.5, 0.5);\n lfo2 = SinOsc.kr([(Rand(0.5,1000) * lfo) * lfo3, (Rand(0.5,1000) * (1 - lfo)) * (1 - lfo3)], 1.5pi, 0.5, 0.5);\n Out.ar(\n 0, \n Mix.arFill(\n numOfCycles,\n { \n SinOsc.ar(\n Rand(40,1000),\n 0, \n (numOfCycles.reciprocal * 0.75) * lfo2)\n }\n ) * EnvGen.kr(Env.perc(Rand(0.1,30), Rand(0.1,30)), doneAction: 2)\n )\n }\n).send(s); \n);\n\n(\nr = Routine({\n 200.do({\n x = Synth.new(\"additivePad\"); \n 10.wait;\n });\n});\n);\n\nr.play;\n```"}, {"role": "assistant", "content": "Just going crazy with modulation. Sample is available here: http://soundcloud.com/schemawound/schemawound-dawn-demo-version."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for julian rohrhuber (c 2007)."}, {"role": "assistant", "content": "```supercollider\n// julian rohrhuber (c 2007)\n\n(\nSynthDef(\"deepsea\", { arg out, pan=0, amp=0.1, variation=0.9;\n var dt, n, freq, mul, t, u;\n n = Rand(7, 46);\n dt = 25.0 + Rand(-1.7, 1.7);\n dt = dt + LFNoise2.kr(2, variation) * 0.001;\n freq = 901 + Rand(0, 65);\n t = Impulse.ar(dt.reciprocal, 0, 100);\n mul = PulseCount.ar(t) < n;\n u = BPF.ar(mul * t, freq, 0.1);\n u = BPF.ar(u, freq, 0.2);\n DetectSilence.ar(u, doneAction:2);\n Out.ar(out, Pan2.ar(u, pan, amp));\n}).add;\n);\n\n(\nSynthDef(\"deepsea\", { arg out, pan=0, amp=0.1, variation=0.9;\n var dt, n, freq, mul, t, u, count;\n n = Rand(7, 46);\n dt = 25.0 + Rand(-1.7, 1.7);\n dt = dt + LFNoise2.kr(2, variation) * 0.001;\n freq = 901 + Rand(0, 65);\n t = Impulse.ar(dt.reciprocal, 0, 100);\n count = PulseCount.ar(t);\n mul = count < n;\n u = BPF.ar(mul * t, freq, 0.1);\n u = BPF.ar(u, freq * (count % LFNoise1.kr(1).range(2, 20) + 1), 0.2);\n DetectSilence.ar(u, doneAction:2);\n Out.ar(out, Pan2.ar(u, pan, amp * 10));\n}).add;\n);\n\n\n\ns.sendMsg(\"/s_new\", \"deepsea\", -1);\n\n\np = ProxySpace.push(s.boot);\n\n~out.play;\n~out.fadeTime = 10;\n\n(\n~fish = Pbind(\n \\instrument, \\deepsea,\n \\dur, Pfunc #{ rrand(9.0, 2.0) },\n \\pan, Pfunc #{ 1.0.rand2 }\n );\n);\n\n~out = ~fish;\n~out[1] = \\filter -> #{ arg in; BPF.ar(in * 5, 700, 0.1) };\n\n(\n~out[2] = \\filter -> #{ arg in;\n CombL.ar(LPF.ar(in * LFNoise1.kr(0.1).max(0), 800), 0.5, 0.5) + in.reverse\n};\n);\n\n(\n~out[3] = \\filter -> #{ arg in; var x; x = in;\n 5.do { x = AllpassN.ar(x, 0.18, {0.06.rand} ! 2 + 0.06, 8) };\n LPF.ar(x + in, 400) + (LFNoise1.kr(0.2) * in)\n };\n\n);\n\n\n\n~out[1] = nil;\n~out[2] = nil;\n\n\np.clear(10).pop;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `PatchGui` in SuperCollider?"}, {"role": "assistant", "content": "PatchGui — gui class Category: Libraries > crucial > GuiClasses."}]} +{"conversations": [{"role": "user", "content": "What is `AbstractFunction`?"}, {"role": "assistant", "content": "AbstractFunction — An object which responds to a set of messages that represent mathematical functions"}, {"role": "user", "content": "What does `AbstractFunction.neg` do?"}, {"role": "assistant", "content": "`a = { 10.rand.postln }; b = a.neg; b.value;`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na = { |x, root = 60| x + root }; b = a.midicps; [a.value(9), b.value(9)];\na = Pseries(60, 1, inf).midicps; a.asStream.nextN(12);\n{ a = LFNoise1.ar(1) * 5 + 60; Pulse.ar(a.round.midicps) * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LFCub`."}, {"role": "assistant", "content": "```supercollider\n{ LFCub.ar(LFCub.kr(LFCub.kr(0.2, 0, 8, 10), 0, 400, 800), 0, 0.1) }.play\n{ LFCub.ar(LFCub.kr(0.2, 0, 400, 800), 0, 0.1) }.play\n{ LFCub.ar(800, 0, 0.1) }.play\n{ LFCub.ar(XLine.kr(100, 8000, 30), 0, 0.1) }.play\n\n// compare:\n\n{ LFPar.ar(LFPar.kr(LFPar.kr(0.2, 0, 8, 10), 0, 400, 800), 0, 0.1) }.play\n{ LFPar.ar(LFPar.kr(0.2, 0, 400, 800), 0, 0.1) }.play\n{ LFPar.ar(800, 0, 0.1) }.play\n{ LFPar.ar(XLine.kr(100, 8000, 30), 0, 0.1) }.play\n\n\n{ SinOsc.ar(SinOsc.kr(SinOsc.kr(0.2, 0, 8, 10), 0, 400, 800), 0, 0.1) }.play\n{ SinOsc.ar(SinOsc.kr(0.2, 0, 400, 800), 0, 0.1) }.play\n{ SinOsc.ar(800, 0, 0.1) }.play\n{ SinOsc.ar(XLine.kr(100, 8000, 30), 0, 0.1) }.play\n\n{ LFTri.ar(LFTri.kr(LFTri.kr(0.2, 0, 8, 10), 0, 400, 800), 0, 0.1) }.play\n{ LFTri.ar(LFTri.kr(0.2, 0, 400, 800), 0, 0.1) }.play\n{ LFTri.ar(800, 0, 0.1) }.play\n{ LFTri.ar(XLine.kr(100, 8000, 30), 0, 0.1) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `FreqScope`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n// create a new analyzer\nFreqScope.new(400, 200, 0, server: s);\n\n// basic sine\n{ SinOsc.ar(2000, 0, 0.25) }.play(s);\n\n// random saw\n{ RLPF.ar(Saw.ar(110, 0.2), LFNoise2.kr(1, 1e4, 1e4), LFNoise2.kr(1, 0.2, 0.22)) }.play(s);\n\n// modulate phase\n{ SinOsc.ar(800, SinOsc.ar(XLine.kr(20, 8000, 10), 0, 2pi), 0.25) }.play(s);\n\n// all harmonics\n{ Blip.ar(200, Line.kr(1, 100, 10), 0.2) }.play(s);\n\n// access the FreqScopeView object to set properties of the Qt Object:\nFreqScope.getInstance // get the FreqScope instance\n .scope // and its FreqScopeView\n .setProperty(\\updateInterval, 1000)\n // set updateInterval to 1000 ms because of reasons\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n//Version 1\n//P(eace)Bind\n//If error messages could experience Nirvanna, it would sound like this.\n(\n{\nSaw.ar(\n freq: SinOsc.kr([60, 63, 67, 70]).range(440,880),\n mul:LFNoise0.kr(freq: [0.25,1]).range(0,1),\n )\n}.play\n\n);\n\n\n//Version 2\n//SuperCollider\n//Sometimes in life, you feel like you need to collide with things.\n(\n{\nPulse.ar(\n freq: SinOsc.kr([60, 63, 67, 70]).range(30,70),\n mul: LFPulse.kr(freq: [0.25,1]).range(0,1)\n )\n}.play\n\n)\n```"}, {"role": "assistant", "content": "Quiz 4a for MUSC 115, pp. 62-84 from Gentle Intro to SuperCollider."}]} +{"conversations": [{"role": "user", "content": "What does `RedParticle.age` do?"}, {"role": "assistant", "content": "Scalar that decrease by 1 for every update. The default is"}]} +{"conversations": [{"role": "user", "content": "What is `Fb1_HopfAFDC` in SuperCollider?"}, {"role": "assistant", "content": "Fb1_HopfAFDC — Adaptive Hopf pseudo ugen with fast dynamical coupling This is an adaptive variant of Hopf, which enhances the adaption mechanism of #[1], see #[2] (4.1.) for a description. The parameter naming follows the convention of #[2]. Category: Libraries > miSCellaneous > Nonlinear."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n var saw, bpf;\n saw = Pulse.ar(\n freq: [100,150],\n mul: LFPulse.kr(\n freq: [0, 0.03, 0.04],\n width: 0.15));\n bpf = LPF.ar(in: saw, freq: SinOsc.kr(-10, -5, 3).range(200, 400));\n Out.ar(0, bpf);\n}.play;\n)\n```"}, {"role": "assistant", "content": "//Pulse is the UGen. There is multichannel expansion due to the lists in the freqs. The range is a big part of the reason this sounds so deep."}]} +{"conversations": [{"role": "user", "content": "What does `HasPatchIns.inputs` do?"}, {"role": "assistant", "content": "parent class for Players that have PatchIns such as Patch"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\ns=Server.default;\n\na= CutProcStream(BBCutProc11.new);\n\n//no offsets set (usually this would be decided by cut synthesisers\n10.do {a.next(Event.default).postln};\n\na= CutProcStream(RecursiveCutProc1.new);\n\n//offsets set\n10.do {a.next(Event.default).postln };\n\n//use with Patterns- not good for live interaction and beat induction in this case, but fine for rendering at server latency arms length.\n\nt=TempoClock(2.4);\n\nPbindf(CutProcStream(WarpCutProc1.new),\\sustain,0.01,\\freq,Pfun\n// …\n```"}, {"role": "assistant", "content": "no offsets set (usually this would be decided by cut synthesisers use with Patterns- not good for live interaction and beat induction in this case, but fine for rendering at server latency arms length. (CutProcStream: Stream wrapper for a cut procedure)"}]} +{"conversations": [{"role": "user", "content": "What does `Mx.insertChannel` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a channel at the index and add objects to Arguments: index; objects. Returns: MxChannel"}]} +{"conversations": [{"role": "user", "content": "What does `KeyCodeResponder.guiClass` do?"}, {"role": "assistant", "content": "register responder functions for keycode and modifier combinations"}]} {"conversations": [{"role": "user", "content": "What is `Splay`?"}, {"role": "assistant", "content": "Splay — Splay spreads an array of channels across the stereo field"}, {"role": "user", "content": "What does `Splay.arFill` do?"}, {"role": "assistant", "content": "In analogy to Mix:arFill, this method takes a function that produces the channels. The counting index is passed to it."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// splay 10 chans of sound into 2\n(\nx = { |spread = 1, level = 0.2, center = 0.0|\n var numchans = 10;\n Splay.ar(\n SinOsc.ar({ |i| LFNoise2.kr(1).exprange(200, 4000) } ! numchans),\n spread,\n level,\n center\n // use levelComp default true\n );\n}.play;\n);\n\ns.meter;\ns.scope;\n\n// change settings dynamically:\n\nx.set(\\spread, 1, \\center, 0); // full stereo\nx.set(\\spread, 0.5, \\center, 0); // less wide\nx.set(\\spread, 0, \\center, 0); // mono center\nx.set(\\spread, 0.5, \\center, 0.5); // spread from center to right\nx.set(\\spread, 0, \\center, -1); // all left\nx.set(\\spread, 1, \\center, 0); // full stereo\n\n// A similar example written with arFill:\n(\nx = { |spread = 1, level = 0.2, center = 0.0|\n var numchans = 10;\n Splay.arFill(numchans,\n { |i| SinOsc.ar(LFNoise2.kr(rrand(10, 20), 200, i + 3 * 100)) },\n spread,\n level,\n center\n );\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "How current is your SuperCollider knowledge?"}, {"role": "assistant", "content": "It comes from a snapshot of the SuperCollider repository (documentation, class library and examples) plus code I can reason about. So classes and arguments in that snapshot I know well, including argument order. Quarks, newer UGens, and anything outside the official tree I may not know at all, and I will say so rather than invent a method name. If you need certainty about a class, check its help page — `SinOsc.schelp` in the source tree is the authority."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Supercollider to Renoise."}, {"role": "assistant", "content": "```supercollider\n// declare an event type which sends OSC commands to Renoise\n\n(\nEvent.addEventType(\\renoise, { |server|\n var renoiseOscServer = NetAddr(\"127.0.0.1\", 8000);\n var notes = [~midinote.value, ~ctranspose.value, ~velocity.value, ~sustain.value, ~lag.value, ~timingOffset.value, ~instr.value, ~track.value].flop;\n var timeNoteOn, timeNoteOff, instrument, track, velocity;\n var serverLatency;\n\n serverLatency = server.latency ? 0;\n\n notes.do {|note|\n instrument = note[6] ? -1;\n track = note[7] ? -1;\n velocity = note[2].asInt.clip(0,127);\n\n // sustain and timingOffset are in beats, lag is in seconds\n timeNoteOn = (thisThread.clock.tempo.reciprocal*note[5])+note[4]+server.latency;\n timeNoteOff = (thisThread.clock.tempo.reciprocal*(note[3]+note[5]))+note[4]+server.latency;\n SystemClock.sched(timeNoteOn, {renoiseOscServer.sendMsg(\"/renoise/trigger/note_on\", instrument.asInt, track.asInt, (note[0]+note[1]).asInt, velocity )});\n SystemClock.sched(timeNoteOff, {renoiseOscServer.sendMsg(\"/renoise/trigger/note_off\", instrument.asInt, track.asInt, (note[0]+note[1]).asInt)});\n }\n});\n);\n\n// Now start Renoise OSC server, load a sample, and try some patterns\n\n// straight timing\n(\nPbind(*[\n type: \\renoise,\n legato: Pgauss(0.2,0.05,inf),\n dur: 0.2,\n degree: [2,5,12],\n track: Prand([0,1], inf),\n ctranspose: Pseq([0,0,0,0,4,4,4,4,5,5,5,5],inf),\n velocity: Pgauss(64,10,inf),\n]).play;\n);\n\n// loose timing\n(\nPbind(*[\n type: \\renoise,\n legato: 0.1,\n dur: 0.2,\n midinote: [66, 69, 74],\n lag: Pwhite(-0.05!3, 0.05)\n]).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BHiPass`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n(\nz = {\n BHiPass.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(10, 20000, \\exponential), // cutoff freq.\n MouseY.kr(0.0, 1.0, \\linear), // rq\n 0.5); // mul\n}.play\n);\nz.release;\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for instant nostalgia with wow and flutter?"}, {"role": "assistant", "content": "```supercollider\n// read a soundfile\n(\ns.waitForBoot({\n\n SynthDef(\\wowflutter_2chan, {\n arg bufnum, out = 0, wobble_rpm=33, wobble_amp=0.05, wobble_exp=39, flutter_amp=0.03, flutter_fixedfreq=6, flutter_variationfreq=2;\n var signed_wobble = wobble_amp*(SinOsc.kr(wobble_rpm/60)**wobble_exp);\n var wow = Select.kr(signed_wobble > 0, signed_wobble, 0);\n var flutter = flutter_amp*SinOsc.kr(flutter_fixedfreq+LFNoise2.kr(flutter_variationfreq));\n var combined_defects = 1 + wow + flutter;\n var sig = PlayBuf.ar(2, bufnum, BufRateScale.kr(bufnum)*combined_defects, doneAction:Done.freeSelf);\n Out.ar(out, sig);\n }).add;\n\n b = Buffer.read(s, \"pianomusic.wav\"); // link in code description, or use your own...\n s.sync;\n\n Synth(\\wowflutter_2chan ,[\n \\bufnum, b.bufnum,\n \\out, 0,\n \\wobble_rpm, 33,\n \\wobble_amp, 0.04,\n \\wobble_exp, 11, // best an odd power, higher values produce sharper, smaller peak\n \\flutter_amp, 0.02,\n \\flutter_fixedfreq, 6,\n \\flutter_variationfreq, 2\n ]);\n});\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ControlSpec`."}, {"role": "assistant", "content": "```supercollider\n// ControlSpec-map can also be used to map ugens\n(\nvar spec;\nspec = [100, 18000, \\exp].asSpec;\n{\n var freq, osc;\n osc = SinOsc.kr(0.1).range(0, 1);\n freq = spec.map(osc);\n\n freq.dump; // BinaryOpUGen\n\n SinOsc.ar(\n freq.poll\n )\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Ppar two intrument cumbia base."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\bass, { | atk = 0.01, dur = 0.15, freq = 50, amp=0.8 |\n var env, osc;\n env = EnvGen.kr( Env.perc( atk, dur-atk, amp, 6 ), doneAction: 2 );\n osc = BPF.ar(LFSaw.ar(freq), freq, 2, mul: env) ! 2;\n Out.ar([0,1],osc);\n}).add;\n);\n\n(\nSynthDef('wiro', { | amp = 0.1 |\n var osc, env, noise, out;\n noise = LPF.ar(WhiteNoise.ar(1),6000);\n osc = HPF.ar(noise,2000);\n //env = Line.ar(1, 0, 0.1);\n env = EnvGen.kr(Env.perc(0.01,0.05), doneAction: 2);\n out = (osc * env);\n Out.ar([0,1],out*amp)\n}).add;\n);\n\n(\nPpar([\n Pbind(\n \\instrument, \\bass,\n \\degree, Pseq([ Pseq([Pn(Pshuf([0,2,4],1),2),Pn(Pshuf([3,5,7],1),2)],2),Pn(Pshuf([-3,-1,1],1),2) ],inf),\n \\dur, Pseq([0.25,0.5,0.25],inf),\n \\legato, Pseq([ Pgeom(0.05, 0.05, 40), Pgeom(2.05, -0.05, 40) ], inf),\n \\octave, 3,\n \\amp, 0.03\n ),\n\n Pbind(\n \\instrument, \\wiro,\n \\dur, Pseq([0.5,0.25,0.25], inf),\n \\legato, Pseq([ Pgeom(0.05, 0.05, 40), Pgeom(2.05, -0.05, 40) ], inf),\n \\amp, 0.05,\n )\n]).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nSynthDef(\\Synth3,\n {arg ress = 0;\n var klank, env;\n klank = Klank.ar(`[{Rand(70,21000)}!7, {Rand(0.128,0.700)}!7],BrownNoise.ar(0.7));\n klank = klank;\n env = EnvGen.kr(Env.perc(0.07, ress), doneAction:2);\n Out.ar(0, klank*env.dup*0.0128);\n}).add;\n)\n\n\n{inf.do{x = rrand(0.01,0.7); Synth(\\Synth3, [\\ress, x+(7*x)]); x.wait;}}.fork\n```"}, {"role": "assistant", "content": "Play around with {Rand(70, 21000)}!7\r\n\r\nA simple example for the begginers... hope I can contribute to something =)."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes From a while ago."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var t, grav, sf, chain, sig;\n sf = LFPulse.ar(0.5);\n grav = LFNoise2.ar(1).range(0.1, 0.7);\n t = TBall.ar(sf, grav, 0.01, 0.0001) * 10;\n \n chain = FFT(LocalBuf(1024), t);\n chain = chain.pvcalc(1024, {|mags, phases|\n [phases, mags];\n });\n chain = PV_BrickWall(chain, LFNoise2.kr(1).range(-1, 0.5));\n chain = PV_RandComb(chain, LFNoise2.kr(1).range(0, 1), Dust.kr(20));\n sig = IFFT(chain);\n \n sig = sig ! 2;\n sig = sig + AllpassC.ar([sig[1], sig[0]], 0.1, {LFNoise2.kr(0.5).range(0.01, 0.1)} ! 2, 2);\n sig = sig + AllpassC.ar(sig, 0.1, {LFNoise2.kr(0.1).range(0.01, 0.1)} ! 2, 1);\n \n sig = LPF.ar(sig, 15000) + LPF.ar([sig[1], sig[0]], 500, 5) + LPF.ar(sig, 200, 10);\n sig = sig * 10;\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Recorder` in SuperCollider?"}, {"role": "assistant", "content": "Recorder — Write Audio to Harddisk A Recorder allows you to write audio to harddisk, reading from a given bus and a certain number of channels, relative to a given node. A Server has one instance, which is accessible also through the ScIDE. You can use the server directly to record its output Category: Server > Abstractions."}]} +{"conversations": [{"role": "user", "content": "What does `VOsc3.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Three variable wavetable oscillators. Arguments: bufpos — Buffer index. Can be swept continuously among adjacent wavetable buffers of the same size.; freq1 — Frequency in Hertz of the 1st oscillator. (non-interpolated control-rate); freq2 — Frequency in Hertz of the 2nd oscillator. (non-interpolated control-rate); freq3 — Frequency in Hertz of the 3rd oscillator. (non-interpolated control-rate); mul — Output will be multiplied by this value.; add — This value will be added to the output.."}]} +{"conversations": [{"role": "user", "content": "What does `NumberBox.shift_scale` do? What arguments does it take?"}, {"role": "assistant", "content": "The factor by which #-step or #-scroll_step is multiplied when incrementing or decrementing the value using keyboard or mouse while the Shift key is Arguments: A Float.."}]} +{"conversations": [{"role": "user", "content": "What does `BusPlug.bus` do?"}, {"role": "assistant", "content": "Set or get the bus. If BusPlug monitor is playing, restart the monitor to adequately play back the new"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `FreqScopeView`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// Start server\ns.boot;\n\n// Create analyzer in a window\n(\nw = Window(\"My Analyzer\", Rect(0, 0, 511, 300)); // width should be 511\nf = FreqScopeView(w, w.view.bounds);\nf.active_(true); // turn it on the first time;\n\nw.onClose_({ f.kill }); // you must have this\nw.front;\n{ SinOsc.ar([500, 1000], 0, 0.25).mean.dup }.play(s); // start two sine waves\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `TempoClock.beatDur` do?"}, {"role": "assistant", "content": "Returns the duration in seconds of a current whole"}]} +{"conversations": [{"role": "user", "content": "What does `Tempo.default` do?"}, {"role": "assistant", "content": "for control of tempo and for use in tempo based calculations"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//simple particlesystem.\n//with mouse controlling world gravity and system position\n\n(\nvar width= 300, height= 300, w, world,\nsys;\n\n//--world\nw= RedWindow(\"particlesystem test\", Rect(128, 64, width, height)).front;\nworld= RedWorld3(RedVector2D[width, height], 0, 20, -0.25); //dim,grav,maxvel,damp\n\n//--system\nsys= RedParticleSystem.new;\n\n//--loop\nw.draw{\n world.gravity= RedVector2D.newFrom(w.mouse/([width, height])-0.5);\n\n //--add new particles and update old\n sys.add(RedParticle(world, w.mouse+5.rand2, 0, RedVector2D[2.rand2, 10.rand], 1.5, 5.rand).age_(40.rrand(50)));\n sys.addForce(world.gravity);\n sys.update;\n\n //--render\n sys.do{|o| //iterate all particles in the system\n Pen.fillColor= Color.grey((o.age/50), 1);\n Pen.fillOval(Rect.aboutRedObject2D(o));\n };\n};\nw.play;\nCmdPeriod.doOnce({w.close});\n)\n```"}, {"role": "assistant", "content": "simple particlesystem. with mouse controlling world gravity and system position."}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for smooth arpeggio, updated envelope (a SuperCollider snippet): bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\bass, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.perc(0.2), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Control`."}, {"role": "assistant", "content": "```supercollider\na = { SinOsc.ar(\\freq.kr(440, 1.2)) }.play;\na.set(\\freq, 330);\na.release;\na = { SinOsc.ar(\\freq.kr([440, 460], 1.2)) }.play;\na.setn(\\freq, [330, 367]);\na.release;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nd = SynthDef(\\tone, { |out = 0, freq = 200|\n var sig;\n\n freq.spec = ControlSpec(20, 20000);\n sig = SinOsc.ar(freq);\n\n Out.ar(out, sig);\n}).add;\n;\n\nd.specs.freq.postln;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nd = SynthDef(\\tone, { |out = 0, freq = 200|\n var sig;\n\n freq.spec = ControlSpec(20, 20000);\n sig = SinOsc.ar(freq);\n\n Out.ar(out, sig);\n}).add;\n);\n\nd.specs.freq.postln;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SimpleNumber.bitNot` do?"}, {"role": "assistant", "content": "one-dimensional value Returns: ones complement"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\nn = NetAddr(\"localhost\", 12345);\nn = s.addr;\n\n// Example sending symbols, integers, and a float\nn.sendMsg('/s_new', \\default, 2000, 0, s.defaultGroup.nodeID, \\freq, 60.midicps);\n\n// The initial forward slash can be omitted\nn.sendMsg(\\n_set, 2000, \\gate, 0);\n\n// Using the performList syntax, you can use an array to store an OSC message\n~msg = [\\n_set, 2000, \\gate, 0];\nn.sendMsg(*~msg);\n```"}, {"role": "assistant", "content": "Example sending symbols, integers, and a float The initial forward slash can be omitted (NetAddr: network address)"}]} +{"conversations": [{"role": "user", "content": "Explain `CmdPeriod` in SuperCollider briefly."}, {"role": "assistant", "content": "CmdPeriod — register objects to be cleared when Cmd-. is pressed CmdPeriod allows you to register objects to perform an action when the user presses Cmd-. These objects must implement a method called -cmdPeriod which performs the necessary tasks. (You can add such a method in your custom classes.) Note that since Function implements -cmdPeriod as a synonym for -value, it is possible to register any function (and thus any arbitrary code) for evaluation when Cmd- Category: Control."}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n~buf = Buffer.read(s, \"C:/sounds/break.wav\");\nPlayBuf.ar(1, ~buf, BufRateScale.kr(~buf), loop: 1);\n```"}, {"role": "assistant", "content": "Loads a sound file into server memory, then plays it in a loop at the file's original pitch.\n\n- `Buffer.read(s, path)` allocates a buffer on the server and fills it from the file. It is asynchronous:\n the Buffer object returns immediately, the samples arrive later.\n- `PlayBuf.ar(1, buf, ...)` needs the channel count first — 1 for a mono file. A wrong count is the usual\n cause of a buffer that plays wrongly or not at all.\n- `BufRateScale.kr(buf)` compensates when the file's sample rate differs from the server's, so `rate: 1` is\n the file's true speed.\n- `loop: 1` restarts at the end instead of stopping.\n\nBecause the read is asynchronous, this line pair is only safe if a `s.sync` or a wait happened in between;\notherwise PlayBuf sees a buffer with no data yet."}]} {"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(..-9).mod(-3);\n// returns [0, -1, -2, 0, -1, -2, 0, -1, -2, 0]\n(..-9).modSeaside(-3);\n// returns [0, 2, 1, 0, -4, -5, 0, -4, -5, 0]\n\n// plot\n(-25..25).modSeaside(-5).plot.plotMode_(\\steps);\n\n// modSeaside\nPbind(\\note, modSeaside(Pseries(-15, 1, 25), -5), \\dur, 0.2).play;\n\n// modSeaside with different divisors\nPbind(\\note, modSeaside(Pseries(-15, 1, 25), [3, -4, -5]), \\dur, 0.2).play;\n\n// mod\nPbind(\\note, mod(Pseries(-15, 1, 25),\n// …\n```"}, {"role": "assistant", "content": "returns [0, -1, -2, 0, -1, -2, 0, -1, -2, 0] returns [0, 2, 1, 0, -4, -5, 0, -4, -5, 0] (Integer: 32-bit Integer number)"}]} -{"conversations": [{"role": "user", "content": "[ 1, 2, 1, 1, 2, 1, 1 ] how to find adjacent elements in an array?"}, {"role": "assistant", "content": "SuperCollider forum — [ 1, 2, 1, 1, 2, 1, 1 ] how to find adjacent elements in an array\n\nRandColors:\n\nI need to find the index, the how many times (the adjacent values are equal) and what is the adjacent value.\n\nThis is perhaps a bit verbose and clunky, but it meets the above specification:\n\n```supercollider\n(\n~repeats = {|array|\n // return [index, number of repeats, the value] for each repeated value\n var results = [];\n var thisIndex = 0;\n var thisCount = 1;\n var thisValue = array[0];\n array[1..].do{|val, i|\n if(val == thisValue,\n {thisCount = thisCount + 1},\n {\n if(\n thisCount > 1,\n {results = results.add([thisIndex, thisCount, thisValue])},\n );\n thisValue = val;\n thisIndex = i + 1;\n thisCount = 1;\n }\n )\n };\n if(thisCount > 1, {results = results.add([thisIndex, thisCount, thisValue])});\n results;\n}\n);\n\na = [1, 2, 1, 1, 1, 2, 1, 1];\nb = ~repeats.value(a);\n\na = [2, 3, 5, 5];\nb = ~repeats.value(a);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Midterm Q2 (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"sawSynth\",{arg freq, amp;\n var env, snd;\n\n env = Env.perc(\n attackTime:0.1,\n releaseTime:2,\n level:amp).kr(doneAction: 2);\n snd = Saw.ar(\n freq:freq*[0.99, 1.0, 1.001, 1.008],\n mul: env);\n snd = LPF.ar(in: snd,freq:2000);\n snd = Splay.ar(snd);\n Out.ar(0,snd);\n\n}).add;\n);\n\n(\nPbind(\n \\instrument, \"sawSynth\",\n \\freq, Pwhite(300, 700, inf),\n \\amp, Pwhite(0.15, 0.2)\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes shred01 (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n// by Notgoodenogh\n\n(\n5.do{\n\n{FreeVerb.ar(1 / pow(2.718281, LFSaw.ar(rrand(10,100),1,1).squared / (2 * (Latch.ar(WhiteNoise.ar(1).range(0.001, 0.15), LFSaw.ar(4,1,0.5,0.5) > 0.99)).squared)) * 0.1, 0.33, 2) * EnvGen.kr(Env.linen(20, 40, 20, 1), doneAction: 2) ! 2}.play\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nMix.ar([SinOsc.ar(220, 0, 0.1), SinOsc.ar(330, 0, 0.1)])\n```"}, {"role": "assistant", "content": "Sums two sine waves into one signal — a perfect fifth, 220 Hz and 330 Hz, at 0.1 amplitude each.\n\n`[SinOsc.ar(220, 0, 0.1), SinOsc.ar(330, 0, 0.1)]` is an Array of two audio-rate signals (each UGen\nreturns a signal; an array of them is just a list). `Mix.ar` adds the elements together. The alternative\n`+` operator does the same for two signals, and `Splay.ar` would spread them across the stereo field\ninstead of summing them."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Words in a matchbox?"}, {"role": "assistant", "content": "```supercollider\n// really early first approach...\n(\nx.free;\nx = {\n var note = Duty.kr(\n 6/3.2,\n 0, \n Dseq([45, 45, 48, 41], inf));\n var snd = Saw.ar(note.midicps * SinOsc.kr(7.421).range(0.998, 1.001)) * -12.dbamp!2;\n var trigs = TDuty.kr(\n Dseq([1, 2, 3]/3.2, inf),\n 0,\n 1);\n var lvls = Duty.kr(\n Dseq([1, 2, 3]/3.2, inf),\n 0,\n Dseq([-9, -3, -6], inf));\n snd = snd * lvls.dbamp.lag2(0.1);\n snd = snd * EnvGen.kr(Env.perc(0.3, 0.3), trigs);\n snd = RLPF.ar(snd, EnvGen.kr(Env.perc(0.5, 0.2), trigs) * 3201 + 2311, 0.2);\n snd = LPF.ar(snd, 3000);\n snd = snd * (1 + Latch.ar(WhiteNoise.ar(-8.dbamp), Dust.ar(830))).lag2(0.01);\n snd = snd + LPF.ar(CombC.ar(snd, 0.4, 0.33, 0.52, -4.dbamp), 932);\n snd = FreeVerb2.ar(snd, snd, 0.21, 0.93, 0.9);\n snd * -12.dbamp;\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n////////////// xosc nufo is unused by now ///////////\n// OSCdef(\\xoscAlive, { |msg, time|\n// if (NTMI.nufo.lastInTime == 0 or: { NTMI.nufo.timeSinceLast > 10 }) {\n// Tdef(\\allLEDs).play;\n// };\n// NTMI.nufo.deviceName = \\xosc;\n// NTMI.nufo.lastInTime = time;\n// }, \"/imu\").permanent_(true);\n```"}, {"role": "assistant", "content": "xosc nufo is unused by now /////////// OSCdef(\\xoscAlive, { |msg, time| if (NTMI.nufo.lastInTime == 0 or: { NTMI.nufo.timeSinceLast > 10 }) { Tdef(\\allLEDs).play; }; NTMI.nufo.deviceName = \\xosc; NTMI.nufo.lastInTime = time; }, \"/imu\").permanent_(true);."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for pitch tracker utility."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\\pitchTrack, {\n var soundin = SoundIn.ar(0);\n var zc = ZeroCrossing.ar(soundin);\n // var pt = Pitch.kr(soundin);\n // var tt = Tartini.kr(soundin);\n SendReply.kr(Impulse.kr(1), '/pitchTrackUtil', [zc, zc.cpsmidi]);\n}).add;\n\n~pitchTrack = {\n if(~pitchTrackSynth.isNil or: { ~pitchTrackSynth.isRunning.not }, {\n ~pitchTrackSynth = Synth(\\pitchTrack);\n ~pitchTrackNW = NodeWatcher.register(~pitchTrackSynth);\n }, {\n ~pitchTrackSynth.free;\n ~pitchTrackSynth = nil;\n \"Pitch tracker stopped.\".postln;\n });\n};\n\n~pitchTrackOSCFunc = {\n OSCFunc({\n | msg |\n (\"Pitch:\"+msg[3].round.asString.padLeft(5)+msg[4].round.asString.padLeft(3)).postln;\n }, '/pitchTrackUtil');\n};\n\n~pitchTrackOSCFunc.();\n\nCmdPeriod.add({~pitchTrackOSCFunc.();});\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Digital Bird sounds."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\birdy, {arg freq=1500, amp=0.5, rate=10;\n var osc, son, convIn, rand;\n osc=LFCub;\n rand = LFNoise1.ar(rate);\n convIn=LinCongN.ar(rate);\n son = osc.ar(Convolution.ar(convIn,convIn));\n freq = Latch.kr(rand.range(0,1).round(0.1), rand) * freq;\n freq = osc.ar(osc.ar(rand)*rand.range(0,10)).range(freq, freq*3);\n son = Formlet.ar(son, freq, convIn.abs*0.1, rand.abs);\n son = Normalizer.ar(son, 0.9, 0.1) * convIn.abs * LFPulse.kr(LFPulse.kr(rand.abs), 0, rand.abs);\n son = son + GVerb.ar(son, 99, 2, mul: rand.range(0,0.3));\n son * amp\n}).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ SyncSaw.ar(100, Line.kr(100, 800, 12), 0.1) }.play;\n\n\n(\nplot { [\n SyncSaw.ar(800, 1200),\n Impulse.ar(800) // to show sync rate\n] }\n);\n\n(\nplot { [\n SyncSaw.ar(800, Line.kr(800, 1600, 0.01)), // modulate saw freq\n Impulse.ar(800) // to show sync rate\n] }\n);\n\n// scoping the saw: hit 's' when focused on the scope window to compare the channels\n(\nscope {\n var freq = 400;\n [\n SyncSaw.ar(freq, freq * MouseX.kr(1, 3)), // modulate saw freq\n Impulse\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ SyncSaw.ar(100, Line.kr(100, 800, 12), 0.1) }.play;\n\n\n(\nplot { [\n SyncSaw.ar(800, 1200),\n Impulse.ar(800) // to show sync rate\n] }\n);\n\n(\nplot { [\n SyncSaw.ar(800, Line.kr(800, 1600, 0.01)), // modulate saw freq\n Impulse.ar(800) // to show sync rate\n] }\n);\n\n// scoping the saw: hit 's' when focused on the scope window to compare the channels\n(\nscope {\n var freq = 400;\n [\n SyncSaw.ar(freq, freq * MouseX.kr(1, 3)), // modulate saw freq\n Impulse.ar(freq) // to show sync rate\n] * 0.3 }\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `BlitB3Square.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Bipolar BLIT derived square waveform Arguments: freq — You start to hear aliasing over 4000 Hz or so, otherwise perceptually indistinguishable from an analogue waveform. Max frequency is half the sampling rate, but you'll hear aliasing well before that. Note that frequency can only be changed at the close of each period, so for very low frequencies, the; leak — leaky coefficient for integration. 0 would give back the impulses, higher numbers (up to near 1.0) fill out the inter-impulse space, integrating the waveform.."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Detuneable fat-saw with a pattern (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\fatsaw,\n {\n arg freq=440, amp=0.3, fat=0.0033, ffreq=2000, atk=0.001, dec=0.3, sus=0.5, rls=0.1,gate=1;\n\n var f1,f2,f3,f4,synth;\n\n f1=freq-(freq*fat);\n f2=freq-(freq*fat/2);\n f3=freq+(freq*fat/2);\n f4=freq+(freq*fat);\n\n synth = LFSaw.ar([f1,f2,f3,f4],[0,0.001,0.002,0.004,0.008]);\n synth = synth * EnvGen.kr(Env([0,1,sus,0],[atk,dec,rls],'lin',2),gate,doneAction:0);\n synth=Splay.ar(synth,0.7);\n synth=RLPF.ar(synth,ffreq*Linen.kr(gate,0.1,0.4,0.2,0),0.4);\n Out.ar([0,1],synth*amp);\n},[0.1,0.3,4,2]).add;\n);\n(\nTempoClock.default = TempoClock.new(2);\nfork{\n\n z = Synth(\\fatsaw,[\\gate,0,\\ffreq,500,\\fat,0.5]);\n\n a=Pseq([0,7,12,5],inf).asStream; // musical degrees\n c = Pseq([40,38,45,47],inf).asStream; // root midi notes\n e = Pseq([0.825,0.375,0.25,0.25],inf).asStream; // note durations\n f = Pseq([1000,1500,2000,2500],inf).asStream; // filter freq value\n\n 0.1.wait;\n z.set(\\gate,1);\n\n //set first root note\n d = c.next;\n\n 8.do{\n\n // move filter freq once every 4 notes\n z.set(\\ffreq, f.next);\n 4.do {\n z.set(\\gate,1);\n z.set(\\freq,(a.next + d).midicps);\n x=[0.451,0.45,0.449].choose;\n x.wait;\n z.set(\\gate,0);\n\n e.next.wait;\n };\n\n d = c.next;\n };\n 2.wait;\n z.free;\n};\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `HPZ1`."}, {"role": "assistant", "content": "```supercollider\n// Compare:\n\n{ WhiteNoise.ar(0.25) }.play;\n\n{ HPZ1.ar(WhiteNoise.ar(0.25)) }.play;\n\n// HPZ1 is useful to detect changes in a signal:\n// see also HPZ2\n(\n{\n var changingSignal = LFNoise0.ar(1000);\n var hpz1 = HPZ1.ar(changingSignal);\n [hpz1, hpz1 > 0, hpz1.abs > 0]\n}.plot\n);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Interface.guiBody` do? What arguments does it take?"}, {"role": "assistant", "content": "Sets up an environment in which you can build a player, a GUI and responders for midi and keyboard control Arguments: ... args."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes (thor magnusson) (2006) An instrumentalist inside a synthdef."}, {"role": "assistant", "content": "```supercollider\n// (thor magnusson) (2006)\n\n// An instrumentalist inside a synthdef.\n\n(\nSynthDef(\\drummer, { arg out=0, tempo=4;\n var snare, base, hihat;\n tempo = Impulse.ar(tempo); // for a drunk drummer replace Impulse with Dust !!!\n\n snare = WhiteNoise.ar(Decay2.ar(PulseDivider.ar(tempo, 4, 2), 0.005, 0.5));\n base = SinOsc.ar(Line.ar(120,60, 1), 0, Decay2.ar(PulseDivider.ar(tempo, 4, 0), 0.005, 0.5));\n hihat = HPF.ar(WhiteNoise.ar(1), 10000) * Decay2.ar(tempo, 0.005, 0.5);\n\n Out.ar(out,(snare + base + hihat) * 0.4 ! 2)\n}).add;\n);\n\na = Synth(\\drummer);\na.set(\\tempo, 6);\na.set(\\tempo, 18);\na.set(\\tempo, 180); // check the CPU! no increase.\na.free;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns=Server.default;\n\ns.latency=0.05;\n\nc=ExternalClock(TempoClock(2.1)).play;\n\n//playExt= play on External Clock\np=Pbind.new.playExt(c);\n\nq= Pbind(\\dur,Pseq([0.25,0.25,0.5],inf),\\freq,Pseq([330,330,550],inf),\\sustain, 0.1).playExt(c;\n\nq.mute;\nq.unmute;\n\np.stop;\nq.stop;\n\nc.stop;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns=Server.default;\n\ns.latency=0.05;\n\nc=ExternalClock(TempoClock(2.1)).play;\n\n//playExt= play on External Clock\np=Pbind.new.playExt(c);\n\nq= Pbind(\\dur,Pseq([0.25,0.25,0.5],inf),\\freq,Pseq([330,330,550],inf),\\sustain, 0.1).playExt(c);\n\nq.mute;\nq.unmute;\n\np.stop;\nq.stop;\n\nc.stop;\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Converting an environment in a prototype object."}, {"role": "assistant", "content": "```supercollider\n~constructPseudoMethods = { |envir|\n var newEnvir = envir.collect { |value|\n var argNames, argBlock, namesBlock, code, func;\n if(value.isKindOf(Function)) {\n func = value;\n argNames = func.def.argumentString(withDefaultValues: true);\n namesBlock = func.def.argumentString(withDefaultValues: false);\n argBlock = if(argNames.notNil) { \"|self, \" ++ argNames ++ \"|\" };\n code = \"{ |func, envir| { % envir.use { func.value(%) } } }\".format(argBlock ? \"\", namesBlock ? \"\");\n //code.postln;\n code.interpret.value(func, envir)\n } {\n value\n }\n };\n newEnvir.know = true; // we want a prototype object style environment\n};\n```"}]} -{"conversations": [{"role": "user", "content": "What does `MxChannel.move` do? What arguments does it take?"}, {"role": "assistant", "content": "a group of MxUnits Arguments: fromIndex; toIndex."}]} -{"conversations": [{"role": "user", "content": "What does `Object.multiChannelPerform` do? What arguments does it take?"}, {"role": "assistant", "content": "Perform selector with multichannel expansion. See also: Arguments: selector — A Symbol representing a method selector.; ... args — Method arguments which, if they contain an array, will call the method multiple times for each sub-element.."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Integer`."}, {"role": "assistant", "content": "```supercollider\n(..-9).mod(-3);\n// returns [0, -1, -2, 0, -1, -2, 0, -1, -2, 0]\n(..-9).modSeaside(-3);\n// returns [0, 2, 1, 0, -4, -5, 0, -4, -5, 0]\n\n// plot\n(-25..25).modSeaside(-5).plot.plotMode_(\\steps);\n\n// modSeaside\nPbind(\\note, modSeaside(Pseries(-15, 1, 25), -5), \\dur, 0.2).play;\n\n// modSeaside with different divisors\nPbind(\\note, modSeaside(Pseries(-15, 1, 25), [3, -4, -5]), \\dur, 0.2).play;\n\n// mod\nPbind(\\note, mod(Pseries(-15, 1, 25), -5), \\dur, 0.2).play;\n\n// mod with different divisors\nPbind(\\note, mod(Pseries(-15, 1, 25), [3, -4, -5]), \\dur, 0.2).play;\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Scale`."}, {"role": "assistant", "content": "```supercollider\n(\nr = {\n var scale = Scale.choose.postln;\n SinOsc.ar(\n (\n DegreeToKey.kr(\n scale.as(LocalBuf),\n MouseX.kr(0, 15), // mouse indexes into scale\n scale.stepsPerOctave,\n 1, // mul = 1\n 60 // offset by 72 notes\n )\n + LFNoise1.kr([3, 3], 0.04) // add some low freq stereo detuning\n ).midicps, // convert midi notes to hertz\n 0,\n 0.25\n )\n}.play;\n);\n\nr.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Nuclear Fallout (a SuperCollider snippet)?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n var saw, bpf;\n saw = Saw.ar(\n freq: [60,150],\n mul: LFPulse.kr(\n freq: [2,3],\n width: 0.15));\n \n { BPF.ar(\n in: WhiteNoise.ar(mul: 1),\n freq: 1000,\n rq: 0.9\n )\n}\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `RedSpring.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a new spring Arguments: object — A RedObject that will be connected to target.; target — A RedObject acting as target.; stiffness — A Float. The default is 0.1.; damping — A Float. The default is 0.9.; length — A Float. The default is 0.."}]} -{"conversations": [{"role": "user", "content": "What does `NamedControl.tr` do?"}, {"role": "assistant", "content": "add a new instance of TrigControl with given name and default values. If lags are given, apply a Lag UGen to"}]} -{"conversations": [{"role": "user", "content": "Explain `Disintegrator` in SuperCollider briefly."}, {"role": "assistant", "content": "Disintegrator — port of some ladspa plugins Amplifies random half-cycles of it's input by multiplier. Set multiplier to 0 and vary probability for a weird fade effect, or set multiplier to -1 and probability to 0.5 to turn pitched sounds into noise. Category: UGens > Filters."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Supercollider to Renoise."}, {"role": "assistant", "content": "```supercollider\n// declare an event type which sends OSC commands to Renoise\n\n(\nEvent.addEventType(\\renoise, { |server|\n var renoiseOscServer = NetAddr(\"127.0.0.1\", 8000);\n var notes = [~midinote.value, ~ctranspose.value, ~velocity.value, ~sustain.value, ~lag.value, ~timingOffset.value, ~instr.value, ~track.value].flop;\n var timeNoteOn, timeNoteOff, instrument, track, velocity;\n var serverLatency;\n\n serverLatency = server.latency ? 0;\n\n notes.do {|note|\n instrument = note[6] ? -1;\n track = note[7] ? -1;\n velocity = note[2].asInt.clip(0,127);\n\n // sustain and timingOffset are in beats, lag is in seconds\n timeNoteOn = (thisThread.clock.tempo.reciprocal*note[5])+note[4]+server.latency;\n timeNoteOff = (thisThread.clock.tempo.reciprocal*(note[3]+note[5]))+note[4]+server.latency;\n SystemClock.sched(timeNoteOn, {renoiseOscServer.sendMsg(\"/renoise/trigger/note_on\", instrument.asInt, track.asInt, (note[0]+note[1]).asInt, velocity )});\n SystemClock.sched(timeNoteOff, {renoiseOscServer.sendMsg(\"/renoise/trigger/note_off\", instrument.asInt, track.asInt, (note[0]+note[1]).asInt)});\n }\n});\n);\n\n// Now start Renoise OSC server, load a sample, and try some patterns\n\n// straight timing\n(\nPbind(*[\n type: \\renoise,\n legato: Pgauss(0.2,0.05,inf),\n dur: 0.2,\n degree: [2,5,12],\n track: Prand([0,1], inf),\n ctranspose: Pseq([0,0,0,0,4,4,4,4,5,5,5,5],inf),\n velocity: Pgauss(64,10,inf),\n]).play;\n);\n\n// loose timing\n(\nPbind(*[\n type: \\renoise,\n legato: 0.1,\n dur: 0.2,\n midinote: [66, 69, 74],\n lag: Pwhite(-0.05!3, 0.05)\n]).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "In what order should I learn SuperCollider?"}, {"role": "assistant", "content": "The order that pays off fastest:\n\n1. **One UGen and Out** — `{ SinOsc.ar(440) * 0.2 }.play`. Learn that a graph must reach Out.\n2. **Envelopes and doneAction** — the difference between a sound and a click.\n3. **SynthDef and Synth** — naming a graph, controlling it with arguments, freeing it with a gate.\n4. **Patterns** — `Pbind` for sequence, so you stop writing loops by hand.\n5. **Buses and effects** — chaining, sends, groups.\n6. **JITLib** — Ndef for patches you modify while they play.\n\nVocabulary to carry: UGen, SynthDef, Synth, bus, group, envelope, gate, doneAction, Pattern, clock. Every\nconfusion in SuperCollider tends to be one of those words."}]} -{"conversations": [{"role": "user", "content": "What does `FlowView.indentedRemaining` do?"}, {"role": "assistant", "content": "The maximum space that is left, starting at the current cursor position."}]} -{"conversations": [{"role": "user", "content": "What does `PMOsc.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Phase modulation oscillator pair. Arguments: carfreq — Carrier frequency in cycles per second.; modfreq — Modulator frequency in cycles per second.; pmindex — The modulation index, representing the ratio of modulator deviation to modulator frequency. Higher values generally produce denser spectra.; modphase — A modulation input for the modulator's phase in radians.; mul — Output will be multiplied by this value.; add — This value will be added to the output.."}]} -{"conversations": [{"role": "user", "content": "What does `Magnitude.min` do?"}, {"role": "assistant", "content": "Comparable value in a linear continuum Returns: the minimum of the receiver and aMagnitude."}]} -{"conversations": [{"role": "user", "content": "When should I use a Pattern instead of writing Synth code by hand?"}, {"role": "assistant", "content": "Use a Pattern when what you want to express is a sequence over time — notes, durations, amplitudes, parameters — rather than a signal. A Pbind describes events, and `.play` turns each event into a Synth (by default of the \\default instrument, or of \\instrument if you name one). Hand-written Synth code is for the sound itself; Patterns are for what plays when. The two compose: a SynthDef named \\bell is triggered from `Pbind(\\instrument, \\bell, ...)`."}]} -{"conversations": [{"role": "user", "content": "What does `EventPatternProxy.new` do?"}, {"role": "assistant", "content": "create a new instance with a pattern (the source). The pattern should be an event pattern (see"}]} -{"conversations": [{"role": "user", "content": "What does `FunctionList.new` do? What arguments does it take?"}, {"role": "assistant", "content": "create a new Arguments: functions — An array of functions or objects."}]} -{"conversations": [{"role": "user", "content": "How do I make an additive bell with Klank?"}, {"role": "assistant", "content": "Klank is a bank of resonant filters excited by a short impulse: you describe the partials as\nfrequencies, amplitudes and decay times.\n\n```supercollider\n(\nSynthDef(\\klank, { |out = 0, freq = 440, amp = 0.3|\n var ratios = [1, 2.2, 3.7, 5.1, 7.3];\n var decays = [4, 2.6, 1.8, 1.2, 0.8];\n var sig = Klank.ar(`[ratios * freq, nil, decays], Impulse.ar(0, 0, 0.2), 1, 0, 0.3);\n Out.ar(out, Pan2.ar(sig * amp, 0));\n}).add;\n);\nSynth(\\klank);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SimpleNumber.betaFullC` do?"}, {"role": "assistant", "content": "Returns the full (non-normalised) complement of the incomplete beta function of `a`, `b` and `x`. Require 0 <= `x` <= 1, and `a,b` >"}]} -{"conversations": [{"role": "user", "content": "Explain `GrayNoise` in SuperCollider briefly."}, {"role": "assistant", "content": "GrayNoise — Bit-flipping Noise Generates noise which results from flipping random bits in a word.foot Generated through mathX_{0} = 1;\\;X_{n+1} = X_{n} \\oplus z, where math\\oplus is bitwise exclusive or, and mathz is a 32-bit binary number with exactly one nonzero digit; the position of the nonzero digit is a uniform random variable. Category: UGens > Generators > Stochastic."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\ns.boot;\n// Simple polling of mean values - you could do this without a UGen!\nx = {|val=1, t_trig=0| MeanTriggered.kr(val, t_trig, 3).poll(t_trig, \"Mean of recent 3 values\"); }.play;\nx.set(\\val, 10.rand.postln, \\t_trig, 1); // Execute this repeatedly\n\nx.free;\n\n// Using it as an audio filter - compare the sounds of these:\nx = {WhiteNoise.ar(0.1)}.play;\nx.free;\nx = {MeanTriggered.ar(WhiteNoise.ar(0.1), 1, 3)}.play; // Note that \".sum\" would be more efficient here...\nx.free;\nx = {MeanT\n// …\n```"}, {"role": "assistant", "content": "Simple polling of mean values - you could do this without a UGen! Using it as an audio filter - compare the sounds of these: (MeanTriggered: Mean of recent values, triggered)"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\ns.boot;\n\n(\nSynthDef(\"lazerdrone\", {\n var in, freq, hasFreq;\n\n \n in = SinOsc.ar(440 * LFSaw.kr(100, 1000));\n\n # freq, hasFreq = Pitch.kr(\n in,\n ampThreshold: 0.09,\n median: 1);\n freq = freq * hasFreq;\n //freq.poll;\n \n SinOsc.kr(freq).poll;\n \n Out.ar(0, in + \n SinOsc.ar(440, \n 0, \n Clip.kr(\n SinOsc.kr(freq), \n 0)\n )\n );\n}).play;\n)\n```"}, {"role": "assistant", "content": "A lazer sound then a drone with morse-code like bleeps. A byproduct of testing the triggering algorithm in the mono2eN SynthDef."}]} -{"conversations": [{"role": "user", "content": "What is `BRF` in SuperCollider?"}, {"role": "assistant", "content": "BRF — 2nd order Butterworth band reject filter. A second order band reject filter. Category: UGens > Filters > Linear."}]} -{"conversations": [{"role": "user", "content": "What does `MxIOletsApp.first` do?"}, {"role": "assistant", "content": "returns first Returns: an MxInletApp or MxOuletApp"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for reverbio (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"reverb\", {arg freq=440, release=0.1;\n var in, s1,out, mod1, depth, mfreq;\n s1 = SoundIn.ar(0,mul:2);\n out=FreeVerb.ar(s1,mix:1,room:MouseX.kr(0,1),damp:MouseY.kr(0,1));\n Out.ar(0,out);\n Out.ar(1,out);\n}).load(s);\n);\na = Synth(\"reverb\");\na.free\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Stethoscope`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n(\n{\n SinOsc.ar([225, 450, 900], 0, 0.2)\n + LPF.ar(\n LFPulse.ar(226 * [1, 2, 5], [0, 0.1, 0.1], 0.2, 0.2),\n MouseX.kr(20, 10000, 1)\n )\n}.scope;\n);\n\n// server.scope only changes the properies explicitly given:\n\ns.scope(numChannels: 5);\ns.scope(index: 12);\ns.scope(zoom: 4);\ns.scope(index: 0);\n\ns.scopeWindow.size = 600;\ns.scopeWindow.size = 222;\n\n// scoping buses:\n\na = Bus.audio(s, 4);\n{ WhiteNoise.ar(0.2.dup(4)) }.play(s, a);\n\na.scope;\n\nc = Bus.control(s, 3);\n{ WhiteNoise.kr(1.dup(4) * MouseX.kr) }.play(s, c);\n\nc.scope;\n\n// note that scoping control rate buses shows block size interpolation (this is due to the\n// fact that ScopeOut.kr doesn't work yet.)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `PSVsect` in SuperCollider?"}, {"role": "assistant", "content": "PSVsect — Sieve pattern for intersection of integer generators with point output Pattern for intersection of integer generators with point output. Corresponds to Sieve's methods Sieve#*sect and Sieve#-sect. For an introduction and more examples see Sieves_and_Psieve_patterns. Category: Libraries > miSCellaneous > Sieves and Psieve Patterns, Streams-Patterns-Events > Sieves and Psieve Patterns."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n~resize_enveloppe = { | levels, times |\n var reverted_levels, index;\n index = 0;\n reverted_levels = levels.reverse;\n while( { reverted_levels[index] == 0 && reverted_levels[index+1] == 0 }, { times[ times.size - 1 - index] = 0.01; index = index + 1 } );\n};\n)\n```"}, {"role": "assistant", "content": "Enveloppes sizes are fixed. This means that if enveloppe's levels are equals to [ 1, 0, 0, 0, 0, 0, 0, 0 ] and times are equals to [ 1, 1, 1, 1, 1, 1, 1, 1 ], the synth UGens will take resources 8 seconds but will only be audible 1 second. To avoid this, passing both the levels and the times to this function will detect when the sound stops playing and will reduce the \"silence\" times to 0.01s, thu."}]} -{"conversations": [{"role": "user", "content": "What does `Option.empty` do?"}, {"role": "assistant", "content": "Represents optional values. Returns: None()"}]} -{"conversations": [{"role": "user", "content": "What is the correct way to stop everything?"}, {"role": "assistant", "content": "Depends on what is playing, and they are different layers:\n\n- `s.freeAll` — frees every node on the server (all sound stops, definitions survive).\n- `CmdPeriod.run` — stops everything scheduled on the clocks (Patterns, Routines, Tasks).\n- `Ndef.clear; Pdef.clear` — clears the JITLib proxies.\n- `s.quit` — shuts the server down entirely.\n\nIn a session the habit is `CmdPeriod.run` first (stops the sequencing), then `s.freeAll` if a drone is still\nsounding."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SoundIn`."}, {"role": "assistant", "content": "```supercollider\n// world's most expensive patchcord (use headphones to avoid feedback)\n{ SoundIn.ar(0) }.play;\n\n// stereo version\n{ SoundIn.ar([0, 1]) }.play;\n\n// scope input; silent output\n{ Amplitude.kr(SoundIn.ar(0)) }.scope;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = NodeProxy(s);\na.play;\na.source = { BPF.ar(Impulse.ar({ rrand(1.0, 2.0) } ! a.numChannels), (0..5).nthPrime * 300, 0.01) * 20 };\na.numChannels; // 2\na.mold(8;\na.numChannels; // 8\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = NodeProxy(s);\na.play;\na.source = { BPF.ar(Impulse.ar({ rrand(1.0, 2.0) } ! a.numChannels), (0..5).nthPrime * 300, 0.01) * 20 };\na.numChannels; // 2\na.mold(8);\na.numChannels; // 8\n```"}]} -{"conversations": [{"role": "user", "content": "What does `PLbindefParEnvironment.num` do?"}, {"role": "assistant", "content": "Getter for PLbindefPar's number of parallel"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for get different result each time running the pattern."}, {"role": "assistant", "content": "```supercollider\nTempoClock.default.tempo = 156/60;\n\n(\nSynthDef(\\spring, { |freq = 400, out = 0, pan = 0, gate = 1, dur = 0.15, curve = -4, amp = 1, index = 1|\n var sig = FreeVerb.ar(Pan2.ar(Blip.ar(freq, index), pan));\n var env = EnvGen.ar(Env.perc(0.01, dur, amp, curve), gate, doneAction:2);\n Out.ar(0, sig * env);\n}).add;\n);\n\n(\nPbind(*[\n instrument: \\spring,\n dur: Pseq([4, 1, 2, 1, 1, 1].scramble/ 4 / TempoClock.default.tempo, inf),\n degree: Pseq(#[1,2,3,4], inf) * Pkey(\\dur).reciprocal,\n octave: Pseq([2,3,4,4,4,3].scramble, inf),\n pan: Pxrand(Array.fill(100, { 0.gaussian(1).clip2(1) }), inf),\n amp: Pseq(#[0.95,1,0.8],inf),\n index: Pstutter(Pseq(#[4,8,12],inf), Pseq([2,3,4,5,6,8].scramble, inf))\n]).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Digital Bird sounds."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\birdy, {arg freq=1500, amp=0.5, rate=10;\n var osc, son, convIn, rand;\n osc=LFCub;\n rand = LFNoise1.ar(rate);\n convIn=LinCongN.ar(rate);\n son = osc.ar(Convolution.ar(convIn,convIn));\n freq = Latch.kr(rand.range(0,1).round(0.1), rand) * freq;\n freq = osc.ar(osc.ar(rand)*rand.range(0,10)).range(freq, freq*3);\n son = Formlet.ar(son, freq, convIn.abs*0.1, rand.abs);\n son = Normalizer.ar(son, 0.9, 0.1) * convIn.abs * LFPulse.kr(LFPulse.kr(rand.abs), 0, rand.abs);\n son = son + GVerb.ar(son, 99, 2, mul: rand.range(0,0.3));\n son * amp\n}).play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What's the difference between Env.perc and Env.adsr?"}, {"role": "assistant", "content": "`Env.perc(attack, release)` goes up once and decays to zero — one-shot sounds. `Env.adsr(a, d, s, r)` holds at a sustain level while its gate is open and only releases when the gate closes — notes you start and stop."}, {"role": "user", "content": "So which do I use for a pad?"}, {"role": "assistant", "content": "adsr, with `gate` as a Synth argument and `doneAction: 2` on the EnvGen:\n\n```supercollider\nSynthDef(\\pad, { |out = 0, freq = 220, gate = 1|\n var env = EnvGen.kr(Env.adsr(0.8, 0.4, 0.7, 2), gate, doneAction: 2);\n Out.ar(out, Saw.ar(freq) * env * 0.1)\n}).add;\n```\n\nThen `x.set(\\gate, 0)` releases it over the 2 seconds of release time."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n~inPlaceSub = { |array, find, replace|\n array.do({ |item, i|\n if(item == find) { array[i] = replace };\n });\n};\n\n~trySub = { |array, find, replace|\n try {\n ~inPlaceSub.(array, find, replace)\n } { |error|\n switch(error.species.name)\n { 'PrimitiveFailedError' } {\n if(error.what.find(\"immutable\").notNil) {\n \"caught ImmutableError\".postln;\n ~inPlaceSub.(array.copy, find, replace)\n } { \"unknown primitive exception\".postln; error.throw }\n }\n // default case: unhandled exception, should\n// …\n```"}, {"role": "assistant", "content": "default case: unhandled exception, should die so re-throw error pass in a mutable array, OK (Exception: root error class)"}]} +{"conversations": [{"role": "user", "content": "What does `HelpBrowser.goTo` do?"}, {"role": "assistant", "content": "Go to specific URL. If the URL points to a file under SCDoc#*helpTargetDir it will be rendered on demand if needed. A URL can also be a local"}]} +{"conversations": [{"role": "user", "content": "What is `ControlName`?"}, {"role": "assistant", "content": "ControlName — Object to store control information of SynthDef (used internally)"}, {"role": "user", "content": "What does `ControlName.index` do?"}, {"role": "assistant", "content": "The index of the control."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nd = SynthDef(\\tone, { |out = 0, freq = 200|\n var sig;\n\n freq.spec = ControlSpec(20, 20000);\n sig = SinOsc.ar(freq);\n\n Out.ar(out, sig);\n}).add;\n);\n\nd.specs.freq.postln;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `NumberEditor.numChannels` do?"}, {"role": "assistant", "content": "holds a float value with a spec, editable with a gui"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nNdef(\\nodeTest, {\n // the input\n var input = Impulse.ar([1, 3, 5].reciprocal, phase: [0, 0.133, 0.5]).sum;\n\n // the nodes, each takes its predecessor as input and estimates the duration between two events. \n // Unfortunately, the starting point of Timer is '0' which we have to put into reasonable limits. System settles after about 15 seconds\n var nodes = (1..10).inject([input], {|last, item| \n [TDuty.ar(max(0.25, Timer.ar(last.first)), 0, 1)] ++ last\n });\n\n // add a pitch to each\n nodes = nodes.collect{|node, i| SinOsc.ar((4000 + (i*500))) * Decay2.ar(node, 0.01, 0.2)};\n\n // splay in stereo field\n Splay.ar(nodes);\n\n}).play\n)\n```"}, {"role": "assistant", "content": "Idea: network of loosely connected nodes. Each node has a dedicated pulse rate / phase. Inducing an irregular trigger signal influences the nodes to (gradually) adapt their pulsation freq (and phase?) to the one of the input.\r\nsound example: https://soundcloud.com/lfsaw/sync-weakconnection-tduty-time."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BusPlug`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\nz = Bus.control(s, 16);\nz.setn({ |i| (i * 5).nthPrime } ! 16 * 5 + 100);\na = BusPlug.for(z);\n{ Splay.ar(SinOsc.ar(a.kr(3, MouseX.kr(0, 25)))) * 0.1 }.play; // selectively play 3 channel of the 16, modulate offset\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `In` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n(\nSynthDef(\"help-PinkNoise\", { |out = 0|\n Out.ar(out, PinkNoise.ar(0.1))\n}).add;\n\nSynthDef(\"help-In\", { |out = 0, in = 0|\n var input;\n input = In.ar(in, 1);\n Out.ar(out, input);\n\n}).add;\n);\n\n// play noise on the right channel\nx = Synth(\"help-PinkNoise\", [\\out, 1]);\n\n// read the input and play it out on the left channel\nSynth.after(x, \"help-In\", [\\out, 0, \\in, 1]);\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `Red3DBox` in SuperCollider briefly."}, {"role": "assistant", "content": "Red3DBox — 3D box / cube A class for rotating and rendering a box in 3D. Category: Red > redUniverse > 3D."}]} {"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DigitalIn`."}, {"role": "assistant", "content": "```supercollider\n// turn on and off a sine oscillator\n\n(\nSynthDef(\"help-DigitalIn\", { |out = 0|\n Out.ar(out,\n SinOsc.ar(500, 0, 0.1 * DigitalIn.ar(0))\n )\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// example\n\n(\n{\n var a, freq, trig;\n a = Dgeom(1, 1.2, 15);\n trig = Impulse.kr(MouseX.kr(1, 40, 1));\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n);\n\n(\n{\n var a, freq, trig;\n a = Dgeom(1, 1.2, inf);\n trig = Dust.kr(MouseX.kr(1, 40, 1));\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// example\n\n(\n{\n var a, freq, trig;\n a = Dgeom(1, 1.2, 15);\n trig = Impulse.kr(MouseX.kr(1, 40, 1));\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n);\n\n(\n{\n var a, freq, trig;\n a = Dgeom(1, 1.2, inf);\n trig = Dust.kr(MouseX.kr(1, 40, 1));\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Real-time pattern morphing with Ndef."}, {"role": "assistant", "content": "```supercollider\n(\n~name = \"saw\";\n\nSynthDef(~name, { arg out=0, amp=0.1, gate=1, pan=0, spread=0.8, freq=200, doneAction=2, ffreq=300, rq=0.3;\n var sig;\n sig = LFSaw.ar(freq);\n sig = RLPF.ar(sig, ffreq, rq);\n sig = sig * EnvGen.ar(\\adsr.kr(Env.adsr(0.01,0.1,0.8,0.1)),gate,doneAction:doneAction);\n sig = Splay.ar(sig, spread, amp, pan);\n Out.ar(out, sig);\n}).add;\n\n\n~morph = { arg mainkey, lagtime, pat;\n var base = pat.asStream.next(());\n var bind = List.new;\n var proxy;\n base.keysValuesDo { arg key, val;\n var ndefkey = \"%.%\".format(mainkey, key).asSymbol;\n Ndef(ndefkey, { \n Line.kr(Ndef(ndefkey).kr, val, lagtime)\n });\n proxy = Ndef(ndefkey);\n bind.add(key);\n bind.add(proxy.bus.asMap);\n };\n Pbind(*bind)\n};\n);\n\n\nPdef(~name).play;\n\n\n(\n// preset 1\n\n~a = Pdef(~name, ~morph.(\\bla, 2.1, Pbind(\n \\freq, 100,\n \\ffreq, 1300,\n)) <> Pbind(\n \\instrument, ~name,\n \\dur, 1,\n));\n\n);\n\n(\n// preset 2\n\n~a = Pdef(~name, ~morph.(\\bla, 1, Pbind(\n \\freq, 1500,\n \\ffreq, 200,\n)) <> Pbind(\n \\instrument, ~name,\n \\dur, 1,\n));\n\n);\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\nx = Synth(\"default\";\nx.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\nx = Synth(\"default\");\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What is the node tree and what is a Group for?"}, {"role": "assistant", "content": "Everything running on the server is a node: Synths and Groups, arranged in a tree under the root group. Order matters, because audio flows through buses from earlier to later nodes in the same branch. A Group is a container that lets you address many nodes at once, which is what you want for an effect chain — put the instruments in one group, the effect in another, and `freeAll` or a volume change hits the whole group instead of a list of node ids."}]} -{"conversations": [{"role": "user", "content": "What does `Signal.peak` do?"}, {"role": "assistant", "content": "Return the peak absolute value of a Signal. `Signal[1, 2, -3,"}]} -{"conversations": [{"role": "user", "content": "I get 'server not running' or nothing happens at all."}, {"role": "assistant", "content": "The server is not booted. In the IDE press Ctrl+B, or evaluate `s.boot`. If code depends on a SynthDef being there, put it inside `s.waitForBoot { ... }`. When a script runs headless you can do `s.boot; s.sync;` and continue. `s.serverRunning` tells you the truth; if it is false, look at the post window for the boot error (usually an audio device problem)."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Now you're going to die (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\fall, { arg freq=200, pan=0, amp=0.1;\n var sig;\n sig = ( WhiteNoise.ar + 0.8 ) * LFSaw.ar({ exprand(10.0,10000) }!20 * ( 1 + ( SinOsc.ar((1..4).rand(0.0)/18 * XLine.kr(1,121200,80)) * 1/41 * XLine.kr(1,180,60) )));\n sig = DelayC.ar(sig, 0.2, {rrand(1/5,1/10000) * ( 1 + ( SinOsc.ar((1..2).rand(0.0)/18 * XLine.kr(1,121200,60)) * 1/41 * XLine.kr(1,180,60) ))}!4) + sig / 2;\n sig = DelayC.ar(sig, 0.2, {rrand(1/5,1/10000) * XLine.kr(1,1/1000,14)}!4) + sig / 2;\n sig = sig + BPF.ar(\n sig, \n { ( exprand(100.0,10000) * LFNoise1.ar(1/100.0.rand).range(1,2) ).clip(20,20000) }!10,\n { ( rand(0.01,1) * LFNoise1.ar(1/100.0.rand).range(1,2) ).clip(0.01,1) }!10\n );\n sig = BRF.ar(\n sig, \n { ( exprand(100.0,10000) * LFNoise1.ar(1/100.0.rand).range(1,2) ).clip(20,20000) }!10,\n { ( rand(0.01,1) * LFNoise1.ar(1/100.0.rand).range(1,2) ).clip(0.01,1) }!10\n );\n sig = LeakDC.ar(sig);\n sig = LPF.ar(sig, 17000 * XLine.kr(1/100,1,4));\n sig = sig * 5 * 3;\n sig = sig.mean;\n sig = sig * amp;\n sig;\n}).play;\n);\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `RedManchesterCode` in SuperCollider briefly."}, {"role": "assistant", "content": "RedManchesterCode — Manchester encoding As per IEEE 802.3. See http://en.wikipedia.org/wiki/Manchester_encoding Category: Red > redTools."}]} -{"conversations": [{"role": "user", "content": "What can you do?"}, {"role": "assistant", "content": "Write and explain SuperCollider: SynthDefs, UGens, Patterns, Ndef, buses and envelopes, and tell you why a patch is silent or will not compile. I am 198M parameters, so I am narrow on purpose."}]} -{"conversations": [{"role": "user", "content": "What does `UnicodeResponder.report` do?"}, {"role": "assistant", "content": "register responder functions for unicode and modifier combinations"}]} -{"conversations": [{"role": "user", "content": "What is `PClip` in SuperCollider?"}, {"role": "assistant", "content": "PClip — UGenPatterns quark library Based on Clip Category: Streams-Patterns-Events > UGenPatterns > Modifiers."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n//you must have run this line before any of the examples below\nf= BBCutBuffer(Platform.resourceDir +/+ \"sounds/break.aiff\",8);\n\nTempoClock.default.tempo_(2.3);\n\n//default\na=BBCut2(CutBuf1(f),CageCut.new).play;\n\na.end;\n\n//weirder\na=BBCut2(CutBuf1(f),CageCut(8.0,[0.2,0.3,0.4,0.1])).play;\n\na.end;\n\n//using your own permutation function\na=BBCut2(CutBuf1(f),CageCut(16.0,[1,3,3,1,1,2,2,1],{arg array; array.scramble\n// …\n```"}, {"role": "assistant", "content": "you must have run this line before any of the examples below using your own permutation function (CageCut: Automatic breakbeat cutting algorithm inspired by John Cage)"}]} -{"conversations": [{"role": "user", "content": "What does `TimeStretch2.stretch` do? What arguments does it take?"}, {"role": "assistant", "content": "Server Side Time Stretch Arguments: inFile — Path to the input file to be stretch. Can be a mono or stereo file. Will output a mono or stereo file corresponding to the input. Will output a WAV file up to 4gb and a w64 if larger.; durMult — How many times longer the outFile will be than the inFile. Goes waaaaay past 11 (try 100!).; numSplits — By default, the algorithm will split audio data into 9 frequency \"octaves\", starting with the first octave below nyquist, then subsequent octaves down from there, leaving everything below the last split to the largest buffer. However, for files of transients, you may want to approach this differentl; amp — The amplitude. Default is 1.; action — A function to be evaluated when the process has completed. By default it will print \"Done stretchin!\"."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// UnitTestScript(\"Collapse\", thisProcess.nowExecutingPath).runScript;\n\n{\n |test|\n var collapseValues = List();\n var collapse;\n\n collapse = Collapse({ |v| collapseValues.add(v) }, 0.1);\n\n collapseValues.clear;\n\n collapse.value(1);\n test.assert(collapseValues.isEmpty, \"Collapse doesn't exec immediately\");\n\n 1.wait;\n test.assertEquals(collapseValues.array, [1], \"Collapse execs eventually\");\n\n collapseValues.clear;\n [1, 2, 3, 4, \"last\"].do { |i| collapse.(i); 0.05.wait };\n 1.wait;\n test.assertEquals(collapseValues.array, [\"last\"], \"Collapse only execs last value.\");\n\n collapseValues.clear;\n [\"first\", \"second\", \"last\"].do { |i| collapse.(i); 0.2.wait };\n test.assertEquals(collapseValues.array, [\"first\", \"second\", \"last\"], \"Collapse execs all values.\")\n\n};\n```"}, {"role": "assistant", "content": "UnitTestScript(\"Collapse\", thisProcess.nowExecutingPath).runScript;."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Ppar two intrument cumbia base."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\bass, { | atk = 0.01, dur = 0.15, freq = 50, amp=0.8 |\n var env, osc;\n env = EnvGen.kr( Env.perc( atk, dur-atk, amp, 6 ), doneAction: 2 );\n osc = BPF.ar(LFSaw.ar(freq), freq, 2, mul: env) ! 2;\n Out.ar([0,1],osc);\n}).add;\n);\n\n(\nSynthDef('wiro', { | amp = 0.1 |\n var osc, env, noise, out;\n noise = LPF.ar(WhiteNoise.ar(1),6000);\n osc = HPF.ar(noise,2000);\n //env = Line.ar(1, 0, 0.1);\n env = EnvGen.kr(Env.perc(0.01,0.05), doneAction: 2);\n out = (osc * env);\n Out.ar([0,1],out*amp)\n}).add;\n);\n\n(\nPpar([\n Pbind(\n \\instrument, \\bass,\n \\degree, Pseq([ Pseq([Pn(Pshuf([0,2,4],1),2),Pn(Pshuf([3,5,7],1),2)],2),Pn(Pshuf([-3,-1,1],1),2) ],inf),\n \\dur, Pseq([0.25,0.5,0.25],inf),\n \\legato, Pseq([ Pgeom(0.05, 0.05, 40), Pgeom(2.05, -0.05, 40) ], inf),\n \\octave, 3,\n \\amp, 0.03\n ),\n\n Pbind(\n \\instrument, \\wiro,\n \\dur, Pseq([0.5,0.25,0.25], inf),\n \\legato, Pseq([ Pgeom(0.05, 0.05, 40), Pgeom(2.05, -0.05, 40) ], inf),\n \\amp, 0.05,\n )\n]).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes sclang fun )."}, {"role": "assistant", "content": "```supercollider\n( // whatever\nNdef(\\ff_twist, {\n var tempo = 156/60;//TempoClock.tempo;\n var bands = 4.rrand(16).debug('bands');\n var sync = bands.factors.scramble.pop.debug('sync');\n var gen = [LFNoise1,LFNoise2,LFNoise0];\n var sig = Splay.ar(\n VarSaw.ar(//LFSaw.kr(Array.rand(bands/sync, 8, 390).stutter(sync)).range(0.97,1.03) * \n Array.exprand(bands, 50, 400) * ({ gen.choose.kr(1/1.rrand(10)).exprange(1, 10) } ! (bands/sync)).stutter(sync), \n 0, \n { gen.choose.kr(1/1.rrand(10)).range(0.1,1) } ! bands, \n { gen.choose.kr(1/1.rrand(10)).range(0.1,1) } ! bands\n ) * ({ EnvGen.kr(Env.perc(0.008.exprand(0.03), tempo.reciprocal / [1,2,4,8].choose, 1, rrand(-7,-1.0)).circle) } ! (bands/sync)).stutter(sync)\n );\n sig = sig * 0.7 + GVerb.ar(sig, mul:0.3);\n sig = Rotate2.ar(\n sig[0], sig[1], \n LFSaw.kr( Duty.kr(tempo.reciprocal * (2,8..24).choose, 0, Drand((1..4)*tempo, inf)) )\n );\n sig;\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `MassEditU` in SuperCollider briefly."}, {"role": "assistant", "content": "MassEditU — Edit multiple units simultaneously. Mimicks a real U, but in fact edits multiple instances of U. Category: UnitLib."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Function:do vs FunctionList:do (same)\na.do { |x| x.value };\n{ 4 }.do { |x| x.value.postln }\n\n(\n().use {\n ~x = \"array\";\n ~y = \"ominous\";\n a.valueEnvir;\n a.valueEnvir(\"list\");\n}\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Function:do vs FunctionList:do (same)\na.do { |x| x.value };\n{ 4 }.do { |x| x.value.postln }\n\n(\n().use {\n ~x = \"array\";\n ~y = \"ominous\";\n a.valueEnvir;\n a.valueEnvir(\"list\");\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `RedMatrixMixer.new` do? What arguments does it take?"}, {"role": "assistant", "content": "mix any number of input and output channels Arguments: nIn — Number of input busses.; nOut — Number of output busses.; in — Offset of first input bus.; out — Offset of first out bus.; group — if `nil` matrixmixer will boot the default server and creates a group after the `defaultGroup`. if a Group then that will be used (also its server). Note that a passed in group object is not freed with calling matrixmixer's #-free.; lag — For amplitudes in seconds.."}]} -{"conversations": [{"role": "user", "content": "What is `NdefGui`?"}, {"role": "assistant", "content": "NdefGui — a gui for a NodeProxy or Ndef"}, {"role": "user", "content": "What does `NdefGui.big` do?"}, {"role": "assistant", "content": "two lines of controls for a big NdefGui, usually in its own window"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\np = ProxySpace.push(s.boot);\n\nl = NdefGui(nil, 3).moveTo(10, 120);\nm = NdefGui(nil, 3).moveTo(10, 240);\nn = NdefGui(nil, 3).moveTo(10, 360);\no = NdefGui(nil, 3).moveTo(10, 480);\n\nSpec.add(\\dens, [0.1, 300, \\exp]);\n\n// make 3 kinds of proxies: using tilde/proxyspace, Ndef, and unnamed.\n~spacy = { |dens = 5| Formlet.ar(Dust.ar(dens ! 2), LFDNoise0.kr(20 ! 2).lag(0.1).linexp(-1, 1, 300, 5000), 0.003, 0.03) };\nNdef(\\ndeffy, { GrayNoise.ar(0.1 ! 2) });\nc = NodeProxy.audio.source_({ PinkNoise.ar(0.1 ! 2) });\n\n// put one in each editor\nl.object_(~spacy);\nm.object_(Ndef(\\ndeffy));\nn.object_(c);\n);\n// One should also be able to drag and drop text into the drag,\n// but this is also not working yet.\n( Ndef(\\a) )\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n var saw, bpf;\n saw = Saw.ar(\n freq: [1700,2000],\n mul: LFPulse.kr(\n freq: [2,7],\n width: 0.115));\n bpf = LPF.ar(in: saw, freq: SinOsc.kr(1/3).range(250, 4000)); \n}.play;\n)\n```"}, {"role": "assistant", "content": "Quiz 4a for MUSC 115, pp. 62-84 from Gentle Intro to SuperCollider."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n//a SynthDef\n(\nSynthDef(\"plucking\", {arg amp = 0.1, freq = 220, decay = 5, coef = 0.1;\n\nvar env, snd;\nenv = EnvGen.kr(Env.linen(0, decay, 0.5), doneAction: 2);\nsnd = Pluck.ar(\n in: Saw.ar(freq, 0.5*amp),\n trig: Impulse.kr(0),\n\n maxdelaytime: 0.1,\n delaytime: freq.reciprocal,\n decaytime: decay,\n coef: coef);\n Out.ar(0, [snd, snd]);\n}).add;\n);\n\n//Bugger soundtrack\n(\nPbind(\n \\instrument, \"plucking\",\n \\scale, Scale.lydian,\n \\degree, Prand([[-2.5, -4.001], [-7.002, -5], [-1, -3.003], [1.005, 0.51]], inf),\n \\amp, Pseq([0.1, 0.2, 0.3, 0.4, 0.5, 0.5, 0.5, 0.5], inf),\n \\decay, Pseq([0.25,1, 0.5, 0.125], inf),\n \\coef, Pseq([0.7, 0.8, 0.9], inf),\n \\dur, Pseq([0.01, 0.0025, 0.2475, 0.24, 0.5], inf)\n).play;\n)\n```"}, {"role": "assistant", "content": "This will be the sound track for Bugger, a Frogger clone that started as a school assignment.\r\nSimple SynthDef using Pluck, and a few Pbinds. \r\n\r\nBugger can be found on [GitLab](https://gitlab.com/Modanung/Bugger)."}]} -{"conversations": [{"role": "user", "content": "How do I use a metronome or check my timing?"}, {"role": "assistant", "content": "A click on the clock you are using, plus a counter to see where you are in the bar:\n\n```supercollider\n(\nTdef(\\click, {\n var count = 0;\n loop {\n (Synth(\\hat, [\\amp, if (count % 4 == 0) { 0.25 } { 0.08 }]));\n count = count + 1;\n 1.wait;\n }\n}).play;\n)\n```\n\nBecause it waits on `TempoClock.default`, it stays in sync with every Pbind you start, which makes it a\ntempo reference rather than a separate sound."}]} -{"conversations": [{"role": "user", "content": "What does `Fb1_ODEdef.next` do? What arguments does it take?"}, {"role": "assistant", "content": "Method for language-side integration, gives next value based on previous Arguments: intType — Integration type. Expects one of the Symbols, for which procedures are stored with Fb1_ODEintdef. The use of symplectic procedures (with prefix 'sym', like 'sym2') is highly recommended. For more accurate integration you can try symplectic procedures of higher order like \\sym4, \\sym8 etc. Multi-step; t — Previous time, expects Number.; y — Previous state, expects Number or Array of system size.; dt — Number. Time delta.; args — List of additional args to be passed to Fb1_ODEdef's function.."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Resonz`."}, {"role": "assistant", "content": "```supercollider\n{ Resonz.ar(WhiteNoise.ar(0.5), 2000, 0.1) }.play\n\n// modulate frequency\n{ Resonz.ar(WhiteNoise.ar(0.5), XLine.kr(1000, 8000, 10), 0.05) }.play\n\n// modulate bandwidth\n{ Resonz.ar(WhiteNoise.ar(0.5), 2000, XLine.kr(1, 0.001, 8)) }.play\n\n// modulate bandwidth opposite direction\n{ Resonz.ar(WhiteNoise.ar(0.5), 2000, XLine.kr(0.001, 1, 8)) }.play\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for it goes beyond vibrato too."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"vibrato\", {arg freq=440, release=0.1;\n var x, sig,out, mod1, depth, mfreq,maxfreq, maxdepth, maxdelay, basedelay;\n maxfreq=5;\n maxdelay=0.1;\n basedelay=maxdelay/2;\n maxdepth=basedelay/2;\n depth = MouseY.kr(0,maxdepth);\n mfreq = MouseX.kr(0,maxfreq);\n mod1 = SinOsc.ar(mfreq,0,depth);\n sig = SoundIn.ar(0,mul:2);\n x = DelayC.ar(sig, maxdelay,basedelay+ mod1);\n out = x;// FreeVerb.ar(x,MouseX.kr(0,1),MouseY.kr(0,1), 0.1);\n Out.ar(0,out);\n Out.ar(1,out);\n}).load(s);\n);\n\na = Synth(\"vibrato\");\na.free\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = {LFTri.ar(100+(1000*Maths.ar(MouseX.kr, MouseY.kr, SinOsc.ar(0.2, 0).range(0,1), 1-MouseButton.kr(lag:0.001))[0]), 0, 0.1}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = {LFTri.ar(100+(1000*Maths.ar(MouseX.kr, MouseY.kr, SinOsc.ar(0.2, 0).range(0,1), 1-MouseButton.kr(lag:0.001))[0]), 0, 0.1)}.play\n```"}]} -{"conversations": [{"role": "user", "content": "What does `FoaDecoderMatrix.shelfK` do?"}, {"role": "assistant", "content": "If the decoder is dual-band psychoacoustically optimised, get or set the shelf"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// poor man's panning\n{\n var f, hornbostelwertheimerkonstante;\n f = MouseY.kr(1, 100, 1);\n hornbostelwertheimerkonstante = 0.00063;\n Impulse.ar(f, hornbostelwertheimerkonstante * f * [1, MouseX.kr(0, 2)], 0.1) \n}.play\n```"}, {"role": "assistant", "content": "If you are too poor to afford changing the amplitudes of a stereo signal, just let the channels wait. But the signal frequency is an impasse that is to be valued in itself."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for simple melody algorithmically generated with a Markov Chain."}, {"role": "assistant", "content": "```supercollider\n/* Markov Chain Experiment II\n Jacob Joaquin\n\n Get a visual representation of the Markov Chain here:\n http://codehop.com/supercollider-markov-chain/\n*/\n\n(\n// Synthesizer\nSynthDef(\\my_synth, {|dur = 1.0, amp = 1.0, freq = 440|\n var env = EnvGen.ar(Env.new([1, 0.1, 0], [0.06, dur - 0.06]), doneAction: 2);\n Out.ar([0, 1], SinOsc.ar([freq * 0.995, freq * 1.005], 0, env * amp))\n}).add; \n\n// Create task\nt = Task({\n // Set attributes of each node\n // [freq, dur, [[next_state, weighted_random],…]]\n var node_list = [\n [60, 1, [[1, 2]]],\n [62, 0.5, [[0, 1], [2, 1]]],\n [63, 1, [[0, 1], [3, 1]]],\n [65, 0.5, [[0, 1], [3, 4], [4, 1]]],\n [67, 1, [[5, 1]]],\n [70, 1.5, [[4, 1], [6, 2]]],\n [69, 1, [[4, 1], [7, 2]]],\n [72, 0.5, [[4, 1], [7, 4], [0, 2]]]\n ];\n\n var node_index = 0;\n var bps = 133.0 / 60.0; // Beats per second\n \n inf.do({\n var weight = 0;\n var random;\n var accumulator;\n var node = node_list[node_index]; \n var freq = node[0].midicps;\n var dur = node[1] / bps;\n var paths = node[2];\n \n // Get total statistical weight of connected nodes\n (0 .. paths.size - 1).do {|i| weight = weight + paths[i][1]};\n \n // Generate random value for choosing next node\n random = weight.rand;\n\n // Choose next node based on statistical weights\n accumulator = paths[0][1];\n \n node_index = block {|break|\n paths.size.do {|i|\n if ((random < accumulator), {\n break.value(paths[i][0])\n }, {\n accumulator = accumulator + paths[i + 1][1] \n })\n }\n };\n \n // Play\n Synth(\\my_synth, [\\dur, dur, \\amp, -3.dbamp, \\freq, freq]); \n dur.wait;\n })\n});\n\nt.start;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "How do I structure a live-coding performance in one file?"}, {"role": "assistant", "content": "One Tdef per musical layer, each with its own loop, so you can start and stop layers while the set\nruns.\n\n```supercollider\n(\nTdef(\\kick, {\n loop {\n Synth(\\kick);\n 0.5.wait;\n }\n}).play;\n\nTdef(\\hats, {\n loop {\n Synth(\\hat, [\\amp, 0.15]);\n (1/8).wait;\n }\n}).play;\n)\n```\n`Tdef(\\kick).stop` stops one layer, `Tdef(\\kick).reset` restarts it at the next cycle, and\n`CmdPeriod.run` stops everything."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PlazyEnvir`."}, {"role": "assistant", "content": "```supercollider\n(\na = PlazyEnvir({ |a = 0, b = 1| Pshuf([a, a, b], 2) }); // a, b default to 0, 1\nx = Pn(a, inf).asStream;\n\n10.do { x.next.postln }; Post.nl;\ne = (a: 100);\n10.do { x.next(e).postln }; Post.nl;\ne = (a: 100, b: 200);\n10.do { x.next(e).postln };\n);\n\n\n// PlazyEnvir used to produce a Pbind:\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05, pan = 0|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, Pan2.ar(SinOsc.ar(freq, 0, env), pan))\n }).add;\n\na = PlazyEnvir({ |g = 0, h = 0, dur = 1|\n postf(\"g: %, h: %, dur: %\\n\", g, h, dur);\n Pbind(\n \\instrument, \\help_sinegrain,\n \\dur, dur,\n \\degree, Pseq([g, g, h, g, h], 2)\n )\n});\n);\n\n// different variants\n(a <> (g: 0, h: 3, dur: 0.2)).play; // single stream\n(a <> (g: [0, 4], h: [3, -1], dur: 0.2)).play; // same durations, two streams\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns=Server.default;\n\na= CutProcStream(BBCutProc11.new);\n\n//no offsets set (usually this would be decided by cut synthesisers\n10.do {a.next(Event.default).postln};\n\na= CutProcStream(RecursiveCutProc1.new);\n\n//offsets set\n10.do {a.next(Event.default).postln };\n\n//use with Patterns- not good for live interaction and beat induction in this case, but fine for rendering at server latency arms length.\n\nt=TempoClock(2.4);\n\nPbindf(CutProcStream(WarpCutProc1.new),\\sustain,0.01,\\freq,Pfun\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns=Server.default;\n\na= CutProcStream(BBCutProc11.new);\n\n//no offsets set (usually this would be decided by cut synthesisers\n10.do {a.next(Event.default).postln};\n\na= CutProcStream(RecursiveCutProc1.new);\n\n//offsets set\n10.do {a.next(Event.default).postln };\n\n//use with Patterns- not good for live interaction and beat induction in this case, but fine for rendering at server latency arms length.\n\nt=TempoClock(2.4);\n\nPbindf(CutProcStream(WarpCutProc1.new),\\sustain,0.01,\\freq,Pfunc({arg event; (event[\\cutnum]*50) + 200})).play(t);\n\n\nPbindf(CutProcStream(SQPusher1.new),\\sustain,0.01,\\freq,Pfunc({arg event; (event[\\cutnum]*260) + 170}), \\amp, 0.2).play(t);\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `HelpBrowser` in SuperCollider briefly."}, {"role": "assistant", "content": "HelpBrowser — Browse the SuperCollider help documentation HelpBrowser is a GUI help browser that lets you browse the documentation of SuperCollider. It is coupled with SCDoc to allow on-the-fly rendering of HTML help files. Category: HelpSystem, GUI > Interfaces."}]} -{"conversations": [{"role": "user", "content": "What does `ProxySpace.copy` do?"}, {"role": "assistant", "content": "Copies the environment into a new one, with each proxy being copied as well (See: NodeProxy#-copy). Also the instance variables that determine the ProxySpace behaviour are included, such as server, fadeTime, quant, reshaping (this happens in the `copyState` method). `p ="}]} +{"conversations": [{"role": "user", "content": "What is `Decay` in SuperCollider?"}, {"role": "assistant", "content": "Decay — Exponential decay An integrating filter which, if given an impulse, will produce an exponentially decaying envelope. `Decay` is essentially the same as Integrator, but instead of specifying the integration coefficient directly, it is calculated from the decayTime — the time required for input signal to attentuate 60 dB, or decay to 99.9% of its value. Category: UGens > Filters > Linear, UGens > Envelopes."}]} +{"conversations": [{"role": "user", "content": "What does `LineLayout.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a HLayout or a VLayout and immediately fill it with items given as arguments. (Note that LineLayout is an abstract class and can not be instantiated, but HLayout and VLayout inherit this Arguments: ... items — Each item can be a view, a layout, nil (for stretchable empty space) or an Integer (for fixed-size empty space).."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n// Play it with the mouse...\nx = { MoogFF.ar(WhiteNoise.ar(01.1), MouseY.kr(100, 10000, 1), MouseX.kr(0, 4)) }.play(s);\nx.free;\n\n// Mmmm, throbby\n(\nx = {\n MoogFF.ar(\n Pulse.ar([40, 121], [0.3, 0.7]),\n SinOsc.kr(LFNoise0.kr(0.42).range(0.001, 2.2)).range(30, 4200),\n 0.83 * 4) }.play(s);\n;\nx.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n// Play it with the mouse...\nx = { MoogFF.ar(WhiteNoise.ar(01.1), MouseY.kr(100, 10000, 1), MouseX.kr(0, 4)) }.play(s);\nx.free;\n\n// Mmmm, throbby\n(\nx = {\n MoogFF.ar(\n Pulse.ar([40, 121], [0.3, 0.7]),\n SinOsc.kr(LFNoise0.kr(0.42).range(0.001, 2.2)).range(30, 4200),\n 0.83 * 4) }.play(s);\n);\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `SFPlayer` in SuperCollider briefly."}, {"role": "assistant", "content": "SFPlayer — A soundfile player SFPlayer plays sound files directly from disk. It also has a convenient #-gui. Category: UGens > InOut, UGens > Buffer."}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for little homage to \"Come Out\" by Steve Reich: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n/* A little homage to \"Come Out\" by Steve Reich.\n It explores ryhtmic aspects created by phasing, retriggering, and pitch shifting.\n It \"detours\" the original audio message available here\n http://www.freesound.org/people/ERH/sounds/34667/\n in which a police patrol recites\n \"We don't want to scare your children, that's the last thing we wanna do\".\n \n */\n\n\ns.options.memSize=128*1024;\ns.boot;\n\n~bus=Bus.audio(s,2);\n~buf=Buffer.readChannel(s,\"/home/***/Supercollider/sounds/v.wav\");\n\n(\nSynthDef(\\playbuff,{arg in=0,out=0,t_trig=0;\n var i=EnvGen.kr(Env([0,40,0.3,0.4,40,0],[0,60,20,20,30]),gate:1);\n var r=EnvGen.kr(Env([0,10,-0.9,-0.9],[40,20,15]),gate:t_trig,doneAction:2);\n var sig1=PlayBuf.ar(1,in,rate:1+r,trigger:Impulse.kr(i),loop:1);\n var sig2=PlayBuf.ar(1,in,rate:1+r,trigger:Impulse.kr(i+0.01),loop:1);\nOut.ar(out,Splay.ar([sig1,sig2],0.5));\n};\n).add;\n\nSynthDef(\\rev,{arg in=0,out=0;\n var sig=In.ar(in,2);\n sig=Compander.ar(sig,sig,0.8,1/3);\n sig=FreeVerb.ar(sig,mix:0.4);\nOut.ar(out,sig);\n};\n).add;\n);\n\nSynth(\\rev,[\\in:~bus]);\n\nfork{\nx=Synth(\\playbuff,[\\out:~bus]);\n75.wait;\nx.set(\\t_trig,1);\n};\n\ns.quit;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n/// Installing sc3-plugins quarks\n\n// If you installed the sc3-plugins to a user location:\n~sc3plugs = Quarks(\nreposPath: \"https://sc3-plugins.svn.sourceforge.net/svnroot/sc3-plugins/build\",\nlocalPath: Platform.userAppSupportDir +/+ \"SC3plugins\"\n);\n\n// If the sc3-plugins were installed to a system wide location:\n~sc3plugs = Quarks(\nreposPath: \"https://sc3-plugins.svn.sourceforge.net/svnroot/sc3-plugins/build\",\nlocalPath: Platform.systemAppSupportDir +/+ \"SC3plugins\"\n);\n\n\n// Get a GUI of the available Quarks and install the ones you want to try out:\n~sc3plugs.gui;\n\n\n// For more general Help on Quarks, see the Quarks helpfile\n```"}, {"role": "assistant", "content": "Installing sc3-plugins quarks If you installed the sc3-plugins to a user location:."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DecodeB2`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var w, x, y, p, a, b, c, d;\n\n p = PinkNoise.ar; // source\n\n // B-format encode\n #w, x, y = PanB2.ar(p, MouseX.kr(-1, 1), 0.1);\n\n // B-format decode to quad\n #a, b, c, d = DecodeB2.ar(4, w, x, y);\n\n [a, b, d, c] // reorder to my speaker arrangement: Lf Rf Lr Rr\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `Synth` in SuperCollider briefly."}, {"role": "assistant", "content": "Synth — Client-side representation of a synth node on the server A Synth is the client-side representation of a synth node on the server. A Synth represents a single sound producing unit. What it does is defined in a SynthDef, which specifies what UGens are used and how they are patched together. It also specifies what inputs and outputs the Synth will have. A SynthDef is thus a kind of fixed pattern, upon which Synths are be based. (Despite this, a given Synth Category: Server > Nodes, Server > Abstractions."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a;\na = Pgeom(1.0, 1.1, inf);\na.asStream.nextN(100).plot;\n);\n\n\n// sound example\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05, amp = 0.1|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2, amp), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n(\nvar a;\na = Pgeom(300, 1.03, 70).asStream;\n{\n a.do { |val|\n Synth(\\help_sinegrain, [\\freq,\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a;\na = Pgeom(1.0, 1.1, inf);\na.asStream.nextN(100).plot;\n);\n\n\n// sound example\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05, amp = 0.1|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2, amp), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n(\nvar a;\na = Pgeom(300, 1.03, 70).asStream;\n{\n a.do { |val|\n Synth(\\help_sinegrain, [\\freq, val]);\n 0.02.wait;\n }\n}.fork;\n);\n\n(\nPbind(\n \\dur, 0.01,\n \\instrument, \\help_sinegrain,\n \\freq, Pgeom(800, Pbrown(0.99, 1.01, 0.01, inf), inf)\n).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `String.find` do?"}, {"role": "assistant", "content": "Returns the index of the string in the receiver, or nil if not found. If ignoreCase is true, find makes no difference between uppercase and lowercase letters. The offset is the point in the string where the search begins. string may be a String or a Char. `\"These are several"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n~a={SinOsc.ar([22.5, 23], mul: ChaosGen.allSubclasses.choose.ar(rrand(1, 30))* 0.3)};\n~b={SinOsc.ar([22.5, 23], mul: 0.3)};\n~c={SinOsc.ar([22.5, 23]*400, mul: ChaosGen.allSubclasses.choose.ar(rrand(1, 30))* 0.03)};\n~d={SinOsc.ar([22.5, 23]*400, mul: 0.03)};\nOut.ar(0, ~a+~b+~c+~d);\n}.scope\n)\n```"}, {"role": "assistant", "content": "some basic synth shamanic stuff for rising vibrational frequency (a SuperCollider snippet)."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nMIDIIn.connectAll;\n// MIDIClient.init;\n\n\n(\n// A SynthDef with ADSR envelope\nSynthDef(\"quick2\", {arg freq = 440, amp = 0.1, gate = 1;\n var snd, env;\n env = Env.adsr(0.01, 0.1, 0.3, 2, amp).kr(2, gate);\n snd = Saw.ar(freq: [freq, freq*1.5], mul: env);\n Out.ar(0, snd)\n}).add;\n);\n\n// Play it with a MIDI keyboard\n(\nvar noteArray = Array.newClear(128); // array has one slot per possible MIDI note\n\nMIDIdef.noteOn(\\myKeyDown, {arg vel, note;\n noteArray[note] = Synth(\"quick2\", [\\freq, note.midicps, \\amp, vel.linlin(0, 127, 0, 1)]);\n [\"NOTE ON\", note].postln;\n});\n\nMIDIdef.noteOff(\\myKeyUp, {arg vel, note;\n noteArray[note].set(\\gate, 0);\n [\"NOTE OFF\", note].postln;\n});\n)\n// PS. Make sure SC MIDI connections are made (MIDIIn.connectAll)\n```"}, {"role": "assistant", "content": "Basic example - how to use a MIDI keyboard with a simple synth."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Seekers are something you should avoid. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var time = 0.23;\n var freq = (55).midicps;\n var a = VarSaw.ar(freq/2, width: XLine.ar(0.5,1,time)).range(0,XLine.ar(0.666,1/666,time));\n var tone = SinOsc.ar(freq).fold(-0.23*a,a) * EnvGen.ar(Env([1,0],[time]));\n Out.ar(0, tone.dup);\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `ToggleButton.init` do? What arguments does it take?"}, {"role": "assistant", "content": "simple two state button Arguments: layout; init; title; minWidth; minHeight; onc; offc."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nNdef(\\bitshift, {\n var t = PulseCount.ar(Impulse.ar(8e3));\n var sig = HPF.ar(\n ( \n ((t * 15) & (t >> 5)) |\n ((t * 5) & (t >> [3, 4])) |\n ((t * 2) & (t >> 9)) |\n ((t * 8) & (t >> 11))\n - 3 % 256\n ) / 127-1 * 3\n , 20\n ).distort * 0.2; \n sig = Greyhole.ar(sig, sig, 0.5, sig).flop.mean/4;\n}).play;\n)\n```"}, {"role": "assistant", "content": "Not very original since I copied the bit code from http://schemawound.com/post/58980873930/bitwise and added a greyhole. But it sound so amazing I want to share it =)."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var trig = Dust.kr(10);\n SinOsc.ar(\n TRand.kr(300, 3000, trig)\n ) * 0.1\n}.play;\n);\n\n(\n{\n var trig = Dust.ar(MouseX.kr(1, 8000, 1));\n SinOsc.ar(\n TRand.ar(300, 3000, trig)\n ) * 0.1\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var trig = Dust.kr(10);\n SinOsc.ar(\n TRand.kr(300, 3000, trig)\n ) * 0.1\n}.play;\n);\n\n(\n{\n var trig = Dust.ar(MouseX.kr(1, 8000, 1));\n SinOsc.ar(\n TRand.ar(300, 3000, trig)\n ) * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SequenceableCollection.separate` do?"}, {"role": "assistant", "content": "Separates the collection into sub-collections by calling the function for each adjacent pair of elements. If the function returns true, then a separation is made between the elements. `[1, 2, 3, 5, 6, 8, 10].separate({ |a, b| (b - a) > 1"}]} +{"conversations": [{"role": "user", "content": "Explain `NumAudioBuses` in SuperCollider briefly."}, {"role": "assistant", "content": "NumAudioBuses — Number of audio busses. Category: UGens > Info."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// if \\degree, \\note or \\midinote are occuring after \\dur,\n// a frequency value will be calculated according to Event's usual conversion framework\n// and used for setting the arg 'freq'.\n\n(\np = PmonoPar([\n [\n \\dur, 1.0,\n \\pan, Pser([-0.9, 0, 0.9], 8) \n ],[\n \\dur, 0.4,\n \\midinote, Pseq((70..75), 7)\n ],[\n \\dur, 0.2,\n \\amp, Pseq([0.05, 0.3], 30) \n ]\n]).trace.play;\n)\n```"}, {"role": "assistant", "content": "if \\degree, \\note or \\midinote are occuring after \\dur, a frequency value will be calculated according to Event's usual conversion framework (PmonoPar: monophonic event pattern for an arbitrary number of timed setting streams)"}]} +{"conversations": [{"role": "user", "content": "What does `MultiSliderView.valueThumbSize` do? What arguments does it take?"}, {"role": "assistant", "content": "The size of the slider handles in the direction of value in pixels (if Arguments: An Integer.."}]} {"conversations": [{"role": "user", "content": "What does `EnvelopeView.index` do? What arguments does it take?"}, {"role": "assistant", "content": "The index of the current node, i.e. the node affected by #-x and #-y methods. This is the selected node with lowest index, or -1 if no Arguments: An Integer.."}]} -{"conversations": [{"role": "user", "content": "What does `SystemClock.clear` do?"}, {"role": "assistant", "content": "Clear the SystemClock's scheduler to stop it."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// These examples compare the variants, so that you can hear the difference in interpolation\n\n// Comb used as a resonator. The resonant fundamental is equal to\n// reciprocal of the delay time.\n{ CombN.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ CombL.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ CombC.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// with negative feedback:\n{ CombN.ar(WhiteNoise.ar(0.01), 0\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// These examples compare the variants, so that you can hear the difference in interpolation\n\n// Comb used as a resonator. The resonant fundamental is equal to\n// reciprocal of the delay time.\n{ CombN.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ CombL.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ CombC.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// with negative feedback:\n{ CombN.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ CombL.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ CombC.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n// used as an echo.\n{ CombL.ar(Decay.ar(Dust.ar(1, 0.5), 0.2, WhiteNoise.ar), 0.2, 0.2, 3) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// try wiggling mouse quickly;\n// LFNoise frequently seems stuck, LFDNoise changes smoothly.\n\n{ SinOsc.ar(LFNoise1.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n{ SinOsc.ar(LFDNoise1.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFNoise1.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n\n{ LFDNoise1.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n```"}, {"role": "assistant", "content": "try wiggling mouse quickly; LFNoise frequently seems stuck, LFDNoise changes smoothly. (LFDNoise1: Dynamic ramp noise)"}]} -{"conversations": [{"role": "user", "content": "What does `SimpleNumber.airyBi` do?"}, {"role": "assistant", "content": "Returns the result of the Airy function Bi at"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n//Version 1\n//P(eace)Bind\n//If error messages could experience Nirvanna, it would sound like this.\n(\n{\nSaw.ar(\n freq: SinOsc.kr([60, 63, 67, 70]).range(440,880),\n mul:LFNoise0.kr(freq: [0.25,1]).range(0,1),\n )\n}.play\n\n);\n\n\n//Version 2\n//SuperCollider\n//Sometimes in life, you feel like you need to collide with things.\n(\n{\nPulse.ar(\n freq: SinOsc.kr([60, 63, 67, 70]).range(30,70),\n mul: LFPulse.kr(freq: [0.25,1]).range(0,1)\n )\n}.play\n\n)\n```"}, {"role": "assistant", "content": "Quiz 4a for MUSC 115, pp. 62-84 from Gentle Intro to SuperCollider."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ DPW4Saw.ar(XLine.kr(2000, 20, 10)) }.play; \n\n{ DPW4Saw.ar(MouseX.kr(20,12000,'exponential'))*0.5 }.play;\n\n{Saw.ar(MouseX.kr(20,12000,'exponential'))}.play\n\n\n//DPW4Saw less efficient than the already band limited Saw UGen\n{ Mix(DPW4Saw.ar(Array.rand(100,50,5000))*0.01) }.play;\n\n{ Mix(Saw.ar(Array.rand(100,50,5000))*0.01 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ DPW4Saw.ar(XLine.kr(2000, 20, 10)) }.play; \n\n{ DPW4Saw.ar(MouseX.kr(20,12000,'exponential'))*0.5 }.play;\n\n{Saw.ar(MouseX.kr(20,12000,'exponential'))}.play\n\n\n//DPW4Saw less efficient than the already band limited Saw UGen\n{ Mix(DPW4Saw.ar(Array.rand(100,50,5000))*0.01) }.play;\n\n{ Mix(Saw.ar(Array.rand(100,50,5000))*0.01) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n//Its not the spline that loops (that would be a loop in 2 dimensional space) but the SplineGen that is set to loop.\n\n// the spline does NOT loop,\nb = BSpline( Array.fill(16,{ arg i; [ i * 0.25,1.0.rand ] }), 3.0,false );\n\nb.gui(nil,1200@300);\n\n\n);\n(\n// the SplineGen loops\n{\n Saw.ar(SplineGen(b,loop:true).kr.linexp(0.0,1.0,40,500).clip(40,500)).dup * 0.4\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n//Its not the spline that loops (that would be a loop in 2 dimensional space) but the SplineGen that is set to loop.\n\n// the spline does NOT loop,\nb = BSpline( Array.fill(16,{ arg i; [ i * 0.25,1.0.rand ] }), 3.0,false );\n\nb.gui(nil,1200@300);\n\n\n);\n(\n// the SplineGen loops\n{\n Saw.ar(SplineGen(b,loop:true).kr.linexp(0.0,1.0,40,500).clip(40,500)).dup * 0.4\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Image.openSVG` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new Image instance from the local SVG file at path. Arguments: path — A String containing the SVG file's path.; size — A Size. SVG contents will be drawn into an image of this size. If not provided, suggested size provided by SVG will be used.."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ExpRand`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-ExpRand\", { |out = 0|\n Out.ar(out,\n FSinOsc.ar(\n ExpRand(100.0, 8000.0),\n 0, Line.kr(0.2, 0, 0.01, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n(\nRoutine({\n inf.do({ |i|\n Synth.new(\"help-ExpRand\"); 0.05.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Add two NodeProxies\nNdef(\\x, { SinOsc.ar(440, 0, 0.2) });\nNdef(\\y, { PinkNoise.ar(0.1) });\nNdef(\\z, Ndef(\\x) + Ndef(\\y).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Add two NodeProxies\nNdef(\\x, { SinOsc.ar(440, 0, 0.2) });\nNdef(\\y, { PinkNoise.ar(0.1) });\nNdef(\\z, Ndef(\\x) + Ndef(\\y)).play;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `LFNoise0` in SuperCollider?"}, {"role": "assistant", "content": "LFNoise0 — Step noise Generates random values at a rate given by the nearest integer division of the sample rate by the `freq` argument. Category: UGens > Generators > Stochastic."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Gbman2DL.ar(MouseX.kr(20, SampleRate.ir*0.25), MouseX.kr(80, SampleRate.ir), 0.1) }.play(s);\n\n{ Gbman2DL.ar(11025, 22050, -0.7, -2.7, 0.1) }.play(s);\n\n{ Gbman2DL.ar(2200, 8800, 1.2, 2.0002, 0.1) }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Gbman2DL.ar(MouseX.kr(20, SampleRate.ir*0.25), MouseX.kr(80, SampleRate.ir), 0.1) }.play(s);\n\n{ Gbman2DL.ar(11025, 22050, -0.7, -2.7, 0.1) }.play(s);\n\n{ Gbman2DL.ar(2200, 8800, 1.2, 2.0002, 0.1) }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `LADSPA.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Run any LADSPA plugin inside SuperCollider Arguments: nChans — the number of output audio channels; id — the UniqueID for the LADSPA ugen that should be used; ... args — all the inputs in the same order as shown in `listPlugins`."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Resonz` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// 1st, evaluate a synthdef\n(\nSynthDef(\"pitchFromNoise\", { arg out = 0;\n Out.ar(\n out,\n Resonz.ar(\n WhiteNoise.ar(15),\n LFNoise0.kr(2, 110, 660),\n 0.005\n )\n )\n}).add;\n);\n\n// 2nd, make 2 synths\n(\nSynth(\"ringModulation\");\nSynth(\"pitchFromNoise\", [\\out, 1]);\n);\n\n// 3rd, tell the server to list its nodes\n(\ns.queryAllNodes;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a closed hi-hat in SuperCollider."}, {"role": "assistant", "content": "High-passed noise with a very short envelope — the filter is what makes it a hat rather than a hiss.\n\n```supercollider\n(\nSynthDef(\\hat, { |out = 0, amp = 0.3, dur = 0.06|\n var env = EnvGen.kr(Env.perc(0.001, dur, 1, -6), doneAction: 2);\n Out.ar(out, Pan2.ar(HPF.ar(WhiteNoise.ar, 7000) * env * amp));\n}).add;\n);\nSynth(\\hat, [\\dur, 0.04]);\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n//var board= CytonSerial(\"/dev/tty.usbserial-DM00DRM0\", initAction: {|b| b.start});\nvar board= PlaybackData(\"~/Desktop/OpenBCI-RAW-2019-04-10_19-04-26.txt\", initAction: {|b| b.start});\n~board= board;\n);\n\n~board.currentTime; //time in file\n\n~board.accelAction= {|xyz| xyz.postln}; //start posting recorded accelerometer data\n\n~board.stop;\n~board.start;\n~board.close;\n```"}, {"role": "assistant", "content": "var board= CytonSerial(\"/dev/tty.usbserial-DM00DRM0\", initAction: {|b| b.start}); (PlaybackData: for playing back data from a file)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Pset overrides incoming values:\n\n(\nvar a, b;\na = Pset(\\freq, 801, Pbind(\\freq, 108));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n);\n\n\n(\nvar a, b;\na = Pset(\\freq, Pseq([401, 801], 2), Pbind(\\dur, 0.5));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n);\n\n\n// sound example\n\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.00\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Pset overrides incoming values:\n\n(\nvar a, b;\na = Pset(\\freq, 801, Pbind(\\freq, 108));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n);\n\n\n(\nvar a, b;\na = Pset(\\freq, Pseq([401, 801], 2), Pbind(\\dur, 0.5));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n);\n\n\n// sound example\n\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain);\na = Pset(\\freq, Pseq([500, 600, 700], inf), a);\na = Pset(\\legato, Pseq([0.01, 1], inf), a);\na.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n\n ~needed_interval = 20;\n\n ~funk = {\n\n // if last time isn't defined, create it with 1000 seconds ago time\n if( ~last_time.isNil ) {\n ~last_time = Date.getDate.bootSeconds;\n ~last_time = ~last_time - 1000;\n };\n\n // if needed interval has passed, execute the funkie\n if( ( Date.getDate.bootSeconds - ~last_time ) > ~needed_interval ) {\n\n // safe last execution time, so next calls will have to wait the needed interval\n ~last_time = Date.getDate.bootSeconds;\n\n ( \"SOMETHING HAPPENS HERE AT MAXIMUN RATE OF 1 TIME EACH\" + ~needed_interval + \" SECONDS \" );\n\n } {\n ( \"YOU STILL HAVE TO WAIT\" );\n }\n };\n);\n\n~funk.value()\n```"}, {"role": "assistant", "content": "A friend of mine asked me how to limit a function to happen at maximun rate of 1 time every N seconds.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a, b;\na = Pseq([1, 2, 3], 2);\nb = Pseq([65, 76]);\nc = Pswitch([a, b, 800], Pseq([2, 2, 0, 1], inf));\nx = c.asStream;\n24.do({ x.next.postln });\n);\n\n\n// Pswitch used as a sequence of pitches:\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a, b;\na = Pseq([1, 2, 3], 2);\nb = Pseq([65, 76]);\nc = Pswitch([a, b, 800], Pseq([2, 2, 0, 1], inf));\nx = c.asStream;\n24.do({ x.next.postln });\n);\n\n\n// Pswitch used as a sequence of pitches:\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Pseq([73, 71, 69], 2);\nb = Pseq([0, 0, 0, 4, 0]+64);\nc = Pswitch([a, b, 75], Pseq([2, 2, 0, 1], inf));\nx = c.asStream;\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, x.next.midicps]);\n 0.18.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `LFPulse` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\ns.meter;\ns.scope;\n\n// synthesize 2 test signals at level 0.1 (-20 dB), first on separate channels\n(\n{ var n = 2, level = 0.1, spread = 1, pan = 0;\n LFPulse.ar({ 100.exprand(2000) } ! n).range(-1, 1) * level\n}.play;\n);\n\n// now mix/pan these 2 signals using Splay, level at 0.1 (-20dB)\n(\nx = { |spread = 1, level = 0.1, center = 0|\n var n = 2;\n var snd = LFPulse.ar({ 100.exprand(2000) } ! n).range(-1, 1);\n var stereo = Splay.ar(snd, spread, level, center);\n Peak.ar(stereo, Impulse.kr(2)).ampdb.poll(2);\n stereo\n}.play;\n);\n\n// when we set full spread, panned to center:\n// the 2 signals are discrete, left and right\n// we see the energy-based levelComp applied (1/2.sqrt).ampdb = -3\nx.set(\\spread, 1, \\center, 0); // -20 - 3 = -23dB\n\n// no spread, panned center:\n// each signal decreases by 3dB as they move to the center (from the panning function)\n// and the two signals mix on each channel, so we get -20 dB\nx.set(\\spread, 0, \\center, 0); // -20dB\n\n// no spread, panned fully right:\n// the signals fully mix in the right channel (+6 dB)\nx.set(\\spread, 0, \\center, 1); // -23 + 6 = -17db\n```"}]} +{"conversations": [{"role": "user", "content": "What is `VarGui`?"}, {"role": "assistant", "content": "VarGui — slider / player gui to set envir variables and synth controllers and play synths, event patterns and tasks"}, {"role": "user", "content": "What does `VarGui.new` do?"}, {"role": "assistant", "content": "Create a new VarGui object, which holds control specifications."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\np = Pbind(\\midinote, Pfunc { ~midi } + Pseq([0, 3, 5, 7], inf), \\dur, 0.2)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SimpleNumber.sphNeumann` do?"}, {"role": "assistant", "content": "Returns the result of the spherical Bessel functions of the first kind. Requires `x` >"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n\n~remapConfig = IdentityDictionary[\n 0 -> 1,\n 1 -> 2,\n 2 -> 3,\n 3 -> 4,\n 4 -> 5,\n 5 -> 6,\n 6 -> 7,\n 7 -> 8,\n 8 -> 9,\n 9 -> 12,\n 10 -> 13,\n 11 -> 14,\n 12 -> 15,\n 13 -> 16,\n 14 -> 17\n];\n\n\n~generateRemapSynthDef = { |numInputChannels, numOutputChannels|\n SynthDef(\\remapOutputs, {\n var sig = In.ar(0, numInputChannels); \n var remapped = Array.fill(numOutputChannels, { Silent.ar(1) }); \n\n ~remapConfig.keysValuesDo { |src, dest|\n if (src < numInputChannels and: { dest < numOutputChannels }) {\n remapped[dest] = sig[src];\n }\n };\n\n ReplaceOut.ar(0, remapped);\n }).add;\n};\n\n~generateRemapSynthDef.(16, 18); \n);\n\n(\n~createRemapSynth = {\n ~remapSynth = Synth(\\remapOutputs, target: s.defaultGroup, addAction: \\addAfter);\n};\n\nServerTree.add( ~createRemapSynth);\n\n)\n```"}, {"role": "assistant", "content": "This code sets up a remapping system where input channels are mapped to output channels based on a predefined configuration. The remapping is done using a SynthDef that reads input signals, applies the remapping, and outputs the remapped signals. The ServerTree.add ensures that the remap synth is created and added to the server's node tree upon server startup and cmd-. and ctrl-.\r\n\r\nBased on discu."}]} +{"conversations": [{"role": "user", "content": "What is `CompositeInstr` in SuperCollider?"}, {"role": "assistant", "content": "CompositeInstr — two Instr combined together with function composition Two Instr chained one into the next. Category: Libraries > crucial > Instr."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// logistic map\n// equation: x1 = -r*x0^2 + r*x0\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n QuadC.ar(SampleRate.ir/4, r.neg, r, 0, 0.1) * 0.4;\n}.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// logistic map\n// equation: x1 = -r*x0^2 + r*x0\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n QuadC.ar(SampleRate.ir/4, r.neg, r, 0, 0.1) * 0.4;\n}.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n//listen to x and y output with defaults\n{Out.ar(0,0.5*SpruceBudworm.ar(0.0))}.play\n\n\n//be careful with rate range, can blow-up easily here, or just not sound\n{Out.ar(0,0.5*SpruceBudworm.ar(0.0,MouseX.kr(0.09,0.1)))}.play\n\n\n{Out.ar(0,0.5*SpruceBudworm.ar(0.0,,MouseX.kr(0.09,0.1),MouseY.kr(25.0,28.0)))}.play\n\n\n{Out.ar(0,0.5*SpruceBudworm.ar(Impulse.kr(MouseY.kr(1,50,'exponential')),0.1))}\n// …\n```"}, {"role": "assistant", "content": "listen to x and y output with defaults be careful with rate range, can blow-up easily here, or just not sound (SpruceBudworm: Spruce bud worm model equations)"}]} +{"conversations": [{"role": "user", "content": "What is `Pluck` in SuperCollider?"}, {"role": "assistant", "content": "Pluck — A Karplus-Strong UGen Category: UGens > Delays."}]} +{"conversations": [{"role": "user", "content": "What does Splay.ar do?"}, {"role": "assistant", "content": "`Splay.ar(inArray, spread, level, center, levelComp)` takes an array of mono signals and distributes them across the stereo field, so `Splay.ar(SinOsc.ar([220, 330, 440]) * 0.1)` is a three-source stereo chord rather than three separate synths. spread (0..1) controls how far the voices fan out and center shifts the middle. It is the shorthand for 'make this array stereo'."}]} {"conversations": [{"role": "user", "content": "Saving \"Presets\"?"}, {"role": "assistant", "content": "SuperCollider forum — Saving \"Presets\"?\n\nIf you don’t care too much about it being human readable, just use writeArchive and readArchive:\n\n```supercollider\na = Array.fill(400, {rrand(0,2200)});\n\na.writeArchive(\"/Users/spluta1/Documents/SC/test\");\n\nb = Object.readArchive(\"/Users/spluta1/Documents/SC/test\");\n\nb.postln;\n```\n\nSam"}]} -{"conversations": [{"role": "user", "content": "What is `BBCPPermute` in SuperCollider?"}, {"role": "assistant", "content": "BBCPPermute — Automatic breakbeat cutting algorithm A relatively straight forward cut procedure supporting arbitrary user defined permutation of equally divided chunks of the target. Category: Libraries > BBCut > Cut procedures."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Lorenz2DC.ar(8800, 16000) }.play(s);\n\n// randomly modulate params\n(\n{ Lorenz2DC.ar(\n 110, 22050,\n LFNoise2.kr(1, 2, 10),\n 20,\n LFNoise2.kr(1, 1.5, 2),\n 0.01\n) * 0.2 }.play(s);\n)\n\n// as a frequency control\n{ SinOsc.ar(Lorenz2DC.kr(40, 80, h:0.01)*800+900)*0.4 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Lorenz2DC.ar(8800, 16000) }.play(s);\n\n// randomly modulate params\n(\n{ Lorenz2DC.ar(\n 110, 22050,\n LFNoise2.kr(1, 2, 10),\n 20,\n LFNoise2.kr(1, 1.5, 2),\n 0.01\n) * 0.2 }.play(s);\n)\n\n// as a frequency control\n{ SinOsc.ar(Lorenz2DC.kr(40, 80, h:0.01)*800+900)*0.4 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = { SinOsc.ar(\\freq.kr(440, 1.2)) }.play;\na.set(\\freq, 330);\na.release;\na = { SinOsc.ar(\\freq.kr([440, 460], 1.2)) }.play;\na.setn(\\freq, [330, 367];\na.release;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = { SinOsc.ar(\\freq.kr(440, 1.2)) }.play;\na.set(\\freq, 330);\na.release;\na = { SinOsc.ar(\\freq.kr([440, 460], 1.2)) }.play;\na.setn(\\freq, [330, 367]);\na.release;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n//Define bow synthdef\n(\nSynthDef(\\help_dwgbowed, { |out=0, freq=440, amp=0.5,force=1, gate=1,pos=0.07,c1=0.25,c3=31,pan=0|\n var vib = Gendy1.kr(1,1,1,1,0.1, 4,mul:0.003,add:1);\n var son = DWGBowedSimple.ar(freq*vib, amp,force, gate,pos,0.1,c1,c3);\n son = DWGSoundBoard.ar(son);\n son = BPF.ar(son,118,1)+son;\n son = BPF.ar(son,430,1)+son;\n son = BPF.ar(son,\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n//Define bow synthdef\n(\nSynthDef(\\help_dwgbowed, { |out=0, freq=440, amp=0.5,force=1, gate=1,pos=0.07,c1=0.25,c3=31,pan=0|\n var vib = Gendy1.kr(1,1,1,1,0.1, 4,mul:0.003,add:1);\n var son = DWGBowedSimple.ar(freq*vib, amp,force, gate,pos,0.1,c1,c3);\n son = DWGSoundBoard.ar(son);\n son = BPF.ar(son,118,1)+son;\n son = BPF.ar(son,430,1)+son;\n son = BPF.ar(son,490,1)+son;\n son = LPF.ar(son,6000);\n Out.ar(out, Pan2.ar(son * 0.1, pan));\n}).add;\n);\n\n//Use it.\n(\n\nPbind(\n \\instrument, \\help_dwgbowed,\n \\dur , 0.25,\n \\degree, Pseq([1,5,7+3], inf),\n \\amp , Pseq([0.9,0.7,0.5],inf),\n).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// use NamedControl to create a number of multichannel controls:\n\na = { SinOsc.ar(NamedControl.kr(\\freq, [300, 330, 370], [1, 0.3, 0.02])).sum * 0.1 }.play;\na.setn(\\freq, [700, 705, 890]);\na.setn(\\freq, [0, 2, 5].midiratio * 400);\n\n// synonymous:\na = { SinOsc.ar(\\freq.kr([300, 330, 370], [1, 0.3, 0.02]).sum * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// use NamedControl to create a number of multichannel controls:\n\na = { SinOsc.ar(NamedControl.kr(\\freq, [300, 330, 370], [1, 0.3, 0.02])).sum * 0.1 }.play;\na.setn(\\freq, [700, 705, 890]);\na.setn(\\freq, [0, 2, 5].midiratio * 400);\n\n// synonymous:\na = { SinOsc.ar(\\freq.kr([300, 330, 370], [1, 0.3, 0.02])).sum * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ SinOsc.ar(MouseX.kr(40, 10000, 1), 0, 0.1) }.play;\n{ SinOsc.ar(MouseX.kr(500, 10000, 1).poll, 0, 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ SinOsc.ar(MouseX.kr(40, 10000, 1), 0, 0.1) }.play;\n{ SinOsc.ar(MouseX.kr(500, 10000, 1).poll, 0, 0.1) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Saving \"Presets\"?"}, {"role": "assistant", "content": "SuperCollider forum — Saving \"Presets\"?\n\nIf you don’t care too much about it being human readable, just use writeArchive and readArchive:\n\n```supercollider\na = Array.fill(400, {rrand(0,2200)});\n\na.writeArchive(\"/Users/spluta1/Documents/SC/test\");\n\nb = Object.readArchive(\"/Users/spluta1/Documents/SC/test\");\n\nb.postln;\n```\n\nSam"}]} +{"conversations": [{"role": "user", "content": "Explain `TdefGui` in SuperCollider briefly."}, {"role": "assistant", "content": "TdefGui — a line of editing controls for a Tdef, and optionally its envir A gui showing the Tdef's name, playing state, source state, and envir state. Optionally, its envir can also be edited. Category: JITLib > GUI, Live Coding."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `LFPulse` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\ns.meter;\ns.scope;\n\n// synthesize 2 test signals at level 0.1 (-20 dB), first on separate channels\n(\n{ var n = 2, level = 0.1, spread = 1, pan = 0;\n LFPulse.ar({ 100.exprand(2000) } ! n).range(-1, 1) * level\n}.play;\n);\n\n// now mix/pan these 2 signals using Splay, level at 0.1 (-20dB)\n(\nx = { |spread = 1, level = 0.1, center = 0|\n var n = 2;\n var snd = LFPulse.ar({ 100.exprand(2000) } ! n).range(-1, 1);\n var stereo = Splay.ar(snd, spread, level, center);\n Peak.ar(stereo, Impulse.kr(2)).ampdb.poll(2);\n stereo\n}.play;\n);\n\n// when we set full spread, panned to center:\n// the 2 signals are discrete, left and right\n// we see the energy-based levelComp applied (1/2.sqrt).ampdb = -3\nx.set(\\spread, 1, \\center, 0); // -20 - 3 = -23dB\n\n// no spread, panned center:\n// each signal decreases by 3dB as they move to the center (from the panning function)\n// and the two signals mix on each channel, so we get -20 dB\nx.set(\\spread, 0, \\center, 0); // -20dB\n\n// no spread, panned fully right:\n// the signals fully mix in the right channel (+6 dB)\nx.set(\\spread, 0, \\center, 1); // -23 + 6 = -17db\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `PulseDivider` in SuperCollider briefly."}, {"role": "assistant", "content": "PulseDivider — Pulse divider. Outputs one impulse each time it receives a certain number of triggers at its input. Category: UGens > Triggers."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Impulse.ar(800, 0.0, 0.5, 0) }.play\n\n{ Impulse.ar(XLine.kr(800, 100, 5), 0.0, 0.5, 0 }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Impulse.ar(800, 0.0, 0.5, 0) }.play\n\n{ Impulse.ar(XLine.kr(800, 100, 5), 0.0, 0.5, 0) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "What does `TraerSpring.getOneEnd` do?"}, {"role": "assistant", "content": "Return the particles that are on either end of this Returns: a LINKClasses/TraerParticle"}]} +{"conversations": [{"role": "user", "content": "Why does every UGen have mul and add arguments?"}, {"role": "assistant", "content": "They are a convenience applied to the UGen's output: the result is `ugens_result * mul + add`. So `SinOsc.ar(440, 0, 0.2)` is the same as `SinOsc.ar(440) * 0.2`, and `SinOsc.ar(440, 0, 0.5, 1800)` is usable directly as a frequency. They exist because multiplying and offsetting is so common that folding it into the UGen saves a node in the graph and a line in the source."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `List`."}, {"role": "assistant", "content": "```supercollider\n// Create a new empty collections with size 3:\nx = Array.new(3);\ny = Array.new(3);\nz = List.new(3);\n\n// Try to add 7 items to the array and list.\n// If the array exceeds maxSize, it will only\n// grow to an internally specified max size.\n(\n7.do { |i|\n x.add(i);\n y = y.add(i); // reassign array y on each add\n z.add(i);\n};\n);\n\n// Attempt to access the 5th item:\nx.at(4); // -> nil (out of bounds)\ny.at(4); // -> 4\nz.at(4); // -> 4\n\n// x grew only to size 4\nx.postln; // -> [ 0, 1, 2, 3 ]\ny.postln; // -> [ 0, 1, 2, 3, 4, 5, 6 ]\nz.postln; // -> List[ 0, 1, 2, 3, 4, 5, 6 ]\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// example\n(\n{\n var trig = Impulse.kr(MouseX.kr(1, 100, 1));\n Ringz.ar(T2A.ar(trig), 800, 0.01) * 0.4\n}.play;\n);\n\n// compare with K2A\n(\n{\n var trig = Impulse.kr(200);\n [T2A.ar(trig), K2A.ar(trig)].lag(0.001)\n}.plot(10/200);\n);\n\n// removing jitter by randomising offset\n(\n{\n var trig = Impulse.kr(MouseX.kr(1, 100, 1));\n Ringz.ar(T2A.ar(trig, WhiteNoise.kr.range(0, s.options.blockSize - 1)), 800, 0.01)\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// example\n(\n{\n var trig = Impulse.kr(MouseX.kr(1, 100, 1));\n Ringz.ar(T2A.ar(trig), 800, 0.01) * 0.4\n}.play;\n);\n\n// compare with K2A\n(\n{\n var trig = Impulse.kr(200);\n [T2A.ar(trig), K2A.ar(trig)].lag(0.001)\n}.plot(10/200);\n);\n\n// removing jitter by randomising offset\n(\n{\n var trig = Impulse.kr(MouseX.kr(1, 100, 1));\n Ringz.ar(T2A.ar(trig, WhiteNoise.kr.range(0, s.options.blockSize - 1)), 800, 0.01) * 0.4\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\nx = SynthDef(\"help-node-set\", { |freq = #[440, 450, 460], out = 0|\n Out.ar(out, Mix(SinOsc.ar(freq, 0, 0.1)))\n}).play\n);\nx.set(\\freq, [1, 2, 3] * 400 + [1, 2, 3], \\out, 1); // two pairs\nx.set(\\freq, [3] * 400 + [1, 2, 3], \\out, 1); // two pairs\nx.set(0, [660, 680, 720], 1, 0; // freq is the first argument, so it's index is 0. out is index 1.\nx.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\nx = SynthDef(\"help-node-set\", { |freq = #[440, 450, 460], out = 0|\n Out.ar(out, Mix(SinOsc.ar(freq, 0, 0.1)))\n}).play\n);\nx.set(\\freq, [1, 2, 3] * 400 + [1, 2, 3], \\out, 1); // two pairs\nx.set(\\freq, [3] * 400 + [1, 2, 3], \\out, 1); // two pairs\nx.set(0, [660, 680, 720], 1, 0); // freq is the first argument, so it's index is 0. out is index 1.\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SPlayFile.read` do? What arguments does it take?"}, {"role": "assistant", "content": "Can be used to preload Arguments: path — A String pointing to a soundfile.."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `BrownNoise`."}, {"role": "assistant", "content": "```supercollider\n{ SinOsc.ar(BrownNoise.ar(100, 200)) * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `BufCombN` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// These examples compare the variants, so that you can hear the difference in interpolation\n\n// allocate buffer\nb = Buffer.alloc(s, 44100, 1);\n\n// Comb used as a resonator. The resonant fundamental is equal to\n// reciprocal of the delay time.\n{ BufCombN.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ BufCombL.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ BufCombC.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// with negative feedback:\n{ BufCombN.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ BufCombL.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ BufCombC.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n// used as an echo.\n{ BufCombC.ar(b.bufnum, Decay.ar(Dust.ar(1, 0.5), 0.2, WhiteNoise.ar), 0.2, 3) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `MultiProc.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Allows selection between multiple breakbeat cutting algorithms Arguments: procs — An array of cut procedure objects.; phrasefunc — a function that returns a valid index into the procs array.; blockfunc — a function that returns a valid index into the procs array. phrasefunc and blockfunc may be set to nil if unneeded. The default behaviour with all nil is a phrasefunc that randomly selects any index up to procs.size.."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Symbol`."}, {"role": "assistant", "content": "```supercollider\na = { Ringz.ar(T2A.ar(\\trig.tr), \\freq.kr(500, 1), 0.8) }.play;\na.set(\\freq, 330, \\trig, 1);\na.set(\\freq, 830, \\trig, 1);\na.release;\n```"}]} +{"conversations": [{"role": "user", "content": "How do I make a delay line?"}, {"role": "assistant", "content": "`CombN.ar(in, maxdelaytime, delaytime, decaytime)` is a feedback delay: maxdelaytime is the buffer size, delaytime the actual delay (and it can modulate), decaytime how long the repeats take to die. For a clean single echo use `DelayN.ar(in, maxdelaytime, delaytime)`, which has no feedback. Both replace the `in` with the delayed signal, so mix with the dry: `dry + CombN.ar(dry, 0.5, 0.3, 2) * 0.4`."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LinSelectX`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar(300),\n Pulse.ar(230)\n ];\n\n LinSelectX.ar(MouseX.kr(0, 1) * a.size, a) * 0.2\n}.play;\n);\n\n(\n{\n var a;\n a = [\n SinOsc.kr(0.25),\n LFSaw.kr(10),\n LFPulse.kr(0.3)\n ];\n\n SinOsc.ar(LinSelectX.kr(MouseX.kr(0, 1) * a.size, a) * 300 + 400) * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `List`?"}, {"role": "assistant", "content": "List — list of items of variable size"}, {"role": "user", "content": "What does `List.new` do?"}, {"role": "assistant", "content": "Creates a List with the initial capacity given by size."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// Create a new empty collections with size 3:\nx = Array.new(3);\ny = Array.new(3);\nz = List.new(3);\n\n// Try to add 7 items to the array and list.\n// If the array exceeds maxSize, it will only\n// grow to an internally specified max size.\n(\n7.do { |i|\n x.add(i);\n y = y.add(i); // reassign array y on each add\n z.add(i);\n};\n);\n\n// Attempt to access the 5th item:\nx.at(4); // -> nil (out of bounds)\ny.at(4); // -> 4\nz.at(4); // -> 4\n\n// x grew only to size 4\nx.postln; // -> [ 0, 1, 2, 3 ]\ny.postln; // -> [ 0, 1, 2, 3, 4, 5, 6 ]\nz.postln; // -> List[ 0, 1, 2, 3, 4, 5, 6 ]\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Saw` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\event_set, { |freq = 440, gate = 1, amp = 0.1, lagTime = 0.1,\n ffreq = 2000, detune = 1.005, out = 0|\n var sig = Saw.ar(Lag.kr(freq, lagTime) * [1, detune]).sum * amp\n * EnvGen.kr(Env.adsr, gate, doneAction: Done.freeSelf);\n Out.ar(out, sig ! 2);\n}).add;\n);\n\na = Synth(\\event_set);\n\n(\np = Pbind(\n \\type, \\set,\n \\id, a,\n \\instrument, \\event_set,\n \\args, #[],\n \\freq, Pexprand(200, 600, inf),\n \\dur, Pwhite(1, 5, inf) * 0.125\n).play;\n);\n\np.stop;\na.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `RedLFSR4BitStream` in SuperCollider?"}, {"role": "assistant", "content": "RedLFSR4BitStream — 4-bit linear feedback shift register 4-bit fibonacci LFSR. see https://en.wikipedia.org/wiki/Linear_feedback_shift_register Category: Red > redUGens."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `In`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-InKr\", { |out = 0, in = 0|\n Out.ar(out,\n SinOsc.ar(In.kr(in, 1), 0, 0.1)\n )\n}).add;\nSynthDef(\"help-lfo\", { |out = 0|\n Out.kr(out, LFNoise1.kr(0.3, 200, 800))\n}).add;\n);\n\n\nb = Bus.control(s, 1);\nb.set(800);\n\nSynth(\"help-InKr\", [\\in, b.index]);\nb.set(400);\nb.set(300);\nSynth(\"help-lfo\", [\\out, b.index]);\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `PatternConductor` in SuperCollider briefly."}, {"role": "assistant", "content": "PatternConductor — Simple interactive control for playing patterns PatternConductor provides a simple interactive control (supporting play, pause, resume, stop) for playing pattern, much like Pattern#-play. However, PatternConductor creates its own clock and directly controls the release of sounding notes as well as their initiation by the pattern. Category: Streams-Patterns-Events > Patterns."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n(\np = Pbind(\n \\midinote, PlaceAll([[60, 61], 70, [80, [81, 81.5], 82]], inf),\n \\dur, 0.2\n);\n\nx = p.play;\n);\n\nx.stop;\n\n\n// to distinguish subarrays from arrays to be taken as output use Refs, \n// as wrapping in another array wouldn't do\n\n(\np = Pbind(\n \\midinote, PlaceAll([[60, 61], 70, [80, `[81, 81.5], 82]], inf),\n \\dur, 0.2\n);\n\nx = p.play;\n) ;\n\n\nx.stop;\n\n\n// Items may also\n// …\n```"}, {"role": "assistant", "content": "to distinguish subarrays from arrays to be taken as output use Refs, as wrapping in another array wouldn't do (PlaceAll: Arbitrarily nested embedding of subarrays)"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n// Simple amplitude tracker sending values to sclang\nSynthDef(\\ampTracker, { |in|\n var freq = 30; // num of values per second\n SendReply.kr(Impulse.kr(freq), '/amp', Amplitude.kr(SoundIn.ar(in)));\n}).add;\n);\n\n// start the tracker on scsynth\nSynth(\\ampTracker);\n\n(\n// receive the values in sclang\nOSCdef(\\ampTracker, { |m|\n m.postln;\n // now use m[3] for your purpose (detecting changes, etc...)\n}, '/amp');\n)\n```"}, {"role": "assistant", "content": "It's jsut an amplitude tracker, to exaplin how to send values from scsynth to sclang."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// ===========================\n// extra demos for pluck\n// ===========================\n\n\n(\n// Made by Meha Gupta\n// Inspired by Happy by Julia Michaels\nPbindef(\\dmpluck,\n \\instrument, \"pluck\",\n \\midinote, Pseq([\n Pseq([\n [57, 69, 73, 76],\n [57, 69, 73, 76],\n [57, 71, 73, 80],\n [52, 78, 76, 80],\n [52, 78, 76, 80],\n [59, 71, 75],\n [59, 71, 75]], 2),\n 64]),\n \\amp, Pseq([0.2, 0.1, 0.2, 0.2, 0.1, 0.1, 0.1], inf) * 0.5,\n \\dur, Pseq([Pn(Pseq([0.25, 0.75, 1, 0.5, 0.5, 0.5, 0.5]), 2), 1]),\n \\decay, Pseq([1, 3, 3, 2, 2, 3, 3, 1, 3, 3, 2, 2, 3, 3, 4]),\n).play;\n)\n```"}, {"role": "assistant", "content": "=========================== extra demos for pluck ===========================."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Basic tone simulator of a stylophone. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n/*\nRetro Stylophone\n\nReverse engineered from: https://www.waitingforfriday.com/?p=334\n\n1. Relaxation oscillator (UJT)\n\n- generated by a combination of two oscillators. The primary oscillator is a\n current controlled PUT (Programmable Uni-Junction Transistor) relaxation oscillator which is\n responsible for generating the overall tone of the instrument.\n A secondary LFO phase-shifted provides the vibrato\n (the relative slow wavering of a sound around the notes centre pitch)\n\n- around 10 VPP\n\n2. LFO phase-shift (vibrato)\n\n- generated by a low-frequency oscillator made with a transistor and several capacitors,\n which produces a triangle/sine wave fed into the frequency control voltage operating the UJT\n\n- frequency of about 8.5Hz, phased shifted of 180 degree, around 4.2 VPP\n*/\n\n(\nSynthDef(\\stylophone, { |freq = 220, vibAmp = 2, toneAmp = 5, atkTime = 0.01, trigger = 0|\n\n var lfo = OnePole.kr(LFPar.kr(8, mul: vibAmp, add: freq), 0.9); // 180 degree inversion\n var relaxOsc = LFPulse.ar(lfo, width: 0.9, mul: toneAmp);\n\n var asr = EnvGen.kr(Env.asr(atkTime * 5, releaseTime: 0.001, curve: \\lin), gate: trigger);\n\n Out.ar(0, relaxOsc * asr)\n}).add\n);\n\nf = Synth(\\stylophone);\n\nf.set(\\freq, 208.2);\nf.set(\\freq, 233.4);\n\nf.set(\\trigger, 1);\nf.set(\\trigger, 0);\nf.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// UnitTestScript(\"Collapse\", thisProcess.nowExecutingPath).runScript;\n\n{\n |test|\n var collapseValues = List();\n var collapse;\n\n collapse = Collapse({ |v| collapseValues.add(v) }, 0.1);\n\n collapseValues.clear;\n\n collapse.value(1);\n test.assert(collapseValues.isEmpty, \"Collapse doesn't exec immediately\");\n\n 1.wait;\n test.assertEquals(collapseValues.array, [1], \"Collapse execs eventually\");\n\n collapseValues.clear;\n [1, 2, 3, 4, \"last\"].do { |i| collapse.(i); 0.05.wait };\n 1.wait;\n test.assertEquals(collapseValues.array, [\"last\"], \"Collapse only execs last value.\");\n\n collapseValues.clear;\n [\"first\", \"second\", \"last\"].do { |i| collapse.(i); 0.2.wait };\n test.assertEquals(collapseValues.array, [\"first\", \"second\", \"last\"], \"Collapse execs all values.\")\n\n};\n```"}, {"role": "assistant", "content": "UnitTestScript(\"Collapse\", thisProcess.nowExecutingPath).runScript;."}]} +{"conversations": [{"role": "user", "content": "Write a closed hi-hat in SuperCollider."}, {"role": "assistant", "content": "High-passed noise with a very short envelope — the filter is what makes it a hat rather than a hiss.\n\n```supercollider\n(\nSynthDef(\\hat, { |out = 0, amp = 0.3, dur = 0.06|\n var env = EnvGen.kr(Env.perc(0.001, dur, 1, -6), doneAction: 2);\n Out.ar(out, Pan2.ar(HPF.ar(WhiteNoise.ar, 7000) * env * amp));\n}).add;\n);\nSynth(\\hat, [\\dur, 0.04]);\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `Breakcore` in SuperCollider briefly."}, {"role": "assistant", "content": "Breakcore — breakcore simulator This is noisy. Category: UGens > Generators > Chaotic."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\FuMaIn;\n~description = \"A live ambisonic input (ACN_FuMa)\";\n~channelLayout = \\ambi;\n\n~function = { |order = 1, t_trig = 0, bus = 0|\n var env = EnvGen.kr(Env([0,1], [1]), t_trig);\n var chans = Array.series(\n size: (order + 1).pow(2).asInteger,\n start: bus,\n step: 1\n );\n var input = SoundIn.ar(chans, env);\n HOAConverterFuma2AcnN3d.ar(order, input);\n}\n```"}, {"role": "assistant", "content": "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see ."}]} +{"conversations": [{"role": "user", "content": "Interfacing SC with external software: MIDI or OSC?"}, {"role": "assistant", "content": "SuperCollider forum — Interfacing SC with external software: MIDI or OSC?\n\nI found this partial solution on sccode.org :\n\n```supercollider\n // declare an event type which sends OSC commands to Renoise\n\n(\nEvent.addEventType(\\renoise, { |server|\n var renoiseOscServer = NetAddr(\"127.0.0.1\", 8000);\n var notes = [~midinote.value, ~ctranspose.value, ~velocity.value, ~sustain.value, ~lag.value, ~timingOffset.value, ~instr.value, ~track.value].flop;\n var timeNoteOn, timeNoteOff, instrument, track, velocity;\n var serverLatency;\n\n serverLatency = server.latency ? 0;\n\n notes.do {|note|\n instrument = note[6] ? -1;\n track = note[7] ? -1;\n velocity = note[2].asInt.clip(0,127);\n\n // sustain and timingOffset are in beats, lag is in seconds\n timeNoteOn = (thisThread.clock.tempo.reciprocal*note[5])+note[4]+server.latency;\n timeNoteOff = (thisThread.clock.tempo.reciprocal*(note[3]+note[5]))+note[4]+server.latency;\n SystemClock.sched(timeNoteOn, {renoiseOscServer.sendMsg(\"/renoise/trigger/note_on\", instrument.asInt, track.asInt, (note[0]+note[1]).asInt, velocity )});\n SystemClock.sched(timeNoteOff, {renoiseOscServer.sendMsg(\"/renoise/trigger/note_off\", instrument.asInt, track.asInt, (note[0]+note[1]).asInt)});\n }\n});\n);\n\n// Now start Renoise OSC server, load a sample, and try some patterns\n\n// straight timing\n(\nPbind(*[\n type: \\renoise,\n legato: Pgauss(0.2,0.05,inf),\n dur: 0.2,\n degree: [2,5,12],\n track: Prand([0,1], inf),\n ctranspose: Pseq([0,0,0,0,4,4,4,4,5,5,5,5],inf),\n velocity: Pgauss(64,10,inf),\n]).play;\n)\n```\n\nhttp://sccode.org/1-4SN\n\nBut what I couldn’t find there was a simple syntax for sending Note Events or Midi Events as OSC messages... Do I really need to re-implement the whole SC’s defaultParentEvent as new OSC Event to send it using regular pattern’s syntax?"}]} +{"conversations": [{"role": "user", "content": "What does `Patch.watchNoncontrols` do?"}, {"role": "assistant", "content": "Pairs an Instr with inputs that that will be passed to the Instr"}]} +{"conversations": [{"role": "user", "content": "I edited a SynthDef and the running sound did not change."}, {"role": "assistant", "content": "Redefining a SynthDef only affects Synths created after the new definition reaches the server; existing instances keep the graph they were built with. Free and recreate them: `~s.free; ~s = Synth(\\name)`. In JITLib, Ndef is the tool designed for this — redefining `Ndef(\\name, { ... })` crossfades to the new graph while it plays."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n// Function to check an array for repetitions within a maximum test span\n\n~repetitionCheck = { |array, maxTestSpan|\n maxTestSpan.do { |i|\n var result = (array.drop(i+1) - array).drop((i+1).neg).includes(0).not;\n (\"no repetitions within a span of \" ++ (i+2).asString ++ \" items: \").post;\n result.postln;\n }\n}\n);\n\n// test case\n// no repetitions within a maximum span of 6 (maxLookBack == 5)\n\n(\n~src = Pbrown(0, 20, 0.3).round.asInteger;\np = PLIdev(\\src, 5, -7, 7).iter;\na = p.nextN(10000);\na.plot;\n~repetition\n// …\n```"}, {"role": "assistant", "content": "Function to check an array for repetitions within a maximum test span no repetitions within a maximum span of 6 (maxLookBack == 5) (PLIdev: dynamic scope pattern searching for numbers with integer distance from a source pattern, optionally avoiding repetitions within a span)"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Play your (short) soundfiles with some delay that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n// By Bjørn Houdorf March 2013, Play your (short) soundfiles with some delay.\n\nb = SoundFile.collectIntoBuffers(\"yourSoundFileFolder/*\"); // 1. rund this\n\n( // 2. and then run this\nt = Task({\n({\n var num= b.size.rand;\n var buf= b[num];\n 0.1*Splay.ar(PlayBuf.ar(buf.numChannels, buf, 1, 1, 0, 0));\n}.play;\n) \n});\n);\n\n\n( // 3. Then run this\nz = Task({\nloop({\n t.start;\n 0.1.wait;\n});\n});\n);\n\n\nz.start; // 4. and run this\nz.stop; // 5. and finally run this\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `LFCub` in SuperCollider briefly."}, {"role": "assistant", "content": "LFCub — A sine like shape made of two cubic pieces A sine like shape made of two cubic pieces. Smoother than Category: UGens > Generators > Deterministic."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BinaryOpUGen`."}, {"role": "assistant", "content": "```supercollider\na = WhiteNoise.ar; // a WhiteNoise\nb = a + 2; // a BinaryOpUGen.\nb.operator; // +\n\n// sound example\n(\n{\n var a = LFSaw.ar(300);\n var b = LFSaw.ar(329.1);\n a % b * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SimpleNumber.legendrePZeros` do?"}, {"role": "assistant", "content": "Since the Legendre polynomials are alternatively even and odd, only the non-negative zeros are returned. For the odd Legendre polynomials, the first zero is always zero. The rest of the zeros are returned in increasing"}]} +{"conversations": [{"role": "user", "content": "What is `Stream`?"}, {"role": "assistant", "content": "Stream — Stream is the base class for classes that define streams"}, {"role": "user", "content": "What does `Stream.play` do?"}, {"role": "assistant", "content": "Streams that return numbers can be played directly with the play message. Streams that return events need to be wrapped in an EventStreamPlayer. See #-asEventStreamPlayer."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// play at the next beat, with offset 0.4\n(\nRoutine({ loop {\n \"***\".postln; 0.5.wait;\n \"_*_\".postln; 0.1.wait;\n} }).play(quant: [1, 0.4]);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ReplaceOut`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"ReplaceOutHelp\", { |out = 0, freq = 440|\n var source;\n source = SinOsc.ar(freq, 0, 0.1);\n\n // write to the bus, replacing previous contents\n ReplaceOut.ar(out, source);\n\n}).add;\n);\n\n// each Synth replaces the output of the previous one\nx = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 500]);\ny = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 600]);\nz = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 700]);\n\n// release them in reverse order; the older Synths are still there.\nz.free;\ny.free;\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Limiter`."}, {"role": "assistant", "content": "```supercollider\n(\n// example signal to process\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n z * 0.8\n}.play\n);\n\n(\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n [z, Limiter.ar(z, 0.4, 0.01)] * 0.5\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `BusPool.reset` do?"}, {"role": "assistant", "content": "bus allocator with retain/release counting for shared busses"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Fdef`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\ns.boot;\nSynthDef(\"gpdef\",\n { |out = 0, freq = 440, sustain = 0.05, amp = 0.1|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain), doneAction: Done.freeSelf) * amp;\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n// fork a thread that plays some sounds\n(\nFdef(\\freq, 440);\nFdef(\\dur, 0.2);\n\nfork {\n loop {\n s.sendMsg(\"/s_new\", \"gpdef\", -1, 1, 1, \\freq, Fdef(\\freq).value);\n Fdef(\\dur).value.wait;\n }\n};\n);\n\n// some modifications\n\nFdef(\\freq, Fdef(\\midinote, 60).midicps);\nFdef(\\midinote, { [67, 64, 65].choose });\nFdef(\\midinote, { [67, 64, 65].choose } + Fdef(\\offset));\nFdef(\\offset, { 4.rand });\nFdef(\\dur, 0.23);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Monitor`."}, {"role": "assistant", "content": "```supercollider\n{ Out.ar(87, SinOsc.ar(MouseX.kr(240, 1000, 1) * [1, 2, 3], 0, 0.2)) }.play; // play three sine tone on channels 87, 88, and 89\nx = Monitor.new; // create a new monitor\nx.play(fromIndex: 87, fromNumChannels: 3, toIndex: 0, toNumChannels: 2); // play them back to the stereo hardware channels\n```"}]} +{"conversations": [{"role": "user", "content": "Rand or rand difference?"}, {"role": "assistant", "content": "SuperCollider forum — Rand or rand difference?\n\nI think you meant to compare Rand and rrand (not rand) – both generate a random number between a given low and high, but Rand is intended to be used inside a SynthDef and the behavior is slightly different. Compare:\n\n```supercollider\n(\nSynthDef(\\test, {\n var freq = rrand(400, 600);\n Out.ar(0, SinOsc.ar(freq) * 0.2);\n}).add;\n);\n\nSynth(\\test); // run and stop multiple times: always same freq\n\n(\nSynthDef(\\test2, {\n var freq = Rand(400, 600);\n Out.ar(0, SinOsc.ar(freq) * 0.2);\n}).add;\n);\n\nSynth(\\test2); // run and stop multiple times: every time a different freq\n```\n\nAs you can read in the help file, Rand is intended to be used inside SynthDefs when you want the particular behavior of a newly generated random frequency for each Synth called. You can use rrand(lo, hi) inside a SynthDef too, if you want the random number to be generated only once at time of SynthDef creation (it gets “inscribed in the recipe” for good), so all future and all Synth calls based on that SynthDef to use on that same random number.\n\nAs a side note, rand (as opposed to rrand) generates a random number between zero and the receiver:\n\n```supercollider\nrand(8); // random numbers between 0 and and 8 (excluding 8)\n\nrand(0.5, 8); // random numbers between 0 and 0.5; second argument is ignored here\n```\n\nAlso in regards to the specific way you present the example (as Functions, indicated by the curly braces): note the difference when you evaluate them:\n\n```supercollider\n{Rand(0.5,8)}.value; // returns 'a Rand'\n{rrand(0.5,8)}.value; // returns an actual random choice between lo and hi\n```\n\nHope this helps,\n\nB"}]} +{"conversations": [{"role": "user", "content": "Are you an AI?"}, {"role": "assistant", "content": "Yes. I am a small language model specialised in SuperCollider. I generate text; I cannot hear audio, run sclang, or check whether a patch sounds the way you want."}]} +{"conversations": [{"role": "user", "content": "What does `Function.getToFloatArray` do? What arguments does it take?"}, {"role": "assistant", "content": "Stream the function audio values to the client using a series of getn messages and put the results into a Arguments: duration — Amount of data to record in seconds; target — A server, synth, or group where to place the synth that plays the function; action — A function to call when writing is finished.; wait — The amount of time in seconds to wait between sending getn messages. Longer times are safer. The default is 0.01 seconds which seems reliable under normal circumstances. A setting of 0 is not recommended.; timeout — The amount of time in seconds after which to post a warning if all replies have not yet been received. the default is 3.."}]} +{"conversations": [{"role": "user", "content": "My sustained synth never stops, even when I set the gate to 0."}, {"role": "assistant", "content": "A sustained EnvGen only releases when the gate goes from positive to non-positive *after* the envelope has started, and the Synth only disappears if that EnvGen has `doneAction: 2`. Check three things: the SynthDef actually takes a `gate = 1` argument, the Env is a sustained shape (Env.adsr or Env.asr, not Env.perc), and you call `x.set(\\gate, 0)` on the Synth object. Setting the gate on a different Synth, or on a Group, does nothing."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// synthdef\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n}).add;\n);\n\n// pattern with different start times\n(\nx = Pbind(\n \\instrument, \\help_sinegrain,\n \\degree, Pseq(#[0, 5, 4, 2, 1, 1, 3], inf),\n \\dur, Pseq(#[0.25, 0.5, 1.0], inf),\n \\scale, #[0, 3, 5, 9, 10]\n);\na = Pbus(Pgt\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// synthdef\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n}).add;\n);\n\n// pattern with different start times\n(\nx = Pbind(\n \\instrument, \\help_sinegrain,\n \\degree, Pseq(#[0, 5, 4, 2, 1, 1, 3], inf),\n \\dur, Pseq(#[0.25, 0.5, 1.0], inf),\n \\scale, #[0, 3, 5, 9, 10]\n);\na = Pbus(Pgtpar([0.0, x, 1.5, x, 2.25, x])).play;\n);\ns.plotTree;\na.stop;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\na = {\n var dur;\n\n dur = 0.1;\n\n LFTri.ar(100+(1000*Maths.ar(dur/2, dur/2, 0.99, 1, 0, 1, LFNoise0.ar(1/dur).range(0,1))[0]), 0, 0.1)\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\na = {\n var dur;\n\n dur = 0.1;\n\n LFTri.ar(100+(1000*Maths.ar(dur/2, dur/2, 0.99, 1, 0, 1, LFNoise0.ar(1/dur).range(0,1))[0]), 0, 0.1)\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LastValue`."}, {"role": "assistant", "content": "```supercollider\nd = { |freq = 440| SinOsc.ar(LastValue.ar(freq, 20), 0, 0.2) }.play;\n\nd.set(\\freq, 400);\nd.set(\\freq, 200);\nd.set(\\freq, 670);\nd.set(\\freq, 680);\nd.set(\\freq, 695);\nd.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// world's most expensive patchcord (use headphones to avoid feedback)\n{ SoundIn.ar(0) }.play;\n\n// stereo version\n{ SoundIn.ar([0, 1]) }.play;\n\n// scope input; silent output\n{ Amplitude.kr(SoundIn.ar(0)) }.scope;\n```"}, {"role": "assistant", "content": "world's most expensive patchcord (use headphones to avoid feedback) scope input; silent output (SoundIn: Read audio from hardware inputs)"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `FreqScopeView`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// Start server\ns.boot;\n\n// Create analyzer in a window\n(\nw = Window(\"My Analyzer\", Rect(0, 0, 511, 300)); // width should be 511\nf = FreqScopeView(w, w.view.bounds);\nf.active_(true); // turn it on the first time;\n\nw.onClose_({ f.kill }); // you must have this\nw.front;\n{ SinOsc.ar([500, 1000], 0, 0.25).mean.dup }.play(s); // start two sine waves\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n/* Audio plugin definition\n\n Each audio plugin should define the following global variables:\n ~name: (symbol) name of the spatializer\n ~description: (string) a short description\n ~function: the actual definition of the plugin\n\n*/\n\n~name = \\MonoIn;\n~description = \"A direct input\";\n~channelLayout = \\mono;\n\n~function = {\n |gate = 0, bus = 0, attack = 0.02, susL = 0.9, release = 0.1, curve = -4|\n var env = Env.asr(attack, susL, release, curve);\n SoundIn.ar(bus, EnvGen.kr(env, gate));\n}\n```"}, {"role": "assistant", "content": "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see ."}]} +{"conversations": [{"role": "user", "content": "What does `MxUnitApp.remove` do?"}, {"role": "assistant", "content": "Disconnect and remove the unit from the Returns: this"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Gbman2DC.ar(MouseX.kr(20, SampleRate.ir*0.25), MouseX.kr(80, SampleRate.ir), 0.1) }.play(s);\n\n{ Gbman2DC.ar(11025, 22050, -0.7, -2.7, 0.1) }.play(s);\n\n{ Gbman2DC.ar(2200, 8800, 1.2, 2.0002, 0.1) }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Gbman2DC.ar(MouseX.kr(20, SampleRate.ir*0.25), MouseX.kr(80, SampleRate.ir), 0.1) }.play(s);\n\n{ Gbman2DC.ar(11025, 22050, -0.7, -2.7, 0.1) }.play(s);\n\n{ Gbman2DC.ar(2200, 8800, 1.2, 2.0002, 0.1) }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `BufRd` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n// indexing with a phasor\n{ BufRd.ar(1, b, Phasor.ar(0, BufRateScale.kr(b), 0, BufFrames.kr(b))) }.play;\n\n// indexing by hand\n{ BufRd.ar(1, b, K2A.ar(MouseX.kr(0, BufFrames.kr(b)))) }.play;\n\nb.free\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Demand`."}, {"role": "assistant", "content": "```supercollider\n{\nvar a, b, t = Impulse.kr(2);\na = { Dseq([1, 2, 3, 4, 5], inf) } * 100;\nb = a + 1;\nDemand.kr(t, 0, [a, b]).poll(t)\n}.play\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nd = SynthDef(\"help-NodeControl\", { |out = 0, freq = 400|\n Out.ar(out,\n SinOsc.ar(freq, 0, 0.5)\n )\n});\ny = d.play; // the synth\n\nc = NodeControl(y, 1;\n\nc.value = 500;\n\nc.value = 300;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nd = SynthDef(\"help-NodeControl\", { |out = 0, freq = 400|\n Out.ar(out,\n SinOsc.ar(freq, 0, 0.5)\n )\n});\ny = d.play; // the synth\n\nc = NodeControl(y, 1);\n\nc.value = 500;\n\nc.value = 300;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `EnvGate`."}, {"role": "assistant", "content": "```supercollider\na = { LPF.ar(Saw.ar(200), 600) * EnvGate.new }.play;\na.set(\\fadeTime, 2);\na.release;\n\n// the same as:\na.set(\\gate, 0);\n\n// several env gates can coexist in one synth def.\n(\na = {\n var sound1 = LPF.ar(Saw.ar(80), 600) * EnvGate.new;\n var sound2 = RLPF.ar(Saw.ar(200) * 0.5, 6000 * EnvGate.new + 60, 0.1) * EnvGate.new;\n sound1 + sound2\n}.play;\n);\na.set(\\fadeTime, 5);\na.release;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// They describe populations of predators and prey, e.g. foxes and rabbits.\n// https://en.wikipedia.org/wiki/Lotka%E2%80%93Volterra_equations\n\n\n// v'(t) = (alpha * v(t)) - (beta * v(t) * w(t))\n// w'(t) = (delta * v(t) * w(t)) - (gamma * w(t))\n\n\n(\nFb1_ODEdef(\\LotkaVolterra, { |t, y, alpha = 0.1, beta = 0.1,\n gamma = 0.1, delta = 0.1|\n [\n { y[0] * (beta.neg * y[1] + alpha) },\n { y[1].neg * (delta.neg\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// They describe populations of predators and prey, e.g. foxes and rabbits.\n// https://en.wikipedia.org/wiki/Lotka%E2%80%93Volterra_equations\n\n\n// v'(t) = (alpha * v(t)) - (beta * v(t) * w(t))\n// w'(t) = (delta * v(t) * w(t)) - (gamma * w(t))\n\n\n(\nFb1_ODEdef(\\LotkaVolterra, { |t, y, alpha = 0.1, beta = 0.1,\n gamma = 0.1, delta = 0.1|\n [\n { y[0] * (beta.neg * y[1] + alpha) },\n { y[1].neg * (delta.neg * y[0] + gamma) }\n ]\n}, 0, [1, 1], 1, 1);\n);\n\n// with standard parameter usage the audio results are brass-like and not spectacular\n\n(\nx = {\n Fb1_ODE.ar(\\LotkaVolterra,\n [0.2, MouseX.kr(0.1, 0.9), MouseY.kr(0.1, 0.9), 0.8],\n tMul: 3000\n ) * 0.1\n}.play\n);\n\nx.release\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// play SinOscs silently and wait for granulation envelopes\n\n(\na = Bus.audio(s, 10);\nx = { Splay.ar(In.ar(a, 10) * SinOsc.ar((3..12) * 100, 0, 0.05)) }.play\n);\n\n\n// send envelopes to buses\n\n(\nz = {\n DXEnvFanOut.ar(\n Dseq((0..5) + a.index, inf) + Diwhite(1, 4),\n \n // with newer SC versions you can also write:\n // Dseq((0..5), inf) + Diwhite(1, 4) + a.index,\n \n fadeTime: 0.05,\n width: 1,\n initOutOffset: -0.5\n )\n}.play\n);\n\nx.release;\n\n// clean\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// play SinOscs silently and wait for granulation envelopes\n\n(\na = Bus.audio(s, 10);\nx = { Splay.ar(In.ar(a, 10) * SinOsc.ar((3..12) * 100, 0, 0.05)) }.play\n);\n\n\n// send envelopes to buses\n\n(\nz = {\n DXEnvFanOut.ar(\n Dseq((0..5) + a.index, inf) + Diwhite(1, 4),\n \n // with newer SC versions you can also write:\n // Dseq((0..5), inf) + Diwhite(1, 4) + a.index,\n \n fadeTime: 0.05,\n width: 1,\n initOutOffset: -0.5\n )\n}.play\n);\n\nx.release;\n\n// cleanup\n\n(\nz.free;\na.free;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// It might also be desirable to start with a fade from silence.\n// This can be done with a negative initOutOffset:\n\n(\nx = {\n var lfo = XLine.ar(1, 0.5, 60);\n DXMix.ar(\n Dseq([0, 4, 1, 5, 2, 6, 3, 7], inf),\n `(Saw.ar((1..8) * 70 * lfo, 0.075)),\n fadeTime: 2,\n width: 2,\n initOutOffset: -1\n ) ! 2\n}.play\n);\n\nx.release\n\n\n// overlap scheme with width = 2 and initOutOffset = -1:\n```"}, {"role": "assistant", "content": "It might also be desirable to start with a fade from silence. This can be done with a negative initOutOffset: (DXMix: crossfades between signals according to demand-rate control)"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `BufRd` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n// indexing with a phasor\n{ BufRd.ar(1, b, Phasor.ar(0, BufRateScale.kr(b), 0, BufFrames.kr(b))) }.play;\n\n// indexing by hand\n{ BufRd.ar(1, b, K2A.ar(MouseX.kr(0, BufFrames.kr(b)))) }.play;\n\nb.free\n```"}]} +{"conversations": [{"role": "user", "content": "What does `JITGui.zone` do?"}, {"role": "assistant", "content": "a CompositeView inside the parent that holds the JITGui's"}]} +{"conversations": [{"role": "user", "content": "I get 'index out of range' when playing a buffer."}, {"role": "assistant", "content": "A read position is past the end of the buffer. `PlayBuf` with a `startPos` in frames beyond `~buf.numFrames`, or a `BufRd`/`GrainBuf` whose phase goes above 1, produces this. For GrainBuf, pos is normalised 0..1, so pass `LFNoise1.kr(1).range(0, 1)` rather than a frame count; for PlayBuf, cap the position at `~buf.numFrames - 1`. If you just loaded the file, check `~buf.numFrames` — a failed read gives 0 frames and every position is out of range."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// a Synth with a multi-node release stage\nd = { |gate = 1|\n var env = Env([0, 1, 0, 0.5, 0], 0.5, -4, releaseNode: 1);\n { BrownNoise.ar }.dup * EnvGen.kr(env, gate, doneAction: Done.freeSelf)\n}.play;\n);\n// forced release in 2 seconds:\n// end value (0) and shape (-4) are read from the env's last node, nodes 2 and 3 are skipped\nd.release(2);\n\n// without releaseTime: normal release stage, as defined in env (3 nodes)\nd.release(;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// a Synth with a multi-node release stage\nd = { |gate = 1|\n var env = Env([0, 1, 0, 0.5, 0], 0.5, -4, releaseNode: 1);\n { BrownNoise.ar }.dup * EnvGen.kr(env, gate, doneAction: Done.freeSelf)\n}.play;\n);\n// forced release in 2 seconds:\n// end value (0) and shape (-4) are read from the env's last node, nodes 2 and 3 are skipped\nd.release(2);\n\n// without releaseTime: normal release stage, as defined in env (3 nodes)\nd.release();\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for little experiment with periodicity: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n/* An little experiment with periodicity. \n Maybe there can be some sync artifact...\n */\n\ns.boot;\n\nSynthDef(\\mallet,{arg in=0,out=0,f=0,f2=0,a=0.1,r=1.8;\n\n var sig=Array.fill(3,{|n| SinOsc.ar(f*(n+1),mul:a/(n*n+1))}).sum;\n var env=EnvGen.kr(Env.perc(0.001,r),gate:Impulse.kr(f2),doneAction:0);\n\nOut.ar(out,sig*env!2);\n};\n).add;\n\n~root=60;\n~degrees=[0,4,5,7,9,12,16,17,19,21].scramble;\n~num=10;\n~coeff=0.75;\n\nArray.fill(~num,{|n| Synth.new(\\mallet,[\\f:(~root +~degrees[n]).midicps,\\a:0.2/~num,\\f2:(1+(n*~coeff))*0.1])});\n\ns.quit;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `MKtl.sync` do?"}, {"role": "assistant", "content": "send all current MKtl values to the physical device, e.g. to move all motorfaders to a freshly recalled"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Seekers are something you should avoid. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var time = 0.23;\n var freq = (55).midicps;\n var a = VarSaw.ar(freq/2, width: XLine.ar(0.5,1,time)).range(0,XLine.ar(0.666,1/666,time));\n var tone = SinOsc.ar(freq).fold(-0.23*a,a) * EnvGen.ar(Env([1,0],[time]));\n Out.ar(0, tone.dup);\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// randomly modulate all params\n(\n{ LatoocarfianC.ar(\n SampleRate.ir/4,\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5)\n) * 0.2 }.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// randomly modulate all params\n(\n{ LatoocarfianC.ar(\n SampleRate.ir/4,\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5)\n) * 0.2 }.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\ns.boot;\n\n(\nSynthDef(\"lazerdrone\", {\n var in, freq, hasFreq;\n\n \n in = SinOsc.ar(440 * LFSaw.kr(100, 1000));\n\n # freq, hasFreq = Pitch.kr(\n in,\n ampThreshold: 0.09,\n median: 1);\n freq = freq * hasFreq;\n //freq.poll;\n \n SinOsc.kr(freq).poll;\n \n Out.ar(0, in + \n SinOsc.ar(440, \n 0, \n Clip.kr(\n SinOsc.kr(freq), \n 0)\n )\n );\n}).play;\n)\n```"}, {"role": "assistant", "content": "A lazer sound then a drone with morse-code like bleeps. A byproduct of testing the triggering algorithm in the mono2eN SynthDef."}]} +{"conversations": [{"role": "user", "content": "What does `SimpleNumber.excess` do?"}, {"role": "assistant", "content": "Returns the difference of the receiver and its clipped"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nSynthDef(\\Synth3,\n {arg ress = 0;\n var klank, env;\n klank = Klank.ar(`[{Rand(70,21000)}!7, {Rand(0.128,0.700)}!7],BrownNoise.ar(0.7));\n klank = klank;\n env = EnvGen.kr(Env.perc(0.07, ress), doneAction:2);\n Out.ar(0, klank*env.dup*0.0128);\n}).add;\n)\n\n\n{inf.do{x = rrand(0.01,0.7); Synth(\\Synth3, [\\ress, x+(7*x)]); x.wait;}}.fork\n```"}, {"role": "assistant", "content": "Play around with {Rand(70, 21000)}!7\r\n\r\nA simple example for the begginers... hope I can contribute to something =)."}]} +{"conversations": [{"role": "user", "content": "What does `RedSequencer.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "simple sequencer Arguments: array — Values to be played in sequence or a Demand rate ugen like Drand, Dseries or Dgeom.; trig — Jumps to the next value in array.; reset — Makes the sequence start from the beginning.."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Tdef` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\n// load a synthdef\ns.boot;\nSynthDef(\"pdef_grainlet\",\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.3), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n\nTdef(\\z, Pseq([1, 1, 1, 0.5, 0.5], inf));\n\n(\nPset(\\instrument, \\pdef_grainlet,\n Ppar([\n Pbind(\n \\dur, Tdef(\\z),\n \\note, Pseq([1, 3, 2, 1, 0], inf),\n \\x, Pfunc { TempoClock.default.elapsedBeats.postln } // posts the onset times\n ),\n Pbind(\n \\dur, 4, // reference beat\n \\sustain, 0.1,\n \\note, 8\n )\n ])\n).play(quant: 1);\n);\n\n\nTdef(\\z, Prand([1, 1, 0.23, 0.5, 0.5], inf)); // exchange time pattern\nTdef(\\z, Pseq([1, 1, 1, 1], inf)); // pattern stays in sync.\nTdef(\\z, Pseq([1, 1, 1, 0.5, 0.5], inf)); // but might be in different order.\n // to avoid this, set quant to an appropriate value.\n```"}]} +{"conversations": [{"role": "user", "content": "What does `View.unminimize` do?"}, {"role": "assistant", "content": "If the view is a window, restores the its previous state after being"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `SelectX` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar(300),\n Pulse.ar(230)\n ];\n\n SelectX.ar(MouseX.kr(0, 1) * a.size, a) * 0.2\n}.play;\n);\n\n(\n{\n var a;\n a = [\n SinOsc.kr(0.25),\n LFSaw.kr(10),\n LFPulse.kr(0.3)\n ];\n\n SinOsc.ar(SelectX.kr(MouseX.kr(0, 1) * a.size, a) * 300 + 400) * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n{var a=LFNoise0,b=SinOscFB,c=Pulse;b.ar(a.ar([2,3])*(c.ar([5,7],b.kr([7,5]))*(a.ar([3,2]))*[800,1200]),(c.kr([100,80])*[2,3]))}.play\n```"}, {"role": "assistant", "content": "dirty and noisy \"result\" of remembering/learning sc again. still dont understand why it does not work when i move .ar/kr to var definition. hh... will turn it into synthdef..."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n{ BlitB3Tri.ar(XLine.kr(1000, 20, 10)) }.play;\n\n//unfortunately, aliasing returns at higher frequencies (over 5000Hz or so) with a vengence\n{ BlitB3Tri.ar(MouseX.kr(20,8000,'exponential').poll,0.99,MouseY.kr(0.001,0.99)) }.play;\n\n//more efficient, some aliasing from 3000, but not so scary over 5000. Duller sound (less high harmonics included for lower fundamentals)\n{ LFTri.ar(MouseX.kr(20,8000,'exponential').poll) }.play;\n\n\n//comparison\n//LFTri version cheaper, and less aliasing! \nx = { LFTri.ar(\n// …\n```"}, {"role": "assistant", "content": "unfortunately, aliasing returns at higher frequencies (over 5000Hz or so) with a vengence more efficient, some aliasing from 3000, but not so scary over 5000. Duller sound (less high harmonics included for lower fundamentals) (BlitB3Tri: Bipolar BLIT derived triangle)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n//bass synth\n{Out.ar(0,Pan2.ar(DoubleWell3.ar(f:SinOsc.ar(MouseX.kr(0,200),0,MouseY.kr(0.5,4.0))),0.0))}.play\n\n//plotting check of first samples\n{DoubleWell3.ar}.plot(0.05, minval:-1, maxval:1)\n\n//gradually changing \n{Pan2.ar(DoubleWell3.ar(0,0.05,LFSaw.ar(Line.kr(10,1000,10)),Line.kr(0.0,0.3,20)),0.0)}.play\n\n//controlled - midscreen amplitude jump\n{Pan2.ar(DoubleWell3.ar(0,0.05,L\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n//bass synth\n{Out.ar(0,Pan2.ar(DoubleWell3.ar(f:SinOsc.ar(MouseX.kr(0,200),0,MouseY.kr(0.5,4.0))),0.0))}.play\n\n//plotting check of first samples\n{DoubleWell3.ar}.plot(0.05, minval:-1, maxval:1)\n\n//gradually changing \n{Pan2.ar(DoubleWell3.ar(0,0.05,LFSaw.ar(Line.kr(10,1000,10)),Line.kr(0.0,0.3,20)),0.0)}.play\n\n//controlled - midscreen amplitude jump\n{Pan2.ar(DoubleWell3.ar(0,0.05,LFSaw.ar(MouseX.kr(10,1000)),MouseY.kr(0.0,0.5)),0.0)}.play\n\n\n\n//triggering\n{DoubleWell3.ar(Impulse.kr(MouseY.kr(0.01,100, 'exponential')),0.1,LFCub.ar(MouseX.kr(10,1000, 'exponential')),MouseY.kr(0.0,1.0),LFNoise0.kr(2.3,0.2,0.8),LFNoise1.kr(2.37,0.2,0.8))}.play\n\n\n//AudioIn as forcing\n{Pan2.ar(DoubleWell3.ar(0,0.05,LPF.ar(AudioIn.ar(1),100,MouseX.kr(0,1000)),MouseY.kr(0.0,0.5)),0.0)}.play\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Color.asHSV` do?"}, {"role": "assistant", "content": "Returns an array with `[hue, saturation, value, alpha]`, as values between 0 and"}]} +{"conversations": [{"role": "user", "content": "How do I add a reverb send to a whole group?"}, {"role": "assistant", "content": "Same shape as the delay: a private stereo bus, one effect reading it, instruments writing both dry\nand wet.\n\n```supercollider\n(\n~verbBus = Bus.audio(s, 2);\nSynthDef(\\verb, { |in = 0, out = 0, room = 0.85, mix = 0.5|\n Out.ar(out, FreeVerb.ar(In.ar(in, 2), mix, room, 0.5) * 0.7);\n}).add;\nSynthDef(\\blip, { |out = 0, send = 0, freq = 440, amp = 0.1|\n var env = EnvGen.kr(Env.perc(0.002, 0.4), doneAction: 2);\n var sig = SinOsc.ar(freq) * env * amp;\n Out.ar(out, sig);\n Out.ar(send, sig);\n}).add;\n);\nSynth(\\verb, [\\in, ~verbBus]);\nPbind(\\instrument, \\blip, \\send, ~verbBus, \\degree, Pseq([0, 4, 7, 11], inf), \\dur, 0.25).play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot\n\n{Perlin3.ar(Integrator.ar(K2A.ar(MouseX.kr(0, 0.1))), Integrator.ar(K2A.ar(MouseY.kr(0, 0.1))))}.play(s)\n\n{Perlin3.ar(*{Line.ar(0, 1000, 30)}.dup(3))}.plot(1\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot\n\n{Perlin3.ar(Integrator.ar(K2A.ar(MouseX.kr(0, 0.1))), Integrator.ar(K2A.ar(MouseY.kr(0, 0.1))))}.play(s)\n\n{Perlin3.ar(*{Line.ar(0, 1000, 30)}.dup(3))}.plot(1)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `CuspL`."}, {"role": "assistant", "content": "```supercollider\n// vary frequency\n{ CuspL.ar(MouseX.kr(20, SampleRate.ir), 1.0, 1.99) * 0.3 }.play(s);\n\n// mouse-controlled params\n{ CuspL.ar(SampleRate.ir/4, MouseX.kr(0.9, 1.1, 1), MouseY.kr(1.8, 2, 1)) * 0.3 }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(CuspL.ar(40, MouseX.kr(0.9, 1.1, 1), MouseY.kr(1.8, 2, 1))*800+900)*0.4 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Routine.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates an instance of Routine, passing it the Function with code to Arguments: func — A Function with code for the Thread to run.; stackSize — Call stack size (an Integer).."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ SinOsc.ar(SinOsc.ar(0.3).exprange(440, 6600), 0, 0.5 * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ SinOsc.ar(SinOsc.ar(0.3).exprange(440, 6600), 0, 0.5) * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// try wiggling mouse quickly;\n// LFNoise frequently seems stuck, LFDNoise changes smoothly.\n\n{ SinOsc.ar(LFNoise1.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n{ SinOsc.ar(LFDNoise1.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFNoise1.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n\n{ LFDNoise1.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n```"}, {"role": "assistant", "content": "try wiggling mouse quickly; LFNoise frequently seems stuck, LFDNoise changes smoothly. (LFDNoise1: Dynamic ramp noise)"}]} +{"conversations": [{"role": "user", "content": "What does `View.parent` do?"}, {"role": "assistant", "content": "The basic visible element of GUI Returns: The view's parent view, or nil if the view is a top view."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// multiple usage of the same name:\na = { SinOsc.ar(\\freq.kr(440, 1.0)) + Saw.ar(\\freq.kr(440, 1.0) * 0.5) * 0.1 }.play;\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n\n// with different lag values:\na = { SinOsc.ar(\\freq.kr(440).lag(3.5)) + Saw.ar(\\freq.kr(440).lag(0.05) * 0.5) * 0.1 }.play;\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n\n// control saved to a variable:\n(\na = {\n var freq = \\freq.kr(440);\n SinOsc\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// multiple usage of the same name:\na = { SinOsc.ar(\\freq.kr(440, 1.0)) + Saw.ar(\\freq.kr(440, 1.0) * 0.5) * 0.1 }.play;\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n\n// with different lag values:\na = { SinOsc.ar(\\freq.kr(440).lag(3.5)) + Saw.ar(\\freq.kr(440).lag(0.05) * 0.5) * 0.1 }.play;\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n\n// control saved to a variable:\n(\na = {\n var freq = \\freq.kr(440);\n SinOsc.ar(freq.lag(3.5)) + Saw.ar(freq.lag(0.05) * 0.5) * 0.1;\n}.play;\n);\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n```"}]} +{"conversations": [{"role": "user", "content": "How do I distort a signal?"}, {"role": "assistant", "content": "Drive it into a nonlinearity, then tame the level: `tanh` is soft clipping, `.distort` is harder,\nand a low-pass after the drive keeps it from getting fizzy.\n\n```supercollider\n(\n{\n var sig = SinOsc.ar(110) * 0.3;\n var driven = (sig * 12).tanh;\n LPF.ar(driven, 5000) * 0.4\n}.play;\n)\n```\n\nMore drive means more harmonics; because they are generated, the output is louder as well as brighter, so\nscale the result down after the nonlinearity."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for blaplop (a SuperCollider snippet) that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\bla, { arg out=0, amp=0.1, gate=1, pan=0, freq=200;\n var sig;\n var tab;\n tab = \\tab.kr(1 ! 15);\n sig = LFSaw.ar(freq * tab.abs);\n sig = sig.sum;\n sig = RLPF.ar(sig, Rand(10,freq*2) + 100 * SinOsc.ar(tab.abs).range(0.01,Rand(2,7)));\n sig = sig.sum;\n sig = sig / 100;\n sig = sig.tanh;\n sig = sig * EnvGen.ar(Env.adsr(0.01,0.1,0.8,0.1+ExpRand(0.001,0.2)),gate,doneAction:2);\n sig = Pan2.ar(sig, pan, amp);\n Out.ar(out, sig);\n}).add;\n);\n\n(\nPdef(\\plop, Pbind(\n \\instrument, \\bla,\n \\degree, Pstep(Pseq([\n Pseq([0,2,4],4),\n Pseq([0,12,6],4),\n Pseq([0,12,6]+7,1),\n ],inf), 1),\n \\octave, 3,\n \\tab, Pfunc {\n var tab;\n [\n //tab = { arg n; (n + 1.asFloat.rand + 1).tanh / (n.rand+1) } ! 15;\n tab = { arg n; (n + 2.asFloat.rand + 1) / (n+1) } ! 15;\n tab.postln;\n ]\n },\n \\dur, PdurStutter( Prand([1,2,4],inf), Pseq([1,2,3]/2,inf)),\n \\amp, 0.4\n)).play;\n);\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Fdef`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\ns.boot;\nSynthDef(\"gpdef\",\n { |out = 0, freq = 440, sustain = 0.05, amp = 0.1|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain), doneAction: Done.freeSelf) * amp;\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n// fork a thread that plays some sounds\n(\nFdef(\\freq, 440);\nFdef(\\dur, 0.2);\n\nfork {\n loop {\n s.sendMsg(\"/s_new\", \"gpdef\", -1, 1, 1, \\freq, Fdef(\\freq).value);\n Fdef(\\dur).value.wait;\n }\n};\n);\n\n// some modifications\n\nFdef(\\freq, Fdef(\\midinote, 60).midicps);\nFdef(\\midinote, { [67, 64, 65].choose });\nFdef(\\midinote, { [67, 64, 65].choose } + Fdef(\\offset));\nFdef(\\offset, { 4.rand });\nFdef(\\dur, 0.23);\n```"}]} +{"conversations": [{"role": "user", "content": "GrainBuf complains about too many grains."}, {"role": "assistant", "content": "The number of simultaneous grains is `density × dur` in seconds, and it exceeds maxGrains (512 by default). Either lower the trigger rate, shorten the grains, or raise the limit: `GrainBuf.ar(2, trig, dur, buf, 1, pos, 2, 0, -1, 1024)` — the 1024 is maxGrains. Raising it costs server CPU per grain, so prefer halving the density if the sound does not need it."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ClipNoise`."}, {"role": "assistant", "content": "```supercollider\n{ ClipNoise.ar(0.2) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\nSynthDef(\"a\", { Out.ar(0, SinOsc.ar(800, 0, 0.2)) }).add;\n\nSynthDef(\"b\", { |t_t = 0| Out.ar(1, PinkNoise.ar(0.3)); Free.kr(t_t, 1001) }).add;\n\ns.sendMsg(\\s_new, \\a, 1001, 0, 0);\n\ns.sendMsg(\\s_new, \\b, 1002, 0, 0);\n\ns.sendMsg(\\n_set, 1002, \\t_t, 1);\n\ns.sendMsg(\\s_new, \\a, 1001, 0, 0);\n\ns.sendMsg(\\n_set, 1002, \\t_t, 1);\n\ns.sendMsg(\\s_new, \\a,\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\nSynthDef(\"a\", { Out.ar(0, SinOsc.ar(800, 0, 0.2)) }).add;\n\nSynthDef(\"b\", { |t_t = 0| Out.ar(1, PinkNoise.ar(0.3)); Free.kr(t_t, 1001) }).add;\n\ns.sendMsg(\\s_new, \\a, 1001, 0, 0);\n\ns.sendMsg(\\s_new, \\b, 1002, 0, 0);\n\ns.sendMsg(\\n_set, 1002, \\t_t, 1);\n\ns.sendMsg(\\s_new, \\a, 1001, 0, 0);\n\ns.sendMsg(\\n_set, 1002, \\t_t, 1);\n\ns.sendMsg(\\s_new, \\a, 1001, 0, 0);\n\ns.sendMsg(\\n_set, 1002, \\t_t, 1);\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// Read a sound file from disk into a buffer\ns.boot;\n// ExampleFiles helps locate audio files used in examples\np = ExampleFiles.child;\n// peek at the path to see location and the format of a path\np.postln;\n// read the file\nb = Buffer.read(s, p);\n\n// now play it\n(\nx = SynthDef(\\help_Buffer, { |out = 0, bufnum|\n Out.ar(out,\n PlayBuf.ar(1, bufnum, BufRateScale.kr(bufnum))\n )\n}).play(s, [\\bufnum, b]);\n);\nx.free; b.free;\n\n// with an action function\n// note that the vars are not immediately up-to-date\n(\nb\n// …\n```"}, {"role": "assistant", "content": "Read a sound file from disk into a buffer ExampleFiles helps locate audio files used in examples (Buffer: Client-side representation of a buffer on a server)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// logistic map as frequency control\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n SinOsc.ar(QuadL.ar(40, r.neg, r, 0, 0.1, 800, 900)) * 0.4;\n}.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// logistic map as frequency control\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n SinOsc.ar(QuadL.ar(40, r.neg, r, 0, 0.1, 800, 900)) * 0.4;\n}.play(s);\n)\n```"}]} {"conversations": [{"role": "user", "content": "What is the difference between Line and XLine?"}, {"role": "assistant", "content": "Both are ramps: `Line.kr(start, end, dur, mul, add, doneAction)` moves linearly, `XLine.kr(...)` moves exponentially in a fixed ratio per unit time. Use Line for amplitude and XLine for frequency or any parameter you hear logarithmically — a linear frequency sweep sounds like it rushes at the top and crawls at the bottom. Both take doneAction, so both can end a Synth."}]} -{"conversations": [{"role": "user", "content": "What is `PbindProxy`?"}, {"role": "assistant", "content": "PbindProxy — incremental event pattern reference"}, {"role": "user", "content": "What does `PbindProxy.new` do?"}, {"role": "assistant", "content": "Return a new instance of PbindProxy with the given patternpairs. Unlike Pbindef, it has no internal name. `a = PbindProxy(\\note, Pseq([0, 7, 9], inf), \\dur, 0.2).play;` It also supports keyword argument syntax: `a = PbindProxy(note: Pseq([0, 7, 9]), dur: 0.2).play;`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na = PbindProxy(\\note, Pseq([0, 7, 9], inf), \\dur, 0.2).play;\na.set(\\note, Pseq([0, 6, 10]));\na.stop;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `SelectXFocus` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a;\n a = [\n Saw.ar(LFSaw.kr(3 * [1, 1.01], 0, 100, 230)),\n SinOsc.ar,\n Pulse.ar(LFPulse.kr(3 * [1, 1.02], 0, 0.4, 100, 230)),\n SinOsc.ar(SinOsc.kr(4 * [1, 1.03], 0, 200, 300))\n ];\n\n SelectXFocus.ar(MouseX.kr(0, 1) * a.size, a, MouseY.kr(0, a.size)) * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `PdurStutter`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,0,1,3,4,0], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n100.do({ x.next.postln });\n);\n\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n);\n\n\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,4,4,0,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Resonz` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// 1st, evaluate a synthdef\n(\nSynthDef(\"pitchFromNoise\", { arg out = 0;\n Out.ar(\n out,\n Resonz.ar(\n WhiteNoise.ar(15),\n LFNoise0.kr(2, 110, 660),\n 0.005\n )\n )\n}).add;\n);\n\n// 2nd, make 2 synths\n(\nSynth(\"ringModulation\");\nSynth(\"pitchFromNoise\", [\\out, 1]);\n);\n\n// 3rd, tell the server to list its nodes\n(\ns.queryAllNodes;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for simple smooth arp. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\smooth, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.linen(0.05, sustain, 0.1), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Pair` in SuperCollider?"}, {"role": "assistant", "content": "Pair — LISP-like two element cells Category: Collections > Ordered."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n//Can be very noisy, high pitched and aliases badly: e.g., great fun, but watch out for your ears, filter, try out odd param settings. I've turned all the amplitudes down in the following\n\n\n//defaults, high pitched! WARNING\n{Out.ar(0,Pan2.ar(0.1*DoubleWell.ar(Impulse.kr(0),MouseX.kr(0.01,1,'exponential'),MouseY.kr(0.01,1,'exponential'),0.9,0.0001,0.25,LFNoise0.kr(1,0.4,0.5),LFNoise0.kr(1,0.4,0.5)),0.0))}.play\n\n\n//2 per second\n(\n{Out.ar(0,\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n//Can be very noisy, high pitched and aliases badly: e.g., great fun, but watch out for your ears, filter, try out odd param settings. I've turned all the amplitudes down in the following\n\n\n//defaults, high pitched! WARNING\n{Out.ar(0,Pan2.ar(0.1*DoubleWell.ar(Impulse.kr(0),MouseX.kr(0.01,1,'exponential'),MouseY.kr(0.01,1,'exponential'),0.9,0.0001,0.25,LFNoise0.kr(1,0.4,0.5),LFNoise0.kr(1,0.4,0.5)),0.0))}.play\n\n\n//2 per second\n(\n{Out.ar(0,Pan2.ar(\n\nCombN.ar(\nResonz.ar(DoubleWell.ar(Impulse.kr(2),MouseX.kr(0.01,1,'exponential'),MouseY.kr(0.01,1,'exponential'),3.9,MouseX.kr(0.0001,0.01,'exponential'),0.25,LFNoise0.kr(1,0.4,0.5),LFNoise0.kr(1,10.4,10.5)),500,0.1),\n0.05,0.05,2\n)\n,0.0))}.play\n)\n\n\n//plotting check of first samples\n{DoubleWell.ar(1,0.025,0.025,0.4,1,0.25,-0.5,-0.2)}.plot(0.01, minval:-1, maxval:1)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// hand code a mono signal to a decorrelated soundfield in B-format\n// NOTE: the demonstrated kernel is not ideal for this task\n\n// define encoding kernel\n(\nvar kernelSize;\nvar scale;\n\nkernelSize = 256;\nscale = 24.neg.dbamp;\n\n~kernel = [[\n Buffer.loadCollection(s, FloatArray.fill(kernelSize, {(3/2).sqrt * scale.rand2})),\n Buffer.loadCollection(s, FloatArray.fill(kernelSize, {scale.rand2})),\n Buffer.loadCollection(s, FloatArray.fill(kernelSize, {scale.rand2})),\n Buffer.loadCollection(\n// …\n```"}, {"role": "assistant", "content": "hand code a mono signal to a decorrelated soundfield in B-format NOTE: the demonstrated kernel is not ideal for this task (AtkKernelConv: Kernel convolution from the Ambisonic Toolkit (ATK))"}]} +{"conversations": [{"role": "user", "content": "What does `OpenBCI.buffer` do?"}, {"role": "assistant", "content": "an Array of n-channel Lists acting as an internal buffer. the buffer is rotated one step each time a new datapoint arrives (each subclass call #-updateBuffer). the buffer is mainly useful for filtering. set its size with"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for attempt at emulating a breathing sound. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\n//s.options.memSize_(64000);\nTempoClock.tempo_(1.0);\n\ns.waitForBoot({\n SynthDef(\\breathe_in, {\n | out = 0, gate = 1, in1=0.11, in2=0.63, in3=0.18, amdb= -10 |\n var menv = EnvGen.kr(Env.new([0,1,1,0],[in1, in2, in3], curve:'lin'),\n gate,\n doneAction:Done.freeSelf);\n var noise = WhiteNoise.ar(amdb.dbamp);\n var f1 = BPF.ar(in:noise, freq:5790, rq:0.1, mul:-29.dbamp);\n var f2 = BPF.ar(in:noise, freq:3400, rq:0.2, mul:-16.dbamp);\n var f3 = BPF.ar(in:noise, freq:1990, rq:0.1, mul:-23.dbamp);\n var f4 = BPF.ar(in:noise, freq:1250, rq:0.1, mul:-26.dbamp);\n Out.ar(out, menv*(f1+f2+f3+f4)!2);\n }).add;\n\n SynthDef(\\breathe_out, {\n | out = 0, gate=1, out1=0.343, out2=0.387, amdb= -4.33 |\n var menv = EnvGen.kr(Env.new([0, 1, 0], [out1,out2], curve:'lin'),\n gate,\n doneAction:Done.freeSelf);\n var noise = WhiteNoise.ar(amdb.dbamp);\n var f1 = BPF.ar(in:noise, freq:2290, rq:0.1, mul:-17.dbamp);\n var f2 = BPF.ar(in:noise, freq:1290, rq:0.1, mul:-19.dbamp);\n var f3 = BPF.ar(in:noise, freq:490, rq:0.1, mul:-18.dbamp);\n Out.ar(out, menv*(f1+f2+f3)!2);\n }).add;\n\n\n s.sync;\n\n fork {\n 50.do({\n var in1 = 0.11.rrand(0.22);\n var in2 = 0.6.rrand(0.8);\n var in3 = 0.16.rrand(0.30);\n var pausein = 0.11.rrand(0.20);\n var out1 = 0.30.rrand(0.50);\n var out2 = 0.36.rrand(0.50);\n var pauseout = 0.11.rrand(0.20);\n var amdb = -10.0.rrand(-14.0);\n var amdb2 = amdb/2.5;\n //(\"in1: \" ++ in1 ++ \" in2: \" ++ in2 ++ \" in3: \" ++ in3 ++ \" pausein: \" ++ pausein ++ \" out1: \" ++ out1 ++ \" out2: \" ++ out2 + \" pauseout: \" ++ pauseout).postln;\n Synth(\\breathe_in, [\\in1, in1, \\in2, in2, \\in3, in3, \\amdb, amdb]);\n (in1+in2+in3+pausein).wait;\n Synth(\\breathe_out, [\\out1, out1, \\out2, out2, \\amdb, amdb2]);\n (out1+out2+pauseout).wait;\n });\n };\n\n});\n);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Lag3`."}, {"role": "assistant", "content": "```supercollider\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n Lag3.kr( // lag the modulator\n LFPulse.kr(4, 0, 0.5, 50, 400), // frequency modulator\n Line.kr(0, 1, 15) // modulate lag time\n ),\n 0, // phase\n 0.3 // sine amplitude\n )\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `BufCombN` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// These examples compare the variants, so that you can hear the difference in interpolation\n\n// allocate buffer\nb = Buffer.alloc(s, 44100, 1);\n\n// Comb used as a resonator. The resonant fundamental is equal to\n// reciprocal of the delay time.\n{ BufCombN.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ BufCombL.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ BufCombC.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// with negative feedback:\n{ BufCombN.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ BufCombL.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ BufCombC.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n// used as an echo.\n{ BufCombL.ar(b.bufnum, Decay.ar(Dust.ar(1, 0.5), 0.2, WhiteNoise.ar), 0.2, 3) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "I made a synth and I hear nothing. Where do I start?"}, {"role": "assistant", "content": "Start with the node tree, not the code: evaluate `s.plotTree`. If your Synth is not there, it never started or it already freed itself; if it is there, the problem is in the signal. Which of the two do you see?"}, {"role": "user", "content": "It's in the tree."}, {"role": "assistant", "content": "Then the node lives and the signal is being lost. Check three things in order: does the SynthDef reach `Out.ar(0, ...)` with bus 0; is any `amp`/`mul` zero; and is a filter closed, e.g. `LPF.ar(sig, 50)` on a 440 Hz sine. Paste the SynthDef and I will read it."}, {"role": "user", "content": "SynthDef(\\x, { |out = 0| Out.ar(out, LPF.ar(Saw.ar(60), 80) * 0.1) }).add; Synth(\\x, [\\out, 2]);"}, {"role": "assistant", "content": "Two things. You wrote a low-pass at 80 Hz over a 60 Hz saw, which leaves almost nothing above the fundamental — the patch is nearly a sine at 60 Hz at very low level. And you passed `\\out, 2`, so it is going to bus 2, not the master. Try `Synth(\\x)` with the default out and a cutoff of 800:\n\n```supercollider\nSynthDef(\\x, { |out = 0, cutoff = 800| Out.ar(out, LPF.ar(Saw.ar(60), cutoff) * 0.1) }).add;\nSynth(\\x);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `FFTSubbandPower.kr` do? What arguments does it take?"}, {"role": "assistant", "content": "Spectral power, divided into subbands Arguments: chain; cutfreqs — must be an array of frequencies. For example, to divide a 44100Hz signal into three subbands we might specify [ 5512, 11025 ] as the cutfreqs, giving subbands of 0-5512Hz, 5512-11025Hz, and 11025-22050Hz. (Frequencies above the Nyquist frequency are not included.); square — performs the same role as in FFTPower.; scalemode — specifies how the band powers are scaled: Mode 1 (default) is to scale the same way as FFTPower does (according to the total number of bins in the FFT). This means that if you add up the power from the various bins, you'll get the same result as if you'd just used FFTPower. This gives the best impre. Returns: #[power1, power2, ... powerN+1]"}]} +{"conversations": [{"role": "user", "content": "What is `LagControl` in SuperCollider?"}, {"role": "assistant", "content": "LagControl — Lagged control input `Control` ugen with fixed-time lags. Category: UGens > Synth control."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Duty`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// this is useful when two UGens need to be called, but only one of their outputs is needed\n(\n{\n var a, b, c;\n a = Dseq([1, 2, 3, 4], inf).dpoll(\"a\");\n b = Dseq([1955, 1952, 1823, 1452], inf).dpoll(\"b\");\n c = (a a .\n\n~name = \\test_noise_burst;\n~description = \"A short burst of enveloped noise that goes well with Patterns\";\n~channelLayout = \\mono;\n\n~function = { arg amp=1, trimDB = 0, attack = 0.01, release = 0.3;\n var env;\n env = EnvGen.ar(Env.perc(attack, release, 0.5), doneAction: Done.freeSelf);\n trimDB.dbamp*amp*PinkNoise.ar(1);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n// Simple polling of median values - you could do this without a UGen!\nx = {|val=1, t_trig=0| MedianTriggered.kr(val, t_trig, 3).poll(t_trig, \"Median of recent 3 values\"); }.play;\nx.set(\\val, 10.rand.postln, \\t_trig, 1); // Execute this repeatedly\n\nx.free;\n\n// Same but with 4 values - note the way medians behave with even-sized sets\nx = {|val=1, t_trig=0| MedianTriggered.kr(val, t_trig, 4).poll(t_trig, \"Median of recent 4 values\"); }.play;\nx.set(\\val, 10.rand.postln, \\t_tr\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n// Simple polling of median values - you could do this without a UGen!\nx = {|val=1, t_trig=0| MedianTriggered.kr(val, t_trig, 3).poll(t_trig, \"Median of recent 3 values\"); }.play;\nx.set(\\val, 10.rand.postln, \\t_trig, 1); // Execute this repeatedly\n\nx.free;\n\n// Same but with 4 values - note the way medians behave with even-sized sets\nx = {|val=1, t_trig=0| MedianTriggered.kr(val, t_trig, 4).poll(t_trig, \"Median of recent 4 values\"); }.play;\nx.set(\\val, 10.rand.postln, \\t_trig, 1); // Execute this repeatedly\n\nx.free;\n\n// Using it as an audio filter - compare the sounds of these:\nx = {WhiteNoise.ar(0.1)}.play;\nx.free;\nx = {MedianTriggered.ar(WhiteNoise.ar(0.1), 1, 3)}.play; // Note that Median.ar is more efficient for this kind of thing\nx.free;\nx = {MedianTriggered.ar(WhiteNoise.ar(0.1), 1, 11)}.play; // Note that Median.ar is more efficient for this kind of thing\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Limiter` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\n// example signal to process\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n z * 0.8\n}.play\n);\n\n(\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n [z, Limiter.ar(z, 0.4, 0.01)] * 0.5\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Class.help` do?"}, {"role": "assistant", "content": "Opens the help file for this Class if it exists. It may take a little while until the help window responds."}]} +{"conversations": [{"role": "user", "content": "What does `ScalarSpec.rate` do?"}, {"role": "assistant", "content": "datatype specifiying a \\scalar \"rate\" input or output"}]} +{"conversations": [{"role": "user", "content": "What does `ArrayedCollection.putEach` do?"}, {"role": "assistant", "content": "Put the values in the corresponding indices given by keys. If one of the two argument arrays is longer then it will wrap. `y = [0, 1, 2, 3, 4, 5, 6, 7, 8,"}]} +{"conversations": [{"role": "user", "content": "What does `PatternProxy.defaultQuant` do?"}, {"role": "assistant", "content": "set the default quantization value for the class. (default:"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `LFNoise1`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\nb = Bus.control(s, 1);\n\na = {\n var freq;\n freq = LFNoise1.kr(2, 600, 800);\n Out.kr(b, freq); // no need for Impulse here\n SinOsc.ar(freq, 0, 0.3) ! 2\n}.play;\n\nl = List.new;\nr = fork { loop { l.add(b.getSynchronous); 0.1.wait } };\n\nr.stop;\na.free;\n\nl.array.plot; // to view the results graphically\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Here we start with initOutOffset = 0.5, fadeMode = 1 (step first),\n// channels with indices 0 and 4 (base tone and 5th partial) are equally weighted.\n\n(\nx = {\n var lfo = XLine.ar(1, 0.5, 60);\n DXMix.ar(\n Dseq([0, 4, 1, 5, 2, 6, 3, 7], inf),\n `(Saw.ar((1..8) * 70 * lfo, 0.075)),\n fadeTime: 0.1,\n stepTime: 2,\n fadeMode: 1,\n width: 3,\n maxWidth: 8,\n initOutOffset: 0.5\n ) ! 2\n}.play\n;\n\nx.release\n\n\n// overlap scheme with width = 3 and initOutOffset = 0.5:\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Here we start with initOutOffset = 0.5, fadeMode = 1 (step first),\n// channels with indices 0 and 4 (base tone and 5th partial) are equally weighted.\n\n(\nx = {\n var lfo = XLine.ar(1, 0.5, 60);\n DXMix.ar(\n Dseq([0, 4, 1, 5, 2, 6, 3, 7], inf),\n `(Saw.ar((1..8) * 70 * lfo, 0.075)),\n fadeTime: 0.1,\n stepTime: 2,\n fadeMode: 1,\n width: 3,\n maxWidth: 8,\n initOutOffset: 0.5\n ) ! 2\n}.play\n);\n\nx.release\n\n\n// overlap scheme with width = 3 and initOutOffset = 0.5:\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Klank`."}, {"role": "assistant", "content": "```supercollider\n(\n{\nKlank.ar([ // the multichannel-expansion\n `[[500, 1078, 1201.5, 1723], nil, [1, 1, 0.5, 0.3]], // left channel\n `[[700, 1071, 1053, 1723], nil, [1, 1, 1, 1]] // right channel\n ], Impulse.ar([1.5, 1.875], 0, 0.1))\n}.play\n);\n\n// expanding specs within the parameter array\n{ Klank.ar(`[[[800, 6000], 1071, [1153, 8000], 1723], nil, [1, 1, 1, 1]], Impulse.ar([2, 3], 0, 0.1)) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\ns.boot;\n\n(\nSynthDef(\"lazerdrone\", {\n var in, freq, hasFreq;\n\n \n in = SinOsc.ar(440 * LFSaw.kr(100, 1000));\n\n # freq, hasFreq = Pitch.kr(\n in,\n ampThreshold: 0.09,\n median: 1);\n freq = freq * hasFreq;\n //freq.poll;\n \n SinOsc.kr(freq).poll;\n \n Out.ar(0, in + \n SinOsc.ar(440, \n 0, \n Clip.kr(\n SinOsc.kr(freq), \n 0)\n )\n );\n}).play;\n)\n```"}, {"role": "assistant", "content": "A lazer sound then a drone with morse-code like bleeps. A byproduct of testing the triggering algorithm in the mono2eN SynthDef."}]} +{"conversations": [{"role": "user", "content": "What does `SequenceableCollection.editDistance` do? What arguments does it take?"}, {"role": "assistant", "content": "Returns the minimum number of changes to modify this `SequenceableCollection` into the other `SequenceableCollection`. A change can be: an addition, a deletion, or a substitution. This is known as the Levenshtein Distance and is implemented in SuperCollider using the Wagner–Fischer algorithm. The default comparison uses identity - see Object#-== and Object#-=== Where both arrays are raw arrays (String, Int16Array, Int32Array, FloatArray etc., or any derived classes), like Arguments: other — The `SequenceableCollection` to compare against; compareFunc — An optional comparison function to use for each element. It will be provided two arguments, and the function must return a boolean as to whether or not they are the same. Default value is `nil`, which will use identity (not equality) to compare elements. `[1, 2, 3, 4].editDistance([2, 3, 4, 5], { |a."}]} +{"conversations": [{"role": "user", "content": "What is `Pn` in SuperCollider?"}, {"role": "assistant", "content": "Pn — repeatedly embed a pattern Category: Streams-Patterns-Events > Patterns > Repetition."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Splay` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\nx = { |spread = 1, level = 0.1, center = 0|\n var n = 20;\n var snd = Splay.ar(LFPulse.ar({ 100.exprand(2000) } ! n).range(-1, 1),\n spread, level, center);\n Peak.ar(snd, 0.01, 1).ampdb.poll(1);\n snd\n}.play;\n);\n\n// at full spread, level -20, pan to center:\n// peak is higher at -11 db\nx.set(\\spread, 1, \\center, 0);\n// with no spread, i.e. all panned center, slightly higher -10\nx.set(\\spread, 0, \\center, 0);\n// worst case: no spread, pan full left: -8db\nx.set(\\spread, 0, \\center, -1); // -8\n```"}]} +{"conversations": [{"role": "user", "content": "Write a random pentatonic melody that plays by itself."}, {"role": "assistant", "content": "Pick degrees from a pentatonic scale; `\\scale` and `\\root` define the pitch space, and `\\degree`\npicks within it.\n\n```supercollider\n(\nPbind(\n \\instrument, \\default,\n \\scale, Scale.minorPentatonic,\n \\root, 3,\n \\degree, Pwhite(0, 9, inf),\n \\octave, 5,\n \\dur, Pwhite(0.12, 0.28, inf),\n \\amp, 0.2,\n \\legato, 0.8\n).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `DPW4Saw.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Sawtooth via 4th order differerentiated polynomial waveform Arguments: freq."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PulseCount`."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\"help-PulseCount\", { |out = 0|\n Out.ar(out,\n SinOsc.ar(\n PulseCount.ar(Impulse.ar(10), Impulse.ar(0.4)) * 200,\n 0, 0.05\n )\n )\n}).play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Plotter.editFunc` do?"}, {"role": "assistant", "content": "Supply a function which is evaluated when editing data. The function is called with the arguments: `plotter`, `plotIndex`, `index`, `val`, `x`,"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// note the pops at the beginning of signal due to lack of lookahead\n{\n var z;\n\n // signal (clean)\n z = Decay2.ar(\n Impulse.ar(8, 0, LFSaw.kr(0.3, 1, -0.3, 0.3)),\n 0.001,\n 0.3\n )\n * Mix.ar(Pulse.ar([80, 81], 0.3));\n\n // apply sustainer\n Compander.ar(z, z,\n thresh: MouseX.kr(0.1, 1),\n slopeBelow: 0.1,\n slopeAbove: 1,\n clampTime: 0.01,\n relaxTime: 0.01\n ) * 0.1\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// note the pops at the beginning of signal due to lack of lookahead\n{\n var z;\n\n // signal (clean)\n z = Decay2.ar(\n Impulse.ar(8, 0, LFSaw.kr(0.3, 1, -0.3, 0.3)),\n 0.001,\n 0.3\n )\n * Mix.ar(Pulse.ar([80, 81], 0.3));\n\n // apply sustainer\n Compander.ar(z, z,\n thresh: MouseX.kr(0.1, 1),\n slopeBelow: 0.1,\n slopeAbove: 1,\n clampTime: 0.01,\n relaxTime: 0.01\n ) * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "List of exit codes?"}, {"role": "assistant", "content": "SuperCollider forum — List of exit codes?\n\n7068696c:\n\n```supercollider\no = s.options;\no.inDevice = nil;\no.outDevice = \"ASIO : ASIO4ALL\";\n```\n\nHmmmm... In earlier SC versions, it wouldn’t have worked to have a nil input device in scsynth either (which is admittedly a problem for devices with no inputs). This was fixed in scsynth but it’s possible that it wasn’t fully fixed in supernova.\n\n@MarcinP – any thoughts about this? (I remember you worked on scsynth device selection but I don’t recall who ported that to supernova.)\n\nhjh"}]} +{"conversations": [{"role": "user", "content": "What does `UGen.prune` do?"}, {"role": "assistant", "content": "Limits the receiver range to one of the four clip modes, see `linlin`"}]} +{"conversations": [{"role": "user", "content": "What does `EZGui.alwaysOnTop` do? What arguments does it take?"}, {"role": "assistant", "content": "Makes the popup window always on top, if there is Arguments: bool — An Instance of Boolean. Default is false.."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `DiskIn`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n\n\n// create with cueSoundFile class method\nb = Buffer.cueSoundFile(s, ExampleFiles.apollo11, 0, 1);\nx = { DiskIn.ar(1, b) }.play;\nb.close; // must call close in between cueing\n// now use like named instance method, but different arguments\nb.cueSoundFile(ExampleFiles.apollo11);\n// have to do all this to clean up properly!\nx.free; b.close; b.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SimpleNumber.ibetaDerivative` do?"}, {"role": "assistant", "content": "Returns the partial derivative with respect to `x` of the incomplete beta function `ibeta(a, b,"}]} +{"conversations": [{"role": "user", "content": "What does `PIdev.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new PIdev Arguments: pattern — The source value pattern to start search from.; maxLookBack — Integer, the maximum lookback span. Fixed, defaults to 3.; loDev — Determines the current low deviation for the search. Defaults to -3.; hiDev — Determines the current high deviation for the search. Defaults to 3.; lookBack — Determines the current lookback span for avoiding repetitions. Can be modulated but must not exceed maxLookBack. If no value is passed, then maxLookBack is taken.; thr — Threshold for equality comparison. Can be modulated, defaults to 1e-3.; length — Number of repeats. Defaults to inf.."}]} +{"conversations": [{"role": "user", "content": "What does `Harmonics.formant` do?"}, {"role": "assistant", "content": "Create a formant like structure. `a.formant(6,"}]} +{"conversations": [{"role": "user", "content": "What does `LinearSpline.minMaxVal` do? What arguments does it take?"}, {"role": "assistant", "content": "returns the min and max val of all points in the given dimension. Note that with subclasses that have curvature the min max returns only the points' min and max and does not account for curvature that may result in values above or below that in the final Arguments: dim — The dimension. Returns: [minVal,maxVal]"}]} +{"conversations": [{"role": "user", "content": "What does `Dwhite.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Demand rate white noise random generator. Arguments: lo — Minimum value.; hi — Maximum value.; length — Number of values to create.."}]} +{"conversations": [{"role": "user", "content": "What does `DrawGrid.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Draws grid lines on a UserView for plotting Arguments: bounds — A Point or Rect describing the size and position of the grid within the parent view (not including any labels).; horzGrid — A grid lines object for the x-axis, instantiated via GridLines, or ControlSpec#-grid method, or `nil` (resulting in no grid lines).; vertGrid — A grid lines object for the y-axis, see horzGrid.. Returns: A `DrawGrid`."}]} +{"conversations": [{"role": "user", "content": "What happens when I call .play on a function?"}, {"role": "assistant", "content": "`.play` on a Function builds a SynthDef from the function body, adds it to the server under an anonymous name, and starts one Synth of it. You get back the Synth, so `x = { SinOsc.ar(440) * 0.1 }.play; x.free;` stops it. It is the fastest way to hear something, but it is not how you write a piece: nothing is named, nothing can be reused, and the definition is lost when the Synth is freed."}]} +{"conversations": [{"role": "user", "content": "What does `CXPlayerControl.stopToBundle` do? What arguments does it take?"}, {"role": "assistant", "content": "adapter class for JITLib to control players Arguments: bundle; fadeTime."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// example\n(\n{\n var trig = Impulse.kr(MouseX.kr(1, 100, 1));\n Ringz.ar(T2A.ar(trig), 800, 0.01) * 0.4\n}.play;\n);\n\n// compare with K2A\n(\n{\n var trig = Impulse.kr(200);\n [T2A.ar(trig), K2A.ar(trig)].lag(0.001)\n}.plot(10/200);\n);\n\n// removing jitter by randomising offset\n(\n{\n var trig = Impulse.kr(MouseX.kr(1, 100, 1));\n Ringz.ar(T2A.ar(trig, WhiteNoise.kr.range(0, s.options.blockSize - 1)), 800, 0.01)\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// example\n(\n{\n var trig = Impulse.kr(MouseX.kr(1, 100, 1));\n Ringz.ar(T2A.ar(trig), 800, 0.01) * 0.4\n}.play;\n);\n\n// compare with K2A\n(\n{\n var trig = Impulse.kr(200);\n [T2A.ar(trig), K2A.ar(trig)].lag(0.001)\n}.plot(10/200);\n);\n\n// removing jitter by randomising offset\n(\n{\n var trig = Impulse.kr(MouseX.kr(1, 100, 1));\n Ringz.ar(T2A.ar(trig, WhiteNoise.kr.range(0, s.options.blockSize - 1)), 800, 0.01) * 0.4\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pulse`."}, {"role": "assistant", "content": "```supercollider\n// modulate frequency\n{ Pulse.ar(XLine.kr(40, 4000, 6), 0.1, 0.2) }.play;\n\n// modulate pulse width\n{ Pulse.ar(200, SinOsc.kr(0.2).range(0.01, 0.99), 0.2) }.play;\n\n// two band limited square waves thru a resonant low pass filter\n{ RLPF.ar(Pulse.ar([100, 250], 0.5, 0.1), XLine.kr(8000, 400, 5), 0.05) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `MKtl.makeLookupName` do?"}, {"role": "assistant", "content": "make a lookupName for a device based on (typically) its protocol, id number and productName. `MKtl.makeLookupName(\\hid, 0, \"Run'N'Drive -"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\nb = Buffer.alloc(s, 512, 1);\nb.sine1(1.0 / [1, 2, 3, 4], true, true, true);\nx = { Osc.ar(b, 200, 0, 0.5) }.play;\n;\nx.free; b.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\nb = Buffer.alloc(s, 512, 1);\nb.sine1(1.0 / [1, 2, 3, 4], true, true, true);\nx = { Osc.ar(b, 200, 0, 0.5) }.play;\n);\nx.free; b.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n// given a simple instrument\nInstr(\\Pulse,{ arg freq=440.0,width=0.5,mul=0.1;\n Pulse.ar( freq, width, mul )\n});\n\n// a patch specifies inputs (arguments) to that instrument\np = Patch( \\Pulse, [ 300, 0.2, 0.1 ]);\n\n//the default server will be booted, the SynthDef written and loaded\np.play;\n\n);\n\np.stop;\n```"}, {"role": "assistant", "content": "given a simple instrument a patch specifies inputs (arguments) to that instrument (Patch: Pairs an Instr with inputs that that will be passed to the Instr)"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// where did I leave my keys?\n(\nvar n = 30, m = 5;\nNdef.clear(3);\nNdef.ar(\\x, n);\nNdef(\\y, { Splay.ar(Ndef.ar(\\x, m, LFNoise1.kr(1/m).range(0, n - m - 1))).clip2 * 0.5 }).play; \nNdef(\\x, { \n { \n var a = Ndef.ar(\\x, 1, LFNoise0.kr(Rand()) * Rand() + Rand() * n);\n a + 0.1 * SinOsc.ar(ExpRand(0.2, 1000)) \n } ! n\n}); \n);\n\n// where did I put my keys?\n(\nvar n = 30, m = 5;\nNdef.clear(3);\nNdef.ar(\\x, n);\nNdef(\\y, { Splay.ar(Ndef.ar(\\x, m, LFNoise1.kr(1/m).range(0, n - m - 1))).clip2 * 0.5 }).play; \nNdef(\\x, { \n {\n var a = Ndef.ar(\\x, 1, LFNoise0.kr(Rand()) * Rand() + Rand() * n);\n SinOsc.ar(ExpRand(0.2, 1000), a) \n } ! n\n}); \n)\n```"}, {"role": "assistant", "content": "Cross-tuning between multiple signal dimensions. The code is finished without listening."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Granular electromaton. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\nServer.local.waitForBoot({\n(\nz.free;\nz = Buffer.alloc(s, 512, 1);\nz.sine1(1.0 / [1, 2, 3, 4], true, true, true);\n\n fork( { loop {\n SynthDef(\"g1\",{ arg out=0,bufnum=0,dur=1,rate=1,pos=0,sdens=1,edens=1;\n var dens = Line.kr(sdens,edens,dur);\n var trig = [LFNoise0,SinOsc,Impulse,LFPulse,LFSaw].choose.ar(Line.kr(sdens,edens,dur));\n //var env = EnvGen.kr(Env.perc(0.0001.rrand(0.1),dur*0.5.rrand(2)),doneAction:2);\n var env = EnvGen.kr(Env.perc(0.0001.rrand(0.1),dur*(0.5.rrand(4))),doneAction:2);\n Out.ar(out,\n GrainBuf.ar(2,trig,1/dens,bufnum,rate,pos)*env;\n )\n }).add();\n [1,2,4,8,16,32].choose.postln.wait;\n }\n }\n );\n\n\na = Pbind(\\instrument,\\g1,\\dur,Pseq([Pseq([0.25],32),Pseq([0.25,0.125,0.125],32),Pseq([0.125],32)],inf),\\sdens,Pseq([9000,1000,500]/10,inf),\\edens,Prand([Pseq([9000,1000,500]/10,4),Pseq([1],1)],inf),\\rate,Pfunc({-10.0.rrand(10)}),\\pos,Pfunc({1.0.rand}),\\bufnum,z.bufnum);\nb = Pbind(\\instrument,\\g1,\\dur,Pseq([4],inf),\\sdens,Pseq([9000,1000,500]/100,inf),\\edens,Prand([Pseq([9000,1000,500]/10,1),Pseq([1],3)],inf),\\rate,Pfunc({-10.0.rrand(10)}),\\pos,Pfunc({-10.0.rrand(10)}),\\bufnum,z.bufnum);\nc = Pbind(\\instrument,\\g1,\\dur,Pseq([4/3],inf),\\sdens,Pseq([9000,1000,500,25],inf),\\edens,Prand([Pseq([9000,1000,500,25],1),Pseq([1],4)],inf),\\rate,Pfunc({-100.0.rrand(100)}),\\pos,Pfunc({-10.0.rrand(10)}),\\bufnum,z.bufnum);\n\n\na =a.play;\nb =b.play;\nc =c.play;\n\n)\n});\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is the difference between Env and EnvGen?"}, {"role": "assistant", "content": "Env is a language-side description: a list of levels, times and a curve, e.g. `Env.perc(0.01, 1)` or `Env.adsr(0.01, 0.1, 0.5, 0.8)`. EnvGen is the UGen that plays it on the server: `EnvGen.kr(env, gate, doneAction: 2)`. The same Env can be played by many EnvGens, and Env also has language-side uses such as `.asStream` inside Patterns and `.plot`."}]} +{"conversations": [{"role": "user", "content": "What is `UserView` in SuperCollider?"}, {"role": "assistant", "content": "UserView — A custom drawn view using Pen An empty view on which you can draw using the Pen class. Category: GUI > Views."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// compares a 441 Hz sine tone derived from sample rate (44100 * 0.01, left)\n// with a 440 Hz tone (right), resulting in a 1 Hz beating\n(\n{\n var freq;\n freq = [SampleRate.ir * 0.01, 440];\n SinOsc.ar(freq, 0, 0.1)\n}.play;\n)\n```"}, {"role": "assistant", "content": "compares a 441 Hz sine tone derived from sample rate (44100 * 0.01, left) with a 440 Hz tone (right), resulting in a 1 Hz beating (SampleRate: Server sample rate.)"}]} +{"conversations": [{"role": "user", "content": "What is `AnalyseEventsDatabase` in SuperCollider?"}, {"role": "assistant", "content": "AnalyseEventsDatabase — Records events found by the AnalyseEvents2 UGen Database that will store any events discovered in an audio signal using the AnalyseEvents UGen. This works on-the-fly, and you can switch the target input bus. Category: Libraries > BBCut > Machine listening."}]} +{"conversations": [{"role": "user", "content": "Who are you?"}, {"role": "assistant", "content": "I am sc-mind, a 198M MiniMind-3-MoE trained from scratch on the SuperCollider source and help corpus. I write and explain SuperCollider: SynthDefs, UGens, Patterns, Ndef, the language/server split, and how to make sound that is not silence."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for sound of an alien weapon firing. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"raygun\", {arg amp = 0.5, sinfreq = 1000, glissf = 0.001, att = 0.01, rel = 0.9;\n var gliss = XLine.kr(sinfreq, sinfreq*glissf, rel);\n var snd = SinOsc.ar(gliss);\n var env = EnvGen.kr(Env.perc(att, rel), doneAction: 2);\n snd = snd * env * amp;\n Out.ar(0, snd);\n}).add;\n);\n\n(\nPbind(\n \\instrument, \"raygun\",\n \\dur, Pseq([0.75,0.75,0.75,0.75,0.25,0.25,0.25]*0.5, inf),\n \\amp, 0.4\n).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "How should I organise a SuperCollider project on disk?"}, {"role": "assistant", "content": "One folder per piece, with a fixed shape:\n\n```text\nmy-piece/\n synthdefs.scd // only SynthDef(...).add, loaded first\n material.scd // buffers, samples, scales\n piece.scd // the performance: Tdefs, Pbinds, Ndefs\n README.md // tempo, required samples, how to run it\n```\n\nThen the workflow is: open `synthdefs.scd`, Ctrl+A Ctrl+Enter to load it, load `material.scd`, and work in\n`piece.scd`. Keeping definitions out of the performance file is what makes a reboot survivable and a piece\nre-runnable six months later."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\nx = SynthDef(\"help-node-set\", { |freq = 440, out = 0|\n Out.ar(out, SinOsc.ar(freq, 0, 0.1))\n}).play\n);\nx.set(\\freq, 880, \\out, 1); // two pairs\nx.set(0, 660, 1, 0; // freq is the first argument, so it's index is 0. out is index 1.\nx.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\nx = SynthDef(\"help-node-set\", { |freq = 440, out = 0|\n Out.ar(out, SinOsc.ar(freq, 0, 0.1))\n}).play\n);\nx.set(\\freq, 880, \\out, 1); // two pairs\nx.set(0, 660, 1, 0); // freq is the first argument, so it's index is 0. out is index 1.\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Env`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var env = Env([0.0, 0.5, 0.0, 1.0, 0.9, 0.0], [0.05, 0.1, 0.01, 1.0, 1.5], -4);\n var envgen = EnvGen.ar(env, doneAction: Done.freeSelf);\n env.plot;\n SinOsc.ar(\n envgen * 1000 + 440\n ) * envgen * 0.1\n}.play\n);\n```"}]} +{"conversations": [{"role": "user", "content": "I get 'syntax error, unexpected NAME' on a block that looks fine."}, {"role": "assistant", "content": "Almost always a missing semicolon between two statements — SuperCollider does not insert them.\n\n```supercollider\n// broken: two statements, no separator\n{ var sig = SinOsc.ar(440) sig = sig * 0.1; sig }.play\n```\n\n```supercollider\n// fixed\n{ var sig = SinOsc.ar(440); sig = sig * 0.1; sig }.play\n```\nThe error points at the second statement, not at the missing semicolon before it, which is why it looks\nfine. If it is not a semicolon, count the brackets: `.ar(` open, `)` closed."}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nNdef(\\x, { Saw.ar(110) * 0.1 }).play;\nNdef(\\x)[1] = \\filter -> { |in| RLPF.ar(in, 800, 0.4) };\n```"}, {"role": "assistant", "content": "Two nodes in one named proxy: a saw source, then a resonant low-pass filter fed by it.\n\n`Ndef(\\x, { ... })` defines the first node of the chain and `.play` starts it. `Ndef(\\x)[1] = \\filter ->`\ninserts a second node at index 1; the `\\filter` key says 'make this node an effect that receives the\nprevious node's output as `in`'. So the patch is `Saw -> RLPF -> out`. Because it is an Ndef, calling\n`Ndef(\\x, { ... })` again replaces the source with a crossfade instead of restarting, and\n`Ndef(\\x).stop` removes the whole chain."}]} +{"conversations": [{"role": "user", "content": "What does `String.unixCmd` do? What arguments does it take?"}, {"role": "assistant", "content": "Executes an operating system command asynchronously using the standard shell (`sh` on *nix, `cmd` on Windows). If you want to run a command without a shell, please use Arguments: action — A Function that is called when the process has exited. It is passed two arguments: the exit code and pid of the exited process.; postOutput — A Boolean that controls whether or not the output of the process is displayed in the post window.. Returns: An Integer - the pid of the shell running the command, not of the command itself (see note below for exceptions). To get the actual pid of the command, use SequenceableCollection#-unixCmd, which does "}]} +{"conversations": [{"role": "user", "content": "What is `DigitalIO`?"}, {"role": "assistant", "content": "DigitalIO — Read or write data to a digital pin"}, {"role": "user", "content": "What does `DigitalIO.ar` do?"}, {"role": "assistant", "content": "The output of this UGen is always the last value read when the digital pin was an input."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// write a sine oscillator's output to a pin, and read the pin value at other times\n\n(\nSynthDef(\"help-DigitalIO\", { |out = 0|\n DigitalIO.ar(0, SinOsc.ar(10), LFPulse.kr(0.1)).poll;\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for Interpolate between Envs with Pseg: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\sin, { arg out=0, gate=1, amp=0.1, pan=0, freq=200;\n var sig;\n sig = SinOsc.ar(freq);\n sig = sig * EnvGen.kr(\\adsr.kr(Env.adsr(0.1,0.1,0.8,0.1)), gate, doneAction:2);\n sig = Pan2.ar(sig, pan, amp);\n Out.ar(out, sig);\n}).add;\n);\n\n(\n// sequence Envs\n// need [] else it is inlined or does pattern multichannel expansion\nPdef(\\demo, \n Pbind(\n \\instrument, \\sin,\n \\degree, Pseq([0, Pwhite(0,7,1)],inf),\n \\legato, 0.5,\n \\adsr, Pseq([\n [ Env.adsr(1.1,0.1,0.8,1.01) ],\n [ Env.adsr(0.01,0.1,0.8,0.01) ],\n [ Env.adsr(0.01,1.1,0.3,0.01) ],\n ],inf),\n )\n).play;\n);\n\n(\n// interpolate using Pseg\n// need .asArray\nPdef(\\demo, \n Pbind(\n \\instrument, \\sin,\n \\degree, Pseq([0, Pwhite(0,7,1)],inf),\n \\legato, 0.5,\n \\adsr, Pseg(Pseq([\n [ Env.adsr(1.1,0.1,0.8,1.01).asArray ],\n [ Env.adsr(0.01,0.1,0.8,0.01).asArray ],\n [ Env.adsr(0.01,1.1,0.3,0.01).asArray ],\n ],inf),8),\n )\n).play;\n);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Array.newClear` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a new array with all slots filled with Arguments: indexedSize — The size of the array.."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n var gspring;\n gspring = { |freq|\n var delay, sinc, env, line, impul;\n\n delay = freq.reciprocal;\n impul = Impulse.ar(0);\n env = Env.perc(0.001, 0.01).ar;\n line = Line.ar(1000, 50, 0.01 );\n sinc = SinOsc.ar(line);\n\n Pluck.ar( sinc * env, impul, delay, delay, 5, 0.5);\n };\n\n\nSynthDef.new('eguitar',\n { arg amp=1, freq=150, out_bus=0, pan=0;\n\n var snd;\n\n snd = gspring.value(freq-50) +\n gspring.value(freq) +\n gspring.value(freq+50);\n\n snd = (snd * 32.dbamp).tanh;\n snd = RLPF.ar(snd, 2800+freq, 0.5);\n snd = (snd * 32.dbamp).tanh;\n snd = RLPF.ar(snd, 300+freq, 0.5);\n snd = (snd * 32.dbamp).tanh;\n\n snd * -20.dbamp;\n\n Out.ar(out_bus, snd );\n}).add\n);\n\nSynth('eguitar', [freq: 360]);\n```"}, {"role": "assistant", "content": "just a very limited attempt for reference purpose of a hoped for eguitar synth ´\r\nbased on https://sccode.org/1-5aC#c982."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// the following two lines produce equivalent results\n{ SinOsc.ar(440, 0, 0.3) }.play(fadeTime: 0.0);\nSynthDef(\\help_FuncPlay, { Out.ar(0, SinOsc.ar(440, 0, 0.3)) }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// the following two lines produce equivalent results\n{ SinOsc.ar(440, 0, 0.3) }.play(fadeTime: 0.0);\nSynthDef(\\help_FuncPlay, { Out.ar(0, SinOsc.ar(440, 0, 0.3)) }).play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `OneZero`."}, {"role": "assistant", "content": "```supercollider\n{ OneZero.ar(WhiteNoise.ar(0.5), 0.5) }.play\n\n{ OneZero.ar(WhiteNoise.ar(0.5), -0.5) }.play\n\n{ OneZero.ar(WhiteNoise.ar(0.5), Line.kr(-0.5, 0.5, 10)) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `Dust2` in SuperCollider briefly."}, {"role": "assistant", "content": "Dust2 — Random impulses. Generates random impulses from -1 to +1. Category: UGens > Generators > Stochastic."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LastValue`."}, {"role": "assistant", "content": "```supercollider\nd = { |freq = 440| SinOsc.ar(LastValue.ar(freq, 20), 0, 0.2) }.play;\n\nd.set(\\freq, 400);\nd.set(\\freq, 200);\nd.set(\\freq, 670);\nd.set(\\freq, 680);\nd.set(\\freq, 695);\nd.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n~resize_enveloppe = { | levels, times |\n var reverted_levels, index;\n index = 0;\n reverted_levels = levels.reverse;\n while( { reverted_levels[index] == 0 && reverted_levels[index+1] == 0 }, { times[ times.size - 1 - index] = 0.01; index = index + 1 } );\n};\n)\n```"}, {"role": "assistant", "content": "Enveloppes sizes are fixed. This means that if enveloppe's levels are equals to [ 1, 0, 0, 0, 0, 0, 0, 0 ] and times are equals to [ 1, 1, 1, 1, 1, 1, 1, 1 ], the synth UGens will take resources 8 seconds but will only be audible 1 second. To avoid this, passing both the levels and the times to this function will detect when the sound stops playing and will reduce the \"silence\" times to 0.01s, thu."}]} +{"conversations": [{"role": "user", "content": "What does `BufMax.kr` do? What arguments does it take?"}, {"role": "assistant", "content": "detect the largest value (and its position) in an array of UGens Arguments: bufnum; gate — You don't need to make use of the gate control: if you do use it, the calculation is only performed when gate>0.. Returns: # val, index"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Routine` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// SynthDefs on the fly\ns.boot;\n(\nt = TempoClock.new;\nr = Routine.new({\n 10.do({\n // could be done with an argument instead of a new def, but proves the point\n SynthDef(\"help-EnvGen\" ++ i, { arg out = 0;\n Out.ar(\n out,\n EnvGen.kr(Env.perc, 1.0, doneAction: Done.freeSelf)\n * SinOsc.ar(100 + (100 * t.elapsedBeats), 0, 0.1)\n )\n }).play(s);\n 1.yield;\n });\n}).play(t); // Note the alternative syntax: Routine.play(aClock)\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Pfsm` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n(\na = Pfsm([\n #[0, 1],\n 67, #[0, 0, 3],\n 72, #[2],\n 73, #[0, 2],\n Pseq([74, 75, 76, 77]), #[2, 3, 3],\n nil, nil\n ], inf).asStream;\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, a.next.midicps]);\n 0.1.wait;\n })\n}).play;\n);\n\n(\nPfsm([\n #[5, 6, 7], // entry states\n\n // e1 (== state 0)\n Pbind(\\dur, Pseq([1/8, 3/8]), \\midinote, Pseq([86, 75])),\n // #[1], // as given in CMJ\n // my de-boredom-ated version..\n #[1, 1, 1, 1, 1, 1, 1, 8],\n // e2 (== state 1)\n Pbind(\\dur, 1/2, \\midinote, Pseq([69])),\n #[0, 1],\n // e3 (== state 2)\n Pbind(\\dur, 1/3, \\midinote, Pseq([55, 60, 66])),\n #[0, 1, 2, 2, 2, 2, 3, 3, 3, 3],\n // e4 (== state 3)\n Pbind(\\dur, 1/4, \\midinote, Pseq([81, 80, 77, 76])),\n #[1, 4, 4, 4, 4],\n // e5 (== state 4)\n Pbind(\\dur, Pseq([1, 2/3, 2/3, 2/3, 1]), \\midinote, Pseq([\\, 70, 70, 70, \\])),\n #[2, 3],\n // e6 (== state 5)\n Pbind(\\dur, 1/4, \\midinote, Pseq([59, 61])),\n #[0, 2, 4, 5, 5, 5, 5, 5, 5, 5],\n // e7 (== state 6)\n Pbind(\\dur, 1/4, \\midinote, Pseq([87, 88], 2)),\n #[4, 4, 4, 4, 6, 6, 6, 7, 7, 7],\n // e8 (== state 7)\n Pbind(\\dur, 1, \\midinote, Pseq([56])),\n #[1, 3, 6, 6, 6],\n // terminal state\n nil, nil\n]).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "What does `EventShortcuts.makeCurrent` do? What arguments does it take?"}, {"role": "assistant", "content": "Makes the shortcut dictionary of that name current (if Arguments: name — Symbol or String.."}]} -{"conversations": [{"role": "user", "content": "What is `AbstractSinglePlayerEffect` in SuperCollider?"}, {"role": "assistant", "content": "AbstractSinglePlayerEffect — base class for players that apply effects to a single input player Category: Libraries > crucial > Players > abstract."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `SortedList`."}, {"role": "assistant", "content": "```supercollider\nSortedList[1, 2, 5, 6].add(4).postln;\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for reflection on seasonal change )."}, {"role": "assistant", "content": "```supercollider\n(\n{ \n LPF.ar(\n DynKlank.ar(\n `[[900, 971, 1153, 1823, 1401], nil, [\n SinOsc.kr(0.2).range(0.1,1), \n SinOsc.kr(0.6).range(0.1,1), \n SinOsc.kr(0.8).range(0.1,1), \n SinOsc.kr(1.2).range(0.1,1), \n SinOsc.kr(2).range(0.1,1)]\n ], \n Limiter.ar(Dust.ar(2, 0.65) + Impulse.ar(1,0,0.9))\n )\n ) ! 2 \n}.play;\n{ \n Pan2.ar(\n DynKlank.ar(`[[800, 1071, 1353, 723 + SinOsc.ar(SinOsc.ar(0.2).range(0, 10)).range(0,330)], nil, [1, 1, 0.5, 1]], PinkNoise.ar(0.007)),\n TRand.kr(-1, 1, trig: Pulse.ar(10))\n )\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Midterm Q1 (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef( \"pulsey\",{arg freq, amp;\n var env, snd;\n env = Env.perc(attackTime: 0.2,\n releaseTime: 4,\n level: amp).kr(doneAction:2);\n snd = Pulse.ar(\n freq: freq*LFNoise2.kr([4, 5, 7]).range(0.988, 1.011),\n mul:env);\n snd = LPF.ar(in: snd, freq: 1000);\n snd = Splay.ar(snd);\n Out.ar(0, snd);\n\n\n}).add;\n);\n\n(\nm = [72, 79, 77, 79, 82, 79, 87, 86, 84, 82, 84, 79];\n\n\nPbind(\n \\instrument, \"pulsey\",\n \\midinote, Pseq(m, inf),\n \\dur, Pseq([Pn(0.5, 5), 1.5], inf),\n \\amp, Pwhite(0.15, 0.2)\n).play;\n\n\nPbind(\n \\instrument, \"pulsey\",\n \\midinote, Pseq(m.reverse, inf),\n \\dur, Pseq([Pn(0.5, 5), 1.5], inf),\n \\ctranspose, Pwrand([-12, -7, -24], [0.8, 0.1, 0.1], inf),\n \\amp, 0.08,\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Ndef`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\nNdef(\\a).play; // play to hardware output.\nNdef(\\a).fadeTime = 2; // fadeTime specifies crossfade\n// set the source\nNdef(\\a, { SinOsc.ar([350, 351.3], 0, 0.2) });\nNdef(\\a, { Pulse.ar([350, 351.3] / 4, 0.4, 0.2) });\nNdef(\\a, Pbind(\\dur, 0.03, \\freq, Pbrown(0, 1, 0.1, inf).linexp(0, 1, 200, 350)));\n\nNdef(\\a, { Ringz.ar(Ndef.ar(\\b), [350, 351.3] * 2, 0.4) });\nNdef(\\b, { Impulse.ar([5, 7]/2, [0, 0.5], 0.15) });\n\nNdef.clear(3); // clear all after 3 seconds\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// hear the difference, LinPan having a slight drop in the middle...\n{ LinPan2.ar(SinOsc.ar(440), Line.kr(-1, 1, 5)) }.play\n\n// ... whereas Pan2 is more smooth\n{ Pan2.ar(SinOsc.ar(440), Line.kr(-1, 1, 5)) }.play\n\n// other examples\n{ Pan2.ar(PinkNoise.ar(0.4), FSinOsc.kr(2), 0.3 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// hear the difference, LinPan having a slight drop in the middle...\n{ LinPan2.ar(SinOsc.ar(440), Line.kr(-1, 1, 5)) }.play\n\n// ... whereas Pan2 is more smooth\n{ Pan2.ar(SinOsc.ar(440), Line.kr(-1, 1, 5)) }.play\n\n// other examples\n{ Pan2.ar(PinkNoise.ar(0.4), FSinOsc.kr(2), 0.3) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SimpleNumber.sign` do?"}, {"role": "assistant", "content": "one-dimensional value Returns: Answer -1 if negative, +1 if positive or 0 if zero."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ PinkNoise.ar(1) * Line.kr(1, 0, 2, doneAction: Done.freeSelf }.play.onFree { \"done\".postln };\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ PinkNoise.ar(1) * Line.kr(1, 0, 2, doneAction: Done.freeSelf) }.play.onFree { \"done\".postln };\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Here we start with initOutOffset = 0.5, fadeMode = 1 (step first),\n// channels with indices 0 and 4 (base tone and 5th partial) are equally weighted.\n\n(\nx = {\n var lfo = XLine.ar(1, 0.5, 60);\n DXMix.ar(\n Dseq([0, 4, 1, 5, 2, 6, 3, 7], inf),\n `(Saw.ar((1..8) * 70 * lfo, 0.075)),\n fadeTime: 0.1,\n stepTime: 2,\n fadeMode: 1,\n width: 3,\n maxWidth: 8,\n initOutOffset: 0.5\n ) ! 2\n}.play\n;\n\nx.release\n\n\n// overlap scheme with width = 3 and initOutOffset = 0.5:\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Here we start with initOutOffset = 0.5, fadeMode = 1 (step first),\n// channels with indices 0 and 4 (base tone and 5th partial) are equally weighted.\n\n(\nx = {\n var lfo = XLine.ar(1, 0.5, 60);\n DXMix.ar(\n Dseq([0, 4, 1, 5, 2, 6, 3, 7], inf),\n `(Saw.ar((1..8) * 70 * lfo, 0.075)),\n fadeTime: 0.1,\n stepTime: 2,\n fadeMode: 1,\n width: 3,\n maxWidth: 8,\n initOutOffset: 0.5\n ) ! 2\n}.play\n);\n\nx.release\n\n\n// overlap scheme with width = 3 and initOutOffset = 0.5:\n```"}]} +{"conversations": [{"role": "user", "content": "What does `PLFNoise2.new` do? What arguments does it take?"}, {"role": "assistant", "content": "UGenPatterns quark library Arguments: freq; mul; add; length — Number of values produced.."}]} +{"conversations": [{"role": "user", "content": "What does `Sieve.==` do? What arguments does it take?"}, {"role": "assistant", "content": "Equality check. Sieves of different mode are equal iff the lists resulting from conversion are Arguments: that — Object to compare.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// a stereo signal, both channels at 0dB\n{ [SinOsc.ar(440), SinOsc.ar(440)] }.play\n\n// using Balance on a stereo signal with the position parameter at 0, effectively the same sound but both channels at -3dB\n{ Balance2.ar(SinOsc.ar(440), SinOsc.ar(440), 0) }.play\n\n// pan sweep from left to right\n{ Balance2.ar(SinOsc.ar(440), SinOsc.ar(1000), Line.kr(-1, 1, 5)) }.play\n\n// other examples\n{ Balance2.ar(LFSaw.ar(44), Pulse.ar(33), FSinOsc.kr(0.5), 0.1) }.play;\n{ var source; source = SinOsc\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// a stereo signal, both channels at 0dB\n{ [SinOsc.ar(440), SinOsc.ar(440)] }.play\n\n// using Balance on a stereo signal with the position parameter at 0, effectively the same sound but both channels at -3dB\n{ Balance2.ar(SinOsc.ar(440), SinOsc.ar(440), 0) }.play\n\n// pan sweep from left to right\n{ Balance2.ar(SinOsc.ar(440), SinOsc.ar(1000), Line.kr(-1, 1, 5)) }.play\n\n// other examples\n{ Balance2.ar(LFSaw.ar(44), Pulse.ar(33), FSinOsc.kr(0.5), 0.1) }.play;\n{ var source; source = SinOsc.ar([440, 550]); Balance2.ar(source[0], source[1], LFNoise0.kr(4), 0.3) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\ns.boot // Boot the server, if you need to\n\n// read a whole sound into memory\n\n// ExampleFiles helps locate audio files used in examples\np = ExampleFiles.child;\n// peek at the path to see location and the format of a path\np.postln;\n// read the file into a buffer\nb = Buffer.read(s, p); // remember to free the buffer later.\n\nSynthDef(\\help_PlayBuf, { |out = 0, bufnum = 0|\n Out.ar(out,\n PlayBuf.ar(1, bufnum, BufRateScale.kr(bufnum), doneAction: Done.freeSelf)\n )\n}).play(s, [\\out, 0, \\bufnum, b]);\n```"}, {"role": "assistant", "content": "read a whole sound into memory ExampleFiles helps locate audio files used in examples (PlayBuf: Sample playback oscillator.)"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `NodeProxy`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\na = NodeProxy.new.play; // play to hardware output.\na.fadeTime = 2; // fadeTime specifies crossfade\n// set the source\na.source = { SinOsc.ar([350, 351.3], 0, 0.2) };\na.source = { Pulse.ar([350, 351.3] / 4, 0.4) * 0.2 };\na.source = Pbind(\\dur, 0.03, \\freq, Pbrown(0, 1, 0.1, inf).linexp(0, 1, 200, 350));\n\nb = NodeProxy.new;\na.source = { Ringz.ar(b.ar, [350, 351.3] * 8, 0.2) * 4 };\nb.source = { Impulse.ar([5, 7]/2, [0, 0.5]) };\n\na.clear(3); // clear after 3 seconds\nb.clear(3);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BRF`."}, {"role": "assistant", "content": "```supercollider\n{ BRF.ar(Saw.ar(200, 0.1), FSinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3800, 4000), 0.3) }.play;\n\n{ BRF.ar(Saw.ar(200, 0.5), MouseX.kr(100, 10000, 1), 0.3) }.play;\n\n\n // BRF on control signals:\n(\n{ var vib = BRF.kr(SinOsc.kr([1, 3, 10], 0, [1, 0.5, 0.25]).sum, MouseX.kr(1, 10, 1), 0.3);\n SinOsc.ar(vib * 200 + 600) * 0.2 }.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// default initial params\n{ LinCongL.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// default initial params\n{ LinCongL.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SynthDefFile.read` do? What arguments does it take?"}, {"role": "assistant", "content": "Read file with classes and synth Arguments: Specify Radicles Class.; Key to identify synth object.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\nNdef(\\a).play; // play to hardware output.\nNdef(\\a).fadeTime = 2; // fadeTime specifies crossfade\n// set the source\nNdef(\\a, { SinOsc.ar([350, 351.3], 0, 0.2) });\nNdef(\\a, { Pulse.ar([350, 351.3] / 4, 0.4, 0.2) });\nNdef(\\a, Pbind(\\dur, 0.03, \\freq, Pbrown(0, 1, 0.1, inf).linexp(0, 1, 200, 350)));\n\nNdef(\\a, { Ringz.ar(Ndef.ar(\\b), [350, 351.3] * 2, 0.4) });\nNdef(\\b, { Impulse.ar([5, 7]\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\nNdef(\\a).play; // play to hardware output.\nNdef(\\a).fadeTime = 2; // fadeTime specifies crossfade\n// set the source\nNdef(\\a, { SinOsc.ar([350, 351.3], 0, 0.2) });\nNdef(\\a, { Pulse.ar([350, 351.3] / 4, 0.4, 0.2) });\nNdef(\\a, Pbind(\\dur, 0.03, \\freq, Pbrown(0, 1, 0.1, inf).linexp(0, 1, 200, 350)));\n\nNdef(\\a, { Ringz.ar(Ndef.ar(\\b), [350, 351.3] * 2, 0.4) });\nNdef(\\b, { Impulse.ar([5, 7]/2, [0, 0.5], 0.15) });\n\nNdef.clear(3); // clear all after 3 seconds\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Image.plot` do? What arguments does it take?"}, {"role": "assistant", "content": "plots the image in a Window. `i = Image.new(SCDoc.helpSourceDir +/+ Arguments: name — the title of the Window. may be nil.; bounds — the bounds of the Window. may be nil.; freeOnClose — flag to tell if the Window should free the Image when closed.; background — additional background to apply to the Window. may be useful for artifacts due to alpha / compositing...; showInfo — shows pixel coordinates while the mouse is over the image's plot window.."}]} +{"conversations": [{"role": "user", "content": "What does `Platform.when` do?"}, {"role": "assistant", "content": "Evaluate ifFunction if all features are present, otherwise evaluate elseFunction. `Platform.when(#[\\Document, \\Window], { \"yeehah!\".postln"}]} +{"conversations": [{"role": "user", "content": "What is the difference between an audio bus and a control bus?"}, {"role": "assistant", "content": "Both are numbered channels on the server used to move signal between nodes. An audio bus carries audio-rate signal and holds one or more audio channels; a control bus carries one value per block, like a parameter. You write with Out.ar / Out.kr and read with In.ar / In.kr, or with `.asMap` / `\\param, bus.asMap` to drive a Synth's control from a bus. Buses are how effects are chained: a synth writes to a private bus, the effect reads it and writes to Out.ar(0, …)."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var z;\n\n // signal (clean)\n z = Decay2.ar(\n Impulse.ar(8, 0, LFSaw.kr(0.3, 1, -0.3, 0.3)),\n 0.001,\n 0.3\n )\n * Mix.ar(Pulse.ar([80, 81], 0.3));\n\n\n // apply limiter (mouse x sets amount)\n Compander.ar(z, z,\n thresh: MouseX.kr(0.01, 1),\n slopeBelow: 1,\n slopeAbove: 0.1,\n clampTime: 0.01,\n relaxTime: 0.01\n )\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var z;\n\n // signal (clean)\n z = Decay2.ar(\n Impulse.ar(8, 0, LFSaw.kr(0.3, 1, -0.3, 0.3)),\n 0.001,\n 0.3\n )\n * Mix.ar(Pulse.ar([80, 81], 0.3));\n\n\n // apply limiter (mouse x sets amount)\n Compander.ar(z, z,\n thresh: MouseX.kr(0.01, 1),\n slopeBelow: 1,\n slopeAbove: 0.1,\n clampTime: 0.01,\n relaxTime: 0.01\n )\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\ns.boot;\n// allocate an array of Buffers and fill them with different harmonics\n(\nb = Buffer.allocConsecutive(8, s, 4096, 1, { |buf, i|\n buf.sine1Msg((1 .. ((i + 1) * 6)).reciprocal) // completion messages\n});\n\na = { VOsc.ar(SinOsc.kr(0.5, 0).range(b.first.bufnum + 0.1, b.last.bufnum - 0.1),\n [440, 441], 0, 0.2) }.play;\n);\na.free;\n\n// iterate over the array and free it\nb.do(_.free);\n```"}, {"role": "assistant", "content": "allocate an array of Buffers and fill them with different harmonics iterate over the array and free it (Buffer: Client-side representation of a buffer on a server)"}]} +{"conversations": [{"role": "user", "content": "What does `EZSlider.visible` do? What arguments does it take?"}, {"role": "assistant", "content": "Sets/gets it the component views are Arguments: bool — An instance of Boolean. Default is `true`.."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PulseDivider`."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\"help-PulseDivider\", { |out = 0|\n var p, a, b;\n p = Impulse.ar(8);\n a = SinOsc.ar(1200, 0, Decay2.ar(p, 0.005, 0.1));\n b = SinOsc.ar(600, 0, Decay2.ar(PulseDivider.ar(p, 4), 0.005, 0.5));\n\n Out.ar(out, (a + b) * 0.4)\n}).play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `SoundIn` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\nu = Server(\\scau, NetAddr(\"127.0.0.1\", 9989)); // Change the port from 9989 to the right one for you\nu.serverRunning = true;\nu.ping(10); // Gives about 0.02 for me - confirms that communication is working\n// Now let's create a quick ring-modulator effect:\nz = { SoundIn.ar([0,1]) * SinOsc.ar(MouseX.kr(100, 1000)) }.play(u);\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Interpreter`?"}, {"role": "assistant", "content": "Interpreter — The interpreter defines a context in which interactive commands are compiled and executed."}, {"role": "user", "content": "What does `Interpreter.clearAll` do?"}, {"role": "assistant", "content": "set the values of the variables `a` through `z` to nil. `x = 123;`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// typical usage\na = 4;\nb = 3;\nb = b + a;\n\n// some sound\na = Synth(\\default);\ng = fork { loop { 0.1.wait; a.set(\\freq, 200 + 20.0.rand2.postln) } };\ng.stop; a.free;\n\n// an overview of all the variables\nthis.inspect;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// default initial params\n{ LatoocarfianL.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// default initial params\n{ LatoocarfianL.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `MxOutletApp.name` do?"}, {"role": "assistant", "content": "Spec of the outlet as defined in the objects driver file in"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n//code that utilizes the glitch.\n//warning! extremely loud.\n//note: might not sound the same on all soundcards\n(\n{GlitchRHPF.ar(\n BrownNoise.ar(1.dup),\n 0.5,\n Saw.kr(1, 10)\n)}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n//code that utilizes the glitch.\n//warning! extremely loud.\n//note: might not sound the same on all soundcards\n(\n{GlitchRHPF.ar(\n BrownNoise.ar(1.dup),\n 0.5,\n Saw.kr(1, 10)\n)}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `NAryOpFunction` in SuperCollider briefly."}, {"role": "assistant", "content": "NAryOpFunction — represent a n-ary operation on a function Operating on functions instead of numbers, what results is not a result of the calculation, but a structure that represents that calculation. Category: Core."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `IEnvGen`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var env = Env([0, 0.6, 0.3, 1.0, 0], [0.1, 0.02, 0.4, 1.1], [\\lin, \\exp, -6, \\sin]);\n var envgen = IEnvGen.kr(env, MouseX.kr(0, env.times.sum));\n env.plot;\n SinOsc.ar(envgen * 500 + 440)\n}.play;\n);\n\n// index with an SinOsc ... mouse controls amplitude of SinOsc\n// use offset so negative values of SinOsc will map into the Env\n(\n{\n var sin = SinOsc.ar(440, 0, MouseX.kr(0, 1));\n // use offset so negative values of SinOsc will map into the Env\n var env = Env([-1, -0.7, 0.7, 1], [0.8666, 0.2666, 0.8668], \\lin, offset: -1.0);\n IEnvGen.ar(env, sin) * 0.1\n}.play;\n);\n\n// index with Amplitude of input, control freq of SinOsc (uses SoundIn)\n(\n{\n var point = Amplitude.ar(SoundIn.ar(0), 0.01, 0.2);\n // use offset so negative values of SinOsc will map into the Env\n var env = Env.xyc([[0, 330, \\exp], [0.5, 440, \\exp], [1.0, 1760]]);\n SinOsc.ar(IEnvGen.kr(env, point)) * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BLowPass`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n(\nz = {\n BLowPass.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(10, 20000, \\exponential), // cutoff freq.\n MouseY.kr(0.0, 1.0, \\linear), // rq\n 0.5); // mul\n}.play\n);\nz.release;\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Env`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var env = Env([0.0, 0.5, 0.0, 1.0, 0.9, 0.0], [0.05, 0.1, 0.01, 1.0, 1.5], -4);\n var envgen = EnvGen.ar(env, doneAction: Done.freeSelf);\n env.plot;\n SinOsc.ar(\n envgen * 1000 + 440\n ) * envgen * 0.1\n}.play\n);\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\na = { |tempo = 1| Ringz.ar(Impulse.ar(tempo), [501, 500], 1/tempo) }.play;\nt = TempoBusClock(a);\nTask { loop { \"klink\".postln; 1.wait } }.play(t);\n);\n\nt.tempo = 1.3;\nt.tempo = 0.5;\nt.tempo = 1.0;\n\n\n// in ProxySpace, a TempoBusClock can be added together with a ~tempo NodeProxy:\n\np = ProxySpace.push(s);\np.makeTempoClock;\np.clock; // now the ProxySpace's clock is a TempoBusClock\n\n~out.play;\n~out = { Ringz.ar(Impulse\n// …\n```"}, {"role": "assistant", "content": "in ProxySpace, a TempoBusClock can be added together with a ~tempo NodeProxy: patterns and tasks are synchronized: (TempoBusClock: a clock that synchronizes its tempo with the server)"}]} +{"conversations": [{"role": "user", "content": "What are you not good at?"}, {"role": "assistant", "content": "Everything outside SuperCollider. I have no audio input, no live data, and my knowledge ends at the documentation snapshot I was trained on — so I can be confidently wrong about Quarks and new UGens."}]} +{"conversations": [{"role": "user", "content": "What does `Signal.overDub` do?"}, {"role": "assistant", "content": "Add a signal to myself starting at the index. If the other signal is too long only the first part is overdubbed. `a = Signal.fill(10,"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for Interpolate between Envs with Pseg: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\sin, { arg out=0, gate=1, amp=0.1, pan=0, freq=200;\n var sig;\n sig = SinOsc.ar(freq);\n sig = sig * EnvGen.kr(\\adsr.kr(Env.adsr(0.1,0.1,0.8,0.1)), gate, doneAction:2);\n sig = Pan2.ar(sig, pan, amp);\n Out.ar(out, sig);\n}).add;\n);\n\n(\n// sequence Envs\n// need [] else it is inlined or does pattern multichannel expansion\nPdef(\\demo, \n Pbind(\n \\instrument, \\sin,\n \\degree, Pseq([0, Pwhite(0,7,1)],inf),\n \\legato, 0.5,\n \\adsr, Pseq([\n [ Env.adsr(1.1,0.1,0.8,1.01) ],\n [ Env.adsr(0.01,0.1,0.8,0.01) ],\n [ Env.adsr(0.01,1.1,0.3,0.01) ],\n ],inf),\n )\n).play;\n);\n\n(\n// interpolate using Pseg\n// need .asArray\nPdef(\\demo, \n Pbind(\n \\instrument, \\sin,\n \\degree, Pseq([0, Pwhite(0,7,1)],inf),\n \\legato, 0.5,\n \\adsr, Pseg(Pseq([\n [ Env.adsr(1.1,0.1,0.8,1.01).asArray ],\n [ Env.adsr(0.01,0.1,0.8,0.01).asArray ],\n [ Env.adsr(0.01,1.1,0.3,0.01).asArray ],\n ],inf),8),\n )\n).play;\n);\n```"}]} +{"conversations": [{"role": "user", "content": "What is the difference between TempoClock and SystemClock?"}, {"role": "assistant", "content": "SystemClock runs in real time and is what `.wait` uses by default. TempoClock runs in beats and has a tempo, so it can be changed while things are playing and Patterns scheduled on it follow. `TempoClock.default` is the clock Patterns use unless told otherwise, which is why `TempoClock.default.tempo = 2` changes the speed of everything you already have running."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Pmulpre` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain);\nb = Pmulpre(\\freq, Pseq([1, 2, 3], inf), a);\nb.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for little homage to \"Come Out\" by Steve Reich: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n/* A little homage to \"Come Out\" by Steve Reich.\n It explores ryhtmic aspects created by phasing, retriggering, and pitch shifting.\n It \"detours\" the original audio message available here\n http://www.freesound.org/people/ERH/sounds/34667/\n in which a police patrol recites\n \"We don't want to scare your children, that's the last thing we wanna do\".\n \n */\n\n\ns.options.memSize=128*1024;\ns.boot;\n\n~bus=Bus.audio(s,2);\n~buf=Buffer.readChannel(s,\"/home/***/Supercollider/sounds/v.wav\");\n\n(\nSynthDef(\\playbuff,{arg in=0,out=0,t_trig=0;\n var i=EnvGen.kr(Env([0,40,0.3,0.4,40,0],[0,60,20,20,30]),gate:1);\n var r=EnvGen.kr(Env([0,10,-0.9,-0.9],[40,20,15]),gate:t_trig,doneAction:2);\n var sig1=PlayBuf.ar(1,in,rate:1+r,trigger:Impulse.kr(i),loop:1);\n var sig2=PlayBuf.ar(1,in,rate:1+r,trigger:Impulse.kr(i+0.01),loop:1);\nOut.ar(out,Splay.ar([sig1,sig2],0.5));\n};\n).add;\n\nSynthDef(\\rev,{arg in=0,out=0;\n var sig=In.ar(in,2);\n sig=Compander.ar(sig,sig,0.8,1/3);\n sig=FreeVerb.ar(sig,mix:0.4);\nOut.ar(out,sig);\n};\n).add;\n);\n\nSynth(\\rev,[\\in:~bus]);\n\nfork{\nx=Synth(\\playbuff,[\\out:~bus]);\n75.wait;\nx.set(\\t_trig,1);\n};\n\ns.quit;\n```"}]} +{"conversations": [{"role": "user", "content": "Can you listen to the sound you generate?"}, {"role": "assistant", "content": "No. I am 198M parameters trained on SuperCollider's documentation and class library; I have no audio input and no way to hear a result. What I can do is reason about the code: whether it reaches an output bus, whether the envelope will ever open, whether a filter at that cutoff leaves anything audible. Treat my patches as a starting point you listen to, not as a judgement about how they sound."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Klank.ar(`[[800, 1071, 1153, 1723], nil, [1, 1, 1, 1]], Impulse.ar(2, 0, 0.1)) }.play;\n\n{ Klank.ar(`[[800, 1071, 1353, 1723], nil, [1, 1, 1, 1]], Dust.ar(8, 0.1)) }.play;\n\n{ Klank.ar(`[[800, 1071, 1353, 1723], nil, [1, 1, 1, 1]], PinkNoise.ar(0.007)) }.play;\n\n{ Klank.ar(`[[200, 671, 1153, 1723], nil, [1, 1, 1, 1]], PinkNoise.ar([0.007, 0.007]) }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Klank.ar(`[[800, 1071, 1153, 1723], nil, [1, 1, 1, 1]], Impulse.ar(2, 0, 0.1)) }.play;\n\n{ Klank.ar(`[[800, 1071, 1353, 1723], nil, [1, 1, 1, 1]], Dust.ar(8, 0.1)) }.play;\n\n{ Klank.ar(`[[800, 1071, 1353, 1723], nil, [1, 1, 1, 1]], PinkNoise.ar(0.007)) }.play;\n\n{ Klank.ar(`[[200, 671, 1153, 1723], nil, [1, 1, 1, 1]], PinkNoise.ar([0.007, 0.007])) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `CutPan1.new` do? What arguments does it take?"}, {"role": "assistant", "content": "CutMixer panning algorithm Arguments: directfunc — A function, called every block, that determines the direction to change the pan. If nil, defaults to a function that randomly returns -1 or 1.; outrate — The common difference of the arithmetic sequence. Defaults to 0.2. This can also be a function, in which case it is called every repeat.."}]} +{"conversations": [{"role": "user", "content": "What does `KrNumberEditor.makePatchOut` do?"}, {"role": "assistant", "content": "a number box and slider for editing a float value [\\kr rate]"}]} +{"conversations": [{"role": "user", "content": "What does `SimpleNumber.bilinrand` do?"}, {"role": "assistant", "content": "Bilateral linearly distributed random number in the range (-this, +this). Like linrand, but adds a second straight line from `-this` to 0. Histogram will approach an isosceles triangle with its apex at x = 0. Formally like `.linrand`, but the probability density function is also supported in the range (-x, 0] by 2(1 +"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `MantissaMask`."}, {"role": "assistant", "content": "```supercollider\n// preserve only 3 bits of mantissa.\n{ MantissaMask.ar(SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4), 3) }.play\n\n// the original\n{ SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4) }.play\n\n// the difference.\n(\n{\n var in;\n in = SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4);\n in - MantissaMask.ar(in, 3)\n}.play\n)\n\n\n// preserve 7 bits of mantissa.\n// This makes the lower 16 bits of the floating point number become zero.\n{ MantissaMask.ar(SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4), 7) }.play\n\n// the original\n{ SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4) }.play\n\n// the difference.\n(\n{\n var in;\n in = SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4);\n in - MantissaMask.ar(in, 7)\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `SoundIn` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\nu = Server(\\scau, NetAddr(\"127.0.0.1\", 9989)); // Change the port from 9989 to the right one for you\nu.serverRunning = true;\nu.ping(10); // Gives about 0.02 for me - confirms that communication is working\n// Now let's create a quick ring-modulator effect:\nz = { SoundIn.ar([0,1]) * SinOsc.ar(MouseX.kr(100, 1000)) }.play(u);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Lag2`."}, {"role": "assistant", "content": "```supercollider\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n Lag2.kr( // lag the modulator\n LFPulse.kr(4, 0, 0.5, 50, 400), // frequency modulator\n Line.kr(0, 1, 15) // modulate lag time\n ),\n 0, // phase\n 0.3 // sine amplitude\n )\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `TreeView.itemPressedAction` do?"}, {"role": "assistant", "content": "The object to be evaluated when a mouse button is pressed on an item, passing this view as the"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Rand`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-Rand\", { |out = 0|\n Out.ar(out,\n FSinOsc.ar(\n Rand(200.0, 400.0),\n 0, Line.kr(0.2, 0, 1, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n(\nRoutine({\n 8.do({\n Synth.new(\"help-Rand\"); 1.0.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Amplitude`."}, {"role": "assistant", "content": "```supercollider\n// use input amplitude to control Pulse amplitude - use headphones to prevent feedback.\n{ Pulse.ar(90, 0.3, Amplitude.kr(SoundIn.ar(0))) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Who made you?"}, {"role": "assistant", "content": "I was trained by the person who runs this project, on top of the MiniMind architecture. My weights started from random numbers and learned from the SuperCollider sources — no teacher model, no distillation."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// Find/make a dataset of points:\nx = 15.collect{[1.0.rand, 1.0.rand]};\n// Append the index onto the end, for later reference\nx = x.collect{|data, i| data ++ i };\n// Use the KDTree quark and the .makeBufferData method to put the data in the searchable format\n~treedata = NearestN.makeBufferData(KDTree(x, lastIsLabel: true));\n// Load the data to the server\n~treebuf = Buffer.sendCollection(s, ~treedata.flat, 5);\n// Run a synth with the ugen and some kind of query data\n~synth = { NearestN.kr(~treebuf, {LFNoise0.kr\n// …\n```"}, {"role": "assistant", "content": "Find/make a dataset of points: Append the index onto the end, for later reference (NearestN: Find the nearest-neighbours in a set of points)"}]} +{"conversations": [{"role": "user", "content": "What is `PSVsymdif_oi` in SuperCollider?"}, {"role": "assistant", "content": "PSVsymdif_oi — Sieve pattern for symmetric difference of integer generators with offsets and interval output Pattern for symmetric difference of integer generators with offsets and interval output. Corresponds to Sieve's methods Sieve#*symdif_oi and Sieve#-symdif_oi. For an introduction and more examples see Sieves_and_Psieve_patterns. Category: Libraries > miSCellaneous > Sieves and Psieve Patterns, Streams-Patterns-Events > Sieves and Psieve Patterns."}]} +{"conversations": [{"role": "user", "content": "What does `RedDiskInSampler.buffers` do?"}, {"role": "assistant", "content": "Return an array of buffer for this key. The number of buffers depend on how many overlaps you had when"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `IEnvGen`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var env = Env([0, 0.6, 0.3, 1.0, 0], [0.1, 0.02, 0.4, 1.1], [\\lin, \\exp, -6, \\sin]);\n var envgen = IEnvGen.kr(env, MouseX.kr(0, env.times.sum));\n env.plot;\n SinOsc.ar(envgen * 500 + 440)\n}.play;\n);\n\n// index with an SinOsc ... mouse controls amplitude of SinOsc\n// use offset so negative values of SinOsc will map into the Env\n(\n{\n var sin = SinOsc.ar(440, 0, MouseX.kr(0, 1));\n // use offset so negative values of SinOsc will map into the Env\n var env = Env([-1, -0.7, 0.7, 1], [0.8666, 0.2666, 0.8668], \\lin, offset: -1.0);\n IEnvGen.ar(env, sin) * 0.1\n}.play;\n);\n\n// index with Amplitude of input, control freq of SinOsc (uses SoundIn)\n(\n{\n var point = Amplitude.ar(SoundIn.ar(0), 0.01, 0.2);\n // use offset so negative values of SinOsc will map into the Env\n var env = Env.xyc([[0, 330, \\exp], [0.5, 440, \\exp], [1.0, 1760]]);\n SinOsc.ar(IEnvGen.kr(env, point)) * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `LinRand` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-LinRand\", { |out = 0, minmax = 1|\n Out.ar(out,\n FSinOsc.ar(\n LinRand(200.0, 10000.0, minmax),\n 0, Line.kr(0.2, 0, 0.01, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n// towards hi\n(\nRoutine({\n loop({\n Synth.new(\"help-LinRand\"); 0.04.wait;\n })\n}).play;\n);\n\n// towards lo (doesn't work like that yet)\n(\nRoutine({\n loop({\n Synth.new(\"help-LinRand\", [\\minmax, -1]); 0.04.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What are the arguments of Pan2?"}, {"role": "assistant", "content": "`Pan2.ar(in, pos, level)` — in is the mono signal, pos is -1 (left) to 1 (right) with 0 in the middle, and level scales the output. It is equal-power, so a centred signal is -3 dB per channel rather than half amplitude. `Pan2.ar(sig, SinOsc.kr(0.1))` is the simplest autopan."}]} +{"conversations": [{"role": "user", "content": "What does `NodeProxy.edit` do?"}, {"role": "assistant", "content": "Returns a new instance of NodeProxyEditor for this proxy. `a ="}]} +{"conversations": [{"role": "user", "content": "What does `ListView.action` do?"}, {"role": "assistant", "content": "The action object evaluated whenever the user changes the current item, i.e. when #-value changes as a result of GUI"}]} +{"conversations": [{"role": "user", "content": "What does `FoaSpeakerMatrix.positions` do?"}, {"role": "assistant", "content": "Answers the position of loudspeaker feeds, in cartesian"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// as frequency control...\n(\n{\nSinOsc.ar(\n LinCongN.ar(\n 40,\n LFNoise2.kr(0.1, 0.1, 1),\n LFNoise2.kr(0.1, 0.1, 0.1),\n LFNoise2.kr(0.1),\n 0, 500, 600\n )\n) * 0.4 }.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// as frequency control...\n(\n{\nSinOsc.ar(\n LinCongN.ar(\n 40,\n LFNoise2.kr(0.1, 0.1, 1),\n LFNoise2.kr(0.1, 0.1, 0.1),\n LFNoise2.kr(0.1),\n 0, 500, 600\n )\n) * 0.4 }.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = {LFTri.ar(100+(1000*Maths2.ar(MouseX.kr, MouseY.kr, 0.2, 1, 0, 1, LFPulse.ar(2))[0]), 0, 0.1}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = {LFTri.ar(100+(1000*Maths2.ar(MouseX.kr, MouseY.kr, 0.2, 1, 0, 1, LFPulse.ar(2))[0]), 0, 0.1)}.play\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `ProxySpace`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\np = ProxySpace.new;\np.fadeTime = 2; // fadeTime specifies crossfade\np[\\out].play; // monitor an empty placeholder through hardware output\n// set its source\np[\\out] = { SinOsc.ar([350, 351.3], 0, 0.2) };\np[\\out] = { Pulse.ar([350, 351.3] / 4, 0.4) * 0.2 };\np[\\out] = Pbind(\\dur, 0.03, \\freq, Pbrown(0, 1, 0.1, inf).linexp(0, 1, 200, 350));\n\n// route one proxy through another:\np[\\out] = { Ringz.ar(p[\\in].ar, [350, 351.3] * 8, 0.2) * 4 };\np[\\in] = { Impulse.ar([5, 7]/2, [0, 0.5]) };\n\np.clear(3); // clear after 3 seconds\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\n// no decay\n(\n{\n SinOsc.ar(\n PeakFollower.ar(Dust.ar(20, Line.kr(0, 1, 4)), 1.0) * 1500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// a little decay\n(\n{\n SinOsc.ar(\n PeakFollower.ar(Dust.ar(20, Line.kr(0, 1, 4)), 0.999) * 1500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// mouse x controls decay, center of the\n(\n{\n var decay;\n decay = MouseX.kr(0.99, 1.00001).min(1.0);\n SinOsc.ar(\n PeakFollower.ar(Dust\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\n// no decay\n(\n{\n SinOsc.ar(\n PeakFollower.ar(Dust.ar(20, Line.kr(0, 1, 4)), 1.0) * 1500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// a little decay\n(\n{\n SinOsc.ar(\n PeakFollower.ar(Dust.ar(20, Line.kr(0, 1, 4)), 0.999) * 1500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// mouse x controls decay, center of the\n(\n{\n var decay;\n decay = MouseX.kr(0.99, 1.00001).min(1.0);\n SinOsc.ar(\n PeakFollower.ar(Dust.ar(20), decay) * 1500 + 200,\n 0, 0.2\n );\n\n}.play;\n);\n\n\n\n\n// follow a sine lfo, decay controlled by mouse x\n(\n{\n var decay;\n decay = MouseX.kr(0, 1.1).min(1.0);\n SinOsc.ar(\n PeakFollower.kr(SinOsc.kr(0.2), decay) * 200 + 500,\n 0, 0.2\n )\n\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Bus`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\nb = Bus(\\audio, 0, 2);\ns.bind {\n SynthDef(\\sinPerc, { |out = 0|\n var signal = SinOsc.ar * Env.sine(0.1).ar(gate: Impulse.ar(2));\n OffsetOut.ar(out, signal ! 2) }\n ).add;\n s.sync;\n Synth(\\sinPerc, [\\out, b]);\n b.plot(1);\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\ambiIn;\n~description = \"A live ambisonic input (ACN_N3D)\";\n~channelLayout = \\ambi;\n\n~function = { |order = 1, t_trig = 0, bus = 0|\n var env = EnvGen.kr(Env([0,1], [1]), t_trig);\n var chans = Array.series(\n size: (order + 1).pow(2).asInteger,\n start: bus,\n step: 1\n );\n SoundIn.ar(chans) * env;\n};\n```"}, {"role": "assistant", "content": "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see ."}]} {"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = WhiteNoise.ar; // a WhiteNoise\nb = a + 2; // a BinaryOpUGen.\nb.operator; // +\n\n// sound example\n(\n{\n var a = LFSaw.ar(300);\n var b = LFSaw.ar(329.1);\n a % b * 0.1\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = WhiteNoise.ar; // a WhiteNoise\nb = a + 2; // a BinaryOpUGen.\nb.operator; // +\n\n// sound example\n(\n{\n var a = LFSaw.ar(300);\n var b = LFSaw.ar(329.1);\n a % b * 0.1\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Linear Mess #1 (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n~buffer = Buffer.read(s, \"/Users/a---/Desktop/archive/_solfège/solfège soundMusic/musica electronica/solfège electroacoustic/triptych part 1/37/Solfegge Sound Processing, And Sample Bank For Live Electronics #37 - 17 (the stems).aiff\");\n\n(\n{\n~a={Warp1.ar(~buffer.numChannels, ~buffer.bufnum, LFDNoise0.kr(0.125) + TRand.kr(0, 0.01, Impulse.kr(40)), 1, 20, overlaps: 1, interp: 4, mul: 0.6)};\n~b={Warp1.ar(~buffer.numChannels, ~buffer.bufnum, LFDNoise0.kr(0.125) + TRand.kr(0, 0.01, Impulse.kr(40)), 2, 20, overlaps: 1, interp: 4, mul: 0.6)};\n~c={Warp1.ar(~buffer.numChannels, ~buffer.bufnum, LFDNoise0.kr(0.125) + TRand.kr(0, 0.01, Impulse.kr(40)), 0.125, 20, overlaps: 1, interp: 4, mul: 0.6)};\n~d={PlayBuf.ar(~buffer.numChannels, ~buffer.bufnum, 1, 1, loop:1)};\n~e={PlayBuf.ar(~buffer.numChannels, ~buffer.bufnum, 2, 1, loop:1)};\n~f={PlayBuf.ar(~buffer.numChannels, ~buffer.bufnum, 0.125, 1, loop:1)};\n ~f2={PlayBuf.ar(~buffer.numChannels, ~buffer.bufnum, 0.125, ((LFDNoise0.kr(19)*2)+0.125), loop:1)};\n\n ~g={Warp1.ar(~buffer.numChannels, ~buffer.bufnum, SinOsc.kr(0.0001) + TRand.kr(0, 0.01, Impulse.kr(40)), 1, 0.2, overlaps: 1, interp: 4, mul: 0.3)};\n~h={Warp1.ar(~buffer.numChannels, ~buffer.bufnum, SinOsc.kr(0.0001) + TRand.kr(0, 0.01, Impulse.kr(40)), 2, 0.2, overlaps: 1, interp: 4, mul: 0.3)};\n~i={Warp1.ar(~buffer.numChannels, ~buffer.bufnum, SinOsc.kr(0.0001) + TRand.kr(0, 0.01, Impulse.kr(40)), 0.125, 0.2, overlaps: 1, interp: 4, mul: 0.3)};\n ~j={Resonz.ar(GVerb.ar(WhiteNoise.ar(SinOsc.kr(SinOsc.kr(0.005))) * 0.03), 432)};\n ~k={GVerb.ar(Resonz.ar(Dust.ar(1), 432))};\n\n Out.ar(0, ~a+~b+~c+~d+~e+~f+~g+~h+~i+~j+~k+~f2);\n}.scope\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for 2 channels of chuckling sawtooths."}, {"role": "assistant", "content": "```supercollider\n//hall of mirrors\n{[AllpassC.ar(HPF.ar(RLPF.ar(Saw.ar(LFPar.kr(0.25).range(220,440)),LFPar.kr(MouseX.kr(0,8),pi).range(220,20000),0.3),LFPar.kr(MouseY.kr(0,8)).range(220,20000)),2,MouseX.kr(0,0.5),2),AllpassC.ar(HPF.ar(RLPF.ar(Saw.ar(LFPar.kr(0.25,pi).range(440,220)),LFPar.kr(MouseX.kr(8,0),pi).range(20000,220),0.3),LFPar.kr(MouseY.kr(8,0),pi).range(20000,220)),2,MouseX.kr(0.5,0),2)]}.play\n```"}]} -{"conversations": [{"role": "user", "content": "Write a random pentatonic melody that plays by itself."}, {"role": "assistant", "content": "Pick degrees from a pentatonic scale; `\\scale` and `\\root` define the pitch space, and `\\degree`\npicks within it.\n\n```supercollider\n(\nPbind(\n \\instrument, \\default,\n \\scale, Scale.minorPentatonic,\n \\root, 3,\n \\degree, Pwhite(0, 9, inf),\n \\octave, 5,\n \\dur, Pwhite(0.12, 0.28, inf),\n \\amp, 0.2,\n \\legato, 0.8\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `WhiteNoise.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "White noise. Arguments: mul — Output will be multiplied by this value.; add — This value will be added to the output.."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pbindef`."}, {"role": "assistant", "content": "```supercollider\nPbindef(\\x, \\note, Pseq([0, 7, 9]), \\dur, 0.2).play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `List.wrapExtend` do?"}, {"role": "assistant", "content": "Returns a new List whose elements are repeated sequences of the receiver, up to size length. The receiver is unchanged."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\np = SerialPort(\n \"/dev/tty.usbserial-A800crTT\", // edit to match your port. SerialPort.listDevices\n baudrate: 9600, // check that baudrate is the same as in arduino sketch\n crtscts: true);\n);\n\n// read 10bit serial data sent from Arduino's Serial.println\n(\nr = Routine({\n var byte, str, res;\n 99999.do{ |i|\n if(p.read == 10, {\n str = \"\";\n while({ byte = p.read; byte != 13 }, {\n str = str++byte.asAscii;\n });\n res = str.asInteger;\n (\"read value:\"+res).postln;\n });\n };\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\np = SerialPort(\n \"/dev/tty.usbserial-A800crTT\", // edit to match your port. SerialPort.listDevices\n baudrate: 9600, // check that baudrate is the same as in arduino sketch\n crtscts: true);\n);\n\n// read 10bit serial data sent from Arduino's Serial.println\n(\nr = Routine({\n var byte, str, res;\n 99999.do{ |i|\n if(p.read == 10, {\n str = \"\";\n while({ byte = p.read; byte != 13 }, {\n str = str++byte.asAscii;\n });\n res = str.asInteger;\n (\"read value:\"+res).postln;\n });\n };\n}).play;\n);\n\nr.stop;\np.close;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `AmpComp.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Basic psychoacoustic amplitude compensation. Arguments: freq — Input frequency value. For freq == root, the output is 1.0.; root — Root freq relative to which the curve is calculated (usually lowest freq).; exp — Exponent: how steep the curve decreases for increasing freq.."}]} -{"conversations": [{"role": "user", "content": "What does `Array.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a new array with size 0 that can grow up to the fixed Arguments: maxSize — The maximum size of the array.."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for some initial thoughts on psytrance bassline."}, {"role": "assistant", "content": "```supercollider\n(\n{ | dur = 0.15, atk = 0.005, amp = 1 |\n SinOsc.ar(\n EnvGen.ar( Env(\n NamedControl.kr(\\freq_l, [2960, 70, 90]),\n NamedControl.kr(\\freq_d, [0.07, 0.2]),\n NamedControl.kr(\\freq_c, [-13, -1]),\n ) ),\n mul:amp * EnvGen.ar(\n Env.perc( atk, dur - atk, curve: NamedControl.kr(\\amp_c, [-1, 6])),\n doneAction: 2\n ); \n ) ! 2;\n}.asSynthDef.name_(\"kick\").add;\n\n{ | atk = 0.01, dur = 0.15, freq = 50, amp=0.8 |\n BPF.ar(LFSaw.ar(freq), freq, 2, mul: EnvGen.kr( Env.perc( atk, dur-atk, amp, 6 ), doneAction: 2 )) ! 2;\n}.asSynthDef.name_(\"bass\").add;\n\n{ | dur = 0.15, freq = 50, amp = 0.8, index = 10 |\n PMOsc.ar(freq, freq + 5, index, mul: amp * EnvGen.kr( Env.triangle( dur ), doneAction: 2 )) ! 2;\n}.asSynthDef.name_(\"bazz\").add;\n);\n\n\n(\nPpar([\n Pbind(*[\n instrument: \\kick,\n delta: 1,\n dur: Pfunc({ thisThread.clock.beatDur }) / 4,\n amp: Pseq([\n Pseq([1], 16),\n Pseq([0.8, 1], 8), \n Pseq([1], 16),\n Pseq([0.8, 0.8, 0.9, 1], 8)\n ], inf) * 0.8,\n freq_l: Pstutter(Prand(2.pow((1..4)),inf), Pseq([\n `[2960,70,90],\n `[1260,60,110],\n `[4360,60,120]\n ],inf))\n ]),\n Pbind(*[\n instrument: \\bass,\n delta: 1/4,\n dur: Pkey(\\delta) * Pfunc({ thisThread.clock.beatDur }),\n freq: Pseq([\\r, 50,60,70], inf),\n amp:0.6\n ]),\n Pbind(*[\n instrument: \\bazz,\n delta: 1/4,\n dur: Pkey(\\delta) * Pfunc({ thisThread.clock.beatDur }),\n freq: Pseq([\\r, 30,35,40], inf),\n amp:0.2\n ])\n]).play(TempoClock(156/60), quant:[1])\n);\n\n// kick from above?\n(\nPbind(*[\n instrument: \\kick,\n delta: Pseq(Array.geom(540, 1, 1.015).reciprocal.reverse),\n dur: Pkey(\\delta) * Pfunc({ thisThread.clock.beatDur }),\n atk: Pkey(\\dur) / 6,\n amp: 0.8\n]).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n//Can be very noisy, high pitched and aliases badly: e.g., great fun, but watch out for your ears, filter, try out odd param settings. I've turned all the amplitudes down in the following\n\n\n//defaults, high pitched! WARNING\n{Out.ar(0,Pan2.ar(0.1*DoubleWell.ar(Impulse.kr(0),MouseX.kr(0.01,1,'exponential'),MouseY.kr(0.01,1,'exponential'),0.9,0.0001,0.25,LFNoise0.kr(1,0.4,0.5),LFNoise0.kr(1,0.4,0.5)),0.0))}.play\n\n\n//2 per second\n(\n{Out.ar(0,\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n//Can be very noisy, high pitched and aliases badly: e.g., great fun, but watch out for your ears, filter, try out odd param settings. I've turned all the amplitudes down in the following\n\n\n//defaults, high pitched! WARNING\n{Out.ar(0,Pan2.ar(0.1*DoubleWell.ar(Impulse.kr(0),MouseX.kr(0.01,1,'exponential'),MouseY.kr(0.01,1,'exponential'),0.9,0.0001,0.25,LFNoise0.kr(1,0.4,0.5),LFNoise0.kr(1,0.4,0.5)),0.0))}.play\n\n\n//2 per second\n(\n{Out.ar(0,Pan2.ar(\n\nCombN.ar(\nResonz.ar(DoubleWell.ar(Impulse.kr(2),MouseX.kr(0.01,1,'exponential'),MouseY.kr(0.01,1,'exponential'),3.9,MouseX.kr(0.0001,0.01,'exponential'),0.25,LFNoise0.kr(1,0.4,0.5),LFNoise0.kr(1,10.4,10.5)),500,0.1),\n0.05,0.05,2\n)\n,0.0))}.play\n)\n\n\n//plotting check of first samples\n{DoubleWell.ar(1,0.025,0.025,0.4,1,0.25,-0.5,-0.2)}.plot(0.01, minval:-1, maxval:1)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Synth`?"}, {"role": "assistant", "content": "Synth — Client-side representation of a synth node on the server"}, {"role": "user", "content": "What does `Synth.new` do?"}, {"role": "assistant", "content": "Create and return a new Synth object, and immediately start the corresponding synth node on the server."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n// create a Synth at the head of the default Server's default group\n// based on the SynthDef \"default\"\nx = Synth.new(\"default\");\ns.queryAllNodes; // note the default group (ID 1)\nx.free;\n\n// Using an arrayed control\n// run this block first to make the SynthDef\n(\nSynthDef(\"help-synth\", { |freq = #[440, 450, 460], out = 0|\n Out.ar(out, Mix(SinOsc.ar(freq, 0, 0.1)));\n}).add;\n);\n\n// then this a short while later\nx = Synth(\"help-synth\", [freq: [500, 501, 510]]);\n\nx = Synth(\"help-synth\", [freq: [500, 501, 510]]);\nx.set(\\freq, [1, 2, 3] * 400 + [1, 2, 3], \\out, 1);\nx.set(\\freq, [3] * 400 + [1, 2, 3], \\out, 1);\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Using sine waves to generate a saw waveform."}, {"role": "assistant", "content": "```supercollider\nq={|f,e|a=Array.fill(e,{|j|e-j}).reverse;(Mix.ar(a.collect{|x|SinOsc.ar(f*x,0,1/x)})/2)!2};{q.(60,300)}.play //saw from sine #supercollider\n\n//Change the values passed to q to control the frequency and how many sines are used.\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Pbind`."}, {"role": "assistant", "content": "```supercollider\nPbind(note: Pseq([0, 4, 7]), amp: 0.1, dur: 0.2).play\n```"}]} -{"conversations": [{"role": "user", "content": "What is `CondVar`?"}, {"role": "assistant", "content": "CondVar — Condition variable: block one or more threads until some condition is true"}, {"role": "user", "content": "What does `CondVar.wait` do?"}, {"role": "assistant", "content": "The behavior depends on whether a `predicate` is given. If no `predicate` is given, this method simply blocks the current thread until it is woken by `signalOne` or `signalAll`. Otherwise, this method is equivalent to `while { predicate.value.not } { cond.wait }`. In other words, the thread only blocks if the predicate is false, otherwise it blocks and only resumes once the thread has been signall"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nc = CondVar();\n\nRoutine {\n 1.wait;\n \"waited for 1 second\".postln;\n 1.wait;\n \"waited for another second, now waiting for you to run 'c.signalOne'...\".postln;\n c.wait;\n \"the condition is no longer waiting\".postln;\n 1.wait;\n \"waited for another second, now waiting for you...\".postln;\n c.wait;\n \"the condition is no longer waiting\".postln;\n 1.wait;\n \"the end\".postln;\n}.play;\n);\n\n// Run this line to unblock the routine\nc.signalOne;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `IsOdd.value` do? What arguments does it take?"}, {"role": "assistant", "content": "validates that the tested object is an odd number Arguments: obj."}]} -{"conversations": [{"role": "user", "content": "What does `SimpleNumber.sign` do?"}, {"role": "assistant", "content": "one-dimensional value Returns: Answer -1 if negative, +1 if positive or 0 if zero."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// compare PL and PLn, start with polling two items from each Stream\n// Note that Pseq defaults to repeats = 1 and PL/PLn default to repeats = inf\n\n(\n~a = Pseq([1, 2, 3]);\nx = PLn(\\a).asStream;\ny = PL(\\a).asStream;\n\nx.nextN(2);\ny.nextN(2);\n);\n\n\n// replace proxy source \n\n~a = ~a * 100;\n\n\n// Stream from PLn finishes before replacement\n\nx.nextN(2)\n\n// With PL substream is replaced immediately\n\ny.nextN(2\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// compare PL and PLn, start with polling two items from each Stream\n// Note that Pseq defaults to repeats = 1 and PL/PLn default to repeats = inf\n\n(\n~a = Pseq([1, 2, 3]);\nx = PLn(\\a).asStream;\ny = PL(\\a).asStream;\n\nx.nextN(2);\ny.nextN(2);\n);\n\n\n// replace proxy source \n\n~a = ~a * 100;\n\n\n// Stream from PLn finishes before replacement\n\nx.nextN(2)\n\n// With PL substream is replaced immediately\n\ny.nextN(2)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n{Mix({|i|var j=Impulse,t=TChoose.kr(j.kr(1/8),[1,6,3]/8),r=Ringz.ar(j.ar(i*t+0.25),600*t*i+[0,9]);CombC.ar(r,1,0.5,4,0.1,r)}!4).tanh/4}.play\n```"}, {"role": "assistant", "content": "Hi colliders, this is my first post here, and also my very first sc tweet! \r\nIt's nothing special, just a little rhythmic Ringz thingy...\r\nAs a beginner, I found this really useful getting the hang of some syntax shortcuts:\r\nhttp://schemawound.com/post/25710867587/supercollider-tweets-background-tips."}]} -{"conversations": [{"role": "user", "content": "What does `SynthDesc.controlDict` do?"}, {"role": "assistant", "content": "An IdentityDictionary of the ControlName's, indexed by name. This can be used for fast lookup of control index by name, for example to set a specific element of a multichannel"}]} -{"conversations": [{"role": "user", "content": "What does `FoaSFVL.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "First Order Ambisonic (FOA) Soundfield Velocity Level Arguments: in — The B-format signal, an array: [w, x, y, z]; size — Analysis filter kernel size.; method — The Soundfield analysis method:."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// sound example\n(\nvar a = { 19.rand };\nvar b = a.sqrt;\nfork {\n 15.do {\n (instrument: \\default, note: [a.value, b.value]).play;\n 0.3.wait;\n }\n}\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// sound example\n(\nvar a = { 19.rand };\nvar b = a.sqrt;\nfork {\n 15.do {\n (instrument: \\default, note: [a.value, b.value]).play;\n 0.3.wait;\n }\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\Mirror;\n~description = \"Mirror soundfield\";\n\n~function = {|in = 0, order = 1, mirrorFrontBack = 0, mirrorLeftRight = 0, mirrorUpDown = 0 |\nHOATransMirror.ar(order, in, mirrorFrontBack, mirrorLeftRight, mirrorUpDown);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nq = Pbind(\\freq, 300, \\dur, Pn(0.3, 2));\nq.trace.play;\n\n// Sound-wise ineffective modification of the incoming stream\np = Pbind(\\degree, 6) <> q;\np.trace.play;\n\n// Instead\np = Pbind(\\degree, 6) <> Pfunc { |ev| ev.freq = nil } <> q;\np.trace.play;\n\n// Alternatively\np = Pbind(\\degree, Pfunc { |ev| ev.freq = nil; 6 }) <> q;\np.trace.play;\n\n// Just setting a key to nil from a Pbind pair will end the stream\np = Pbind(\\freq, nil, \\degree, 6 <>\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nq = Pbind(\\freq, 300, \\dur, Pn(0.3, 2));\nq.trace.play;\n\n// Sound-wise ineffective modification of the incoming stream\np = Pbind(\\degree, 6) <> q;\np.trace.play;\n\n// Instead\np = Pbind(\\degree, 6) <> Pfunc { |ev| ev.freq = nil } <> q;\np.trace.play;\n\n// Alternatively\np = Pbind(\\degree, Pfunc { |ev| ev.freq = nil; 6 }) <> q;\np.trace.play;\n\n// Just setting a key to nil from a Pbind pair will end the stream\np = Pbind(\\freq, nil, \\degree, 6) <> q;\np.trace.play; // silent because it outputs no events\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SCluster.release` do? What arguments does it take?"}, {"role": "assistant", "content": "fade out the sound and free all internal nodes and Arguments: releaseTime — fade out time in seconds.; onFreeFunc — a LINKClasses/Function to be evaluated after the reverberating sound disappeared.."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for simple melody algorithmically generated with a Markov Chain."}, {"role": "assistant", "content": "```supercollider\n/* Markov Chain Experiment II\n Jacob Joaquin\n\n Get a visual representation of the Markov Chain here:\n http://codehop.com/supercollider-markov-chain/\n*/\n\n(\n// Synthesizer\nSynthDef(\\my_synth, {|dur = 1.0, amp = 1.0, freq = 440|\n var env = EnvGen.ar(Env.new([1, 0.1, 0], [0.06, dur - 0.06]), doneAction: 2);\n Out.ar([0, 1], SinOsc.ar([freq * 0.995, freq * 1.005], 0, env * amp))\n}).add; \n\n// Create task\nt = Task({\n // Set attributes of each node\n // [freq, dur, [[next_state, weighted_random],…]]\n var node_list = [\n [60, 1, [[1, 2]]],\n [62, 0.5, [[0, 1], [2, 1]]],\n [63, 1, [[0, 1], [3, 1]]],\n [65, 0.5, [[0, 1], [3, 4], [4, 1]]],\n [67, 1, [[5, 1]]],\n [70, 1.5, [[4, 1], [6, 2]]],\n [69, 1, [[4, 1], [7, 2]]],\n [72, 0.5, [[4, 1], [7, 4], [0, 2]]]\n ];\n\n var node_index = 0;\n var bps = 133.0 / 60.0; // Beats per second\n \n inf.do({\n var weight = 0;\n var random;\n var accumulator;\n var node = node_list[node_index]; \n var freq = node[0].midicps;\n var dur = node[1] / bps;\n var paths = node[2];\n \n // Get total statistical weight of connected nodes\n (0 .. paths.size - 1).do {|i| weight = weight + paths[i][1]};\n \n // Generate random value for choosing next node\n random = weight.rand;\n\n // Choose next node based on statistical weights\n accumulator = paths[0][1];\n \n node_index = block {|break|\n paths.size.do {|i|\n if ((random < accumulator), {\n break.value(paths[i][0])\n }, {\n accumulator = accumulator + paths[i + 1][1] \n })\n }\n };\n \n // Play\n Synth(\\my_synth, [\\dur, dur, \\amp, -3.dbamp, \\freq, freq]); \n dur.wait;\n })\n});\n\nt.start;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LFDNoise1`."}, {"role": "assistant", "content": "```supercollider\n// try wiggling mouse quickly;\n// LFNoise frequently seems stuck, LFDNoise changes smoothly.\n\n{ SinOsc.ar(LFNoise1.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n{ SinOsc.ar(LFDNoise1.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFNoise1.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n\n{ LFDNoise1.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Red3D.rotationX` do? What arguments does it take?"}, {"role": "assistant", "content": "Set the angle of rotation around the X Arguments: theta — In radians.."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Basic tone simulator of a stylophone?"}, {"role": "assistant", "content": "```supercollider\n/*\nRetro Stylophone\n\nReverse engineered from: https://www.waitingforfriday.com/?p=334\n\n1. Relaxation oscillator (UJT)\n\n- generated by a combination of two oscillators. The primary oscillator is a\n current controlled PUT (Programmable Uni-Junction Transistor) relaxation oscillator which is\n responsible for generating the overall tone of the instrument.\n A secondary LFO phase-shifted provides the vibrato\n (the relative slow wavering of a sound around the notes centre pitch)\n\n- around 10 VPP\n\n2. LFO phase-shift (vibrato)\n\n- generated by a low-frequency oscillator made with a transistor and several capacitors,\n which produces a triangle/sine wave fed into the frequency control voltage operating the UJT\n\n- frequency of about 8.5Hz, phased shifted of 180 degree, around 4.2 VPP\n*/\n\n(\nSynthDef(\\stylophone, { |freq = 220, vibAmp = 2, toneAmp = 5, atkTime = 0.01, trigger = 0|\n\n var lfo = OnePole.kr(LFPar.kr(8, mul: vibAmp, add: freq), 0.9); // 180 degree inversion\n var relaxOsc = LFPulse.ar(lfo, width: 0.9, mul: toneAmp);\n\n var asr = EnvGen.kr(Env.asr(atkTime * 5, releaseTime: 0.001, curve: \\lin), gate: trigger);\n\n Out.ar(0, relaxOsc * asr)\n}).add\n);\n\nf = Synth(\\stylophone);\n\nf.set(\\freq, 208.2);\nf.set(\\freq, 233.4);\n\nf.set(\\trigger, 1);\nf.set(\\trigger, 0);\nf.free;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\n{ Mix.new([PinkNoise.ar(0.1), FSinOsc.ar(801, 0.1), LFSaw.ar(40, 0.1)]) }.play\n\n(\nplay({\n Mix.new(Array.fill(8, { SinOsc.ar(500 + 500.0.rand, 0, 0.05) }));\n}))\n\n(\nplay({\n Mix.fill(8, { SinOsc.ar(500 + 500.0.rand, 0, 0.05) });\n})\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\n{ Mix.new([PinkNoise.ar(0.1), FSinOsc.ar(801, 0.1), LFSaw.ar(40, 0.1)]) }.play\n\n(\nplay({\n Mix.new(Array.fill(8, { SinOsc.ar(500 + 500.0.rand, 0, 0.05) }));\n}))\n\n(\nplay({\n Mix.fill(8, { SinOsc.ar(500 + 500.0.rand, 0, 0.05) });\n}))\n```"}]} -{"conversations": [{"role": "user", "content": "What does `MultiSliderView.isFilled` do? What arguments does it take?"}, {"role": "assistant", "content": "If true, the sliders will have their area between the #-reference and the #-value colored, and the area bounded by the lines connecting the reference and the value points will be colored as Arguments: A Boolean.."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Blip thru Formlet, pseudo-vocal synthesis."}, {"role": "assistant", "content": "```supercollider\n// Blip thru Formlet, pseudo-vocal synthesis.\n// hh&adc, since beijing 2005\n// 2019 made quad/MC\n\n// keywords: vocal, voice, formants\n\n/*\nNdef(\\formSing).gui;\nNdef(\\formSing).play;\nNdef(\\formSing).getHalo(\\stepFdev).value;\n*/\nNdef(\\formSing).addSpec(\\root, [20, 500, 6]);\nNdef(\\formSing).addSpec(\\formfrq, [50, 5000, \\exp]);\nNdef(\\formSing).addSpec(\\harm, [1, 256, \\exp]);\nNdef(\\formSing).addSpec(\\formLag, [0.01, 100, \\exp]);\nNdef(\\formSing).addSpec(\\ndiv, [0.01, 1, \\exp]);\nNdef(\\formSing).addSpec(\\fdev, [0, 24, \\amp]);\nNdef(\\formSing).addSpec(\\round, [0, 3, \\amp, 0.05]);\n\n(\n// modulating formant frequency\nNdef(\\formSing, { arg amp=0, root=150, formfrq=500, harm=20, fdev=2, ndiv = 0.2, formLag=0.1, round = 1.5;\n var freqCompare = 1; // ((formfrq / root).log2).abs.min(1).linexp(0, 1, 0.25, 1);\n var in = Blip.ar(\n root.lag(formLag) * LFNoise0.kr(root * ndiv ! q.numChans, fdev.max(0.01) ).midiratio,\n harm.lag(formLag), // .max(formfrq / root * 0.25),\n 0.1\n ) * GrayNoise.ar(0.1 ! q.numChans, 1);\n\n Limiter.ar(Formlet.ar(in, formfrq.lag(formLag), 0.005, 0.02) * (freqCompare * amp.lag(0.1)))\n .softclip;\n});\n);\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// example usage:\n// on machine running the server\n(\ns.options.bindAddress = \"0.0.0.0\"; // allow connections from any address\ns.options.maxLogins = 2; // set to correct number of clients\ns.boot;\n);\n\n// on remote machine connecting to server\n(\no = ServerOptions.new;\no.maxLogins = 2;\nt = Server.remote(\\remote, NetAddr(\"192.168.0.130\", 57110), o); // set to correct address and port\n// info about returned client ID should be posted in the post window\nt.makeWindow; // make a window for monitoring\n)\n\n// if you want to use the remote server without the need to explicitly pass it to e.g. Synth or Function\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// example usage:\n// on machine running the server\n(\ns.options.bindAddress = \"0.0.0.0\"; // allow connections from any address\ns.options.maxLogins = 2; // set to correct number of clients\ns.boot;\n);\n\n// on remote machine connecting to server\n(\no = ServerOptions.new;\no.maxLogins = 2;\nt = Server.remote(\\remote, NetAddr(\"192.168.0.130\", 57110), o); // set to correct address and port\n// info about returned client ID should be posted in the post window\nt.makeWindow; // make a window for monitoring\n)\n\n// if you want to use the remote server without the need to explicitly pass it to e.g. Synth or Function -play, set it to be the default server:\n//Server.default = t;\n\n//otherwise, make some sound on the remote server\n{Resonz.ar(Saw.ar([100,101]), Line.kr(100,5000,10, doneAction: 2),mul: -12.dbamp)}.play(target: t); //use target to specify the remote server\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Env.asArray` do?"}, {"role": "assistant", "content": "Converts the Env to an Array in a specially ordered format. This allows for Env parameters to be settable arguments in a SynthDef. See example under"}]} -{"conversations": [{"role": "user", "content": "What does `Collection.storeOn` do?"}, {"role": "assistant", "content": "Write a compilable representation of the collection to a"}]} -{"conversations": [{"role": "user", "content": "My Synth runs but I hear nothing. How do I debug it?"}, {"role": "assistant", "content": "Check in this order, because each step eliminates a whole class of causes:\n\n1. **Is anything coming out of the bus you write to?** `Out.ar(0, sig)` for the master. A typo like\n `Out.ar(2, ...)` is silence.\n2. **Is the amplitude non-zero?** Multiply chain of `mul`/`add`, `amp`, and `env` all have to be positive;\n an envelope with `level: 0` or a gate that never opens is silent.\n3. **Did the Synth free itself immediately?** `doneAction: 2` on an EnvGen whose envelope is already\n finished at creation kills the node instantly. `s.plotTree` shows whether the node exists at all.\n4. **Is the envelope actually moving?** `env.poll` inside the SynthDef prints it per block.\n5. **Is the filter closed?** A `LPF.ar(sig, 50)` on a 440 Hz sine leaves almost nothing.\n\nThe fastest single tool is `s.plotTree`: if the Synth is not in the tree, the problem is lifecycle; if it\nis, the problem is signal."}]} -{"conversations": [{"role": "user", "content": "What does `BSpline.bSplineIntDeltaControls` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: list — (describe argument here). Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "What is `DataFFT` in SuperCollider?"}, {"role": "assistant", "content": "DataFFT — collect data and perform fft Collects data from any OpenBCI board and calculate FFT. Category: External Control."}]} -{"conversations": [{"role": "user", "content": "What does `WebView.onLoadFinished` do?"}, {"role": "assistant", "content": "Sets the object to be evaluated when a page has loaded successfully, passing the view as the"}]} -{"conversations": [{"role": "user", "content": "What does `Event.playAndDelta` do?"}, {"role": "assistant", "content": "Used by EventStreamPlayer to play Events and obtain a time"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\na = {\n var sig, mathsA, foc, eor, mathsB, sig1, noise;\n\n #mathsA, foc, eor = Maths2.ar(0.5, MouseX.kr, 0.5, 1-MouseButton.kr(0,1, 0.001));\n\n sig = LFTri.ar(100+(2000*mathsA), 0, 0.1);\n mathsB = Maths2.ar(0.001, min(0.1, MouseX.kr), 0.9, 0, 1, eor)[0];\n noise = mathsB*WhiteNoise.ar(0.1);\n\n sig1 = LFTri.ar(20+(mathsB*1400), 0, 0.1);\n\n (sig+sig1+noise).dup\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\na = {\n var sig, mathsA, foc, eor, mathsB, sig1, noise;\n\n #mathsA, foc, eor = Maths2.ar(0.5, MouseX.kr, 0.5, 1-MouseButton.kr(0,1, 0.001));\n\n sig = LFTri.ar(100+(2000*mathsA), 0, 0.1);\n mathsB = Maths2.ar(0.001, min(0.1, MouseX.kr), 0.9, 0, 1, eor)[0];\n noise = mathsB*WhiteNoise.ar(0.1);\n\n sig1 = LFTri.ar(20+(mathsB*1400), 0, 0.1);\n\n (sig+sig1+noise).dup\n}.play\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n// use input amplitude to control Pulse amplitude - use headphones to prevent feedback.\nSynthDef(\"help-AmplitudeMod\",{ arg out=0;\n Out.ar(out,\n Pulse.ar(90, 0.3, Amplitude.kr(SoundIn.ar))\n )\n}).play;\n\n);\n\n\n(\n// use input amplitude to control SinOsc frequency - use headphones to prevent feedback.\nz = SynthDef(\"help-AmplitudeMod\",{ arg out=0, attack=0.01, release=0.01;\n Out.ar(out,\n SinOsc.ar(\n AmplitudeMod.kr(\n SoundIn.ar,\n attack,\n release,\n 1200,\n 4\n// …\n```"}, {"role": "assistant", "content": "use input amplitude to control Pulse amplitude - use headphones to prevent feedback. use input amplitude to control SinOsc frequency - use headphones to prevent feedback. (AmplitudeMod: amplitude follower (deprecated))"}]} -{"conversations": [{"role": "user", "content": "What is `ChaosGen` in SuperCollider?"}, {"role": "assistant", "content": "ChaosGen — UGens that cause chaos \"ChaosGen\" is an abstract class - in other words, a class that you do not use directly. Instead, use one of its subclasses. Various things inherit from this abstract class, including HenonN, LinCongL, LatoocarfianL, GbmanL, CuspL, StandardL, and more. Category: UGens > Generators > Chaotic."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nb.free;\nb = Buffer.read(s, ExampleFiles.apollo11);\n{\n var pointer = Phasor.ar(0, SampleDur.ir / BufDur.ir(b) * XLine.kr(1, 0.25, 20));\n var sound = Warp1.ar(1, b, pointer, 1, 0.3, -1, 16, Line.kr(0, 1, 40), 4);\n Pan2.ar(sound, pointer * 2 - 1, 0.25)\n}.play\n;\nb.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nb.free;\nb = Buffer.read(s, ExampleFiles.apollo11);\n{\n var pointer = Phasor.ar(0, SampleDur.ir / BufDur.ir(b) * XLine.kr(1, 0.25, 20));\n var sound = Warp1.ar(1, b, pointer, 1, 0.3, -1, 16, Line.kr(0, 1, 40), 4);\n Pan2.ar(sound, pointer * 2 - 1, 0.25)\n}.play\n);\nb.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What is SuperCollider?"}, {"role": "assistant", "content": "SuperCollider is a platform for audio synthesis and algorithmic composition, written in C++ and SuperCollider. It splits into a language client (sclang) that runs your code and builds UGen graphs, and an audio server (scsynth) that does the DSP in real time. They talk over OSC."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{ var nse, env, kic;\n kic = tanh(Ringz.ar(LPF.ar(Trig.ar(Impulse.ar(1.0),SampleDur.ir),1000),30,0.25,7).sin*2);\n env = Env.perc(0.05, 1, 1, -4);\n nse = BrownNoise.ar(2) + PinkNoise.ar(0.5) * EnvGen.kr(env,Impulse.kr(1), doneAction: 2);\n\n nse = Mix.ar(BPF.ar(nse,[100,1200,80,40,20],MouseX.kr(0,1),[1,0.2,1,1,1]));\n nse = LPF.ar(nse + kic, MouseY.kr(100,1000))! 2\n\n}.play\n)\n```"}, {"role": "assistant", "content": "A muffled thump. An attempt at a Jurassic Park © glass of water sort of thing - or breaking into a silo."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nd = { |freq = 440| SinOsc.ar(LastValue.ar(freq, 20), 0, 0.2) }.play;\n\nd.set(\\freq, 400);\nd.set(\\freq, 200);\nd.set(\\freq, 670);\nd.set(\\freq, 680);\nd.set(\\freq, 695;\nd.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nd = { |freq = 440| SinOsc.ar(LastValue.ar(freq, 20), 0, 0.2) }.play;\n\nd.set(\\freq, 400);\nd.set(\\freq, 200);\nd.set(\\freq, 670);\nd.set(\\freq, 680);\nd.set(\\freq, 695);\nd.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Rand`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-Rand\", { |out = 0|\n Out.ar(out,\n FSinOsc.ar(\n Rand(200.0, 400.0),\n 0, Line.kr(0.2, 0, 1, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n(\nRoutine({\n 8.do({\n Synth.new(\"help-Rand\"); 1.0.wait;\n })\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n~buf = Buffer.read(s, \"C:/sounds/break.wav\");\nPlayBuf.ar(1, ~buf, BufRateScale.kr(~buf), loop: 1);\n```"}, {"role": "assistant", "content": "Loads a sound file into server memory, then plays it in a loop at the file's original pitch.\n\n- `Buffer.read(s, path)` allocates a buffer on the server and fills it from the file. It is asynchronous:\n the Buffer object returns immediately, the samples arrive later.\n- `PlayBuf.ar(1, buf, ...)` needs the channel count first — 1 for a mono file. A wrong count is the usual\n cause of a buffer that plays wrongly or not at all.\n- `BufRateScale.kr(buf)` compensates when the file's sample rate differs from the server's, so `rate: 1` is\n the file's true speed.\n- `loop: 1` restarts at the end instead of stopping.\n\nBecause the read is asynchronous, this line pair is only safe if a `s.sync` or a wait happened in between;\notherwise PlayBuf sees a buffer with no data yet."}]} -{"conversations": [{"role": "user", "content": "What does `Main.scVersionTweak` do?"}, {"role": "assistant", "content": "The \"tweak\" version is typically only used to distinguish pre-release versions of SC from proper releases. It may be Returns: tweak version as a String"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nSynthDef(\"help-PulseCount\", { |out = 0|\n Out.ar(out,\n SinOsc.ar(\n PulseCount.ar(Impulse.ar(10), Impulse.ar(0.4)) * 200,\n 0, 0.05\n )\n )\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nSynthDef(\"help-PulseCount\", { |out = 0|\n Out.ar(out,\n SinOsc.ar(\n PulseCount.ar(Impulse.ar(10), Impulse.ar(0.4)) * 200,\n 0, 0.05\n )\n )\n}).play;\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for more tweets (pitchshift feedback + sinoscfb)?"}, {"role": "assistant", "content": "```supercollider\n// probably horrible for speakers... \n\n// glitchift\n{l=LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j**[l,k],k),[0.05,0.03],j);LocalOut.ar(s);s}.play;\n// drone\n{l=LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j**[2,2.1],k),[0.05,0.03],j);LocalOut.ar(s);s}.play;\n\n\n// few more I was mucking around with (remove tanh loop for < 140c)\n{l = LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j**l,k),[0.05,0.03],j);5.do{s=s.tanh+(s*0.1)};LocalOut.ar(s);s}.play;\n\n{l = LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j**2,k),[0.05,0.03],j);5.do{s=s.tanh+(s*0.1)};LocalOut.ar(s);s}.play;\n\n{l = LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j*20,k),[0.05,0.03],j);5.do{s=s.tanh+(s*0.1)};LocalOut.ar(s);s}.play;\n\n{l = LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j**j,k),[0.05,0.03],j);5.do{s=s.tanh+(s*0.1)};LocalOut.ar(s);s}.play;\n\n{l = LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j**l.abs,k),[0.05,0.03],j);5.do{s=s.tanh+(s*0.1)};LocalOut.ar(s);s}.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes THX Deep Note inspired synth sketch."}, {"role": "assistant", "content": "```supercollider\n// A. Broz: Deep Choir (v2, 2020-10-29)\n(\n~numVoices = 30;\n\n~chaos = { |range = 1.0|\n ~numVoices collect: { exprand(180 / range, 260 * range) }\n};\n\n~bigChord = { |fund = 30, harmonics = 5|\n ~numVoices collect: {\n fund\n * rrand(1, harmonics) // build chord\n * rrand(1, 2) * rrand(1, 2) // octaves\n + rrand(-1.2, 1.2) // beats\n }\n};\n\n// Try with Pmono\nSynthDef(\\fakeTHX, {\n var env = EnvGen.kr(\n envelope: Env.adsr(15, \\decay.kr(10), 1, 10, curve: \\sine),\n gate: \\gate.kr(1),\n doneAction: Done.freeSelf,\n );\n var chord = \\freq.kr(~chaos.value, \\lag.kr(10));\n var meander = \\meander.kr(0.3, 8);\n var sig = chord collect: { |f|\n f = f * LFNoise2.kr(rrand(0.3, 0.8)).exprange(1 - meander, 1 + meander);\n BLowPass.ar(Saw.ar(f), f, 0.6);\n };\n sig = Splay.ar(sig, 0.8) * env * \\mul.kr(0.5, 3);\n Out.ar(0, sig);\n}).add;\n);\n\n(\nRoutine({\n var fakeTHX = Synth(\\fakeTHX);\n\n 10.wait;\n\n fakeTHX.set(\\meander, 0);\n\n fakeTHX.set(\\freq, ~bigChord.(30, 5));\n\n 10.wait;\n\n fakeTHX.set(\\gate, 0);\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `FunctionDef.argumentString` do? What arguments does it take?"}, {"role": "assistant", "content": "Return a string that contains all argument names and their default values for embedding in a string. If there are no arguments, it returns nil. `{ |a = 9, b = 10, c| a + b }.def.argumentString; // \"a = 9, Arguments: withDefaultValues — If set to false, no default values are appended `// \"a, b, c\"`; withEllipsis — If set to true, ellipsis characters (`\" ... \"`) are appended `// \"a = 9, b = 10 ... c\"`; asArray — If set to true, return the string for an array that represents all arguments. The other arguments are set to false. `// \"[a, b] ++ c\"`."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// record a buffer\nb = { Blip.ar(XLine.kr(10000, 4, 3) * [1, 1.2], 20) * 0.1 }.asBuffer(3, fadeTime: 0.1)\nb.plot; // after 3 seconds, you can see it.\n// play the soundfile back\n{ PlayBuf.ar(b.numChannels, b, LFNoise2.kr(2 ! 8).exprange(0.15, 1), loop: 1.sum }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// record a buffer\nb = { Blip.ar(XLine.kr(10000, 4, 3) * [1, 1.2], 20) * 0.1 }.asBuffer(3, fadeTime: 0.1)\nb.plot; // after 3 seconds, you can see it.\n// play the soundfile back\n{ PlayBuf.ar(b.numChannels, b, LFNoise2.kr(2 ! 8).exprange(0.15, 1), loop: 1).sum }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Dxrand`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a, freq, trig;\n a = Dxrand([1, 3, 2, 7, 8], inf);\n trig = Impulse.kr(MouseX.kr(1, 400, 1));\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `MassEditUChain.release` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: time — (describe argument here). Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "What does `NumberBox.clipLo` do? What arguments does it take?"}, {"role": "assistant", "content": "The lowest numerical value allowed. Trying to set a lower value will clip it to Arguments: A Float.."}]} -{"conversations": [{"role": "user", "content": "What does `Date.rawSeconds` do?"}, {"role": "assistant", "content": "Get or set the receiver's raw time in seconds (relative to the \"epoch\" of January 1, 1970). If you modify this property, the other properties will not update. See note at #-resolve — there is no \"resolveFromRawSeconds\" method, but you can generate a new self-consistent Date instance by passing the `rawSeconds` as an argument to"}]} -{"conversations": [{"role": "user", "content": "What does `Array.pyramidg` do?"}, {"role": "assistant", "content": "Like pyramid, but keep the resulting values grouped in subarrays. `//"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `HPZ2`."}, {"role": "assistant", "content": "```supercollider\n// Compare:\n\n{ WhiteNoise.ar(0.25) }.play;\n\n{ HPZ2.ar(WhiteNoise.ar(0.25)) }.play;\n\n// HPZ2 is useful to detect changes in a signal:\n// see also HPZ1\n(\n{\n var changingSignal = LFNoise0.ar(1000);\n var hpz2 = HPZ2.ar(changingSignal);\n [hpz2, hpz2 > 0]\n}.plot\n);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PanB2`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var w, x, y, p, a, b, c, d;\n\n p = PinkNoise.ar; // source\n\n // B-format encode\n #w, x, y = PanB2.ar(p, MouseX.kr(-1, 1), 0.1);\n\n // B-format decode to quad\n #a, b, c, d = DecodeB2.ar(4, w, x, y);\n\n [a, b, d, c] // reorder to my speaker arrangement: Lf Rf Lr Rr\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// randomly modulate params\n(\n{ LinCongN.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(0.1, 0.5, 1.4),\n LFNoise2.kr(0.1, 0.1, 0.1),\n LFNoise2.kr(0.1)\n) * 0.2 }.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// randomly modulate params\n(\n{ LinCongN.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(0.1, 0.5, 1.4),\n LFNoise2.kr(0.1, 0.1, 0.1),\n LFNoise2.kr(0.1)\n) * 0.2 }.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `UGen`."}, {"role": "assistant", "content": "```supercollider\n{ Blip.ar(Blip.kr(4, 5, 500, 60), 59, 0.1) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `FreqScopeView.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Frequency analysis view Arguments: parent — The parent view.; bounds — An instance of Rect, or a Point indicating `width@height`.; server — The server to be shown in scope.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// increase phase multiplier\n{ FBSineN.ar(SampleRate.ir, 1, 0, XLine.kr(1, 2, 10), 0.1) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// increase phase multiplier\n{ FBSineN.ar(SampleRate.ir, 1, 0, XLine.kr(1, 2, 10), 0.1) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Saw`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n SynthDef(\\controlList, { |out = 0, freq = 440, amp = 0.1, detune = #[0.999, 1.001], gate = 1|\n var sig = Mix(Saw.ar(freq * (detune ++ [1]), amp)),\n env = EnvGen.kr(Env.adsr, gate, doneAction: Done.freeSelf);\n Out.ar(out, (sig * env) ! 2);\n }).add;\n\n SynthDescLib.global[\\controlList]\n )\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// Resonator, must subtract blockSize for correct tuning\n(\nSynthDef(\"testRes\", {\n \nvar freq = 300, localIn, input, limitLevel = 0.2, output;\nvar feedbackAmt = 0.999;\n\nfreq = MouseY.kr(20, 678, \\exponential).poll;\nfeedbackAmt = MouseX.kr(0.2, 0.99999).poll;\nlocalIn = LocalIn.ar(1); \ninput = LFNoise1.ar(freq * 16, 0.2);\ninput = input + Dust2.ar(freq);\n\n\nLocalOut.ar(\n HPF.ar(LPF.ar(DelayC.ar(input + (localIn * feedbackAmt), 2, freq.reciprocal - ControlRate.ir.reciprocal), freq * 8), freq * 0.125)\n);\n\noutput = Limiter.ar(localIn, limitLevel, 0.01) * limitLevel.reciprocal;\nOffsetOut.ar(0, output ! 2);\n\n}).play(s);\n\n)\n```"}, {"role": "assistant", "content": "Using filtered feedback with a noise input to produce a tone. Some bass notes turn a little noisy if the freq is left at one value for a few seconds. It's worth scoping this too.\r\nRoom for improvement: some of the vars could / should be arguments."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DecodeB2`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var w, x, y, p, a, b, c, d;\n\n p = PinkNoise.ar; // source\n\n // B-format encode\n #w, x, y = PanB2.ar(p, MouseX.kr(-1, 1), 0.1);\n\n // B-format decode to quad\n #a, b, c, d = DecodeB2.ar(4, w, x, y);\n\n [a, b, d, c] // reorder to my speaker arrangement: Lf Rf Lr Rr\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `AbstractGridLines` in SuperCollider?"}, {"role": "assistant", "content": "AbstractGridLines — Calculates the numerical values suitable for grid lines to be used for plotting or other UI elements. `AbstractGridLines` and its subclasses are strategy objects that find suitable intervals for plotting grid lines and labels. The data range and warping behavior (e.g. linear or exponential) are derived from the corresponding ControlSpec. The instance methods of `AbstractGridLines` are used by DrawGrid (which is in turn used by Plotter) for getting logically spaced intervals that span the data for Category: GUI > Accessories."}]} +{"conversations": [{"role": "user", "content": "Which keys does a Pbind understand?"}, {"role": "assistant", "content": "The ones you use constantly are \\instrument (a SynthDef name), \\dur (seconds), \\degree (scale degree), \\midinote, \\freq, \\amp, \\legato (note length as a fraction of \\dur), and \\scale plus \\root for the scale used by \\degree. Everything else is passed to the Synth as an argument, so a SynthDef with `|cutoff = 800|` can be driven by `\\cutoff, Pwhite(400, 4000)`."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a, b;\na = Place(#[1, [2, 5], [3, 6]], inf);\nx = a.asStream;\n8.do({ x.next.postln });\n);\n\n1\n2\n3\n1\n5\n6\n1\n2\n\n\n\n// Place used as a sequence of pitches\n\n(\nSynthDef(\"help-sinegrain\",\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n(\nc = Place(#[0, 0, [0, 4, 7], [1, 5,\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a, b;\na = Place(#[1, [2, 5], [3, 6]], inf);\nx = a.asStream;\n8.do({ x.next.postln });\n);\n\n1\n2\n3\n1\n5\n6\n1\n2\n\n\n\n// Place used as a sequence of pitches\n\n(\nSynthDef(\"help-sinegrain\",\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n(\nc = Place(#[0, 0, [0, 4, 7], [1, 5, 8], [2, 6, 9]], inf) + 67;\nx = c.asStream;\nRoutine({\n loop({\n Synth(\"help-sinegrain\", [\\freq, x.next.midicps]);\n 0.17.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `UnaryOpUGen` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\na = WhiteNoise.ar; // a WhiteNoise\nb = a.squared; // a UnaryOpUGen.\nb.operator; // squared\n\n// sound example\n\n{ var a = LFSaw.ar(300).range(0, 2pi); a.sin * 0.1 }.play;\n\n// Plotting the \"abs\" unary operator (via the server):\n\n{ SinOsc.ar(300).abs }.plot\n```"}]} {"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// running this line will show all your MIDI ins and outs on the console\n// find the number of the output interface you want to use\nMIDIClient.init;\n\n// select the midi out you would like to use\nm = MIDIOut( 8 ).latency_(0.0);\n\n// send a sysex functions\n// some example messages MKS-50 here:\n// \"http://www.vintagesynth.com/roland/sysex.php\"\n// this one using MIDI CHANNEL 2 ( 0x01 )\n\n// set filter\n~set_param = { | param, value |\n m.sysex(Int8Array[ 0xF0, 0x41, 0x36, 0x01, 0x23, 0x20, 0x01, param, value, 0xf7]);\n};\n\n\n// connect will connect to all midi in devices\n// if you need to specify one,\n// check the sources at: MIDIClient.sources\n// and connect using MIDIIn.connect( source_index )\nMIDIIn.connectAll;\n\n// show incoming control data\n~control = { arg src, channel, control, value;\n \n // ( control + \" : \" + value ).postln;\n \n switch( control,\n 32, {\n // value.postln;\n // still have to convert value to hex number\n ~set_param.value( 0x10, value );\n });\n};\n\nMIDIIn.addFuncTo(\\control, ~control);\n```"}, {"role": "assistant", "content": "This snippet is a proof of concept showing how to map MIDI CC to MIDI Sysex messages.\r\n\r\nIt can be improved by filtering MIDI source, and routing channel and control number in a neater way.\r\n\r\nunfortunately i couldn't test this code on my synths, the CC part was tested."}]} -{"conversations": [{"role": "user", "content": "What is `Pspawner` in SuperCollider?"}, {"role": "assistant", "content": "Pspawner — dynamic control of multiple event streams from a Routine Pspawner allows a routine to dynamically start and stop subpatterns. Category: Streams-Patterns-Events > Patterns > Parallel."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\"pauseSelf-help\", { |out, t_trig|\n PauseSelf.kr(t_trig);\n Out.ar(out, SinOsc.ar(400, 0, 0.2));\n}).add;\n);\n\ns.sendMsg(\"/s_new\", \"pauseSelf-help\", 1731);\ns.sendMsg(\"/n_set\", 1731, \\t_trig, 1);\ns.sendMsg(\"/n_run\", 1731, 1);\ns.sendMsg(\"/n_set\", 1731, \\t_trig, 1);\ns.sendMsg(\"/n_free\", 1731;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\"pauseSelf-help\", { |out, t_trig|\n PauseSelf.kr(t_trig);\n Out.ar(out, SinOsc.ar(400, 0, 0.2));\n}).add;\n);\n\ns.sendMsg(\"/s_new\", \"pauseSelf-help\", 1731);\ns.sendMsg(\"/n_set\", 1731, \\t_trig, 1);\ns.sendMsg(\"/n_run\", 1731, 1);\ns.sendMsg(\"/n_set\", 1731, \\t_trig, 1);\ns.sendMsg(\"/n_free\", 1731);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `PlayerSocket.qrespawnPlayer` do? What arguments does it take?"}, {"role": "assistant", "content": "restart the currently playing Arguments: releaseTime."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Nested ifs in a SynthDef?"}, {"role": "assistant", "content": "```supercollider\n(\n{\nvar noise, out;\nnoise = LFNoise0.kr(8);\n\nout = if( noise > 0.0,\n if(noise > 0.5, \n if(noise > 0.9, WhiteNoise.ar(0.2), Pulse.ar(60, 0.5, 0.4)),\n SinOsc.ar(500, 0, 0.25)\n ),\n Saw.ar(160, 0.5)\n);\n\nout ! 2\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a kick drum in SuperCollider."}, {"role": "assistant", "content": "A pitch-swept sine with a fast decay: the frequency envelope is what makes it read as a kick.\n\n```supercollider\n(\nSynthDef(\\kick, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 50, 40], [0.03, 0.15], -4));\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -6), doneAction: 2);\n Out.ar(out, Pan2.ar(SinOsc.ar(pitch) * env * amp));\n}).add;\n);\nSynth(\\kick);\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// example: same as TwoPole\n(\n{\n var rho, theta, b1, b2;\n theta = MouseX.kr(0.2pi, pi);\n rho = MouseY.kr(0.6, 0.99);\n b1 = 2.0 * rho * cos(theta);\n b2 = rho.squared.neg;\n SOS.ar(LFSaw.ar(200, 0, 0.1), 1.0, 0.0, 0.0, b1, b2)\n}.play\n);\n\n\n(\n{\n var rho, theta, b1, b2;\n theta = MouseX.kr(0.2pi, pi);\n rho = MouseY.kr(0.6, 0.99);\n b1 = 2.0 * rho * cos(theta);\n b2 = rho.squared\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// example: same as TwoPole\n(\n{\n var rho, theta, b1, b2;\n theta = MouseX.kr(0.2pi, pi);\n rho = MouseY.kr(0.6, 0.99);\n b1 = 2.0 * rho * cos(theta);\n b2 = rho.squared.neg;\n SOS.ar(LFSaw.ar(200, 0, 0.1), 1.0, 0.0, 0.0, b1, b2)\n}.play\n);\n\n\n(\n{\n var rho, theta, b1, b2;\n theta = MouseX.kr(0.2pi, pi);\n rho = MouseY.kr(0.6, 0.99);\n b1 = 2.0 * rho * cos(theta);\n b2 = rho.squared.neg;\n SOS.ar(WhiteNoise.ar(0.1 ! 2), 1.0, 0.0, 0.0, b1, b2)\n}.play\n);\n\n// example with SOS.kr kr as modulator\n(\n{\n var rho, theta, b1, b2, vib;\n theta = MouseX.kr(0.2pi, pi);\n rho = MouseY.kr(0.6, 0.99);\n b1 = 2.0 * rho * cos(theta);\n b2 = rho.squared.neg;\n\n vib = SOS.kr(LFSaw.kr(3.16), 1.0, 0.0, 0.0, b1, b2);\n SinOsc.ar(vib * 200 + 600) * 0.2\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes open files within the Modality workshop folder."}, {"role": "assistant", "content": "```supercollider\n// open files within the Modality workshop folder\n\n~basePath = \"\".resolveRelative;\n\n// installing Modality and other quarks for this workshop:\n(~basePath +/+ \"0_installing.scd\").openDocument;\n\n// finding and defining devices:\n(~basePath +/+ \"1_finding_and_defining_devices_hid.scd\").openDocument;\n(~basePath +/+ \"1_finding_and_defining_devices_midi.scd\").openDocument;\n\n// exploring elements and actions:\n(~basePath +/+ \"2_elements_and_actions_hid.scd\").openDocument;\n(~basePath +/+ \"2_elements_and_actions_midi.scd\").openDocument;\n\n// using ndefs:\n(~basePath +/+ \"3_using_ndefs_hid.scd\").openDocument;\n(~basePath +/+ \"3_using_ndefs_midi.scd\").openDocument;\n\n\n// some shared sound processes\n(~basePath +/+ \"shared_processes\").openOS;\n\n(~basePath +/+ \"shared_processes/*\").pathMatch.collect(_.basename).postcs;\n(~basePath +/+ \"shared_processes/*\").pathMatch.choose.openDocument;\n// open one of them:\n(~basePath +/+ \"shared_processes/cat.scd\").openDocument;\n// load one directly, e.g. for use in controller patches:\n(~basePath +/+ \"shared_processes/cat.scd\").load;\n\n// ... you are welcome to share your own sound processes here!\n\n// some more modal functionality using MFunc:\n(~basePath +/+ \"5_modal_functionality_2_hid.scd\").openDocument;\n(~basePath +/+ \"5_modal_functionality_2_midi.scd\").openDocument;\n(~basePath +/+ \"5_modal_functions_2b_midi.scd\").openDocument;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// nothing especially implemented\n\n(\nx = {\n var trig = Impulse.ar(7);\n var in = [0, 8.5];\n var maxLookBack = [1, 3];\n var loDev = [-1, -5];\n var hiDev = [1, 5];\n var midi = { |i| Demand.ar(trig, 0,\n DIdev(\n in[i] + SinOsc.ar(0.1, -pi/2).range(65, 85).round,\n maxLookBack: maxLookBack[i],\n loDev: loDev[i],\n hiDev: hiDev[i]\n ).dpoll(label: \"midi_\" ++ (i == 0).if { \"lo\" }{ \"hi\"})\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// nothing especially implemented\n\n(\nx = {\n var trig = Impulse.ar(7);\n var in = [0, 8.5];\n var maxLookBack = [1, 3];\n var loDev = [-1, -5];\n var hiDev = [1, 5];\n var midi = { |i| Demand.ar(trig, 0,\n DIdev(\n in[i] + SinOsc.ar(0.1, -pi/2).range(65, 85).round,\n maxLookBack: maxLookBack[i],\n loDev: loDev[i],\n hiDev: hiDev[i]\n ).dpoll(label: \"midi_\" ++ (i == 0).if { \"lo\" }{ \"hi\"})\n ) } ! 2;\n SinOsc.ar(midi.lag(0.007).midicps, 0, 0.1)\n}.play;\n);\n\nx.release\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Monitor`."}, {"role": "assistant", "content": "```supercollider\n{ Out.ar(87, SinOsc.ar(MouseX.kr(240, 1000, 1) * [1, 2, 3], 0, 0.2)) }.play; // play three sine tone on channels 87, 88, and 89\nx = Monitor.new; // create a new monitor\nx.play(fromIndex: 87, fromNumChannels: 3, toIndex: 0, toNumChannels: 2); // play them back to the stereo hardware channels\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// A beautiful sc140 tweet by Batuhan Bozkurt, parametrized for real-time changes\n(\n// Start sound here\na = { | rateL = 5, rateR = 6, blipMul = 100, blipAdd = 50, fMul = 50, kMul = 1 |\n f = LocalIn.ar(2).tanh;\n k = Latch.kr(f[0].abs,Impulse.kr(1/4)) * kMul;\n LocalOut.ar(\n f +\n CombC.ar(Blip.ar([rateL, rateR], blipMul * k + blipAdd, 0.9), 1, k*0.3, fMul * f));f\n}.play\n);\n\n// Set parameters for changing sound here: \n\na.set(\\rateL, 10);\n\na.set(\\rateR, 8);\n\na.set(\\blipMul, 25);\n\na.set(\\blipAdd, 70);\n\na.set(\\fMul, 30);\n\n\na.set(\\kMul, 0.01);\n```"}, {"role": "assistant", "content": "A beautiful sc140 tweet by Batuhan Bozkurt, parametrized for real-time changes. To do: Add gui widgets for easier interactive control."}]} -{"conversations": [{"role": "user", "content": "What does `DrawGrid.fontColor` do? What arguments does it take?"}, {"role": "assistant", "content": "Get/set the font Arguments: c — A Color.. Returns: A Color."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n//code that utilizes the glitch.\n//warning! extremely loud.\n//note: might not sound the same on all soundcards\n(\n{GlitchHPF.ar(\n BrownNoise.ar(1.dup),\n 0.5,\n Saw.kr(1, 10)\n)}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n//code that utilizes the glitch.\n//warning! extremely loud.\n//note: might not sound the same on all soundcards\n(\n{GlitchHPF.ar(\n BrownNoise.ar(1.dup),\n 0.5,\n Saw.kr(1, 10)\n)}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// bend all numerical values by adding controls\nNdef(\\bubbles, {\n var index = 0;\n Bend({ |original|\n [original, original.isNumber, index].postln;\n if(original.isNumber) {\n original = NamedControl.kr(\"bend_\"++index, original);\n index = index + 1;\n };\n original;\n }, {\n f = LFSaw.kr(0.4, 0, 24, LFSaw.kr([8,7.23], 0, 3, 80)).midicps; // glissando function\n CombN.ar(SinOsc.ar(f, 0, 0.04), 0.2, 0.2, 4) // echoing sine wave\n })\n}).play)\n\n\nNdef(\\bubbles).g\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// bend all numerical values by adding controls\nNdef(\\bubbles, {\n var index = 0;\n Bend({ |original|\n [original, original.isNumber, index].postln;\n if(original.isNumber) {\n original = NamedControl.kr(\"bend_\"++index, original);\n index = index + 1;\n };\n original;\n }, {\n f = LFSaw.kr(0.4, 0, 24, LFSaw.kr([8,7.23], 0, 3, 80)).midicps; // glissando function\n CombN.ar(SinOsc.ar(f, 0, 0.04), 0.2, 0.2, 4) // echoing sine wave\n })\n}).play)\n\n\nNdef(\\bubbles).gui(20);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `FSinOsc`."}, {"role": "assistant", "content": "```supercollider\n{ FSinOsc.ar(800) * 0.2 }.play;\n\n{ FSinOsc.ar(XLine.kr(200, 4000, 1)) * 0.2 }.play;\n\n// loses amplitude towards the end\n{ FSinOsc.ar(FSinOsc.ar(XLine.kr(4, 401, 8), 0.0, 200, 800)) * 0.2 }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// crucial-library - sends midi clock and song position pointer\n// x.add( MIDIClockOut(\"IAC Driver\", \"IAC Bus 1\") )\n\nMxUnit.register('MIDIClockOut',\n(\n make: { arg mco;\n ~source = mco;\n MxUnit(mco, [], [])\n },\n spawnToBundle: { arg b;\n b.addFunction({~source.start}.inEnvir)\n },\n stopToBundle: { arg b;\n b.addFunction({~source.stop}.inEnvir)\n }\n /*,\n gotoBeat: { arg beat, atBeat, bundle;\n [beat, atBeat, bundle].debug;\n ~source.gotoBeatAtBeat(beat, atBeat)\n }*/\n\n));\n```"}, {"role": "assistant", "content": "crucial-library - sends midi clock and song position pointer x.add( MIDIClockOut(\"IAC Driver\", \"IAC Bus 1\") )."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BufWr`."}, {"role": "assistant", "content": "```supercollider\n(\n// allocate a buffer for writinig into\ns = Server.local;\ns.sendMsg(\"/b_alloc\", 0, 44100 * 2);\n);\n\n\n// write into the buffer with a BufWr\n(\ny = { |rate = 1|\n var in;\n in = SinOsc.ar(LFNoise1.kr(2, 300, 400), 0, 0.1);\n BufWr.ar(in, 0, Phasor.ar(0, BufRateScale.kr(0) * rate, 0, BufFrames.kr(0)));\n 0.0 // quiet\n}.play;\n);\n\n// read it with a BufRd\n(\nx = { |rate = 1|\n BufRd.ar(1, 0, Phasor.ar(0, BufRateScale.kr(0) * rate, 0, BufFrames.kr(0)))\n}.play(s);\n);\n\n\n\nx.set(\\rate, 5);\ny.set(\\rate, 2.0.rand);\nx.set(\\rate, 2);\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for The quest for the prime numbers?"}, {"role": "assistant", "content": "```supercollider\n//Prime numbers\n \nServer.default.boot;\n(\n//maximum number\n~max=100;\n\n//synthdefs: 2 filtered sawteeth for number and divisor\nSynthDef ( \\gsaw, {arg g;\n Out.ar(1, \n RLPF.ar ( Saw.ar(20*g), 10000*(1-(g/~max)), 0.2, 0.2)\n )\n}).add;\n\nSynthDef ( \\dsaw, {arg d, g;\n Out.ar(0,\n RLPF.ar( Saw.ar(20*d), 10000*d/sqrt(g), 0.2, 0.2)\n // the square root is important: if you search for the divisors of a number,\n // don't search beyond the square root of the number. There won't be any.\n )\n}).add;\n\n//a fm-sound with carrier 20*number and modulator 20*divisor, modulation index = 10\nSynthDef (\\fm, {arg m, c;\n Out.ar(0,\n Pan2.ar(SinOsc.ar(20*c+(SinOsc.ar(20*m, 0, 200*m, 0))), 0)\n )\n}).add;\n\n);\n(\nr=Routine({\n var number, divisor;\n //the list of prime numbers\n l=Array.newClear(indexedSize: 0);\n\n for (2, ~max,{arg number;\n x=Synth(\\gsaw, [\\g, number]); //play the number\n divisor=2;\n p=true; //prime number?\n while ({((divisor <= (number.sqrt)).and(p == true))},\n { \n y=Synth(\\dsaw, [\\d, divisor, \\g, number]); //play the divisor\n z=Synth(\\fm, [\\m, divisor, \\c, number]); //play the fm sound of number and divisor\n 1.wait; //1 second should be enough to hear if a sound is harmonic\n // harmonic sound means: not a prime number\n y.free; \n z.free; \n if( number.mod(divisor) == 0, {p = false} ); //not a prime number\n divisor = divisor + 1;\n }\n );\n x.free;\n if (p == true){ //primenumber!\n l=l.add(number); //add primenumber to the list\n for (1, l.size, { arg i; //play the list of prime numbers\n z=Synth(\\fm, [\\m, l.size, \\c, l[i]]);\n 0.1.wait;\n z.free;\n });\n }\n\n });\n});\n);\nr.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `PopUpTreeMenu.action` do?"}, {"role": "assistant", "content": "Function that gets evaluated when some leaf is selected. Arguments passed in: `this,"}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n~pad = Synth(\\pad, [\\freq, 165]);\n~pad.set(\\gate, 0);\n```"}, {"role": "assistant", "content": "It starts a sustained synth and then releases it.\n\n`Synth(\\pad, [\\freq, 165])` creates an instance of a SynthDef that takes a `gate` argument (default 1). The\narray after the name is alternating argument names and values: `\\freq, 165`. Setting `\\gate` to 0 does not\ncut the sound dead — the EnvGen inside sees the gate close and runs the release stage of its Env, then frees\nthe Synth because that EnvGen has `doneAction: 2`. This is the standard lifecycle for pads, drones and any\nsound you want to stop gracefully."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n// restricting fm to harmonic sidebands after\n// [Chowning, 1973] Chowning, J. (1973). The synthesis of complex spectra by means of frequency modulation. Journal of the Audio Engineering Society, 21(7):526–534.\n// restriction actually happens because of the specs, not server-side.\n\nSpec.add(\\index, [0, 40]);\nSpec.add(\\harm1, [0, 20, \\lin, 1]);\nSpec.add(\\harm2, [0, 20, \\lin, 1]);\nSpec.add(\\fundFreq, \\freq);\n\nNdef(\\fmk, {\n \n PMOsc.ar(\n \\carFreq.kr(100, 0.1), \n (\\harm1.kr(1, 1)/(\\harm2.kr(1, 1)) * LFNoise1.ar(50).range(0.995, 1.001))*\\carFreq.kr(100), \n \\index.kr(1, 0.1) * SinOsc.ar(2.5).range(0.995, 1.005)\n ) \n})\n);\nNdef(\\fmk).gui\n```"}, {"role": "assistant", "content": "Restricting fm to harmonic sidebands after[Chowning, 1973]. Restriction actually happens because of the specs, not server-side.\r\n----- \r\nChowning, J. (1973). The synthesis of complex spectra by means of frequency modulation. Journal of the Audio Engineering Society, 21(7):526–534."}]} -{"conversations": [{"role": "user", "content": "What does `Node.waitForFree` do?"}, {"role": "assistant", "content": "Wait until this Node is freed. Should be used inside a Routine or"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for We all could use a little more?"}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\cowbell, {\n | out=0, amp=0.3, gate=1, fund_freq=540, pan=0.0 |\n var sig, env;\n\n sig = Pulse.ar( fund_freq * [ 1, 1.5085 ], [ 0.565, 0.445 ], [ 0.4, 0.6 ] ).distort;\n env = EnvGen.ar(\n Env(\n [ 0, 0.05, 1, 0.1, 0 ], [ 0.003, 0.002, 0.05, 0.5 ], [2, -4, -4, -4]\n ),\n gate: gate,\n timeScale: [ 1.0, 1.5 ],\n doneAction: 2\n );\n sig = Mix( sig * env );\n sig = BPF.ar( sig, fund_freq * 2, 1.808 );\n\n Out.ar( out, Pan2.ar( sig, pan, amp ) );\n}).add;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n~buf = BBCutBuffer(Platform.resourceDir +/+ \"sounds/break.aiff\", 8);\n\nBBCut2(CutGroup([CutBuf3(~buf, 0.3), CutBRF1()]), BBCutProc11()).play(2.5;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n~buf = BBCutBuffer(Platform.resourceDir +/+ \"sounds/break.aiff\", 8);\n\nBBCut2(CutGroup([CutBuf3(~buf, 0.3), CutBRF1()]), BBCutProc11()).play(2.5);\n```"}]} -{"conversations": [{"role": "user", "content": "What is a SynthDef?"}, {"role": "assistant", "content": "A SynthDef is a named, compiled server-side instrument: a UGen graph plus named controls. You build one with SynthDef(\\name, { |args| ... }).add, and then play instances with Synth(\\name)."}]} -{"conversations": [{"role": "user", "content": "What does `HelpBrowser.goTo` do?"}, {"role": "assistant", "content": "Go to specific URL. If the URL points to a file under SCDoc#*helpTargetDir it will be rendered on demand if needed. A URL can also be a local"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Routine`."}, {"role": "assistant", "content": "```supercollider\n// wait\n\n(\nvar r;\nr = Routine {\n 10.do({ |a|\n a.postln;\n // Often you might see Wait being used to pause a routine\n // This waits for one second between each number\n 1.wait;\n });\n // Wait half second before saying we're done\n 0.5.wait;\n \"done\".postln;\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// result of BufRd is used as index for the next BufRd\n// needs Buffer c prepared above\n\n(\ny = {\n GFIS.ar(\n { |x| BufRd.ar(1, c, c.numFrames * x) },\n (LFDNoise3.ar(3) * [1, 1.1]).range(0.5, 0.51), 7\n ) * 0.2\n}.play\n);\n\ny.release\n```"}, {"role": "assistant", "content": "result of BufRd is used as index for the next BufRd needs Buffer c prepared above (GFIS: generalized functional iteration synthesis pseudo ugen)"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\Mirror;\n~description = \"Mirror soundfield\";\n\n~function = {|in = 0, order = 1, mirrorFrontBack = 0, mirrorLeftRight = 0, mirrorUpDown = 0 |\nHOATransMirror.ar(order, in, mirrorFrontBack, mirrorLeftRight, mirrorUpDown);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "What does `DissonanceCurve.+` do? What arguments does it take?"}, {"role": "assistant", "content": "Adds two DiscconanceCurves together in a meaningful way. This would be useful to figure out a scale that works for two different Arguments: other — a Spectrum or a DissonanceCurve. Returns: a new DissonanceCurve"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Compare with Ex. 2 from DXFan help.\n// As DXFanOut, other than DXFan, doesn't return an array, a mix is not necessary, \n// by internal use of Out ugens the signal is mixed to the referred buses anyway.\n\n// For the same reason a normal release doesn't work, to get this option we can add an EnvGate.\n\n(\nx = {\n var lfo = { LFDNoise3.kr(0.2) };\n DXFanOut.ar(\n [Dseq([0, 1], inf), Dseq([1, 0], inf)],\n [\n LFTri.ar(150 * lfo.().range(1, 2), 0, 0.05),\n BPF.ar(PinkNoise.ar(), lfo.().range(1000, 3000),\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Compare with Ex. 2 from DXFan help.\n// As DXFanOut, other than DXFan, doesn't return an array, a mix is not necessary, \n// by internal use of Out ugens the signal is mixed to the referred buses anyway.\n\n// For the same reason a normal release doesn't work, to get this option we can add an EnvGate.\n\n(\nx = {\n var lfo = { LFDNoise3.kr(0.2) };\n DXFanOut.ar(\n [Dseq([0, 1], inf), Dseq([1, 0], inf)],\n [\n LFTri.ar(150 * lfo.().range(1, 2), 0, 0.05),\n BPF.ar(PinkNoise.ar(), lfo.().range(1000, 3000), 0.1, 0.7)\n ] * EnvGate(),\n fadeTime: 0.07,\n width: 1\n )\n}.play\n);\n\nx.release\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `ScurryableInstrGateSpawner` in SuperCollider briefly."}, {"role": "assistant", "content": "ScurryableInstrGateSpawner — a Pbind-like spawner that plays an Instr with streams supplied to its inputs. this one scurries SC does not have the most stable language side scheduling. Higher CPU load can cause scheduling events to be delayed and OSC can be sent unevenly. Category: Libraries > crucial > Instr, Libraries > crucial > Players."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Platform`."}, {"role": "assistant", "content": "```supercollider\n// start a server program from the cmdLine for testing\n~pid = unixCmd(Server.program + s.options.asOptionsString(57100));\n// kill just that server program by its pid:\nthisProcess.platform.killProcessByID(~pid);\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// vibrato at 1 Hz, note the use of DC.ar UGen; a constant of 400.0 doesn't work\n{ SinOsc.ar(Vibrato.ar(DC.ar(400.0), 1, 0.02)) }.play\n\n// compare: k-rate freq input can be a constant\n{ SinOsc.ar(Vibrato.kr(400.0, 1, 0.02)) }.play\n\n// control rate and rateVariation\n{ SinOsc.ar(Vibrato.ar(DC.ar(400.0), MouseX.kr(2.0, 100.0), 0.1, 1.0, 1.0, MouseY.kr(0.0, 1.0), 0.1)) }.play\n\n// control depth and depthVariation\n{ SinOsc.ar(Vibrato.ar(DC.ar(4\n// …\n```"}, {"role": "assistant", "content": "vibrato at 1 Hz, note the use of DC.ar UGen; a constant of 400.0 doesn't work compare: k-rate freq input can be a constant (Vibrato: The Vibrato oscillator models a slow frequency modulation.)"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var freq, trig;\n var in = Dseq([1, 2, 3], inf);\n var rep = Dstutter(Diwhite(2, 8, inf), in);\n trig = Impulse.kr(MouseX.kr(1, 40, 1));\n freq = Demand.kr(trig, 0, rep).poll(trig) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var freq, trig;\n var in = Dseq([1, 2, 3], inf);\n var rep = Dstutter(Diwhite(2, 8, inf), in);\n trig = Impulse.kr(MouseX.kr(1, 40, 1));\n freq = Demand.kr(trig, 0, rep).poll(trig) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Since the allpass delay has no audible effect as a resonator on\n// steady-state sound ...\n\n{ AllpassC.ar(WhiteNoise.ar(0.1), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// ...these examples add the input to the effected sound and compare variants so that you can hear\n// the effect of the phase comb:\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassN.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2)\n}.play)\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassL.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Since the allpass delay has no audible effect as a resonator on\n// steady-state sound ...\n\n{ AllpassC.ar(WhiteNoise.ar(0.1), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// ...these examples add the input to the effected sound and compare variants so that you can hear\n// the effect of the phase comb:\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassN.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2)\n}.play)\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassL.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2)\n}.play)\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassC.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2)\n}.play)\n\n\n// used as an echo - doesn't really sound different than Comb,\n// but it outputs the input signal immediately (inverted) and the echoes\n// are lower in amplitude.\n{ AllpassC.ar(Decay.ar(Dust.ar(1, 0.5), 0.2, WhiteNoise.ar), 0.2, 0.2, 3) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `LeastChange.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Output least changed Arguments: a — Input signal A.; b — Input signal B.."}]} -{"conversations": [{"role": "user", "content": "What does `OSCSched.tsched` do? What arguments does it take?"}, {"role": "assistant", "content": "time based scheduling delta specified in Arguments: seconds; server; bundle; onArrival."}]} -{"conversations": [{"role": "user", "content": "What does `ArrayedCollection.++` do?"}, {"role": "assistant", "content": "Concatenate the contents of the two collections into a new ArrayedCollection."}]} -{"conversations": [{"role": "user", "content": "What does `AbstractDispatcher.typeKey` do?"}, {"role": "assistant", "content": "Subclasses should override this method to return a key indicating the type of message this dispatcher responds to, e.g. `'OSC matched'` or `'MIDI Returns: A Symbol."}]} -{"conversations": [{"role": "user", "content": "What is `Duty` in SuperCollider?"}, {"role": "assistant", "content": "Duty — Demand results from demand rate UGens. A value is demanded of each UGen in the list and output according to a stream of duration values. The unit generators in the list should be 'demand' rate. Category: UGens > Demand."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ArrayedCollection`."}, {"role": "assistant", "content": "```supercollider\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n pitches.size.do{ |i|\n {\n var freq = pitches[i].midicps;\n var env = Env.perc.ar(Done.freeSelf);\n SinOsc.ar(freq) * 0.1 * env\n }.play;\n 0.2.wait\n }\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is a UGen?"}, {"role": "assistant", "content": "A UGen is a unit generator: the primitive signal-processing node of the server. SinOsc, Saw, WhiteNoise, LPF and EnvGen are UGens, and they are wired into a graph inside a SynthDef."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\nb = Buffer.alloc(s, 512, 1);\nb.sine2([1.0, 3], [1, 0.5]);\nx = { Osc.ar(b, 200, 0, 0.5) }.play;\n;\nx.free; b.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\nb = Buffer.alloc(s, 512, 1);\nb.sine2([1.0, 3], [1, 0.5]);\nx = { Osc.ar(b, 200, 0, 0.5) }.play;\n);\nx.free; b.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Rand`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-Rand\", { |out = 0|\n Out.ar(out,\n FSinOsc.ar(\n Rand(200.0, 400.0),\n 0, Line.kr(0.2, 0, 1, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n(\nRoutine({\n 8.do({\n Synth.new(\"help-Rand\"); 1.0.wait;\n })\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "What does `MIDIFunc.midiClock` do?"}, {"role": "assistant", "content": "A convenience method to create a new MIDIFunc which responds to MIDI clock messages. See #*new for argument descriptions. The responding `func` will be passed the argument Returns: A new instance of MIDIFunc which responds to MIDI clock messages."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// You'll only hear the front two channels on a stereo setup.\n\n{ Pan4.ar(PinkNoise.ar, FSinOsc.kr(2), FSinOsc.kr(1.2), 0.3)) }.play;\n\n\n{ Pan4.ar(PinkNoise.ar, -1, 0, 0.3) }.play; // left pair\n{ Pan4.ar(PinkNoise.ar, 1, 0, 0.3) }.play; // right pair\n{ Pan4.ar(PinkNoise.ar, 0, -1, 0.3) }.play; // back pair\n{ Pan4.ar(PinkNoise.ar, 0, 1, 0.3) }.play; // front pair\n\n{ Pan4.ar(PinkNoise.ar, 0, 0, 0.3 }.play; // center\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// You'll only hear the front two channels on a stereo setup.\n\n{ Pan4.ar(PinkNoise.ar, FSinOsc.kr(2), FSinOsc.kr(1.2), 0.3)) }.play;\n\n\n{ Pan4.ar(PinkNoise.ar, -1, 0, 0.3) }.play; // left pair\n{ Pan4.ar(PinkNoise.ar, 1, 0, 0.3) }.play; // right pair\n{ Pan4.ar(PinkNoise.ar, 0, -1, 0.3) }.play; // back pair\n{ Pan4.ar(PinkNoise.ar, 0, 1, 0.3) }.play; // front pair\n\n{ Pan4.ar(PinkNoise.ar, 0, 0, 0.3) }.play; // center\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Image.colorToPixel` do?"}, {"role": "assistant", "content": "Convert a Color into a pixel datatype suitable for setting pixel data in the Image Returns: A 32bit packed Integer in the RGBA format."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// examples\n\np = ProxySpace.push(s.boot); // use ProxySpace as current environment.\n\n~out.play;\n\n~out = { SinOsc.ar([400, 407] * 0.9, 0, 0.2) };\n\n~out = { SinOsc.ar([400, 437] * 0.9, 0, 0.2) * LFPulse.kr([1, 1.3]) };\n\n~out = { SinOsc.ar([400, 437] * 0.9, 0, 0.2) * ~x.kr(2) };\n\n~x = { LFPulse.kr([1, 1.3] * MouseX.kr(1, 30, 1)) };\n\n~out = { SinOsc.ar([400, 437] * Lag.kr(0.1 + ~\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// examples\n\np = ProxySpace.push(s.boot); // use ProxySpace as current environment.\n\n~out.play;\n\n~out = { SinOsc.ar([400, 407] * 0.9, 0, 0.2) };\n\n~out = { SinOsc.ar([400, 437] * 0.9, 0, 0.2) * LFPulse.kr([1, 1.3]) };\n\n~out = { SinOsc.ar([400, 437] * 0.9, 0, 0.2) * ~x.kr(2) };\n\n~x = { LFPulse.kr([1, 1.3] * MouseX.kr(1, 30, 1)) };\n\n~out = { SinOsc.ar([400, 437] * Lag.kr(0.1 + ~x, 0.3), 0, 0.2) * ~x };\n\np.fadeTime = 5;\n\n~out = { SinOsc.ar([400, 437] * 1.1, 0, 0.2) * ~x.kr(2) };\n\np.clear(8); // end and clear all in 8 sec.\n\n\np.pop; // move out.\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Midterm Q3 (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"bell\", {arg freq, amp;\n\n\n var env, snd, partials, relativeAmps;\n\n partials = [0.5, 1, 1.19, 1.56, 2, 2.51, 2.66, 3.01, 4.1];\n relativeAmps = [0.25, 1, 0.8, 0.5, 0.9, 0.4, 0.3, 0.6, 0.1];\n\n env = Env.perc(\n attackTime: 0.01,\n releaseTime: 5,\n level: amp*relativeAmps).kr(doneAction:2);\n\n snd = SinOsc.ar(\n freq: freq*partials,\n mul: env\n );\n\n snd = Mix.ar(snd);\n\n Out.ar(0, snd * 0.1 ! 2);\n\n}).add;\n);\n\n\n//Test your \"bell\" SynthDef with the following Pbind:\n\n\n(\nPbind(\n \\instrument, \"bell\",\n \\degree, Pwhite(-5, 10),\n \\dur, Pwhite(3, 6),\n \\amp, Pwhite(0.1, 0.5)\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "SC can't open or read files?"}, {"role": "assistant", "content": "SuperCollider forum — SC can't open or read files\n\nIt looks as though it’s finally working!\n\nI moved the file to a folder I created in the user support directory for SuperCollider and then changed the quotes to ascii.\n\nI think the issue was that at first I had the file name listed without the extension, then I added the extension to the file name and added the file extension to the file path in the code and this must have created a conflict.\n\nIn the first instance SC needed the file extension, ascii quotes, and since I’m on windows the path needed double \\ in the path file.\n\nThe final working code looks like this:\n\n```supercollider\nb = Buffer.readChannel(s, \"C:\\\\Users\\\\44774\\\\AppData\\\\Local\\\\SuperCollider\\\\Tables\\\\wubsquare.wav\", startFrame:0, numFrames: -1);\n```\n\nThe wav file is simply named wubsquare and I included the file extension in the code."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for lurking line noise."}, {"role": "assistant", "content": "```supercollider\n({var\n rf = 7\n , rt = Impulse.kr(rf)\n , bs = 8.collect({|i| PulseDivider.kr(rt, 16, i*2)})\n , bt = bs[0] + bs[2] + Dust.kr(SinOsc.kr(0.01, 0, 0.25, 0.25))\n , be = Decay.kr(bt, 0.2)\n , se = Decay.kr(bs[5]+bs[6], 0.01)\n , bass = be*SinOsc.ar(SinOsc.ar([5,6], 0, 20, \n Demand.kr(bt, 0, Drand((30..48), inf)).midicps\n ))\n , snar = se*SinOsc.ar(2000+[0, 5])\n , off = (LPF.kr(BrownNoise.kr([1,1]), 10)**(1/3))>0\n , hat = DelayL.kr(Decay.kr(Mix.kr(bs), 0.01), 20, rf.reciprocal*off)*PinkNoise.ar\n , line = Saw.ar(50)*0.1*(LFNoise0.kr(50)>0)*SinOsc.kr(0.1, 0, 0.4, 0.45)\n ;\n Out.ar(0, FreeVerb.ar(bass+snar + hat + line, \n SinOsc.kr(0.01, 0, 0.4, 0.5), \n 0.8, 0.5))\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Server-side sequencing (a SuperCollider snippet) that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n(\nf = { |f0=200, rate=4|\n {\n var seq = Dseq(f0*[1/2,3/4, Dstutter(4, Drand([1/2,1,2,3,4,5,6],1)), 2,3/2,3,4/3], inf);\n var trig = Impulse.ar(rate);\n var freq = Demand.ar(trig,0, seq);\n var env = Decay2.ar(trig,1e-3,1);\n FreeVerb.ar(\n Splay.ar(SinOsc.ar(freq*[0.995, 1, 1.005]).fold(-0.995,0.995)*0.25*env),\n 0.5,\n 0.5\n );\n }\n};\n\nfork{ 4.do{\n fork{\n f.(100,2).play;\n (1/8).wait;\n f.(200,4).play;\n (1/4).wait;\n f.(100*4/3,8).play;\n (1/2).wait;\n f.(400,4).play;\n };\n (1/4).wait;\n}}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `AbstractPlayerEffect` in SuperCollider?"}, {"role": "assistant", "content": "AbstractPlayerEffect — parent class for any player that takes another player and adds effects Category: Libraries > crucial > Players > abstract."}]} +{"conversations": [{"role": "user", "content": "What is `BLowPass`?"}, {"role": "assistant", "content": "BLowPass — 12db/oct rolloff - 2nd order resonant Low Pass Filter"}, {"role": "user", "content": "What does `BLowPass.sc` do?"}, {"role": "assistant", "content": "calculate filter coefficients."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n(\nz = {\n BLowPass.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(10, 20000, \\exponential), // cutoff freq.\n MouseY.kr(0.0, 1.0, \\linear), // rq\n 0.5); // mul\n}.play\n);\nz.release;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// this frees after the Decay has become quiet enough for a long enough time\n{ var signal = Decay.ar(Impulse.ar(0), 2, PinkNoise.ar(0.2)); DetectSilence.ar(signal, doneAction: Done.freeSelf; signal }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// this frees after the Decay has become quiet enough for a long enough time\n{ var signal = Decay.ar(Impulse.ar(0), 2, PinkNoise.ar(0.2)); DetectSilence.ar(signal, doneAction: Done.freeSelf); signal }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\delay;\n~description = \"Simple delay line\";\n~channelLayout = \\mono;\n~function = {|in = 0, del = 0.5|\n DelayC.ar(in, 2, del);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "What is `BLowPass`?"}, {"role": "assistant", "content": "BLowPass — 12db/oct rolloff - 2nd order resonant Low Pass Filter"}, {"role": "user", "content": "What does `BLowPass.sc` do?"}, {"role": "assistant", "content": "calculate filter coefficients."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n(\nz = {\n BLowPass.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(10, 20000, \\exponential), // cutoff freq.\n MouseY.kr(0.0, 1.0, \\linear), // rq\n 0.5); // mul\n}.play\n);\nz.release;\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `BufRd`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_playbuf, { |out = 0, bufnum = 0, rate = 1, startPos = 0, amp = 0.1, sustain = 1, pan = 0, loop = 1|\n var audio;\n rate = rate * BufRateScale.ir(bufnum);\n startPos = startPos * BufFrames.ir(bufnum);\n\n audio = BufRd.ar(1, bufnum, Phasor.ar(0, rate, startPos, BufFrames.ir(bufnum)), 1, 1);\n audio = EnvGen.ar(Env.sine, 1, timeScale: sustain, doneAction: Done.freeSelf) * audio;\n audio = Pan2.ar(audio, pan, amp);\n OffsetOut.ar(out, audio);\n}).add; // use .store for rendering example below\n\na = Pproto({\n ~newgroup = (type: \\group).yield;\n ~sf1 = (type: \\allocRead, path: ExampleFiles.apollo11).yield;\n},\n Pbind(*[\n instrument: \\help_playbuf,\n dur: Pseg([0, 0, 0.25, 0.5, 0.75, 1], 10).linexp(0, 1, 0.01, 2),\n legato: 4,\n startPos: Pn(Pseg([0, 1], 20), inf),\n rate: Pwhite(1, 1).midiratio,\n loop: 0,\n group: Pkey(\\newgroup),\n bufnum: Pkey(\\sf1)\n ])\n);\na.play;\n)\n\n// a.render(\"sounds/test.aif\", 40)\n// SoundFile.openRead(\"sounds/test.aif\").play\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `PV_Add` in SuperCollider briefly."}, {"role": "assistant", "content": "PV_Add — Complex addition. Complex addition: Category: UGens > FFT."}]} {"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// given a simple instrument\nInstr(\\Pulse,{ arg freq=440.0,width=0.5,mul=0.1;\n Pulse.ar( freq, width, mul )\n});\n\n// a patch specifies inputs (arguments) to that instrument\np = Patch( \\Pulse, [ 300, 0.2, 0.1 ]);\n\n//the default server will be booted, the SynthDef written and loaded\np.play;\n\n;\n\np.stop;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// given a simple instrument\nInstr(\\Pulse,{ arg freq=440.0,width=0.5,mul=0.1;\n Pulse.ar( freq, width, mul )\n});\n\n// a patch specifies inputs (arguments) to that instrument\np = Patch( \\Pulse, [ 300, 0.2, 0.1 ]);\n\n//the default server will be booted, the SynthDef written and loaded\np.play;\n\n);\n\np.stop;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\AcnSn3dIn;\n~description = \"A live ambisonic input (ACN_SN3D)\";\n~channelLayout = \\ambi;\n\n~function = { |order=1, t_trig = 0, bus = 0|\n var env = EnvGen.kr(Env([0,1], [1]), t_trig);\n var chans = Array.series(\n size: (order + 1).pow(2).asInteger,\n start: bus,\n step: 1\n );\n var input = SoundIn.ar(chans) * env;\n HOAConverterAcnSn3d2AcnN3d.ar(order, input);\n};\n```"}, {"role": "assistant", "content": "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see ."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n//you must have run this line before any of the examples below\nf= BBCutBuffer(Platform.resourceDir +/+ \"sounds/break.aiff\",8);\n\nTempoClock.default.tempo_(2.3);\n\n//default\na=BBCut2(CutBuf1(f),CageCut.new).play;\n\na.end;\n\n//weirder\na=BBCut2(CutBuf1(f),CageCut(8.0,[0.2,0.3,0.4,0.1])).play;\n\na.end;\n\n//using your own permutation function\na=BBCut2(CutBuf1(f),CageCut(16.0,[1,3,3,1,1,2,2,1],{arg array; array.scramble\n// …\n```"}, {"role": "assistant", "content": "you must have run this line before any of the examples below using your own permutation function (CageCut: Automatic breakbeat cutting algorithm inspired by John Cage)"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Array`."}, {"role": "assistant", "content": "```supercollider\n// an array of routine functions:\n(\na = [\n { 1.wait; \\done_one.postln },\n { 0.5.wait; \\done_two.postln },\n { 0.2.wait; \\done_three.postln }\n];\n);\n// join after 0\n(\nRoutine {\n \"join = 0.\".postcln;\n a.fork(0); \\doneAll.postln;\n}.play;\n);\n// join after 1\n(\nRoutine {\n \"join = 1.\".postcln;\n a.fork(1); \\doneAll.postln;\n}.play;\n);\n// join after all\n(\nRoutine {\n \"join = a.size (default).\".postcln;\n a.fork; \\doneAll.postln;\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Sample.tempo` do? What arguments does it take?"}, {"role": "assistant", "content": "tempo of the musical content of the sample if its a rhythmic loop. this co-depends on the beats Arguments: tm."}]} -{"conversations": [{"role": "user", "content": "What does `Char.isFileSafe` do?"}, {"role": "assistant", "content": "ASCII character Returns: true if the char is safe for use in a filename. Excludes the path separators / and :"}]} -{"conversations": [{"role": "user", "content": "What does `HistoryGui.docHeight` do?"}, {"role": "assistant", "content": "get and set the height of the text window opened by"}]} -{"conversations": [{"role": "user", "content": "What does `Node.moveBefore` do?"}, {"role": "assistant", "content": "Move this Node to be directly before aNode. N.B. n_before, the OSC message which this method encapsulates, allows already freed nodes as targets. This is so that one may attempt a series of moves, with the last successful one taking effect. For this reason this method will fail silently if either the target or this node have already been freed. If you will need to check, you may register the relevant nodes with a"}]} -{"conversations": [{"role": "user", "content": "Explain `NodeMap` in SuperCollider briefly."}, {"role": "assistant", "content": "NodeMap — store control values and bus mappings Object to store control values and bus mappings independently of a specific node. Category: JITLib > NodeProxy, Server > Nodes, Server > Abstractions."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nb = Bus.audio(s, 2);\na = { |inbus = 0|\n var sig = In.ar(inbus, 2);\n // x axis is side, oriented toward right;\n // y axis is mid\n [sig[1] - sig[0], sig.sum]\n}.play(s.defaultGroup, outbus: b, addAction: \\addAfter);\nc = s.scope;\nc.style = 2;\nc.bus = b;\n)\n```"}, {"role": "assistant", "content": "Very quick-and-dirty hack to show stereo phase. Center = up (12:00). Full left = 10:30, full right = 1:30."}]} -{"conversations": [{"role": "user", "content": "What does `Server.named` do?"}, {"role": "assistant", "content": "Object representing a server application Returns: An IdentityDictionary of all servers listed by their name `Server.named.at(\\default)`"}]} -{"conversations": [{"role": "user", "content": "Interfacing SC with external software: MIDI or OSC?"}, {"role": "assistant", "content": "SuperCollider forum — Interfacing SC with external software: MIDI or OSC?\n\nI found this partial solution on sccode.org :\n\n```supercollider\n // declare an event type which sends OSC commands to Renoise\n\n(\nEvent.addEventType(\\renoise, { |server|\n var renoiseOscServer = NetAddr(\"127.0.0.1\", 8000);\n var notes = [~midinote.value, ~ctranspose.value, ~velocity.value, ~sustain.value, ~lag.value, ~timingOffset.value, ~instr.value, ~track.value].flop;\n var timeNoteOn, timeNoteOff, instrument, track, velocity;\n var serverLatency;\n\n serverLatency = server.latency ? 0;\n\n notes.do {|note|\n instrument = note[6] ? -1;\n track = note[7] ? -1;\n velocity = note[2].asInt.clip(0,127);\n\n // sustain and timingOffset are in beats, lag is in seconds\n timeNoteOn = (thisThread.clock.tempo.reciprocal*note[5])+note[4]+server.latency;\n timeNoteOff = (thisThread.clock.tempo.reciprocal*(note[3]+note[5]))+note[4]+server.latency;\n SystemClock.sched(timeNoteOn, {renoiseOscServer.sendMsg(\"/renoise/trigger/note_on\", instrument.asInt, track.asInt, (note[0]+note[1]).asInt, velocity )});\n SystemClock.sched(timeNoteOff, {renoiseOscServer.sendMsg(\"/renoise/trigger/note_off\", instrument.asInt, track.asInt, (note[0]+note[1]).asInt)});\n }\n});\n);\n\n// Now start Renoise OSC server, load a sample, and try some patterns\n\n// straight timing\n(\nPbind(*[\n type: \\renoise,\n legato: Pgauss(0.2,0.05,inf),\n dur: 0.2,\n degree: [2,5,12],\n track: Prand([0,1], inf),\n ctranspose: Pseq([0,0,0,0,4,4,4,4,5,5,5,5],inf),\n velocity: Pgauss(64,10,inf),\n]).play;\n)\n```\n\nhttp://sccode.org/1-4SN\n\nBut what I couldn’t find there was a simple syntax for sending Note Events or Midi Events as OSC messages... Do I really need to re-implement the whole SC’s defaultParentEvent as new OSC Event to send it using regular pattern’s syntax?"}]} -{"conversations": [{"role": "user", "content": "What is `SharedOut` in SuperCollider?"}, {"role": "assistant", "content": "SharedOut — Write to a shared control bus. Category: UGens > InOut."}]} -{"conversations": [{"role": "user", "content": "Build a slowly evolving drone with Ndef."}, {"role": "assistant", "content": "Ndef gives you a named patch you can redefine while it plays; the filter is a separate node in the\nchain so you can change it on its own.\n\n```supercollider\n(\nNdef(\\drone, { |freq = 55, amp = 0.12|\n var detune = [0, 0.07, -0.11];\n var sig = Mix(Saw.ar(freq * (1 + detune))) * amp;\n LPF.ar(sig, 400);\n}).play;\n\nNdef(\\drone)[1] = \\filter -> { |in| RLPF.ar(in, LFNoise1.kr(0.1).exprange(200, 1800), 0.3) };\n)\n```\n\nRedefining Ndef(\\drone, { ... }) later crossfades to the new definition; Ndef(\\drone).stop stops it."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for UI sounds (pt1)."}, {"role": "assistant", "content": "```supercollider\n// UI sounds\n// this code is an attempt to recreate a sound\n// inspired from some technological/electrical UI interface\n\n// 1. first define the synth\n// Here we are using the FM technique\n(\nSynthDef(\\fmmod, {\n |\n amp=0.2,\n fc=1000,\n fm = 100,\n idx = 100,\n atk=0.01,\n rls=0.1\n |\n var env = EnvGen.ar(Env.perc(atk, rls), doneAction:2);\n var modulator = SinOsc.ar(fm);\n var carrier = SinOsc.ar(fc + (idx*modulator) );\n var sig = carrier * env * amp;\n sig = HPF.ar(sig, 1000);\n Out.ar(0, sig!2);\n}).add;\n);\n\n// 2. then define the Pbind which will play the sequence\n// of UI sounds simulating variuos characters showing up on an\n// imaginary display.\n// Play around FC, FM, ATK and RLS to obtain different sound characters.\n(\np = Pbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 100,\n \\idx, 100,\n \\amp, 0.6,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).asEventStreamPlayer;\n);\n\n// 3. play it\np.play;\n\n// 4. Here are some presets\n\n// \"cricket\" preset\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 100,\n \\idx, 100,\n \\amp, 0.6,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 2\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 1000,\n \\idx, 100,\n \\amp, 0.6,\n \\atk, 0.001,\n \\rls, 0.01,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 3\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 100,\n \\idx, 10,\n \\amp, 0.4,\n \\atk, 0.01,\n \\rls, 0.01,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 4\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 1000,\n \\fm, 100,\n \\idx, 1000,\n \\amp, 0.2,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n\n// preset 5\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 5000,\n \\fm, 1000,\n \\idx, 1000,\n \\amp, 0.4,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 5\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 8000,\n \\fm, 1000,\n \\idx, 1000,\n \\amp, 0.7,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Function.awake` do? What arguments does it take?"}, {"role": "assistant", "content": "This method is called by a Clock on which the function was scheduled when its scheduling time is up. It calls #-value, passing on the scheduling time in beats as an Arguments: beats — The scheduling time in beats. This is equal to the current logical time (Thread#-beats).; seconds — The scheduling time in seconds. This is equal to the current logical time (Thread#-seconds).; clock — The clock on which the object was scheduled.. Returns: The value returned by the function's #-value. A caller clock uses this value to reschedule the function. `// Runs every 2 seconds`"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for XoX pattern helper."}, {"role": "assistant", "content": "```supercollider\n(\n~xox = {|str| str.collectAs({|l| switch(l.toLower,$x, {1}, $o, {Rest(1)})}, Array)};\n);\n\n\n(\nSynthDef(\\acid, { arg out, freq = 1000, gate = 1, pan = 1, cut = 4000, rez = 0.8, amp = 1, sustain = 1, release = 0.5;\n var sig, env;\n env = EnvGen.kr(Env.linen(0.01, sustain, sustain * release), gate, amp, doneAction: Done.freeSelf);\n sig = Pulse.ar([freq,freq*1.001], 0.5);\n sig = sig + Pulse.ar(freq*0.501, 0.01, [0,0.5]);\n sig = sig + Pulse.ar(freq*1.99, 0.11, [0.5,0]);\n sig = RLPF.ar(sig, cut, rez);\n sig = Pan2.ar(sig);\n sig = sig * env;\n\n Out.ar(out, sig);\n}).add;\n);\n\n(\nPbind(\n \\instrument, \\acid,\n \\dur, Pseq(~xox.(\"xxooxoxo\") * 8/120, inf),\n \\scale, Scale.minor,\n \\degree, Pseq([0,4,5,3,3], inf),\n \\cut, Pwhite(100, 1500),\n \\rez, Pwhite(0.1, 0.8),\n \\amp, -10.dbamp,\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write an FM bell in SuperCollider."}, {"role": "assistant", "content": "PMOsc is phase modulation: a non-integer modulator ratio gives the inharmonic clang.\n\n```supercollider\n(\nSynthDef(\\fmBell, { |out = 0, freq = 440, amp = 0.2, dur = 4|\n var index = EnvGen.kr(Env([8, 0.2], [dur], -4));\n var sig = PMOsc.ar(freq, freq * 1.4, index, 0, 1);\n var env = EnvGen.kr(Env.perc(0.002, dur, 1, -5), doneAction: 2);\n Out.ar(out, Pan2.ar(sig * env * amp, 0));\n}).add;\n);\nSynth(\\fmBell, [\\freq, 550]);\n```"}]} -{"conversations": [{"role": "user", "content": "[ 1, 2, 1, 1, 2, 1, 1 ] how to find adjacent elements in an array?"}, {"role": "assistant", "content": "SuperCollider forum — [ 1, 2, 1, 1, 2, 1, 1 ] how to find adjacent elements in an array\n\nRandColors:\n\nI need to find the index, the how many times (the adjacent values are equal) and what is the adjacent value.\n\nThis is perhaps a bit verbose and clunky, but it meets the above specification:\n\n```supercollider\n(\n~repeats = {|array|\n // return [index, number of repeats, the value] for each repeated value\n var results = [];\n var thisIndex = 0;\n var thisCount = 1;\n var thisValue = array[0];\n array[1..].do{|val, i|\n if(val == thisValue,\n {thisCount = thisCount + 1},\n {\n if(\n thisCount > 1,\n {results = results.add([thisIndex, thisCount, thisValue])},\n );\n thisValue = val;\n thisIndex = i + 1;\n thisCount = 1;\n }\n )\n };\n if(thisCount > 1, {results = results.add([thisIndex, thisCount, thisValue])});\n results;\n}\n);\n\na = [1, 2, 1, 1, 1, 2, 1, 1];\nb = ~repeats.value(a);\n\na = [2, 3, 5, 5];\nb = ~repeats.value(a);\n```"}]} -{"conversations": [{"role": "user", "content": "What are you good at?"}, {"role": "assistant", "content": "SuperCollider. I can explain its classes and UGens, write SynthDefs and patches, read a patch back to you, and tell you why one does not compile. I am 198M parameters; I am not a general assistant."}]} -{"conversations": [{"role": "user", "content": "What does `JITGui.moveTo` do?"}, {"role": "assistant", "content": "if it has its own window, one can move it to some specific"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ LFNoise1.ar(1000, 0.25) }.play;\n\n// modulate frequency\n\n{ LFNoise1.ar(XLine.kr(1000, 10000, 10), 0.25) }.play;\n\n// as frequency modulator\n(\n{ SinOsc.ar(\n LFNoise1.ar(4, 400, 450),\n 0, 0.2\n )\n}.play;\n)\n\n// freq is the rate of starting points\n{ var freq = 1000; [LFNoise1.ar(freq), Impulse.ar(freq) }.plot\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ LFNoise1.ar(1000, 0.25) }.play;\n\n// modulate frequency\n\n{ LFNoise1.ar(XLine.kr(1000, 10000, 10), 0.25) }.play;\n\n// as frequency modulator\n(\n{ SinOsc.ar(\n LFNoise1.ar(4, 400, 450),\n 0, 0.2\n )\n}.play;\n)\n\n// freq is the rate of starting points\n{ var freq = 1000; [LFNoise1.ar(freq), Impulse.ar(freq)] }.plot\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nd = SynthDef(\\demoWrapping, { |out|\n Out.ar(out, SynthDef.wrap({ |freq| SinOsc.ar(freq) }))\n};\n\nd.allControlNames;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nd = SynthDef(\\demoWrapping, { |out|\n Out.ar(out, SynthDef.wrap({ |freq| SinOsc.ar(freq) }))\n});\n\nd.allControlNames;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `AudioPatchOut.audio` do? What arguments does it take?"}, {"role": "assistant", "content": "manages state and resources for a Player's output when connecting to other Players Arguments: audioPatchIn; needsValueSetNow."}]} -{"conversations": [{"role": "user", "content": "How do I use a metronome or check my timing?"}, {"role": "assistant", "content": "A click on the clock you are using, plus a counter to see where you are in the bar:\n\n```supercollider\n(\nTdef(\\click, {\n var count = 0;\n loop {\n (Synth(\\hat, [\\amp, if (count % 4 == 0) { 0.25 } { 0.08 }]));\n count = count + 1;\n 1.wait;\n }\n}).play;\n)\n```\n\nBecause it waits on `TempoClock.default`, it stays in sync with every Pbind you start, which makes it a\ntempo reference rather than a separate sound."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for cosmic organ with a inspiration of rukano tweet."}, {"role": "assistant", "content": "```supercollider\n// 2012.05.04\n// Work for NX014 Class\n// Inspiration: A Rukano Tweet. Thanks rukano!\n// Comment: Cosmic Organ.\n\np = ProxySpace.push(s.boot);\n\n~a.play;\n\n~a = { var alpha,gamma;\n alpha= LFNoise2;\n gamma= {[rrand(30,50),rrand(50,70),rrand(50,70),rrand(70,100)].choose.midicps*alpha.kr(1,0.01,1)}!24;\n Pan2.ar(LeakDC.ar(Normalizer.ar(\n BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(FreeVerb.ar(\n Splay.ar(RLPF.ar(LFSaw.ar(gamma)/4,gamma*LFCub.kr(rrand(0.01,0.1),0,2,3),alpha.kr(1/8,0.6,0.7))) \n ,0.1,0.1,0.1)\n ,100,6.0,6),1000,6.0,0),5000,6.0,0),10000,6.0,6)\n ,(0.8/0.999)*1,0.1)),0)\n};\n\n~a = nil;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// Handy code for quick class demonstrations.\n// Comparing a few intervals - Just Intonation versus 12-tone Equal Tempered\n\n// Major third (just)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 60.midicps * 5/4], mul: 0.1) }).play\n// Major third (ET12)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 64.midicps], mul: 0.1) }).play;\n\n// Major second (just)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 60.midicps * 9/8], mul: 0.1) }).play\n// Major second (ET)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 62.midicps], mul: 0.1) }).play;\n\n// Perfect fifth (just)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 60.midicps * 3/2], mul: 0.1) }).play\n// Perfect fifth (ET)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 67.midicps], mul: 0.1) });\n```"}, {"role": "assistant", "content": "Simple handy code for quick class demonstrations. Hear and compare a few intervals in Just Intonation versus 12-tone Equal Tempered tuning."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Modanung - Return of the King."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"plucking\", {arg amp = 0.1, freq = 220, decay = 5, coef = 0.1;\nvar env, snd;\nenv = EnvGen.kr(Env.linen(0, decay, 0.5), doneAction: 2);\nsnd = Pluck.ar(\n in: SinOsc.ar(0.5*freq, 0, amp),\n trig: Impulse.kr(0),\n\n maxdelaytime: 0.1,\n delaytime: freq.reciprocal,\n decaytime: decay,\n coef: coef);\n Out.ar(0, [snd, snd]);\n}).add;\n);\n(\nSynthDef(\\FreeVerb2x2, {|outbus, mix = 0.23, room = 0.42, damp = 0.666, amp = 1.0|\n var signal;\n\n signal = In.ar(outbus, 2);\n\n ReplaceOut.ar(outbus,\n FreeVerb2.ar( // FreeVerb2 - true stereo UGen\n signal[0], // Left channel\n signal[1], // Right Channel\n mix, room, damp, amp)); // same params as FreeVerb 1 chn version\n\n}).add;\nz = Synth(\\FreeVerb2x2, [\\outbus, 0], addAction:\\addToTail)\n);\n(\nPbind(\n \\instrument, \"plucking\",\n \\scale, Scale.locrian,\n \\degree, Prand([[-2.5, -4.001], [-7.002, -5], [-1, -3.003], [-1.005, -0.51], [-5, -3], [-4, -4], [0, 1]], inf),\n \\amp, Pseq([0.23, 0.042, 0.2, 0.32], inf),\n \\decay, Pseq([0.25,2.5, 0.025, 0.25], inf),\n \\coef, Pseq([0.3, 0.2, 0.9], inf),\n \\dur, Pseq([0.2, 0.01, 0.21, 0.001, 0.0001, 0.00911, 0.191, 0.23],inf)\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is the difference between .ar, .kr and .ir?"}, {"role": "assistant", "content": "The rate method decides how often a UGen is evaluated. `.ar` runs at the audio rate, once per sample, and produces an audio signal. `.kr` runs at the control rate, once per block of 64 samples by default, so it is cheaper and is used for parameters that do not need sample accuracy. `.ir` is evaluated once when the Synth is created and then never again, for constants such as SampleRate.ir or a size. Using .kr where you need audio-rate modulation gives stepped, zipper-noise-like control; using .ar where .kr would do costs CPU."}]} -{"conversations": [{"role": "user", "content": "How do I add a reverb send to a whole group?"}, {"role": "assistant", "content": "Same shape as the delay: a private stereo bus, one effect reading it, instruments writing both dry\nand wet.\n\n```supercollider\n(\n~verbBus = Bus.audio(s, 2);\nSynthDef(\\verb, { |in = 0, out = 0, room = 0.85, mix = 0.5|\n Out.ar(out, FreeVerb.ar(In.ar(in, 2), mix, room, 0.5) * 0.7);\n}).add;\nSynthDef(\\blip, { |out = 0, send = 0, freq = 440, amp = 0.1|\n var env = EnvGen.kr(Env.perc(0.002, 0.4), doneAction: 2);\n var sig = SinOsc.ar(freq) * env * amp;\n Out.ar(out, sig);\n Out.ar(send, sig);\n}).add;\n);\nSynth(\\verb, [\\in, ~verbBus]);\nPbind(\\instrument, \\blip, \\send, ~verbBus, \\degree, Pseq([0, 4, 7, 11], inf), \\dur, 0.25).play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SynthDesc.outputData` do?"}, {"role": "assistant", "content": "Returns an array of events with information about any UGens that write to a bus (such as Out etc.). This includes the rate and number of channels of the UGen. If its first input is a control, also the corresponding control name is provided. `a = SynthDef(\\x, { |out, freq = 440| Out.ar(out,"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\nSynthDef(\"ReplaceOutHelp\", { |out = 0, freq = 440|\n var source;\n source = SinOsc.ar(freq, 0, 0.1);\n\n // write to the bus, replacing previous contents\n ReplaceOut.ar(out, source);\n\n}).add;\n);\n\n// each Synth replaces the output of the previous one\nx = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 500]);\ny = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 600]);\nz = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 700]);\n\n// release them in reverse order; the older Synths are still there.\nz.free;\ny.free;\nx.free;\n```"}, {"role": "assistant", "content": "write to the bus, replacing previous contents each Synth replaces the output of the previous one (ReplaceOut: Send signal to a bus, overwriting previous contents.)"}]} -{"conversations": [{"role": "user", "content": "Write a plucked string in SuperCollider."}, {"role": "assistant", "content": "Pluck is a Karplus-Strong string: a noise burst into a tuned delay with feedback. The delay time is\nthe reciprocal of the frequency.\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 220, amp = 0.5, dur = 3|\n var period = freq.reciprocal;\n var sig = Pluck.ar(WhiteNoise.ar(0.2), Impulse.kr(0), period, period, dur, 0.5);\n Out.ar(out, Pan2.ar(sig * amp, 0));\n}).add;\n);\nSynth(\\pluck, [\\freq, 330, \\dur, 4]);\n```"}]} -{"conversations": [{"role": "user", "content": "What is the correct way to stop everything?"}, {"role": "assistant", "content": "Depends on what is playing, and they are different layers:\n\n- `s.freeAll` — frees every node on the server (all sound stops, definitions survive).\n- `CmdPeriod.run` — stops everything scheduled on the clocks (Patterns, Routines, Tasks).\n- `Ndef.clear; Pdef.clear` — clears the JITLib proxies.\n- `s.quit` — shuts the server down entirely.\n\nIn a session the habit is `CmdPeriod.run` first (stops the sequencing), then `s.freeAll` if a drone is still\nsounding."}]} -{"conversations": [{"role": "user", "content": "Rand or rand difference?"}, {"role": "assistant", "content": "SuperCollider forum — Rand or rand difference?\n\nI think you meant to compare Rand and rrand (not rand) – both generate a random number between a given low and high, but Rand is intended to be used inside a SynthDef and the behavior is slightly different. Compare:\n\n```supercollider\n(\nSynthDef(\\test, {\n var freq = rrand(400, 600);\n Out.ar(0, SinOsc.ar(freq) * 0.2);\n}).add;\n);\n\nSynth(\\test); // run and stop multiple times: always same freq\n\n(\nSynthDef(\\test2, {\n var freq = Rand(400, 600);\n Out.ar(0, SinOsc.ar(freq) * 0.2);\n}).add;\n);\n\nSynth(\\test2); // run and stop multiple times: every time a different freq\n```\n\nAs you can read in the help file, Rand is intended to be used inside SynthDefs when you want the particular behavior of a newly generated random frequency for each Synth called. You can use rrand(lo, hi) inside a SynthDef too, if you want the random number to be generated only once at time of SynthDef creation (it gets “inscribed in the recipe” for good), so all future and all Synth calls based on that SynthDef to use on that same random number.\n\nAs a side note, rand (as opposed to rrand) generates a random number between zero and the receiver:\n\n```supercollider\nrand(8); // random numbers between 0 and and 8 (excluding 8)\n\nrand(0.5, 8); // random numbers between 0 and 0.5; second argument is ignored here\n```\n\nAlso in regards to the specific way you present the example (as Functions, indicated by the curly braces): note the difference when you evaluate them:\n\n```supercollider\n{Rand(0.5,8)}.value; // returns 'a Rand'\n{rrand(0.5,8)}.value; // returns an actual random choice between lo and hi\n```\n\nHope this helps,\n\nB"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for first step?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n\nz = ( ( SinOsc.ar( ((LFSaw.kr(-0.05,1) +1) *100 + 20 ), LFTri.kr(40,0,1), LFSaw.kr(1.5) ) \n * LFTri.kr(rrand(0.005,0.03),3.99.rand,0.2) ) + \n( LFPulse.ar(60,0,0.5,Pulse.ar(0.5,0.5,0.1)) * LFTri.kr(rrand(0.005,0.03),3.99.rand,0.5) ) +\n( SinOsc.ar(65,0,LFPulse.kr(0.66666,0.5,0.3)*0.3) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) )+\n( LFPar.ar(120,0,LFPulse.kr(0.5,0.5,0.2)*0.3) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( LFCub.ar(185,0,LFPulse.kr(0.5,0.74,0.2)*0.3) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( SinOsc.ar(365,0,LFPulse.kr(1.33333333,0,0.1)*0.3) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( FreeVerb.ar(LFTri.ar(260,0,LFPulse.kr(0.5,0.25,0.01)*0.3),0.5,0.8,0.1) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( SinOsc.ar(800,0,LFPulse.kr(2,0,0.1)*0.1) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( LFPar.ar(820,0,LFPulse.kr(1.666666,0,0.1)*0.1) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( WhiteNoise.ar( LFPulse.kr(2,0.5,0.001,1) )/2 * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( WhiteNoise.ar( LFPulse.kr(1,0.5,0.001,1) )/2 * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( WhiteNoise.ar( LFPulse.kr(1.666666,0.5,0.001,1) )/4 * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( WhiteNoise.ar( LFPulse.kr(1.333333,0.5,0.001,1) )/4 * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) );\n\nFreeVerb.ar(\n ((CombC.ar(\n DelayN.ar(\n DelayN.ar(z, 0.5, [0.5,0.75], 1, z), \n 0.5, 0.5, 1, z), \n 0.1, LFNoise0.kr(1,0.05,0.001).abs, 2, z))+z),\n0.1,1,0.1); \n\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PanB2`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var w, x, y, p, a, b, c, d;\n\n p = PinkNoise.ar; // source\n\n // B-format encode\n #w, x, y = PanB2.ar(p, MouseX.kr(-1, 1), 0.1);\n\n // B-format decode to quad\n #a, b, c, d = DecodeB2.ar(4, w, x, y);\n\n [a, b, d, c] // reorder to my speaker arrangement: Lf Rf Lr Rr\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `RedOscillator2.couple` do? What arguments does it take?"}, {"role": "assistant", "content": "Apply influence from two other oscillator's phase (normally left and right when connected in a ring). Call this before each Arguments: prev — The EMPHASISleft LINKClasses/RedOscillator2 instance.; next — The EMPHASISright LINKClasses/RedOscillator2 instance.."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\ns.boot;\n\n// create a new analyzer\nFreqScope.new(400, 200, 0, server: s);\n\n// basic sine\n{ SinOsc.ar(2000, 0, 0.25) }.play(s);\n\n// random saw\n{ RLPF.ar(Saw.ar(110, 0.2), LFNoise2.kr(1, 1e4, 1e4), LFNoise2.kr(1, 0.2, 0.22)) }.play(s);\n\n// modulate phase\n{ SinOsc.ar(800, SinOsc.ar(XLine.kr(20, 8000, 10), 0, 2pi), 0.25) }.play(s);\n\n// all harmonics\n{ Blip.ar(200, Line.kr(1, 100, 10), 0.2) }.play(s);\n\n// access the Fre\n// …\n```"}, {"role": "assistant", "content": "create a new analyzer access the FreqScopeView object to set properties of the Qt Object: (FreqScope: Frequency spectrum visualizer)"}]} -{"conversations": [{"role": "user", "content": "What is `BBandPass` in SuperCollider?"}, {"role": "assistant", "content": "BBandPass — Band Pass Filter The B equalization suite is based on the Second Order Section (SOS) biquad UGen. Category: UGens > Filters > BEQSuite."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for how to generate the synthdef with a pattern?"}, {"role": "assistant", "content": "```supercollider\n(\nPdef(\\zed, \n Pbind(\n \\osc, Pseq([SinOsc, LFSaw],inf),\n \\instrument, Prout({ arg ev;\n SynthDef(\\zed, { arg out=0, gate=1, amp=0.1, pan=0, freq=200;\n var sig;\n sig = ev[\\osc].ar(freq);\n sig = sig * EnvGen.kr(\\adsr.kr(Env.adsr(0.1,0.1,0.8,0.1)), gate, doneAction:2);\n sig = Pan2.ar(sig, pan, amp);\n Out.ar(out, sig);\n }).add.yield;\n }).loop,\n \\degree, Pseq([0],inf),\n \\dur, 1,\n \\amp, 0.1,\n )\n).play;\n);\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Modulating GVerb roomsize, among other things?"}, {"role": "assistant", "content": "```supercollider\nNdef(\\b, { LFDNoise0.ar(500)});\nNdef(\\c, { LFDNoise1.ar(0.3).range(5,15)});\nNdef(\\d, { LFDNoise3.ar(SinOsc.kr(0.1, 0, 1000, 300), 200, 200)});\nNdef(\\a, { Limiter.ar(GVerb.ar(SinOsc.ar(Ndef(\\d), mul: Ndef(\\b)), roomsize: Ndef(\\c) ) )});\nNdef(\\a).play;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// fadeTimes should be above blockSize\n// for shorter grains you can use smaller blocksizes\n\n(\ns.options.blockSize = 2;\ns.reboot;\n);\n\n// as the effect is AM on single outs we get side bands\n\n(\ns.doWhenBooted {\n x = {\n var lfo = LFDNoise3.ar(0.2);\n DXFan.ar(\n Dseq((0..7), inf),\n SinOsc.ar(lfo.range(800, 1500), 0, 0.03),\n size: 8,\n fadeTime: 0.0002\n )\n }.play\n};\n);\n\nx.release\n\n\n// go back to default\n\n(\ns.options.blockSize = 64;\ns.reboot;\n)\n```"}, {"role": "assistant", "content": "fadeTimes should be above blockSize for shorter grains you can use smaller blocksizes (DXFan: crossfades signals within a multichannel array according to demand-rate control)"}]} -{"conversations": [{"role": "user", "content": "What does `AbstractFunction.linexp` do?"}, {"role": "assistant", "content": "An object which responds to a set of messages that represent mathematical functions"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ LFPulse.kr(XLine.kr(1, 200, 10), 0, 0.2) * SinOsc.ar(440 * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ LFPulse.kr(XLine.kr(1, 200, 10), 0, 0.2) * SinOsc.ar(440) * 0.1 }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n(\nSynthDef(\"help-InFeedback\", { |out = 0, in = 0|\n Out.ar(out,\n InFeedback.ar(in, 1)\n );\n}).add;\nSynthDef(\"help-SinOsc\", { |out = 0, freq = 440|\n Out.ar(out, SinOsc.ar(freq, 0, 0.1))\n}).add;\n);\n\nx = Bus.audio(s, 1);\n\n// read from bus n play to bus 0 (silent)\na = Synth(\"help-InFeedback\", [\\in, x.index, \\out, 0]);\n\n// now play a synth after this one, playing to bus x\nb = Synth.after(a, \"help-SinOsc\", [\\out, x.index]);\n\n// add another synth\n// …\n```"}, {"role": "assistant", "content": "read from bus n play to bus 0 (silent) now play a synth after this one, playing to bus x (InFeedback: Read signal from a bus with a current or one cycle old timestamp.)"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Saw`."}, {"role": "assistant", "content": "```supercollider\n// modulating the frequency\n\n{ Saw.ar(XLine.kr(40, 4000, 6), 0.2) }.play;\n\n// two band limited sawtooth waves through a resonant low pass filter\n\n{ RLPF.ar(Saw.ar([100, 250], 0.1), XLine.kr(8000, 400, 5), 0.05) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `OSCresponderNode`."}, {"role": "assistant", "content": "```supercollider\n// example: two SuperCollider apps communicating\n\n// application 1:\nn = NetAddr(\"127.0.0.1\", 57120); // the url should be the one of computer of app 2 (or nil)\n\no = OSCresponderNode(n, '/chat', { |t, r, msg| (\"time:\" + t).postln; msg[1].postln }).add;\n\n// application 2:\nm = NetAddr(\"127.0.0.1\", 57120); // the url should be the one of computer of app 1\nm.sendMsg(\"/chat\", \"Hello App 1\");\n\n// sending bundles (including timestamps)\n(\nm.sendBundle(2.0, [\"/chat\", \"Hello App 1\"], [\"/chat\", \"Hallo Wurld\"]);\nm.sendBundle(0.0, [\"/chat\", \"Hello App 1\"], [\"/chat\", \"Hallo Wurld\"]);\n);\n\n// end application 1:\no.remove;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Rect.resizeTo` do?"}, {"role": "assistant", "content": "Returns a new Rect whose dimensions are (x,"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// Change MembraneCircle to MembraneHexagon for a different shaped\n// circular drum head\ns.boot;\ns.reboot;\n(\n{ var excitation = EnvGen.kr(Env.perc,\n MouseButton.kr(0, 1, 0),\n timeScale: 0.1, doneAction: 0\n ) * PinkNoise.ar(0.4);\n var tension = MouseX.kr(0.01, 0.1);\n var loss = MouseY.kr(0.999999, 0.999, 1);\n MembraneCircle.ar(excitation, tension, loss);\n}.play;\n)\n```"}, {"role": "assistant", "content": "Change MembraneCircle to MembraneHexagon for a different shaped circular drum head (MembraneCircle: Waveguide mesh physical models of drum membranes)"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// modulate frequency\n{ Blip.ar(XLine.kr(20000, 200, 6), 100, 0.2) }.play;\n\n// modulate numharmonics\n{ Blip.ar(200, Line.kr(1, 100, 20), 0.2 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// modulate frequency\n{ Blip.ar(XLine.kr(20000, 200, 6), 100, 0.2) }.play;\n\n// modulate numharmonics\n{ Blip.ar(200, Line.kr(1, 100, 20), 0.2) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Tdef`."}, {"role": "assistant", "content": "```supercollider\nTdef(\\x, { loop { 0.5.wait; \"aaaaaaaaaaaaaazz\".scramble.postln } }).play;\nTdef(\\x, { loop { 0.125.wait; \"aazz\".scramble.postln } });\nTdef(\\x, { loop { 0.5.wait; (note: 14.rand).play } });\nTdef(\\x, { loop { 0.5.wait; (note: 14.rand + [0, 3, 6, 7].keep(4.rand)).play } });\nTdef(\\x).stop;\nTdef(\\x).play;\nTdef(\\x).clear;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a bell in SuperCollider."}, {"role": "assistant", "content": "A bell is a set of inharmonic partials with a long percussive decay. The ratios below are the\nclassic bell ones; the envelope frees the Synth when it ends.\n\n```supercollider\n(\nSynthDef(\\bell, { |out = 0, freq = 440, amp = 0.2, dur = 3|\n var partials = [1, 2.76, 5.4, 8.93];\n var amps = [1, 0.5, 0.3, 0.15];\n var sig = SinOsc.ar(freq * partials) * amps;\n var env = EnvGen.kr(Env.perc(0.001, dur, 1, -6), doneAction: 2);\n Out.ar(out, Pan2.ar(Mix(sig) * env * amp, 0));\n}).add;\n);\nSynth(\\bell, [\\freq, 660, \\dur, 4]);\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\np = Platform.resourceDir +/+ \"sounds/a11wlk01.wav\";\nb = Buffer.read(s, p);\n\n(\ny = {\n var pos = 0.5; // other pos offset will give totally different sounds\n var osc = GFIS.ar({ |x| sin(LFDNoise3.ar(10).range(3.2, 4) * x) }, 0.3, 6) * 0.1;\n // GFIS involves a LeakDC, but not BufRd\n LeakDC.ar(BufRd.ar(1, b, b.numFrames * (osc * [0.0120, 0.0125] * 5 + pos), interpolation: 4)) * 0.1\n}.play\n;\n\ny.release\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\np = Platform.resourceDir +/+ \"sounds/a11wlk01.wav\";\nb = Buffer.read(s, p);\n\n(\ny = {\n var pos = 0.5; // other pos offset will give totally different sounds\n var osc = GFIS.ar({ |x| sin(LFDNoise3.ar(10).range(3.2, 4) * x) }, 0.3, 6) * 0.1;\n // GFIS involves a LeakDC, but not BufRd\n LeakDC.ar(BufRd.ar(1, b, b.numFrames * (osc * [0.0120, 0.0125] * 5 + pos), interpolation: 4)) * 0.1\n}.play\n);\n\ny.release\n```"}]} -{"conversations": [{"role": "user", "content": "What does `ArrayedCollection.copyRange` do?"}, {"role": "assistant", "content": "Return a new ArrayedCollection which is a copy of the indexed slots of the receiver from start to end. — Both start and end are specified as integers starting from 0. If end < start, an empty ArrayedCollection is returned."}]} -{"conversations": [{"role": "user", "content": "What is `Pgpar` in SuperCollider?"}, {"role": "assistant", "content": "Pgpar — embed event streams in parallel and put each in its own group Embeds several event streams so that they form a single output stream with all their events in temporal order. When one stream ends, the other streams are further embedded until all have ended. Category: Streams-Patterns-Events > Patterns > Parallel."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\freq, Pseq([500, 600, 700]), \\instrument, \\sinegrain);\na = Pmulp(\\freq, Pseq([0.5, 0.9, 0.8], inf), a);\na.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\freq, Pseq([500, 600, 700]), \\instrument, \\sinegrain);\na = Pmulp(\\freq, Pseq([0.5, 0.9, 0.8], inf), a);\na.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `FFT.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Fast Fourier Transform Arguments: buffer — A buffer to store spectral data. The buffer's size must correspond to a power of 2. LocalBuf is useful here, because processes should not share data between synths. (Note: most PV UGens operate on this data in place. Use PV_Copy for parallel processing.); in — The signal to be analyzed. The signal's rate determines the rate at which the input is read.; hop — The amount of offset from the beginning of one FFT analysis frame to the next, measured in multiples of the analysis frame size. This can range between 1.0 and values close to (but larger than) 0.0, and the default is 0.5 (meaning each frame has a 50% overlap with the preceding/following frames).; wintype — Defines how the data is windowed:; active — A simple control allowing FFT analysis to be active (>0) or inactive (<=0). This is mainly useful for signal analysis processes which are only intended to analyse at specific times rather than continuously; winsize — The windowed audio frames are usually the same size as the buffer. If you wish the FFT to be zero-padded then you can specify a window size smaller than the actual buffer size (e.g. window size 1024 with buffer size 2048). Both values must still be a power of two. Leave this at its default of zero f. Returns: The FFT chain"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pluck`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n// excitation signal is WhiteNoise, triggered twice a second with varying OnePole coef\n(\n { Pluck.ar(WhiteNoise.ar(0.1), Impulse.kr(2), 440.reciprocal, 440.reciprocal, 10,\n coef: MouseX.kr(-0.999, 0.999))\n }.play(s)\n);\ns.quit;\n// a group of angry fretless mandolin players\n(\n {\n var freq, numparts;\n numparts = 50;\n freq = SinOsc.kr(Array.fill(numparts, { Rand(0.05, 0.2) }),\n Array.fill(numparts, { Rand(0, 1.0) })).range(1000, 3000);\n LeakDC.ar(\n Pan2.ar(\n Pluck.ar(\n WhiteNoise.ar(0.1).dup(numparts),\n Impulse.kr(Array.fill(numparts, { Rand(10, 12) })),\n 100.reciprocal, freq.reciprocal, 2, Rand(0.01, 0.2), mul: 1),\n Array.fill(numparts, { Rand.new(-1.0, 1.0) }))\n .sum\n );\n }.play(s);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// get some data from the synth audio\n{ SinOsc.ar + GrayNoise.ar(0.1) }.loadToFloatArray(0.01, action: { |array| a = array });\na.postln;\na.plot;\n\n// place it after some other node:\nz = { WhiteNoise.ar * 0.1 }.play; // play some noise\n{ BPF.ar(In.ar(0), 7000, 0.01) * 10 }.loadToFloatArray(0.01, z, action: { |array| a = array };\na.postln;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// get some data from the synth audio\n{ SinOsc.ar + GrayNoise.ar(0.1) }.loadToFloatArray(0.01, action: { |array| a = array });\na.postln;\na.plot;\n\n// place it after some other node:\nz = { WhiteNoise.ar * 0.1 }.play; // play some noise\n{ BPF.ar(In.ar(0), 7000, 0.01) * 10 }.loadToFloatArray(0.01, z, action: { |array| a = array });\na.postln;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Pgeom.new` do? What arguments does it take?"}, {"role": "assistant", "content": "geometric series pattern Arguments: start — start value.; grow — multiplication factor.; length — number of values produced.."}]} -{"conversations": [{"role": "user", "content": "What is `EaseOutCirc` in SuperCollider?"}, {"role": "assistant", "content": "EaseOutCirc — Circular ease-out Easing equation for a circular (sqrt(1-t^2)) ease-out, decelerating from zero velocity. Category: Ease."}]} -{"conversations": [{"role": "user", "content": "Explain `USession` in SuperCollider briefly."}, {"role": "assistant", "content": "USession — (put short description here) (put long description here) Category: UnitLib."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\nb = Buffer.alloc(s, 2048, 1);\nc = Buffer.alloc(s, 2048, 1);\nd = Buffer.read(s, \"sounds/a11wlk01.wav\");\n);\n\n(\nSynthDef(\"help-commonMul\", { arg out=0, bufnumA=0, bufnumB=1, soundBufnum=2;\n var inA, inB, chainA, chainB, chain;\n inA = HPF.ar(Mix(LFSaw.ar([100, 150], 0, 0.2)), 1200);\n inB = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);\n chainA = FFT(bufnumA, inA);\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\nb = Buffer.alloc(s, 2048, 1);\nc = Buffer.alloc(s, 2048, 1);\nd = Buffer.read(s, \"sounds/a11wlk01.wav\");\n);\n\n(\nSynthDef(\"help-commonMul\", { arg out=0, bufnumA=0, bufnumB=1, soundBufnum=2;\n var inA, inB, chainA, chainB, chain;\n inA = HPF.ar(Mix(LFSaw.ar([100, 150], 0, 0.2)), 1200);\n inB = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);\n chainA = FFT(bufnumA, inA);\n chainB = FFT(bufnumB, inB);\n chain = PV_CommonMul(chainA, chainB, MouseX.kr(0, 50), MouseY.kr);\n Out.ar(out, IFFT(chain).dup);\n}).play(s,[\\out, 0, \\bufnumA, b.bufnum, \\bufnumB, c.bufnum, \\soundBufnum, d.bufnum]);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n{ Pan2.ar(Klank.ar(`[[1, 2.2, 3.5, 4.9], nil, Array.series(4, 1, -0.2)], PinkNoise.ar(EnvGen.ar(Env.perc(0.001,0.01), Impulse.ar(4))), 0), 0); }.play;\n```"}, {"role": "assistant", "content": "I accidentally set the freqscale of a Klank to 0. What resulted was a surprisingly varied and dynamic bit of glitch. The joy of typos in SC :)."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `TempoClock`."}, {"role": "assistant", "content": "```supercollider\nt = TempoClock.default;\nt.play({ |beats, time, clock| [beats, time, clock].postln });\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// default params\n{ QuadC.ar(SampleRate.ir/4) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// default params\n{ QuadC.ar(SampleRate.ir/4) * 0.2 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Integrator`."}, {"role": "assistant", "content": "```supercollider\n{ Integrator.ar(LFPulse.ar(300, 0.2, 0.1), MouseX.kr(0.001, 0.999, 1)) }.play\n\n// used as an envelope\n{ Integrator.ar(LFPulse.ar(3, 0.2, 0.0004), 0.999, FSinOsc.ar(700), 0) }.play\n\n\n// scope\n\n{ Integrator.ar(LFPulse.ar(1500 / 4, 0.2, 0.1), MouseX.kr(0.01, 0.999, 1)) }.scope\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BRF`."}, {"role": "assistant", "content": "```supercollider\n{ BRF.ar(Saw.ar(200, 0.1), FSinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3800, 4000), 0.3) }.play;\n\n{ BRF.ar(Saw.ar(200, 0.5), MouseX.kr(100, 10000, 1), 0.3) }.play;\n\n\n // BRF on control signals:\n(\n{ var vib = BRF.kr(SinOsc.kr([1, 3, 10], 0, [1, 0.5, 0.25]).sum, MouseX.kr(1, 10, 1), 0.3);\n SinOsc.ar(vib * 200 + 600) * 0.2 }.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// The code below generates a series of test signals for each speaker of \n// the currently active setup. In the default settings this generates \n// short pink noise bursts, twice on each group of 8 speakers.\n\n(\nn = 8; // size of speaker groups\nz = 1/4; // duration per burst\nt = \\pinkNoise; // udef name for sound generation\nr = 2; // number of repeats per group\nx = UScore();\n\n(WFSSpeakerConf.default.speakerCount / n).ceil.do({ |i|\n var folder;\n folder = UScore( i * (r * (n + 1) * z) );\n x.add( folder );\n r.do({ |ii|\n n.do({ |iii|\n folder.add( UChain( ((ii * (n + 1)) + iii) * z, iii, z * (3/4), \n [ t, [ \\seed, 12345 ] ],\n [ \\wfsIndex, [ \\index, (i * 8) + iii, \\gain, 0 ] ]\n )\n );\n });\n });\n folder.name = ([1,n] + (i*8)).join(\"-\"); \n});\n\nx.gui;\n)\n```"}, {"role": "assistant", "content": "The code below generates a series of test signals for each speaker of the currently active setup. In the default settings this generates short pink noise bursts, twice on each group of 8 speakers."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PatternProxy`."}, {"role": "assistant", "content": "```supercollider\na = PatternProxy(Pseq([1, 2, 3], inf));\n\nx = Pseq([0, 0, a], inf).asStream;\n\nt = Task({ loop({ x.next.postln; 0.3.wait }) }).play;\n\n\na.source = Pseq([55, 66, 77], inf);\na.source = Pseq([55, 66, 77], 1);\n\nt.stop;\n```"}]} -{"conversations": [{"role": "user", "content": "What is `FoaTumble` in SuperCollider?"}, {"role": "assistant", "content": "FoaTumble — First Order Ambisonic (FOA) rotation transformer Rotate a First Order Ambisonic signal (B-format) around the y-axis. Category: Libraries > Ambisonic Toolkit > UGens > FOA > Transformer, UGens > Multichannel > Ambisonics."}]} -{"conversations": [{"role": "user", "content": "What does `TreeViewItem.setView` do? What arguments does it take?"}, {"role": "assistant", "content": "Places another view into the given data field. Only one view can be placed into a data field at once. If a view is already present, it will be removed and destroyed. If the number of data fields decreases due to a call to TreeView#-columns, the views contained in removed data fields will also be removed and Arguments: column — An integer index of a data field.; view — A View.."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// Periphonic (3D) decoder with eight channels arranged in a bi-rectangle:\n// [ [ 30, 0 ], [ -30, 0 ], [ 90, 35.3 ], [ -90, 35.3 ],\n// [ -150, -0 ], [ 150, -0 ], [ -90, -35.3 ], [ 90, -35.3 ] ]\n\n// specify 1/2 the desired directions\n~directions = [[ 30, 0 ], [ -30, 0 ], [ 90, 35.3 ], [ -90, 35.3]].degrad;\n~decoder = FoaDecoderMatrix.newDiametric(~directions);\n\n// inspect\n~decoder.dirChannels.raddeg\n```"}, {"role": "assistant", "content": "Periphonic (3D) decoder with eight channels arranged in a bi-rectangle: [ [ 30, 0 ], [ -30, 0 ], [ 90, 35.3 ], [ -90, 35.3 ], (FoaDecoderMatrix: First Order Ambisonic (FOA) decoder matrices)"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Enveloppes sizes are fixed."}, {"role": "assistant", "content": "```supercollider\n(\n~resize_enveloppe = { | levels, times |\n var reverted_levels, index;\n index = 0;\n reverted_levels = levels.reverse;\n while( { reverted_levels[index] == 0 && reverted_levels[index+1] == 0 }, { times[ times.size - 1 - index] = 0.01; index = index + 1 } );\n};\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Midterm Q3 (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"bell\", {arg freq, amp;\n\n\n var env, snd, partials, relativeAmps;\n\n partials = [0.5, 1, 1.19, 1.56, 2, 2.51, 2.66, 3.01, 4.1];\n relativeAmps = [0.25, 1, 0.8, 0.5, 0.9, 0.4, 0.3, 0.6, 0.1];\n\n env = Env.perc(\n attackTime: 0.01,\n releaseTime: 5,\n level: amp*relativeAmps).kr(doneAction:2);\n\n snd = SinOsc.ar(\n freq: freq*partials,\n mul: env\n );\n\n snd = Mix.ar(snd);\n\n Out.ar(0, snd * 0.1 ! 2);\n\n}).add;\n);\n\n\n//Test your \"bell\" SynthDef with the following Pbind:\n\n\n(\nPbind(\n \\instrument, \"bell\",\n \\degree, Pwhite(-5, 10),\n \\dur, Pwhite(3, 6),\n \\amp, Pwhite(0.1, 0.5)\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `ServerLogGui.cmd_ngo` do? What arguments does it take?"}, {"role": "assistant", "content": "the interface for display and searching the ServerLog Arguments: msg; r. Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Feedback with beats."}, {"role": "assistant", "content": "```supercollider\nNdef(\\a, {\n var src, loc, delay=0.01;\n src = Decay2.ar(Impulse.ar(1/8), LFNoise2.kr(4).range(0.001, 0.0001),\n LFNoise2.kr(4).range(0.005, 0.05))!2\n * Saw.ar(LFNoise2.kr(4).exprange(40, 4000));\n loc = BPF.ar(LocalIn.ar(2) + [src, 0], LFNoise0.kr(1/4).range(100, 1200).lag, 3.2);\n loc = GVerb.ar(loc, 100, 4, mul:0.02, add:loc);\n loc = Compander.ar(loc, loc, 0.9, 1, 0.001);\n loc = (loc * 0.501).tanh;\n loc = Compander.ar(loc, loc, 0.1, 1, 0.1); \n loc = DelayC.ar(loc, delay * 2, delay * 1);\n LocalOut.ar(loc.reverse * 0.49);\n Out.ar(0, loc * 0.9)\n}).play;\n\nNdef(\\b, {\n var src, loc, del;\n del = 1/100;\n src = Decay2.ar(TDuty.ar(1/4,0,Dseq([1, 0.5, 0.3, 0.1],inf)), \n LFNoise2.kr(4).range(0.001, 0.0001), LFNoise2.kr(4).range(0.005, 0.05))!2\n * Saw.ar(LFNoise2.kr(200).exprange(40, 14000));\n loc = BPF.ar(LocalIn.ar(2) + [src, 0], LFNoise2.kr(0.1).range(40, 400), 3.2);\n loc = GVerb.ar(loc, 100, 4, mul:0.02, add:loc);\n loc = Compander.ar(loc, loc, 0.9, 1, 0.001);\n loc = (loc * 0.51).tanh;\n loc = Compander.ar(loc, loc, 0.1, 1, 0.1); \n loc = DelayC.ar(loc, del * 2, del * 1);\n LocalOut.ar(loc.reverse * 0.45);\n Out.ar(0, Compander.ar(loc,loc,0.1, 1, 0.05) * 1.2)\n}).play;\n\nNdef(\\c, {\n var src, loc, del=1/4;\n src = Decay2.ar(Impulse.ar(1), 0.0001, 0.05) * SinOsc.ar(60);\n loc = src + LocalIn.ar(2);\n loc = BPF.ar(loc, 800, 3.2).softclip;\n loc = DelayN.ar(loc, del, [0, del]);\n LocalOut.ar(loc.reverse * 0.99);\n Out.ar(0, loc * 2)\n}).play;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// example from SendTrig\n\n(\ns.boot;\ns.notify;\n);\n\n(\nSynthDef(\"help-SendTrig\", {\n SendTrig.kr(Dust.kr(1.0), 0, 0.9);\n}).add;\n\n// register to receive this message\na = OSCresponderNode(s.addr, '/tr', { |time, responder, msg|\n [time, responder, msg].postln;\n}).add;\nb = OSCresponderNode(s.addr, '/tr', { |time, responder, msg|\n \"this is another call\".postln;\n}).add;\n);\n\nx = Synth.new(\"help-SendTrig\";\na.remove;\nb.remove;\nx.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// example from SendTrig\n\n(\ns.boot;\ns.notify;\n);\n\n(\nSynthDef(\"help-SendTrig\", {\n SendTrig.kr(Dust.kr(1.0), 0, 0.9);\n}).add;\n\n// register to receive this message\na = OSCresponderNode(s.addr, '/tr', { |time, responder, msg|\n [time, responder, msg].postln;\n}).add;\nb = OSCresponderNode(s.addr, '/tr', { |time, responder, msg|\n \"this is another call\".postln;\n}).add;\n);\n\nx = Synth.new(\"help-SendTrig\");\na.remove;\nb.remove;\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pseq`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Pseq(#[60, 61, 63, 65, 72], inf).asStream;\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, a.next.midicps]);\n 0.2.wait;\n })\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(freq: 761.play // play a default synth sound with 761 Hz\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(freq: 761).play // play a default synth sound with 761 Hz\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Real-time pattern morphing with Ndef."}, {"role": "assistant", "content": "```supercollider\n(\n~name = \"saw\";\n\nSynthDef(~name, { arg out=0, amp=0.1, gate=1, pan=0, spread=0.8, freq=200, doneAction=2, ffreq=300, rq=0.3;\n var sig;\n sig = LFSaw.ar(freq);\n sig = RLPF.ar(sig, ffreq, rq);\n sig = sig * EnvGen.ar(\\adsr.kr(Env.adsr(0.01,0.1,0.8,0.1)),gate,doneAction:doneAction);\n sig = Splay.ar(sig, spread, amp, pan);\n Out.ar(out, sig);\n}).add;\n\n\n~morph = { arg mainkey, lagtime, pat;\n var base = pat.asStream.next(());\n var bind = List.new;\n var proxy;\n base.keysValuesDo { arg key, val;\n var ndefkey = \"%.%\".format(mainkey, key).asSymbol;\n Ndef(ndefkey, { \n Line.kr(Ndef(ndefkey).kr, val, lagtime)\n });\n proxy = Ndef(ndefkey);\n bind.add(key);\n bind.add(proxy.bus.asMap);\n };\n Pbind(*bind)\n};\n);\n\n\nPdef(~name).play;\n\n\n(\n// preset 1\n\n~a = Pdef(~name, ~morph.(\\bla, 2.1, Pbind(\n \\freq, 100,\n \\ffreq, 1300,\n)) <> Pbind(\n \\instrument, ~name,\n \\dur, 1,\n));\n\n);\n\n(\n// preset 2\n\n~a = Pdef(~name, ~morph.(\\bla, 1, Pbind(\n \\freq, 1500,\n \\ffreq, 200,\n)) <> Pbind(\n \\instrument, ~name,\n \\dur, 1,\n));\n\n);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Midterm Q2 (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"sawSynth\",{arg freq, amp;\n var env, snd;\n\n env = Env.perc(\n attackTime:0.1,\n releaseTime:2,\n level:amp).kr(doneAction: 2);\n snd = Saw.ar(\n freq:freq*[0.99, 1.0, 1.001, 1.008],\n mul: env);\n snd = LPF.ar(in: snd,freq:2000);\n snd = Splay.ar(snd);\n Out.ar(0,snd);\n\n}).add;\n);\n\n(\nPbind(\n \\instrument, \"sawSynth\",\n \\freq, Pwhite(300, 700, inf),\n \\amp, Pwhite(0.15, 0.2)\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n var freqs = [200, 600, 400, 450, 150, 20, 800];\n var amps = Saw.ar(freq: [2,3, 5]).range(1, 0.5, 0.3, 0.8);\n var snd = LFTri.ar(freq: freqs, mul: amps);\n Mix.ar(snd)\n}.play;\n)\n```"}, {"role": "assistant", "content": "LFTri that plays in a single channel with frequent amplitude shifts."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// Function to check an array for repetitions within a maximum test span\n\n~repetitionCheck = { |array, maxTestSpan|\n maxTestSpan.do { |i|\n var result = (array.drop(i+1) - array).drop((i+1).neg).includes(0).not;\n (\"no repetitions within a span of \" ++ (i+2).asString ++ \" items: \").post;\n result.postln;\n }\n}\n);\n\n// test case\n// no repetitions within a maximum span of 6 (lookBack == 5)\n\n(\np = PIdev(Pbrown(0, 20, 0.3).round.asInteger, 5, -7, 7).iter;\na = p.nextN(10000);\na.plot;\n~repetitionCheck.(a, 10);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// Function to check an array for repetitions within a maximum test span\n\n~repetitionCheck = { |array, maxTestSpan|\n maxTestSpan.do { |i|\n var result = (array.drop(i+1) - array).drop((i+1).neg).includes(0).not;\n (\"no repetitions within a span of \" ++ (i+2).asString ++ \" items: \").post;\n result.postln;\n }\n}\n);\n\n// test case\n// no repetitions within a maximum span of 6 (lookBack == 5)\n\n(\np = PIdev(Pbrown(0, 20, 0.3).round.asInteger, 5, -7, 7).iter;\na = p.nextN(10000);\na.plot;\n~repetitionCheck.(a, 10);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `RedMixerChannel.eqMi` do?"}, {"role": "assistant", "content": "Activate channel equalizer middle band (0=off, 1=on). Also"}]} -{"conversations": [{"role": "user", "content": "What does `AbstractVector.gramSchmidt` do?"}, {"role": "assistant", "content": "Applies the gramSchmidt process to the vectors and returns an array of orthogonal vectors that span the same subspace as the original"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\np = Pmono(\\default, \\dur, 0.2, \\freq, Pwhite(1, 8) * 100).play\n\np.stop\n\n// multi channel expansion is supported:\np = Pmono(\\default, \\dur, 0.2, \\freq, Pwhite(1, 8) * 100, \\detune, [0, 2, 5, 1]).play\n\np.stop\n\n\n// the following example will end after 5 seconds\n// or you can stop it sooner with a stop message\n(\np = Pfindur(5,\n Pset(\\detune, Pwhite(0, 1.0) * [0, 1, 3, 7],\n Ppar([\n Pmono(\\default, \\dur, 0.2, \\freq, Pwhite(1, 8) * 100),\n Pmono(\\default\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\np = Pmono(\\default, \\dur, 0.2, \\freq, Pwhite(1, 8) * 100).play\n\np.stop\n\n// multi channel expansion is supported:\np = Pmono(\\default, \\dur, 0.2, \\freq, Pwhite(1, 8) * 100, \\detune, [0, 2, 5, 1]).play\n\np.stop\n\n\n// the following example will end after 5 seconds\n// or you can stop it sooner with a stop message\n(\np = Pfindur(5,\n Pset(\\detune, Pwhite(0, 1.0) * [0, 1, 3, 7],\n Ppar([\n Pmono(\\default, \\dur, 0.2, \\freq, Pwhite(1, 8) * 100),\n Pmono(\\default, \\dur, 0.1, \\freq, Pwhite(1, 8) * 300)\n ])\n )\n).play;\n);\np.stop;\n```"}]} -{"conversations": [{"role": "user", "content": "What is `FoaNF` in SuperCollider?"}, {"role": "assistant", "content": "FoaNF — First Order Ambisonic (FOA) near-field distance estimate Return the near-field distance estimate of a first order ambisonic (B-format) signal, in meters. Category: Libraries > Ambisonic Toolkit > UGens > FOA > Analyzer, UGens > Multichannel > Ambisonics, UGens > Analysis > Ambisonics."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Detune idea is from James Harkins."}, {"role": "assistant", "content": "```supercollider\n(\na = {\n |freq = 40, wid = 0.5|\n Mix(LFPulse.ar(freq *((Array.fill(40, Pxrand((1, 2..20), inf).iter)/1000)+1),\n 0, wid, 0.05)\n ).dup\n}.play;\n);\n\n//more distorsion\n~widlfo = {Saw.kr(0.5).range(0,1)};\na.set(\\wid, ~widlfo);\n\n//stop\na.release;\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Random deep fryer?"}, {"role": "assistant", "content": "```supercollider\n// random deep fryer. can turn in to rain, waves and other stuff.\n// nice with multichannel iteration. Change number at \"!2\".\n// volume compensation for high quality filter with \"1/q.sqrt\" for mul in BPF.\n// variable \"dist\" for distortion, increasing can go loud, decrease \"amp\" if so.\n// LFNoise1 with noisefreq,noisemul,noiseoffset gives it the wavy feel.\n\n(\nSynthDef(\\friture, {\n arg amp=0.5, dist=2, dens=12, dustamp=1, offset=0, noisefreq=2, noisemul=2,\n noiseoffset=0, frq1=200, frq2=2500, rq1=0.5, rq2=0.1, out=0;\n\n var sig, env;\n\n sig = {BPF.ar((Dust2.ar(dens, dustamp, offset)*LFNoise1.ar(noisefreq,noisemul,noiseoffset)),rrand(frq1,frq2),q=rrand(rq1,rq2),1/q.sqrt)}!2;\n sig = (sig*dist).tanh*amp;\n\n\n Out.ar(out,sig);\n\n }).add;\n);\n\ny = Synth.new(\\friture);\ny.free;\n\ny.set(\\dens,161);\ny.set(\\amp,0.5);\ny.set(\\dist,1);\ny.set(\\rq1,0.2);\ny.set(\\rq2,0.4);\ny.set(\\frq1,133);\ny.set(\\frq2,193);\ny.set(\\noisefreq,1);\ny.set(\\noisemul,2);\ny.set(\\noiseoffset,(-2));\ny.set(\\out,0);\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar nome,layout;\nnome = Patch({ arg beat,freq,amp;\n Decay2.ar(\n K2A.ar(beat), 0.01,0.11,\n SinOsc.ar( freq, 0, amp )\n )\n },[\n BeatClockPlayer.new(4.0),\n StreamKrDur(\n Pseq([ 750, 500, 300, 500, 750, 500, 400, 500, 750, 500, 400, 500, 750, 500, 400, 500 ],inf),\n 1.0),\n StreamKrDur(\n Pseq([1,0.25,0.5,0.25,0.75,0.25,0.5,0.25,0.75,0.25,0.5,0.25,0.75,0.25\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar nome,layout;\nnome = Patch({ arg beat,freq,amp;\n Decay2.ar(\n K2A.ar(beat), 0.01,0.11,\n SinOsc.ar( freq, 0, amp )\n )\n },[\n BeatClockPlayer.new(4.0),\n StreamKrDur(\n Pseq([ 750, 500, 300, 500, 750, 500, 400, 500, 750, 500, 400, 500, 750, 500, 400, 500 ],inf),\n 1.0),\n StreamKrDur(\n Pseq([1,0.25,0.5,0.25,0.75,0.25,0.5,0.25,0.75,0.25,0.5,0.25,0.75,0.25,0.5,0.25] * 0.01,inf),\n 1.0)\n ]);\nlayout = FlowView.new;\n\nToggleButton(layout,\"Nome\",{\n if(nome.isPlaying.not,{ nome.play(atTime: 4) })\n},{\n if(nome.isPlaying,{ nome.stop })\n},minWidth: 250);\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `AbstractMessageMatcher.func` do?"}, {"role": "assistant", "content": "Get or set this object's response Returns: A Function or similar object."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `SortedList`."}, {"role": "assistant", "content": "```supercollider\nSortedList[1, 2, 5, 6].add(4).postln;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// By Bjørn Houdorf March 2013, Play your (short) soundfiles with some delay.\n\nb = SoundFile.collectIntoBuffers(\"yourSoundFileFolder/*\"); // 1. rund this\n\n( // 2. and then run this\nt = Task({\n({\n var num= b.size.rand;\n var buf= b[num];\n 0.1*Splay.ar(PlayBuf.ar(buf.numChannels, buf, 1, 1, 0, 0));\n}.play;\n) \n});\n);\n\n\n( // 3. Then run this\nz = Task({\nloop({\n t.start;\n 0.1.wait;\n});\n});\n);\n\n\nz.start; // 4. and run this\nz.stop; // 5. and finally run this\n```"}, {"role": "assistant", "content": "Play your (short) soundfiles with some delay. Your soundfiles should be in the folder \"yourSoundFileFolder\"."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for electric guitar (a SuperCollider snippet)?"}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\noisecomb2, { arg out, gate=1, pan=0, freq=300, amp=0.1, noiselevel=0.2,\n minfreq=100, decaytime=1, doneAction=2, ffreq=500, rq=0.3, spread=0.8;\n var sig, env;\n sig = WhiteNoise.ar(noiselevel);\n sig = sig + ClipNoise.ar(noiselevel);\n sig = sig + AllpassC.ar(sig, 1/minfreq, 1/freq, decaytime);\n sig = RLPF.ar(sig, ffreq * \\ffreqtab.kr(1!10), rq);\n env = EnvGen.kr(\\adsr.kr(Env.adsr(0.6,0.1,0.8,0.1)), gate, doneAction:doneAction);\n sig = sig * env;\n sig = Splay.ar(sig, spread, 1, pan);\n sig = sig * amp;\n Out.ar(out, sig);\n}).store;\n);\n\n(\nPdef(\\plopbla, Pbind(\n \\instrument, \\noisecomb2,\n \\note, Pseq([[0,7],[1,8],[-1,5]]-2,inf),\n //\\note, Pseq([0,1,2,3,4],inf)\n \\octave, Pstep(Pseq([3,4],inf),Pseq([5,0.75],inf)),\n \\minfreq, 50,\n \\decaytime, 1.0,\n \\adsr, Pseq([\n [Env.adsr(0.02,0.1,0.8,0.4,curve:0.5)],\n [Env.adsr(0.02,0.1,0.8,0.4,curve:0.5)],\n [Env.adsr(0.02,0.1,0.8,0.4,curve:0.5)],\n [Env.adsr(0.03,0.1,0.8,0.1,curve:0.5)],\n [Env.adsr(0.03,0.1,0.8,0.1,curve:0.5)],\n [Env.adsr(0.03,0.1,0.8,0.1,curve:0.5)],\n ],inf),\n \\legato, 1.0,\n //\\ffreq, [500,610,820,140],\n \\ffreq, 500,\n //\\ffreqtab, [[0.8,1,1.1,1.2, 2,4,5,6, 8,10].scramble.postln],\n //\\ffreqtab, Pfunc{ [[ 0.1, 0.2, 0.3, 0.5, 1,2,3,8, 10, 12 ].scramble] + rrand(0.01,1.0); },\n //\\ffreqtab, [ 6, 4, 5, 10, 1, 1.2, 0.8, 1.1, 2, 8 ], // also nice\n \\ffreqtab, [[ 6, 4, 5, 10, 1, 1.2, 0.8, 0.4, 2, 8 ]],\n \\dur, Pseq([3,1,1, 0.25,0.25,0.25],inf),\n \\amp, 1.1\n)).play;\n);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `EventPatternProxy.set` do?"}, {"role": "assistant", "content": "set arguments in the default event. If there is none, it is created and the pattern is"}]} -{"conversations": [{"role": "user", "content": "What is the node tree and what is a Group for?"}, {"role": "assistant", "content": "Everything running on the server is a node: Synths and Groups, arranged in a tree under the root group. Order matters, because audio flows through buses from earlier to later nodes in the same branch. A Group is a container that lets you address many nodes at once, which is what you want for an effect chain — put the instruments in one group, the effect in another, and `freeAll` or a volume change hits the whole group instead of a list of node ids."}]} -{"conversations": [{"role": "user", "content": "What does Lag do?"}, {"role": "assistant", "content": "`Lag.ar(in, lagTime)` and `Lag.kr(in, lagTime)` smooth a signal with an exponential lag towards its target, which removes the clicks and zipper noise a stepped control would produce. Lag.kr on a mouse or MIDI input is the standard way to make a parameter feel analogue: `Lag.kr(MouseX.kr(200, 4000), 0.2)`. Lag2 and Lag3 are the second- and third-order versions, smoother and slower."}]} -{"conversations": [{"role": "user", "content": "What does `EnvelopeView.setString` do? What arguments does it take?"}, {"role": "assistant", "content": "Sets the label of the node at the given Arguments: index — the index of the node.; string — A String.."}]} -{"conversations": [{"role": "user", "content": "How should I check an answer you give me?"}, {"role": "assistant", "content": "Three quick checks, cheapest first. Does it evaluate without a syntax error — the post window points at the exact character. Does the node appear in `s.plotTree` — if yes, the problem is signal rather than lifecycle. Does it reach `Out.ar(0, ...)` with a non-zero amplitude and an open filter. If those three pass and it is still silent, the class's own help page will show the argument order you may have assumed wrong."}]} -{"conversations": [{"role": "user", "content": "Can you listen to the sound you generate?"}, {"role": "assistant", "content": "No. I am 198M parameters trained on SuperCollider's documentation and class library; I have no audio input and no way to hear a result. What I can do is reason about the code: whether it reaches an output bus, whether the envelope will ever open, whether a filter at that cutoff leaves anything audible. Treat my patches as a starting point you listen to, not as a judgement about how they sound."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for distobass (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\\bass, { arg out=0, amp=0.1, gate=1, pan=0, spread=0.8, freq=200, doneAction=2;\n var sig, sig1, sig2, sig3;\n freq = SinOsc.ar(freq*\\fmfreq.kr(1).lag(0.3)) * \\fmrange.kr(0.5).lag(0.3) * LFNoise1.kr(1/7).range(0.9,1.1) + 1 * freq;\n sig = SinOsc.ar(freq.lag(0.1) * [1,8,2,4,1.002]);\n sig1 = LFPulse.ar(freq * [1,4,1.001,2 * LFNoise1.kr(1/10).range(0.999,1.001),1/2], mul:1.00);\n sig = sig + sig1;\n sig = sig.fold2(SinOsc.kr(1/13).range(0.9,1));\n sig = sig.wrap2(SinOsc.kr(1/14).range(0.9,1));\n sig = RLPF.ar(sig, \\lpf.kr(500).lag(0.4) * LFNoise1.kr(1/9).range(0.9,1.1), \\rq.kr(0.5));\n sig = HPF.ar(sig, \\hpf.kr(40));\n sig = sig * EnvGen.ar(\\iadsr.kr(Env.adsr(0.01,0.1,0.8,0.1)),\\igate.kr(1),doneAction:0);\n sig = sig * EnvGen.ar(\\adsr.kr(Env.adsr(0.01,0.1,0.8,0.1)),gate,doneAction:doneAction);\n sig = Splay.ar(sig, spread, amp, pan);\n Out.ar(out, sig);\n}).add;\n\n(\nPdef(\\bass, Pmono(\\bass,\n \\freq, 70 * Pseq([0,1].midiratio,inf).stutter(16) * Pseq([1,2],inf).stutter(64),\n \\fmrange, Pseq([0.5,1,1.5],inf),\n \\fmfreq, Pseq([0.5,1,2,4],inf),\n \\dur, 1/4,\n \\igate, Pseq([\n 1,0,0,0,\n 0,0,0,0,\n ],inf),\n \\iadsr, Pseq([\n [ Env.adsr(0.1,0.1,0.8,4.1) ],\n ],inf),\n \\lpf, Pkey(\\freq) * Pseq([\n 2,1,4,8,\n 2,1,4,8,\n 2,1,4,8,\n 4,2,2,4,\n ],inf).stutter(8),\n \\hpf, Pkey(\\freq) / 2,\n\n \\amp, Pkey(\\amp) * 2,\n \\isRest, false,\n));\nPdef(\\bass).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `RedManchesterCode.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new Arguments: numBits — The maximum number of bits in the data to be encoded. The default 8 can deal with values between 0 and 255.."}]} -{"conversations": [{"role": "user", "content": "What does `RedEffectModuleGUI.new` do? What arguments does it take?"}, {"role": "assistant", "content": "gui for effect modules Arguments: redEffectModule — A RedEffectModule.; parent — A Window, View or `nil`.; position — A Point or `nil`.."}]} -{"conversations": [{"role": "user", "content": "I get 'server not running' or nothing happens at all."}, {"role": "assistant", "content": "The server is not booted. In the IDE press Ctrl+B, or evaluate `s.boot`. If code depends on a SynthDef being there, put it inside `s.waitForBoot { ... }`. When a script runs headless you can do `s.boot; s.sync;` and continue. `s.serverRunning` tells you the truth; if it is false, look at the post window for the boot error (usually an audio device problem)."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Midterm Q3 (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"bell\", {arg freq, amp;\n\n\n var env, snd, partials, relativeAmps;\n\n partials = [0.5, 1, 1.19, 1.56, 2, 2.51, 2.66, 3.01, 4.1];\n relativeAmps = [0.25, 1, 0.8, 0.5, 0.9, 0.4, 0.3, 0.6, 0.1];\n\n env = Env.perc(\n attackTime: 0.01,\n releaseTime: 5,\n level: amp*relativeAmps).kr(doneAction:2);\n\n snd = SinOsc.ar(\n freq: freq*partials,\n mul: env\n );\n\n snd = Mix.ar(snd);\n\n Out.ar(0, snd * 0.1 ! 2);\n\n}).add;\n);\n\n\n//Test your \"bell\" SynthDef with the following Pbind:\n\n\n(\nPbind(\n \\instrument, \"bell\",\n \\degree, Pwhite(-5, 10),\n \\dur, Pwhite(3, 6),\n \\amp, Pwhite(0.1, 0.5)\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Semideterministic JitLib Code for Experimental Livecoding."}, {"role": "assistant", "content": "```supercollider\n// NX102\n// 2012-08-07_23_05_45\n\n// La ment no té límits.\n\n// Use with Jitlib:\n\np = ProxySpace.push(s.boot);\n\n// Read one sample on your collection:\n\nb = Buffer.read(s,Platform.userAppSupportDir +/+\"/audio/a11wlk01.wav\",bufnum:1);\n\n// Play and fun:\n\n~nx102.play;\n\n~nx102 = {\n Pan2.ar(LeakDC.ar(Normalizer.ar(\n BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(FreeVerb.ar(\n RHPF.ar(RLPF.ar(\n Pulse.ar(\n (PlayBuf.kr(1,1,Rand(50,100),1,0,1)*Rand(100,1000)).clip(\n Rand(5,12),Rand(12,20))) \n ,Rand(100,5000),Rand(0.005,0.1))\n ,Rand(5000,20000),Rand(0.005,0.1))\n ,0.0,0.0,0.0)\n ,100,6.0,6),1000,6.0,0),5000,6.0,0),10000,6.0,6)\n ,(1.25/0.999)*1.0,0.1)),0)\n};\n\n~nx102 = nil;\nb.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `ScoreClock.makeScore` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a Score object by running all items scheduled on this clock, capturing OSC messages and Arguments: maxTime — The maximum duration in seconds of the score.; padding — Add this many seconds of padding after the last activity.. Returns: A new Score object."}]} -{"conversations": [{"role": "user", "content": "Explain `Dust` in SuperCollider briefly."}, {"role": "assistant", "content": "Dust — Random impulses. Generates random impulses from 0 to +1. Category: UGens > Generators > Stochastic."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n({ [5, 6, 2].choose.postln } ring1: { [2, -1, 3].choose.postln }).value\n\n// UGens are also abstract functions\n(\n{ a = SinOsc.ar(335); b = SinOsc.ar(MouseX.kr(1, 1000, 1));\nring1(a, b) * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n({ [5, 6, 2].choose.postln } ring1: { [2, -1, 3].choose.postln }).value\n\n// UGens are also abstract functions\n(\n{ a = SinOsc.ar(335); b = SinOsc.ar(MouseX.kr(1, 1000, 1));\nring1(a, b) * 0.1 }.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(// * //watch the postWindow\na=[\"m\",\"x\",\"f\",\"k\",\"d\",\"p\"];\nx=Array;\ny=x.newClear(6);\n~mxfkdp=Task({\n inf.do({y.put(x.series(6,0,1).choose,a.scramble).postln;\n 0.03.wait;})}).play;\nm=fork({inf.do({\n \"array num:\".postcln;\n if(y[x.series(6,0,1).choose.postcln]==a,\n {\"lo encontraste!/found it!\".postcln;\n 1.do({GVerb.ar(\n EnvGen.ar(Env.perc(0.01,8),1,doneAction:2)*\n Blip.ar(XLine.kr(440,1600,8)),50,10,0.02)}.play);\n ~mxfkdp.stop;\n m.stop;}, \n {\"buscando.../seeking...\".postcln;});\n 0.03.wait})});\n);\n//.SCtweetLong\n```"}, {"role": "assistant", "content": "this code throws a scrambled array of arrays seeking among them for the original array,\r\nIt only sounds when it founds it. (may take a while)\r\nthe idea started trying a SCtweet, but became with this funny code!."}]} -{"conversations": [{"role": "user", "content": "Explain `NoteOffResponder` in SuperCollider briefly."}, {"role": "assistant", "content": "NoteOffResponder — allow functions to be registered to respond to MIDI noteOff events Category: External Control > MIDI."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PmonoArtic`."}, {"role": "assistant", "content": "```supercollider\n// This SynthDef has a harder attack than the default, illustrating rearticulation more clearly.\n(\nSynthDef(\\sawpulse, { |out, freq = 440, gate = 0.5, plfofreq = 6, mw = 0, ffreq = 2000, rq = 0.3, freqlag = 0.05, amp = 1|\n var sig, plfo, fcurve;\n plfo = SinOsc.kr(plfofreq, mul: mw, add: 1);\n freq = Lag.kr(freq, freqlag) * plfo;\n fcurve = EnvGen.kr(Env.adsr(0, 0.3, 0.1, 20), gate);\n fcurve = (fcurve - 1).madd(0.7, 1) * ffreq;\n sig = Mix.ar([Pulse.ar(freq, 0.9), Saw.ar(freq*1.007)]);\n sig = RLPF.ar(sig, fcurve, rq)\n * EnvGen.kr(Env.adsr(0.04, 0.2, 0.6, 0.1), gate, doneAction: Done.freeSelf)\n * amp;\n Out.ar(out, sig ! 2)\n}).add;\n);\n\np = PmonoArtic(\\sawpulse, \\dur, 0.2, \\freq, Pwhite(1, 8) * 100, \\legato, Pwrand(#[0.5, 1.0], #[0.1, 0.9], inf)).play;\n\np.stop;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `AbstractServerAction.remove` do?"}, {"role": "assistant", "content": "Remove an item or object from registry. If server is nil, remove from all"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\nSynthDef(\\help_Buffer_copy, { |out = 0, buf|\n Line.ar(0, 0, dur: BufDur.kr(buf), doneAction: Done.freeSelf);\n Out.ar(out, PlayBuf.ar(1, buf));\n}).add;\n);\n\n(\nb = Buffer.read(s, ExampleFiles.child);\nc = Buffer.alloc(s, 120000);\n);\n\nSynth(\\help_Buffer_copy, [\\buf, b]);\n\n// copy the whole buffer\nb.copyData(c);\nSynth(\\help_Buffer_copy, [\\buf, c]);\n\n// copy some samples\nc.zero;\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\nSynthDef(\\help_Buffer_copy, { |out = 0, buf|\n Line.ar(0, 0, dur: BufDur.kr(buf), doneAction: Done.freeSelf);\n Out.ar(out, PlayBuf.ar(1, buf));\n}).add;\n);\n\n(\nb = Buffer.read(s, ExampleFiles.child);\nc = Buffer.alloc(s, 120000);\n);\n\nSynth(\\help_Buffer_copy, [\\buf, b]);\n\n// copy the whole buffer\nb.copyData(c);\nSynth(\\help_Buffer_copy, [\\buf, c]);\n\n// copy some samples\nc.zero;\nb.copyData(c, numSamples: 4410);\nSynth(\\help_Buffer_copy, [\\buf, c]);\n\n// buffer \"compositing\"\nc.zero;\nb.copyData(c, numSamples: 4410);\nb.copyData(c, dstStartAt: 4410, numSamples: 15500);\nSynth(\\help_Buffer_copy, [\\buf, c]);\n\nb.free;\nc.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Float.as32Bits` do?"}, {"role": "assistant", "content": "64-bit Floating point number Returns: an Integer which is the bit pattern of this as a 32bit single precision float"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n//listen to x and y output\n{Out.ar(0,Brusselator.ar(Impulse.kr(MouseY.kr(1,50,'exponential')),MouseX.kr(0.01,1,'exponential')))}.play\n\n//avoid DC offset (default gamma is 1.0, listening to x only, so take off gamma\n{Out.ar(0,Pan2.ar((Brusselator.ar(Impulse.kr(MouseY.kr(1,50,'exponential')),MouseX.kr(0.01,1,'exponential')))[0] - 1.0) )}.play\n\n\n//fun time, stable oscillation with these parameters\n{var mu = MouseY.kr(1.0,1.5); Out.ar(0,Pan2.\n// …\n```"}, {"role": "assistant", "content": "listen to x and y output avoid DC offset (default gamma is 1.0, listening to x only, so take off gamma (Brusselator: Prigogine oscillator)"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// start a server program from the cmdLine for testing\n~pid = unixCmd(Server.program + s.options.asOptionsString(57100));\n// kill just that server program by its pid:\nthisProcess.platform.killProcessByID(~pid);\n```"}, {"role": "assistant", "content": "start a server program from the cmdLine for testing kill just that server program by its pid: (Platform: handle cross-platform differencies)"}]} -{"conversations": [{"role": "user", "content": "What is `HasItemSpec` in SuperCollider?"}, {"role": "assistant", "content": "HasItemSpec — abstract parent class for datatypes that wrap other datatypes eg. ArraySpec Category: Spec, Libraries > crucial > Spec."}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nNdef(\\x, { Saw.ar(110) * 0.1 }).play;\nNdef(\\x)[1] = \\filter -> { |in| RLPF.ar(in, 800, 0.4) };\n```"}, {"role": "assistant", "content": "Two nodes in one named proxy: a saw source, then a resonant low-pass filter fed by it.\n\n`Ndef(\\x, { ... })` defines the first node of the chain and `.play` starts it. `Ndef(\\x)[1] = \\filter ->`\ninserts a second node at index 1; the `\\filter` key says 'make this node an effect that receives the\nprevious node's output as `in`'. So the patch is `Saw -> RLPF -> out`. Because it is an Ndef, calling\n`Ndef(\\x, { ... })` again replaces the source with a crossfade instead of restarting, and\n`Ndef(\\x).stop` removes the whole chain."}]} -{"conversations": [{"role": "user", "content": "What does `MIDIdef.smpte` do?"}, {"role": "assistant", "content": "A convenience method to create a new MIDIdef which responds to MIDI smpte messages. See #*new for argument descriptions. The responding `func` will be passed the arguments seconds, framerate, dropframe, and srcID. (dropframe is a Returns: A new instance of MIDIdef which responds to MIDI smpte messages."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Impulse.ar(4, [0, MouseX.kr(0, 1)], 0.2 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Impulse.ar(4, [0, MouseX.kr(0, 1)], 0.2) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Limiter`."}, {"role": "assistant", "content": "```supercollider\n(\n// example signal to process\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n z * 0.8\n}.play\n);\n\n(\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n [z, Limiter.ar(z, 0.4, 0.01)] * 0.5\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Position.previous` do?"}, {"role": "assistant", "content": "an object that holds the value of the current play position for an object"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n//Its not the spline that loops (that would be a loop in 2 dimensional space) but the SplineGen that is set to loop.\n\n// the spline does NOT loop,\nb = BSpline( Array.fill(16,{ arg i; [ i * 0.25,1.0.rand ] }), 3.0,false );\n\nb.gui(nil,1200@300);\n\n\n);\n(\n// the SplineGen loops\n{\n Saw.ar(SplineGen(b,loop:true).kr.linexp(0.0,1.0,40,500).clip(40,500)).dup * 0.4\n}.play\n)\n```"}, {"role": "assistant", "content": "Its not the spline that loops (that would be a loop in 2 dimensional space) but the SplineGen that is set to loop. the spline does NOT loop, (SplineGen: Like EnvGen but for Splines)"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Listening to CC messages."}, {"role": "assistant", "content": "```supercollider\n// connect will connect to all midi in devices\n// if you need to specify one,\n// check the sources at: MIDIClient.sources\n// and connect using MIDIIn.connect( source_index )\nMIDIIn.connect;\n\n// show incoming control data\n~control = { arg src, chan, num, val; \n [chan,num,val].postln; \n};\n\nMIDIIn.addFuncTo(\\control, ~control);\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// default values\n{ Logistic.ar }.play\n\n// onset of chaos\n{ Logistic.ar(Line.kr(3.55, 3.6, 5), 1000) }.play\n\n// explore via Mouse\n{ Logistic.ar(MouseX.kr(3, 3.99), MouseY.kr(10, 10000, 'exponential'), 0.25, 0.5 }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// default values\n{ Logistic.ar }.play\n\n// onset of chaos\n{ Logistic.ar(Line.kr(3.55, 3.6, 5), 1000) }.play\n\n// explore via Mouse\n{ Logistic.ar(MouseX.kr(3, 3.99), MouseY.kr(10, 10000, 'exponential'), 0.25, 0.5) }.play\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Padd`."}, {"role": "assistant", "content": "```supercollider\n(\nvar a, b;\na = Padd(\\freq, 801, Pbind(\\freq, 100));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\n// The mul and add arguments of SinOsc themselves use MulAdd!\n// These two examples will create precisely the same synth graph:\nx = { SinOsc.ar(440, 0, 0.1, 0.05) }.play(s);\nx.trace; // You should see a \"MulAdd\" in the trace\nx.free;\n\nx = { MulAdd(SinOsc.ar(440, 0), 0.1, 0.05) }.play(s);\nx.trace;\nx.free;\n\n// In fact this will produce the same graph too - the separate multiply and add are optimised into one MulAdd\nx = { SinOsc.ar(440, 0) * 0.1 + 0.05 }.play(s;\nx.trace;\nx.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\n// The mul and add arguments of SinOsc themselves use MulAdd!\n// These two examples will create precisely the same synth graph:\nx = { SinOsc.ar(440, 0, 0.1, 0.05) }.play(s);\nx.trace; // You should see a \"MulAdd\" in the trace\nx.free;\n\nx = { MulAdd(SinOsc.ar(440, 0), 0.1, 0.05) }.play(s);\nx.trace;\nx.free;\n\n// In fact this will produce the same graph too - the separate multiply and add are optimised into one MulAdd\nx = { SinOsc.ar(440, 0) * 0.1 + 0.05 }.play(s);\nx.trace;\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for 2 channels of chuckling sawtooths."}, {"role": "assistant", "content": "```supercollider\n//hall of mirrors\n{[AllpassC.ar(HPF.ar(RLPF.ar(Saw.ar(LFPar.kr(0.25).range(220,440)),LFPar.kr(MouseX.kr(0,8),pi).range(220,20000),0.3),LFPar.kr(MouseY.kr(0,8)).range(220,20000)),2,MouseX.kr(0,0.5),2),AllpassC.ar(HPF.ar(RLPF.ar(Saw.ar(LFPar.kr(0.25,pi).range(440,220)),LFPar.kr(MouseX.kr(8,0),pi).range(20000,220),0.3),LFPar.kr(MouseY.kr(8,0),pi).range(20000,220)),2,MouseX.kr(0.5,0),2)]}.play\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for first step?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n\nz = ( ( SinOsc.ar( ((LFSaw.kr(-0.05,1) +1) *100 + 20 ), LFTri.kr(40,0,1), LFSaw.kr(1.5) ) \n * LFTri.kr(rrand(0.005,0.03),3.99.rand,0.2) ) + \n( LFPulse.ar(60,0,0.5,Pulse.ar(0.5,0.5,0.1)) * LFTri.kr(rrand(0.005,0.03),3.99.rand,0.5) ) +\n( SinOsc.ar(65,0,LFPulse.kr(0.66666,0.5,0.3)*0.3) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) )+\n( LFPar.ar(120,0,LFPulse.kr(0.5,0.5,0.2)*0.3) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( LFCub.ar(185,0,LFPulse.kr(0.5,0.74,0.2)*0.3) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( SinOsc.ar(365,0,LFPulse.kr(1.33333333,0,0.1)*0.3) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( FreeVerb.ar(LFTri.ar(260,0,LFPulse.kr(0.5,0.25,0.01)*0.3),0.5,0.8,0.1) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( SinOsc.ar(800,0,LFPulse.kr(2,0,0.1)*0.1) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( LFPar.ar(820,0,LFPulse.kr(1.666666,0,0.1)*0.1) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( WhiteNoise.ar( LFPulse.kr(2,0.5,0.001,1) )/2 * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( WhiteNoise.ar( LFPulse.kr(1,0.5,0.001,1) )/2 * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( WhiteNoise.ar( LFPulse.kr(1.666666,0.5,0.001,1) )/4 * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( WhiteNoise.ar( LFPulse.kr(1.333333,0.5,0.001,1) )/4 * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) );\n\nFreeVerb.ar(\n ((CombC.ar(\n DelayN.ar(\n DelayN.ar(z, 0.5, [0.5,0.75], 1, z), \n 0.5, 0.5, 1, z), \n 0.1, LFNoise0.kr(1,0.05,0.001).abs, 2, z))+z),\n0.1,1,0.1); \n\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `MxApp.play` do? What arguments does it take?"}, {"role": "assistant", "content": "Starts playing it isn't already Arguments: then — A callback, executed after play has started. Returns: this"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\"help-LinRand\", { |out = 0, minmax = 1|\n Out.ar(out,\n FSinOsc.ar(\n LinRand(200.0, 10000.0, minmax),\n 0, Line.kr(0.2, 0, 0.01, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n// towards hi\n(\nRoutine({\n loop({\n Synth.new(\"help-LinRand\"); 0.04.wait;\n })\n}).play;\n);\n\n// towards lo (doesn't work like that yet)\n(\nRoutine({\n loop({\n Synth.new(\"help-LinRand\", [\\minmax, -1]); 0.04.wait;\n })\n}).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\"help-LinRand\", { |out = 0, minmax = 1|\n Out.ar(out,\n FSinOsc.ar(\n LinRand(200.0, 10000.0, minmax),\n 0, Line.kr(0.2, 0, 0.01, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n// towards hi\n(\nRoutine({\n loop({\n Synth.new(\"help-LinRand\"); 0.04.wait;\n })\n}).play;\n);\n\n// towards lo (doesn't work like that yet)\n(\nRoutine({\n loop({\n Synth.new(\"help-LinRand\", [\\minmax, -1]); 0.04.wait;\n })\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes sclang fun )."}, {"role": "assistant", "content": "```supercollider\n( // whatever\nNdef(\\ff_twist, {\n var tempo = 156/60;//TempoClock.tempo;\n var bands = 4.rrand(16).debug('bands');\n var sync = bands.factors.scramble.pop.debug('sync');\n var gen = [LFNoise1,LFNoise2,LFNoise0];\n var sig = Splay.ar(\n VarSaw.ar(//LFSaw.kr(Array.rand(bands/sync, 8, 390).stutter(sync)).range(0.97,1.03) * \n Array.exprand(bands, 50, 400) * ({ gen.choose.kr(1/1.rrand(10)).exprange(1, 10) } ! (bands/sync)).stutter(sync), \n 0, \n { gen.choose.kr(1/1.rrand(10)).range(0.1,1) } ! bands, \n { gen.choose.kr(1/1.rrand(10)).range(0.1,1) } ! bands\n ) * ({ EnvGen.kr(Env.perc(0.008.exprand(0.03), tempo.reciprocal / [1,2,4,8].choose, 1, rrand(-7,-1.0)).circle) } ! (bands/sync)).stutter(sync)\n );\n sig = sig * 0.7 + GVerb.ar(sig, mul:0.3);\n sig = Rotate2.ar(\n sig[0], sig[1], \n LFSaw.kr( Duty.kr(tempo.reciprocal * (2,8..24).choose, 0, Drand((1..4)*tempo, inf)) )\n );\n sig;\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BelaScope`."}, {"role": "assistant", "content": "```supercollider\n{ BelaScope.scope(0, SinOsc.ar) }.play;\n// same using UGen\n```"}]} -{"conversations": [{"role": "user", "content": "What is `PLexprand` in SuperCollider?"}, {"role": "assistant", "content": "PLexprand — dynamic scope Pexprand variant Takes Symbol args for later reference by the Streams, which will read from variables in the Environments of their instantiation. See PLx_suite. Category: Libraries > miSCellaneous > PLx suite, Streams-Patterns-Events > PLx suite."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Just a lunch time tweet."}, {"role": "assistant", "content": "```supercollider\n{CombC.ar(Klang.ar(`[[100,101,1000,1001]],1,0)*0.1,0.33,LFTri.ar(0.1, 0, 0.1, 0.11)+LFTri.ar(0.17, 0, 0.1, 0.22),10)!2}.play;\n\n//Variation\n‎{CombC.ar(Klang.ar(`[[100,101,1000,1001]],1,0)*0.1,1.33,LFTri.ar(0.3, 0, 0.1, 0.71)+LFTri.ar(0.7, 0, 0.1, 0.52),10)!2}.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Instr.defArgs` do?"}, {"role": "assistant", "content": "the defaults for each argument that were specified in the function; eg. for { arg freq=440; } the defArg is Returns: array of default args"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Just an exploration with Substractive synthesis?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n\n 2.do{\n {BPF.ar (WhiteNoise.ar, [73,81].midicps, 1e-4, Env.sine(10,50).kr(2)).sum!2}.play; gauss (7,0.2).wait;\n {BPF.ar (WhiteNoise.ar, [71,80].midicps, 1e-4, Env.sine(10).kr(2)).sum!2*50}.play; gauss (7,0.2).wait;\n {BPF.ar (WhiteNoise.ar, [69,78].midicps, 1e-4, Env.sine(10).kr(2)).sum!2*50}.play; gauss (7,0.2).wait;\n {BPF.ar (WhiteNoise.ar, [68,80].midicps, 1e-4, Env.sine(10).kr(2)).sum!2*50}.play; gauss (7,0.2).wait;\n}\n}.fork\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Midterm Q2 (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"sawSynth\",{arg freq, amp;\n var env, snd;\n\n env = Env.perc(\n attackTime:0.1,\n releaseTime:2,\n level:amp).kr(doneAction: 2);\n snd = Saw.ar(\n freq:freq*[0.99, 1.0, 1.001, 1.008],\n mul: env);\n snd = LPF.ar(in: snd,freq:2000);\n snd = Splay.ar(snd);\n Out.ar(0,snd);\n\n}).add;\n);\n\n(\nPbind(\n \\instrument, \"sawSynth\",\n \\freq, Pwhite(300, 700, inf),\n \\amp, Pwhite(0.15, 0.2)\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// if \\degree, \\note or \\midinote are occuring after \\dur,\n// a frequency value will be calculated according to Event's usual conversion framework\n// and used for setting the arg 'freq'.\n\n(\np = PmonoPar([\n [\n \\dur, 1.0,\n \\pan, Pser([-0.9, 0, 0.9], 8) \n ],[\n \\dur, 0.4,\n \\midinote, Pseq((70..75), 7)\n ],[\n \\dur, 0.2,\n \\amp, Pseq([0.05, 0.3], 30) \n ]\n]).trace.play;\n)\n```"}, {"role": "assistant", "content": "if \\degree, \\note or \\midinote are occuring after \\dur, a frequency value will be calculated according to Event's usual conversion framework (PmonoPar: monophonic event pattern for an arbitrary number of timed setting streams)"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\nPdef(\\x).play;\nPdef(\\x).quant = 0; // we don't want quant here.\nPdef(\\x, Pbind(\\degree, Pseq((0..5), inf), \\dur, 0.3)).condition_({ |val, i| i.postln % 6 == 0 });\nPdef(\\x, Pbind(\\degree, Pseq((0..7) + 5.rand, inf), \\dur, 0.3)).condition_({ |val, i| (i % 8).postln == 0 });\n\n// the above is equivalent to:\nPdef(\\x, Pbind(\\degree, Pseq((0..7) + 5.rand, inf), \\dur, 0.3)).count(8);\n\n// the value that is sent in is the event, so decisions can be made dependent on the event's fields\n```"}, {"role": "assistant", "content": "the above is equivalent to: the value that is sent in is the event, so decisions can be made dependent on the event's fields (Pdef: stream reference definition)"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = PbindProxy(note: Pseq([0, 7, 9]), dur: 0.2.play;\na.stop;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = PbindProxy(note: Pseq([0, 7, 9]), dur: 0.2).play;\na.stop;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `ServerOptions.threadPinning` do?"}, {"role": "assistant", "content": "Enable/disable thread pinning. For scsynth this value is ignored. Thread pinning forces each thread to only run on a particular CPU core. Depending on the system, this might give better or worse performance. Default is `nil` which means that the value is chosen by Supernova. (At the time of writing, it is by default enabled on Linux and disabled on macOS and"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for little study on piano improvisation."}, {"role": "assistant", "content": "```supercollider\n/* Piano Gestures: A Little Study by mimetik\n\n This is a little study on piano improvisation, in particular on \"gestures\", by which I mean here little improvised phrasings.\n\n*/\n\nMIDIClient.init;\n\n/*\nChoose from the list of devices your internal MIDI router, so to send the notes to piano intrument in your favourite DAW\n*/\n\n~mOut = MIDIOut.new(3);\n\n//Set the scale to be Cmajor\n~scale=[0,2,4,5,7,9,11];\n\n//Define pattern proxies which will be modified by the task t below\n\na=PatternProxy(Pxrand([3,3,3,1,3,3],inf));\nb=PatternProxy(Pseq([1/2],inf));\nr=PatternProxy(Pseq([12],inf));\nn=Prand([4,8,16],inf).asStream;\n\nt=Task({\nPdef(\\x,Pbind(\\type,\\midi,\\chan,0,\n \\midiout,~mOut,\n \\scale,~scale,\n \\root,-12,\n \\degree,Pxrand([[0,3,5],[3,5,7],[4,6,8],[5,7,11]],inf),\n \\legato,1,\n \\amp,[{rrand(0.6,0.8)},{rrand(0.5,0.6)},{rrand(0.5,0.6)}]*0.7, \\dur,Prand([Pseq([1,1,1,1],1),Pseq([1,1,2],1),Pseq([1,2,1],1)],inf))).play(quant:1);\n\nPdef(\\y,Pbind(\\type,\\midi,\\chan,0,\n \\midiout,~mOut,\n \\scale,~scale,\n \\root,r,\n \\degree,a,\n \\legato,1,\n \\amp,{rrand(0.5,0.6)},\n\\dur,b)).play(quant:1);\n\n10.wait;\n\nt=Task({\n inf.do({\n if (0.7.coin,{ \n c=[[3,0,7,1,9,11,0,4],[[3,7],0,7,Rest,9,[0,11],0,4]].choose.scramble;\n r.source=Pseq([[12,24].wchoose([0.7,0.3])],inf);\n d=n.next;\n a.source=Pseq([Pxrand(c,d),Pxrand([3,3,3,1,3,3],inf)]);\n b.source=Pseq([Pseq([1/8],d),Pseq([1/2],inf)]);\n });\n rrand(3,4).wait;})}).play(quant:1);\n };\n).play(quant:1);\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\nb = Buffer.alloc(s, 512, 1);\nb.sine2([1.0, 3], [1, 0.5]);\nx = { Osc.ar(b, 200, 0, 0.5) }.play;\n;\nx.free; b.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\nb = Buffer.alloc(s, 512, 1);\nb.sine2([1.0, 3], [1, 0.5]);\nx = { Osc.ar(b, 200, 0, 0.5) }.play;\n);\nx.free; b.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n~constructPseudoMethods = { |envir|\n var newEnvir = envir.collect { |value|\n var argNames, argBlock, namesBlock, code, func;\n if(value.isKindOf(Function)) {\n func = value;\n argNames = func.def.argumentString(withDefaultValues: true);\n namesBlock = func.def.argumentString(withDefaultValues: false);\n argBlock = if(argNames.notNil) { \"|self, \" ++ argNames ++ \"|\" };\n code = \"{ |func, envir| { % envir.use { func.value(%) } } }\".format(argBlock ? \"\", namesBlock ? \"\");\n //code.postln;\n code.interpret.value(func, envir)\n } {\n value\n }\n };\n newEnvir.know = true; // we want a prototype object style environment\n};\n```"}, {"role": "assistant", "content": "/*\r\nI often like to write out a library as an environment, like:\r\n\r\n~start_sound = { |freq, amp| <...> };\r\n~start_high_pitch_sound = { |amp| ~start_sound.(14000, amp) };\r\n\r\n… and then use loadRelative to load that library.\r\n\r\nThis, however has the problem that you can't stick the whole library into an environment that you call from the outside. e.g.\r\n\r\nq = ();\r\nq.use { resolveRelative(\"/library.sc."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for IP detector."}, {"role": "assistant", "content": "```supercollider\n// The following strings are to avoid listing network bridges which seem to be created by Parallels Desktop:\n// | grep -Fv \"inet 10.\" \n\n(\n~getLocalIPs = {\n var winCMD, macCMD, linCMD, ips;\n \n winCMD = {\n \"ipconfig | findstr /C:IPv4\"\n .unixCmdGetStdOut\n .replace(\" IPv4 Address. . . . . . . . . . . : \", \"\");\n };\n \n macCMD = {\n (\"ifconfig | grep -Fv\" + \"inet 10.\"\n .quote + \"| grep\" + \"inet \"\n .quote + \"| grep -Fv 127.0.0.1 | awk '{print $2}'\"\n ).unixCmdGetStdOut;\n };\n \n linCMD = {\n (\"ip address | grep \\\"inet \\\" | grep -Fv 127.0.0.1 | awk '{print $2}' | cut -d '/' -f1\")\n .unixCmdGetStdOut;\n };\n //linCMD = { (\n // \"ifconfig | grep\" + \"inet \".quote +\n // \"| grep -Fv 127.0.0.1 | awk '{print $2}'\" \n //).unixCmdGetStdOut };\n \n ips = Platform.case(\n \\osx, { macCMD.() },\n \\linux, { linCMD.() },\n \\windows, { winCMD.() }\n );\n \n ips = ips.split(Char.nl);\n ips.removeAt(ips.size-1);\n ips\n}\n);\n\n~getLocalIPs.()\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\HOABinaural;\n~description = \"Binaural decoder using the HOABinaural class from SC-HOA\";\n\n~function = { |in = 0, order|\n HOABinaural.ar(\n order: order,\n in: in\n );\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// \\b should thus take twice the value of \\a in each event:\np = Pbind(\\a, Pwhite(1, 10, inf), \\b, Pkey(\\a) * 2).asStream;\n\n\np.next(()) // for Pbind, must pass in a default event even if empty\n\n('a': 10, 'b': 20)\n('a': 2, 'b': 4)\n('a': 5, 'b': 10)\n('a': 4, 'b': 8)\n('a': 2, 'b': 4)\n\n// note: to check if a Pkey's result /equals/ another value,\n// be sure to use |==|\np = Pbind(\n \\a, Pseries(1, 1, inf),\n \\b, Pif(\n Pkey(\\a) == 2,\n \"equals 2\",\n \"nope\"\n )\n).asStream;\n\np.next(());\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// \\b should thus take twice the value of \\a in each event:\np = Pbind(\\a, Pwhite(1, 10, inf), \\b, Pkey(\\a) * 2).asStream;\n\n\np.next(()) // for Pbind, must pass in a default event even if empty\n\n('a': 10, 'b': 20)\n('a': 2, 'b': 4)\n('a': 5, 'b': 10)\n('a': 4, 'b': 8)\n('a': 2, 'b': 4)\n\n// note: to check if a Pkey's result /equals/ another value,\n// be sure to use |==|\np = Pbind(\n \\a, Pseries(1, 1, inf),\n \\b, Pif(\n Pkey(\\a) == 2,\n \"equals 2\",\n \"nope\"\n )\n).asStream;\n\np.next(()); // 'b' is always \"nope\"\n\np = Pbind(\n \\a, Pseries(1, 1, inf),\n \\b, Pif(\n Pkey(\\a) |==| 2,\n \"equals 2\",\n \"nope\"\n )\n).asStream;\n\np.next(()); // 'b' is as expected\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes song of forest."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\sound, {\n arg i_bus = 0, amp = 0.1, freq = 440, sustain = 1, pan = 0;\n var env, osc, out;\n env = EnvGen.kr(Env.perc(0.01, sustain, amp),doneAction:2);\n osc = SinOsc.ar([freq, freq * 1.005, freq * 0.995], mul:env);\n out = Pan2.ar(osc, pan);\n Out.ar(i_bus, out);\n}).send(s);\n);\n\n(\n~amp = 0.1;\na = Pdef(\\a,\n Pbind(\n \\instrument, \\sound,\n \\amp, ~amp * 1.5,\n \\degree, Pseq([2, 4, 5, 6, 1] - 1, inf),\n \\dur, Pseq([1, 1, 1, 1, 2] / 4, inf)\n )\n).quant_([3, 0, 0, 1]);\n\nb = Pdef(\\b,\n Pbind(\n \\instrument, \\sound,\n \\amp, ~amp,\n \\degree, Pseq([8, 6, 5, 3, 4, 6] - 1, inf),\n \\dur, Pseq([1, 1, 1, 1, 1, 1] / 4, inf)\n )\n).quant_([3, 0, 0, 1]);\n\nc = Pdef(\\c,\n Pbind(\n \\instrument, \\sound,\n \\amp, ~amp * 0.6,\n \\degree, Pseq([1, 6, 8, 6, Pwrand([11,13], [2, 1].normalizeSum)] - 1, inf),\n \\amp, Pseq([0, 1, 1, 1, 1] / 10, inf),\n \\dur, Pseq([8, 1, 1, 1, 1] / 8, inf),\n \\sustain, 0.1\n )\n).quant_([3, 0, 0, 1]);\n);\n\n(\nSystemClock.sched(0, Routine({\n a.play; 12.yield;\n b.play; 12.yield;\n c.play; 12.yield;\n c.pause; 6.yield;\n a.pause; 6.yield;\n\n b.pause; a.play; 12.yield;\n b.play; 12.yield;\n c.play; 12.yield;\n c.pause; a.pause; 6.yield;\n b.pause; 6.yield;\n}));\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for first step?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n\nz = ( ( SinOsc.ar( ((LFSaw.kr(-0.05,1) +1) *100 + 20 ), LFTri.kr(40,0,1), LFSaw.kr(1.5) ) \n * LFTri.kr(rrand(0.005,0.03),3.99.rand,0.2) ) + \n( LFPulse.ar(60,0,0.5,Pulse.ar(0.5,0.5,0.1)) * LFTri.kr(rrand(0.005,0.03),3.99.rand,0.5) ) +\n( SinOsc.ar(65,0,LFPulse.kr(0.66666,0.5,0.3)*0.3) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) )+\n( LFPar.ar(120,0,LFPulse.kr(0.5,0.5,0.2)*0.3) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( LFCub.ar(185,0,LFPulse.kr(0.5,0.74,0.2)*0.3) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( SinOsc.ar(365,0,LFPulse.kr(1.33333333,0,0.1)*0.3) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( FreeVerb.ar(LFTri.ar(260,0,LFPulse.kr(0.5,0.25,0.01)*0.3),0.5,0.8,0.1) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( SinOsc.ar(800,0,LFPulse.kr(2,0,0.1)*0.1) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( LFPar.ar(820,0,LFPulse.kr(1.666666,0,0.1)*0.1) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( WhiteNoise.ar( LFPulse.kr(2,0.5,0.001,1) )/2 * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( WhiteNoise.ar( LFPulse.kr(1,0.5,0.001,1) )/2 * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( WhiteNoise.ar( LFPulse.kr(1.666666,0.5,0.001,1) )/4 * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( WhiteNoise.ar( LFPulse.kr(1.333333,0.5,0.001,1) )/4 * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) );\n\nFreeVerb.ar(\n ((CombC.ar(\n DelayN.ar(\n DelayN.ar(z, 0.5, [0.5,0.75], 1, z), \n 0.5, 0.5, 1, z), \n 0.1, LFNoise0.kr(1,0.05,0.001).abs, 2, z))+z),\n0.1,1,0.1); \n\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `MxOutletApp.spec` do?"}, {"role": "assistant", "content": "Spec of the outlet as defined in the objects driver file in Returns: a Spec subclass"}]} -{"conversations": [{"role": "user", "content": "What does `IrNumberEditor.instrArgFromControl` do? What arguments does it take?"}, {"role": "assistant", "content": "a number box and slider for editing a float value [\\ir rate] Arguments: control."}]} -{"conversations": [{"role": "user", "content": "What does `LFDClipNoise.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Dynamic clipped noise Arguments: freq — Approximate rate at which to generate random values.; mul — Output will be multiplied by this value.; add — This value will be added to the output.."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `GbmanN`."}, {"role": "assistant", "content": "```supercollider\n// default initial params\n{ GbmanN.ar(MouseX.kr(20, SampleRate.ir)) * 0.1 }.play(s);\n\n// change initial params\n{ GbmanN.ar(MouseX.kr(20, SampleRate.ir), -0.7, -2.7) * 0.1 }.play(s);\n\n// wait for it...\n{ GbmanN.ar(MouseX.kr(20, SampleRate.ir), 1.2, 2.0002) * 0.1 }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(GbmanN.ar(40)*400+500)*0.4 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// increase phase multiplier\n{ FBSineL.ar(SampleRate.ir, 1, 0, XLine.kr(1, 2, 10), 0.1) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// increase phase multiplier\n{ FBSineL.ar(SampleRate.ir, 1, 0, XLine.kr(1, 2, 10), 0.1) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `GridLayout.minRowHeight` do? What arguments does it take?"}, {"role": "assistant", "content": "Gets the minimum height assigned to a Arguments: row — The index of a row.."}]} +{"conversations": [{"role": "user", "content": "What is `Int32Array` in SuperCollider?"}, {"role": "assistant", "content": "Int32Array — an array whose indexed slots are all of the same type These classes implement arrays whose indexed slots are all of the same type. Category: Collections > Ordered."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n( //testing RecCutProc\nvar sf;\nvar rcdat;\n\nRoutine.run({\n\nsf= BBCutBuffer(Platform.resourceDir +/+ \"sounds/break.aiff\",8);\n\ns.sync;\n\n//argument 1-cut positions, 16 is wraparound, necessary for calculating differences\n//arg 2- offsets at any given of the 16 quantised positions along the sample length\n//arg 3- but cut up choosing blocks of size 3, 4, etc units (units must total 16 here)\n//units are taken across phraselength, so with phrase 8.0, one unit= 8.0/16= 0.5 = eighth notes\nrcdat= RCutData.new([0,4,7,10,12,15,16],[0\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n( //testing RecCutProc\nvar sf;\nvar rcdat;\n\nRoutine.run({\n\nsf= BBCutBuffer(Platform.resourceDir +/+ \"sounds/break.aiff\",8);\n\ns.sync;\n\n//argument 1-cut positions, 16 is wraparound, necessary for calculating differences\n//arg 2- offsets at any given of the 16 quantised positions along the sample length\n//arg 3- but cut up choosing blocks of size 3, 4, etc units (units must total 16 here)\n//units are taken across phraselength, so with phrase 8.0, one unit= 8.0/16= 0.5 = eighth notes\nrcdat= RCutData.new([0,4,7,10,12,15,16],[0,1,2,3, 4,5,6, 3,4,5, 8,9, 7,8,10, 10],[3,4,1,5,3]);\n\nBBCut2([CutBuf1(sf),CutMixer(0,1.0,1.0,panfunc:{0.7.rand2})],RecCutProc.new(rcdat,8.0)).play(2.3);\n\n});\n\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `PlayerSocket.fuseBlown` do?"}, {"role": "assistant", "content": "a player that can play other players using a cross-faded and fuse-protected socket"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n//Chaos engine hum\n(\n{\n SinOsc.ar(10 + (50 * SinOsc.kr([50, 51], 0, SinOsc.kr(101, Saw.kr(0.12345, 678, 9), 0.2, 0.8), Pulse.kr([25, 25.5], 0.25, 0.125, -0.25))), 0, 0.5, 0);\n}.play();\n)\n```"}, {"role": "assistant", "content": "A deep binaural cycle reminiscent of the engine of a space ship."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n// p = ProxySpace.push(s.boot);\n\nl = NodeProxyEditor(nil, 3); l.w.bounds_(l.w.bounds.moveBy(0, 120));\nm = NodeProxyEditor(nil, 3); m.w.bounds_(m.w.bounds.moveBy(0, 240));\nn = NodeProxyEditor(nil, 3); n.w.bounds_(n.w.bounds.moveBy(0, 360));\no = NodeProxyEditor(nil, 3); o.w.bounds_(o.w.bounds.moveBy(0, 480));\n\nSpec.add(\\dens, [0.1, 300, \\exp]);\n\n // make 3 kinds of proxies: using tilde/pro\n// …\n```"}, {"role": "assistant", "content": "p = ProxySpace.push(s.boot); make 3 kinds of proxies: using tilde/proxyspace, Ndef, and unnamed. (NodeProxyEditor: editor for a nodeproxy - replaced by NdefGui!)"}]} +{"conversations": [{"role": "user", "content": "What are the arguments of EnvGen?"}, {"role": "assistant", "content": "`EnvGen.ar(envelope, gate, levelScale, levelBias, timeScale, doneAction)` — or the .kr form. Envelope is an Env; gate is the signal that holds the envelope open (a number for a one-shot, a trigger or gate control for a sustained sound); levelScale and levelBias scale and offset the output; timeScale stretches durations. Use `doneAction: 2` on a one-shot so the Synth frees itself."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// one last example\n(\nb = Buffer.alloc(s, 512, 1);\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, true, true);\n);\n\n(\n{\n var input = SoundIn.ar(0);\n var framesize = 512;\n Convolution2L.ar(input, b, 0, framesize, 1, 0.5);\n}.play\n;\n\nb.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// one last example\n(\nb = Buffer.alloc(s, 512, 1);\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, true, true);\n);\n\n(\n{\n var input = SoundIn.ar(0);\n var framesize = 512;\n Convolution2L.ar(input, b, 0, framesize, 1, 0.5);\n}.play\n);\n\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Latoocarfian2DL.ar(MouseX.kr(20, SampleRate.ir * 0.5), MouseX.kr(40, SampleRate.ir), mul:0.2) }.play(s);\n\n\n(\n{ Latoocarfian2DL.ar(\n SampleRate.ir/4,\n SampleRate.ir,\n LFNoise2.kr(2.dup, 1.5, 1.5),\n d:LFNoise2.kr(2.dup, 0.5, 1.5),\n mul:0.2\n) }.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Latoocarfian2DL.ar(MouseX.kr(20, SampleRate.ir * 0.5), MouseX.kr(40, SampleRate.ir), mul:0.2) }.play(s);\n\n\n(\n{ Latoocarfian2DL.ar(\n SampleRate.ir/4,\n SampleRate.ir,\n LFNoise2.kr(2.dup, 1.5, 1.5),\n d:LFNoise2.kr(2.dup, 0.5, 1.5),\n mul:0.2\n) }.play(s);\n)\n```"}]} {"conversations": [{"role": "user", "content": "Show another SuperCollider example using `QuadL`."}, {"role": "assistant", "content": "```supercollider\n// logistic map\n// equation: x1 = -r*x0^2 + r*x0\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n QuadL.ar(SampleRate.ir/4, r.neg, r, 0, 0.1) * 0.4;\n}.play(s);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `View.minimize` do?"}, {"role": "assistant", "content": "If the view is a window, hides it (only keep it present in the"}]} -{"conversations": [{"role": "user", "content": "What is `PLbindef`?"}, {"role": "assistant", "content": "PLbindef — wrapper for Pbindef which allows replacement in object prototyping style"}, {"role": "user", "content": "What does `PLbindef.new` do?"}, {"role": "assistant", "content": "Creates a new PLbindef object or sets sources as with Pbindef."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n// synthdefs to play with\n\n(\nSynthDef(\\noise_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, rq = 0.1, amp = 0.1|\n var sig = { WhiteNoise.ar } ! 2;\n sig = BPF.ar(sig, freq, rq) *\n EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2) *\n (rq ** -1) * (250 / (freq ** 0.8));\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\sin_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { SinOsc.ar(freq, Rand(0, 2pi)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\saw_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { VarSaw.ar(freq, Rand(0, 1)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for rough sketch of chicago minor chord pad thing."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\\ChicagoPad, { |out = 0, freq = 440, cutoff = 500, amp = 0.2|\n var snd;\n freq = freq + SinOsc.kr(0.1, 0, 1, 20);\n snd = Saw.ar([freq, freq+1, freq-1, freq*3/2, freq*6/5])*0.1;\n snd = snd + VarSaw.ar(0.99*[freq, freq+1, freq-1,freq*3/2, freq*6/5],0, LFTri.kr(0.3).range(0.25,0.9))*0.1;\n snd = Mix(snd);\n snd = RLPF.ar(snd, SinOsc.kr(0.1, 0, 100, 5000), 0.1);\n snd = GVerb.ar(snd ,40, 10, 0.6, 0.6, -3, -9, -11)*0.2;\n \n //snd = RLPF.ar(snd, SinOsc.kr(0.08, 0.5, cutoff/10, cutoff), 0.2);\n snd = MoogFF.ar(snd, SinOsc.kr(0.08, 0.5, cutoff/10, cutoff), 3, 0);\n snd = DelayC.ar(snd, 1.5, 1,0.8);\n //snd = snd * EnvGen.ar(Env.linen(0.001, 0.01,0.01,1), doneAction:2);\n Out.ar(out, [snd, AllpassC.ar(snd, 0.5, 0.05, 0.3)]*amp);\n}).send;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `ControlRate` in SuperCollider briefly."}, {"role": "assistant", "content": "ControlRate — Server control rate. Get the current control rate of the server. Category: UGens > Info."}]} -{"conversations": [{"role": "user", "content": "Explain `FoaXform` in SuperCollider briefly."}, {"role": "assistant", "content": "FoaXform — First Order Ambisonic (FOA) matrix transformer Transforms (spatial domain filter) a First Order Ambisonic signal (B-format). FoaXform provides static initial rate transforms, for continuously varying dynamic transforms transforms see FoaTransform. Category: Libraries > Ambisonic Toolkit > UGens > FOA > Transformer, UGens > Multichannel > Ambisonics."}]} -{"conversations": [{"role": "user", "content": "Write a random pentatonic melody that plays by itself."}, {"role": "assistant", "content": "Pick degrees from a pentatonic scale; `\\scale` and `\\root` define the pitch space, and `\\degree`\npicks within it.\n\n```supercollider\n(\nPbind(\n \\instrument, \\default,\n \\scale, Scale.minorPentatonic,\n \\root, 3,\n \\degree, Pwhite(0, 9, inf),\n \\octave, 5,\n \\dur, Pwhite(0.12, 0.28, inf),\n \\amp, 0.2,\n \\legato, 0.8\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Runs every 2 seconds\nAppClock.play({ \"And again\".postln; 2 };\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Runs every 2 seconds\nAppClock.play({ \"And again\".postln; 2 });\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Mx.bpm` do?"}, {"role": "assistant", "content": "The bpm that the Mx should play at. This sets the global Tempo when play starts and is saved with the Mx Returns: float. beats per minute"}]} +{"conversations": [{"role": "user", "content": "What does `HilbertH.calcRealCoeffs` do? What arguments does it take?"}, {"role": "assistant", "content": "Generate real Arguments: size — The size of the kernel used for Hartley Phasing filtering.."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n~resize_enveloppe = { | levels, times |\n var reverted_levels, index;\n index = 0;\n reverted_levels = levels.reverse;\n while( { reverted_levels[index] == 0 && reverted_levels[index+1] == 0 }, { times[ times.size - 1 - index] = 0.01; index = index + 1 } );\n};\n)\n```"}, {"role": "assistant", "content": "Enveloppes sizes are fixed. This means that if enveloppe's levels are equals to [ 1, 0, 0, 0, 0, 0, 0, 0 ] and times are equals to [ 1, 1, 1, 1, 1, 1, 1, 1 ], the synth UGens will take resources 8 seconds but will only be audible 1 second. To avoid this, passing both the levels and the times to this function will detect when the sound stops playing and will reduce the \"silence\" times to 0.01s, thu."}]} {"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// put can be used with the array indexing syntax:\na = NodeProxy.new.play;\na[0] = { SinOsc.ar(Rand(200, 899)) * 0.1.dup };\na[2] = { SinOsc.ar(Rand(200, 899)) * 0.1.dup };\na.sources.do(_.postcs);\n// using multiple index expands into multiple objects\na[0..5] = { SinOsc.ar(Rand(200, 899)) * 0.1.dup };\na.sources.do(_.postcs);\na.send; // exchange synths, using the sources as definitions\na.clear;\n```"}, {"role": "assistant", "content": "put can be used with the array indexing syntax: using multiple index expands into multiple objects (NodeProxy: a reference on a server)"}]} -{"conversations": [{"role": "user", "content": "What does `Harmonics.formant` do?"}, {"role": "assistant", "content": "Create a formant like structure. `a.formant(6,"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Just an exploration with Substractive synthesis?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n\n 2.do{\n {BPF.ar (WhiteNoise.ar, [73,81].midicps, 1e-4, Env.sine(10,50).kr(2)).sum!2}.play; gauss (7,0.2).wait;\n {BPF.ar (WhiteNoise.ar, [71,80].midicps, 1e-4, Env.sine(10).kr(2)).sum!2*50}.play; gauss (7,0.2).wait;\n {BPF.ar (WhiteNoise.ar, [69,78].midicps, 1e-4, Env.sine(10).kr(2)).sum!2*50}.play; gauss (7,0.2).wait;\n {BPF.ar (WhiteNoise.ar, [68,80].midicps, 1e-4, Env.sine(10).kr(2)).sum!2*50}.play; gauss (7,0.2).wait;\n}\n}.fork\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n Ramp.kr( // lag the modulator\n LFPulse.kr(4, 0, 0.5, 50, 400), // frequency modulator\n Line.kr(0, 1, 15) // modulate lag time\n ),\n 0, // phase\n 0.3 // sine amplitude\n )\n}.scope;\n);\n\n// Compare\n(\nvar pulse;\n{\n pulse = LFPulse.kr(8.772);\n Out.kr(0, [Ramp.kr(pulse, 0.025), Lag.kr(pulse, 0.025), pulse]);\n}.play;\ns.scope(3, bufsize: 4\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n Ramp.kr( // lag the modulator\n LFPulse.kr(4, 0, 0.5, 50, 400), // frequency modulator\n Line.kr(0, 1, 15) // modulate lag time\n ),\n 0, // phase\n 0.3 // sine amplitude\n )\n}.scope;\n);\n\n// Compare\n(\nvar pulse;\n{\n pulse = LFPulse.kr(8.772);\n Out.kr(0, [Ramp.kr(pulse, 0.025), Lag.kr(pulse, 0.025), pulse]);\n}.play;\ns.scope(3, bufsize: 44100, rate: \\control, zoom: 40);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nb = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n\n// This is very cool!\n\n(\n{\n Spring.ar(PlayBuf.ar(1, b, loop: 1)*Saw.ar(4));\n}.play;\n)\n```"}, {"role": "assistant", "content": "Feeding sound file multiplied by a slow saw wave into the spring physical model. Fascinating results ensue."}]} -{"conversations": [{"role": "user", "content": "What does `Boolean.asInteger` do?"}, {"role": "assistant", "content": "abstract class whose instances represent a logical value"}]} -{"conversations": [{"role": "user", "content": "Explain `MovingAverage` in SuperCollider briefly."}, {"role": "assistant", "content": "MovingAverage — The average of samples over a variable number of frames. A running average, power or RMS over a variable number of samples. For a running sum (not averaged) see MovingSum. Category: UGens > Analysis, UGens > Maths."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{LPCError.ar(AudioIn.ar, MouseX.kr(1,64))}.play\n\n{LPCError.ar(SinOsc.ar(LFNoise0.kr(0.2,400,500)), MouseX.kr(1,64))}.play\n\n{LPCError.ar(Resonz.ar(Mix(Saw.ar(100*[1,0.9,0.8,0.7,0.5])),1000,0.1,2), MouseX.kr(1,64)}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{LPCError.ar(AudioIn.ar, MouseX.kr(1,64))}.play\n\n{LPCError.ar(SinOsc.ar(LFNoise0.kr(0.2,400,500)), MouseX.kr(1,64))}.play\n\n{LPCError.ar(Resonz.ar(Mix(Saw.ar(100*[1,0.9,0.8,0.7,0.5])),1000,0.1,2), MouseX.kr(1,64))}.play\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `OscN` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// compare examples below with interpolating Osc examples.\n\n(\ns = Server.local;\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, false, true);\nb = Buffer.alloc(s, 512, 1);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum, 500, 0, 0.5)\n )\n}).play(s, [0, 0, 1, b.bufnum]);\n\n);\nb.free;\n\n\n\n(\n// noninterpolating - there are noticeable artifacts\n// modulate freq\n\ns = Server.local;\nb.sine1(1.0/[1, 2, 3, 4, 5, 6].squared, true, false, true);\nb = Buffer.alloc(s, 512, 1);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum, XLine.kr(2000, 200), 0, 0.5)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n\n);\nb.free;\n\n(\n// sounds very different than the Osc example\ns = Server.local;\nb = Buffer.alloc(s, 512, 1);\nb.sine1([1.0], true, true, true);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum,\n OscN.ar(bufnum,\n XLine.kr(1, 1000, 9),\n 0,\n 200,\n 800),\n 0,\n 0.25)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n\n);\nb.free;\n\n(\n// modulate phase\ns = Server.local;\nb = Buffer.alloc(s, 512, 1);\nb.sine1([1.0], true, true, true);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum,\n 800,\n OscN.ar(bufnum,\n XLine.kr(20, 8000, 10),\n 0,\n 2pi),\n 0.25)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n);\nb.free;\n\n\n(\n// change the buffer while its playing\ns = Server.local;\nb = Buffer.alloc(s, 4096, 1);\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, true, true);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum, [80, 80.2], 0, 0.2)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n);\n\n(\nRoutine({\n var n = 32;\n 50.do({\n b.sine1(Array.rand(n, 0, 1).cubed, true, true, true);\n 0.25.wait;\n });\n}).play;\n);\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `ScoreClock.beginScore` do?"}, {"role": "assistant", "content": "Start capturing. This must be called once before the code that you want to"}]} +{"conversations": [{"role": "user", "content": "What does `FancySlider.knobColor` do?"}, {"role": "assistant", "content": "An efficient Slider which substitutes a user view for a slider"}]} +{"conversations": [{"role": "user", "content": "Write a filter sweep over a saw."}, {"role": "assistant", "content": "An LFO on the cutoff of a resonant low-pass; XLine or an LFO both work, the LFO is the loopable one.\n\n```supercollider\n{ LPF.ar(Saw.ar([60, 60.2]), SinOsc.kr(0.2).exprange(150, 4000), 0.4) * 0.2 }.play;\n```\n\n`.exprange` is the exponential mapping you want for frequency; a linear `.range` sweep sounds uneven."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Lag2`."}, {"role": "assistant", "content": "```supercollider\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n Lag2.kr( // lag the modulator\n LFPulse.kr(4, 0, 0.5, 50, 400), // frequency modulator\n Line.kr(0, 1, 15) // modulate lag time\n ),\n 0, // phase\n 0.3 // sine amplitude\n )\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Pen.translate` do?"}, {"role": "assistant", "content": "Translate the coordinate system to have its origin moved by"}]} +{"conversations": [{"role": "user", "content": "What is `IFFT` in SuperCollider?"}, {"role": "assistant", "content": "IFFT — Inverse Fast Fourier Transform The inverse fast fourier transform converts from frequency content to a signal. Category: UGens > FFT."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `VarGui`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// synth definition with raising frequency\n\n(\nSynthDef(\\synth_0, { |devFactor = 0.1, devFreq = 10, amp = 0.1|\n var freq = XLine.kr(400, 1200, 10); \n Out.ar(0, SinOsc.ar(SinOsc.ar(devFreq, 0, devFactor * freq, freq), mul: amp).dup(2) * EnvGate.new) \n}).add;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PanB2`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var w, x, y, p, a, b, c, d;\n\n p = PinkNoise.ar; // source\n\n // B-format encode\n #w, x, y = PanB2.ar(p, MouseX.kr(-1, 1), 0.1);\n\n // B-format decode to quad\n #a, b, c, d = DecodeB2.ar(4, w, x, y);\n\n [a, b, d, c] // reorder to my speaker arrangement: Lf Rf Lr Rr\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// poor man's panning\n{\n var f, hornbostelwertheimerkonstante;\n f = MouseY.kr(1, 100, 1);\n hornbostelwertheimerkonstante = 0.00063;\n Impulse.ar(f, hornbostelwertheimerkonstante * f * [1, MouseX.kr(0, 2)], 0.1) \n}.play\n```"}, {"role": "assistant", "content": "If you are too poor to afford changing the amplitudes of a stereo signal, just let the channels wait. But the signal frequency is an impasse that is to be valued in itself."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `OscN` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// compare examples below with interpolating Osc examples.\n\n(\ns = Server.local;\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, false, true);\nb = Buffer.alloc(s, 512, 1);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum, 500, 0, 0.5)\n )\n}).play(s, [0, 0, 1, b.bufnum]);\n\n);\nb.free;\n\n\n\n(\n// noninterpolating - there are noticeable artifacts\n// modulate freq\n\ns = Server.local;\nb.sine1(1.0/[1, 2, 3, 4, 5, 6].squared, true, false, true);\nb = Buffer.alloc(s, 512, 1);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum, XLine.kr(2000, 200), 0, 0.5)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n\n);\nb.free;\n\n(\n// sounds very different than the Osc example\ns = Server.local;\nb = Buffer.alloc(s, 512, 1);\nb.sine1([1.0], true, true, true);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum,\n OscN.ar(bufnum,\n XLine.kr(1, 1000, 9),\n 0,\n 200,\n 800),\n 0,\n 0.25)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n\n);\nb.free;\n\n(\n// modulate phase\ns = Server.local;\nb = Buffer.alloc(s, 512, 1);\nb.sine1([1.0], true, true, true);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum,\n 800,\n OscN.ar(bufnum,\n XLine.kr(20, 8000, 10),\n 0,\n 2pi),\n 0.25)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n);\nb.free;\n\n\n(\n// change the buffer while its playing\ns = Server.local;\nb = Buffer.alloc(s, 4096, 1);\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, true, true);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum, [80, 80.2], 0, 0.2)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n);\n\n(\nRoutine({\n var n = 32;\n 50.do({\n b.sine1(Array.rand(n, 0, 1).cubed, true, true, true);\n 0.25.wait;\n });\n}).play;\n);\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `ExpRand` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-ExpRand\", { |out = 0|\n Out.ar(out,\n FSinOsc.ar(\n ExpRand(100.0, 8000.0),\n 0, Line.kr(0.2, 0, 0.01, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n(\nRoutine({\n inf.do({ |i|\n Synth.new(\"help-ExpRand\"); 0.05.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `MethodLabel.classMethod` do? What arguments does it take?"}, {"role": "assistant", "content": "a brown colored button that displays the name of a label and inspects the Method when clicked Arguments: method; layout — the parent view, FlowView or window; minWidth — Label will automatically size itself to fit the name. minWidth specifies a minimum width so that multiple labels will align nicely.. Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "What does `VDiskIn.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Stream in audio from a file, with variable rate Arguments: numChannels — number of channels. Must be a nonzero, positive integer. This is fixed when the SynthDef is compiled so cannot be assigned to a SynthDef argument.; bufnum — buffer number; rate — controls the rate of playback. Values below 4 are probably fine, but the higher the value, the more disk activity there is, and the more likelihood there will be a problem.; loop — If loop is set to 1, the soundfile will loop.; sendID — If a sendID is given, the UGen sends an OSC message with this ID and the frame index relative to the onset of the Synth each time it reloads the buffer: `['/diskin', nodeID, sendID, frame]`. The true frame index into the file is determined by the `startFrame` given when reading the initial buffer's ."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// This question comes up sometimes.\n// one way to do it is to define an event type:\n\n\n(\nEvent.addEventType(\\dnote, { |server|\n \n var instrument = ~instrument.asDefName;\n var synthLib = ~synthLib ?? { SynthDescLib.global };\n var desc = synthLib.at(instrument);\n \n \n if (desc.notNil) {\n desc.controls.do { |x|\n x.defaultValue !? { x.name.asSymbol.envirPut(x.defaultValue) }\n };\n // for efficiency, get this now\n ~hasGate = desc.hasGate;\n ~msgFunc = desc.msgFunc;\n };\n ~type = \\note;\n \n currentEnvironment.play;\n});\n);\n\n(\nSynthDef(\\test, { |out, freq = 1000| \n Out.ar(out, Line.ar(0.1, 0, 0.1, doneAction:2) * SinOsc.ar(freq)) \n}).add\n);\n\nPbind(\\type, \\dnote, \\instrument, \\test, \\dur, 0.3).play;\n```"}, {"role": "assistant", "content": "One answer to the question \"how to use the SynthDef's default argument in an Event?\"."}]} +{"conversations": [{"role": "user", "content": "What is `PLbindef`?"}, {"role": "assistant", "content": "PLbindef — wrapper for Pbindef which allows replacement in object prototyping style"}, {"role": "user", "content": "What does `PLbindef.new` do?"}, {"role": "assistant", "content": "Creates a new PLbindef object or sets sources as with Pbindef."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n// synthdefs to play with\n\n(\nSynthDef(\\noise_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, rq = 0.1, amp = 0.1|\n var sig = { WhiteNoise.ar } ! 2;\n sig = BPF.ar(sig, freq, rq) *\n EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2) *\n (rq ** -1) * (250 / (freq ** 0.8));\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\sin_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { SinOsc.ar(freq, Rand(0, 2pi)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\saw_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { VarSaw.ar(freq, Rand(0, 1)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `AmpCompA` in SuperCollider briefly."}, {"role": "assistant", "content": "AmpCompA — Basic psychoacoustic amplitude compensation (ANSI A-weighting curve). Higher frequencies are normally perceived as louder, which AmpCompA compensates. Following the measurements by Fletcher and Munson, the ANSI standard describes a function for loudness vs. frequency. Category: UGens > Analysis > Amplitude."}]} +{"conversations": [{"role": "user", "content": "I get 'FAILURE IN SERVER /s_new SynthDef not found'. What is wrong?"}, {"role": "assistant", "content": "The server does not know that SynthDef. Three usual causes, in order of likelihood:\n\n1. **The SynthDef was added before the server booted.** `SynthDef(...).add` is asynchronous; wrap the work\n in `s.waitForBoot { ... }` or put `s.sync` after `.add`.\n2. **The name does not match.** `SynthDef(\\bell, ...)` is played by `Synth(\\bell)`, not `\\Bell` — symbols\n are case-sensitive.\n3. **`.add` was never called.** Writing `SynthDef(\\bell, { ... })` without `.add` builds the definition in\n the language and sends nothing.\n\nCheck with `SynthDescLib.global.dict.keys` — if the name is not there, it never reached the server."}]} +{"conversations": [{"role": "user", "content": "What does `NdefMixerOld.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Return a new window for a given server. `// ndef mxers for other Arguments: server — Server object (Server) or server name (Symbol); nProxies — an Integer.; title — a String.; bounds — a Rect.."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LinCongN`."}, {"role": "assistant", "content": "```supercollider\n// randomly modulate params\n(\n{ LinCongN.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(0.1, 0.5, 1.4),\n LFNoise2.kr(0.1, 0.1, 0.1),\n LFNoise2.kr(0.1)\n) * 0.2 }.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `FBSineN`."}, {"role": "assistant", "content": "```supercollider\n// increase feedback\n{ FBSineN.ar(SampleRate.ir, 1, Line.kr(0.01, 4, 10), 1, 0.1) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "How do I use a metronome or check my timing?"}, {"role": "assistant", "content": "A click on the clock you are using, plus a counter to see where you are in the bar:\n\n```supercollider\n(\nTdef(\\click, {\n var count = 0;\n loop {\n (Synth(\\hat, [\\amp, if (count % 4 == 0) { 0.25 } { 0.08 }]));\n count = count + 1;\n 1.wait;\n }\n}).play;\n)\n```\n\nBecause it waits on `TempoClock.default`, it stays in sync with every Pbind you start, which makes it a\ntempo reference rather than a separate sound."}]} +{"conversations": [{"role": "user", "content": "What does `SimpleNumber.quantize` do? What arguments does it take?"}, {"role": "assistant", "content": "Deprecated. Round the receiver to the quantum. If you're looking for MIDI quantization type features use Arguments: quantum — amount.; tolerance — allowed tolerance.; strength — Determines how much the value is allowed to differ in the tolerance range.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// modulate frequency of a sine oscillator\n\n(\nSynthDef(\"help-AnalogIn\", { |out = 0|\n Out.ar(out,\n SinOsc.ar(AnalogIn.ar(0).exprange(200, 5000), 0, 0.1)\n )\n}).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// modulate frequency of a sine oscillator\n\n(\nSynthDef(\"help-AnalogIn\", { |out = 0|\n Out.ar(out,\n SinOsc.ar(AnalogIn.ar(0).exprange(200, 5000), 0, 0.1)\n )\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Node`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n(\nx = SynthDef(\"help-node-set\", { |freq = 440, out = 0|\n Out.ar(out, SinOsc.ar(freq, 0, 0.1))\n}).play\n);\nx.run(false);\nx.run; // default is true\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a granular texture in SuperCollider."}, {"role": "assistant", "content": "Read a sound file into a buffer, then trigger grains from it. Grain density is the Impulse rate and\ngrain length is dur; keep the density times the length under maxGrains or raise it.\n\n```supercollider\n(\ns.waitForBoot {\n ~buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n SynthDef(\\grain, { |out = 0, amp = 0.4, density = 30, dur = 0.08|\n var trig = Impulse.kr(density);\n var sig = GrainBuf.ar(2, trig, dur, ~buf, 1, LFNoise0.kr(2).range(0, 1), 2, 0, -1, 512);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n Synth(\\grain);\n};\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// Very artificial example - just filtering some noise.\ns.boot;\nb = Buffer.alloc(s,2048,1);\n(\nx = {\nvar in, chain, freq, rq, val;\n//freq = LFPar.kr(0.3).exprange(100, 1000);\nfreq = MouseY.kr(1000, 100, 1);\nrq = MouseX.kr(0.001, 10, 1);\nin = BPF.ar(WhiteNoise.ar, freq, rq);\nchain = FFT(b.bufnum, in);\n\nval = FFTSpread.kr(chain);\n\nOut.ar(0, in.dup * 0.1);\n(val * 0.000001).poll(10); // Poll but scaled down so more readable!\n}.play(s);\n);\n// …\n```"}, {"role": "assistant", "content": "Very artificial example - just filtering some noise. freq = LFPar.kr(0.3).exprange(100, 1000); (FFTSpread: Spectral spread)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\\pm, { |out = 0, freq = 440, amp = 0.1, pan = 0, gate = 1, ratio = 1, index = 1, ar = 0.1, dr = 0.1|\n var z;\n z = LPF.ar(\n PMOsc.ar(freq, freq * ratio, Linen.kr(gate, ar, index, dr), 0, 0.3),\n XLine.kr(Rand(4000, 5000), Rand(2500, 3200), 1)\n ) * Linen.kr(gate, 0.01, 0.7, dr, 2);\n OffsetOut.ar(out, Pan2.ar(z, pan, amp));\n}).add;\n);\n\n(instrument: \\pm).play;\n\n(instrument: \\pm, ratio: 3.4\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\\pm, { |out = 0, freq = 440, amp = 0.1, pan = 0, gate = 1, ratio = 1, index = 1, ar = 0.1, dr = 0.1|\n var z;\n z = LPF.ar(\n PMOsc.ar(freq, freq * ratio, Linen.kr(gate, ar, index, dr), 0, 0.3),\n XLine.kr(Rand(4000, 5000), Rand(2500, 3200), 1)\n ) * Linen.kr(gate, 0.01, 0.7, dr, 2);\n OffsetOut.ar(out, Pan2.ar(z, pan, amp));\n}).add;\n);\n\n(instrument: \\pm).play;\n\n(instrument: \\pm, ratio: 3.42, index: 12, freq: 150, ar: 8, dr: 3, sustain: 10).play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `ArrayedCollection.removeAt` do?"}, {"role": "assistant", "content": "Remove and return the item at index, specified as an integer or a float starting from 0, shrinking the size of the ArrayedCollection. `y = [1, 2, 3,"}]} +{"conversations": [{"role": "user", "content": "What does `ScopeView.stop` do?"}, {"role": "assistant", "content": "Tells the ScopeView object to stop plotting. Plotting can be resumed anytime with the #start"}]} +{"conversations": [{"role": "user", "content": "What does `RedDiskInSampler.overlaps` do?"}, {"role": "assistant", "content": "Get or set number of overlaps or voices allowed to play per key at once. The default is 2. You will need to #-prepareForPlay again after setting"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n# x,y,z = RosslerL.ar(MouseX.kr(1, 200));\nPan2.ar(Pulse.ar(x.range(100,1000), y.range(0,1), 0.3), z)\n}.play(s)\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n# x,y,z = RosslerL.ar(MouseX.kr(1, 200));\nPan2.ar(Pulse.ar(x.range(100,1000), y.range(0,1), 0.3), z)\n}.play(s)\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `HilbertWIm` in SuperCollider?"}, {"role": "assistant", "content": "HilbertWIm — Applies the Imaginary part of the Hilbert Transform to an input signal. [1] Offers the Hilbert Transform of an input signal via Weaver's Third Method. footWeaver, Donald. “A Third Method of Generation and Detection of Single-Sideband Signals.” Proceedings of the IRE, vol. 44, no. 12, 1956, pp. 1703–1705. Category: Libraries > Hilbert > Pseudo-UGens, UGens > Filters > Nonlinear."}]} +{"conversations": [{"role": "user", "content": "What does `MxQuery.set` do? What arguments does it take?"}, {"role": "assistant", "content": "jQuery style queries for selecting objects and performing bulk operations on them Arguments: selector; value."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Vibrato`."}, {"role": "assistant", "content": "```supercollider\n// vibrato at 1 Hz, note the use of DC.ar UGen; a constant of 400.0 doesn't work\n{ SinOsc.ar(Vibrato.ar(DC.ar(400.0), 1, 0.02)) }.play\n\n// compare: k-rate freq input can be a constant\n{ SinOsc.ar(Vibrato.kr(400.0, 1, 0.02)) }.play\n\n// control rate and rateVariation\n{ SinOsc.ar(Vibrato.ar(DC.ar(400.0), MouseX.kr(2.0, 100.0), 0.1, 1.0, 1.0, MouseY.kr(0.0, 1.0), 0.1)) }.play\n\n// control depth and depthVariation\n{ SinOsc.ar(Vibrato.ar(DC.ar(400.0), LFNoise1.kr(1, 3, 7), MouseX.kr(0.0, 1.0), 1.0, 1.0, MouseY.kr(0.0, 1.0), 0.1)) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "What does `NodeControl.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Encapsulates in an object a node and an index. Arguments: node — The node to encapsulate; index — The index to encapsulate."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\"help-LinRand\", { |out = 0, minmax = 1|\n Out.ar(out,\n FSinOsc.ar(\n LinRand(200.0, 10000.0, minmax),\n 0, Line.kr(0.2, 0, 0.01, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n// towards hi\n(\nRoutine({\n loop({\n Synth.new(\"help-LinRand\"); 0.04.wait;\n })\n}).play;\n);\n\n// towards lo (doesn't work like that yet)\n(\nRoutine({\n loop({\n Synth.new(\"help-LinRand\", [\\minmax, -1]); 0.04.wait;\n })\n}).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\"help-LinRand\", { |out = 0, minmax = 1|\n Out.ar(out,\n FSinOsc.ar(\n LinRand(200.0, 10000.0, minmax),\n 0, Line.kr(0.2, 0, 0.01, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n// towards hi\n(\nRoutine({\n loop({\n Synth.new(\"help-LinRand\"); 0.04.wait;\n })\n}).play;\n);\n\n// towards lo (doesn't work like that yet)\n(\nRoutine({\n loop({\n Synth.new(\"help-LinRand\", [\\minmax, -1]); 0.04.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// logistic map\n// equation: x1 = -r*x0^2 + r*x0\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n QuadC.ar(SampleRate.ir/4, r.neg, r, 0, 0.1) * 0.4;\n}.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// logistic map\n// equation: x1 = -r*x0^2 + r*x0\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n QuadC.ar(SampleRate.ir/4, r.neg, r, 0, 0.1) * 0.4;\n}.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.quit;\nf = { Group.new(s.defaultGroup); \"Other code can be evaluated too\".postln };\nServerTree.add(f);\ns.boot;\ns.queryAllNodes; // note the group within the default group\nServerTree.remove(f;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.quit;\nf = { Group.new(s.defaultGroup); \"Other code can be evaluated too\".postln };\nServerTree.add(f);\ns.boot;\ns.queryAllNodes; // note the group within the default group\nServerTree.remove(f);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DetectSilence`."}, {"role": "assistant", "content": "```supercollider\n// this frees after the Decay has become quiet enough for a long enough time\n{ var signal = Decay.ar(Impulse.ar(0), 2, PinkNoise.ar(0.2)); DetectSilence.ar(signal, doneAction: Done.freeSelf); signal }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `UnaryOpUGen` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\na = WhiteNoise.ar; // a WhiteNoise\nb = a.squared; // a UnaryOpUGen.\nb.operator; // squared\n\n// sound example\n\n{ var a = LFSaw.ar(300).range(0, 2pi); a.sin * 0.1 }.play;\n\n// Plotting the \"abs\" unary operator (via the server):\n\n{ SinOsc.ar(300).abs }.plot\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Duty`."}, {"role": "assistant", "content": "```supercollider\n(\n {\n var freq;\n freq = Duty.kr(\n Drand([0.01, 0.2, 0.4], inf), // demand ugen as durations\n 0,\n Dseq([204, 400, 201, 502, 300, 200], inf)\n );\n SinOsc.ar(freq * [1, 1.01]) * 0.1\n\n }.play;\n);\n\n(\n {\n var freq;\n freq = Duty.kr(\n MouseX.kr(0.001, 2, 1), // control rate ugen as durations\n 0,\n Dseq([204, 400, 201, 502, 300, 200], inf)\n );\n SinOsc.ar(freq * [1, 1.01]) * 0.1\n\n }.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n~name = \\defaultMapper;\n\n// default mapper does nothing. It could have been named 'identity'\n~function = { |aziDeg = 0, eleDeg = 0, gainDB = -99, delayMs = 1, lpHz = 15000, hpHz = 5, spread = 0.01, nfIndex = 0|\n [[aziDeg, eleDeg, gainDB, delayMs, lpHz, hpHz, spread, nfIndex]];\n };\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "What does `SplineGui.onSelect` do?"}, {"role": "assistant", "content": "A handler evaluated when you select a point. arg: selected index, Returns: function"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `ControlRate`."}, {"role": "assistant", "content": "```supercollider\n{ SinOsc.ar(ControlRate.ir) * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// default initial params\n{ LatoocarfianC.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// default initial params\n{ LatoocarfianC.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Mx.app` do?"}, {"role": "assistant", "content": "Returns the MxApp object which is used to communicate with the Mx. `x = Returns: an MxApp"}]} +{"conversations": [{"role": "user", "content": "What does `Object.?` do?"}, {"role": "assistant", "content": "If the receiver is nil then answer anObject, otherwise answer the"}]} +{"conversations": [{"role": "user", "content": "What does `ServerLogGui.showTimes` do?"}, {"role": "assistant", "content": "the interface for display and searching the ServerLog Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `CoinGate`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\na = SynthDef(\"help-TCoin\", { |out = 0, prob = 0.5|\n var trig;\n trig = CoinGate.kr(prob, Impulse.kr(10));\n Out.ar(out,\n SinOsc.ar(\n TRand.kr(300.0, 400.0, trig), 0, 0.2\n )\n )\n}).play;\n);\n\na.set(\\prob, 1.0);\na.set(\\prob, 0.0);\na.set(\\prob, 0.1);\n\n\n(\na = SynthDef(\"help-TCoin\", { |out = 0, prob = 0.5|\n var trig;\n trig = Impulse.ar(20, 0, SinOsc.kr(0.5, 0, 1, 1));\n Out.ar(out,\n Mix.fill(3, { Ringz.ar(CoinGate.ar(prob, trig*0.5), #[1, 1.5]*Rand(1000, 9000), 0.01) })\n )\n}).play;\n);\n\na.set(\\prob, 1.0);\na.set(\\prob, 0.0);\na.set(\\prob, 0.1);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// note different syntax in these two examples\n{ if(LFNoise1.kr(1.0, 0.5, 0.5), SinOsc.ar, Saw.ar) * 0.1 }.play;\n\n{ Trig1.ar(Dust.ar(3), 0.2).lag(0.1).if(FSinOsc.ar(440), FSinOsc.ar(880) * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// note different syntax in these two examples\n{ if(LFNoise1.kr(1.0, 0.5, 0.5), SinOsc.ar, Saw.ar) * 0.1 }.play;\n\n{ Trig1.ar(Dust.ar(3), 0.2).lag(0.1).if(FSinOsc.ar(440), FSinOsc.ar(880)) * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Latoocarfian2DN.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "latoocarfian 2D chaotic generator Arguments: minfreq, maxfreq — iteration frequency in Hertz; a, b, c, d — equation variables; x0 — initial value of x; y0 — initial value of y."}]} +{"conversations": [{"role": "user", "content": "What does `BSpline.splineIntPart2` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: list — (describe argument here); i — (describe argument here). Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "What does `ServerErrorGui.guiBody` do? What arguments does it take?"}, {"role": "assistant", "content": "Listen to a server for /fail messages and display them in a small view. Arguments: layout."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Convolution2L`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// one last example\n(\nb = Buffer.alloc(s, 512, 1);\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, true, true);\n);\n\n(\n{\n var input = SoundIn.ar(0);\n var framesize = 512;\n Convolution2L.ar(input, b, 0, framesize, 1, 0.5);\n}.play\n);\n\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Out` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-out\", { |out = 0, freq = 440|\n var source;\n source = SinOsc.ar(freq, 0, 0.1);\n\n // write to the bus, adding to previous contents\n Out.ar(out, source);\n\n}).add;\n);\n\n\nSynth(\"help-out\", [\\freq, 500]);\nSynth(\"help-out\", [\\freq, 600]);\nSynth(\"help-out\", [\\freq, 700]);\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\na = { |tempo = 1| Ringz.ar(Impulse.ar(tempo), [501, 500], 1/tempo) }.play;\nt = TempoBusClock(a);\nTask { loop { \"klink\".postln; 1.wait } }.play(t);\n);\n\nt.tempo = 1.3;\nt.tempo = 0.5;\nt.tempo = 1.0;\n\n\n// in ProxySpace, a TempoBusClock can be added together with a ~tempo NodeProxy:\n\np = ProxySpace.push(s);\np.makeTempoClock;\np.clock; // now the ProxySpace's clock is a TempoBusClock\n\n~out.play;\n~out = { Ringz.ar(Impulse\n// …\n```"}, {"role": "assistant", "content": "in ProxySpace, a TempoBusClock can be added together with a ~tempo NodeProxy: patterns and tasks are synchronized: (TempoBusClock: a clock that synchronizes its tempo with the server)"}]} +{"conversations": [{"role": "user", "content": "What does `UChain.<|` do? What arguments does it take?"}, {"role": "assistant", "content": "Returns new UChain containing all the units of this UChain plus the unit passed in the Arguments: unit. Returns: UChain"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// you have to write the sample path in the firts line\n\n~bufferdue = Buffer.read(s,\" WRITE YOUR SAMPLE PATH HERE \", bufnum:2);\n\n(\nSynthDef.new(\\bufbeat, {\n arg amp = 1, out = 0, buf, start, end, freq = 1;\n var sig, ptr;\n ptr = LFNoise1.ar(freq).range(0.0,end);\n sig = BufRd.ar(2, buf, ptr);\n sig = sig * amp;\n Out.ar(out, sig);\n}).add\n);\n\nx = Synth.new(\\bufbeat, [\\buf, ~bufferdue.bufnum, \\start,0, \\end, ~bufferdue.numFrames-1, \\freq, 1, \\amp, 0.5],g);\n\nx.free;\n```"}, {"role": "assistant", "content": "a simple BufRd with the starting point of lecture randomized by LFNoise1."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Mix`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var n;\n n = 8; // number of 'voices'\n Mix.new( // mix all stereo pairs down.\n Pan2.ar( // pan the voice to a stereo position\n CombL.ar( // a comb filter used as a string resonator\n Dust.ar( // random impulses as an excitation function\n // an array to cause expansion of Dust to n channels\n // 1 means one impulse per second on average\n Array.fill(n, 1),\n 0.3 // amplitude\n ),\n 0.01, // max delay time in seconds\n // array of different random lengths for each 'string'\n Array.fill(n, {0.004.rand+0.0003}),\n 4 // decay time in seconds\n ),\n Array.fill(n,{1.0.rand2}) // give each voice a different pan position\n )\n )\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `SoundIn` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\nu = Server(\\scau, NetAddr(\"127.0.0.1\", 9989)); // Change the port from 9989 to the right one for you\nu.serverRunning = true;\nu.ping(10); // Gives about 0.02 for me - confirms that communication is working\n// Now let's create a quick ring-modulator effect:\nz = { SoundIn.ar([0,1]) * SinOsc.ar(MouseX.kr(100, 1000)) }.play(u);\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `SClusterDistortions` in SuperCollider briefly."}, {"role": "assistant", "content": "SClusterDistortions — control SCluster distortions Distortions control for LINKClasses/SCluster. Category: SInstruments."}]} +{"conversations": [{"role": "user", "content": "Explain `UnicodeResponder` in SuperCollider briefly."}, {"role": "assistant", "content": "UnicodeResponder — register responder functions for unicode and modifier combinations This can be used to replace a function in a view's keydownAction. It matches modifier/unicode combinations and then evaluates the matched handler. Category: External Control > Keyboard, Libraries > crucial > Keyboard."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `In`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-InKr\", { |out = 0, in = 0|\n Out.ar(out,\n SinOsc.ar(In.kr(in, 1), 0, 0.1)\n )\n}).add;\nSynthDef(\"help-lfo\", { |out = 0|\n Out.kr(out, LFNoise1.kr(0.3, 200, 800))\n}).add;\n);\n\n\nb = Bus.control(s, 1);\nb.set(800);\n\nSynth(\"help-InKr\", [\\in, b.index]);\nb.set(400);\nb.set(300);\nSynth(\"help-lfo\", [\\out, b.index]);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Magnitude.<` do?"}, {"role": "assistant", "content": "Comparable value in a linear continuum Returns: a Boolean whether the receiver is less than aMagnitude."}]} +{"conversations": [{"role": "user", "content": "What is `TGaussRand` in SuperCollider?"}, {"role": "assistant", "content": "TGaussRand — triggered gaussian random distribution Generates a random float value in gaussian distribution from `lo` to `hi` each time the trigger signal changes from nonpositive to positive values. Category: UGens > Random, UGens > Triggers."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `AbstractFunction`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\na = { |x| #[440, 720, 801, 1020.2].at(x) }; b = a.cpsmidi; [a.value(3), b.value(3)];\na = Pseries(220, 220, inf).cpsmidi; a.asStream.nextN(12); // overtone series as midinotes\n// follow but round to next midinote\n{ a = Pitch.kr(SoundIn.ar).at(1); Pulse.ar(a.cpsmidi.round.midicps) * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What are the server's default sample rate and block size?"}, {"role": "assistant", "content": "44100 Hz and 64 samples per block by default, so the control rate is 44100/64 = 689.06 Hz. You can read them from the language with `s.sampleRate` and `s.options.blockSize`, or from inside a Synth with `SampleRate.ir` and `ControlRate.ir`. A `.kr` signal therefore updates about 689 times a second, which is why it is smooth enough for filters and envelopes but not for audio-rate FM."}]} +{"conversations": [{"role": "user", "content": "What does `MIDIFunc.activeSense` do?"}, {"role": "assistant", "content": "A convenience method to create a new MIDIFunc which responds to MIDI active sense messages. See #*new for argument descriptions. The responding `func` will be passed the argument Returns: A new instance of MIDIFunc which responds to MIDI active sense messages."}]} +{"conversations": [{"role": "user", "content": "What does `Buffer.sine2` do? What arguments does it take?"}, {"role": "assistant", "content": "Fill this buffer with a series of sine wave partials using specified frequencies and Arguments: freqs — An Array containing frequencies (in cycles per buffer) for the partials.; amps — An Array containing amplitudes for the partials. This should contain the same number of items as freqs.; normalize — A Boolean indicating whether or not to normalize the buffer to a peak value of 1.0. The default is true.; asWavetable — A Boolean indicating whether or not to write to the buffer in wavetable format so that it can be read by interpolating oscillators. The default is true.; clearFirst — A Boolean indicating whether or not to clear the buffer before writing. The default is true.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// increase feedback\n{ FBSineL.ar(SampleRate.ir, 1, Line.kr(0.01, 4, 10), 1, 0.1) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// increase feedback\n{ FBSineL.ar(SampleRate.ir, 1, Line.kr(0.01, 4, 10), 1, 0.1) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SCDocHTMLRenderer.makeArgString` do?"}, {"role": "assistant", "content": "Used Returns: A String representing the arguments (with defaults) for a Method."}]} +{"conversations": [{"role": "user", "content": "What does `SCDocHTMLRenderer.htmlForLink` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a html string for the given scdoc Arguments: link — An scdoc link, such as a document key like \"Classes/SinOsc\", or an URL, or link to other file installed with the help.; escape — a boolean to set whether to escape special characters.. Returns: A String"}]} +{"conversations": [{"role": "user", "content": "What is `Ref` in SuperCollider?"}, {"role": "assistant", "content": "Ref — a reference to a value A Ref holds an object which may be retrieved and altered with the messages value and value_(obj). The backquote `` is a unary operator that is equivalent to calling `Ref.new(obj)`. Category: Core."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `AnalogIn`."}, {"role": "assistant", "content": "```supercollider\n// modulate frequency of a sine oscillator\n\n(\nSynthDef(\"help-AnalogIn\", { |out = 0|\n Out.ar(out,\n SinOsc.ar(AnalogIn.ar(0).exprange(200, 5000), 0, 0.1)\n )\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `RedDiskInSampler.voicesLeft` do?"}, {"role": "assistant", "content": "Return number of free voices for this key i.e. the number of non-playing"}]} +{"conversations": [{"role": "user", "content": "What does `QPalette.light` do?"}, {"role": "assistant", "content": "A predefined palette using light colors. All colors are considered to be set (see"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Just a dirty FM bass shuffling. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\nfork{\n SynthDef(\\basicFM, {|out = 0, gate = 1, amp = 1, carFreq = 1000, modFreq = 100, modAmount = 2000, clipAmount = 0.1|\n var modEnv = EnvGen.ar(Env.adsr(0.5, 0.5, 0.7, 0.1, peakLevel: modAmount), gate);\n var mod = SinOsc.ar(modFreq) * modEnv;\n var car = SinOsc.ar(carFreq + mod);\n var ampEnv = EnvGen.ar(Env.adsr(0.1, 0.3, 0.7, 0.2, peakLevel: amp), gate, doneAction: 2);\n var clip = clipAmount * 500;\n Out.ar(out, (car * ampEnv * clip).clip(-0.7, 0.7) * 0.1);\n }).add;\n\n s.sync;\n\n Pbind(*[\n instrument: \\basicFM,\n out: [0, 1],\n dur: Pseq([1/7, 1/3] / 1.2, inf),\n sustain: Pkey(\\dur),\n amp: 1/4,\n carFreq: Pseq([1, 1, 1, 2] * 350, inf),\n modFreq: Pkey(\\carFreq) * (1/8),\n modAmount: Pseq([2, 1, 0.5, 2, 1, 0.5, 2, 1, 2, 1, 0.5, 2, 1, 0.5, 2, 4] * 500, inf),\n clipAmount: Pseq([Pn(0.1, 32), Pn(1, 32)], inf)\n ]).play;\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `BelaScope`?"}, {"role": "assistant", "content": "BelaScope — Bela's Oscilloscope interface"}, {"role": "user", "content": "What does `BelaScope.scope` do?"}, {"role": "assistant", "content": "Send an array of UGen data to Bela's oscilloscope."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n{ BelaScope.scope(0, SinOsc.ar) }.play;\n// same using UGen\n```"}]} +{"conversations": [{"role": "user", "content": "What does `String.dirname` do?"}, {"role": "assistant", "content": "Return the directory name from a filesystem path. The behavior matches that of POSIX'"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n// a pattern with long notes\np = Pbind(\n \\freq, Pwhite(0, log(32)).exp.round(1) * 36.midicps,\n \\detune, Pfunc({ |ev| ev[\\freq] * rand(0.01) }),\n \\sustain, Pwhite(log(0.1), log(20)).exp,\n \\dur, Prand([0.1, 0.1, 0.1, 0.1, 0.2, 1, 2], inf),\n \\db, Pstep(Pseq([-20, -30, -25, -30], inf), 0.2)\n);\n\n// unrelated cluster pattern running on TempoClock.default\nPbind(\\dur, 2, \\midinote, Pseq([(48..60)], 20), \\db, -30).play;\n// …\n```"}, {"role": "assistant", "content": "a pattern with long notes unrelated cluster pattern running on TempoClock.default (PatternConductor: Simple interactive control for playing patterns)"}]} {"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// connect will connect to all midi in devices\n// if you need to specify one,\n// check the sources at: MIDIClient.sources\n// and connect using MIDIIn.connect( source_index )\nMIDIIn.connect;\n\n// show incoming control data\n~control = { arg src, chan, num, val; \n [chan,num,val].postln; \n};\n\nMIDIIn.addFuncTo(\\control, ~control);\n```"}, {"role": "assistant", "content": "Simple example showing how to listen for MIDI control messages."}]} -{"conversations": [{"role": "user", "content": "Explain `FoaProximity` in SuperCollider briefly."}, {"role": "assistant", "content": "FoaProximity — First Order Ambisonic (FOA) proximity effect filter Apply proximity filtering to a First Order Ambisonic signal (B-format). Category: Libraries > Ambisonic Toolkit > UGens > FOA > Transformer, UGens > Multichannel > Ambisonics."}]} -{"conversations": [{"role": "user", "content": "Explain `BufAllpassN` in SuperCollider briefly."}, {"role": "assistant", "content": "BufAllpassN — Buffer based all pass delay line with no interpolation. All pass delay line with no interpolation which uses a buffer for its internal memory. See also BufAllpassC which uses cubic interpolation, and which BufAllpassL uses linear interpolation. Cubic interpolation is more computationally expensive than linear, but more accurate. Category: UGens > Delays > Buffer."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// Now to demonstrate language-side classification, we'll iterate over a grid and classify:\n(\n(0, 0.1 .. 1).collect{|y|\n(0, 0.1 .. 1).collect{|x|\nPlaneTree.classify([x,y], ~treedata)\n}\n}.do(_.postln);\"\"\n);\n\n// Server-side: run this then move the mouse left/right/up/down - classification should follow same pattern.\ns.boot;\n~treebuf = Buffer.loadCollection(s, ~treedata.flat, ~treedata[0].size);\n(\nx = {\nPlaneTree.kr(~treebuf, [MouseX.kr(0,1), MouseY.kr(0,1)]).poll\n// …\n```"}, {"role": "assistant", "content": "Now to demonstrate language-side classification, we'll iterate over a grid and classify: Server-side: run this then move the mouse left/right/up/down - classification should follow same pattern. (PlaneTree: Tree classifier using (hyper)planes – UGen or language-side)"}]} -{"conversations": [{"role": "user", "content": "What does `AbstractFunction.rho` do?"}, {"role": "assistant", "content": "An object which responds to a set of messages that represent mathematical functions"}]} -{"conversations": [{"role": "user", "content": "What does `Class.findRespondingUpperSubclasses` do?"}, {"role": "assistant", "content": "Return a list of all classes down the class tree starting from the receiver, whose instances respond to the message selector or all message selector in an array."}]} -{"conversations": [{"role": "user", "content": "What is `Pn` in SuperCollider?"}, {"role": "assistant", "content": "Pn — repeatedly embed a pattern Category: Streams-Patterns-Events > Patterns > Repetition."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for number 10 for Quiz 4a."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var tri, bpf;\n tri = LFTri.ar(\n freq: [440,340, 513],\n mul: LFPulse.kr(\n freq: [6,3,2],\n width: 0.15));\n bpf = SinOsc.ar(in: tri, freq: LFNoise2.kr(4).range(400,1000));\n Splay.ar(tri,bpf);\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Object.dup` do?"}, {"role": "assistant", "content": "Duplicates the receiver n times, returning an array of n copies. Different classes respond to this message differently. The shortcut \"!\" can be used in"}]} -{"conversations": [{"role": "user", "content": "How current is your SuperCollider knowledge?"}, {"role": "assistant", "content": "It comes from a snapshot of the SuperCollider repository (documentation, class library and examples) plus code I can reason about. So classes and arguments in that snapshot I know well, including argument order. Quarks, newer UGens, and anything outside the official tree I may not know at all, and I will say so rather than invent a method name. If you need certainty about a class, check its help page — `SinOsc.schelp` in the source tree is the authority."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// lookBack and deviations coupled here\n// maxLookBack must be large enough\n\n(\n~loDev = -1;\n~hiDev = 1;\n~lookBack = 2;\n\np = Pbind(\n \\dur, 1/7,\n \\midinote, PLIdev(78, 10, \\loDev, \\hiDev, \\lookBack).trace(prefix: \"midi \"),\n).play;\n);\n\n// start parameter movement on the fly\n\n(\n~loDev = Pseg(Pseq([2, 5].neg, inf), 5, \\sin);\n~hiDev = Pseg(Pseq([2, 5], inf), 5, \\sin).trace(prefix: \"absolute deviation and lookBack \");\n~lookBack = Pseg(Pseq\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// lookBack and deviations coupled here\n// maxLookBack must be large enough\n\n(\n~loDev = -1;\n~hiDev = 1;\n~lookBack = 2;\n\np = Pbind(\n \\dur, 1/7,\n \\midinote, PLIdev(78, 10, \\loDev, \\hiDev, \\lookBack).trace(prefix: \"midi \"),\n).play;\n);\n\n// start parameter movement on the fly\n\n(\n~loDev = Pseg(Pseq([2, 5].neg, inf), 5, \\sin);\n~hiDev = Pseg(Pseq([2, 5], inf), 5, \\sin).trace(prefix: \"absolute deviation and lookBack \");\n~lookBack = Pseg(Pseq([2, 5], inf), 5, \\sin); \n);\n\np.stop\n```"}]} -{"conversations": [{"role": "user", "content": "What does `ObjectGui.gui` do? What arguments does it take?"}, {"role": "assistant", "content": "The standard method to create a view / window. Usually you call yourModel.gui(parent, bounds) and this creates the gui (of the related ObjectGui subclass) and then theObjectGui.gui(parent, bounds) is called, forwarding the arguments. So this method is what receives the forwarded (parent, bounds) from the initial call to theModel.gui(parent, bounds). Usually you do not call this manually and would avoid reimplementing Arguments: parent — parent view : nil, a Window, a FlowView or any other usable container view.; bounds — nil or a Rect. The default of nil will offer the entire bounds to the guiBody method and then shrink the view size afterwards to the exact size of the contents that were actually added.; ... args — More args may be passed into theModel.gui(parent, bounds, anArg, moreArg) and will be forwarded to guiBody.. Returns: this"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Another fibonaccy melody."}, {"role": "assistant", "content": "```supercollider\n(\nc=13;a=Array.fib(64,0,1);b=Array.fill(size:c,function:{arg i;a[i]%12});\np=1/(21-c);Pdef(\\x,Pbind(\\dur,p,\\degree,Pseq(b,1,0)));\nr=Array.fill(c,{arg i;Pbindf(Pdef(\\x),\\mtranspose,1-b[i]);});\nPseq(r,(1/p)).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `NumRunningSynths`."}, {"role": "assistant", "content": "```supercollider\n// example: frequency is derived from the number of synths running\n(\nSynthDef(\"numRunning\", { |out|\n Out.ar(out, SinOsc.ar(NumRunningSynths.ir * 200 + 400, 0, 0.1));\n}).add;\n);\n\ns.sendMsg(\"/s_new\", \"numRunning\", -1, 0, 0);\ns.sendMsg(\"/s_new\", \"numRunning\", -1, 0, 0);\ns.sendMsg(\"/s_new\", \"numRunning\", -1, 0, 0);\ns.sendMsg(\"/s_new\", \"numRunning\", -1, 0, 0);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Object.asArray` do?"}, {"role": "assistant", "content": "Returns an Array with the receiver, unless it is an Array already. `[1, 2,"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// 2D:\n~directions = [ theta0, theta1, ... thetaN ;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// 2D:\n~directions = [ theta0, theta1, ... thetaN ];\n```"}]} -{"conversations": [{"role": "user", "content": "What does `BusPlug.defaultReshaping` do?"}, {"role": "assistant", "content": "default reshaping behaviour for BusPlug and its sublass NodeProxy. See:"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Extra Demos for \\apadMH SynthDef."}, {"role": "assistant", "content": "```supercollider\n// Extra Demos for \\apadMH SynthDef\n\n\n(\n// made by Diya Menon\n// inspired by Eastside\n// demo\nPbindef(\\dmapadMH2,\n \\instrument, \"apadMH\",\n \\midinote, Pseq([\n 73, 73, 73, 73, 69, 71, 71, 71, 69, 69, 69, 69, 69, 64, 69, 69, 69, 69,\n [57, 61, 52, 69, 73, 64],\n [56, 59, 51, 68, 71, 63],\n [61, 64, 56, 73, 76, 68],\n [54, 57, 49, 66, 69, 61],\n [54, 57, 49, 66, 69, 61],\n [56, 59, 51, 68, 71, 63],\n [57, 61, 52, 69, 73, 64],\n ]),\n \\amp, Pseq([\n Pn([0.075], 18),\n 0.081, 0.065, 0.075, 0.1, 0.065, 0.05, 0.1\n ]),\n \\dur, Pseq([\n Pn(0.17, 3), 0.34,\n Pseq([Pn(0.17, 4), 0.34], 2),\n Pn(0.17, 4),\n 1.5, 0.75, 0.75, 1.5, 0.75, 0.75, 1.5]),\n \\rel, Pgeom(0.01, 1.25),\n \\reverbMix, 0\n).play;\n);\n\n(\n// by Bruno Ruviaro\nPbindef(\\apadMH2,\n \\instrument, \"apadMH\",\n \\degree, Pwhite(-10, 15, inf),\n \\amp, Pwhite(0.06, 0.2, inf),\n \\mtranspose, Prand([\n 0,\n [0, 4],\n 0,\n [0, 5, 7]\n ], inf),\n \\dur, Prand([1, 2, 2.6], inf),\n \\att, Pwhite(0.9, 1.5),\n \\rel, 6, //Pn(Pgeom(0.01, 1.25), inf),\n \\legato, 1,\n \\vibratoRate, Pwhite(2.0, 4.0, inf),\n \\vibratoDepth, Pwhite(0.005, 0.02, inf),\n \\reverbMix, 0.2\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// environments can be used as a lookup with valueEnvir:\n\n(\nEnvironment.use {\n ~y = 10;\n ~x = 2;\n ~z = { |x = 8| x } + { |y = 0| y + 1.0.rand };\n ~z.valueEnvir;\n}\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// environments can be used as a lookup with valueEnvir:\n\n(\nEnvironment.use {\n ~y = 10;\n ~x = 2;\n ~z = { |x = 8| x } + { |y = 0| y + 1.0.rand };\n ~z.valueEnvir;\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for piece i'm working on for a dance performance."}, {"role": "assistant", "content": "```supercollider\n( // 'random' sequences of rhythms, reverb,...\nz = {\n var trig, seq;\n trig = Impulse.kr(6);\n seq = Drand([\n Dseq([4,0,0,1,Drand([1,4]),1,0,1]),\n Dseq([1,0,2,0,Drand([0,1,4]),0,1,1]),\n Dseq([4,0,0,2,Drand([1,2,4]),0,1,1]),\n Dseq([4,0,1,2,Drand([0,1,4]),1,2,0]),\n Dseq([1,1,4,1,Drand([1,4]),2,3,3]),\n Dseq([4,1,0,1,Drand([0,4]),1,0,1])\n ], inf);\n\n g = HenonN.ar(\n [120,120],\n LFNoise2.kr(1, 0.2, 1.2),\n LFNoise2.kr(1, 0.15, 0.15)\n )\n * 0.2\n + SinOsc.ar([61,40], mul:0.7)\n\n // add lovely chaos noise (taken from documentation example)\n + {\n LatoocarfianC.ar(\n SampleRate.ir/4,\n LFNoise2.kr(2,1.5,1.5),\n LFNoise2.kr(2,1.5,1.5),\n LFNoise2.kr(2,0.5,1.5),\n LFNoise2.kr(2,0.5,1.5)\n ) * 0.1 // volume\n }\n +\n { FBSineN.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(1, 32, 33),\n LFNoise2.kr(1, 0.5),\n LFNoise2.kr(1, 0.05, 1.05),\n LFNoise2.kr(1, 0.3, 0.3)\n ) * 0.2 * SinOsc.kr(0.01) }\n ;\n\n trig = Demand.kr(trig, 0, seq * 0.2) * trig;\n { MoogFF.ar(\n g,\n SinOsc.kr(0.1,0,1,1) * 1000 + 3000)}.dup\n * Decay.kr(trig, Demand.kr(trig,0,Drand([1,2,4,6], inf)*0.1)) // envelope\n ;\n};\n\n{\n GVerb.ar(\n in: EnvGen.kr(Env.linen(20, 240, 40, 0.6, \\sine)) * z * 0.9,\n roomsize: 30,\n revtime: 4, // SinOsc.kr(0.1,0,4,4.1),\n damping:0.4, // SinOsc.kr(0.12,0,0.4,0.5),\n inputbw:1,\n spread:15,\n drylevel:SinOsc.kr(0.02,0,0.5,0.5),\n earlyreflevel:SinOsc.kr(0.01,0,0.5,0.5),\n taillevel:SinOsc.kr(0.02,pi,0.05,0.05)\n );\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "GrainBuf complains about too many grains."}, {"role": "assistant", "content": "The number of simultaneous grains is `density × dur` in seconds, and it exceeds maxGrains (512 by default). Either lower the trigger rate, shorten the grains, or raise the limit: `GrainBuf.ar(2, trig, dur, buf, 1, pos, 2, 0, -1, 1024)` — the 1024 is maxGrains. Raising it costs server CPU per grain, so prefer halving the density if the sound does not need it."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n(\nx = Pbind(\\midinote, Pseries(60, 1, 10), \\dur, 0.5).asStream;\ny = Pbind(\\midinote, Pseries(90, -1, 10), \\dur, 0.5).asStream;\n\nz = Pseq([2, 3, 1, 2], 1).asStream;\n\n~a = Pfuncn({ x.next(()) }, { z.next });\n~b = Pfuncn({ y.next(()) }, { z.next });\n\nPsymNilSafe(Pseq(\"ab\", inf)).trace.play;\n\n// shorter with method 'symplay':\n// trace indicates all events with delta = 0 (maxNull\n// …\n```"}, {"role": "assistant", "content": "shorter with method 'symplay': trace indicates all events with delta = 0 (maxNull = 128) in the post window (PsymNilSafe: Psym variant that avoids hangs if all referenced patterns return nil)"}]} -{"conversations": [{"role": "user", "content": "Explain `Clothesline` in SuperCollider briefly."}, {"role": "assistant", "content": "Clothesline — Timeline for Code When compoising larger pieces out of many smaller programs, one is often drawn towards recording the elements and arranging the piece in a timeline of a digital audio workstation. The class Clothesline gives a simple way to schedule code in a timeline, each with beginning and end. It has a GUI for simple navigation. This is all, it has no further controls, no dragging, no convenience. It is experi Category: live coding."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Electrode Theremin (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var saw, bpf;\n saw = Saw.ar(\n freq: 30, \n mul: SinOsc.kr(\n freq: LFPulse.ar(freq: [100, 1000]).range(1, 10),\n width: 0.9));\n bpf = BPF.ar(in: saw, freq: MouseY.kr(1000, [6000, 9000]), rq: MouseX.kr(0.1, 0.9), mul: 20);\n Out.ar(0, bpf);\n \n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SequenceableCollection.integrate` do?"}, {"role": "assistant", "content": "Returns a collection with the incremental sums of all elements. `[3, 4, 1,"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `IRand`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-IRand\", {\n Out.ar(\n IRand(0, 1), // play on random channel between 0 and 1\n FSinOsc.ar(500,\n 0, Line.kr(0.2, 0, 0.1, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n(\nRoutine({\n 16.do({\n Synth.new(\"help-IRand\"); 0.5.wait;\n })\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `Routine` in SuperCollider briefly."}, {"role": "assistant", "content": "Routine — Functions that can return in the middle and then resume where they left off A Routine runs a Function and allows it to be suspended in the middle and be resumed again where it left off. This functionality is supported by the Routine's superclass Thread. Effectively, Routines can be used to implement co-routines as found in Scheme and some other languages. Category: Core > Kernel."}]} -{"conversations": [{"role": "user", "content": "What does `FoaEncoderMatrix.newAmbix1` do?"}, {"role": "assistant", "content": "A first order linkhttps://en.wikipedia.org/wiki/Ambisonic_data_exchange_formats##Ambisonic format exchange encoder. Encodes from AmbiX to traditional B-format. A convenience alias to"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Unfunky Drummer - Insert samples, extract joy?"}, {"role": "assistant", "content": "```supercollider\n(\nfork{\n //---------Source Files---------\n ~numOfPatterns = 16;\n ~synthDefToUse = \\bufPlay; //Change to \\bufPlay2 to use stereo samples\n ~rate = 2; //Rate of playback\n ~source = [ // Create an array of your samples. ~media.samples points at my base sample directory and is defined in my startup file.\n ~media.samples ++ \"808/kicks/808 kick 6.wav\",\n ~media.samples ++ \"808/snares/808 snare 6.wav\",\n ~media.samples ++ \"808/hats/808 hat 2.wav\",\n ~media.samples ++ \"808/other/808 cowbell.wav\",\n ~media.samples ++ \"808/other/808 clap.wav\",\n ~media.samples ++ \"808/other/808 rim.wav\",\n ~media.samples ++ \"808/other/808 maraca.wav\"\n ];\n Buffer.freeAll;\n ~buffers = ~source.collect{|source| Buffer.read(s, source)};\n ~patterns = ~numOfPatterns.collect{|val| Pbind(*[dur: Pn(1/val, val)])};\n ~randPattern = Prand(~patterns, 1);\n ~patterns = ~buffers.collect{|buf| Pbind(*[bufnum: buf]) <> ~randPattern};\n SynthDef(\\bufPlay, {|out = 0, bufnum, rateScale = 1, amp = 1| Out.ar(out, PlayBuf.ar(1, bufnum, BufRateScale.kr(bufnum) * rateScale, doneAction: 2) * amp!2);}).add;\n SynthDef(\\bufPlay2, {|out = 0, bufnum, rateScale = 1, amp = 1| Out.ar(out, PlayBuf.ar(2, bufnum, BufRateScale.kr(bufnum) * rateScale, doneAction: 2) * amp);}).add;\n s.sync;\n Ppar(~patterns, inf).play(TempoClock(~rate, 0), protoEvent: (instrument: ~synthDefToUse, amp: 0.25)); //Change to /bufPlay2 for stereo samples\n};\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SimpleEnttecDMXPro.new` do? What arguments does it take?"}, {"role": "assistant", "content": "create a new Arguments: portid — one listed in `SerialPort.devices`.; baudrate — baudrate of the serial port.; universeSize — size of the initial DMX universe.; cmdperiod — if `true`, the serial port will be closed on command-period.."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes vinyl noise emulation."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef.new(\\vinylCrackling, { arg out=0;\n var pop,imp,modImp,midNoise,hiNoise,loNoise,loopTime=8,numChan=2,w,x,y;\n\n //Harder pops\n pop = TDuty.ar(Dseq({ 1.0.bilinrand.abs } ! loopTime,inf));\n pop = Resonz.ar(Decay.ar(pop,TRand.ar(0.001,0.1,pop)),Demand.ar(pop,0,Dseq({ 7000.bilinrand.abs+40 } ! loopTime,inf)),\n mul:Demand.ar(pop,0,Dseq({ exprand(0.1,0.87) } ! loopTime,inf)));\n pop = LeakDC.ar(pop,TRand.ar(0.9,0.9995,pop));\n #w,x,y = PanB2.ar(pop,Demand.ar(pop,0,Dseq({ 1.0.rand2 } ! loopTime,inf)));\n\n //Softer, highpass filtered impulses\n imp = { arg i; HPF.ar(LPF.ar(Dust2.ar(8),8000.0),6000.0,WhiteNoise.ar(0.7)) } ! numChan;\n\n //Faster, modulated lowpass filtered impulses\n modImp = LPF.ar(Dust.ar(LFDNoise3.ar(1).exprange(100,500),LFDNoise3.ar(10).exprange(0.01,0.07)),9000.0) ! numChan;\n\n //Mid frequency modulated noise background\n midNoise = LPF.ar(GrayNoise.ar(LFDNoise3.ar(60))*WhiteNoise.ar(0.009),12000.0) ! numChan;\n\n //High frequency modulated noise background\n hiNoise = HPF.ar(LPF.ar(GrayNoise.ar(LFDNoise3.ar(60))*WhiteNoise.ar(0.01),14000.0),8000.0) ! numChan;\n\n //Low frequency modulated noise background\n loNoise = LPF.ar(BrownNoise.ar(PinkNoise.ar.range(0.001,0.02)),1200) ! numChan;\n\n Out.ar(out,DecodeB2.ar(numChan,w,x,y)+imp+modImp+midNoise+hiNoise+loNoise);\n }).add;\n);\n\ns.sendMsg('/s_new',\\vinylCrackling,a=s.nextNodeID,0,1,\\out,0);\ns.sendMsg('/n_free',a);\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Feedback with beats."}, {"role": "assistant", "content": "```supercollider\nNdef(\\a, {\n var src, loc, delay=0.01;\n src = Decay2.ar(Impulse.ar(1/8), LFNoise2.kr(4).range(0.001, 0.0001),\n LFNoise2.kr(4).range(0.005, 0.05))!2\n * Saw.ar(LFNoise2.kr(4).exprange(40, 4000));\n loc = BPF.ar(LocalIn.ar(2) + [src, 0], LFNoise0.kr(1/4).range(100, 1200).lag, 3.2);\n loc = GVerb.ar(loc, 100, 4, mul:0.02, add:loc);\n loc = Compander.ar(loc, loc, 0.9, 1, 0.001);\n loc = (loc * 0.501).tanh;\n loc = Compander.ar(loc, loc, 0.1, 1, 0.1); \n loc = DelayC.ar(loc, delay * 2, delay * 1);\n LocalOut.ar(loc.reverse * 0.49);\n Out.ar(0, loc * 0.9)\n}).play;\n\nNdef(\\b, {\n var src, loc, del;\n del = 1/100;\n src = Decay2.ar(TDuty.ar(1/4,0,Dseq([1, 0.5, 0.3, 0.1],inf)), \n LFNoise2.kr(4).range(0.001, 0.0001), LFNoise2.kr(4).range(0.005, 0.05))!2\n * Saw.ar(LFNoise2.kr(200).exprange(40, 14000));\n loc = BPF.ar(LocalIn.ar(2) + [src, 0], LFNoise2.kr(0.1).range(40, 400), 3.2);\n loc = GVerb.ar(loc, 100, 4, mul:0.02, add:loc);\n loc = Compander.ar(loc, loc, 0.9, 1, 0.001);\n loc = (loc * 0.51).tanh;\n loc = Compander.ar(loc, loc, 0.1, 1, 0.1); \n loc = DelayC.ar(loc, del * 2, del * 1);\n LocalOut.ar(loc.reverse * 0.45);\n Out.ar(0, Compander.ar(loc,loc,0.1, 1, 0.05) * 1.2)\n}).play;\n\nNdef(\\c, {\n var src, loc, del=1/4;\n src = Decay2.ar(Impulse.ar(1), 0.0001, 0.05) * SinOsc.ar(60);\n loc = src + LocalIn.ar(2);\n loc = BPF.ar(loc, 800, 3.2).softclip;\n loc = DelayN.ar(loc, del, [0, del]);\n LocalOut.ar(loc.reverse * 0.99);\n Out.ar(0, loc * 2)\n}).play;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// implicitly, the composition operator <> returns a Pchain when applied to a pattern.\n// so that a <> b creates a Pchain (a, b).\n// as seen above, in Pchain(a, b), a specifies (and overrides) b: b is the input to a.\n\n// the above example is equivalent to:\n\n(Pbind(\\degree, Pseq([1, 2, 3], inf)) <> (detune: [0, 4])).trace.play;\n\n(\na = Pbind(\\degree, Pseq([1, 2, 3], inf), \\dur, Prand([0.2, 0.4], inf));\nb = Pbind(\\detune, Pseq([-30, 0, [0, 40]], inf), \\dur, 0.1);\nc = b <> a;\nc.play; // see that the\n// …\n```"}, {"role": "assistant", "content": "implicitly, the composition operator <> returns a Pchain when applied to a pattern. so that a <> b creates a Pchain (a, b). (Pchain: pass values from stream to stream)"}]} -{"conversations": [{"role": "user", "content": "Write a chord progression with Pbind."}, {"role": "assistant", "content": "Put an array of degrees in the pattern, use \\strum to spread the chord, and the default instrument\nplays all notes of each event.\n\n```supercollider\n(\nPbind(\n \\scale, Scale.minor,\n \\root, 2,\n \\degree, Pseq([[0, 4, 7], [-3, 0, 4], [-5, -1, 2], [0, 4, 7]], inf),\n \\dur, 1.5,\n \\strum, 0.02,\n \\amp, 0.12,\n \\legato, 0.9\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// without any modification, convert FFT chain (frequency domain signal) back to audio (time domain signal)\n(\n{ var in, chain;\n in = WhiteNoise.ar;\n chain = FFT(LocalBuf(2048), in);\n IFFT.ar(chain) * -20.dbamp // inverse FFT\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// without any modification, convert FFT chain (frequency domain signal) back to audio (time domain signal)\n(\n{ var in, chain;\n in = WhiteNoise.ar;\n chain = FFT(LocalBuf(2048), in);\n IFFT.ar(chain) * -20.dbamp // inverse FFT\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `PrettyPrintStream.storeArgs` do? What arguments does it take?"}, {"role": "assistant", "content": "a CollStream subclass that supports indenting with tabs Arguments: args; itemsPerLine."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for radio static with tuning noise (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"radiostatic\", {arg out=0;\n var hum, sineSweep, tuning, dustNoise, staticNoise, humFreq, numHarms;\n \n numHarms = 7;\n humFreq = 100;\n hum = Array.fill(numHarms, {|i| SinOsc.ar( (i+1) * humFreq, 0, 1/numHarms)});\n hum = hum.sum;\n dustNoise = Dust.ar(LFNoise1.ar(0.5).range(1000,8000));\n staticNoise = hum * dustNoise * LFNoise1.ar(1).range(0.5, 2);\n \n sineSweep = SinOsc.ar(LFNoise2.ar(1).range(20, 11000));\n tuning = SinOsc.ar(10000).ring4(sineSweep) * LFNoise2.ar(1.1).range(0.05, 0.1);\n\n Out.ar(out, Pan2.ar(staticNoise + tuning, 0));\n}).add;\n);\n \na = Synth(\"radiostatic\");\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `OSCFuncBothMessageMatcher` in SuperCollider briefly."}, {"role": "assistant", "content": "OSCFuncBothMessageMatcher — Matches incoming messages to responder funcs based on receive port and sender address This is used by OSCMessageDispatcher and OSCMessagePatternDispatcher to match incoming OSC messages to instances of OSCFunc or OSCdef using receive port and sender address. This class is private, and generally users should not need to address instances directly. Category: External Control > OSC > Matchers."}]} -{"conversations": [{"role": "user", "content": "What does `PatternProxy.defaultQuant` do?"}, {"role": "assistant", "content": "set the default quantization value for the class. (default:"}]} -{"conversations": [{"role": "user", "content": "What does `Method.ownerClass` do?"}, {"role": "assistant", "content": "Code that implements an operation upon instances of a Class. Returns: The Class for which the method is part of the implementation."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// won't work (the output is 0.5*0.0), which is why we need the DC UGen!\n{ 0.5 }.play\n\n// constantly zero\n{ DC.ar(0.0) }.play;\n\n\n// DC offset; will click on start and finish\n{ DC.ar(0.5) + SinOsc.ar(440, 0, 0.1) }.play;\n\n\n// test - note the transient before LeakDC adapts and suppresses the offset\n{ LeakDC.ar(DC.ar(0.5) }.play;\n\n\n// show scope\ns.scope\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// won't work (the output is 0.5*0.0), which is why we need the DC UGen!\n{ 0.5 }.play\n\n// constantly zero\n{ DC.ar(0.0) }.play;\n\n\n// DC offset; will click on start and finish\n{ DC.ar(0.5) + SinOsc.ar(440, 0, 0.1) }.play;\n\n\n// test - note the transient before LeakDC adapts and suppresses the offset\n{ LeakDC.ar(DC.ar(0.5)) }.play;\n\n\n// show scope\ns.scope\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar f;\n\n// define a function\nf = { |x, y, z| [x, y, z].postln };\n\nEnvironment.use({\n ~x = 7;\n ~y = 8;\n ~z = 9;\n\n f.valueEnvir(1, 2, 3); // all values supplied\n f.valueEnvir(1, 2); // z is looked up in the current Environment\n f.valueEnvir(1); // y and z are looked up in the current Environment\n f.valueEnvir; // all arguments are looked up in the current Environment\n f.valueEnvir(z: 1); // x and y are looked up in the current Environment\n});\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar f;\n\n// define a function\nf = { |x, y, z| [x, y, z].postln };\n\nEnvironment.use({\n ~x = 7;\n ~y = 8;\n ~z = 9;\n\n f.valueEnvir(1, 2, 3); // all values supplied\n f.valueEnvir(1, 2); // z is looked up in the current Environment\n f.valueEnvir(1); // y and z are looked up in the current Environment\n f.valueEnvir; // all arguments are looked up in the current Environment\n f.valueEnvir(z: 1); // x and y are looked up in the current Environment\n});\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `QuadL`."}, {"role": "assistant", "content": "```supercollider\n// logistic map\n// equation: x1 = -r*x0^2 + r*x0\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n QuadL.ar(SampleRate.ir/4, r.neg, r, 0, 0.1) * 0.4;\n}.play(s);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `MxUnit.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Container for a musical object (Instr, NDef, Spline etc); this is a single unit that has inlets and outlets which can be connected to other units Arguments: source; inlets; outlets."}]} -{"conversations": [{"role": "user", "content": "What does `EnvelopeView.drawRects` do? What arguments does it take?"}, {"role": "assistant", "content": "Whether to draw the Arguments: A Boolean.."}]} -{"conversations": [{"role": "user", "content": "Can you listen to the sound you generate?"}, {"role": "assistant", "content": "No. I am 198M parameters trained on SuperCollider's documentation and class library; I have no audio input and no way to hear a result. What I can do is reason about the code: whether it reaches an output bus, whether the envelope will ever open, whether a filter at that cutoff leaves anything audible. Treat my patches as a starting point you listen to, not as a judgement about how they sound."}]} -{"conversations": [{"role": "user", "content": "What is `IdentitySet`?"}, {"role": "assistant", "content": "IdentitySet — a set according to identity"}, {"role": "user", "content": "What does `IdentitySet.add` do?"}, {"role": "assistant", "content": "Add anObject to the IdentitySet. An object which is equal to an object already in the IdentitySet will not be added. `IdentitySet[1, 2, 3].add(4);`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nIdentitySet[1, 2, 3].add(4);\nIdentitySet[1, 2, 3].add(3);\n// the two strings are equal but not identical\nIdentitySet[\"abc\", \"def\", \"ghi\"].add(\"def\");\n// symbols are guaranteed to be identical if they are equal\nIdentitySet['abc', 'def', 'ghi'].add('def');\nIdentitySet['abc', 'def', 'ghi'].add('jkl');\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\n(\n// trig with MouseY\nSynthDef(\"help-randWipe\", { |out = 0|\n var inA, chainA, inB, chainB, chain;\n inA = Mix.arFill(6, { LFSaw.ar(exprand(400, 1000), 0, 0.1) });\n inB = Mix.arFill(6, { LFPulse.ar(exprand(80, 400), 0, 0.2, SinOsc.kr(8.0.rand, 0, 0.2).max(0)) });\n chainA = FFT(LocalBuf(2048), inA);\n chainB = FFT(LocalBuf(2048), inB);\n chain = PV_RandWipe(chainA, chainB, MouseX.kr.poll, MouseY.kr\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\n(\n// trig with MouseY\nSynthDef(\"help-randWipe\", { |out = 0|\n var inA, chainA, inB, chainB, chain;\n inA = Mix.arFill(6, { LFSaw.ar(exprand(400, 1000), 0, 0.1) });\n inB = Mix.arFill(6, { LFPulse.ar(exprand(80, 400), 0, 0.2, SinOsc.kr(8.0.rand, 0, 0.2).max(0)) });\n chainA = FFT(LocalBuf(2048), inA);\n chainB = FFT(LocalBuf(2048), inB);\n chain = PV_RandWipe(chainA, chainB, MouseX.kr.poll, MouseY.kr.poll > 0.5);\n Out.ar(out, 0.5 * IFFT(chain).dup);\n}).play(s);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\n(\n{\n var in, chain;\n in = WhiteNoise.ar(0.2);\n chain = FFT(LocalBuf(2048), in);\n chain = PV_BrickWall(chain, SinOsc.kr(0.1));\n IFFT(chain);\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\n(\n{\n var in, chain;\n in = WhiteNoise.ar(0.2);\n chain = FFT(LocalBuf(2048), in);\n chain = PV_BrickWall(chain, SinOsc.kr(0.1));\n IFFT(chain);\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `RedWorld1` in SuperCollider?"}, {"role": "assistant", "content": "RedWorld1 — world without walls (non wrapping) See also RedWorld, RedWorld2, RedWorld3. Category: Red > redUniverse."}]} -{"conversations": [{"role": "user", "content": "What is `AbstractFunction`?"}, {"role": "assistant", "content": "AbstractFunction — An object which responds to a set of messages that represent mathematical functions"}, {"role": "user", "content": "What does `AbstractFunction.neg` do?"}, {"role": "assistant", "content": "`a = { 10.rand.postln }; b = a.neg; b.value;`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na = { |x, root = 60| x + root }; b = a.midicps; [a.value(9), b.value(9)];\na = Pseries(60, 1, inf).midicps; a.asStream.nextN(12);\n{ a = LFNoise1.ar(1) * 5 + 60; Pulse.ar(a.round.midicps) * 0.1 }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `CampCutProc.chooseblock` do?"}, {"role": "assistant", "content": "this uses the setoffset method of BBCutSynth to specify offset jumps relative to the current phrase size. In normal use phrasesize will be the same as the beat length of the source you wish to permute. Note that sources which don't respond to setoffset will not be effected by CampCutProc except for any enveloping/panning etc caused by"}]} -{"conversations": [{"role": "user", "content": "I get 'Node not found' when I call .set on a Synth after a while."}, {"role": "assistant", "content": "The Synth was freed and the language still holds a reference. That happens whenever the SynthDef used `doneAction: 2` and the envelope finished, or when something called `freeAll`/`CmdPeriod`. Guard it with `if (x.notNil and: { x.isPlaying }) { x.set(\\freq, 300) }`, or store the node in a variable that you clear when it ends. For sustained sounds the right pattern is a `gate` argument with `doneAction: 2` on the EnvGen, so the node lives until you release it."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `IdentitySet`."}, {"role": "assistant", "content": "```supercollider\nIdentitySet[1, 2, 3].add(4);\nIdentitySet[1, 2, 3].add(3);\n// the two strings are equal but not identical\nIdentitySet[\"abc\", \"def\", \"ghi\"].add(\"def\");\n// symbols are guaranteed to be identical if they are equal\nIdentitySet['abc', 'def', 'ghi'].add('def');\nIdentitySet['abc', 'def', 'ghi'].add('jkl');\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for simple melody algorithmically generated with a Markov Chain."}, {"role": "assistant", "content": "```supercollider\n/* Markov Chain Experiment II\n Jacob Joaquin\n\n Get a visual representation of the Markov Chain here:\n http://codehop.com/supercollider-markov-chain/\n*/\n\n(\n// Synthesizer\nSynthDef(\\my_synth, {|dur = 1.0, amp = 1.0, freq = 440|\n var env = EnvGen.ar(Env.new([1, 0.1, 0], [0.06, dur - 0.06]), doneAction: 2);\n Out.ar([0, 1], SinOsc.ar([freq * 0.995, freq * 1.005], 0, env * amp))\n}).add; \n\n// Create task\nt = Task({\n // Set attributes of each node\n // [freq, dur, [[next_state, weighted_random],…]]\n var node_list = [\n [60, 1, [[1, 2]]],\n [62, 0.5, [[0, 1], [2, 1]]],\n [63, 1, [[0, 1], [3, 1]]],\n [65, 0.5, [[0, 1], [3, 4], [4, 1]]],\n [67, 1, [[5, 1]]],\n [70, 1.5, [[4, 1], [6, 2]]],\n [69, 1, [[4, 1], [7, 2]]],\n [72, 0.5, [[4, 1], [7, 4], [0, 2]]]\n ];\n\n var node_index = 0;\n var bps = 133.0 / 60.0; // Beats per second\n \n inf.do({\n var weight = 0;\n var random;\n var accumulator;\n var node = node_list[node_index]; \n var freq = node[0].midicps;\n var dur = node[1] / bps;\n var paths = node[2];\n \n // Get total statistical weight of connected nodes\n (0 .. paths.size - 1).do {|i| weight = weight + paths[i][1]};\n \n // Generate random value for choosing next node\n random = weight.rand;\n\n // Choose next node based on statistical weights\n accumulator = paths[0][1];\n \n node_index = block {|break|\n paths.size.do {|i|\n if ((random < accumulator), {\n break.value(paths[i][0])\n }, {\n accumulator = accumulator + paths[i + 1][1] \n })\n }\n };\n \n // Play\n Synth(\\my_synth, [\\dur, dur, \\amp, -3.dbamp, \\freq, freq]); \n dur.wait;\n })\n});\n\nt.start;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `IdentityBag.add` do?"}, {"role": "assistant", "content": "Add anObject to the Bag. A Bag may contain multiple entries of the same object. `IdentityBag[1, 2,"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for aurora borealis?"}, {"role": "assistant", "content": "```supercollider\n(\n~root = -13;\n~revSend = Bus.audio(s, 2);\n);\n(\ns.waitForBoot(\n {\n \n SynthDef(\\bell, {\n |\n freq=556, findex=0, frate=2,\n dur=5, pos=0,\n amp=0.25,\n out=0\n |\n var sigA, sigB, sigC, sig, env, fmod;\n env = EnvGen.ar(Env.triangle(5), doneAction:2);\n fmod = findex * SinOsc.kr(frate, mul:0.5, add:0.5) * Line.kr(0, 1, 7);\n sigA = Pulse.ar(freq + fmod, LFNoise2.kr(1).range(0.2, 0.8) );\n sigB = VarSaw.ar(freq + fmod);\n sigC = WhiteNoise.ar() * 0.125;\n sig = SelectX.ar(LFNoise2.kr(2).range(0, 2), [sigA, sigB, sigC]);\n sig = LPF.ar(sig, freq*4 );\n sig = sig * env * amp;\n Out.ar(out, Pan2.ar(sig, pos));\n }).add;\n\n s.sync;\n\n SynthDef(\\rev, {\n arg in=0, out=0, mix=1, room=0.8;\n var sig;\n sig = In.ar(in, 2);\n sig = FreeVerb.ar(sig, mix, room);\n Out.ar(out, sig);\n }).add;\n\n s.sync;\n\n ~rev = Synth(\\rev, [\\in, ~revSend]);\n\n x = Pbind(\n \\instrument, \\bell,\n \\out, ~revSend,\n \\root, Pfunc({~root}),\n \\octave, Pwrand([4, 5, 6, 7], [6,8,3,1].normalizeSum, inf),\n \\degree, Prand(Scale.lydian.degrees, inf),\n \\ctranspose, Pwhite( -0.05, 0.05, inf),\n \\amp, 1.1 * Pexprand(0.001, 0.7) * (1/(Pkey(\\octave)+1)),\n \\findex, Pexprand(2, 20),\n \\frate, Pwhite(1, 25, inf),\n \\pos, Pwhite(-0.8, 0.8, inf),\n \\dur, Pwhite(0.1, 0.5),\n ).asEventStreamPlayer;\n x.play;\n\n wait(15);\n r = Routine({\n \"starting\".postln;\n loop({\n ~root = [-13, -1, 4, 7].choose;\n wait( 10.rrand(25) );\n });\n });\n r.play;\n});\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `MostChange`."}, {"role": "assistant", "content": "```supercollider\n(\nd = SynthDef(\"help-MostChange\", { |out, amp = 1.0|\n var sound, in1, in2;\n in1 = LFNoise1.ar(800, amp);\n in2 = SinOsc.ar(800);\n sound = MostChange.ar(in1, in2) * 0.1;\n Out.ar(out, sound)\n}).play;\n);\n\nd.set(\\amp, 0.1);\nd.set(\\amp, 0);\nd.set(\\amp, 3);\nd.free;\n\n// the control that changed most is used for output:\n\n(\nd = SynthDef(\"help-MostChange\", { |out, freq = 440|\n var sound, internalFreq;\n internalFreq = LFNoise0.ar(0.3, 300, 800);\n sound = SinOsc.ar(\n MostChange.kr(freq, internalFreq)\n );\n Out.ar(out, sound * 0.1)\n}).play;\n);\n\nd.set(\\freq, 800);\nd.set(\\freq, 800); // nothing changed\nd.set(\\freq, 900);\nd.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nMIDIIn.connectAll;\n// MIDIClient.init;\n\n\n(\n// A SynthDef with ADSR envelope\nSynthDef(\"quick2\", {arg freq = 440, amp = 0.1, gate = 1;\n var snd, env;\n env = Env.adsr(0.01, 0.1, 0.3, 2, amp).kr(2, gate);\n snd = Saw.ar(freq: [freq, freq*1.5], mul: env);\n Out.ar(0, snd)\n}).add;\n);\n\n// Play it with a MIDI keyboard\n(\nvar noteArray = Array.newClear(128); // array has one slot per possible MIDI note\n\nMIDIdef.noteOn(\\myKeyDown, {arg vel, note;\n noteArray[note] = Synth(\"quick2\", [\\freq, note.midicps, \\amp, vel.linlin(0, 127, 0, 1)]);\n [\"NOTE ON\", note].postln;\n});\n\nMIDIdef.noteOff(\\myKeyUp, {arg vel, note;\n noteArray[note].set(\\gate, 0);\n [\"NOTE OFF\", note].postln;\n});\n)\n// PS. Make sure SC MIDI connections are made (MIDIIn.connectAll)\n```"}, {"role": "assistant", "content": "Basic example - how to use a MIDI keyboard with a simple synth."}]} -{"conversations": [{"role": "user", "content": "What does `EZRanger.action` do?"}, {"role": "assistant", "content": "Set/get a Function or FunctionList to be evaluated when the value changes. The first argument will be the"}]} -{"conversations": [{"role": "user", "content": "What does Splay.ar do?"}, {"role": "assistant", "content": "`Splay.ar(inArray, spread, level, center, levelComp)` takes an array of mono signals and distributes them across the stereo field, so `Splay.ar(SinOsc.ar([220, 330, 440]) * 0.1)` is a three-source stereo chord rather than three separate synths. spread (0..1) controls how far the voices fan out and center shifts the middle. It is the shorthand for 'make this array stereo'."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// \\b should thus take twice the value of \\a in each event:\np = Pbind(\\a, Pwhite(1, 10, inf), \\b, Pkey(\\a) * 2).asStream;\n\n\np.next(()) // for Pbind, must pass in a default event even if empty\n\n('a': 10, 'b': 20)\n('a': 2, 'b': 4)\n('a': 5, 'b': 10)\n('a': 4, 'b': 8)\n('a': 2, 'b': 4)\n\n// note: to check if a Pkey's result /equals/ another value,\n// be sure to use |==|\np = Pbind(\n \\a, Pseries(1, 1, inf),\n \\b, Pif(\n Pkey(\\a) == 2,\n \"equals 2\",\n \"nope\"\n )\n).asStream;\n\np.next(());\n// …\n```"}, {"role": "assistant", "content": "\\b should thus take twice the value of \\a in each event: note: to check if a Pkey's result /equals/ another value, (Pkey: access a key in an event stream)"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n(\nx = Pbind(\\midinote, Pseries(60, 1, 10), \\dur, 0.5).asStream;\ny = Pbind(\\midinote, Pseries(90, -1, 10), \\dur, 0.5).asStream;\n\nz = Pseq([2, 3, 1, 2], 1).asStream;\n\n~a = Pfuncn({ x.next(()) }, { z.next });\n~b = Pfuncn({ y.next(()) }, { z.next });\n\nPsymNilSafe(Pseq(\"ab\", inf)).trace.play;\n\n// shorter with method 'symplay':\n// trace indicates all events with delta = 0 (maxNull\n// …\n```"}, {"role": "assistant", "content": "shorter with method 'symplay': trace indicates all events with delta = 0 (maxNull = 128) in the post window (PsymNilSafe: Psym variant that avoids hangs if all referenced patterns return nil)"}]} -{"conversations": [{"role": "user", "content": "What does `ServerLogSentEvent.matchSynthDef` do? What arguments does it take?"}, {"role": "assistant", "content": "internal usage Arguments: defName. Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "What does `XLine.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Exponential line generator. Arguments: start — Starting value.; end — Ending value.; dur — Duration in seconds.; mul — Output will be multiplied by this value.; add — This value will be added to the output.; doneAction — A doneAction to be evaluated when the line is completed. See."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `XFade2`."}, {"role": "assistant", "content": "```supercollider\n{ XFade2.ar(Saw.ar, SinOsc.ar, LFTri.kr(0.1)) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nt = TempoClock(120/60).permanent_(true);\n\n(\n~change_clock_tempo = {|clock, tempo, beats=1|\n beats.do {|beat|\n var stepTempo = beat.linexp(0, beats-1, clock.tempo, tempo);\n clock.schedAbs(clock.nextBar + beat, {\n \"New Tempo: \".post; (stepTempo*60).post; \" BPM\".postln;\n clock.tempo_(stepTempo);\n });\n };\n nil;\n};\nPbindef(\\n,\n \\octave, 4,\n \\dur, 0.5,\n \\degree, Pseq((0..7), inf)\n).play(t, quant: 4);\n);\n\n~change_clock_tempo.value(t, 200/60, 16);\n~change_clock_tempo.value(t, 50/60, 8);\nt.tempo*60\n```"}, {"role": "assistant", "content": "This gradually changes the tempo of a TempoClock, each beat of a specified number of beats, and starting at the next bar.\r\n\r\n\r\nPersonally, I was not able to heavily distinguish between `.linlin` and `.linexp` for reasonable musical tempos.\r\n\r\n\r\nThere may be a mathematically smoother way of handling this at the control rate.\r\n\r\n\r\nThis function does not gracefully handle multiple simultaneous invoca."}]} +{"conversations": [{"role": "user", "content": "What is `FFTSlope` in SuperCollider?"}, {"role": "assistant", "content": "FFTSlope — Spectral slope Given an FFT chain, this measures the spectral slope, which is the slope of the linear correlation line derived from the spectral magnitudes. Category: UGens > Analysis, UGens > FFT."}]} +{"conversations": [{"role": "user", "content": "What is `SequenceableCollection`?"}, {"role": "assistant", "content": "SequenceableCollection — Abstract superclass of indexable collections"}, {"role": "user", "content": "What does `SequenceableCollection.series` do?"}, {"role": "assistant", "content": "Fill a SequenceableCollection with an arithmetic series. `Array.series(5, 10, 2);`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// using numbers as score\n[3, [1, 2, 1], 1].convertRhythm; // List[0.75, 1.5, 0.75]\n[2, [1, 3, [1, [2, 1, 1, 1]], 1, 3], 1].convertRhythm;\n[2, [1, [1, [2, 1, 1, 1]]], 1].convertRhythm;\n[2, [1, [1, [2, 1, 1, 1]]], 2].convertRhythm; // repeat\n[2, [1, [1, [2, 1, 1, -1]]], 2].convertRhythm; // negative value is tied over.\n\n// sound example\nPbind(\\degree, Pseries(0, 1, inf), \\dur, Pseq([2, [1, [1, [2, 1, 1, -1]]], 2].convertRhythm)).play;\n```"}]} {"conversations": [{"role": "user", "content": "What is `Dictionary`?"}, {"role": "assistant", "content": "Dictionary — associative collection mapping keys to values"}, {"role": "user", "content": "What does `Dictionary.new` do?"}, {"role": "assistant", "content": "Creates a Dictionary with an initial capacity for n key value mappings."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nd = Dictionary.new;\nd.add(\\monkey -> 0).postln;\nd.add(\\robot -> 1).postln; // Add robot as a key with a value of 1\nd.add(\\monkey -> 2).postln; // Replaces the value for the key monkey with 2\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes No Quarter pluck synth bass sound."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\bass, { |outbus, midinote = 42|\n var freq = midinote.midicps;\n var subfreq = freq / 2;\n \n // Envelopes\n var subenv = EnvGen.kr(Env.perc(0, 1), doneAction:2);\n var env = EnvGen.kr(Env.perc(0, 0.5));\n \n // Component synthesis\n var pluck = Pluck.ar(PinkNoise.ar, 1, 0.2, subfreq.reciprocal) * subenv * 2;\n var tri = VarSaw.ar(freq) * env;\n var sin = SinOsc.ar(freq) * env;\n var sub = (SinOsc.ar([subfreq, subfreq - 2, subfreq + 2]).sum * subenv).tanh;\n var click = RLPF.ar(Impulse.ar(0), [2000, 8000], 1).sum * 1000;\n \n // Initial signal\n var sig = pluck + tri + sub + click;\n \n // Resonant LPFs\n sig = RLPF.ar(sig, XLine.ar(freq * 100, freq * 10, 0.15));\n sig = sig + (MoogFF.ar(sig, freq * 20, 2.5) * 0.1);\n \n // EQ resulting signal\n sig = BPeakEQ.ar(sig, 400, 0.5, -9);\n sig = BPeakEQ.ar(sig, 2000, 0.5, 6);\n sig = BHiShelf.ar(sig, 8000, 1, 3);\n sig = BPeakEQ.ar(sig, 200, 1, 3);\n \n // Apply another envelope to dampen a bit more\n sig = sig * XLine.kr(1, 0.6, 0.1);\n \n // Tanh distortion / limiting\n sig = (sig * 1).tanh;\n \n // Another round of signal coloring, using another RLPF\n // and sine components\n sig = sig + RLPF.ar(sig, XLine.ar(freq * 100, freq * 10, 0.15)) + sin + sub;\n \n // Another round of tanh distortion / limiting\n sig = (sig / 2.3).tanh;\n \n // Another resonant LPF\n sig = MoogFF.ar(sig, XLine.ar(freq*150, freq*30, 0.1), 0.1);\n \n Out.ar(outbus, sig!2);\n}).add;\n);\n\n(\nTempoClock.default.tempo = 1.8;\n\nPbind(\n \\instrument, \\bass,\n \\midinote, Pseq([\n Pseq([Rest, 42, 42], 3),\n Pseq([Rest, 42, 42, 42]),\n Pseq([Rest, 42, 42], 3),\n Pseq([Rest, 45, 45, 42])\n ], inf),\n \\dur, Pseq([\n Pseq([0.75, 0.75, 0.5], 3),\n Pseq([0.5, 0.25, 0.75, 0.5])\n ], inf)\n).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for pitch tracker utility."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\\pitchTrack, {\n var soundin = SoundIn.ar(0);\n var zc = ZeroCrossing.ar(soundin);\n // var pt = Pitch.kr(soundin);\n // var tt = Tartini.kr(soundin);\n SendReply.kr(Impulse.kr(1), '/pitchTrackUtil', [zc, zc.cpsmidi]);\n}).add;\n\n~pitchTrack = {\n if(~pitchTrackSynth.isNil or: { ~pitchTrackSynth.isRunning.not }, {\n ~pitchTrackSynth = Synth(\\pitchTrack);\n ~pitchTrackNW = NodeWatcher.register(~pitchTrackSynth);\n }, {\n ~pitchTrackSynth.free;\n ~pitchTrackSynth = nil;\n \"Pitch tracker stopped.\".postln;\n });\n};\n\n~pitchTrackOSCFunc = {\n OSCFunc({\n | msg |\n (\"Pitch:\"+msg[3].round.asString.padLeft(5)+msg[4].round.asString.padLeft(3)).postln;\n }, '/pitchTrackUtil');\n};\n\n~pitchTrackOSCFunc.();\n\nCmdPeriod.add({~pitchTrackOSCFunc.();});\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// record: type some text\n(\nvar time = Main.elapsedTime;\na = List.new;\nr = Routine { |char|\nloop {\n a = a.add([char, Main.elapsedTime - time]);\n char = 0.yield;\n}\n};\n\nDocument.new(\"type some text\")\n .keyDownAction = { |doc, key| r.value(key) ; time = Main.elapsedTime };\n);\n\n// play back text in time\n(\nd = Document.new(\"type some text\");\nfork({\n a.do { |pair|\n d.string = d.string ++ pair[0];\n pair[1].wait;\n }\n}, AppClock)\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// record: type some text\n(\nvar time = Main.elapsedTime;\na = List.new;\nr = Routine { |char|\nloop {\n a = a.add([char, Main.elapsedTime - time]);\n char = 0.yield;\n}\n};\n\nDocument.new(\"type some text\")\n .keyDownAction = { |doc, key| r.value(key) ; time = Main.elapsedTime };\n);\n\n// play back text in time\n(\nd = Document.new(\"type some text\");\nfork({\n a.do { |pair|\n d.string = d.string ++ pair[0];\n pair[1].wait;\n }\n}, AppClock)\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Stream` in SuperCollider?"}, {"role": "assistant", "content": "Stream — Stream is the base class for classes that define streams Stream is an abstract class that is not used directly. The following attempts to document some aspects of the use of Streams for music generation. Category: Streams-Patterns-Events."}]} -{"conversations": [{"role": "user", "content": "Explain `SynthiX` in SuperCollider briefly."}, {"role": "assistant", "content": "SynthiX — A patching matrix for Mx inspired by the EMS Synthi A Category: Mx."}]} -{"conversations": [{"role": "user", "content": "What does `AbstractFunction.sqrt` do?"}, {"role": "assistant", "content": "`a = { |x| x + 1 }; b = a.sqrt; [a.value(1),"}]} -{"conversations": [{"role": "user", "content": "What does `PappliedInstr.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "partial application for Instr Arguments: ... args."}]} -{"conversations": [{"role": "user", "content": "What does `SymbolArray.readFromStream` do?"}, {"role": "assistant", "content": "an array whose indexed slots are all of the same type"}]} -{"conversations": [{"role": "user", "content": "Explain `FFTSpread` in SuperCollider briefly."}, {"role": "assistant", "content": "FFTSpread — Spectral spread Given an FFT chain, this measures the spectral spread, which is the magnitude-weighted variance. This measure can serve as an (approximate) clue towards the bandwidth of a signal (although the value is not a frequency). Category: UGens > Analysis, UGens > FFT."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Digital Bird sounds."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\birdy, {arg freq=1500, amp=0.5, rate=10;\n var osc, son, convIn, rand;\n osc=LFCub;\n rand = LFNoise1.ar(rate);\n convIn=LinCongN.ar(rate);\n son = osc.ar(Convolution.ar(convIn,convIn));\n freq = Latch.kr(rand.range(0,1).round(0.1), rand) * freq;\n freq = osc.ar(osc.ar(rand)*rand.range(0,10)).range(freq, freq*3);\n son = Formlet.ar(son, freq, convIn.abs*0.1, rand.abs);\n son = Normalizer.ar(son, 0.9, 0.1) * convIn.abs * LFPulse.kr(LFPulse.kr(rand.abs), 0, rand.abs);\n son = son + GVerb.ar(son, 99, 2, mul: rand.range(0,0.3));\n son * amp\n}).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Simple relaxing white noise generator simulating a seaside."}, {"role": "assistant", "content": "```supercollider\n// A.Broz: Waves & Surf (2020-10-29)\n\n/*\n _.====.._\n ,:._ ~-_\n `\\ ~-_\n | `.\n ,/ ~-_\n -..__..-'' ~~--..__...----...\n*/\n(\n~waves = {\n var noise = { WhiteNoise.ar(0.04 + LFNoise1.kr(0.3, 0.03)) };\n var motion = { LFNoise1.kr(0.2).exprange(100, 2000) };\n var hps = { HPF.ar(noise.value, 50) };\n var wave = { LPF.ar(hps.value, motion.value).tanh };\n var sig = wave!10;\n sig = Splay.ar(sig, 0.6).tanh;\n sig = sig * Line.kr(0, 1, 10); // fade in\n LeakDC.ar(sig);\n}.play;\n);\n\n~waves release: 10;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `PrintVal.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "debug assistance Arguments: in — input to sample (.kr rate); numblocks — print the value after this number of control periods (44100/64 is about 689 per second); id — give a tag to the printing so that you can use more than one in a patch to test multiple things."}]} -{"conversations": [{"role": "user", "content": "What is `Int32Array` in SuperCollider?"}, {"role": "assistant", "content": "Int32Array — an array whose indexed slots are all of the same type These classes implement arrays whose indexed slots are all of the same type. Category: Collections > Ordered."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// ZoomH2 records two stereo .wav files:\n// SRxxxF.wav\n// SRxxxR.wav\n// correct input for FoaEncoderMatrix.newZoomH2 is:\n\n~in = [ SRxxxR[0], SRxxxR[1], SRxxxF[0], SRxxxF[1] ]\n```"}, {"role": "assistant", "content": "ZoomH2 records two stereo .wav files: correct input for FoaEncoderMatrix.newZoomH2 is: (FoaEncoderMatrix: First Order Ambisonic (FOA) encoder matrices)"}]} -{"conversations": [{"role": "user", "content": "What does `KeyCodeResponder.guiClass` do?"}, {"role": "assistant", "content": "register responder functions for keycode and modifier combinations"}]} -{"conversations": [{"role": "user", "content": "What does `Squiz.kr` do? What arguments does it take?"}, {"role": "assistant", "content": "same as Arguments: in; pitchratio; zcperchunk; memlen; mul; add."}]} -{"conversations": [{"role": "user", "content": "Explain `SeenBefore` in SuperCollider briefly."}, {"role": "assistant", "content": "SeenBefore — eliminates duplicates by saving a history of objects it has tested Most constraints do not have any state or internal variables. This one saves each object in a history list and returns false if it has already seen an object. Category: Libraries > crucial > Constraints."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Red alert."}, {"role": "assistant", "content": "```supercollider\n//Fig 58.7: Red alert\n//Complete patch, saw + second harmonic, resonators, distortion and post filters to create \n//fixed resonance. Contains the subpatch shown in fig 58.6.\n\n(\n SynthDef(\\red, {\n \n var env, redAlert, dfbe, aIn, bIn, cIn, aOut, bOut, cOut;\n \n # aIn, bIn, cIn = LocalIn.ar(7).clumps([5,1,1]);\n \n env = [\n EnvGen.ar(Env.new([0,1,1,0], [0.9, 0.3, 0.0])), \n EnvGen.ar(Env.new([0,1,1,0], [0.01, 0.88, 0.01]))\n ];\n env[0] = LFSaw.ar(env[0].sqrt * 487 + 360, 1, 0.5, 0.5);\n env[0] = (env[0] - 0.5) + ((env[0] * 2 * 2pi).cos * 0.3);\n redAlert = (env[0] - OnePole.ar(env[0], exp(-2pi * (1 * SampleDur.ir)))) * env[1];\n redAlert = redAlert + (cIn * 0.006) * 0.2;\n \n \n // fig 58.6: Delay feedback element\n dfbe = 0!6;\n redAlert = redAlert + (aIn * 0.7);\n 5.do{|i| dfbe[i] = DelayN.ar(redAlert[i], 0.1, [0.015, 0.022, 0.035, 0.024, 0.011][i])};\n aOut = dfbe[0..4]; \n \n redAlert = redAlert[0..4].sum;\n redAlert = (redAlert - OnePole.ar(redAlert, exp(-2pi * (12 * SampleDur.ir))));\n \n dfbe[5] = redAlert + (bIn * 0.7);\n dfbe[5] = DelayN.ar(dfbe[5], 0.1, 0.061);\n # bOut, cOut = dfbe[5]!2;\n LocalOut.ar(aOut ++ bOut ++ cOut);\n \n redAlert = Clip.ar(redAlert * 4, -1, 1);\n redAlert = BPF.ar(redAlert, [740, 1400, 1500, 1600], (12!4).reciprocal) ++ (redAlert * 0.5);\n Out.ar(0, (redAlert.sum * 0.2)!2);\n \n}).add;\n);\n \n// ALL HANDS!! BATTLESTATIONS!\ne = Synth(\\red);\n\n\n\n// code also available here: \n// http://en.wikibooks.org/wiki/Designing_Sound_in_SuperCollider/Red_alert\n```"}]} -{"conversations": [{"role": "user", "content": "What does `UGenInstr.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "converts a single UGen into an Instr eg. UGenInstr(RLPF) Arguments: ... args."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\"help-Dust\", { |out = 0|\n Out.ar(out,\n Dust.ar(200, 0.5)\n )\n}).play;\n);\n\n(\nSynthDef(\"help-Dust\", { |out = 0|\n Out.ar(out,\n Dust.ar(XLine.kr(20000, 2, 10), 0.5)\n )\n}).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\"help-Dust\", { |out = 0|\n Out.ar(out,\n Dust.ar(200, 0.5)\n )\n}).play;\n);\n\n(\nSynthDef(\"help-Dust\", { |out = 0|\n Out.ar(out,\n Dust.ar(XLine.kr(20000, 2, 10), 0.5)\n )\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Just experimenting with patterns."}, {"role": "assistant", "content": "```supercollider\n/* Some Funky Klangs - Totally botched the math on what I was trying to do but it sounds better this way */\n\n( \nSynthDef(\\DistKlangBlip, { \n | out = 0, release = 1, freq1 = 1, freq2 = 5, freq3 = 8, freqMult = 4 | \n var env = Linen.kr(Impulse.kr(0), 0.01, 1, release, doneAction:2); \n var freqs = ([freq1, freq2, freq3] * freqMult).midicps; \n var klang = Klang.ar(`[freqs, nil, nil ], 1, 0); \n Out.ar(out, klang.tanh!2 * env * 0.5) \n}).add\n\n);\n\n( \n Pbind(*[ \n instrument: \\DistKlangBlip, \n dur: Pxrand([0.25, 0.5], inf) * 0.5, \n release: Pkey(\\dur), \n freqMult: Pxrand((3..12), inf), \n freq2: Prand([4,5], inf), \n freq3: Prand([8,12], inf) \n]).play; \n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LinExp`."}, {"role": "assistant", "content": "```supercollider\n// compare:\n(\n{\n var mod = SinOsc.kr(Line.kr(1, 10, 10));\n SinOsc.ar(mod * 400 + 500) * 0.1\n}.play;\n);\n\n(\n{\n var mod = SinOsc.kr(Line.kr(1, 10, 10));\n SinOsc.ar(LinExp.kr(mod, -1, 1, 100, 900)) * 0.1\n}.play;\n);\n\n// modulating destination values.\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(LinExp.ar(mod, -1, 1, MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1))) * 0.1\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nTempoClock.default.tempo_(2);\n\n(\nBBCut2(CutGroup([CutStream1.new,CutMixer(0,1.0,{1.0.rand},{1.0.rand2})]), ChooseCutProc(0.25,4)).play\n);\n\n\n(\nBBCut2(CutGroup([CutStream1.new,CutMixer(0,1.0,RollAmplitude.new,CutPan1.new)]), WarpCutProc1(0.25,4)).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nTempoClock.default.tempo_(2);\n\n(\nBBCut2(CutGroup([CutStream1.new,CutMixer(0,1.0,{1.0.rand},{1.0.rand2})]), ChooseCutProc(0.25,4)).play\n);\n\n\n(\nBBCut2(CutGroup([CutStream1.new,CutMixer(0,1.0,RollAmplitude.new,CutPan1.new)]), WarpCutProc1(0.25,4)).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nSynthDef(\\bird,{\n var sig, freqenv, env, trig;\n trig = Dust.ar(2);\n env = EnvGen.ar(Env.perc(0.01,0.4,0.8,-8), trig, doneAction: 2);\n freqenv = EnvGen.ar(Env([Rand(1000,3000), Rand(3000,6000), Rand(1000,2000), Rand(2000,5000)],[0.1,0.01,0.1]);, trig);\n sig = SinOsc.ar(freqenv, 0, env);\n sig = Pan2.ar(sig, Rand(-1.0,1.0));\n Out.ar(0, sig);\n}).add;\n);\n\n(\nRoutine({\n inf.do({\n Synth(\\bird);\n rrand(1.0,2.0).wait;\n })\n}).play;\n)\n```"}, {"role": "assistant", "content": "I haven't found a quite satisfying code about birds, so here's a very simple SynthDef to start with."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LatoocarfianN`."}, {"role": "assistant", "content": "```supercollider\n// randomly modulate all params\n(\n{ LatoocarfianN.ar(\n SampleRate.ir/4,\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5)\n) * 0.2 }.play(s);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "How do I make an additive bell with Klank?"}, {"role": "assistant", "content": "Klank is a bank of resonant filters excited by a short impulse: you describe the partials as\nfrequencies, amplitudes and decay times.\n\n```supercollider\n(\nSynthDef(\\klank, { |out = 0, freq = 440, amp = 0.3|\n var ratios = [1, 2.2, 3.7, 5.1, 7.3];\n var decays = [4, 2.6, 1.8, 1.2, 0.8];\n var sig = Klank.ar(`[ratios * freq, nil, decays], Impulse.ar(0, 0, 0.2), 1, 0, 0.3);\n Out.ar(out, Pan2.ar(sig * amp, 0));\n}).add;\n);\nSynth(\\klank);\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `Henon2DN` in SuperCollider briefly."}, {"role": "assistant", "content": "Henon2DN — henon map 2D chaotic generator `y = b * x(n)` Category: UGens > Generators > Stochastic."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\nSynthDef(\\sine, { |freq = 400, amp = 0.1| Out.ar(0, SinOsc.ar(freq, mul: amp)) }).add;\nSynthDef(\\pulse, { |freq = 400, amp = 0.1| Out.ar(0, Pulse.ar(freq, mul: amp)) }).add;\n);\n\n(\nx = Synth(\\sine).register;\ny = Synth(\\pulse).register;\n);\n\n// pause pulse \n\ny.run(false);\n\n// VarGui checks state, definition is known, new Synths of same definition can be started\n\nv = VarGui(synth: [x,y]).gui;\n\n\n// With nodeIDs or non-regist\n// …\n```"}, {"role": "assistant", "content": "VarGui checks state, definition is known, new Synths of same definition can be started With nodeIDs or non-registered Synths VarGui demands addtional state info (VarGui: slider / player gui to set envir variables and synth controllers and play synths, event patterns and tasks)"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for strange device found in space )\r\n\r\np.s?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n Limiter.ar(HPF.ar(\n GVerb.ar(\n Pan2.ar(\n PMOsc.ar(\n Demand.kr(\n Impulse.kr(\n SinOsc.kr(SinOsc.kr(1/30).range(1/10, 1/15)).range(0, 25)\n * LFPulse.kr(0.2).range(0.5, 1)\n + \n LFDNoise3.kr(1/10, 10, 10)\n ), \n 0, \n Dxrand(Array.geom(100, 50, 1.06), inf) + Dgeom(1, 1.005)\n ),\n [[3,5],[7,11]] + SinOsc.ar([1/60, 1/45]).range(0, 1300),\n Demand.kr(\n Impulse.kr(SinOsc.kr(0.1).range(0.1, 20)),\n 0,\n Dxrand(Array.series(13, 0, 0.5), inf)\n )\n ).sum,\n SinOsc.ar(1, mul:0.5),\n LFPar.ar([1/5,1/3]).range(0.3, 1)\n ), \n 250, \n 0.5, \n damping:SinOsc.kr(1/20).range(0.2,0.7), \n drylevel: SinOsc.kr(1/15).range(0.2,0.7), \n earlyreflevel:0.3\n ) * 0.1\n +\n LFDNoise3.ar(SinOsc.kr(1/15, [0, pi/4]).range(100,350), 0.3),\n [SinOsc.ar(1/45, [0,pi/2]).range(20, 120)]\n ))\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n// Simple polling of mean values - you could do this without a UGen!\nx = {|val=1, t_trig=0| MeanTriggered.kr(val, t_trig, 3).poll(t_trig, \"Mean of recent 3 values\"); }.play;\nx.set(\\val, 10.rand.postln, \\t_trig, 1); // Execute this repeatedly\n\nx.free;\n\n// Using it as an audio filter - compare the sounds of these:\nx = {WhiteNoise.ar(0.1)}.play;\nx.free;\nx = {MeanTriggered.ar(WhiteNoise.ar(0.1), 1, 3)}.play; // Note that \".sum\" would be more efficient here...\nx.free;\nx = {MeanT\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n// Simple polling of mean values - you could do this without a UGen!\nx = {|val=1, t_trig=0| MeanTriggered.kr(val, t_trig, 3).poll(t_trig, \"Mean of recent 3 values\"); }.play;\nx.set(\\val, 10.rand.postln, \\t_trig, 1); // Execute this repeatedly\n\nx.free;\n\n// Using it as an audio filter - compare the sounds of these:\nx = {WhiteNoise.ar(0.1)}.play;\nx.free;\nx = {MeanTriggered.ar(WhiteNoise.ar(0.1), 1, 3)}.play; // Note that \".sum\" would be more efficient here...\nx.free;\nx = {MeanTriggered.ar(WhiteNoise.ar(0.1), 1, 11)}.play; // Note that \".sum\" would be more efficient here...\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SparseArray.reduceArray` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a new SparseArray holding the same data as array. `a = [4, 7, 4, 4, 4, 4, 4, 4, 9, 9, Arguments: array — Any ArrayedCollection.; default — The default value, i.e. the value that all slots should take at first. For best memory efficiency, you should supply the most common value found in the collection.."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Dwrand`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a, freq, trig;\n a = Dwrand([0, 1, 2, 7], [0.4, 0.4, 0.1, 0.1], inf).dpoll;\n trig = Impulse.kr(MouseX.kr(1, 400, 1));\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n//run one line at a time\nf= BBCutBuffer(Platform.resourceDir +/+ \"sounds/break.aiff\",8);\n\nPost << [\\length,f.length, \\beatlength, f.beatlength, \\events, f.eventstarts] << nl;\n\n\nf= BBCutBuffer.array([Platform.resourceDir +/+ \"sounds/break.aiff\",Platform.resourceDir +/+ \"sounds/break2.aiff\"],[8,4],[[0,10000],[3500,6700,9000]]);\n\nf.do({ arg val; Post << [\\length,val.length, \\beatlength, val.beatlength, \\events, val.eventstarts] << nl;\n// …\n```"}, {"role": "assistant", "content": "run one line at a time will only select playback positions from the events list given above, using an offset choice function (BBCutBuffer: A buffer in BBCut2)"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Tdef`."}, {"role": "assistant", "content": "```supercollider\nTdef(\\x).play; // create an empty Tdef and play it.\n\nTdef(\\x, { loop({ \"ggggggggggggggggg9999ggg999ggg999gg\".scramble.postln; 0.5.wait }) });\n\n\nTdef(\\x, { loop({ \"---------////----------------------\".scramble.postln; 0.25.wait }) });\nTdef(\\x, { loop({ thisThread.seconds.postln; 1.wait }) });\nTdef(\\x, { loop({ thisThread.seconds.postln; 1.01.wait }) });\n\nTempoClock.default.tempo = 2;\n\nTdef(\\x, { \"the end\".postln });\nTdef(\\x, { \"one more\".postln });\nTdef(\\x, { 10.do({ \"ten more\".scramble.postln; 0.25.wait }) });\nTdef(\\x, { loop({ \"lots more\".scramble.postln; 0.25.wait }) });\n\nTempoClock.default.tempo = 1;\n\nTdef(\\x).stop;\nTdef(\\x).play;\n\nTdef(\\x).clear;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Change arg values of MIDIdef after instantiation."}, {"role": "assistant", "content": "```supercollider\n~mdef =\n{\n |key, func, msgNum, permanent = true|\n\n MIDIdef(key, func ?? { MIDIdef(key).func }, msgNum ? MIDIdef(key).msgNum, MIDIdef(key).chan, MIDIdef(key).msgType, MIDIdef(key).srcID).permanent_(permanent)\n}\n```"}]} -{"conversations": [{"role": "user", "content": "Resetting start count with PulseDivider?"}, {"role": "assistant", "content": "SuperCollider forum — Resetting start count with PulseDivider?\n\ni think in your example Sweep is receiving a trigger while going from 0 to 1 causing the discontinuity in the phase because the duration between one trigger and the next is unknown.\n\nwith this example you get at least a continiuous phase with random triggers to drive the hanning window (evaluate it several times). but its not multichannel with distributed phases / windows accross channels:\n\n```supercollider\n(\nvar randomTrigPhase = { |triggerRate = 10, randomness = 1|\n var minDuration = (2 ** randomness) / triggerRate;\n var maxDuration = (2 ** (-1 * randomness)) / triggerRate;\n var demand = Dunique(minDuration * ((maxDuration / minDuration) ** Dwhite(0, 1)));\n var duration = Duty.ar(demand, DC.ar(0), demand);\n var phase = Phasor.ar(DC.ar(0), (1 / duration) / SampleRate.ir, 0, 1);\n (phase: phase, trigger: HPZ1.ar(phase) < 0);\n};\n\nvar hanningWindow = { |phase|\n (1 - (phase * 2pi).cos) / 2 * (phase < 1);\n};\n\n{\n var rate = 100;\n var phase = randomTrigPhase.(rate, 1).phase;\n hanningWindow.(phase);\n}.plot(0.1);\n)\n```\n\nim not sure if this is helping it just reminded me of some issue with multichannel random triggers and continiuous phases i have been trying to solve."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nServer.local.quit; // If server running, need to stop it for this example\n\n// We'll modify the server boot procedure to set our env var...\n~realserverprogram = Server.program;\nServer.program = \"export PANCREAS=220;\" + Server.program\ns.boot;\n\n(\nx = {\n// Env var specifies frequency.\n// If you change the env var name to one that isn't set, 440 is used.\nSinOsc.ar(Getenv(\\PANCREAS, 440), 0, 0.1);\n}.play(Server.local);\n;\nx.free;\n\n// This should restore the variable to what it was\nServer.program = ~realserverprogram;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nServer.local.quit; // If server running, need to stop it for this example\n\n// We'll modify the server boot procedure to set our env var...\n~realserverprogram = Server.program;\nServer.program = \"export PANCREAS=220;\" + Server.program\ns.boot;\n\n(\nx = {\n// Env var specifies frequency.\n// If you change the env var name to one that isn't set, 440 is used.\nSinOsc.ar(Getenv(\\PANCREAS, 440), 0, 0.1);\n}.play(Server.local);\n);\nx.free;\n\n// This should restore the variable to what it was\nServer.program = ~realserverprogram;\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Modulating GVerb roomsize, among other things?"}, {"role": "assistant", "content": "```supercollider\nNdef(\\b, { LFDNoise0.ar(500)});\nNdef(\\c, { LFDNoise1.ar(0.3).range(5,15)});\nNdef(\\d, { LFDNoise3.ar(SinOsc.kr(0.1, 0, 1000, 300), 200, 200)});\nNdef(\\a, { Limiter.ar(GVerb.ar(SinOsc.ar(Ndef(\\d), mul: Ndef(\\b)), roomsize: Ndef(\\c) ) )});\nNdef(\\a).play;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\ns.boot;\n(\n// send a synth def to server\nSynthDef(\"tpulse\", { |out = 0, freq = 700, sawFreq = 440.0|\n Out.ar(out, SyncSaw.ar(freq, sawFreq, 0.1));\n}).add;\n);\n\n// Here the defaults for *new will result in a Synth at the head of the default group\n// of the default Server. This will use the SynthDef's default arguments;\ny = Synth.new(\"tpulse\");\ny.free;\n\n// The same done explicitly\ny = Synth.new(\"tpulse\", nil, s, \\addToHead);\ny.free;\n\n// With some arguments\ny = Synth.new(\"tpulse\", [\\freq\n// …\n```"}, {"role": "assistant", "content": "send a synth def to server Here the defaults for *new will result in a Synth at the head of the default group (Synth: Client-side representation of a synth node on the server)"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for SOUND 1, from orig Influx Example."}, {"role": "assistant", "content": "```supercollider\n// SOUND 1, from orig Influx Example\n(\n// // // if JITLibExtensions are used, you can make space local:\n// Ndef(\\dog).addSpec(\\intv, [-24, 24]);\n// Ndef(\\dog).addSpec(\\timescale, [0.01, 10, \\exp]);\n// Ndef(\\dog).addSpec(\\curve, [-10, 10]);\n// Ndef(\\dog).addSpec(\\ffreq, \\freq);\n//\n// Ndef(\\dog).addSpec(\\loopnode, [0, 12]);\n// Ndef(\\dog).addSpec(\\dens, [10, 1000, \\exp]);\n// Ndef(\\dog).addSpec(\\resfreq, \\freq);\n// Ndef(\\dog).addSpec(\\ringtime, [0.01, 1, \\exp]);\n\nSpec.add(\\intv, [-24, 24]);\nSpec.add(\\timescale, [0.01, 10, \\exp]);\nSpec.add(\\curve, [-10, 10]);\nSpec.add(\\ffreq, \\freq);\n\nSpec.add(\\loopnode, [0, 12]);\nSpec.add(\\dens, [10, 1000, \\exp]);\nSpec.add(\\resfreq, \\freq);\nSpec.add(\\ringtime, [0.01, 1, \\exp]);\n\n\nNdef(\\dog, { |amp=0, freq=250, intv=19, timescale=1, curve=0, loopnode=0, dens = 10, resfreq = 500, ringtime = 0.01|\n var n = 15;\n var env = EnvGen.kr(\n Env({ 1.0.rand2 }!(n+1), {1.0.rand}!n, curve, releaseNode: n-1, loopNode: loopnode.min(n-3)),\n timeScale: timescale);\n var pitch = (env * [1, 0.33, -1] * intv).midiratio * freq;\n var form = Formant.ar(pitch, pitch.rotate(1) * 1.6, pitch.rotate(2) * 2.6);\n\n var dusty = Ringz.ar(\n Dust.ar(dens!3),\n resfreq * LFNoise0.kr([3, 5, 7], 0.5, 1),\n ringtime)\n * ((dens ** -0.5) * (ringtime ** -0.3)\n );\n\n Splay.ar(form * dusty, level: amp) ;\n});\n);\n\nNdef(\\dog).set(\\amp, 0.2).vol_(0.2);\nNdef(\\dog).gui.moveTo(400, 380);\n\n/*\n// Ndef(\\dog).addHalo(\\orderedNames, Ndef(\\dog).controlKeys);\nNdef(\\dog).controlKeys;\nNdef(\\dog).vol_(0.5);\nNdefPreset( Ndef(\\dog) ).loadSettings;\nNdef(\\dog).play;\nNdef(\\dog).gui;\n*/\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `TExpRand`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var trig = Dust.kr(10);\n SinOsc.ar(\n TExpRand.kr(300.0, 3000.0, trig)\n ) * 0.1\n}.play;\n);\n\n(\n{\n var trig = Dust.ar(MouseX.kr(1, 8000, 1));\n SinOsc.ar(\n TExpRand.ar(300.0, 3000.0, trig)\n ) * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `LinRand` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-LinRand\", { |out = 0, minmax = 1|\n Out.ar(out,\n FSinOsc.ar(\n LinRand(200.0, 10000.0, minmax),\n 0, Line.kr(0.2, 0, 0.01, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n// towards hi\n(\nRoutine({\n loop({\n Synth.new(\"help-LinRand\"); 0.04.wait;\n })\n}).play;\n);\n\n// towards lo (doesn't work like that yet)\n(\nRoutine({\n loop({\n Synth.new(\"help-LinRand\", [\\minmax, -1]); 0.04.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SynthiX.refresh` do?"}, {"role": "assistant", "content": "refresh the view. Also updates any values (the little yellow Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Env`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var env = Env([0.0, 0.5, 0.0, 1.0, 0.9, 0.0], [0.05, 0.1, 0.01, 1.0, 1.5], -4);\n var envgen = EnvGen.ar(env, doneAction: Done.freeSelf);\n env.plot;\n SinOsc.ar(\n envgen * 1000 + 440\n ) * envgen * 0.1\n}.play\n);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `SharedIn`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n// only works with the internal server\ns = Server.internal;\ns.boot;\n);\n\n(\nSynthDef(\"help-SharedIn1\", {\n Out.ar(0, SinOsc.ar(Lag.kr(SharedIn.kr(0, 1), 0.01), 0, 0.2));\n}).add;\nSynthDef(\"help-SharedIn2\", {\n Out.ar(1, SinOsc.ar(Lag.kr(SharedIn.kr(0, 1), 0.01, 1.5), 0, 0.2));\n}).add;\n);\n\n(\ns.setSharedControl(0, 300); // an initial value\ns.sendMsg(\\s_new, \"help-SharedIn1\", x = s.nextNodeID, 0, 1);\ns.sendMsg(\\s_new, \"help-SharedIn2\", y = s.nextNodeID, 0, 1);\n\nRoutine({\n 30.do({\n s.setSharedControl(0, 300 * (10.rand + 1));\n 0.2.wait;\n });\n s.sendMsg(\\n_free, x);\n s.sendMsg(\\n_free, y);\n}).play;\n);\n\n\ns.quit;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n \n// definition for future reference in arbitrary Environments,\n// Poisson distribution gives positive integer values\n\n(\np = Pbind(\n \\midinote, (PLpoisson(\\mean) + 50).clip(60, 90),\n \\dur, 0.1\n);\n);\n\n\n// prepare current Environment\n\n~mean = 10;\n\n\n// run\n\nx = p.play;\n\n\n// changing mean value \n\n~mean = Pstutter(5, PLseq((0, 5..30)));\n\nx.stop;\n```"}, {"role": "assistant", "content": "definition for future reference in arbitrary Environments, Poisson distribution gives positive integer values (PLpoisson: dynamic scope Ppoisson variant)"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// create a def with some variants\n(\nSynthDef(\\vartest, { |out, freq = 440, amp = 0.2, a = 0.01, r = 1|\n // the EnvGen with doneAction: Done.freeSelf frees the synth automatically when done\n Out.ar(out, SinOsc.ar(freq, 0, EnvGen.kr(Env.perc(a, r, amp), doneAction: Done.freeSelf)));\n}, variants: (alpha: [a: 0.5, r: 0.5], beta: [a: 3, r: 0.01], gamma: [a: 0.01, r: 4])\n).add;\n);\n\n// now make some synths. First using the arg defaults\nSynth(\\vartest);\n\n// now the variant def\n// …\n```"}, {"role": "assistant", "content": "create a def with some variants the EnvGen with doneAction: Done.freeSelf frees the synth automatically when done (SynthDef: Client-side representation of a synth definition)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = {LFTri.ar(100+(1000*Maths.ar(MouseX.kr, MouseY.kr, 0.2, 1, 0, 1, LFPulse.ar(2))[0]), 0, 0.1}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = {LFTri.ar(100+(1000*Maths.ar(MouseX.kr, MouseY.kr, 0.2, 1, 0, 1, LFPulse.ar(2))[0]), 0, 0.1)}.play\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Scale`?"}, {"role": "assistant", "content": "Scale — represents a musical scale"}, {"role": "user", "content": "What does `Scale.all` do?"}, {"role": "assistant", "content": "The scale repository, to which new scales can be added. `Scale.all.put(\\catastrophic, Scale([0, 0.01, 0.04, 11.2]));`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\na = Scale.major;\na.degrees; // [0, 2, 4, 5, 7, 9, 11]\na.semitones; // [0, 2, 4, 5, 7, 9, 11]\na.cents; // [0, 200, 300, 500, 700, 900, 1100]\na.ratios; // [1, 1.1224620483089, 1.2599210498937, 1.3348398541685, etc.]\n\nPbind(\\scale, a, \\degree, Pseq((0..7) ++ (6..0) ++ [\\rest], 1), \\dur, 0.25).play;\n\n// use non-standard tuning\na.tuning_(\\just);\na.degrees; // no change; degrees are independent of tuning\na.semitones; // [0, 2.0391000173077, 3.1564128700055, 4.9804499913461, etc.]\na.ratios.collect(_.round(0.001)); // [1, 1.125, 1.2, 1.333, 1.5, 1.667, 1.875]\n\nPbind(\\scale, a, \\degree, Pseq((0..7) ++ (6..0) ++ [\\rest], 1), \\dur, 0.25).play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// Handy code for quick class demonstrations.\n// Comparing a few intervals - Just Intonation versus 12-tone Equal Tempered\n\n// Major third (just)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 60.midicps * 5/4], mul: 0.1) }).play\n// Major third (ET12)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 64.midicps], mul: 0.1) }).play;\n\n// Major second (just)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 60.midicps * 9/8], mul: 0.1) }).play\n// Major second (ET)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 62.midicps], mul: 0.1) }).play;\n\n// Perfect fifth (just)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 60.midicps * 3/2], mul: 0.1) }).play\n// Perfect fifth (ET)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 67.midicps], mul: 0.1) });\n```"}, {"role": "assistant", "content": "Simple handy code for quick class demonstrations. Hear and compare a few intervals in Just Intonation versus 12-tone Equal Tempered tuning."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// It might also be desirable to start with a fade from silence.\n// This can be done with a negative initOutOffset:\n\n(\nx = {\n var lfo = XLine.ar(1, 0.5, 60);\n DXMix.ar(\n Dseq([0, 4, 1, 5, 2, 6, 3, 7], inf),\n `(Saw.ar((1..8) * 70 * lfo, 0.075)),\n fadeTime: 2,\n width: 2,\n initOutOffset: -1\n ) ! 2\n}.play\n;\n\nx.release\n\n\n// overlap scheme with width = 2 and initOutOffset = -1:\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// It might also be desirable to start with a fade from silence.\n// This can be done with a negative initOutOffset:\n\n(\nx = {\n var lfo = XLine.ar(1, 0.5, 60);\n DXMix.ar(\n Dseq([0, 4, 1, 5, 2, 6, 3, 7], inf),\n `(Saw.ar((1..8) * 70 * lfo, 0.075)),\n fadeTime: 2,\n width: 2,\n initOutOffset: -1\n ) ! 2\n}.play\n);\n\nx.release\n\n\n// overlap scheme with width = 2 and initOutOffset = -1:\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Phprand.new` do? What arguments does it take?"}, {"role": "assistant", "content": "random values that tend toward hi Arguments: lo — lower boundary of values.; hi — upper boundary of values.; length — number of values produced.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// this frees after the Decay has become quiet enough for a long enough time\n{ var signal = Decay.ar(Impulse.ar(0), 2, PinkNoise.ar(0.2)); DetectSilence.ar(signal, doneAction: Done.freeSelf; signal }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// this frees after the Decay has become quiet enough for a long enough time\n{ var signal = Decay.ar(Impulse.ar(0), 2, PinkNoise.ar(0.2)); DetectSilence.ar(signal, doneAction: Done.freeSelf); signal }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// stepper cycles between 0 and 1, average hovers around 0.5\na = { AverageOutput.kr(Stepper.kr(Impulse.kr(1), min: 0, max: 1).poll }.play;\n\na.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// stepper cycles between 0 and 1, average hovers around 0.5\na = { AverageOutput.kr(Stepper.kr(Impulse.kr(1), min: 0, max: 1)).poll }.play;\n\na.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `HistoryGui.docHeight` do?"}, {"role": "assistant", "content": "get and set the height of the text window opened by"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `ProxySpace`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\np = ProxySpace.new;\np.fadeTime = 2; // fadeTime specifies crossfade\np[\\out].play; // monitor an empty placeholder through hardware output\n// set its source\np[\\out] = { SinOsc.ar([350, 351.3], 0, 0.2) };\np[\\out] = { Pulse.ar([350, 351.3] / 4, 0.4) * 0.2 };\np[\\out] = Pbind(\\dur, 0.03, \\freq, Pbrown(0, 1, 0.1, inf).linexp(0, 1, 200, 350));\n\n// route one proxy through another:\np[\\out] = { Ringz.ar(p[\\in].ar, [350, 351.3] * 8, 0.2) * 4 };\np[\\in] = { Impulse.ar([5, 7]/2, [0, 0.5]) };\n\np.clear(3); // clear after 3 seconds\n```"}]} {"conversations": [{"role": "user", "content": "What is `Pdef`?"}, {"role": "assistant", "content": "Pdef — stream reference definition"}, {"role": "user", "content": "What does `Pdef.all` do?"}, {"role": "assistant", "content": "A global IdentityDictionary with all proxies."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\nPdef(\\x, Pbind(\\note, Pbrown(0, 6, 0.1, inf)));\nPdef(\\x).quant = 0; // no waiting.\nPbindf(Pdef(\\x), \\dur, 0.03).play;\nPbindf(Pdef(\\x), \\dur, 0.1, \\ctranspose, 15).play;\nPbindf(Pdef(\\x), \\dur, 0.3, \\ctranspose, 2).play;\n// now change the definition\nPdef(\\x, Pbind(\\note, Pseq([0, 3, 5, 7, 9, 11], inf)));\nPdef(\\x, Pbind(\\freq, Pseq([1000, 1923, 245.2, 1718] / 1.2 + 0.1, inf)));\n```"}]} -{"conversations": [{"role": "user", "content": "What does `AbstractFunction.reciprocal` do?"}, {"role": "assistant", "content": "`a = { 10.rand.postln }; b = a.reciprocal;"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ArrayedCollection`."}, {"role": "assistant", "content": "```supercollider\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n pitches.size.do{ |i|\n {\n var freq = pitches[i].midicps;\n var env = Env.perc.ar(Done.freeSelf);\n SinOsc.ar(freq) * 0.1 * env\n }.play;\n 0.2.wait\n }\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `FoaSFVL` in SuperCollider?"}, {"role": "assistant", "content": "FoaSFVL — First Order Ambisonic (FOA) Soundfield Velocity Level Return the Soundfield Velocity Level, SFVL, of a first order ambisonic (B-format) signal, in dB. Category: Libraries > Ambisonic Toolkit > UGens > FOA > Analyzer, UGens > Multichannel > Ambisonics, UGens > Analysis > Ambisonics."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\limiter;\n~description = \"hard limiter\";\n~channelLayout = \\mono;\n~function = {|in = 0, limitDB = 0 |\nvar limit = limitDB.dbamp;\nLimiter.ar(in, limit);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "I get 'Buffer UGen: no buffer data'. What does it mean?"}, {"role": "assistant", "content": "The UGen got a bufnum that the server has no data for. `Buffer.read` is asynchronous: the Buffer object exists immediately but the samples arrive later, so a Synth created straight after `Buffer.read` reads nothing. Wait for it — `s.sync` after the read, or `Buffer.read(s, path, action: { |b| ... })` and create the Synth in the action. The other cause is a nil or wrong buffer: `PlayBuf.ar(1, ~buf)` where ~buf was never assigned passes 0, which is 'no buffer'."}]} -{"conversations": [{"role": "user", "content": "What does `JITGui.hasWindow` do?"}, {"role": "assistant", "content": "(common to all JITGuis) a flag whether the JITGui has made its own window, and thus owns"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a;\na = Pgeom(1.0, 1.1, inf);\na.asStream.nextN(100).plot;\n);\n\n\n// sound example\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05, amp = 0.1|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2, amp), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n(\nvar a;\na = Pgeom(300, 1.03, 70).asStream;\n{\n a.do { |val|\n Synth(\\help_sinegrain, [\\freq,\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a;\na = Pgeom(1.0, 1.1, inf);\na.asStream.nextN(100).plot;\n);\n\n\n// sound example\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05, amp = 0.1|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2, amp), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n(\nvar a;\na = Pgeom(300, 1.03, 70).asStream;\n{\n a.do { |val|\n Synth(\\help_sinegrain, [\\freq, val]);\n 0.02.wait;\n }\n}.fork;\n);\n\n(\nPbind(\n \\dur, 0.01,\n \\instrument, \\help_sinegrain,\n \\freq, Pgeom(800, Pbrown(0.99, 1.01, 0.01, inf), inf)\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LFDNoise1`."}, {"role": "assistant", "content": "```supercollider\n// try wiggling mouse quickly;\n// LFNoise frequently seems stuck, LFDNoise changes smoothly.\n\n{ SinOsc.ar(LFNoise1.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n{ SinOsc.ar(LFDNoise1.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFNoise1.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n\n{ LFDNoise1.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `MulAdd`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n// The mul and add arguments of SinOsc themselves use MulAdd!\n// These two examples will create precisely the same synth graph:\nx = { SinOsc.ar(440, 0, 0.1, 0.05) }.play(s);\nx.trace; // You should see a \"MulAdd\" in the trace\nx.free;\n\nx = { MulAdd(SinOsc.ar(440, 0), 0.1, 0.05) }.play(s);\nx.trace;\nx.free;\n\n// In fact this will produce the same graph too - the separate multiply and add are optimised into one MulAdd\nx = { SinOsc.ar(440, 0) * 0.1 + 0.05 }.play(s);\nx.trace;\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What is `ServerLogGui` in SuperCollider?"}, {"role": "assistant", "content": "ServerLogGui — the interface for display and searching the ServerLog Category: Debugging, External Control > OSC."}]} -{"conversations": [{"role": "user", "content": "Write an FM bell in SuperCollider."}, {"role": "assistant", "content": "PMOsc is phase modulation: a non-integer modulator ratio gives the inharmonic clang.\n\n```supercollider\n(\nSynthDef(\\fmBell, { |out = 0, freq = 440, amp = 0.2, dur = 4|\n var index = EnvGen.kr(Env([8, 0.2], [dur], -4));\n var sig = PMOsc.ar(freq, freq * 1.4, index, 0, 1);\n var env = EnvGen.kr(Env.perc(0.002, dur, 1, -5), doneAction: 2);\n Out.ar(out, Pan2.ar(sig * env * amp, 0));\n}).add;\n);\nSynth(\\fmBell, [\\freq, 550]);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SerialPort.put` do? What arguments does it take?"}, {"role": "assistant", "content": "Write a byte to the device. Always Arguments: byte — An Integer or Char. Only values in the range from 0 to `2**databits - 1` may be written. If a value out of that range is passed to `put`, only the lowest bits will be used.; timeout — Unused, deprecated.. Returns: A Boolean indicating whether the write was successful."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Dust2`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-Dust2\", { |out = 0|\n Out.ar(out,\n Dust2.ar(200, 0.5)\n )\n}).play;\n);\n\n(\nSynthDef(\"help-Dust2\", { |out = 0|\n Out.ar(out,\n Dust2.ar(XLine.kr(20000, 2, 10), 0.5)\n )\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `RedLSystem` in SuperCollider briefly."}, {"role": "assistant", "content": "RedLSystem — rewrite strings A simple string rewrite class. Category: Red > redUniverse > additional."}]} -{"conversations": [{"role": "user", "content": "What does `Array.newClear` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a new array with all slots filled with Arguments: indexedSize — The size of the array.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// nOut allows for switching between iteration levels up to maximum n\n\n(\ny = {\n |nOut = 10|\n GFIS.ar({ |x| sin(LFDNoise1.ar(20).range(3, 3.5) * x) }, [0.2, 0.3], 10, nOut) * 0.1\n}.play\n);\n\n\ny.set(\\nOut, 9)\n\ny.set(\\nOut, 8)\n\ny.release\n\n\n// it can be passed an array of levels, \n// the resulting multichannel signal can e.g. be used for crossfaded switching with DXMix\n\n// switch between 3 mono signals and double them\n\n(\ny = {\n var src = GFIS.ar({ |x| sin(LFDNoise3.ar(30).\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// nOut allows for switching between iteration levels up to maximum n\n\n(\ny = {\n |nOut = 10|\n GFIS.ar({ |x| sin(LFDNoise1.ar(20).range(3, 3.5) * x) }, [0.2, 0.3], 10, nOut) * 0.1\n}.play\n);\n\n\ny.set(\\nOut, 9)\n\ny.set(\\nOut, 8)\n\ny.release\n\n\n// it can be passed an array of levels, \n// the resulting multichannel signal can e.g. be used for crossfaded switching with DXMix\n\n// switch between 3 mono signals and double them\n\n(\ny = {\n var src = GFIS.ar({ |x| sin(LFDNoise3.ar(30).range(3, 4) * x) }, 0.2, 9, [5, 7, 9]) * 0.1;\n DXMix.ar(Dseq([0, 1, 2], inf), `src, fadeTime: 0.01, stepTime: 0.02, fadeMode: 1) ! 2\n}.play\n);\n\ny.release;\n\n// switch between 3 stereo signals\n\n(\ny = {\n var src = GFIS.ar({ |x| sin(LFDNoise3.ar(30).range(3, 4) * x) }, [0.2, 0.21], 9, [5, 7, 9]) * 0.1;\n DXMix.ar(Dseq([0, 1, 2], inf), `src, fadeTime: 0.01, stepTime: 0.02, fadeMode: 1)\n}.play\n);\n\ny.release;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SPlayFile.read` do? What arguments does it take?"}, {"role": "assistant", "content": "Can be used to preload Arguments: path — A String pointing to a soundfile.."}]} -{"conversations": [{"role": "user", "content": "What does `PlayerSocket.socketFreeAll` do?"}, {"role": "assistant", "content": "a player that can play other players using a cross-faded and fuse-protected socket"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Re: the perfect frequencies?"}, {"role": "assistant", "content": "```supercollider\n// Rumush\n// https://mycelialcordsblog.wordpress.com/\n// https://fungorumush.bandcamp.com/releases\n// https://soundcloud.com/fungorum\n\n(\nf = {\n var rep = [4, 8, 16, 32];\n var n = rep.choose;\n var x = [\n\n 54, 60, 66, 72, 81, 90, 96, 102,\n 108, 128, 132, 144, 162, 180, 192, 204,\n 216, 240, 264, 288, 324, 360, 384, 408,\n 432, 480, 528, 576, 648, 720, 768, 816,\n 864, 960, 1056, 1152, 1296, 1440, 1536, 1632,\n 1728, 1920, 2112, 2304, 2592, 2880, 3072, 3264,\n 3456, 3840, 4224, 4608, 5184, 5760, 6144, 6528,\n 6912, 7680, 8448, 9216, 10368, 11520, 12288, 528\n\n ];\n Mix.fill(n,\n {\n var detune = 5.rand;\n var sin = SinOsc.ar(x.choose, 4.rand, 0.25);\n var saw = RLPF.ar(Saw.ar(x.choose*0.01+detune, 0.75), x.choose, 2.rand).tanh;\n Pan2.ar((sin+saw) * EnvGen.kr(Env.sine(12, 1/n), 1, doneAction:2),\n 1.rand2) }\n );\n};\n);\n\n(\n// DEFINE A ROUTINE\nr = Routine({\n\n inf.do({\n f.play;\n 10.wait;\n })\n});\n);\n\nr.reset.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `MultiTrackAudioSpec.storeArgs` do?"}, {"role": "assistant", "content": "datatype specifying multiple 'audio' rate tracks"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Dgeom`."}, {"role": "assistant", "content": "```supercollider\n// example\n\n(\n{\n var a, freq, trig;\n a = Dgeom(1, 1.2, 15);\n trig = Impulse.kr(MouseX.kr(1, 40, 1));\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n);\n\n(\n{\n var a, freq, trig;\n a = Dgeom(1, 1.2, inf);\n trig = Dust.kr(MouseX.kr(1, 40, 1));\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LinCongC`."}, {"role": "assistant", "content": "```supercollider\n// randomly modulate params\n(\n{ LinCongC.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(0.1, 0.5, 1.4),\n LFNoise2.kr(0.1, 0.1, 0.1),\n LFNoise2.kr(0.1)\n) * 0.2 }.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Object.idle` do?"}, {"role": "assistant", "content": "within a routine, return values (the receiver) until this time is over. (see also Routine#-play) Time is measured relative to the thread's clock. `a = Routine { 1.yield; 0.idle(3); 400.yield"}]} {"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(// * //watch the postWindow\na=[\"m\",\"x\",\"f\",\"k\",\"d\",\"p\"];\nx=Array;\ny=x.newClear(6);\n~mxfkdp=Task({\n inf.do({y.put(x.series(6,0,1).choose,a.scramble).postln;\n 0.03.wait;})}).play;\nm=fork({inf.do({\n \"array num:\".postcln;\n if(y[x.series(6,0,1).choose.postcln]==a,\n {\"lo encontraste!/found it!\".postcln;\n 1.do({GVerb.ar(\n EnvGen.ar(Env.perc(0.01,8),1,doneAction:2)*\n Blip.ar(XLine.kr(440,1600,8)),50,10,0.02)}.play);\n ~mxfkdp.stop;\n m.stop;}, \n {\"buscando.../seeking...\".postcln;});\n 0.03.wait})});\n);\n//.SCtweetLong\n```"}, {"role": "assistant", "content": "this code throws a scrambled array of arrays seeking among them for the original array,\r\nIt only sounds when it founds it. (may take a while)\r\nthe idea started trying a SCtweet, but became with this funny code!."}]} -{"conversations": [{"role": "user", "content": "What does `UScore.pos` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: x — (describe argument here). Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SoundFile`."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\\diskIn2, { |out, amp = 1, bufnum, sustainTime, atk = 0, rel = 0, gate = 1|\n var sig = VDiskIn.ar(2, bufnum, BufRateScale.kr(bufnum));\n var gateEnv = EnvGen.kr(Env([1, 1, 0], [sustainTime-rel, 0]));\n var env = EnvGen.kr(Env.asr(atk, 1, rel), gate * gateEnv, doneAction: Done.freeSelf);\n Out.ar(out, sig * env * amp)\n});\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Crackle`."}, {"role": "assistant", "content": "```supercollider\n{ Crackle.ar(1.95, 0.5) }.play;\n\n// modulate chaos parameter\n{ Crackle.ar(Line.kr(1.0, 2.0, 3), 0.5, 0.5) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// playing two interval lines in parallel\n\n(\n~a = Pseq([4, 2, 0]) + [0, -5];\n~b = Pseq([7, 5, 4]) + [0, 5];\n \np = Pbind(\n \\dur, Pseq([0.4, 0.2, 0.2], inf),\n \\note, PLn(\\a)\n);\n \nq = Pbindf(p, \\note, PLn(\\b));\n\nx = Ppar([p, q]).play; \n);\n\n \n\n// replace the lower event stream, new notes start after end of embedding Pseq\n \n~a = Pseq([3, 2, 0]) + [0, -5];\n\n\n// replace second line\n\n~b = Pseq([7, 5, 4]) + [5, 12];\n\n\n// source nil stops event\n// …\n```"}, {"role": "assistant", "content": "playing two interval lines in parallel replace the lower event stream, new notes start after end of embedding Pseq (PLn: dynamic scope placeholder pattern whose streams will be finished before replacements)"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// a Buffer for the UGens to use\nb = Buffer.alloc(s, 44100, 1);\n\n// write a signal into a delay, tap it at multiple times\nSynthDef(\\write, { |buffer, cout|\n var src, tapPhase, tap1, tap2, tap3;\n src = WhiteNoise.ar(0.2) * Decay.kr(Dust.kr(3), 0.7);\n tapPhase = DelTapWr.ar(buffer, src);\n Out.kr(cout, tapPhase);\n }).add;\n\nSynthDef(\\readFilt, { |out, buffer, cin|\n var phase, src, filt;\n phase = In.kr(cin);\n src = DelTapRd\n// …\n```"}, {"role": "assistant", "content": "a Buffer for the UGens to use write a signal into a delay, tap it at multiple times (DelTapWr: Write to a buffer for a DelTapRd UGen)"}]} +{"conversations": [{"role": "user", "content": "Explain `ParGroup` in SuperCollider briefly."}, {"role": "assistant", "content": "ParGroup — Client-side representation of a parallel group node on the server Parallel Groups are server-side node containers that work similar to Groups, but without ordering constraints for the contained nodes. This means that on parallel architectures the elements of a Parallel Group can be executed concurrently. Category: Server > Nodes, Server > Abstractions."}]} +{"conversations": [{"role": "user", "content": "What does `View.action` do? What arguments does it take?"}, {"role": "assistant", "content": "Gets or sets the default action of the view, i.e. the object to be evaluated when the user interacts with the view in an essential way (e.g. a Button is clicked, a ListView item is selected, Arguments: func — Any object to set as default action, usually a Function or a FunctionList. When evaluated, it will be passed the view as an argument.."}]} +{"conversations": [{"role": "user", "content": "What does `LinkClock.latency` do? What arguments does it take?"}, {"role": "assistant", "content": "Gets or sets the number of seconds of OSC messaging latency for which the `LinkClock` should account. In general, this should be set to match the server object's Arguments: lat — A Float.."}]} +{"conversations": [{"role": "user", "content": "What is `Henon2DC` in SuperCollider?"}, {"role": "assistant", "content": "Henon2DC — henon map 2D chaotic generator `y = b * x(n)` Category: UGens > Generators > Stochastic."}]} +{"conversations": [{"role": "user", "content": "How do I play a sample from disk?"}, {"role": "assistant", "content": "Load it into a Buffer on the server, then play the buffer. `BufRateScale` keeps the pitch right when\nthe file's sample rate differs from the server's.\n\n```supercollider\n(\ns.waitForBoot {\n ~buf = Buffer.read(s, \"C:/sounds/break.wav\");\n SynthDef(\\player, { |out = 0, buf = 0, amp = 0.6, rate = 1|\n var sig = PlayBuf.ar(2, buf, BufRateScale.kr(buf) * rate, loop: 1);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n ~player = Synth(\\player, [\\buf, ~buf]);\n};\n)\n```\nUse `numChannels` 1 for a mono file; a mismatch is silent or wrong-sounding rather than an error."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// The code below generates a series of test signals for each speaker of \n// the currently active setup. In the default settings this generates \n// short pink noise bursts, twice on each group of 8 speakers.\n\n(\nn = 8; // size of speaker groups\nz = 1/4; // duration per burst\nt = \\pinkNoise; // udef name for sound generation\nr = 2; // number of repeats per group\nx = UScore();\n\n(WFSSpeakerConf.default.speakerCount / n).ceil.do({ |i|\n var folder;\n folder = UScore( i * (r * (n + 1) * z) );\n x.add( folder );\n r.do({ |ii|\n n.do({ |iii|\n folder.add( UChain( ((ii * (n + 1)) + iii) * z, iii, z * (3/4), \n [ t, [ \\seed, 12345 ] ],\n [ \\wfsIndex, [ \\index, (i * 8) + iii, \\gain, 0 ] ]\n )\n );\n });\n });\n folder.name = ([1,n] + (i*8)).join(\"-\"); \n});\n\nx.gui;\n)\n```"}, {"role": "assistant", "content": "The code below generates a series of test signals for each speaker of the currently active setup. In the default settings this generates short pink noise bursts, twice on each group of 8 speakers."}]} +{"conversations": [{"role": "user", "content": "Explain `RedAbstractModule` in SuperCollider briefly."}, {"role": "assistant", "content": "RedAbstractModule — abstract class Category: Red > redModule."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `BufCombN` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// These examples compare the variants, so that you can hear the difference in interpolation\n\n// allocate buffer\nb = Buffer.alloc(s, 44100, 1);\n\n// Comb used as a resonator. The resonant fundamental is equal to\n// reciprocal of the delay time.\n{ BufCombN.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ BufCombL.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ BufCombC.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// with negative feedback:\n{ BufCombN.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ BufCombL.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ BufCombC.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n// used as an echo.\n{ BufCombC.ar(b.bufnum, Decay.ar(Dust.ar(1, 0.5), 0.2, WhiteNoise.ar), 0.2, 3) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Env`?"}, {"role": "assistant", "content": "Env — Specification for a segmented envelope"}, {"role": "user", "content": "What does `Env.new` do?"}, {"role": "assistant", "content": "Create a new envelope specification."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// an envelope in a synth\n(\n{\n var env = Env([0, 1, 0.5, 1, 0], [0.01, 0.5, 0.02, 0.5]);\n SinOsc.ar(470) * EnvGen.kr(env, doneAction: Done.freeSelf)\n}.play\n);\n// an envelope to control a parameter in a pattern\n(\nPbind(\n \\note, Env([0, 12, 6, 13, 0], [1, 5, 2, 10]),\n \\dur, 0.1\n).play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `BufSampleRate`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n// compares a 1102.5 Hz sine tone (11025 * 0.1, left) with a 1100 Hz tone (right)\n// the apollo sample has a sample rate of 11.025 kHz\n(\n{\n var freq;\n freq = [BufSampleRate.kr(b) * 0.1, 1100];\n SinOsc.ar(freq, 0, 0.1)\n}.play;\n);\n\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Option.empty` do?"}, {"role": "assistant", "content": "Represents optional values. Returns: None()"}]} +{"conversations": [{"role": "user", "content": "What model are you?"}, {"role": "assistant", "content": "I am sc-mind: a 198M MiniMind-3-MoE, eight layers, 768 wide, four experts with top-1 routing. I was trained from scratch on the SuperCollider documentation, class library and help pages, then fine-tuned on questions and answers about them."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `JITGui`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// typically, only subclasses of JITGui are used,\n // so here are just some basic usage and layout tests\n\n // make its own window - defPos, minSize is used\ng = JITGui(Ndef(\\a));\n\n // make its own window, specific size\ng = JITGui(Ndef(\\a), bounds: 390@20);\n\n // provide full bounds\ng = JITGui(Ndef(\\a), bounds: Rect(200, 500, 390, 24));\n\n // extent is 0@0: minSize x, y is used\ng = JITGui(Ndef(\\a), bounds: Rect(200, 500, 0, 0));\ng = JITGui(Ndef(\\a), bounds: Rect(200, 500, 0, 50));\ng = JITGui(Ndef(\\a), bounds: Rect(200, 500, 500, 0));\n\n\n( // put a JITGui in an existing window:\nw = Window().front;\ng = JITGui(Ndef(\\a), 0, w, bounds: 300@48);\n);\n\n( // 5 lines high\nw = Window().front;\ng = JITGui(Ndef(\\a), 5, w);\n);\n\n( // recommended: use a FlowLayout.\nw = Window().front;\nw.addFlowLayout;\nEZSlider(w, 300@100, \\test, []);\ng = JITGui(Ndef(\\a), 0, w, bounds: 300@40);\n);\n\n// test changing color schemes for JITguis\n// this scheme is admittedly ugly but different\n\nGUI.skins.put(\\jit, (\n fontSpecs: [\"Inconsolata\", 12],\n fontColor: Color.white,\n background: Color(0.2, 0.85, 0.7, 0.5),\n foreground: Color.grey(0.1),\n onColor: Color(0.5, 0, 0.5),\n onColor2: Color(0.0, 0.5, 0.5),\n offColor: Color.grey(0.2, 0.5),\n hiliteColor: Color.green(1.0, 0.5),\n gap: 0 @ 0,\n margin: 2@2,\n buttonHeight: 18,\n headHeight: 24)\n);\n\n// make some JITGuis to check\nn = NdefGui(Ndef(\\a));\nNdef(\\a, { SinOsc.ar(\\freq.kr(250)) });\nNdef(\\a).clear;\nn = NdefMixer(s);\n\nTdefAllGui();\nTdef(\\a).set(\\amp, 0.25);\nTdefGui(Tdef(\\a), 5);\n\nEnvirGui((a: 123));\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Document.standardizePath` do? What arguments does it take?"}, {"role": "assistant", "content": "Editor-specific text document editing Arguments: p — The file system path to the directory. An instance of String.."}]} +{"conversations": [{"role": "user", "content": "What does `SynthlessPlayer.connectToPatchIn` do? What arguments does it take?"}, {"role": "assistant", "content": "parent class for Players that will not spawn a synth Arguments: patchIn; needsValueSetNow."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PdurStutter`."}, {"role": "assistant", "content": "```supercollider\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,0,1,3,4,0], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n100.do({ x.next.postln });\n);\n\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n);\n\n\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,4,4,0,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n~buf = Buffer.read(s, \"C:/sounds/break.wav\");\nPlayBuf.ar(1, ~buf, BufRateScale.kr(~buf), loop: 1);\n```"}, {"role": "assistant", "content": "Loads a sound file into server memory, then plays it in a loop at the file's original pitch.\n\n- `Buffer.read(s, path)` allocates a buffer on the server and fills it from the file. It is asynchronous:\n the Buffer object returns immediately, the samples arrive later.\n- `PlayBuf.ar(1, buf, ...)` needs the channel count first — 1 for a mono file. A wrong count is the usual\n cause of a buffer that plays wrongly or not at all.\n- `BufRateScale.kr(buf)` compensates when the file's sample rate differs from the server's, so `rate: 1` is\n the file's true speed.\n- `loop: 1` restarts at the end instead of stopping.\n\nBecause the read is asynchronous, this line pair is only safe if a `s.sync` or a wait happened in between;\notherwise PlayBuf sees a buffer with no data yet."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `ReplaceOut`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"ReplaceOutHelp\", { |out = 0, freq = 440|\n var source;\n source = SinOsc.ar(freq, 0, 0.1);\n\n // write to the bus, replacing previous contents\n ReplaceOut.ar(out, source);\n\n}).add;\n);\n\n// each Synth replaces the output of the previous one\nx = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 500]);\ny = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 600]);\nz = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 700]);\n\n// release them in reverse order; the older Synths are still there.\nz.free;\ny.free;\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a, b;\na = Pn(Pseq(#[1, 2, 3], 1), 4); // repeat pattern four times\nb = a.asStream;\n16.do({ b.next.postln });\n);\n\n// sound example\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\nvar a;\na = Pn(Pshuf([1, 2, 2, 3, 3, 3], 4)).asStream;\n{\n loop {\n Syn\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a, b;\na = Pn(Pseq(#[1, 2, 3], 1), 4); // repeat pattern four times\nb = a.asStream;\n16.do({ b.next.postln });\n);\n\n// sound example\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\nvar a;\na = Pn(Pshuf([1, 2, 2, 3, 3, 3], 4)).asStream;\n{\n loop {\n Synth(\\help_sinegrain, [\\freq, a.next * 600 + 300]);\n 0.2.wait;\n }\n}.fork;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PeakFollower`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n// no decay\n(\n{\n SinOsc.ar(\n PeakFollower.ar(Dust.ar(20, Line.kr(0, 1, 4)), 1.0) * 1500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// a little decay\n(\n{\n SinOsc.ar(\n PeakFollower.ar(Dust.ar(20, Line.kr(0, 1, 4)), 0.999) * 1500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// mouse x controls decay, center of the\n(\n{\n var decay;\n decay = MouseX.kr(0.99, 1.00001).min(1.0);\n SinOsc.ar(\n PeakFollower.ar(Dust.ar(20), decay) * 1500 + 200,\n 0, 0.2\n );\n\n}.play;\n);\n\n\n\n\n// follow a sine lfo, decay controlled by mouse x\n(\n{\n var decay;\n decay = MouseX.kr(0, 1.1).min(1.0);\n SinOsc.ar(\n PeakFollower.kr(SinOsc.kr(0.2), decay) * 200 + 500,\n 0, 0.2\n )\n\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "How do I pan notes around the stereo field in a pattern?"}, {"role": "assistant", "content": "Put `\\pan` in the Pbind: the default instrument understands it and passes it to Pan2.\n\n```supercollider\n(\nPbind(\n \\scale, Scale.minorPentatonic,\n \\degree, Pseq([0, 2, 4, 7, 9, 7, 4, 2], inf),\n \\dur, 0.2,\n \\pan, Pseq([-1, -0.5, 0, 0.5, 1, 0.5, 0, -0.5], inf),\n \\amp, 0.15\n).play;\n)\n```\n\nTo pan an arbitrary synth, add a `pan = 0` argument to the SynthDef and wrap the output in\n`Pan2.ar(sig, pan)`."}]} +{"conversations": [{"role": "user", "content": "What is `Pbindf` in SuperCollider?"}, {"role": "assistant", "content": "Pbindf — bind several value patterns to one existing event stream by binding keys to values Pbindf adds several value streams into one existing event stream. Each value stream is assigned to one or more keys in the resulting event stream, overriding any values from the input stream. Category: Streams-Patterns-Events > Patterns > Composition."}]} +{"conversations": [{"role": "user", "content": "What is `RedLZSS` in SuperCollider?"}, {"role": "assistant", "content": "RedLZSS — lzss compression/decompression See http://michael.dipperstein.com/lzss/ and http://en.wikipedia.org/wiki/Lempel-Ziv-Storer-Szymanski Category: Red > > redTools."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `QuadN`."}, {"role": "assistant", "content": "```supercollider\n// logistic map\n// equation: x1 = -r*x0^2 + r*x0\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n QuadN.ar(SampleRate.ir/4, r.neg, r, 0, 0.1) * 0.4;\n}.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\ns.scope(16);\n\n{ Out.ar(87, SinOsc.ar(MouseX.kr(40, 10000, 1) * [1, 2, 3], 0, 0.2)) }.play;\nx = Monitor.new;\nx.play(87, 3, 1, 2);\nx.out = 0;\nx.stop(3.0);\nx.play(87, 1, 0, 1); // in > out : now mixes down (wrapping)\nx.play(89, 1, 0, 2); // in < out : now distributes to 2 channels\nx.stop;\n\n// multiple play\nx.play(87, 1, 0, 2, multi: true);\nx.play(88, 1, 0, 2, multi: true);\nx.play(89, 1, 0, 2, multi: true;\nx.stop;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\ns.scope(16);\n\n{ Out.ar(87, SinOsc.ar(MouseX.kr(40, 10000, 1) * [1, 2, 3], 0, 0.2)) }.play;\nx = Monitor.new;\nx.play(87, 3, 1, 2);\nx.out = 0;\nx.stop(3.0);\nx.play(87, 1, 0, 1); // in > out : now mixes down (wrapping)\nx.play(89, 1, 0, 2); // in < out : now distributes to 2 channels\nx.stop;\n\n// multiple play\nx.play(87, 1, 0, 2, multi: true);\nx.play(88, 1, 0, 2, multi: true);\nx.play(89, 1, 0, 2, multi: true);\nx.stop;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `NonControlSpec` in SuperCollider?"}, {"role": "assistant", "content": "NonControlSpec — datatype specifying an input to an Instr that will not be in the SynthDef/Synth Category: Spec, Libraries > crucial > Spec."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = NodeProxy(s);\na.source = { |freq = 444| Blip.ar(freq * [1, 1.03], 200) * 0.1 };\na.play;\na.set(\\freq, 555);\nb = a.copy;\nb.play;\nb.set(\\freq, 222;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = NodeProxy(s);\na.source = { |freq = 444| Blip.ar(freq * [1, 1.03], 200) * 0.1 };\na.play;\na.set(\\freq, 555);\nb = a.copy;\nb.play;\nb.set(\\freq, 222);\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `ProxySpace`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\np = ProxySpace.new;\np.fadeTime = 2; // fadeTime specifies crossfade\np[\\out].play; // monitor an empty placeholder through hardware output\n// set its source\np[\\out] = { SinOsc.ar([350, 351.3], 0, 0.2) };\np[\\out] = { Pulse.ar([350, 351.3] / 4, 0.4) * 0.2 };\np[\\out] = Pbind(\\dur, 0.03, \\freq, Pbrown(0, 1, 0.1, inf).linexp(0, 1, 200, 350));\n\n// route one proxy through another:\np[\\out] = { Ringz.ar(p[\\in].ar, [350, 351.3] * 8, 0.2) * 4 };\np[\\in] = { Impulse.ar([5, 7]/2, [0, 0.5]) };\n\np.clear(3); // clear after 3 seconds\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `FBSineN`."}, {"role": "assistant", "content": "```supercollider\n// default initial params\n{ FBSineN.ar(SampleRate.ir/4) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "How do I play a sample from disk?"}, {"role": "assistant", "content": "Load it into a Buffer on the server, then play the buffer. `BufRateScale` keeps the pitch right when\nthe file's sample rate differs from the server's.\n\n```supercollider\n(\ns.waitForBoot {\n ~buf = Buffer.read(s, \"C:/sounds/break.wav\");\n SynthDef(\\player, { |out = 0, buf = 0, amp = 0.6, rate = 1|\n var sig = PlayBuf.ar(2, buf, BufRateScale.kr(buf) * rate, loop: 1);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n ~player = Synth(\\player, [\\buf, ~buf]);\n};\n)\n```\nUse `numChannels` 1 for a mono file; a mismatch is silent or wrong-sounding rather than an error."}]} +{"conversations": [{"role": "user", "content": "What does `GUI.setSkin` do? What arguments does it take?"}, {"role": "assistant", "content": "Factory abstraction for all GUI related core classes Arguments: skinName."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Synth`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n(\n// send a synth def to server\nSynthDef(\"tpulse\", { |out = 0, freq = 700, sawFreq = 440.0|\n Out.ar(out, SyncSaw.ar(freq, sawFreq, 0.1));\n}).add;\n);\n\n// Here the defaults for *new will result in a Synth at the head of the default group\n// of the default Server. This will use the SynthDef's default arguments;\ny = Synth.new(\"tpulse\");\ny.free;\n\n// The same done explicitly\ny = Synth.new(\"tpulse\", nil, s, \\addToHead);\ny.free;\n\n// With some arguments\ny = Synth.new(\"tpulse\", [\\freq, 350, \\sawFreq, 220]);\ny.free;\n\n// make a new synth\ny = Synth(\"tpulse\");\n\n// pause\ny.run(false);\n\ny.run(true);\n\n// set a control by argument name\ny.set(\"freq\", 200);\n\n// or by index\ny.set(2, 100.0);\n\n// modulate out to bus number 1 (the right speaker)\ny.set(0, 1);\n\n// multiple set commands in one message\ny.set(\"out\", 0, \"freq\", 300);\n\n// free the synth from the server\ny.free;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// hear the difference, LinPan having a slight drop in the middle (yeah, it's subtle)...\n{ LinPan2.ar(SinOsc.ar(440), Line.kr(-1, 1, 5)) }.play;\n\n// ... whereas Pan2 is more smooth\n{ Pan2.ar(SinOsc.ar(440), Line.kr(-1, 1, 5)) }.play;\n\n// other examples\n{ LinPan2.ar(PinkNoise.ar(0.4), FSinOsc.kr(2)) }.play;\n\n{ LinPan2.ar(FSinOsc.ar(800, 0, 0.1), FSinOsc.kr(3) }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// hear the difference, LinPan having a slight drop in the middle (yeah, it's subtle)...\n{ LinPan2.ar(SinOsc.ar(440), Line.kr(-1, 1, 5)) }.play;\n\n// ... whereas Pan2 is more smooth\n{ Pan2.ar(SinOsc.ar(440), Line.kr(-1, 1, 5)) }.play;\n\n// other examples\n{ LinPan2.ar(PinkNoise.ar(0.4), FSinOsc.kr(2)) }.play;\n\n{ LinPan2.ar(FSinOsc.ar(800, 0, 0.1), FSinOsc.kr(3)) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// define two Pbinds of same length, play first\n\n// data sharing with rhythms of coinciding entry points is sure as streams are time-shifted\n\n(\np = PmonoPar([\n [\n \\dur, Prand([1, 1, 2]/3, inf).collect(~dur = _).trace, // or: .collect { |x| ~dur = x } .trace\n \\amp, Pseq([0.2, 0.05], 15).trace \n ],[\n \\dur, Pfunc { ~dur / 2 },\n \\midinote, Pshuf((60..85)) \n ]\n]).trace.play;\n)\n```"}, {"role": "assistant", "content": "define two Pbinds of same length, play first data sharing with rhythms of coinciding entry points is sure as streams are time-shifted (PmonoPar: monophonic event pattern for an arbitrary number of timed setting streams)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nNdef(\\maus, { MouseX.kr });\nNdef(\\haus, { Pan2.ar(Blip.ar(Ndef.kr(\\maus, 1) * 70), SinOsc.kr(Ndef.ar(\\maus, 1) * 5)) }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nNdef(\\maus, { MouseX.kr });\nNdef(\\haus, { Pan2.ar(Blip.ar(Ndef.kr(\\maus, 1) * 70), SinOsc.kr(Ndef.ar(\\maus, 1) * 5)) }).play;\n```"}]} +{"conversations": [{"role": "user", "content": "How do I make a piece reproducible instead of a different take every time?"}, {"role": "assistant", "content": "Three things make a SuperCollider piece repeatable: a fixed seed, a fixed tempo, and no live input.\n\n```supercollider\n(\nthisThread.randSeed = 1234;\nTempoClock.default.tempo = 2;\nPbind(\\degree, Pwhite(0, 7, inf), \\dur, 0.25).play;\n)\n```\n\n`thisThread.randSeed` fixes the random sequence of the current thread, so `Pwhite`, `Prand` and friends give\nthe same values again. Recording with `s.record(path, duration: 30)` then makes the take an artifact rather\nthan a performance. Input from `MouseX` or a MIDI controller is the usual remaining source of difference."}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nPbind(\\degree, Pseq([0, 2, 4, 7], inf), \\dur, 0.25).play;\n```"}, {"role": "assistant", "content": "It plays a four-note major arpeggio in a loop, one note every 250 ms.\n\n`Pbind` builds an event stream: each event is the current value of every key. `Pseq([0, 2, 4, 7], inf)`\ncycles the degrees forever, and `\\dur, 0.25` sets the time between events in beats on the default\nTempoClock. With no `\\instrument`, the `\\default` SynthDef is used, which converts `\\degree` to a\nfrequency through the current scale (major, rooted at C by default). `.play` schedules it on the clock\nand returns an EventStreamPlayer."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Event` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\pm, { |out = 0, freq = 440, amp = 0.1, pan = 0, gate = 1, ratio = 1, index = 1, ar = 0.1, dr = 0.1|\n var z;\n z = LPF.ar(\n PMOsc.ar(freq, freq * ratio, Linen.kr(gate, ar, index, dr), 0, 0.3),\n XLine.kr(Rand(4000, 5000), Rand(2500, 3200), 1)\n ) * Linen.kr(gate, 0.01, 0.7, dr, 2);\n OffsetOut.ar(out, Pan2.ar(z, pan, amp));\n}).add;\n);\n\n(instrument: \\pm).play;\n\n(instrument: \\pm, ratio: 3.42, index: 12, freq: 150, ar: 8, dr: 3, sustain: 10).play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(//*********PREPARE**********\np.pop;\n//Any code that needs to access your own environment goes here\np = ProxySpace.push(s);\n~fxLoop.play.fadeTime_(5);\n);\n\n(//*********FXLoop**********\n~fxLoop = {\n var in = SoundIn.ar([0,1]);\n in;\n}\n)\n```"}, {"role": "assistant", "content": "Code for using Supercollider as a realtime livecode FX processor for audio input. Blog post explaing this code: http://schemawound.com/post/53528545022/fxloop."}]} +{"conversations": [{"role": "user", "content": "What is the difference between \\degree, \\midinote and \\freq in a Pbind?"}, {"role": "assistant", "content": "`\\freq` is the frequency in Hz and is used as-is. `\\midinote` is a MIDI note number, converted to frequency by the default instrument. `\\degree` is a scale degree, quantised to the scale in \\scale (default major) rooted at \\root; degrees can be negative or fractional. If you set both, the more specific conversion wins, so set exactly one."}]} +{"conversations": [{"role": "user", "content": "What does `View.resizeTo` do? What arguments does it take?"}, {"role": "assistant", "content": "Resize the view, preserving its Arguments: width — An Int: the new horizontal size of the view.; height — An Int: the new vertical size of the view.."}]} +{"conversations": [{"role": "user", "content": "Explain `BendResponder` in SuperCollider briefly."}, {"role": "assistant", "content": "BendResponder — allow functions to be registered to respond to MIDI pitchbend events Category: External Control > MIDI."}]} +{"conversations": [{"role": "user", "content": "What does `RedVector.manhattan` do?"}, {"role": "assistant", "content": "Get the sum of the absolute differences as a Float."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for sound of an alien weapon firing. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"raygun\", {arg amp = 0.5, sinfreq = 1000, glissf = 0.001, att = 0.01, rel = 0.9;\n var gliss = XLine.kr(sinfreq, sinfreq*glissf, rel);\n var snd = SinOsc.ar(gliss);\n var env = EnvGen.kr(Env.perc(att, rel), doneAction: 2);\n snd = snd * env * amp;\n Out.ar(0, snd);\n}).add;\n);\n\n(\nPbind(\n \\instrument, \"raygun\",\n \\dur, Pseq([0.75,0.75,0.75,0.75,0.25,0.25,0.25]*0.5, inf),\n \\amp, 0.4\n).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `RedKCS.encodeStringAsSoundFile` do? What arguments does it take?"}, {"role": "assistant", "content": "convert a string into a sound file (render to Arguments: str — the string to be encoded.; path — a string specifying where to save the resulting sound file.. Returns: a Boolean indicating if creating the file was successful."}]} +{"conversations": [{"role": "user", "content": "What are you good at?"}, {"role": "assistant", "content": "SuperCollider. I can explain its classes and UGens, write SynthDefs and patches, read a patch back to you, and tell you why one does not compile. I am 198M parameters; I am not a general assistant."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `In`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-InKr\", { |out = 0, in = 0|\n Out.ar(out,\n SinOsc.ar(In.kr(in, 1), 0, 0.1)\n )\n}).add;\nSynthDef(\"help-lfo\", { |out = 0|\n Out.kr(out, LFNoise1.kr(0.3, 200, 800))\n}).add;\n);\n\n\nb = Bus.control(s, 1);\nb.set(800);\n\nSynth(\"help-InKr\", [\\in, b.index]);\nb.set(400);\nb.set(300);\nSynth(\"help-lfo\", [\\out, b.index]);\n```"}]} {"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\envfol;\n~description = \"Envelope follower (audio rate)\";\n~channelLayout = \\mono;\n~function = {|in = 0, decaycoeff = 0.99, amp = 10.0, lpf = 20 |\n var env, out;\n in.scope;\n env = LPF.ar(PeakFollower.ar(in), lpf, mul: 50, add:-1);\n env.scope;\n env;\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Condition`."}, {"role": "assistant", "content": "```supercollider\n(\nc = Condition.new(false);\n\nRoutine {\n 1.wait;\n \"waited for 1 second\".postln;\n 1.wait;\n \"waited for another second, now waiting for you ... \".postln;\n c.wait;\n \"the condition has stopped waiting.\".postln;\n 1.wait;\n \"waited for another second\".postln;\n \"waiting for you ... \".postln;\n c.test = false;\n c.wait;\n \"the condition has stopped waiting.\".postln;\n 1.wait;\n \"the end\".postln;\n}.play;\n);\n\n// continue\n(\nc.test = true;\nc.signal;\n);\n\n// a typical use is a routine that can pause under certain conditions:\n(\nc = Condition.new;\nfork { loop { 1.wait; \"going\".postln; c.wait } };\n);\nc.test = true; c.signal;\nc.test = false;\n```"}]} -{"conversations": [{"role": "user", "content": "Do is not ¨returning¨ array (campanology)?"}, {"role": "assistant", "content": "SuperCollider forum — Do is not ̈returning ̈ array (campanology)\n\nYou can remove the need for all mutable variables by computing the indexes to swap first - these are stored in indexesEven and indexesOdd.\n\nThen an array of functions is made (swappers)...i.e.[indexesEven, indexesOdd, indexesEven....]\n\nFinally, .inject is used to chain these together, taking the previous result as the input to the next and building an array.\n\n```supercollider\n(\n~swap_sort_steps = {\n |parts|\n var swapConsequtiveIndexes = {|from, to|\n (from..to).clump(2).collect{|p| p.reverse }.flat\n };\n var indexesEven = swapConsequtiveIndexes.(0, parts - 1);\n var indexesOdd = [0] ++ swapConsequtiveIndexes.(1, parts - 1);\n var swappers = parts.collect{ |n|\n {|toSwap| if(n.even)\n { indexesEven.collect{|i| toSwap[i]} }\n { indexesOdd.collect{|i| toSwap[i]} }\n }\n };\n postf(\"indexesEven : %\\nindexesOdd : %\\n\", indexesEven, indexesOdd);\n swappers.inject( [(0..parts-1)], {\n |col, f|\n col ++ [f.(col.last)]\n });\n};\n)\n```\n\nAlso, as I’m sure you know, if anyone else is reading who doesn’t know what this is... its a swap sort algorithm."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns = Server.default;\nm = BusMeters(s,Array.fill(4,{Bus.audio(s,2)}));\nm.gui;\n\nm.start;\n\nRoutine({\n 500.do {\n {\n EnvGen.kr(Env.perc) * Saw.ar(rrand(100,400),rrand(-80,0).dbamp)\n }.play(outbus:m.busses.choose);\n 0.1.wait;\n }\n}).play(AppClock\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns = Server.default;\nm = BusMeters(s,Array.fill(4,{Bus.audio(s,2)}));\nm.gui;\n\nm.start;\n\nRoutine({\n 500.do {\n {\n EnvGen.kr(Env.perc) * Saw.ar(rrand(100,400),rrand(-80,0).dbamp)\n }.play(outbus:m.busses.choose);\n 0.1.wait;\n }\n}).play(AppClock)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `PCombN` in SuperCollider briefly."}, {"role": "assistant", "content": "PCombN — UGenPatterns quark library Based on CombN Category: Streams-Patterns-Events > UGenPatterns > Modifiers."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `InTrig`."}, {"role": "assistant", "content": "```supercollider\ns = Server.local;\nb = Bus.control(s, 1);\n\nSynthDef(\"help-InTrig\", { |out = 0, busnum = 0|\n var inTrig;\n inTrig = InTrig.kr(busnum);\n Out.ar(out,\n EnvGen.kr(Env.perc, gate: inTrig, levelScale: inTrig) * SinOsc.ar\n )\n}).play(s, [\\out, 0, \\busnum, b.index]);\n\n\nb.set(1.0);\n\nb.value = 1.0;\n\nb.value = 0.2;\n\nb.value = 0.1;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Dust`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-Dust\", { |out = 0|\n Out.ar(out,\n Dust.ar(200, 0.5)\n )\n}).play;\n);\n\n(\nSynthDef(\"help-Dust\", { |out = 0|\n Out.ar(out,\n Dust.ar(XLine.kr(20000, 2, 10), 0.5)\n )\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ DPW4Saw.ar(XLine.kr(2000, 20, 10)) }.play; \n\n{ DPW4Saw.ar(MouseX.kr(20,12000,'exponential'))*0.5 }.play;\n\n{Saw.ar(MouseX.kr(20,12000,'exponential'))}.play\n\n\n//DPW4Saw less efficient than the already band limited Saw UGen\n{ Mix(DPW4Saw.ar(Array.rand(100,50,5000))*0.01) }.play;\n\n{ Mix(Saw.ar(Array.rand(100,50,5000))*0.01 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ DPW4Saw.ar(XLine.kr(2000, 20, 10)) }.play; \n\n{ DPW4Saw.ar(MouseX.kr(20,12000,'exponential'))*0.5 }.play;\n\n{Saw.ar(MouseX.kr(20,12000,'exponential'))}.play\n\n\n//DPW4Saw less efficient than the already band limited Saw UGen\n{ Mix(DPW4Saw.ar(Array.rand(100,50,5000))*0.01) }.play;\n\n{ Mix(Saw.ar(Array.rand(100,50,5000))*0.01) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n///////////////////// channel offset/object index /////////////////////\n\n\na = NodeProxy.audio(s, 2);\na.play;\na[0] = { Ringz.ar(Impulse.ar(5, 0, 0.1), 1260) };\na.put(1, { Ringz.ar(Impulse.ar(5.3, 0, 0.1), 420) }, 1);\na.put(0, { Ringz.ar(Dust.ar([1, 1]*15.3, 0.1), 720) }, 1);\na.put(1, { Ringz.ar(Impulse.ar(5.3, 0, 0.1), 420) }, 1;\na.end;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n///////////////////// channel offset/object index /////////////////////\n\n\na = NodeProxy.audio(s, 2);\na.play;\na[0] = { Ringz.ar(Impulse.ar(5, 0, 0.1), 1260) };\na.put(1, { Ringz.ar(Impulse.ar(5.3, 0, 0.1), 420) }, 1);\na.put(0, { Ringz.ar(Dust.ar([1, 1]*15.3, 0.1), 720) }, 1);\na.put(1, { Ringz.ar(Impulse.ar(5.3, 0, 0.1), 420) }, 1);\na.end;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// define the violin-like sound synth\n(\nSynthDef(\\violin, {\n | midinote=60, gate=1, amp=0.25 |\n var env = EnvGen.kr(Env.asr(0.1, 1, 0.1), gate, doneAction:2);\n var sig = VarSaw.ar(\n midinote.midicps,\n width:LFNoise2.kr(1).range(0.2, 0.8)*SinOsc.kr(5, Rand(0.0, 1.0)).range(0.7,0.8))*0.25;\n sig = sig * env * amp;\n Out.ar(0, sig!2);\n}).add;\n);\n\n\n// play a chord (farfisa-like sound)\n(\n[60, 64, 67].do ({\n | note |\n Synth(\\violin, [\\midinote, note]);\n})\n);\n\n// play a single note (it seems also a flute!)\nx = Synth(\\violin, [\\midinote, 84]);\nx.set(\\gate, 0); // stop the note\n\n\n// play some random notes\n(\np = Pbind(\n \\instrument, \\violin,\n \\midinote, Prand( Scale.majorPentatonic.degrees, inf) + 60,\n \\dur, 3,\n \\legato, 1\n).play;\n)\n```"}, {"role": "assistant", "content": "Trying to procedurally synthetise a violin, I eventually came out with a \"Farfisa\" organ like sound.\r\nIt can be used also as a flute!."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n~closet = [\\hat, \\hat, \\hat, \\coat, \\coat, \\shoe, \\shoe];\n~closet.removeAll([\\hat, \\coat, \\shoe, \\shoe]; // Doesn't empty the closet, just removes what we wanted to\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n~closet = [\\hat, \\hat, \\hat, \\coat, \\coat, \\shoe, \\shoe];\n~closet.removeAll([\\hat, \\coat, \\shoe, \\shoe]); // Doesn't empty the closet, just removes what we wanted to\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// given a UGen graph:\n(\n{\nSplay.ar(SinOsc.ar({ exprand(300.0, 10000.0) } ! 17, 0, { 1.0.rand } ! 17)) * 0.1 \n}.play\n);\n\n// É all existing UGen inputs can be replaced or modified with an arbitrary function (here with a modulator)\n(\n{\nBend({ |in|\n in * LFDNoise3.kr(MouseX.kr(0.1, 200, 1), 0.1, 1)\n}, {\n Splay.ar(SinOsc.ar({ exprand(300.0, 10000.0) } ! 17, 0, { 1.0.rand } ! 17))\n \n}) * 0.1\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// given a UGen graph:\n(\n{\nSplay.ar(SinOsc.ar({ exprand(300.0, 10000.0) } ! 17, 0, { 1.0.rand } ! 17)) * 0.1 \n}.play\n);\n\n// É all existing UGen inputs can be replaced or modified with an arbitrary function (here with a modulator)\n(\n{\nBend({ |in|\n in * LFDNoise3.kr(MouseX.kr(0.1, 200, 1), 0.1, 1)\n}, {\n Splay.ar(SinOsc.ar({ exprand(300.0, 10000.0) } ! 17, 0, { 1.0.rand } ! 17))\n \n}) * 0.1\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `T2A`."}, {"role": "assistant", "content": "```supercollider\n// example\n(\n{\n var trig = Impulse.kr(MouseX.kr(1, 100, 1));\n Ringz.ar(T2A.ar(trig), 800, 0.01) * 0.4\n}.play;\n);\n\n// compare with K2A\n(\n{\n var trig = Impulse.kr(200);\n [T2A.ar(trig), K2A.ar(trig)].lag(0.001)\n}.plot(10/200);\n);\n\n// removing jitter by randomising offset\n(\n{\n var trig = Impulse.kr(MouseX.kr(1, 100, 1));\n Ringz.ar(T2A.ar(trig, WhiteNoise.kr.range(0, s.options.blockSize - 1)), 800, 0.01) * 0.4\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// SynthDefs from Ex. 1a\n\n(\n// Similar to Ex. 1b, but the midinote pattern will cause the stream to generate arrays of two elements,\n// they will be distributed to the indicated synths\n\nr = { |add = 0, int = 7| Pstutter(5, Pwhite(60, 65) + [0, int] + add) };\n\n// each setting streams affects two synths: those of corresponding indices of \\synths\n\np = PpolyPar([[\n \\synths, [0, 1],\n \\dur, 1/6,\n \\midinote, r.(0, 5),\n \\amp, 0.04\n ],[\n \\synths, [0, 2],\n \\dur, 1/4,\n \\midinote, r.(10, 6),\n \\amp, 0.\n// …\n```"}, {"role": "assistant", "content": "SynthDefs from Ex. 1a Similar to Ex. 1b, but the midinote pattern will cause the stream to generate arrays of two elements, (PpolyPar: polyphonic event pattern for an arbitrary number of timed setting streams)"}]} -{"conversations": [{"role": "user", "content": "What does `TWChoose.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Randomly select one of several inputs Arguments: trig; array; weights; normalize."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var a, freq;\n a = Dreset(Dseries(0, 2, inf), Drand([0, 0, 0, 1], inf));\n freq = Duty.kr(1/MouseX.kr(1, 40, 1), 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n}.play;\n);\n\n// reset when mouse button is pressed\n(\n{\n var a, freq;\n a = Dreset(Dseries(0, 2, inf), MouseButton.kr);\n freq = Duty.kr(1/MouseX.kr(1, 40, 1), 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n}.play;\n);\n\n// audio rate\n(\n{\n var a, nmax = 90;\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var a, freq;\n a = Dreset(Dseries(0, 2, inf), Drand([0, 0, 0, 1], inf));\n freq = Duty.kr(1/MouseX.kr(1, 40, 1), 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n}.play;\n);\n\n// reset when mouse button is pressed\n(\n{\n var a, freq;\n a = Dreset(Dseries(0, 2, inf), MouseButton.kr);\n freq = Duty.kr(1/MouseX.kr(1, 40, 1), 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n}.play;\n);\n\n// audio rate\n(\n{\n var a, nmax = 90;\n a = { Dreset(Dseries(0, 1, inf), Drand(0 ! nmax ++ 1, inf)) } ! 2;\n Duty.ar(SampleDur.ir, 0, a) * (0.1 / nmax)\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `UScoreEditor.soloEvents` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: events — (describe argument here). Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// Compare with Ex. 2 from DXFan help.\n// As DXFanOut, other than DXFan, doesn't return an array, a mix is not necessary, \n// by internal use of Out ugens the signal is mixed to the referred buses anyway.\n\n// For the same reason a normal release doesn't work, to get this option we can add an EnvGate.\n\n(\nx = {\n var lfo = { LFDNoise3.kr(0.2) };\n DXFanOut.ar(\n [Dseq([0, 1], inf), Dseq([1, 0], inf)],\n [\n LFTri.ar(150 * lfo.().range(1, 2), 0, 0.05),\n BPF.ar(PinkNoise.ar(), lfo.().range(1000, 3000),\n// …\n```"}, {"role": "assistant", "content": "Compare with Ex. 2 from DXFan help. As DXFanOut, other than DXFan, doesn't return an array, a mix is not necessary, (DXFanOut: crossfades signals between out buses according to demand-rate control)"}]} -{"conversations": [{"role": "user", "content": "What does `PlayerSocket.setSource` do? What arguments does it take?"}, {"role": "assistant", "content": "a player that can play other players using a cross-faded and fuse-protected socket Arguments: s; atTime — see atTime; releaseTime."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Synth`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n(\nSynthDef(\"help-Synth-get\", { |out, freq = 440|\n Out.ar(out, SinOsc.ar(freq, 0, 0.1));\n}).add;\n);\nx = Synth(\"help-Synth-get\");\nx.set(\\freq, 220 + 440.rand);\nx.get(\\freq, { |value| (\"freq is now:\" + value + \"Hz\").postln });\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What is `ControlName`?"}, {"role": "assistant", "content": "ControlName — Object to store control information of SynthDef (used internally)"}, {"role": "user", "content": "What does `ControlName.index` do?"}, {"role": "assistant", "content": "The index of the control."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nd = SynthDef(\\tone, { |out = 0, freq = 200|\n var sig;\n\n freq.spec = ControlSpec(20, 20000);\n sig = SinOsc.ar(freq);\n\n Out.ar(out, sig);\n}).add;\n);\n\nd.specs.freq.postln;\n```"}]} -{"conversations": [{"role": "user", "content": "What is `HPZ1` in SuperCollider?"}, {"role": "assistant", "content": "HPZ1 — Two point difference filter A special case fixed filter. Implements the formula: Category: UGens > Filters > Linear."}]} -{"conversations": [{"role": "user", "content": "What does `ServerLogGui.coloredDef` do? What arguments does it take?"}, {"role": "assistant", "content": "the interface for display and searching the ServerLog Arguments: defName; r. Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\smooth, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.linen(0.05, sustain, 0.1), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n)\n```"}, {"role": "assistant", "content": "plays an arpeggio on the \"left hand\" and an arpeggio on the \"right hand\"."}]} -{"conversations": [{"role": "user", "content": "What are you not good at?"}, {"role": "assistant", "content": "Everything outside SuperCollider. I have no audio input, no live data, and my knowledge ends at the documentation snapshot I was trained on — so I can be confidently wrong about Quarks and new UGens."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ MoogLadder.ar(Mix(LFSaw.ar([120, 180], 0, 0.33)), LinExp.kr(LFCub.kr(0.1, 0.5*pi), -1, 1, 180, 8500), 0.75.dup }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ MoogLadder.ar(Mix(LFSaw.ar([120, 180], 0, 0.33)), LinExp.kr(LFCub.kr(0.1, 0.5*pi), -1, 1, 180, 8500), 0.75).dup }.play\n```"}]} -{"conversations": [{"role": "user", "content": "What does `EZKnob.setColors` do? What arguments does it take?"}, {"role": "assistant", "content": "Wrapper class for label, knob, number box Arguments: stringBackground — An instance of Color. The `background` of the label and unit views.; stringColor — An instance of Color. The `stringColor` of the label and unit views.; numBackground — An instance of Color. The `numColor` of the number view.; numStringColor — An instance of Color. The `stringColor` of the number view.; numNormalColor — An instance of Color. The `normalColor` of the number view.; numTypingColor — An instance of Color. The `typingColor` of the number view.; knobColors — An instance of Color. The `knobColors` of the knob view.; background — An instance of Color. The `background` of the enclosing view.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// constant source (72), max deviation +/- 3\n// no repetition within 5 pitches\n\n(\nx = {\n var trig = Impulse.ar(5);\n var midi = Demand.ar(trig, 0, DIdev(72, 2, -1, 2));\n midi.poll(5, label: \\midi);\n SinOsc.ar(midi.midicps.lag(0.007)) ! 2 * 0.1\n}.play;\n;\n\nx.release\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// constant source (72), max deviation +/- 3\n// no repetition within 5 pitches\n\n(\nx = {\n var trig = Impulse.ar(5);\n var midi = Demand.ar(trig, 0, DIdev(72, 2, -1, 2));\n midi.poll(5, label: \\midi);\n SinOsc.ar(midi.midicps.lag(0.007)) ! 2 * 0.1\n}.play;\n);\n\nx.release\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a, b;\na = Pmulpre(\\note, 2, Pbind(\\note, Pseq([1, 2, 3])));\nx = a.asStream;\n9.do({ x.next(Event.default).postln });\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a, b;\na = Pmulpre(\\note, 2, Pbind(\\note, Pseq([1, 2, 3])));\nx = a.asStream;\n9.do({ x.next(Event.default).postln });\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `LinearSpline` in SuperCollider briefly."}, {"role": "assistant", "content": "LinearSpline — A simple linearly interpolated spline passing through a series of points. A spline is defined by a series of points. These points may be of 2 or more dimensions. 2 dimensional splines may be displayed and edited using a gui. A LinearSpline interpolates between points using straight lines with no curvature. Category: Splines, Envelopes > Splines."}]} -{"conversations": [{"role": "user", "content": "What does `RedBMP.palette` do?"}, {"role": "assistant", "content": "Colour table as a 1-dimensional array of Color objects. Size 256 for 8bit images, size 16 for 4bit images and size 2 for 1bit"}]} -{"conversations": [{"role": "user", "content": "What does `BandSplitter2.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Split signal into 2 phase-coherent bands Arguments: sig — Input signal; f1 — Frequency of crossover.; order — Order of crossover filters (2, 4, 6, or 8)."}]} -{"conversations": [{"role": "user", "content": "What is the difference between an audio bus and a control bus?"}, {"role": "assistant", "content": "Both are numbered channels on the server used to move signal between nodes. An audio bus carries audio-rate signal and holds one or more audio channels; a control bus carries one value per block, like a parameter. You write with Out.ar / Out.kr and read with In.ar / In.kr, or with `.asMap` / `\\param, bus.asMap` to drive a Synth's control from a bus. Buses are how effects are chained: a synth writes to a private bus, the effect reads it and writes to Out.ar(0, …)."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\nb = Buffer.alloc(s, s.sampleRate);\n(\n{\n MultiTap.ar(`[0.1, 0.2, 0.3, 0.4], `[0.1, 0.2, 0.4, 0.8],\n Decay.ar(Dust.ar(2), 0.1, PinkNoise.ar), bufnum: b.bufnum)\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\nb = Buffer.alloc(s, s.sampleRate);\n(\n{\n MultiTap.ar(`[0.1, 0.2, 0.3, 0.4], `[0.1, 0.2, 0.4, 0.8],\n Decay.ar(Dust.ar(2), 0.1, PinkNoise.ar), bufnum: b.bufnum)\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for radio static with tuning noise (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"radiostatic\", {arg out=0;\n var hum, sineSweep, tuning, dustNoise, staticNoise, humFreq, numHarms;\n \n numHarms = 7;\n humFreq = 100;\n hum = Array.fill(numHarms, {|i| SinOsc.ar( (i+1) * humFreq, 0, 1/numHarms)});\n hum = hum.sum;\n dustNoise = Dust.ar(LFNoise1.ar(0.5).range(1000,8000));\n staticNoise = hum * dustNoise * LFNoise1.ar(1).range(0.5, 2);\n \n sineSweep = SinOsc.ar(LFNoise2.ar(1).range(20, 11000));\n tuning = SinOsc.ar(10000).ring4(sineSweep) * LFNoise2.ar(1.1).range(0.05, 0.1);\n\n Out.ar(out, Pan2.ar(staticNoise + tuning, 0));\n}).add;\n);\n \na = Synth(\"radiostatic\");\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\nIdentitySet[1, 2, 3].add(4);\nIdentitySet[1, 2, 3].add(3);\n// the two strings are equal but not identical\nIdentitySet[\"abc\", \"def\", \"ghi\"].add(\"def\");\n// symbols are guaranteed to be identical if they are equal\nIdentitySet['abc', 'def', 'ghi'].add('def');\nIdentitySet['abc', 'def', 'ghi'].add('jkl');\n```"}, {"role": "assistant", "content": "the two strings are equal but not identical symbols are guaranteed to be identical if they are equal (IdentitySet: a set according to identity)"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nSynthDef(\\bigLocalBuf, {\n LocalBuf(88200).set(Array.fill(88200, { #[0, 0.25, 0.5, 0.75, 1.0].choose }))\n}).add;\n\nSynthDescLib.at(\\bigLocalBuf).constants;\n// prints: FloatArray[1, 88200, 0, 0.75, 0.5, 0.25\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nSynthDef(\\bigLocalBuf, {\n LocalBuf(88200).set(Array.fill(88200, { #[0, 0.25, 0.5, 0.75, 1.0].choose }))\n}).add;\n\nSynthDescLib.at(\\bigLocalBuf).constants;\n// prints: FloatArray[1, 88200, 0, 0.75, 0.5, 0.25]\n```"}]} -{"conversations": [{"role": "user", "content": "What does `PlayerBinop.new` do? What arguments does it take?"}, {"role": "assistant", "content": "the result of a binary op on a Player Arguments: operator; a; b."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// SynthDefs from Ex. 1a\n\n(\n// Similar to Ex. 1b, but the midinote pattern will cause the stream to generate arrays of two elements,\n// they will be distributed to the indicated synths\n\nr = { |add = 0, int = 7| Pstutter(5, Pwhite(60, 65) + [0, int] + add) };\n\n// each setting streams affects two synths: those of corresponding indices of \\synths\n\np = PpolyPar([[\n \\synths, [0, 1],\n \\dur, 1/6,\n \\midinote, r.(0, 5),\n \\amp, 0.04\n ],[\n \\synths, [0, 2],\n \\dur, 1/4,\n \\midinote, r.(10, 6),\n \\amp, 0.\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// SynthDefs from Ex. 1a\n\n(\n// Similar to Ex. 1b, but the midinote pattern will cause the stream to generate arrays of two elements,\n// they will be distributed to the indicated synths\n\nr = { |add = 0, int = 7| Pstutter(5, Pwhite(60, 65) + [0, int] + add) };\n\n// each setting streams affects two synths: those of corresponding indices of \\synths\n\np = PpolyPar([[\n \\synths, [0, 1],\n \\dur, 1/6,\n \\midinote, r.(0, 5),\n \\amp, 0.04\n ],[\n \\synths, [0, 2],\n \\dur, 1/4,\n \\midinote, r.(10, 6),\n \\amp, 0.03\n ],[\n \\synths, [1, 2],\n \\dur, 1/3,\n \\midinote, r.(20, 7),\n \\amp, 0.05\n ]],\n [\\saw, \\pulse, \\sine]\n).play\n);\n\np.stop;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Window.setTopLeftBounds` do? What arguments does it take?"}, {"role": "assistant", "content": "A convenience method that, unlike #-bounds, sets the bounds by measuring position from the top-left corner of the screen, and vertically offset by Arguments: rect — A Rect.; menuSpacer — An Integer amount of pixels.."}]} -{"conversations": [{"role": "user", "content": "Are you an AI?"}, {"role": "assistant", "content": "Yes. I am a small language model specialised in SuperCollider. I generate text; I cannot hear audio, run sclang, or check whether a patch sounds the way you want."}]} -{"conversations": [{"role": "user", "content": "What does `Font.pointSize` do? What arguments does it take?"}, {"role": "assistant", "content": "Gets or sets the point-size of the font. When getting, returns nil if the font has pixel-size instead. See #-hasPointSize for Arguments: A Float.."}]} -{"conversations": [{"role": "user", "content": "What does `PathName.fileName` do?"}, {"role": "assistant", "content": "returns just the name of the file itself; i.e. everything after the last slash in the full path."}]} -{"conversations": [{"role": "user", "content": "What is `ArrayedCollection`?"}, {"role": "assistant", "content": "ArrayedCollection — Abstract superclass of Collections of fixed maximum size"}, {"role": "user", "content": "What does `ArrayedCollection.newClear` do?"}, {"role": "assistant", "content": "Creates a new instance with indexedSize indexable slots. The slots are filled with Nil, zero or something else appropriate to the type of indexable slots in the object. `Array.newClear(4).postln;`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n pitches.size.do{ |i|\n {\n var freq = pitches[i].midicps;\n var env = Env.perc.ar(Done.freeSelf);\n SinOsc.ar(freq) * 0.1 * env\n }.play;\n 0.2.wait\n }\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Timer`."}, {"role": "assistant", "content": "```supercollider\n// using timer to modulate sine frequency: the slower the trigger is the higher the frequency\n(\n{ var trig;\n trig = Impulse.kr(MouseX.kr(0.5, 20, 1));\n SinOsc.ar(Timer.kr(trig) * 500 + 500, 0, 0.2)\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// you have to write the sample path in the firts line\n\n~bufferdue = Buffer.read(s,\" WRITE YOUR SAMPLE PATH HERE \", bufnum:2);\n\n(\nSynthDef.new(\\bufbeat, {\n arg amp = 1, out = 0, buf, start, end, freq = 1;\n var sig, ptr;\n ptr = LFNoise1.ar(freq).range(0.0,end);\n sig = BufRd.ar(2, buf, ptr);\n sig = sig * amp;\n Out.ar(out, sig);\n}).add\n);\n\nx = Synth.new(\\bufbeat, [\\buf, ~bufferdue.bufnum, \\start,0, \\end, ~bufferdue.numFrames-1, \\freq, 1, \\amp, 0.5],g);\n\nx.free;\n```"}, {"role": "assistant", "content": "a simple BufRd with the starting point of lecture randomized by LFNoise1."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nb = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n\n(\n{\n var snd, envTime, knee, out;\n snd = PlayBuf.ar(1, b, BufRateScale.kr(b), loop: 1);\n envTime = MouseX.kr(1.0e-3, 0.1e-3);\n knee = MouseY.kr(0, -90).dbamp;\n out = DelayC.ar(snd, 0.01, envTime * 0.5) * EnvFollow.ar(snd, 1 - (envTime * SampleRate.ir).reciprocal).max(knee).reciprocal;\n out * 0.1!2\n}.play;\n)\n```"}, {"role": "assistant", "content": "a replication of the legendary LADSPA plugin of the same name, originally written by steve harris. a compressor with a super fast attack which results in harsh distortion fx. requires sc3-plugins."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Diwhite`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a, freq, trig;\n a = Diwhite(0, 15, inf);\n trig = Impulse.kr(MouseX.kr(1, 40, 1));\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nx = nil;\nx = x.add(8); // returns an array\nx = x.add(7; // appends to the array\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nx = nil;\nx = x.add(8); // returns an array\nx = x.add(7); // appends to the array\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Pmulp`."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\freq, Pseq([500, 600, 700]), \\instrument, \\sinegrain);\na = Pmulp(\\freq, Pseq([0.5, 0.9, 0.8], inf), a);\na.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Pushing air."}, {"role": "assistant", "content": "```supercollider\n/*\n0050\n\"pushing air\" => \".--. ..- ... .... .. -. --. / .- .. .-.\"\n*/\n\n~morsestr = \".--. ..- ... .... .. -. --. / .- .. .-. / \";\n\n~ctlbus1 = Bus.control(s);\nMIDIIn.connectAll;\n\n(\nSynthDef(\\perc, {|freq=280|\n var ampEnv, snd, attack, release, sat, mod;\n release = 3;\n attack = ~ctlbus1.kr;\n sat = -2;\n mod = SinOsc.ar(4, 0, 2);\n ampEnv = EnvGen.ar(Env.perc(attack, release, 1), doneAction:2);\n snd = ampEnv * SinOsc.ar([freq, (1.005*freq)+mod], [Rand(0,3.14),Rand(0,3.14)]);\n snd = 2/(1 + (sat*snd).exp) - 1;\n Out.ar(0,snd);\n}).add;\n);\n\n~t = TempoClock.new;\n~t.tempo = 3;\nTdef(\\morse).play(~t);\n\n\n(\nMIDIdef.cc(\\attackTime, \n {|val, num, chan, src| \n var attackTime;\n\n attackTime = val.linlin(0,127,0,2);\n ~ctlbus1.set(attackTime);\n (\"attackTime: \" ++ attackTime).postln;\n },2);\n\nMIDIdef.cc(\\tempo, \n {|val, num, chan, src| \n var index;\n var tempoArray = [3,6,12];\n \n index = val.linlin(0,127,0,2);\n ~t.tempo = val.linlin(0,127,1,12);//tempoArray[index];\n val.linlin(0,127,1,12).postln;//tempoArray[index].postln;\n },14);\n);\n\n(\nTdef(\\morse,\n{ \n inf.do{ |i| \n \n var f0 = 180 * (2**(0/12));\n var freq = 2**(([-7,-3,0,2,5,9,12].choose)/12) * f0;\n var char = ~morsestr.wrapAt(i).asString;\n \n switch(char,\n \".\", { \".\".post; \n //x = Synth(\\default); \n x = Synth(\\perc, [\\freq, freq]); \n 1.wait;\n //x.release;\n },\n \"-\", { \"-\".post; \n //x = Synth(\\default); \n x = Synth(\\perc, [\\freq, freq]); \n 3.wait;\n //x.release;\n },\n \" \", { \" \".post; \n 1.wait;\n },\n \"/\", { \"/\".post;\n 3.wait;\n }, {});\n };\n})\n);\n\nTdef(\\morse).reset;\nTdef(\\morse).pause;\nTdef(\\morse).stop;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Modanung - Return of the King."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"plucking\", {arg amp = 0.1, freq = 220, decay = 5, coef = 0.1;\nvar env, snd;\nenv = EnvGen.kr(Env.linen(0, decay, 0.5), doneAction: 2);\nsnd = Pluck.ar(\n in: SinOsc.ar(0.5*freq, 0, amp),\n trig: Impulse.kr(0),\n\n maxdelaytime: 0.1,\n delaytime: freq.reciprocal,\n decaytime: decay,\n coef: coef);\n Out.ar(0, [snd, snd]);\n}).add;\n);\n(\nSynthDef(\\FreeVerb2x2, {|outbus, mix = 0.23, room = 0.42, damp = 0.666, amp = 1.0|\n var signal;\n\n signal = In.ar(outbus, 2);\n\n ReplaceOut.ar(outbus,\n FreeVerb2.ar( // FreeVerb2 - true stereo UGen\n signal[0], // Left channel\n signal[1], // Right Channel\n mix, room, damp, amp)); // same params as FreeVerb 1 chn version\n\n}).add;\nz = Synth(\\FreeVerb2x2, [\\outbus, 0], addAction:\\addToTail)\n);\n(\nPbind(\n \\instrument, \"plucking\",\n \\scale, Scale.locrian,\n \\degree, Prand([[-2.5, -4.001], [-7.002, -5], [-1, -3.003], [-1.005, -0.51], [-5, -3], [-4, -4], [0, 1]], inf),\n \\amp, Pseq([0.23, 0.042, 0.2, 0.32], inf),\n \\decay, Pseq([0.25,2.5, 0.025, 0.25], inf),\n \\coef, Pseq([0.3, 0.2, 0.9], inf),\n \\dur, Pseq([0.2, 0.01, 0.21, 0.001, 0.0001, 0.00911, 0.191, 0.23],inf)\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `CompositeInstr` in SuperCollider?"}, {"role": "assistant", "content": "CompositeInstr — two Instr combined together with function composition Two Instr chained one into the next. Category: Libraries > crucial > Instr."}]} -{"conversations": [{"role": "user", "content": "What is `BelaScope`?"}, {"role": "assistant", "content": "BelaScope — Bela's Oscilloscope interface"}, {"role": "user", "content": "What does `BelaScope.scope` do?"}, {"role": "assistant", "content": "Send an array of UGen data to Bela's oscilloscope."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n{ BelaScope.scope(0, SinOsc.ar) }.play;\n// same using UGen\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ LFNoise0.ar(1000, 0.25) }.play;\n\n// modulate frequency\n\n{ LFNoise0.ar(XLine.kr(1000, 10000, 10), 0.25) }.play;\n\n// as frequency modulator\n(\n{ SinOsc.ar(\n LFNoise0.ar(4, 400, 450),\n 0, 0.2\n )\n}.play;\n)\n\n// freq is the rate of starting points\n{ var freq = 1000; [LFNoise0.ar(freq), Impulse.ar(freq) }.plot\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ LFNoise0.ar(1000, 0.25) }.play;\n\n// modulate frequency\n\n{ LFNoise0.ar(XLine.kr(1000, 10000, 10), 0.25) }.play;\n\n// as frequency modulator\n(\n{ SinOsc.ar(\n LFNoise0.ar(4, 400, 450),\n 0, 0.2\n )\n}.play;\n)\n\n// freq is the rate of starting points\n{ var freq = 1000; [LFNoise0.ar(freq), Impulse.ar(freq)] }.plot\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `PV_MagClip` in SuperCollider briefly."}, {"role": "assistant", "content": "PV_MagClip — Clip bins to a threshold. Clips bin magnitudes to a maximum threshold. Category: UGens > FFT."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\np = ProxySpace.push(s.boot);\n\nl = NdefGui(nil, 3).moveTo(10, 120);\nm = NdefGui(nil, 3).moveTo(10, 240);\nn = NdefGui(nil, 3).moveTo(10, 360);\no = NdefGui(nil, 3).moveTo(10, 480);\n\nSpec.add(\\dens, [0.1, 300, \\exp]);\n\n// make 3 kinds of proxies: using tilde/proxyspace, Ndef, and unnamed.\n~spacy = { |dens = 5| Formlet.ar(Dust.ar(dens ! 2), LFDNoise0.kr(20 ! 2).lag(0.1).linexp(-1, 1, 300, 5000), 0.003,\n// …\n```"}, {"role": "assistant", "content": "make 3 kinds of proxies: using tilde/proxyspace, Ndef, and unnamed. put one in each editor (NdefGui: a gui for a NodeProxy or Ndef)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// time warped analog bubbles, time scale is mouse x position\n{\n\n Bend.time(MouseX.kr(0.02, 20, 1), {\n var f = LFSaw.kr(0.4, 0, 24, LFSaw.kr([8,7.23], 0, 3, 80)).midicps; // glissando function\n CombN.ar(SinOsc.ar(f, 0, 0.04), 0.2, 0.2, 4) // echoing sine wave\n })\n\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// time warped analog bubbles, time scale is mouse x position\n{\n\n Bend.time(MouseX.kr(0.02, 20, 1), {\n var f = LFSaw.kr(0.4, 0, 24, LFSaw.kr([8,7.23], 0, 3, 80)).midicps; // glissando function\n CombN.ar(SinOsc.ar(f, 0, 0.04), 0.2, 0.2, 4) // echoing sine wave\n })\n\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SimpleNumber.ellint3C` do?"}, {"role": "assistant", "content": "Returns the complete elliptic integral of the third kind, Legendre form. Requires `-1 <= k <= 1` and `n <"}]} +{"conversations": [{"role": "user", "content": "Explain `DetaBlockerBuf` in SuperCollider briefly."}, {"role": "assistant", "content": "DetaBlockerBuf — Demand version of the BetaBlocker VChip Demand Rate BetaBlocker UGen with a heap possibly shared with other instances. For every trigger, it computes one step of the underlying BetaBlocker engine and then returns the stack's top element. Category: UGens > Demand."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ LFNoise1.ar(1000, 0.25) }.play;\n\n// modulate frequency\n\n{ LFNoise1.ar(XLine.kr(1000, 10000, 10), 0.25) }.play;\n\n// as frequency modulator\n(\n{ SinOsc.ar(\n LFNoise1.ar(4, 400, 450),\n 0, 0.2\n )\n}.play;\n)\n\n// freq is the rate of starting points\n{ var freq = 1000; [LFNoise1.ar(freq), Impulse.ar(freq) }.plot\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ LFNoise1.ar(1000, 0.25) }.play;\n\n// modulate frequency\n\n{ LFNoise1.ar(XLine.kr(1000, 10000, 10), 0.25) }.play;\n\n// as frequency modulator\n(\n{ SinOsc.ar(\n LFNoise1.ar(4, 400, 450),\n 0, 0.2\n )\n}.play;\n)\n\n// freq is the rate of starting points\n{ var freq = 1000; [LFNoise1.ar(freq), Impulse.ar(freq)] }.plot\n```"}]} {"conversations": [{"role": "user", "content": "I get 'Node not found' when I call .set on a Synth after a while."}, {"role": "assistant", "content": "The Synth was freed and the language still holds a reference. That happens whenever the SynthDef used `doneAction: 2` and the envelope finished, or when something called `freeAll`/`CmdPeriod`. Guard it with `if (x.notNil and: { x.isPlaying }) { x.set(\\freq, 300) }`, or store the node in a variable that you clear when it ends. For sustained sounds the right pattern is a `gate` argument with `doneAction: 2` on the EnvGen, so the node lives until you release it."}]} -{"conversations": [{"role": "user", "content": "What does `InstrSpawner.latency` do?"}, {"role": "assistant", "content": "a Pbind-like spawner that plays an Instr with streams supplied to its inputs"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ControlRate`."}, {"role": "assistant", "content": "```supercollider\n{ ControlRate.ir.poll }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `RedWorld.damping` do?"}, {"role": "assistant", "content": "A scalar. The cost of running into walls"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Pevent`."}, {"role": "assistant", "content": "```supercollider\nPevent(Pbind(\\harmonic, Pseq([24, 25, 29, 30], inf)), (octave: 3, dur: 0.2)).trace.play;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Changing an Env while playing\n(\nSynthDef(\\env, { |i_outbus = 0|\n var env, envctl;\n\n // make a dummy 8 segment envelope\n env = Env.newClear(8);\n\n // create a control argument array\n envctl = \\env.kr(env.asArray);\n\n ReplaceOut.kr(i_outbus, EnvGen.kr(envctl, doneAction: Done.freeSelf));\n}).add;\n);\n\n(\nSynthDef(\\sine, { |out, freq = 440|\n Out.ar(out, SinOsc.ar(freq, 0, 0.2));\n}).add;\n);\n\nf = Bus.control(s, 1);\nf.set(800);\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Changing an Env while playing\n(\nSynthDef(\\env, { |i_outbus = 0|\n var env, envctl;\n\n // make a dummy 8 segment envelope\n env = Env.newClear(8);\n\n // create a control argument array\n envctl = \\env.kr(env.asArray);\n\n ReplaceOut.kr(i_outbus, EnvGen.kr(envctl, doneAction: Done.freeSelf));\n}).add;\n);\n\n(\nSynthDef(\\sine, { |out, freq = 440|\n Out.ar(out, SinOsc.ar(freq, 0, 0.2));\n}).add;\n);\n\nf = Bus.control(s, 1);\nf.set(800);\n\n// use f's control bus value for frequency\n// i.e. *map* the control to read from the bus\na = Synth(\\sine, [freq: f.asMap]);\n\nSynth(\\env, [i_outbus: f, env: Env([700, 900, 900, 800], [1, 1, 1]*0.4, \\exp)]);\n\nSynth(\\env, [i_outbus: f, env: Env([1000, 1000, 800, 1000, 900, 1000], [1, 1, 1, 1, 1]*0.3, \\step)]);\n\na.free;\nf.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Pan Sonic emulation - Katodivaihe - lahetys?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a, b, c, d, n, e, f, out;\n\n a = Impulse.ar(8)*1.5;\n\n b = WhiteNoise.ar * Env([1.0,1.0,0.0],[0.01,0.01],\\step).ar(0, Impulse.ar(1 )) ;\n b = FreeVerb.ar(b, 0.5, 0.4)*2.5;\n\n c = SinOsc.ar(40) * Env.perc(0.01,0.2).ar(0, TDuty.ar(Dseq([1/4,1/2,1/8,1/8],inf)));\n 5.do{ c = (c.distort + c)*0.75};\n c = c * 1.5;\n\n d = LPF.ar(Saw.ar([20,47]).sum , XLine.ar(4000,200,0.5)) * Env.perc.ar(0, Impulse.ar(1/16)) * 0.5;\n d = (GVerb.ar( d , roomsize:10, revtime:6) * 200).clip(-1.0,1.0) * 0.3;\n\n n = 12;\n e = ( Saw.ar( 40*(1..n) * ({ LFNoise1.ar(0.1).range(1,1.01) } ! n) ) *\n ({ LFNoise1.ar(0.1).range(0.0,1.0) }!n)).sum * 10;\n e = CombC.ar(e, 0.1, 0.1, 4) + e;\n e = e.tanh * 0.3 * SinOsc.ar(0.05).range(0.5,1.0);\n e = e.dup;\n e = e * SinOsc.ar(0.03).range(0.2,1.0) * 0.5;\n\n f = Blip.ar(100) * Blip.ar(100) * Env([0.0,0.0,1.0],[8,8],[\\step,\\linear,\\step])\n .ar(0, Impulse.ar(1/16)) * 2 ;\n\n out = ((a + b + c + f) ! 2) + d + e;\n out = out * 0.2\n\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for algorithmic/aleatoric composition for mallets and proxy patterns."}, {"role": "assistant", "content": "```supercollider\n/*\"Musical Toys For Little Robots\"\n\n or\n\n \"How I learned to stop worrying and love the proxy\"\n\nhttp://soundcloud.com/unknown-artist-6/musical-toys-for-little-robots\n\n */\n\n~fx=Bus.audio(s,2);\n\n(\nSynthDef(\\mallet,{arg in=0,out=0,m=48,a=1,r=1,p=0;\n\n var sig=Array.fill(3,{|n| SinOsc.ar(m.midicps+(n*0.01),mul:a*0.3)}).sum;\n var env=EnvGen.kr(Env.perc(0.001,r),gate:1,doneAction:2);\n\n Out.ar(out,Pan2.ar(sig*env,pos:p));\n};\n).add;\n\nSynthDef(\\rev,{arg in=0,out=0;\n var sig=In.ar(in,2);\n sig=sig*0.8+CombC.ar(sig,0.5,0.3,0.5,0.2);\n Out.ar(out,sig)\n };\n).add;\n);\n\nSynth(\\rev,[\\in:~fx]);\n\n\n(\nfork{\n var degrees=Prand([0,4,5,7,9,12],inf).asStream;\n var root=[36,48,60,72];\n var x;\n x=Array.new;\n a=PatternProxy(Pseq([0+root.wchoose([0.3,0.4,0.2,0.1])],inf));\n d=1/8;\n\n ~streams=[];\n ~names={|pbind| ~streams=~streams++pbind.play(quant:1)};\n\n ~names.value(Pbind(*[\\instrument:\\mallet,\n \\m:a,\n \\dur:d,\n \\a:{rrand(0.4,1)*0.05},\n \\p:{rrand(-0.2,0.2)},\n \\r:{rrand(0.5,0.8)},\n \\out:~fx\n ]));\n\n\n 20.do({|n|\n x=x.add(degrees.next+root.wchoose([0.3,0.4,0.2,0.1]));\n x.postln;\n a.source=Pseq(x.scramble,inf);\n if ((n+1) % 6 == 0,{~names.value(Pbind(*[\\instrument:\\mallet,\n \\m:Pcollect({arg inval;inval-[-24,12].choose},a),\n \\dur:d,\n \\a:{rrand(0.4,1)*0.05/(n+1)},\n \\p:{rrand(-0.2,0.2)},\n \\r:{rrand(0.5,0.8)},\n \\out:~fx\n ]));\"new stream\".postln});\n (n+1).wait});\n\n 19.do({|n|\n x.removeAt(0);\n x.postln;\n a.source=Pseq(x.scramble,inf);\n (19-(n+1)).wait;});\n4.wait;\n ~streams.do{|n| n.stop;2.wait};\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `PV_MagFreeze` in SuperCollider?"}, {"role": "assistant", "content": "PV_MagFreeze — Freeze magnitudes. Freezes magnitudes at current levels when `freeze` > 0. Category: UGens > FFT."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PV_Add`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\nb = Buffer.read(s, ExampleFiles.child);\n\n(\nSynthDef(\"help-add\", { |out = 0, soundBufnum|\n var inA, chainA, inB, chainB, chain ;\n inA = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);\n inB = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum) * 0.5, loop: 1);\n chainA = FFT(LocalBuf(2048), inA);\n chainB = FFT(LocalBuf(2048), inB);\n chain = PV_Add(chainA, chainB);\n Out.ar(out, 0.1 * IFFT(chain).dup);\n}).play(s, [\\soundBufnum, b.bufnum]);\n);\n\nb.free\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Electronic Waves in the beach."}, {"role": "assistant", "content": "```supercollider\n// 2012.05.10\n// Work for NX013 Class\n// Comment: Ocean of Bass.\n\np = ProxySpace.push(s.boot);\n\n~a.play;\n\n~a = { var array;\n array = Array.series(rrand(1,1000),rrand(1,1000),rrand(1,30));\n array = array ++ array.reverse;\n Pan2.ar(LeakDC.ar(Normalizer.ar(\n BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(FreeVerb.ar(\n BPF.ar(\n LPF.ar(FreeVerb.ar(WhiteNoise.ar(),\n rrand(0.5,1.0),rrand(0.5,1.0),rrand(0.5,1.0))\n ,Demand.kr(Impulse.kr(rrand(5,20)),0,Dseq(array,inf)))\n ,rrand(100,5000),rrand(0.1,1.0))\n ,0.1,0.1,0.1)\n ,100,6.0,6),1000,6.0,0),5000,6.0,0),10000,6.0,6)\n ,(1.33/0.999)*1.0,0.1)),0)\n};\n\n~a = nil;\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Latency`?"}, {"role": "assistant", "content": "Latency — Measure audio latency for multiple channels"}, {"role": "user", "content": "What does `Latency.testAudio` do?"}, {"role": "assistant", "content": "main method to measure audio latency"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// server has hardwareBufferSize 512 for this example.\ns.options.hardwareBufferSize = 512; s.reboot;\n// do something that sends messages with server latency\nPbind(\\degree, Pbrown(-14, 14, 3), \\dur, 1/8).play;\ns.latency;\ns.latency = 0.1; // tune down ...\ns.latency = 0.05;\ns.latency = 0.025;\ns.latency = 0.012; // ... until every message posts \"late 0.01....\" now\ns.latency = 0.018; // go back up -> fewer late messages\ns.latency = 0.021; // go back up until ...\ns.latency = 0.024; // late messages are completely gone again\n\ns.latency = 0.03; // this works on many systems\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for first step?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n\nz = ( ( SinOsc.ar( ((LFSaw.kr(-0.05,1) +1) *100 + 20 ), LFTri.kr(40,0,1), LFSaw.kr(1.5) ) \n * LFTri.kr(rrand(0.005,0.03),3.99.rand,0.2) ) + \n( LFPulse.ar(60,0,0.5,Pulse.ar(0.5,0.5,0.1)) * LFTri.kr(rrand(0.005,0.03),3.99.rand,0.5) ) +\n( SinOsc.ar(65,0,LFPulse.kr(0.66666,0.5,0.3)*0.3) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) )+\n( LFPar.ar(120,0,LFPulse.kr(0.5,0.5,0.2)*0.3) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( LFCub.ar(185,0,LFPulse.kr(0.5,0.74,0.2)*0.3) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( SinOsc.ar(365,0,LFPulse.kr(1.33333333,0,0.1)*0.3) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( FreeVerb.ar(LFTri.ar(260,0,LFPulse.kr(0.5,0.25,0.01)*0.3),0.5,0.8,0.1) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( SinOsc.ar(800,0,LFPulse.kr(2,0,0.1)*0.1) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( LFPar.ar(820,0,LFPulse.kr(1.666666,0,0.1)*0.1) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( WhiteNoise.ar( LFPulse.kr(2,0.5,0.001,1) )/2 * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( WhiteNoise.ar( LFPulse.kr(1,0.5,0.001,1) )/2 * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( WhiteNoise.ar( LFPulse.kr(1.666666,0.5,0.001,1) )/4 * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( WhiteNoise.ar( LFPulse.kr(1.333333,0.5,0.001,1) )/4 * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) );\n\nFreeVerb.ar(\n ((CombC.ar(\n DelayN.ar(\n DelayN.ar(z, 0.5, [0.5,0.75], 1, z), \n 0.5, 0.5, 1, z), \n 0.1, LFNoise0.kr(1,0.05,0.001).abs, 2, z))+z),\n0.1,1,0.1); \n\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Nested ifs in a SynthDef?"}, {"role": "assistant", "content": "```supercollider\n(\n{\nvar noise, out;\nnoise = LFNoise0.kr(8);\n\nout = if( noise > 0.0,\n if(noise > 0.5, \n if(noise > 0.9, WhiteNoise.ar(0.2), Pulse.ar(60, 0.5, 0.4)),\n SinOsc.ar(500, 0, 0.25)\n ),\n Saw.ar(160, 0.5)\n);\n\nout ! 2\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Those were the times."}, {"role": "assistant", "content": "```supercollider\n(\ns.waitForBoot({\n\n SynthDef(\\singer, {\n | out=0, freq=440, amp=0.5, vibrato=6|\n var lfo, lfo2, lfo3, sig;\n lfo = SinOsc.kr(1/5, 0).range(250,1000);\n lfo2 = SinOsc.kr(1/5, 0).range(0.1,0.9);\n lfo3 = SinOsc.kr(vibrato).range(0.3, 1);\n sig = lfo3*RLPF.ar(in:VarSaw.ar(freq:Lag.ar(in:K2A.ar(freq), lagTime:0.3), iphase:0, width:lfo2, mul:amp), freq:lfo, rq:200/lfo);\n Out.ar(out, sig!2);\n }).add;\n\n s.sync;\n\n Pdef.defaultQuant_(0);\n Pdef(\\bass, Pmono(\\default, \\dur, Pwhite(0.01, 0.1, inf), \\freq, (Pgbrown(1,8,5) * 20).round(10), \\amp, Pbrown(0.2,0.6,0.05)));\n Pdef(\\computer, Pmono(\\default, \\dur, Pwhite(0.01, 0.1, inf), \\freq, (Pgbrown(1,8,9) * 100).round(20), \\amp, Pbrown(0.2,0.6,0.05)));\n Pdef(\\soprano, Pmono(\\singer, \\dur, Pwhite(0.01, 0.1, inf), \\freq, Pgbrown(1,8,0.05) * 200, \\amp, Pbrown(0.2,0.6,0.05)/5, \\vibrato, Pbrown(4,7,0.125)));\n Pdef(\\soprano2, Pmono(\\singer, \\dur, Pwhite(0.01, 0.1, inf), \\freq, Pbrown(3,6,0.1) * 100, \\amp, Pbrown(0.2,0.6,0.05)/5, \\vibrato, Pbrown(3,8,0.125)));\n\n fork {\n Pdef(\\bass).play;\n 10.wait;\n Pdef(\\computer).play;\n 10.wait;\n Pdef(\\soprano).play;\n 10.wait;\n Pdef(\\soprano2).play;\n 10.wait;\n Pdef(\\computer).stop;\n 20.wait;\n Pdef(\\bass).stop;\n 10.wait;\n Pdef(\\soprano).stop;\n Pdef(\\soprano2).stop;\n Pdef(\\bass).play;\n Pdef(\\soprano).play;\n 10.wait;\n Pdef(\\soprano2).play;\n 10.wait;\n Pdef(\\computer).play;\n 20.wait;\n Pdef(\\bass).stop;\n Pdef(\\computer).stop;\n Pdef(\\soprano).stop;\n Pdef(\\soprano2).stop;\n }\n\n});\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Object.performArgs` do? What arguments does it take?"}, {"role": "assistant", "content": "Like #-perform, but allows you to pass a key-value array of keyword arguments. Useful in #-doesNotUnderstand and other places where you might accept a variety of keyword Arguments: selector — A Symbol of the method name.; args — An Array of the arguments.; kwargs — An Array of keyword-argument pairs. Example `x.performArgs(\\foo, [1, 2], [\\bar, 10]);`."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\RotateAz;\n~description = \"Rotation around the z-axis (angle from -180 to 180)\";\n\n~function = { |in = 0, order = 1, rotateAziDeg = 0|\n\n // Rotating the scene is done from the perspective of the listener\n // rotation follows the right-hand rule of rotation:\n // * Positive azimuth means the listener turns head to the left\n\n HOATransRotateAz.ar(\n order: order,\n in: in,\n az: rotateAziDeg.degrad\n );\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "Rand or rand difference?"}, {"role": "assistant", "content": "SuperCollider forum — Rand or rand difference?\n\nI think you meant to compare Rand and rrand (not rand) – both generate a random number between a given low and high, but Rand is intended to be used inside a SynthDef and the behavior is slightly different. Compare:\n\n```supercollider\n(\nSynthDef(\\test, {\n var freq = rrand(400, 600);\n Out.ar(0, SinOsc.ar(freq) * 0.2);\n}).add;\n);\n\nSynth(\\test); // run and stop multiple times: always same freq\n\n(\nSynthDef(\\test2, {\n var freq = Rand(400, 600);\n Out.ar(0, SinOsc.ar(freq) * 0.2);\n}).add;\n);\n\nSynth(\\test2); // run and stop multiple times: every time a different freq\n```\n\nAs you can read in the help file, Rand is intended to be used inside SynthDefs when you want the particular behavior of a newly generated random frequency for each Synth called. You can use rrand(lo, hi) inside a SynthDef too, if you want the random number to be generated only once at time of SynthDef creation (it gets “inscribed in the recipe” for good), so all future and all Synth calls based on that SynthDef to use on that same random number.\n\nAs a side note, rand (as opposed to rrand) generates a random number between zero and the receiver:\n\n```supercollider\nrand(8); // random numbers between 0 and and 8 (excluding 8)\n\nrand(0.5, 8); // random numbers between 0 and 0.5; second argument is ignored here\n```\n\nAlso in regards to the specific way you present the example (as Functions, indicated by the curly braces): note the difference when you evaluate them:\n\n```supercollider\n{Rand(0.5,8)}.value; // returns 'a Rand'\n{rrand(0.5,8)}.value; // returns an actual random choice between lo and hi\n```\n\nHope this helps,\n\nB"}]} -{"conversations": [{"role": "user", "content": "What does `HasItemSpec.unmap` do? What arguments does it take?"}, {"role": "assistant", "content": "abstract parent class for datatypes that wrap other datatypes eg. ArraySpec Arguments: val."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\RotateAz;\n~description = \"Rotation around the z-axis (angle from -180 to 180)\";\n\n~function = { |in = 0, order = 1, rotateAziDeg = 0|\n\n // Rotating the scene is done from the perspective of the listener\n // rotation follows the right-hand rule of rotation:\n // * Positive azimuth means the listener turns head to the left\n\n HOATransRotateAz.ar(\n order: order,\n in: in,\n az: rotateAziDeg.degrad\n );\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for in the jungle."}, {"role": "assistant", "content": "```supercollider\n({\nvar nz = { |...args| LFDNoise3.kr(*args) };\nvar sig = Limiter.ar(\n BPF.ar(\n RHPF.ar(\n RLPF.ar(\n WhiteNoise.ar(nz.(1/[9,10],0.25,0.75)),\n nz.(5!2).exprange(1000, 2000),\n nz.(1/5!2).range(0.1,1)),\n nz.(5!2).exprange(50,150),\n nz.(1/5!2).range(0.1,1)),\n nz.(5!2).exprange(150,1000),\n nz.(1/5!2).range(0.1,1)))\n* LFGauss.ar([3,4],0.33) * LFGauss.ar(1/[4,9],0.25)\n* SinOsc.ar(Lag2UD.kr(Duty.kr(1,0,{Dibrown(300,2400,250)}!2),0.25,0.8));\nRotate2.ar(sig[0], sig[1], LFSaw.kr(1/5));\n}.play)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n(\np = Pbind(\n \\instrument, \\synth_1a,\n \\preAmp, PL(\\preAmp), \n \\amp, PL(\\amp), \n \\midinote, PLseq(\\seq) + PL(\\seqAdd), \n \\dur, 0.2\n);\n\n~spec = 4.collect { |i| [\\seq, [12*i + 24, 12*i + 48, \\lin, 1, 24*i + 36] ! 5, \n \\seqAdd, [0, 12, \\lin, 1, 0],\n \\amp, [0, 0.15, \\lin, 0.01, 0.07 - (0.01 * i)],\n \\preAmp, [5, 50, \\lin, 0.01, 20]] };\n);\n\n// run all players in sync by passing a quant arg\n\nv = VarG\n// …\n```"}, {"role": "assistant", "content": "run all players in sync by passing a quant arg EventStreamPlayers derived from Pbind are run in (VarGui: slider / player gui to set envir variables and synth controllers and play synths, event patterns and tasks)"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `CoinGate`."}, {"role": "assistant", "content": "```supercollider\n(\na = SynthDef(\"help-TCoin\", { |out = 0, prob = 0.5|\n var trig;\n trig = CoinGate.kr(prob, Impulse.kr(10));\n Out.ar(out,\n SinOsc.ar(\n TRand.kr(300.0, 400.0, trig), 0, 0.2\n )\n )\n}).play;\n);\n\na.set(\\prob, 1.0);\na.set(\\prob, 0.0);\na.set(\\prob, 0.1);\n\n\n(\na = SynthDef(\"help-TCoin\", { |out = 0, prob = 0.5|\n var trig;\n trig = Impulse.ar(20, 0, SinOsc.kr(0.5, 0, 1, 1));\n Out.ar(out,\n Mix.fill(3, { Ringz.ar(CoinGate.ar(prob, trig*0.5), #[1, 1.5]*Rand(1000, 9000), 0.01) })\n )\n}).play;\n);\n\na.set(\\prob, 1.0);\na.set(\\prob, 0.0);\na.set(\\prob, 0.1);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Compander`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n Decay2.ar(\n Impulse.ar(8, 0, LFSaw.kr(0.3, 1, -0.3, 0.3)),\n 0.001,\n 0.3\n )\n * Mix.ar(Pulse.ar([80, 81], 0.3))\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n// synthdefs to play with\n\n(\nSynthDef(\\noise_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, rq = 0.1, amp = 0.1|\n var sig = { WhiteNoise.ar } ! 2;\n sig = BPF.ar(sig, freq, rq) *\n EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2) *\n (rq ** -1) * (250 / (freq ** 0.8));\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\sin_grain, { |out = 0, freq = 4\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n// synthdefs to play with\n\n(\nSynthDef(\\noise_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, rq = 0.1, amp = 0.1|\n var sig = { WhiteNoise.ar } ! 2;\n sig = BPF.ar(sig, freq, rq) *\n EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2) *\n (rq ** -1) * (250 / (freq ** 0.8));\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\sin_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { SinOsc.ar(freq, Rand(0, 2pi)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\saw_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { VarSaw.ar(freq, Rand(0, 1)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What are you not good at?"}, {"role": "assistant", "content": "Everything outside SuperCollider. I have no audio input, no live data, and my knowledge ends at the documentation snapshot I was trained on — so I can be confidently wrong about Quarks and new UGens."}]} -{"conversations": [{"role": "user", "content": "What does `Plotter.plots` do?"}, {"role": "assistant", "content": "Plot numerical data on a window or view Returns: An Array of Plots."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// default initial params\n{ LinCongC.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// default initial params\n{ LinCongC.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// use input amplitude to control Pulse amplitude - use headphones to prevent feedback.\nSynthDef(\"help-AmplitudeMod\",{ arg out=0;\n Out.ar(out,\n Pulse.ar(90, 0.3, Amplitude.kr(SoundIn.ar))\n )\n}).play;\n\n);\n\n\n(\n// use input amplitude to control SinOsc frequency - use headphones to prevent feedback.\nz = SynthDef(\"help-AmplitudeMod\",{ arg out=0, attack=0.01, release=0.01;\n Out.ar(out,\n SinOsc.ar(\n AmplitudeMod.kr(\n SoundIn.ar,\n attack,\n release,\n 1200,\n 4\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// use input amplitude to control Pulse amplitude - use headphones to prevent feedback.\nSynthDef(\"help-AmplitudeMod\",{ arg out=0;\n Out.ar(out,\n Pulse.ar(90, 0.3, Amplitude.kr(SoundIn.ar))\n )\n}).play;\n\n);\n\n\n(\n// use input amplitude to control SinOsc frequency - use headphones to prevent feedback.\nz = SynthDef(\"help-AmplitudeMod\",{ arg out=0, attack=0.01, release=0.01;\n Out.ar(out,\n SinOsc.ar(\n AmplitudeMod.kr(\n SoundIn.ar,\n attack,\n release,\n 1200,\n 400)\n , 0, 0.3)\n )\n}).play;\n\n);\nz.set(\\attack, 0.050)\nz.set(\\release, 0.125)\n\nz.free\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Ndef`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\nNdef(\\sound, { |freq = 56, numHarm = 10| Blip.ar(freq, numHarm, 30) * 0.2 }).play;\nNdef(\\sound).set(\\freq, 15);\nNdef(\\sound).set(\\freq, 15, \\numHarm, 100);\n\nNdef(\\lfo, { LFNoise2.kr(2).exprange(10, 200) });\nNdef(\\sound).map(\\numHarm, Ndef(\\lfo));\nNdef(\\sound).set(\\numHarm, nil); // unmap.\nNdef(\\sound).stop;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Node`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n(\nx = SynthDef(\"help-node-set\", { |freq = 440, out = 0|\n Out.ar(out, SinOsc.ar(freq, 0, 0.1))\n}).play\n);\nx.set(\\freq, 880, \\out, 1); // two pairs\nx.set(0, 660, 1, 0); // freq is the first argument, so it's index is 0. out is index 1.\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `NamedControl` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// compare this:\n(\na = {\n var x, y;\n x = NamedControl.kr(\\freq, 440).lag(3.5);\n y = NamedControl.kr(\\freq, 440).lag(1);\n SinOsc.ar([x, y] * [2, 1.2]) * 0.1\n}.play;\n);\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n\n// to this:\n(\na = {\n var x, y;\n x = Control.names([\\freq]).kr(440).lag(3.5);\n y = Control.names([\\freq]).kr(440).lag(1); // this hangs when set\n SinOsc.ar([x, y] * [2, 1.2]) * 0.1\n}.play;\n);\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n```"}]} +{"conversations": [{"role": "user", "content": "The server stopped responding. What do I do?"}, {"role": "assistant", "content": "In order: `Ctrl+.` (CmdPeriod) to reset scheduling, then `s.reboot` if the server itself is wedged.\nA reboot drops every SynthDef and buffer, so re-add them — which is why real projects keep their SynthDefs\nin a file you can re-evaluate rather than typing them in the REPL.\n\nIf the boot itself fails, the post window has the reason: usually the audio device (another application\nholding exclusive access) or a sample-rate mismatch. `Server.default.options.device` picks a device before\n`s.boot`."}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nNdef(\\x, { Saw.ar(110) * 0.1 }).play;\nNdef(\\x)[1] = \\filter -> { |in| RLPF.ar(in, 800, 0.4) };\n```"}, {"role": "assistant", "content": "Two nodes in one named proxy: a saw source, then a resonant low-pass filter fed by it.\n\n`Ndef(\\x, { ... })` defines the first node of the chain and `.play` starts it. `Ndef(\\x)[1] = \\filter ->`\ninserts a second node at index 1; the `\\filter` key says 'make this node an effect that receives the\nprevious node's output as `in`'. So the patch is `Saw -> RLPF -> out`. Because it is an Ndef, calling\n`Ndef(\\x, { ... })` again replaces the source with a crossfade instead of restarting, and\n`Ndef(\\x).stop` removes the whole chain."}]} +{"conversations": [{"role": "user", "content": "What does `Interface.init` do? What arguments does it take?"}, {"role": "assistant", "content": "Sets up an environment in which you can build a player, a GUI and responders for midi and keyboard control Arguments: i; a."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n{ Pan2.ar(Klank.ar(`[[1, 2.2, 3.5, 4.9], nil, Array.series(4, 1, -0.2)], PinkNoise.ar(EnvGen.ar(Env.perc(0.001,0.01), Impulse.ar(4))), 0), 0); }.play;\n```"}, {"role": "assistant", "content": "I accidentally set the freqscale of a Klank to 0. What resulted was a surprisingly varied and dynamic bit of glitch. The joy of typos in SC :)."}]} +{"conversations": [{"role": "user", "content": "What is `EaseInOutSine` in SuperCollider?"}, {"role": "assistant", "content": "EaseInOutSine — Sinusoidal ease-in/out Easing equation for a sinusoidal (sin(t)) ease-in/out, accelerating until halfway, then decelerating. Category: Ease."}]} +{"conversations": [{"role": "user", "content": "What does `Rational.squared` do?"}, {"role": "assistant", "content": "Power of two `Rational(5,7).squared // -> 25 %/"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Pgtpar` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// synthdef\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n}).add;\n);\n\n// pattern with different start times\n(\nx = Pbind(\n \\instrument, \\help_sinegrain,\n \\degree, Pseq(#[0, 5, 4, 2, 1, 1, 3], inf),\n \\dur, Pseq(#[0.25, 0.5, 1.0], inf),\n \\scale, #[0, 3, 5, 9, 10]\n);\na = Pbus(Pgtpar([0.0, x, 1.5, x, 2.25, x])).play;\n);\ns.plotTree;\na.stop;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `FoaDirectO` in SuperCollider briefly."}, {"role": "assistant", "content": "FoaDirectO — First Order Ambisonic (FOA) directivity transformer Adjust the soundfield directivity of a First Order Ambisonic signal (B-format) across the origin. Category: Libraries > Ambisonic Toolkit > UGens > FOA > Transformer, UGens > Multichannel > Ambisonics."}]} +{"conversations": [{"role": "user", "content": "What does `NearestN.kr` do? What arguments does it take?"}, {"role": "assistant", "content": "Find the nearest-neighbours in a set of points Arguments: treebuf — a Buffer containing data which MUST be in the special format created using the KDTree class and NearestN.makeBufferData; in — An array representing the input point. Num channels must match the dimensionality of the points in the dataset; gate — The unit is active while gate > 0. While <=0, no search is performed and output is held steady; num — Number of points to retrieve. NOT modulatable.. Returns: A flat array containing (3 * num) channels, which is a ranked list of the nearest items (the very nearest coming first). For each match, this returns three channels [treeindex, distancesquared, label]"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\nz = {\n BLowPass4.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(10, 20000, \\exponential), // cutoff freq.\n MouseY.kr(0.1, 1.0, \\linear), // rq - compensate for 2 biquad sections.\n 0.5); // mul\n}.play\nz.release;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\nz = {\n BLowPass4.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(10, 20000, \\exponential), // cutoff freq.\n MouseY.kr(0.1, 1.0, \\linear), // rq - compensate for 2 biquad sections.\n 0.5); // mul\n}.play)\nz.release;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\FuMaIn;\n~description = \"A live ambisonic input (ACN_FuMa)\";\n~channelLayout = \\ambi;\n\n~function = { |order = 1, t_trig = 0, bus = 0|\n var env = EnvGen.kr(Env([0,1], [1]), t_trig);\n var chans = Array.series(\n size: (order + 1).pow(2).asInteger,\n start: bus,\n step: 1\n );\n var input = SoundIn.ar(chans, env);\n HOAConverterFuma2AcnN3d.ar(order, input);\n}\n```"}, {"role": "assistant", "content": "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see ."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `ExpRand` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-ExpRand\", { |out = 0|\n Out.ar(out,\n FSinOsc.ar(\n ExpRand(100.0, 8000.0),\n 0, Line.kr(0.2, 0, 0.01, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n(\nRoutine({\n inf.do({ |i|\n Synth.new(\"help-ExpRand\"); 0.05.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `AbstractFunction`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\na = { |x| #[440, 720, 801, 1020.2].at(x) }; b = a.cpsmidi; [a.value(3), b.value(3)];\na = Pseries(220, 220, inf).cpsmidi; a.asStream.nextN(12); // overtone series as midinotes\n// follow but round to next midinote\n{ a = Pitch.kr(SoundIn.ar).at(1); Pulse.ar(a.cpsmidi.round.midicps) * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `MIDIMKtlDevice.postPossible` do?"}, {"role": "assistant", "content": "Post all access code for device that could be used by"}]} +{"conversations": [{"role": "user", "content": "Explain `RedEffectModuleGUI` in SuperCollider briefly."}, {"role": "assistant", "content": "RedEffectModuleGUI — gui for effect modules A standardized gui for RedEffectModules. Category: Red > redModule."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n~mdef =\n{\n |key, func, msgNum, permanent = true|\n\n MIDIdef(key, func ?? { MIDIdef(key).func }, msgNum ? MIDIdef(key).msgNum, MIDIdef(key).chan, MIDIdef(key).msgType, MIDIdef(key).srcID).permanent_(permanent)\n}\n```"}, {"role": "assistant", "content": "Change arg values of MIDIdef after instantiation (a SuperCollider snippet)."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n{ Pan2.ar(Klank.ar(`[[1, 2.2, 3.5, 4.9], nil, Array.series(4, 1, -0.2)], PinkNoise.ar(EnvGen.ar(Env.perc(0.001,0.01), Impulse.ar(4))), 0), 0); }.play;\n```"}, {"role": "assistant", "content": "I accidentally set the freqscale of a Klank to 0. What resulted was a surprisingly varied and dynamic bit of glitch. The joy of typos in SC :)."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nb = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n\n(\n{\n var snd, envTime, knee, out;\n snd = PlayBuf.ar(1, b, BufRateScale.kr(b), loop: 1);\n envTime = MouseX.kr(1.0e-3, 0.1e-3);\n knee = MouseY.kr(0, -90).dbamp;\n out = DelayC.ar(snd, 0.01, envTime * 0.5) * EnvFollow.ar(snd, 1 - (envTime * SampleRate.ir).reciprocal).max(knee).reciprocal;\n out * 0.1!2\n}.play;\n)\n```"}, {"role": "assistant", "content": "a replication of the legendary LADSPA plugin of the same name, originally written by steve harris. a compressor with a super fast attack which results in harsh distortion fx. requires sc3-plugins."}]} +{"conversations": [{"role": "user", "content": "What does Splay.ar do?"}, {"role": "assistant", "content": "`Splay.ar(inArray, spread, level, center, levelComp)` takes an array of mono signals and distributes them across the stereo field, so `Splay.ar(SinOsc.ar([220, 330, 440]) * 0.1)` is a three-source stereo chord rather than three separate synths. spread (0..1) controls how far the voices fan out and center shifts the middle. It is the shorthand for 'make this array stereo'."}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for smooth arpeggio, updated envelope (a SuperCollider snippet): bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\bass, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.perc(0.2), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\na = Synth(\\MoaningDialogue)\n\n//COOL TWEAKS\n//AngryTweak\na.set(\\feedback, 29,\\freq, 6)\n//CalmTweak\na.set(\\feedback, 60, \\freq, 0.8)\n//WeirdTweak\na.set(\\feedback, 2.8, \\freq, 2)\n\n(\nSynthDef(\\MoaningDialogue, {\n |rateL = 0.2, rateR = 0.3, freq = 2, feedback = 50, mul = 1 , lpfreq = 2500|\n Out.ar(0,\n FreeVerb.ar(\n BLowPass.ar(\n SinOscFB.ar(\n LFDNoise1.kr([rateL, rateR], freq), feedback;\n , mul),\n lpfreq,\n 0.2\n ),\n 0.3,\n 0.0\n )\n )}\n).add\n)\n```"}, {"role": "assistant", "content": "One of the first synths I made.\r\nA frog-like sounding synth, with a dialogue between the left and the right channel.\r\nI've also notated some simple tweaks."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Play it with the mouse\n{DFM1.ar(PinkNoise.ar(mul: 0.5), MouseX.kr(80, 5000, 'exponential'), MouseY.kr(0.1, 1.2))}.play;\n\n// Throbby bass\n{DFM1.ar(Pulse.ar(100, mul:0.4) + Pulse.ar(100.1, mul:0.4), SinOsc.kr(SinOsc.kr(0.3).range(0.2, 5)).range(80, 2000), 1.1, inputgain: 2.0, mul:0.7!2}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Play it with the mouse\n{DFM1.ar(PinkNoise.ar(mul: 0.5), MouseX.kr(80, 5000, 'exponential'), MouseY.kr(0.1, 1.2))}.play;\n\n// Throbby bass\n{DFM1.ar(Pulse.ar(100, mul:0.4) + Pulse.ar(100.1, mul:0.4), SinOsc.kr(SinOsc.kr(0.3).range(0.2, 5)).range(80, 2000), 1.1, inputgain: 2.0, mul:0.7)!2}.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `AbstractPlayer.bundle` do? What arguments does it take?"}, {"role": "assistant", "content": "the base class for all Players : a playable object Arguments: server; atTime — see atTime; buildFunction."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `InTrig`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\ns = Server.local;\nb = Bus.control(s, 1);\n\nSynthDef(\"help-InTrig\", { |out = 0, busnum = 0|\n var inTrig;\n inTrig = InTrig.kr(busnum);\n Out.ar(out,\n EnvGen.kr(Env.perc, gate: inTrig, levelScale: inTrig) * SinOsc.ar\n )\n}).play(s, [\\out, 0, \\busnum, b.index]);\n\n\nb.set(1.0);\n\nb.value = 1.0;\n\nb.value = 0.2;\n\nb.value = 0.1;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `BufCombN` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// These examples compare the variants, so that you can hear the difference in interpolation\n\n// allocate buffer\nb = Buffer.alloc(s, 44100, 1);\n\n// Comb used as a resonator. The resonant fundamental is equal to\n// reciprocal of the delay time.\n{ BufCombN.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ BufCombL.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ BufCombC.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// with negative feedback:\n{ BufCombN.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ BufCombL.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ BufCombC.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n// used as an echo.\n{ BufCombL.ar(b.bufnum, Decay.ar(Dust.ar(1, 0.5), 0.2, WhiteNoise.ar), 0.2, 3) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\\synth_1a, { |freq = 400, preAmp = 5, amp = 0.1|\n var src = SinOsc.ar(freq, 0, mul: preAmp).tanh ! 2;\n OffsetOut.ar(0, src * amp * EnvGen.ar(Env.perc, doneAction: 2))\n}).add;\n);\n\n(\np = Pbind(\n \\instrument, \\synth_1a,\n \\preAmp, PL(\\preAmp), // or Pfunc { ~preAmp } \n \\amp, PL(\\amp), // or Pfunc { ~amp } \n \\midinote, PLseq(\\seq) + PL(\\seqAdd), \n \\dur, 0.2\n);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\\synth_1a, { |freq = 400, preAmp = 5, amp = 0.1|\n var src = SinOsc.ar(freq, 0, mul: preAmp).tanh ! 2;\n OffsetOut.ar(0, src * amp * EnvGen.ar(Env.perc, doneAction: 2))\n}).add;\n);\n\n(\np = Pbind(\n \\instrument, \\synth_1a,\n \\preAmp, PL(\\preAmp), // or Pfunc { ~preAmp } \n \\amp, PL(\\amp), // or Pfunc { ~amp } \n \\midinote, PLseq(\\seq) + PL(\\seqAdd), \n \\dur, 0.2\n);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `PLbindef`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n// synthdefs to play with\n\n(\nSynthDef(\\noise_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, rq = 0.1, amp = 0.1|\n var sig = { WhiteNoise.ar } ! 2;\n sig = BPF.ar(sig, freq, rq) *\n EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2) *\n (rq ** -1) * (250 / (freq ** 0.8));\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\sin_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { SinOsc.ar(freq, Rand(0, 2pi)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\saw_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { VarSaw.ar(freq, Rand(0, 1)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `DelayN` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// これは(SC2の配布物の中の)\"01 Why SuperCollider document\"からのリバーブ\n(\nSynthDef(\"preDelay\", { arg inbus = 2;\n Out.ar(\n 4,\n DelayN.ar(In.ar(inbus, 1), 0.048, 0.048)\n )\n}).add;\n\nSynthDef(\"combs\", {\n Out.ar(\n 6,\n Mix.arFill(7, { CombL.ar(In.ar(4, 1), 0.1, LFNoise1.kr(Rand(0, 0.1), 0.04, 0.05), 15) })\n )\n}).add;\n\nSynthDef(\"allpass\", { arg gain = 0.2;\n var source;\n source = In.ar(6, 1);\n 4.do({ source = AllpassN.ar(source, 0.050, [Rand(0, 0.05), Rand(0, 0.05)], 1) });\n Out.ar(\n 8,\n source * gain\n )\n}).add;\n\nSynthDef(\"theMixer\", { arg gain = 1;\n Out.ar(\n 0,\n Mix.ar([In.ar(2, 1), In.ar(8, 2)]) * gain\n )\n}).add;\n);\n\n(\nSynth(\"fm1\", [\\bus, 2, \\freq, 440, \\carPartial, 1, \\modPartial, 1.99, \\mul, 0.071]);\nSynth(\"fm1\", [\\bus, 2, \\freq, 442, \\carPartial, 1, \\modPartial, 2.401, \\mul, 0.071]);\nSynth.tail(s, \"preDelay\");\nSynth.tail(s, \"combs\");\nSynth.tail(s, \"allpass\");\nSynth.tail(s, \"theMixer\", [\\gain, 0.64]);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n{var a=LFNoise0,b=SinOscFB,c=Pulse;b.ar(a.ar([2,3])*(c.ar([5,7],b.kr([7,5]))*(a.ar([3,2]))*[800,1200]),(c.kr([100,80])*[2,3]))}.play\n```"}, {"role": "assistant", "content": "dirty and noisy \"result\" of remembering/learning sc again. still dont understand why it does not work when i move .ar/kr to var definition. hh... will turn it into synthdef..."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nDelayC.ar(z, 0.2, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\n(\n// recursive application of delay.\n{\nz = Decay2.ar(Dust.ar(1, 0.5), 0.01, 0.1, Saw.ar(100 + [0, 1]));\n5.do { |i| z = DelayC.ar(RLPF.ar(z, Rand(100, 3000), 0.03), 1, 1 / (2**i), 1, z * 0.5) };\nz\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nDelayC.ar(z, 0.2, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\n(\n// recursive application of delay.\n{\nz = Decay2.ar(Dust.ar(1, 0.5), 0.01, 0.1, Saw.ar(100 + [0, 1]));\n5.do { |i| z = DelayC.ar(RLPF.ar(z, Rand(100, 3000), 0.03), 1, 1 / (2**i), 1, z * 0.5) };\nz\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n//Version 1\n//P(eace)Bind\n//If error messages could experience Nirvanna, it would sound like this.\n(\n{\nSaw.ar(\n freq: SinOsc.kr([60, 63, 67, 70]).range(440,880),\n mul:LFNoise0.kr(freq: [0.25,1]).range(0,1),\n )\n}.play\n\n);\n\n\n//Version 2\n//SuperCollider\n//Sometimes in life, you feel like you need to collide with things.\n(\n{\nPulse.ar(\n freq: SinOsc.kr([60, 63, 67, 70]).range(30,70),\n mul: LFPulse.kr(freq: [0.25,1]).range(0,1)\n )\n}.play\n\n)\n```"}, {"role": "assistant", "content": "Quiz 4a for MUSC 115, pp. 62-84 from Gentle Intro to SuperCollider."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// This question comes up sometimes.\n// one way to do it is to define an event type:\n\n\n(\nEvent.addEventType(\\dnote, { |server|\n \n var instrument = ~instrument.asDefName;\n var synthLib = ~synthLib ?? { SynthDescLib.global };\n var desc = synthLib.at(instrument);\n \n \n if (desc.notNil) {\n desc.controls.do { |x|\n x.defaultValue !? { x.name.asSymbol.envirPut(x.defaultValue) }\n };\n // for efficiency, get this now\n ~hasGate = desc.hasGate;\n ~msgFunc = desc.msgFunc;\n };\n ~type = \\note;\n \n currentEnvironment.play;\n});\n);\n\n(\nSynthDef(\\test, { |out, freq = 1000| \n Out.ar(out, Line.ar(0.1, 0, 0.1, doneAction:2) * SinOsc.ar(freq)) \n}).add\n);\n\nPbind(\\type, \\dnote, \\instrument, \\test, \\dur, 0.3).play;\n```"}, {"role": "assistant", "content": "One answer to the question \"how to use the SynthDef's default argument in an Event?\"."}]} +{"conversations": [{"role": "user", "content": "What does `EnvelopedPlayer.synthDefArgs` do?"}, {"role": "assistant", "content": "takes a Player as input and plays it through an Env with fused protection"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// example from ServerErrorGui in crucial lib\n\nf = OSCresponderNode(s.addr, '/fail', { |time, responder, msg|\n {\n var mins, secs;\n mins = (time/60).round(1);\n secs = (time%60).round(0.1);\n if(secs<10, { secs = \"0\"++secs.asString }, { secs = secs.asString });\n // put this on a gui\n // errors.label = \"% % (%:%)\".format(msg[1], msg[2], mins, secs);\n // errors.stringColor = Color.white;\n \"% % (%:%)\".format(msg[1], msg[2], mins, secs).postln;\n }.defer\n});\nf.add;\n// …\n```"}, {"role": "assistant", "content": "example from ServerErrorGui in crucial lib errors.label = \"% % (%:%)\".format(msg[1], msg[2], mins, secs); (OSCresponderNode: client side network responder)"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Stethoscope`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var f = { |l,h| SinOsc.kr(0.1, {pi.rand}).range(l, h) } ;\n Pulse.ar({ f.(20, 1000) }!6, { f.(0.0, 1) }!6, { f.(0.0, 1.0) }!6)\n}.play;\n);\n\nc = s.scope;\nc.numChannels = 6;\nc.scopeView.waveColors = [Color.red, Color.red, Color.cyan, Color.cyan, Color.white, Color.white];\nc.style = 2;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `LFGauss` in SuperCollider?"}, {"role": "assistant", "content": "LFGauss — Gaussian function oscillator A non-band-limited gaussian function oscillator. Category: UGens > Generators > Deterministic."}]} {"conversations": [{"role": "user", "content": "Write a warm pad in SuperCollider."}, {"role": "assistant", "content": "Detuned saws through a slow filter envelope and a long release: the detune is what makes it wide.\n\n```supercollider\n(\nSynthDef(\\pad, { |out = 0, freq = 220, amp = 0.15, gate = 1|\n var detune = [-0.06, -0.02, 0.02, 0.06];\n var sig = Mix(Saw.ar(freq * (1 + detune))) * 0.25;\n var env = EnvGen.kr(Env.adsr(1.2, 0.5, 0.7, 3), gate, doneAction: 2);\n var cutoff = SinOsc.kr(0.05).exprange(300, 2000);\n sig = RLPF.ar(sig, cutoff, 0.4);\n Out.ar(out, Splay.ar([sig, DelayN.ar(sig, 0.02, 0.012)]) * env * amp);\n}).add;\n);\n~pad = Synth(\\pad, [\\freq, 165]);\n~pad.set(\\gate, 0);\n```\n`gate` is what makes a sustained sound controllable: `\\gate, 0` releases it and `doneAction: 2` then\nfrees the Synth."}]} -{"conversations": [{"role": "user", "content": "What does `RedMixGUI.new` do? What arguments does it take?"}, {"role": "assistant", "content": "gui for RedMixMono, RedMixStereo, RedMixStereoMono Arguments: redMix — A red mix object (RedMixMono, RedMixStereo, RedMixStereoMono); parent — A Window, View or `nil`.; position — A Point or `nil`.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// The finishing of a ZeroXBufRd is not detemined by finite demand rate ugens but by an overall envelope, \n// its release section is triggered by a maximum number of half wavesets ('length') or a maximum time. \n\n// Buffers from Ex.4\n\n{ ZeroXBufRd.ar(b[0], z[0], rate: 1, length: 10, rel: 0.01) }.plot(0.03)\n\n{ ZeroXBufRd.ar(b[0], z[0], rate: 1, maxTime: 0.01, rel: 0.01) }.plot(0.03)\n\n\n// envelopes can be differentiated\n\n{ ZeroXBufRd.ar(b[0..1], z[0..1], rate: 1, maxTime: [0.01, 0.005], rel: [0.00\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// The finishing of a ZeroXBufRd is not detemined by finite demand rate ugens but by an overall envelope, \n// its release section is triggered by a maximum number of half wavesets ('length') or a maximum time. \n\n// Buffers from Ex.4\n\n{ ZeroXBufRd.ar(b[0], z[0], rate: 1, length: 10, rel: 0.01) }.plot(0.03)\n\n{ ZeroXBufRd.ar(b[0], z[0], rate: 1, maxTime: 0.01, rel: 0.01) }.plot(0.03)\n\n\n// envelopes can be differentiated\n\n{ ZeroXBufRd.ar(b[0..1], z[0..1], rate: 1, maxTime: [0.01, 0.005], rel: [0.005, 0.02]) }.plot(0.03)\n\n{ ZeroXBufRd.ar(b[0..1], z[0..1], rate: 1, length: [7, 2], rel: [0.005, 0.02]) }.plot(0.03)\n\n\n// there should be only one doneAction 2 in this case\n\n{ ZeroXBufRd.ar(b[0..1], z[0..1], rate: 1, maxTime: [0.01, 0.005], rel: [0.05, 0.5], doneAction: [0, 2]) }.play\n\n\n(\nb.do(_.free);\nz.do(_.free);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `AbstractServerAction`."}, {"role": "assistant", "content": "```supercollider\n// ServerBoot\ns.boot;\nf = { |server| \"------------The server '%' has booted.------------\\n\".postf(server) };\nServerBoot.add(f, \\default);\ns.quit; // quit the server and observe the post\ns.boot;\nServerBoot.remove(f, \\default); // remove it again\ns.quit;\ns.boot; // no post.\nServerBoot.add(f, Server.internal);\nServer.internal.quit;\nServer.internal.boot;\nServerBoot.removeAll; // clear all\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes SyncSaw madness."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\fun, {\n var src, freq = 25;\n var lagTime = \\lagTime.kr(0);\n var vibrato = \\vibrato.kr([ 1.3515662384033, 1.3061940193176, 0.604791264534, 1.2328997278214, 0.33569867610931, 0.40528120040894, 1.0865307760239, 1.22394572258, 1.7781081724167, 0.15319232463837 ], lagTime);\n \n var vibRatio = \\vibRatio.kr([ 2.9047239411079, 0.39578121743921, 0.10932490532285, 0.051738858660565, 0.17840235868831, 0.024495380749894, 3.9689920754869, 4.1139229659643, 0.23327501819885, 0.97643604193256 ], lagTime);\n \n var freqVary = \\freqVary.kr([ 143.76541377614, 14.25479545154, 6.6728691888342, 58.434807398325, 154.89385962072, 34.112274650688, 3.1140823758236, 10.42040949808, 158.59959972037, 1.2163188440936 ], lagTime);\n \n \n var numSrcs = vibrato.size;\n\n src = numSrcs.collect{|i|\n var freq2 = (freq * freqVary[i]) * LFNoise2.kr(0.01).range(1, 1.5);\n     \n SyncSaw.ar(freq2, freq2 * SinOsc.ar(Line.kr(1, vibrato[i], 20) * vibRatio[i], Rand(0, 0.8)).range(pi, pi * 0.1)) * rrand(0.05, 0.1)\n };\n \n src = Splay.ar(src);\n \n}).play\n);\n\nNdef(\\fun).fadeTime = 20;\n\nNdef(\\fun).rebuild\n\n(\nNdef(\\fun).setn(\n \\lagTime, [5],\n \\vibRatio, {exprand(0.1, 3)}!10,\n \\freqVary, {exprand(1, 150)}!10,\n \\vibrato, {exprand(0.3, 3)}!10\n)\n);\n(\nNdef(\\fun).setn(\n \\lagTime, [200],\n \\vibRatio, ({exprand(0.1, 3)}!10).sort,\n \\freqVary, ({exprand(1, 150)}!10).sort,\n \\vibrato, ({exprand(0.3, 3)}!10).sort\n)\n);\n\n(\nNdef(\\fun).xsetn(\n \\lagTime, [100],\n \\vibRatio, {exprand(0.1, 3)}!10,\n \\freqVary, {exprand(1, 150)}!10,\n \\vibrato, {exprand(0.3, 3)}!10\n))\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for short piece which plays random major music."}, {"role": "assistant", "content": "```supercollider\np = ProxySpace.push(s.boot);\n~a.play.quant_(4); ~b.play.quant_(4);\n~c = { LFNoise1.kr(8).range(0,15).round };\n~a = Pbind(\\degree, Pstutter(4, Pseq([0,2,3,4], inf)), \\octave, [3,4], \\dur, 0.25, \\amp, 0.3);\n~b = Pbind(\\octave, 4, \\scale, Scale.majorPentatonic, \\degree, ~c, \\dur, 1/4, \\legato, 0.5);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `EventShortcuts.addOnBase` do? What arguments does it take?"}, {"role": "assistant", "content": "Adds a new named IdentityDictionary of shortcuts based on the copy of an existing Arguments: baseName — Symbol or String. Name of the shortcut dictionary to build upon.; newName — Symbol or String. Name of the new shortcut set.; dict — IdentityDictionary of new or/and additional abbreviations (keys given as Symbols) and original names (values given as Symbols).; overwrite — Boolean. Determines if a shortcut dictionary of that name – if existing at all – is overwritten. Defaults to false.."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nSynthDef(\\Synth3,\n {arg ress = 0;\n var klank, env;\n klank = Klank.ar(`[{Rand(70,21000)}!7, {Rand(0.128,0.700)}!7],BrownNoise.ar(0.7));\n klank = klank;\n env = EnvGen.kr(Env.perc(0.07, ress), doneAction:2);\n Out.ar(0, klank*env.dup*0.0128);\n}).add;\n)\n\n\n{inf.do{x = rrand(0.01,0.7); Synth(\\Synth3, [\\ress, x+(7*x)]); x.wait;}}.fork\n```"}, {"role": "assistant", "content": "Play around with {Rand(70, 21000)}!7\r\n\r\nA simple example for the begginers... hope I can contribute to something =)."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Converting an environment in a prototype object."}, {"role": "assistant", "content": "```supercollider\n~constructPseudoMethods = { |envir|\n var newEnvir = envir.collect { |value|\n var argNames, argBlock, namesBlock, code, func;\n if(value.isKindOf(Function)) {\n func = value;\n argNames = func.def.argumentString(withDefaultValues: true);\n namesBlock = func.def.argumentString(withDefaultValues: false);\n argBlock = if(argNames.notNil) { \"|self, \" ++ argNames ++ \"|\" };\n code = \"{ |func, envir| { % envir.use { func.value(%) } } }\".format(argBlock ? \"\", namesBlock ? \"\");\n //code.postln;\n code.interpret.value(func, envir)\n } {\n value\n }\n };\n newEnvir.know = true; // we want a prototype object style environment\n};\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `PSchmidt` in SuperCollider briefly."}, {"role": "assistant", "content": "PSchmidt — UGenPatterns quark library Based on Schmidt Category: Streams-Patterns-Events > UGenPatterns > Modifiers."}]} -{"conversations": [{"role": "user", "content": "What does `Env.embedInStream` do?"}, {"role": "assistant", "content": "Embeds this Env within an enclosing Stream. Timing is derived from"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n{ Hasher.ar(Line.ar(0, 1, 1), 0.2) }.play;\n\n// Even adding a small amount to the input can result in a very different output. Compare these two examples:\n(\n{\n SinOsc.ar(\n Hasher.kr(MouseX.kr(0, 10).round(1), 300, 500)\n ) * 0.1\n}.play;\n);\n\n(\n{\n SinOsc.ar(\n Hasher.kr(MouseX.kr(0, 10).round(1) + 0.0001, 300, 500)\n ) * 0.1\n}.play;\n);\n\n// Output stays constant while not moving the mouse.\n(\n{\n SinOsc.ar(\n Hasher.kr(MouseX.kr(0, 10), 300, 500)\n ) * 0.1\n}.play;\n)\n```"}, {"role": "assistant", "content": "Even adding a small amount to the input can result in a very different output. Compare these two examples: Output stays constant while not moving the mouse. (Hasher: Scrambled value with a hash function.)"}]} -{"conversations": [{"role": "user", "content": "Explain `SPlayFileDiskStereo` in SuperCollider briefly."}, {"role": "assistant", "content": "SPlayFileDiskStereo — a sound file player that streams from disk in stereo This class is a wrapper for VDiskIn and will take any soundfile with 1, 2 or 4 (by default) channels and mix it down and play it in STEREO. Use SPlayFileDisk for mixing down and playing in MONO, and SPlayFileDiskQuad for QUAD playback. Category: SInstruments."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for gabber kick (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\gabberkick, {\n var snd;\n snd = SinOsc.ar(Env([1000, 69, 60], [0.015, 0.1], \\exp).ar * [-0.1, 0, 0.1].midiratio);\n snd = Mix(snd);\n snd = (snd * 10).tanh;\n snd = (snd * 5.1).atan;\n snd = BPeakEQ.ar(snd, XLine.kr(2000, 100, 0.3), 2.0, 8);\n snd = snd + DelayC.ar(snd, 0.01, SinOsc.ar(4).range(0.0, 0.001));\n snd = RLPF.ar(snd, 8000, 0.7);\n snd = snd * Env([0, 1, 0.7, 0.7, 0], [0.001, 0.01, 0.3, 0.02]).ar(2);\n snd = (snd * 0.6).clip(-1, 1);\n Out.ar(\\out.kr(0), Pan2.ar(snd, \\pan.kr(0), \\amp.kr(0.1)));\n}).add;\n);\n\nSynth(\\gabberkick, [amp: 0.6])\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for attempt at a Star Wars sound effect!?"}, {"role": "assistant", "content": "```supercollider\n(\n\n// bye fighter\n{\n\nvar whooshPitch, whooseVol, swish, swishPitch = 970, noise, output, timeScale = 1.5;\nvar trump, trumpPitch = 400, chain, buf;\nvar panning;\n\nwhooshPitch = EnvGen.kr(\n\n Env(\n [0.8, 1.0, 0.9, 0.7, 0.5, 0.3, 0.24, 0.12, 0.0],\n [0.08, 0.2, 0.15, 0.11, 0.08, 0.09, 0.06, 0.18],\n 2\n ),\n timeScale: 1.3 * timeScale\n \n).lag(0.2);\n\nwhooseVol = EnvGen.kr(\n\n Env(\n [0.0, 0.2, 0.7, 0.9, 1.0, 0.8, 0.6, 0.43, 0.22, 0.0],\n [0.4, 0.5, 0.2, 0.15, 0.17, 0.11, 0.1, 0.16, 0.28],\n 2\n ),\n timeScale: 0.9 * timeScale\n \n).lag(0.2, 1.5) * LFNoise1.kr(37.2, 0.2, 1).lag(0.2);\n\nnoise = Mix(CombC.ar(WhiteNoise.ar(0.2), 0.1, [whooshPitch.exprange(0.16, 0.00011), whooshPitch.exprange(0.19, 0.00013)], 0.09));\nnoise = noise + BrownNoise.ar(0.1);\n\nswishPitch = swishPitch * LFNoise0.kr(365, 0.2, 1);\nswishPitch = swishPitch * whooshPitch.range(0.8, 1.3);\nswish = Mix.fill(\n 3,\n {\n |i|\n SinOsc.ar(swishPitch + (i * whooshPitch.exprange(45, 1)), rrand(0.0, 1.0), 0.4);\n }\n);\ntrumpPitch = trumpPitch * whooshPitch.range(0.92, 1.08);\ntrump = Mix.fill(3, { |i| SinOscFB.ar(trumpPitch * LFNoise0.kr(28, 0.06, 1).lag(0.8) * (0.8 + (i * 0.05)), 1.2, 0.8) }) * 0.6;\ntrump = RHPF.ar(trump, whooshPitch.range(120, 335), 0.2);\nchain = FFT(LocalBuf(2048), trump);\nchain = PV_BinShift(chain, WhiteNoise.kr.range(0.96, 1.01), whooshPitch.range(24, 28)); \ntrump = IFFT(chain) * 0.2;\npanning = Line.kr(-0.7, 0.7, 3);\noutput = noise + swish + trump;\noutput = output * whooseVol;\n\nPan2.ar(output, panning, 1.0);\n}.play;\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does doneAction do?"}, {"role": "assistant", "content": "It tells the server what to do to the enclosing Synth when the UGen finishes. The one that matters most is `doneAction: 2`, which frees the Synth: that is how a percussive sound cleans itself up instead of leaking silent nodes. `doneAction: 0` does nothing, so the Synth keeps running. EnvGen, Line, XLine, LinePan and friends all accept it, which is why `EnvGen.kr(Env.perc(0.01, 1), doneAction: 2)` is the standard envelope idiom."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `FreqScope`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n// create a new analyzer\nFreqScope.new(400, 200, 0, server: s);\n\n// basic sine\n{ SinOsc.ar(2000, 0, 0.25) }.play(s);\n\n// random saw\n{ RLPF.ar(Saw.ar(110, 0.2), LFNoise2.kr(1, 1e4, 1e4), LFNoise2.kr(1, 0.2, 0.22)) }.play(s);\n\n// modulate phase\n{ SinOsc.ar(800, SinOsc.ar(XLine.kr(20, 8000, 10), 0, 2pi), 0.25) }.play(s);\n\n// all harmonics\n{ Blip.ar(200, Line.kr(1, 100, 10), 0.2) }.play(s);\n\n// access the FreqScopeView object to set properties of the Qt Object:\nFreqScope.getInstance // get the FreqScope instance\n .scope // and its FreqScopeView\n .setProperty(\\updateInterval, 1000)\n // set updateInterval to 1000 ms because of reasons\n```"}]} -{"conversations": [{"role": "user", "content": "What is a SynthDef?"}, {"role": "assistant", "content": "A SynthDef is a named, compiled server-side instrument: a UGen graph plus named controls. You build one with SynthDef(\\name, { |args| ... }).add, and then play instances with Synth(\\name)."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ FSinOsc.ar(800) * 0.2 }.play;\n\n{ FSinOsc.ar(XLine.kr(200, 4000, 1)) * 0.2 }.play;\n\n// loses amplitude towards the end\n{ FSinOsc.ar(FSinOsc.ar(XLine.kr(4, 401, 8), 0.0, 200, 800) * 0.2 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ FSinOsc.ar(800) * 0.2 }.play;\n\n{ FSinOsc.ar(XLine.kr(200, 4000, 1)) * 0.2 }.play;\n\n// loses amplitude towards the end\n{ FSinOsc.ar(FSinOsc.ar(XLine.kr(4, 401, 8), 0.0, 200, 800)) * 0.2 }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nd = { |freq = 440|\n var internalFreq;\n internalFreq = LFNoise0.ar(0.3, 300, 800);\n SinOsc.ar(\n LeastChange.kr(freq, internalFreq) // two sources of change: one external, one internal\n ) * 0.1\n}.play\n);\n\nd.set(\\freq, 800);\nd.set(\\freq, 900;\nd.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nd = { |freq = 440|\n var internalFreq;\n internalFreq = LFNoise0.ar(0.3, 300, 800);\n SinOsc.ar(\n LeastChange.kr(freq, internalFreq) // two sources of change: one external, one internal\n ) * 0.1\n}.play\n);\n\nd.set(\\freq, 800);\nd.set(\\freq, 900);\nd.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Detune idea is from James Harkins."}, {"role": "assistant", "content": "```supercollider\n(\na = {\n |freq = 40, wid = 0.5|\n Mix(LFPulse.ar(freq *((Array.fill(40, Pxrand((1, 2..20), inf).iter)/1000)+1),\n 0, wid, 0.05)\n ).dup\n}.play;\n);\n\n//more distorsion\n~widlfo = {Saw.kr(0.5).range(0,1)};\na.set(\\wid, ~widlfo);\n\n//stop\na.release;\n```"}]} -{"conversations": [{"role": "user", "content": "Saving \"Presets\"?"}, {"role": "assistant", "content": "SuperCollider forum — Saving \"Presets\"?\n\nIf you don’t care too much about it being human readable, just use writeArchive and readArchive:\n\n```supercollider\na = Array.fill(400, {rrand(0,2200)});\n\na.writeArchive(\"/Users/spluta1/Documents/SC/test\");\n\nb = Object.readArchive(\"/Users/spluta1/Documents/SC/test\");\n\nb.postln;\n```\n\nSam"}]} -{"conversations": [{"role": "user", "content": "How should I check an answer you give me?"}, {"role": "assistant", "content": "Three quick checks, cheapest first. Does it evaluate without a syntax error — the post window points at the exact character. Does the node appear in `s.plotTree` — if yes, the problem is signal rather than lifecycle. Does it reach `Out.ar(0, ...)` with a non-zero amplitude and an open filter. If those three pass and it is still silent, the class's own help page will show the argument order you may have assumed wrong."}]} -{"conversations": [{"role": "user", "content": "What does `Image.loadPixels` do? What arguments does it take?"}, {"role": "assistant", "content": "load all the pixels of the receiver in an array. it is better and faster to call this function instead of #-pixels if you plan to retrieve frequently the pixel data (since it won't allocate a new array everytime !) `// exec one line at a Arguments: array — the array that will be filled. Should be an Int32Array of size receiver.width * receiver.height.; region — the targeted rectangular region. (nil by default, meaning full size); start — the start index of the array.."}]} -{"conversations": [{"role": "user", "content": "What does `Server.unresponsive` do?"}, {"role": "assistant", "content": "`true` if the server is unresponsive (specifically, if it has failed to respond after ServerOptions#-pingsBeforeConsideredDead ping attempts); `false`"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nf = ();\nf.beatAndBar = {\n var t = currentEnvironment.clock; // t= TempoClock.new;\n var text = \"xB: \";\n\n var nBeatsPerBar = { arg n, beats, clock;\n var nBpb = clock.beatsPerBar * n;\n \"\" ++ n ++ text ++ (nBpb - (beats%(nBpb))).asInteger\n };\n\n t.play({arg beats, time, clock;\n ( //[\"beat: \" ++ (t.beatInBar + 1).asInteger] ++ //uncomment for beat in bar\n [1,2,4,8,16,32].collect( {|n,i| nBeatsPerBar.value(n, beats, clock)})\n ).postln;\n 1});\n \"beatAntBar\";\n}\n);\n\nf[\\beatAndBar].value;\n\n(\nf[\\beatAndBar].value;\nCmdPeriod.add(f[\\beatAndBar]);\n)\n```"}, {"role": "assistant", "content": "Prints beats to bars for a mutiple of bar.\r\nHow many beats left until next 1, 2, 4, 8, 16, 32, etc bar."}]} +{"conversations": [{"role": "user", "content": "What is a UGen graph in SuperCollider?"}, {"role": "assistant", "content": "A UGen graph is the directed acyclic graph of unit generators that a SynthDef describes: sources (SinOsc, WhiteNoise) feed processors (LPF, EnvGen, Pan2) and end at an output such as Out.ar. The language builds the graph; the server instantiates it once per Synth. A signal path is drawn by passing one UGen's output as another's input, and because UGens are multi-channel by default, the same expression can build a stereo or 8-channel graph depending on the arrays inside it."}]} +{"conversations": [{"role": "user", "content": "What is `IFFT`?"}, {"role": "assistant", "content": "IFFT — Inverse Fast Fourier Transform"}, {"role": "user", "content": "What does `IFFT.new` do?"}, {"role": "assistant", "content": "returns a time domain signal from converting the FFT frequency domain signal chain. The *new method is equivalent to the *ar message returns an audio rate signal."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// without any modification, convert FFT chain (frequency domain signal) back to audio (time domain signal)\n(\n{ var in, chain;\n in = WhiteNoise.ar;\n chain = FFT(LocalBuf(2048), in);\n IFFT.ar(chain) * -20.dbamp // inverse FFT\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `EaseOutQuart.value` do? What arguments does it take?"}, {"role": "assistant", "content": "Quartic ease-out Arguments: t — a Float between 0.0 and 1.0.."}]} +{"conversations": [{"role": "user", "content": "What does `SoundFileView.selectionSize` do? What arguments does it take?"}, {"role": "assistant", "content": "The size of a Arguments: index — The index of the selection; an Integer between 0 an 63.. Returns: An Integer."}]} +{"conversations": [{"role": "user", "content": "What happens when I call .play on a function?"}, {"role": "assistant", "content": "`.play` on a Function builds a SynthDef from the function body, adds it to the server under an anonymous name, and starts one Synth of it. You get back the Synth, so `x = { SinOsc.ar(440) * 0.1 }.play; x.free;` stops it. It is the fastest way to hear something, but it is not how you write a piece: nothing is named, nothing can be reused, and the definition is lost when the Synth is freed."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\"help-WhiteNoise\", { |out = 0|\n Out.ar(out,\n WhiteNoise.ar(0.25)\n )\n}).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\"help-WhiteNoise\", { |out = 0|\n Out.ar(out,\n WhiteNoise.ar(0.25)\n )\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "When should I use a Pattern instead of writing Synth code by hand?"}, {"role": "assistant", "content": "Use a Pattern when what you want to express is a sequence over time — notes, durations, amplitudes, parameters — rather than a signal. A Pbind describes events, and `.play` turns each event into a Synth (by default of the \\default instrument, or of \\instrument if you name one). Hand-written Synth code is for the sound itself; Patterns are for what plays when. The two compose: a SynthDef named \\bell is triggered from `Pbind(\\instrument, \\bell, ...)`."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nc=13;a=Array.fib(64,0,1);b=Array.fill(size:c,function:{arg i;a[i]%12});\np=1/(21-c);Pdef(\\x,Pbind(\\dur,p,\\degree,Pseq(b,1,0)));\nr=Array.fill(c,{arg i;Pbindf(Pdef(\\x),\\mtranspose,1-b[i]);});\nPseq(r,(1/p)).play;\n)\n```"}, {"role": "assistant", "content": "Wow ! the conciseness of SuperCollider is wonderful !\r\nWe can make many attractive melodies !."}]} +{"conversations": [{"role": "user", "content": "What does `File.use` do?"}, {"role": "assistant", "content": "Open the file, evaluate the function with the file as argument, and close it again. If the process fails, close the file and throw an"}]} +{"conversations": [{"role": "user", "content": "What does `Boolean.keywordWarnings` do?"}, {"role": "assistant", "content": "turn on/off warnings if a keyword argument is not"}]} +{"conversations": [{"role": "user", "content": "What does `Node.waitForFree` do?"}, {"role": "assistant", "content": "Wait until this Node is freed. Should be used inside a Routine or"}]} +{"conversations": [{"role": "user", "content": "What does `SCButtonAdapter.initOneState` do? What arguments does it take?"}, {"role": "assistant", "content": "parent class for Button classes Arguments: name; textcolor; backcolor."}]} +{"conversations": [{"role": "user", "content": "Explain `HasPatchIns` in SuperCollider briefly."}, {"role": "assistant", "content": "HasPatchIns — parent class for Players that have PatchIns such as Patch Category: Libraries > crucial > Players > abstract."}]} +{"conversations": [{"role": "user", "content": "What model are you?"}, {"role": "assistant", "content": "I am sc-mind: a 198M MiniMind-3-MoE, eight layers, 768 wide, four experts with top-1 routing. I was trained from scratch on the SuperCollider documentation, class library and help pages, then fine-tuned on questions and answers about them."}]} +{"conversations": [{"role": "user", "content": "What is a UGen graph in SuperCollider?"}, {"role": "assistant", "content": "A UGen graph is the directed acyclic graph of unit generators that a SynthDef describes: sources (SinOsc, WhiteNoise) feed processors (LPF, EnvGen, Pan2) and end at an output such as Out.ar. The language builds the graph; the server instantiates it once per Synth. A signal path is drawn by passing one UGen's output as another's input, and because UGens are multi-channel by default, the same expression can build a stereo or 8-channel graph depending on the arrays inside it."}]} +{"conversations": [{"role": "user", "content": "What is `ControlName`?"}, {"role": "assistant", "content": "ControlName — Object to store control information of SynthDef (used internally)"}, {"role": "user", "content": "What does `ControlName.index` do?"}, {"role": "assistant", "content": "The index of the control."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nd = SynthDef(\\tone, { |out = 0, freq = 200|\n var sig;\n\n freq.spec = ControlSpec(20, 20000);\n sig = SinOsc.ar(freq);\n\n Out.ar(out, sig);\n}).add;\n);\n\nd.specs.freq.postln;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nPsloth {\n var seed, repeats;\n\n *new { arg seed, repeats=1;\n ^super.newCopyArgs(seed, repeats);\n }\n\n storeArgs{^[seed, repeats]}\n\n embedInStream { arg inval;\n var size=seed.size;\n var pointers=List[];\n repeats.value(inval).do({ arg j;\n j = j+1;\n if(j == j.nextPowerOf(size),{ pointers.add(0); });\n pointers.collect{|i| seed.at(i)}.sum.embedInStream(inval);\n pointers.do{|x, i|\n if((i==0) || (pointers[0..(i-1)].sum==0), {pointers[i] = ((x+1)%size);})\n };\n });\n ^inval\n }\n}\n```"}, {"role": "assistant", "content": "Save this as an extension and recompile class library. You can now use `Psloth([0,1,0], 10)`, for example, instead of declaring a new routine for each pattern.\r\n\r\nI didn't persist the use cases, as this should be saved as a `.sc` file. Please refer to the ancestor code for usage.\r\n\r\nMemory/CPU usage will grow over time, but at a decreasing rate. This can be used for a large amount of repeats. Exte."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nSynthDef(\\Synth3,\n {arg ress = 0;\n var klank, env;\n klank = Klank.ar(`[{Rand(70,21000)}!7, {Rand(0.128,0.700)}!7],BrownNoise.ar(0.7));\n klank = klank;\n env = EnvGen.kr(Env.perc(0.07, ress), doneAction:2);\n Out.ar(0, klank*env.dup*0.0128);\n}).add;\n)\n\n\n{inf.do{x = rrand(0.01,0.7); Synth(\\Synth3, [\\ress, x+(7*x)]); x.wait;}}.fork\n```"}, {"role": "assistant", "content": "Play around with {Rand(70, 21000)}!7\r\n\r\nA simple example for the begginers... hope I can contribute to something =)."}]} +{"conversations": [{"role": "user", "content": "What is the difference between .ar, .kr and .ir?"}, {"role": "assistant", "content": "The rate method decides how often a UGen is evaluated. `.ar` runs at the audio rate, once per sample, and produces an audio signal. `.kr` runs at the control rate, once per block of 64 samples by default, so it is cheaper and is used for parameters that do not need sample accuracy. `.ir` is evaluated once when the Synth is created and then never again, for constants such as SampleRate.ir or a size. Using .kr where you need audio-rate modulation gives stepped, zipper-noise-like control; using .ar where .kr would do costs CPU."}]} +{"conversations": [{"role": "user", "content": "How do I make an additive bell with Klank?"}, {"role": "assistant", "content": "Klank is a bank of resonant filters excited by a short impulse: you describe the partials as\nfrequencies, amplitudes and decay times.\n\n```supercollider\n(\nSynthDef(\\klank, { |out = 0, freq = 440, amp = 0.3|\n var ratios = [1, 2.2, 3.7, 5.1, 7.3];\n var decays = [4, 2.6, 1.8, 1.2, 0.8];\n var sig = Klank.ar(`[ratios * freq, nil, decays], Impulse.ar(0, 0, 0.2), 1, 0, 0.3);\n Out.ar(out, Pan2.ar(sig * amp, 0));\n}).add;\n);\nSynth(\\klank);\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Node`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n(\nx = SynthDef(\"help-node-set\", { |freq = 440, out = 0|\n Out.ar(out, SinOsc.ar(freq, 0, 0.1))\n}).play\n);\nx.run(false);\nx.run; // default is true\nx.free;\n```"}]} {"conversations": [{"role": "user", "content": "What is Ndef used for?"}, {"role": "assistant", "content": "Ndef is the JITLib node proxy: a named placeholder for a running signal chain that you can redefine while it plays. `Ndef(\\drone, { SinOsc.ar(55) * 0.1 }).play` starts it, and calling Ndef(\\drone, { ... }) again crossfades to the new definition without restarting the sound. It also supports chaining, `Ndef(\\drone)[1] = \\filter -> { |in| LPF.ar(in, 800) }`, which is the idiomatic way to build and modify a live patch."}]} -{"conversations": [{"role": "user", "content": "How do I record my output to a file?"}, {"role": "assistant", "content": "`s.record(path)` starts recording the server's output; `s.stopRecording` stops it.\n\n```supercollider\ns.record(\"C:/audio/take1.wav\");\n// play for a while\ns.stopRecording;\n```\n\nThe path must be writable and the format follows the extension (.wav, .aiff, .flac). The file is written\nby the server, so it captures exactly what the master bus produces — including your effects, which is what\nyou want. `s.record` also accepts `duration:` to stop by itself, which is the reproducible form for a take."}]} -{"conversations": [{"role": "user", "content": "What does `Color.screen` do? What arguments does it take?"}, {"role": "assistant", "content": "An object which stores color values Arguments: aColor — An instance of Color.; opacity — A value between 0 and 1. Default value is 1.0.."}]} -{"conversations": [{"role": "user", "content": "What does `SimpleNumber.ellint3C` do?"}, {"role": "assistant", "content": "Returns the complete elliptic integral of the third kind, Legendre form. Requires `-1 <= k <= 1` and `n <"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nDelayN.ar(z, 0.2, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\n(\n// recursive application of delay.\n{\nz = Decay2.ar(Dust.ar(1, 0.5), 0.01, 0.1, Saw.ar(100 + [0, 1]));\n5.do { |i| z = DelayN.ar(RLPF.ar(z, Rand(100, 3000), 0.03), 1, 1 / (2**i), 1, z * 0.5) };\nz\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nDelayN.ar(z, 0.2, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\n(\n// recursive application of delay.\n{\nz = Decay2.ar(Dust.ar(1, 0.5), 0.01, 0.1, Saw.ar(100 + [0, 1]));\n5.do { |i| z = DelayN.ar(RLPF.ar(z, Rand(100, 3000), 0.03), 1, 1 / (2**i), 1, z * 0.5) };\nz\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// time warped analog bubbles, time scale is mouse x position\n{\n\n Bend.time(MouseX.kr(0.02, 20, 1), {\n var f = LFSaw.kr(0.4, 0, 24, LFSaw.kr([8,7.23], 0, 3, 80)).midicps; // glissando function\n CombN.ar(SinOsc.ar(f, 0, 0.04), 0.2, 0.2, 4) // echoing sine wave\n })\n\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// time warped analog bubbles, time scale is mouse x position\n{\n\n Bend.time(MouseX.kr(0.02, 20, 1), {\n var f = LFSaw.kr(0.4, 0, 24, LFSaw.kr([8,7.23], 0, 3, 80)).midicps; // glissando function\n CombN.ar(SinOsc.ar(f, 0, 0.04), 0.2, 0.2, 4) // echoing sine wave\n })\n\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\nNdef(\\a).ar;\nNdef(\\k).kr;\n\n // make a MonitorGui with all bells and whistles\nm = MonitorGui.new(bounds: 500@40, options: [\\name, \\level, \\fade]);\n\n // when it has a kr proxy, it is visible, but disabled\nm.object_(Ndef(\\k));\n // with an ar proxy, it is enabled\nm.object_(Ndef(\\a));\n\n\n // show its play state\nNdef(\\a).play\n // and volume\nNdef(\\a).vol_(0.25);\n\n // NOTE: shift-clicking the play button opens a playN dialog!\n\nNdef(\\a).stop;\nNdef(\\a).play(0;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\nNdef(\\a).ar;\nNdef(\\k).kr;\n\n // make a MonitorGui with all bells and whistles\nm = MonitorGui.new(bounds: 500@40, options: [\\name, \\level, \\fade]);\n\n // when it has a kr proxy, it is visible, but disabled\nm.object_(Ndef(\\k));\n // with an ar proxy, it is enabled\nm.object_(Ndef(\\a));\n\n\n // show its play state\nNdef(\\a).play\n // and volume\nNdef(\\a).vol_(0.25);\n\n // NOTE: shift-clicking the play button opens a playN dialog!\n\nNdef(\\a).stop;\nNdef(\\a).play(0);\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nNdef(\\nodeTest, {\n // the input\n var input = Impulse.ar([1, 3, 5].reciprocal, phase: [0, 0.133, 0.5]).sum;\n\n // the nodes, each takes its predecessor as input and estimates the duration between two events. \n // Unfortunately, the starting point of Timer is '0' which we have to put into reasonable limits. System settles after about 15 seconds\n var nodes = (1..10).inject([input], {|last, item| \n [TDuty.ar(max(0.25, Timer.ar(last.first)), 0, 1)] ++ last\n });\n\n // add a pitch to each\n nodes = nodes.collect{|node, i| SinOsc.ar((4000 + (i*500))) * Decay2.ar(node, 0.01, 0.2)};\n\n // splay in stereo field\n Splay.ar(nodes);\n\n}).play\n)\n```"}, {"role": "assistant", "content": "Idea: network of loosely connected nodes. Each node has a dedicated pulse rate / phase. Inducing an irregular trigger signal influences the nodes to (gradually) adapt their pulsation freq (and phase?) to the one of the input.\r\nsound example: https://soundcloud.com/lfsaw/sync-weakconnection-tduty-time."}]} -{"conversations": [{"role": "user", "content": "How do I distort a signal?"}, {"role": "assistant", "content": "Drive it into a nonlinearity, then tame the level: `tanh` is soft clipping, `.distort` is harder,\nand a low-pass after the drive keeps it from getting fizzy.\n\n```supercollider\n(\n{\n var sig = SinOsc.ar(110) * 0.3;\n var driven = (sig * 12).tanh;\n LPF.ar(driven, 5000) * 0.4\n}.play;\n)\n```\n\nMore drive means more harmonics; because they are generated, the output is louder as well as brighter, so\nscale the result down after the nonlinearity."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes SOUND 1, from orig Influx Example."}, {"role": "assistant", "content": "```supercollider\n// SOUND 1, from orig Influx Example\n(\nNdef(\\dog).addSpec(\\intv, [-24, 24]);\nNdef(\\dog).addSpec(\\timescale, [0.01, 10, \\exp]);\nNdef(\\dog).addSpec(\\curve, [-10, 10]);\nNdef(\\dog).addSpec(\\ffreq, \\freq);\n\nNdef(\\dog).addSpec(\\loopnode, [0, 12]);\nNdef(\\dog).addSpec(\\dens, [10, 1000]);\nNdef(\\dog).addSpec(\\resfreq, \\freq);\nNdef(\\dog).addSpec(\\ringtime, [0.01, 1, \\exp]);\n\nNdef(\\dog, { |amp, freq=250, intv=19, timescale=1, curve=0, loopnode=0, dens = 10, resfreq = 500, ringtime = 0.01|\n var n = 15;\n var env = EnvGen.kr(\n Env({ 1.0.rand2 }!(n+1), {1.0.rand}!n, curve, releaseNode: n-1, loopNode: loopnode.min(n-3)),\n timeScale: timescale);\n var pitch = (env * [1, 0.33, -1] * intv).midiratio * freq;\n var form = Formant.ar(pitch, pitch.rotate(1) * 1.6, pitch.rotate(2) * 2.6);\n\n var dusty = Ringz.ar(\n Dust.ar(dens!3), \n resfreq * LFNoise0.kr([3, 5, 7], 0.5, 1), \n ringtime) \n * ((dens ** -0.5) * (ringtime ** -0.3)\n );\n \n Splay.ar(form * dusty, level: amp) ;\n});\n);\n\nNdef(\\dog).addHalo(\\orderedNames, Ndef(\\dog).controlKeys);\n\n/*\nNdef(\\dog).controlKeys;\nNdef(\\dog).vol_(0.5);\nNdefPreset( Ndef(\\dog) ).loadSettings;\nNdef(\\dog).play;\nNdef(\\dog).gui;\n*/\n```"}]} -{"conversations": [{"role": "user", "content": "Resetting start count with PulseDivider?"}, {"role": "assistant", "content": "SuperCollider forum — Resetting start count with PulseDivider?\n\ni think in your example Sweep is receiving a trigger while going from 0 to 1 causing the discontinuity in the phase because the duration between one trigger and the next is unknown.\n\nwith this example you get at least a continiuous phase with random triggers to drive the hanning window (evaluate it several times). but its not multichannel with distributed phases / windows accross channels:\n\n```supercollider\n(\nvar randomTrigPhase = { |triggerRate = 10, randomness = 1|\n var minDuration = (2 ** randomness) / triggerRate;\n var maxDuration = (2 ** (-1 * randomness)) / triggerRate;\n var demand = Dunique(minDuration * ((maxDuration / minDuration) ** Dwhite(0, 1)));\n var duration = Duty.ar(demand, DC.ar(0), demand);\n var phase = Phasor.ar(DC.ar(0), (1 / duration) / SampleRate.ir, 0, 1);\n (phase: phase, trigger: HPZ1.ar(phase) < 0);\n};\n\nvar hanningWindow = { |phase|\n (1 - (phase * 2pi).cos) / 2 * (phase < 1);\n};\n\n{\n var rate = 100;\n var phase = randomTrigPhase.(rate, 1).phase;\n hanningWindow.(phase);\n}.plot(0.1);\n)\n```\n\nim not sure if this is helping it just reminded me of some issue with multichannel random triggers and continiuous phases i have been trying to solve."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Paddp`."}, {"role": "assistant", "content": "```supercollider\n(\nvar a, b;\na = Paddp(\\freq, Pseq([2, 3, pi], inf), Pbind(\\freq, Pseq([100, 200, 300])));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\nx = {\nvar son = SinOsc.ar(mul: SinOsc.ar(0.3).range(0,1) * Line.ar(0, 1, 20, doneAction: 2));\nTextVU.ar(2, son, \"Sin\");\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\nx = {\nvar son = SinOsc.ar(mul: SinOsc.ar(0.3).range(0,1) * Line.ar(0, 1, 20, doneAction: 2));\nTextVU.ar(2, son, \"Sin\");\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{CrossoverDistortion.ar(SinOsc.ar([400, 404], 0, 0.2), MouseX.kr(0, 1), MouseY.kr(0, 1))}.play\n\n{CrossoverDistortion.ar(SoundIn.ar, MouseX.kr(0, 1), MouseY.kr(0, 1)}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{CrossoverDistortion.ar(SinOsc.ar([400, 404], 0, 0.2), MouseX.kr(0, 1), MouseY.kr(0, 1))}.play\n\n{CrossoverDistortion.ar(SoundIn.ar, MouseX.kr(0, 1), MouseY.kr(0, 1))}.play\n```"}]} +{"conversations": [{"role": "user", "content": "What does `RedUniverse.write` do?"}, {"role": "assistant", "content": "Save all worlds and objects and their respective state to"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `BufRd` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n// indexing with a phasor\n{ BufRd.ar(1, b, Phasor.ar(0, BufRateScale.kr(b), 0, BufFrames.kr(b))) }.play;\n\n// indexing by hand\n{ BufRd.ar(1, b, K2A.ar(MouseX.kr(0, BufFrames.kr(b)))) }.play;\n\nb.free\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `FBSineL`."}, {"role": "assistant", "content": "```supercollider\n// increase feedback\n{ FBSineL.ar(SampleRate.ir, 1, Line.kr(0.01, 4, 10), 1, 0.1) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What is the difference between an audio bus and a control bus?"}, {"role": "assistant", "content": "Both are numbered channels on the server used to move signal between nodes. An audio bus carries audio-rate signal and holds one or more audio channels; a control bus carries one value per block, like a parameter. You write with Out.ar / Out.kr and read with In.ar / In.kr, or with `.asMap` / `\\param, bus.asMap` to drive a Synth's control from a bus. Buses are how effects are chained: a synth writes to a private bus, the effect reads it and writes to Out.ar(0, …)."}]} +{"conversations": [{"role": "user", "content": "What does `UScoreEditor.unmuteEvents` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: events — (describe argument here). Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Hilbert`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\ns.scope;\na = { Hilbert.ar(SinOsc.ar(100)) * -20.dbamp }.play;\na.release;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `In`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n(\nSynthDef(\"help-PinkNoise\", { |out = 0|\n Out.ar(out, PinkNoise.ar(0.1))\n}).add;\n\nSynthDef(\"help-In\", { |out = 0, in = 0|\n var input;\n input = In.ar(in, 1);\n Out.ar(out, input);\n\n}).add;\n);\n\n// play noise on the right channel\nx = Synth(\"help-PinkNoise\", [\\out, 1]);\n\n// read the input and play it out on the left channel\nSynth.after(x, \"help-In\", [\\out, 0, \\in, 1]);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SynthlessPlayer.proxyControlClass` do?"}, {"role": "assistant", "content": "parent class for Players that will not spawn a synth"}]} +{"conversations": [{"role": "user", "content": "What does `ControlSpec.guessNumberStep` do?"}, {"role": "assistant", "content": "Used for EZ GUI classes for guessing a sensible step if none is"}]} +{"conversations": [{"role": "user", "content": "What does Lag do?"}, {"role": "assistant", "content": "`Lag.ar(in, lagTime)` and `Lag.kr(in, lagTime)` smooth a signal with an exponential lag towards its target, which removes the clicks and zipper noise a stepped control would produce. Lag.kr on a mouse or MIDI input is the standard way to make a parameter feel analogue: `Lag.kr(MouseX.kr(200, 4000), 0.2)`. Lag2 and Lag3 are the second- and third-order versions, smoother and slower."}]} +{"conversations": [{"role": "user", "content": "Explain `SinOscFB` in SuperCollider briefly."}, {"role": "assistant", "content": "SinOscFB — Feedback FM oscillator SinOscFB is a sine oscillator that has phase modulation feedback; its output plugs back into the phase input. Basically this allows a modulation between a sine wave and a sawtooth like wave. Overmodulation causes chaotic oscillation. It may be useful if you want to simulate feedback FM synths. Category: UGens > Generators > Deterministic, UGens > Generators > Chaotic."}]} {"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n~x.play;\n\n~x = { var alpha,beta; alpha = rrand(99,399); beta = alpha = rrand(99,399);Pan2.ar(LeakDC.ar(Normalizer.ar(BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(\nFreeVerb.ar(Formant.ar(TRand.kr(alpha,alpha+(rrand(5,20)),Impulse.kr(rrand(10,100))), TRand.kr(beta,beta+(rrand(5,20)),Impulse.kr(rrand(10,100))), EnvGen.kr(Env.adsr,Impulse.kr(rrand(100,666)))*rrand(666,3333),0.125),\nrrand(0.5,1.0),rrand(0.5,1.0),rrand(0.5,1.0))\n,100,6.0,12),1000,6.0,0),5000,6.0,0),10000,6.0,12),0.6,0.1)),0)\n};\n```"}, {"role": "assistant", "content": "A drone insect-string from:\r\n\r\nhttp://musicnumbers.wordpress.com/2011/11/25/nx010/."}]} -{"conversations": [{"role": "user", "content": "Explain `Red4DTesseract` in SuperCollider briefly."}, {"role": "assistant", "content": "Red4DTesseract — hypercube A class for rotating and rendering a 4D-hypercube in 3D. Category: Red > redUniverse > shapes."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Re: Re: the perfect frequencies?"}, {"role": "assistant", "content": "```supercollider\n(\nf = {\n var rep = [4, 8, 16, 32];\n var n = rep.choose;\n var x = [\n\n 54, 60, 66, 72, 81, 90, 96, 102,\n 108, 128, 132, 144, 162, 180, 192, 204,\n 216, 240, 264, 288, 324, 360, 384, 408,\n 432, 480, 528, 576, 648, 720, 768, 816,\n 864, 960, 1056, 1152, 1296, 1440, 1536, 1632,\n 1728, 1920, 2112, 2304, 2592, 2880, 3072, 3264,\n 3456, 3840, 4224, 4608, 5184, 5760, 6144, 6528,\n 6912, 7680, 8448, 9216, 10368, 11520, 12288, 528\n\n ];\n var fac1 = [1,10,100,1000].choose;\n var fac2 = [1,10,100,1000].choose;\n var fac3 = [1,10,100,1000].choose;\n Mix.fill(n,\n {\n var detune = 5.rand;\n var saw;\n var sin;\n detune = XLine.kr(0.1,1+250.0.rand ,2+9.0.rand) * 2.0.rand* [1,-1].choose;\n sin = SinOsc.ar(x.choose * ( 1 + ( SinOsc.ar(x.choose/fac1) * x.choose/fac2 )) + detune, 4.rand, 0.25);\n saw = RLPF.ar(Saw.ar(x.choose*0.01+detune, 0.75), x.choose, 2.rand);\n saw = [\n saw,\n saw.fold2( SinOsc.ar(x.choose/fac3).range(0.1,1) ),\n saw.wrap2( SinOsc.ar(x.choose/fac3).range(0.1,1) ),\n saw * SinOsc.ar(x.choose/2),\n ( saw * SinOsc.ar(x.choose/fac3).range(1,20) ).tanh/2,\n ].choose;\n Pan2.ar((sin+saw) * EnvGen.kr(Env.sine(12, 1/n), 1, doneAction:2),\n 1.rand2) \n }\n );\n};\n);\n\n(\n// DEFINE A ROUTINE\nr = Routine({\n\n inf.do({\n f.play;\n 10.wait;\n })\n});\n);\n\nr.reset.play;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\np = Pbind(\n \\midinote, Prand((60,60.5..80), inf),\n \\dur, Prand([0.125, 0.25, 0.5], inf)\n);\n\n//p.play;\n\nf = Fomus(p.asStream, 30);\nf.ly;\nf.midi;\nf.xml;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\np = Pbind(\n \\midinote, Prand((60,60.5..80), inf),\n \\dur, Prand([0.125, 0.25, 0.5], inf)\n);\n\n//p.play;\n\nf = Fomus(p.asStream, 30);\nf.ly;\nf.midi;\nf.xml;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `BHiShelf` in SuperCollider?"}, {"role": "assistant", "content": "BHiShelf — Hi Shelf The B equalization suite is based on the Second Order Section (SOS) biquad UGen. Category: UGens > Filters > BEQSuite."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n\nPatch({ arg tempo;\n Impulse.ar( tempo )\n},[\n TempoPlayer.new\n\n]).play(atTime: 1)\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n\nPatch({ arg tempo;\n Impulse.ar( tempo )\n},[\n TempoPlayer.new\n\n]).play(atTime: 1)\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `RedTrk.item` do?"}, {"role": "assistant", "content": "Object to be controlled (e.g. Pbind, Tdef, Routine"}]} -{"conversations": [{"role": "user", "content": "What does `Latency.threshold` do?"}, {"role": "assistant", "content": "get and set amplitude threshold for pulses on input"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Very quick-and-dirty hack to show stereo phase."}, {"role": "assistant", "content": "```supercollider\n(\nb = Bus.audio(s, 2);\na = { |inbus = 0|\n var sig = In.ar(inbus, 2);\n // x axis is side, oriented toward right;\n // y axis is mid\n [sig[1] - sig[0], sig.sum]\n}.play(s.defaultGroup, outbus: b, addAction: \\addAfter);\nc = s.scope;\nc.style = 2;\nc.bus = b;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// every other note of the diatonic cluster: stacked thirds\n(degree: (0..12), amp: [0, 0.1]).play;\n\n// every other note of the semitone cluster: a wholetone cluster again\n(note: (0..12), amp: [0, 0.1]).play;\n\n// every third note of the semitone cluster: a diminished chord\n(note: (0..12), amp: [0, 0, 0.1]).play;\n\n// the same with different sustain times\n(note: (0..12), amp: [0, 0, 0.1], sustain: [0.1, 0.3, 1.3, 2.5]).play;\n\n// timingOffset gives a tempo-relative offset time to each synth\n(instrument: \\pm, ratio: [2.3, 4.5\n// …\n```"}, {"role": "assistant", "content": "every other note of the diatonic cluster: stacked thirds every other note of the semitone cluster: a wholetone cluster again (Event: an environment that represents an action)"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\nb= Buffer.read(s,\"sounds/break\",20000,10000);\n\n//gradual erosion\n(\nSynthDef(\"help-sortbuf\",{arg bufnum;\nOut.ar(0,\nPan2.ar( \nSortBuf.ar(bufnum,LFNoise0.kr(5,50000,60000),0)\n,0.0))\n}).play(s,[\\bufnum, b.bufnum]);\n);\n\nc= Buffer.read(s,\"sounds/break\",20000,10000);\nc.copy(b); //restore buffer\n\n\n//short 2000 sample buffer sorted over about 10 seconds\nb= Buffer.read(s,\"sounds/break\",20000,2000);\n{SortBuf.ar(b.buf\n// …\n```"}, {"role": "assistant", "content": "short 2000 sample buffer sorted over about 10 seconds , MouseY.kr(200,4000),0.1) (SortBuf: Karplus-Strong via a sorting algorithm)"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pmulp`."}, {"role": "assistant", "content": "```supercollider\n(\nvar a, b;\na = Pmulp(\\freq, Pseq([2, 3, pi], inf), Pbind(\\freq, Pseq([100, 200, 300])));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Nil`."}, {"role": "assistant", "content": "```supercollider\n// for Nil: return the argument unmodified (an event).\nnil.transformEvent((x: 8));\n// for Dictionary (and thus for Event): add to the argument.\n(y: 100, z: 1).transformEvent((x: 8));\n// for Association: add the association to the event\n(\\a -> \\x).transformEvent((x: 8));\n// for Function: use the function receive the event as argument.\n{ |event| event.use { ~x = ~x + 1 }; event }.transformEvent((x: 8));\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SerialPort.putAll` do? What arguments does it take?"}, {"role": "assistant", "content": "Write multiple bytes to the Arguments: bytes — Collection may be Int8Array or String.; timeout — Unused, deprecated.."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pseg`."}, {"role": "assistant", "content": "```supercollider\n// change a parameter\n(\nPbind(\n \\note, Pseg(Pseq([1, 5], inf), Pseq([4, 1], inf), \\linear),\n \\dur, 0.1\n).play;\n);\n\n(\nPbind(\n \\freq, Pseg(Pseq([400, 1500], inf), Pseq([4, 4], inf), Pseq([\\linear, \\exp], inf)),\n \\dur, 0.1\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nInstr(\\testSine,{arg freq=1000,mul=0.1; SinOsc.ar(freq,0,mul)});\na=PlayerMixer([\n Patch(\\testSine,[400,0.1]),\n Patch(\\testSine,[800,0.08]),\n Patch(\\testSine,[1600,0.06])\n]);\n);\n\na.play;\n\na.addPlayer(Patch(\\testSine,[2000,0.2]));\na.addPlayer(Patch(\\testSine,[2400,0.15]));\na.addPlayer(Patch(\\testSine,[2800,0.1]));\n\na.addPlayer( Patch(\\testSine, [rrand(400,4000\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nInstr(\\testSine,{arg freq=1000,mul=0.1; SinOsc.ar(freq,0,mul)});\na=PlayerMixer([\n Patch(\\testSine,[400,0.1]),\n Patch(\\testSine,[800,0.08]),\n Patch(\\testSine,[1600,0.06])\n]);\n);\n\na.play;\n\na.addPlayer(Patch(\\testSine,[2000,0.2]));\na.addPlayer(Patch(\\testSine,[2400,0.15]));\na.addPlayer(Patch(\\testSine,[2800,0.1]));\n\na.addPlayer( Patch(\\testSine, [rrand(400,4000),0.1 ] ) );\n\n\n\n(\nInstr(\\testSine,{arg freq=1000,mul=0.1; SinOsc.ar(freq,0,mul)});\na=PlayerMixer([\n Patch(\\testSine,[400,0.1]),\n Patch(\\testSine,[800,0.08]),\n Patch(\\testSine,[1600,0.06])\n]);\nb=PlayerPool([a]).autostart_(true);\n);\nb.choose\n\nb.play;\na.addPlayer(Patch(\\testSine,[2000,0.2]));\nb.select(0); //crashes\na.addPlayer(Patch(\\testSine,[2400,0.15]));\nb.select(0); //crashes\na.addPlayer(Patch(\\testSine,[2800,0.1]));\nb.select(0); //crashes\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Platform`?"}, {"role": "assistant", "content": "Platform — handle cross-platform differencies"}, {"role": "user", "content": "What does `Platform.case` do?"}, {"role": "assistant", "content": "Perform actions depending on the current platform (name), just like Object:switch: `Platform.case(`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// start a server program from the cmdLine for testing\n~pid = unixCmd(Server.program + s.options.asOptionsString(57100));\n// kill just that server program by its pid:\nthisProcess.platform.killProcessByID(~pid);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `FoaWr.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "First Order Ambisonic (FOA) Soundfield Reactive Energy Vector Arguments: in — The B-format signal, an array: [w, x, y, z]; size — Analysis filter kernel size.; method — The Soundfield analysis method:."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Lag`."}, {"role": "assistant", "content": "```supercollider\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n Lag.kr( // lag the modulator\n LFPulse.kr(4, 0, 0.5, 50, 400), // frequency modulator\n Line.kr(0, 1, 15) // modulate lag time\n ),\n 0, // phase\n 0.3 // sine amplitude\n )\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `EaseInOutCubic` in SuperCollider briefly."}, {"role": "assistant", "content": "EaseInOutCubic — Cubic ease-in/out Easing equation for a cubic (t^3) ease-in/out, accelerating until halfway, then decelerating. Category: Ease."}]} -{"conversations": [{"role": "user", "content": "Write a granular texture in SuperCollider."}, {"role": "assistant", "content": "Read a sound file into a buffer, then trigger grains from it. Grain density is the Impulse rate and\ngrain length is dur; keep the density times the length under maxGrains or raise it.\n\n```supercollider\n(\ns.waitForBoot {\n ~buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n SynthDef(\\grain, { |out = 0, amp = 0.4, density = 30, dur = 0.08|\n var trig = Impulse.kr(density);\n var sig = GrainBuf.ar(2, trig, dur, ~buf, 1, LFNoise0.kr(2).range(0, 1), 2, 0, -1, 512);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n Synth(\\grain);\n};\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for tired pads."}, {"role": "assistant", "content": "```supercollider\n// this is what I write when I didn't sleep last night.. zzzzzz\n// easy subsynth with dynklank and simple scale\n\n(\n\nfork{ \n loop{\n var time;\n time = 5.rand;\n {\n var sound, freqs, envs, rings, numvoices, env;\n numvoices = 40;\n freqs = {(Scale.major(\\just).degrees+26+\n (0,12..110).choose).choose}.dup(numvoices).midicps;\n rings = {1.0.rand}.dup(numvoices);\n envs = { EnvGen.kr(Env.linen( time/3.0.rand, \n time/3.0.rand, time/3.0.rand, 1.0.rand ) ) }.dup(numvoices);\n \n sound = PinkNoise.ar(numvoices.reciprocal!2);\n sound = DynKlank.ar(`[freqs,envs,rings], sound );\n sound = sound * EnvGen.kr(Env.linen(time.rand,time/3,time.rand),doneAction:2);\n \n sound = HPF.ar(sound, 120);\n \n 4.do{sound = DelayC.ar(sound, 0.4, [0.4.rand,0.4.rand], 1/8, sound) };\n \n //good call - lets turn this down \n sound*0.2;\n }.play;\n time.rand.wait;\n }\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes nothing much )."}, {"role": "assistant", "content": "```supercollider\n(\n{|atk=0.05,dur=10,freq=50,amp=0.8|\n PMOsc.ar(\n Line.kr(1,2,dur,freq),\n LFNoise2.kr([1,2]).range(1,2)*freq,\n LFNoise2.kr([2,1]).range(0.1,3.5),\n 0,\n Decay2.ar(\n Impulse.ar(XLine.kr(1, 25, dur)) * SinOsc.ar(4/dur,[0,pi/2],0.05,1),\n 0.023, XLine.ar(1,35,dur).reciprocal,\n Line.ar(1,0.8,dur) * LFNoise2.kr(4/dur,0.05,1).dup\n ) * EnvGen.ar(Env([0,1,1,0],[atk,dur-atk,0.3]),1,amp, doneAction:2)\n )\n // * LFPulse.ar(XLine.kr(5,20,dur,freq * LFNoise2.kr([1,2]).range(0.95,1.05)))\n}.play(args:[\n freq:50.rrand(350).debug('freq'),\n dur:10.rrand(20).debug('dur')\n])\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Midterm Q3 (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"bell\", {arg freq, amp;\n\n\n var env, snd, partials, relativeAmps;\n\n partials = [0.5, 1, 1.19, 1.56, 2, 2.51, 2.66, 3.01, 4.1];\n relativeAmps = [0.25, 1, 0.8, 0.5, 0.9, 0.4, 0.3, 0.6, 0.1];\n\n env = Env.perc(\n attackTime: 0.01,\n releaseTime: 5,\n level: amp*relativeAmps).kr(doneAction:2);\n\n snd = SinOsc.ar(\n freq: freq*partials,\n mul: env\n );\n\n snd = Mix.ar(snd);\n\n Out.ar(0, snd * 0.1 ! 2);\n\n}).add;\n);\n\n\n//Test your \"bell\" SynthDef with the following Pbind:\n\n\n(\nPbind(\n \\instrument, \"bell\",\n \\degree, Pwhite(-5, 10),\n \\dur, Pwhite(3, 6),\n \\amp, Pwhite(0.1, 0.5)\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `NodeControl` in SuperCollider briefly."}, {"role": "assistant", "content": "NodeControl — Encapsulates in an object a node and an index. This object can be held by a client and have its value set without otherwise having to store the details about where the node's input is. Category: Server > Nodes."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\ns.boot;\n// allocate an array of Buffers and fill them with different harmonics\n(\nb = Buffer.allocConsecutive(8, s, 4096, 1, { |buf, i|\n buf.sine1Msg((1 .. ((i + 1) * 6)).reciprocal) // completion messages\n});\n\na = { VOsc.ar(SinOsc.kr(0.5, 0).range(b.first.bufnum + 0.1, b.last.bufnum - 0.1),\n [440, 441], 0, 0.2) }.play;\n);\na.free;\n\n// iterate over the array and free it\nb.do(_.free);\n```"}, {"role": "assistant", "content": "allocate an array of Buffers and fill them with different harmonics iterate over the array and free it (Buffer: Client-side representation of a buffer on a server)"}]} -{"conversations": [{"role": "user", "content": "How should I check an answer you give me?"}, {"role": "assistant", "content": "Three quick checks, cheapest first. Does it evaluate without a syntax error — the post window points at the exact character. Does the node appear in `s.plotTree` — if yes, the problem is signal rather than lifecycle. Does it reach `Out.ar(0, ...)` with a non-zero amplitude and an open filter. If those three pass and it is still silent, the class's own help page will show the argument order you may have assumed wrong."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\"ReplaceOutHelp\", { |out = 0, freq = 440|\n var source;\n source = SinOsc.ar(freq, 0, 0.1);\n\n // write to the bus, replacing previous contents\n ReplaceOut.ar(out, source);\n\n}).add;\n);\n\n// each Synth replaces the output of the previous one\nx = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 500]);\ny = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 600]);\nz = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 700];\n\n// release them in reverse order; the older Synths are still there.\nz.free;\ny.free;\nx.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\"ReplaceOutHelp\", { |out = 0, freq = 440|\n var source;\n source = SinOsc.ar(freq, 0, 0.1);\n\n // write to the bus, replacing previous contents\n ReplaceOut.ar(out, source);\n\n}).add;\n);\n\n// each Synth replaces the output of the previous one\nx = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 500]);\ny = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 600]);\nz = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 700]);\n\n// release them in reverse order; the older Synths are still there.\nz.free;\ny.free;\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `FSinOsc`."}, {"role": "assistant", "content": "```supercollider\n{ FSinOsc.ar(800) * 0.2 }.play;\n\n{ FSinOsc.ar(XLine.kr(200, 4000, 1)) * 0.2 }.play;\n\n// loses amplitude towards the end\n{ FSinOsc.ar(FSinOsc.ar(XLine.kr(4, 401, 8), 0.0, 200, 800)) * 0.2 }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Ndef`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\nNdef(\\sound).play;\nNdef(\\sound).fadeTime = 1;\nNdef(\\sound, { SinOsc.ar([600, 635], 0, SinOsc.kr(2).max(0) * 0.2) });\nNdef(\\sound, { SinOsc.ar([600, 635] * 3, 0, SinOsc.kr(2 * 3).max(0) * 0.2) });\nNdef(\\sound, { SinOsc.ar([600, 635] * 2, 0, SinOsc.kr(2 * 3).max(0) * 0.2) });\nNdef(\\sound, Pbind(\\dur, 0.17, \\freq, Pfunc({ rrand(300, 700) })));\n\nNdef(\\lfo, { LFNoise1.kr(3, 400, 800) });\nNdef(\\sound).map(\\freq, Ndef(\\lfo));\nNdef(\\sound, { |freq| SinOsc.ar([600, 635] + freq, 0, SinOsc.kr(2 * 3).max(0) * 0.2) });\nNdef(\\lfo, { LFNoise1.kr(300, 400, 800) });\n\nNdef.clear; // clear all Ndefs\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `StandardN`."}, {"role": "assistant", "content": "```supercollider\n// vary frequency\n{ StandardN.ar(MouseX.kr(20, SampleRate.ir)) * 0.3 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `Psetp` in SuperCollider briefly."}, {"role": "assistant", "content": "Psetp — event pattern that sets values of one key Sets a value in an event stream until it ends, repeats this with new values until the value stream ends. Category: Streams-Patterns-Events > Patterns > Filter."}]} -{"conversations": [{"role": "user", "content": "Explain `SparseArray` in SuperCollider briefly."}, {"role": "assistant", "content": "SparseArray — Array that stores duplicated values more efficiently A sparse array is a data structure that acts in exactly the same manner as an Array. However, data is represented differently in memory, in a way that makes it much more efficient to store very large arrays in which many values are the same. Category: Collections > Ordered."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Beam me up scotty."}, {"role": "assistant", "content": "```supercollider\n{\nvar time = 8;\nvar freq = (40-12).midicps;\nvar a = VarSaw.ar(freq/2, width: XLine.ar(0.5,1,time)).range(0,XLine.ar(1,1/1000,time));\nvar tone = SinOsc.ar(freq).fold(-1*a,a);\nOut.ar(0, tone.dup);\n}.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SequenceableCollection.indexIn` do?"}, {"role": "assistant", "content": "Returns the closest index of the value in the collection (collection must be sorted). `[2, 3, 5,"}]} -{"conversations": [{"role": "user", "content": "Explain `EaseOutInBack` in SuperCollider briefly."}, {"role": "assistant", "content": "EaseOutInBack — Back ease-out/in Easing equation for a back (overshooting cubic easing: (a+1)*t^3 - a*t^2) ease-out/in, decelerating until halfway, then accelerating. The a parameter controls overshoot, the default producing a 10% overshoot. Category: Ease."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = PatternProxy(Pseq([1, 2, 3], inf));\n\nx = Pseq([0, 0, a], inf).asStream;\n\nt = Task({ loop({ x.next.postln; 0.3.wait }) }).play;\n\n\na.source = Pseq([55, 66, 77], inf);\na.source = Pseq([55, 66, 77], 1;\n\nt.stop;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = PatternProxy(Pseq([1, 2, 3], inf));\n\nx = Pseq([0, 0, a], inf).asStream;\n\nt = Task({ loop({ x.next.postln; 0.3.wait }) }).play;\n\n\na.source = Pseq([55, 66, 77], inf);\na.source = Pseq([55, 66, 77], 1);\n\nt.stop;\n```"}]} -{"conversations": [{"role": "user", "content": "What is the difference between Line and XLine?"}, {"role": "assistant", "content": "Both are ramps: `Line.kr(start, end, dur, mul, add, doneAction)` moves linearly, `XLine.kr(...)` moves exponentially in a fixed ratio per unit time. Use Line for amplitude and XLine for frequency or any parameter you hear logarithmically — a linear frequency sweep sounds like it rushes at the top and crawls at the bottom. Both take doneAction, so both can end a Synth."}]} -{"conversations": [{"role": "user", "content": "What does `SequenceableCollection.modSeaside` do?"}, {"role": "assistant", "content": "Pre-3.14 modulo with unexpected behavior for negative integer modulus; see Integer#-modSeaside. Calling `modSeaside` on a non-integer operand will fall back to `mod` behavior; see"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// what can it sound like? see: https://www.youtube.com/watch?v=dRmY3tEwZyE \n// the youtube version has been sent through an additional reverb pedal, but\n// you don't need the pedal to get something that sounds interesting\n\n(\ns.options.memSize_(16384*10);\ns.reboot;\ns.waitForBoot({\n \n Ndef(\\bits, {\n var t = PulseCount.ar(Impulse.ar(8e3));\n var u = PulseCount.ar(Impulse.ar(7009));\n var sig = HPF.ar(\n (\n ((t * 15) & (t >> 5)) |\n ((t * 5) & (t >> [3, 4])) |\n ((t * 2) & (t >> 9)) |\n ((t * 8) & (t >> 11)) |\n (((t*t) & t) | (t >> 3))\n - 3 % 256\n ) / 127-1 * 3\n , 20\n ) * 0.1;\n var sig2 = LPF.ar(HPF.ar(gcd(t*u, u+t), WhiteNoise.ar()*2000 + 1000), 20);\n sig2 = sig2*sig;\n sig = 0.3*Splay.ar(Limiter.ar(Greyhole.ar(sig + sig2, sig, 0.5, sig), 0.5).flatten);\n }).play;\n});\n)\n```"}, {"role": "assistant", "content": "a surprisingly rich soundscape in a few lines of code (lucky accident)."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Digital Bird sounds."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\birdy, {arg freq=1500, amp=0.5, rate=10;\n var osc, son, convIn, rand;\n osc=LFCub;\n rand = LFNoise1.ar(rate);\n convIn=LinCongN.ar(rate);\n son = osc.ar(Convolution.ar(convIn,convIn));\n freq = Latch.kr(rand.range(0,1).round(0.1), rand) * freq;\n freq = osc.ar(osc.ar(rand)*rand.range(0,10)).range(freq, freq*3);\n son = Formlet.ar(son, freq, convIn.abs*0.1, rand.abs);\n son = Normalizer.ar(son, 0.9, 0.1) * convIn.abs * LFPulse.kr(LFPulse.kr(rand.abs), 0, rand.abs);\n son = son + GVerb.ar(son, 99, 2, mul: rand.range(0,0.3));\n son * amp\n}).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Object.blend` do?"}, {"role": "assistant", "content": "Lineraly interpolate between this and argument `blend(10, 100,"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na= IBVA(\"/dev/tty.BlueVAS_H-Data\"); //or use an ibva instance from another example\n\nb= IBVAplayer(a);\nb.prepare(\"~/Desktop/ibvarectest\");\nb.play;\nb.stop;\n\nb.play(1, 2, {\"done\".postln}; //repeat twice at normal rate, post when finished\nb.stop;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na= IBVA(\"/dev/tty.BlueVAS_H-Data\"); //or use an ibva instance from another example\n\nb= IBVAplayer(a);\nb.prepare(\"~/Desktop/ibvarectest\");\nb.play;\nb.stop;\n\nb.play(1, 2, {\"done\".postln}); //repeat twice at normal rate, post when finished\nb.stop;\n```"}]} -{"conversations": [{"role": "user", "content": "How do I see what a signal is doing?"}, {"role": "assistant", "content": "`.poll` prints values to the post window — `SinOsc.kr(1).poll` prints once per control block, and `.poll(10)` limits it to every 10th. `s.scope` opens an oscilloscope on the main output, and `.scope` on a UGen shows just that signal. For a numeric snapshot of many signals at once, `s.meter` shows the output levels, and `\".dump\".postln` style probes are common while debugging."}]} -{"conversations": [{"role": "user", "content": "What does `MultiTrackAudioSpec.tracks` do?"}, {"role": "assistant", "content": "datatype specifying multiple 'audio' rate tracks"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for simple melody algorithmically generated with a Markov Chain."}, {"role": "assistant", "content": "```supercollider\n/* Markov Chain Experiment II\n Jacob Joaquin\n\n Get a visual representation of the Markov Chain here:\n http://codehop.com/supercollider-markov-chain/\n*/\n\n(\n// Synthesizer\nSynthDef(\\my_synth, {|dur = 1.0, amp = 1.0, freq = 440|\n var env = EnvGen.ar(Env.new([1, 0.1, 0], [0.06, dur - 0.06]), doneAction: 2);\n Out.ar([0, 1], SinOsc.ar([freq * 0.995, freq * 1.005], 0, env * amp))\n}).add; \n\n// Create task\nt = Task({\n // Set attributes of each node\n // [freq, dur, [[next_state, weighted_random],…]]\n var node_list = [\n [60, 1, [[1, 2]]],\n [62, 0.5, [[0, 1], [2, 1]]],\n [63, 1, [[0, 1], [3, 1]]],\n [65, 0.5, [[0, 1], [3, 4], [4, 1]]],\n [67, 1, [[5, 1]]],\n [70, 1.5, [[4, 1], [6, 2]]],\n [69, 1, [[4, 1], [7, 2]]],\n [72, 0.5, [[4, 1], [7, 4], [0, 2]]]\n ];\n\n var node_index = 0;\n var bps = 133.0 / 60.0; // Beats per second\n \n inf.do({\n var weight = 0;\n var random;\n var accumulator;\n var node = node_list[node_index]; \n var freq = node[0].midicps;\n var dur = node[1] / bps;\n var paths = node[2];\n \n // Get total statistical weight of connected nodes\n (0 .. paths.size - 1).do {|i| weight = weight + paths[i][1]};\n \n // Generate random value for choosing next node\n random = weight.rand;\n\n // Choose next node based on statistical weights\n accumulator = paths[0][1];\n \n node_index = block {|break|\n paths.size.do {|i|\n if ((random < accumulator), {\n break.value(paths[i][0])\n }, {\n accumulator = accumulator + paths[i + 1][1] \n })\n }\n };\n \n // Play\n Synth(\\my_synth, [\\dur, dur, \\amp, -3.dbamp, \\freq, freq]); \n dur.wait;\n })\n});\n\nt.start;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Main`?"}, {"role": "assistant", "content": "Main — The concrete instance of Process"}, {"role": "user", "content": "What does `Main.thisProcess` do?"}, {"role": "assistant", "content": "The singleton instance of Main is available through the special keyword thisProcess. For example, to find out what platform you're on: `thisProcess.platform; // --> e.g. \"an OSXPlatform\", \"a Linux`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nShutDown.add({ \"Good bye!!\".postln });\n```"}]} -{"conversations": [{"role": "user", "content": "My Synth runs but I hear nothing. How do I debug it?"}, {"role": "assistant", "content": "Check in this order, because each step eliminates a whole class of causes:\n\n1. **Is anything coming out of the bus you write to?** `Out.ar(0, sig)` for the master. A typo like\n `Out.ar(2, ...)` is silence.\n2. **Is the amplitude non-zero?** Multiply chain of `mul`/`add`, `amp`, and `env` all have to be positive;\n an envelope with `level: 0` or a gate that never opens is silent.\n3. **Did the Synth free itself immediately?** `doneAction: 2` on an EnvGen whose envelope is already\n finished at creation kills the node instantly. `s.plotTree` shows whether the node exists at all.\n4. **Is the envelope actually moving?** `env.poll` inside the SynthDef prints it per block.\n5. **Is the filter closed?** A `LPF.ar(sig, 50)` on a 440 Hz sine leaves almost nothing.\n\nThe fastest single tool is `s.plotTree`: if the Synth is not in the tree, the problem is lifecycle; if it\nis, the problem is signal."}]} -{"conversations": [{"role": "user", "content": "What does `Synth.grain` do?"}, {"role": "assistant", "content": "A convenience method which will create a synth node with an node ID of -1. Such a node cannot be messaged after creation. As such this method does not create an object, and returns nil. For details of its arguments see `new` Returns: nil"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var a, freq, trig;\n a = Dseries(0, 1, 15);\n trig = Impulse.kr(MouseX.kr(1, 40, 1));\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n);\n\n(\n{\n var a, freq, trig;\n a = Dseries(0, 1, inf);\n trig = Dust.kr(MouseX.kr(1, 40, 1));\n freq = Demand.kr(trig, 0, a) % 15 * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var a, freq, trig;\n a = Dseries(0, 1, 15);\n trig = Impulse.kr(MouseX.kr(1, 40, 1));\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n);\n\n(\n{\n var a, freq, trig;\n a = Dseries(0, 1, inf);\n trig = Dust.kr(MouseX.kr(1, 40, 1));\n freq = Demand.kr(trig, 0, a) % 15 * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Gates (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\plop).put(0, { arg freq=200, rq=0.1, pan=0, amp=0.1;\n var sig;\n var sig1, sig2, sig3, sig4, sig5, sig6, sig7, sig8;\n sig1 = WhiteNoise.ar(1, 0);\n sig2 = LPF.ar(WhiteNoise.ar(1, 0), SinOsc.kr(1/16 * [1,2,3,4]/2).range(100,9001));\n sig3 = LFSaw.ar(( freq* [1/2,1,2,1] ).clip(20,15000)) * [1,4,1/2,2];\n sig1 = SelectX.ar(\\mixg.kr(0.5)*2, [sig1, sig2, sig3]);\n sig = Gate.ar(sig1, LFPulse.ar( SinOsc.kr(1/8 * [1,2,3,4].reverse/2).range(30,100), 0.5));\n sig = Gate.ar(sig, LFPulse.ar( freq ));\n sig = RLPF.ar(sig, ( freq * SinOsc.kr([1,2,3,4]/4).range(1,4) ).clip(20,15000), rq * [1,2,3,4]);\n sig1 = LFPulse.ar(freq * [1,1/2]) * [1,1/2];\n sig = SelectX.ar(\\mix.kr(0.8)*2, [sig, sig1 * sig, sig1]);\n sig1 = BPF.ar(sig, ( freq*2 ).clip(20,15000), rq) * 5;\n sig2 = BPF.ar(sig, freq, rq) * 5;\n sig3 = BPF.ar(sig, freq/2, rq) * 5;\n sig = SelectX.ar(\\mix2.kr(0.6) * 3, [sig, sig1, sig2, sig3]);\n sig = Pan2.ar(sig, LFNoise1.kr(1/2 * [1,2,3,4]).range(-1.0,1.0) * 0.3, amp).mean;\n}).play;\n\nSpec.add(\\mix, \\unipolar);\nSpec.add(\\mix2, \\unipolar);\nSpec.add(\\mixg, \\unipolar);\n);\n\nNdef(\\plop).edit;\n\nNdef(\\plop).unset(\\freq);\n\n(\n Ndef(\\plop).put(1, \\set -> Pbind(\n \\degree, Pseq([\n 0,3,2,3,\n 4,2,2,3,\n ],inf),\n \\octave, 4,\n \\dur, Pseq([1,2,4,1],inf)/4,\n )\n);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\ns.boot;\n\n(\nSynthDef(\"lazerdrone\", {\n var in, freq, hasFreq;\n\n \n in = SinOsc.ar(440 * LFSaw.kr(100, 1000));\n\n # freq, hasFreq = Pitch.kr(\n in,\n ampThreshold: 0.09,\n median: 1);\n freq = freq * hasFreq;\n //freq.poll;\n \n SinOsc.kr(freq).poll;\n \n Out.ar(0, in + \n SinOsc.ar(440, \n 0, \n Clip.kr(\n SinOsc.kr(freq), \n 0)\n )\n );\n}).play;\n)\n```"}, {"role": "assistant", "content": "A lazer sound then a drone with morse-code like bleeps. A byproduct of testing the triggering algorithm in the mono2eN SynthDef."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\na = RecNodeProxy.audio(s, 2);\nb = a.index; // get the bus index;\na.play; // monitor;\na.open(\"xproxySpace.aif\");\na.record;\na.unpause;\n\n(\nRoutine({\n var id;\n loop({\n id = s.nextNodeID;\n s.sendMsg(\"/s_new\", \"default\", id, 0, 0, \\out, b, \\freq, rrand(400, 800));\n 0.2.wait;\n s.sendMsg(\"/n_set\", id, \\gate, 0);\n 0.2.wait;\n })\n}).play;\n;\n\n\n// stop recording and close file\na.close;\n\n// monitor off\na\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\na = RecNodeProxy.audio(s, 2);\nb = a.index; // get the bus index;\na.play; // monitor;\na.open(\"xproxySpace.aif\");\na.record;\na.unpause;\n\n(\nRoutine({\n var id;\n loop({\n id = s.nextNodeID;\n s.sendMsg(\"/s_new\", \"default\", id, 0, 0, \\out, b, \\freq, rrand(400, 800));\n 0.2.wait;\n s.sendMsg(\"/n_set\", id, \\gate, 0);\n 0.2.wait;\n })\n}).play;\n);\n\n\n// stop recording and close file\na.close;\n\n// monitor off\na.stop;\n```"}]} -{"conversations": [{"role": "user", "content": "My pattern keeps playing after I press Ctrl+."}, {"role": "assistant", "content": "Ctrl+. (CmdPeriod) stops everything scheduled on the clocks, including Patterns. If yours survives, it is not scheduled on a clock — most often it is a `Synth` created directly, or a `Task`/`Routine` started on `SystemClock` in a way that outlived the period. Do you still see the node in `s.plotTree`?"}, {"role": "user", "content": "Yes, there's a synth."}, {"role": "assistant", "content": "Then the sound is a node, not a pattern: `s.freeAll` will stop it. The likely cause is a SynthDef whose EnvGen has no `doneAction`, or a drone with `gate = 1` that nothing releases. Add `doneAction: 2` to the envelope, or keep a reference and `x.set(\\gate, 0)` when you want it to end."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes beats to bar printing."}, {"role": "assistant", "content": "```supercollider\n(\nf = ();\nf.beatAndBar = {\n var t = currentEnvironment.clock; // t= TempoClock.new;\n var text = \"xB: \";\n\n var nBeatsPerBar = { arg n, beats, clock;\n var nBpb = clock.beatsPerBar * n;\n \"\" ++ n ++ text ++ (nBpb - (beats%(nBpb))).asInteger\n };\n\n t.play({arg beats, time, clock;\n ( //[\"beat: \" ++ (t.beatInBar + 1).asInteger] ++ //uncomment for beat in bar\n [1,2,4,8,16,32].collect( {|n,i| nBeatsPerBar.value(n, beats, clock)})\n ).postln;\n 1});\n \"beatAntBar\";\n}\n);\n\nf[\\beatAndBar].value;\n\n(\nf[\\beatAndBar].value;\nCmdPeriod.add(f[\\beatAndBar]);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `PopUpMenu.background` do? What arguments does it take?"}, {"role": "assistant", "content": "Setting this variable colors the area of the view under the text with the given Arguments: A Color.."}]} -{"conversations": [{"role": "user", "content": "Explain `PLbindefPar` in SuperCollider briefly."}, {"role": "assistant", "content": "PLbindefPar — container for parallel PLbindefs which allows replacement in object prototyping style PLbindefPar employs a number of parallel PLbindefs, replacement of key streams can be done in object prototyping style with a dedicated PLbindefParEnvironment, which also holds player methods. This hybrid Environment is itself assigned to the PLbindefPar's name in an Environment of choice, by default the current Environment. Setting can thus be done in very condensed syntax, also in combination wi Category: Libraries > miSCellaneous > PLx suite, Streams-Patterns-Events > PLx suite."}]} -{"conversations": [{"role": "user", "content": "Build a slowly evolving drone with Ndef."}, {"role": "assistant", "content": "Ndef gives you a named patch you can redefine while it plays; the filter is a separate node in the\nchain so you can change it on its own.\n\n```supercollider\n(\nNdef(\\drone, { |freq = 55, amp = 0.12|\n var detune = [0, 0.07, -0.11];\n var sig = Mix(Saw.ar(freq * (1 + detune))) * amp;\n LPF.ar(sig, 400);\n}).play;\n\nNdef(\\drone)[1] = \\filter -> { |in| RLPF.ar(in, LFNoise1.kr(0.1).exprange(200, 1800), 0.3) };\n)\n```\n\nRedefining Ndef(\\drone, { ... }) later crossfades to the new definition; Ndef(\\drone).stop stops it."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for We all could use a little more?"}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\cowbell, {\n | out=0, amp=0.3, gate=1, fund_freq=540, pan=0.0 |\n var sig, env;\n\n sig = Pulse.ar( fund_freq * [ 1, 1.5085 ], [ 0.565, 0.445 ], [ 0.4, 0.6 ] ).distort;\n env = EnvGen.ar(\n Env(\n [ 0, 0.05, 1, 0.1, 0 ], [ 0.003, 0.002, 0.05, 0.5 ], [2, -4, -4, -4]\n ),\n gate: gate,\n timeScale: [ 1.0, 1.5 ],\n doneAction: 2\n );\n sig = Mix( sig * env );\n sig = BPF.ar( sig, fund_freq * 2, 1.808 );\n\n Out.ar( out, Pan2.ar( sig, pan, amp ) );\n}).add;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n{ BlitB3Square.ar(XLine.kr(1000, 20, 10)) }.play;\n\n{ BlitB3Square.ar(MouseX.kr(20,1000,'exponential'),MouseY.kr(0.001,0.999)) }.play;\n\n//comparison\n//blit version is cheaper, but aliases once pushed over 4000 or so at 44100 SR\n{ Pulse.ar(4000, 0.5) }.play;\n{ BlitB3Square.ar(4000) }.play;\n\n\n//spot the difference in CPU usage\n{ Mix.fill(100, {Pan2.ar(0.1*BlitB3Square.ar( ((LFNoise0.kr(rrand(2,3))).range(0,36)+36).midic\n// …\n```"}, {"role": "assistant", "content": "blit version is cheaper, but aliases once pushed over 4000 or so at 44100 SR spot the difference in CPU usage (BlitB3Square: Bipolar BLIT derived square waveform)"}]} +{"conversations": [{"role": "user", "content": "What does `BAllPass.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "All Pass Filter Arguments: in — input signal to be processed.; freq — center frequency. WARNING: due to the nature of its implementation frequency values close to 0 may cause glitches and/or extremely loud audio artifacts!; rq — the reciprocal of Q. bandwidth / cutoffFreq.; mul; add."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\\pm, { |out = 0, freq = 440, amp = 0.1, pan = 0, gate = 1, ratio = 1, index = 1, ar = 0.1, dr = 0.1|\n var z;\n z = LPF.ar(\n PMOsc.ar(freq, freq * ratio, Linen.kr(gate, ar, index, dr), 0, 0.3),\n XLine.kr(Rand(4000, 5000), Rand(2500, 3200), 1)\n ) * Linen.kr(gate, 0.01, 0.7, dr, 2);\n OffsetOut.ar(out, Pan2.ar(z, pan, amp));\n}).add;\n);\n\n(instrument: \\pm).play;\n\n(instrument: \\pm, ratio: 3.4\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\\pm, { |out = 0, freq = 440, amp = 0.1, pan = 0, gate = 1, ratio = 1, index = 1, ar = 0.1, dr = 0.1|\n var z;\n z = LPF.ar(\n PMOsc.ar(freq, freq * ratio, Linen.kr(gate, ar, index, dr), 0, 0.3),\n XLine.kr(Rand(4000, 5000), Rand(2500, 3200), 1)\n ) * Linen.kr(gate, 0.01, 0.7, dr, 2);\n OffsetOut.ar(out, Pan2.ar(z, pan, amp));\n}).add;\n);\n\n(instrument: \\pm).play;\n\n(instrument: \\pm, ratio: 3.42, index: 12, freq: 150, ar: 8, dr: 3, sustain: 10).play;\n```"}]} {"conversations": [{"role": "user", "content": "What does `PLswitch.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new PLswitch Arguments: list — Symbol or Pswitch list arg. If a Symbol is passed, list can be assigned to an envir variable later on. This lists's elements can be dynamically replaced by Patterns or Streams.; which — Symbol or Pswitch which arg. If a Symbol is passed, repeats can be assigned to an envir variable later on. Can be dynamically replaced by Patterns or Streams. Defaults to 0.; cutItems — Symbol or Boolean or Integer (0 or 1) or a Function returning Boolean or Integer. If a Symbol is passed, cutItems can be assigned to an envir variable later on. Determines if list items, which are Patterns or Streams themselves, will be finished if a replacement occurs during their embedding, or if ; envir — Dictionary or one of the Symbols \\top, \\t (topEnvironment), \\current, \\c (currentEnvironment). Dictionary to be taken for variable reference. Defaults to \\current.."}]} -{"conversations": [{"role": "user", "content": "Buffer.read fails and I get a path error. What should the path look like?"}, {"role": "assistant", "content": "On Windows use forward slashes or escaped backslashes inside the string: `Buffer.read(s, \"C:/sounds/kick.wav\")`. A single backslash starts an escape sequence, which is why `\"C:\\sounds\\kick.wav\"` fails. Also check the extension is real (`.wav`, `.aiff`, `.flac`) and that the file is not on a network path — the server reads it, not the language, and it may resolve differently. For sounds that ship with SuperCollider, `Platform.resourceDir +/+ \"sounds/a11wlk01.wav\"` is the portable form."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\n(\nSynthDef(\"help-SendTrig\", {\n SendTrig.kr(Dust.kr(1.0), 0, 0.9);\n}).add;\n\n// register to receive this message\no = OSCFunc({ |msg, time|\n [time, msg].postln;\n}, '/tr', s.addr);\n);\n\nSynth(\"help-SendTrig\";\n\no.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\n(\nSynthDef(\"help-SendTrig\", {\n SendTrig.kr(Dust.kr(1.0), 0, 0.9);\n}).add;\n\n// register to receive this message\no = OSCFunc({ |msg, time|\n [time, msg].postln;\n}, '/tr', s.addr);\n);\n\nSynth(\"help-SendTrig\");\n\no.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What is `NumRunningSynths` in SuperCollider?"}, {"role": "assistant", "content": "NumRunningSynths — Number of currently running synths. Category: UGens > Info."}]} -{"conversations": [{"role": "user", "content": "What does `HasPatchIns.inputProxies` do?"}, {"role": "assistant", "content": "parent class for Players that have PatchIns such as Patch"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n// use input amplitude to control SinOsc frequency - use headphones to prevent feedback.\n{\n SinOsc.ar(\n Amplitude.kr(\n SoundIn.ar(0),\n 0.01,\n 0.01,\n 1200,\n 400\n ),\n 0, 0.3)\n}.play;\n)\n```"}, {"role": "assistant", "content": "use input amplitude to control SinOsc frequency - use headphones to prevent feedback. (Amplitude: Amplitude follower)"}]} -{"conversations": [{"role": "user", "content": "Explain `LazyList` in SuperCollider briefly."}, {"role": "assistant", "content": "LazyList — Implementation of lazy list or stream Allows for implementation of infinite lists. Category: FP."}]} -{"conversations": [{"role": "user", "content": "What does `TraerParticleSystem.makeParticle` do?"}, {"role": "assistant", "content": "Create a new particle in the system with some mass and at some x, y, z position. The default is a new particle with mass CODE1.0 at CODE(0, 0,"}]} -{"conversations": [{"role": "user", "content": "What does `Group.deepFree` do?"}, {"role": "assistant", "content": "Free all Synths in the group, and all Synths in any enclosed groups, but do not free this group or any of its enclosed"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ BlitB3Tri.ar(XLine.kr(1000, 20, 10)) }.play;\n\n//unfortunately, aliasing returns at higher frequencies (over 5000Hz or so) with a vengence\n{ BlitB3Tri.ar(MouseX.kr(20,8000,'exponential').poll,0.99,MouseY.kr(0.001,0.99)) }.play;\n\n//more efficient, some aliasing from 3000, but not so scary over 5000. Duller sound (less high harmonics included for lower fundamentals)\n{ LFTri.ar(MouseX.kr(20,8000,'exponential').poll) }.play;\n\n\n//comparison\n//LFTri version cheaper, and less aliasing! \nx = { LFTri.ar(\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ BlitB3Tri.ar(XLine.kr(1000, 20, 10)) }.play;\n\n//unfortunately, aliasing returns at higher frequencies (over 5000Hz or so) with a vengence\n{ BlitB3Tri.ar(MouseX.kr(20,8000,'exponential').poll,0.99,MouseY.kr(0.001,0.99)) }.play;\n\n//more efficient, some aliasing from 3000, but not so scary over 5000. Duller sound (less high harmonics included for lower fundamentals)\n{ LFTri.ar(MouseX.kr(20,8000,'exponential').poll) }.play;\n\n\n//comparison\n//LFTri version cheaper, and less aliasing! \nx = { LFTri.ar(4000) }.play;\nx = { BlitB3Tri.ar(4000) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SGliss.addVoices` do? What arguments does it take?"}, {"role": "assistant", "content": "create new voices up to a maximum of CODEmaxNumVoices (set in LINK#*new). internally controllers for frequencies, amplitudes and panning are automatically Arguments: num — the number of voices to be added.; type — a LINKClasses/Symbol describing the type of sound to add. For example CODE\\Pink.; args — extra arguments as an LINKClasses/Array with key/value pairs.."}]} -{"conversations": [{"role": "user", "content": "What does `ScalarPatchOut.control` do? What arguments does it take?"}, {"role": "assistant", "content": "\\scalar rate PatchOut Arguments: controlPatchIn; needsValueSetNow."}]} -{"conversations": [{"role": "user", "content": "What does `ListView.action` do?"}, {"role": "assistant", "content": "The action object evaluated whenever the user changes the current item, i.e. when #-value changes as a result of GUI"}]} -{"conversations": [{"role": "user", "content": "What does `SequenceableCollection.instill` do? What arguments does it take?"}, {"role": "assistant", "content": "Put an element at a given index (like SequenceableCollection#-put). This method is also implemented in Object, so that you can use it in situations where you don't want to know if the receiver is a collection or not. It will always return a new collection. See also: Arguments: index — The index at which to put the item; item — The object to put into the new collection; default — If the index exceeds the current collection's size, extend the collection with this element `(`."}]} -{"conversations": [{"role": "user", "content": "What is `Process` in SuperCollider?"}, {"role": "assistant", "content": "Process — Runtime environment for the virtual machine and interpreter. A Process is the runtime environment for the virtual machine and interpreter. It has a subclass named Main which is where you should override the methods of Process. There are two methods of interest. One is named `startup` and is called after the class library has been compiled. The other is named `run` and is called when the user chooses the Run menu command. Category: Core > Kernel."}]} -{"conversations": [{"role": "user", "content": "Explain `SClusterAmplitudes` in SuperCollider briefly."}, {"role": "assistant", "content": "SClusterAmplitudes — control SCluster amplitudes Amplitude control for LINKClasses/SCluster. Category: SInstruments."}]} -{"conversations": [{"role": "user", "content": "What does Lag do?"}, {"role": "assistant", "content": "`Lag.ar(in, lagTime)` and `Lag.kr(in, lagTime)` smooth a signal with an exponential lag towards its target, which removes the clicks and zipper noise a stepped control would produce. Lag.kr on a mouse or MIDI input is the standard way to make a parameter feel analogue: `Lag.kr(MouseX.kr(200, 4000), 0.2)`. Lag2 and Lag3 are the second- and third-order versions, smoother and slower."}]} -{"conversations": [{"role": "user", "content": "How do I add a reverb send to a whole group?"}, {"role": "assistant", "content": "Same shape as the delay: a private stereo bus, one effect reading it, instruments writing both dry\nand wet.\n\n```supercollider\n(\n~verbBus = Bus.audio(s, 2);\nSynthDef(\\verb, { |in = 0, out = 0, room = 0.85, mix = 0.5|\n Out.ar(out, FreeVerb.ar(In.ar(in, 2), mix, room, 0.5) * 0.7);\n}).add;\nSynthDef(\\blip, { |out = 0, send = 0, freq = 440, amp = 0.1|\n var env = EnvGen.kr(Env.perc(0.002, 0.4), doneAction: 2);\n var sig = SinOsc.ar(freq) * env * amp;\n Out.ar(out, sig);\n Out.ar(send, sig);\n}).add;\n);\nSynth(\\verb, [\\in, ~verbBus]);\nPbind(\\instrument, \\blip, \\send, ~verbBus, \\degree, Pseq([0, 4, 7, 11], inf), \\dur, 0.25).play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `RedTime.asSeconds` do?"}, {"role": "assistant", "content": "Calculates the number of seconds using Returns: A SimpleNumber."}]} -{"conversations": [{"role": "user", "content": "What does `HasPatchIns.mapInputToBus` do? What arguments does it take?"}, {"role": "assistant", "content": "parent class for Players that have PatchIns such as Patch Arguments: i; bus."}]} -{"conversations": [{"role": "user", "content": "What does `MIDIMKtlDevice.send` do? What arguments does it take?"}, {"role": "assistant", "content": "Send the value of the element to the MIDI device; called if you set the value of an MKtlElement that is an Arguments: key — The key of the element.; val — The value to which it is set.."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes nothing much )."}, {"role": "assistant", "content": "```supercollider\n(\n{|atk=0.05,dur=10,freq=50,amp=0.8|\n PMOsc.ar(\n Line.kr(1,2,dur,freq),\n LFNoise2.kr([1,2]).range(1,2)*freq,\n LFNoise2.kr([2,1]).range(0.1,3.5),\n 0,\n Decay2.ar(\n Impulse.ar(XLine.kr(1, 25, dur)) * SinOsc.ar(4/dur,[0,pi/2],0.05,1),\n 0.023, XLine.ar(1,35,dur).reciprocal,\n Line.ar(1,0.8,dur) * LFNoise2.kr(4/dur,0.05,1).dup\n ) * EnvGen.ar(Env([0,1,1,0],[atk,dur-atk,0.3]),1,amp, doneAction:2)\n )\n // * LFPulse.ar(XLine.kr(5,20,dur,freq * LFNoise2.kr([1,2]).range(0.95,1.05)))\n}.play(args:[\n freq:50.rrand(350).debug('freq'),\n dur:10.rrand(20).debug('dur')\n])\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Plane` in SuperCollider?"}, {"role": "assistant", "content": "Plane — Keeps track of Planes Main Plane class. Keeps track of Planes Category: Libraries > Radicles."}]} -{"conversations": [{"role": "user", "content": "What does `SGUIelement.asView` do?"}, {"role": "assistant", "content": "layout support. only latest (last) view is returned. makes adding views to layouts"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// dalek mating season I\n(\n f = StreamKrDur(\n Prand(Array.fill(rrand(4,16),{ rrand(20,80).midicps }),inf),\n 0.125,// a float\n 0.05);\n\n Tempo.bpm = 100; // times are in beats\n\n Patch({ arg freq;\n Saw.ar(freq,0.2)\n },[\n f\n ]).play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// dalek mating season I\n(\n f = StreamKrDur(\n Prand(Array.fill(rrand(4,16),{ rrand(20,80).midicps }),inf),\n 0.125,// a float\n 0.05);\n\n Tempo.bpm = 100; // times are in beats\n\n Patch({ arg freq;\n Saw.ar(freq,0.2)\n },[\n f\n ]).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SerialPort.next` do?"}, {"role": "assistant", "content": "Read a byte from the device. Non-blocking"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Abusing Convolution2 to make pitch."}, {"role": "assistant", "content": "```supercollider\n// fixed (unchanging) impulse response\n// cmd-. to stop\n\n(\ns.waitForBoot {\n var c = Condition.new, cleanfunc = { CmdPeriod.remove(cleanfunc); b.free };\n fork {\n b = Buffer.alloc(s, 2048, 1);\n CmdPeriod.add(cleanfunc);\n s.sync;\n a = {\n RecordBuf.ar(BrownNoise.ar * EnvGen.ar(Env(#[0, 1, 0], #[0.5, 0.5], \\sin), timeScale: b.duration, doneAction: 2), b, loop: 0);\n 0\n }.play;\n OSCpathResponder(s.addr, ['/n_end', a.nodeID], { |time, resp, msg|\n resp.remove;\n c.unhang;\n }).add;\n c.hang;\n a = {\n var freq = MouseX.kr(150, 450, warp: 1, lag: 0.1);\n LeakDC.ar(Convolution2.ar(Impulse.ar(freq), b, framesize: b.numFrames) * -35.dbamp) ! 2;\n }.play;\n };\n};\n);\n\n\n\n// multiple impulse responses for timbre control\n(\ns.waitForBoot {\n var c = Condition.new, cleanfunc = { CmdPeriod.remove(cleanfunc); b.free };\n fork {\n b = Buffer.allocConsecutive(3, s, 2048, 1);\n CmdPeriod.add(cleanfunc);\n s.sync;\n a = {\n var sig = [BrownNoise.ar, PinkNoise.ar, WhiteNoise.ar];\n sig.do { |chan, i|\n RecordBuf.ar(chan * EnvGen.ar(Env(#[0, 1, 0], #[0.5, 0.5], \\sin), timeScale: b[i].duration, doneAction: 2), b[i], loop: 0);\n 0\n };\n }.play;\n OSCpathResponder(s.addr, ['/n_end', a.nodeID], { |time, resp, msg|\n resp.remove;\n c.unhang;\n }).add;\n c.hang;\n a = {\n var freq = MouseX.kr(150, 450, warp: 1, lag: 0.1),\n index = MouseY.kr(0, 1.99, lag: 0.1),\n iWhole = index.trunc(2),\n iFrac = index - iWhole,\n iAdjust = iFrac >= 1.0,\n trig = Impulse.ar(freq),\n convolvers = b.collect { |buf, i|\n LeakDC.ar(Convolution2.ar(trig, buf, framesize: buf.numFrames))\n };\n (\n XFade2.ar(\n Select.ar(iWhole + (2 * iAdjust), convolvers),\n Select.ar(iWhole + 1, convolvers),\n iFrac.fold(0, 1) * 2 - 1\n ) * -30.dbamp\n ) ! 2;\n }.play;\n };\n};\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Electronic Waves in the beach."}, {"role": "assistant", "content": "```supercollider\n// 2012.05.10\n// Work for NX013 Class\n// Comment: Ocean of Bass.\n\np = ProxySpace.push(s.boot);\n\n~a.play;\n\n~a = { var array;\n array = Array.series(rrand(1,1000),rrand(1,1000),rrand(1,30));\n array = array ++ array.reverse;\n Pan2.ar(LeakDC.ar(Normalizer.ar(\n BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(FreeVerb.ar(\n BPF.ar(\n LPF.ar(FreeVerb.ar(WhiteNoise.ar(),\n rrand(0.5,1.0),rrand(0.5,1.0),rrand(0.5,1.0))\n ,Demand.kr(Impulse.kr(rrand(5,20)),0,Dseq(array,inf)))\n ,rrand(100,5000),rrand(0.1,1.0))\n ,0.1,0.1,0.1)\n ,100,6.0,6),1000,6.0,0),5000,6.0,0),10000,6.0,6)\n ,(1.33/0.999)*1.0,0.1)),0)\n};\n\n~a = nil;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// allocate buffer\nb = Buffer.alloc(s, 44100, 1);\n\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nBufDelayC.ar(b.bufnum, z, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\nb.free;\n\n\n// multichannel\n\n// two channels, two buffers\nb = Buffer.allocConsecutive(2, s, 32768, 1);\n\na = { |bufs = #[0, 1]|\n var sig = SinOsc.ar([440, 880\n// …\n```"}, {"role": "assistant", "content": "Dust randomly triggers Decay to create an exponential decay envelope for the WhiteNoise input source (BufDelayC: Buffer based simple delay line with cubic interpolation.)"}]} -{"conversations": [{"role": "user", "content": "What does `POneZero.new` do? What arguments does it take?"}, {"role": "assistant", "content": "UGenPatterns quark library Arguments: pattern; coef; mul; add."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n var freqs = [200, 600, 400, 450, 150, 20, 800];\n var amps = Saw.ar(freq: [2,3, 5]).range(1, 0.5, 0.3, 0.8);\n var snd = LFTri.ar(freq: freqs, mul: amps);\n Mix.ar(snd)\n}.play;\n)\n```"}, {"role": "assistant", "content": "LFTri that plays in a single channel with frequent amplitude shifts."}]} -{"conversations": [{"role": "user", "content": "What is `Harmonics`?"}, {"role": "assistant", "content": "Harmonics — Convenient factory for filling buffers with harmonics on the server"}, {"role": "user", "content": "What does `Harmonics.new` do?"}, {"role": "assistant", "content": "Create a new Harmonics array of size. Nothing is filled in for you, until instance methods are applied. `a = Harmonics.new(16); // just returns an instance of Harmon`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na.ramp(1.0, 1.0); // returns a harmonic series\n\nb = Buffer.alloc(s, 512, 1);\n// harmonic series for freqs, ramp down for amps\nb.sine2(a.ramp(1.0, 1.0).postln, a.ramp(0.5, -0.025).postln, true, true, true);\n(\nz = SynthDef(\"help-Osc\", { |out = 0, bufnum = 0|\n Out.ar(out,\n Osc.ar(bufnum, 200, 0, 0.5)\n )\n});\n);\ny = z.play(s, [\\out, 0, \\bufnum, b]);\ny.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for batuhan's buzzer parametrized."}, {"role": "assistant", "content": "```supercollider\n// A beautiful sc140 tweet by Batuhan Bozkurt, parametrized for real-time changes\n(\n// Start sound here\na = { | rateL = 5, rateR = 6, blipMul = 100, blipAdd = 50, fMul = 50, kMul = 1 |\n f = LocalIn.ar(2).tanh;\n k = Latch.kr(f[0].abs,Impulse.kr(1/4)) * kMul;\n LocalOut.ar(\n f +\n CombC.ar(Blip.ar([rateL, rateR], blipMul * k + blipAdd, 0.9), 1, k*0.3, fMul * f));f\n}.play\n);\n\n// Set parameters for changing sound here: \n\na.set(\\rateL, 10);\n\na.set(\\rateR, 8);\n\na.set(\\blipMul, 25);\n\na.set(\\blipAdd, 70);\n\na.set(\\fMul, 30);\n\n\na.set(\\kMul, 0.01);\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var sig, chain;\n sig = WhiteNoise.ar(0.2);\n chain = FFT(LocalBuf(2048), sig);\n chain = PV_RectComb(chain, 8, LFTri.kr(0.097, 0, 0.4, 0.5),\n LFTri.kr(0.24, 0, -0.5, 0.5));\n IFFT(chain).dup\n}.play;\n);\n\n(\n{\n var sig, chain;\n sig = WhiteNoise.ar(0.2);\n chain = FFT(LocalBuf(2048), sig);\n chain = PV_RectComb(chain, MouseX.kr(0, 32), MouseY.kr, 0.2);\n IFFT(chain).dup\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var sig, chain;\n sig = WhiteNoise.ar(0.2);\n chain = FFT(LocalBuf(2048), sig);\n chain = PV_RectComb(chain, 8, LFTri.kr(0.097, 0, 0.4, 0.5),\n LFTri.kr(0.24, 0, -0.5, 0.5));\n IFFT(chain).dup\n}.play;\n);\n\n(\n{\n var sig, chain;\n sig = WhiteNoise.ar(0.2);\n chain = FFT(LocalBuf(2048), sig);\n chain = PV_RectComb(chain, MouseX.kr(0, 32), MouseY.kr, 0.2);\n IFFT(chain).dup\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Dictionary`."}, {"role": "assistant", "content": "```supercollider\na = (note: 2);\nb = (note: [3, 5]);\nPseq([a, b]).play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LinPan2`."}, {"role": "assistant", "content": "```supercollider\n// hear the difference, LinPan having a slight drop in the middle (yeah, it's subtle)...\n{ LinPan2.ar(SinOsc.ar(440), Line.kr(-1, 1, 5)) }.play;\n\n// ... whereas Pan2 is more smooth\n{ Pan2.ar(SinOsc.ar(440), Line.kr(-1, 1, 5)) }.play;\n\n// other examples\n{ LinPan2.ar(PinkNoise.ar(0.4), FSinOsc.kr(2)) }.play;\n\n{ LinPan2.ar(FSinOsc.ar(800, 0, 0.1), FSinOsc.kr(3)) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Window.drawFunc` do? What arguments does it take?"}, {"role": "assistant", "content": "Just like the UserView, the window can be given a Function to evaluate whenever it is asked to redraw itself, so you can use the Pen class to draw on the window. See UserView#-drawFunc for Arguments: A Function.."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// you have to write the sample path in the firts line\n\n~bufferdue = Buffer.read(s,\" WRITE YOUR SAMPLE PATH HERE \", bufnum:2);\n\n(\nSynthDef.new(\\bufbeat, {\n arg amp = 1, out = 0, buf, start, end, freq = 1;\n var sig, ptr;\n ptr = LFNoise1.ar(freq).range(0.0,end);\n sig = BufRd.ar(2, buf, ptr);\n sig = sig * amp;\n Out.ar(out, sig);\n}).add\n);\n\nx = Synth.new(\\bufbeat, [\\buf, ~bufferdue.bufnum, \\start,0, \\end, ~bufferdue.numFrames-1, \\freq, 1, \\amp, 0.5],g);\n\nx.free;\n```"}, {"role": "assistant", "content": "a simple BufRd with the starting point of lecture randomized by LFNoise1."}]} -{"conversations": [{"role": "user", "content": "What is `FoaThetaPhiR` in SuperCollider?"}, {"role": "assistant", "content": "FoaThetaPhiR — First Order Ambisonic (FOA) Azimuth & Elevation of Soundfield Reactive Intensity Vector Return the Azimuth & Elevation of Reactive Intensity Vector of a first order ambisonic (B-format) signal. Category: Libraries > Ambisonic Toolkit > UGens > FOA > Analyzer, UGens > Multichannel > Ambisonics, UGens > Analysis > Ambisonics."}]} -{"conversations": [{"role": "user", "content": "GrainBuf complains about too many grains."}, {"role": "assistant", "content": "The number of simultaneous grains is `density × dur` in seconds, and it exceeds maxGrains (512 by default). Either lower the trigger rate, shorten the grains, or raise the limit: `GrainBuf.ar(2, trig, dur, buf, 1, pos, 2, 0, -1, 1024)` — the 1024 is maxGrains. Raising it costs server CPU per grain, so prefer halving the density if the sound does not need it."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SendTrig`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n(\nSynthDef(\"help-SendTrig\", {\n SendTrig.kr(Dust.kr(1.0), 0, 0.9);\n}).add;\n\n// register to receive this message\no = OSCFunc({ |msg, time|\n [time, msg].postln;\n}, '/tr', s.addr);\n);\n\nSynth(\"help-SendTrig\");\n\no.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\ns.boot;\n(\n{\n SinOsc.ar([225, 450, 900], 0, 0.2)\n + LPF.ar(\n LFPulse.ar(226 * [1, 2, 5], [0, 0.1, 0.1], 0.2, 0.2),\n MouseX.kr(20, 10000, 1)\n )\n}.scope;\n);\n\n// server.scope only changes the properies explicitly given:\n\ns.scope(numChannels: 5);\ns.scope(index: 12);\ns.scope(zoom: 4);\ns.scope(index: 0);\n\ns.scopeWindow.size = 600;\ns.scopeWindow.size = 222;\n\n// scoping buses:\n\na = Bus.audio(s, 4);\n{\n// …\n```"}, {"role": "assistant", "content": "server.scope only changes the properies explicitly given: note that scoping control rate buses shows block size interpolation (this is due to the (Stethoscope: An oscilloscope)"}]} -{"conversations": [{"role": "user", "content": "What does `EZRanger.new` do? What arguments does it take?"}, {"role": "assistant", "content": "A wrapper class for a label, a rangeslider, and numberboxes Arguments: parent — The parent view or window. If the parent is nil, then EZRanger will create its own Window, and place it conveniently on the screen if the bounds are a Point. If the bounds are a Rect, then the Rect determines the window bounds.; bounds — An instance of Rect or Point. Default value is `160@20`.; label — The label. Default value is `nil`. If `nil`, then no StaticText is created.; controlSpec — The ControlSpec for scaling the value.; action — A Function called when the value changes. The function is passed the EZRanger instance as its argument.; initVal — An instance of Array `[lo, hi]`. If `nil`, then it uses the ControlSpec's default value.; initAction — A Boolean indicating whether the action function should be called when setting the initial value. The default is `false`.; labelWidth — Number of pixels width for the label. default is 60.."}]} -{"conversations": [{"role": "user", "content": "What does `Char.isAlphaNum` do?"}, {"role": "assistant", "content": "ASCII character Returns: whether the char is an alphabetic or numeric character."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Pfunc`."}, {"role": "assistant", "content": "```supercollider\nq = Pbind(\\freq, 300, \\dur, Pn(0.3, 2));\nq.trace.play;\n\n// Sound-wise ineffective modification of the incoming stream\np = Pbind(\\degree, 6) <> q;\np.trace.play;\n\n// Instead\np = Pbind(\\degree, 6) <> Pfunc { |ev| ev.freq = nil } <> q;\np.trace.play;\n\n// Alternatively\np = Pbind(\\degree, Pfunc { |ev| ev.freq = nil; 6 }) <> q;\np.trace.play;\n\n// Just setting a key to nil from a Pbind pair will end the stream\np = Pbind(\\freq, nil, \\degree, 6) <> q;\np.trace.play; // silent because it outputs no events\n```"}]} -{"conversations": [{"role": "user", "content": "What does `LinTrans.-` do?"}, {"role": "assistant", "content": "subtraciton between linear transformations. `a ="}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LFSaw`."}, {"role": "assistant", "content": "```supercollider\n{ LFSaw.ar(500, 1, 0.1) }.play\n\n// used as both Oscillator and LFO:\n{ LFSaw.ar(LFSaw.kr(4, 0, 200, 400), 0, 0.1) }.play\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Demand`."}, {"role": "assistant", "content": "```supercollider\n{\nvar a, b, t = Impulse.kr(2);\na = { Dseq([1, 2, 3, 4, 5], inf) } * 100;\nb = a + 1;\nDemand.kr(t, 0, [a, b]).poll(t)\n}.play\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for tired pads."}, {"role": "assistant", "content": "```supercollider\n// this is what I write when I didn't sleep last night.. zzzzzz\n// easy subsynth with dynklank and simple scale\n\n(\n\nfork{ \n loop{\n var time;\n time = 5.rand;\n {\n var sound, freqs, envs, rings, numvoices, env;\n numvoices = 40;\n freqs = {(Scale.major(\\just).degrees+26+\n (0,12..110).choose).choose}.dup(numvoices).midicps;\n rings = {1.0.rand}.dup(numvoices);\n envs = { EnvGen.kr(Env.linen( time/3.0.rand, \n time/3.0.rand, time/3.0.rand, 1.0.rand ) ) }.dup(numvoices);\n \n sound = PinkNoise.ar(numvoices.reciprocal!2);\n sound = DynKlank.ar(`[freqs,envs,rings], sound );\n sound = sound * EnvGen.kr(Env.linen(time.rand,time/3,time.rand),doneAction:2);\n \n sound = HPF.ar(sound, 120);\n \n 4.do{sound = DelayC.ar(sound, 0.4, [0.4.rand,0.4.rand], 1/8, sound) };\n \n //good call - lets turn this down \n sound*0.2;\n }.play;\n time.rand.wait;\n }\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BLowPass`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n(\nz = {\n BLowPass.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(10, 20000, \\exponential), // cutoff freq.\n MouseY.kr(0.0, 1.0, \\linear), // rq\n 0.5); // mul\n}.play\n);\nz.release;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Pan2` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\ns.bind {\n SynthDef(\"tpulse2\", { arg out=0, freq=700, sawFreq=440.0;\n Out.ar(out, Pan2.ar(SyncSaw.ar(freq, sawFreq, 0.1), SinOsc.kr(8)) )\n }).send(s);\n s.sync; // wait until synthdef is loaded\n x = Synth.new(\"tpulse2\");\n a = Bus.control.set(440);\n x.map(\\freq, a);\n};\n);\n\na.free; x.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nNdef(\\x, { Saw.ar(110) * 0.1 }).play;\nNdef(\\x)[1] = \\filter -> { |in| RLPF.ar(in, 800, 0.4) };\n```"}, {"role": "assistant", "content": "Two nodes in one named proxy: a saw source, then a resonant low-pass filter fed by it.\n\n`Ndef(\\x, { ... })` defines the first node of the chain and `.play` starts it. `Ndef(\\x)[1] = \\filter ->`\ninserts a second node at index 1; the `\\filter` key says 'make this node an effect that receives the\nprevious node's output as `in`'. So the patch is `Saw -> RLPF -> out`. Because it is an Ndef, calling\n`Ndef(\\x, { ... })` again replaces the source with a crossfade instead of restarting, and\n`Ndef(\\x).stop` removes the whole chain."}]} +{"conversations": [{"role": "user", "content": "What does `Fdef.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Lazy function proxy Arguments: key — if no instance exists with this name, create a new one, otherwise return the existing one.; val — If a Function is given, replace the old function with the new one.."}]} +{"conversations": [{"role": "user", "content": "What does `RedHarmonicTree.sorted` do? What arguments does it take?"}, {"role": "assistant", "content": "sorted harmonic tree Arguments: base — Base frequency.; num — Number of partials.; range — 1 and 2 will only produce unison and octaves.."}]} +{"conversations": [{"role": "user", "content": "What is `PbindProxy`?"}, {"role": "assistant", "content": "PbindProxy — incremental event pattern reference"}, {"role": "user", "content": "What does `PbindProxy.new` do?"}, {"role": "assistant", "content": "Return a new instance of PbindProxy with the given patternpairs. Unlike Pbindef, it has no internal name. `a = PbindProxy(\\note, Pseq([0, 7, 9], inf), \\dur, 0.2).play;` It also supports keyword argument syntax: `a = PbindProxy(note: Pseq([0, 7, 9]), dur: 0.2).play;`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na = PbindProxy(\\note, Pseq([0, 7, 9], inf), \\dur, 0.2).play;\na.set(\\note, Pseq([0, 6, 10]));\na.stop;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `PHSplayer` in SuperCollider briefly."}, {"role": "assistant", "content": "PHSplayer — PHS player object Implicitely instantiated when PHS's play method is called, allows stopping and resuming with options also concerning the help synth. Category: Libraries > miSCellaneous > HS and HSpar, Streams-Patterns-Events > HS and HSpar."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n {\n var freq;\n freq = Duty.kr(\n Drand([0.01, 0.2, 0.4], inf), // demand ugen as durations\n 0,\n Dseq([204, 400, 201, 502, 300, 200], inf)\n );\n SinOsc.ar(freq * [1, 1.01]) * 0.1\n\n }.play;\n);\n\n(\n {\n var freq;\n freq = Duty.kr(\n MouseX.kr(0.001, 2, 1), // control rate ugen as durations\n 0,\n Dseq([204, 400, 201, 502, 300, 200], inf)\n );\n SinOsc.ar(freq * [1, 1.01]) * 0.1\n\n }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n {\n var freq;\n freq = Duty.kr(\n Drand([0.01, 0.2, 0.4], inf), // demand ugen as durations\n 0,\n Dseq([204, 400, 201, 502, 300, 200], inf)\n );\n SinOsc.ar(freq * [1, 1.01]) * 0.1\n\n }.play;\n);\n\n(\n {\n var freq;\n freq = Duty.kr(\n MouseX.kr(0.001, 2, 1), // control rate ugen as durations\n 0,\n Dseq([204, 400, 201, 502, 300, 200], inf)\n );\n SinOsc.ar(freq * [1, 1.01]) * 0.1\n\n }.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SequenceableCollection.exprand` do?"}, {"role": "assistant", "content": "Fill a SequenceableCollection with random values in the range minVal to maxVal with exponential distribution. `Array.exprand(8, 1,"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a, x;\na = Pconst(5, Prand([1, 2, 0.5, 0.1], inf));\nx = a.asStream;\n9.do({ x.next(Event.default).postln });\n);\n\n\n// Pconst used as a sequence of durations\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\nPn(\n Pbind(\n \\dur, Pconst(1, Prand([1, 0.\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a, x;\na = Pconst(5, Prand([1, 2, 0.5, 0.1], inf));\nx = a.asStream;\n9.do({ x.next(Event.default).postln });\n);\n\n\n// Pconst used as a sequence of durations\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\nPn(\n Pbind(\n \\dur, Pconst(1, Prand([1, 0.02, 0.2], inf)),\n \\instrument, \\help_sinegrain,\n \\degree, Pseries(0, 1, inf),\n \\octave, 6\n )\n).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `Routine` in SuperCollider briefly."}, {"role": "assistant", "content": "Routine — Functions that can return in the middle and then resume where they left off A Routine runs a Function and allows it to be suspended in the middle and be resumed again where it left off. This functionality is supported by the Routine's superclass Thread. Effectively, Routines can be used to implement co-routines as found in Scheme and some other languages. Category: Core > Kernel."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n// prep\ns = Server.local;\n\nn = SynthDef(\"Updater-help\", {|out, freq|\n var sin;\n sin = SinOsc.ar(freq, 0.5)*EnvGen.kr(Env.triangle(4,1), doneAction:2);\n Out.ar(out, sin);\n }).send(s);\n);\n\n(\n//create a new synth node on the server\nn = Synth.new(\"Updater-help\", [\\out, 0, \\freq, 220]);\n\n//you need to register the synth with a NodeWatcher first\nNodeWatcher.register(n);\n\n//update the client of \\n_end messages\nUpdater(n, {|node, msg|\n// …\n```"}, {"role": "assistant", "content": "create a new synth node on the server you need to register the synth with a NodeWatcher first (Updater: simple MVC utility; calls an update handler when the model changes)"}]} +{"conversations": [{"role": "user", "content": "What does `FoaMagA.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "First Order Ambisonic (FOA) Magnitude of Soundfield Complex Admittance Vector Arguments: in — The B-format signal, an array: [w, x, y, z]; size — Analysis filter kernel size.; method — The Soundfield analysis method:."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Hilbert`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\ns.scope;\na = { Hilbert.ar(SinOsc.ar(100)) * -20.dbamp }.play;\na.release;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n\n// define HS, PHS - play\n\n(\nh = HS(s, { |freq = 0.5, dev = 10, center = 65| LFDNoise3.kr(freq, dev, center) });\n\np = PHS(h, nil, // default help synth args\n Prand([0.4, 0.2],inf), [ \\midinote, Pkey(\\val), \\amp, 0.1 ],\n 0.1, [ \\midinote, Pkey(\\val) + 9.5 + Pxrand([0, 2, 5],inf), \\amp, 0.08 ]\n).play;\n);\n\n\n// stop only help synth\n\np.stop(hsStop: true, pbindStop\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n\n// define HS, PHS - play\n\n(\nh = HS(s, { |freq = 0.5, dev = 10, center = 65| LFDNoise3.kr(freq, dev, center) });\n\np = PHS(h, nil, // default help synth args\n Prand([0.4, 0.2],inf), [ \\midinote, Pkey(\\val), \\amp, 0.1 ],\n 0.1, [ \\midinote, Pkey(\\val) + 9.5 + Pxrand([0, 2, 5],inf), \\amp, 0.08 ]\n).play;\n);\n\n\n// stop only help synth\n\np.stop(hsStop: true, pbindStop: false);\n\n\n// stop pbind\n\np.stop;\n\n\n// resume help synth and eventstream player\n\np.play(hsPlay: true, pbindPlay: true);\n\n\n// stop player and free HS\n\np.free;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// example; this buffer is mono, so the number of samples matches the number of frames\nb = Buffer.read(s, ExampleFiles.child);\n\n// indexing with a phasor\n{ BufRd.ar(1, b, Phasor.ar(0, BufRateScale.kr(b), 0, BufSamples.kr(b))) }.play;\n\n// indexing by hand\n{ BufRd.ar(1, b, K2A.ar(MouseX.kr(0, BufSamples.kr(b))) }.play;\n\nb.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// example; this buffer is mono, so the number of samples matches the number of frames\nb = Buffer.read(s, ExampleFiles.child);\n\n// indexing with a phasor\n{ BufRd.ar(1, b, Phasor.ar(0, BufRateScale.kr(b), 0, BufSamples.kr(b))) }.play;\n\n// indexing by hand\n{ BufRd.ar(1, b, K2A.ar(MouseX.kr(0, BufSamples.kr(b)))) }.play;\n\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Buffer`?"}, {"role": "assistant", "content": "Buffer — Client-side representation of a buffer on a server"}, {"role": "user", "content": "What does `Buffer.alloc` do?"}, {"role": "assistant", "content": "Create and return a Buffer and immediately allocate the required memory on the server. The buffer's values will be initialised to 0.0."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n// allocate an array of Buffers and fill them with different harmonics\n(\nb = Buffer.allocConsecutive(8, s, 4096, 1, { |buf, i|\n buf.sine1Msg((1 .. ((i + 1) * 6)).reciprocal) // completion messages\n});\n\na = { VOsc.ar(SinOsc.kr(0.5, 0).range(b.first.bufnum + 0.1, b.last.bufnum - 0.1),\n [440, 441], 0, 0.2) }.play;\n);\na.free;\n\n// iterate over the array and free it\nb.do(_.free);\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `TRand` in SuperCollider briefly."}, {"role": "assistant", "content": "TRand — Triggered random number generator. Generates a random float value in uniform distribution from `lo` to `hi` each time the trigger signal changes from nonpositive to positive values. Category: UGens > Random, UGens > Triggers."}]} +{"conversations": [{"role": "user", "content": "What does `View.mouseDown` do?"}, {"role": "assistant", "content": "Handles response to a mouse button press event. Evaluates #-mouseDownAction. See #Mouse actions for explanation of"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Duty`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\n {\n var freq;\n freq = Duty.kr(\n Drand([0.01, 0.2, 0.4], inf), // demand ugen as durations\n 0,\n Dseq([204, 400, 201, 502, 300, 200], inf)\n );\n SinOsc.ar(freq * [1, 1.01]) * 0.1\n\n }.play;\n);\n\n(\n {\n var freq;\n freq = Duty.kr(\n MouseX.kr(0.001, 2, 1), // control rate ugen as durations\n 0,\n Dseq([204, 400, 201, 502, 300, 200], inf)\n );\n SinOsc.ar(freq * [1, 1.01]) * 0.1\n\n }.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `BufSamples` in SuperCollider?"}, {"role": "assistant", "content": "BufSamples — Current number of samples in buffer. Returns the current number of allocated samples. A sample is not the same as a frame (compare with BufFrames); a frame includes the samples in each channel of the buffer. Only for a mono buffer are samples the same as frames. `samples = frames * numChannels` Category: UGens > Buffer > Info."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `NodeControl`."}, {"role": "assistant", "content": "```supercollider\nd = SynthDef(\"help-NodeControl\", { |out = 0, freq = 400|\n Out.ar(out,\n SinOsc.ar(freq, 0, 0.5)\n )\n});\ny = d.play; // the synth\n\nc = NodeControl(y, 1);\n\nc.value = 500;\n\nc.value = 300;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Lorenz2DL.ar(11025, 44100) }.play(s);\n\n// randomly modulate params\n(\n{ Lorenz2DL.ar(\n 11025, 44100,\n LFNoise0.kr(1, 2, 10),\n 20,\n LFNoise0.kr(1, 1.5, 2),\n 0.02\n) * 0.2 }.play(s);\n)\n\n// as a frequency control\n{ SinOsc.ar(Lorenz2DL.ar(40, 80, h:0.02)*800+900)*0.4 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Lorenz2DL.ar(11025, 44100) }.play(s);\n\n// randomly modulate params\n(\n{ Lorenz2DL.ar(\n 11025, 44100,\n LFNoise0.kr(1, 2, 10),\n 20,\n LFNoise0.kr(1, 1.5, 2),\n 0.02\n) * 0.2 }.play(s);\n)\n\n// as a frequency control\n{ SinOsc.ar(Lorenz2DL.ar(40, 80, h:0.02)*800+900)*0.4 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `GbmanN`."}, {"role": "assistant", "content": "```supercollider\n// default initial params\n{ GbmanN.ar(MouseX.kr(20, SampleRate.ir)) * 0.1 }.play(s);\n\n// change initial params\n{ GbmanN.ar(MouseX.kr(20, SampleRate.ir), -0.7, -2.7) * 0.1 }.play(s);\n\n// wait for it...\n{ GbmanN.ar(MouseX.kr(20, SampleRate.ir), 1.2, 2.0002) * 0.1 }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(GbmanN.ar(40)*400+500)*0.4 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// By Bjørn Houdorf March 2013, Play your (short) soundfiles with some delay.\n\nb = SoundFile.collectIntoBuffers(\"yourSoundFileFolder/*\"); // 1. rund this\n\n( // 2. and then run this\nt = Task({\n({\n var num= b.size.rand;\n var buf= b[num];\n 0.1*Splay.ar(PlayBuf.ar(buf.numChannels, buf, 1, 1, 0, 0));\n}.play;\n) \n});\n);\n\n\n( // 3. Then run this\nz = Task({\nloop({\n t.start;\n 0.1.wait;\n});\n});\n);\n\n\nz.start; // 4. and run this\nz.stop; // 5. and finally run this\n```"}, {"role": "assistant", "content": "Play your (short) soundfiles with some delay. Your soundfiles should be in the folder \"yourSoundFileFolder\"."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `DecodeB2`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var w, x, y, p, a, b, c, d;\n\n p = PinkNoise.ar; // source\n\n // B-format encode\n #w, x, y = PanB2.ar(p, MouseX.kr(-1, 1), 0.1);\n\n // B-format decode to quad\n #a, b, c, d = DecodeB2.ar(4, w, x, y);\n\n [a, b, d, c] // reorder to my speaker arrangement: Lf Rf Lr Rr\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Fb1_ODEdef.next` do? What arguments does it take?"}, {"role": "assistant", "content": "Method for language-side integration, gives next value based on previous Arguments: intType — Integration type. Expects one of the Symbols, for which procedures are stored with Fb1_ODEintdef. The use of symplectic procedures (with prefix 'sym', like 'sym2') is highly recommended. For more accurate integration you can try symplectic procedures of higher order like \\sym4, \\sym8 etc. Multi-step; t — Previous time, expects Number.; y — Previous state, expects Number or Array of system size.; dt — Number. Time delta.; args — List of additional args to be passed to Fb1_ODEdef's function.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a, b;\na = Pshuf([1, 2, 3, 4, 5], 3); // repeat 3 times\nb = a.asStream;\n16.do({ b.next.postln });\n);\n\n// Pshuf used as a sequence of pitches:\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Pn(Pshuf(#[60, 60, 60, 61, 63, 65, 72], 4), inf).\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a, b;\na = Pshuf([1, 2, 3, 4, 5], 3); // repeat 3 times\nb = a.asStream;\n16.do({ b.next.postln });\n);\n\n// Pshuf used as a sequence of pitches:\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Pn(Pshuf(#[60, 60, 60, 61, 63, 65, 72], 4), inf).asStream;\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, a.next.midicps]);\n 0.15.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Resonz`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"pitchFromNoise\", { arg out = 0;\n Out.ar(\n out,\n Resonz.ar(\n WhiteNoise.ar(15),\n LFNoise0.kr(2, 110, 660),\n 0.005\n )\n )\n}).add;\n);\n\n\n(\nSynth(\"ringModulation\");\nSynth(\"pitchFromNoise\", [\\out, 1]);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `NdefGui`?"}, {"role": "assistant", "content": "NdefGui — a gui for a NodeProxy or Ndef"}, {"role": "user", "content": "What does `NdefGui.big` do?"}, {"role": "assistant", "content": "two lines of controls for a big NdefGui, usually in its own window"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\np = ProxySpace.push(s.boot);\n\nl = NdefGui(nil, 3).moveTo(10, 120);\nm = NdefGui(nil, 3).moveTo(10, 240);\nn = NdefGui(nil, 3).moveTo(10, 360);\no = NdefGui(nil, 3).moveTo(10, 480);\n\nSpec.add(\\dens, [0.1, 300, \\exp]);\n\n// make 3 kinds of proxies: using tilde/proxyspace, Ndef, and unnamed.\n~spacy = { |dens = 5| Formlet.ar(Dust.ar(dens ! 2), LFDNoise0.kr(20 ! 2).lag(0.1).linexp(-1, 1, 300, 5000), 0.003, 0.03) };\nNdef(\\ndeffy, { GrayNoise.ar(0.1 ! 2) });\nc = NodeProxy.audio.source_({ PinkNoise.ar(0.1 ! 2) });\n\n// put one in each editor\nl.object_(~spacy);\nm.object_(Ndef(\\ndeffy));\nn.object_(c);\n);\n// One should also be able to drag and drop text into the drag,\n// but this is also not working yet.\n( Ndef(\\a) )\n```"}]} +{"conversations": [{"role": "user", "content": "What does `View.removeAction` do? What arguments does it take?"}, {"role": "assistant", "content": "Adds/removes 'func' to or from the list of objects in the variable determined by 'selector'. If 'selector' is not an Array or a List, it will become one, containing the previous object plus 'func'. This is useful for adding functionality to existing frameworks that have action functions Arguments: func — Any object to add as an action, usually a Function.; selector — A Symbol containing the name of the action variable to which 'func' will be added. In other words, 'add' method will be invoked on that variable; by default that is \\action, but any other (sensible) instance or class variable of the view could work (e.g. \\globalKeyDownAction or \\mouseUpAction or \\on."}]} {"conversations": [{"role": "user", "content": "Write an FM bell in SuperCollider."}, {"role": "assistant", "content": "PMOsc is phase modulation: a non-integer modulator ratio gives the inharmonic clang.\n\n```supercollider\n(\nSynthDef(\\fmBell, { |out = 0, freq = 440, amp = 0.2, dur = 4|\n var index = EnvGen.kr(Env([8, 0.2], [dur], -4));\n var sig = PMOsc.ar(freq, freq * 1.4, index, 0, 1);\n var env = EnvGen.kr(Env.perc(0.002, dur, 1, -5), doneAction: 2);\n Out.ar(out, Pan2.ar(sig * env * amp, 0));\n}).add;\n);\nSynth(\\fmBell, [\\freq, 550]);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `WebView.runJavaScript` do? What arguments does it take?"}, {"role": "assistant", "content": "Evaluates the given JavaScript code in the context of the current Arguments: A String.; A function to be called when execution is complete, with the result as first argument.."}]} -{"conversations": [{"role": "user", "content": "What does `U.prepareAnd` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: target — (describe argument here); loadDef — (describe argument here); action — (describe argument here). Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for radio static with tuning noise (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"radiostatic\", {arg out=0;\n var hum, sineSweep, tuning, dustNoise, staticNoise, humFreq, numHarms;\n \n numHarms = 7;\n humFreq = 100;\n hum = Array.fill(numHarms, {|i| SinOsc.ar( (i+1) * humFreq, 0, 1/numHarms)});\n hum = hum.sum;\n dustNoise = Dust.ar(LFNoise1.ar(0.5).range(1000,8000));\n staticNoise = hum * dustNoise * LFNoise1.ar(1).range(0.5, 2);\n \n sineSweep = SinOsc.ar(LFNoise2.ar(1).range(20, 11000));\n tuning = SinOsc.ar(10000).ring4(sineSweep) * LFNoise2.ar(1.1).range(0.05, 0.1);\n\n Out.ar(out, Pan2.ar(staticNoise + tuning, 0));\n}).add;\n);\n \na = Synth(\"radiostatic\");\n```"}]} -{"conversations": [{"role": "user", "content": "What does `MxQuery.outlets` do?"}, {"role": "assistant", "content": "Like inlets but returns Returns: an MxQuery with just outlets"}]} -{"conversations": [{"role": "user", "content": "What does `AbsApp.dereference` do?"}, {"role": "assistant", "content": "Abstract super class for the various MxApp scripting objects"}]} -{"conversations": [{"role": "user", "content": "What is `Ppar` in SuperCollider?"}, {"role": "assistant", "content": "Ppar — embed event streams in parallel Embeds several event streams so that they form a single output stream with all their events in temporal order. When one stream ends, the other streams are further embedded until all have ended. Category: Streams-Patterns-Events > Patterns > Parallel."}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nMix.ar([SinOsc.ar(220, 0, 0.1), SinOsc.ar(330, 0, 0.1)])\n```"}, {"role": "assistant", "content": "Sums two sine waves into one signal — a perfect fifth, 220 Hz and 330 Hz, at 0.1 amplitude each.\n\n`[SinOsc.ar(220, 0, 0.1), SinOsc.ar(330, 0, 0.1)]` is an Array of two audio-rate signals (each UGen\nreturns a signal; an array of them is just a list). `Mix.ar` adds the elements together. The alternative\n`+` operator does the same for two signals, and `Splay.ar` would spread them across the stereo field\ninstead of summing them."}]} -{"conversations": [{"role": "user", "content": "When should I use a Pattern instead of writing Synth code by hand?"}, {"role": "assistant", "content": "Use a Pattern when what you want to express is a sequence over time — notes, durations, amplitudes, parameters — rather than a signal. A Pbind describes events, and `.play` turns each event into a Synth (by default of the \\default instrument, or of \\instrument if you name one). Hand-written Synth code is for the sound itself; Patterns are for what plays when. The two compose: a SynthDef named \\bell is triggered from `Pbind(\\instrument, \\bell, ...)`."}]} -{"conversations": [{"role": "user", "content": "What does `SimpleNumber.beta` do?"}, {"role": "assistant", "content": "The beta function is defined by: `tgamma(a)*tgamma(b) /"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Bell example using Ndef?"}, {"role": "assistant", "content": "```supercollider\n(\nvar fundamental = 131;\nvar dur = 10;\nvar partials =\n[\n [1, 0.5, dur * 1],\n [1.02, 0.3, dur * 1],\n [1.01, 0.14, dur * 0.5],\n [2.44, 0.17, dur * 0.8],\n [3.31, 0.9, dur * 0.5],\n [5.1, 0.1, dur * 0.56],\n [5.9, 0.1, dur * 0.9],\n [11.01, 0.09, dur * 1],\n [13, 0.01, dur * 0.5],\n [15, 0.01, dur * 0.2],\n [16, 0.05, dur * 0.02],\n [19, 0.10, dur * 0.01],\n [20, 0.01, dur * 0.2],\n [24, 0.01, dur * 0.2],\n [4, 3, dur * 0.002] // attack\n];\n\nNdef(\\quickBell).fadeTime = 0;\nNdef(\\quickBell, {\n var snd, env;\n env = Env.perc(\n attackTime: 0.001,\n releaseTime: partials.flop.at(2),\n level: partials.flop.at(1)\n ).kr;\n // fundamental + inharmonics\n snd = SinOsc.ar(\n freq: fundamental * partials.flop.at(0);\n );\n snd = snd * env;\n snd = Splay.ar(snd);\n snd = Limiter.ar(snd);\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "[ 1, 2, 1, 1, 2, 1, 1 ] how to find adjacent elements in an array?"}, {"role": "assistant", "content": "SuperCollider forum — [ 1, 2, 1, 1, 2, 1, 1 ] how to find adjacent elements in an array\n\nRandColors:\n\nI need to find the index, the how many times (the adjacent values are equal) and what is the adjacent value.\n\nThis is perhaps a bit verbose and clunky, but it meets the above specification:\n\n```supercollider\n(\n~repeats = {|array|\n // return [index, number of repeats, the value] for each repeated value\n var results = [];\n var thisIndex = 0;\n var thisCount = 1;\n var thisValue = array[0];\n array[1..].do{|val, i|\n if(val == thisValue,\n {thisCount = thisCount + 1},\n {\n if(\n thisCount > 1,\n {results = results.add([thisIndex, thisCount, thisValue])},\n );\n thisValue = val;\n thisIndex = i + 1;\n thisCount = 1;\n }\n )\n };\n if(thisCount > 1, {results = results.add([thisIndex, thisCount, thisValue])});\n results;\n}\n);\n\na = [1, 2, 1, 1, 1, 2, 1, 1];\nb = ~repeats.value(a);\n\na = [2, 3, 5, 5];\nb = ~repeats.value(a);\n```"}]} -{"conversations": [{"role": "user", "content": "What is `PulseDPW` in SuperCollider?"}, {"role": "assistant", "content": "PulseDPW — super-efficient square-wave oscillator with low aliasing Use this just like the Pulse UGen - as with SawDPW, this uses the \"Differentiated Parabolic Wave\" technique to create a waveform extremely efficiently and with low (but not zero) aliasing. Category: UGens > Generators."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\ne = Environment.make({ ~a = 3; ~b = 10 });\n{ |a, b| (a * b) }.valueWithEnvir(e);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\ne = Environment.make({ ~a = 3; ~b = 10 });\n{ |a, b| (a * b) }.valueWithEnvir(e);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Are you an AI?"}, {"role": "assistant", "content": "Yes. I am a small language model specialised in SuperCollider. I generate text; I cannot hear audio, run sclang, or check whether a patch sounds the way you want."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n{ BlitB3Square.ar(XLine.kr(1000, 20, 10)) }.play;\n\n{ BlitB3Square.ar(MouseX.kr(20,1000,'exponential'),MouseY.kr(0.001,0.999)) }.play;\n\n//comparison\n//blit version is cheaper, but aliases once pushed over 4000 or so at 44100 SR\n{ Pulse.ar(4000, 0.5) }.play;\n{ BlitB3Square.ar(4000) }.play;\n\n\n//spot the difference in CPU usage\n{ Mix.fill(100, {Pan2.ar(0.1*BlitB3Square.ar( ((LFNoise0.kr(rrand(2,3))).range(0,36)+36).midic\n// …\n```"}, {"role": "assistant", "content": "blit version is cheaper, but aliases once pushed over 4000 or so at 44100 SR spot the difference in CPU usage (BlitB3Square: Bipolar BLIT derived square waveform)"}]} +{"conversations": [{"role": "user", "content": "What does `UnicodeResponder.dict` do?"}, {"role": "assistant", "content": "register responder functions for unicode and modifier combinations"}]} +{"conversations": [{"role": "user", "content": "Explain `EnvelopeView` in SuperCollider briefly."}, {"role": "assistant", "content": "EnvelopeView — A configurable view with nodes and connections A view which can graphically display nodes at x/y coordinates, connection lines, cross-connections, node markers, and labels. All of the values for these are stored in arrays. While this view is typically used to make editable envelopes interfaces, it can be used to draw very complex interconnection graphs as well. Category: GUI > Views."}]} +{"conversations": [{"role": "user", "content": "What does `Pmul.new` do? What arguments does it take?"}, {"role": "assistant", "content": "multiply with value of a key in event stream Arguments: name — the key; value — can be a pattern or a stream. The resulting stream ends when that incoming stream ends.; pattern — the pattern."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Duty`."}, {"role": "assistant", "content": "```supercollider\n(\n {\n var freq;\n freq = Duty.kr(\n Drand([0.01, 0.2, 0.4], inf), // demand ugen as durations\n 0,\n Dseq([204, 400, 201, 502, 300, 200], inf)\n );\n SinOsc.ar(freq * [1, 1.01]) * 0.1\n\n }.play;\n);\n\n(\n {\n var freq;\n freq = Duty.kr(\n MouseX.kr(0.001, 2, 1), // control rate ugen as durations\n 0,\n Dseq([204, 400, 201, 502, 300, 200], inf)\n );\n SinOsc.ar(freq * [1, 1.01]) * 0.1\n\n }.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "I get 'Node not found' when I call .set on a Synth after a while."}, {"role": "assistant", "content": "The Synth was freed and the language still holds a reference. That happens whenever the SynthDef used `doneAction: 2` and the envelope finished, or when something called `freeAll`/`CmdPeriod`. Guard it with `if (x.notNil and: { x.isPlaying }) { x.set(\\freq, 300) }`, or store the node in a variable that you clear when it ends. For sustained sounds the right pattern is a `gate` argument with `doneAction: 2` on the EnvGen, so the node lives until you release it."}]} +{"conversations": [{"role": "user", "content": "What does `PLmeanrand.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new PLmeanrand Arguments: lo — Symbol or Pmeanrand lo arg. If a Symbol is passed, list can be assigned to an envir variable later on. Can be dynamically replaced by Patterns or Streams. Defaults to 0.; hi — Symbol or Pmeanrand hi arg. If a Symbol is passed, list can be assigned to an envir variable later on. Can be dynamically replaced by Patterns or Streams. Defaults to 1.; length — Symbol or Pmeanrand length arg. If a Symbol is passed, list can be assigned to an envir variable later on. Defaults to inf.; envir — Dictionary or one of the Symbols \\top, \\t (topEnvironment), \\current, \\c (currentEnvironment). Dictionary to be taken for variable reference. Defaults to \\current.."}]} +{"conversations": [{"role": "user", "content": "Explain `SVF` in SuperCollider briefly."}, {"role": "assistant", "content": "SVF — 12db/Oct State Variable Filter Total, 100% Plastic... Category: UGens > Filters."}]} +{"conversations": [{"role": "user", "content": "What is `BinaryOpFunction`?"}, {"role": "assistant", "content": "BinaryOpFunction — represent a binary operation on a function"}, {"role": "user", "content": "What does `BinaryOpFunction.value` do?"}, {"role": "assistant", "content": "Executes each of the operand functions and then performs the selector on the result."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nvar a = { 19.rand };\nvar b = { [5, 8, 9].choose };\nvar c = a + b;\nfork {\n 15.do {\n (instrument: \\default, note: [c.value, a.value]).play;\n 0.3.wait;\n }\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What are the arguments of GrainBuf.ar?"}, {"role": "assistant", "content": "`GrainBuf.ar(numChannels, trigger, dur, sndbuf, rate, pos, interp, pan, envbufnum, maxGrains, mul, add)`. The ones you always pass are numChannels (1 or 2), trigger (a UGen that fires grains, e.g. Impulse.kr(20)), dur (grain length in seconds), sndbuf (an integer buffer number, or `~buf`), rate (playback rate per grain), and pos (read position 0..1 into the buffer). Raise maxGrains if the server complains about too many grains rather than lowering density."}]} +{"conversations": [{"role": "user", "content": "What does `Sieve.union_o` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new Sieve object in mode 'points' with offsets, generated by the union of sets of Arguments: ... data — Alternating generators and integer offsets plus an optional integer limit, wrapped into a Ref, which is included when reached. Allowed generators: Integers, Streams or Patterns producing intervals or Sieves itself. Integers and Stream/Pattern output must be strictly positive. Integers as generators ."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for sound of an alien weapon firing. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"raygun\", {arg amp = 0.5, sinfreq = 1000, glissf = 0.001, att = 0.01, rel = 0.9;\n var gliss = XLine.kr(sinfreq, sinfreq*glissf, rel);\n var snd = SinOsc.ar(gliss);\n var env = EnvGen.kr(Env.perc(att, rel), doneAction: 2);\n snd = snd * env * amp;\n Out.ar(0, snd);\n}).add;\n);\n\n(\nPbind(\n \\instrument, \"raygun\",\n \\dur, Pseq([0.75,0.75,0.75,0.75,0.25,0.25,0.25]*0.5, inf),\n \\amp, 0.4\n).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Vibrato`."}, {"role": "assistant", "content": "```supercollider\n// vibrato at 1 Hz, note the use of DC.ar UGen; a constant of 400.0 doesn't work\n{ SinOsc.ar(Vibrato.ar(DC.ar(400.0), 1, 0.02)) }.play\n\n// compare: k-rate freq input can be a constant\n{ SinOsc.ar(Vibrato.kr(400.0, 1, 0.02)) }.play\n\n// control rate and rateVariation\n{ SinOsc.ar(Vibrato.ar(DC.ar(400.0), MouseX.kr(2.0, 100.0), 0.1, 1.0, 1.0, MouseY.kr(0.0, 1.0), 0.1)) }.play\n\n// control depth and depthVariation\n{ SinOsc.ar(Vibrato.ar(DC.ar(400.0), LFNoise1.kr(1, 3, 7), MouseX.kr(0.0, 1.0), 1.0, 1.0, MouseY.kr(0.0, 1.0), 0.1)) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `IEnvGen`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var env = Env([0, 0.6, 0.3, 1.0, 0], [0.1, 0.02, 0.4, 1.1], [\\lin, \\exp, -6, \\sin]);\n var envgen = IEnvGen.kr(env, MouseX.kr(0, env.times.sum));\n env.plot;\n SinOsc.ar(envgen * 500 + 440)\n}.play;\n);\n\n// index with an SinOsc ... mouse controls amplitude of SinOsc\n// use offset so negative values of SinOsc will map into the Env\n(\n{\n var sin = SinOsc.ar(440, 0, MouseX.kr(0, 1));\n // use offset so negative values of SinOsc will map into the Env\n var env = Env([-1, -0.7, 0.7, 1], [0.8666, 0.2666, 0.8668], \\lin, offset: -1.0);\n IEnvGen.ar(env, sin) * 0.1\n}.play;\n);\n\n// index with Amplitude of input, control freq of SinOsc (uses SoundIn)\n(\n{\n var point = Amplitude.ar(SoundIn.ar(0), 0.01, 0.2);\n // use offset so negative values of SinOsc will map into the Env\n var env = Env.xyc([[0, 330, \\exp], [0.5, 440, \\exp], [1.0, 1760]]);\n SinOsc.ar(IEnvGen.kr(env, point)) * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `SymbolArray` in SuperCollider?"}, {"role": "assistant", "content": "SymbolArray — an array whose indexed slots are all of the same type These classes implement arrays whose indexed slots are all of the same type. Category: Collections > Ordered."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\nz = Bus.control(s, 16);\nz.setn({ |i| (i * 5).nthPrime } ! 16 * 5 + 100);\na = BusPlug.for(z);\n{ Splay.ar(SinOsc.ar(a.kr(3, MouseX.kr(0, 25))) * 0.1 }.play; // selectively play 3 channel of the 16, modulate offset\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\nz = Bus.control(s, 16);\nz.setn({ |i| (i * 5).nthPrime } ! 16 * 5 + 100);\na = BusPlug.for(z);\n{ Splay.ar(SinOsc.ar(a.kr(3, MouseX.kr(0, 25)))) * 0.1 }.play; // selectively play 3 channel of the 16, modulate offset\n```"}]} +{"conversations": [{"role": "user", "content": "What does `MultiTrackAudioSpec.new` do? What arguments does it take?"}, {"role": "assistant", "content": "datatype specifying multiple 'audio' rate tracks Arguments: tracks; numChannels."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// crucial-library - sends midi clock and song position pointer\n// x.add( MIDIClockOut(\"IAC Driver\", \"IAC Bus 1\") )\n\nMxUnit.register('MIDIClockOut',\n(\n make: { arg mco;\n ~source = mco;\n MxUnit(mco, [], [])\n },\n spawnToBundle: { arg b;\n b.addFunction({~source.start}.inEnvir)\n },\n stopToBundle: { arg b;\n b.addFunction({~source.stop}.inEnvir)\n }\n /*,\n gotoBeat: { arg beat, atBeat, bundle;\n [beat, atBeat, bundle].debug;\n ~source.gotoBeatAtBeat(beat, atBeat)\n }*/\n\n));\n```"}, {"role": "assistant", "content": "crucial-library - sends midi clock and song position pointer x.add( MIDIClockOut(\"IAC Driver\", \"IAC Bus 1\") )."}]} +{"conversations": [{"role": "user", "content": "What does `RedKMeans.classifications` do?"}, {"role": "assistant", "content": "An array containing the result after the update method is called. It holds indices and have the same size as the number of items in the vectors array. Each index represents which centroid each vector belongs to. So to look up the closest centroid for vector i, do"}]} +{"conversations": [{"role": "user", "content": "Write a plucked string in SuperCollider."}, {"role": "assistant", "content": "Pluck is a Karplus-Strong string: a noise burst into a tuned delay with feedback. The delay time is\nthe reciprocal of the frequency.\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 220, amp = 0.5, dur = 3|\n var period = freq.reciprocal;\n var sig = Pluck.ar(WhiteNoise.ar(0.2), Impulse.kr(0), period, period, dur, 0.5);\n Out.ar(out, Pan2.ar(sig * amp, 0));\n}).add;\n);\nSynth(\\pluck, [\\freq, 330, \\dur, 4]);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `DoubleNestedAllpassL.ar` do?"}, {"role": "assistant", "content": "Nested Allpass filters as proposed by Vercoe and Pluckett"}]} +{"conversations": [{"role": "user", "content": "What does `CutMixer.new` do? What arguments does it take?"}, {"role": "assistant", "content": "BBCut2 volume and panning control Arguments: outbus — Bus number for final output. The stereo output will be placed on this bus plus the one above. The default is thus 0 and 1.; volume — output volume multiplier. Defaults to 1.0.; ampfunc — Something that responds to .value and returns a cut's amplitude. This is called for every repeat in a BBCutBlock . The first argument is the repeat number in the block, and the second argument is the block itself. If ampfunc responds to .updateblock, that will also be called every block with the cur; panfunc — Something that responds to .value and returns a cut's pan position. This is called for every repeat in a BBCutBlock . The first argument is the repeat number in the block, and the second argument is the block itself. If panfunc responds to .updateblock, that will also be called every block with the ."}]} +{"conversations": [{"role": "user", "content": "What does `RedSpring.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a new spring Arguments: object — A RedObject that will be connected to target.; target — A RedObject acting as target.; stiffness — A Float. The default is 0.1.; damping — A Float. The default is 0.9.; length — A Float. The default is 0.."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Duty`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// this is useful when two UGens need to be called, but only one of their outputs is needed\n(\n{\n var a, b, c;\n a = Dseq([1, 2, 3, 4], inf).dpoll(\"a\");\n b = Dseq([1955, 1952, 1823, 1452], inf).dpoll(\"b\");\n c = (a a Analysis, UGens > FFT."}]} +{"conversations": [{"role": "user", "content": "What does `BusPlug.control` do?"}, {"role": "assistant", "content": "Create a new control rate instance on the given"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Psetpre does not override incoming values:\n\n(\nvar a, b;\na = Psetpre(\\freq, 801, Pbind(\\freq, 108));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n);\n\n\n(\nvar a, b;\na = Psetpre(\\freq, Pseq([401, 801], 2), Pbind(\\dur, 0.5));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n);\n\n\n// sound example\n\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.per\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Psetpre does not override incoming values:\n\n(\nvar a, b;\na = Psetpre(\\freq, 801, Pbind(\\freq, 108));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n);\n\n\n(\nvar a, b;\na = Psetpre(\\freq, Pseq([401, 801], 2), Pbind(\\dur, 0.5));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n);\n\n\n// sound example\n\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain);\na = Psetpre(\\freq, Pseq([500, 600, 700], inf), a);\na = Psetpre(\\legato, Pseq([0.01, 1], inf), a);\na.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Build a slowly evolving drone with Ndef."}, {"role": "assistant", "content": "Ndef gives you a named patch you can redefine while it plays; the filter is a separate node in the\nchain so you can change it on its own.\n\n```supercollider\n(\nNdef(\\drone, { |freq = 55, amp = 0.12|\n var detune = [0, 0.07, -0.11];\n var sig = Mix(Saw.ar(freq * (1 + detune))) * amp;\n LPF.ar(sig, 400);\n}).play;\n\nNdef(\\drone)[1] = \\filter -> { |in| RLPF.ar(in, LFNoise1.kr(0.1).exprange(200, 1800), 0.3) };\n)\n```\n\nRedefining Ndef(\\drone, { ... }) later crossfades to the new definition; Ndef(\\drone).stop stops it."}]} +{"conversations": [{"role": "user", "content": "Explain `ChooseCutProc` in SuperCollider briefly."}, {"role": "assistant", "content": "ChooseCutProc — Automatic breakbeat cutting algorithm This cut procedure allows the user to specify a set of allowable cuts and repeats. It allows a roll at the end of a phrase. It is therefore a cross between BBCutProc11 (which automates what size cuts are permissible for a given subdiv rate) and WarpCutProc1. Derive new classes from this overriding the default instance methods to create advanced extensions of this paradigm; else pass in your own fu Category: Libraries > BBCut > Cut procedures."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `RecordBuf` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// Execute the following in order\n(\n// allocate a Buffer\ns = Server.local;\nb = Buffer.alloc(s, 44100 * 4.0, 1); // a four second 1 channel Buffer\n);\n\n// record for four seconds\n(\nSynthDef(\\help_RecordBuf, { |out = 0, bufnum = 0|\n var formant;\n formant = Formant.ar(XLine.kr(400, 1000, 4), 2000, 800, 0.125);\n RecordBuf.ar(formant, bufnum, doneAction: Done.freeSelf, loop: 0);\n}).play(s, [\\out, 0, \\bufnum, b]);\n);\n\n// play it back\n(\nSynthDef(\\help_RecordBuf_playback, { |out = 0, bufnum = 0|\n var playbuf;\n playbuf = PlayBuf.ar(1, bufnum);\n FreeSelfWhenDone.kr(playbuf); // frees the synth when the PlayBuf is finished\n Out.ar(out, playbuf);\n}).play(s, [\\out, 0, \\bufnum, b]);\n);\n\n// overdub\n(\nSynthDef(\\help_RecordBuf_overdub, { |out = 0, bufnum = 0|\n var formant;\n formant = Formant.ar(XLine.kr(200, 1000, 4), 2000, 800, 0.125);\n // mixes equally with existing data\n RecordBuf.ar(formant, bufnum, 0, 0.3, 0.5, doneAction: Done.freeSelf, loop: 0);\n}).play(s, [\\out, 0, \\bufnum, b]);\n);\n\n// play back the overdubbed version\nSynth.new(\\help_RecordBuf_playback, [\\out, 0, \\bufnum, b], s);\n\n// write the contents of the buffer to a file (see Buffer for more options)\n(\nb.write(sampleFormat: 'int16');\nthisProcess.platform.recordingsDir +/+ \"SC_\" ++ Date.localtime.stamp ++ \".aiff\"; // generated path\n);\n\nb.close; b.free; // cleanup\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// A beautiful sc140 tweet by Batuhan Bozkurt, parametrized for real-time changes\n(\n// Start sound here\na = { | rateL = 5, rateR = 6, blipMul = 100, blipAdd = 50, fMul = 50, kMul = 1 |\n f = LocalIn.ar(2).tanh;\n k = Latch.kr(f[0].abs,Impulse.kr(1/4)) * kMul;\n LocalOut.ar(\n f +\n CombC.ar(Blip.ar([rateL, rateR], blipMul * k + blipAdd, 0.9), 1, k*0.3, fMul * f));f\n}.play\n);\n\n// Set parameters for changing sound here: \n\na.set(\\rateL, 10);\n\na.set(\\rateR, 8);\n\na.set(\\blipMul, 25);\n\na.set(\\blipAdd, 70);\n\na.set(\\fMul, 30);\n\n\na.set(\\kMul, 0.01);\n```"}, {"role": "assistant", "content": "A beautiful sc140 tweet by Batuhan Bozkurt, parametrized for real-time changes. To do: Add gui widgets for easier interactive control."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Paddpre` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain);\nb = Paddpre(\\freq, Pseq([10, 30, 100], inf), a);\nb.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `WrapIndex`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// indexing into a table\n(\n{\n var buf = LocalBuf.newFrom([200, 300, 400, 500, 600, 800]);\n var freq = WrapIndex.kr(buf, MouseX.kr(0, BufFrames.ir(buf) * 3));\n SinOsc.ar(freq) * 0.1\n}.play;\n);\n\n// the same using a global buffer\n(\nt = [200, 300, 400, 500, 600, 800];\nb = Buffer(s, t.size, 1);\n\n// alloc and set the values\ns.listSendMsg(b.allocMsg(b.setnMsg(0, t)).postln);\n\nSynthDef(\\help_Index, { |out = 0, bufnum = 0|\n Out.ar(out,\n SinOsc.ar(\n WrapIndex.kr(\n bufnum,\n MouseX.kr(0, BufFrames.ir(bufnum) * 3)\n ),\n 0,\n 0.5\n )\n )\n}).play(s, [\\bufnum, b.bufnum]);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{ var nse, env, kic;\n kic = tanh(Ringz.ar(LPF.ar(Trig.ar(Impulse.ar(1.0),SampleDur.ir),1000),30,0.25,7).sin*2);\n env = Env.perc(0.05, 1, 1, -4);\n nse = BrownNoise.ar(2) + PinkNoise.ar(0.5) * EnvGen.kr(env,Impulse.kr(1), doneAction: 2);\n\n nse = Mix.ar(BPF.ar(nse,[100,1200,80,40,20],MouseX.kr(0,1),[1,0.2,1,1,1]));\n nse = LPF.ar(nse + kic, MouseY.kr(100,1000))! 2\n\n}.play\n)\n```"}, {"role": "assistant", "content": "A muffled thump. An attempt at a Jurassic Park © glass of water sort of thing - or breaking into a silo."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n/*\n( // PlayerBinop not yet implemented\n\nPatch(\\monosynth,[\n BeatClockPlayer.new(16) * MIDIGatePlayer.new,\n MIDIFreqPlayer.new,\n CCPlayer(50,[100,3000,\\exp,0.0,1500.0]),\n CCPlayer(51,[0.1,0.9,\\exp,0.0,0.2]),\n CCPlayer(52,[0.05,1.0])\n]).play\n\n\n*/\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n/*\n( // PlayerBinop not yet implemented\n\nPatch(\\monosynth,[\n BeatClockPlayer.new(16) * MIDIGatePlayer.new,\n MIDIFreqPlayer.new,\n CCPlayer(50,[100,3000,\\exp,0.0,1500.0]),\n CCPlayer(51,[0.1,0.9,\\exp,0.0,0.2]),\n CCPlayer(52,[0.05,1.0])\n]).play\n\n)\n*/\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n \n// definition for future reference in arbitrary Environments\n\nq = PLhprand(\\lo, \\hi);\n\n\n// prepare current Environment\n// PLseq repeats arg defaults to inf\n\n(\n~lo = 60;\n~hi = PLseq((92..62));\n);\n\n\n\n// run\n\n(\ny = Pbind(\n \\midinote, Ptuple(q!5), \n \\dur, 0.1,\n \\amp, 0.05\n).play;\n);\n\n\n// replace, converging bounds\n\n(\n~lo = PLseq((40..70) ++ (70!5));\n~hi = 70.5;\n);\n\ny.stop;\n```"}, {"role": "assistant", "content": "definition for future reference in arbitrary Environments prepare current Environment (PLhprand: dynamic scope Phprand variant)"}]} +{"conversations": [{"role": "user", "content": "What does `SCViewHolder.keyDownResponder` do?"}, {"role": "assistant", "content": "This method is forwarded to the view. Note: this is a cruciallib convention and will be deprecated Returns: The result of calling the method on the proxied view"}]} +{"conversations": [{"role": "user", "content": "What does `FoaMFreqOsc.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "First Order Ambisonic (FOA) monofrequent soundfield generator Arguments: freq — Frequency in Hertz. Sampled at audio-rate.; phase — Phase offset or modulator in radians. Sampled at audio-rate.; azimuthA — Azimuth of the Active Intensity Vector, in radians.; elevationA — Elevation of the Active Intensity Vector, in radians.; azimuthR — Azimuth of the Reactive Intensity Vector, in radians.; elevationR — Elevation of the Reactive Intensity Vector, in radians.; alpha; beta."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `InTrig`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\ns = Server.local;\nb = Bus.control(s, 1);\n\nSynthDef(\"help-InTrig\", { |out = 0, busnum = 0|\n var inTrig;\n inTrig = InTrig.kr(busnum);\n Out.ar(out,\n EnvGen.kr(Env.perc, gate: inTrig, levelScale: inTrig) * SinOsc.ar\n )\n}).play(s, [\\out, 0, \\busnum, b.index]);\n\n\nb.set(1.0);\n\nb.value = 1.0;\n\nb.value = 0.2;\n\nb.value = 0.1;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// default initial params\n{ LinCongL.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// default initial params\n{ LinCongL.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// UnitTestScript(\"Collapse\", thisProcess.nowExecutingPath).runScript;\n\n{\n |test|\n var collapseValues = List();\n var collapse;\n\n collapse = Collapse({ |v| collapseValues.add(v) }, 0.1);\n\n collapseValues.clear;\n\n collapse.value(1);\n test.assert(collapseValues.isEmpty, \"Collapse doesn't exec immediately\");\n\n 1.wait;\n test.assertEquals(collapseValues.array, [1], \"Collapse execs eventually\");\n\n collapseValues.clear;\n [1, 2, 3, 4, \"last\"].do { |i| collapse.(i); 0.05.wait };\n 1.wait;\n test.assertEquals(collapseValues.array, [\"last\"], \"Collapse only execs last value.\");\n\n collapseValues.clear;\n [\"first\", \"second\", \"last\"].do { |i| collapse.(i); 0.2.wait };\n test.assertEquals(collapseValues.array, [\"first\", \"second\", \"last\"], \"Collapse execs all values.\")\n\n};\n```"}, {"role": "assistant", "content": "UnitTestScript(\"Collapse\", thisProcess.nowExecutingPath).runScript;."}]} +{"conversations": [{"role": "user", "content": "What does `Date.resolve` do?"}, {"role": "assistant", "content": "Resolve any inconsistencies in the Date object, updating all the fields (in particular `dayOfWeek` and `rawSeconds`) as necessary. If the instance properties (`year`, `month`, `day`, `hour`, `minute`, `second`) are modified, the Date will be in an inconsistent state — its `rawSeconds` won't reflect the modifications, and the properties may fall outside of \"normal\" ranges (`month: 1-12, day:1-31, hour: 0-23, minute/second: 0-59`). Also, using the string conversion methods may"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// You'll only hear the front two channels on a stereo setup.\n\n{ Pan4.ar(PinkNoise.ar, FSinOsc.kr(2), FSinOsc.kr(1.2), 0.3)) }.play;\n\n\n{ Pan4.ar(PinkNoise.ar, -1, 0, 0.3) }.play; // left pair\n{ Pan4.ar(PinkNoise.ar, 1, 0, 0.3) }.play; // right pair\n{ Pan4.ar(PinkNoise.ar, 0, -1, 0.3) }.play; // back pair\n{ Pan4.ar(PinkNoise.ar, 0, 1, 0.3) }.play; // front pair\n\n{ Pan4.ar(PinkNoise.ar, 0, 0, 0.3 }.play; // center\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// You'll only hear the front two channels on a stereo setup.\n\n{ Pan4.ar(PinkNoise.ar, FSinOsc.kr(2), FSinOsc.kr(1.2), 0.3)) }.play;\n\n\n{ Pan4.ar(PinkNoise.ar, -1, 0, 0.3) }.play; // left pair\n{ Pan4.ar(PinkNoise.ar, 1, 0, 0.3) }.play; // right pair\n{ Pan4.ar(PinkNoise.ar, 0, -1, 0.3) }.play; // back pair\n{ Pan4.ar(PinkNoise.ar, 0, 1, 0.3) }.play; // front pair\n\n{ Pan4.ar(PinkNoise.ar, 0, 0, 0.3) }.play; // center\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// For most cases the symmetric symplectic procedures with prefix 'sym' should be used (default 'sym2').\n// They deliver best results with regard to long-term stability, see links at top.\n// In case you suspect instability coming from numerics \n// you can take symplectic variants of higher order: \n// \\sym2, \\sym4, \\sym6, \\sym8, \\sym12, \\sym16, \\sym32, \\sym64.\n\n// Note that already a simple harmonic oscillator can fail with a standard procedure\n\n// This is decaying after a few seconds with classical Runge-Kutta 3rd order !\n// ATTENTION: with other non-symplectic procedures this can lead to immediate blow\n// …\n```"}, {"role": "assistant", "content": "For most cases the symmetric symplectic procedures with prefix 'sym' should be used (default 'sym2'). They deliver best results with regard to long-term stability, see links at top. (Fb1_ODE: general ordinary differential equation integrator pseudo ugen)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = { Ringz.ar(T2A.ar(\\trig.tr), \\freq.kr(500, 1), 0.8) }.play;\na.set(\\freq, 330, \\trig, 1);\na.set(\\freq, 830, \\trig, 1;\na.release;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = { Ringz.ar(T2A.ar(\\trig.tr), \\freq.kr(500, 1), 0.8) }.play;\na.set(\\freq, 330, \\trig, 1);\na.set(\\freq, 830, \\trig, 1);\na.release;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// won't work (the output is 0.5*0.0), which is why we need the DC UGen!\n{ 0.5 }.play\n\n// constantly zero\n{ DC.ar(0.0) }.play;\n\n\n// DC offset; will click on start and finish\n{ DC.ar(0.5) + SinOsc.ar(440, 0, 0.1) }.play;\n\n\n// test - note the transient before LeakDC adapts and suppresses the offset\n{ LeakDC.ar(DC.ar(0.5) }.play;\n\n\n// show scope\ns.scope\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// won't work (the output is 0.5*0.0), which is why we need the DC UGen!\n{ 0.5 }.play\n\n// constantly zero\n{ DC.ar(0.0) }.play;\n\n\n// DC offset; will click on start and finish\n{ DC.ar(0.5) + SinOsc.ar(440, 0, 0.1) }.play;\n\n\n// test - note the transient before LeakDC adapts and suppresses the offset\n{ LeakDC.ar(DC.ar(0.5)) }.play;\n\n\n// show scope\ns.scope\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for some pattern exprimenting: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\brumm, { |dur = 1, pan = 2, freq = 40, index = 20|\n var sig = Pan2.ar(\n Blip.ar(freq, index),\n pan\n ) * EnvGen.ar(Env.perc(0.01, dur), doneAction: 2);\n Out.ar(0, sig);\n}).add;\n);\n\n(\nPbind(*[\n dur: Pseq([1.2, 0.2, 0.5, Pseries(0.1, -0.001, 100)], inf),\n pan: Pxrand(#[-0.5, 0.5, 0.1, -0.1, 0.8, -1], inf),\n freq: 40,\n instrument: \\brumm\n]).play();\n);\n\n(\nPbind(*[\n dur: Pseq([1.2, 0.2, 0.5, Pseries(0.1, -0.001, 100)], inf),\n pan: Pxrand(#[-0.5, 0.5, 0.1, -0.1, 0.8, -1], inf),\n freq: Pseq([Pseries(140, 0.5, 200)], inf),\n instrument: \\brumm\n]).play;\n);\n\n(\nPbind(*[\n dur: Pseq(Signal.chebyFill(1024, Array.rand(10, 0.0, 10.0)).abs + 0.05, inf),\n pan: Pxrand(#[-0.5, 0.5, 0.1, -0.1, 0.8, -1], inf),\n freq: Pseq(Signal.chebyFill(1024, Array.rand(10, 0.0, 10.0)).abs * 18000 + 120, inf),\n instrument: \\brumm\n]).play;\n);\n\n\n(\nPbind(*[\n dur: Pseq([1.2, 0.2, 0.5, Pseries(0.1, -0.002, 50)], inf),\n pan: Pxrand(#[-0.5, 0.5, 0.1, -0.1, 0.8, -1, 1, -0.8], inf),\n freq: Pseq([Pseries(740, 0.5, 200), Pxrand(Array.series(740, 0.5, 200), 50)], inf),\n instrument: \\brumm\n]).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Annotations.guiFindBus` do? What arguments does it take?"}, {"role": "assistant", "content": "stores names and notations for Nodes, identifying the Node's owner and its purpose Arguments: index; rate; layout."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BufRateScale`."}, {"role": "assistant", "content": "```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n(\nx = { |rate = 1|\n BufRd.ar(1, b, Phasor.ar(0, BufRateScale.kr(b) * rate, 0, BufFrames.kr(b)))\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Pen.rotate` do?"}, {"role": "assistant", "content": "Rotates subsequent drawing around the Point `x@y` by the amount angle in radians"}]} +{"conversations": [{"role": "user", "content": "Explain `TrigSpec` in SuperCollider briefly."}, {"role": "assistant", "content": "TrigSpec — datatype specifying a 'trig' rate input or output Category: Spec, Libraries > crucial > Spec."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for SOUND 1, from orig Influx Example. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// SOUND 1, from orig Influx Example\n(\nNdef(\\dog).addSpec(\\intv, [-24, 24]);\nNdef(\\dog).addSpec(\\timescale, [0.01, 10, \\exp]);\nNdef(\\dog).addSpec(\\curve, [-10, 10]);\nNdef(\\dog).addSpec(\\ffreq, \\freq);\n\nNdef(\\dog).addSpec(\\loopnode, [0, 12]);\nNdef(\\dog).addSpec(\\dens, [10, 1000]);\nNdef(\\dog).addSpec(\\resfreq, \\freq);\nNdef(\\dog).addSpec(\\ringtime, [0.01, 1, \\exp]);\n\nNdef(\\dog, { |amp=0, freq=250, intv=19, timescale=1, curve=0, loopnode=0, dens = 10, resfreq = 500, ringtime = 0.01|\n var n = 15;\n var env = EnvGen.kr(\n Env({ 1.0.rand2 }!(n+1), {1.0.rand}!n, curve, releaseNode: n-1, loopNode: loopnode.min(n-3)),\n timeScale: timescale);\n var pitch = (env * [1, 0.33, -1] * intv).midiratio * freq;\n var form = Formant.ar(pitch, pitch.rotate(1) * 1.6, pitch.rotate(2) * 2.6);\n\n var dusty = Ringz.ar(\n Dust.ar(dens!3),\n (resfreq * LFNoise0.kr([3, 5, 7], 0.5, 1)).lag(0.3),\n ringtime)\n * ((dens ** -0.5) * (ringtime ** -0.3)\n );\n\n Splay.ar(form * dusty, level: amp * 4) ;\n});\n);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SinOscFB`."}, {"role": "assistant", "content": "```supercollider\n{ SinOscFB.ar(440, MouseX.kr(0, 4))*0.1 }.play\n\n\n{ SinOscFB.ar(MouseY.kr(10, 1000, 'exponential'), MouseX.kr(0.5pi, pi))*0.1 }.play\n\n\n{ SinOscFB.ar(100*SinOscFB.ar(MouseY.kr(1, 1000, 'exponential'))+200, MouseX.kr(0.5pi, pi))*0.1 }.play\n\n\n// Scope the wave form\n{ SinOscFB.ar([400, 301], MouseX.kr(0, 4), 0.3) }.scope;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// 2012.05.04\n// Work for NX014 Class\n// Inspiration: A Rukano Tweet. Thanks rukano!\n// Comment: Cosmic Organ.\n\np = ProxySpace.push(s.boot);\n\n~a.play;\n\n~a = { var alpha,gamma;\n alpha= LFNoise2;\n gamma= {[rrand(30,50),rrand(50,70),rrand(50,70),rrand(70,100)].choose.midicps*alpha.kr(1,0.01,1)}!24;\n Pan2.ar(LeakDC.ar(Normalizer.ar(\n BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(FreeVerb.ar(\n Splay.ar(RLPF.ar(LFSaw.ar(gamma)/4,gamma*LFCub.kr(rrand(0.01,0.1),0,2,3),alpha.kr(1/8,0.6,0.7))) \n ,0.1,0.1,0.1)\n ,100,6.0,6),1000,6.0,0),5000,6.0,0),10000,6.0,6)\n ,(0.8/0.999)*1,0.1)),0)\n};\n\n~a = nil;\n```"}, {"role": "assistant", "content": "A cosmic organ with a inspiration of rukano tweet. Thanks rukano!."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(//*********PREPARE**********\np.pop;\n//Any code that needs to access your own environment goes here\np = ProxySpace.push(s);\n~fxLoop.play.fadeTime_(5);\n);\n\n(//*********FXLoop**********\n~fxLoop = {\n var in = SoundIn.ar([0,1]);\n // in = in + (in * SinOsc.ar(LFTri.ar([0.1, 0.09]).range(215, 321)));\n in = in + CombC.ar(in, 2, SinOsc.ar(0.015).range(0.5, 1) * [0.13, 0.17], 7);\n in = in + CombC.ar(in, 2, SinOsc.ar(0.01).range(0.5, 1) * [0.1, 0.15], 7);\n in = in + CombC.ar(in, 2, [1.5, 1.0], 7);\n in = in + GVerb.ar(in, 10);\n in = in / 3;\n in;\n}\n)\n```"}, {"role": "assistant", "content": "Audio Sample: https://soundcloud.com/schemawound/supercollider-guitar-fx-test."}]} +{"conversations": [{"role": "user", "content": "What does `RedBitStream.new` do? What arguments does it take?"}, {"role": "assistant", "content": "stream bits Arguments: collection — An Array of integers.; byte — Number of bits per byte in this collection of integers. If byte is 8 then integers should not be greater than 255.."}]} +{"conversations": [{"role": "user", "content": "What does `Formant.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Formant oscillator Arguments: fundfreq — Fundamental frequency in Hertz. (control rate); formfreq — Formant frequency in Hertz. (control rate); bwfreq — Pulse width frequency in Hertz. Controls the bandwidth of the formant. (control rate) Must be greater than or equal to `fundfreq`.; mul; add."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Pgtpar` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// synthdef\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n}).add;\n);\n\n// pattern with different start times\n(\nx = Pbind(\n \\instrument, \\help_sinegrain,\n \\degree, Pseq(#[0, 5, 4, 2, 1, 1, 3], inf),\n \\dur, Pseq(#[0.25, 0.5, 1.0], inf),\n \\scale, #[0, 3, 5, 9, 10]\n);\na = Pbus(Pgtpar([0.0, x, 1.5, x, 2.25, x])).play;\n);\ns.plotTree;\na.stop;\n```"}]} {"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// nOut allows for switching between iteration levels up to maximum n\n\n(\ny = {\n |nOut = 10|\n GFIS.ar({ |x| sin(LFDNoise1.ar(20).range(3, 3.5) * x) }, [0.2, 0.3], 10, nOut) * 0.1\n}.play\n);\n\n\ny.set(\\nOut, 9)\n\ny.set(\\nOut, 8)\n\ny.release\n\n\n// it can be passed an array of levels, \n// the resulting multichannel signal can e.g. be used for crossfaded switching with DXMix\n\n// switch between 3 mono signals and double them\n\n(\ny = {\n var src = GFIS.ar({ |x| sin(LFDNoise3.ar(30).\n// …\n```"}, {"role": "assistant", "content": "nOut allows for switching between iteration levels up to maximum n it can be passed an array of levels, (GFIS: generalized functional iteration synthesis pseudo ugen)"}]} -{"conversations": [{"role": "user", "content": "What is the difference between Line and XLine?"}, {"role": "assistant", "content": "Both are ramps: `Line.kr(start, end, dur, mul, add, doneAction)` moves linearly, `XLine.kr(...)` moves exponentially in a fixed ratio per unit time. Use Line for amplitude and XLine for frequency or any parameter you hear logarithmically — a linear frequency sweep sounds like it rushes at the top and crawls at the bottom. Both take doneAction, so both can end a Synth."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Many patterns controlling a single synth."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\sawFilt, { |out = 0, freq = 440, amp = 0.1, gate = 1, cf = 100, wobble = 3, t_bd, t_sd, pw = 0.4|\n var base = Splay.ar(RLPF.ar(Pulse.ar(freq * [0.99,0.5,1.01],pw),cf.lag(0.05),0.3).madd(SinOsc.ar(wobble).range(0.5,4)).sin) * 0.5;\n var env = Linen.kr(gate, attackTime: 0.01, releaseTime: 0.5, doneAction: 2);\n var sig = base;\n var bd = tanh(Ringz.ar(LPF.ar(Trig.ar(t_bd,SampleDur.ir),1000),30,0.5,5).sin*2);\n var sd = tanh(Ringz.ar(LPF.ar(Trig.ar(t_sd,SampleDur.ir),1000),120,0.75,PinkNoise.ar(2!2)).sin*2);\n sd = HPF.ar(sd,60);\n sig = tanh(GVerb.ar(HPF.ar(base * env,30), 70, 11, 0.15)*0.5 + sig + bd + sd);\n Out.ar(out, sig*amp*env);\n}).add;\n);\n\n(\np = Pproto(\n {\n ~id = (\n type: \\on,\n dur: 0,\n instrument: \\sawFilt,\n amp: 1,\n ).yield[\\id];\n ~type = \\set;\n },\n Ppar([\n Pbind(\n \\args, #[freq],\n \\freq, Pseq([49,47,50,48]-12,inf).midicps,\n \\dur, 4,\n ),\n Pbind(\n \\args, #[cf],\n \\cf, Pseq([100,Prand([700,400,1100],3)],inf),\n \\stutter, Prand([1,2,4,8],inf),\n \\dur, PdurStutter(Pkey(\\stutter)*2, 2),\n // NOTE: also useful is .collect on patterns!\n // \\dur, Prand([1,2,4,8], inf).collect{ |x| (1/x)!(x*2) }.flatten\n ),\n Pbind(\n \\args, #[wobble],\n \\wobble, Pxrand([3,1.5,6],inf),\n \\dur, Prand([2,1],inf),\n ),\n Pbind(\n \\args, #[t_bd],\n \\t_bd, Pseq([1,0,0,1],inf),\n \\dur, 0.5,\n ),\n Pbind(\n \\args, #[t_sd],\n \\t_sd, Pseq([0,0,1,0],inf),\n \\dur, 0.5,\n ),\n Pbind(\n \\args, #[pw],\n \\pw, Prand([0.4,0.3,0.5],inf),\n \\dur, 2,\n ),\n ])\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SimpleNumber.quantize` do? What arguments does it take?"}, {"role": "assistant", "content": "Deprecated. Round the receiver to the quantum. If you're looking for MIDI quantization type features use Arguments: quantum — amount.; tolerance — allowed tolerance.; strength — Determines how much the value is allowed to differ in the tolerance range.."}]} -{"conversations": [{"role": "user", "content": "What does `InstrBrowser.gui` do? What arguments does it take?"}, {"role": "assistant", "content": "Browse your instrument library, with customizable actions Arguments: layout; bounds."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for LFDNoise Modular version?"}, {"role": "assistant", "content": "```supercollider\n(\n~lfd={\n var signal, myFrequency, frequencyMin=0.1, frequencyMax=30, myAmplitude, amplitudeMin=0.01, amplitudeMax=0.6, myPhase, phaseMin=0, phaseMax=1.5;\n myFrequency = Array.fill(2, {[rrand(frequencyMin, frequencyMax)]});\n myAmplitude = Array.fill(2, {[rrand(amplitudeMin, amplitudeMax)]});\n myPhase = Array.fill(2, {[rrand(phaseMin, phaseMax)]});\n signal = LeakDC.ar([LFDNoise1, LFDNoise0, LFDNoise3, LFDClipNoise].choose.ar(myFrequency, myPhase, myAmplitude));\n Out.ar(0, signal);\n};\n);\n\n~lfd.scope\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\na = Environment.make({\n ~a = 100;\n ~b = 200;\n ~c = 300;\n});\na.postln;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\na = Environment.make({\n ~a = 100;\n ~b = 200;\n ~c = 300;\n});\na.postln;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `RedInterpolator.new` do? What arguments does it take?"}, {"role": "assistant", "content": "holds a value and interpolates to new target Arguments: value — Start value.; tick — Update rate / resolution.; clock — If no clock passed in the SystemClock will be used.."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Just a dirty FM bass shuffling?"}, {"role": "assistant", "content": "```supercollider\n(\nfork{\n SynthDef(\\basicFM, {|out = 0, gate = 1, amp = 1, carFreq = 1000, modFreq = 100, modAmount = 2000, clipAmount = 0.1|\n var modEnv = EnvGen.ar(Env.adsr(0.5, 0.5, 0.7, 0.1, peakLevel: modAmount), gate);\n var mod = SinOsc.ar(modFreq) * modEnv;\n var car = SinOsc.ar(carFreq + mod);\n var ampEnv = EnvGen.ar(Env.adsr(0.1, 0.3, 0.7, 0.2, peakLevel: amp), gate, doneAction: 2);\n var clip = clipAmount * 500;\n Out.ar(out, (car * ampEnv * clip).clip(-0.7, 0.7) * 0.1);\n }).add;\n\n s.sync;\n\n Pbind(*[\n instrument: \\basicFM,\n out: [0, 1],\n dur: Pseq([1/7, 1/3] / 1.2, inf),\n sustain: Pkey(\\dur),\n amp: 1/4,\n carFreq: Pseq([1, 1, 1, 2] * 350, inf),\n modFreq: Pkey(\\carFreq) * (1/8),\n modAmount: Pseq([2, 1, 0.5, 2, 1, 0.5, 2, 1, 2, 1, 0.5, 2, 1, 0.5, 2, 4] * 500, inf),\n clipAmount: Pseq([Pn(0.1, 32), Pn(1, 32)], inf)\n ]).play;\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// given a UGen graph ...\n(\n{ Splay.ar(SinOsc.ar({ exprand(300.0, 10000.0) } ! 17, 0, { 1.0.rand } ! 17)) * 0.1 }.play\n);\n\n// ... all existing UGen inputs can be replaced or modified with an arbitrary function\n// e.g. with a modulator\n(\n{\nBend({ |in|\n in * LFDNoise3.kr(MouseX.kr(0.1, 200, 1), 0.1, 1)\n}, {\n Splay.ar(SinOsc.ar({ exprand(300.0, 10000.0) } ! 17, 0, { 1.0.rand } ! 17))\n}) * 0.1\n}.play\n)\n```"}, {"role": "assistant", "content": "given a UGen graph ... ... all existing UGen inputs can be replaced or modified with an arbitrary function (Bend: UGen wrapper for code bending)"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n \n// definition for future reference in arbitrary Environments,\n// intervals grow together with base tone\n\n(\nq = PLexprand(\\lo, \\hi);\n\np = Pbind(\n \\midinote, 60 + q + PLtuple([0, q]),\n \\dur, 0.1\n);\n);\n\n\n// prepare current Environment\n\n(\n~lo = 0.1;\n~hi = 10;\n);\n\n\n// run\n\nx = p.play;\n\n\n// replace \n\n~hi = 20;\n\nx.stop;\n```"}, {"role": "assistant", "content": "definition for future reference in arbitrary Environments, intervals grow together with base tone (PLexprand: dynamic scope Pexprand variant)"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for minor scale filtered pulsewave demands?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n arg amp=0.1;\n var a, trig, basefreq, snd, cutoffmod, rqmod;\n \n a = Dseq([0, 2, 3, 5, 7, 8, 10, 12], inf);\n trig = Impulse.kr(4);\n basefreq = Demand.kr(trig, 0, a) + 38;\n basefreq = basefreq.midicps;\n cutoffmod = LFNoise2.ar(0.2).range(100,1500);\n rqmod = LFNoise2.ar(0.2).range(1,0.05);\n\n snd = (Pulse.ar(basefreq + 1 * SinOsc.kr(0.1.rand).range(0.99,1.010)) * amp) \n + (Pulse.ar(basefreq + 2 * SinOsc.kr(0.1.rand).range(0.99,1.010)) * amp) \n + (Pulse.ar(basefreq + 3 * SinOsc.kr(0.1.rand).range(0.99,1.01)) * amp)\n + (Pulse.ar(basefreq + 4 * SinOsc.kr(0.1.rand).range(0.99,1.01)) * amp)\n + (Pulse.ar(basefreq + 5 * SinOsc.kr(0.1.rand).range(0.99,1.01)) * amp)\n + (Pulse.ar(basefreq + 2 * SinOsc.kr(0.1.rand).range(0.99,1.010)) * amp) \n + (Pulse.ar(basefreq + 3 * SinOsc.kr(0.1.rand).range(0.99,1.01)) * amp)\n + (Pulse.ar(basefreq + 4 * SinOsc.kr(0.1.rand).range(0.99,1.01)) * amp)\n + (Pulse.ar(basefreq + 5 * SinOsc.kr(0.1.rand).range(0.99,1.01)) * amp)\n + (Pulse.ar(basefreq + 6 * SinOsc.kr(0.1.rand).range(0.99,1.01)) * amp);\n \n \n snd = LeakDC.ar(snd);\n snd = RLPF.ar(snd, cutoffmod, rqmod);\n snd = Limiter.ar(in: snd, level: 0.8, dur:0.001);\n snd.dup;\n \n}.play)\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LFPulse`."}, {"role": "assistant", "content": "```supercollider\n{ LFPulse.ar(XLine.kr(1, 200, 10), 0, 0.2, 0.1) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Saw` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\event_set, { |freq = 440, gate = 1, amp = 0.1, lagTime = 0.1,\n ffreq = 2000, detune = 1.005, out = 0|\n var sig = Saw.ar(Lag.kr(freq, lagTime) * [1, detune]).sum * amp\n * EnvGen.kr(Env.adsr, gate, doneAction: Done.freeSelf);\n Out.ar(out, sig ! 2);\n}).add;\n);\n\na = Synth(\\event_set);\n\n(\np = Pbind(\n \\type, \\set,\n \\id, a,\n \\instrument, \\event_set,\n \\args, #[],\n \\freq, Pexprand(200, 600, inf),\n \\dur, Pwhite(1, 5, inf) * 0.125\n).play;\n);\n\np.stop;\na.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Instr.test` do? What arguments does it take?"}, {"role": "assistant", "content": "creates a Patch, guis it and plays Arguments: ... args. Returns: a Patch"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// logistic map\n// equation: x1 = -r*x0^2 + r*x0\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n QuadC.ar(SampleRate.ir/4, r.neg, r, 0, 0.1) * 0.4;\n}.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// logistic map\n// equation: x1 = -r*x0^2 + r*x0\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n QuadC.ar(SampleRate.ir/4, r.neg, r, 0, 0.1) * 0.4;\n}.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `LinuxPlatform` in SuperCollider briefly."}, {"role": "assistant", "content": "LinuxPlatform — Linux platform-specific methods This class is available only on Linux, and implements Linux platform-specific methods. Category: Platform."}]} +{"conversations": [{"role": "user", "content": "What does `Event.playAndDelta` do?"}, {"role": "assistant", "content": "Used by EventStreamPlayer to play Events and obtain a time"}]} +{"conversations": [{"role": "user", "content": "What does `Method.primitiveName` do?"}, {"role": "assistant", "content": "Code that implements an operation upon instances of a Class. Returns: A Symbol which contains the name of the primitive function that implements the Method, if there is one."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SampleRate`."}, {"role": "assistant", "content": "```supercollider\n// compares a 441 Hz sine tone derived from sample rate (44100 * 0.01, left)\n// with a 440 Hz tone (right), resulting in a 1 Hz beating\n(\n{\n var freq;\n freq = [SampleRate.ir * 0.01, 440];\n SinOsc.ar(freq, 0, 0.1)\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `AbstractFunction`?"}, {"role": "assistant", "content": "AbstractFunction — An object which responds to a set of messages that represent mathematical functions"}, {"role": "user", "content": "What does `AbstractFunction.neg` do?"}, {"role": "assistant", "content": "`a = { 10.rand.postln }; b = a.neg; b.value;`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na = { |x, root = 60| x + root }; b = a.midicps; [a.value(9), b.value(9)];\na = Pseries(60, 1, inf).midicps; a.asStream.nextN(12);\n{ a = LFNoise1.ar(1) * 5 + 60; Pulse.ar(a.round.midicps) * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ LPF.ar(Saw.ar(100), SinOsc.kr(0.5).exprange(200, 2000)) * 0.2 }.play;\n```"}, {"role": "assistant", "content": "A sawtooth through a low-pass filter whose cutoff is swept slowly up and down — a classic filter\nsweep.\n\n- `Saw.ar(100)` is a 100 Hz sawtooth, rich in harmonics.\n- `SinOsc.kr(0.5)` is a control-rate sine at 0.5 Hz, so one full cycle takes 2 seconds.\n- `.exprange(200, 2000)` maps that -1..1 sine exponentially onto 200..2000 Hz — exponential is the right\n mapping for frequency, because we hear pitch logarithmically.\n- `LPF.ar(sig, cutoff)` removes harmonics above the cutoff; as it opens and closes you hear the tone\n brighten and darken.\n- `* 0.2` keeps the output from clipping."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// For more SynthDefs and examples please head to: https://mycelialcordsblog.wordpress.com/ \n\n(\nSynthDef(\\hasherTest,\n{\narg rate = 1, freq = 60, index = 1000, tRate = 100,\nout = 0, fRate = 0.1;\n\nvar t_trig = LFPulse.kr(0.5/fRate, 0.5);\nvar random = LFNoise0.ar(rate, add:1);\nvar noise = Hasher.ar(random);\nvar sound = Saw.ar((freq+(noise*index)), Decay.kr(Impulse.kr(tRate), noise*0.001)).tanh;\nsound = Pan2.ar(sound, noise-0.3*2);\nFreeSelf.kr(t_trig);\nOut.ar(out, sound);\n}).store;\n);\n\n(\nPbind(\n\\instrument, \\hasherTest,\n\\dur, 5,\n\\rate, Pfuncn({100.rand}, inf),\n\\freq, Pfuncn({10000.rand}, inf),\n\\index, Pfuncn({20000.rand}, inf),\n\\tRate, Pfuncn({1000.rand}, inf),\n\\fRate, 5,\n).play;\n)\n```"}, {"role": "assistant", "content": "It is a simple SynthDef I made after having a look at Hasher UGen with a pattern to play it. It creates nice and varied glitch sounds."}]} +{"conversations": [{"role": "user", "content": "What does `PSVop_o.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new PSVop_o Arguments: genList — An array of generators and corresponding offsets. Allowed generators: Integers, Streams or Patterns producing intervals or Sieves itself. Integers and Stream/Pattern output must be strictly positive. Integers as generators produce zero and its positive multiples. Offsets must be integers.; op — One of the Symbols 'u', 's', 'sd', 'd' as abbreviations for set operations 'union', 'sect', 'symdif', 'dif' or a Pattern/Stream to produce such. Defaults to 'u'.; difIndex — Integer or a Pattern/Stream to produce such. Determines the generator from which will be subtracted in case of operation 'dif'. Defaults to 0.; maxLength — Integer. Maximum number of items, which the stream will return. Defaults to inf.; limit — Integer. Limit up to which integers can be returned by the stream. If no limit is passed, returned integers might go up to default limit 65536.."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `IdentityDictionary`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_sinegrain, { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0.5pi, env))\n}).add;\n\na = Pbind(\\instrument, \\help_sinegrain, \\note, Pseq([0, 7, 2, 9, 11, 10, 9, 8], inf), \\dur, 1);\na.play(quant: (quant: 1, phase: 0));\na.play(quant: (quant: 1, phase: 1/3));\na.play(quant: (quant: 1, phase: 1.0.rand));\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `IdentityBag`?"}, {"role": "assistant", "content": "IdentityBag — A Bag according to identity"}, {"role": "user", "content": "What does `IdentityBag.add` do?"}, {"role": "assistant", "content": "Add anObject to the Bag. A Bag may contain multiple entries of the same object. `IdentityBag[1, 2, 3].add(4);`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nIdentityBag[1, 2, 3].add(4);\nIdentityBag[1, 2, 3].add(3);\nIdentityBag[\"abc\", \"def\", \"ghi\"].add(\"jkl\");\nIdentityBag[\"abc\", \"def\", \"ghi\"].add(\"def\");\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// the following two lines produce equivalent results\n{ SinOsc.ar(440, 0, 0.3) }.play(fadeTime: 0.0);\nSynthDef(\\help_FuncPlay, { Out.ar(0, SinOsc.ar(440, 0, 0.3)) }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// the following two lines produce equivalent results\n{ SinOsc.ar(440, 0, 0.3) }.play(fadeTime: 0.0);\nSynthDef(\\help_FuncPlay, { Out.ar(0, SinOsc.ar(440, 0, 0.3)) }).play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Padd`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, gate = 1|\n var env;\n env = EnvGen.kr(Env.asr(0.001, 1, 0.2), gate, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain, \\freq, 440);\nb = Padd(\\freq, Pseq([10, 30, 100], inf), a);\nb.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Event.removeEventType` do? What arguments does it take?"}, {"role": "assistant", "content": "Remove an event type function from the collection. If there is an associated event type parent, this will be removed Arguments: type — A name (usually a symbol) for the event type.."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `RandID` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// start a noise patch and set the id of the generator\n(\nSynthDef(\"help-RandID\", { |out = 0, id = 1|\n RandID.ir(id);\n Out.ar(out,\n WhiteNoise.ar(0.05) + Dust2.ar(70)\n )\n}).add;\n);\n\n// reset the seed of my rgen at a variable rate\n(\nSynthDef(\"help-RandSeed\", { |seed = 1910, id = 1|\n RandID.kr(id);\n RandSeed.kr(Impulse.kr(FSinOsc.kr(0.2, 0, 10, 11)), seed);\n}).add;\n\n);\n\n// start two noise synths on left and right channel with a different randgen id\na = Synth(\"help-RandID\", [\\out, 0, \\id, 1]);\nb = Synth(\"help-RandID\", [\\out, 1, \\id, 2]);\n\n// reset the seed of randgen 1\nx = Synth(\"help-RandSeed\", [\\id, 1]);\n\n// change the target randgen to 2 (affects right channel)\nx.set(\\id, 2);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for attempt at emulating a breathing sound. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\n//s.options.memSize_(64000);\nTempoClock.tempo_(1.0);\n\ns.waitForBoot({\n SynthDef(\\breathe_in, {\n | out = 0, gate = 1, in1=0.11, in2=0.63, in3=0.18, amdb= -10 |\n var menv = EnvGen.kr(Env.new([0,1,1,0],[in1, in2, in3], curve:'lin'),\n gate,\n doneAction:Done.freeSelf);\n var noise = WhiteNoise.ar(amdb.dbamp);\n var f1 = BPF.ar(in:noise, freq:5790, rq:0.1, mul:-29.dbamp);\n var f2 = BPF.ar(in:noise, freq:3400, rq:0.2, mul:-16.dbamp);\n var f3 = BPF.ar(in:noise, freq:1990, rq:0.1, mul:-23.dbamp);\n var f4 = BPF.ar(in:noise, freq:1250, rq:0.1, mul:-26.dbamp);\n Out.ar(out, menv*(f1+f2+f3+f4)!2);\n }).add;\n\n SynthDef(\\breathe_out, {\n | out = 0, gate=1, out1=0.343, out2=0.387, amdb= -4.33 |\n var menv = EnvGen.kr(Env.new([0, 1, 0], [out1,out2], curve:'lin'),\n gate,\n doneAction:Done.freeSelf);\n var noise = WhiteNoise.ar(amdb.dbamp);\n var f1 = BPF.ar(in:noise, freq:2290, rq:0.1, mul:-17.dbamp);\n var f2 = BPF.ar(in:noise, freq:1290, rq:0.1, mul:-19.dbamp);\n var f3 = BPF.ar(in:noise, freq:490, rq:0.1, mul:-18.dbamp);\n Out.ar(out, menv*(f1+f2+f3)!2);\n }).add;\n\n\n s.sync;\n\n fork {\n 50.do({\n var in1 = 0.11.rrand(0.22);\n var in2 = 0.6.rrand(0.8);\n var in3 = 0.16.rrand(0.30);\n var pausein = 0.11.rrand(0.20);\n var out1 = 0.30.rrand(0.50);\n var out2 = 0.36.rrand(0.50);\n var pauseout = 0.11.rrand(0.20);\n var amdb = -10.0.rrand(-14.0);\n var amdb2 = amdb/2.5;\n //(\"in1: \" ++ in1 ++ \" in2: \" ++ in2 ++ \" in3: \" ++ in3 ++ \" pausein: \" ++ pausein ++ \" out1: \" ++ out1 ++ \" out2: \" ++ out2 + \" pauseout: \" ++ pauseout).postln;\n Synth(\\breathe_in, [\\in1, in1, \\in2, in2, \\in3, in3, \\amdb, amdb]);\n (in1+in2+in3+pausein).wait;\n Synth(\\breathe_out, [\\out1, out1, \\out2, out2, \\amdb, amdb2]);\n (out1+out2+pauseout).wait;\n });\n };\n\n});\n);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Resonz`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"pitchFromNoise\", { arg out = 0;\n Out.ar(\n out,\n Resonz.ar(\n WhiteNoise.ar(15),\n LFNoise0.kr(2, 110, 660),\n 0.005\n )\n )\n}).add;\n);\n\n\n(\nSynth(\"ringModulation\");\nSynth(\"pitchFromNoise\", [\\out, 1]);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// default initial params\n{ FBSineN.ar(SampleRate.ir/4) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// default initial params\n{ FBSineN.ar(SampleRate.ir/4) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What is `PLPZ1` in SuperCollider?"}, {"role": "assistant", "content": "PLPZ1 — UGenPatterns quark library Based on LPZ1 Category: Streams-Patterns-Events > UGenPatterns > Modifiers."}]} +{"conversations": [{"role": "user", "content": "What does `TreeViewItem.setString` do? What arguments does it take?"}, {"role": "assistant", "content": "Sets the text in the given data Arguments: column — An integer index of a data field.; string — A String or nil.."}]} +{"conversations": [{"role": "user", "content": "Explain `Gate` in SuperCollider briefly."}, {"role": "assistant", "content": "Gate — Gate or hold. Allows input signal value to pass when gate is positive, otherwise holds last value. Category: UGens > Triggers."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `FoldIndex`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// indexing into a table\n(\n{\n var buf = LocalBuf.newFrom([200, 300, 400, 500, 600, 800]);\n var freq = FoldIndex.kr(buf, MouseX.kr(0, BufFrames.ir(buf) * 3));\n SinOsc.ar(freq) * 0.1\n}.play;\n);\n\n// the same using a global buffer\n(\nt = [200, 300, 400, 500, 600, 800];\nb = Buffer(s, t.size, 1);\n\n// alloc and set the values\ns.listSendMsg(b.allocMsg(b.setnMsg(0, t)).postln);\n\nSynthDef(\\help_Index, { |out = 0, bufnum = 0|\n Out.ar(out,\n SinOsc.ar(\n FoldIndex.kr(\n bufnum,\n MouseX.kr(0, BufFrames.ir(bufnum) * 3)\n ),\n 0,\n 0.5\n )\n )\n}).play(s, [\\bufnum, b.bufnum]);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `FPSignal.storePrevious` do?"}, {"role": "assistant", "content": "Implementation of Functional Reactive Programming."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = WhiteNoise.ar; // a WhiteNoise\nb = a + 2; // a BinaryOpUGen.\nb.operator; // +\n\n// sound example\n(\n{\n var a = LFSaw.ar(300);\n var b = LFSaw.ar(329.1);\n a % b * 0.1\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = WhiteNoise.ar; // a WhiteNoise\nb = a + 2; // a BinaryOpUGen.\nb.operator; // +\n\n// sound example\n(\n{\n var a = LFSaw.ar(300);\n var b = LFSaw.ar(329.1);\n a % b * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "I get 'Node not found' when I call .set on a Synth after a while."}, {"role": "assistant", "content": "The Synth was freed and the language still holds a reference. That happens whenever the SynthDef used `doneAction: 2` and the envelope finished, or when something called `freeAll`/`CmdPeriod`. Guard it with `if (x.notNil and: { x.isPlaying }) { x.set(\\freq, 300) }`, or store the node in a variable that you clear when it ends. For sustained sounds the right pattern is a `gate` argument with `doneAction: 2` on the EnvGen, so the node lives until you release it."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Pwrap` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Pn(\n Pwrap(\n Pgeom(200, 1.07, 96),\n 200,\n 1000.0\n ),\n inf\n);\nx = a.asStream;\n\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, x.next.debug, \\dur, 0.3]);\n 0.12.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nb = SoundFile.collectIntoBuffers(\"yourSoundFileFolder/*\"); // By Bjørn Houdorf, December 21, 2012\n\n(\n{\nvar number = b.numChannels, randomNumber, trigger, delayed, panned, sound, mixedSound, rotatedSound;\ntrigger = Dust.kr(Array.fill(number,1), 1, -0.5); // Generates random impulses from -0.5 to 0.5. as a excitation function\nrandomNumber = TRand.kr(1, number, trigger);\nsound = PlayBuf.ar(Array.fill(number,1) ,randomNumber,1,trigger,0,0); // play sound files\ndelayed = DelayL.ar(sound, trigger, trigger); // delaying the sound files\npanned = Pan2.ar(delayed, Array.fill(number,{1.0.rand2})); // pan them out in the stereo field\nmixedSound = 0.05*Mix.new(panned);// and mix them to one stereo signal\nrotatedSound = Rotate2.ar(mixedSound[0], mixedSound[1], LFSaw.kr(0.05)); // rotate stereo signal\n}.play; // play it all\n)\n```"}, {"role": "assistant", "content": "Put your sound files in the sound file folder. The code plays random sound files panned out in the stereo field. A swarm of sound files."}]} +{"conversations": [{"role": "user", "content": "How do I make a delay line?"}, {"role": "assistant", "content": "`CombN.ar(in, maxdelaytime, delaytime, decaytime)` is a feedback delay: maxdelaytime is the buffer size, delaytime the actual delay (and it can modulate), decaytime how long the repeats take to die. For a clean single echo use `DelayN.ar(in, maxdelaytime, delaytime)`, which has no feedback. Both replace the `in` with the delayed signal, so mix with the dry: `dry + CombN.ar(dry, 0.5, 0.3, 2) * 0.4`."}]} +{"conversations": [{"role": "user", "content": "How big are you?"}, {"role": "assistant", "content": "198M parameters in total, 64M active per token because the feed-forward layers are a mixture of four experts with top-1 routing. That is small enough to train in minutes on one GPU."}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nMix.ar([SinOsc.ar(220, 0, 0.1), SinOsc.ar(330, 0, 0.1)])\n```"}, {"role": "assistant", "content": "Sums two sine waves into one signal — a perfect fifth, 220 Hz and 330 Hz, at 0.1 amplitude each.\n\n`[SinOsc.ar(220, 0, 0.1), SinOsc.ar(330, 0, 0.1)]` is an Array of two audio-rate signals (each UGen\nreturns a signal; an array of them is just a list). `Mix.ar` adds the elements together. The alternative\n`+` operator does the same for two signals, and `Splay.ar` would spread them across the stereo field\ninstead of summing them."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `NodeProxy`."}, {"role": "assistant", "content": "```supercollider\nb = NodeProxy.new.play;\nb.source = { PinkNoise.ar(0.2.dup) };\n// now I want to filter b through a new proxy.\na = NodeProxy.new;\na <-- b; a.source = { HPF.ar(b.ar, 7000) };\na.source = { HPF.ar(b.ar, 3000) }; // changing the source\na.clear; b.clear;\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `IdentityDictionary`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_sinegrain, { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0.5pi, env))\n}).add;\n\na = Pbind(\\instrument, \\help_sinegrain, \\note, Pseq([0, 7, 2, 9, 11, 10, 9, 8], inf), \\dur, 1);\na.play(quant: (quant: 1, phase: 0));\na.play(quant: (quant: 1, phase: 1/3));\na.play(quant: (quant: 1, phase: 1.0.rand));\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Using sine waves to generate a saw waveform. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\nq={|f,e|a=Array.fill(e,{|j|e-j}).reverse;(Mix.ar(a.collect{|x|SinOsc.ar(f*x,0,1/x)})/2)!2};{q.(60,300)}.play //saw from sine #supercollider\n\n//Change the values passed to q to control the frequency and how many sines are used.\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `MouseY`."}, {"role": "assistant", "content": "```supercollider\n{ SinOsc.ar(MouseY.kr(40, 10000, 1), 0, 0.1) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\envfol;\n~description = \"Envelope follower (audio rate)\";\n~channelLayout = \\mono;\n~function = {|in = 0, decaycoeff = 0.99, amp = 10.0, lpf = 20 |\n var env, out;\n in.scope;\n env = LPF.ar(PeakFollower.ar(in), lpf, mul: 50, add:-1);\n env.scope;\n env;\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\Mirror;\n~description = \"Mirror soundfield\";\n\n~function = {|in = 0, order = 1, mirrorFrontBack = 0, mirrorLeftRight = 0, mirrorUpDown = 0 |\nHOATransMirror.ar(order, in, mirrorFrontBack, mirrorLeftRight, mirrorUpDown);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "What does `Sieve.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new Sieve object in mode Arguments: gen — A generator. Allowed generators: Integers, Streams or Patterns producing intervals or Sieves itself. Integers and Stream/Pattern output must be strictly positive. Integers as generators produce zero and its positive multiples.; limit — An integer limit, which is included when reached. If no limit is passed, returned integers might go up to default limit 65536.."}]} +{"conversations": [{"role": "user", "content": "What is `Platform`?"}, {"role": "assistant", "content": "Platform — handle cross-platform differencies"}, {"role": "user", "content": "What does `Platform.case` do?"}, {"role": "assistant", "content": "Perform actions depending on the current platform (name), just like Object:switch: `Platform.case(`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// start a server program from the cmdLine for testing\n~pid = unixCmd(Server.program + s.options.asOptionsString(57100));\n// kill just that server program by its pid:\nthisProcess.platform.killProcessByID(~pid);\n```"}]} {"conversations": [{"role": "user", "content": "What are the arguments of EnvGen?"}, {"role": "assistant", "content": "`EnvGen.ar(envelope, gate, levelScale, levelBias, timeScale, doneAction)` — or the .kr form. Envelope is an Env; gate is the signal that holds the envelope open (a number for a one-shot, a trigger or gate control for a sustained sound); levelScale and levelBias scale and offset the output; timeScale stretches durations. Use `doneAction: 2` on a one-shot so the Synth frees itself."}]} -{"conversations": [{"role": "user", "content": "What does `UserView.frameRate` do? What arguments does it take?"}, {"role": "assistant", "content": "The interval at which the view regularly redraws itself, if #-animate is `true`. You can change the desired frame rate by setting this variable. The default frame rate is Arguments: fps — A Float defining the interval between frames of animation, in frames per second.."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n \n// definition for future reference in arbitrary Environments\n\nq = PLhprand(\\lo, \\hi);\n\n\n// prepare current Environment\n// PLseq repeats arg defaults to inf\n\n(\n~lo = 60;\n~hi = PLseq((92..62));\n);\n\n\n\n// run\n\n(\ny = Pbind(\n \\midinote, Ptuple(q!5), \n \\dur, 0.1,\n \\amp, 0.05\n).play;\n);\n\n\n// replace, converging bounds\n\n(\n~lo = PLseq((40..70) ++ (70!5));\n~hi = 70.5;\n);\n\ny.stop;\n```"}, {"role": "assistant", "content": "definition for future reference in arbitrary Environments prepare current Environment (PLhprand: dynamic scope Phprand variant)"}]} +{"conversations": [{"role": "user", "content": "What does `NRand.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Sum of uniform distributions. Arguments: lo — Lower limit of the output range.; hi — Upper limit of the output range.; n."}]} +{"conversations": [{"role": "user", "content": "What does `SystemClock.clear` do?"}, {"role": "assistant", "content": "Clear the SystemClock's scheduler to stop it."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Looping sampler with crossfading. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\\simpler, {\n arg buf=0\n ,freq=220\n ,sampleStart=0\n ,loopStart=0\n ,loopLen=1 // between 0 (min) and 1 (max)\n ,fadeTime=0.1\n ,gate=1\n ,attack=0.01\n ,sustain=1\n ,release=1\n ,f0=220;\n\n var rate = freq / f0;\n var sr = rate*BufSampleRate.kr(buf);\n var fadeFrames = fadeTime*sr;\n var loopEnd = loopLen*(BufFrames.kr(buf) - loopStart) + loopStart;\n var loopFrames = loopEnd - loopStart + 1;\n var loopTime = (loopFrames - fadeFrames)/sr;\n var startUpTime = (loopStart - sampleStart)/sr;\n\n var trigLoop = TDuty.ar(Dseq([startUpTime + loopTime, Dseq([loopTime], inf)]), gapFirst:1);\n\n var phaseA = Phasor.ar(trigLoop, rate, sampleStart, inf, loopStart);\n var phaseB = Phasor.ar(trigLoop, rate, loopEnd - fadeFrames, inf, loopEnd - fadeFrames);\n\n var srcA = BufRd.ar(buf.numChannels, buf, phaseA);\n var srcB = BufRd.ar(buf.numChannels, buf, phaseB);\n\n var startLoop = SetResetFF.ar(trigLoop);\n var loopPan = Phasor.ar(trigLoop, 2/fadeFrames * rate, -1, inf, -1).clip(-1,1);\n\n var out = Select.ar(startLoop, [srcA, LinXFade2.ar(srcB, srcA, pan:loopPan)]);\n var env = EnvGen.ar(Env.asr(attack, sustain, release, 1), gate, doneAction:2);\n\n Out.ar(0, Splay.ar(out) * env);\n}).add;\n\n// Try it out:\n~buf = Buffer.read(s, Platform.resourceDir +/+ 'sounds/a11wlk01.wav');\n\nPdef(\\p, Pbind(*[\n instrument: \\simpler\n ,buf: ~buf\n ,octave: Prand([3,4,5],inf)\n ,degree: Pn(Plazy({Pseq([-4,0,5,7,9,12].scramble.clump(2),2)}))\n ,dur: 0.5\n ,strum: Prand([0, 0.125, 0.25], inf)\n ,strumEndsTogether: false\n ,loopStart: Pwhite(90000, 150000)\n ,sampleStart: Pwhite(50000, 85000)\n ,loopLen: 0.4\n ,fadeTime: 0.15\n ,attack: 0.25\n ,release: 4\n])).play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LPZ2`."}, {"role": "assistant", "content": "```supercollider\n// Compare:\n\n{ WhiteNoise.ar(0.25) }.play;\n\n{ LPZ2.ar(WhiteNoise.ar(0.25)) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\nx = SynthDef(\"help-node-set\", { |freq = 440, out = 0|\n Out.ar(out, SinOsc.ar(freq, 0, 0.1))\n}).play\n);\nx.run(false;\nx.run; // default is true\nx.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\nx = SynthDef(\"help-node-set\", { |freq = 440, out = 0|\n Out.ar(out, SinOsc.ar(freq, 0, 0.1))\n}).play\n);\nx.run(false);\nx.run; // default is true\nx.free;\n```"}]} {"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\delay;\n~description = \"Simple delay line\";\n~channelLayout = \\mono;\n~function = {|in = 0, del = 0.5|\n DelayC.ar(in, 2, del);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\FuMaIn;\n~description = \"A live ambisonic input (ACN_FuMa)\";\n~channelLayout = \\ambi;\n\n~function = { |order = 1, t_trig = 0, bus = 0|\n var env = EnvGen.kr(Env([0,1], [1]), t_trig);\n var chans = Array.series(\n size: (order + 1).pow(2).asInteger,\n start: bus,\n step: 1\n );\n var input = SoundIn.ar(chans, env);\n HOAConverterFuma2AcnN3d.ar(order, input);\n}\n```"}, {"role": "assistant", "content": "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see ."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// with a completion message\ns.boot;\n(\nSynthDef(\\help_Buffer, { |out = 0, bufnum|\n Out.ar(out,\n PlayBuf.ar(1, bufnum, BufRateScale.kr(bufnum))\n )\n}).add;\n\ny = Synth.basicNew(\\help_Buffer); // not sent yet\nb = Buffer.readNoUpdate(s, ExampleFiles.child,\n completionMessage: { |buffer|\n // synth add its s_new msg to follow\n // after the buffer read completes\n y.newMsg(s, [\\bufnum, buffer], \\addToTail)\n });\n;\n// note vars not accurate\nb.numFrames; // nil\nb.updateInf\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// with a completion message\ns.boot;\n(\nSynthDef(\\help_Buffer, { |out = 0, bufnum|\n Out.ar(out,\n PlayBuf.ar(1, bufnum, BufRateScale.kr(bufnum))\n )\n}).add;\n\ny = Synth.basicNew(\\help_Buffer); // not sent yet\nb = Buffer.readNoUpdate(s, ExampleFiles.child,\n completionMessage: { |buffer|\n // synth add its s_new msg to follow\n // after the buffer read completes\n y.newMsg(s, [\\bufnum, buffer], \\addToTail)\n });\n);\n// note vars not accurate\nb.numFrames; // nil\nb.updateInfo;\nb.numFrames; // 188893\n// when done...\ny.free;\nb.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Nil`."}, {"role": "assistant", "content": "```supercollider\n// for Nil: return the argument unmodified (an event).\nnil.transformEvent((x: 8));\n// for Dictionary (and thus for Event): add to the argument.\n(y: 100, z: 1).transformEvent((x: 8));\n// for Association: add the association to the event\n(\\a -> \\x).transformEvent((x: 8));\n// for Function: use the function receive the event as argument.\n{ |event| event.use { ~x = ~x + 1 }; event }.transformEvent((x: 8));\n```"}]} -{"conversations": [{"role": "user", "content": "How do I make a delay line?"}, {"role": "assistant", "content": "`CombN.ar(in, maxdelaytime, delaytime, decaytime)` is a feedback delay: maxdelaytime is the buffer size, delaytime the actual delay (and it can modulate), decaytime how long the repeats take to die. For a clean single echo use `DelayN.ar(in, maxdelaytime, delaytime)`, which has no feedback. Both replace the `in` with the delayed signal, so mix with the dry: `dry + CombN.ar(dry, 0.5, 0.3, 2) * 0.4`."}]} -{"conversations": [{"role": "user", "content": "What does `RedHuffman.compress` do?"}, {"role": "assistant", "content": "Compresses an array into a string of binary numbers. Creates a #*tree and a #*dict as"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Convolution2L`."}, {"role": "assistant", "content": "```supercollider\n// longer crossfade\n(\nSynthDef(\\conv_test2, { |out, kernel, t_trig = 0|\n var input = Impulse.ar(1);\n var framesize = 2048; // must have power of two\n var result = Convolution2L.ar(input, kernel, t_trig, 2048, 5, 0.5);\n Out.ar(out, result);\n}).add\n);\n\nx = Synth(\\conv_test2, [\\kernel, b]);\n\n// changing the buffer number:\nx.set(\\kernel, c);\nx.set(\\t_trig, 1); // after this trigger, the change will take effect.\nx.set(\\kernel, d);\nx.set(\\t_trig, 1); // after this trigger, the change will take effect.\n\nd.zero;\n\n40.do { |it| d.set(20 * it + 10, 1) }; // changing the buffers' contents\n\nx.set(\\t_trig, 1); // after this trigger, the change will take effect.\n\nx.set(\\kernel, b);\nx.set(\\t_trig, 1); // after this trigger, the change will take effect.\n\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nb = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n\n(\n{\n var snd, envTime, knee, out;\n snd = PlayBuf.ar(1, b, BufRateScale.kr(b), loop: 1);\n envTime = MouseX.kr(1.0e-3, 0.1e-3);\n knee = MouseY.kr(0, -90).dbamp;\n out = DelayC.ar(snd, 0.01, envTime * 0.5) * EnvFollow.ar(snd, 1 - (envTime * SampleRate.ir).reciprocal).max(knee).reciprocal;\n out * 0.1!2\n}.play;\n)\n```"}, {"role": "assistant", "content": "a replication of the legendary LADSPA plugin of the same name, originally written by steve harris. a compressor with a super fast attack which results in harsh distortion fx. requires sc3-plugins."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Semideterministic JitLib Code for Experimental Livecoding."}, {"role": "assistant", "content": "```supercollider\n// NX102\n// 2012-08-07_23_05_45\n\n// La ment no té límits.\n\n// Use with Jitlib:\n\np = ProxySpace.push(s.boot);\n\n// Read one sample on your collection:\n\nb = Buffer.read(s,Platform.userAppSupportDir +/+\"/audio/a11wlk01.wav\",bufnum:1);\n\n// Play and fun:\n\n~nx102.play;\n\n~nx102 = {\n Pan2.ar(LeakDC.ar(Normalizer.ar(\n BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(FreeVerb.ar(\n RHPF.ar(RLPF.ar(\n Pulse.ar(\n (PlayBuf.kr(1,1,Rand(50,100),1,0,1)*Rand(100,1000)).clip(\n Rand(5,12),Rand(12,20))) \n ,Rand(100,5000),Rand(0.005,0.1))\n ,Rand(5000,20000),Rand(0.005,0.1))\n ,0.0,0.0,0.0)\n ,100,6.0,6),1000,6.0,0),5000,6.0,0),10000,6.0,6)\n ,(1.25/0.999)*1.0,0.1)),0)\n};\n\n~nx102 = nil;\nb.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `AbstractFunction.>>` do?"}, {"role": "assistant", "content": "`a = { [2r10010, 2r101011, 2r11100].choose.postln"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain);\nb = Paddpre(\\freq, Pseq([10, 30, 100], inf), a);\nb.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain);\nb = Paddpre(\\freq, Pseq([10, 30, 100], inf), a);\nb.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\nq = ();\n(\n q.instructions = (\n \\NOP: 0,\n \\ORG: 1,\n \\EQU: 2,\n \\JMP: 3,\n \\JMPZ: 4,\n \\PSHL: 5,\n \\PSH: 6,\n \\PSHI: 7,\n \\POP: 8,\n \\POPI: 9,\n \\ADD: 10,\n \\SUB: 11,\n \\INC: 12,\n \\DEC: 13,\n \\AND: 14,\n \\OR: 15,\n \\XOR: 16,\n \\NOT: 17,\n \\ROR: 18,\n \\ROL: 19,\n \\PIP: 20,\n \\PDP: 21,\n \\DUP: 22,\n \\NOTE: 23,\n \\VOX: 24,\n \\STOP: 25\n );\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\nq = ();\n(\n q.instructions = (\n \\NOP: 0,\n \\ORG: 1,\n \\EQU: 2,\n \\JMP: 3,\n \\JMPZ: 4,\n \\PSHL: 5,\n \\PSH: 6,\n \\PSHI: 7,\n \\POP: 8,\n \\POPI: 9,\n \\ADD: 10,\n \\SUB: 11,\n \\INC: 12,\n \\DEC: 13,\n \\AND: 14,\n \\OR: 15,\n \\XOR: 16,\n \\NOT: 17,\n \\ROR: 18,\n \\ROL: 19,\n \\PIP: 20,\n \\PDP: 21,\n \\DUP: 22,\n \\NOTE: 23,\n \\VOX: 24,\n \\STOP: 25\n );\n\n q.translate = {|q, val|\n q.instructions[val] ?? {val}\n };\n\n q.makeCollection = {|q, program|\n program.collect{|instr| q.translate(instr)} ++ (0!(256 - program.size))\n };\n);\n\n// a saw wave generating program\nq.program = [\\ORG, \\INC, \\INC, \\JMP, 1];\n\n// load to a buffer\nb.loadCollection(q.makeCollection(q.program))\n\n{Demand.ar(Impulse.ar(20000), 0, DetaBlockerBuf(b.bufnum, 0))}.play\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for reqs: sc3-plugins."}, {"role": "assistant", "content": "```supercollider\n(\nfork {\n TempoClock.tempo = 1;//156/60;\n Ndef(\\ttso).play;\n loop {\n var seed = thisThread.randSeed = 100000000.rand.debug('seed');\n var wait = 20.rrand(60).debug('wait');\n Ndef(\\ttso, {\n var gamma= {[rrand(30,50),rrand(50,70),rrand(50,70),rrand(70,100)].choose.midicps*LFNoise2.kr(1,0.01,1)}!24;\n Pan2.ar(\n LeakDC.ar(\n Normalizer.ar(\n BPeakEQ.ar(\n FreeVerb.ar(\n Splay.ar(RLPF.ar(LFSaw.ar(gamma)/4,gamma*LFCub.kr(rrand(0.01,0.1),0,2,3),LFNoise2.kr(1/8,0.6,0.7))),\n 0.1,0.1,0.1\n ),\n [100.rrand(200),1000.rrand(2000),5000.rrand(7000),10000.rrand(15000)],Array.rand(4,0,6),Array.rand(4,0,6)\n ).mean,\n 0.8,0.1\n )\n ),\n LFNoise2.kr(0.1.exprand(10)).range(-0.1,0.1),\n SelectX.kr(\n [SinOsc,LFTri].choose.kr(2.rrand(25).reciprocal).range(0,2),\n [\n 0.7.rrand(1),\n LFGauss.kr(\n Latch.kr(\n LFNoise2.kr(1).range(1/5,5.rrand(20)).reciprocal, \n Impulse.kr(LFNoise2.kr(3.rrand(10).reciprocal).range(0.5,3.rrand(6)))\n ),\n SinOsc.kr(3.rrand(15).reciprocal).range(0.07.rrand(0.16),0.25.rrand(0.4))\n ),\n 0.1.rrand(0.5)\n ]\n )\n )\n }).fadeTime_(3.rrand(6));\n wait.wait;\n }\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `EaseOutInCirc.value` do? What arguments does it take?"}, {"role": "assistant", "content": "Circular ease-out/in Arguments: t — a Float between 0.0 and 1.0.."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n var saw, bpf;\n saw = Pulse.ar(\n freq: [100,150],\n mul: LFPulse.kr(\n freq: [0, 0.03, 0.04],\n width: 0.15));\n bpf = LPF.ar(in: saw, freq: SinOsc.kr(-10, -5, 3).range(200, 400));\n Out.ar(0, bpf);\n}.play;\n)\n```"}, {"role": "assistant", "content": "//Pulse is the UGen. There is multichannel expansion due to the lists in the freqs. The range is a big part of the reason this sounds so deep."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SequenceableCollection`."}, {"role": "assistant", "content": "```supercollider\n// using numbers as score\n[3, [1, 2, 1], 1].convertRhythm; // List[0.75, 1.5, 0.75]\n[2, [1, 3, [1, [2, 1, 1, 1]], 1, 3], 1].convertRhythm;\n[2, [1, [1, [2, 1, 1, 1]]], 1].convertRhythm;\n[2, [1, [1, [2, 1, 1, 1]]], 2].convertRhythm; // repeat\n[2, [1, [1, [2, 1, 1, -1]]], 2].convertRhythm; // negative value is tied over.\n\n// sound example\nPbind(\\degree, Pseries(0, 1, inf), \\dur, Pseq([2, [1, [1, [2, 1, 1, -1]]], 2].convertRhythm)).play;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// same as above, but we set the address to nil so we can receive from anywhere\n// no need for a NetAddr since we are just listening (and not sending)\n\no = OSCresponderNode(nil, '/test', { |t, r, msg| msg.postln }).add;\no.remove;\n```"}, {"role": "assistant", "content": "same as above, but we set the address to nil so we can receive from anywhere no need for a NetAddr since we are just listening (and not sending) (OSCresponderNode: client side network responder)"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Just going crazy with modulation."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"additivePad\", \n { arg numOfCycles = 100;\n var lfo;\n var lfo2;\n var lfo3;\n lfo = SinOsc.kr([Rand(0.5,1000),Rand(0.5,1000)], 1.5pi, 0.5, 0.5);\n lfo3 = SinOsc.kr([Rand(0.1,0.5),Rand(0.1,0.5)], 1.5pi, 0.5, 0.5);\n lfo2 = SinOsc.kr([(Rand(0.5,1000) * lfo) * lfo3, (Rand(0.5,1000) * (1 - lfo)) * (1 - lfo3)], 1.5pi, 0.5, 0.5);\n Out.ar(\n 0, \n Mix.arFill(\n numOfCycles,\n { \n SinOsc.ar(\n Rand(40,1000),\n 0, \n (numOfCycles.reciprocal * 0.75) * lfo2)\n }\n ) * EnvGen.kr(Env.perc(Rand(0.1,30), Rand(0.1,30)), doneAction: 2)\n )\n }\n).send(s); \n);\n\n(\nr = Routine({\n 200.do({\n x = Synth.new(\"additivePad\"); \n 10.wait;\n });\n});\n);\n\nr.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nDelayL.ar(z, 0.2, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\n(\n// recursive application of delay.\n{\nz = Decay2.ar(Dust.ar(1, 0.5), 0.01, 0.1, Saw.ar(100 + [0, 1]));\n5.do { |i| z = DelayL.ar(RLPF.ar(z, Rand(100, 3000), 0.03), 1, 1 / (2**i), 1, z * 0.5) };\nz\n}.play\n)\n```"}, {"role": "assistant", "content": "Dust randomly triggers Decay to create an exponential decay envelope for the WhiteNoise input source (DelayL: Simple delay line with linear interpolation.)"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// if NTMI.helloSnd is not already defined in startup file, do this:\nfork {\n NTMI.numChans.do { |i|\n { LFDNoise3.ar(\n XLine.kr(\n exprand(2000, 5000),\n exprand(2000, 20000),\n 0.25, doneAction: 2),\n 0.1\n )\n }.play(outbus: i);\n 0.25.wait;\n };\n}\n```"}, {"role": "assistant", "content": "if NTMI.helloSnd is not already defined in startup file, do this:."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n\n// definition for future reference in arbitrary Environments,\n// Cauchy distribution is not bounded, so do clip !\n\n(\np = Pbind(\n \\midinote, PLcauchy(\\mean, \\spread).clip(60, 90),\n \\dur, 0.1\n);\n);\n\n// prepare current Environment\n\n(\n~mean = 75;\n~spread = 0.1;\n);\n\n\n// run\n\nx = p.play;\n\n\n// move mean value and distribution\n// PLseq defaults to repeats = inf\n\n(\n~mean = PLseq((80, 79.7..70));\n~spread = PLseq([0,\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n\n// definition for future reference in arbitrary Environments,\n// Cauchy distribution is not bounded, so do clip !\n\n(\np = Pbind(\n \\midinote, PLcauchy(\\mean, \\spread).clip(60, 90),\n \\dur, 0.1\n);\n);\n\n// prepare current Environment\n\n(\n~mean = 75;\n~spread = 0.1;\n);\n\n\n// run\n\nx = p.play;\n\n\n// move mean value and distribution\n// PLseq defaults to repeats = inf\n\n(\n~mean = PLseq((80, 79.7..70));\n~spread = PLseq([0, 0, 0, 1]);\n);\n\nx.stop;\n```"}]} -{"conversations": [{"role": "user", "content": "What is the difference between a Synth and a SynthDef?"}, {"role": "assistant", "content": "A SynthDef is a definition: a compiled UGen graph with named controls, registered on the server once. A Synth is one running instance of that definition. You create the definition with `SynthDef(\\bell, { |freq = 440| ... }).add` and then instances with `Synth(\\bell, [\\freq, 660])`. Defining the same SynthDef twice replaces it for future instances; already running Synths keep the old graph until they are freed."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DC`."}, {"role": "assistant", "content": "```supercollider\n// won't work (the output is 0.5*0.0), which is why we need the DC UGen!\n{ 0.5 }.play\n\n// constantly zero\n{ DC.ar(0.0) }.play;\n\n\n// DC offset; will click on start and finish\n{ DC.ar(0.5) + SinOsc.ar(440, 0, 0.1) }.play;\n\n\n// test - note the transient before LeakDC adapts and suppresses the offset\n{ LeakDC.ar(DC.ar(0.5)) }.play;\n\n\n// show scope\ns.scope\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Function.valueArrayEnvir` do?"}, {"role": "assistant", "content": "Evaluates the FunctionDef referred to by the Function. If the last argument is an Array or List, then it is unpacked and appended to the other arguments (if any) to the Function. If the last argument is not an Array or List then this is the same as the 'value' method. Unsupplied argument names are looked up in the current"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `EnvGen`."}, {"role": "assistant", "content": "```supercollider\n{ PinkNoise.ar(EnvGen.kr(Env.perc, doneAction: Done.freeSelf)) }.play\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DrawGrid`."}, {"role": "assistant", "content": "```supercollider\n(\nx = [0, 10].asSpec.units_(\"sec\");\ny = [0, 1].asSpec.units_(\"amp\");\nd = DrawGrid((500@250).asRect, x.grid, y.grid);\n\n// set its properties before testing\nd.x.tickSpacing_(25);\nd.linePattern_(FloatArray[10.0, 5.0, 2.0, 5.0]);\n\n// generate a preview\n~testView = d.preview;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nPchain(\n Pbind(\\detune, Pseq([-30, 0, 40], inf), \\dur, Prand([0.2, 0.4], inf)),\n Pbind(\\degree, Pseq([1, 2, 3], inf), \\dur, 1)\n).trace.play;\n);\n\n\n// also events can be used directly:\n(\nPchain(\n Pbind(\\degree, Pseq([1, 2, 3], inf)),\n (detune: [0, 4])\n).trace.play;\n);\n\n// compose some more complicated patterns:\n(\nvar a, b;\na = Prand([\n Pbind(\\degree, Pseq([0, 1, 3, 5, 6])),\n Pbind(\\dur, Pshuf([0.4, 0.3, 0.3]), \\degree,\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nPchain(\n Pbind(\\detune, Pseq([-30, 0, 40], inf), \\dur, Prand([0.2, 0.4], inf)),\n Pbind(\\degree, Pseq([1, 2, 3], inf), \\dur, 1)\n).trace.play;\n);\n\n\n// also events can be used directly:\n(\nPchain(\n Pbind(\\degree, Pseq([1, 2, 3], inf)),\n (detune: [0, 4])\n).trace.play;\n);\n\n// compose some more complicated patterns:\n(\nvar a, b;\na = Prand([\n Pbind(\\degree, Pseq([0, 1, 3, 5, 6])),\n Pbind(\\dur, Pshuf([0.4, 0.3, 0.3]), \\degree, Pseq([3, -1]))\n], inf);\nb = Prand([\n Pbind(\\ctranspose, Pn(1, 4)),\n Pbind(\\mtranspose, Pn(2, 7))\n], inf);\nc = Prand([\n Pbind(\\detune, Pfuncn({ [0, 10.0].rand }, 5), \\legato, 0.2, \\dur, 0.2),\n Pbind(\\legato, Pseq([0.2, 0.5, 1.5], 2), \\dur, 0.3)\n], inf);\nPchain(a, b, c).trace.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for in the jungle."}, {"role": "assistant", "content": "```supercollider\n({\nvar nz = { |...args| LFDNoise3.kr(*args) };\nvar sig = Limiter.ar(\n BPF.ar(\n RHPF.ar(\n RLPF.ar(\n WhiteNoise.ar(nz.(1/[9,10],0.25,0.75)),\n nz.(5!2).exprange(1000, 2000),\n nz.(1/5!2).range(0.1,1)),\n nz.(5!2).exprange(50,150),\n nz.(1/5!2).range(0.1,1)),\n nz.(5!2).exprange(150,1000),\n nz.(1/5!2).range(0.1,1)))\n* LFGauss.ar([3,4],0.33) * LFGauss.ar(1/[4,9],0.25)\n* SinOsc.ar(Lag2UD.kr(Duty.kr(1,0,{Dibrown(300,2400,250)}!2),0.25,0.8));\nRotate2.ar(sig[0], sig[1], LFSaw.kr(1/5));\n}.play)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for tired pads."}, {"role": "assistant", "content": "```supercollider\n// this is what I write when I didn't sleep last night.. zzzzzz\n// easy subsynth with dynklank and simple scale\n\n(\n\nfork{ \n loop{\n var time;\n time = 5.rand;\n {\n var sound, freqs, envs, rings, numvoices, env;\n numvoices = 40;\n freqs = {(Scale.major(\\just).degrees+26+\n (0,12..110).choose).choose}.dup(numvoices).midicps;\n rings = {1.0.rand}.dup(numvoices);\n envs = { EnvGen.kr(Env.linen( time/3.0.rand, \n time/3.0.rand, time/3.0.rand, 1.0.rand ) ) }.dup(numvoices);\n \n sound = PinkNoise.ar(numvoices.reciprocal!2);\n sound = DynKlank.ar(`[freqs,envs,rings], sound );\n sound = sound * EnvGen.kr(Env.linen(time.rand,time/3,time.rand),doneAction:2);\n \n sound = HPF.ar(sound, 120);\n \n 4.do{sound = DelayC.ar(sound, 0.4, [0.4.rand,0.4.rand], 1/8, sound) };\n \n //good call - lets turn this down \n sound*0.2;\n }.play;\n time.rand.wait;\n }\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for muffled thump?"}, {"role": "assistant", "content": "```supercollider\n(\n{ var nse, env, kic;\n kic = tanh(Ringz.ar(LPF.ar(Trig.ar(Impulse.ar(1.0),SampleDur.ir),1000),30,0.25,7).sin*2);\n env = Env.perc(0.05, 1, 1, -4);\n nse = BrownNoise.ar(2) + PinkNoise.ar(0.5) * EnvGen.kr(env,Impulse.kr(1), doneAction: 2);\n\n nse = Mix.ar(BPF.ar(nse,[100,1200,80,40,20],MouseX.kr(0,1),[1,0.2,1,1,1]));\n nse = LPF.ar(nse + kic, MouseY.kr(100,1000))! 2\n\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for LFDNoise Modular version?"}, {"role": "assistant", "content": "```supercollider\n(\n~lfd={\n var signal, myFrequency, frequencyMin=0.1, frequencyMax=30, myAmplitude, amplitudeMin=0.01, amplitudeMax=0.6, myPhase, phaseMin=0, phaseMax=1.5;\n myFrequency = Array.fill(2, {[rrand(frequencyMin, frequencyMax)]});\n myAmplitude = Array.fill(2, {[rrand(amplitudeMin, amplitudeMax)]});\n myPhase = Array.fill(2, {[rrand(phaseMin, phaseMax)]});\n signal = LeakDC.ar([LFDNoise1, LFDNoise0, LFDNoise3, LFDClipNoise].choose.ar(myFrequency, myPhase, myAmplitude));\n Out.ar(0, signal);\n};\n);\n\n~lfd.scope\n```"}]} -{"conversations": [{"role": "user", "content": "What is `OnePole` in SuperCollider?"}, {"role": "assistant", "content": "OnePole — One pole filter. A one pole filter. Implements the formula: Category: UGens > Filters > Linear."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// default initial params\n{ LinCongC.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// default initial params\n{ LinCongC.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a plucked string in SuperCollider."}, {"role": "assistant", "content": "Pluck is a Karplus-Strong string: a noise burst into a tuned delay with feedback. The delay time is\nthe reciprocal of the frequency.\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 220, amp = 0.5, dur = 3|\n var period = freq.reciprocal;\n var sig = Pluck.ar(WhiteNoise.ar(0.2), Impulse.kr(0), period, period, dur, 0.5);\n Out.ar(out, Pan2.ar(sig * amp, 0));\n}).add;\n);\nSynth(\\pluck, [\\freq, 330, \\dur, 4]);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Dshuf.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Demand rate random sequence generator Arguments: list — array of values or other ugens; repeats — number of repeats."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `AudioIn`."}, {"role": "assistant", "content": "```supercollider\n// patching input to output\n\n// beware of the feedback\n\n(\nServerOptions.inDevices.postln; // post available audio input devices\ns.meter; // display level meters for monitoring\nSynthDef(\\helpAudioIn, { |out|\n var input = AudioIn.ar(1); // first input\n // delay output to tame feedback in case of microphones are configured:\n Out.ar(out, CombN.ar(input * -25.dbamp, 0.5, 0.5, 0.001))\n}).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LatoocarfianL`."}, {"role": "assistant", "content": "```supercollider\n// default initial params\n{ LatoocarfianL.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\ns.boot;\n// create a Synth at the head of the default Server's default group\n// based on the SynthDef \"default\"\nx = Synth.new(\"default\");\ns.queryAllNodes; // note the default group (ID 1)\nx.free;\n\n// Using an arrayed control\n// run this block first to make the SynthDef\n(\nSynthDef(\"help-synth\", { |freq = #[440, 450, 460], out = 0|\n Out.ar(out, Mix(SinOsc.ar(freq, 0, 0.1)));\n}).add;\n);\n\n// then this a short while later\nx = Synth(\"help-synth\", [freq: [500, 501, 510]]);\n\nx = Synth(\"help-synth\",\n// …\n```"}, {"role": "assistant", "content": "create a Synth at the head of the default Server's default group based on the SynthDef \"default\" (Synth: Client-side representation of a synth node on the server)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// try wiggling mouse quickly;\n// LFNoise frequently seems stuck, LFDNoise changes smoothly.\n\n{ SinOsc.ar(LFNoise1.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n{ SinOsc.ar(LFDNoise1.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFNoise1.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n\n{ LFDNoise1.ar(XLine.kr(2000, 20000, 8), 0.1 }.scope;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// try wiggling mouse quickly;\n// LFNoise frequently seems stuck, LFDNoise changes smoothly.\n\n{ SinOsc.ar(LFNoise1.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n{ SinOsc.ar(LFDNoise1.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFNoise1.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n\n{ LFDNoise1.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for simple smooth arp. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\smooth, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.linen(0.05, sustain, 0.1), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `PLbindef`?"}, {"role": "assistant", "content": "PLbindef — wrapper for Pbindef which allows replacement in object prototyping style"}, {"role": "user", "content": "What does `PLbindef.new` do?"}, {"role": "assistant", "content": "Creates a new PLbindef object or sets sources as with Pbindef."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n// synthdefs to play with\n\n(\nSynthDef(\\noise_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, rq = 0.1, amp = 0.1|\n var sig = { WhiteNoise.ar } ! 2;\n sig = BPF.ar(sig, freq, rq) *\n EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2) *\n (rq ** -1) * (250 / (freq ** 0.8));\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\sin_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { SinOsc.ar(freq, Rand(0, 2pi)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\saw_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { VarSaw.ar(freq, Rand(0, 1)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `NamedControl`?"}, {"role": "assistant", "content": "NamedControl — Named reference to a control"}, {"role": "user", "content": "What does `NamedControl.ar` do?"}, {"role": "assistant", "content": "add a new instance of AudioControl with given name and default values. If lags are given, apply a Lag UGen to it."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// use NamedControl to create a number of multichannel controls:\n\na = { SinOsc.ar(NamedControl.kr(\\freq, [300, 330, 370], [1, 0.3, 0.02])).sum * 0.1 }.play;\na.setn(\\freq, [700, 705, 890]);\na.setn(\\freq, [0, 2, 5].midiratio * 400);\n\n// synonymous:\na = { SinOsc.ar(\\freq.kr([300, 330, 370], [1, 0.3, 0.02])).sum * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `AbstractFunction.ring2` do?"}, {"role": "assistant", "content": "((a*b) + a + b) `({ [5, 6, 2].choose.postln } ring2: { [2, -1,"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\nvar noise, out;\nnoise = LFNoise0.kr(8);\n\nout = if( noise > 0.0,\n if(noise > 0.5, \n if(noise > 0.9, WhiteNoise.ar(0.2), Pulse.ar(60, 0.5, 0.4)),\n SinOsc.ar(500, 0, 0.25)\n ),\n Saw.ar(160, 0.5)\n);\n\nout ! 2\n\n}.play;\n)\n```"}, {"role": "assistant", "content": "A short, silly example of using if in a SynthDef. Using Select is generally a better thing to do."}]} +{"conversations": [{"role": "user", "content": "Write a snare drum in SuperCollider."}, {"role": "assistant", "content": "Two ingredients: a short tonal body and band-passed noise for the rattle.\n\n```supercollider\n(\nSynthDef(\\snare, { |out = 0, amp = 0.6|\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -6), doneAction: 2);\n var body = SinOsc.ar(180) * 0.4;\n var rattle = BPF.ar(WhiteNoise.ar, 1800, 0.4) * 3;\n Out.ar(out, Pan2.ar((body + rattle) * env * amp));\n}).add;\n);\nSynth(\\snare);\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// Here we start with initOutOffset = 0.5, fadeMode = 1 (step first),\n// channels with indices 0 and 4 (base tone and 5th partial) are equally weighted.\n\n(\nx = {\n var lfo = XLine.ar(1, 0.5, 60);\n DXMix.ar(\n Dseq([0, 4, 1, 5, 2, 6, 3, 7], inf),\n `(Saw.ar((1..8) * 70 * lfo, 0.075)),\n fadeTime: 0.1,\n stepTime: 2,\n fadeMode: 1,\n width: 3,\n maxWidth: 8,\n initOutOffset: 0.5\n ) ! 2\n}.play\n);\n\nx.release\n\n\n// overlap scheme with width = 3 and initOutOffset = 0.5:\n```"}, {"role": "assistant", "content": "Here we start with initOutOffset = 0.5, fadeMode = 1 (step first), channels with indices 0 and 4 (base tone and 5th partial) are equally weighted. (DXMix: crossfades between signals according to demand-rate control)"}]} +{"conversations": [{"role": "user", "content": "Who are you?"}, {"role": "assistant", "content": "I am sc-mind, a 198M MiniMind-3-MoE trained from scratch on the SuperCollider source and help corpus. I write and explain SuperCollider: SynthDefs, UGens, Patterns, Ndef, the language/server split, and how to make sound that is not silence."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `SoundIn` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\nu = Server(\\scau, NetAddr(\"127.0.0.1\", 9989)); // Change the port from 9989 to the right one for you\nu.serverRunning = true;\nu.ping(10); // Gives about 0.02 for me - confirms that communication is working\n// Now let's create a quick ring-modulator effect:\nz = { SoundIn.ar([0,1]) * SinOsc.ar(MouseX.kr(100, 1000)) }.play(u);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Patch.storeArgs` do?"}, {"role": "assistant", "content": "Pairs an Instr with inputs that that will be passed to the Instr"}]} +{"conversations": [{"role": "user", "content": "What does `SpruceBudworm.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Spruce bud worm model equations Arguments: reset — If > 0.0, restart with new initial conditions sampled from initx, inity; rate — update rate for a sample step; k1 — equation constant; k2 — equation constant; alpha — equation constant; beta — equation constant; mu — equation constant; rho — equation constant."}]} +{"conversations": [{"role": "user", "content": "What is `ParGroup`?"}, {"role": "assistant", "content": "ParGroup — Client-side representation of a parallel group node on the server"}, {"role": "user", "content": "What does `ParGroup.basicNew` do?"}, {"role": "assistant", "content": "Create and return a ParGroup object without creating a group node on the server. (This method is inherited from Node and is documented here only for convenience.)"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nfork {\n p = ParGroup.new;\n loop {\n (\n degree: rrand(0.0, 12.0).round(1/4),\n group: p,\n db: rrand(-30, -25),\n pan: rrand(-1.0, 1.0)\n ).play;\n 0.2.wait;\n }\n}\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Create a new empty collections with size 3:\nx = Array.new(3);\ny = Array.new(3);\nz = List.new(3);\n\n// Try to add 7 items to the array and list.\n// If the array exceeds maxSize, it will only\n// grow to an internally specified max size.\n(\n7.do { |i|\n x.add(i);\n y = y.add(i); // reassign array y on each add\n z.add(i);\n};\n);\n\n// Attempt to access the 5th item:\nx.at(4); // -> nil (out of bounds)\ny.at(4); // -> 4\nz.at(4); // -> 4\n\n// x grew only to size 4\nx.postln; // -> [ 0, 1, 2, 3 ]\ny.postln; // -> [ 0, 1, 2\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Create a new empty collections with size 3:\nx = Array.new(3);\ny = Array.new(3);\nz = List.new(3);\n\n// Try to add 7 items to the array and list.\n// If the array exceeds maxSize, it will only\n// grow to an internally specified max size.\n(\n7.do { |i|\n x.add(i);\n y = y.add(i); // reassign array y on each add\n z.add(i);\n};\n);\n\n// Attempt to access the 5th item:\nx.at(4); // -> nil (out of bounds)\ny.at(4); // -> 4\nz.at(4); // -> 4\n\n// x grew only to size 4\nx.postln; // -> [ 0, 1, 2, 3 ]\ny.postln; // -> [ 0, 1, 2, 3, 4, 5, 6 ]\nz.postln; // -> List[ 0, 1, 2, 3, 4, 5, 6 ]\n```"}]} +{"conversations": [{"role": "user", "content": "What does `RedHuffman.decompress` do?"}, {"role": "assistant", "content": "Decompresses a binary string into an array. Make sure you use the right #*tree and #*dict as generated by the compress"}]} +{"conversations": [{"role": "user", "content": "How to know the hardware buffer size?"}, {"role": "assistant", "content": "SuperCollider forum — How to know the hardware buffer size\n\nSay you want to use a UGen to control an external hardware device, independently of the soundcard. At first, one would think that this calculation is time-locked to the control rate, so e.g. at 1.5 kHz for a 48 kHz sample rate and a block size of 32.\n\nBut no, of course this calculation is time-locked to the hardware buffer size (I/O buffer size) of the soundcard you happen to use. EDIT: For a typical (low) setting, this is something like 256, so that would be about 190 Hz (5 ms). This may be too much delay for some applications, so we may want a smaller buffer size.\n\nIn scsynth, we can set a value for this size via ServerOptions:\n\n```supercollider\n // reduce to block size\ns.options.hardwareBufferSize = s.options.blockSize;\ns.reboot;\n```\n\nUnfortunately, not all soundcards support low block sizes. Also high quality sound cards may have very large ones, actually – this is a cultural thing, when you use them for recording, it is not a problem. But for live I/O it introduces delay (a quarter second is like an eternity then).\n\nSo now my question: how do I know if the above setting has been actually successful? How do I know what buffer size is current?\n\nI am sure that on different OSes there are ways to derive this in different ways. Maybe there is a way in supercollider as well?"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Pan2` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\ng = Group.new;\n\n// make 4 synths in g\n// 1.0.rand2 returns a random number from -1 to 1.\n4.do({ { arg amp = 0.1; Pan2.ar(SinOsc.ar(440 + 110.rand, 0, amp), 1.0.rand2) }.play(g); });\n\ng.set(\\amp, 0.005); // turn them all down\n\ng.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Who are you?"}, {"role": "assistant", "content": "I am sc-mind, a 198M MiniMind-3-MoE trained from scratch on the SuperCollider source and help corpus. I write and explain SuperCollider: SynthDefs, UGens, Patterns, Ndef, the language/server split, and how to make sound that is not silence."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Trig.ar(Dust.ar(1), 0.2) * FSinOsc.ar(800, 0.5) }.play\n\n{ Trig.ar(Dust.ar(4), 0.1 }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Trig.ar(Dust.ar(1), 0.2) * FSinOsc.ar(800, 0.5) }.play\n\n{ Trig.ar(Dust.ar(4), 0.1) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "What does `PBRZ2.new` do? What arguments does it take?"}, {"role": "assistant", "content": "UGenPatterns quark library Arguments: pattern; mul; add."}]} +{"conversations": [{"role": "user", "content": "What does `RedWindow.play` do?"}, {"role": "assistant", "content": "Starts an internal thread on the AppClock updating at rate"}]} +{"conversations": [{"role": "user", "content": "What is `EnvirGui` in SuperCollider?"}, {"role": "assistant", "content": "EnvirGui — display the contents of an environment for editing EnvirGui displays all keys and values of an environment, so one can change them flexibly. Single number get displayed with an EZSlider, pairs of numbers with an EZRanger, and anything else is shown as an EZText (a text field). Category: JITLib > GUI, Live Coding."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `SharedOut` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\n// only works with the internal server\ns = Server.internal;\ns.boot;\n);\n\n(\nSynthDef(\"help-SharedOut\", {\n SharedOut.kr(0, SinOsc.kr(0.2));\n}).add;\n);\n\n(\ns.sendMsg(\\s_new, \"help-SharedOut\", x = s.nextNodeID, 0, 1);\ns.sendMsg(\\n_trace, x);\n\n// poll the shared control bus\nRoutine({\n 30.do({\n s.getSharedControl(0).postln;\n 0.2.wait;\n });\n}).play;\n);\n\n\ns.quit;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Using sine waves to generate a saw waveform. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\nq={|f,e|a=Array.fill(e,{|j|e-j}).reverse;(Mix.ar(a.collect{|x|SinOsc.ar(f*x,0,1/x)})/2)!2};{q.(60,300)}.play //saw from sine #supercollider\n\n//Change the values passed to q to control the frequency and how many sines are used.\n```"}]} +{"conversations": [{"role": "user", "content": "When should I use a Pattern instead of writing Synth code by hand?"}, {"role": "assistant", "content": "Use a Pattern when what you want to express is a sequence over time — notes, durations, amplitudes, parameters — rather than a signal. A Pbind describes events, and `.play` turns each event into a Synth (by default of the \\default instrument, or of \\instrument if you name one). Hand-written Synth code is for the sound itself; Patterns are for what plays when. The two compose: a SynthDef named \\bell is triggered from `Pbind(\\instrument, \\bell, ...)`."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `OSCBundle`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// create a new, empty instance\na = OSCBundle.new;\n\n// a synthdef that needs to be sent to the server, an operation that is asynchronous,\n// i.e. we have to wait until it is finished.\nx = SynthDef(\"test\", { OffsetOut.ar(0, BPF.ar(Impulse.ar(4) * 10, Rand(9000, 1000), 0.1)) });\n// this is why addPrepare is used.\na.addPrepare([\"/d_recv\", x.asBytes]);\n// add is used with synchronous operations, like starting synths.\na.add([\"/s_new\", \"test\", -1]);\n\n// the bundle has now the synchronous separated from the asynchronous bundles:\na.messages;\na.preparationMessages;\n\n// this can be simply sent - the bundle takes care of the server client communication\n// like waiting for the synthdef to be loaded. the synth is started when the preparation\n// is finished.\n\ns.boot; // boot the server\na.send(s);\n\ns.freeAll; // free all nodes on the server\n\n// scheduled sending: the synths are started on the next beat.\n\na.schedSend(s, TempoClock.default, 1);\na.schedSend(s, TempoClock.default, 1);\na.schedSend(s, TempoClock.default, 1);\n\ns.freeAll; // free all nodes on the server\n\n// the bundle can contain several preparation messages and messages at a time.\n// the proparationMessages are sent first and only when they are all completed,\n// the other bundles are sent.\n// the bundle can also be reused, if there is no specific allocated buffers/node ids.\n```"}]} +{"conversations": [{"role": "user", "content": "What does `DetectIndex.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Search a buffer for a value Arguments: bufnum — index of the buffer; in — the input signal.. Returns: index of first occurrence of value, or -1 if value is not found."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nb = NodeProxy.new.play;\nb.source = { PinkNoise.ar(0.2.dup) };\n// now I want to filter b through a new proxy.\na = NodeProxy.new;\na <-- b; a.source = { HPF.ar(b.ar, 7000) };\na.source = { HPF.ar(b.ar, 3000 }; // changing the source\na.clear; b.clear;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nb = NodeProxy.new.play;\nb.source = { PinkNoise.ar(0.2.dup) };\n// now I want to filter b through a new proxy.\na = NodeProxy.new;\na <-- b; a.source = { HPF.ar(b.ar, 7000) };\na.source = { HPF.ar(b.ar, 3000) }; // changing the source\na.clear; b.clear;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DynKlank`."}, {"role": "assistant", "content": "```supercollider\n{ DynKlank.ar(`[[800, 1071, 1153, 1723], nil, [1, 1, 1, 1]], Impulse.ar(2, 0, 0.1)) }.play;\n\n{ DynKlank.ar(`[[800, 1071, 1353, 1723], nil, [1, 1, 1, 1]], Dust.ar(8, 0.1)) }.play;\n\n{ DynKlank.ar(`[[800, 1071, 1353, 1723], nil, [1, 1, 1, 1]], PinkNoise.ar(0.007)) }.play;\n\n{ DynKlank.ar(`[[200, 671, 1153, 1723], nil, [1, 1, 1, 1]], PinkNoise.ar([0.007, 0.007])) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "How do I add reverb with FreeVerb?"}, {"role": "assistant", "content": "`FreeVerb.ar(in, mix, room, damp)` — mix 0..1 is dry/wet, room 0..1 is the size (0.5 is a small room, 0.9 is a hall), damp 0..1 rolls off the high end of the tail. Put it after your sound: `FreeVerb.ar(SinOsc.ar(440) * 0.1, 0.4, 0.8, 0.5)`. For a send-style reverb, write the dry signal to Out.ar(0, …) and the same signal through FreeVerb to a second bus."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for SOUND 1, from orig Influx Example. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// SOUND 1, from orig Influx Example\n(\nNdef(\\dog).addSpec(\\intv, [-24, 24]);\nNdef(\\dog).addSpec(\\timescale, [0.01, 10, \\exp]);\nNdef(\\dog).addSpec(\\curve, [-10, 10]);\nNdef(\\dog).addSpec(\\ffreq, \\freq);\n\nNdef(\\dog).addSpec(\\loopnode, [0, 12]);\nNdef(\\dog).addSpec(\\dens, [10, 1000]);\nNdef(\\dog).addSpec(\\resfreq, \\freq);\nNdef(\\dog).addSpec(\\ringtime, [0.01, 1, \\exp]);\n\nNdef(\\dog, { |amp=0, freq=250, intv=19, timescale=1, curve=0, loopnode=0, dens = 10, resfreq = 500, ringtime = 0.01|\n var n = 15;\n var env = EnvGen.kr(\n Env({ 1.0.rand2 }!(n+1), {1.0.rand}!n, curve, releaseNode: n-1, loopNode: loopnode.min(n-3)),\n timeScale: timescale);\n var pitch = (env * [1, 0.33, -1] * intv).midiratio * freq;\n var form = Formant.ar(pitch, pitch.rotate(1) * 1.6, pitch.rotate(2) * 2.6);\n\n var dusty = Ringz.ar(\n Dust.ar(dens!3),\n (resfreq * LFNoise0.kr([3, 5, 7], 0.5, 1)).lag(0.3),\n ringtime)\n * ((dens ** -0.5) * (ringtime ** -0.3)\n );\n\n Splay.ar(form * dusty, level: amp * 4) ;\n});\n);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `BPF`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// synthdefs to play with\n(\nSynthDef(\\noise_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, rq = 0.1, amp = 0.1|\n var sig = { WhiteNoise.ar } ! 2;\n sig = BPF.ar(sig, freq, rq) *\n EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2) *\n (rq ** -1) * (250 / (freq ** 0.8));\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\sin_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { SinOsc.ar(freq, Rand(0, 2pi)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n\n\nSynthDef(\\saw_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { VarSaw.ar(freq, Rand(0, 1)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "How do I make an additive bell with Klank?"}, {"role": "assistant", "content": "Klank is a bank of resonant filters excited by a short impulse: you describe the partials as\nfrequencies, amplitudes and decay times.\n\n```supercollider\n(\nSynthDef(\\klank, { |out = 0, freq = 440, amp = 0.3|\n var ratios = [1, 2.2, 3.7, 5.1, 7.3];\n var decays = [4, 2.6, 1.8, 1.2, 0.8];\n var sig = Klank.ar(`[ratios * freq, nil, decays], Impulse.ar(0, 0, 0.2), 1, 0, 0.3);\n Out.ar(out, Pan2.ar(sig * amp, 0));\n}).add;\n);\nSynth(\\klank);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n///////////////////// beat accurate playing /////////////////////\n\n\n\n\na = NodeProxy.audio(s, 2);\na.play;\n\na.quant = 2.0; // quantize changes to the next 2.0-beat multiple\na.source = { Ringz.ar(Impulse.ar(0.5, 0, 0.3), 3000, 0.01) };\na[1] = { Ringz.ar(Impulse.ar([0.5, 1], 0, 0.3), 1000, 0.01) };\na[2] = { Ringz.ar(Impulse.ar([3, 5]/2, 0, 0.3), 8000, 0.01) };\na[3] = { Ringz.ar(Impulse.ar([3, 5]*16, 0, 0.3), 5000,\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n///////////////////// beat accurate playing /////////////////////\n\n\n\n\na = NodeProxy.audio(s, 2);\na.play;\n\na.quant = 2.0; // quantize changes to the next 2.0-beat multiple\na.source = { Ringz.ar(Impulse.ar(0.5, 0, 0.3), 3000, 0.01) };\na[1] = { Ringz.ar(Impulse.ar([0.5, 1], 0, 0.3), 1000, 0.01) };\na[2] = { Ringz.ar(Impulse.ar([3, 5]/2, 0, 0.3), 8000, 0.01) };\na[3] = { Ringz.ar(Impulse.ar([3, 5]*16, 0, 0.3), 5000, 0.01) * LFPulse.kr(0.5, 0, 0.05) };\n\na.removeLast;\na.removeAt(2);\n\na.clear;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `JITGui.nameView` do?"}, {"role": "assistant", "content": "(specific in the JITGui class) displays the object's key or name if"}]} +{"conversations": [{"role": "user", "content": "What does `ServerLogGui.guiMixedBundle` do? What arguments does it take?"}, {"role": "assistant", "content": "the interface for display and searching the ServerLog Arguments: mb. Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `ReplaceOut`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"ReplaceOutHelp\", { |out = 0, freq = 440|\n var source;\n source = SinOsc.ar(freq, 0, 0.1);\n\n // write to the bus, replacing previous contents\n ReplaceOut.ar(out, source);\n\n}).add;\n);\n\n// each Synth replaces the output of the previous one\nx = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 500]);\ny = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 600]);\nz = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 700]);\n\n// release them in reverse order; the older Synths are still there.\nz.free;\ny.free;\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\Identity;\n~description = \"Output the Ambisonics stream to outputs channels, useful for NRT rendering\";\n\n~function = {|in = 0|\nin;\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "What does `EZLists.insertItem` do? What arguments does it take?"}, {"role": "assistant", "content": "Inserts a list/menu item at index Arguments: index — An Integer. The index where to insert an item.; name — An instance of String or Symbol. The name of the list/menu item.; action — An instance of Function.."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `EnvGen` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// as amplitude envelope\n(\n{\n var env = Env([0, 1, 0.5, 1, 0], [0.01, 0.5, 0.02, 0.5]);\n SinOsc.ar(470) * EnvGen.kr(env, doneAction: Done.freeSelf)\n}.play\n);\n\n// as amplitude and modulation envelope\n(\n{\n var env = Env([0, 1, 0.5, 0.8, 0, 1.2, 0], [0.01, 0.5, 0.02, 0.5, 0.2, 0.5]);\n var gate = Impulse.kr(MouseX.kr(0.2, 3), 0.5);\n var gen = EnvGen.kr(env, gate);\n SinOsc.ar(270, SinOsc.ar(gen * 473)) * gen * 0.2\n}.play\n);\n// EnvGen multichannel expands when passed a multichannel envelope\n(\n{\n SinOsc.ar(\n EnvGen.kr(\n Env.circle([0, 1, 0, (2..4), 0, LFNoise1.kr(0.1 ! 5) * 10, 0], [0.01, 0.6])\n )\n * 240 + 300\n ).sum * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `InstrSpawner` in SuperCollider?"}, {"role": "assistant", "content": "InstrSpawner — a Pbind-like spawner that plays an Instr with streams supplied to its inputs a Pbind-like spawner that plays an Instr with streams supplied to its inputs. Category: Libraries > crucial > Instr, Libraries > crucial > Players."}]} +{"conversations": [{"role": "user", "content": "Explain `NetAddr` in SuperCollider briefly."}, {"role": "assistant", "content": "NetAddr — network address Category: Control, External Control > OSC."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// logistic map as frequency control\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n SinOsc.ar(QuadN.ar(40, r.neg, r, 0, 0.1, 800, 900)) * 0.4;\n}.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// logistic map as frequency control\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n SinOsc.ar(QuadN.ar(40, r.neg, r, 0, 0.1, 800, 900)) * 0.4;\n}.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n( //testing RecCutProc\nvar sf;\nvar rcdat;\n\nRoutine.run({\n\nsf= BBCutBuffer(Platform.resourceDir +/+ \"sounds/break.aiff\",8);\n\ns.sync;\n\n//argument 1-cut positions, 16 is wraparound, necessary for calculating differences\n//arg 2- offsets at any given of the 16 quantised positions along the sample length\n//arg 3- but cut up choosing blocks of size 3, 4, etc units (units must total 16 here)\n//units are taken across phraselength, so with phrase 8.0, one unit= 8.0/16= 0.5 = eighth notes\nrcdat= RCutData.new([0,4,7,10,12,15,16],[0\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n( //testing RecCutProc\nvar sf;\nvar rcdat;\n\nRoutine.run({\n\nsf= BBCutBuffer(Platform.resourceDir +/+ \"sounds/break.aiff\",8);\n\ns.sync;\n\n//argument 1-cut positions, 16 is wraparound, necessary for calculating differences\n//arg 2- offsets at any given of the 16 quantised positions along the sample length\n//arg 3- but cut up choosing blocks of size 3, 4, etc units (units must total 16 here)\n//units are taken across phraselength, so with phrase 8.0, one unit= 8.0/16= 0.5 = eighth notes\nrcdat= RCutData.new([0,4,7,10,12,15,16],[0,1,2,3, 4,5,6, 3,4,5, 8,9, 7,8,10, 10],[3,4,1,5,3]);\n\nBBCut2([CutBuf1(sf),CutMixer(0,1.0,1.0,panfunc:{0.7.rand2})],RecCutProc.new(rcdat,8.0)).play(2.3);\n\n});\n\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// With the indices arg arbitrary series from the buffer can be played.\n// Passing an array we define an index sequence which doesn't depend on lookBack\n\n(\n~lookBack = 0;\n\np = PSloop(\n Pbind(\n \\dur, Pn(Pshuf([1, 1, 2]/6)),\n \\midinote, Pseq((60..80), inf)\n ),\n bufSize: 10,\n lookBack: { ~lookBack },\n indices: [0, 1, 0, 1, 2, 0, 1, 2, 3]\n).trace.play\n);\n\n// wait a bit to fill buffer\n// start loop with useful lookBack (here > 3)\n\n~lookBack = 4\n\n~lookBack = 6\n\n\n// go on and loop again\n\n~lookBack = 0;\n\n~\n// …\n```"}, {"role": "assistant", "content": "With the indices arg arbitrary series from the buffer can be played. Passing an array we define an index sequence which doesn't depend on lookBack (PSloop: Pattern to derive loops from a given Pattern)"}]} +{"conversations": [{"role": "user", "content": "What does `FrameCompare.kr` do? What arguments does it take?"}, {"role": "assistant", "content": "calculates spectral MSE distance of two fft chains Arguments: buffer1 — FFT chain1; buffer2 — FFT chain2; wAmount — Influence of the weight matrix (should be between 0 and 1). Weight matrix helps to minimize errors on regions with more energy.."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// Evaluate this to start your project\n// The Cactus instnce is stored in c by convention\n\nc = CactusGUI(Document.current.dir).cactus; // with GUI\nc = Cactus(Document.current.dir); // without GUI\n\n/*\n\nAny folder with sound files you place in the buffers folder becomes available\nwith the following syntax:\n\n c.buffers.at(\"[folder_name]/[file_name_without_extension]\").play;\n\nYou can also access the folder as a List\n\n c.buffers.at(\"[folder_name]\");\n\n*/\n\n// You can use the dictionary at .at to store anything you like. For example:\n\nc.at[\\exampleVariable] = 10000.rand;\n\n// Get the value\n\nc.at[\\exampleVariable];\n```"}, {"role": "assistant", "content": "Evaluate this to start your project The Cactus instnce is stored in c by convention."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `RHPF`."}, {"role": "assistant", "content": "```supercollider\n{ RHPF.ar(Saw.ar(200, 0.1), FSinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3600, 4000), 0.2) }.play;\n\n(\n{ var ctl = RHPF.kr(LFSaw.kr(2), SinOsc.kr(XLine.kr(0.07, 30, 20), 0, 35, 40), 0.05);\n SinOsc.ar(ctl * 200 + 500);\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ LFPulse.ar(XLine.kr(1, 200, 10), 0, 0.2, 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ LFPulse.ar(XLine.kr(1, 200, 10), 0, 0.2, 0.1) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a snare drum in SuperCollider."}, {"role": "assistant", "content": "Two ingredients: a short tonal body and band-passed noise for the rattle.\n\n```supercollider\n(\nSynthDef(\\snare, { |out = 0, amp = 0.6|\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -6), doneAction: 2);\n var body = SinOsc.ar(180) * 0.4;\n var rattle = BPF.ar(WhiteNoise.ar, 1800, 0.4) * 3;\n Out.ar(out, Pan2.ar((body + rattle) * env * amp));\n}).add;\n);\nSynth(\\snare);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `AbstractFunction.even` do?"}, {"role": "assistant", "content": "An object which responds to a set of messages that represent mathematical functions"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// examples: args are // outs, amps, ins, vol, fadeTime\n\n{ Out.ar(87, SinOsc.ar(MouseX.kr(40, 10000, 1) * [1, 2, 3], 0, 0.2)) }.play;\nx = Monitor.new;\n\n(\nx.playN(\n [0, 1, 4], // to these outs\n [0.1, 0.4, 0.3], // with these volumes\n [87, 88, 89] // from these ins\n);\n);\n(\nx.playN(\n [0, [1, 3, 2], 4], // outs can be nested: 87 -> 0, 88 -> [1, 3, 2], 89 -> 4\n [0.1, [0.4, 0.2, 0.1], 0.3], // with nested volumes 0.1, [0\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// examples: args are // outs, amps, ins, vol, fadeTime\n\n{ Out.ar(87, SinOsc.ar(MouseX.kr(40, 10000, 1) * [1, 2, 3], 0, 0.2)) }.play;\nx = Monitor.new;\n\n(\nx.playN(\n [0, 1, 4], // to these outs\n [0.1, 0.4, 0.3], // with these volumes\n [87, 88, 89] // from these ins\n);\n);\n(\nx.playN(\n [0, [1, 3, 2], 4], // outs can be nested: 87 -> 0, 88 -> [1, 3, 2], 89 -> 4\n [0.1, [0.4, 0.2, 0.1], 0.3], // with nested volumes 0.1, [0.4, 0.2, 0.1], and 0.3\n [87, 88, 89]); // reading from these ins\n);\n// can also set global volume and fadetime\nx.playN(vol: 0.0, fadeTime: 4);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Array.lace` do?"}, {"role": "assistant", "content": "Returns a new Array whose elements are interlaced sequences of the elements of the receiver's subcollections, up to size length. The receiver is unchanged. `x = [[1, 2, 3], 6, List[\"foo\","}]} +{"conversations": [{"role": "user", "content": "What is `DataFile` in SuperCollider?"}, {"role": "assistant", "content": "DataFile — Write specs into File A tool for reading and writing data files. Category: Libraries > Radicles."}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for exploring of morphing cycled envelopes (i.e: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\ro_v19, {\n var freq = 40.rrand(90).debug('base freq');\n var seed = thisThread.randSeed = 1000000000.rand.debug('seed');\n var gen = [LFNoise2,LFNoise0,SinOsc,LFPulse,LFSaw];\n var sig = Splay.ar({\n var i = 4.exprand(40).asInteger;\n Median.ar(\n 3.exprand(18),\n EnvGen.ar(\n Env( // wave form\n [0] ++ Array.fill(i-1, { \n gen.choose.kr(\n 0.25.coin.if({ gen.choose.kr(0.01.exprand(0.1)).exprange(0.1,1) }, { 0.1.exprand(1) }), \n mul: 0.25.coin.if({ gen.choose.kr(0.05.exprand(10)).range(0.1,1) }, { 0.1.rrand(1) })\n )\n }) ++ [0],\n Array.rand(i-1, 0.1,1.0).normalizeSum,\n [[-5.0.rrand(5),\\sin].choose] ++ Array.fill(i-2, {\n [\\sin ! 1.rrand(6), -5.0.rrand(5) ! 1.rrand(4)].flat.choose\n }) ++ [[-5.0.rrand(5),\\sin].choose]\n ).circle,\n timeScale: Duty.kr( // freq\n Drand([4,8,16,24], inf), 0,\n Dwrand([1,2,4,8,16,32,64]*freq, ((14..7) ** 1.rrand(3)).normalizeSum, inf) // octave\n * 0.75.coin.if({ Duty.kr( // note\n [Dxrand, Drand].choose.new([0.125,0.25,0.5,1,2,4,6,8,12], inf), 0,\n Dshuf({ (0..11).choose.midiratio } ! 1.exprand(8), inf)\n ) }, { (0..11).choose.midiratio })\n ).reciprocal\n )\n ) * EnvGen.kr( // rhythm\n Env.perc(\n 0.01.exprand(0.4) * 0.25.coin.if({ Duty.kr( // atk\n Drand([0.5,1,2,4,8,12,16], inf), 0,\n Dshuf({ [1,2,3,4].choose } ! 1.exprand(8), inf)\n ) }, { 1 }),\n 0.1.exprand(4) * 0.75.coin.if({ Duty.kr( // release\n Drand([0.5,1,2,4,8,12,16], inf), 0,\n Dshuf({ [1,2,4,8,16].choose.reciprocal } ! 1.exprand(8), inf)\n ) }, { 1 }),\n LFNoise2.kr(0.1.exprand(10)).range(0.05,1), // appearance\n LFNoise2.kr(0.1.exprand(10)).range(-4,4),\n ).circle\n );\n } ! 3.rrand(9).debug('source'));\n BHiShelf.ar(\n GVerb.ar(\n Rotate2.ar(sig[0], sig[1], Duty.kr(Drand([2,4,8],inf), 0, Drand([-1,1,0],inf)) * LFSaw.kr(0.1.exprand(1))),\n 40.rrand(150).debug('room')\n ),\n LFNoise2.kr(0.1.exprand(0.5)).range(4000,6500),\n LFNoise2.kr(0.1.exprand(1)).range(1,3),\n LFNoise2.kr(0.1.exprand(1)).range(-24,-16)\n );\n}).play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `CCPlayer.initResponders` do?"}, {"role": "assistant", "content": "adds a MIDI CC responder and plays it to a bus as control rate"}]} +{"conversations": [{"role": "user", "content": "What does `EventShortcuts.addOnBase` do? What arguments does it take?"}, {"role": "assistant", "content": "Adds a new named IdentityDictionary of shortcuts based on the copy of an existing Arguments: baseName — Symbol or String. Name of the shortcut dictionary to build upon.; newName — Symbol or String. Name of the new shortcut set.; dict — IdentityDictionary of new or/and additional abbreviations (keys given as Symbols) and original names (values given as Symbols).; overwrite — Boolean. Determines if a shortcut dictionary of that name – if existing at all – is overwritten. Defaults to false.."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// 2012.05.04\n// Work for NX014 Class\n// Inspiration: A Rukano Tweet. Thanks rukano!\n// Comment: Cosmic Organ.\n\np = ProxySpace.push(s.boot);\n\n~a.play;\n\n~a = { var alpha,gamma;\n alpha= LFNoise2;\n gamma= {[rrand(30,50),rrand(50,70),rrand(50,70),rrand(70,100)].choose.midicps*alpha.kr(1,0.01,1)}!24;\n Pan2.ar(LeakDC.ar(Normalizer.ar(\n BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(FreeVerb.ar(\n Splay.ar(RLPF.ar(LFSaw.ar(gamma)/4,gamma*LFCub.kr(rrand(0.01,0.1),0,2,3),alpha.kr(1/8,0.6,0.7))) \n ,0.1,0.1,0.1)\n ,100,6.0,6),1000,6.0,0),5000,6.0,0),10000,6.0,6)\n ,(0.8/0.999)*1,0.1)),0)\n};\n\n~a = nil;\n```"}, {"role": "assistant", "content": "A cosmic organ with a inspiration of rukano tweet. Thanks rukano!."}]} +{"conversations": [{"role": "user", "content": "What does `View.canFocus` do? What arguments does it take?"}, {"role": "assistant", "content": "Sets or gets whether the view can receive keyboard Arguments: A Boolean.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a, b;\na = Pseq([1, 2, 3], inf);\nb = Pseq([65, 76], inf);\nc = Ptuple([a, a, b], inf);\nx = c.asStream;\n8.do({ x.next.postln });\n);\n\n\n(\nvar a, b;\na = Pseq([1, 2, 3], inf);\nb = Pseq([65, 76], 3); // stops after 3 cycles\nc = Ptuple([a, a, b], 4); // stops after 4 cycles\nx = c.asStream;\n8.do({ x.next.postln });\n);\n\n\n// Ptuple used as a sequence of pitches (chords)\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a, b;\na = Pseq([1, 2, 3], inf);\nb = Pseq([65, 76], inf);\nc = Ptuple([a, a, b], inf);\nx = c.asStream;\n8.do({ x.next.postln });\n);\n\n\n(\nvar a, b;\na = Pseq([1, 2, 3], inf);\nb = Pseq([65, 76], 3); // stops after 3 cycles\nc = Ptuple([a, a, b], 4); // stops after 4 cycles\nx = c.asStream;\n8.do({ x.next.postln });\n);\n\n\n// Ptuple used as a sequence of pitches (chords)\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Pseq([73, 71, 69, 69, 65, 64], inf);\nb = Pseq([0, 0, 0, 4, 0, 3, 2], inf) + a;\nc = Ptuple([a, b], inf);\nx = c.asStream;\nRoutine({\n var chord;\n loop({\n chord = x.next.postln.midicps;\n (instrument: \\help_sinegrain, freq: chord).play;\n 0.2.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "When should I use a Pattern instead of writing Synth code by hand?"}, {"role": "assistant", "content": "Use a Pattern when what you want to express is a sequence over time — notes, durations, amplitudes, parameters — rather than a signal. A Pbind describes events, and `.play` turns each event into a Synth (by default of the \\default instrument, or of \\instrument if you name one). Hand-written Synth code is for the sound itself; Patterns are for what plays when. The two compose: a SynthDef named \\bell is triggered from `Pbind(\\instrument, \\bell, ...)`."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `FoldIndex`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// indexing into a table\n(\n{\n var buf = LocalBuf.newFrom([200, 300, 400, 500, 600, 800]);\n var freq = FoldIndex.kr(buf, MouseX.kr(0, BufFrames.ir(buf) * 3));\n SinOsc.ar(freq) * 0.1\n}.play;\n);\n\n// the same using a global buffer\n(\nt = [200, 300, 400, 500, 600, 800];\nb = Buffer(s, t.size, 1);\n\n// alloc and set the values\ns.listSendMsg(b.allocMsg(b.setnMsg(0, t)).postln);\n\nSynthDef(\\help_Index, { |out = 0, bufnum = 0|\n Out.ar(out,\n SinOsc.ar(\n FoldIndex.kr(\n bufnum,\n MouseX.kr(0, BufFrames.ir(bufnum) * 3)\n ),\n 0,\n 0.5\n )\n )\n}).play(s, [\\bufnum, b.bufnum]);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// an envelope in a synth\n(\n{\n var env = Env([0, 1, 0.5, 1, 0], [0.01, 0.5, 0.02, 0.5]);\n SinOsc.ar(470) * EnvGen.kr(env, doneAction: Done.freeSelf)\n}.play\n);\n// an envelope to control a parameter in a pattern\n(\nPbind(\n \\note, Env([0, 12, 6, 13, 0], [1, 5, 2, 10]),\n \\dur, 0.1\n).play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// an envelope in a synth\n(\n{\n var env = Env([0, 1, 0.5, 1, 0], [0.01, 0.5, 0.02, 0.5]);\n SinOsc.ar(470) * EnvGen.kr(env, doneAction: Done.freeSelf)\n}.play\n);\n// an envelope to control a parameter in a pattern\n(\nPbind(\n \\note, Env([0, 12, 6, 13, 0], [1, 5, 2, 10]),\n \\dur, 0.1\n).play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `BLowPass`?"}, {"role": "assistant", "content": "BLowPass — 12db/oct rolloff - 2nd order resonant Low Pass Filter"}, {"role": "user", "content": "What does `BLowPass.sc` do?"}, {"role": "assistant", "content": "calculate filter coefficients."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n(\nz = {\n BLowPass.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(10, 20000, \\exponential), // cutoff freq.\n MouseY.kr(0.0, 1.0, \\linear), // rq\n 0.5); // mul\n}.play\n);\nz.release;\n```"}]} +{"conversations": [{"role": "user", "content": "Buffer.read fails and I get a path error. What should the path look like?"}, {"role": "assistant", "content": "On Windows use forward slashes or escaped backslashes inside the string: `Buffer.read(s, \"C:/sounds/kick.wav\")`. A single backslash starts an escape sequence, which is why `\"C:\\sounds\\kick.wav\"` fails. Also check the extension is real (`.wav`, `.aiff`, `.flac`) and that the file is not on a network path — the server reads it, not the language, and it may resolve differently. For sounds that ship with SuperCollider, `Platform.resourceDir +/+ \"sounds/a11wlk01.wav\"` is the portable form."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nx = { |freq = 440| SinOsc.ar(freq, 0, 0.3) }.play; // this returns a Synth object;\nx.set(\\freq, 880); // note you can set the freq argument\nx.defName; // the name of the resulting SynthDef\nx.release(4; // fadeout over 4 seconds\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nx = { |freq = 440| SinOsc.ar(freq, 0, 0.3) }.play; // this returns a Synth object;\nx.set(\\freq, 880); // note you can set the freq argument\nx.defName; // the name of the resulting SynthDef\nx.release(4); // fadeout over 4 seconds\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Synth`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n(\n// send a synth def to server\nSynthDef(\"tpulse\", { |out = 0, freq = 700, sawFreq = 440.0|\n Out.ar(out, SyncSaw.ar(freq, sawFreq, 0.1));\n}).add;\n);\n\n// Here the defaults for *new will result in a Synth at the head of the default group\n// of the default Server. This will use the SynthDef's default arguments;\ny = Synth.new(\"tpulse\");\ny.free;\n\n// The same done explicitly\ny = Synth.new(\"tpulse\", nil, s, \\addToHead);\ny.free;\n\n// With some arguments\ny = Synth.new(\"tpulse\", [\\freq, 350, \\sawFreq, 220]);\ny.free;\n\n// make a new synth\ny = Synth(\"tpulse\");\n\n// pause\ny.run(false);\n\ny.run(true);\n\n// set a control by argument name\ny.set(\"freq\", 200);\n\n// or by index\ny.set(2, 100.0);\n\n// modulate out to bus number 1 (the right speaker)\ny.set(0, 1);\n\n// multiple set commands in one message\ny.set(\"out\", 0, \"freq\", 300);\n\n// free the synth from the server\ny.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// hand code a mono signal to a decorrelated soundfield in B-format\n// NOTE: the demonstrated kernel is not ideal for this task\n\n// define encoding kernel\n(\nvar kernelSize;\nvar scale;\n\nkernelSize = 256;\nscale = 24.neg.dbamp;\n\n~kernel = [[\n Buffer.loadCollection(s, FloatArray.fill(kernelSize, {(3/2).sqrt * scale.rand2})),\n Buffer.loadCollection(s, FloatArray.fill(kernelSize, {scale.rand2})),\n Buffer.loadCollection(s, FloatArray.fill(kernelSize, {scale.rand2})),\n Buffer.loadCollection(\n// …\n```"}, {"role": "assistant", "content": "hand code a mono signal to a decorrelated soundfield in B-format NOTE: the demonstrated kernel is not ideal for this task (AtkKernelConv: Kernel convolution from the Ambisonic Toolkit (ATK))"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// synth definition with raising frequency\n\n(\nSynthDef(\\synth_0, { |devFactor = 0.1, devFreq = 10, amp = 0.1|\n var freq = XLine.kr(400, 1200, 10); \n Out.ar(0, SinOsc.ar(SinOsc.ar(devFreq, 0, devFactor * freq, freq), mul: amp).dup(2) * EnvGate.new) \n}).add;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// synth definition with raising frequency\n\n(\nSynthDef(\\synth_0, { |devFactor = 0.1, devFreq = 10, amp = 0.1|\n var freq = XLine.kr(400, 1200, 10); \n Out.ar(0, SinOsc.ar(SinOsc.ar(devFreq, 0, devFactor * freq, freq), mul: amp).dup(2) * EnvGate.new) \n}).add;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `ArraySpec.storeArgs` do?"}, {"role": "assistant", "content": "datatype specifying an array with an itemSpec which describes its items"}]} +{"conversations": [{"role": "user", "content": "My pattern keeps playing after I press Ctrl+."}, {"role": "assistant", "content": "Ctrl+. (CmdPeriod) stops everything scheduled on the clocks, including Patterns. If yours survives, it is not scheduled on a clock — most often it is a `Synth` created directly, or a `Task`/`Routine` started on `SystemClock` in a way that outlived the period. Do you still see the node in `s.plotTree`?"}, {"role": "user", "content": "Yes, there's a synth."}, {"role": "assistant", "content": "Then the sound is a node, not a pattern: `s.freeAll` will stop it. The likely cause is a SynthDef whose EnvGen has no `doneAction`, or a drone with `gate = 1` that nothing releases. Add `doneAction: 2` to the envelope, or keep a reference and `x.set(\\gate, 0)` when you want it to end."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nDelayC.ar(z, 0.2, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\n(\n// recursive application of delay.\n{\nz = Decay2.ar(Dust.ar(1, 0.5), 0.01, 0.1, Saw.ar(100 + [0, 1]));\n5.do { |i| z = DelayC.ar(RLPF.ar(z, Rand(100, 3000), 0.03), 1, 1 / (2**i), 1, z * 0.5) };\nz\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nDelayC.ar(z, 0.2, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\n(\n// recursive application of delay.\n{\nz = Decay2.ar(Dust.ar(1, 0.5), 0.01, 0.1, Saw.ar(100 + [0, 1]));\n5.do { |i| z = DelayC.ar(RLPF.ar(z, Rand(100, 3000), 0.03), 1, 1 / (2**i), 1, z * 0.5) };\nz\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `AbstractFunction`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\na = { |x| #[440, 720, 801, 1020.2].at(x) }; b = a.cpsmidi; [a.value(3), b.value(3)];\na = Pseries(220, 220, inf).cpsmidi; a.asStream.nextN(12); // overtone series as midinotes\n// follow but round to next midinote\n{ a = Pitch.kr(SoundIn.ar).at(1); Pulse.ar(a.cpsmidi.round.midicps) * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for danger loud click. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// proceed with caution. start at min volume, and not with your expensive speakers.\n\nfork{b=Buffer.alloc(s,512,1);inf.do{b.cheby({[1,0].choose}!2);{(Shaper.ar(b,SinOsc.ar(55,0,Line.kr(1,0,2,1,0,2))))!2}.play;0.1.wait;}};\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LinCongN`."}, {"role": "assistant", "content": "```supercollider\n// default initial params\n{ LinCongN.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `InstrGui` in SuperCollider briefly."}, {"role": "assistant", "content": "InstrGui — gui class Category: Libraries > crucial > GuiClasses."}]} +{"conversations": [{"role": "user", "content": "What does `Function.r` do?"}, {"role": "assistant", "content": "Returns a Routine using this as its func argument. `a = r { 5.do { |i| i.rand.yield }"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for blaplop (a SuperCollider snippet) that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\bla, { arg out=0, amp=0.1, gate=1, pan=0, freq=200;\n var sig;\n var tab;\n tab = \\tab.kr(1 ! 15);\n sig = LFSaw.ar(freq * tab.abs);\n sig = sig.sum;\n sig = RLPF.ar(sig, Rand(10,freq*2) + 100 * SinOsc.ar(tab.abs).range(0.01,Rand(2,7)));\n sig = sig.sum;\n sig = sig / 100;\n sig = sig.tanh;\n sig = sig * EnvGen.ar(Env.adsr(0.01,0.1,0.8,0.1+ExpRand(0.001,0.2)),gate,doneAction:2);\n sig = Pan2.ar(sig, pan, amp);\n Out.ar(out, sig);\n}).add;\n);\n\n(\nPdef(\\plop, Pbind(\n \\instrument, \\bla,\n \\degree, Pstep(Pseq([\n Pseq([0,2,4],4),\n Pseq([0,12,6],4),\n Pseq([0,12,6]+7,1),\n ],inf), 1),\n \\octave, 3,\n \\tab, Pfunc {\n var tab;\n [\n //tab = { arg n; (n + 1.asFloat.rand + 1).tanh / (n.rand+1) } ! 15;\n tab = { arg n; (n + 2.asFloat.rand + 1) / (n+1) } ! 15;\n tab.postln;\n ]\n },\n \\dur, PdurStutter( Prand([1,2,4],inf), Pseq([1,2,3]/2,inf)),\n \\amp, 0.4\n)).play;\n);\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `NodeProxy`."}, {"role": "assistant", "content": "```supercollider\nb = NodeProxy.new.play;\nb.source = { PinkNoise.ar(0.2.dup) };\n// now I want to filter b through a new proxy.\na = NodeProxy.new;\na <-- b; a.source = { HPF.ar(b.ar, 7000) };\na.source = { HPF.ar(b.ar, 3000) }; // changing the source\na.clear; b.clear;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `AbstractSInstrument` in SuperCollider?"}, {"role": "assistant", "content": "AbstractSInstrument — an abstract class for all sInstruments Helper class for instruments. Category: SInstruments."}]} +{"conversations": [{"role": "user", "content": "What does `UScore.moveEventToEmptyTrack` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: evt — (describe argument here). Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nSynthDef(\"help-PrintVal\",{PrintVal.kr(SinOsc.kr(440,0,0.1), 100)}).play\n\n\n//two at once\n(\nSynthDef(\"help-PrintVal\",{\n\nPrintVal.kr(SinOsc.kr(440,0,0.1), 100, 1);\n\nPrintVal.kr(LFNoise1.kr(100,0.1), 10, 2);\n\n}).play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nSynthDef(\"help-PrintVal\",{PrintVal.kr(SinOsc.kr(440,0,0.1), 100)}).play\n\n\n//two at once\n(\nSynthDef(\"help-PrintVal\",{\n\nPrintVal.kr(SinOsc.kr(440,0,0.1), 100, 1);\n\nPrintVal.kr(LFNoise1.kr(100,0.1), 10, 2);\n\n}).play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `WhiteNoise`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-WhiteNoise\", { |out = 0|\n Out.ar(out,\n WhiteNoise.ar(0.25)\n )\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is a bus, in one sentence?"}, {"role": "assistant", "content": "A numbered channel on the server that nodes write signal into and read signal out of, which is how sounds are chained without cables."}, {"role": "user", "content": "Show me using one for an effect."}, {"role": "assistant", "content": "Write the source to a private bus, read it in the effect, send the effect to the master:\n\n```supercollider\n(\n~bus = Bus.audio(s, 1);\nSynthDef(\\src, { |out = 0| Out.ar(out, Saw.ar(110) * 0.1) }).add;\nSynthDef(\\fx, { |in = 0| Out.ar(0, RLPF.ar(In.ar(in, 1), 1200, 0.3)) }).add;\n);\nSynth(\\fx, [\\in, ~bus]);\nSynth(\\src, [\\out, ~bus]);\n```\n\nOrder matters: the effect exists before the source, so the source's output has a listener."}]} +{"conversations": [{"role": "user", "content": "What is `HilbertPDNIm` in SuperCollider?"}, {"role": "assistant", "content": "HilbertPDNIm — Applies the Imaginary part of the Hilbert Transform to an input signal. [1] Offers the Hilbert Transform of an input signal via Weaver's Second Method,footWeaver, Donald. “A Third Method of Generation and Detection of Single-Sideband Signals.” Proceedings of the IRE, vol. 44, no. 12, 1956, pp. 1703–1705. known as Hartley Phasing,footUS Patent 1,666,206, Modulation System, April 17, 1928, United States Patent and Trademark Office. expressed as a 12th-order Phase Differenci Category: Libraries > Hilbert > Pseudo-UGens, UGens > Filters > Nonlinear."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LinLin`."}, {"role": "assistant", "content": "```supercollider\n// examples:\n\n(\n{\n var mod = SinOsc.kr(Line.kr(1, 10, 10));\n SinOsc.ar(LinLin.kr(mod, -1, 1, 100, 900)) * 0.1\n}.play;\n);\n\n// modulating destination values.\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(LinLin.ar(mod, -1, 1, MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1))) * 0.1\n}.play;\n);\n\n// modulating source and destination values.\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(\n LinLin.ar(mod,\n SinOsc.kr(0.2), SinOsc.kr(0.2543),\n MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1)\n )\n ) * 0.1\n}.play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n//Version 1\n//P(eace)Bind\n//If error messages could experience Nirvanna, it would sound like this.\n(\n{\nSaw.ar(\n freq: SinOsc.kr([60, 63, 67, 70]).range(440,880),\n mul:LFNoise0.kr(freq: [0.25,1]).range(0,1),\n )\n}.play\n\n);\n\n\n//Version 2\n//SuperCollider\n//Sometimes in life, you feel like you need to collide with things.\n(\n{\nPulse.ar(\n freq: SinOsc.kr([60, 63, 67, 70]).range(30,70),\n mul: LFPulse.kr(freq: [0.25,1]).range(0,1)\n )\n}.play\n\n)\n```"}, {"role": "assistant", "content": "Quiz 4a for MUSC 115, pp. 62-84 from Gentle Intro to SuperCollider."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `RunningMin`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n SinOsc.ar(\n RunningMin.ar(Dust.ar(20), Impulse.ar(0.4)) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// follow a sine lfo, reset rate controlled by mouse x\n(\n{\n SinOsc.ar(\n RunningMin.kr(SinOsc.kr(0.2), Impulse.kr(MouseX.kr(0.01, 2, 1))) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is the difference between ~foo and a local variable?"}, {"role": "assistant", "content": "`var foo` is a local: it exists only inside the function or file block that declares it. `~foo` is an environment variable: it lives in the current Environment, survives between executions of the same block, and is visible to everything running in that environment. That is why `~buf = Buffer.read(s, path)` works in one cell and `PlayBuf.ar(1, ~buf)` works in the next, while a `var` would be gone."}]} -{"conversations": [{"role": "user", "content": "What does `Every.value` do? What arguments does it take?"}, {"role": "assistant", "content": "holds a list of Contraints, validates that the test object satisifes all of those Arguments: obj."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n// Simple amplitude tracker sending values to sclang\nSynthDef(\\ampTracker, { |in|\n var freq = 30; // num of values per second\n SendReply.kr(Impulse.kr(freq), '/amp', Amplitude.kr(SoundIn.ar(in)));\n}).add;\n);\n\n// start the tracker on scsynth\nSynth(\\ampTracker);\n\n(\n// receive the values in sclang\nOSCdef(\\ampTracker, { |m|\n m.postln;\n // now use m[3] for your purpose (detecting changes, etc...)\n}, '/amp');\n)\n```"}, {"role": "assistant", "content": "It's jsut an amplitude tracker, to exaplin how to send values from scsynth to sclang."}]} -{"conversations": [{"role": "user", "content": "What is `Pbindf`?"}, {"role": "assistant", "content": "Pbindf — bind several value patterns to one existing event stream by binding keys to values"}, {"role": "user", "content": "What does `Pbindf.new` do?"}, {"role": "assistant", "content": "The arguments to Pbindf is the initial pattern followed by an alternating sequence of keys and patterns. A pattern can also be bound to an array of keys. In this case, the pattern must specify a sequence whose elements are arrays with at least as many elements as there are keys."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\na = Pbind(\\x, Pseq([1, 2, 3]), \\zzz, 9000); // input stream\nb = Pbindf(a, \\y, Prand([100, 300, 200], inf), \\zzz, 99);\nx = b.asStream;\n);\n\nx.next(()); // pass in an event ()\nx.next(());\nx.next(());\nx.next(()); // end: nil\n\n\n\n// sound examples\n\n// using the default synth def\na = Pbind(\\dur, 0.1);\nPbindf(a, \\freq, Prand([300, 500, 231.2, 399.2], inf)).play;\nPbindf(a, \\freq, Prand([1, 1.2, 2, 2.5, 3, 4], inf) * 200).play;\n\n\n(\n// a SynthDef\nSynthDef(\\test, { |out, freq = 440, amp = 0.1, nharms = 10, pan = 0, gate = 1|\n var audio = Blip.ar(freq, nharms, amp);\n var env = Linen.kr(gate, doneAction: Done.freeSelf);\n OffsetOut.ar(out, Pan2.ar(audio, pan, env));\n}).add;\n);\n\na = Pbind(\\instrument, \\test, \\dur, 0.1);\n\nPbindf(a, \\freq, Prand([1, 1.2, 2, 2.5, 3, 4], inf) * 200).play;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n/// Installing sc3-plugins quarks\n\n// If you installed the sc3-plugins to a user location:\n~sc3plugs = Quarks(\nreposPath: \"https://sc3-plugins.svn.sourceforge.net/svnroot/sc3-plugins/build\",\nlocalPath: Platform.userAppSupportDir +/+ \"SC3plugins\"\n);\n\n// If the sc3-plugins were installed to a system wide location:\n~sc3plugs = Quarks(\nreposPath: \"https://sc3-plugins.svn.sourceforge.net/svnroot/sc3-plugins/build\",\nlocalPath: Platform.systemAppSupportDir +/+ \"SC3plugins\"\n);\n\n\n// Get a GUI of the available Quarks and install the ones you want to try out:\n~sc3plugs.gui;\n\n\n// For more general Help on Quarks, see the Quarks helpfile\n```"}, {"role": "assistant", "content": "Installing sc3-plugins quarks If you installed the sc3-plugins to a user location:."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ ClipNoise.ar(0.2 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ ClipNoise.ar(0.2) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "How current is your SuperCollider knowledge?"}, {"role": "assistant", "content": "It comes from a snapshot of the SuperCollider repository (documentation, class library and examples) plus code I can reason about. So classes and arguments in that snapshot I know well, including argument order. Quarks, newer UGens, and anything outside the official tree I may not know at all, and I will say so rather than invent a method name. If you need certainty about a class, check its help page — `SinOsc.schelp` in the source tree is the authority."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LFCub`."}, {"role": "assistant", "content": "```supercollider\n{ LFCub.ar(LFCub.kr(LFCub.kr(0.2, 0, 8, 10), 0, 400, 800), 0, 0.1) }.play\n{ LFCub.ar(LFCub.kr(0.2, 0, 400, 800), 0, 0.1) }.play\n{ LFCub.ar(800, 0, 0.1) }.play\n{ LFCub.ar(XLine.kr(100, 8000, 30), 0, 0.1) }.play\n\n// compare:\n\n{ LFPar.ar(LFPar.kr(LFPar.kr(0.2, 0, 8, 10), 0, 400, 800), 0, 0.1) }.play\n{ LFPar.ar(LFPar.kr(0.2, 0, 400, 800), 0, 0.1) }.play\n{ LFPar.ar(800, 0, 0.1) }.play\n{ LFPar.ar(XLine.kr(100, 8000, 30), 0, 0.1) }.play\n\n\n{ SinOsc.ar(SinOsc.kr(SinOsc.kr(0.2, 0, 8, 10), 0, 400, 800), 0, 0.1) }.play\n{ SinOsc.ar(SinOsc.kr(0.2, 0, 400, 800), 0, 0.1) }.play\n{ SinOsc.ar(800, 0, 0.1) }.play\n{ SinOsc.ar(XLine.kr(100, 8000, 30), 0, 0.1) }.play\n\n{ LFTri.ar(LFTri.kr(LFTri.kr(0.2, 0, 8, 10), 0, 400, 800), 0, 0.1) }.play\n{ LFTri.ar(LFTri.kr(0.2, 0, 400, 800), 0, 0.1) }.play\n{ LFTri.ar(800, 0, 0.1) }.play\n{ LFTri.ar(XLine.kr(100, 8000, 30), 0, 0.1) }.play\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Variations for Z1 sawtooth."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var mod = SinOsc.ar([0.1,0.15,0.2]).range(0,1);\n var saw = LFSaw.ar([10,12,15]);\n var out = (saw - ((saw>0)*mod)+(mod*0.5));\n Splay.ar(out)*0.4;\n}.play;\n\n{\n var mod = SinOsc.ar([0.1,0.15,0.2]).range(0,1);\n var saw = SinOsc.ar(LFSaw.ar([10,12,15]).range(200,300));\n var out = (saw - ((saw>0)*mod)+(mod*0.5));\n Splay.ar(out)*0.4;\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a chord progression with Pbind."}, {"role": "assistant", "content": "Put an array of degrees in the pattern, use \\strum to spread the chord, and the default instrument\nplays all notes of each event.\n\n```supercollider\n(\nPbind(\n \\scale, Scale.minor,\n \\root, 2,\n \\degree, Pseq([[0, 4, 7], [-3, 0, 4], [-5, -1, 2], [0, 4, 7]], inf),\n \\dur, 1.5,\n \\strum, 0.02,\n \\amp, 0.12,\n \\legato, 0.9\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Periphonic (3D) decoder with eight channels arranged in a bi-rectangle:\n~directions = [[ 30, 0 ], [ -30, 0 ], [ 90, 35.3 ], [ -90, 35.3]].degrad\n~decoder = FoaDecoderMatrix.newDiametric(~directions\n\n// inspect\n~decoder.dirChannels.raddeg\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Periphonic (3D) decoder with eight channels arranged in a bi-rectangle:\n~directions = [[ 30, 0 ], [ -30, 0 ], [ 90, 35.3 ], [ -90, 35.3]].degrad\n~decoder = FoaDecoderMatrix.newDiametric(~directions)\n\n// inspect\n~decoder.dirChannels.raddeg\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Pisano periods for rythmic patterns."}, {"role": "assistant", "content": "```supercollider\nb = Buffer.read( s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\" );\n\n(\nSynthDef(\\playBuf, {| out = 0, buf = 0, amp = 0.2, pan = 0.0, dur = 0.2, gate = 1 startPos = 0 |\n var sig, env;\n env = EnvGen.ar( Env.sine( dur ), gate, amp, doneAction: 2 );\n sig = PlayBuf.ar( \n 1, \n buf, \n BufRateScale.ir( buf ), \n 1, \n startPos * BufFrames.ir( buf )\n );\n OffsetOut.ar(out, Pan2.ar( sig * env, pan ) )\n}).add\n);\n\n(\nPn(\n Plazy({\n var divisor = 3.rrand( 9 ), repeats = 10.rrand( 20 );\n var pisano, size, starts, durs, pans, amps;\n\n pisano = Array.pisano( divisor );\n size = pisano.size;\n starts = { 1.0.rand } ! size ;\n durs = { 0.03.rrand( 0.08 ) } ! size;\n pans = { 1.0.rand2 } ! size;\n amps = { 0.05.rrand( 0.8 ) } ! size;\n\n \"Divisor: %\\t pisano period is of length: %\\n\".postf( divisor, size );\n\n Pbind(\n \\instrument, \\playBuf,\n \\pisano, Pseq( pisano, repeats ),\n \\buf, b,\n \\amp, Pindex( amps, Pkey( \\pisano ) ),\n \\dur, Pindex( durs, Pkey( \\pisano ) ),\n \\pan, Pindex( pans, Pkey( \\pisano ) ),\n \\startPos, Pindex( starts, Pkey( \\pisano ) )\n )\n }),\n inf\n).play\n);\n\nb.free\n\n//////////////////////////////////////////////////////////////////////\n// + Array { \n// // The pisano period for the given integer.\n// *pisano { | divisor = 3 |\n// var list, lastPair, sum;\n// if ( divisor.isInteger.not or: { divisor < 0 } ){\n// \"The divisor must be a positive integer\".throw;\n// };\n// list = List[ 0, 1 ];\n// while {\n// lastPair = list.keep( -2 );\n// sum = lastPair.sum;\n// sum != 1 or: { lastPair.last != 0 }\n// }{\n// list.add( sum % divisor );\n// };\n// ^ list.array.drop( -1 )\n// }\n\n// }\n//////////////////////////////////////////////////////////////////////\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes open files within the Modality workshop folder."}, {"role": "assistant", "content": "```supercollider\n// open files within the Modality workshop folder\n\n~basePath = \"\".resolveRelative;\n\n// installing Modality and other quarks for this workshop:\n(~basePath +/+ \"0_installing.scd\").openDocument;\n\n// finding and defining devices:\n(~basePath +/+ \"1_finding_and_defining_devices_hid.scd\").openDocument;\n(~basePath +/+ \"1_finding_and_defining_devices_midi.scd\").openDocument;\n\n// exploring elements and actions:\n(~basePath +/+ \"2_elements_and_actions_hid.scd\").openDocument;\n(~basePath +/+ \"2_elements_and_actions_midi.scd\").openDocument;\n\n// using ndefs:\n(~basePath +/+ \"3_using_ndefs_hid.scd\").openDocument;\n(~basePath +/+ \"3_using_ndefs_midi.scd\").openDocument;\n\n\n// some shared sound processes\n(~basePath +/+ \"shared_processes\").openOS;\n\n(~basePath +/+ \"shared_processes/*\").pathMatch.collect(_.basename).postcs;\n(~basePath +/+ \"shared_processes/*\").pathMatch.choose.openDocument;\n// open one of them:\n(~basePath +/+ \"shared_processes/cat.scd\").openDocument;\n// load one directly, e.g. for use in controller patches:\n(~basePath +/+ \"shared_processes/cat.scd\").load;\n\n// ... you are welcome to share your own sound processes here!\n\n// some more modal functionality using MFunc:\n(~basePath +/+ \"5_modal_functionality_2_hid.scd\").openDocument;\n(~basePath +/+ \"5_modal_functionality_2_midi.scd\").openDocument;\n(~basePath +/+ \"5_modal_functions_2b_midi.scd\").openDocument;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n/// Installing sc3-plugins quarks\n\n// If you installed the sc3-plugins to a user location:\n~sc3plugs = Quarks(\nreposPath: \"https://sc3-plugins.svn.sourceforge.net/svnroot/sc3-plugins/build\",\nlocalPath: Platform.userAppSupportDir +/+ \"SC3plugins\"\n);\n\n// If the sc3-plugins were installed to a system wide location:\n~sc3plugs = Quarks(\nreposPath: \"https://sc3-plugins.svn.sourceforge.net/svnroot/sc3-plugins/build\",\nlocalPath: Platform.systemAppSupportDir +/+ \"SC3plugins\"\n);\n\n\n// Get a GUI of the available Quarks and install the ones you want to try out:\n~sc3plugs.gui;\n\n\n// For more general Help on Quarks, see the Quarks helpfile\n```"}, {"role": "assistant", "content": "Installing sc3-plugins quarks If you installed the sc3-plugins to a user location:."}]} -{"conversations": [{"role": "user", "content": "What is `KeyDownResponderGroup` in SuperCollider?"}, {"role": "assistant", "content": "KeyDownResponderGroup — for concatenating differing classes of key/unicode responders For concatenating differing class of responder including KeyCodeResponder/UnicodeResponder/SwitchableKeyDownResponder or even straight functions Category: Libraries > crucial > GUI > internals."}]} -{"conversations": [{"role": "user", "content": "What does `RedDiskInSampler.overlaps` do?"}, {"role": "assistant", "content": "Get or set number of overlaps or voices allowed to play per key at once. The default is 2. You will need to #-prepareForPlay again after setting"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Server-side sequencing (a SuperCollider snippet)?"}, {"role": "assistant", "content": "```supercollider\n(\nf = { |f0=200, rate=4|\n {\n var seq = Dseq(f0*[1/2,3/4, Dstutter(4, Drand([1/2,1,2,3,4,5,6],1)), 2,3/2,3,4/3], inf);\n var trig = Impulse.ar(rate);\n var freq = Demand.ar(trig,0, seq);\n var env = Decay2.ar(trig,1e-3,1);\n FreeVerb.ar(\n Splay.ar(SinOsc.ar(freq*[0.995, 1, 1.005]).fold(-0.995,0.995)*0.25*env),\n 0.5,\n 0.5\n );\n }\n};\n\nfork{ 4.do{\n fork{\n f.(100,2).play;\n (1/8).wait;\n f.(200,4).play;\n (1/4).wait;\n f.(100*4/3,8).play;\n (1/2).wait;\n f.(400,4).play;\n };\n (1/4).wait;\n}}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Patch.synthDefArgs` do?"}, {"role": "assistant", "content": "Pairs an Instr with inputs that that will be passed to the Instr"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// frequency modulation\n(\nplay {\n DynKlang.ar(`[\n [800, 1000, 1200] + SinOsc.kr([2, 3, 4.2], 0, [13, 24, 12]),\n [0.3, 0.3, 0.3],\n [pi, pi, pi]\n ]\n) * 0.1\n};\n);\n\n\n// building new synths every 2 seconds\n(\nfork {\n loop {\n play {\n var mod = SinOsc.kr(Rand(0.1, 0.9), 0, Rand(5, 20));\n Pan2.ar(DynKlang.ar(`[Array.rand(12, 200.0, 2000.0), 1, mod]), 1.0.rand)\n * EnvGen.kr(Env.sine(4), 1, 0.02, doneAction: D\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// frequency modulation\n(\nplay {\n DynKlang.ar(`[\n [800, 1000, 1200] + SinOsc.kr([2, 3, 4.2], 0, [13, 24, 12]),\n [0.3, 0.3, 0.3],\n [pi, pi, pi]\n ]\n) * 0.1\n};\n);\n\n\n// building new synths every 2 seconds\n(\nfork {\n loop {\n play {\n var mod = SinOsc.kr(Rand(0.1, 0.9), 0, Rand(5, 20));\n Pan2.ar(DynKlang.ar(`[Array.rand(12, 200.0, 2000.0), 1, mod]), 1.0.rand)\n * EnvGen.kr(Env.sine(4), 1, 0.02, doneAction: Done.freeSelf)\n };\n 2.wait;\n }\n}\n);\n\n\n// resetting the frequencies and amplitudes after the synth has been created\n(\nSynthDef('help-dynKlang', { |out,\n freqs = #[220, 440, 880, 1760],\n amps = #[0.35, 0.23, 0.12, 0.05],\n phases = #[1, 1.5, 2, 2.5]|\n\n Out.ar(out, DynKlang.ar(`[freqs, amps, phases]))\n}).add\n);\n\na = Synth('help-dynKlang');\n\na.setn(\\freqs, Array.rand(4, 500, 2000));\na.setn(\\amps, Array.rand(4, 0.01, 0.25));\n```"}]} -{"conversations": [{"role": "user", "content": "Write a warm pad in SuperCollider."}, {"role": "assistant", "content": "Detuned saws through a slow filter envelope and a long release: the detune is what makes it wide.\n\n```supercollider\n(\nSynthDef(\\pad, { |out = 0, freq = 220, amp = 0.15, gate = 1|\n var detune = [-0.06, -0.02, 0.02, 0.06];\n var sig = Mix(Saw.ar(freq * (1 + detune))) * 0.25;\n var env = EnvGen.kr(Env.adsr(1.2, 0.5, 0.7, 3), gate, doneAction: 2);\n var cutoff = SinOsc.kr(0.05).exprange(300, 2000);\n sig = RLPF.ar(sig, cutoff, 0.4);\n Out.ar(out, Splay.ar([sig, DelayN.ar(sig, 0.02, 0.012)]) * env * amp);\n}).add;\n);\n~pad = Synth(\\pad, [\\freq, 165]);\n~pad.set(\\gate, 0);\n```\n`gate` is what makes a sustained sound controllable: `\\gate, 0` releases it and `doneAction: 2` then\nfrees the Synth."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PV_MagDiv`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n(\nSynthDef(\"help-magMul\", { |out = 0|\n var inA, chainA, inB, chainB, chain;\n inA = WhiteNoise.ar(0.2);\n inB = LFSaw.ar(100, 0, 0.2);\n chainA = FFT(LocalBuf(2048), inA);\n chainB = FFT(LocalBuf(2048), inB);\n chain = PV_MagDiv(chainA, chainB);\n Out.ar(out, 0.5 * IFFT(chain).dup);\n}).play;\n);\n\n\nc = Buffer.read(s, ExampleFiles.child);\n\n(\nSynthDef(\"help-magMul2\", { |out = 0, soundBufnum = 0|\n var inA, chainA, inB, chainB, chain;\n inA = LFSaw.ar([100, 150], 0, 0.2);\n inB = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);\n chainA = FFT(LocalBuf(2048), inA);\n chainB = FFT(LocalBuf(2048), inB);\n chain = PV_MagDiv(chainA, chainB);\n Out.ar(out, 0.1 * IFFT(chain));\n}).play(s, [\\out, 0, \\soundBufnum, c]);\n);\n\nc.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nSynthDef(\\madtraffic, {|out, sig, gate=1, freq=440|\n // doneAction: 2 rilascia la synth quando EvnGen ha finito\n sig = (Blip.ar(freq)*0.7+Blip.ar(freq/2+Rand(1,12))*0.7)\n*EnvGen.kr(Env.asr(0.1, 0.3, 0.3), gate, doneAction:2);\n sig = RLPF.ar(sig,SinOsc.kr(0.3, 0, 200, 1500), 0.1);\n sig = FreeVerb.ar(sig, 0.5, 0.5, 0.5);\n Out.ar(out, sig);\n\n}).add;\n);\n\n(\nPbind(\n \\instrument, \\madtraffic,\n \\freq, Pseq([137, 373, Prand([237, 473, 713],1)], inf),\n \\legato, Pseq([1.7, 0.3], inf),\n \\dur, 0.3,\n \\out, Pseq([1, 0], inf)\n).play;\n)\n```"}, {"role": "assistant", "content": "\"It's the lack of eye contact that makes us more idiots, to the point that convertible riders give less to escalation. Closed in the car, explain the psychologists, we regress to childhood and react by shouting, or with that surrogate of the shock that is the horn.\"\r\n\r\n\r\n\r\nhttp://bz-buzz.blogspot.com/2018/09/mad-traffic.html\r\n\r\nhttp://bzakirasantjago.blogspot.it/."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n Lag.kr( // lag the modulator\n LFPulse.kr(4, 0, 0.5, 50, 400), // frequency modulator\n Line.kr(0, 1, 15) // modulate lag time\n ),\n 0, // phase\n 0.3 // sine amplitude\n )\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n Lag.kr( // lag the modulator\n LFPulse.kr(4, 0, 0.5, 50, 400), // frequency modulator\n Line.kr(0, 1, 15) // modulate lag time\n ),\n 0, // phase\n 0.3 // sine amplitude\n )\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\\pm, { |out = 0, freq = 440, amp = 0.1, pan = 0, gate = 1, ratio = 1, index = 1, ar = 0.1, dr = 0.1|\n var z;\n z = LPF.ar(\n PMOsc.ar(freq, freq * ratio, Linen.kr(gate, ar, index, dr), 0, 0.3),\n XLine.kr(Rand(4000, 5000), Rand(2500, 3200), 1)\n ) * Linen.kr(gate, 0.01, 0.7, dr, 2);\n OffsetOut.ar(out, Pan2.ar(z, pan, amp));\n}).add;\n);\n\n(instrument: \\pm).play;\n\n(instrument: \\pm, ratio: 3.4\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\\pm, { |out = 0, freq = 440, amp = 0.1, pan = 0, gate = 1, ratio = 1, index = 1, ar = 0.1, dr = 0.1|\n var z;\n z = LPF.ar(\n PMOsc.ar(freq, freq * ratio, Linen.kr(gate, ar, index, dr), 0, 0.3),\n XLine.kr(Rand(4000, 5000), Rand(2500, 3200), 1)\n ) * Linen.kr(gate, 0.01, 0.7, dr, 2);\n OffsetOut.ar(out, Pan2.ar(z, pan, amp));\n}).add;\n);\n\n(instrument: \\pm).play;\n\n(instrument: \\pm, ratio: 3.42, index: 12, freq: 150, ar: 8, dr: 3, sustain: 10).play;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `ChaosGen` in SuperCollider briefly."}, {"role": "assistant", "content": "ChaosGen — UGens that cause chaos \"ChaosGen\" is an abstract class - in other words, a class that you do not use directly. Instead, use one of its subclasses. Various things inherit from this abstract class, including HenonN, LinCongL, LatoocarfianL, GbmanL, CuspL, StandardL, and more. Category: UGens > Generators > Chaotic."}]} -{"conversations": [{"role": "user", "content": "What does `Out.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Write a signal to a bus. Arguments: bus — The index of the bus to write out to. The lowest numbers are written to the audio hardware.; channelsArray — An Array of channels or single output to write out. You cannot change the size of this once a SynthDef has been built.."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Ndef`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\nNdef(\\sound).play;\nNdef(\\sound).fadeTime = 1;\nNdef(\\sound, { SinOsc.ar([600, 635], 0, SinOsc.kr(2).max(0) * 0.2) });\nNdef(\\sound, { SinOsc.ar([600, 635] * 3, 0, SinOsc.kr(2 * 3).max(0) * 0.2) });\nNdef(\\sound, { SinOsc.ar([600, 635] * 2, 0, SinOsc.kr(2 * 3).max(0) * 0.2) });\nNdef(\\sound, Pbind(\\dur, 0.17, \\freq, Pfunc({ rrand(300, 700) })));\n\nNdef(\\lfo, { LFNoise1.kr(3, 400, 800) });\nNdef(\\sound).map(\\freq, Ndef(\\lfo));\nNdef(\\sound, { |freq| SinOsc.ar([600, 635] + freq, 0, SinOsc.kr(2 * 3).max(0) * 0.2) });\nNdef(\\lfo, { LFNoise1.kr(300, 400, 800) });\n\nNdef.clear; // clear all Ndefs\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n{\n // LFSaw begins at 0, illustrates attack time better\n var sig = LFSaw.ar(440);\n var amps = Amplitude.ar(\n sig,\n attackTime: [0.001, 0.01],\n releaseTime: [0.01, 0.2]\n );\n [sig] ++ amps\n}.plot\n.superpose_(true)\n.plotColor_([Color.black, Color.green, Color.blue]);\n);\n\n(\n// use input amplitude to control SinOsc frequency\n{\n SinOsc.ar(\n Amplitude.kr(\n Blip.ar(3, 20) * LFNoise1.kr(0.1).range(0, 1),\n MouseX.kr(0.00\n// …\n```"}, {"role": "assistant", "content": "LFSaw begins at 0, illustrates attack time better use input amplitude to control SinOsc frequency (Amplitude: Amplitude follower)"}]} -{"conversations": [{"role": "user", "content": "What does `Object.yield` do?"}, {"role": "assistant", "content": "Must be called from inside a Routine. Yields control to the calling thread. The receiver is the result passed to the calling thread's method. The result of yield will be the value passed to the Routine's next method the next time it is"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for load all files for the hyperdisco setup."}, {"role": "assistant", "content": "```supercollider\n//// load all files for the hyperdisco setup.\n\nq = q ? ();\nq.hyperfolder = q.hyperfolder ?? { thisProcess.nowExecutingPath.dirname };\n\n(q.hyperfolder +/+ \"libs/_SynthLib.scd\").loadPaths;\n(q.hyperfolder +/+ \"libs/_FXLib.scd\").loadPaths;\n(q.hyperfolder +/+ \"setup_files/2_makeHistory.scd\").loadPaths;\n\nif (Platform.hasQt) {\n (q.hyperfolder +/+ \"setup_files/1a_Butz.scd\").loadPaths;\n (q.hyperfolder +/+ \"setup_files/1b_winbounds.scd\").loadPaths;\n (q.hyperfolder +/+ \"setup_files/2b_makeHistoryGUI.scd\").loadPaths;\n};\n\n// this may be too harsh - comment out if not needed!\nServer.killAll;\n\nTask {\n try { (q.hyperfolder +/+ \"setup_files/1_logMeIn.scd\").loadPaths } {\n \"*** setup_files/1_logMeIn.scd failed!\".postln;\n };\n 1.wait;\n\n (q.hyperfolder +/+ \"setup_files/3_runCode*.scd\").loadPaths;\n\n // this could be problematic,\n if (Platform.hasQt) {\n // maybe we need a non-doc- SyncText version?\n (q.hyperfolder +/+ \"setup_files/4_makeSyncedEditor.scd\").loadPaths;\n // sent drawing code will just be ignored ...\n /// would be nice if it did get shown!\n (q.hyperfolder +/+ \"setup_files/5_drawer.scd\").loadPaths;\n };\n\n s.options.memSize = (2 ** 18).asInteger;\n s.waitForBoot {\n s.sync;\n (q.hyperfolder +/+ \"setup_files/6_HyperMasterFX.scd\").loadPaths;\n };\n\n}.play(AppClock);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for gabber kick (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\gabberkick, {\n var snd;\n snd = SinOsc.ar(Env([1000, 69, 60], [0.015, 0.1], \\exp).ar * [-0.1, 0, 0.1].midiratio);\n snd = Mix(snd);\n snd = (snd * 10).tanh;\n snd = (snd * 5.1).atan;\n snd = BPeakEQ.ar(snd, XLine.kr(2000, 100, 0.3), 2.0, 8);\n snd = snd + DelayC.ar(snd, 0.01, SinOsc.ar(4).range(0.0, 0.001));\n snd = RLPF.ar(snd, 8000, 0.7);\n snd = snd * Env([0, 1, 0.7, 0.7, 0], [0.001, 0.01, 0.3, 0.02]).ar(2);\n snd = (snd * 0.6).clip(-1, 1);\n Out.ar(\\out.kr(0), Pan2.ar(snd, \\pan.kr(0), \\amp.kr(0.1)));\n}).add;\n);\n\nSynth(\\gabberkick, [amp: 0.6])\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nPfindur(16, Pbind(....)\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nPfindur(16, Pbind(....))\n```"}]} -{"conversations": [{"role": "user", "content": "Write a plucked string in SuperCollider."}, {"role": "assistant", "content": "Pluck is a Karplus-Strong string: a noise burst into a tuned delay with feedback. The delay time is\nthe reciprocal of the frequency.\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 220, amp = 0.5, dur = 3|\n var period = freq.reciprocal;\n var sig = Pluck.ar(WhiteNoise.ar(0.2), Impulse.kr(0), period, period, dur, 0.5);\n Out.ar(out, Pan2.ar(sig * amp, 0));\n}).add;\n);\nSynth(\\pluck, [\\freq, 330, \\dur, 4]);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `PLbindefPar.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new PLbindefPar object or sets sources of an existing Arguments: ... args — First arg should be the name, followed by num, the number of parallel PLbindefs, and the key/value pairs. Values are assigned to single PLbindefs according to the convention of PLbindefParEnvironment#-put, see there and examples below. The last arg can be an optional environment which determines whe."}]} -{"conversations": [{"role": "user", "content": "What does `Dbrown2.new` do? What arguments does it take?"}, {"role": "assistant", "content": "demand rate brownian movement with Gendyn distributions Arguments: lo — minimum value; hi — maximum value; step — maximum step for each new value; dist — gendyn distribution (see Gendy1); length — number of values to create."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for smooth arpeggio, updated envelope (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\bass, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.perc(0.2), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `OnePole`."}, {"role": "assistant", "content": "```supercollider\n{ OnePole.ar(WhiteNoise.ar(0.5), 0.95) }.play\n\n{ OnePole.ar(WhiteNoise.ar(0.5), -0.95) }.play\n\n{ OnePole.ar(WhiteNoise.ar(0.5), Line.kr(-0.99, 0.99, 10)) }.play\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Abusing Convolution2 to make pitch."}, {"role": "assistant", "content": "```supercollider\n// fixed (unchanging) impulse response\n// cmd-. to stop\n\n(\ns.waitForBoot {\n var c = Condition.new, cleanfunc = { CmdPeriod.remove(cleanfunc); b.free };\n fork {\n b = Buffer.alloc(s, 2048, 1);\n CmdPeriod.add(cleanfunc);\n s.sync;\n a = {\n RecordBuf.ar(BrownNoise.ar * EnvGen.ar(Env(#[0, 1, 0], #[0.5, 0.5], \\sin), timeScale: b.duration, doneAction: 2), b, loop: 0);\n 0\n }.play;\n OSCpathResponder(s.addr, ['/n_end', a.nodeID], { |time, resp, msg|\n resp.remove;\n c.unhang;\n }).add;\n c.hang;\n a = {\n var freq = MouseX.kr(150, 450, warp: 1, lag: 0.1);\n LeakDC.ar(Convolution2.ar(Impulse.ar(freq), b, framesize: b.numFrames) * -35.dbamp) ! 2;\n }.play;\n };\n};\n);\n\n\n\n// multiple impulse responses for timbre control\n(\ns.waitForBoot {\n var c = Condition.new, cleanfunc = { CmdPeriod.remove(cleanfunc); b.free };\n fork {\n b = Buffer.allocConsecutive(3, s, 2048, 1);\n CmdPeriod.add(cleanfunc);\n s.sync;\n a = {\n var sig = [BrownNoise.ar, PinkNoise.ar, WhiteNoise.ar];\n sig.do { |chan, i|\n RecordBuf.ar(chan * EnvGen.ar(Env(#[0, 1, 0], #[0.5, 0.5], \\sin), timeScale: b[i].duration, doneAction: 2), b[i], loop: 0);\n 0\n };\n }.play;\n OSCpathResponder(s.addr, ['/n_end', a.nodeID], { |time, resp, msg|\n resp.remove;\n c.unhang;\n }).add;\n c.hang;\n a = {\n var freq = MouseX.kr(150, 450, warp: 1, lag: 0.1),\n index = MouseY.kr(0, 1.99, lag: 0.1),\n iWhole = index.trunc(2),\n iFrac = index - iWhole,\n iAdjust = iFrac >= 1.0,\n trig = Impulse.ar(freq),\n convolvers = b.collect { |buf, i|\n LeakDC.ar(Convolution2.ar(trig, buf, framesize: buf.numFrames))\n };\n (\n XFade2.ar(\n Select.ar(iWhole + (2 * iAdjust), convolvers),\n Select.ar(iWhole + 1, convolvers),\n iFrac.fold(0, 1) * 2 - 1\n ) * -30.dbamp\n ) ! 2;\n }.play;\n };\n};\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Shift register patch (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n/*\nShift register code adapted from here:\n\n\"http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/serial-in-parallell-out-shift-register-ugen-td6331387.html\"\n*/\n\n(\n~shift_register = {arg length = 5, trig, in;\n \n var buf = LocalBuf(length);\n var count = PulseCount.kr(trig);\n \n Demand.kr(trig, 0, Dbufwr(in, buf, count));\n Demand.kr(trig, 0, Dbufrd(buf, count + (1..length))).reverse;\n};\n\nNdef(\\n1, {\n\n var amp = 0.1;\n var pulse = Impulse.kr(1/16);\n var rate = TChoose.kr(pulse, [3,5,10]);\n var trans = TChoose.kr(pulse, [0,2,-2,7,-5]);\n\n //var trig = Impulse.kr([3,5]/2);\n var trig = Trig1.kr(CuspL.ar(rate * 3), 0.001);\n var octave = Demand.kr(PulseDivider.kr(trig, 4), 0, Drand([12,-12], inf));\n var note = Demand.kr(trig, 0, Dseq([42,46,51,54,59,63,66].scramble + trans, inf) + octave);\n var chord = ~shift_register.(5, trig, note);\n\n var sig = PMOsc.ar(\n Vibrato.ar(K2A.ar(chord.midicps)),\n chord.midicps * LFPulse.kr(1/8).range(1.01, 2.01),\n Env([3,3,0],[0, 0.2], -4).kr(gate:trig)\n );\n sig = sig * AmpCompA.kr(chord.midicps) * amp;\n\n sig = sig.flatten.sum;\n sig = XFade2.ar(sig!2, GVerb.ar(BPF.ar(sig, 90.midicps), roomsize:50, revtime:8, drylevel:0), 0.2);\n sig;\n\n}).play(fadeTime:4);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Pipe.new` do? What arguments does it take?"}, {"role": "assistant", "content": "pipe stdin to, or stdout from, a UNIX shell command Arguments: commandLine — A String representing a valid shell command.; mode — A String representing the mode. Valid modes are \"w\" (pipe to stdin) and \"r\" (pipe from stdout).."}]} -{"conversations": [{"role": "user", "content": "What does `HSpar.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new HSpar Arguments: server — Must be running server.; ugenFuncs — Collection of functions that define the synths.; demandLatency — Latency of help synths in seconds. Default value 0.15.; respondLatency — Time in seconds, given to the response to be received by the client on time. Default value 0.15.; postOSC — Boolean for posting of (server to client) OSC messages. Defaults to false.; granularity — Time grains per second, quantization for bookkeeping. Defaults to 200.; inputCheck — Boolean for checking input data. Defaults to true.."}]} -{"conversations": [{"role": "user", "content": "What does `DebugFrame.context` do?"}, {"role": "assistant", "content": "Returns another DebugFrame of the compiling context, rarely"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `CuspN`."}, {"role": "assistant", "content": "```supercollider\n// vary frequency\n{ CuspN.ar(MouseX.kr(20, SampleRate.ir), 1.0, 1.99) * 0.3 }.play(s);\n\n// mouse-controlled params\n{ CuspN.ar(SampleRate.ir/4, MouseX.kr(0.9, 1.1, 1), MouseY.kr(1.8, 2, 1)) * 0.3 }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(CuspN.ar(40, MouseX.kr(0.9, 1.1, 1), MouseY.kr(1.8, 2, 1))*800+900)*0.4 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SimpleLabel.makeViewWithStringSize` do? What arguments does it take?"}, {"role": "assistant", "content": "private Arguments: layout — the parent view, FlowView or window; optimalWidth; minHeight — default is GUI.skin.buttonHeight. Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(//*********PREPARE**********\np.pop;\n//Any code that needs to access your own environment goes here\np = ProxySpace.push(s);\n~fxLoop.play.fadeTime_(5);\n);\n\n(//*********FXLoop**********\n~fxLoop = {\n var in = SoundIn.ar([0,1]);\n in;\n}\n)\n```"}, {"role": "assistant", "content": "Code for using Supercollider as a realtime livecode FX processor for audio input. Blog post explaing this code: http://schemawound.com/post/53528545022/fxloop."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes blipecho context."}, {"role": "assistant", "content": "```supercollider\n( \nSynthDef(\\klang_blip, { \n | out = 0, release = 1, freq1 = 1, freq2 = 5, freq3 = 8, freq_mul = 4, atk_dur = 0.01, amp = #[0.3,0.3,0.3], mod_freq = 25 | \n var sig = DynKlang.ar(\n `[([freq1, freq2, freq3].linexp(1,12,1,1140) * freq_mul), amp, nil ], \n EnvGen.kr(Env([5,1.05,0.95,0.01],[0.025,release*3/4,release/4])), \n 150\n ) * LFGauss.kr(mod_freq.reciprocal, 0.3);\n Out.ar(out, (sig/8)!2 * Linen.kr(Impulse.kr(0), atk_dur, 1, release, doneAction:2)) \n}).add;\n\nSynthDef(\\dubecho,{|in, out, length = 1, fb = 0.8, sep = 0.012|\n var input = In.ar(in, 2);\n var feedback = LocalIn.ar(2);\n var output = LeakDC.ar(feedback*fb + input);\n output = HPF.ar(output, 400);\n output = LPF.ar(output, 12000);\n output = output.tanh;\n LocalOut.ar(DelayC.ar(output, 1, LFNoise2.ar(12).range([length,length+sep],[length+sep,length])).reverse);\n ReplaceOut.ar(out, output);\n}).add;\n);\n\n( \n~bus = Bus.audio(s, 2);\n~echo = Synth(\\dubecho, [\\in, ~bus, \\length, TempoClock.default.tempo*(3/8), \\fb, 0.25, \\sep, 0.0012], addAction: \\addToTail);\n\nPbind(*[ \n instrument: \\klang_blip, \n dur: Pwrand([0.25,0.5,1,0.125], [16,16,1,1].normalizeSum, inf), \n release: Pkey(\\dur),\n freq_mul: Pstutter(Pwrand([1,2,4],[5,3,2].normalizeSum,inf), Pxrand((1..6), inf)),\n freq1: Pstutter(Pxrand((2,4..16), inf), Prand((1..4), inf)), \n freq2: Pstutter(Pxrand((2,4..16), inf), Prand((4..8), inf)), \n freq3: Pstutter(Pxrand((2,4..16), inf), Prand((8..12), inf)),\n mod_freq: Pstutter(Pxrand((2,4..16), inf), Pbrown(7,30,3)),\n atk_dur: Pkey(\\freq_mul).linlin(12,2,0.01,0.4),\n out: ~bus,\n amp: Pstutter(Pxrand((2,4..16),inf), Pfunc({[2,3,4].normalizeSum.scramble}))\n]).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\ns.plotTree;\n\n// Define and play a repeating pattern that generates a new synth every 0.4 seconds:\nx = Pn((dur: 0.4, midinote: 69, amp: 0.1)).play;\n\n/*\nThe NodeTreeView window dynamically displays active synth nodes.\nInitially, it shows the first node, and upon each refresh, it retains the previous node while adding a new one.\nThis results in the display of one or two subsequent nodes at each interval.\n*/\n\n// stop updating plotTree:\ns.nodeTreeView.stop;\n\n// start updating plotTree:\ns.nodeTreeView.start;\n\n// stop the playback of the pattern:\nx.stop;\n\ns.nodeTreeV\n// …\n```"}, {"role": "assistant", "content": "Define and play a repeating pattern that generates a new synth every 0.4 seconds: stop updating plotTree: (Server: Object representing a server application)"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n/* Audio plugin definition\n\n Each audio plugin should define the following global variables:\n ~name: (symbol) name of the spatializer\n ~description: (string) a short description\n ~function: the actual definition of the plugin\n\n*/\n\n~name = \\emptySource;\n~description = \"dummy/template\";\n~channelLayout = \\mono;\n\n~function = {\n DC.ar(0);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "What does `PeakFollower.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Track peak signal amplitude. Arguments: in — The input signal.; decay — Decay factor.."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PLbindef`."}, {"role": "assistant", "content": "```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n// synthdefs to play with\n\n(\nSynthDef(\\noise_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, rq = 0.1, amp = 0.1|\n var sig = { WhiteNoise.ar } ! 2;\n sig = BPF.ar(sig, freq, rq) *\n EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2) *\n (rq ** -1) * (250 / (freq ** 0.8));\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\sin_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { SinOsc.ar(freq, Rand(0, 2pi)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\saw_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { VarSaw.ar(freq, Rand(0, 1)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// Since the allpass delay has no audible effect as a resonator on\n// steady state sound ...\n\n{ AllpassN.ar(WhiteNoise.ar(0.1), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// ...these examples add the input to the effected sound and compare variants so that you can hear\n// the effect of the phase comb:\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassN.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2)\n}.play)\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassL.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2\n// …\n```"}, {"role": "assistant", "content": "Since the allpass delay has no audible effect as a resonator on steady state sound ... (AllpassN: Schroeder allpass delay line with no interpolation.)"}]} +{"conversations": [{"role": "user", "content": "What does `Object.dup` do?"}, {"role": "assistant", "content": "Duplicates the receiver n times, returning an array of n copies. Different classes respond to this message differently. The shortcut \"!\" can be used in"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `BufSampleRate`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n// compares a 1102.5 Hz sine tone (11025 * 0.1, left) with a 1100 Hz tone (right)\n// the apollo sample has a sample rate of 11.025 kHz\n(\n{\n var freq;\n freq = [BufSampleRate.kr(b) * 0.1, 1100];\n SinOsc.ar(freq, 0, 0.1)\n}.play;\n);\n\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `String.stripRTF` do?"}, {"role": "assistant", "content": "Returns a new String with all RTF formatting removed."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\ns.scope;\na = { HilbertFIR.ar(SinOsc.ar(100) * -20.dbamp, LocalBuf(2048) }.play;\na.release;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\ns.scope;\na = { HilbertFIR.ar(SinOsc.ar(100) * -20.dbamp, LocalBuf(2048)) }.play;\na.release;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Out.ar(87, SinOsc.ar(MouseX.kr(340, 1000, 1) * [1, 2, 3], 0, 0.2)) }.play;\nx = Monitor.new.play(87, 3, 0, fadeTime: 3;\nx.stop;\nx.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Out.ar(87, SinOsc.ar(MouseX.kr(340, 1000, 1) * [1, 2, 3], 0, 0.2)) }.play;\nx = Monitor.new.play(87, 3, 0, fadeTime: 3);\nx.stop;\nx.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `BrownNoise`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// 以下のSynthDefは全て共通のコントロール名(mul)を持つ\n(\n// 3つのSynthDefとグループを作成する\nSynthDef(\"synthNumber1\", { arg mul = 0.2;\n Out.ar(\n 0,\n BrownNoise.ar(mul) * LFNoise0.kr([1, 1.01])\n )\n }, [0.1]).add;\nSynthDef(\"synthNumber2\", { arg mul = 0.2;\n Out.ar(\n 0,\n WhiteNoise.ar(mul) * LFNoise1.kr([2.99, 3])\n )\n }, [0.1]).add;\nSynthDef(\"synthNumber3\", { arg mul = 0.2;\n Out.ar(\n 0,\n PinkNoise.ar(mul) * LFNoise2.kr([0.79, 0.67])\n )\n}, [0.1]).add;\n);\n\n(\n// グループを作成する\n~myGroup = Group.new;\n);\n\n(\n// 3つのシンセを加える\nSynth.head(~myGroup, \"synthNumber1\");\nSynth.head(~myGroup, \"synthNumber2\");\nSynth.head(~myGroup, \"synthNumber3\");\n);\n\n// 3つのシンセのそれぞれの\\mulコントロール、新しい(そして同じ)値にセットする\n~myGroup.set(\\mul, 0.05)\n```"}]} +{"conversations": [{"role": "user", "content": "What are the arguments of PlayBuf.ar?"}, {"role": "assistant", "content": "`PlayBuf.ar(numChannels, bufnum, rate, trigger, startPos, loop)`. numChannels must match what is in the buffer, or you get a channel mismatch; bufnum is the Buffer's integer number; rate is playback speed where 1 is normal and negative plays backwards; trigger restarts playback on each trigger in loop mode; startPos is in frames; loop is 0 or 1. `PlayBuf.ar(1, ~buf, BufRateScale.kr(~buf), loop: 1)` is the standard pitch-correct form."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Latoocarfian2DL.ar(MouseX.kr(20, SampleRate.ir * 0.5), MouseX.kr(40, SampleRate.ir), mul:0.2) }.play(s);\n\n\n(\n{ Latoocarfian2DL.ar(\n SampleRate.ir/4,\n SampleRate.ir,\n LFNoise2.kr(2.dup, 1.5, 1.5),\n d:LFNoise2.kr(2.dup, 0.5, 1.5),\n mul:0.2\n) }.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Latoocarfian2DL.ar(MouseX.kr(20, SampleRate.ir * 0.5), MouseX.kr(40, SampleRate.ir), mul:0.2) }.play(s);\n\n\n(\n{ Latoocarfian2DL.ar(\n SampleRate.ir/4,\n SampleRate.ir,\n LFNoise2.kr(2.dup, 1.5, 1.5),\n d:LFNoise2.kr(2.dup, 0.5, 1.5),\n mul:0.2\n) }.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n \n// definition for future reference in arbitrary Environments\n\np = PLbrown(\\lo, \\hi, \\step);\n\n\n// prepare current Environment\n// PLseq repeats arg defaults to inf\n\n(\n~lo = 55;\n~hi = 80;\n~step = Pstutter(10, PLseq([0.05, 3.5]));\n);\n\n\n// run\n\n(\nx = Pbind(\n \\midinote, Ptuple(p!2), \n \\dur, 0.1\n).play;\n);\n\n// replace\n\n(\n~lo = Pseq((50..90));\n~hi = Pseq((50..90) + 15);\n)\n```"}, {"role": "assistant", "content": "definition for future reference in arbitrary Environments prepare current Environment (PLbrown: dynamic scope Pbrown variant)"}]} +{"conversations": [{"role": "user", "content": "What does `ModMap.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a new ModMap to modulate Arguments: Fade time for ModMap.."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// where did I leave my keys?\n(\nvar n = 30, m = 5;\nNdef.clear(3);\nNdef.ar(\\x, n);\nNdef(\\y, { Splay.ar(Ndef.ar(\\x, m, LFNoise1.kr(1/m).range(0, n - m - 1))).clip2 * 0.5 }).play; \nNdef(\\x, { \n { \n var a = Ndef.ar(\\x, 1, LFNoise0.kr(Rand()) * Rand() + Rand() * n);\n a + 0.1 * SinOsc.ar(ExpRand(0.2, 1000)) \n } ! n\n}); \n);\n\n// where did I put my keys?\n(\nvar n = 30, m = 5;\nNdef.clear(3);\nNdef.ar(\\x, n);\nNdef(\\y, { Splay.ar(Ndef.ar(\\x, m, LFNoise1.kr(1/m).range(0, n - m - 1))).clip2 * 0.5 }).play; \nNdef(\\x, { \n {\n var a = Ndef.ar(\\x, 1, LFNoise0.kr(Rand()) * Rand() + Rand() * n);\n SinOsc.ar(ExpRand(0.2, 1000), a) \n } ! n\n}); \n)\n```"}, {"role": "assistant", "content": "Cross-tuning between multiple signal dimensions. The code is finished without listening."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// as amplitude envelope\n(\n{\n var env = Env([0, 1, 0.5, 1, 0], [0.01, 0.5, 0.02, 0.5]);\n SinOsc.ar(470) * EnvGen.kr(env, doneAction: Done.freeSelf)\n}.play\n);\n\n// as amplitude and modulation envelope\n(\n{\n var env = Env([0, 1, 0.5, 0.8, 0, 1.2, 0], [0.01, 0.5, 0.02, 0.5, 0.2, 0.5]);\n var gate = Impulse.kr(MouseX.kr(0.2, 3), 0.5);\n var gen = EnvGen.kr(env, gate);\n SinOsc.ar(270, S\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// as amplitude envelope\n(\n{\n var env = Env([0, 1, 0.5, 1, 0], [0.01, 0.5, 0.02, 0.5]);\n SinOsc.ar(470) * EnvGen.kr(env, doneAction: Done.freeSelf)\n}.play\n);\n\n// as amplitude and modulation envelope\n(\n{\n var env = Env([0, 1, 0.5, 0.8, 0, 1.2, 0], [0.01, 0.5, 0.02, 0.5, 0.2, 0.5]);\n var gate = Impulse.kr(MouseX.kr(0.2, 3), 0.5);\n var gen = EnvGen.kr(env, gate);\n SinOsc.ar(270, SinOsc.ar(gen * 473)) * gen * 0.2\n}.play\n);\n// EnvGen multichannel expands when passed a multichannel envelope\n(\n{\n SinOsc.ar(\n EnvGen.kr(\n Env.circle([0, 1, 0, (2..4), 0, LFNoise1.kr(0.1 ! 5) * 10, 0], [0.01, 0.6])\n )\n * 240 + 300\n ).sum * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `BufSampleRate`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n// compares a 1102.5 Hz sine tone (11025 * 0.1, left) with a 1100 Hz tone (right)\n// the apollo sample has a sample rate of 11.025 kHz\n(\n{\n var freq;\n freq = [BufSampleRate.kr(b) * 0.1, 1100];\n SinOsc.ar(freq, 0, 0.1)\n}.play;\n);\n\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `PHSplayer.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new PHSplayer Arguments: pHelpSynth — A PHS object.."}]} +{"conversations": [{"role": "user", "content": "What does `RedWorld.damping` do?"}, {"role": "assistant", "content": "A scalar. The cost of running into walls"}]} +{"conversations": [{"role": "user", "content": "What does `BSpline.interpolate` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: divisions — (describe argument here). Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// write a sine oscillator's output to a pin\n\n(\nSynthDef(\"help-DigitalOut\", { |out = 0|\n DigitalOut.ar(0, SinOsc.ar(10));\n}).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// write a sine oscillator's output to a pin\n\n(\nSynthDef(\"help-DigitalOut\", { |out = 0|\n DigitalOut.ar(0, SinOsc.ar(10));\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is the difference between TempoClock and SystemClock?"}, {"role": "assistant", "content": "SystemClock runs in real time and is what `.wait` uses by default. TempoClock runs in beats and has a tempo, so it can be changed while things are playing and Patterns scheduled on it follow. `TempoClock.default` is the clock Patterns use unless told otherwise, which is why `TempoClock.default.tempo = 2` changes the speed of everything you already have running."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n \n// definition for future reference in arbitrary Environments\n\n(\np = Pbind(\n \\midinote, PLnaryop('+', \\src, [\\dev]),\n \\dur, 0.1\n);\n);\n\n\n// define Environment and play\n\n(\ne = (src: PLseq([61,62]), dev: Pbrown(-5, 5, 0.2) );\n\ne.use { x = p.play };\n);\n\n\n// replace\n\ne.dev = PLseq((0, 0.5..7));\n\ne.dev = Pbrown(-5, 5, 0.2);\n\ne.src = PLseq([61,64,65]);\n// …\n```"}, {"role": "assistant", "content": "definition for future reference in arbitrary Environments define Environment and play (PLnaryop: dynamic scope Pnaryop variant)"}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nRoutine({ loop { Synth(\\kick); 0.5.wait } }).play;\n```"}, {"role": "assistant", "content": "It starts a kick every half second, forever.\n\nA Routine is a language-side coroutine: `.play` runs it on the clock, and `wait` suspends it until the next\nbeat without blocking anything else. Inside the `loop`, `Synth(\\kick)` creates a kick and `0.5.wait` waits\nhalf a beat on the current TempoClock — the tempo, not seconds, so changing the clock changes the rate.\nBecause the kick SynthDef frees itself with `doneAction: 2`, the loop can run for hours without leaking\nnodes."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `PdurStutter`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,0,1,3,4,0], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n100.do({ x.next.postln });\n);\n\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n);\n\n\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,4,4,0,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `AbstractSPlayFile` in SuperCollider briefly."}, {"role": "assistant", "content": "AbstractSPlayFile — an abstract class for all soundfile players Helper class for soundfile players. Category: SInstruments."}]} +{"conversations": [{"role": "user", "content": "What does `ServerOptions.ugenPluginsPath` do?"}, {"role": "assistant", "content": "A path or an Array of paths. If non-nil, the standard paths are NOT searched for plugins. This corresponds with the option"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for electric hum: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\eHum).addSpec(\\fFreq, ControlSpec(25, 1000, \\lin, step: 25));\nNdef(\\eHum).addSpec(\\fRq, [0.01, 0.2]);\nNdef(\\eHum).addSpec(\\fFreqIdx, [0, 8, \\lin, 0.2]);\nNdef(\\eHum).fadeTime = 2;\n\nNdef(\\eHum, {|fFreqIdx = 1, fRq = 0.1|\n var src = Impulse.ar([50, 75, 100]); // three sources\n var fFreq = (25 * (2 ** fFreqIdx));\n\n Splay.ar((BPF.ar(src, fFreq, fRq))* 8)\n})\n);\n\nNdef(\\eHum).gui;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// hear the difference, LinPan having a slight drop in the middle...\n{ LinPan2.ar(SinOsc.ar(440), Line.kr(-1, 1, 5)) }.play\n\n// ... whereas Pan2 is more smooth\n{ Pan2.ar(SinOsc.ar(440), Line.kr(-1, 1, 5)) }.play\n\n// other examples\n{ Pan2.ar(PinkNoise.ar(0.4), FSinOsc.kr(2), 0.3) }.play;\n```"}, {"role": "assistant", "content": "hear the difference, LinPan having a slight drop in the middle... ... whereas Pan2 is more smooth (Pan2: Two channel equal power pan.)"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// Pn advances Pgate each time its subpattern is repeated\n(\nPbind(\n \\degree, Pn(Pseq((0..7)), inf, \\step),\n \\mtranspose, Pgate(Pwhite(0, 5), inf, \\step),\n \\dur, 0.2\n).play\n);\n\n\n// Two different Pgates advanced at two different rates\n(\nPbind(\n\n \\scale, Scale.minor,\n \\foo, Pn(Pseq((0..2)), inf, \\step1),\n \\degree, Pn(Pseq((0..7).mirror), inf, \\step),\n \\ctranspose, Pgate(Pwhite(0, 5), inf, \\step) + Pgate(Pseq([0, 7, 0, -7], inf), inf, \\step1),\n \\dur, 0.\n// …\n```"}, {"role": "assistant", "content": "Pn advances Pgate each time its subpattern is repeated Two different Pgates advanced at two different rates (Pgate: A gated stream that only advances when a particular event key is true.)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n//difficult to find active parameters, forced to try resetting! \n\n{Out.ar(0,Pan2.ar(0.5*TermanWang.ar(2.0,Impulse.kr(MouseX.kr(1,1000)),0.1,0.01,1.0,1.0,1.0,MouseX.kr(0.4,1.2), MouseY.kr(2.0,4.0)),0.0))}.play;\n\n\n{Out.ar(0,Pan2.ar(0.5*TermanWang.ar(LFNoise1.ar(LFNoise0.kr(0.5,500,500),1.0,3.0),Impulse.kr(MouseX.kr(1,10000, 'exponential')),0.01,0.01,1.0,1.0,1.\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n//difficult to find active parameters, forced to try resetting! \n\n{Out.ar(0,Pan2.ar(0.5*TermanWang.ar(2.0,Impulse.kr(MouseX.kr(1,1000)),0.1,0.01,1.0,1.0,1.0,MouseX.kr(0.4,1.2), MouseY.kr(2.0,4.0)),0.0))}.play;\n\n\n{Out.ar(0,Pan2.ar(0.5*TermanWang.ar(LFNoise1.ar(LFNoise0.kr(0.5,500,500),1.0,3.0),Impulse.kr(MouseX.kr(1,10000, 'exponential')),0.01,0.01,1.0,1.0,1.0,MouseX.kr(0.4,1.2), MouseY.kr(2.0,4.0)),0.0))}.play;\n\n\n{Out.ar(0,Pan2.ar(FreeVerb.ar(0.5*TermanWang.ar(2.0+ SinOsc.ar(MouseX.kr(10,10000,'exponential'),0,MouseY.kr(0.1,100.0,'exponential')),Impulse.kr(MouseX.kr(1,10000, 'exponential')),0.01,0.01,1.0,1.0,1.0,MouseX.kr(0.4,1.2), MouseY.kr(2.0,4.0)),0.5)))}.play;\n```"}]} +{"conversations": [{"role": "user", "content": "How do I play a sample from disk?"}, {"role": "assistant", "content": "Load it into a Buffer on the server, then play the buffer. `BufRateScale` keeps the pitch right when\nthe file's sample rate differs from the server's.\n\n```supercollider\n(\ns.waitForBoot {\n ~buf = Buffer.read(s, \"C:/sounds/break.wav\");\n SynthDef(\\player, { |out = 0, buf = 0, amp = 0.6, rate = 1|\n var sig = PlayBuf.ar(2, buf, BufRateScale.kr(buf) * rate, loop: 1);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n ~player = Synth(\\player, [\\buf, ~buf]);\n};\n)\n```\nUse `numChannels` 1 for a mono file; a mismatch is silent or wrong-sounding rather than an error."}]} +{"conversations": [{"role": "user", "content": "What does `Interface.keyDownAction` do?"}, {"role": "assistant", "content": "Sets up an environment in which you can build a player, a GUI and responders for midi and keyboard control"}]} +{"conversations": [{"role": "user", "content": "I get \"Message 'ar' not understood\". Why?"}, {"role": "assistant", "content": "You called a rate method on something that is not a UGen. `Env.ar(...)` and `Buffer.ar(...)` are the classic cases: Env is a language-side description and is played by `EnvGen.ar(env, ...)`; a Buffer is server memory and is played by `PlayBuf.ar` or `BufRd.ar`. The UGen is the thing with a rate method — if it is a description or a container, there is another UGen that consumes it."}]} +{"conversations": [{"role": "user", "content": "Explain `Pair` in SuperCollider briefly."}, {"role": "assistant", "content": "Pair — LISP-like two element cells Category: Collections > Ordered."}]} +{"conversations": [{"role": "user", "content": "Where does the magic frequency 261.6255653006 come from?"}, {"role": "assistant", "content": "SuperCollider forum — Where does the magic frequency 261.6255653006 come from?\n\nThinking about this a bit more, on one hand it might be useful if set (and everything else in Event) could fetch not only the msgFunc from the synthDesc, which it does (if args are set to []), but perhaps also the default values for the synth controls... and then used those in preference to Event defaults if “nothing is specified” for some key in the event. Alas “nothing is specified” is tedious to detect in Event, as it does its own calculations which have a lot of inputs (esp. for the frequency stuff). So, one could implement such a policy more explicitly in a \\finish callback that e.g. looks up in synthDesc only specific keys (say specified in a defArgs, possibly with [] meaning all found in the synthDesc) and sets only those if “not set” in event.\n\nI almost started coding this idea, but I realised that’s actually inferior to just putting the synth defaults in another event/environment, and chaining that before the event... which is exactly what I usually do with a Pdef.envir. That approach, besides sidestepping the issue of detecting what’s “not set” in the Event, has an extra advantage that a persistent set of defaults, after being initialized with the synthdef ones, can be easily tweaked in a gui. When I find myself that I often change the default value of some control like that, I go back and change the synthdef default. Because of that workflow, in which I always have the defaults loaded in an chained envir, I didn’t even have much realization of Event defaults for things like amp, freq etc. And I didn’t need type: \\set much until recently... for which getting the args constructed in that case is also rather easy as Pdef(...).controlKeys. Even without Pdefs, that’s straightforward (past loading those defaults into an event)\n\n```supercollider\ne = SynthDescLib.global.synthDescs.at(\\default).controls.inject((), { |e, c| e[c.name] = c.defaultValue });\n(instrument: \\default, dur: 1, amp: 0.2).next(e).play\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `CoinGate`."}, {"role": "assistant", "content": "```supercollider\n(\na = SynthDef(\"help-TCoin\", { |out = 0, prob = 0.5|\n var trig;\n trig = CoinGate.kr(prob, Impulse.kr(10));\n Out.ar(out,\n SinOsc.ar(\n TRand.kr(300.0, 400.0, trig), 0, 0.2\n )\n )\n}).play;\n);\n\na.set(\\prob, 1.0);\na.set(\\prob, 0.0);\na.set(\\prob, 0.1);\n\n\n(\na = SynthDef(\"help-TCoin\", { |out = 0, prob = 0.5|\n var trig;\n trig = Impulse.ar(20, 0, SinOsc.kr(0.5, 0, 1, 1));\n Out.ar(out,\n Mix.fill(3, { Ringz.ar(CoinGate.ar(prob, trig*0.5), #[1, 1.5]*Rand(1000, 9000), 0.01) })\n )\n}).play;\n);\n\na.set(\\prob, 1.0);\na.set(\\prob, 0.0);\na.set(\\prob, 0.1);\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Resonz`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"noiseToPitch\", { arg out = 0, mul = 1;\n Out.ar(\n out,\n Resonz.ar(\n WhiteNoise.ar(mul),\n LFNoise0.kr(4, 110, 660),\n [0.005, 0.005]\n )\n )\n}).add;\n);\n\n(\n// activate left and right channels\nSynth(\"noiseToPitch\", [\\out, 0, \\mul, 1]);\nSynth(\"noiseToPitch\", [\\out, 1, \\mul, 1]);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Routine` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// SynthDefs on the fly\ns.boot;\n(\nt = TempoClock.new;\nr = Routine.new({\n 10.do({\n // could be done with an argument instead of a new def, but proves the point\n SynthDef(\"help-EnvGen\" ++ i, { arg out = 0;\n Out.ar(\n out,\n EnvGen.kr(Env.perc, 1.0, doneAction: Done.freeSelf)\n * SinOsc.ar(100 + (100 * t.elapsedBeats), 0, 0.1)\n )\n }).play(s);\n 1.yield;\n });\n}).play(t); // Note the alternative syntax: Routine.play(aClock)\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Image.colorToPixel` do?"}, {"role": "assistant", "content": "Convert a Color into a pixel datatype suitable for setting pixel data in the Image Returns: A 32bit packed Integer in the RGBA format."}]} {"conversations": [{"role": "user", "content": "I edited a SynthDef and the running sound did not change."}, {"role": "assistant", "content": "Redefining a SynthDef only affects Synths created after the new definition reaches the server; existing instances keep the graph they were built with. Free and recreate them: `~s.free; ~s = Synth(\\name)`. In JITLib, Ndef is the tool designed for this — redefining `Ndef(\\name, { ... })` crossfades to the new graph while it plays."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Enveloppes sizes are fixed."}, {"role": "assistant", "content": "```supercollider\n(\n~resize_enveloppe = { | levels, times |\n var reverted_levels, index;\n index = 0;\n reverted_levels = levels.reverse;\n while( { reverted_levels[index] == 0 && reverted_levels[index+1] == 0 }, { times[ times.size - 1 - index] = 0.01; index = index + 1 } );\n};\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `TdefGui.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a new JITGui that will be watching an object and display its Arguments: object — the object to watch; numItems — the number of display items to use, e.g. how many fields for text, or how many EZSliders for single-number parameters.; parent — a parent view on which to display. If nil, a new window is created; parent can also be an existing window or a composite view.; bounds — a desired size and position where to display a JITGui. can be nil, a Point, or a Rect. JITGuis know their minimum size (minSize), and if bounds is nil, minSize is used. if bounds is a point or rect, it will be set to at least minSize. With a rect one can also supply a position where to display. If a; makeSkip — A flag whether to make a skipjack. If one uses a TdefGui as part of a larger gui ensemble, one may want to call checkUpdate on all of them together, not with separate skipJacks.; options — a list of additional information, e.g. flags about optional buttons. (this is used is some subclasses)."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Stockmarket Sonification (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\dollar, { |out, freq = 440, amp = 0.1, pan = 0, sustain = 1.0|\n var env = EnvGen.kr(Env([amp, amp, 0], [sustain, 0.01]), doneAction: 2);\n var decay = freq ** -0.5 * 100;\n var string = CombL.ar(Decay2.ar(Impulse.ar(0), 0.0001, 0.001), 1/freq, 1/freq, decay);\n var damped = string; //LPF.ar(string, Line.kr(11000, 3000, decay));\n OffsetOut.ar(out, Pan2.ar(damped * env, pan));\n}).add;\n);\n\n(\nSynthDef(\\euro, { |out, freq = 440, amp = 0.1, pan = 0, sustain = 1.0|\n var env = EnvGen.kr(Env.perc(0.001, sustain), doneAction: 2);\n var decay = freq ** -0.5 * 100;\n var thing;\n freq = freq * (1..7).nthPrime;\n thing = SinOsc.ar(freq , 0, amp * AmpComp.kr(freq)).mean;\n OffsetOut.ar(out, Pan2.ar(thing * env, pan));\n}).add;\n);\n\n\n(\nPdef(\\stock, { |note = 0, sustain = 1|\n Pbind(\n \\instrument, [\\dollar, \\euro].choose,\n \\note, note.value + Pseq((12..0).curdle(0.1).scramble.flat * 3), \n \\dur, sustain.value / 12\n )\n})\n);\n\n(\nPdef(\\ett, \n Pbind(\n \\type, \\phrase,\n \\instrument, \\stock,\n \\dur, 4,\n \\legato, Prand((1..5), inf),\n \\note, Prand((0..12), inf) + Prand([[0, 2], [0, 6], [0, 7], 0, 0], inf)\n )\n).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\ns.boot;\n\n(\nvar winenv;\n// a custom envelope\nwinenv = Env([0, 1, 0], [0.5, 0.5], [8, -8]);\nz = Buffer.sendCollection(s, winenv.discretize, 1);\n\nSynthDef(\\sin_grain_test, { |out, gate = 1, amp = 1, envbuf|\n var pan, env, freqdev;\n // use mouse x to control panning\n pan = MouseX.kr(-1, 1);\n // use WhiteNoise and mouse y to control deviation from center pitch\n freqdev = WhiteNoise.kr(MouseY.kr(0, 400));\n env = EnvGen.kr(\n Env([0, 1\n// …\n```"}, {"role": "assistant", "content": "use mouse x to control panning use WhiteNoise and mouse y to control deviation from center pitch (GrainSin: Granular synthesis with sine tones)"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Hilbert`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\ns.scope;\na = { Hilbert.ar(SinOsc.ar(100)) * -20.dbamp }.play;\na.release;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Dseq`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a, freq, trig;\n a = Dseq([1, 3, 2, 7, 8], 3);\n trig = Impulse.kr(MouseX.kr(1, 40, 1));\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n);\n\n// audio rate\n(\n{\n var a, freq, trig;\n a = Dseq({ 10.rand } ! 32, inf);\n trig = Impulse.ar(MouseX.kr(1, 10000, 1));\n freq = Demand.ar(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `QuadL`."}, {"role": "assistant", "content": "```supercollider\n// default params\n{ QuadL.ar(SampleRate.ir/4) * 0.2 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `PLFPulse.new` do? What arguments does it take?"}, {"role": "assistant", "content": "UGenPatterns quark library Arguments: freq; iphase — Fixed.; width; mul; add; length — Number of values produced.."}]} -{"conversations": [{"role": "user", "content": "What does `BusPool.initClass` do?"}, {"role": "assistant", "content": "bus allocator with retain/release counting for shared busses"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nb = NodeProxy.audio(s, 2);\nb.play; // listen to b\nb.source = { SinOsc.ar([400, 500], 0, 0.1) }; // play something\n\nr = b.record(\"recproxy101.aiff\"); // start recorder (paused\nr.unpause; // start recording\nr.close; // end recording, close file\nb.stop; // stop listen\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nb = NodeProxy.audio(s, 2);\nb.play; // listen to b\nb.source = { SinOsc.ar([400, 500], 0, 0.1) }; // play something\n\nr = b.record(\"recproxy101.aiff\"); // start recorder (paused)\nr.unpause; // start recording\nr.close; // end recording, close file\nb.stop; // stop listen\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `PdurStutter`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,0,1,3,4,0], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n100.do({ x.next.postln });\n);\n\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n);\n\n\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,4,4,0,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Stream`?"}, {"role": "assistant", "content": "Stream — Stream is the base class for classes that define streams"}, {"role": "user", "content": "What does `Stream.play` do?"}, {"role": "assistant", "content": "Streams that return numbers can be played directly with the play message. Streams that return events need to be wrapped in an EventStreamPlayer. See #-asEventStreamPlayer."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// play at the next beat, with offset 0.4\n(\nRoutine({ loop {\n \"***\".postln; 0.5.wait;\n \"_*_\".postln; 0.1.wait;\n} }).play(quant: [1, 0.4]);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `AbstractSController.def` do?"}, {"role": "assistant", "content": "creates a Returns: a LINKClasses/SynthDef that has the argument CODE\\sController_bus for setting the output control rate bus. The name of the SynthDef must be CODEthis.defName."}]} +{"conversations": [{"role": "user", "content": "Explain `SplineGen` in SuperCollider briefly."}, {"role": "assistant", "content": "SplineGen — Like EnvGen but for Splines Plays a spline along one dimension for use in automation and control rate modulation. This is the equivalent of EnvGen Category: Splines, UGens > Generators."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Pmulpre` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain);\nb = Pmulpre(\\freq, Pseq([1, 2, 3], inf), a);\nb.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `ReplaceOut`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"ReplaceOutHelp\", { |out = 0, freq = 440|\n var source;\n source = SinOsc.ar(freq, 0, 0.1);\n\n // write to the bus, replacing previous contents\n ReplaceOut.ar(out, source);\n\n}).add;\n);\n\n// each Synth replaces the output of the previous one\nx = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 500]);\ny = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 600]);\nz = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 700]);\n\n// release them in reverse order; the older Synths are still there.\nz.free;\ny.free;\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "How do I play a sample from disk?"}, {"role": "assistant", "content": "Load it into a Buffer on the server, then play the buffer. `BufRateScale` keeps the pitch right when\nthe file's sample rate differs from the server's.\n\n```supercollider\n(\ns.waitForBoot {\n ~buf = Buffer.read(s, \"C:/sounds/break.wav\");\n SynthDef(\\player, { |out = 0, buf = 0, amp = 0.6, rate = 1|\n var sig = PlayBuf.ar(2, buf, BufRateScale.kr(buf) * rate, loop: 1);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n ~player = Synth(\\player, [\\buf, ~buf]);\n};\n)\n```\nUse `numChannels` 1 for a mono file; a mismatch is silent or wrong-sounding rather than an error."}]} +{"conversations": [{"role": "user", "content": "What does `StreamKrDur.spec` do?"}, {"role": "assistant", "content": "a 'control' rate player that combines a stream of values with a stream of durations and plays them"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a, b;\na = Place(#[1, [2, 5], [3, 6]], inf);\nx = a.asStream;\n8.do({ x.next.postln });\n);\n\n1\n2\n3\n1\n5\n6\n1\n2\n\n\n\n// Place used as a sequence of pitches\n\n(\nSynthDef(\"help-sinegrain\",\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n(\nc = Place(#[0, 0, [0, 4, 7], [1, 5,\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a, b;\na = Place(#[1, [2, 5], [3, 6]], inf);\nx = a.asStream;\n8.do({ x.next.postln });\n);\n\n1\n2\n3\n1\n5\n6\n1\n2\n\n\n\n// Place used as a sequence of pitches\n\n(\nSynthDef(\"help-sinegrain\",\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n(\nc = Place(#[0, 0, [0, 4, 7], [1, 5, 8], [2, 6, 9]], inf) + 67;\nx = c.asStream;\nRoutine({\n loop({\n Synth(\"help-sinegrain\", [\\freq, x.next.midicps]);\n 0.17.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `POneZero.new` do? What arguments does it take?"}, {"role": "assistant", "content": "UGenPatterns quark library Arguments: pattern; coef; mul; add."}]} +{"conversations": [{"role": "user", "content": "What does `Platform.ideName` do?"}, {"role": "assistant", "content": "returns a String indicating which IDE the language believes it is running in. (Often this is determined via the \"-i\" option to the sclang executable.) This is determined when sclang starts and cannot be changed dynamically. The main purpose of this is to include/exclude folders from the class search patch depending on which IDE is in use: for example, if the value of ideName is \"scapp\" then folders named \"scide_scapp\" are included and all other folders beginning with"}]} {"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// A beautiful sc140 tweet by Batuhan Bozkurt, parametrized for real-time changes\n(\n// Start sound here\na = { | rateL = 5, rateR = 6, blipMul = 100, blipAdd = 50, fMul = 50, kMul = 1 |\n f = LocalIn.ar(2).tanh;\n k = Latch.kr(f[0].abs,Impulse.kr(1/4)) * kMul;\n LocalOut.ar(\n f +\n CombC.ar(Blip.ar([rateL, rateR], blipMul * k + blipAdd, 0.9), 1, k*0.3, fMul * f));f\n}.play\n);\n\n// Set parameters for changing sound here: \n\na.set(\\rateL, 10);\n\na.set(\\rateR, 8);\n\na.set(\\blipMul, 25);\n\na.set(\\blipAdd, 70);\n\na.set(\\fMul, 30);\n\n\na.set(\\kMul, 0.01);\n```"}, {"role": "assistant", "content": "A beautiful sc140 tweet by Batuhan Bozkurt, parametrized for real-time changes. To do: Add gui widgets for easier interactive control."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Function`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\nx = { |freq = 440| SinOsc.ar(freq, 0, 0.3) }.play; // this returns a Synth object;\nx.set(\\freq, 880); // note you can set the freq argument\nx.defName; // the name of the resulting SynthDef\nx.release(4); // fadeout over 4 seconds\n```"}]} +{"conversations": [{"role": "user", "content": "What does `AbstractPlayer.spec` do?"}, {"role": "assistant", "content": "the base class for all Players : a playable object"}]} +{"conversations": [{"role": "user", "content": "What is the difference between ~foo and a local variable?"}, {"role": "assistant", "content": "`var foo` is a local: it exists only inside the function or file block that declares it. `~foo` is an environment variable: it lives in the current Environment, survives between executions of the same block, and is visible to everything running in that environment. That is why `~buf = Buffer.read(s, path)` works in one cell and `PlayBuf.ar(1, ~buf)` works in the next, while a `var` would be gone."}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for some kick drums i wrote back in january: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\kick1, {\n var snd;\n snd = DC.ar(0);\n snd = snd + (SinOsc.ar(XLine.ar(800, 400, 0.01)) * Env.perc(0.0005, 0.01).ar);\n snd = snd + (BPF.ar(Hasher.ar(Sweep.ar), XLine.ar(800, 100, 0.01), 0.6) * Env.perc(0.001, 0.02).delay(0.001).ar);\n snd = snd + (SinOsc.ar(XLine.ar(172, 50, 0.01)) * Env.perc(0.0001, 0.3, 1, \\lin).delay(0.005).ar(2));\n snd = snd.tanh;\n Out.ar(\\out.kr(0), Pan2.ar(snd, \\pan.kr(0), \\amp.kr(0.1)));\n}).add;\n);\n\nSynth(\\kick1, [amp: 0.4]);\n\n(\nSynthDef(\\kick2, {\n var snd;\n snd = DC.ar(0);\n snd = snd + (HPF.ar(Hasher.ar(Sweep.ar), 1320) * Env.perc(0.003, 0.03).ar * 0.5);\n snd = snd + (SinOsc.ar(XLine.ar(750, 161, 0.02)) * Env.perc(0.0005, 0.02).ar);\n snd = snd + (SinOsc.ar(XLine.ar(167, 52, 0.04)) * Env.perc(0.0005, 0.3).ar(2));\n snd = snd.tanh;\n Out.ar(\\out.kr(0), Pan2.ar(snd, \\pan.kr(0), \\amp.kr(0.1)));\n}).add;\n);\n\nSynth(\\kick2, [amp: 0.4]);\n\n(\nSynthDef(\\kick3, {\n var snd;\n snd = DC.ar(0);\n snd = snd + (SinOsc.ar(XLine.ar(1500, 800, 0.01)) * Env.perc(0.0005, 0.01, curve: \\lin).ar);\n snd = snd + (BPF.ar(Impulse.ar(0) * SampleRate.ir / 48000, 6100, 1.0) * 3.dbamp);\n snd = snd + (BPF.ar(Hasher.ar(Sweep.ar), 300, 0.9) * Env.perc(0.001, 0.02).ar);\n snd = snd + (SinOsc.ar(XLine.ar(472, 60, 0.045)) * Env.perc(0.0001, 0.3, curve: \\lin).delay(0.005).ar(2));\n snd = snd.tanh;\n Out.ar(\\out.kr(0), Pan2.ar(snd, \\pan.kr(0), \\amp.kr(0.1)));\n}).add;\n);\n\nSynth(\\kick3, [amp: 0.4]);\n\n\n/*\ncontributors so far: nathan ho\n\ni use Hasher.ar(Sweep.ar) as a quick way to generate deterministic white noise, so i can get exactly the same kick each time for a precise digital sampler effect. you are free to replace it with WhiteNoise.ar.\n\nthe DC.ar(0) does nothing, it's just so i can reorder all the \"snd = snd +\" lines and/or comment out parts of the synth.\n\nsome of the attacks are so fast that Env:kr doesn't correctly handle them. that's why i always use Env:ar, so i don't have to think about ar/kr when i'm messing with sharp envelope attacks. i'm sure many of them could be refactored to kr for CPU, but idc\n*/\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// (thor magnusson) (2006)\n\n// An instrumentalist inside a synthdef.\n\n(\nSynthDef(\\drummer, { arg out=0, tempo=4;\n var snare, base, hihat;\n tempo = Impulse.ar(tempo); // for a drunk drummer replace Impulse with Dust !!!\n\n snare = WhiteNoise.ar(Decay2.ar(PulseDivider.ar(tempo, 4, 2), 0.005, 0.5));\n base = SinOsc.ar(Line.ar(120,60, 1), 0, Decay2.ar(PulseDivider.ar(tempo, 4, 0), 0.005, 0.5));\n hihat = HPF.ar(WhiteNoise.ar(1), 10000) * Decay2.ar(tempo, 0.005, 0.5);\n\n Out.ar(out,(snare + base + hihat) * 0.4 ! 2)\n}).add;\n);\n\na = Synth(\\drummer);\na.set(\\tempo, 6);\na.set(\\tempo, 18);\na.set(\\tempo, 180); // check the CPU! no increase.\na.free;\n```"}, {"role": "assistant", "content": "(thor magnusson) (2006) An instrumentalist inside a synthdef."}]} +{"conversations": [{"role": "user", "content": "What does `Balance2.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Stereo signal balancer Arguments: left — channel 1 of input stereo signal; right — channel 2 of input stereo signal; pos — pan position, -1 is left, +1 is right; level — a control rate level input.."}]} +{"conversations": [{"role": "user", "content": "How do I distort a signal?"}, {"role": "assistant", "content": "Drive it into a nonlinearity, then tame the level: `tanh` is soft clipping, `.distort` is harder,\nand a low-pass after the drive keeps it from getting fizzy.\n\n```supercollider\n(\n{\n var sig = SinOsc.ar(110) * 0.3;\n var driven = (sig * 12).tanh;\n LPF.ar(driven, 5000) * 0.4\n}.play;\n)\n```\n\nMore drive means more harmonics; because they are generated, the output is louder as well as brighter, so\nscale the result down after the nonlinearity."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `FreqScope`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n// create a new analyzer\nFreqScope.new(400, 200, 0, server: s);\n\n// basic sine\n{ SinOsc.ar(2000, 0, 0.25) }.play(s);\n\n// random saw\n{ RLPF.ar(Saw.ar(110, 0.2), LFNoise2.kr(1, 1e4, 1e4), LFNoise2.kr(1, 0.2, 0.22)) }.play(s);\n\n// modulate phase\n{ SinOsc.ar(800, SinOsc.ar(XLine.kr(20, 8000, 10), 0, 2pi), 0.25) }.play(s);\n\n// all harmonics\n{ Blip.ar(200, Line.kr(1, 100, 10), 0.2) }.play(s);\n\n// access the FreqScopeView object to set properties of the Qt Object:\nFreqScope.getInstance // get the FreqScope instance\n .scope // and its FreqScopeView\n .setProperty(\\updateInterval, 1000)\n // set updateInterval to 1000 ms because of reasons\n```"}]} +{"conversations": [{"role": "user", "content": "What does `UScoreEditor.soloEvents` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: events — (describe argument here). Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "What does `ArrayedCollection.copyRange` do?"}, {"role": "assistant", "content": "Return a new ArrayedCollection which is a copy of the indexed slots of the receiver from start to end. — Both start and end are specified as integers starting from 0. If end < start, an empty ArrayedCollection is returned."}]} +{"conversations": [{"role": "user", "content": "What does `KeyCodeResponder.value` do? What arguments does it take?"}, {"role": "assistant", "content": "register responder functions for keycode and modifier combinations Arguments: view; keycode; modifier; unicode."}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ var sig = SinOsc.ar(440) * 0.2; Out.ar(0, sig) }.play;\n```"}, {"role": "assistant", "content": "The minimal SynthDef idiom: a source multiplied by an amplitude, written to the master bus.\n\n`var sig = SinOsc.ar(440) * 0.2` builds the signal; `Out.ar(0, sig)` is the only mandatory part, because a\nUGen graph that never reaches an output produces no sound. `Out`'s first argument is the bus number — 0 is\nthe main stereo output — and the second is the signal. The function's return value does not matter here,\nwhich is why the `Out.ar` can sit on its own line. `.play` compiles this into an anonymous SynthDef and\nstarts one instance."}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for electric hum: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\eHum).addSpec(\\fFreq, ControlSpec(25, 1000, \\lin, step: 25));\nNdef(\\eHum).addSpec(\\fRq, [0.01, 0.2]);\nNdef(\\eHum).addSpec(\\fFreqIdx, [0, 8, \\lin, 0.2]);\nNdef(\\eHum).fadeTime = 2;\n\nNdef(\\eHum, {|fFreqIdx = 1, fRq = 0.1|\n var src = Impulse.ar([50, 75, 100]); // three sources\n var fFreq = (25 * (2 ** fFreqIdx));\n\n Splay.ar((BPF.ar(src, fFreq, fRq))* 8)\n})\n);\n\nNdef(\\eHum).gui;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// needs Buffer c prepared above\n\n(\ny = {\n var add = LFDNoise3.ar(0.3) * [0.05, 0.0505];\n GFIS.ar(\n { |x| BufRd.ar(1, c, c.numFrames * (x + add)) }, \n 0.5, 7\n ) * 0.2\n}.play\n;\n\ny.release\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// needs Buffer c prepared above\n\n(\ny = {\n var add = LFDNoise3.ar(0.3) * [0.05, 0.0505];\n GFIS.ar(\n { |x| BufRd.ar(1, c, c.numFrames * (x + add)) }, \n 0.5, 7\n ) * 0.2\n}.play\n);\n\ny.release\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `LazyEnvir` in SuperCollider briefly."}, {"role": "assistant", "content": "LazyEnvir — lazy environment Environment with deferred evaluation and default values. Category: JITLib > Environments, Live Coding, Collections > Unordered."}]} +{"conversations": [{"role": "user", "content": "What is `PLbindef`?"}, {"role": "assistant", "content": "PLbindef — wrapper for Pbindef which allows replacement in object prototyping style"}, {"role": "user", "content": "What does `PLbindef.new` do?"}, {"role": "assistant", "content": "Creates a new PLbindef object or sets sources as with Pbindef."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n// synthdefs to play with\n\n(\nSynthDef(\\noise_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, rq = 0.1, amp = 0.1|\n var sig = { WhiteNoise.ar } ! 2;\n sig = BPF.ar(sig, freq, rq) *\n EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2) *\n (rq ** -1) * (250 / (freq ** 0.8));\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\sin_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { SinOsc.ar(freq, Rand(0, 2pi)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\saw_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { VarSaw.ar(freq, Rand(0, 1)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Pan2` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\ng = Group.new;\n\n// make 4 synths in g\n// 1.0.rand2 returns a random number from -1 to 1.\n4.do({ { arg amp = 0.1; Pan2.ar(SinOsc.ar(440 + 110.rand, 0, amp), 1.0.rand2) }.play(g); });\n\ng.set(\\amp, 0.005); // turn them all down\n\ng.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `PatternProxy.envir` do?"}, {"role": "assistant", "content": "provide a default environment for the proxy. If given, it is used as an environment for the routine function. When set for the first time, the routine pattern is"}]} +{"conversations": [{"role": "user", "content": "What does `KeyCodeResponder.option` do? What arguments does it take?"}, {"role": "assistant", "content": "register responder functions for keycode and modifier combinations Arguments: ... associations."}]} +{"conversations": [{"role": "user", "content": "Explain `GrainBuf` in SuperCollider briefly."}, {"role": "assistant", "content": "GrainBuf — Granular synthesis with sound stored in a buffer Category: UGens > Buffer, UGens > Generators > Granular."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Normalizer`."}, {"role": "assistant", "content": "```supercollider\n(\n// example signal to process\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n z * 0.8\n}.play\n);\n\n(\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n [z, Normalizer.ar(z, 0.4, 0.01)] * 0.5\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `InTrig`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\ns = Server.local;\nb = Bus.control(s, 1);\n\nSynthDef(\"help-InTrig\", { |out = 0, busnum = 0|\n var inTrig;\n inTrig = InTrig.kr(busnum);\n Out.ar(out,\n EnvGen.kr(Env.perc, gate: inTrig, levelScale: inTrig) * SinOsc.ar\n )\n}).play(s, [\\out, 0, \\busnum, b.index]);\n\n\nb.set(1.0);\n\nb.value = 1.0;\n\nb.value = 0.2;\n\nb.value = 0.1;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// randomly modulate all params\n(\n{ LatoocarfianN.ar(\n SampleRate.ir/4,\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5)\n) * 0.2 }.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// randomly modulate all params\n(\n{ LatoocarfianN.ar(\n SampleRate.ir/4,\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5)\n) * 0.2 }.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\np = Pbind(\n \\instrument, \\synth_1a,\n \\preAmp, PL(\\preAmp), \n \\amp, PL(\\amp), \n \\midinote, PLseq(\\seq) + PL(\\seqAdd), \n \\dur, 0.2\n);\n\nq = Pbindf(p, \\midinote, PLseq(\\seq));\n\nv = VarGui([\\seq, { [48, 84, \\lin, 1, rrand(48, 84)] } ! 5, \n \\seqAdd, [0, 12, \\lin, 1, 7],\n \\amp, [0, 0.3, \\lin, 0.01, 0.07],\n \\preAmp, [5, 50, \\lin, 0.01, 20]],\n stream: [q,p].collect(_.asE\n// …\n```"}, {"role": "assistant", "content": "so currentEnvironment is given implicitely by both ESPs and used for setting ensures that players, also if started separately for the first time, (VarGui: slider / player gui to set envir variables and synth controllers and play synths, event patterns and tasks)"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `RunningSum`."}, {"role": "assistant", "content": "```supercollider\n// distorts of course - would need scaling\n{ RunningSum.ar(SoundIn.ar) }.play\n\n// Running Average over x samples\n(\n{\n var x = 100;\n RunningSum.ar(LFSaw.ar, x) * (x.reciprocal)\n }.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `EZText.enabled` do? What arguments does it take?"}, {"role": "assistant", "content": "Sets/gets whether the textfield is Arguments: bool — An instance of Boolean. Default is `true`.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// as a frequency control\n{ SinOsc.ar(Lag.ar(LorenzL.ar(MouseX.kr(1, 200)), 3e-3)*800+900)*0.4 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// as a frequency control\n{ SinOsc.ar(Lag.ar(LorenzL.ar(MouseX.kr(1, 200)), 3e-3)*800+900)*0.4 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `PLnaryFunc` in SuperCollider briefly."}, {"role": "assistant", "content": "PLnaryFunc — dynamic scope PnaryFunc variant Takes Symbol args for later reference by the Streams, which will read from variables in the Environments of their instantiation. See PLx_suite. For replacing operators dynamically take PLnaryFunc with the operator wrapped into a Function. Category: Libraries > miSCellaneous > PLx suite, Streams-Patterns-Events > PLx suite."}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for seeking an Array!: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(// * //watch the postWindow\na=[\"m\",\"x\",\"f\",\"k\",\"d\",\"p\"];\nx=Array;\ny=x.newClear(6);\n~mxfkdp=Task({\n inf.do({y.put(x.series(6,0,1).choose,a.scramble).postln;\n 0.03.wait;})}).play;\nm=fork({inf.do({\n \"array num:\".postcln;\n if(y[x.series(6,0,1).choose.postcln]==a,\n {\"lo encontraste!/found it!\".postcln;\n 1.do({GVerb.ar(\n EnvGen.ar(Env.perc(0.01,8),1,doneAction:2)*\n Blip.ar(XLine.kr(440,1600,8)),50,10,0.02)}.play);\n ~mxfkdp.stop;\n m.stop;}, \n {\"buscando.../seeking...\".postcln;});\n 0.03.wait})});\n);\n//.SCtweetLong\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `LPF`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\\default, { arg out=0, freq=440, amp=0.1, pan=0, gate=1;\n var z;\n z = LPF.ar(\n Mix.new(VarSaw.ar(freq + [0, Rand(-0.4,0.0), Rand(0.0,0.4)], 0, 0.3)),\n XLine.kr(Rand(4000,5000), Rand(2500,3200), 1)\n ) * Linen.kr(gate, 0.01, 0.7, 0.3, 2);\n OffsetOut.ar(out, Pan2.ar(z, pan, amp));\n}, [\\ir]);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `SoundIn` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\nu = Server(\\scau, NetAddr(\"127.0.0.1\", 9989)); // Change the port from 9989 to the right one for you\nu.serverRunning = true;\nu.ping(10); // Gives about 0.02 for me - confirms that communication is working\n// Now let's create a quick ring-modulator effect:\nz = { SoundIn.ar([0,1]) * SinOsc.ar(MouseX.kr(100, 1000)) }.play(u);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = { |x, root = 60| x + root }; b = a.midicps; [a.value(9), b.value(9)];\na = Pseries(60, 1, inf).midicps; a.asStream.nextN(12);\n{ a = LFNoise1.ar(1) * 5 + 60; Pulse.ar(a.round.midicps * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = { |x, root = 60| x + root }; b = a.midicps; [a.value(9), b.value(9)];\na = Pseries(60, 1, inf).midicps; a.asStream.nextN(12);\n{ a = LFNoise1.ar(1) * 5 + 60; Pulse.ar(a.round.midicps) * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\sub;\n~description = \"Dedicate a channel to subwoofer signal. Ideally use with monoSpat spatializer\";\n~channelLayout = \\mono;\n~function = { |in = 0, sub_gainDB = -99, sub_lpHz = 200|\n LPF.ar(in, sub_lpHz.clip(5.0, 18000)) * sub_gainDB.dbamp\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for sound of an alien weapon firing. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"raygun\", {arg amp = 0.5, sinfreq = 1000, glissf = 0.001, att = 0.01, rel = 0.9;\n var gliss = XLine.kr(sinfreq, sinfreq*glissf, rel);\n var snd = SinOsc.ar(gliss);\n var env = EnvGen.kr(Env.perc(att, rel), doneAction: 2);\n snd = snd * env * amp;\n Out.ar(0, snd);\n}).add;\n);\n\n(\nPbind(\n \\instrument, \"raygun\",\n \\dur, Pseq([0.75,0.75,0.75,0.75,0.25,0.25,0.25]*0.5, inf),\n \\amp, 0.4\n).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Condition`."}, {"role": "assistant", "content": "```supercollider\n(\nc = Condition.new(false);\n\nRoutine {\n 1.wait;\n \"waited for 1 second\".postln;\n 1.wait;\n \"waited for another second, now waiting for you ... \".postln;\n c.wait;\n \"the condition has stopped waiting.\".postln;\n 1.wait;\n \"waited for another second\".postln;\n \"waiting for you ... \".postln;\n c.test = false;\n c.wait;\n \"the condition has stopped waiting.\".postln;\n 1.wait;\n \"the end\".postln;\n}.play;\n);\n\n// continue\n(\nc.test = true;\nc.signal;\n);\n\n// a typical use is a routine that can pause under certain conditions:\n(\nc = Condition.new;\nfork { loop { 1.wait; \"going\".postln; c.wait } };\n);\nc.test = true; c.signal;\nc.test = false;\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for little homage to \"Come Out\" by Steve Reich: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n/* A little homage to \"Come Out\" by Steve Reich.\n It explores ryhtmic aspects created by phasing, retriggering, and pitch shifting.\n It \"detours\" the original audio message available here\n http://www.freesound.org/people/ERH/sounds/34667/\n in which a police patrol recites\n \"We don't want to scare your children, that's the last thing we wanna do\".\n \n */\n\n\ns.options.memSize=128*1024;\ns.boot;\n\n~bus=Bus.audio(s,2);\n~buf=Buffer.readChannel(s,\"/home/***/Supercollider/sounds/v.wav\");\n\n(\nSynthDef(\\playbuff,{arg in=0,out=0,t_trig=0;\n var i=EnvGen.kr(Env([0,40,0.3,0.4,40,0],[0,60,20,20,30]),gate:1);\n var r=EnvGen.kr(Env([0,10,-0.9,-0.9],[40,20,15]),gate:t_trig,doneAction:2);\n var sig1=PlayBuf.ar(1,in,rate:1+r,trigger:Impulse.kr(i),loop:1);\n var sig2=PlayBuf.ar(1,in,rate:1+r,trigger:Impulse.kr(i+0.01),loop:1);\nOut.ar(out,Splay.ar([sig1,sig2],0.5));\n};\n).add;\n\nSynthDef(\\rev,{arg in=0,out=0;\n var sig=In.ar(in,2);\n sig=Compander.ar(sig,sig,0.8,1/3);\n sig=FreeVerb.ar(sig,mix:0.4);\nOut.ar(out,sig);\n};\n).add;\n);\n\nSynth(\\rev,[\\in:~bus]);\n\nfork{\nx=Synth(\\playbuff,[\\out:~bus]);\n75.wait;\nx.set(\\t_trig,1);\n};\n\ns.quit;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// Since the allpass delay has no audible effect as a resonator on\n// steady state sound ...\n\n{ AllpassL.ar(WhiteNoise.ar(0.1), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// ...these examples add the input to the effected sound and compare variants so that you can hear\n// the effect of the phase comb:\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassN.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2)\n}.play)\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassL.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2\n// …\n```"}, {"role": "assistant", "content": "Since the allpass delay has no audible effect as a resonator on steady state sound ... (AllpassL: Schroeder allpass delay line with linear interpolation.)"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// This question comes up sometimes.\n// one way to do it is to define an event type:\n\n\n(\nEvent.addEventType(\\dnote, { |server|\n \n var instrument = ~instrument.asDefName;\n var synthLib = ~synthLib ?? { SynthDescLib.global };\n var desc = synthLib.at(instrument);\n \n \n if (desc.notNil) {\n desc.controls.do { |x|\n x.defaultValue !? { x.name.asSymbol.envirPut(x.defaultValue) }\n };\n // for efficiency, get this now\n ~hasGate = desc.hasGate;\n ~msgFunc = desc.msgFunc;\n };\n ~type = \\note;\n \n currentEnvironment.play;\n});\n);\n\n(\nSynthDef(\\test, { |out, freq = 1000| \n Out.ar(out, Line.ar(0.1, 0, 0.1, doneAction:2) * SinOsc.ar(freq)) \n}).add\n);\n\nPbind(\\type, \\dnote, \\instrument, \\test, \\dur, 0.3).play;\n```"}, {"role": "assistant", "content": "One answer to the question \"how to use the SynthDef's default argument in an Event?\"."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\nb = Buffer.alloc(s, 512, 1);\nb.sine2([1.0, 3], [1, 0.5]);\nx = { Osc.ar(b, 200, 0, 0.5) }.play;\n;\nx.free; b.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\nb = Buffer.alloc(s, 512, 1);\nb.sine2([1.0, 3], [1, 0.5]);\nx = { Osc.ar(b, 200, 0, 0.5) }.play;\n);\nx.free; b.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// We'll hear the sawtooth wave when the two sine oscillators are both in the region x = 0.0 to 0.5, y = 0.5 to 1.0\n(\n{\n InRect.ar(\n SinOsc.ar(1), SinOsc.ar(1.3), Rect(0, 0.5, 0.5, 0.5)\n ) * LFSaw.ar(44, 0, 0.1)\n}.play\n);\n\n// Stereo effect\n(\n{\n InRect.ar(\n LFNoise0.ar([140, 141]), LFNoise0.ar(143), Rect(0, 0, 0.5, 1)\n ).lag(0.1) * LFSaw.ar(SinOsc.ar(10, 0, 5, 400), 0, 0.1)\n}.play\n);\n\n// For the Rect, create as left\n// …\n```"}, {"role": "assistant", "content": "We'll hear the sawtooth wave when the two sine oscillators are both in the region x = 0.0 to 0.5, y = 0.5 to 1.0 For the Rect, create as left, 'top', width, height; (InRect: Test if a point is within a given rectangle.)"}]} +{"conversations": [{"role": "user", "content": "What does `Dbrown2.new` do? What arguments does it take?"}, {"role": "assistant", "content": "demand rate brownian movement with Gendyn distributions Arguments: lo — minimum value; hi — maximum value; step — maximum step for each new value; dist — gendyn distribution (see Gendy1); length — number of values to create."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = NodeProxy(s);\na.reshaping = \\elastic;\na.play(0, 2); // play stereo\na.source = { BPF.ar(Dust.ar(8 ! 8), (0..5).nthPrime * 300, 0.01 * 20 };\na.numChannels; // 8\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = NodeProxy(s);\na.reshaping = \\elastic;\na.play(0, 2); // play stereo\na.source = { BPF.ar(Dust.ar(8 ! 8), (0..5).nthPrime * 300, 0.01) * 20 };\na.numChannels; // 8\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Annotations.unregister` do? What arguments does it take?"}, {"role": "assistant", "content": "stores names and notations for Nodes, identifying the Node's owner and its purpose Arguments: object."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ProxySynthDef`."}, {"role": "assistant", "content": "```supercollider\na = ProxySynthDef(\"xtest\", { SinOsc.ar(400) * 0.1 });\n\na.add;\n\nx = Synth(\"xtest\");\nx.release;\n\n\n/*\n\n if the resulting number of channels is larger than a given channelConstraint,\n it behaves according to the rate: audio rate signals are wrapped around\n a smaller channel size, control rate signals are not (the exceeding channels are left out)\n\n*/\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\nz = {\nBBandPass.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(20, 20000, \\exponential),\n MouseY.kr(0.0, 10.0, \\linear), // bw\n 0.5); // mul\n}.play)\nz.release;\n\n(\nz = {\nBBandPass.ar(\n WhiteNoise.ar ! 2,\n MouseX.kr(20, 20000, \\exponential),\n MouseY.kr(0.0, 10.0, \\linear), // bw\n 0.5); // mul\n}.play\nz.release;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\nz = {\nBBandPass.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(20, 20000, \\exponential),\n MouseY.kr(0.0, 10.0, \\linear), // bw\n 0.5); // mul\n}.play)\nz.release;\n\n(\nz = {\nBBandPass.ar(\n WhiteNoise.ar ! 2,\n MouseX.kr(20, 20000, \\exponential),\n MouseY.kr(0.0, 10.0, \\linear), // bw\n 0.5); // mul\n}.play)\nz.release;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `PlayerSocket.qrespawnPlayer` do? What arguments does it take?"}, {"role": "assistant", "content": "restart the currently playing Arguments: releaseTime."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var z;\n\n // signal (clean)\n z = Decay2.ar(\n Impulse.ar(8, 0, LFSaw.kr(0.3, 1, -0.3, 0.3)),\n 0.001,\n 0.3\n )\n * Mix.ar(Pulse.ar([80, 81], 0.3));\n\n\n // apply limiter (mouse x sets amount)\n Compander.ar(z, z,\n thresh: MouseX.kr(0.01, 1),\n slopeBelow: 1,\n slopeAbove: 0.1,\n clampTime: 0.01,\n relaxTime: 0.01\n )\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var z;\n\n // signal (clean)\n z = Decay2.ar(\n Impulse.ar(8, 0, LFSaw.kr(0.3, 1, -0.3, 0.3)),\n 0.001,\n 0.3\n )\n * Mix.ar(Pulse.ar([80, 81], 0.3));\n\n\n // apply limiter (mouse x sets amount)\n Compander.ar(z, z,\n thresh: MouseX.kr(0.01, 1),\n slopeBelow: 1,\n slopeAbove: 0.1,\n clampTime: 0.01,\n relaxTime: 0.01\n )\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `NumberEditor` in SuperCollider briefly."}, {"role": "assistant", "content": "NumberEditor — holds a float value with a spec, editable with a gui This is the default control for a StaticSpec. Category: Libraries > crucial > Editors."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `IdentityDictionary`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_sinegrain, { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0.5pi, env))\n}).add;\n\na = Pbind(\\instrument, \\help_sinegrain, \\note, Pseq([0, 7, 2, 9, 11, 10, 9, 8], inf), \\dur, 1);\na.play(quant: (quant: 1, phase: 0));\na.play(quant: (quant: 1, phase: 1/3));\na.play(quant: (quant: 1, phase: 1.0.rand));\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `EaseOutInCirc.value` do? What arguments does it take?"}, {"role": "assistant", "content": "Circular ease-out/in Arguments: t — a Float between 0.0 and 1.0.."}]} +{"conversations": [{"role": "user", "content": "What does `Magnitude.min` do?"}, {"role": "assistant", "content": "Comparable value in a linear continuum Returns: the minimum of the receiver and aMagnitude."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\nvar trigger, fund, flashInst;\nflashInst = Array.fill(7,\n{\ntrigger = Dust.kr(2)*PinkNoise.ar(1);\nfund = rrand(100, 137);\nPan2.ar(\nMix.ar(\nArray.fill(7,\n{arg counter;\nvar partial;\npartial = counter + 3;\n//HenonC.ar(fund*partial).atan *\nDPW3Tri.ar(fund*partial).atan *\nEnvGen.kr(Env.adsr(0.01, 0, 0.1, 7.0),\ntrigger, 1/partial) *AY.ar(713)* max(0, LFNoise1.kr(rrand(37.0, 73.0)))\n})\n)*0.2,\n1.0.rand2)\n});\nMix.ar(flashInst)*0.6\n}.play\n)\n```"}, {"role": "assistant", "content": "\"High-energy Radio Bursts, generated by an old coffee machine of Arab origin, manifest themselves as noise and audio signals, and trigger a magnetic alteration with unpredictable effects;\"\r\n\r\n\r\n\r\nhttp://bz-buzz.blogspot.com/2018/10/radio-bursts-from-old-coffee-pot.html\r\n\r\nhttp://bzakirasantjago.blogspot.com/."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// Analogizer\n// a quick draft of a model of the EHX Analogizer pedal\n// some info from \"https://www.bassic.de/threads/electro-harmonix-ehx-analogizer.14865686/\"\n\ns.default\ns.boot\n\n// used this for testing: https://www.freesound.org/people/wescwave/sounds/169885/\n~buf = Buffer.read(s, \"169884__wescwave__double-bass-test2.wav\");\n\n(\n~x.free;\n~x = {\n var a, d, s;\n\n a = PlayBuf.ar(2, ~buf, 1, 1, 0, 1);\n a = a.sum!2; // go mono to make the effect more prominent\n\n // the \"distortion modeling\" could use some more love...\n s = (a * MouseY.kr(26/2, 0).dbamp).tanh;\n s = s * MouseY.kr(-16/2, 0).dbamp;\n\n // a simple delay\n d = DelayC.ar(s, 0.1, MouseX.kr(3.5/1000, 65/1000));\n\n // dry/wet...\n a = a + (d * MouseY.kr(0, -96).dbamp);\n\n Out.ar(0, a);\n}.play\n)\n```"}, {"role": "assistant", "content": "The EHX Analogizer (http://www.ehx.com/products/analogizer) is a guitar pedal that apparently consists of a ultra-short delay with some gain stage. It's supposed to \"fatten\" and somehow \"spread\" the sound to make it appear more \"analog\" (thus: dirty). I wanted to quickly test the effect myself.\r\n\r\nI guess with some additional care of the distortion stage and maybe some very little modulation (ster."}]} +{"conversations": [{"role": "user", "content": "What is `Boolean` in SuperCollider?"}, {"role": "assistant", "content": "Boolean — abstract class whose instances represent a logical value Boolean is the superclass of True and False which are the concrete realizations. In code True and False are represented by the literal values `true` and `false`. Category: Core."}]} +{"conversations": [{"role": "user", "content": "In what order should I learn SuperCollider?"}, {"role": "assistant", "content": "The order that pays off fastest:\n\n1. **One UGen and Out** — `{ SinOsc.ar(440) * 0.2 }.play`. Learn that a graph must reach Out.\n2. **Envelopes and doneAction** — the difference between a sound and a click.\n3. **SynthDef and Synth** — naming a graph, controlling it with arguments, freeing it with a gate.\n4. **Patterns** — `Pbind` for sequence, so you stop writing loops by hand.\n5. **Buses and effects** — chaining, sends, groups.\n6. **JITLib** — Ndef for patches you modify while they play.\n\nVocabulary to carry: UGen, SynthDef, Synth, bus, group, envelope, gate, doneAction, Pattern, clock. Every\nconfusion in SuperCollider tends to be one of those words."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `CoinGate`."}, {"role": "assistant", "content": "```supercollider\n(\na = SynthDef(\"help-TCoin\", { |out = 0, prob = 0.5|\n var trig;\n trig = CoinGate.kr(prob, Impulse.kr(10));\n Out.ar(out,\n SinOsc.ar(\n TRand.kr(300.0, 400.0, trig), 0, 0.2\n )\n )\n}).play;\n);\n\na.set(\\prob, 1.0);\na.set(\\prob, 0.0);\na.set(\\prob, 0.1);\n\n\n(\na = SynthDef(\"help-TCoin\", { |out = 0, prob = 0.5|\n var trig;\n trig = Impulse.ar(20, 0, SinOsc.kr(0.5, 0, 1, 1));\n Out.ar(out,\n Mix.fill(3, { Ringz.ar(CoinGate.ar(prob, trig*0.5), #[1, 1.5]*Rand(1000, 9000), 0.01) })\n )\n}).play;\n);\n\na.set(\\prob, 1.0);\na.set(\\prob, 0.0);\na.set(\\prob, 0.1);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `RedEffectModule.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a new stereo effect module and boot the server if not already running. Server is taken from group Arguments: out — Which audio bus to use. Puts a ReplaceOut on this bus and the following (index+1).; group — A Group. Defaults to `Server.default.defaultGroup`.; addAction — A Symbol.; lag — a non-modulatable lag time for all parameters.."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Stethoscope`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var f = { |l,h| SinOsc.kr(0.1, {pi.rand}).range(l, h) } ;\n Pulse.ar({ f.(20, 1000) }!6, { f.(0.0, 1) }!6, { f.(0.0, 1.0) }!6)\n}.play;\n);\n\nc = s.scope;\nc.numChannels = 6;\nc.scopeView.waveColors = [Color.red, Color.red, Color.cyan, Color.cyan, Color.white, Color.white];\nc.style = 2;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Just a dirty FM bass shuffling. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\nfork{\n SynthDef(\\basicFM, {|out = 0, gate = 1, amp = 1, carFreq = 1000, modFreq = 100, modAmount = 2000, clipAmount = 0.1|\n var modEnv = EnvGen.ar(Env.adsr(0.5, 0.5, 0.7, 0.1, peakLevel: modAmount), gate);\n var mod = SinOsc.ar(modFreq) * modEnv;\n var car = SinOsc.ar(carFreq + mod);\n var ampEnv = EnvGen.ar(Env.adsr(0.1, 0.3, 0.7, 0.2, peakLevel: amp), gate, doneAction: 2);\n var clip = clipAmount * 500;\n Out.ar(out, (car * ampEnv * clip).clip(-0.7, 0.7) * 0.1);\n }).add;\n\n s.sync;\n\n Pbind(*[\n instrument: \\basicFM,\n out: [0, 1],\n dur: Pseq([1/7, 1/3] / 1.2, inf),\n sustain: Pkey(\\dur),\n amp: 1/4,\n carFreq: Pseq([1, 1, 1, 2] * 350, inf),\n modFreq: Pkey(\\carFreq) * (1/8),\n modAmount: Pseq([2, 1, 0.5, 2, 1, 0.5, 2, 1, 2, 1, 0.5, 2, 1, 0.5, 2, 4] * 500, inf),\n clipAmount: Pseq([Pn(0.1, 32), Pn(1, 32)], inf)\n ]).play;\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SineShaper.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "port of some ladspa plugins Arguments: in — The input signal.; limit; mul — Output will be multiplied by this value.; add — This value will be added to the output.."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// create a DMX object, default to a single universe of 512 channels\nd = SimpleDMX();\n\n// get a fixture and set its color\nf = SimpleDMXFixture(0, 5, universeId: 0, desc: (\\channelTypes: #[dim, r, g, b, white]));\nf.setColor(Color.white);\n\n// add the fixture to the DMX state\nd.add(f);\n\n// get state\nd.getState\n```"}, {"role": "assistant", "content": "create a DMX object, default to a single universe of 512 channels get a fixture and set its color (SimpleDMX: an abstract DMX interface)"}]} +{"conversations": [{"role": "user", "content": "What does `TempoClock.permanent` do?"}, {"role": "assistant", "content": "Sets or gets a Boolean value indicating whether the clock will survive cmd-period. If false the clock is stopped (and thus removed) on cmd-period. If true the clock survives cmd-period. It is false by"}]} +{"conversations": [{"role": "user", "content": "What does `SelectButtonSet.new` do? What arguments does it take?"}, {"role": "assistant", "content": "a set of radio buttons Arguments: layout; labelArrayOrQnty; action; color; selectedColor; width; height."}]} +{"conversations": [{"role": "user", "content": "What does `Font.hasPointSize` do?"}, {"role": "assistant", "content": "A Boolean variable indicating whether the #-size is regarded as pixel-size (precise amount of pixels), or point-size (adapting to screen resolution). To change this, you need to set the size via #-pixelSize or"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// connect will connect to all midi in devices\n// if you need to specify one,\n// check the sources at: MIDIClient.sources\n// and connect using MIDIIn.connect( source_index )\nMIDIIn.connect;\n\n// show incoming control data\n~control = { arg src, chan, num, val; \n [chan,num,val].postln; \n};\n\nMIDIIn.addFuncTo(\\control, ~control);\n```"}, {"role": "assistant", "content": "Simple example showing how to listen for MIDI control messages."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n // LFSaw begins at 0, illustrates attack time better\n var sig = LFSaw.ar(440);\n var amps = Amplitude.ar(\n sig,\n attackTime: [0.001, 0.01],\n releaseTime: [0.01, 0.2]\n );\n [sig] ++ amps\n}.plot\n.superpose_(true)\n.plotColor_([Color.black, Color.green, Color.blue]);\n);\n\n(\n// use input amplitude to control SinOsc frequency\n{\n SinOsc.ar(\n Amplitude.kr(\n Blip.ar(3, 20) * LFNoise1.kr(0.1).range(0, 1),\n MouseX.kr(0.00\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n // LFSaw begins at 0, illustrates attack time better\n var sig = LFSaw.ar(440);\n var amps = Amplitude.ar(\n sig,\n attackTime: [0.001, 0.01],\n releaseTime: [0.01, 0.2]\n );\n [sig] ++ amps\n}.plot\n.superpose_(true)\n.plotColor_([Color.black, Color.green, Color.blue]);\n);\n\n(\n// use input amplitude to control SinOsc frequency\n{\n SinOsc.ar(\n Amplitude.kr(\n Blip.ar(3, 20) * LFNoise1.kr(0.1).range(0, 1),\n MouseX.kr(0.001, 1, 1),\n MouseY.kr(0.001, 1, 1),\n 1200,\n 400\n ),\n 0, 0.3)\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n(\n~loDev = -6;\n~hiDev = 5;\n~lookBack = 2;\n\np = Pbind(\n \\dur, 0.2,\n \\midinote, PLIdev(72, 11, \\loDev, \\hiDev, \\lookBack).trace(prefix: \"midi \"),\n).play;\n);\n\n\n// change on the fly\n// as lookBack equals 2, this defines a fixed sequence (up or down anyway)\n\n(\n~loDev = -1;\n~hiDev = 1;\n);\n\n\n// widen range\n\n(\n~loDev = -6;\n~hiDev = 5;\n);\n\n\n// force a twelve-tone row\n\n~lookBack = 11;\n\n\n// contradictory input, lookBack 11 not possible within range, causes\n// …\n```"}, {"role": "assistant", "content": "as lookBack equals 2, this defines a fixed sequence (up or down anyway) force a twelve-tone row (PLIdev: dynamic scope pattern searching for numbers with integer distance from a source pattern, optionally avoiding repetitions within a span)"}]} +{"conversations": [{"role": "user", "content": "What does `Symbol.tr` do?"}, {"role": "assistant", "content": "Return a TrigControl input with a default value (val). If val is an array, the control will be"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nNdef(\\lfo2, { LFNoise1.kr(LFNoise1.kr(0.1).exprange(1, 300) ! 2, 400, 800) });\nNdef(\\sound, { Blip.ar(Ndef.kr(\\lfo2), 30) * 0.2 }).play;\n\nNdef(\\lfo2, { [MouseX.kr(10, 300, 1), MouseY.kr(10, 300, 1)] };\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nNdef(\\lfo2, { LFNoise1.kr(LFNoise1.kr(0.1).exprange(1, 300) ! 2, 400, 800) });\nNdef(\\sound, { Blip.ar(Ndef.kr(\\lfo2), 30) * 0.2 }).play;\n\nNdef(\\lfo2, { [MouseX.kr(10, 300, 1), MouseY.kr(10, 300, 1)] });\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `EnvGen` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// as amplitude envelope\n(\n{\n var env = Env([0, 1, 0.5, 1, 0], [0.01, 0.5, 0.02, 0.5]);\n SinOsc.ar(470) * EnvGen.kr(env, doneAction: Done.freeSelf)\n}.play\n);\n\n// as amplitude and modulation envelope\n(\n{\n var env = Env([0, 1, 0.5, 0.8, 0, 1.2, 0], [0.01, 0.5, 0.02, 0.5, 0.2, 0.5]);\n var gate = Impulse.kr(MouseX.kr(0.2, 3), 0.5);\n var gen = EnvGen.kr(env, gate);\n SinOsc.ar(270, SinOsc.ar(gen * 473)) * gen * 0.2\n}.play\n);\n// EnvGen multichannel expands when passed a multichannel envelope\n(\n{\n SinOsc.ar(\n EnvGen.kr(\n Env.circle([0, 1, 0, (2..4), 0, LFNoise1.kr(0.1 ! 5) * 10, 0], [0.01, 0.6])\n )\n * 240 + 300\n ).sum * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// fadeTimes should be above blockSize\n// for shorter grains you can use smaller blocksizes\n\n(\ns.options.blockSize = 2;\ns.reboot;\n);\n\n// as the effect is AM on single outs we get side bands\n\n(\ns.doWhenBooted {\n x = {\n var lfo = LFDNoise3.ar(0.2);\n DXFan.ar(\n Dseq((0..7), inf),\n SinOsc.ar(lfo.range(800, 1500), 0, 0.03),\n size: 8,\n fadeTime: 0.0002\n )\n }.play\n};\n);\n\nx.release\n\n\n// go back to default\n\n(\ns.options.blockSize = 64;\ns.reboot;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// fadeTimes should be above blockSize\n// for shorter grains you can use smaller blocksizes\n\n(\ns.options.blockSize = 2;\ns.reboot;\n);\n\n// as the effect is AM on single outs we get side bands\n\n(\ns.doWhenBooted {\n x = {\n var lfo = LFDNoise3.ar(0.2);\n DXFan.ar(\n Dseq((0..7), inf),\n SinOsc.ar(lfo.range(800, 1500), 0, 0.03),\n size: 8,\n fadeTime: 0.0002\n )\n }.play\n};\n);\n\nx.release\n\n\n// go back to default\n\n(\ns.options.blockSize = 64;\ns.reboot;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `GrayNoise`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-GrayNoise\", { |out = 0|\n Out.ar(out,\n GrayNoise.ar(-20.dbamp)\n )\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What are you good at?"}, {"role": "assistant", "content": "SuperCollider. I can explain its classes and UGens, write SynthDefs and patches, read a patch back to you, and tell you why one does not compile. I am 198M parameters; I am not a general assistant."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{WalshHadamard.ar(SoundIn.ar, MouseX.kr(0,64)}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{WalshHadamard.ar(SoundIn.ar, MouseX.kr(0,64))}.play\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `TWChoose`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar,\n Pulse.ar\n ];\n TWChoose.ar(Dust.ar(MouseX.kr(1, 1000, 1)), a, [0.99, 0.05, 0.05].normalizeSum) * 0.2\n\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nb = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n\n(\n{\n var snd, envTime, knee, out;\n snd = PlayBuf.ar(1, b, BufRateScale.kr(b), loop: 1);\n envTime = MouseX.kr(1.0e-3, 0.1e-3);\n knee = MouseY.kr(0, -90).dbamp;\n out = DelayC.ar(snd, 0.01, envTime * 0.5) * EnvFollow.ar(snd, 1 - (envTime * SampleRate.ir).reciprocal).max(knee).reciprocal;\n out * 0.1!2\n}.play;\n)\n```"}, {"role": "assistant", "content": "a replication of the legendary LADSPA plugin of the same name, originally written by steve harris. a compressor with a super fast attack which results in harsh distortion fx. requires sc3-plugins."}]} +{"conversations": [{"role": "user", "content": "Explain `MovingAverage` in SuperCollider briefly."}, {"role": "assistant", "content": "MovingAverage — The average of samples over a variable number of frames. A running average, power or RMS over a variable number of samples. For a running sum (not averaged) see MovingSum. Category: UGens > Analysis, UGens > Maths."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `LinSelectX`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar(300),\n Pulse.ar(230)\n ];\n\n LinSelectX.ar(MouseX.kr(0, 1) * a.size, a) * 0.2\n}.play;\n);\n\n(\n{\n var a;\n a = [\n SinOsc.kr(0.25),\n LFSaw.kr(10),\n LFPulse.kr(0.3)\n ];\n\n SinOsc.ar(LinSelectX.kr(MouseX.kr(0, 1) * a.size, a) * 300 + 400) * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `StandardN`."}, {"role": "assistant", "content": "```supercollider\n// mouse-controlled param\n{ StandardN.ar(SampleRate.ir/2, MouseX.kr(0.9, 4)) * 0.3 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nMix.ar([SinOsc.ar(220, 0, 0.1), SinOsc.ar(330, 0, 0.1)])\n```"}, {"role": "assistant", "content": "Sums two sine waves into one signal — a perfect fifth, 220 Hz and 330 Hz, at 0.1 amplitude each.\n\n`[SinOsc.ar(220, 0, 0.1), SinOsc.ar(330, 0, 0.1)]` is an Array of two audio-rate signals (each UGen\nreturns a signal; an array of them is just a list). `Mix.ar` adds the elements together. The alternative\n`+` operator does the same for two signals, and `Splay.ar` would spread them across the stereo field\ninstead of summing them."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Recorder`."}, {"role": "assistant", "content": "```supercollider\n(\n{ SinOsc.ar(\n SinOsc.ar(\n XLine.kr(1, 100, 5)).exprange(*XLine.kr([20, 800], [7000, 200], 10)\n )\n ) * 0.1\n\n}.play;\ns.record(duration: 10);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for very punchy snare in neurofunk style: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\neurosnare, {\n var snd;\n // a percussive click to give it some attack\n snd = LPF.ar(HPF.ar(WhiteNoise.ar, 300), 8000) * Env.linen(0.001, 0.01, 0.001).ar;\n // sine sweep body. very important!\n snd = snd + (SinOsc.ar(Env([400, 196, 160], [0.04, 0.2], \\exp).ar) * Env.perc(0.04, 0.2).ar * 6.dbamp).tanh;\n // sound of snare coils rattling\n snd = snd + (HPF.ar(BPeakEQ.ar(WhiteNoise.ar, 4000, 0.5, 3), 300) * Env.perc(0.05, 0.2).delay(0.01).ar(2) * -3.dbamp);\n // another sound sweep to improve the attack, optional\n snd = snd + (SinOsc.ar(XLine.kr(3000, 1500, 0.01)) * Env.perc(0.001, 0.02).ar);\n // distortion helps glue everything together and acts as a compressor\n snd = (snd * 1.4).tanh;\n snd = Pan2.ar(snd, \\pan.kr(0), \\amp.kr(0.1));\n Out.ar(\\out.kr(0), snd);\n}).add;\n);\n\nSynth(\\neurosnare, [amp: 0.4]);\n```"}]} +{"conversations": [{"role": "user", "content": "What is `ControlName`?"}, {"role": "assistant", "content": "ControlName — Object to store control information of SynthDef (used internally)"}, {"role": "user", "content": "What does `ControlName.index` do?"}, {"role": "assistant", "content": "The index of the control."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nd = SynthDef(\\tone, { |out = 0, freq = 200|\n var sig;\n\n freq.spec = ControlSpec(20, 20000);\n sig = SinOsc.ar(freq);\n\n Out.ar(out, sig);\n}).add;\n);\n\nd.specs.freq.postln;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `TwoPole`."}, {"role": "assistant", "content": "```supercollider\n{ TwoPole.ar(WhiteNoise.ar(0.005), 2000, 0.95) }.play\n\n{ TwoPole.ar(WhiteNoise.ar(0.005), XLine.kr(800, 8000, 8), 0.95) }.play\n\n{ TwoPole.ar(WhiteNoise.ar(0.005), MouseX.kr(800, 8000, 1), 0.95) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `OscN` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// compare examples below with interpolating Osc examples.\n\n(\ns = Server.local;\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, false, true);\nb = Buffer.alloc(s, 512, 1);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum, 500, 0, 0.5)\n )\n}).play(s, [0, 0, 1, b.bufnum]);\n\n);\nb.free;\n\n\n\n(\n// noninterpolating - there are noticeable artifacts\n// modulate freq\n\ns = Server.local;\nb.sine1(1.0/[1, 2, 3, 4, 5, 6].squared, true, false, true);\nb = Buffer.alloc(s, 512, 1);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum, XLine.kr(2000, 200), 0, 0.5)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n\n);\nb.free;\n\n(\n// sounds very different than the Osc example\ns = Server.local;\nb = Buffer.alloc(s, 512, 1);\nb.sine1([1.0], true, true, true);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum,\n OscN.ar(bufnum,\n XLine.kr(1, 1000, 9),\n 0,\n 200,\n 800),\n 0,\n 0.25)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n\n);\nb.free;\n\n(\n// modulate phase\ns = Server.local;\nb = Buffer.alloc(s, 512, 1);\nb.sine1([1.0], true, true, true);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum,\n 800,\n OscN.ar(bufnum,\n XLine.kr(20, 8000, 10),\n 0,\n 2pi),\n 0.25)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n);\nb.free;\n\n\n(\n// change the buffer while its playing\ns = Server.local;\nb = Buffer.alloc(s, 4096, 1);\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, true, true);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum, [80, 80.2], 0, 0.2)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n);\n\n(\nRoutine({\n var n = 32;\n 50.do({\n b.sine1(Array.rand(n, 0, 1).cubed, true, true, true);\n 0.25.wait;\n });\n}).play;\n);\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `GVerb`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\n// CAUTION: THE FOLLOWING CAN BE EXTREMELY LOUD\n// set the following variable to true if you want to run this code\nvar run = false;\nif (run) {\n { GVerb.ar(Dust.ar(5), SinOsc.kr(0.3).range(10, 14), drylevel:0) }.play\n}\n// 3.13 super loud glitch (crackling)! 3.14: super loud glitch (cleaner pitch shifting)!\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Duty`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\n {\n var freq;\n freq = Duty.kr(\n Drand([0.01, 0.2, 0.4], inf), // demand ugen as durations\n 0,\n Dseq([204, 400, 201, 502, 300, 200], inf)\n );\n SinOsc.ar(freq * [1, 1.01]) * 0.1\n\n }.play;\n);\n\n(\n {\n var freq;\n freq = Duty.kr(\n MouseX.kr(0.001, 2, 1), // control rate ugen as durations\n 0,\n Dseq([204, 400, 201, 502, 300, 200], inf)\n );\n SinOsc.ar(freq * [1, 1.01]) * 0.1\n\n }.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `RedTapeRecorder.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "sampling and looping Arguments: buffer; in — Input signal.; gate — 1= record, 0= looped playback.; interpol — 1= no, 2= linear, 4= cubic.; muteWhileRecording — when on (1) the sound is muted while recording.; lag — mute fade in and out time. only useful when muteWhileRecording is on. a small value here might reduce some clicks.."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\Identity;\n~description = \"Output the Ambisonics stream to outputs channels, useful for NRT rendering\";\n\n~function = {|in = 0|\nin;\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Routine` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// SynthDefs on the fly\ns.boot;\n(\nt = TempoClock.new;\nr = Routine.new({\n 10.do({\n // could be done with an argument instead of a new def, but proves the point\n SynthDef(\"help-EnvGen\" ++ i, { arg out = 0;\n Out.ar(\n out,\n EnvGen.kr(Env.perc, 1.0, doneAction: Done.freeSelf)\n * SinOsc.ar(100 + (100 * t.elapsedBeats), 0, 0.1)\n )\n }).play(s);\n 1.yield;\n });\n}).play(t); // Note the alternative syntax: Routine.play(aClock)\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n{Mix({|i|var j=Impulse,t=TChoose.kr(j.kr(1/8),[1,6,3]/8),r=Ringz.ar(j.ar(i*t+0.25),600*t*i+[0,9]);CombC.ar(r,1,0.5,4,0.1,r)}!4).tanh/4}.play\n```"}, {"role": "assistant", "content": "Hi colliders, this is my first post here, and also my very first sc tweet! \r\nIt's nothing special, just a little rhythmic Ringz thingy...\r\nAs a beginner, I found this really useful getting the hang of some syntax shortcuts:\r\nhttp://schemawound.com/post/25710867587/supercollider-tweets-background-tips."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n//code that utilizes the glitch.\n//warning! extremely loud.\n//note: might not sound the same on all soundcards\n(\n{GlitchBPF.ar(\n    ClipNoise.ar(1.dup),\n    0.5,\n    SinOsc.kr(1, 10)\n)}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n//code that utilizes the glitch.\n//warning! extremely loud.\n//note: might not sound the same on all soundcards\n(\n{GlitchBPF.ar(\n    ClipNoise.ar(1.dup),\n    0.5,\n    SinOsc.kr(1, 10)\n)}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `JITGui`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// typically, only subclasses of JITGui are used,\n // so here are just some basic usage and layout tests\n\n // make its own window - defPos, minSize is used\ng = JITGui(Ndef(\\a));\n\n // make its own window, specific size\ng = JITGui(Ndef(\\a), bounds: 390@20);\n\n // provide full bounds\ng = JITGui(Ndef(\\a), bounds: Rect(200, 500, 390, 24));\n\n // extent is 0@0: minSize x, y is used\ng = JITGui(Ndef(\\a), bounds: Rect(200, 500, 0, 0));\ng = JITGui(Ndef(\\a), bounds: Rect(200, 500, 0, 50));\ng = JITGui(Ndef(\\a), bounds: Rect(200, 500, 500, 0));\n\n\n( // put a JITGui in an existing window:\nw = Window().front;\ng = JITGui(Ndef(\\a), 0, w, bounds: 300@48);\n);\n\n( // 5 lines high\nw = Window().front;\ng = JITGui(Ndef(\\a), 5, w);\n);\n\n( // recommended: use a FlowLayout.\nw = Window().front;\nw.addFlowLayout;\nEZSlider(w, 300@100, \\test, []);\ng = JITGui(Ndef(\\a), 0, w, bounds: 300@40);\n);\n\n// test changing color schemes for JITguis\n// this scheme is admittedly ugly but different\n\nGUI.skins.put(\\jit, (\n fontSpecs: [\"Inconsolata\", 12],\n fontColor: Color.white,\n background: Color(0.2, 0.85, 0.7, 0.5),\n foreground: Color.grey(0.1),\n onColor: Color(0.5, 0, 0.5),\n onColor2: Color(0.0, 0.5, 0.5),\n offColor: Color.grey(0.2, 0.5),\n hiliteColor: Color.green(1.0, 0.5),\n gap: 0 @ 0,\n margin: 2@2,\n buttonHeight: 18,\n headHeight: 24)\n);\n\n// make some JITGuis to check\nn = NdefGui(Ndef(\\a));\nNdef(\\a, { SinOsc.ar(\\freq.kr(250)) });\nNdef(\\a).clear;\nn = NdefMixer(s);\n\nTdefAllGui();\nTdef(\\a).set(\\amp, 0.25);\nTdefGui(Tdef(\\a), 5);\n\nEnvirGui((a: 123));\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Latch`."}, {"role": "assistant", "content": "```supercollider\n{ Blip.ar(LFNoise0.kr(9, 400, 500), 4, 0.2) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for Re: Dark sea horns: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\n Ndef(\\x, {\n var output;\n var delayTime;\n var delayMax = 0.2;\n var delayAdd = 0.1;\n var pulseFreq = 0.5;\n var proxyMul = 2;\n var pulseMin = 40;\n var pulseMax = 130;\n var numOfEchos = 2;\n\n var mainPulse = LFPulse.ar(pulseFreq, 0, 0.5).range(pulseMin, pulseMax);\n var proxy = Ndef(\\x).ar * proxyMul;\n var ampModFreq = SinOsc.ar(0.01, 0).range(0.3, 30);\n var ampMod = LFNoise1.ar(ampModFreq, 6);\n output = SinOsc.ar(mainPulse + proxy, 0, ampMod).tanh;\n numOfEchos.do{\n delayTime = {delayMax.rand + delayAdd}!2;\n output = AllpassL.ar(output, 0.1, delayTime, 5);\n };\n output.tanh;\n }).play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = NodeProxy(s); a.play;\na.source = { Splay.ar(Blip.ar(\\freq.kr(18 ! 4))) * 0.2 };\na.set(\\freq, [1, 3, 56, 13]);\na.source = { Splay.ar(SinOsc.ar(LFSaw.ar(\\freq.kr(18 ! 4)) * 250 + 400)) * 0.2 };\nb = NodeProxy(s); b.source = { MouseX.kr(0, 3) * [1, 3, 56, 13] };\na.set(\\freq, b;\na.clear; b.clear;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = NodeProxy(s); a.play;\na.source = { Splay.ar(Blip.ar(\\freq.kr(18 ! 4))) * 0.2 };\na.set(\\freq, [1, 3, 56, 13]);\na.source = { Splay.ar(SinOsc.ar(LFSaw.ar(\\freq.kr(18 ! 4)) * 250 + 400)) * 0.2 };\nb = NodeProxy(s); b.source = { MouseX.kr(0, 3) * [1, 3, 56, 13] };\na.set(\\freq, b);\na.clear; b.clear;\n```"}]} +{"conversations": [{"role": "user", "content": "How do I pan notes around the stereo field in a pattern?"}, {"role": "assistant", "content": "Put `\\pan` in the Pbind: the default instrument understands it and passes it to Pan2.\n\n```supercollider\n(\nPbind(\n \\scale, Scale.minorPentatonic,\n \\degree, Pseq([0, 2, 4, 7, 9, 7, 4, 2], inf),\n \\dur, 0.2,\n \\pan, Pseq([-1, -0.5, 0, 0.5, 1, 0.5, 0, -0.5], inf),\n \\amp, 0.15\n).play;\n)\n```\n\nTo pan an arbitrary synth, add a `pan = 0` argument to the SynthDef and wrap the output in\n`Pan2.ar(sig, pan)`."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Using sine waves to generate a saw waveform. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\nq={|f,e|a=Array.fill(e,{|j|e-j}).reverse;(Mix.ar(a.collect{|x|SinOsc.ar(f*x,0,1/x)})/2)!2};{q.(60,300)}.play //saw from sine #supercollider\n\n//Change the values passed to q to control the frequency and how many sines are used.\n```"}]} +{"conversations": [{"role": "user", "content": "What is `SynthDesc`?"}, {"role": "assistant", "content": "SynthDesc — Description of a synth definition"}, {"role": "user", "content": "What does `SynthDesc.read` do?"}, {"role": "assistant", "content": "Adds all synthDescs in a path to a dict. You should not use this method or *readFile to read SynthDescs into a SynthDescLib. Use SynthDescLib#read or SynthDescLib#readStream instead."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"test\", { |out, freq, xFade|\n XOut.ar(out, xFade, SinOsc.ar(freq))\n}).store\n);\n```"}]} {"conversations": [{"role": "user", "content": "I get 'Node not found' when I call .set on a Synth after a while."}, {"role": "assistant", "content": "The Synth was freed and the language still holds a reference. That happens whenever the SynthDef used `doneAction: 2` and the envelope finished, or when something called `freeAll`/`CmdPeriod`. Guard it with `if (x.notNil and: { x.isPlaying }) { x.set(\\freq, 300) }`, or store the node in a variable that you clear when it ends. For sustained sounds the right pattern is a `gate` argument with `doneAction: 2` on the EnvGen, so the node lives until you release it."}]} -{"conversations": [{"role": "user", "content": "Explain `NumAudioBuses` in SuperCollider briefly."}, {"role": "assistant", "content": "NumAudioBuses — Number of audio busses. Category: UGens > Info."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\n(\nSynthDef(\"modsine\",\n { |out, freq = 320, amp = 0.2|\n Out.ar(out, SinOsc.ar(freq, 0, amp));\n }).add;\nSynthDef(\"lfo\",\n { |out, rate = 2|\n Out.kr(out, LFPulse.kr(rate, 0, 0.1, 0.2))\n }).add;\n);\n\n// start nodes\n(\nb = Bus.control(s, 1);\nx = Synth(\"modsine\");\ny = Synth.before(x, \"lfo\", [\\out, b]);\n);\n\n// create some node maps\n(\nh = NodeMap.new;\nh.set(\\freq, 800);\nh.map(\\amp, b);\n\nk = NodeMap\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\n(\nSynthDef(\"modsine\",\n { |out, freq = 320, amp = 0.2|\n Out.ar(out, SinOsc.ar(freq, 0, amp));\n }).add;\nSynthDef(\"lfo\",\n { |out, rate = 2|\n Out.kr(out, LFPulse.kr(rate, 0, 0.1, 0.2))\n }).add;\n);\n\n// start nodes\n(\nb = Bus.control(s, 1);\nx = Synth(\"modsine\");\ny = Synth.before(x, \"lfo\", [\\out, b]);\n);\n\n// create some node maps\n(\nh = NodeMap.new;\nh.set(\\freq, 800);\nh.map(\\amp, b);\n\nk = NodeMap.new;\nk.set(\\freq, 400);\nk.unmap(\\amp);\n);\n\n// apply the maps\n\nh.sendToNode(x); // the first time a new bundle is made\nk.sendToNode(x);\n\nh.sendToNode(x); // the second time the cache is used\nk.sendToNode(x);\n\nh.set(\\freq, 600);\n\nh.sendToNode(x); // when a value was changed, a new bundle is made\n\n// free all\nx.free; b.free; y.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Server`?"}, {"role": "assistant", "content": "Server — Object representing a server application"}, {"role": "user", "content": "What does `Server.new` do?"}, {"role": "assistant", "content": "Create a new Server instance."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n{ SinOsc.ar * 0.1 }.play(s); // play a synth on the server\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Hymn #15 - generative melody by array rewriting?"}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\ping, {\n arg freq = 440, pan = 0;\n var sig;\n sig = SinOsc.ar(freq, 0, 0.3);\n sig = sig * EnvGen.ar(Env.perc(0.01, 1), doneAction:2);\n sig = Pan2.ar(sig, pan);\n Out.ar(0, sig)\n}).add;\n);\n\n(\n~scramb = {|pan|\nvar notes = [0,4,7,14,9,12,4,7,9,7];\nvar dur = [1,1,2,3,6,3,4,5,2,1,13];\nvar transp = [0, 5, 7, 3, 2];\nvar scrambRand = {|array|\n var rand = rrand(0, array.size-3);\n var end = rand + rrand(1,2);\n var range = (rand..end);\n var reverseRange = range.reverse;\n var temp = array.copy;\n range.postln;\n range.do({|item, index|\n array[item] = temp[reverseRange[index]];\n });\n array;\n};\nvar octRand = {|array|\n var rand = rrand(0, array.size-1);\n array[rand] = array[rand] + [-12,0,12].choose;\n };\nvar task = Task {\n var step = 0;\n var transpStep = 0;\n loop {\n var freq = (notes.wrapAt(step) + 60 + transp.wrapAt(transpStep)).midicps;\n Synth(\\ping, [\\freq, freq, \\pan, pan]);\n (dur.wrapAt(step) * 0.15).wait;\n step = step + 1 % (notes.size * 12;);\n if (step%32 == 0, {scrambRand.value(notes)});\n if (step%20 == 0, {scrambRand.value(dur)});\n if (step%66 == 0, {transpStep = transpStep + 1 % (transp.size)});\n if (step%24 == 0, {notes = notes.rotate(rrand(-1, 1))});\n if (step%56 ==0, {octRand.value(notes)});\n }\n}.play;\n};\n);\n\n(\n~scramb.value(-0.7);~scramb.value(0.7);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes open files within the Modality workshop folder."}, {"role": "assistant", "content": "```supercollider\n// open files within the Modality workshop folder\n\n~basePath = \"\".resolveRelative;\n\n// installing Modality and other quarks for this workshop:\n(~basePath +/+ \"0_installing.scd\").openDocument;\n\n// finding and defining devices:\n(~basePath +/+ \"1_finding_and_defining_devices_hid.scd\").openDocument;\n(~basePath +/+ \"1_finding_and_defining_devices_midi.scd\").openDocument;\n\n// exploring elements and actions:\n(~basePath +/+ \"2_elements_and_actions_hid.scd\").openDocument;\n(~basePath +/+ \"2_elements_and_actions_midi.scd\").openDocument;\n\n// using ndefs:\n(~basePath +/+ \"3_using_ndefs_hid.scd\").openDocument;\n(~basePath +/+ \"3_using_ndefs_midi.scd\").openDocument;\n\n\n// some shared sound processes\n(~basePath +/+ \"shared_processes\").openOS;\n\n(~basePath +/+ \"shared_processes/*\").pathMatch.collect(_.basename).postcs;\n(~basePath +/+ \"shared_processes/*\").pathMatch.choose.openDocument;\n// open one of them:\n(~basePath +/+ \"shared_processes/cat.scd\").openDocument;\n// load one directly, e.g. for use in controller patches:\n(~basePath +/+ \"shared_processes/cat.scd\").load;\n\n// ... you are welcome to share your own sound processes here!\n\n// some more modal functionality using MFunc:\n(~basePath +/+ \"5_modal_functionality_2_hid.scd\").openDocument;\n(~basePath +/+ \"5_modal_functionality_2_midi.scd\").openDocument;\n(~basePath +/+ \"5_modal_functions_2b_midi.scd\").openDocument;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Recorder.numFrames` do?"}, {"role": "assistant", "content": "returns the number of frames of the recording"}]} -{"conversations": [{"role": "user", "content": "What does `BusPlug.bus` do?"}, {"role": "assistant", "content": "Set or get the bus. If BusPlug monitor is playing, restart the monitor to adequately play back the new"}]} -{"conversations": [{"role": "user", "content": "Explain `Standard2DL` in SuperCollider briefly."}, {"role": "assistant", "content": "Standard2DL — standard map 2D chaotic generator `x(n+1) = (x(n) + y(n+1)) % 2pi` Category: UGens > Generators > Stochastic."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var trig = Dust.kr(10);\n SinOsc.ar(\n TBrownRand.kr(300, 3000, 1.0, MouseX.kr(0, 5), trig)\n ) * 0.1\n}.play;\n);\n\n(\n{\n var trig = Dust.kr(10);\n Pan2.ar(\n SinOsc.ar(LinExp.kr(TBrownRand.kr(dev:0.2, trig:trig), 0, 1, 300, 3000)),\n TBrownRand.kr(-1.0, 1.0, 1.0, 4, trig),\n 0.1\n )\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var trig = Dust.kr(10);\n SinOsc.ar(\n TBrownRand.kr(300, 3000, 1.0, MouseX.kr(0, 5), trig)\n ) * 0.1\n}.play;\n);\n\n(\n{\n var trig = Dust.kr(10);\n Pan2.ar(\n SinOsc.ar(LinExp.kr(TBrownRand.kr(dev:0.2, trig:trig), 0, 1, 300, 3000)),\n TBrownRand.kr(-1.0, 1.0, 1.0, 4, trig),\n 0.1\n )\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What's the difference between Env.perc and Env.adsr?"}, {"role": "assistant", "content": "`Env.perc(attack, release)` goes up once and decays to zero — one-shot sounds. `Env.adsr(a, d, s, r)` holds at a sustain level while its gate is open and only releases when the gate closes — notes you start and stop."}, {"role": "user", "content": "So which do I use for a pad?"}, {"role": "assistant", "content": "adsr, with `gate` as a Synth argument and `doneAction: 2` on the EnvGen:\n\n```supercollider\nSynthDef(\\pad, { |out = 0, freq = 220, gate = 1|\n var env = EnvGen.kr(Env.adsr(0.8, 0.4, 0.7, 2), gate, doneAction: 2);\n Out.ar(out, Saw.ar(freq) * env * 0.1)\n}).add;\n```\n\nThen `x.set(\\gate, 0)` releases it over the 2 seconds of release time."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Shift register patch (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n/*\nShift register code adapted from here:\n\n\"http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/serial-in-parallell-out-shift-register-ugen-td6331387.html\"\n*/\n\n(\n~shift_register = {arg length = 5, trig, in;\n \n var buf = LocalBuf(length);\n var count = PulseCount.kr(trig);\n \n Demand.kr(trig, 0, Dbufwr(in, buf, count));\n Demand.kr(trig, 0, Dbufrd(buf, count + (1..length))).reverse;\n};\n\nNdef(\\n1, {\n\n var amp = 0.1;\n var pulse = Impulse.kr(1/16);\n var rate = TChoose.kr(pulse, [3,5,10]);\n var trans = TChoose.kr(pulse, [0,2,-2,7,-5]);\n\n //var trig = Impulse.kr([3,5]/2);\n var trig = Trig1.kr(CuspL.ar(rate * 3), 0.001);\n var octave = Demand.kr(PulseDivider.kr(trig, 4), 0, Drand([12,-12], inf));\n var note = Demand.kr(trig, 0, Dseq([42,46,51,54,59,63,66].scramble + trans, inf) + octave);\n var chord = ~shift_register.(5, trig, note);\n\n var sig = PMOsc.ar(\n Vibrato.ar(K2A.ar(chord.midicps)),\n chord.midicps * LFPulse.kr(1/8).range(1.01, 2.01),\n Env([3,3,0],[0, 0.2], -4).kr(gate:trig)\n );\n sig = sig * AmpCompA.kr(chord.midicps) * amp;\n\n sig = sig.flatten.sum;\n sig = XFade2.ar(sig!2, GVerb.ar(BPF.ar(sig, 90.midicps), roomsize:50, revtime:8, drylevel:0), 0.2);\n sig;\n\n}).play(fadeTime:4);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `HilbertFIR`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\ns.scope;\na = { HilbertFIR.ar(SinOsc.ar(100) * -20.dbamp, LocalBuf(2048)) }.play;\na.release;\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Splay`?"}, {"role": "assistant", "content": "Splay — Splay spreads an array of channels across the stereo field"}, {"role": "user", "content": "What does `Splay.arFill` do?"}, {"role": "assistant", "content": "In analogy to Mix:arFill, this method takes a function that produces the channels. The counting index is passed to it."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// splay 10 chans of sound into 2\n(\nx = { |spread = 1, level = 0.2, center = 0.0|\n var numchans = 10;\n Splay.ar(\n SinOsc.ar({ |i| LFNoise2.kr(1).exprange(200, 4000) } ! numchans),\n spread,\n level,\n center\n // use levelComp default true\n );\n}.play;\n);\n\ns.meter;\ns.scope;\n\n// change settings dynamically:\n\nx.set(\\spread, 1, \\center, 0); // full stereo\nx.set(\\spread, 0.5, \\center, 0); // less wide\nx.set(\\spread, 0, \\center, 0); // mono center\nx.set(\\spread, 0.5, \\center, 0.5); // spread from center to right\nx.set(\\spread, 0, \\center, -1); // all left\nx.set(\\spread, 1, \\center, 0); // full stereo\n\n// A similar example written with arFill:\n(\nx = { |spread = 1, level = 0.2, center = 0.0|\n var numchans = 10;\n Splay.arFill(numchans,\n { |i| SinOsc.ar(LFNoise2.kr(rrand(10, 20), 200, i + 3 * 100)) },\n spread,\n level,\n center\n );\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Amplitude`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n // LFSaw begins at 0, illustrates attack time better\n var sig = LFSaw.ar(440);\n var amps = Amplitude.ar(\n sig,\n attackTime: [0.001, 0.01],\n releaseTime: [0.01, 0.2]\n );\n [sig] ++ amps\n}.plot\n.superpose_(true)\n.plotColor_([Color.black, Color.green, Color.blue]);\n);\n\n(\n// use input amplitude to control SinOsc frequency\n{\n SinOsc.ar(\n Amplitude.kr(\n Blip.ar(3, 20) * LFNoise1.kr(0.1).range(0, 1),\n MouseX.kr(0.001, 1, 1),\n MouseY.kr(0.001, 1, 1),\n 1200,\n 400\n ),\n 0, 0.3)\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Buffer.query` do? What arguments does it take?"}, {"role": "assistant", "content": "Sends a `\\b_query` message to the server, which reponds with: the OSC address pattern (`/b_info`), `bufnum`, `numFrames`, `numChannels`, and `sampleRate` of the server-side buffer representation. These values are passed, in order, to the action function which, by default, is: `action: { |oscAddrPattern, bufnum, numFrames, numChannels, s` which posts the buffer's Arguments: action — An optional Function to be called with the buffer attributes listed above as arguments, replacing the default action.."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\smooth, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.linen(0.05, sustain, 0.1), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n)\n```"}, {"role": "assistant", "content": "plays an arpeggio on the \"left hand\" and an arpeggio on the \"right hand\"."}]} +{"conversations": [{"role": "user", "content": "Explain `Instr` in SuperCollider briefly."}, {"role": "assistant", "content": "Instr — An enhanced version of SynthDef with a library An Instrument is a function that has a unique name attached to it and Specs that describe the input and output datatypes. Category: Libraries > crucial > Instr."}]} +{"conversations": [{"role": "user", "content": "What does `TempoBus.asBus` do?"}, {"role": "assistant", "content": "maintains a control Bus on the server with the current Tempo"}]} +{"conversations": [{"role": "user", "content": "What is `BHiPass`?"}, {"role": "assistant", "content": "BHiPass — 12db/oct rolloff - 2nd order resonant Hi Pass Filter"}, {"role": "user", "content": "What does `BHiPass.sc` do?"}, {"role": "assistant", "content": "calculate filter coefficients."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n(\nz = {\n BHiPass.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(10, 20000, \\exponential), // cutoff freq.\n MouseY.kr(0.0, 1.0, \\linear), // rq\n 0.5); // mul\n}.play\n);\nz.release;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// sound example\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05, amp = 0.1|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2, amp), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\nvar a;\na = Pnaryop(\\wrap, Pseries(0, 1, 12), [3, 7]).asStream;\n{\n a.do { |val|\n Synth(\\help_sinegrain, [\\freq, (val + 72) .midicps.postln]);\n 0.5.wait;\n }\n}.for\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// sound example\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05, amp = 0.1|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2, amp), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\nvar a;\na = Pnaryop(\\wrap, Pseries(0, 1, 12), [3, 7]).asStream;\n{\n a.do { |val|\n Synth(\\help_sinegrain, [\\freq, (val + 72) .midicps.postln]);\n 0.5.wait;\n }\n}.fork;\n);\n\n(\nPbind(\n \\dur, 0.1,\n \\instrument, \\help_sinegrain,\n \\note, Pnaryop(\\wrap, Pseries(0, 1, 12), [3, 7]);\n).play;\n);\n\n\n\n// these are the same as:\n\n(\nvar a;\na = Pseries(0, 1, 12).wrap(3, 7).asStream;\n{\n a.do { |val|\n Synth(\\help_sinegrain, [\\freq, (val + 72) .midicps.postln]);\n 0.5.wait;\n }\n}.fork;\n);\n\n(\nPbind(\n \\dur, 0.1,\n \\instrument, \\help_sinegrain,\n \\note, Pwhite(0, 12, inf).wrap(3, 7);\n).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `OpenObject.avoidTheWorst` do?"}, {"role": "assistant", "content": "A Boolean to de/activate a layer of extra protection. By default this is true and will block strings that contain `unixCmd`, `systemCmd`, `Pipe` and `File`. To turn off the protection set this to false."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// crossfading a mono source between two outs\n\n(\nx = {\n DXFan.ar(\n Dseq([0, 1], inf),\n PinkNoise.ar(0.05),\n fadeTime: 1\n )\n}.play\n);\n\nx.release\n\n\n// Crossfading a stereo source between two outs,\n// for more than two channels size has to be passed.\n\n(\n{\n DXFan.ar(\n Dseq([0, 2], inf),\n `(Saw.ar(50 * [1, 5], 0.03)),\n size: 4,\n fadeTime: 0.1\n )\n}.plot(0.2)\n);\n\n\n// crossfading a mono source between several outs\n\n(\n{\n DXFan.ar(\n Dseq([0, 3, 1, 2], inf),\n BPF.ar(Pink\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// crossfading a mono source between two outs\n\n(\nx = {\n DXFan.ar(\n Dseq([0, 1], inf),\n PinkNoise.ar(0.05),\n fadeTime: 1\n )\n}.play\n);\n\nx.release\n\n\n// Crossfading a stereo source between two outs,\n// for more than two channels size has to be passed.\n\n(\n{\n DXFan.ar(\n Dseq([0, 2], inf),\n `(Saw.ar(50 * [1, 5], 0.03)),\n size: 4,\n fadeTime: 0.1\n )\n}.plot(0.2)\n);\n\n\n// crossfading a mono source between several outs\n\n(\n{\n DXFan.ar(\n Dseq([0, 3, 1, 2], inf),\n BPF.ar(PinkNoise.ar(), LFDNoise3.ar(1).range(100, 2000), 0.1, 0.7),\n size: 4,\n fadeTime: 0.05\n )\n}.plot(0.2)\n);\n\n\n// sliding over several channels, increased width\n\n(\n{\n DXFan.ar(\n Dseq([0, 3, 1, 2], inf),\n BPF.ar(PinkNoise.ar(), LFDNoise3.ar(1).range(100, 2000), 0.1, 0.7),\n size: 4,\n fadeTime: 0.02,\n maxWidth: 4,\n width: 3\n )\n}.plot(0.2)\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `TimeStretch2.stretch` do? What arguments does it take?"}, {"role": "assistant", "content": "Server Side Time Stretch Arguments: inFile — Path to the input file to be stretch. Can be a mono or stereo file. Will output a mono or stereo file corresponding to the input. Will output a WAV file up to 4gb and a w64 if larger.; durMult — How many times longer the outFile will be than the inFile. Goes waaaaay past 11 (try 100!).; numSplits — By default, the algorithm will split audio data into 9 frequency \"octaves\", starting with the first octave below nyquist, then subsequent octaves down from there, leaving everything below the last split to the largest buffer. However, for files of transients, you may want to approach this differentl; amp — The amplitude. Default is 1.; action — A function to be evaluated when the process has completed. By default it will print \"Done stretchin!\"."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `NRand`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-NRand\", { |out = 0, n = 0|\n Out.ar(out,\n FSinOsc.ar(\n NRand(1200.0, 4000.0, n),\n 0, Line.kr(0.2, 0, 0.01, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n(\nn = 0;\nRoutine({\n inf.do({ |i|\n Synth.new(\"help-NRand\", [\\n, n]); 0.05.wait;\n })\n}).play;\n);\n\nn = 1;\nn = 2;\nn = 4;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `PlayerRecorder.makePath` do?"}, {"role": "assistant", "content": "utility class to prepare and precisely record a player to a soundfile"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot\nb = Bus.audio(s, 2);\na = { SinOsc.ar([330, 440], 0, 0.4) }.play(s, b // you won't hear this if you only have two channels\nb.scope\n\na.free;\nb.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot\nb = Bus.audio(s, 2);\na = { SinOsc.ar([330, 440], 0, 0.4) }.play(s, b) // you won't hear this if you only have two channels\nb.scope\n\na.free;\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n Decay2.ar(\n Impulse.ar(8, 0, LFSaw.kr(0.3, 1, -0.3, 0.3)),\n 0.001,\n 0.3\n )\n * Mix.ar(Pulse.ar([80, 81], 0.3))\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n Decay2.ar(\n Impulse.ar(8, 0, LFSaw.kr(0.3, 1, -0.3, 0.3)),\n 0.001,\n 0.3\n )\n * Mix.ar(Pulse.ar([80, 81], 0.3))\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `ArrayMax.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "detect the largest value (and its position) in an array of UGens Arguments: array. Returns: # val, index"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// modulate fundamental frequency, formant freq stays constant\n{ Formant.ar(XLine.kr(400, 1000, 8), 2000, 800, 0.125) }.play\n\n// modulate formant frequency, fundamental freq stays constant\n{ Formant.ar(200, XLine.kr(400, 4000, 8), 200, 0.125) }.play\n\n// modulate width frequency, other freqs stay constant\n{ Formant.ar(400, 2000, XLine.kr(800, 8000, 8), 0.125 }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// modulate fundamental frequency, formant freq stays constant\n{ Formant.ar(XLine.kr(400, 1000, 8), 2000, 800, 0.125) }.play\n\n// modulate formant frequency, fundamental freq stays constant\n{ Formant.ar(200, XLine.kr(400, 4000, 8), 200, 0.125) }.play\n\n// modulate width frequency, other freqs stay constant\n{ Formant.ar(400, 2000, XLine.kr(800, 8000, 8), 0.125) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `PathName` in SuperCollider briefly."}, {"role": "assistant", "content": "PathName — file and directory path utilities PathName is a utility class for manipulating file names and paths. It expects a path to a file, and lets you access parts of that file path. Category: Files."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SortedList`."}, {"role": "assistant", "content": "```supercollider\nt = SortedList.new(8, {|a,b| a.first < b.first });\nt.add([10, \"last\"]);\nt.add([1, \"first\"]);\nt.postln;\n```"}]} +{"conversations": [{"role": "user", "content": "How do I make this brighter?\n```supercollider\n{ LPF.ar(Saw.ar(110), 400) * 0.2 }.play;\n```"}, {"role": "assistant", "content": "Raise the cutoff. 400 Hz is well below the harmonics that carry brightness, so open it to 2000-4000 Hz:\n\n```supercollider\n{ LPF.ar(Saw.ar(110), 3000) * 0.2 }.play;\n```"}, {"role": "user", "content": "Still dull."}, {"role": "assistant", "content": "Then the low-pass is not the limit — the source is. A saw at 110 Hz has energy up to Nyquist, so check the amplitude: at 0.2 the high harmonics are quiet. Two moves: add resonance so the filter peak is audible, and raise the level slightly.\n\n```supercollider\n{ RLPF.ar(Saw.ar(110), 2500, 0.3) * 0.35 }.play;\n```\n\nIf that is still dull, the answer is a different source: `Saw` is band-limited and soft; try `LFSaw` or add a second detuned saw for more high content."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// as frequency control...\n(\n{\nSinOsc.ar(\n LinCongL.ar(\n 40,\n LFNoise2.kr(0.1, 0.1, 1),\n LFNoise2.kr(0.1, 0.1, 0.1),\n LFNoise2.kr(0.1),\n 0, 500, 600\n )\n) * 0.4 }.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// as frequency control...\n(\n{\nSinOsc.ar(\n LinCongL.ar(\n 40,\n LFNoise2.kr(0.1, 0.1, 1),\n LFNoise2.kr(0.1, 0.1, 0.1),\n LFNoise2.kr(0.1),\n 0, 500, 600\n )\n) * 0.4 }.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a;\na = Pgeom(1.0, 1.1, inf);\na.asStream.nextN(100).plot;\n);\n\n\n// sound example\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\nvar a;\na = Pseries(300, 20, 70).asStream;\n{\n a.do { |val|\n Synth(\\help_sinegrain, [\\freq, val]);\n 0.02.wait;\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a;\na = Pgeom(1.0, 1.1, inf);\na.asStream.nextN(100).plot;\n);\n\n\n// sound example\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\nvar a;\na = Pseries(300, 20, 70).asStream;\n{\n a.do { |val|\n Synth(\\help_sinegrain, [\\freq, val]);\n 0.02.wait;\n }\n}.fork;\n);\n\n(\nPbind(\n \\dur, 0.01,\n \\instrument, \\help_sinegrain,\n \\freq, Pseries(800.0, Pbrown(-1.0, 3.0, 0.1, inf), inf)\n).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `EnvGen`."}, {"role": "assistant", "content": "```supercollider\n// as amplitude envelope\n(\n{\n var env = Env([0, 1, 0.5, 1, 0], [0.01, 0.5, 0.02, 0.5]);\n SinOsc.ar(470) * EnvGen.kr(env, doneAction: Done.freeSelf)\n}.play\n);\n\n// as amplitude and modulation envelope\n(\n{\n var env = Env([0, 1, 0.5, 0.8, 0, 1.2, 0], [0.01, 0.5, 0.02, 0.5, 0.2, 0.5]);\n var gate = Impulse.kr(MouseX.kr(0.2, 3), 0.5);\n var gen = EnvGen.kr(env, gate);\n SinOsc.ar(270, SinOsc.ar(gen * 473)) * gen * 0.2\n}.play\n);\n// EnvGen multichannel expands when passed a multichannel envelope\n(\n{\n SinOsc.ar(\n EnvGen.kr(\n Env.circle([0, 1, 0, (2..4), 0, LFNoise1.kr(0.1 ! 5) * 10, 0], [0.01, 0.6])\n )\n * 240 + 300\n ).sum * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n {\n var freq;\n freq = Duty.kr(\n Drand([0.01, 0.2, 0.4], inf), // demand ugen as durations\n 0,\n Dseq([204, 400, 201, 502, 300, 200], inf)\n );\n SinOsc.ar(freq * [1, 1.01]) * 0.1\n\n }.play;\n);\n\n(\n {\n var freq;\n freq = Duty.kr(\n MouseX.kr(0.001, 2, 1), // control rate ugen as durations\n 0,\n Dseq([204, 400, 201, 502, 300, 200], inf)\n );\n SinOsc.ar(freq * [1, 1.01]) * 0.1\n\n }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n {\n var freq;\n freq = Duty.kr(\n Drand([0.01, 0.2, 0.4], inf), // demand ugen as durations\n 0,\n Dseq([204, 400, 201, 502, 300, 200], inf)\n );\n SinOsc.ar(freq * [1, 1.01]) * 0.1\n\n }.play;\n);\n\n(\n {\n var freq;\n freq = Duty.kr(\n MouseX.kr(0.001, 2, 1), // control rate ugen as durations\n 0,\n Dseq([204, 400, 201, 502, 300, 200], inf)\n );\n SinOsc.ar(freq * [1, 1.01]) * 0.1\n\n }.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Diwhite` in SuperCollider?"}, {"role": "assistant", "content": "Diwhite — Demand rate white noise random generator. Category: UGens > Demand."}]} +{"conversations": [{"role": "user", "content": "What does `File.existsCaseSensitive` do?"}, {"role": "assistant", "content": "Like #*exists but ensure case sensitivity of the last path component on case insensitive filesystems. On case sensitive systems, it falls back to using"}]} +{"conversations": [{"role": "user", "content": "What does `MxQuery.reject` do? What arguments does it take?"}, {"role": "assistant", "content": "Just like collection Arguments: function — a new MxQuery with the non-rejected results."}]} +{"conversations": [{"role": "user", "content": "What does `RedMixerChannel.insertClass` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new RedEffectModule before the Arguments: redEfxClass — A class or an array of classes.; addAction — Local to the inserts. The default `\\addToHead` will put it first in the chain of inserts.."}]} +{"conversations": [{"role": "user", "content": "What does `Object.alwaysYield` do?"}, {"role": "assistant", "content": "Must be called from inside a Routine. Yields control to the calling thread. The receiver is the result passed to the calling thread's method. The Routine, when called subsequently will always yield the receiver until it is reset. alwaysYield never returns within the"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Pn(\n Pwrap(\n Pgeom(200, 1.07, 96),\n 200,\n 1000.0\n ),\n inf\n);\nx = a.asStream;\n\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, x.next.debug, \\dur, 0.3]);\n 0.12.wait;\n })\n}).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Pn(\n Pwrap(\n Pgeom(200, 1.07, 96),\n 200,\n 1000.0\n ),\n inf\n);\nx = a.asStream;\n\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, x.next.debug, \\dur, 0.3]);\n 0.12.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n~lfd={\n var signal, myFrequency, frequencyMin=0.1, frequencyMax=30, myAmplitude, amplitudeMin=0.01, amplitudeMax=0.6, myPhase, phaseMin=0, phaseMax=1.5;\n myFrequency = Array.fill(2, {[rrand(frequencyMin, frequencyMax)]});\n myAmplitude = Array.fill(2, {[rrand(amplitudeMin, amplitudeMax)]});\n myPhase = Array.fill(2, {[rrand(phaseMin, phaseMax)]});\n signal = LeakDC.ar([LFDNoise1, LFDNoise0, LFDNoise3, LFDClipNoise].choose.ar(myFrequency, myPhase, myAmplitude));\n Out.ar(0, signal);\n};\n);\n\n~lfd.scope\n```"}, {"role": "assistant", "content": "a draft of a modular function for LFDNoise sctochastically selection. i shall be turning this into a pseudo ugen, using high level classes abstraction layer."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `FreqScope`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n// create a new analyzer\nFreqScope.new(400, 200, 0, server: s);\n\n// basic sine\n{ SinOsc.ar(2000, 0, 0.25) }.play(s);\n\n// random saw\n{ RLPF.ar(Saw.ar(110, 0.2), LFNoise2.kr(1, 1e4, 1e4), LFNoise2.kr(1, 0.2, 0.22)) }.play(s);\n\n// modulate phase\n{ SinOsc.ar(800, SinOsc.ar(XLine.kr(20, 8000, 10), 0, 2pi), 0.25) }.play(s);\n\n// all harmonics\n{ Blip.ar(200, Line.kr(1, 100, 10), 0.2) }.play(s);\n\n// access the FreqScopeView object to set properties of the Qt Object:\nFreqScope.getInstance // get the FreqScope instance\n .scope // and its FreqScopeView\n .setProperty(\\updateInterval, 1000)\n // set updateInterval to 1000 ms because of reasons\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = List[1, 2, 3]\na.foldAt(2) // same as at\na.foldAt(3) // folds back\na.foldAt([-1, 3, 1]) // array of indices (returns not a list, but an array)\na@|@3 //syntactic shortcut\n\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n 32.do{ |i|\n {\n var freq = pitches.foldAt(i).midicps;\n var env = Env.perc.ar(Done.freeSelf);\n SinOsc.ar(freq) * 0.1 * env\n }.play;\n 0.2.wait\n }\n}\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = List[1, 2, 3]\na.foldAt(2) // same as at\na.foldAt(3) // folds back\na.foldAt([-1, 3, 1]) // array of indices (returns not a list, but an array)\na@|@3 //syntactic shortcut\n\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n 32.do{ |i|\n {\n var freq = pitches.foldAt(i).midicps;\n var env = Env.perc.ar(Done.freeSelf);\n SinOsc.ar(freq) * 0.1 * env\n }.play;\n 0.2.wait\n }\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `IRand`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-IRand\", {\n Out.ar(\n IRand(0, 1), // play on random channel between 0 and 1\n FSinOsc.ar(500,\n 0, Line.kr(0.2, 0, 0.1, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n(\nRoutine({\n 16.do({\n Synth.new(\"help-IRand\"); 0.5.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nc=13;a=Array.fib(64,0,1);b=Array.fill(size:c,function:{arg i;a[i]%12});\np=1/(21-c);Pdef(\\x,Pbind(\\dur,p,\\degree,Pseq(b,1,0)));\nr=Array.fill(c,{arg i;Pbindf(Pdef(\\x),\\mtranspose,1-b[i]);});\nPseq(r,(1/p)).play;\n)\n```"}, {"role": "assistant", "content": "Wow ! the conciseness of SuperCollider is wonderful !\r\nWe can make many attractive melodies !."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n{ BlitB3Saw.ar(XLine.kr(1000, 20, 10)) }.play;\n\n//aliasing suddenly appears for very high frequencies\n{ BlitB3Saw.ar(MouseX.kr(10,10000,'exponential'),MouseY.kr(0.01,0.99)) }.play;\n\n//comparison\n{ Saw.ar(1000) }.play;\n{ BlitB3Saw.ar(1000) }.play;\n\n{ Mix(Saw.ar({rrand(10,1000)}!100,mul:0.01)) }.play;\n//definitely more efficient second method\n{ Mix(BlitB3Saw.ar({rrand(10,1000)}!100,mul:0.01)) }.play;\n\n//see also comparison in BlitB3 help file\n```"}, {"role": "assistant", "content": "aliasing suddenly appears for very high frequencies definitely more efficient second method (BlitB3Saw: BLIT derived sawtooth)"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `StandardN`."}, {"role": "assistant", "content": "```supercollider\n// vary frequency\n{ StandardN.ar(MouseX.kr(20, SampleRate.ir)) * 0.3 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `BufAllpassL` in SuperCollider briefly."}, {"role": "assistant", "content": "BufAllpassL — Buffer based all pass delay line with linear interpolation. All pass delay line with linear interpolation which uses a buffer for its internal memory. See also BufAllpassN which uses no interpolation, and which BufAllpassC uses cubic interpolation. Cubic interpolation is more computationally expensive than linear, but more accurate. Category: UGens > Delays > Buffer."}]} +{"conversations": [{"role": "user", "content": "What does `UScore.playState` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: newState — (describe argument here); changed — (describe argument here). Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "What does `RingBuffer.overwrite` do?"}, {"role": "assistant", "content": "Add value and increase LINK#-writePos by overwriting oldest readable"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `BinaryOpUGen`."}, {"role": "assistant", "content": "```supercollider\n// trigger an envelope\n(\n{\n var trig;\n trig = SinOsc.ar(1) > 0.1;\n EnvGen.kr(Env.perc, trig, doneAction: Done.none) * SinOsc.ar(440, 0, 0.1)\n}.play\n) // > outputs 0 or 1\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nb = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n\n// This is very cool!\n\n(\n{\n Spring.ar(PlayBuf.ar(1, b, loop: 1)*Saw.ar(4));\n}.play;\n)\n```"}, {"role": "assistant", "content": "Feeding sound file multiplied by a slow saw wave into the spring physical model. Fascinating results ensue."}]} +{"conversations": [{"role": "user", "content": "What does `Tempo.beats2secsKr` do? What arguments does it take?"}, {"role": "assistant", "content": "when used in an Instr in a Patch this will convert beats to seconds, inserting a control rate UGen with the Arguments: beats."}]} +{"conversations": [{"role": "user", "content": "How to generate paradiddles?"}, {"role": "assistant", "content": "SuperCollider forum — How to generate paradiddles?\n\nHi Rodet, I’m teaching jazz at college, and sometimes paradiddles come up in conversation (although I’m not a drummer). A paradiddle is basically a way of ‘evenly’ playing a roll (single/double/triple/whatever). If you take your drumsticks/fingers and play evenly:\n\nright, left, right, right, left, right, left, left, right, left, right, right, etc\n\nyou’ll notice that it’s possible to get an even rhythm, which when played fast becomes a roll. The idea of the single/double/triple is just to place the accents (lightly, or not) on the left, right hand, which if I understand helps keep an even stroke (and makes better sense to follow).\n\nSo, although I don’t know the goal of your idea, a simple code which would give you the solution could be a pattern. You’ll notice I’ve put in a SynthDef to give the ‘snare’ sound - not very real, but just for the demonstration. If you run these patterns, un-commenting the line needed (single, double or triple - don’t forget to comment out the lines you don’t need), you’ll hear the accents a paradiddle gives.\n\nIn this example Pbind ‘a’ gives the pulse, and Pbind ‘b’ the accents. And, if you play along with them (using your chart), you’ll notice the accents pass from right hand to left hand (or vice versa). This is (more or less) what paradiddles do, although a drummer will explain better how they ‘accent’ strokes to get more complicated/subtle rhythms.\n\n```supercollider\n(\nSynthDef(\\snare, {\n arg out=0, sus=0.1;\n var sig, env;\n sig = WhiteNoise.ar(0.1);\n env = EnvGen.kr(Env.perc(0.001, sus), doneAction:2);\n sig = sig*env;\n Out.ar(out, sig!2);\n}).add;\n);\n\n(\nt=TempoClock(80/60);\na=Pbind(\n \\instrument, \\snare,\n \\dur, 1/2,\n \\sus, 0.01\n);\nb=Pbind(\n \\instrument, \\snare,\n \\dur, 1,\n \\sus, Pseq([0.02, 0.01],inf), // single\n //\\sus, Pseq([0.02, 0.01, 0.01],inf), // double\n //\\sus, Pseq([0.02, 0.01, 0.01, 0.01],inf), // triple\n);\nPpar([a, b]).play(t);\n)\n```\n\nI hope that puts you on the right track.\n\np.s. Don’t forget to try out changing the speed to get the real effect. Try something like 320/60 on the TempoClock."}]} +{"conversations": [{"role": "user", "content": "What does `PInRange.new` do? What arguments does it take?"}, {"role": "assistant", "content": "UGenPatterns quark library Arguments: pattern; lo; hi."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `FBSineC`."}, {"role": "assistant", "content": "```supercollider\n// increase feedback\n{ FBSineC.ar(SampleRate.ir, 1, Line.kr(0.01, 4, 10), 1, 0.1) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "I get 'Buffer UGen: no buffer data'. What does it mean?"}, {"role": "assistant", "content": "The UGen got a bufnum that the server has no data for. `Buffer.read` is asynchronous: the Buffer object exists immediately but the samples arrive later, so a Synth created straight after `Buffer.read` reads nothing. Wait for it — `s.sync` after the read, or `Buffer.read(s, path, action: { |b| ... })` and create the Synth in the action. The other cause is a nil or wrong buffer: `PlayBuf.ar(1, ~buf)` where ~buf was never assigned passes 0, which is 'no buffer'."}]} +{"conversations": [{"role": "user", "content": "What is `ArrayedCollection`?"}, {"role": "assistant", "content": "ArrayedCollection — Abstract superclass of Collections of fixed maximum size"}, {"role": "user", "content": "What does `ArrayedCollection.newClear` do?"}, {"role": "assistant", "content": "Creates a new instance with indexedSize indexable slots. The slots are filled with Nil, zero or something else appropriate to the type of indexable slots in the object. `Array.newClear(4).postln;`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n pitches.size.do{ |i|\n {\n var freq = pitches[i].midicps;\n var env = Env.perc.ar(Done.freeSelf);\n SinOsc.ar(freq) * 0.1 * env\n }.play;\n 0.2.wait\n }\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `EZRanger.unitView` do?"}, {"role": "assistant", "content": "The units label. Only appears if `unitWidth` was set to >"}]} +{"conversations": [{"role": "user", "content": "Can you run this code and tell me if it works?"}, {"role": "assistant", "content": "No — I cannot execute SuperCollider. What I can tell you is what would break and why: bracket balance, arguments that must exist for the class, a SynthDef that never reaches Out, a SynthDef played before it is added, an envelope that frees the Synth immediately. For certainty, evaluate it: the post window reports errors precisely, and `s.plotTree` shows whether the node exists."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Just experimenting with patterns that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n/* Some Funky Klangs - Totally botched the math on what I was trying to do but it sounds better this way */\n\n( \nSynthDef(\\DistKlangBlip, { \n | out = 0, release = 1, freq1 = 1, freq2 = 5, freq3 = 8, freqMult = 4 | \n var env = Linen.kr(Impulse.kr(0), 0.01, 1, release, doneAction:2); \n var freqs = ([freq1, freq2, freq3] * freqMult).midicps; \n var klang = Klang.ar(`[freqs, nil, nil ], 1, 0); \n Out.ar(out, klang.tanh!2 * env * 0.5) \n}).add\n\n);\n\n( \n Pbind(*[ \n instrument: \\DistKlangBlip, \n dur: Pxrand([0.25, 0.5], inf) * 0.5, \n release: Pkey(\\dur), \n freqMult: Pxrand((3..12), inf), \n freq2: Prand([4,5], inf), \n freq3: Prand([8,12], inf) \n]).play; \n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Patch.respawn` do? What arguments does it take?"}, {"role": "assistant", "content": "Pairs an Instr with inputs that that will be passed to the Instr Arguments: atTime — see atTime."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LinCongC`."}, {"role": "assistant", "content": "```supercollider\n// randomly modulate params\n(\n{ LinCongC.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(0.1, 0.5, 1.4),\n LFNoise2.kr(0.1, 0.1, 0.1),\n LFNoise2.kr(0.1)\n) * 0.2 }.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Seekers are something you should avoid. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var time = 0.23;\n var freq = (55).midicps;\n var a = VarSaw.ar(freq/2, width: XLine.ar(0.5,1,time)).range(0,XLine.ar(0.666,1/666,time));\n var tone = SinOsc.ar(freq).fold(-0.23*a,a) * EnvGen.ar(Env([1,0],[time]));\n Out.ar(0, tone.dup);\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Kepler 22-b atmosphere. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\nfork { \n Ndef(\\ttwnd).play;//(d,2,addAction:\\addToHead);\n loop {\n var seed = thisThread.randSeed = 100000000.rand.debug('seed');\n Ndef(\\ttwnd, {\n var freq = [20, 7500];\n Splay.ar(\n { \n var bands = 2.rrand(10);\n var sig = { [BPF,RLPF,RHPF].choose.ar(\n LFNoise2.ar(freq[0].rrand(freq[1]), LFNoise2.kr(0.1.exprand(10))),\n Array.rand(bands, freq[0], freq[1]),\n Array.rand(bands, 0.2, 1.8)\n ).mean } ! 2;\n Rotate2.ar(sig[0], sig[1], LFSaw.kr(0.1.exprand(10)));\n } ! 4.rrand(6).debug('source'),\n 0.5.rrand(1)\n );\n }).fadeTime_(1.rrand(4.0));\n 10.0.rrand(40).debug('wait(bts)').wait;\n }\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ LFNoise0.ar(1000, 0.25) }.play;\n\n// modulate frequency\n\n{ LFNoise0.ar(XLine.kr(1000, 10000, 10), 0.25) }.play;\n\n// as frequency modulator\n(\n{ SinOsc.ar(\n LFNoise0.ar(4, 400, 450),\n 0, 0.2\n )\n}.play;\n)\n\n// freq is the rate of starting points\n{ var freq = 1000; [LFNoise0.ar(freq), Impulse.ar(freq) }.plot\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ LFNoise0.ar(1000, 0.25) }.play;\n\n// modulate frequency\n\n{ LFNoise0.ar(XLine.kr(1000, 10000, 10), 0.25) }.play;\n\n// as frequency modulator\n(\n{ SinOsc.ar(\n LFNoise0.ar(4, 400, 450),\n 0, 0.2\n )\n}.play;\n)\n\n// freq is the rate of starting points\n{ var freq = 1000; [LFNoise0.ar(freq), Impulse.ar(freq)] }.plot\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Red3D.update` do?"}, {"role": "assistant", "content": "Call this to perform the rotation calculations. This updates the variable"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a;\na = Prout({ loop { 1.yield; 2.yield; 7.yield; 10.do { 1.0.rand.yield } } });\na.asStream.nextN(100).plot;\n);\n\n\n// sound example\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.1), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n(\nvar a;\na = Prout({ loop { 1.yield; 2.yield; 7.yield; 10.do { 1.0.\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a;\na = Prout({ loop { 1.yield; 2.yield; 7.yield; 10.do { 1.0.rand.yield } } });\na.asStream.nextN(100).plot;\n);\n\n\n// sound example\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.1), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n(\nvar a;\na = Prout({ loop { 1.yield; 2.yield; 7.yield; 10.do { 1.0.rand.yield } } }).asStream;\n{\n a.do { |val|\n Synth(\\help_sinegrain, [\\freq, val * 100 + 300]);\n 0.02.wait;\n }\n}.fork;\n);\n\n// shortcut:\n(\nPbind(\n \\instrument, \\help_sinegrain,\n \\freq, p { loop { ([1000, 2000].choose + [100, 200].choose + [10, 20].choose).postln.yield } },\n \\dur, 0.1\n).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SoundFileView.peakColor` do? What arguments does it take?"}, {"role": "assistant", "content": "The color of the peak-to-peak data. This can be overridden by #-waveColors. Defaults to `Color(0.95, Arguments: A `Color`.."}]} {"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ RHPF.ar(Saw.ar(200, 0.1), FSinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3600, 4000), 0.2) }.play;\n\n(\n{ var ctl = RHPF.kr(LFSaw.kr(2), SinOsc.kr(XLine.kr(0.07, 30, 20), 0, 35, 40), 0.05);\n SinOsc.ar(ctl * 200 + 500);\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ RHPF.ar(Saw.ar(200, 0.1), FSinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3600, 4000), 0.2) }.play;\n\n(\n{ var ctl = RHPF.kr(LFSaw.kr(2), SinOsc.kr(XLine.kr(0.07, 30, 20), 0, 35, 40), 0.05);\n SinOsc.ar(ctl * 200 + 500);\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `PS.lastValues` do?"}, {"role": "assistant", "content": "Array of last values stored in memoRoutine, latest value is first in"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// Handy code for quick class demonstrations.\n// Comparing a few intervals - Just Intonation versus 12-tone Equal Tempered\n\n// Major third (just)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 60.midicps * 5/4], mul: 0.1) }).play\n// Major third (ET12)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 64.midicps], mul: 0.1) }).play;\n\n// Major second (just)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 60.midicps * 9/8], mul: 0.1) }).play\n// Major second (ET)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 62.midicps], mul: 0.1) }).play;\n\n// Perfect fifth (just)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 60.midicps * 3/2], mul: 0.1) }).play\n// Perfect fifth (ET)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 67.midicps], mul: 0.1) });\n```"}, {"role": "assistant", "content": "Simple handy code for quick class demonstrations. Hear and compare a few intervals in Just Intonation versus 12-tone Equal Tempered tuning."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes old school noise from needle on vinyl."}, {"role": "assistant", "content": "```supercollider\n{\n var sig, sig1, sig2, lpf, popHz, lagtime, noise, popHzMul,\n pan1, pan2, panmod1, panmod2;\n popHzMul = Decay.kr(Dust.kr(0.15), 3, 10, 0.8);\n popHz = LFNoise1.kr(20).exprange(0.1,10) * popHzMul;\n sig = Dust2.ar(popHz);\n lpf = LFNoise1.kr(10).exprange(1000,20000);\n lagtime = LFNoise1.kr(20).range(0.008,0.0001);\n sig = LPF.ar(sig, lpf);\n sig = Lag.ar(sig, lagtime);\n sig = sig + FreeVerb.ar(sig, 0.8, 1, mul:0.11);\n panmod1 = LFNoise1.kr(5).range(0.2,0.7);\n panmod2 = LFNoise1.kr(5).range(0.2,0.7);\n pan1 = SinOsc.kr(panmod1).range(-0.2,0.2);\n pan2 = SinOsc.kr(panmod2).range(-0.2,0.2);\n sig1 = Pan2.ar(sig, pan1, 0.5);\n sig2 = Pan2.ar(sig, pan2, 0.5);\n sig = sig1 + sig2;\n sig = sig + BPF.ar(BrownNoise.ar([0.0025,0.0025]), 7200, 0.4);\n sig = sig + HPF.ar(Crackle.ar([1.999,1.999], 0.0025),2000);\n Out.ar(0, sig*6);\n}.play\n```"}]} -{"conversations": [{"role": "user", "content": "What is `CondVar`?"}, {"role": "assistant", "content": "CondVar — Condition variable: block one or more threads until some condition is true"}, {"role": "user", "content": "What does `CondVar.wait` do?"}, {"role": "assistant", "content": "The behavior depends on whether a `predicate` is given. If no `predicate` is given, this method simply blocks the current thread until it is woken by `signalOne` or `signalAll`. Otherwise, this method is equivalent to `while { predicate.value.not } { cond.wait }`. In other words, the thread only blocks if the predicate is false, otherwise it blocks and only resumes once the thread has been signall"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nc = CondVar();\n\nRoutine {\n 1.wait;\n \"waited for 1 second\".postln;\n 1.wait;\n \"waited for another second, now waiting for you to run 'c.signalOne'...\".postln;\n c.wait;\n \"the condition is no longer waiting\".postln;\n 1.wait;\n \"waited for another second, now waiting for you...\".postln;\n c.wait;\n \"the condition is no longer waiting\".postln;\n 1.wait;\n \"the end\".postln;\n}.play;\n);\n\n// Run this line to unblock the routine\nc.signalOne;\n```"}]} -{"conversations": [{"role": "user", "content": "What is `CutPBS1` in SuperCollider?"}, {"role": "assistant", "content": "CutPBS1 — CutBuf playback rate algorithm CutPBS1 is intended to be used in the pbsfunc (playback speed func) parameter of CutBuf2 and CutBuf3. The first repeat of each block has rate 1, and the following repeats follow a geometric sequence. Category: Libraries > BBCut > Cut FX."}]} -{"conversations": [{"role": "user", "content": "What is a UGen?"}, {"role": "assistant", "content": "A UGen is a unit generator: the primitive signal-processing node of the server. SinOsc, Saw, WhiteNoise, LPF and EnvGen are UGens, and they are wired into a graph inside a SynthDef."}]} -{"conversations": [{"role": "user", "content": "What does `TraerSpring.getOneEnd` do?"}, {"role": "assistant", "content": "Return the particles that are on either end of this Returns: a LINKClasses/TraerParticle"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SampleRate`."}, {"role": "assistant", "content": "```supercollider\n// compares a 441 Hz sine tone derived from sample rate (44100 * 0.01, left)\n// with a 440 Hz tone (right), resulting in a 1 Hz beating\n(\n{\n var freq;\n freq = [SampleRate.ir * 0.01, 440];\n SinOsc.ar(freq, 0, 0.1)\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `String.postcs` do?"}, {"role": "assistant", "content": "As #-postln, but posts the #-asCompileString#compileString of the receiver. `List[1, 2, [\"comment\", [3, 2]], { 1.0.rand"}]} +{"conversations": [{"role": "user", "content": "Who are you?"}, {"role": "assistant", "content": "I am sc-mind, a 198M MiniMind-3-MoE trained from scratch on the SuperCollider source and help corpus. I write and explain SuperCollider: SynthDefs, UGens, Patterns, Ndef, the language/server split, and how to make sound that is not silence."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `RunningMin`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n SinOsc.ar(\n RunningMin.ar(Dust.ar(20), Impulse.ar(0.4)) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// follow a sine lfo, reset rate controlled by mouse x\n(\n{\n SinOsc.ar(\n RunningMin.kr(SinOsc.kr(0.2), Impulse.kr(MouseX.kr(0.01, 2, 1))) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ SinOscFB.ar(440, MouseX.kr(0, 4))*0.1 }.play\n\n\n{ SinOscFB.ar(MouseY.kr(10, 1000, 'exponential'), MouseX.kr(0.5pi, pi))*0.1 }.play\n\n\n{ SinOscFB.ar(100*SinOscFB.ar(MouseY.kr(1, 1000, 'exponential'))+200, MouseX.kr(0.5pi, pi))*0.1 }.play\n\n\n// Scope the wave form\n{ SinOscFB.ar([400, 301], MouseX.kr(0, 4), 0.3 }.scope;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ SinOscFB.ar(440, MouseX.kr(0, 4))*0.1 }.play\n\n\n{ SinOscFB.ar(MouseY.kr(10, 1000, 'exponential'), MouseX.kr(0.5pi, pi))*0.1 }.play\n\n\n{ SinOscFB.ar(100*SinOscFB.ar(MouseY.kr(1, 1000, 'exponential'))+200, MouseX.kr(0.5pi, pi))*0.1 }.play\n\n\n// Scope the wave form\n{ SinOscFB.ar([400, 301], MouseX.kr(0, 4), 0.3) }.scope;\n```"}]} +{"conversations": [{"role": "user", "content": "What is the node tree and what is a Group for?"}, {"role": "assistant", "content": "Everything running on the server is a node: Synths and Groups, arranged in a tree under the root group. Order matters, because audio flows through buses from earlier to later nodes in the same branch. A Group is a container that lets you address many nodes at once, which is what you want for an effect chain — put the instruments in one group, the effect in another, and `freeAll` or a volume change hits the whole group instead of a list of node ids."}]} +{"conversations": [{"role": "user", "content": "What does `AbstractDispatcher.typeKey` do?"}, {"role": "assistant", "content": "Subclasses should override this method to return a key indicating the type of message this dispatcher responds to, e.g. `'OSC matched'` or `'MIDI Returns: A Symbol."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//multiple objects within a world with gravity force\n//color and size depends on object's mass\n\n(\nvar width= 300, height= 300, w, wgrav, world, n= 80;\n\n//--world\nw= RedWindow(\"vector test\", Rect(128, 64, width, height)).front;\nwgrav= RedVector2D[-0.1, 0.98]; //world xy gravity\nworld= RedWorld3(RedVector2D[width, height], wgrav, 20, 0.2); //dim,grav,maxvel,damp\n\n//--objects\n{\n var mass= 1.0.rrand(4); //random mass for each object\n RedObject(world, RedVector2D[width, 20].rand, 0, 0, mass, mass*5); //world,loc,vel,acc,mass,size\n}.dup(n);\n\n//--loop\nw.draw{\n world.objects.do{|o|\n o.addForce(world.gravity);\n o.update;\n world.contain(o);\n\n //--render\n Pen.strokeColor= Color.grey(o.mass/4);\n Pen.strokeRect(Rect.aboutRedObject2D(o));\n };\n};\nw.play;\nCmdPeriod.doOnce({w.close});\n)\n```"}, {"role": "assistant", "content": "multiple objects within a world with gravity force color and size depends on object's mass."}]} +{"conversations": [{"role": "user", "content": "What does `Function.plot` do? What arguments does it take?"}, {"role": "assistant", "content": "Implements a function Arguments: duration — The duration of the function to plot in seconds. The default is 0.01.; target — The server, synth or group where the signal is picked up. See asTarget. `(`; bounds — An instance of Rect or Point indicating the bounds of the plot window.; minval — the minimum value in the plot. If not specified, the signal's minimum is used.; maxval — the maximum value in the plot. If not specified, the signal's maximum is used.; separately — If set to `true`, for multichannel signals use separate value display ranges, unless minval or maxval is specified already.; parent — Either a Window or View may be passed in - then the plot is embedded. Otherwise a new Window is created. `(`."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nSynthDef(\"help-PulseDivider\", { |out = 0|\n var p, a, b;\n p = Impulse.ar(8);\n a = SinOsc.ar(1200, 0, Decay2.ar(p, 0.005, 0.1));\n b = SinOsc.ar(600, 0, Decay2.ar(PulseDivider.ar(p, 4), 0.005, 0.5));\n\n Out.ar(out, (a + b) * 0.4)\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nSynthDef(\"help-PulseDivider\", { |out = 0|\n var p, a, b;\n p = Impulse.ar(8);\n a = SinOsc.ar(1200, 0, Decay2.ar(p, 0.005, 0.1));\n b = SinOsc.ar(600, 0, Decay2.ar(PulseDivider.ar(p, 4), 0.005, 0.5));\n\n Out.ar(out, (a + b) * 0.4)\n}).play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `AbstractMessageMatcher.func` do?"}, {"role": "assistant", "content": "Get or set this object's response Returns: A Function or similar object."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nx = SynthDef(\\test, {\n Out.ar(0, \n Formants.ar(420, Vowel(\\a).addControls(3)) * 0.01\n )\n}).play\n);\n\nx.inspect\n\nx.setn(*Vowel(\\i).asKeyValuePairs(3);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nx = SynthDef(\\test, {\n Out.ar(0, \n Formants.ar(420, Vowel(\\a).addControls(3)) * 0.01\n )\n}).play\n);\n\nx.inspect\n\nx.setn(*Vowel(\\i).asKeyValuePairs(3));\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// vibrato at 1 Hz, note the use of DC.ar UGen; a constant of 400.0 doesn't work\n{ SinOsc.ar(Vibrato.ar(DC.ar(400.0), 1, 0.02)) }.play\n\n// compare: k-rate freq input can be a constant\n{ SinOsc.ar(Vibrato.kr(400.0, 1, 0.02)) }.play\n\n// control rate and rateVariation\n{ SinOsc.ar(Vibrato.ar(DC.ar(400.0), MouseX.kr(2.0, 100.0), 0.1, 1.0, 1.0, MouseY.kr(0.0, 1.0), 0.1)) }.play\n\n// control depth and depthVariation\n{ SinOsc.ar(Vibrato.ar(DC.ar(4\n// …\n```"}, {"role": "assistant", "content": "vibrato at 1 Hz, note the use of DC.ar UGen; a constant of 400.0 doesn't work compare: k-rate freq input can be a constant (Vibrato: The Vibrato oscillator models a slow frequency modulation.)"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `BiPanB2`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var w, x, y, p, q, a, b, c, d;\n\n p = LFSaw.ar(200);\n q = LFSaw.ar(301);\n\n // B-format encode\n #w, x, y = BiPanB2.ar(p, q, MouseX.kr(-1, 1), 0.1);\n\n // B-format decode to quad\n #a, b, c, d = DecodeB2.ar(4, w, x, y);\n\n [a, b, d, c] // reorder to my speaker arrangement: Lf Rf Lr Rr\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\nSynthDef(\"a\", { Out.ar(0, SinOsc.ar(800, 0, 0.2)) }).add;\n\nSynthDef(\"b\", { |t_t = 0| Out.ar(1, PinkNoise.ar(0.3)); Free.kr(t_t, 1001) }).add;\n\ns.sendMsg(\\s_new, \\a, 1001, 0, 0);\n\ns.sendMsg(\\s_new, \\b, 1002, 0, 0);\n\ns.sendMsg(\\n_set, 1002, \\t_t, 1);\n\ns.sendMsg(\\s_new, \\a, 1001, 0, 0);\n\ns.sendMsg(\\n_set, 1002, \\t_t, 1);\n\ns.sendMsg(\\s_new, \\a,\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\nSynthDef(\"a\", { Out.ar(0, SinOsc.ar(800, 0, 0.2)) }).add;\n\nSynthDef(\"b\", { |t_t = 0| Out.ar(1, PinkNoise.ar(0.3)); Free.kr(t_t, 1001) }).add;\n\ns.sendMsg(\\s_new, \\a, 1001, 0, 0);\n\ns.sendMsg(\\s_new, \\b, 1002, 0, 0);\n\ns.sendMsg(\\n_set, 1002, \\t_t, 1);\n\ns.sendMsg(\\s_new, \\a, 1001, 0, 0);\n\ns.sendMsg(\\n_set, 1002, \\t_t, 1);\n\ns.sendMsg(\\s_new, \\a, 1001, 0, 0);\n\ns.sendMsg(\\n_set, 1002, \\t_t, 1);\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// connect will connect to all midi in devices\n// if you need to specify one,\n// check the sources at: MIDIClient.sources\n// and connect using MIDIIn.connect( source_index )\nMIDIIn.connect;\n\n// show incoming control data\n~control = { arg src, chan, num, val; \n [chan,num,val].postln; \n};\n\nMIDIIn.addFuncTo(\\control, ~control);\n```"}, {"role": "assistant", "content": "Simple example showing how to listen for MIDI control messages."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Compare:\n\n{ WhiteNoise.ar(0.25) }.play;\n\n{ BPZ2.ar(WhiteNoise.ar(0.25) }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Compare:\n\n{ WhiteNoise.ar(0.25) }.play;\n\n{ BPZ2.ar(WhiteNoise.ar(0.25)) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Beam me up scotty. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n{\nvar time = 8;\nvar freq = (40-12).midicps;\nvar a = VarSaw.ar(freq/2, width: XLine.ar(0.5,1,time)).range(0,XLine.ar(1,1/1000,time));\nvar tone = SinOsc.ar(freq).fold(-1*a,a);\nOut.ar(0, tone.dup);\n}.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `QuadC`."}, {"role": "assistant", "content": "```supercollider\n// default params\n{ QuadC.ar(SampleRate.ir/4) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `SampleRate`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// compares a 441 Hz sine tone derived from sample rate (44100 * 0.01, left)\n// with a 440 Hz tone (right), resulting in a 1 Hz beating\n(\n{\n var freq;\n freq = [SampleRate.ir * 0.01, 440];\n SinOsc.ar(freq, 0, 0.1)\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `VarLag`."}, {"role": "assistant", "content": "```supercollider\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n VarLag.kr( // lag the modulator\n LFPulse.kr(1).range(100, 400), // frequency modulator\n 0.2, // lag time\n Line.kr(-8, 8, 15, doneAction: Done.freeSelf) // modulate shape\n ),\n 0, // sine phase\n 0.3 // sine amplitude\n )\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `JITGui`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// typically, only subclasses of JITGui are used,\n // so here are just some basic usage and layout tests\n\n // make its own window - defPos, minSize is used\ng = JITGui(Ndef(\\a));\n\n // make its own window, specific size\ng = JITGui(Ndef(\\a), bounds: 390@20);\n\n // provide full bounds\ng = JITGui(Ndef(\\a), bounds: Rect(200, 500, 390, 24));\n\n // extent is 0@0: minSize x, y is used\ng = JITGui(Ndef(\\a), bounds: Rect(200, 500, 0, 0));\ng = JITGui(Ndef(\\a), bounds: Rect(200, 500, 0, 50));\ng = JITGui(Ndef(\\a), bounds: Rect(200, 500, 500, 0));\n\n\n( // put a JITGui in an existing window:\nw = Window().front;\ng = JITGui(Ndef(\\a), 0, w, bounds: 300@48);\n);\n\n( // 5 lines high\nw = Window().front;\ng = JITGui(Ndef(\\a), 5, w);\n);\n\n( // recommended: use a FlowLayout.\nw = Window().front;\nw.addFlowLayout;\nEZSlider(w, 300@100, \\test, []);\ng = JITGui(Ndef(\\a), 0, w, bounds: 300@40);\n);\n\n// test changing color schemes for JITguis\n// this scheme is admittedly ugly but different\n\nGUI.skins.put(\\jit, (\n fontSpecs: [\"Inconsolata\", 12],\n fontColor: Color.white,\n background: Color(0.2, 0.85, 0.7, 0.5),\n foreground: Color.grey(0.1),\n onColor: Color(0.5, 0, 0.5),\n onColor2: Color(0.0, 0.5, 0.5),\n offColor: Color.grey(0.2, 0.5),\n hiliteColor: Color.green(1.0, 0.5),\n gap: 0 @ 0,\n margin: 2@2,\n buttonHeight: 18,\n headHeight: 24)\n);\n\n// make some JITGuis to check\nn = NdefGui(Ndef(\\a));\nNdef(\\a, { SinOsc.ar(\\freq.kr(250)) });\nNdef(\\a).clear;\nn = NdefMixer(s);\n\nTdefAllGui();\nTdef(\\a).set(\\amp, 0.25);\nTdefGui(Tdef(\\a), 5);\n\nEnvirGui((a: 123));\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nMix.ar([SinOsc.ar(220, 0, 0.1), SinOsc.ar(330, 0, 0.1)])\n```"}, {"role": "assistant", "content": "Sums two sine waves into one signal — a perfect fifth, 220 Hz and 330 Hz, at 0.1 amplitude each.\n\n`[SinOsc.ar(220, 0, 0.1), SinOsc.ar(330, 0, 0.1)]` is an Array of two audio-rate signals (each UGen\nreturns a signal; an array of them is just a list). `Mix.ar` adds the elements together. The alternative\n`+` operator does the same for two signals, and `Splay.ar` would spread them across the stereo field\ninstead of summing them."}]} +{"conversations": [{"role": "user", "content": "What does `RedWorld.neighbours` do?"}, {"role": "assistant", "content": "Returns an Array of objects that are in the surrounding locations. Only useful when working with discrete worlds. e.g. cellular"}]} +{"conversations": [{"role": "user", "content": "What does `IBVAfft.new` do? What arguments does it take?"}, {"role": "assistant", "content": "create a new Arguments: ibva — an instance of IBVA."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// allocate buffer\nb = Buffer.alloc(s, 44100, 1);\n\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nBufDelayN.ar(b.bufnum, z, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\nb.free;\n\n\n// multichannel\n\n// two channels, two buffers\nb = Buffer.allocConsecutive(2, s, 32768, 1);\n\na = { |bufs = #[0, 1]|\n var sig = SinOsc.ar([440, 880\n// …\n```"}, {"role": "assistant", "content": "Dust randomly triggers Decay to create an exponential decay envelope for the WhiteNoise input source (BufDelayN: Buffer based simple delay line with no interpolation.)"}]} +{"conversations": [{"role": "user", "content": "Write a plucked string in SuperCollider."}, {"role": "assistant", "content": "Pluck is a Karplus-Strong string: a noise burst into a tuned delay with feedback. The delay time is\nthe reciprocal of the frequency.\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 220, amp = 0.5, dur = 3|\n var period = freq.reciprocal;\n var sig = Pluck.ar(WhiteNoise.ar(0.2), Impulse.kr(0), period, period, dur, 0.5);\n Out.ar(out, Pan2.ar(sig * amp, 0));\n}).add;\n);\nSynth(\\pluck, [\\freq, 330, \\dur, 4]);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `BusPlug` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\ns.boot;\nz = Bus.control(s, 16);\nz.setn({ |i| (i * 5).nthPrime } ! 16 * 5 + 100);\na = BusPlug.for(z);\n{ Splay.ar(SinOsc.ar(a.kr(3, MouseX.kr(0, 25)))) * 0.1 }.play; // selectively play 3 channel of the 16, modulate offset\n```"}]} {"conversations": [{"role": "user", "content": "What does `ServerLog.getSortedEvents` do? What arguments does it take?"}, {"role": "assistant", "content": "records OSC traffic to and from a Server and displays this in a browseable searchable interface Arguments: tail; callback. Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n~buf = BBCutBuffer(Platform.resourceDir +/+ \"sounds/break.aiff\", 8);\n\nBBCut2(CutGroup([CutBuf3(~buf, 0.3), CutMixer(0, 1, SQPushFXAmp2(0.5))]), SQPusher1()).play(2.5;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n~buf = BBCutBuffer(Platform.resourceDir +/+ \"sounds/break.aiff\", 8);\n\nBBCut2(CutGroup([CutBuf3(~buf, 0.3), CutMixer(0, 1, SQPushFXAmp2(0.5))]), SQPusher1()).play(2.5);\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Pattern transcription of intro chords of this song."}, {"role": "assistant", "content": "```supercollider\n// Crystal Waters \"Gypsy Woman (She's Homeless)\" - chords\n(\n~bpm = TempoClock.new(120/60);\nPbind(\n \\midinote, Pseq([\n Pn([45, 57, 67, 72, 76], 2),\n Pn([46, 58, 69, 74, 77], 3),\n Pn([43, 55, 67, 70, 74, 77], 2), \n Pn([48, 60, 67, 70, 73, 76], 3),\n Pseq([\n Pn([50, 62, 65, 69, 72, 76], 2),\n Pn([50, 62, 65, 69, 72, 74], 3)\n ], 2),\n Pn([45, 57, 67, 72, 76], 2),\n Pn([46, 58, 69, 74, 77], 3),\n Pn([52, 64, 76, 79, 83, 86], 2),\n Pn([51, 63, 75, 79, 82, 86], 3),\n Pseq([\n Pn([50, 62, 65, 69, 72, 76], 2),\n Pn([50, 62, 65, 69, 72, 74], 3)\n ], 2),\n ], inf),\n \\ctranspose, -12,\n \\dur, Pseq([1, Pn(3/4, 4)], inf),\n \\amp, 0.2,\n \\legato, Pseq([0.5, 0.5, Pwhite(0.2, 0.3, 3)], inf)\n).play(~bpm);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `BAllPass` in SuperCollider?"}, {"role": "assistant", "content": "BAllPass — All Pass Filter The B equalization suite is based on the Second Order Section (SOS) biquad UGen. Category: UGens > Filters > BEQSuite."}]} -{"conversations": [{"role": "user", "content": "What does `NodeProxy.controlNames` do?"}, {"role": "assistant", "content": "Returns the ControlName objects of all slots, except the names of this list (default: `[\\out, \\i_out, \\gate, \\fadeTime]`, which are used internally). When the node proxy received a `set` for a given key, the `defaultValue` of the corresponding `ControlName` contains the object that was passed, which might be any object"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n‎{h={|f|1-LFTri.ar(f)};l={|s,e|Line.ar(s,e,1200,1,0,2)};FreeVerb.ar(h.(l.(147,5147))*h.(l.(1117,17))*h.(100)*h.([55,55.1])*0.05,0.7,1)}.play\n\n//Explanation of this piece - http://schemawound.com/post/40100438722/11-13-2012-tweet-explained\n```"}, {"role": "assistant", "content": "Explanation of this piece - http://schemawound.com/post/40100438722/11-13-2012-tweet-explained."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `SharedOut` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\n// only works with the internal server\ns = Server.internal;\ns.boot;\n);\n\n(\nSynthDef(\"help-SharedOut\", {\n SharedOut.kr(0, SinOsc.kr(0.2));\n}).add;\n);\n\n(\ns.sendMsg(\\s_new, \"help-SharedOut\", x = s.nextNodeID, 0, 1);\ns.sendMsg(\\n_trace, x);\n\n// poll the shared control bus\nRoutine({\n 30.do({\n s.getSharedControl(0).postln;\n 0.2.wait;\n });\n}).play;\n);\n\n\ns.quit;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n var freqs = [200, 600, 400, 450, 150, 20, 800];\n var amps = Saw.ar(freq: [2,3, 5]).range(1, 0.5, 0.3, 0.8);\n var snd = LFTri.ar(freq: freqs, mul: amps);\n Mix.ar(snd)\n}.play;\n)\n```"}, {"role": "assistant", "content": "LFTri that plays in a single channel with frequent amplitude shifts."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Play your (short) soundfiles with some delay that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n// By Bjørn Houdorf March 2013, Play your (short) soundfiles with some delay.\n\nb = SoundFile.collectIntoBuffers(\"yourSoundFileFolder/*\"); // 1. rund this\n\n( // 2. and then run this\nt = Task({\n({\n var num= b.size.rand;\n var buf= b[num];\n 0.1*Splay.ar(PlayBuf.ar(buf.numChannels, buf, 1, 1, 0, 0));\n}.play;\n) \n});\n);\n\n\n( // 3. Then run this\nz = Task({\nloop({\n t.start;\n 0.1.wait;\n});\n});\n);\n\n\nz.start; // 4. and run this\nz.stop; // 5. and finally run this\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Detune idea is from James Harkins. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\na = {\n |freq = 40, wid = 0.5|\n Mix(LFPulse.ar(freq *((Array.fill(40, Pxrand((1, 2..20), inf).iter)/1000)+1),\n 0, wid, 0.05)\n ).dup\n}.play;\n);\n\n//more distorsion\n~widlfo = {Saw.kr(0.5).range(0,1)};\na.set(\\wid, ~widlfo);\n\n//stop\na.release;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `DelTapWr` in SuperCollider briefly."}, {"role": "assistant", "content": "DelTapWr — Write to a buffer for a DelTapRd UGen Write to a buffer for a DelTapRd UGen. Category: UGens > Buffer, UGens > Delays."}]} +{"conversations": [{"role": "user", "content": "What does `PlayerSocket.qwake` do?"}, {"role": "assistant", "content": "a player that can play other players using a cross-faded and fuse-protected socket"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Pseq` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Pseq(#[60, 61, 63, 65, 72], inf).asStream;\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, a.next.midicps]);\n 0.2.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pause`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\nSynthDef(\\a, { Out.ar(0, SinOsc.ar(800, 0, 0.2)) }).add;\n\nSynthDef(\\b, { |gate = 1| Out.ar(1, PinkNoise.ar(0.3)); Pause.kr(gate, 1001) }).add;\n\ns.sendMsg(\\s_new, \\a, 1001, 0, 0);\n\ns.sendMsg(\\s_new, \\b, 1002, 0, 0);\n\ns.sendMsg(\\n_set, 1002, \\gate, 0);\n\ns.sendMsg(\\n_set, 1002, \\gate, 1);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Monitor.copy` do?"}, {"role": "assistant", "content": "Return a copy of the receiver, with the same channel setting, but not running. You can run it with the settings by sending it the #-play message, and pass in any modifications you want to"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Crackle`."}, {"role": "assistant", "content": "```supercollider\n{ Crackle.ar(1.95, 0.5) }.play;\n\n// modulate chaos parameter\n{ Crackle.ar(Line.kr(1.0, 2.0, 3), 0.5, 0.5) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for 003_102 (a SuperCollider snippet). Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\nSynthDef('003_102', {|out=0,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y| Out.ar(out, Pan2.ar(Normalizer.ar(( GbmanL.ar( LPF.ar( SyncSaw.ar(p, k, q, h ), FreqShift.ar(d, r, k, y, a ), h, n ), r, l, Blip.ar(r, f, u, i ), h ))*( LFPar.ar(d, x, Saw.ar(w, k, Formant.ar(s, q, d, DelayL.ar(y, 0.5, w, v, i ), e ) ), y ))*( LFCub.ar(q, a, h, g ))*( Gendy1.ar(r, c, r, QuadL.ar(h, o, j, t, t, v, f ), k, p, g, Pulse.ar(g, g, c, s ), PMOsc.ar(f, u, d, t, d, f ), f, LFNoise0.ar(k, l, e ), d ) )))) }).play(args: #[ a, 0.1, b, 0.83039082494709, c, 7.4736936148092, d, 57.834883574831, e, 0.56638920329924, f, 2.7610572022348, g, -0.60208093272399, h, 0.69731527262978, i, 0.97553825378418, j, 0.47619211673737, k, 0.45142233371735, l, 6.5229251440451, m, 0.34238355327673, n, 3.1624102065486, o, 1, p, 1, q, 5.4898714868897, r, 2.7777416341664, s, 10966.099508885, t, 0.15706503391266, u, 3.1945936724559, v, 20000, w, -4.6151277924266, x, 1.4588773159677, y, 0.0012384873762477 ])\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nd = { |freq = 440| SinOsc.ar(LastValue.ar(freq, 20), 0, 0.2) }.play;\n\nd.set(\\freq, 400);\nd.set(\\freq, 200);\nd.set(\\freq, 670);\nd.set(\\freq, 680);\nd.set(\\freq, 695;\nd.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nd = { |freq = 440| SinOsc.ar(LastValue.ar(freq, 20), 0, 0.2) }.play;\n\nd.set(\\freq, 400);\nd.set(\\freq, 200);\nd.set(\\freq, 670);\nd.set(\\freq, 680);\nd.set(\\freq, 695);\nd.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `SharedOut` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\n// only works with the internal server\ns = Server.internal;\ns.boot;\n);\n\n(\nSynthDef(\"help-SharedOut\", {\n SharedOut.kr(0, SinOsc.kr(0.2));\n}).add;\n);\n\n(\ns.sendMsg(\\s_new, \"help-SharedOut\", x = s.nextNodeID, 0, 1);\ns.sendMsg(\\n_trace, x);\n\n// poll the shared control bus\nRoutine({\n 30.do({\n s.getSharedControl(0).postln;\n 0.2.wait;\n });\n}).play;\n);\n\n\ns.quit;\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LinCongL`."}, {"role": "assistant", "content": "```supercollider\n// randomly modulate params\n(\n{ LinCongL.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(0.1, 0.5, 1.4),\n LFNoise2.kr(0.1, 0.1, 0.1),\n LFNoise2.kr(0.1)\n) * 0.2 }.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Fb1_ODEdef.reset` do?"}, {"role": "assistant", "content": "Removes all Fb1_ODEdefs other than the predefined ones from the"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `EnvGen`."}, {"role": "assistant", "content": "```supercollider\n// as amplitude envelope\n(\n{\n var env = Env([0, 1, 0.5, 1, 0], [0.01, 0.5, 0.02, 0.5]);\n SinOsc.ar(470) * EnvGen.kr(env, doneAction: Done.freeSelf)\n}.play\n);\n\n// as amplitude and modulation envelope\n(\n{\n var env = Env([0, 1, 0.5, 0.8, 0, 1.2, 0], [0.01, 0.5, 0.02, 0.5, 0.2, 0.5]);\n var gate = Impulse.kr(MouseX.kr(0.2, 3), 0.5);\n var gen = EnvGen.kr(env, gate);\n SinOsc.ar(270, SinOsc.ar(gen * 473)) * gen * 0.2\n}.play\n);\n// EnvGen multichannel expands when passed a multichannel envelope\n(\n{\n SinOsc.ar(\n EnvGen.kr(\n Env.circle([0, 1, 0, (2..4), 0, LFNoise1.kr(0.1 ! 5) * 10, 0], [0.01, 0.6])\n )\n * 240 + 300\n ).sum * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// only works with the internal server\ns = Server.internal;\ns.boot;\n);\n\n(\nSynthDef(\"help-SharedIn1\", {\n Out.ar(0, SinOsc.ar(Lag.kr(SharedIn.kr(0, 1), 0.01), 0, 0.2));\n}).add;\nSynthDef(\"help-SharedIn2\", {\n Out.ar(1, SinOsc.ar(Lag.kr(SharedIn.kr(0, 1), 0.01, 1.5), 0, 0.2));\n}).add;\n);\n\n(\ns.setSharedControl(0, 300); // an initial value\ns.sendMsg(\\s_new, \"help-SharedIn1\", x = s.nextNodeID, 0, 1);\ns\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// only works with the internal server\ns = Server.internal;\ns.boot;\n);\n\n(\nSynthDef(\"help-SharedIn1\", {\n Out.ar(0, SinOsc.ar(Lag.kr(SharedIn.kr(0, 1), 0.01), 0, 0.2));\n}).add;\nSynthDef(\"help-SharedIn2\", {\n Out.ar(1, SinOsc.ar(Lag.kr(SharedIn.kr(0, 1), 0.01, 1.5), 0, 0.2));\n}).add;\n);\n\n(\ns.setSharedControl(0, 300); // an initial value\ns.sendMsg(\\s_new, \"help-SharedIn1\", x = s.nextNodeID, 0, 1);\ns.sendMsg(\\s_new, \"help-SharedIn2\", y = s.nextNodeID, 0, 1);\n\nRoutine({\n 30.do({\n s.setSharedControl(0, 300 * (10.rand + 1));\n 0.2.wait;\n });\n s.sendMsg(\\n_free, x);\n s.sendMsg(\\n_free, y);\n}).play;\n);\n\n\ns.quit;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `EnvelopeView.step` do? What arguments does it take?"}, {"role": "assistant", "content": "Makes the nodes snap (i.e. quantized) to the nearest multiple of the argument. Unless this is larger than 0, nodes will not be movable using Arguments: A Float.."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `FBSineN`."}, {"role": "assistant", "content": "```supercollider\n// default initial params\n{ FBSineN.ar(SampleRate.ir/4) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `TreeView.onItemChanged` do?"}, {"role": "assistant", "content": "The object to be evaluated whenever the current item changes, passing this view as the"}]} +{"conversations": [{"role": "user", "content": "What is the difference between a Synth and a SynthDef?"}, {"role": "assistant", "content": "A SynthDef is a definition: a compiled UGen graph with named controls, registered on the server once. A Synth is one running instance of that definition. You create the definition with `SynthDef(\\bell, { |freq = 440| ... }).add` and then instances with `Synth(\\bell, [\\freq, 660])`. Defining the same SynthDef twice replaces it for future instances; already running Synths keep the old graph until they are freed."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Saw` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\event_set, { |freq = 440, gate = 1, amp = 0.1, lagTime = 0.1,\n ffreq = 2000, detune = 1.005, out = 0|\n var sig = Saw.ar(Lag.kr(freq, lagTime) * [1, detune]).sum * amp\n * EnvGen.kr(Env.adsr, gate, doneAction: Done.freeSelf);\n Out.ar(out, sig ! 2);\n}).add;\n);\n\na = Synth(\\event_set);\n\n(\np = Pbind(\n \\type, \\set,\n \\id, a,\n \\instrument, \\event_set,\n \\args, #[],\n \\freq, Pexprand(200, 600, inf),\n \\dur, Pwhite(1, 5, inf) * 0.125\n).play;\n);\n\np.stop;\na.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nNdef(\\x, { Saw.ar(110) * 0.1 }).play;\nNdef(\\x)[1] = \\filter -> { |in| RLPF.ar(in, 800, 0.4) };\n```"}, {"role": "assistant", "content": "Two nodes in one named proxy: a saw source, then a resonant low-pass filter fed by it.\n\n`Ndef(\\x, { ... })` defines the first node of the chain and `.play` starts it. `Ndef(\\x)[1] = \\filter ->`\ninserts a second node at index 1; the `\\filter` key says 'make this node an effect that receives the\nprevious node's output as `in`'. So the patch is `Saw -> RLPF -> out`. Because it is an Ndef, calling\n`Ndef(\\x, { ... })` again replaces the source with a crossfade instead of restarting, and\n`Ndef(\\x).stop` removes the whole chain."}]} +{"conversations": [{"role": "user", "content": "What does `WAmp.kr` do? What arguments does it take?"}, {"role": "assistant", "content": "windowed amplitude follower Arguments: in — Signal input.; winSize — The window size in seconds. Not modulatable.."}]} +{"conversations": [{"role": "user", "content": "What does `AbstractPlayer.load` do? What arguments does it take?"}, {"role": "assistant", "content": "the base class for all Players : a playable object Arguments: obj; warnIfNotFound."}]} +{"conversations": [{"role": "user", "content": "What does `Pdef.set` do?"}, {"role": "assistant", "content": "Set arguments in the default event. If there is none, it is created and the pattern is"}]} +{"conversations": [{"role": "user", "content": "Can you listen to the sound you generate?"}, {"role": "assistant", "content": "No. I am 198M parameters trained on SuperCollider's documentation and class library; I have no audio input and no way to hear a result. What I can do is reason about the code: whether it reaches an output bus, whether the envelope will ever open, whether a filter at that cutoff leaves anything audible. Treat my patches as a starting point you listen to, not as a judgement about how they sound."}]} +{"conversations": [{"role": "user", "content": "What does `List.pop` do?"}, {"role": "assistant", "content": "Remove and return the last element of the"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LPZ2`."}, {"role": "assistant", "content": "```supercollider\n// Compare:\n\n{ WhiteNoise.ar(0.25) }.play;\n\n{ LPZ2.ar(WhiteNoise.ar(0.25)) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n//Chaos engine hum\n(\n{\n SinOsc.ar(10 + (50 * SinOsc.kr([50, 51], 0, SinOsc.kr(101, Saw.kr(0.12345, 678, 9), 0.2, 0.8), Pulse.kr([25, 25.5], 0.25, 0.125, -0.25))), 0, 0.5, 0);\n}.play();\n)\n```"}, {"role": "assistant", "content": "A deep binaural cycle reminiscent of the engine of a space ship."}]} +{"conversations": [{"role": "user", "content": "What does `Integer.nthPrime` do?"}, {"role": "assistant", "content": "32-bit Integer number Returns: the nth prime number. The receiver must be from 0 to 6541."}]} +{"conversations": [{"role": "user", "content": "What does `LeastChange.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Output least changed Arguments: a — Input signal A.; b — Input signal B.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// fadeTimes should be above blockSize\n// for shorter grains you can use smaller blocksizes\n\n(\ns.options.blockSize = 2;\ns.reboot;\n);\n\n// as the effect is AM on single outs we get side bands\n\n(\ns.doWhenBooted {\n x = {\n var lfo = LFDNoise3.ar(0.2);\n DXFan.ar(\n Dseq((0..7), inf),\n SinOsc.ar(lfo.range(800, 1500), 0, 0.03),\n size: 8,\n fadeTime: 0.0002\n )\n }.play\n};\n);\n\nx.release\n\n\n// go back to default\n\n(\ns.options.blockSize = 64;\ns.reboot;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// fadeTimes should be above blockSize\n// for shorter grains you can use smaller blocksizes\n\n(\ns.options.blockSize = 2;\ns.reboot;\n);\n\n// as the effect is AM on single outs we get side bands\n\n(\ns.doWhenBooted {\n x = {\n var lfo = LFDNoise3.ar(0.2);\n DXFan.ar(\n Dseq((0..7), inf),\n SinOsc.ar(lfo.range(800, 1500), 0, 0.03),\n size: 8,\n fadeTime: 0.0002\n )\n }.play\n};\n);\n\nx.release\n\n\n// go back to default\n\n(\ns.options.blockSize = 64;\ns.reboot;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is the difference between a Synth and a SynthDef?"}, {"role": "assistant", "content": "A SynthDef is a definition: a compiled UGen graph with named controls, registered on the server once. A Synth is one running instance of that definition. You create the definition with `SynthDef(\\bell, { |freq = 440| ... }).add` and then instances with `Synth(\\bell, [\\freq, 660])`. Defining the same SynthDef twice replaces it for future instances; already running Synths keep the old graph until they are freed."}]} +{"conversations": [{"role": "user", "content": "I get 'Message not understood' on a nil variable."}, {"role": "assistant", "content": "`~buffer` (or any variable) was never assigned, or it was assigned in a different environment. Environment variables are per-environment: a `~buf` set in one server-side file block is not visible in another. Check with `~buf.postln` before using it. The other common cause is an assignment that failed silently, e.g. `~buf = Buffer.read(...)` where the file was missing — the error is posted but ~buf stays nil."}]} +{"conversations": [{"role": "user", "content": "What does `Sieve.sect_o` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new Sieve object in mode 'points' with offsets, generated by the intersection of sets of Arguments: ... data — Alternating generators and integer offsets plus an optional integer limit, wrapped into a Ref, which is included when reached. Allowed generators: Integers, Streams or Patterns producing intervals or Sieves itself. Integers and Stream/Pattern output must be strictly positive. Integers as generators ."}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for seeking an Array!: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(// * //watch the postWindow\na=[\"m\",\"x\",\"f\",\"k\",\"d\",\"p\"];\nx=Array;\ny=x.newClear(6);\n~mxfkdp=Task({\n inf.do({y.put(x.series(6,0,1).choose,a.scramble).postln;\n 0.03.wait;})}).play;\nm=fork({inf.do({\n \"array num:\".postcln;\n if(y[x.series(6,0,1).choose.postcln]==a,\n {\"lo encontraste!/found it!\".postcln;\n 1.do({GVerb.ar(\n EnvGen.ar(Env.perc(0.01,8),1,doneAction:2)*\n Blip.ar(XLine.kr(440,1600,8)),50,10,0.02)}.play);\n ~mxfkdp.stop;\n m.stop;}, \n {\"buscando.../seeking...\".postcln;});\n 0.03.wait})});\n);\n//.SCtweetLong\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n//Should really only do this in NRT, but does work if low load in RT \n(\na = {\n \n~featuresave = FeatureSave.kr(SinOsc.kr,Impulse.kr(10)-0.5); \n \n}.play \n);\n\ns.sendMsg(\"/u_cmd\", a.nodeID, ~featuresave.synthIndex, \"createfile\", \"testfile2.data\")\n\ns.sendMsg(\"/u_cmd\", a.nodeID, ~featuresave.synthIndex, \"closefile\"\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n//Should really only do this in NRT, but does work if low load in RT \n(\na = {\n \n~featuresave = FeatureSave.kr(SinOsc.kr,Impulse.kr(10)-0.5); \n \n}.play \n);\n\ns.sendMsg(\"/u_cmd\", a.nodeID, ~featuresave.synthIndex, \"createfile\", \"testfile2.data\")\n\ns.sendMsg(\"/u_cmd\", a.nodeID, ~featuresave.synthIndex, \"closefile\")\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{Disintegrator.ar(SinOsc.ar([400, 404], 0, 0.2), MouseX.kr(0, 1), MouseY.kr(0, 1))}.play\n\n{Disintegrator.ar(SoundIn.ar, MouseX.kr(0, 44100), MouseY.kr(0, 1)}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{Disintegrator.ar(SinOsc.ar([400, 404], 0, 0.2), MouseX.kr(0, 1), MouseY.kr(0, 1))}.play\n\n{Disintegrator.ar(SoundIn.ar, MouseX.kr(0, 44100), MouseY.kr(0, 1))}.play\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nPdef(\\zed, \n Pbind(\n \\osc, Pseq([SinOsc, LFSaw],inf),\n \\instrument, Prout({ arg ev;\n SynthDef(\\zed, { arg out=0, gate=1, amp=0.1, pan=0, freq=200;\n var sig;\n sig = ev[\\osc].ar(freq);\n sig = sig * EnvGen.kr(\\adsr.kr(Env.adsr(0.1,0.1,0.8,0.1)), gate, doneAction:2);\n sig = Pan2.ar(sig, pan, amp);\n Out.ar(out, sig);\n }).add.yield;\n }).loop,\n \\degree, Pseq([0],inf),\n \\dur, 1,\n \\amp, 0.1,\n )\n).play;\n);\n```"}, {"role": "assistant", "content": "synthdef building should take less time than s.latency for this to work."}]} +{"conversations": [{"role": "user", "content": "What does `PLbindefParEnvironment.at` do?"}, {"role": "assistant", "content": "For Integers it works as IdentityDictionary#-at, for SequenceableCollections of Integers it enables setting and getting as well as playing, stopping, resetting and clearing of sources of corresponding PLbindefs by using a TempPLbindefParEnvironment (see PLbindefPar#Ex. 1#Ex.1 in PLbindefPar's"}]} {"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n/* Audio plugin definition\n\n Each audio plugin should define the following global variables:\n ~name: (symbol) name of the spatializer\n ~description: (string) a short description\n ~function: the actual definition of the plugin\n\n*/\n\n~name = \\Limiter;\n~description = \"A simple limiter\";\n~channelLayout = \\mono;\n\n~function = { arg in, level=0.7, dur=0.01, outputDB=0;\n outputDB.dbamp * Limiter.ar(In.ar(in), level, dur);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// given a UGen graph:\n(\n{\nSplay.ar(SinOsc.ar({ exprand(300.0, 10000.0) } ! 17, 0, { 1.0.rand } ! 17)) * 0.1 \n}.play\n);\n\n// É all existing UGen inputs can be replaced or modified with an arbitrary function (here with a modulator)\n(\n{\nBend({ |in|\n in * LFDNoise3.kr(MouseX.kr(0.1, 200, 1), 0.1, 1)\n}, {\n Splay.ar(SinOsc.ar({ exprand(300.0, 10000.0) } ! 17, 0, { 1.0.rand } ! 17))\n \n}) * 0.1\n}.play\n)\n```"}, {"role": "assistant", "content": "given a UGen graph: É all existing UGen inputs can be replaced or modified with an arbitrary function (here with a modulator) (Bend: UGen wrapper for code bending)"}]} -{"conversations": [{"role": "user", "content": "I get 'syntax error, unexpected NAME' on a block that looks fine."}, {"role": "assistant", "content": "Almost always a missing semicolon between two statements — SuperCollider does not insert them.\n\n```supercollider\n// broken: two statements, no separator\n{ var sig = SinOsc.ar(440) sig = sig * 0.1; sig }.play\n```\n\n```supercollider\n// fixed\n{ var sig = SinOsc.ar(440); sig = sig * 0.1; sig }.play\n```\nThe error points at the second statement, not at the missing semicolon before it, which is why it looks\nfine. If it is not a semicolon, count the brackets: `.ar(` open, `)` closed."}]} -{"conversations": [{"role": "user", "content": "What does `ServerLogGui.guiMixedBundle` do? What arguments does it take?"}, {"role": "assistant", "content": "the interface for display and searching the ServerLog Arguments: mb. Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Gates (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\plop).put(0, { arg freq=200, rq=0.1, pan=0, amp=0.1;\n var sig;\n var sig1, sig2, sig3, sig4, sig5, sig6, sig7, sig8;\n sig1 = WhiteNoise.ar(1, 0);\n sig2 = LPF.ar(WhiteNoise.ar(1, 0), SinOsc.kr(1/16 * [1,2,3,4]/2).range(100,9001));\n sig3 = LFSaw.ar(( freq* [1/2,1,2,1] ).clip(20,15000)) * [1,4,1/2,2];\n sig1 = SelectX.ar(\\mixg.kr(0.5)*2, [sig1, sig2, sig3]);\n sig = Gate.ar(sig1, LFPulse.ar( SinOsc.kr(1/8 * [1,2,3,4].reverse/2).range(30,100), 0.5));\n sig = Gate.ar(sig, LFPulse.ar( freq ));\n sig = RLPF.ar(sig, ( freq * SinOsc.kr([1,2,3,4]/4).range(1,4) ).clip(20,15000), rq * [1,2,3,4]);\n sig1 = LFPulse.ar(freq * [1,1/2]) * [1,1/2];\n sig = SelectX.ar(\\mix.kr(0.8)*2, [sig, sig1 * sig, sig1]);\n sig1 = BPF.ar(sig, ( freq*2 ).clip(20,15000), rq) * 5;\n sig2 = BPF.ar(sig, freq, rq) * 5;\n sig3 = BPF.ar(sig, freq/2, rq) * 5;\n sig = SelectX.ar(\\mix2.kr(0.6) * 3, [sig, sig1, sig2, sig3]);\n sig = Pan2.ar(sig, LFNoise1.kr(1/2 * [1,2,3,4]).range(-1.0,1.0) * 0.3, amp).mean;\n}).play;\n\nSpec.add(\\mix, \\unipolar);\nSpec.add(\\mix2, \\unipolar);\nSpec.add(\\mixg, \\unipolar);\n);\n\nNdef(\\plop).edit;\n\nNdef(\\plop).unset(\\freq);\n\n(\n Ndef(\\plop).put(1, \\set -> Pbind(\n \\degree, Pseq([\n 0,3,2,3,\n 4,2,2,3,\n ],inf),\n \\octave, 4,\n \\dur, Pseq([1,2,4,1],inf)/4,\n )\n);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `SCViewHolder` in SuperCollider?"}, {"role": "assistant", "content": "SCViewHolder — Instead of subclassing a (Q/SC)View, this is a proxy/adapter object that holds the View When writing gui widgets it is sometimes not desirable to subclass a view class. Its preferable to write a class that acts like a View and is used where Views normally are used but isn't a direct subclass of a View class. Category: GUI."}]} -{"conversations": [{"role": "user", "content": "Explain `KrNumberEditorGui` in SuperCollider briefly."}, {"role": "assistant", "content": "KrNumberEditorGui — gui class Category: Libraries > crucial > GuiClasses."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `In`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-InKr\", { |out = 0, in = 0|\n Out.ar(out,\n SinOsc.ar(In.kr(in, 1), 0, 0.1)\n )\n}).add;\nSynthDef(\"help-lfo\", { |out = 0|\n Out.kr(out, LFNoise1.kr(0.3, 200, 800))\n}).add;\n);\n\n\nb = Bus.control(s, 1);\nb.set(800);\n\nSynth(\"help-InKr\", [\\in, b.index]);\nb.set(400);\nb.set(300);\nSynth(\"help-lfo\", [\\out, b.index]);\n```"}]} -{"conversations": [{"role": "user", "content": "Do is not ¨returning¨ array (campanology)?"}, {"role": "assistant", "content": "SuperCollider forum — Do is not ̈returning ̈ array (campanology)\n\nYou can remove the need for all mutable variables by computing the indexes to swap first - these are stored in indexesEven and indexesOdd.\n\nThen an array of functions is made (swappers)...i.e.[indexesEven, indexesOdd, indexesEven....]\n\nFinally, .inject is used to chain these together, taking the previous result as the input to the next and building an array.\n\n```supercollider\n(\n~swap_sort_steps = {\n |parts|\n var swapConsequtiveIndexes = {|from, to|\n (from..to).clump(2).collect{|p| p.reverse }.flat\n };\n var indexesEven = swapConsequtiveIndexes.(0, parts - 1);\n var indexesOdd = [0] ++ swapConsequtiveIndexes.(1, parts - 1);\n var swappers = parts.collect{ |n|\n {|toSwap| if(n.even)\n { indexesEven.collect{|i| toSwap[i]} }\n { indexesOdd.collect{|i| toSwap[i]} }\n }\n };\n postf(\"indexesEven : %\\nindexesOdd : %\\n\", indexesEven, indexesOdd);\n swappers.inject( [(0..parts-1)], {\n |col, f|\n col ++ [f.(col.last)]\n });\n};\n)\n```\n\nAlso, as I’m sure you know, if anyone else is reading who doesn’t know what this is... its a swap sort algorithm."}]} -{"conversations": [{"role": "user", "content": "What does `U.controlOuts` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: unit — (describe argument here). Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "What does `NodeProxy.edit` do?"}, {"role": "assistant", "content": "Returns a new instance of NodeProxyEditor for this proxy. `a ="}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Now you're going to die (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\fall, { arg freq=200, pan=0, amp=0.1;\n var sig;\n sig = ( WhiteNoise.ar + 0.8 ) * LFSaw.ar({ exprand(10.0,10000) }!20 * ( 1 + ( SinOsc.ar((1..4).rand(0.0)/18 * XLine.kr(1,121200,80)) * 1/41 * XLine.kr(1,180,60) )));\n sig = DelayC.ar(sig, 0.2, {rrand(1/5,1/10000) * ( 1 + ( SinOsc.ar((1..2).rand(0.0)/18 * XLine.kr(1,121200,60)) * 1/41 * XLine.kr(1,180,60) ))}!4) + sig / 2;\n sig = DelayC.ar(sig, 0.2, {rrand(1/5,1/10000) * XLine.kr(1,1/1000,14)}!4) + sig / 2;\n sig = sig + BPF.ar(\n sig, \n { ( exprand(100.0,10000) * LFNoise1.ar(1/100.0.rand).range(1,2) ).clip(20,20000) }!10,\n { ( rand(0.01,1) * LFNoise1.ar(1/100.0.rand).range(1,2) ).clip(0.01,1) }!10\n );\n sig = BRF.ar(\n sig, \n { ( exprand(100.0,10000) * LFNoise1.ar(1/100.0.rand).range(1,2) ).clip(20,20000) }!10,\n { ( rand(0.01,1) * LFNoise1.ar(1/100.0.rand).range(1,2) ).clip(0.01,1) }!10\n );\n sig = LeakDC.ar(sig);\n sig = LPF.ar(sig, 17000 * XLine.kr(1/100,1,4));\n sig = sig * 5 * 3;\n sig = sig.mean;\n sig = sig * amp;\n sig;\n}).play;\n);\n```"}]} -{"conversations": [{"role": "user", "content": "In what order should I learn SuperCollider?"}, {"role": "assistant", "content": "The order that pays off fastest:\n\n1. **One UGen and Out** — `{ SinOsc.ar(440) * 0.2 }.play`. Learn that a graph must reach Out.\n2. **Envelopes and doneAction** — the difference between a sound and a click.\n3. **SynthDef and Synth** — naming a graph, controlling it with arguments, freeing it with a gate.\n4. **Patterns** — `Pbind` for sequence, so you stop writing loops by hand.\n5. **Buses and effects** — chaining, sends, groups.\n6. **JITLib** — Ndef for patches you modify while they play.\n\nVocabulary to carry: UGen, SynthDef, Synth, bus, group, envelope, gate, doneAction, Pattern, clock. Every\nconfusion in SuperCollider tends to be one of those words."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes From a while ago."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var t, grav, sf, chain, sig;\n sf = LFPulse.ar(0.5);\n grav = LFNoise2.ar(1).range(0.1, 0.7);\n t = TBall.ar(sf, grav, 0.01, 0.0001) * 10;\n \n chain = FFT(LocalBuf(1024), t);\n chain = chain.pvcalc(1024, {|mags, phases|\n [phases, mags];\n });\n chain = PV_BrickWall(chain, LFNoise2.kr(1).range(-1, 0.5));\n chain = PV_RandComb(chain, LFNoise2.kr(1).range(0, 1), Dust.kr(20));\n sig = IFFT(chain);\n \n sig = sig ! 2;\n sig = sig + AllpassC.ar([sig[1], sig[0]], 0.1, {LFNoise2.kr(0.5).range(0.01, 0.1)} ! 2, 2);\n sig = sig + AllpassC.ar(sig, 0.1, {LFNoise2.kr(0.1).range(0.01, 0.1)} ! 2, 1);\n \n sig = LPF.ar(sig, 15000) + LPF.ar([sig[1], sig[0]], 500, 5) + LPF.ar(sig, 200, 10);\n sig = sig * 10;\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Why does every UGen have mul and add arguments?"}, {"role": "assistant", "content": "They are a convenience applied to the UGen's output: the result is `ugens_result * mul + add`. So `SinOsc.ar(440, 0, 0.2)` is the same as `SinOsc.ar(440) * 0.2`, and `SinOsc.ar(440, 0, 0.5, 1800)` is usable directly as a frequency. They exist because multiplying and offsetting is so common that folding it into the UGen saves a node in the graph and a line in the source."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\nn = NetAddr(\"localhost\", 12345);\nn = s.addr;\n\n// Example sending symbols, integers, and a float\nn.sendMsg('/s_new', \\default, 2000, 0, s.defaultGroup.nodeID, \\freq, 60.midicps);\n\n// The initial forward slash can be omitted\nn.sendMsg(\\n_set, 2000, \\gate, 0);\n\n// Using the performList syntax, you can use an array to store an OSC message\n~msg = [\\n_set, 2000, \\gate, 0];\nn.sendMsg(*~msg);\n```"}, {"role": "assistant", "content": "Example sending symbols, integers, and a float The initial forward slash can be omitted (NetAddr: network address)"}]} -{"conversations": [{"role": "user", "content": "What does `History.startTimeStamp` do?"}, {"role": "assistant", "content": "keeps a history of interpreted lines of code"}]} -{"conversations": [{"role": "user", "content": "What does `EZText.value` do? What arguments does it take?"}, {"role": "assistant", "content": "Gets/sets the value of the ezText. Does not perform the Arguments: inval — Any object.."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Pan Sonic emulation - Katodivaihe - lahetys?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a, b, c, d, n, e, f, out;\n\n a = Impulse.ar(8)*1.5;\n\n b = WhiteNoise.ar * Env([1.0,1.0,0.0],[0.01,0.01],\\step).ar(0, Impulse.ar(1 )) ;\n b = FreeVerb.ar(b, 0.5, 0.4)*2.5;\n\n c = SinOsc.ar(40) * Env.perc(0.01,0.2).ar(0, TDuty.ar(Dseq([1/4,1/2,1/8,1/8],inf)));\n 5.do{ c = (c.distort + c)*0.75};\n c = c * 1.5;\n\n d = LPF.ar(Saw.ar([20,47]).sum , XLine.ar(4000,200,0.5)) * Env.perc.ar(0, Impulse.ar(1/16)) * 0.5;\n d = (GVerb.ar( d , roomsize:10, revtime:6) * 200).clip(-1.0,1.0) * 0.3;\n\n n = 12;\n e = ( Saw.ar( 40*(1..n) * ({ LFNoise1.ar(0.1).range(1,1.01) } ! n) ) *\n ({ LFNoise1.ar(0.1).range(0.0,1.0) }!n)).sum * 10;\n e = CombC.ar(e, 0.1, 0.1, 4) + e;\n e = e.tanh * 0.3 * SinOsc.ar(0.05).range(0.5,1.0);\n e = e.dup;\n e = e * SinOsc.ar(0.03).range(0.2,1.0) * 0.5;\n\n f = Blip.ar(100) * Blip.ar(100) * Env([0.0,0.0,1.0],[8,8],[\\step,\\linear,\\step])\n .ar(0, Impulse.ar(1/16)) * 2 ;\n\n out = ((a + b + c + f) ! 2) + d + e;\n out = out * 0.2\n\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nx = SynthDef(\\vowel, {|freq = 420|\n Out.ar(0, \n Formants.ar(freq.lag(0.1), Vowel(\\a).addControls(lag: 1)) * 0.01\n )\n}).play\n);\n \nx.setn(*([\\freq, exprand(100, 1000)] ++ Vowel(\\u, \\soprano).asKeyValuePairs));\nx.setn(*([\\freq, exprand(100, 500)] ++ Vowel(\\e, \\bass).asKeyValuePairs));\nx.setn(*([\\freq, exprand(400, 1000)] ++ Vowel(\\a, \\soprano).asKeyValuePairs);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nx = SynthDef(\\vowel, {|freq = 420|\n Out.ar(0, \n Formants.ar(freq.lag(0.1), Vowel(\\a).addControls(lag: 1)) * 0.01\n )\n}).play\n);\n \nx.setn(*([\\freq, exprand(100, 1000)] ++ Vowel(\\u, \\soprano).asKeyValuePairs));\nx.setn(*([\\freq, exprand(100, 500)] ++ Vowel(\\e, \\bass).asKeyValuePairs));\nx.setn(*([\\freq, exprand(400, 1000)] ++ Vowel(\\a, \\soprano).asKeyValuePairs));\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nv = Vowel()\nv.addFormants([3000,4000], -6, [200, 200])\n\n{Formants.ar(100, v) * 0.1 }.play\n{Formants.ar(100, Vowel()) * 0.1}.play\n \n{[Formants.ar(100, Vowel()) * 0.1, Formants.ar(100, v) * 0.1 ]}.play\n\nv.removeFormants([5,6]\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nv = Vowel()\nv.addFormants([3000,4000], -6, [200, 200])\n\n{Formants.ar(100, v) * 0.1 }.play\n{Formants.ar(100, Vowel()) * 0.1}.play\n \n{[Formants.ar(100, Vowel()) * 0.1, Formants.ar(100, v) * 0.1 ]}.play\n\nv.removeFormants([5,6])\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Recorder`."}, {"role": "assistant", "content": "```supercollider\n(\n{ SinOsc.ar(\n SinOsc.ar(\n XLine.kr(1, 100, 5)).exprange(*XLine.kr([20, 800], [7000, 200], 10)\n )\n ) * 0.1\n\n}.play;\ns.record(duration: 10);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nb = Bus.audio(s, 2);\na = { |inbus = 0|\n var sig = In.ar(inbus, 2);\n // x axis is side, oriented toward right;\n // y axis is mid\n [sig[1] - sig[0], sig.sum]\n}.play(s.defaultGroup, outbus: b, addAction: \\addAfter);\nc = s.scope;\nc.style = 2;\nc.bus = b;\n)\n```"}, {"role": "assistant", "content": "Very quick-and-dirty hack to show stereo phase. Center = up (12:00). Full left = 10:30, full right = 1:30."}]} +{"conversations": [{"role": "user", "content": "Saving \"Presets\"?"}, {"role": "assistant", "content": "SuperCollider forum — Saving \"Presets\"?\n\nIf you don’t care too much about it being human readable, just use writeArchive and readArchive:\n\n```supercollider\na = Array.fill(400, {rrand(0,2200)});\n\na.writeArchive(\"/Users/spluta1/Documents/SC/test\");\n\nb = Object.readArchive(\"/Users/spluta1/Documents/SC/test\");\n\nb.postln;\n```\n\nSam"}]} +{"conversations": [{"role": "user", "content": "What does `SerialPort.put` do? What arguments does it take?"}, {"role": "assistant", "content": "Write a byte to the device. Always Arguments: byte — An Integer or Char. Only values in the range from 0 to `2**databits - 1` may be written. If a value out of that range is passed to `put`, only the lowest bits will be used.; timeout — Unused, deprecated.. Returns: A Boolean indicating whether the write was successful."}]} +{"conversations": [{"role": "user", "content": "What does `USession.prepareAndStart` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: targets — (describe argument here). Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `SelectX` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar(300),\n Pulse.ar(230)\n ];\n\n SelectX.ar(MouseX.kr(0, 1) * a.size, a) * 0.2\n}.play;\n);\n\n(\n{\n var a;\n a = [\n SinOsc.kr(0.25),\n LFSaw.kr(10),\n LFPulse.kr(0.3)\n ];\n\n SinOsc.ar(SelectX.kr(MouseX.kr(0, 1) * a.size, a) * 300 + 400) * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LatoocarfianC`."}, {"role": "assistant", "content": "```supercollider\n// randomly modulate all params\n(\n{ LatoocarfianC.ar(\n SampleRate.ir/4,\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5)\n) * 0.2 }.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `FoaMagIr` in SuperCollider?"}, {"role": "assistant", "content": "FoaMagIr — First Order Ambisonic (FOA) Magnitude of Soundfield Reactive Intensity Vector Return the Magnitude of Reactive Intensity Vector, ||Ir||, of a first order ambisonic (B-format) signal. Category: Libraries > Ambisonic Toolkit > UGens > FOA > Analyzer, UGens > Multichannel > Ambisonics, UGens > Analysis > Ambisonics."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Duty`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// this is useful when two UGens need to be called, but only one of their outputs is needed\n(\n{\n var a, b, c;\n a = Dseq([1, 2, 3, 4], inf).dpoll(\"a\");\n b = Dseq([1955, 1952, 1823, 1452], inf).dpoll(\"b\");\n c = (a a Buffer > Info."}]} +{"conversations": [{"role": "user", "content": "What is rq in BPF.ar?"}, {"role": "assistant", "content": "rq is the reciprocal of Q, so it is a bandwidth control, not a Q control. Small rq means a narrow, resonant band; large rq means a wide, gentle one. The signature is `BPF.ar(in, freq, rq, mul, add)`. A common idiom is `rq = 0.3` for a broad sweep and `rq = 0.02` for a whistle. The same rq convention applies to RLPF and RHPF."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LinRand`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-LinRand\", { |out = 0, minmax = 1|\n Out.ar(out,\n FSinOsc.ar(\n LinRand(200.0, 10000.0, minmax),\n 0, Line.kr(0.2, 0, 0.01, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n// towards hi\n(\nRoutine({\n loop({\n Synth.new(\"help-LinRand\"); 0.04.wait;\n })\n}).play;\n);\n\n// towards lo (doesn't work like that yet)\n(\nRoutine({\n loop({\n Synth.new(\"help-LinRand\", [\\minmax, -1]); 0.04.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ SinOsc.ar(SinOsc.ar(0.3).range(440, 660), 0, 0.5 * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ SinOsc.ar(SinOsc.ar(0.3).range(440, 660), 0, 0.5) * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n//Its not the spline that loops (that would be a loop in 2 dimensional space) but the SplineGen that is set to loop.\n\n// the spline does NOT loop,\nb = BSpline( Array.fill(16,{ arg i; [ i * 0.25,1.0.rand ] }), 3.0,false );\n\nb.gui(nil,1200@300);\n\n\n);\n(\n// the SplineGen loops\n{\n Saw.ar(SplineGen(b,loop:true).kr.linexp(0.0,1.0,40,500).clip(40,500)).dup * 0.4\n}.play\n)\n```"}, {"role": "assistant", "content": "Its not the spline that loops (that would be a loop in 2 dimensional space) but the SplineGen that is set to loop. the spline does NOT loop, (SplineGen: Like EnvGen but for Splines)"}]} +{"conversations": [{"role": "user", "content": "What does `PathName.fileName` do?"}, {"role": "assistant", "content": "returns just the name of the file itself; i.e. everything after the last slash in the full path."}]} +{"conversations": [{"role": "user", "content": "Write a warm pad in SuperCollider."}, {"role": "assistant", "content": "Detuned saws through a slow filter envelope and a long release: the detune is what makes it wide.\n\n```supercollider\n(\nSynthDef(\\pad, { |out = 0, freq = 220, amp = 0.15, gate = 1|\n var detune = [-0.06, -0.02, 0.02, 0.06];\n var sig = Mix(Saw.ar(freq * (1 + detune))) * 0.25;\n var env = EnvGen.kr(Env.adsr(1.2, 0.5, 0.7, 3), gate, doneAction: 2);\n var cutoff = SinOsc.kr(0.05).exprange(300, 2000);\n sig = RLPF.ar(sig, cutoff, 0.4);\n Out.ar(out, Splay.ar([sig, DelayN.ar(sig, 0.02, 0.012)]) * env * amp);\n}).add;\n);\n~pad = Synth(\\pad, [\\freq, 165]);\n~pad.set(\\gate, 0);\n```\n`gate` is what makes a sustained sound controllable: `\\gate, 0` releases it and `doneAction: 2` then\nfrees the Synth."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `FoldIndex`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// indexing into a table\n(\n{\n var buf = LocalBuf.newFrom([200, 300, 400, 500, 600, 800]);\n var freq = FoldIndex.kr(buf, MouseX.kr(0, BufFrames.ir(buf) * 3));\n SinOsc.ar(freq) * 0.1\n}.play;\n);\n\n// the same using a global buffer\n(\nt = [200, 300, 400, 500, 600, 800];\nb = Buffer(s, t.size, 1);\n\n// alloc and set the values\ns.listSendMsg(b.allocMsg(b.setnMsg(0, t)).postln);\n\nSynthDef(\\help_Index, { |out = 0, bufnum = 0|\n Out.ar(out,\n SinOsc.ar(\n FoldIndex.kr(\n bufnum,\n MouseX.kr(0, BufFrames.ir(bufnum) * 3)\n ),\n 0,\n 0.5\n )\n )\n}).play(s, [\\bufnum, b.bufnum]);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Routine` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// SynthDefs on the fly\ns.boot;\n(\nt = TempoClock.new;\nr = Routine.new({\n 10.do({\n // could be done with an argument instead of a new def, but proves the point\n SynthDef(\"help-EnvGen\" ++ i, { arg out = 0;\n Out.ar(\n out,\n EnvGen.kr(Env.perc, 1.0, doneAction: Done.freeSelf)\n * SinOsc.ar(100 + (100 * t.elapsedBeats), 0, 0.1)\n )\n }).play(s);\n 1.yield;\n });\n}).play(t); // Note the alternative syntax: Routine.play(aClock)\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `TempoGui` in SuperCollider briefly."}, {"role": "assistant", "content": "TempoGui — gui class a slider and number box to control the current Tempo in bpm Category: Libraries > crucial > GuiClasses."}]} +{"conversations": [{"role": "user", "content": "What is `LTI` in SuperCollider?"}, {"role": "assistant", "content": "LTI — Linear Time Invariant General Filter Equation General Linear Time-Invariant (LTI) filter UGen where you specify any coefficient set via a Buffer Represents the general LTI filter difference equation in the time domain: Category: UGens > Filters."}]} +{"conversations": [{"role": "user", "content": "What does `Editor.makePatchOut` do?"}, {"role": "assistant", "content": "holds a value that can be edited with a GUI, saves as the value"}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ LPF.ar(Saw.ar(100), SinOsc.kr(0.5).exprange(200, 2000)) * 0.2 }.play;\n```"}, {"role": "assistant", "content": "A sawtooth through a low-pass filter whose cutoff is swept slowly up and down — a classic filter\nsweep.\n\n- `Saw.ar(100)` is a 100 Hz sawtooth, rich in harmonics.\n- `SinOsc.kr(0.5)` is a control-rate sine at 0.5 Hz, so one full cycle takes 2 seconds.\n- `.exprange(200, 2000)` maps that -1..1 sine exponentially onto 200..2000 Hz — exponential is the right\n mapping for frequency, because we hear pitch logarithmically.\n- `LPF.ar(sig, cutoff)` removes harmonics above the cutoff; as it opens and closes you hear the tone\n brighten and darken.\n- `* 0.2` keeps the output from clipping."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// Now to demonstrate language-side classification, we'll iterate over a grid and classify:\n(\n(0, 0.1 .. 1).collect{|y|\n(0, 0.1 .. 1).collect{|x|\nPlaneTree.classify([x,y], ~treedata)\n}\n}.do(_.postln);\"\"\n);\n\n// Server-side: run this then move the mouse left/right/up/down - classification should follow same pattern.\ns.boot;\n~treebuf = Buffer.loadCollection(s, ~treedata.flat, ~treedata[0].size);\n(\nx = {\nPlaneTree.kr(~treebuf, [MouseX.kr(0,1), MouseY.kr(0,1)]).poll\n// …\n```"}, {"role": "assistant", "content": "Now to demonstrate language-side classification, we'll iterate over a grid and classify: Server-side: run this then move the mouse left/right/up/down - classification should follow same pattern. (PlaneTree: Tree classifier using (hyper)planes – UGen or language-side)"}]} +{"conversations": [{"role": "user", "content": "What is `IIRFilter` in SuperCollider?"}, {"role": "assistant", "content": "IIRFilter — 24db/oct rolloff, 4nd order resonant Low Pass Filter BlackRain. Category: UGens > Filters."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// where did I leave my keys?\n(\nvar n = 30, m = 5;\nNdef.clear(3);\nNdef.ar(\\x, n);\nNdef(\\y, { Splay.ar(Ndef.ar(\\x, m, LFNoise1.kr(1/m).range(0, n - m - 1))).clip2 * 0.5 }).play; \nNdef(\\x, { \n { \n var a = Ndef.ar(\\x, 1, LFNoise0.kr(Rand()) * Rand() + Rand() * n);\n a + 0.1 * SinOsc.ar(ExpRand(0.2, 1000)) \n } ! n\n}); \n);\n\n// where did I put my keys?\n(\nvar n = 30, m = 5;\nNdef.clear(3);\nNdef.ar(\\x, n);\nNdef(\\y, { Splay.ar(Ndef.ar(\\x, m, LFNoise1.kr(1/m).range(0, n - m - 1))).clip2 * 0.5 }).play; \nNdef(\\x, { \n {\n var a = Ndef.ar(\\x, 1, LFNoise0.kr(Rand()) * Rand() + Rand() * n);\n SinOsc.ar(ExpRand(0.2, 1000), a) \n } ! n\n}); \n)\n```"}, {"role": "assistant", "content": "Cross-tuning between multiple signal dimensions. The code is finished without listening."}]} +{"conversations": [{"role": "user", "content": "What does `Event.play` do?"}, {"role": "assistant", "content": "Play the event. This evaluates the function at \\play. `(freq:"}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n~buf = Buffer.read(s, \"C:/sounds/break.wav\");\nPlayBuf.ar(1, ~buf, BufRateScale.kr(~buf), loop: 1);\n```"}, {"role": "assistant", "content": "Loads a sound file into server memory, then plays it in a loop at the file's original pitch.\n\n- `Buffer.read(s, path)` allocates a buffer on the server and fills it from the file. It is asynchronous:\n the Buffer object returns immediately, the samples arrive later.\n- `PlayBuf.ar(1, buf, ...)` needs the channel count first — 1 for a mono file. A wrong count is the usual\n cause of a buffer that plays wrongly or not at all.\n- `BufRateScale.kr(buf)` compensates when the file's sample rate differs from the server's, so `rate: 1` is\n the file's true speed.\n- `loop: 1` restarts at the end instead of stopping.\n\nBecause the read is asynchronous, this line pair is only safe if a `s.sync` or a wait happened in between;\notherwise PlayBuf sees a buffer with no data yet."}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for little homage to \"Come Out\" by Steve Reich: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n/* A little homage to \"Come Out\" by Steve Reich.\n It explores ryhtmic aspects created by phasing, retriggering, and pitch shifting.\n It \"detours\" the original audio message available here\n http://www.freesound.org/people/ERH/sounds/34667/\n in which a police patrol recites\n \"We don't want to scare your children, that's the last thing we wanna do\".\n \n */\n\n\ns.options.memSize=128*1024;\ns.boot;\n\n~bus=Bus.audio(s,2);\n~buf=Buffer.readChannel(s,\"/home/***/Supercollider/sounds/v.wav\");\n\n(\nSynthDef(\\playbuff,{arg in=0,out=0,t_trig=0;\n var i=EnvGen.kr(Env([0,40,0.3,0.4,40,0],[0,60,20,20,30]),gate:1);\n var r=EnvGen.kr(Env([0,10,-0.9,-0.9],[40,20,15]),gate:t_trig,doneAction:2);\n var sig1=PlayBuf.ar(1,in,rate:1+r,trigger:Impulse.kr(i),loop:1);\n var sig2=PlayBuf.ar(1,in,rate:1+r,trigger:Impulse.kr(i+0.01),loop:1);\nOut.ar(out,Splay.ar([sig1,sig2],0.5));\n};\n).add;\n\nSynthDef(\\rev,{arg in=0,out=0;\n var sig=In.ar(in,2);\n sig=Compander.ar(sig,sig,0.8,1/3);\n sig=FreeVerb.ar(sig,mix:0.4);\nOut.ar(out,sig);\n};\n).add;\n);\n\nSynth(\\rev,[\\in:~bus]);\n\nfork{\nx=Synth(\\playbuff,[\\out:~bus]);\n75.wait;\nx.set(\\t_trig,1);\n};\n\ns.quit;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\"help-out\", { |out = 0, freq = 440|\n var source;\n source = SinOsc.ar(freq, 0, 0.1);\n\n // write to the bus, adding to previous contents\n Out.ar(out, source);\n\n}).add;\n);\n\n\nSynth(\"help-out\", [\\freq, 500]);\nSynth(\"help-out\", [\\freq, 600]);\nSynth(\"help-out\", [\\freq, 700];\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\"help-out\", { |out = 0, freq = 440|\n var source;\n source = SinOsc.ar(freq, 0, 0.1);\n\n // write to the bus, adding to previous contents\n Out.ar(out, source);\n\n}).add;\n);\n\n\nSynth(\"help-out\", [\\freq, 500]);\nSynth(\"help-out\", [\\freq, 600]);\nSynth(\"help-out\", [\\freq, 700]);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Ganglion.defaultSampleRate` do?"}, {"role": "assistant", "content": "An Integer that is different for each board. For Ganglion boards it is 200"}]} +{"conversations": [{"role": "user", "content": "Can you listen to the sound you generate?"}, {"role": "assistant", "content": "No. I am 198M parameters trained on SuperCollider's documentation and class library; I have no audio input and no way to hear a result. What I can do is reason about the code: whether it reaches an output bus, whether the envelope will ever open, whether a filter at that cutoff leaves anything audible. Treat my patches as a starting point you listen to, not as a judgement about how they sound."}]} +{"conversations": [{"role": "user", "content": "What does `UnixFILE.isOpen` do?"}, {"role": "assistant", "content": "Returns whether the file is open. An open request can fail if a file cannot be found for example. This method lets you test that the open call"}]} +{"conversations": [{"role": "user", "content": "Explain `PlazyEnvirN` in SuperCollider briefly."}, {"role": "assistant", "content": "PlazyEnvirN — instantiate new patterns from a function and multichannel expand them Evaluates a function that returns a pattern and embeds it in a stream. Category: Streams-Patterns-Events > Patterns > Function."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PulseDivider`."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\"help-PulseDivider\", { |out = 0|\n var p, a, b;\n p = Impulse.ar(8);\n a = SinOsc.ar(1200, 0, Decay2.ar(p, 0.005, 0.1));\n b = SinOsc.ar(600, 0, Decay2.ar(PulseDivider.ar(p, 4), 0.005, 0.5));\n\n Out.ar(out, (a + b) * 0.4)\n}).play;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `Slider` in SuperCollider briefly."}, {"role": "assistant", "content": "Slider — A view consisting of a sliding handle. A view that allows setting a numerical value by means of moving a sliding handle. It can have horizontal or vertical orientation, meaning the direction in which the handle moves. Category: GUI > Views."}]} +{"conversations": [{"role": "user", "content": "What is the difference between .ar, .kr and .ir?"}, {"role": "assistant", "content": "The rate method decides how often a UGen is evaluated. `.ar` runs at the audio rate, once per sample, and produces an audio signal. `.kr` runs at the control rate, once per block of 64 samples by default, so it is cheaper and is used for parameters that do not need sample accuracy. `.ir` is evaluated once when the Synth is created and then never again, for constants such as SampleRate.ir or a size. Using .kr where you need audio-rate modulation gives stepped, zipper-noise-like control; using .ar where .kr would do costs CPU."}]} +{"conversations": [{"role": "user", "content": "What does `RedMixer.cvs` do?"}, {"role": "assistant", "content": "Dictionary with all Ref objects. (used to be CV"}]} +{"conversations": [{"role": "user", "content": "What does `Signal.ifft` do?"}, {"role": "assistant", "content": "Perform an inverse FFT on a real and imaginary signal in place. See also the class method #*fftCosTable."}]} +{"conversations": [{"role": "user", "content": "What does `IsOdd.value` do? What arguments does it take?"}, {"role": "assistant", "content": "validates that the tested object is an odd number Arguments: obj."}]} +{"conversations": [{"role": "user", "content": "What does Splay.ar do?"}, {"role": "assistant", "content": "`Splay.ar(inArray, spread, level, center, levelComp)` takes an array of mono signals and distributes them across the stereo field, so `Splay.ar(SinOsc.ar([220, 330, 440]) * 0.1)` is a three-source stereo chord rather than three separate synths. spread (0..1) controls how far the voices fan out and center shifts the middle. It is the shorthand for 'make this array stereo'."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\Identity;\n~description = \"Output the Ambisonics stream to outputs channels, useful for NRT rendering\";\n\n~function = {|in = 0|\nin;\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "What does `InstrAt.prepareToBundle` do? What arguments does it take?"}, {"role": "assistant", "content": "a reference to an Instr by name. obsolete Arguments: group; bundle."}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n~pad = Synth(\\pad, [\\freq, 165]);\n~pad.set(\\gate, 0);\n```"}, {"role": "assistant", "content": "It starts a sustained synth and then releases it.\n\n`Synth(\\pad, [\\freq, 165])` creates an instance of a SynthDef that takes a `gate` argument (default 1). The\narray after the name is alternating argument names and values: `\\freq, 165`. Setting `\\gate` to 0 does not\ncut the sound dead — the EnvGen inside sees the gate close and runs the release stage of its Env, then frees\nthe Synth because that EnvGen has `doneAction: 2`. This is the standard lifecycle for pads, drones and any\nsound you want to stop gracefully."}]} +{"conversations": [{"role": "user", "content": "What is the difference between the language and the server?"}, {"role": "assistant", "content": "sclang runs your code, the clock and Patterns, and builds UGen graphs. scsynth performs the DSP in real time. They communicate over OSC, which is why a language-side mistake can leave a sound running, and why s.freeAll stops it."}]} +{"conversations": [{"role": "user", "content": "Explain `DemandSpec` in SuperCollider briefly."}, {"role": "assistant", "content": "DemandSpec — datatype specifying a \\demand rate input or output Category: Spec, Libraries > crucial > Spec."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// every other note of the diatonic cluster: stacked thirds\n(degree: (0..12), amp: [0, 0.1]).play;\n\n// every other note of the semitone cluster: a wholetone cluster again\n(note: (0..12), amp: [0, 0.1]).play;\n\n// every third note of the semitone cluster: a diminished chord\n(note: (0..12), amp: [0, 0, 0.1]).play;\n\n// the same with different sustain times\n(note: (0..12), amp: [0, 0, 0.1], sustain: [0.1, 0.3, 1.3, 2.5]).play;\n\n// timingOffset gives a tempo-relative offset time to each synth\n(instrument: \\pm, ratio: [2.3, 4.5\n// …\n```"}, {"role": "assistant", "content": "every other note of the diatonic cluster: stacked thirds every other note of the semitone cluster: a wholetone cluster again (Event: an environment that represents an action)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// We'll hear the sawtooth wave when the two sine oscillators are both in the region x = 0.0 to 0.5, y = 0.5 to 1.0\n(\n{\n InRect.ar(\n SinOsc.ar(1), SinOsc.ar(1.3), Rect(0, 0.5, 0.5, 0.5)\n ) * LFSaw.ar(44, 0, 0.1)\n}.play\n);\n\n// Stereo effect\n(\n{\n InRect.ar(\n LFNoise0.ar([140, 141]), LFNoise0.ar(143), Rect(0, 0, 0.5, 1)\n ).lag(0.1) * LFSaw.ar(SinOsc.ar(10, 0, 5, 400), 0, 0.1)\n}.play\n);\n\n// For the Rect, create as left\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// We'll hear the sawtooth wave when the two sine oscillators are both in the region x = 0.0 to 0.5, y = 0.5 to 1.0\n(\n{\n InRect.ar(\n SinOsc.ar(1), SinOsc.ar(1.3), Rect(0, 0.5, 0.5, 0.5)\n ) * LFSaw.ar(44, 0, 0.1)\n}.play\n);\n\n// Stereo effect\n(\n{\n InRect.ar(\n LFNoise0.ar([140, 141]), LFNoise0.ar(143), Rect(0, 0, 0.5, 1)\n ).lag(0.1) * LFSaw.ar(SinOsc.ar(10, 0, 5, 400), 0, 0.1)\n}.play\n);\n\n// For the Rect, create as left, 'top', width, height;\nr = Rect(0, 0, 1, 1)\n\nr.left\nr.top\nr.right\nr.bottom\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// (thor magnusson) (2006)\n\n// An instrumentalist inside a synthdef.\n\n(\nSynthDef(\\drummer, { arg out=0, tempo=4;\n var snare, base, hihat;\n tempo = Impulse.ar(tempo); // for a drunk drummer replace Impulse with Dust !!!\n\n snare = WhiteNoise.ar(Decay2.ar(PulseDivider.ar(tempo, 4, 2), 0.005, 0.5));\n base = SinOsc.ar(Line.ar(120,60, 1), 0, Decay2.ar(PulseDivider.ar(tempo, 4, 0), 0.005, 0.5));\n hihat = HPF.ar(WhiteNoise.ar(1), 10000) * Decay2.ar(tempo, 0.005, 0.5);\n\n Out.ar(out,(snare + base + hihat) * 0.4 ! 2)\n}).add;\n);\n\na = Synth(\\drummer);\na.set(\\tempo, 6);\na.set(\\tempo, 18);\na.set(\\tempo, 180); // check the CPU! no increase.\na.free;\n```"}, {"role": "assistant", "content": "(thor magnusson) (2006) An instrumentalist inside a synthdef."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar synth = { Out.ar(99, SinOsc.ar([300, 700])) }.play;\n{ In.ar(99, 2) }.plot(0.02, synth);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar synth = { Out.ar(99, SinOsc.ar([300, 700])) }.play;\n{ In.ar(99, 2) }.plot(0.02, synth);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `AbstractDispatcher.all` do?"}, {"role": "assistant", "content": "Get a collection of all currently active Returns: An IdentitySet."}]} +{"conversations": [{"role": "user", "content": "Explain `EaseInOutCubic` in SuperCollider briefly."}, {"role": "assistant", "content": "EaseInOutCubic — Cubic ease-in/out Easing equation for a cubic (t^3) ease-in/out, accelerating until halfway, then decelerating. Category: Ease."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// as a frequency control\n{ SinOsc.ar(StandardL.ar(40, MouseX.kr(0.9, 4))*800+900)*0.4 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// as a frequency control\n{ SinOsc.ar(StandardL.ar(40, MouseX.kr(0.9, 4))*800+900)*0.4 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Warp1`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\nb.free;\nb = Buffer.read(s, ExampleFiles.apollo11);\n{\n var pointer = Phasor.ar(0, SampleDur.ir / BufDur.ir(b) * XLine.kr(1, 0.25, 20));\n var sound = Warp1.ar(1, b, pointer, 1, 0.3, -1, 16, Line.kr(0, 1, 40), 4);\n Pan2.ar(sound, pointer * 2 - 1, 0.25)\n}.play\n);\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `DecodeB2`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var w, x, y, p, a, b, c, d;\n\n p = PinkNoise.ar; // source\n\n // B-format encode\n #w, x, y = PanB2.ar(p, MouseX.kr(-1, 1), 0.1);\n\n // B-format decode to quad\n #a, b, c, d = DecodeB2.ar(4, w, x, y);\n\n [a, b, d, c] // reorder to my speaker arrangement: Lf Rf Lr Rr\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Klank`."}, {"role": "assistant", "content": "```supercollider\n{ Klank.ar(`[[800, 1071, 1153, 1723], nil, [1, 1, 1, 1]], Impulse.ar(2, 0, 0.1)) }.play;\n\n{ Klank.ar(`[[800, 1071, 1353, 1723], nil, [1, 1, 1, 1]], Dust.ar(8, 0.1)) }.play;\n\n{ Klank.ar(`[[800, 1071, 1353, 1723], nil, [1, 1, 1, 1]], PinkNoise.ar(0.007)) }.play;\n\n{ Klank.ar(`[[200, 671, 1153, 1723], nil, [1, 1, 1, 1]], PinkNoise.ar([0.007, 0.007])) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `BBCutQuantise1` in SuperCollider briefly."}, {"role": "assistant", "content": "BBCutQuantise1 — Adds a swing rhythm in BBCut2 BBCutQuantise1 is experimental. Category: Libraries > BBCut > Cut procedures."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for some initial thoughts on psytrance bassline. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\n{ | dur = 0.15, atk = 0.005, amp = 1 |\n SinOsc.ar(\n EnvGen.ar( Env(\n NamedControl.kr(\\freq_l, [2960, 70, 90]),\n NamedControl.kr(\\freq_d, [0.07, 0.2]),\n NamedControl.kr(\\freq_c, [-13, -1]),\n ) ),\n mul:amp * EnvGen.ar(\n Env.perc( atk, dur - atk, curve: NamedControl.kr(\\amp_c, [-1, 6])),\n doneAction: 2\n ); \n ) ! 2;\n}.asSynthDef.name_(\"kick\").add;\n\n{ | atk = 0.01, dur = 0.15, freq = 50, amp=0.8 |\n BPF.ar(LFSaw.ar(freq), freq, 2, mul: EnvGen.kr( Env.perc( atk, dur-atk, amp, 6 ), doneAction: 2 )) ! 2;\n}.asSynthDef.name_(\"bass\").add;\n\n{ | dur = 0.15, freq = 50, amp = 0.8, index = 10 |\n PMOsc.ar(freq, freq + 5, index, mul: amp * EnvGen.kr( Env.triangle( dur ), doneAction: 2 )) ! 2;\n}.asSynthDef.name_(\"bazz\").add;\n);\n\n\n(\nPpar([\n Pbind(*[\n instrument: \\kick,\n delta: 1,\n dur: Pfunc({ thisThread.clock.beatDur }) / 4,\n amp: Pseq([\n Pseq([1], 16),\n Pseq([0.8, 1], 8), \n Pseq([1], 16),\n Pseq([0.8, 0.8, 0.9, 1], 8)\n ], inf) * 0.8,\n freq_l: Pstutter(Prand(2.pow((1..4)),inf), Pseq([\n `[2960,70,90],\n `[1260,60,110],\n `[4360,60,120]\n ],inf))\n ]),\n Pbind(*[\n instrument: \\bass,\n delta: 1/4,\n dur: Pkey(\\delta) * Pfunc({ thisThread.clock.beatDur }),\n freq: Pseq([\\r, 50,60,70], inf),\n amp:0.6\n ]),\n Pbind(*[\n instrument: \\bazz,\n delta: 1/4,\n dur: Pkey(\\delta) * Pfunc({ thisThread.clock.beatDur }),\n freq: Pseq([\\r, 30,35,40], inf),\n amp:0.2\n ])\n]).play(TempoClock(156/60), quant:[1])\n);\n\n// kick from above?\n(\nPbind(*[\n instrument: \\kick,\n delta: Pseq(Array.geom(540, 1, 1.015).reciprocal.reverse),\n dur: Pkey(\\delta) * Pfunc({ thisThread.clock.beatDur }),\n atk: Pkey(\\dur) / 6,\n amp: 0.8\n]).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Convolution2L`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// one last example\n(\nb = Buffer.alloc(s, 512, 1);\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, true, true);\n);\n\n(\n{\n var input = SoundIn.ar(0);\n var framesize = 512;\n Convolution2L.ar(input, b, 0, framesize, 1, 0.5);\n}.play\n);\n\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `ProxySynthDef`?"}, {"role": "assistant", "content": "ProxySynthDef — synth def that wraps ugen graph"}, {"role": "user", "content": "What does `ProxySynthDef.sampleAccurate` do?"}, {"role": "assistant", "content": "always use OffsetOut, if set to true (default: false)"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na = ProxySynthDef(\"xtest\", { SinOsc.ar(400) * 0.1 });\n\na.add;\n\nx = Synth(\"xtest\");\nx.release;\n\n\n/*\n\n if the resulting number of channels is larger than a given channelConstraint,\n it behaves according to the rate: audio rate signals are wrapped around\n a smaller channel size, control rate signals are not (the exceeding channels are left out)\n\n*/\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `In`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n(\nSynthDef(\"help-PinkNoise\", { |out = 0|\n Out.ar(out, PinkNoise.ar(0.1))\n}).add;\n\nSynthDef(\"help-In\", { |out = 0, in = 0|\n var input;\n input = In.ar(in, 1);\n Out.ar(out, input);\n\n}).add;\n);\n\n// play noise on the right channel\nx = Synth(\"help-PinkNoise\", [\\out, 1]);\n\n// read the input and play it out on the left channel\nSynth.after(x, \"help-In\", [\\out, 0, \\in, 1]);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Server.bootSync` do? What arguments does it take?"}, {"role": "assistant", "content": "Boot the Server and wait until it has completed before resuming the Arguments: condition — an optional instance of Condition used for evaluating this.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// try wiggling the mouse quickly;\n// LFNoise frequently seems stuck, LFDNoise changes smoothly.\n\n{ LFClipNoise.ar(MouseX.kr(0.1, 1000, 1), 0.1) }.play\n\n{ LFDClipNoise.ar(MouseX.kr(0.1, 1000, 1), 0.1) }.play\n\n// silent for 2 secs before going up in freq\n\n{ LFClipNoise.ar(XLine.kr(0.5, 10000, 3), 0.1) }.scope;\n\n{ LFDClipNoise.ar(XLine.kr(0.5, 10000, 3), 0.1) }.scope;\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFClipNoise.ar\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// try wiggling the mouse quickly;\n// LFNoise frequently seems stuck, LFDNoise changes smoothly.\n\n{ LFClipNoise.ar(MouseX.kr(0.1, 1000, 1), 0.1) }.play\n\n{ LFDClipNoise.ar(MouseX.kr(0.1, 1000, 1), 0.1) }.play\n\n// silent for 2 secs before going up in freq\n\n{ LFClipNoise.ar(XLine.kr(0.5, 10000, 3), 0.1) }.scope;\n\n{ LFDClipNoise.ar(XLine.kr(0.5, 10000, 3), 0.1) }.scope;\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFClipNoise.ar(XLine.kr(1000, 20000, 10), 0.1) }.scope;\n\n{ LFDClipNoise.ar(XLine.kr(1000, 20000, 10), 0.1) }.scope;\n```"}]} {"conversations": [{"role": "user", "content": "What does `Collection.iter` do?"}, {"role": "assistant", "content": "Returns a Routine that returns the elements one by one. `r = Set[10, 2, -3,"}]} -{"conversations": [{"role": "user", "content": "What does `PlayerSocket.qwake` do?"}, {"role": "assistant", "content": "a player that can play other players using a cross-faded and fuse-protected socket"}]} -{"conversations": [{"role": "user", "content": "What is `SynthDesc`?"}, {"role": "assistant", "content": "SynthDesc — Description of a synth definition"}, {"role": "user", "content": "What does `SynthDesc.read` do?"}, {"role": "assistant", "content": "Adds all synthDescs in a path to a dict. You should not use this method or *readFile to read SynthDescs into a SynthDescLib. Use SynthDescLib#read or SynthDescLib#readStream instead."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"test\", { |out, freq, xFade|\n XOut.ar(out, xFade, SinOsc.ar(freq))\n}).store\n);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Server.waitForBoot` do? What arguments does it take?"}, {"role": "assistant", "content": "Evaluate \"onComplete\" as soon as the server has booted. This method will boot the server for you if it is not already running or booting. If the server is already running, \"onComplete\" is executed Arguments: onComplete — A function to evaluate after the server has booted successfully.; limit — The number of times to check for a successful boot. (5 times/sec); onFailure — A function to evaluate after the server fails to boot. If onFailure is not given, an error message is posted. Providing a function suppresses the error message. If you want to supply a function and print the normal error message, make sure that your function returns \"false,\" e.g. `s.waitForBoot(onFa; clock — The default Clock is AppClock. Use SystemClock or TempoClock if time accuracy is important.."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Nil`."}, {"role": "assistant", "content": "```supercollider\nx = nil;\nx = x.add(8); // returns an array\nx = x.add(7); // appends to the array\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// These examples compare the variants, so that you can hear the difference in interpolation\n\n// Comb used as a resonator. The resonant fundamental is equal to\n// reciprocal of the delay time.\n{ CombN.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ CombL.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ CombC.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// with negative feedback:\n{ CombN.ar(WhiteNoise.ar(0.01), 0\n// …\n```"}, {"role": "assistant", "content": "These examples compare the variants, so that you can hear the difference in interpolation Comb used as a resonator. The resonant fundamental is equal to (CombL: Comb delay line with linear interpolation.)"}]} -{"conversations": [{"role": "user", "content": "What does `Impulsar.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "converts a 'trig' input to an 'audio' rate single pulse Arguments: trig; mul; add."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Looping sampler with crossfading."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\\simpler, {\n arg buf=0\n ,freq=220\n ,sampleStart=0\n ,loopStart=0\n ,loopLen=1 // between 0 (min) and 1 (max)\n ,fadeTime=0.1\n ,gate=1\n ,attack=0.01\n ,sustain=1\n ,release=1\n ,f0=220;\n\n var rate = freq / f0;\n var sr = rate*BufSampleRate.kr(buf);\n var fadeFrames = fadeTime*sr;\n var loopEnd = loopLen*(BufFrames.kr(buf) - loopStart) + loopStart;\n var loopFrames = loopEnd - loopStart + 1;\n var loopTime = (loopFrames - fadeFrames)/sr;\n var startUpTime = (loopStart - sampleStart)/sr;\n\n var trigLoop = TDuty.ar(Dseq([startUpTime + loopTime, Dseq([loopTime], inf)]), gapFirst:1);\n\n var phaseA = Phasor.ar(trigLoop, rate, sampleStart, inf, loopStart);\n var phaseB = Phasor.ar(trigLoop, rate, loopEnd - fadeFrames, inf, loopEnd - fadeFrames);\n\n var srcA = BufRd.ar(buf.numChannels, buf, phaseA);\n var srcB = BufRd.ar(buf.numChannels, buf, phaseB);\n\n var startLoop = SetResetFF.ar(trigLoop);\n var loopPan = Phasor.ar(trigLoop, 2/fadeFrames * rate, -1, inf, -1).clip(-1,1);\n\n var out = Select.ar(startLoop, [srcA, LinXFade2.ar(srcB, srcA, pan:loopPan)]);\n var env = EnvGen.ar(Env.asr(attack, sustain, release, 1), gate, doneAction:2);\n\n Out.ar(0, Splay.ar(out) * env);\n}).add;\n\n// Try it out:\n~buf = Buffer.read(s, Platform.resourceDir +/+ 'sounds/a11wlk01.wav');\n\nPdef(\\p, Pbind(*[\n instrument: \\simpler\n ,buf: ~buf\n ,octave: Prand([3,4,5],inf)\n ,degree: Pn(Plazy({Pseq([-4,0,5,7,9,12].scramble.clump(2),2)}))\n ,dur: 0.5\n ,strum: Prand([0, 0.125, 0.25], inf)\n ,strumEndsTogether: false\n ,loopStart: Pwhite(90000, 150000)\n ,sampleStart: Pwhite(50000, 85000)\n ,loopLen: 0.4\n ,fadeTime: 0.15\n ,attack: 0.25\n ,release: 4\n])).play;\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for poor man's panning."}, {"role": "assistant", "content": "```supercollider\n// poor man's panning\n{\n var f, hornbostelwertheimerkonstante;\n f = MouseY.kr(1, 100, 1);\n hornbostelwertheimerkonstante = 0.00063;\n Impulse.ar(f, hornbostelwertheimerkonstante * f * [1, MouseX.kr(0, 2)], 0.1) \n}.play\n```"}]} -{"conversations": [{"role": "user", "content": "What is the node tree and what is a Group for?"}, {"role": "assistant", "content": "Everything running on the server is a node: Synths and Groups, arranged in a tree under the root group. Order matters, because audio flows through buses from earlier to later nodes in the same branch. A Group is a container that lets you address many nodes at once, which is what you want for an effect chain — put the instruments in one group, the effect in another, and `freeAll` or a volume change hits the whole group instead of a list of node ids."}]} -{"conversations": [{"role": "user", "content": "What does `InterfaceDef.onNoteOn` do?"}, {"role": "assistant", "content": "defines event, midi and GUI handlers for an Interface"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Paddpre`."}, {"role": "assistant", "content": "```supercollider\n(\nvar a, b;\na = Paddpre(\\x, 8, Pbind(\\dur, 0.5));\nx = a.asStream;\n9.do({ x.next((\\x:4)).postln });\n)\n```"}]} -{"conversations": [{"role": "user", "content": "How do I record my output to a file?"}, {"role": "assistant", "content": "`s.record(path)` starts recording the server's output; `s.stopRecording` stops it.\n\n```supercollider\ns.record(\"C:/audio/take1.wav\");\n// play for a while\ns.stopRecording;\n```\n\nThe path must be writable and the format follows the extension (.wav, .aiff, .flac). The file is written\nby the server, so it captures exactly what the master bus produces — including your effects, which is what\nyou want. `s.record` also accepts `duration:` to stop by itself, which is the reproducible form for a take."}]} -{"conversations": [{"role": "user", "content": "How to know the hardware buffer size?"}, {"role": "assistant", "content": "SuperCollider forum — How to know the hardware buffer size\n\nSay you want to use a UGen to control an external hardware device, independently of the soundcard. At first, one would think that this calculation is time-locked to the control rate, so e.g. at 1.5 kHz for a 48 kHz sample rate and a block size of 32.\n\nBut no, of course this calculation is time-locked to the hardware buffer size (I/O buffer size) of the soundcard you happen to use. EDIT: For a typical (low) setting, this is something like 256, so that would be about 190 Hz (5 ms). This may be too much delay for some applications, so we may want a smaller buffer size.\n\nIn scsynth, we can set a value for this size via ServerOptions:\n\n```supercollider\n // reduce to block size\ns.options.hardwareBufferSize = s.options.blockSize;\ns.reboot;\n```\n\nUnfortunately, not all soundcards support low block sizes. Also high quality sound cards may have very large ones, actually – this is a cultural thing, when you use them for recording, it is not a problem. But for live I/O it introduces delay (a quarter second is like an eternity then).\n\nSo now my question: how do I know if the above setting has been actually successful? How do I know what buffer size is current?\n\nI am sure that on different OSes there are ways to derive this in different ways. Maybe there is a way in supercollider as well?"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\"help-LFClipNoise\", { |out = 0|\n Out.ar(out,\n LFClipNoise.ar(1000, 0.25)\n )\n}).play;\n);\n\n// modulate frequency\n(\nSynthDef(\"help-LFClipNoise\", { |out = 0|\n Out.ar(out,\n LFClipNoise.ar(XLine.kr(1000, 10000, 10), 0.25)\n )\n}).play;\n);\n\n// use as frequency control\n(\nSynthDef(\"help-LFClipNoise\", { |out = 0|\n Out.ar(out,\n SinOsc.ar(\n LFClipNoise.ar(4, 200, 600),\n 0, 0.2\n )\n )\n}).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\"help-LFClipNoise\", { |out = 0|\n Out.ar(out,\n LFClipNoise.ar(1000, 0.25)\n )\n}).play;\n);\n\n// modulate frequency\n(\nSynthDef(\"help-LFClipNoise\", { |out = 0|\n Out.ar(out,\n LFClipNoise.ar(XLine.kr(1000, 10000, 10), 0.25)\n )\n}).play;\n);\n\n// use as frequency control\n(\nSynthDef(\"help-LFClipNoise\", { |out = 0|\n Out.ar(out,\n SinOsc.ar(\n LFClipNoise.ar(4, 200, 600),\n 0, 0.2\n )\n )\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Paddpre`."}, {"role": "assistant", "content": "```supercollider\n(\nvar a, b;\na = Paddpre(\\freq, 302, Pset(\\freq, 500, Pbind(\\dur, 0.3)));\nx = a.asStream;\n9.do({ x.next(Event.default).postln });\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// connect will connect to all midi in devices\n// if you need to specify one,\n// check the sources at: MIDIClient.sources\n// and connect using MIDIIn.connect( source_index )\nMIDIIn.connect;\n\n// show incoming control data\n~control = { arg src, chan, num, val; \n [chan,num,val].postln; \n};\n\nMIDIIn.addFuncTo(\\control, ~control);\n```"}, {"role": "assistant", "content": "Simple example showing how to listen for MIDI control messages."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes BD with ringing BPF."}, {"role": "assistant", "content": "```supercollider\n// BD with ringing BPF\n\n(\nSynthDef.new(\\bazedrum,\n {\n arg out = 0, outlevel=0.5, freq = 50, wet=0.5, q = 220, clicklevel =0, decaytrig = 0.1,\n decayfreq = 0.21, mulfreq =2 , decayamp = 1, dist = 17;\n\n var envtrig, envfreq, envamp, trigger,click, sig;\n\n envtrig = EnvGen.ar(Env.perc(1/10**5, decaytrig, 1, -9));\n envfreq = EnvGen.kr(Env.perc(0.003, decayfreq, mulfreq, -5));\n envamp = EnvGen.kr(Env.perc(0.003, decayamp,1, 2),doneAction:2);\n freq = freq * (1 + envfreq);\n trigger = envtrig*HPF.ar(PinkNoise.ar,40)+(envtrig*2);\n click = HPF.ar(envtrig*WhiteNoise.ar,2000*(1-envtrig),clicklevel);\n sig = BPF.ar(trigger, freq,1/q, sqrt(q)*5);\n sig = sig + click;\n\n sig = LeakDC.ar(sig* envamp,0.996);\n\n sig = Balance2.ar(sig,(sig*dist).tanh/3,(wet*2)-1);\n\n sig = Mix.ar(sig/2)*outlevel;\n\n out = 0;\n Out.ar(out, sig!2);\n }\n ).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Cleanroom (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n~t = 1; TempoClock.default.tempo = ~t;\n(\nSynthDef(\\ambifall3, { arg out=0, gate=1, amp=0.1, pan=0, freq=200;\n var sig;\n //thisThread.randSeed = 1923;\n\n sig = SinOsc.ar(freq);\n sig = Pan2.ar(sig, pan, amp);\n sig = ( WhiteNoise.ar + 0.8 ) * LFSaw.ar({ exprand(10.0,10000) }!20 * ( 1 + ( SinOsc.ar((1..4).rand(0.0)/18 * XLine.kr(1,121200,80)) * 1/41 * XLine.kr(1,0.1,60) )));\n sig = DelayC.ar(sig, 0.2, {rrand(1/5,1/10000) * ( 1 + ( SinOsc.ar((1..2).rand(0.0)/18 * XLine.kr(42,11200,60)) * 1/41 * XLine.kr(1,180,60) ))}!4) + sig / 2;\n sig = DelayC.ar(sig, 0.2, {rrand(1/5,1/10000) * XLine.kr(1/1000,1/20001,14)}!4) + sig / 2;\n sig = sig + BPF.ar(\n sig, \n { ( exprand(100.0,10000) * LFNoise1.ar(1/100.0.rand).range(1,2) ).clip(20,20000) }!10,\n { ( rand(0.01,1) * LFNoise1.ar(1/100.0.rand).range(1,2) ).clip(0.01,1) }!10\n );\n sig = BRF.ar(\n sig, \n { ( exprand(100.0,10000) * LFNoise1.ar(1/100.0.rand).range(1,2) ).clip(20,20000) }!10,\n { ( rand(0.01,1) * LFNoise1.ar(1/100.0.rand).range(1,2) ).clip(0.01,1) }!10\n );\n sig = LeakDC.ar(sig);\n sig = LPF.ar(sig, 17000 * XLine.kr(1,1/100,4));\n sig = sig * 5 * 3;\n sig = sig.mean;\n //sig = sig.clip;\n //sig = Compander.ar(sig, sig, \\cpt.kr(0.4), \\cpbelow.kr(1.001), \\cpabove.kr(0.009), \\cpclamp.kr(0.01), \\cprelax.kr(0.1));\n sig = Limiter.ar(sig, 1);\n sig = sig * EnvGen.kr(\\adsr.kr(Env.adsr(0.1,0.1,0.8,4.1)), gate, doneAction:2);\n sig = sig * amp;\n Out.ar(out, sig);\n}).add;\n);\n(\nPdef(\\part, Pdef(\\ambifall3, \n Ppar([\n Pseq([\n Pmono(\\ambifall3,\n \\freq, 2,\n \\dur, Pseq([1],4),\n \\amp, 0.1,\n ),\n Event.silent(4),\n ],inf),\n ])\n)).play;\n);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PV_CopyPhase`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\nb = Buffer.read(s, ExampleFiles.child);\n\n(\nSynthDef(\"help-copyPhase\", { |out = 0|\n var inA, chainA, inB, chainB, chain;\n inA = SinOsc.ar(SinOsc.kr(SinOsc.kr(0.08, 0, 6, 6.2).squared, 0, 100, 800));\n inB = WhiteNoise.ar(0.2);\n chainA = FFT(LocalBuf(2048), inA);\n chainB = FFT(LocalBuf(2048), inB);\n chain = PV_CopyPhase(chainA, chainB);\n Out.ar(out, 0.1 * IFFT(chain).dup);\n}).play(s);\n);\n\n(\nSynthDef(\"help-copyPhase2\", { |out = 0, soundBufnum = 2|\n var inA, chainA, inB, chainB, chain;\n inA = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);\n inB = SinOsc.ar(SinOsc.kr(SinOsc.kr(0.08, 0, 6, 6.2).squared, 0, 100, 800));\n chainA = FFT(LocalBuf(2048), inA);\n chainB = FFT(LocalBuf(2048), inB);\n chain = PV_CopyPhase(chainA, chainB);\n Out.ar(out, 0.1 * IFFT(chain).dup);\n}).play(s, [\\soundBufnum, b]);\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nb = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n\n(\n{\n var snd, envTime, knee, out;\n snd = PlayBuf.ar(1, b, BufRateScale.kr(b), loop: 1);\n envTime = MouseX.kr(1.0e-3, 0.1e-3);\n knee = MouseY.kr(0, -90).dbamp;\n out = DelayC.ar(snd, 0.01, envTime * 0.5) * EnvFollow.ar(snd, 1 - (envTime * SampleRate.ir).reciprocal).max(knee).reciprocal;\n out * 0.1!2\n}.play;\n)\n```"}, {"role": "assistant", "content": "a replication of the legendary LADSPA plugin of the same name, originally written by steve harris. a compressor with a super fast attack which results in harsh distortion fx. requires sc3-plugins."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for SOUND 1, from orig Influx Example."}, {"role": "assistant", "content": "```supercollider\n// SOUND 1, from orig Influx Example\n(\n// // // if JITLibExtensions are used, you can make space local:\n// Ndef(\\dog).addSpec(\\intv, [-24, 24]);\n// Ndef(\\dog).addSpec(\\timescale, [0.01, 10, \\exp]);\n// Ndef(\\dog).addSpec(\\curve, [-10, 10]);\n// Ndef(\\dog).addSpec(\\ffreq, \\freq);\n//\n// Ndef(\\dog).addSpec(\\loopnode, [0, 12]);\n// Ndef(\\dog).addSpec(\\dens, [10, 1000, \\exp]);\n// Ndef(\\dog).addSpec(\\resfreq, \\freq);\n// Ndef(\\dog).addSpec(\\ringtime, [0.01, 1, \\exp]);\n\nSpec.add(\\intv, [-24, 24]);\nSpec.add(\\timescale, [0.01, 10, \\exp]);\nSpec.add(\\curve, [-10, 10]);\nSpec.add(\\ffreq, \\freq);\n\nSpec.add(\\loopnode, [0, 12]);\nSpec.add(\\dens, [10, 1000, \\exp]);\nSpec.add(\\resfreq, \\freq);\nSpec.add(\\ringtime, [0.01, 1, \\exp]);\n\n\nNdef(\\dog, { |amp=0, freq=250, intv=19, timescale=1, curve=0, loopnode=0, dens = 10, resfreq = 500, ringtime = 0.01|\n var n = 15;\n var env = EnvGen.kr(\n Env({ 1.0.rand2 }!(n+1), {1.0.rand}!n, curve, releaseNode: n-1, loopNode: loopnode.min(n-3)),\n timeScale: timescale);\n var pitch = (env * [1, 0.33, -1] * intv).midiratio * freq;\n var form = Formant.ar(pitch, pitch.rotate(1) * 1.6, pitch.rotate(2) * 2.6);\n\n var dusty = Ringz.ar(\n Dust.ar(dens!3),\n resfreq * LFNoise0.kr([3, 5, 7], 0.5, 1),\n ringtime)\n * ((dens ** -0.5) * (ringtime ** -0.3)\n );\n\n Splay.ar(form * dusty, level: amp) ;\n});\n);\n\nNdef(\\dog).set(\\amp, 0.2).vol_(0.2);\nNdef(\\dog).gui.moveTo(400, 380);\n\n/*\n// Ndef(\\dog).addHalo(\\orderedNames, Ndef(\\dog).controlKeys);\nNdef(\\dog).controlKeys;\nNdef(\\dog).vol_(0.5);\nNdefPreset( Ndef(\\dog) ).loadSettings;\nNdef(\\dog).play;\nNdef(\\dog).gui;\n*/\n```"}]} -{"conversations": [{"role": "user", "content": "Strange offset behaviour when plotting some .kr uGens?"}, {"role": "assistant", "content": "SuperCollider forum — Strange offset behaviour when plotting some .kr uGens\n\nI’ve got a workaround for this now.\n\n```supercollider\ns.quit;\nServer.local.options.blockSize = 4;\ns.boot;\n\n{[\n LFTri.ar(s.sampleRate/2, 1, 2), // just to show where the samples are\n Impulse.ar(0), // audio rate impulse in correct place\n Impulse.kr(0), // control rate impulse with offset issue\n Trig1.kr(1, 0) // control rate impulse in correct place\n]}.plot(70/s.sampleRate);\n\n{[\n LFTri.ar(s.sampleRate/2, 1, 2), // just to show where the samples are\n Phasor.ar(Impulse.ar(0), 1/8, -2, 2, -0.625), // Phasor as it behaves in audio rate\n Phasor.kr(Impulse.kr(0), 1/2, -2, 2, -0.625), // Phasor as it behaves in control rate\n Phasor.kr(Impulse.kr(0), 1/2, -2, 2, -0.5) + (1.5 * Trig1.kr(1, 0)) // Phasor in control rate patched to match audio rate\n]}.plot(70/s.sampleRate)\n```\n\nI assume the problem is that the first control rate sample is meant to be more of a ‘sample -1’ than ‘sample 0’, hence why plot omits it when the output is at control rate. This would be fine if audio rate uGens started after one control period. Since they don’t, I’m happy to just adjust the code to make the subsequent samples correct, and then use ​ + (x * Trig1.kr(1, 0)) to patch the first sample. The only problem now is that it’s more complicated to do that with some other uGens."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n//you must have run this line before any of the examples below\nf= BBCutBuffer.array([Platform.resourceDir +/+ \"sounds/break.aiff\",Platform.resourceDir +/+ \"sounds/break2.aiff\"],[8,4]);\n\n\n( //defaults\nBBCut2(CutBuf1(f[0]),OffsetCP1.new).play(2.4);\n);\n\n\n( //your own func\n\nBBCut2(CutBuf1(f[0]),OffsetCP1.new(\n{\narg beatsleft, phraselength,block;\n\nif(block%2==0,\n{[[1.0],16.rand]}, {[[[0.5],[0.25,0.25]].choose\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n//you must have run this line before any of the examples below\nf= BBCutBuffer.array([Platform.resourceDir +/+ \"sounds/break.aiff\",Platform.resourceDir +/+ \"sounds/break2.aiff\"],[8,4]);\n\n\n( //defaults\nBBCut2(CutBuf1(f[0]),OffsetCP1.new).play(2.4);\n);\n\n\n( //your own func\n\nBBCut2(CutBuf1(f[0]),OffsetCP1.new(\n{\narg beatsleft, phraselength,block;\n\nif(block%2==0,\n{[[1.0],16.rand]}, {[[[0.5],[0.25,0.25]].choose,[4,8,12].choose]});\n}, 0.0625\n)\n).play(2.1);\n);\n\n\n\n(\nBBCut2(CutBuf1(f[1]),OffsetCP1.new(\n{\narg beatsleft, phraselength,block;\n\nif(block%2==0,\n{[[0.5],16.rand]}, {[[[0.25],[0.25,0.25]].choose,[4,8,12].choose]});\n}, 0.0625\n)\n).play(2.8);\n);\n\n\n(\nBBCut2(CutBuf1(f[1]),OffsetCP1.new(\n{\narg beatsleft, phraselength,block;\n\nif(block%2==0,\n{[[0.5],16.rand]}, {[[[0.25],[0.25,0.25], [0.125, 0.125, 0.25]].choose,[4,8,12, 5].choose]});\n}, 0.0625\n)\n).play(2.1);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `TChoose`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar,\n Pulse.ar\n ];\n TChoose.ar(Dust.ar(MouseX.kr(1, 1000, 1)), a) * 0.2\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a, b;\na = Paddpre(\\x, 8, Pbind(\\dur, 0.5));\nx = a.asStream;\n9.do({ x.next((\\x:4)).postln });\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a, b;\na = Paddpre(\\x, 8, Pbind(\\dur, 0.5));\nx = a.asStream;\n9.do({ x.next((\\x:4)).postln });\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes sclang fun )."}, {"role": "assistant", "content": "```supercollider\n( // whatever\nNdef(\\ff_twist, {\n var tempo = 156/60;//TempoClock.tempo;\n var bands = 4.rrand(16).debug('bands');\n var sync = bands.factors.scramble.pop.debug('sync');\n var gen = [LFNoise1,LFNoise2,LFNoise0];\n var sig = Splay.ar(\n VarSaw.ar(//LFSaw.kr(Array.rand(bands/sync, 8, 390).stutter(sync)).range(0.97,1.03) * \n Array.exprand(bands, 50, 400) * ({ gen.choose.kr(1/1.rrand(10)).exprange(1, 10) } ! (bands/sync)).stutter(sync), \n 0, \n { gen.choose.kr(1/1.rrand(10)).range(0.1,1) } ! bands, \n { gen.choose.kr(1/1.rrand(10)).range(0.1,1) } ! bands\n ) * ({ EnvGen.kr(Env.perc(0.008.exprand(0.03), tempo.reciprocal / [1,2,4,8].choose, 1, rrand(-7,-1.0)).circle) } ! (bands/sync)).stutter(sync)\n );\n sig = sig * 0.7 + GVerb.ar(sig, mul:0.3);\n sig = Rotate2.ar(\n sig[0], sig[1], \n LFSaw.kr( Duty.kr(tempo.reciprocal * (2,8..24).choose, 0, Drand((1..4)*tempo, inf)) )\n );\n sig;\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Signal.plot` do?"}, {"role": "assistant", "content": "Plot the Signal in a window. The arguments are not required and if not given defaults will be used. `Signal.sineFill(512, [1]).plot;` For details, see"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Change arg values of MIDIdef after instantiation."}, {"role": "assistant", "content": "```supercollider\n~mdef =\n{\n |key, func, msgNum, permanent = true|\n\n MIDIdef(key, func ?? { MIDIdef(key).func }, msgNum ? MIDIdef(key).msgNum, MIDIdef(key).chan, MIDIdef(key).msgType, MIDIdef(key).srcID).permanent_(permanent)\n}\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n{\n\nvar in, fft, entropy;\n\n//in = SinOsc.ar(MouseX.kr(100,1000),0,0.1);\n//in = Mix(SinOsc.ar([440,MouseX.kr(440,880)],0,0.1)); \nin= SoundIn.ar; \n\nfft = FFT(LocalBuf(2048), in);\n\nentropy=SpectralEntropy.kr(fft,2048,1); //one output band (so full spectrum's entropy)\n\nentropy.poll; \n\nOut.ar(0,Pan2.ar(0.1*Blip.ar(100,10*(entropy.sqrt)))); \n}.play\n);\n\n\n\n\n(\n{\n\nvar in, fft, entropy;\nvar amplit\n// …\n```"}, {"role": "assistant", "content": "in = SinOsc.ar(MouseX.kr(100,1000),0,0.1); in = Mix(SinOsc.ar([440,MouseX.kr(440,880)],0,0.1)); (SpectralEntropy: Spectral feature extraction)"}]} +{"conversations": [{"role": "user", "content": "What does `FlowLayout.currentBounds` do?"}, {"role": "assistant", "content": "Gets a Rect with `bounds.width` and `height = top +"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Compander`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var z;\n\n // signal (clean)\n z = Decay2.ar(\n Impulse.ar(8, 0, LFSaw.kr(0.3, 1, -0.3, 0.3)),\n 0.001,\n 0.3\n )\n * Mix.ar(Pulse.ar([80, 81], 0.3));\n\n // apply gate (mouse x sets treshold)\n Compander.ar(z, z,\n thresh: MouseX.kr(0.001, 1),\n slopeBelow: 10,\n slopeAbove: 1,\n clampTime: 0.01,\n relaxTime: 0.01\n )\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Scale` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\nr = {\n var scale = Scale.choose.postln;\n SinOsc.ar(\n (\n DegreeToKey.kr(\n scale.as(LocalBuf),\n MouseX.kr(0, 15), // mouse indexes into scale\n scale.stepsPerOctave,\n 1, // mul = 1\n 60 // offset by 72 notes\n )\n + LFNoise1.kr([3, 3], 0.04) // add some low freq stereo detuning\n ).midicps, // convert midi notes to hertz\n 0,\n 0.25\n )\n}.play;\n);\n\nr.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Ndef`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\nNdef(\\a).play; // play to hardware output.\nNdef(\\a).fadeTime = 2; // fadeTime specifies crossfade\n// set the source\nNdef(\\a, { SinOsc.ar([350, 351.3], 0, 0.2) });\nNdef(\\a, { Pulse.ar([350, 351.3] / 4, 0.4, 0.2) });\nNdef(\\a, Pbind(\\dur, 0.03, \\freq, Pbrown(0, 1, 0.1, inf).linexp(0, 1, 200, 350)));\n\nNdef(\\a, { Ringz.ar(Ndef.ar(\\b), [350, 351.3] * 2, 0.4) });\nNdef(\\b, { Impulse.ar([5, 7]/2, [0, 0.5], 0.15) });\n\nNdef.clear(3); // clear all after 3 seconds\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ SinOsc.ar(SinOsc.ar(0.3).curverange(440, 660, -3), 0, 0.5 * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ SinOsc.ar(SinOsc.ar(0.3).curverange(440, 660, -3), 0, 0.5) * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Detune idea is from James Harkins. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\na = {\n |freq = 40, wid = 0.5|\n Mix(LFPulse.ar(freq *((Array.fill(40, Pxrand((1, 2..20), inf).iter)/1000)+1),\n 0, wid, 0.05)\n ).dup\n}.play;\n);\n\n//more distorsion\n~widlfo = {Saw.kr(0.5).range(0,1)};\na.set(\\wid, ~widlfo);\n\n//stop\na.release;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ControlName`."}, {"role": "assistant", "content": "```supercollider\n(\nd = SynthDef(\\tone, { |out = 0, freq = 200|\n var sig;\n\n freq.spec = ControlSpec(20, 20000);\n sig = SinOsc.ar(freq);\n\n Out.ar(out, sig);\n}).add;\n);\n\nd.specs.freq.postln;\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `InFeedback`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-InFeedback\", { |out = 0, in = 0|\n Out.ar(out,\n InFeedback.ar(in, 1)\n );\n}).add;\nSynthDef(\"help-SinOsc\", { |out = 0, freq = 440|\n Out.ar(out, SinOsc.ar(freq, 0, 0.1))\n}).add;\n);\n\nx = Bus.audio(s, 1);\n\n// read from bus n play to bus 0 (silent)\na = Synth(\"help-InFeedback\", [\\in, x.index, \\out, 0]);\n\n// now play a synth after this one, playing to bus x\nb = Synth.after(a, \"help-SinOsc\", [\\out, x.index]);\n\n// add another synth before a which also writes to bus x\n// now you can't hear b, as its data is one cycle old, and is overwritten by c\nc = Synth.before(a, \"help-SinOsc\", [\\out, x.index, \\freq, 800]);\n\n// free c and you can hear b again\nc.free;\nx.free;\n\na.free; b.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `EventSource.remove` do?"}, {"role": "assistant", "content": "Disconnects this EventStream from the parent EventStream (if it has a parent). If the EventStream is not assigned to any variable anymore it will be gc'ed."}]} +{"conversations": [{"role": "user", "content": "What does `ModMap.map` do? What arguments does it take?"}, {"role": "assistant", "content": "A tool for modulating Ndefs Arguments: Input Ndef; key for argument to be modulated; key for type of modulation from ControlFiles; spec array; extraArguments for modulating signal (for example to control modulation frequency); lag time; where to post?."}]} +{"conversations": [{"role": "user", "content": "Explain `LFDNoise1` in SuperCollider briefly."}, {"role": "assistant", "content": "LFDNoise1 — Dynamic ramp noise Like LFNoise1, it generates linearly interpolated random values at a rate given by the `freq` argument, with two differences: Category: UGens > Generators > Stochastic."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// given a UGen graph ...\n(\n{ Splay.ar(SinOsc.ar({ exprand(300.0, 10000.0) } ! 17, 0, { 1.0.rand } ! 17)) * 0.1 }.play\n);\n\n// ... all existing UGen inputs can be replaced or modified with an arbitrary function\n// e.g. with a modulator\n(\n{\nBend({ |in|\n in * LFDNoise3.kr(MouseX.kr(0.1, 200, 1), 0.1, 1)\n}, {\n Splay.ar(SinOsc.ar({ exprand(300.0, 10000.0) } ! 17, 0, { 1.0.rand } ! 17))\n}) * 0.1\n}.play\n)\n```"}, {"role": "assistant", "content": "given a UGen graph ... ... all existing UGen inputs can be replaced or modified with an arbitrary function (Bend: UGen wrapper for code bending)"}]} +{"conversations": [{"role": "user", "content": "What does `NodeProxy.send` do? What arguments does it take?"}, {"role": "assistant", "content": "Send a new synth without releasing the old one. If the source is a stream or a pattern, it starts a new Arguments: extraArgs — Arguments used to set the synth. The argument list is applied to the synth only. Arguments specified here override settings in the node map, but leave them untouched.; index — What slot to send a new synth with. If nil, uses all. (default: nil); freeLast — if to free the last synth at that index or not (default: true)."}]} +{"conversations": [{"role": "user", "content": "What does `MxUnit.init` do?"}, {"role": "assistant", "content": "Container for a musical object (Instr, NDef, Spline etc); this is a single unit that has inlets and outlets which can be connected to other units"}]} +{"conversations": [{"role": "user", "content": "What is `Pavaroh` in SuperCollider?"}, {"role": "assistant", "content": "Pavaroh — applying ascending and descending scales to event stream Basic classical indian scale pattern. Allowing to apply an ascending scale (aroh) and a descending scale (avaroh). Category: Streams-Patterns-Events > Patterns > Math."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{WalshHadamard.ar(SoundIn.ar, MouseX.kr(0,64)}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{WalshHadamard.ar(SoundIn.ar, MouseX.kr(0,64))}.play\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\AcnSn3dIn;\n~description = \"A live ambisonic input (ACN_SN3D)\";\n~channelLayout = \\ambi;\n\n~function = { |order=1, t_trig = 0, bus = 0|\n var env = EnvGen.kr(Env([0,1], [1]), t_trig);\n var chans = Array.series(\n size: (order + 1).pow(2).asInteger,\n start: bus,\n step: 1\n );\n var input = SoundIn.ar(chans) * env;\n HOAConverterAcnSn3d2AcnN3d.ar(order, input);\n};\n```"}, {"role": "assistant", "content": "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see ."}]} +{"conversations": [{"role": "user", "content": "What does `TraerAttraction.getStrength` do?"}, {"role": "assistant", "content": "Positive strength is attraction, negative strength is Returns: a LINKClasses/Float"}]} +{"conversations": [{"role": "user", "content": "What does `Instr.name` do?"}, {"role": "assistant", "content": "the symbolized version of the name: [\\one,\\two,\\three] dotNotation is usually nicer to work"}]} +{"conversations": [{"role": "user", "content": "[ 1, 2, 1, 1, 2, 1, 1 ] how to find adjacent elements in an array?"}, {"role": "assistant", "content": "SuperCollider forum — [ 1, 2, 1, 1, 2, 1, 1 ] how to find adjacent elements in an array\n\nRandColors:\n\nI need to find the index, the how many times (the adjacent values are equal) and what is the adjacent value.\n\nThis is perhaps a bit verbose and clunky, but it meets the above specification:\n\n```supercollider\n(\n~repeats = {|array|\n // return [index, number of repeats, the value] for each repeated value\n var results = [];\n var thisIndex = 0;\n var thisCount = 1;\n var thisValue = array[0];\n array[1..].do{|val, i|\n if(val == thisValue,\n {thisCount = thisCount + 1},\n {\n if(\n thisCount > 1,\n {results = results.add([thisIndex, thisCount, thisValue])},\n );\n thisValue = val;\n thisIndex = i + 1;\n thisCount = 1;\n }\n )\n };\n if(thisCount > 1, {results = results.add([thisIndex, thisCount, thisValue])});\n results;\n}\n);\n\na = [1, 2, 1, 1, 1, 2, 1, 1];\nb = ~repeats.value(a);\n\na = [2, 3, 5, 5];\nb = ~repeats.value(a);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `MultiSplineFr.focusedPoint` do? What arguments does it take?"}, {"role": "assistant", "content": "Multi dimensional spline frame rate device Arguments: fp."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Pmulp` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\freq, Pseq([500, 600, 700]), \\instrument, \\sinegrain);\na = Pmulp(\\freq, Pseq([0.5, 0.9, 0.8], inf), a);\na.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// logistic map as frequency control\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n SinOsc.ar(QuadC.ar(40, r.neg, r, 0, 0.1, 800, 900)) * 0.4;\n}.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// logistic map as frequency control\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n SinOsc.ar(QuadC.ar(40, r.neg, r, 0, 0.1, 800, 900)) * 0.4;\n}.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Dust`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-Dust\", { |out = 0|\n Out.ar(out,\n Dust.ar(200, 0.5)\n )\n}).play;\n);\n\n(\nSynthDef(\"help-Dust\", { |out = 0|\n Out.ar(out,\n Dust.ar(XLine.kr(20000, 2, 10), 0.5)\n )\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for SOUND 1, from orig Influx Example. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n// SOUND 1, from orig Influx Example\n(\n// // // if JITLibExtensions are used, you can make space local:\n// Ndef(\\dog).addSpec(\\intv, [-24, 24]);\n// Ndef(\\dog).addSpec(\\timescale, [0.01, 10, \\exp]);\n// Ndef(\\dog).addSpec(\\curve, [-10, 10]);\n// Ndef(\\dog).addSpec(\\ffreq, \\freq);\n//\n// Ndef(\\dog).addSpec(\\loopnode, [0, 12]);\n// Ndef(\\dog).addSpec(\\dens, [10, 1000, \\exp]);\n// Ndef(\\dog).addSpec(\\resfreq, \\freq);\n// Ndef(\\dog).addSpec(\\ringtime, [0.01, 1, \\exp]);\n\nSpec.add(\\intv, [-24, 24]);\nSpec.add(\\timescale, [0.01, 10, \\exp]);\nSpec.add(\\curve, [-10, 10]);\nSpec.add(\\ffreq, \\freq);\n\nSpec.add(\\loopnode, [0, 12]);\nSpec.add(\\dens, [10, 1000, \\exp]);\nSpec.add(\\resfreq, \\freq);\nSpec.add(\\ringtime, [0.01, 1, \\exp]);\n\n\nNdef(\\dog, { |amp=0, freq=250, intv=19, timescale=1, curve=0, loopnode=0, dens = 10, resfreq = 500, ringtime = 0.01|\n var n = 15;\n var env = EnvGen.kr(\n Env({ 1.0.rand2 }!(n+1), {1.0.rand}!n, curve, releaseNode: n-1, loopNode: loopnode.min(n-3)),\n timeScale: timescale);\n var pitch = (env * [1, 0.33, -1] * intv).midiratio * freq;\n var form = Formant.ar(pitch, pitch.rotate(1) * 1.6, pitch.rotate(2) * 2.6);\n\n var dusty = Ringz.ar(\n Dust.ar(dens!3),\n resfreq * LFNoise0.kr([3, 5, 7], 0.5, 1),\n ringtime)\n * ((dens ** -0.5) * (ringtime ** -0.3)\n );\n\n Splay.ar(form * dusty, level: amp) ;\n});\n);\n\nNdef(\\dog).set(\\amp, 0.2).vol_(0.2);\nNdef(\\dog).gui.moveTo(400, 380);\n\n/*\n// Ndef(\\dog).addHalo(\\orderedNames, Ndef(\\dog).controlKeys);\nNdef(\\dog).controlKeys;\nNdef(\\dog).vol_(0.5);\nNdefPreset( Ndef(\\dog) ).loadSettings;\nNdef(\\dog).play;\nNdef(\\dog).gui;\n*/\n```"}]} +{"conversations": [{"role": "user", "content": "How do I add a reverb send to a whole group?"}, {"role": "assistant", "content": "Same shape as the delay: a private stereo bus, one effect reading it, instruments writing both dry\nand wet.\n\n```supercollider\n(\n~verbBus = Bus.audio(s, 2);\nSynthDef(\\verb, { |in = 0, out = 0, room = 0.85, mix = 0.5|\n Out.ar(out, FreeVerb.ar(In.ar(in, 2), mix, room, 0.5) * 0.7);\n}).add;\nSynthDef(\\blip, { |out = 0, send = 0, freq = 440, amp = 0.1|\n var env = EnvGen.kr(Env.perc(0.002, 0.4), doneAction: 2);\n var sig = SinOsc.ar(freq) * env * amp;\n Out.ar(out, sig);\n Out.ar(send, sig);\n}).add;\n);\nSynth(\\verb, [\\in, ~verbBus]);\nPbind(\\instrument, \\blip, \\send, ~verbBus, \\degree, Pseq([0, 4, 7, 11], inf), \\dur, 0.25).play;\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Array`."}, {"role": "assistant", "content": "```supercollider\n(\nx = {\n SinOsc.ar([0.1, 0.2], 0).poll * 0.1\n}.play;\n);\nx.trace; // By tracing the Synth you can see the two Poll units we created\nx.free\n```"}]} +{"conversations": [{"role": "user", "content": "What does `PHSusePlayer.free` do?"}, {"role": "assistant", "content": "Only free this PHSusePlayer - the PHSplayer / PHSparPlayer, which is using the same HS / HSpar, is not"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// The code below generates a series of test signals for each speaker of \n// the currently active setup. In the default settings this generates \n// short pink noise bursts, twice on each group of 8 speakers.\n\n(\nn = 8; // size of speaker groups\nz = 1/4; // duration per burst\nt = \\pinkNoise; // udef name for sound generation\nr = 2; // number of repeats per group\nx = UScore();\n\n(WFSSpeakerConf.default.speakerCount / n).ceil.do({ |i|\n var folder;\n folder = UScore( i * (r * (n + 1) * z) );\n x.add( folder );\n r.do({ |ii|\n n.do({ |iii|\n folder.add( UChain( ((ii * (n + 1)) + iii) * z, iii, z * (3/4), \n [ t, [ \\seed, 12345 ] ],\n [ \\wfsIndex, [ \\index, (i * 8) + iii, \\gain, 0 ] ]\n )\n );\n });\n });\n folder.name = ([1,n] + (i*8)).join(\"-\"); \n});\n\nx.gui;\n)\n```"}, {"role": "assistant", "content": "The code below generates a series of test signals for each speaker of the currently active setup. In the default settings this generates short pink noise bursts, twice on each group of 8 speakers."}]} +{"conversations": [{"role": "user", "content": "What does `UChain.eventSustain` do?"}, {"role": "assistant", "content": "The time from the begging of the event until the moment when the chain should be released (to start the fade Returns: Float"}]} +{"conversations": [{"role": "user", "content": "I get \"Message 'ar' not understood\". Why?"}, {"role": "assistant", "content": "You called a rate method on something that is not a UGen. `Env.ar(...)` and `Buffer.ar(...)` are the classic cases: Env is a language-side description and is played by `EnvGen.ar(env, ...)`; a Buffer is server memory and is played by `PlayBuf.ar` or `BufRd.ar`. The UGen is the thing with a rate method — if it is a description or a container, there is another UGen that consumes it."}]} +{"conversations": [{"role": "user", "content": "What does `PCombN.new` do? What arguments does it take?"}, {"role": "assistant", "content": "UGenPatterns quark library Arguments: pattern; maxdelaytime — Fixed.; delaytime; decaytime — Differs from CombN. Here feedback factor.; mul; add."}]} +{"conversations": [{"role": "user", "content": "What does `EnvironmentRedirect.localRemoveAt` do?"}, {"role": "assistant", "content": "Like `removeAt`, but without calling the dispatch"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nr = Recorder(s);\n{ GVerb.ar(Dust.ar(4)) }.play; // play on bus 64\nr.record(numChannels: 2;\nr.stopRecording;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nr = Recorder(s);\n{ GVerb.ar(Dust.ar(4)) }.play; // play on bus 64\nr.record(numChannels: 2);\nr.stopRecording;\n```"}]} {"conversations": [{"role": "user", "content": "List of exit codes?"}, {"role": "assistant", "content": "SuperCollider forum — List of exit codes?\n\n7068696c:\n\n```supercollider\no = s.options;\no.inDevice = nil;\no.outDevice = \"ASIO : ASIO4ALL\";\n```\n\nHmmmm... In earlier SC versions, it wouldn’t have worked to have a nil input device in scsynth either (which is admittedly a problem for devices with no inputs). This was fixed in scsynth but it’s possible that it wasn’t fully fixed in supernova.\n\n@MarcinP – any thoughts about this? (I remember you worked on scsynth device selection but I don’t recall who ported that to supernova.)\n\nhjh"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for little homage to \"Come Out\" by Steve Reich."}, {"role": "assistant", "content": "```supercollider\n/* A little homage to \"Come Out\" by Steve Reich.\n It explores ryhtmic aspects created by phasing, retriggering, and pitch shifting.\n It \"detours\" the original audio message available here\n http://www.freesound.org/people/ERH/sounds/34667/\n in which a police patrol recites\n \"We don't want to scare your children, that's the last thing we wanna do\".\n \n */\n\n\ns.options.memSize=128*1024;\ns.boot;\n\n~bus=Bus.audio(s,2);\n~buf=Buffer.readChannel(s,\"/home/***/Supercollider/sounds/v.wav\");\n\n(\nSynthDef(\\playbuff,{arg in=0,out=0,t_trig=0;\n var i=EnvGen.kr(Env([0,40,0.3,0.4,40,0],[0,60,20,20,30]),gate:1);\n var r=EnvGen.kr(Env([0,10,-0.9,-0.9],[40,20,15]),gate:t_trig,doneAction:2);\n var sig1=PlayBuf.ar(1,in,rate:1+r,trigger:Impulse.kr(i),loop:1);\n var sig2=PlayBuf.ar(1,in,rate:1+r,trigger:Impulse.kr(i+0.01),loop:1);\nOut.ar(out,Splay.ar([sig1,sig2],0.5));\n};\n).add;\n\nSynthDef(\\rev,{arg in=0,out=0;\n var sig=In.ar(in,2);\n sig=Compander.ar(sig,sig,0.8,1/3);\n sig=FreeVerb.ar(sig,mix:0.4);\nOut.ar(out,sig);\n};\n).add;\n);\n\nSynth(\\rev,[\\in:~bus]);\n\nfork{\nx=Synth(\\playbuff,[\\out:~bus]);\n75.wait;\nx.set(\\t_trig,1);\n};\n\ns.quit;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Abusing Convolution2 to make pitch."}, {"role": "assistant", "content": "```supercollider\n// fixed (unchanging) impulse response\n// cmd-. to stop\n\n(\ns.waitForBoot {\n var c = Condition.new, cleanfunc = { CmdPeriod.remove(cleanfunc); b.free };\n fork {\n b = Buffer.alloc(s, 2048, 1);\n CmdPeriod.add(cleanfunc);\n s.sync;\n a = {\n RecordBuf.ar(BrownNoise.ar * EnvGen.ar(Env(#[0, 1, 0], #[0.5, 0.5], \\sin), timeScale: b.duration, doneAction: 2), b, loop: 0);\n 0\n }.play;\n OSCpathResponder(s.addr, ['/n_end', a.nodeID], { |time, resp, msg|\n resp.remove;\n c.unhang;\n }).add;\n c.hang;\n a = {\n var freq = MouseX.kr(150, 450, warp: 1, lag: 0.1);\n LeakDC.ar(Convolution2.ar(Impulse.ar(freq), b, framesize: b.numFrames) * -35.dbamp) ! 2;\n }.play;\n };\n};\n);\n\n\n\n// multiple impulse responses for timbre control\n(\ns.waitForBoot {\n var c = Condition.new, cleanfunc = { CmdPeriod.remove(cleanfunc); b.free };\n fork {\n b = Buffer.allocConsecutive(3, s, 2048, 1);\n CmdPeriod.add(cleanfunc);\n s.sync;\n a = {\n var sig = [BrownNoise.ar, PinkNoise.ar, WhiteNoise.ar];\n sig.do { |chan, i|\n RecordBuf.ar(chan * EnvGen.ar(Env(#[0, 1, 0], #[0.5, 0.5], \\sin), timeScale: b[i].duration, doneAction: 2), b[i], loop: 0);\n 0\n };\n }.play;\n OSCpathResponder(s.addr, ['/n_end', a.nodeID], { |time, resp, msg|\n resp.remove;\n c.unhang;\n }).add;\n c.hang;\n a = {\n var freq = MouseX.kr(150, 450, warp: 1, lag: 0.1),\n index = MouseY.kr(0, 1.99, lag: 0.1),\n iWhole = index.trunc(2),\n iFrac = index - iWhole,\n iAdjust = iFrac >= 1.0,\n trig = Impulse.ar(freq),\n convolvers = b.collect { |buf, i|\n LeakDC.ar(Convolution2.ar(trig, buf, framesize: buf.numFrames))\n };\n (\n XFade2.ar(\n Select.ar(iWhole + (2 * iAdjust), convolvers),\n Select.ar(iWhole + 1, convolvers),\n iFrac.fold(0, 1) * 2 - 1\n ) * -30.dbamp\n ) ! 2;\n }.play;\n };\n};\n)\n```"}]} -{"conversations": [{"role": "user", "content": "How do I make an additive bell with Klank?"}, {"role": "assistant", "content": "Klank is a bank of resonant filters excited by a short impulse: you describe the partials as\nfrequencies, amplitudes and decay times.\n\n```supercollider\n(\nSynthDef(\\klank, { |out = 0, freq = 440, amp = 0.3|\n var ratios = [1, 2.2, 3.7, 5.1, 7.3];\n var decays = [4, 2.6, 1.8, 1.2, 0.8];\n var sig = Klank.ar(`[ratios * freq, nil, decays], Impulse.ar(0, 0, 0.2), 1, 0, 0.3);\n Out.ar(out, Pan2.ar(sig * amp, 0));\n}).add;\n);\nSynth(\\klank);\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n{ Pan2.ar(Klank.ar(`[[1, 2.2, 3.5, 4.9], nil, Array.series(4, 1, -0.2)], PinkNoise.ar(EnvGen.ar(Env.perc(0.001,0.01), Impulse.ar(4))), 0), 0); }.play;\n```"}, {"role": "assistant", "content": "I accidentally set the freqscale of a Klank to 0. What resulted was a surprisingly varied and dynamic bit of glitch. The joy of typos in SC :)."}]} -{"conversations": [{"role": "user", "content": "What does `EnvGen.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Envelope generator Arguments: envelope — An Env instance, or an Array of Controls. (See Control and the example below for how to use this.) The envelope is polled when the EnvGen is triggered, and at the start of a new envelope segment. The Env inputs can be other UGens.; gate — This triggers the envelope and holds it open while > 0. If the Env is fixed-length (e.g. Env.linen, Env.perc), the gate argument is used as a simple trigger. If it is an sustaining envelope (e.g. Env.adsr, Env.asr), the envelope is held open until the gate becomes 0, at which point is released. If g; levelScale — The levels of the breakpoints are multiplied by this value. This value can be modulated, but is only sampled at the start of a new envelope segment.; levelBias — This value is added as an offset to the levels of the breakpoints. This value can be modulated, but is only sampled at the start of a new envelope segment.; timeScale — The durations of the segments are multiplied by this value. This value can be modulated, but is only sampled at the start of a new envelope segment.; doneAction — An integer representing an action to be executed when the env is finished playing. This can be used to free the enclosing synth, etc. See Done for more detail.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\\sine, { |freq = 400, amp = 0.1| Out.ar(0, SinOsc.ar(freq, mul: amp)) }).add;\nSynthDef(\\pulse, { |freq = 400, amp = 0.1| Out.ar(0, Pulse.ar(freq, mul: amp)) }).add;\n);\n\n(\nx = Synth(\\sine).register;\ny = Synth(\\pulse).register;\n);\n\n// pause pulse \n\ny.run(false);\n\n// VarGui checks state, definition is known, new Synths of same definition can be started\n\nv = VarGui(synth: [x,y]).gui;\n\n\n// With nodeIDs or non-regist\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\\sine, { |freq = 400, amp = 0.1| Out.ar(0, SinOsc.ar(freq, mul: amp)) }).add;\nSynthDef(\\pulse, { |freq = 400, amp = 0.1| Out.ar(0, Pulse.ar(freq, mul: amp)) }).add;\n);\n\n(\nx = Synth(\\sine).register;\ny = Synth(\\pulse).register;\n);\n\n// pause pulse \n\ny.run(false);\n\n// VarGui checks state, definition is known, new Synths of same definition can be started\n\nv = VarGui(synth: [x,y]).gui;\n\n\n// With nodeIDs or non-registered Synths VarGui demands addtional state info\n\n(\nx = { SinOsc.ar(400, mul: 0.1) }.play;\ny = { Pulse.ar(700, mul: 0.01) }.play;\n);\n\ny.run(false);\n\n// no new Synths from temporary synth definition\n\nv = VarGui(synth: [x,y], assumePlaying: true, assumeRunning: [true, false]).gui;\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for We all could use a little more?"}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\cowbell, {\n | out=0, amp=0.3, gate=1, fund_freq=540, pan=0.0 |\n var sig, env;\n\n sig = Pulse.ar( fund_freq * [ 1, 1.5085 ], [ 0.565, 0.445 ], [ 0.4, 0.6 ] ).distort;\n env = EnvGen.ar(\n Env(\n [ 0, 0.05, 1, 0.1, 0 ], [ 0.003, 0.002, 0.05, 0.5 ], [2, -4, -4, -4]\n ),\n gate: gate,\n timeScale: [ 1.0, 1.5 ],\n doneAction: 2\n );\n sig = Mix( sig * env );\n sig = BPF.ar( sig, fund_freq * 2, 1.808 );\n\n Out.ar( out, Pan2.ar( sig, pan, amp ) );\n}).add;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Pgate`."}, {"role": "assistant", "content": "```supercollider\n// Pn advances Pgate each time its subpattern is repeated\n(\nPbind(\n \\degree, Pn(Pseq((0..7)), inf, \\step),\n \\mtranspose, Pgate(Pwhite(0, 5), inf, \\step),\n \\dur, 0.2\n).play\n);\n\n\n// Two different Pgates advanced at two different rates\n(\nPbind(\n\n \\scale, Scale.minor,\n \\foo, Pn(Pseq((0..2)), inf, \\step1),\n \\degree, Pn(Pseq((0..7).mirror), inf, \\step),\n \\ctranspose, Pgate(Pwhite(0, 5), inf, \\step) + Pgate(Pseq([0, 7, 0, -7], inf), inf, \\step1),\n \\dur, 0.2\n).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n//Chaos engine hum\n(\n{\n SinOsc.ar(10 + (50 * SinOsc.kr([50, 51], 0, SinOsc.kr(101, Saw.kr(0.12345, 678, 9), 0.2, 0.8), Pulse.kr([25, 25.5], 0.25, 0.125, -0.25))), 0, 0.5, 0);\n}.play();\n)\n```"}, {"role": "assistant", "content": "A deep binaural cycle reminiscent of the engine of a space ship."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `SynthDef`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_isRand, { |out|\n Out.ar(out,\n SinOsc.ar(Rand(400, 800), 0, 0.2) * Line.kr(1, 0, 1, doneAction: Done.freeSelf)\n )\n}).add;\n);\na = Synth(\\help_isRand);\nb = Synth(\\help_isRand); // a different randomly selected freq\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes blipecho context."}, {"role": "assistant", "content": "```supercollider\n( \nSynthDef(\\klang_blip, { \n | out = 0, release = 1, freq1 = 1, freq2 = 5, freq3 = 8, freq_mul = 4, atk_dur = 0.01, amp = #[0.3,0.3,0.3], mod_freq = 25 | \n var sig = DynKlang.ar(\n `[([freq1, freq2, freq3].linexp(1,12,1,1140) * freq_mul), amp, nil ], \n EnvGen.kr(Env([5,1.05,0.95,0.01],[0.025,release*3/4,release/4])), \n 150\n ) * LFGauss.kr(mod_freq.reciprocal, 0.3);\n Out.ar(out, (sig/8)!2 * Linen.kr(Impulse.kr(0), atk_dur, 1, release, doneAction:2)) \n}).add;\n\nSynthDef(\\dubecho,{|in, out, length = 1, fb = 0.8, sep = 0.012|\n var input = In.ar(in, 2);\n var feedback = LocalIn.ar(2);\n var output = LeakDC.ar(feedback*fb + input);\n output = HPF.ar(output, 400);\n output = LPF.ar(output, 12000);\n output = output.tanh;\n LocalOut.ar(DelayC.ar(output, 1, LFNoise2.ar(12).range([length,length+sep],[length+sep,length])).reverse);\n ReplaceOut.ar(out, output);\n}).add;\n);\n\n( \n~bus = Bus.audio(s, 2);\n~echo = Synth(\\dubecho, [\\in, ~bus, \\length, TempoClock.default.tempo*(3/8), \\fb, 0.25, \\sep, 0.0012], addAction: \\addToTail);\n\nPbind(*[ \n instrument: \\klang_blip, \n dur: Pwrand([0.25,0.5,1,0.125], [16,16,1,1].normalizeSum, inf), \n release: Pkey(\\dur),\n freq_mul: Pstutter(Pwrand([1,2,4],[5,3,2].normalizeSum,inf), Pxrand((1..6), inf)),\n freq1: Pstutter(Pxrand((2,4..16), inf), Prand((1..4), inf)), \n freq2: Pstutter(Pxrand((2,4..16), inf), Prand((4..8), inf)), \n freq3: Pstutter(Pxrand((2,4..16), inf), Prand((8..12), inf)),\n mod_freq: Pstutter(Pxrand((2,4..16), inf), Pbrown(7,30,3)),\n atk_dur: Pkey(\\freq_mul).linlin(12,2,0.01,0.4),\n out: ~bus,\n amp: Pstutter(Pxrand((2,4..16),inf), Pfunc({[2,3,4].normalizeSum.scramble}))\n]).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PatternConductor`."}, {"role": "assistant", "content": "```supercollider\n(\n// a pattern with long notes\np = Pbind(\n \\freq, Pwhite(0, log(32)).exp.round(1) * 36.midicps,\n \\detune, Pfunc({ |ev| ev[\\freq] * rand(0.01) }),\n \\sustain, Pwhite(log(0.1), log(20)).exp,\n \\dur, Prand([0.1, 0.1, 0.1, 0.1, 0.2, 1, 2], inf),\n \\db, Pstep(Pseq([-20, -30, -25, -30], inf), 0.2)\n);\n\n// unrelated cluster pattern running on TempoClock.default\nPbind(\\dur, 2, \\midinote, Pseq([(48..60)], 20), \\db, -30).play;\n\n// make a conductor\na = PatternConductor(p, quant: 2);\na.play;\n);\n\n\n// now try some interactive control options line by line:\na.quant = 0;\na.pause;\na.resume;\na.stop;\na.play;\na.pause;\na.play;\na.stop(1000);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Function`."}, {"role": "assistant", "content": "```supercollider\n(\nEnvironment.use({\n~a = 3;\n~b = 10;\n{ |a, b| (a * b).postln }.valueEnvir;\n});\n);\n\n// or syntactically shorter using an Event:\n\n(a:3, b:10).use { { |a, b| (a * b).postln }.valueEnvir };\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Window.acceptsClickThrough` do? What arguments does it take?"}, {"role": "assistant", "content": "Whether the window receives clicks when it is not front-most. The default is Arguments: A Boolean.."}]} -{"conversations": [{"role": "user", "content": "What does `LinkClock.latency` do? What arguments does it take?"}, {"role": "assistant", "content": "Gets or sets the number of seconds of OSC messaging latency for which the `LinkClock` should account. In general, this should be set to match the server object's Arguments: lat — A Float.."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes sound of an alien weapon firing."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"raygun\", {arg amp = 0.5, sinfreq = 1000, glissf = 0.001, att = 0.01, rel = 0.9;\n var gliss = XLine.kr(sinfreq, sinfreq*glissf, rel);\n var snd = SinOsc.ar(gliss);\n var env = EnvGen.kr(Env.perc(att, rel), doneAction: 2);\n snd = snd * env * amp;\n Out.ar(0, snd);\n}).add;\n);\n\n(\nPbind(\n \\instrument, \"raygun\",\n \\dur, Pseq([0.75,0.75,0.75,0.75,0.25,0.25,0.25]*0.5, inf),\n \\amp, 0.4\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n//Can be very noisy, high pitched and aliases badly: e.g., great fun, but watch out for your ears, filter, try out odd param settings. I've turned all the amplitudes down in the following\n\n\n//defaults, high pitched! WARNING\n{Out.ar(0,Pan2.ar(0.1*DoubleWell.ar(Impulse.kr(0),MouseX.kr(0.01,1,'exponential'),MouseY.kr(0.01,1,'exponential'),0.9,0.0001,0.25,LFNoise0.kr(1,0.4,0.5),LFNoise0.kr(1,0.4,0.5)),0.0))}.play\n\n\n//2 per second\n(\n{Out.ar(0,\n// …\n```"}, {"role": "assistant", "content": "Can be very noisy, high pitched and aliases badly: e.g., great fun, but watch out for your ears, filter, try out odd param settings. I've turned all the amplitudes down in the following defaults, high pitched! WARNING (DoubleWell: Forced DoubleWell Oscillator)"}]} -{"conversations": [{"role": "user", "content": "Explain `SelectX` in SuperCollider briefly."}, {"role": "assistant", "content": "SelectX — Mix one output from many sources The output is mixed from an array of inputs, performing an equal power crossfade between two adjacent channels. Category: UGens > Multichannel > Select."}]} -{"conversations": [{"role": "user", "content": "What does `KeyCodeResponder.controlModifier` do?"}, {"role": "assistant", "content": "register responder functions for keycode and modifier combinations"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Red alert."}, {"role": "assistant", "content": "```supercollider\n//Fig 58.7: Red alert\n//Complete patch, saw + second harmonic, resonators, distortion and post filters to create \n//fixed resonance. Contains the subpatch shown in fig 58.6.\n\n(\n SynthDef(\\red, {\n \n var env, redAlert, dfbe, aIn, bIn, cIn, aOut, bOut, cOut;\n \n # aIn, bIn, cIn = LocalIn.ar(7).clumps([5,1,1]);\n \n env = [\n EnvGen.ar(Env.new([0,1,1,0], [0.9, 0.3, 0.0])), \n EnvGen.ar(Env.new([0,1,1,0], [0.01, 0.88, 0.01]))\n ];\n env[0] = LFSaw.ar(env[0].sqrt * 487 + 360, 1, 0.5, 0.5);\n env[0] = (env[0] - 0.5) + ((env[0] * 2 * 2pi).cos * 0.3);\n redAlert = (env[0] - OnePole.ar(env[0], exp(-2pi * (1 * SampleDur.ir)))) * env[1];\n redAlert = redAlert + (cIn * 0.006) * 0.2;\n \n \n // fig 58.6: Delay feedback element\n dfbe = 0!6;\n redAlert = redAlert + (aIn * 0.7);\n 5.do{|i| dfbe[i] = DelayN.ar(redAlert[i], 0.1, [0.015, 0.022, 0.035, 0.024, 0.011][i])};\n aOut = dfbe[0..4]; \n \n redAlert = redAlert[0..4].sum;\n redAlert = (redAlert - OnePole.ar(redAlert, exp(-2pi * (12 * SampleDur.ir))));\n \n dfbe[5] = redAlert + (bIn * 0.7);\n dfbe[5] = DelayN.ar(dfbe[5], 0.1, 0.061);\n # bOut, cOut = dfbe[5]!2;\n LocalOut.ar(aOut ++ bOut ++ cOut);\n \n redAlert = Clip.ar(redAlert * 4, -1, 1);\n redAlert = BPF.ar(redAlert, [740, 1400, 1500, 1600], (12!4).reciprocal) ++ (redAlert * 0.5);\n Out.ar(0, (redAlert.sum * 0.2)!2);\n \n}).add;\n);\n \n// ALL HANDS!! BATTLESTATIONS!\ne = Synth(\\red);\n\n\n\n// code also available here: \n// http://en.wikibooks.org/wiki/Designing_Sound_in_SuperCollider/Red_alert\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Algorithmic melancholy (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nvar n = 20, baseFreq = 45.midicps;\nvar lsin, rsin, arg1, arg2, sig;\nvar bus, busIndex, scale, freq, freqIndex, amp;\nvar responder;\n\nscale = Scale.nikriz.ratios * baseFreq;\n\nbus = Bus.control( s, 2 * n );\nbus.setn( { 1.0.rand2 } ! ( 2 * n ) );\nbusIndex = bus.index;\n\nfreq = Bus.control( s, n );\nfreqIndex = freq.index;\n\nresponder = OSCFunc({ | id |\n freq.setAt( id[2] , scale.choose * 1.rrand( 3 ) );\n},'/tr', s.addr);\n\nCmdPeriod.doOnce { [ bus, freq, responder ].free; };\n\nn.do {|i|\n freq.setn( { scale.choose * rrand( 1, 3) } ! n );\n {\n #arg1, arg2 = In.kr( 2 * i + busIndex, 2 );\n\n #lsin, rsin = SinOsc.kr( [ arg1, arg2 ], { 2.0.rrand(20.0) } ! 2 * [ arg2, arg1 ] ); \n\n sig = Formant.ar( \n LFNoise0.kr( 0.05, 2.5, 7) * arg1, \n arg2,\n 500.0.rrand(700) \n );\n\n ReplaceOut.kr( 2 * i + busIndex, [ rsin, lsin ] );\n\n sig = Pluck.ar( \n BrownNoise.ar(0.5), \n sig, \n 0.025, \n freq.kr( 1, i ).reciprocal, \n 3.7\n ) * 0.6;\n\n amp = Line.kr( dur: rrand( 1.0, 20.0) ) * max( 0, LFNoise1.kr( 0.05, 0.6, 0.4 ) ) ;\n sig = sig * amp;\n SendTrig.kr( amp <= 0, i, i );\n\n Pan2.ar( sig, 0.8.rand2 )\n }.play\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "I get 'Message not understood' on a nil variable."}, {"role": "assistant", "content": "`~buffer` (or any variable) was never assigned, or it was assigned in a different environment. Environment variables are per-environment: a `~buf` set in one server-side file block is not visible in another. Check with `~buf.postln` before using it. The other common cause is an assignment that failed silently, e.g. `~buf = Buffer.read(...)` where the file was missing — the error is posted but ~buf stays nil."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Gbman2DN.ar(MouseX.kr(20, SampleRate.ir*0.25), MouseX.kr(80, SampleRate.ir), 0.1) }.play(s);\n\n{ Gbman2DN.ar(11025, 22050, -0.7, -2.7, 0.1) }.play(s);\n\n{ Gbman2DN.ar(2200, 8800, 1.2, 2.0002, 0.1) }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Gbman2DN.ar(MouseX.kr(20, SampleRate.ir*0.25), MouseX.kr(80, SampleRate.ir), 0.1) }.play(s);\n\n{ Gbman2DN.ar(11025, 22050, -0.7, -2.7, 0.1) }.play(s);\n\n{ Gbman2DN.ar(2200, 8800, 1.2, 2.0002, 0.1) }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "How big are you?"}, {"role": "assistant", "content": "198M parameters in total, 64M active per token because the feed-forward layers are a mixture of four experts with top-1 routing. That is small enough to train in minutes on one GPU."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n(\n// PLseq not used as proxy, only taken as it defaults to repeats = inf\n\np = Pbind(\n \\midinote, PLseq([PLser(\\a, \\r), 60, 61]),\n \\dur, 0.2\n);\n\n// prepare current Environment\n\n~a = (67..70);\n~r = 6;\n);\n\nx = p.play;\n\n\n// replace repeats\n\n~r = 3;\n\n\n// replace array elements\n\n~a[0] = [77, 93.5];\n\n~a[2] = Pseq((94..96));\n\n\n// replace whole array\n\n~a = [55, 52];\n\nx.stop;\n// …\n```"}, {"role": "assistant", "content": "PLseq not used as proxy, only taken as it defaults to repeats = inf prepare current Environment (PLser: dynamic scope Pser variant)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// the following two lines produce equivalent results\n{ SinOsc.ar(440, 0, 0.3) }.play(fadeTime: 0.0);\nSynthDef(\\help_FuncPlay, { Out.ar(0, SinOsc.ar(440, 0, 0.3)) }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// the following two lines produce equivalent results\n{ SinOsc.ar(440, 0, 0.3) }.play(fadeTime: 0.0);\nSynthDef(\\help_FuncPlay, { Out.ar(0, SinOsc.ar(440, 0, 0.3)) }).play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pgtpar`."}, {"role": "assistant", "content": "```supercollider\n// synthdef\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n}).add;\n);\n\n// pattern with different start times\n(\nx = Pbind(\n \\instrument, \\help_sinegrain,\n \\degree, Pseq(#[0, 5, 4, 2, 1, 1, 3], inf),\n \\dur, Pseq(#[0.25, 0.5, 1.0], inf),\n \\scale, #[0, 3, 5, 9, 10]\n);\na = Pbus(Pgtpar([0.0, x, 1.5, x, 2.25, x])).play;\n);\ns.plotTree;\na.stop;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nNdef(\\nodeTest, {\n // the input\n var input = Impulse.ar([1, 3, 5].reciprocal, phase: [0, 0.133, 0.5]).sum;\n\n // the nodes, each takes its predecessor as input and estimates the duration between two events. \n // Unfortunately, the starting point of Timer is '0' which we have to put into reasonable limits. System settles after about 15 seconds\n var nodes = (1..10).inject([input], {|last, item| \n [TDuty.ar(max(0.25, Timer.ar(last.first)), 0, 1)] ++ last\n });\n\n // add a pitch to each\n nodes = nodes.collect{|node, i| SinOsc.ar((4000 + (i*500))) * Decay2.ar(node, 0.01, 0.2)};\n\n // splay in stereo field\n Splay.ar(nodes);\n\n}).play\n)\n```"}, {"role": "assistant", "content": "Idea: network of loosely connected nodes. Each node has a dedicated pulse rate / phase. Inducing an irregular trigger signal influences the nodes to (gradually) adapt their pulsation freq (and phase?) to the one of the input.\r\nsound example: https://soundcloud.com/lfsaw/sync-weakconnection-tduty-time."}]} +{"conversations": [{"role": "user", "content": "What does `NodeProxy.controlNames` do?"}, {"role": "assistant", "content": "Returns the ControlName objects of all slots, except the names of this list (default: `[\\out, \\i_out, \\gate, \\fadeTime]`, which are used internally). When the node proxy received a `set` for a given key, the `defaultValue` of the corresponding `ControlName` contains the object that was passed, which might be any object"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// a Function passed to loopFunc is applied to all items of the looping\n\n(\n~lookBack = 0;\n\np = Pbind(\n \\dur, Pn(Pshuf([1, 1, 2]/6)),\n \\midinote, PSloop(\n Prand((60..80), inf),\n bufSize: 10,\n lookBack: { ~lookBack },\n loopFunc: { |x| x + [0, 5] }\n )\n).play\n);\n\n// wait a bit to fill buffer\n// loop with Function applied\n\n~lookBack = 3\n\n~lookBack = 6\n\n\n// go on and stop\n\n~lookBack = 0\n\np.stop\n```"}, {"role": "assistant", "content": "a Function passed to loopFunc is applied to all items of the looping wait a bit to fill buffer (PSloop: Pattern to derive loops from a given Pattern)"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LinRand`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-LinRand\", { |out = 0, minmax = 1|\n Out.ar(out,\n FSinOsc.ar(\n LinRand(200.0, 10000.0, minmax),\n 0, Line.kr(0.2, 0, 0.01, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n// towards hi\n(\nRoutine({\n loop({\n Synth.new(\"help-LinRand\"); 0.04.wait;\n })\n}).play;\n);\n\n// towards lo (doesn't work like that yet)\n(\nRoutine({\n loop({\n Synth.new(\"help-LinRand\", [\\minmax, -1]); 0.04.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Compander` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var z;\n\n // signal (clean)\n z = Decay2.ar(\n Impulse.ar(8, 0, LFSaw.kr(0.3, 1, -0.3, 0.3)),\n 0.001,\n 0.3\n )\n * Mix.ar(Pulse.ar([80, 81], 0.3));\n\n // apply gate (mouse x sets treshold)\n Compander.ar(z, z,\n thresh: MouseX.kr(0.001, 1),\n slopeBelow: 10,\n slopeAbove: 1,\n clampTime: 0.01,\n relaxTime: 0.01\n )\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Osc`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\ns = Server.local;\nb = Buffer.alloc(s, 512, 1);\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, true, true);\n\nSynthDef(\"help-Osc\", { |out = 0, bufnum = 0|\n Out.ar(out,\n Osc.ar(bufnum, 200, 0, 0.5)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n);\n\n(\ns = Server.local;\nb = Buffer.alloc(s, 512, 1);\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, true, true);\n\nSynthDef(\"help-Osc\", { |out = 0, bufnum = 0|\n Out.ar(out,\n Osc.ar(bufnum, XLine.kr(2000, 200), 0, 0.5) // modulate freq\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n);\n\n\n(\ns = Server.local;\nb = Buffer.alloc(s, 512, 1);\nb.sine1([1.0], true, true, true);\n\nSynthDef(\"help-Osc\", { |out = 0, bufnum = 0|\n Out.ar(out,\n Osc.ar(bufnum,\n Osc.ar(bufnum,\n XLine.kr(1, 1000, 9),\n 0,\n 200,\n 800),\n 0,\n 0.25)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n);\n\n\n(\n// modulate phase\ns = Server.local;\nb = Buffer.alloc(s, 512, 1);\nb.sine1([1.0], true, true, true);\n\nSynthDef(\"help-Osc\", { |out = 0, bufnum = 0|\n Out.ar(out,\n Osc.ar(bufnum,\n 800,\n Osc.ar(bufnum,\n XLine.kr(20, 8000, 10),\n 0,\n 2pi),\n 0.25)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n);\n\n\n\n(\n// change the buffer while its playing\ns = Server.local;\nb = Buffer.alloc(s, 4096, 1);\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, true, true);\n\nSynthDef(\"help-Osc\", { |out = 0, bufnum = 0|\n Out.ar(out,\n Osc.ar(bufnum, [80, 80.2], 0, 0.2)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n);\n\n(\nfork {\n var n = 32;\n 50.do {\n b.sine1(Array.rand(n, 0, 1).cubed, true, true, true);\n 0.25.wait;\n };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "What does `Integer.wrap` do? What arguments does it take?"}, {"role": "assistant", "content": "Wrap this around [lo, hi] such that it falls in range. Equivalent to (this % (hi - lo + 1)) + lo. Note that this behavior is different from Arguments: lo — The low threshold (inclusive) of wrapping.; hi — The high threshold (inclusive) of wrapping.."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pbind`."}, {"role": "assistant", "content": "```supercollider\nPbind(\\note, Pseq([0, 4, 7]), \\amp, 0.1, \\dur, 0.2).play\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes farfisa organ like sound."}, {"role": "assistant", "content": "```supercollider\n// define the violin-like sound synth\n(\nSynthDef(\\violin, {\n | midinote=60, gate=1, amp=0.25 |\n var env = EnvGen.kr(Env.asr(0.1, 1, 0.1), gate, doneAction:2);\n var sig = VarSaw.ar(\n midinote.midicps,\n width:LFNoise2.kr(1).range(0.2, 0.8)*SinOsc.kr(5, Rand(0.0, 1.0)).range(0.7,0.8))*0.25;\n sig = sig * env * amp;\n Out.ar(0, sig!2);\n}).add;\n);\n\n\n// play a chord (farfisa-like sound)\n(\n[60, 64, 67].do ({\n | note |\n Synth(\\violin, [\\midinote, note]);\n})\n);\n\n// play a single note (it seems also a flute!)\nx = Synth(\\violin, [\\midinote, 84]);\nx.set(\\gate, 0); // stop the note\n\n\n// play some random notes\n(\np = Pbind(\n \\instrument, \\violin,\n \\midinote, Prand( Scale.majorPentatonic.degrees, inf) + 60,\n \\dur, 3,\n \\legato, 1\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Formant.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Formant oscillator Arguments: fundfreq — Fundamental frequency in Hertz. (control rate); formfreq — Formant frequency in Hertz. (control rate); bwfreq — Pulse width frequency in Hertz. Controls the bandwidth of the formant. (control rate) Must be greater than or equal to `fundfreq`.; mul; add."}]} -{"conversations": [{"role": "user", "content": "What can you do?"}, {"role": "assistant", "content": "Write and explain SuperCollider: SynthDefs, UGens, Patterns, Ndef, buses and envelopes, and tell you why a patch is silent or will not compile. I am 198M parameters, so I am narrow on purpose."}]} -{"conversations": [{"role": "user", "content": "What does `OpenBCIboard.on` do? What arguments does it take?"}, {"role": "assistant", "content": "turn on (unmute) one ore more Arguments: channel — can be an Integer or an Array of Integers. `c.on(1) //turn on the first channel`."}]} -{"conversations": [{"role": "user", "content": "What does `Synth.replace` do?"}, {"role": "assistant", "content": "Create and return a Synth and use it to replace `nodeToReplace`, taking its place in its server's node"}]} -{"conversations": [{"role": "user", "content": "What does `EaseInOutAtan.value` do? What arguments does it take?"}, {"role": "assistant", "content": "Atan ease-in/out Arguments: t — a Float between 0.0 and 1.0.; a — overshoot. The default is 15.."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Variations for Z1 sawtooth."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var mod = SinOsc.ar([0.1,0.15,0.2]).range(0,1);\n var saw = LFSaw.ar([10,12,15]);\n var out = (saw - ((saw>0)*mod)+(mod*0.5));\n Splay.ar(out)*0.4;\n}.play;\n\n{\n var mod = SinOsc.ar([0.1,0.15,0.2]).range(0,1);\n var saw = SinOsc.ar(LFSaw.ar([10,12,15]).range(200,300));\n var out = (saw - ((saw>0)*mod)+(mod*0.5));\n Splay.ar(out)*0.4;\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\nb = Buffer.read(s, ExampleFiles.child);\n\n(\nSynthDef(\"help-binWipe\", { |out = 0|\n var inA, chainA, inB, chainB, chain;\n inA = WhiteNoise.ar(0.2);\n inB = LFSaw.ar(100, 0, 0.2);\n chainA = FFT(LocalBuf(2048), inA);\n chainB = FFT(LocalBuf(2048), inB);\n chain = PV_BinWipe(chainA, chainB, MouseX.kr(-1, 1));\n Out.ar(out, 0.1 * IFFT(chain).dup);\n}).play(s);\n);\n\n(\nSynthDef(\"help-binWipe2\", { |out = 0, sound\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\nb = Buffer.read(s, ExampleFiles.child);\n\n(\nSynthDef(\"help-binWipe\", { |out = 0|\n var inA, chainA, inB, chainB, chain;\n inA = WhiteNoise.ar(0.2);\n inB = LFSaw.ar(100, 0, 0.2);\n chainA = FFT(LocalBuf(2048), inA);\n chainB = FFT(LocalBuf(2048), inB);\n chain = PV_BinWipe(chainA, chainB, MouseX.kr(-1, 1));\n Out.ar(out, 0.1 * IFFT(chain).dup);\n}).play(s);\n);\n\n(\nSynthDef(\"help-binWipe2\", { |out = 0, soundBufnum = 2|\n var inA, chainA, inB, chainB, chain;\n inA = WhiteNoise.ar(0.2);\n inB = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);\n chainA = FFT(LocalBuf(2048), inA);\n chainB = FFT(LocalBuf(2048), inB);\n chain = PV_BinWipe(chainA, chainB, MouseX.kr(-1, 1));\n Out.ar(out, 0.1 * IFFT(chain).dup);\n}).play(s, [\\soundBufnum, b]);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Who made you?"}, {"role": "assistant", "content": "I was trained by the person who runs this project, on top of the MiniMind architecture. My weights started from random numbers and learned from the SuperCollider sources — no teacher model, no distillation."}]} -{"conversations": [{"role": "user", "content": "What does `LinearSpline.createPoint` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a new point, inserting it in the points Arguments: p — The point, either as a Point object or as an array.; i — The point index to insert the point at. Note that the subsequent points are moved along the spline's point array but their values are not changed.."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Change arg values of MIDIdef after instantiation."}, {"role": "assistant", "content": "```supercollider\n~mdef =\n{\n |key, func, msgNum, permanent = true|\n\n MIDIdef(key, func ?? { MIDIdef(key).func }, msgNum ? MIDIdef(key).msgNum, MIDIdef(key).chan, MIDIdef(key).msgType, MIDIdef(key).srcID).permanent_(permanent)\n}\n```"}]} -{"conversations": [{"role": "user", "content": "Rand or rand difference?"}, {"role": "assistant", "content": "SuperCollider forum — Rand or rand difference?\n\nI think you meant to compare Rand and rrand (not rand) – both generate a random number between a given low and high, but Rand is intended to be used inside a SynthDef and the behavior is slightly different. Compare:\n\n```supercollider\n(\nSynthDef(\\test, {\n var freq = rrand(400, 600);\n Out.ar(0, SinOsc.ar(freq) * 0.2);\n}).add;\n);\n\nSynth(\\test); // run and stop multiple times: always same freq\n\n(\nSynthDef(\\test2, {\n var freq = Rand(400, 600);\n Out.ar(0, SinOsc.ar(freq) * 0.2);\n}).add;\n);\n\nSynth(\\test2); // run and stop multiple times: every time a different freq\n```\n\nAs you can read in the help file, Rand is intended to be used inside SynthDefs when you want the particular behavior of a newly generated random frequency for each Synth called. You can use rrand(lo, hi) inside a SynthDef too, if you want the random number to be generated only once at time of SynthDef creation (it gets “inscribed in the recipe” for good), so all future and all Synth calls based on that SynthDef to use on that same random number.\n\nAs a side note, rand (as opposed to rrand) generates a random number between zero and the receiver:\n\n```supercollider\nrand(8); // random numbers between 0 and and 8 (excluding 8)\n\nrand(0.5, 8); // random numbers between 0 and 0.5; second argument is ignored here\n```\n\nAlso in regards to the specific way you present the example (as Functions, indicated by the curly braces): note the difference when you evaluate them:\n\n```supercollider\n{Rand(0.5,8)}.value; // returns 'a Rand'\n{rrand(0.5,8)}.value; // returns an actual random choice between lo and hi\n```\n\nHope this helps,\n\nB"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a, b;\na = Paddpre(\\legato, Pseq([0.2, 0.4], 2), Pbind(\\dur, 0.5));\nx = a.asStream;\n9.do({ x.next(Event.default).postln });\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a, b;\na = Paddpre(\\legato, Pseq([0.2, 0.4], 2), Pbind(\\dur, 0.5));\nx = a.asStream;\n9.do({ x.next(Event.default).postln });\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\nk = 5;\n~ndims = 1;\nb = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n~kbuf = Buffer.alloc(s, k, ~ndims+1)\n\n(\nx = {\n var sig, chain, chaintrig, features, kbuf, classif, centroid, resynth;\n\n // sig = AudioIn.ar;\n sig = PlayBuf.ar(1, b, loop: 1);\n chain = FFT(LocalBuf(512), sig);\n chaintrig = chain > -0.001;\n\n features = [SpecCentroid.kr(chain)]; // just one 1D feature here\n classif = KMeansRT.kr(~kbuf, features\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\nk = 5;\n~ndims = 1;\nb = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n~kbuf = Buffer.alloc(s, k, ~ndims+1)\n\n(\nx = {\n var sig, chain, chaintrig, features, kbuf, classif, centroid, resynth;\n\n // sig = AudioIn.ar;\n sig = PlayBuf.ar(1, b, loop: 1);\n chain = FFT(LocalBuf(512), sig);\n chaintrig = chain > -0.001;\n\n features = [SpecCentroid.kr(chain)]; // just one 1D feature here\n classif = KMeansRT.kr(~kbuf, features, k, chaintrig);\n classif.poll(chaintrig);\n\n // Now we read the centroid position back out of the buffer and sonify\n centroid = KMeansRT.getCentroid(~kbuf, classif, ~ndims).at(0);\n\n resynth = SinOsc.ar(centroid, 0, 0.1);\n [sig, resynth]\n}.play\n);\n\nx.free\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// default params\n{ QuadL.ar(SampleRate.ir/4) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// default params\n{ QuadL.ar(SampleRate.ir/4) * 0.2 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes an experiment with roots of unity in supercollider."}, {"role": "assistant", "content": "```supercollider\n(\n\n~divisors = {\n arg n;\n ~divs = List.newClear(0);\n for( 1, floor(sqrt(n)), {arg i; if(n%i==0,{\n //i.postln;\n ~divs.add(i);\n // (i==n.div(i)).postln;\n if(i==n.div(i),{},{~divs.add(n.div(i))});\n },{});\n });\n ~divs.sort;\n ~divs;\n};\n\n\nSynthDef(\\rootsOfUnitySum, { |out=0,freq=1,amp=1,n=1,ks=#[1]|\n var l,sigl,sigr,env;\n\n\n sigl = SinOsc.ar(freq:0,mul:0);\n sigr = SinOsc.ar(freq:0,mul:0);\n ks.do({arg item,i;\n k = item;\n sigr = sigr+SinOsc.ar(freq:freq*2pi*k/n,mul:amp,phase:0.5*pi);\n sigl = sigl+SinOsc.ar(freq:freq*2pi*k/n,mul:amp);\n });\n env = EnvGen.kr(Env.linen(attackTime: 0.001, sustainTime: 1, releaseTime: 0.01, level: 1.0, curve: 'lin'), doneAction: Done.freeSelf);\n sigr = sigr*env;\n sigl = sigl*env;\n\n Out.ar(out, [sigl,sigr])\n}).add;\n\n\n~getPbind = { arg n, amps, durs, freq;\n ~nums = ~divisors.value(n);\n r = Pbind(\\instrument,\\rootsOfUnitySum,\n \\amp,amps,\n \\dur,durs,\n \\freq,freq,\n \\n,Pseq([n],~nums.size),\n \\ks , Pseq(all{:~divisors.value(n),n<-~nums},1)).trace();\n r\n};\n\n~seq = (1..13);\n~tau = all{:~divisors.value(n).size,n<-~seq};\n\n\n~r = Pseq(all{:~getPbind.value(\n n:n,\n amps:Pseq(all{:0.5/t,t<-~tau},1),\n durs:Pseq(all{:0.3333/t,t<-~tau},1),\n freq:220/3),n<-~seq},1);\n\n~s = Pseq(all{:~getPbind.value(\n n:n,\n amps:Pseq(all{:0.5/t,t<-~tau},1),\n durs:Pseq(all{:0.5/t,t<-~tau},1),\n freq:110),n<-~seq},1);\n\n~t = Pseq(all{:~getPbind.value(\n n:n,\n amps:Pseq(all{:0.5/t,t<-~tau},1),\n durs:Pseq(all{:1/t,t<-~tau},1),\n freq:220),n<-~seq},1);\n\n~x = Pseq([\n Ppar([~t],1),\n Ppar([~s],1),\n Ppar([~s,~t],1),\n Ppar([~r],1),\n Ppar([~r,~t],1),\n Ppar([~r,~s],1),\n Ppar([~r,~s,~t],1),\n ],inf);\n\n);\n\nPdef(\\mplayer, ~x).clock_(TempoClock(100/60)).play;\nPdef(\\mplayer, Pn(Event.silent)).fadeTime_(8);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `FOS`."}, {"role": "assistant", "content": "```supercollider\n(\n// same as OnePole\n{ var x;\n x = LFTri.ar(0.4, 0, 0.99);\n FOS.ar(LFSaw.ar(200, 0, 0.2), 1 - x.abs, 0.0, x)\n}.play;\n);\n\n(\n// same as OneZero\n{ var x;\n x = LFTri.ar(0.4, 0, 0.99);\n FOS.ar(LFSaw.ar(200, 0, 0.2), 1 - x.abs, x, 0.0)\n}.play;\n);\n\n(\n// same as OnePole, kr\n{ var x, ctl;\n x = LFTri.kr(0.2, 0, 0.99);\n ctl = FOS.kr(LFSaw.kr(8, 0, 0.2), 1 - x.abs, 0.0, x);\n LFTri.ar(ctl * 200 + 500);\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Seekers are something you should avoid?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n var time = 0.23;\n var freq = (55).midicps;\n var a = VarSaw.ar(freq/2, width: XLine.ar(0.5,1,time)).range(0,XLine.ar(0.666,1/666,time));\n var tone = SinOsc.ar(freq).fold(-0.23*a,a) * EnvGen.ar(Env([1,0],[time]));\n Out.ar(0, tone.dup);\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for first step?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n\nz = ( ( SinOsc.ar( ((LFSaw.kr(-0.05,1) +1) *100 + 20 ), LFTri.kr(40,0,1), LFSaw.kr(1.5) ) \n * LFTri.kr(rrand(0.005,0.03),3.99.rand,0.2) ) + \n( LFPulse.ar(60,0,0.5,Pulse.ar(0.5,0.5,0.1)) * LFTri.kr(rrand(0.005,0.03),3.99.rand,0.5) ) +\n( SinOsc.ar(65,0,LFPulse.kr(0.66666,0.5,0.3)*0.3) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) )+\n( LFPar.ar(120,0,LFPulse.kr(0.5,0.5,0.2)*0.3) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( LFCub.ar(185,0,LFPulse.kr(0.5,0.74,0.2)*0.3) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( SinOsc.ar(365,0,LFPulse.kr(1.33333333,0,0.1)*0.3) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( FreeVerb.ar(LFTri.ar(260,0,LFPulse.kr(0.5,0.25,0.01)*0.3),0.5,0.8,0.1) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( SinOsc.ar(800,0,LFPulse.kr(2,0,0.1)*0.1) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( LFPar.ar(820,0,LFPulse.kr(1.666666,0,0.1)*0.1) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( WhiteNoise.ar( LFPulse.kr(2,0.5,0.001,1) )/2 * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( WhiteNoise.ar( LFPulse.kr(1,0.5,0.001,1) )/2 * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( WhiteNoise.ar( LFPulse.kr(1.666666,0.5,0.001,1) )/4 * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( WhiteNoise.ar( LFPulse.kr(1.333333,0.5,0.001,1) )/4 * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) );\n\nFreeVerb.ar(\n ((CombC.ar(\n DelayN.ar(\n DelayN.ar(z, 0.5, [0.5,0.75], 1, z), \n 0.5, 0.5, 1, z), \n 0.1, LFNoise0.kr(1,0.05,0.001).abs, 2, z))+z),\n0.1,1,0.1); \n\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Dxrand`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a, freq, trig;\n a = Dxrand([1, 3, 2, 7, 8], inf);\n trig = Impulse.kr(MouseX.kr(1, 400, 1));\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Trig` in SuperCollider?"}, {"role": "assistant", "content": "Trig — Timed trigger. When a nonpositive to positive transition occurs at the input, Trig outputs the level of the triggering input for the specified duration, otherwise it outputs zero. Category: UGens > Triggers."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for smooth arpeggio, updated envelope (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\bass, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.perc(0.2), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var trig = Dust.kr(10);\n SinOsc.ar(\n TBetaRand.kr(300, 3000, 0.1, 0.1, trig)\n ) * 0.1\n}.play;\n);\n\n(\n{\n var trig, prob1, prob2;\n trig = Dust.kr(10);\n prob1 = MouseX.kr(1, 5);\n prob2 = MouseY.kr(1, 5);\n SinOsc.ar(\n TBetaRand.kr(300, 3000, prob1, prob2, trig)\n ) * 0.1\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var trig = Dust.kr(10);\n SinOsc.ar(\n TBetaRand.kr(300, 3000, 0.1, 0.1, trig)\n ) * 0.1\n}.play;\n);\n\n(\n{\n var trig, prob1, prob2;\n trig = Dust.kr(10);\n prob1 = MouseX.kr(1, 5);\n prob2 = MouseY.kr(1, 5);\n SinOsc.ar(\n TBetaRand.kr(300, 3000, prob1, prob2, trig)\n ) * 0.1\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Dser`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a, freq, trig;\n a = Dser([1, 3, 2, 7, 8], 8);\n trig = Impulse.kr(MouseX.kr(1, 40, 1));\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a, b;\na = Pfindur(5, Pbind(\\dur, Prand([1, 2, 0.5, 0.1], inf)));\nx = a.asStream;\n9.do({ x.next(Event.default).postln });\n);\n\n\n(\nvar a, b;\na = Pfindur(5, Pbind(\\dur, Prand([1, 2, 0.5, 0.1], 4)));\nx = a.asStream;\n9.do({ x.next(Event.default).postln });\n);\n\n\n// Pfindur used as a sequence of pitches\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a, b;\na = Pfindur(5, Pbind(\\dur, Prand([1, 2, 0.5, 0.1], inf)));\nx = a.asStream;\n9.do({ x.next(Event.default).postln });\n);\n\n\n(\nvar a, b;\na = Pfindur(5, Pbind(\\dur, Prand([1, 2, 0.5, 0.1], 4)));\nx = a.asStream;\n9.do({ x.next(Event.default).postln });\n);\n\n\n// Pfindur used as a sequence of pitches\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\nvar c;\nc = Pbind(\n \\dur, Prand([1, 0.02, 0.2], inf),\n \\instrument, \\help_sinegrain,\n \\degree, Pseries(0, 1, inf),\n \\octave, 6\n);\n\nPn(\n Pfindur(1, c)\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes SOUND 1, from orig Influx Example."}, {"role": "assistant", "content": "```supercollider\n// SOUND 1, from orig Influx Example\n(\nNdef(\\dog).addSpec(\\intv, [-24, 24]);\nNdef(\\dog).addSpec(\\timescale, [0.01, 10, \\exp]);\nNdef(\\dog).addSpec(\\curve, [-10, 10]);\nNdef(\\dog).addSpec(\\ffreq, \\freq);\n\nNdef(\\dog).addSpec(\\loopnode, [0, 12]);\nNdef(\\dog).addSpec(\\dens, [10, 1000]);\nNdef(\\dog).addSpec(\\resfreq, \\freq);\nNdef(\\dog).addSpec(\\ringtime, [0.01, 1, \\exp]);\n\nNdef(\\dog, { |amp, freq=250, intv=19, timescale=1, curve=0, loopnode=0, dens = 10, resfreq = 500, ringtime = 0.01|\n var n = 15;\n var env = EnvGen.kr(\n Env({ 1.0.rand2 }!(n+1), {1.0.rand}!n, curve, releaseNode: n-1, loopNode: loopnode.min(n-3)),\n timeScale: timescale);\n var pitch = (env * [1, 0.33, -1] * intv).midiratio * freq;\n var form = Formant.ar(pitch, pitch.rotate(1) * 1.6, pitch.rotate(2) * 2.6);\n\n var dusty = Ringz.ar(\n Dust.ar(dens!3), \n resfreq * LFNoise0.kr([3, 5, 7], 0.5, 1), \n ringtime) \n * ((dens ** -0.5) * (ringtime ** -0.3)\n );\n \n Splay.ar(form * dusty, level: amp) ;\n});\n);\n\nNdef(\\dog).addHalo(\\orderedNames, Ndef(\\dog).controlKeys);\n\n/*\nNdef(\\dog).controlKeys;\nNdef(\\dog).vol_(0.5);\nNdefPreset( Ndef(\\dog) ).loadSettings;\nNdef(\\dog).play;\nNdef(\\dog).gui;\n*/\n```"}]} -{"conversations": [{"role": "user", "content": "Synth Iteration Help?"}, {"role": "assistant", "content": "SuperCollider forum — Synth Iteration Help\n\n```supercollider\n(\nSynthDef (\\sine_tone) {\narg freq = 440, amp = 1, len = 1, bus = 0;\nvar sig, env;\nenv = Env.step ([ amp ], [ len ]);\nenv = EnvGen.kr (env, doneAction: 2);\nsig = SinOsc.ar (freq, 0, env);\nOut.ar (bus % 2, sig); // bus modulo 2 here to wrap to stereo\n}.add;\n)\n```\n\nmaybe try wrapping the bus array to [ 0, 1 ] by using modulo: bus % 2. this should let you hear what is going on using a stereo output\n\nby using a Pbind, each “note” is being instantiated as a separate synth with its own length, amplitude, frequency and bus. the doneAction: 2 argument in the EnvGen.kr ugen just means each synth will free itself once it is done playing the note it has been assigned."}]} -{"conversations": [{"role": "user", "content": "What is a UGen graph in SuperCollider?"}, {"role": "assistant", "content": "A UGen graph is the directed acyclic graph of unit generators that a SynthDef describes: sources (SinOsc, WhiteNoise) feed processors (LPF, EnvGen, Pan2) and end at an output such as Out.ar. The language builds the graph; the server instantiates it once per Synth. A signal path is drawn by passing one UGen's output as another's input, and because UGens are multi-channel by default, the same expression can build a stereo or 8-channel graph depending on the arrays inside it."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// check blockSize before (or reset blockSize in examples)\n\n(\nif (s.options.blockSize != 64) {\n s.options.blockSize = 64;\n s.quit.reboot;\n}\n);\n\n// func can take an index as third arg, it runs from 0 to blockSize - 1\n// this can be used to define the feedback relation depending on it\n\n// note that inDepth is set to [2, 1] as we look back to inSig[i-1] (in[1][0]),\n// but not to lfo[i-1] (in[0][1] == lfo[0]), this saves 128 UGens !\n\n\n(\nx = {\n var inSig = SinOsc.ar([50, 50.1]);\n var lfo = SinOsc\n// …\n```"}, {"role": "assistant", "content": "check blockSize before (or reset blockSize in examples) func can take an index as third arg, it runs from 0 to blockSize - 1 (Fb1: single sample feedback / feedforward pseudo ugen)"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes a Panthera Pardus meditates about his melanism."}, {"role": "assistant", "content": "```supercollider\n// a Panthera Pardus meditates about his melanism\n\n(\n~chrs = {|in, speed| DelayC.ar(in, 0.5, Array.fill(12, {|i| LFNoise2.ar(speed).range(0.022, 0.024);}).sum)};\n~phas = {|in, speed=1| var chain; chain = in+FreqShift.ar(in, 0, SinOsc.kr(speed).range(0, pi)).tanh; chain = chain + FreqShift.ar(chain, 0, SinOsc.kr(speed*0.97).range(0, pi)).tanh; chain=(chain*0.5).tanh; };\n~smear = {|in, bins=50| var chain; chain=FFT(LocalBuf(2048), in); chain=PV_MagSmear(chain, bins); chain=IFFT(chain)*0.5; };\n\nNdef.clear;\nNdef(\\pantheraPardus___).play;\nNdef(\\___hisInner).play;\nNdef(\\pantheraPardus___).fadeTime = 5;\nNdef(\\___hisInner).fadeTime = 50;\n\nNdef(\\pantheraPardus___, {arg amp=1;\n var sig, env, sig0, ctrl;\n ctrl = LFGauss.kr(5, 0.15);\n sig = (Saw.ar([LFNoise1.kr(1).range(15, 30), 0.025], 0.14)) * LFNoise2.kr(1).range(0.5, 1);\n sig = (sig + PinkNoise.ar(0.1) * LFNoise2.kr(1).range(0.1, 0.4)) * ctrl;\n sig = sig*0.25 + ~chrs.(~phas.(sig, [0.2, 0.174]), [0.1, 0.12]);\n sig = DynKlank.ar(`[[100, 200, 300, 1000, 4000, 9000], (ctrl.range(0.2/6, 1/6)*LFNoise2.kr(1).range(0.2, 1))!6, 0.025], sig*0.2);\n sig = ~smear.(sig, 5);\n sig = HPF.ar(LPF.ar(sig, (LFNoise2.kr(1.25).range(100, 2000))), 250); \n sig = Limiter.ar(GVerb.ar(Limiter.ar(sig), 4.5, 0.2, 0.9, 0.1), -6.dbamp)*15;\n});\n\nNdef(\\___hisInner, {arg amp=1;\n var sig = Saw.ar(Duty.kr(Dseq([2, 4, 1, 1/4, 8], inf), 0, Dseq([61+(1/6), [63+(3/6), 58+(3/6)], 64+(3/6)].midicps, inf)), 0.14);\n sig = LPF.ar(sig, LFNoise0.kr(15).range(5120, 9400).lag(0.001), 0.01);\n sig = DynKlank.ar(`[[100, LFNoise0.kr(2).range(300, 320), 4000], 1/3, 0.04], sig);\n sig = ~chrs.(~phas.(sig, [0.2, 0.174]), [0.1, 0.12]);\n sig = HPF.ar(LPF.ar(sig, 1200), 400)*15;\n sig = Limiter.ar(FreeVerb.ar(sig, [0.8, 0.78]), -6.dbamp);\n});\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n SinOsc.ar(\n RunningMax.ar(Dust.ar(20), Impulse.ar(0.4)) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// follow a sine lfo, reset rate controlled by mouse x\n(\n{\n SinOsc.ar(\n RunningMax.kr(SinOsc.kr(0.2), Impulse.kr(MouseX.kr(0.01, 2, 1))) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n SinOsc.ar(\n RunningMax.ar(Dust.ar(20), Impulse.ar(0.4)) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// follow a sine lfo, reset rate controlled by mouse x\n(\n{\n SinOsc.ar(\n RunningMax.kr(SinOsc.kr(0.2), Impulse.kr(MouseX.kr(0.01, 2, 1))) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "How do I play a sample from disk?"}, {"role": "assistant", "content": "Load it into a Buffer on the server, then play the buffer. `BufRateScale` keeps the pitch right when\nthe file's sample rate differs from the server's.\n\n```supercollider\n(\ns.waitForBoot {\n ~buf = Buffer.read(s, \"C:/sounds/break.wav\");\n SynthDef(\\player, { |out = 0, buf = 0, amp = 0.6, rate = 1|\n var sig = PlayBuf.ar(2, buf, BufRateScale.kr(buf) * rate, loop: 1);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n ~player = Synth(\\player, [\\buf, ~buf]);\n};\n)\n```\nUse `numChannels` 1 for a mono file; a mismatch is silent or wrong-sounding rather than an error."}]} -{"conversations": [{"role": "user", "content": "What does `EventPatternProxy.default` do?"}, {"role": "assistant", "content": "a default source, if none is given. the default is a Pbind with resting notes of 1.0 beat"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n‎{h={|f|1-LFTri.ar(f)};l={|s,e|Line.ar(s,e,1200,1,0,2)};FreeVerb.ar(h.(l.(147,5147))*h.(l.(1117,17))*h.(100)*h.([55,55.1])*0.05,0.7,1)}.play\n\n//Explanation of this piece - http://schemawound.com/post/40100438722/11-13-2012-tweet-explained\n```"}, {"role": "assistant", "content": "Explanation of this piece - http://schemawound.com/post/40100438722/11-13-2012-tweet-explained."}]} -{"conversations": [{"role": "user", "content": "Saving \"Presets\"?"}, {"role": "assistant", "content": "SuperCollider forum — Saving \"Presets\"?\n\nIf you don’t care too much about it being human readable, just use writeArchive and readArchive:\n\n```supercollider\na = Array.fill(400, {rrand(0,2200)});\n\na.writeArchive(\"/Users/spluta1/Documents/SC/test\");\n\nb = Object.readArchive(\"/Users/spluta1/Documents/SC/test\");\n\nb.postln;\n```\n\nSam"}]} -{"conversations": [{"role": "user", "content": "What does `QtGUI.debugLevel` do?"}, {"role": "assistant", "content": "Gets or sets the verbosity level for debug output from \"QtCollider\" code. SuperCollider must have been built in debug mode for messages to appear. Valid values are -1 (none), 0 (warnings only, default), 1 (most messages), and 2 (verbose). Values outside this range are effectively"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a, b;\na = Pser([1, 2, 3], 5); // return 5 items\nb = a.asStream;\n6.do({ b.next.postln });\n);\n\n// Pser used as a sequence of pitches:\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Pser([Pser(#[60, 61, 63, 65, 72], 3)], inf).asStream;\nRoutine({\n loop({\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a, b;\na = Pser([1, 2, 3], 5); // return 5 items\nb = a.asStream;\n6.do({ b.next.postln });\n);\n\n// Pser used as a sequence of pitches:\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Pser([Pser(#[60, 61, 63, 65, 72], 3)], inf).asStream;\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, a.next.midicps]);\n 0.2.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BufSamples`."}, {"role": "assistant", "content": "```supercollider\n// example; this buffer is mono, so the number of samples matches the number of frames\nb = Buffer.read(s, ExampleFiles.child);\n\n// indexing with a phasor\n{ BufRd.ar(1, b, Phasor.ar(0, BufRateScale.kr(b), 0, BufSamples.kr(b))) }.play;\n\n// indexing by hand\n{ BufRd.ar(1, b, K2A.ar(MouseX.kr(0, BufSamples.kr(b)))) }.play;\n\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Mx.updateVarPooling` do?"}, {"role": "assistant", "content": "set up parent chain of unit environments that participate in"}]} +{"conversations": [{"role": "user", "content": "What does `Patch.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Pairs an Instr with inputs that that will be passed to the Instr Arguments: name — The Instr can be specified as: an Instr name `(` a direct function that will be used to create an Instr in place `(` or directly pass an Instr object `(`; inputs — an array of arguments for the Instr function. Can also be a dictionary: (argName: value, ... ) `Patch({ arg freq,amp;`; outClass — default is Out.ar You could supply ReplaceOut to do effect processing on a Bus."}]} +{"conversations": [{"role": "user", "content": "What does `CountLimit.reset` do?"}, {"role": "assistant", "content": "Counts how many items have been presented to it. returns true until limit false thereafter"}]} +{"conversations": [{"role": "user", "content": "What does `UScoreEditor.trimEventsEndAtPos` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: events — (describe argument here). Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "What is `Synth`?"}, {"role": "assistant", "content": "Synth — Client-side representation of a synth node on the server"}, {"role": "user", "content": "What does `Synth.new` do?"}, {"role": "assistant", "content": "Create and return a new Synth object, and immediately start the corresponding synth node on the server."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n// create a Synth at the head of the default Server's default group\n// based on the SynthDef \"default\"\nx = Synth.new(\"default\");\ns.queryAllNodes; // note the default group (ID 1)\nx.free;\n\n// Using an arrayed control\n// run this block first to make the SynthDef\n(\nSynthDef(\"help-synth\", { |freq = #[440, 450, 460], out = 0|\n Out.ar(out, Mix(SinOsc.ar(freq, 0, 0.1)));\n}).add;\n);\n\n// then this a short while later\nx = Synth(\"help-synth\", [freq: [500, 501, 510]]);\n\nx = Synth(\"help-synth\", [freq: [500, 501, 510]]);\nx.set(\\freq, [1, 2, 3] * 400 + [1, 2, 3], \\out, 1);\nx.set(\\freq, [3] * 400 + [1, 2, 3], \\out, 1);\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Normalizer`."}, {"role": "assistant", "content": "```supercollider\n(\n// example signal to process\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n z * 0.8\n}.play\n);\n\n(\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n [z, Normalizer.ar(z, 0.4, 0.01)] * 0.5\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n/// Installing sc3-plugins quarks\n\n// If you installed the sc3-plugins to a user location:\n~sc3plugs = Quarks(\nreposPath: \"https://sc3-plugins.svn.sourceforge.net/svnroot/sc3-plugins/build\",\nlocalPath: Platform.userAppSupportDir +/+ \"SC3plugins\"\n);\n\n// If the sc3-plugins were installed to a system wide location:\n~sc3plugs = Quarks(\nreposPath: \"https://sc3-plugins.svn.sourceforge.net/svnroot/sc3-plugins/build\",\nlocalPath: Platform.systemAppSupportDir +/+ \"SC3plugins\"\n);\n\n\n// Get a GUI of the available Quarks and install the ones you want to try out:\n~sc3plugs.gui;\n\n\n// For more general Help on Quarks, see the Quarks helpfile\n```"}, {"role": "assistant", "content": "Installing sc3-plugins quarks If you installed the sc3-plugins to a user location:."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nNdef(\\birdy, {arg freq=1500, amp=0.5, rate=10;\n var osc, son, convIn, rand;\n osc=LFCub;\n rand = LFNoise1.ar(rate);\n convIn=LinCongN.ar(rate);\n son = osc.ar(Convolution.ar(convIn,convIn));\n freq = Latch.kr(rand.range(0,1).round(0.1), rand) * freq;\n freq = osc.ar(osc.ar(rand)*rand.range(0,10)).range(freq, freq*3);\n son = Formlet.ar(son, freq, convIn.abs*0.1, rand.abs);\n son = Normalizer.ar(son, 0.9, 0.1) * convIn.abs * LFPulse.kr(LFPulse.kr(rand.abs), 0, rand.abs);\n son = son + GVerb.ar(son, 99, 2, mul: rand.range(0,0.3));\n son * amp\n}).play\n)\n```"}, {"role": "assistant", "content": "I just rewrote one of autocsi's tweets and came out with this which sounds like a digital bird of some kind:."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Latch`."}, {"role": "assistant", "content": "```supercollider\n{ Blip.ar(LFNoise0.kr(9, 400, 500), 4, 0.2) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `List`."}, {"role": "assistant", "content": "```supercollider\n// Create a new empty collections with size 3:\nx = Array.new(3);\ny = Array.new(3);\nz = List.new(3);\n\n// Try to add 7 items to the array and list.\n// If the array exceeds maxSize, it will only\n// grow to an internally specified max size.\n(\n7.do { |i|\n x.add(i);\n y = y.add(i); // reassign array y on each add\n z.add(i);\n};\n);\n\n// Attempt to access the 5th item:\nx.at(4); // -> nil (out of bounds)\ny.at(4); // -> 4\nz.at(4); // -> 4\n\n// x grew only to size 4\nx.postln; // -> [ 0, 1, 2, 3 ]\ny.postln; // -> [ 0, 1, 2, 3, 4, 5, 6 ]\nz.postln; // -> List[ 0, 1, 2, 3, 4, 5, 6 ]\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for smooth arpeggio, updated envelope (a SuperCollider snippet): bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\bass, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.perc(0.2), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Splay - not getting spread, wrong use?"}, {"role": "assistant", "content": "SuperCollider forum — Splay - not getting spread, wrong use?\n\nYou need to undestand that if you have two identical signal coming from left and right it will always be mono. No stereo spread possible. So you need to introduce (at least) two different signals - and just different amplification will not really work.\n\nTo expand your first example, we can introduce an array of values for paramtere pos:\n\n```supercollider\n(\nx = { arg spread=1, level=0.2, center=0.0;\n Splay.ar(\n GrainBuf.ar(numChannels: 1,\n trigger: Impulse.kr(1.2875),\n dur: Impulse.kr(1.2875),\n sndbuf: b,\n pos:[0,0.5],\n interp: 1\n ),\n spread,\n level,\n center\n );\n}.play;\n);\n\nx.set(\\spread, 1, \\center, 0); // full stereo\nx.set(\\spread, 0, \\center, 0); // mono center\n```\n\nBy way of Multichannel Expansion this creates two different signals (channels, an array of 2 UGen graphs) that you can hear as different and therefore observe the stereo spread.\n\nAnd similarly, to use your other example with In.ar where I have added in=2, so that it takes my mic in (but you can specify another bus) and wrapped it into a feedback delay with an array of two values for delayTime. Multichannel expansion thus creates two channels that are different because they have different delaytimes but the rest of UGen graph is the same (a copy). Changing spread now works:\n\n```supercollider\n(\nSynthDef(\\stereo,{|out=0, in=2, spread=1, level=1, center=0.0|\n Out.ar(out,\n Splay.ar(\n CombN.ar(\n In.ar(in, 1), 1, [0.3,0.4], 2)\n ,spread,level,center));\n}).play;\n)\n```\n\nI hope that clarifies the issue better."}]} {"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ SinOsc.ar(300, 0, 0.5) * SinOsc.kr(2.unipolar * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ SinOsc.ar(300, 0, 0.5) * SinOsc.kr(2).unipolar * 0.1 }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What is the difference between \\degree, \\midinote and \\freq in a Pbind?"}, {"role": "assistant", "content": "`\\freq` is the frequency in Hz and is used as-is. `\\midinote` is a MIDI note number, converted to frequency by the default instrument. `\\degree` is a scale degree, quantised to the scale in \\scale (default major) rooted at \\root; degrees can be negative or fractional. If you set both, the more specific conversion wins, so set exactly one."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Env`."}, {"role": "assistant", "content": "```supercollider\n// an envelope in a synth\n(\n{\n var env = Env([0, 1, 0.5, 1, 0], [0.01, 0.5, 0.02, 0.5]);\n SinOsc.ar(470) * EnvGen.kr(env, doneAction: Done.freeSelf)\n}.play\n);\n// an envelope to control a parameter in a pattern\n(\nPbind(\n \\note, Env([0, 12, 6, 13, 0], [1, 5, 2, 10]),\n \\dur, 0.1\n).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `ProxySpace.document` do? What arguments does it take?"}, {"role": "assistant", "content": "creates a new document with the current proxyspace state. This does not allow open functions as proxy sources. see: Arguments: keys — list of keys to document a subset of proxies; onlyAudibleOutput — a boolean.; includeSettings — a boolean.."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Words in a matchbox?"}, {"role": "assistant", "content": "```supercollider\n// really early first approach...\n(\nx.free;\nx = {\n var note = Duty.kr(\n 6/3.2,\n 0, \n Dseq([45, 45, 48, 41], inf));\n var snd = Saw.ar(note.midicps * SinOsc.kr(7.421).range(0.998, 1.001)) * -12.dbamp!2;\n var trigs = TDuty.kr(\n Dseq([1, 2, 3]/3.2, inf),\n 0,\n 1);\n var lvls = Duty.kr(\n Dseq([1, 2, 3]/3.2, inf),\n 0,\n Dseq([-9, -3, -6], inf));\n snd = snd * lvls.dbamp.lag2(0.1);\n snd = snd * EnvGen.kr(Env.perc(0.3, 0.3), trigs);\n snd = RLPF.ar(snd, EnvGen.kr(Env.perc(0.5, 0.2), trigs) * 3201 + 2311, 0.2);\n snd = LPF.ar(snd, 3000);\n snd = snd * (1 + Latch.ar(WhiteNoise.ar(-8.dbamp), Dust.ar(830))).lag2(0.01);\n snd = snd + LPF.ar(CombC.ar(snd, 0.4, 0.33, 0.52, -4.dbamp), 932);\n snd = FreeVerb2.ar(snd, snd, 0.21, 0.93, 0.9);\n snd * -12.dbamp;\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Paddp` in SuperCollider?"}, {"role": "assistant", "content": "Paddp — add each value of a pattern to the value at a key in event stream Adds a value to a named value in an event pattern or stream until it ends. Repeats this with new values until the value stream ends. Category: Streams-Patterns-Events > Patterns > Math."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n var saw, bpf;\n saw = Saw.ar(\n freq: [1700,2000],\n mul: LFPulse.kr(\n freq: [2,7],\n width: 0.115));\n bpf = LPF.ar(in: saw, freq: SinOsc.kr(1/3).range(250, 4000)); \n}.play;\n)\n```"}, {"role": "assistant", "content": "Quiz 4a for MUSC 115, pp. 62-84 from Gentle Intro to SuperCollider."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes shred01 (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n// by Notgoodenogh\n\n(\n5.do{\n\n{FreeVerb.ar(1 / pow(2.718281, LFSaw.ar(rrand(10,100),1,1).squared / (2 * (Latch.ar(WhiteNoise.ar(1).range(0.001, 0.15), LFSaw.ar(4,1,0.5,0.5) > 0.99)).squared)) * 0.1, 0.33, 2) * EnvGen.kr(Env.linen(20, 40, 20, 1), doneAction: 2) ! 2}.play\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PV_JensenAndersen`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\fftod, { |out|\n var source1, detect, chain;\n source1 = SoundIn.ar(0);\n chain = FFT(LocalBuf(2048), source1);\n detect = PV_JensenAndersen.ar(chain, threshold: MouseX.kr(0.1, 1.0));\n Out.ar(out, SinOsc.ar([440, 445], 0, Decay.ar(0.1 * detect, 0.1)));\n}).play(s);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BeatTrack`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_beattrack2, { |out|\n var trackb, trackh, trackq, tempo;\n var source;\n var bsound, hsound, qsound;\n\n source = SoundIn.ar(0);\n\n #trackb, trackh, trackq, tempo = BeatTrack.kr(FFT(LocalBuf(1024)));\n\n bsound = Pan2.ar(LPF.ar(WhiteNoise.ar * Decay.kr(trackb, 0.05), 1000), 0.0);\n\n hsound = Pan2.ar(BPF.ar(WhiteNoise.ar * Decay.kr(trackh, 0.05), 3000, 0.66), -0.5);\n\n qsound = Pan2.ar(HPF.ar(WhiteNoise.ar * Decay.kr(trackq, 0.05), 5000), 0.5);\n\n Out.ar(out, bsound + hsound + qsound);\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Pprob.new` do? What arguments does it take?"}, {"role": "assistant", "content": "random values with arbitrary probability distribution Arguments: distribution — desired probability distribution (histogram).; lo — lower bound of the resulting values.; hi — upper bound of the resulting values.; length — number of values to repeat.; tableSize — resample table to this size. If the size of the distribution is smaller than 64, it is (linearly) resampled to this minimum size.; distribution — set the distribution, the table is recalculated.; tableSize — set the resample size, the table is recalculated.."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\ambiIn;\n~description = \"A live ambisonic input (ACN_N3D)\";\n~channelLayout = \\ambi;\n\n~function = { |order = 1, t_trig = 0, bus = 0|\n var env = EnvGen.kr(Env([0,1], [1]), t_trig);\n var chans = Array.series(\n size: (order + 1).pow(2).asInteger,\n start: bus,\n step: 1\n );\n SoundIn.ar(chans) * env;\n};\n```"}, {"role": "assistant", "content": "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see ."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n// Simple amplitude tracker sending values to sclang\nSynthDef(\\ampTracker, { |in|\n var freq = 30; // num of values per second\n SendReply.kr(Impulse.kr(freq), '/amp', Amplitude.kr(SoundIn.ar(in)));\n}).add;\n);\n\n// start the tracker on scsynth\nSynth(\\ampTracker);\n\n(\n// receive the values in sclang\nOSCdef(\\ampTracker, { |m|\n m.postln;\n // now use m[3] for your purpose (detecting changes, etc...)\n}, '/amp');\n)\n```"}, {"role": "assistant", "content": "It's jsut an amplitude tracker, to exaplin how to send values from scsynth to sclang."}]} -{"conversations": [{"role": "user", "content": "What does `Interface.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Sets up an environment in which you can build a player, a GUI and responders for midi and keyboard control Arguments: interfaceDef; args."}]} -{"conversations": [{"role": "user", "content": "What does `StreamSpec.rate` do?"}, {"role": "assistant", "content": "datatype specifying that the input or output is stream or pattern"}]} -{"conversations": [{"role": "user", "content": "What is `ControlSpec`?"}, {"role": "assistant", "content": "ControlSpec — numerical input specification"}, {"role": "user", "content": "What does `ControlSpec.map` do?"}, {"role": "assistant", "content": "Maps and constrains a value between 0 and 1 to the range between minval and maxval."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// ControlSpec-map can also be used to map ugens\n(\nvar spec;\nspec = [100, 18000, \\exp].asSpec;\n{\n var freq, osc;\n osc = SinOsc.kr(0.1).range(0, 1);\n freq = spec.map(osc);\n\n freq.dump; // BinaryOpUGen\n\n SinOsc.ar(\n freq.poll\n )\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n//Chaos engine hum\n(\n{\n SinOsc.ar(10 + (50 * SinOsc.kr([50, 51], 0, SinOsc.kr(101, Saw.kr(0.12345, 678, 9), 0.2, 0.8), Pulse.kr([25, 25.5], 0.25, 0.125, -0.25))), 0, 0.5, 0);\n}.play();\n)\n```"}, {"role": "assistant", "content": "A deep binaural cycle reminiscent of the engine of a space ship."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pmulp`."}, {"role": "assistant", "content": "```supercollider\n(\nvar a, b;\na = Pmulp(\\freq, Pseq([2, 3, pi], inf), Pbind(\\freq, Pseq([100, 200, 300])));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n)\n```"}]} -{"conversations": [{"role": "user", "content": "A starting point to start experimenting with non-standard synthesis?"}, {"role": "assistant", "content": "SuperCollider forum — A starting point to start experimenting with non-standard synthesis?\n\nI while ago I did this noise cloud generator which might serve as inspiration. Other ideas: scramble signals with FFT tools, granular synthesis, FM-synthesis with extreme settings, like index-of-modulation = 4000.\n\n```supercollider\nSynthDef(\\clouds, {\n var num = 10;\n var dur = \\duration.kr(1/6);\n var sig = num.collect{\n var freq = Rand(30, 5000) * SinOsc.kr(LFNoise1.kr(dur).range(30, 1000), 0, LFNoise1.kr(dur)\n .range(0.01, 8)).midiratio;\n var sig = Select.ar(LFNoise0.kr(dur).range(0, 2).round,\n [SinOsc.ar(freq, 0, 0.3), Saw.ar(freq, 0.3), Pulse.ar(freq, 0, 0.3)]);\n var filtFreq = Rand(30, 1000) * LFNoise1.kr(dur).range(1.0, 5.0);\n var filt = Select.ar(LFNoise0.kr(dur).range(0, 2).round,\n [LPF.ar(sig, filtFreq), HPF.ar(sig, filtFreq), BPF.ar(sig, filtFreq)]\n );\n sig = CombL.ar(filt, 0.5, LFNoise1.kr(dur).range(0.02, 0.5), rrand(0.3, 2));\n sig\n };\n var env = Env.perc(\\atk.kr(0.02), \\rel.kr(6), 1, \\cur.kr(-4)).ar(2);\n sig = Splay.ar(sig); // nb! levelComp: true, so if removed signal will be extremely loud!\n sig = LPF.ar(sig, 2000);\n sig = FreeVerb2.ar(sig[0], sig[1], LFNoise1.kr(dur).range(0, 1.0), LFNoise1.kr(dur).range(0.2, 2));\n sig = sig * env * \\amp.kr(1);\n Out.ar(\\out.kr(0), sig)\n}).add;\n\nSynth(\\clouds, [\\atk, rrand(0.01, 2), \\rel, rrand(1, 6.0), \\duration, rrand(0.01, 1)])\n// run it several times, the outcome is highly random\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `AbstractPlayerProxy` in SuperCollider briefly."}, {"role": "assistant", "content": "AbstractPlayerProxy — base class for players that act as proxies for another player Defers all responsiblities for playing to another object. This is a superclass. Category: Libraries > crucial > Players > abstract."}]} -{"conversations": [{"role": "user", "content": "What does `DetectIndex.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Search a buffer for a value Arguments: bufnum — index of the buffer; in — the input signal.. Returns: index of first occurrence of value, or -1 if value is not found."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Scale`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\na = Scale.major;\na.degrees; // [0, 2, 4, 5, 7, 9, 11]\na.semitones; // [0, 2, 4, 5, 7, 9, 11]\na.cents; // [0, 200, 300, 500, 700, 900, 1100]\na.ratios; // [1, 1.1224620483089, 1.2599210498937, 1.3348398541685, etc.]\n\nPbind(\\scale, a, \\degree, Pseq((0..7) ++ (6..0) ++ [\\rest], 1), \\dur, 0.25).play;\n\n// use non-standard tuning\na.tuning_(\\just);\na.degrees; // no change; degrees are independent of tuning\na.semitones; // [0, 2.0391000173077, 3.1564128700055, 4.9804499913461, etc.]\na.ratios.collect(_.round(0.001)); // [1, 1.125, 1.2, 1.333, 1.5, 1.667, 1.875]\n\nPbind(\\scale, a, \\degree, Pseq((0..7) ++ (6..0) ++ [\\rest], 1), \\dur, 0.25).play;\n```"}]} -{"conversations": [{"role": "user", "content": "What is `MultiSliderView` in SuperCollider?"}, {"role": "assistant", "content": "MultiSliderView — A view displaying an array of sliders MultiSliderView displays a collection of values, each represented by the position of one of the sliders placed side by side. Category: GUI > Views."}]} -{"conversations": [{"role": "user", "content": "What does `PV_Compander.new` do? What arguments does it take?"}, {"role": "assistant", "content": "simple spectral compression/expansion Arguments: buffer — fft buffer; thresh — mag thresh; slopeBelow, slopeAbove — same as Compander."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\nPdefn(\\x, Pbrown(0, 6, 0.1, inf));\nPbind(\\note, Pdefn(\\x), \\dur, 0.3).play;\nPbind(\\note, Pdefn(\\x), \\dur, 0.1, \\ctranspose, 15).play;\n// now change the definition\nPdefn(\\x, Pseq([0, 3, 5, 7, 9, 11], inf));\nPdefn(\\x, Pseq([0, 3, 3, 7], inf) + Pseq([0, [0, 3], [0, 5, 7]], inf);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\nPdefn(\\x, Pbrown(0, 6, 0.1, inf));\nPbind(\\note, Pdefn(\\x), \\dur, 0.3).play;\nPbind(\\note, Pdefn(\\x), \\dur, 0.1, \\ctranspose, 15).play;\n// now change the definition\nPdefn(\\x, Pseq([0, 3, 5, 7, 9, 11], inf));\nPdefn(\\x, Pseq([0, 3, 3, 7], inf) + Pseq([0, [0, 3], [0, 5, 7]], inf));\n```"}]} -{"conversations": [{"role": "user", "content": "What does `AbstractPlayer.reverseComposeBinaryOp` do? What arguments does it take?"}, {"role": "assistant", "content": "the base class for all Players : a playable object Arguments: operator; pattern."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//simple particlesystem.\n//with mouse controlling world gravity and system position\n\n(\nvar width= 300, height= 300, w, world,\nsys;\n\n//--world\nw= RedWindow(\"particlesystem test\", Rect(128, 64, width, height)).front;\nworld= RedWorld3(RedVector2D[width, height], 0, 20, -0.25); //dim,grav,maxvel,damp\n\n//--system\nsys= RedParticleSystem.new;\n\n//--loop\nw.draw{\n world.gravity= RedVector2D.newFrom(w.mouse/([width, height])-0.5);\n\n //--add new particles and update old\n sys.add(RedParticle(world, w.mouse+5.rand2, 0, RedVector2D[2.rand2, 10.rand], 1.5, 5.rand).age_(40.rrand(50)));\n sys.addForce(world.gravity);\n sys.update;\n\n //--render\n sys.do{|o| //iterate all particles in the system\n Pen.fillColor= Color.grey((o.age/50), 1);\n Pen.fillOval(Rect.aboutRedObject2D(o));\n };\n};\nw.play;\nCmdPeriod.doOnce({w.close});\n)\n```"}, {"role": "assistant", "content": "simple particlesystem. with mouse controlling world gravity and system position."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Just an exploration with Substractive synthesis?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n\n 2.do{\n {BPF.ar (WhiteNoise.ar, [73,81].midicps, 1e-4, Env.sine(10,50).kr(2)).sum!2}.play; gauss (7,0.2).wait;\n {BPF.ar (WhiteNoise.ar, [71,80].midicps, 1e-4, Env.sine(10).kr(2)).sum!2*50}.play; gauss (7,0.2).wait;\n {BPF.ar (WhiteNoise.ar, [69,78].midicps, 1e-4, Env.sine(10).kr(2)).sum!2*50}.play; gauss (7,0.2).wait;\n {BPF.ar (WhiteNoise.ar, [68,80].midicps, 1e-4, Env.sine(10).kr(2)).sum!2*50}.play; gauss (7,0.2).wait;\n}\n}.fork\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// Since the allpass delay has no audible effect as a resonator on\n// steady-state sound ...\n\n{ AllpassC.ar(WhiteNoise.ar(0.1), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// ...these examples add the input to the effected sound and compare variants so that you can hear\n// the effect of the phase comb:\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassN.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2)\n}.play)\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassL.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0\n// …\n```"}, {"role": "assistant", "content": "Since the allpass delay has no audible effect as a resonator on steady-state sound ... (AllpassC: Schroeder allpass delay line with cubic interpolation.)"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// FIS is contained in the trnsnd quark\n// first example of its helpfile\n\n{ FIS.ar(LinExp.ar(LFTri.ar(0.1), -1, 1, 1, 4), LFNoise2.ar(300).range(0, 1), 3, 0.1) }.play;\n\n// the same with GFIS requires definition of varying params outside func \n
(\ny = {\n var r = LinExp.ar(LFTri.ar(0.1), -1, 1, 1, 4);\n var i = LFNoise2.ar(300).range(0, 1);\n GFIS.ar({ |x| sin(r * x) }, i, 3, 3, false) * 0.1\n}.play\n);\n\ny.release\n\n// proof of concept, difference is silent as it should\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// FIS is contained in the trnsnd quark\n// first example of its helpfile\n\n{ FIS.ar(LinExp.ar(LFTri.ar(0.1), -1, 1, 1, 4), LFNoise2.ar(300).range(0, 1), 3, 0.1) }.play;\n\n// the same with GFIS requires definition of varying params outside func \n
(\ny = {\n var r = LinExp.ar(LFTri.ar(0.1), -1, 1, 1, 4);\n var i = LFNoise2.ar(300).range(0, 1);\n GFIS.ar({ |x| sin(r * x) }, i, 3, 3, false) * 0.1\n}.play\n);\n\ny.release\n\n// proof of concept, difference is silent as it should\n\n(\nz = {\n var r = LinExp.ar(LFTri.ar(0.1), -1, 1, 1, 4);\n var i = LFNoise2.ar(300).range(0, 1);\n GFIS.ar({ |x| sin(r * x) }, i, 3, 3, false) * 0.1 - FIS.ar(r, i, 3, 0.1)\n}.play\n);\n\nz.release\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DecodeB2`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var w, x, y, p, a, b, c, d;\n\n p = PinkNoise.ar; // source\n\n // B-format encode\n #w, x, y = PanB2.ar(p, MouseX.kr(-1, 1), 0.1);\n\n // B-format decode to quad\n #a, b, c, d = DecodeB2.ar(4, w, x, y);\n\n [a, b, d, c] // reorder to my speaker arrangement: Lf Rf Lr Rr\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DynKlank`."}, {"role": "assistant", "content": "```supercollider\n{ DynKlank.ar(`[[800, 1071, 1153, 1723], nil, [1, 1, 1, 1]], Impulse.ar(2, 0, 0.1)) }.play;\n\n{ DynKlank.ar(`[[800, 1071, 1353, 1723], nil, [1, 1, 1, 1]], Dust.ar(8, 0.1)) }.play;\n\n{ DynKlank.ar(`[[800, 1071, 1353, 1723], nil, [1, 1, 1, 1]], PinkNoise.ar(0.007)) }.play;\n\n{ DynKlank.ar(`[[200, 671, 1153, 1723], nil, [1, 1, 1, 1]], PinkNoise.ar([0.007, 0.007])) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// world's most expensive patchcord (use headphones to avoid feedback)\n{ SoundIn.ar(0) }.play;\n\n// stereo version\n{ SoundIn.ar([0, 1]) }.play;\n\n// scope input; silent output\n{ Amplitude.kr(SoundIn.ar(0)) }.scope;\n```"}, {"role": "assistant", "content": "world's most expensive patchcord (use headphones to avoid feedback) scope input; silent output (SoundIn: Read audio from hardware inputs)"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Detuneable fat-saw with a pattern (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\fatsaw,\n {\n arg freq=440, amp=0.3, fat=0.0033, ffreq=2000, atk=0.001, dec=0.3, sus=0.5, rls=0.1,gate=1;\n\n var f1,f2,f3,f4,synth;\n\n f1=freq-(freq*fat);\n f2=freq-(freq*fat/2);\n f3=freq+(freq*fat/2);\n f4=freq+(freq*fat);\n\n synth = LFSaw.ar([f1,f2,f3,f4],[0,0.001,0.002,0.004,0.008]);\n synth = synth * EnvGen.kr(Env([0,1,sus,0],[atk,dec,rls],'lin',2),gate,doneAction:0);\n synth=Splay.ar(synth,0.7);\n synth=RLPF.ar(synth,ffreq*Linen.kr(gate,0.1,0.4,0.2,0),0.4);\n Out.ar([0,1],synth*amp);\n},[0.1,0.3,4,2]).add;\n);\n(\nTempoClock.default = TempoClock.new(2);\nfork{\n\n z = Synth(\\fatsaw,[\\gate,0,\\ffreq,500,\\fat,0.5]);\n\n a=Pseq([0,7,12,5],inf).asStream; // musical degrees\n c = Pseq([40,38,45,47],inf).asStream; // root midi notes\n e = Pseq([0.825,0.375,0.25,0.25],inf).asStream; // note durations\n f = Pseq([1000,1500,2000,2500],inf).asStream; // filter freq value\n\n 0.1.wait;\n z.set(\\gate,1);\n\n //set first root note\n d = c.next;\n\n 8.do{\n\n // move filter freq once every 4 notes\n z.set(\\ffreq, f.next);\n 4.do {\n z.set(\\gate,1);\n z.set(\\freq,(a.next + d).midicps);\n x=[0.451,0.45,0.449].choose;\n x.wait;\n z.set(\\gate,0);\n\n e.next.wait;\n };\n\n d = c.next;\n };\n 2.wait;\n z.free;\n};\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n~listing = \"ls Help\".unixCmdGetStdOut; // Grab\n~listing.reverse.as(Array.dupEach.join.postln; // Mangle\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n~listing = \"ls Help\".unixCmdGetStdOut; // Grab\n~listing.reverse.as(Array).dupEach.join.postln; // Mangle\n```"}]} -{"conversations": [{"role": "user", "content": "What is `LocalBuf`?"}, {"role": "assistant", "content": "LocalBuf — Allocate a buffer local to the synth"}, {"role": "user", "content": "What does `LocalBuf.newFrom` do?"}, {"role": "assistant", "content": "Allocates a new buffer from a given list of values"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\\bigLocalBuf, {\n LocalBuf(88200).set(Array.fill(88200, { #[0, 0.25, 0.5, 0.75, 1.0].choose }))\n}).add;\n\nSynthDescLib.at(\\bigLocalBuf).constants;\n// prints: FloatArray[1, 88200, 0, 0.75, 0.5, 0.25]\n```"}]} -{"conversations": [{"role": "user", "content": "What does `UChain.getAllUChains` do?"}, {"role": "assistant", "content": "Returns this. This method is used to recursivly get all the UChains in a Returns: UChain"}]} -{"conversations": [{"role": "user", "content": "Explain `PlazyEnvirN` in SuperCollider briefly."}, {"role": "assistant", "content": "PlazyEnvirN — instantiate new patterns from a function and multichannel expand them Evaluates a function that returns a pattern and embeds it in a stream. Category: Streams-Patterns-Events > Patterns > Function."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes flanger (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"flange\", {arg freq=440, release=0.1;\n var x, sig,out, mod1, depth, mfreq,maxfreq, maxdepth, maxdelay, basedelay;\n maxfreq=3;\n maxdelay=0.01;\n basedelay=maxdelay/2;\n maxdepth=basedelay/2;\n depth = MouseY.kr(0,maxdepth);\n mfreq = MouseX.kr(0,maxfreq);\n mod1 = SinOsc.ar(mfreq,0,depth);\n sig = SoundIn.ar(0,mul:2);\n out = DelayC.ar(sig, maxdelay,basedelay+ mod1);\n out = Mix.ar([out,sig]);\n Out.ar(0,out);\n Out.ar(1,out);\n}).load(s);\n);\n\na = Synth(\"flange\");\na.free\n```"}]} -{"conversations": [{"role": "user", "content": "What is Ndef used for?"}, {"role": "assistant", "content": "Ndef is the JITLib node proxy: a named placeholder for a running signal chain that you can redefine while it plays. `Ndef(\\drone, { SinOsc.ar(55) * 0.1 }).play` starts it, and calling Ndef(\\drone, { ... }) again crossfades to the new definition without restarting the sound. It also supports chaining, `Ndef(\\drone)[1] = \\filter -> { |in| LPF.ar(in, 800) }`, which is the idiomatic way to build and modify a live patch."}]} -{"conversations": [{"role": "user", "content": "What does `PHSplayer.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new PHSplayer Arguments: pHelpSynth — A PHS object.."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Blip thru Formlet, pseudo-vocal synthesis."}, {"role": "assistant", "content": "```supercollider\n// Blip thru Formlet, pseudo-vocal synthesis.\n// hh&adc, since beijing 2005\n// 2019 made quad/MC\n\n// keywords: vocal, voice, formants\n\n/*\nNdef(\\formSing).gui;\nNdef(\\formSing).play;\nNdef(\\formSing).getHalo(\\stepFdev).value;\n*/\nNdef(\\formSing).addSpec(\\root, [20, 500, 6]);\nNdef(\\formSing).addSpec(\\formfrq, [50, 5000, \\exp]);\nNdef(\\formSing).addSpec(\\harm, [1, 256, \\exp]);\nNdef(\\formSing).addSpec(\\formLag, [0.01, 100, \\exp]);\nNdef(\\formSing).addSpec(\\ndiv, [0.01, 1, \\exp]);\nNdef(\\formSing).addSpec(\\fdev, [0, 24, \\amp]);\nNdef(\\formSing).addSpec(\\round, [0, 3, \\amp, 0.05]);\n\n(\n// modulating formant frequency\nNdef(\\formSing, { arg amp=0, root=150, formfrq=500, harm=20, fdev=2, ndiv = 0.2, formLag=0.1, round = 1.5;\n var freqCompare = 1; // ((formfrq / root).log2).abs.min(1).linexp(0, 1, 0.25, 1);\n var in = Blip.ar(\n root.lag(formLag) * LFNoise0.kr(root * ndiv ! q.numChans, fdev.max(0.01) ).midiratio,\n harm.lag(formLag), // .max(formfrq / root * 0.25),\n 0.1\n ) * GrayNoise.ar(0.1 ! q.numChans, 1);\n\n Limiter.ar(Formlet.ar(in, formfrq.lag(formLag), 0.005, 0.02) * (freqCompare * amp.lag(0.1)))\n .softclip;\n});\n);\n```"}]} -{"conversations": [{"role": "user", "content": "Where does the magic frequency 261.6255653006 come from?"}, {"role": "assistant", "content": "SuperCollider forum — Where does the magic frequency 261.6255653006 come from?\n\nThinking about this a bit more, on one hand it might be useful if set (and everything else in Event) could fetch not only the msgFunc from the synthDesc, which it does (if args are set to []), but perhaps also the default values for the synth controls... and then used those in preference to Event defaults if “nothing is specified” for some key in the event. Alas “nothing is specified” is tedious to detect in Event, as it does its own calculations which have a lot of inputs (esp. for the frequency stuff). So, one could implement such a policy more explicitly in a \\finish callback that e.g. looks up in synthDesc only specific keys (say specified in a defArgs, possibly with [] meaning all found in the synthDesc) and sets only those if “not set” in event.\n\nI almost started coding this idea, but I realised that’s actually inferior to just putting the synth defaults in another event/environment, and chaining that before the event... which is exactly what I usually do with a Pdef.envir. That approach, besides sidestepping the issue of detecting what’s “not set” in the Event, has an extra advantage that a persistent set of defaults, after being initialized with the synthdef ones, can be easily tweaked in a gui. When I find myself that I often change the default value of some control like that, I go back and change the synthdef default. Because of that workflow, in which I always have the defaults loaded in an chained envir, I didn’t even have much realization of Event defaults for things like amp, freq etc. And I didn’t need type: \\set much until recently... for which getting the args constructed in that case is also rather easy as Pdef(...).controlKeys. Even without Pdefs, that’s straightforward (past loading those defaults into an event)\n\n```supercollider\ne = SynthDescLib.global.synthDescs.at(\\default).controls.inject((), { |e, c| e[c.name] = c.defaultValue });\n(instrument: \\default, dur: 1, amp: 0.2).next(e).play\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// try wiggling mouse quickly:\n// LFNoise2 overshoots when going from high to low freqs, LFDNoise changes smoothly.\n\n{ SinOsc.ar(LFNoise2.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n{ SinOsc.ar(LFDNoise3.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFNoise2.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n\n{ LFDNoise3.ar(XLine.kr(2000, 20000, 8), 0.1\n// …\n```"}, {"role": "assistant", "content": "try wiggling mouse quickly: LFNoise2 overshoots when going from high to low freqs, LFDNoise changes smoothly. (LFDNoise3: Dynamic cubic noise)"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Henon2DL.ar(SampleRate.ir/4, SampleRate.ir, MouseX.kr(1,1.4), MouseY.kr(0,0.3)) * 0.2 }.play(s);\n\n(\n{ Henon2DL.ar(\n 2200, 8800,\n LFNoise2.kr(1, 0.2, 1.2),\n LFNoise2.kr(1, 0.15, 0.15)\n) * 0.2 }.play(s);\n)\n\n{ SinOsc.ar(Henon2DL.ar(20, 40, MouseX.kr(1,1.4), MouseY.kr(0,0.3))*800+900)*0.4 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Henon2DL.ar(SampleRate.ir/4, SampleRate.ir, MouseX.kr(1,1.4), MouseY.kr(0,0.3)) * 0.2 }.play(s);\n\n(\n{ Henon2DL.ar(\n 2200, 8800,\n LFNoise2.kr(1, 0.2, 1.2),\n LFNoise2.kr(1, 0.15, 0.15)\n) * 0.2 }.play(s);\n)\n\n{ SinOsc.ar(Henon2DL.ar(20, 40, MouseX.kr(1,1.4), MouseY.kr(0,0.3))*800+900)*0.4 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nSynthDef(\"mini\",{\n Out.ar( 0,\n Instr.ar(\"minimoog.two\", SinOsc.kr(1.0).range(300,500) )\n )\n}).send(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nSynthDef(\"mini\",{\n Out.ar( 0,\n Instr.ar(\"minimoog.two\", SinOsc.kr(1.0).range(300,500) )\n )\n}).send(s);\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ var sig = SinOsc.ar(440) * 0.2; Out.ar(0, sig) }.play;\n```"}, {"role": "assistant", "content": "The minimal SynthDef idiom: a source multiplied by an amplitude, written to the master bus.\n\n`var sig = SinOsc.ar(440) * 0.2` builds the signal; `Out.ar(0, sig)` is the only mandatory part, because a\nUGen graph that never reaches an output produces no sound. `Out`'s first argument is the bus number — 0 is\nthe main stereo output — and the second is the signal. The function's return value does not matter here,\nwhich is why the `Out.ar` can sit on its own line. `.play` compiles this into an anonymous SynthDef and\nstarts one instance."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Routine` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// SynthDefs on the fly\ns.boot;\n(\nt = TempoClock.new;\nr = Routine.new({\n 10.do({\n // could be done with an argument instead of a new def, but proves the point\n SynthDef(\"help-EnvGen\" ++ i, { arg out = 0;\n Out.ar(\n out,\n EnvGen.kr(Env.perc, 1.0, doneAction: Done.freeSelf)\n * SinOsc.ar(100 + (100 * t.elapsedBeats), 0, 0.1)\n )\n }).play(s);\n 1.yield;\n });\n}).play(t); // Note the alternative syntax: Routine.play(aClock)\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// UnitTestScript(\"Collapse\", thisProcess.nowExecutingPath).runScript;\n\n{\n |test|\n var collapseValues = List();\n var collapse;\n\n collapse = Collapse({ |v| collapseValues.add(v) }, 0.1);\n\n collapseValues.clear;\n\n collapse.value(1);\n test.assert(collapseValues.isEmpty, \"Collapse doesn't exec immediately\");\n\n 1.wait;\n test.assertEquals(collapseValues.array, [1], \"Collapse execs eventually\");\n\n collapseValues.clear;\n [1, 2, 3, 4, \"last\"].do { |i| collapse.(i); 0.05.wait };\n 1.wait;\n test.assertEquals(collapseValues.array, [\"last\"], \"Collapse only execs last value.\");\n\n collapseValues.clear;\n [\"first\", \"second\", \"last\"].do { |i| collapse.(i); 0.2.wait };\n test.assertEquals(collapseValues.array, [\"first\", \"second\", \"last\"], \"Collapse execs all values.\")\n\n};\n```"}, {"role": "assistant", "content": "UnitTestScript(\"Collapse\", thisProcess.nowExecutingPath).runScript;."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BHiPass`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n(\nz = {\n BHiPass.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(10, 20000, \\exponential), // cutoff freq.\n MouseY.kr(0.0, 1.0, \\linear), // rq\n 0.5); // mul\n}.play\n);\nz.release;\n```"}]} {"conversations": [{"role": "user", "content": "What is the difference between .ar, .kr and .ir?"}, {"role": "assistant", "content": "The rate method decides how often a UGen is evaluated. `.ar` runs at the audio rate, once per sample, and produces an audio signal. `.kr` runs at the control rate, once per block of 64 samples by default, so it is cheaper and is used for parameters that do not need sample accuracy. `.ir` is evaluated once when the Synth is created and then never again, for constants such as SampleRate.ir or a size. Using .kr where you need audio-rate modulation gives stepped, zipper-noise-like control; using .ar where .kr would do costs CPU."}]} -{"conversations": [{"role": "user", "content": "What does `AbstractConsole.addToLayout` do? What arguments does it take?"}, {"role": "assistant", "content": "abstract parent class for the console widgets Arguments: moreFunc."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Schemawound track from the SIGNALVOID compilation."}, {"role": "assistant", "content": "```supercollider\n/*\nSchemawound track from the SIGNALVOID compilation.\nSIGNALVOID is a noise compilation. Participants were asked to create up to three tracks, each of exactly one minute in length, with no gaps of silence at the beginning or end. Download the free compilation here: http://archive.org/details/SignalvoidMp3 or http://archive.org/details/SignalvoidFlac\nPhysical copies are available here http://signalvoid.bandcamp.com/merch/signalvoid-2\n\nBlog post about the creation of this track http://schemawound.tumblr.com/post/29065985817/signalvoid-1-burn-it-to-disc-then-burn-the-disc\n*/\n\n(\n {\n var saw1 = Saw.ar((10..100));\n var saw2 = Mix(Saw.ar(saw1).range(100, 600));\n var sin0 = SinOsc.ar(0.002).range(5,75);\n var sin1 = SinOsc.ar(0.1).range(1,sin0);\n var sin2 = SinOsc.ar(0.15).range(2,10);\n var sinMod = (sin1 * sin2)!2;\n var sin66 = SinOsc.ar(0.0164).range(600,1000);\n var saw3 = Saw.ar(sinMod).range(200, sin66);\n var saw4 = Saw.ar(saw3);\n var sin3 = Mix(SinOsc.ar((1..100)));\n var sum1 = (saw2 * saw4) * sin3;\n var comb1 = CombL.ar(sum1, 1, 0.2, 1) + sum1;\n var sin4 = SinOsc.ar(0.12).range(3, 1000);\n var comb2 = comb1.tanh;\n var sin5 = SinOsc.ar(sin4);\n var sin6 = SinOsc.ar(0.001);\n var comb3 = comb2 * sin5 * sin6;\n var sum2 = (comb2 + comb3) * 0.3;\n var verb1 = sum2;\n var line1 = Line.ar(1, 0.001, 60, doneAction: 2);\n var line2 = Line.ar(0, 1, 60);\n var comb4 = CombL.ar(verb1, 1, line1, 0.1) * line2;\n var sum3 = comb4 + verb1;\n sum3 * 0.5;\n }.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "I get 'Buffer UGen: no buffer data'. What does it mean?"}, {"role": "assistant", "content": "The UGen got a bufnum that the server has no data for. `Buffer.read` is asynchronous: the Buffer object exists immediately but the samples arrive later, so a Synth created straight after `Buffer.read` reads nothing. Wait for it — `s.sync` after the read, or `Buffer.read(s, path, action: { |b| ... })` and create the Synth in the action. The other cause is a nil or wrong buffer: `PlayBuf.ar(1, ~buf)` where ~buf was never assigned passes 0, which is 'no buffer'."}]} -{"conversations": [{"role": "user", "content": "GrainBuf complains about too many grains."}, {"role": "assistant", "content": "The number of simultaneous grains is `density × dur` in seconds, and it exceeds maxGrains (512 by default). Either lower the trigger rate, shorten the grains, or raise the limit: `GrainBuf.ar(2, trig, dur, buf, 1, pos, 2, 0, -1, 1024)` — the 1024 is maxGrains. Raising it costs server CPU per grain, so prefer halving the density if the sound does not need it."}]} -{"conversations": [{"role": "user", "content": "What does `MultiplePlayers.children` do?"}, {"role": "assistant", "content": "parent class for players that have multiple tracks / voices"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n\nb = Bus.control(Server.local);\n{\n var p,qnty=4,gate;\n gate = In.kr(b);\n p = Mix.arFill(qnty.asInteger,{ arg i;\n SinOsc.ar(440 + rrand(1,5))\n }) * qnty.reciprocal;\n\n Enveloper2.ar(p,gate,Env.adsr)\n}.play;\n\n;\n\n\n// On\nb.value = 1.0;\n\n// Off\nb.value = 0.0;\n\nb.value = 0.2;\n\nb.value = 0.0;\n\nb.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n\nb = Bus.control(Server.local);\n{\n var p,qnty=4,gate;\n gate = In.kr(b);\n p = Mix.arFill(qnty.asInteger,{ arg i;\n SinOsc.ar(440 + rrand(1,5))\n }) * qnty.reciprocal;\n\n Enveloper2.ar(p,gate,Env.adsr)\n}.play;\n\n);\n\n\n// On\nb.value = 1.0;\n\n// Off\nb.value = 0.0;\n\nb.value = 0.2;\n\nb.value = 0.0;\n\nb.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// Periphonic (3D) decoder with eight channels arranged in a bi-rectangle:\n// [ [ 30, 0 ], [ -30, 0 ], [ 90, 35.3 ], [ -90, 35.3 ],\n// [ -150, -0 ], [ 150, -0 ], [ -90, -35.3 ], [ 90, -35.3 ] ]\n\n// specify 1/2 the desired directions\n~directions = [[ 30, 0 ], [ -30, 0 ], [ 90, 35.3 ], [ -90, 35.3]].degrad;\n~decoder = FoaDecoderMatrix.newDiametric(~directions);\n\n// inspect\n~decoder.dirChannels.raddeg\n```"}, {"role": "assistant", "content": "Periphonic (3D) decoder with eight channels arranged in a bi-rectangle: [ [ 30, 0 ], [ -30, 0 ], [ 90, 35.3 ], [ -90, 35.3 ], (FoaDecoderMatrix: First Order Ambisonic (FOA) decoder matrices)"}]} -{"conversations": [{"role": "user", "content": "What does `AbstractPlayer.spec` do?"}, {"role": "assistant", "content": "the base class for all Players : a playable object"}]} -{"conversations": [{"role": "user", "content": "Who made you?"}, {"role": "assistant", "content": "I was trained by the person who runs this project, on top of the MiniMind architecture. My weights started from random numbers and learned from the SuperCollider sources — no teacher model, no distillation."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for simple smooth arp."}, {"role": "assistant", "content": "```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\smooth, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.linen(0.05, sustain, 0.1), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Wavetable.chebyFill` do? What arguments does it take?"}, {"role": "assistant", "content": "Fill a Wavetable of the given size with a sum of Chebyshev polynomials at the given amplitudes for use in waveshaping by the Shaper Arguments: size — must be a power of 2 plus 1, eventual wavetable is next power of two size up.; amplitudes — an Array of amplitudes for each Chebyshev polynomial beginning with order 1.; normalize — a Boolean indicating whether to normalize the resulting Wavetable. If the zeroOffset argument is true, the normalization is done for use as a transfer function, using Signal#-normalizeTransfer#normalizeTransfer, otherwise it just uses Signal#-normalize#normalize to make the absolute peak value 1. De; zeroOffset — a Boolean indicating whether to offset the middle of each polynomial to zero. If true, then a zero input will always result in a zero output when used as a Shaper##waveshaper. If false, then the \"raw\" (unshifted) Chebyshev polynomials are used. Default is false.."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Real-time pattern morphing with Ndef."}, {"role": "assistant", "content": "```supercollider\n(\n~name = \"saw\";\n\nSynthDef(~name, { arg out=0, amp=0.1, gate=1, pan=0, spread=0.8, freq=200, doneAction=2, ffreq=300, rq=0.3;\n var sig;\n sig = LFSaw.ar(freq);\n sig = RLPF.ar(sig, ffreq, rq);\n sig = sig * EnvGen.ar(\\adsr.kr(Env.adsr(0.01,0.1,0.8,0.1)),gate,doneAction:doneAction);\n sig = Splay.ar(sig, spread, amp, pan);\n Out.ar(out, sig);\n}).add;\n\n\n~morph = { arg mainkey, lagtime, pat;\n var base = pat.asStream.next(());\n var bind = List.new;\n var proxy;\n base.keysValuesDo { arg key, val;\n var ndefkey = \"%.%\".format(mainkey, key).asSymbol;\n Ndef(ndefkey, { \n Line.kr(Ndef(ndefkey).kr, val, lagtime)\n });\n proxy = Ndef(ndefkey);\n bind.add(key);\n bind.add(proxy.bus.asMap);\n };\n Pbind(*bind)\n};\n);\n\n\nPdef(~name).play;\n\n\n(\n// preset 1\n\n~a = Pdef(~name, ~morph.(\\bla, 2.1, Pbind(\n \\freq, 100,\n \\ffreq, 1300,\n)) <> Pbind(\n \\instrument, ~name,\n \\dur, 1,\n));\n\n);\n\n(\n// preset 2\n\n~a = Pdef(~name, ~morph.(\\bla, 1, Pbind(\n \\freq, 1500,\n \\ffreq, 200,\n)) <> Pbind(\n \\instrument, ~name,\n \\dur, 1,\n));\n\n);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes ~chaos2 (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\n~chaos2={\n var signal, myFrequency, frequencyMin=0.1, frequencyMax=30, myAmplitude, amplitudeMin=0.01, amplitudeMax=0.6, myPhase, phaseMin=0, phaseMax=1.5;\n myFrequency = Array.fill(2, {[rrand(frequencyMin, frequencyMax)]});\n myAmplitude = Array.fill(2, {[rrand(amplitudeMin, amplitudeMax)]});\n myPhase = Array.fill(2, {[rrand(phaseMin, phaseMax)]});\n signal = LeakDC.ar(ChaosGen.allSubclasses.choose.ar(myFrequency, myPhase, myAmplitude));\n myFrequency = (myFrequency + Array.fill(2, {[rrand(frequencyMin, frequencyMax)]})) * (signal);\n myAmplitude = (myAmplitude + Array.fill(2, {[rrand(amplitudeMin, amplitudeMax)]})) * (signal);\n myPhase = (myPhase + Array.fill(2, {[rrand(phaseMin, phaseMax)]}))* (signal);\n signal = LeakDC.ar(ChaosGen.allSubclasses.choose.ar(myFrequency, myPhase, myAmplitude));\n myFrequency = (myFrequency + Array.fill(2, {[rrand(frequencyMin, frequencyMax)]})) * (signal);\n myAmplitude = (myAmplitude + Array.fill(2, {[rrand(amplitudeMin, amplitudeMax)]})) * (signal);\n myPhase = (myPhase + Array.fill(2, {[rrand(phaseMin, phaseMax)]}))* (signal);\n signal = LeakDC.ar(ChaosGen.allSubclasses.choose.ar(myFrequency, myPhase, myAmplitude));\n Out.ar(0, LeakDC.ar(signal * 0.3));\n};\n);\n\n~chaosmegafeedback={Mix.new(~chaos2 ! 16) * 0.00000000000000000000000003}.scope;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `DynKlang.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Dynamic sine oscillator bank Arguments: specificationsArrayRef — a Ref to an Array of three Arrays:; freqscale — a scale factor multiplied by all frequencies at initialization time.; freqoffset — an offset added to all frequencies at initialization time.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\na = Pbind(\n x: Pseq([1, 2, 3]),\n y: Prand([100, 300, 200], inf),\n zzz: 99\n);\nx = a.asStream;\n);\n\nx.next(()); // pass in an event ()\nx.next(());\nx.next(());\nx.next((); // end: nil\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\na = Pbind(\n x: Pseq([1, 2, 3]),\n y: Prand([100, 300, 200], inf),\n zzz: 99\n);\nx = a.asStream;\n);\n\nx.next(()); // pass in an event ()\nx.next(());\nx.next(());\nx.next(()); // end: nil\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `MxTimeGui` in SuperCollider briefly."}, {"role": "assistant", "content": "MxTimeGui — Timeline view This object is the timeline view that coordinates any timeline views that the units may support. Category: Mx."}]} -{"conversations": [{"role": "user", "content": "What does `ToggleButton.init` do? What arguments does it take?"}, {"role": "assistant", "content": "simple two state button Arguments: layout; init; title; minWidth; minHeight; onc; offc."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes song of forest."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\sound, {\n arg i_bus = 0, amp = 0.1, freq = 440, sustain = 1, pan = 0;\n var env, osc, out;\n env = EnvGen.kr(Env.perc(0.01, sustain, amp),doneAction:2);\n osc = SinOsc.ar([freq, freq * 1.005, freq * 0.995], mul:env);\n out = Pan2.ar(osc, pan);\n Out.ar(i_bus, out);\n}).send(s);\n);\n\n(\n~amp = 0.1;\na = Pdef(\\a,\n Pbind(\n \\instrument, \\sound,\n \\amp, ~amp * 1.5,\n \\degree, Pseq([2, 4, 5, 6, 1] - 1, inf),\n \\dur, Pseq([1, 1, 1, 1, 2] / 4, inf)\n )\n).quant_([3, 0, 0, 1]);\n\nb = Pdef(\\b,\n Pbind(\n \\instrument, \\sound,\n \\amp, ~amp,\n \\degree, Pseq([8, 6, 5, 3, 4, 6] - 1, inf),\n \\dur, Pseq([1, 1, 1, 1, 1, 1] / 4, inf)\n )\n).quant_([3, 0, 0, 1]);\n\nc = Pdef(\\c,\n Pbind(\n \\instrument, \\sound,\n \\amp, ~amp * 0.6,\n \\degree, Pseq([1, 6, 8, 6, Pwrand([11,13], [2, 1].normalizeSum)] - 1, inf),\n \\amp, Pseq([0, 1, 1, 1, 1] / 10, inf),\n \\dur, Pseq([8, 1, 1, 1, 1] / 8, inf),\n \\sustain, 0.1\n )\n).quant_([3, 0, 0, 1]);\n);\n\n(\nSystemClock.sched(0, Routine({\n a.play; 12.yield;\n b.play; 12.yield;\n c.play; 12.yield;\n c.pause; 6.yield;\n a.pause; 6.yield;\n\n b.pause; a.play; 12.yield;\n b.play; 12.yield;\n c.play; 12.yield;\n c.pause; a.pause; 6.yield;\n b.pause; 6.yield;\n}));\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Converting an environment in a prototype object."}, {"role": "assistant", "content": "```supercollider\n~constructPseudoMethods = { |envir|\n var newEnvir = envir.collect { |value|\n var argNames, argBlock, namesBlock, code, func;\n if(value.isKindOf(Function)) {\n func = value;\n argNames = func.def.argumentString(withDefaultValues: true);\n namesBlock = func.def.argumentString(withDefaultValues: false);\n argBlock = if(argNames.notNil) { \"|self, \" ++ argNames ++ \"|\" };\n code = \"{ |func, envir| { % envir.use { func.value(%) } } }\".format(argBlock ? \"\", namesBlock ? \"\");\n //code.postln;\n code.interpret.value(func, envir)\n } {\n value\n }\n };\n newEnvir.know = true; // we want a prototype object style environment\n};\n```"}]} -{"conversations": [{"role": "user", "content": "What model are you?"}, {"role": "assistant", "content": "I am sc-mind: a 198M MiniMind-3-MoE, eight layers, 768 wide, four experts with top-1 routing. I was trained from scratch on the SuperCollider documentation, class library and help pages, then fine-tuned on questions and answers about them."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(//*********PREPARE**********\np.pop;\n//Any code that needs to access your own environment goes here\np = ProxySpace.push(s);\n~fxLoop.play.fadeTime_(5);\n);\n\n(//*********FXLoop**********\n~fxLoop = {\n var in = SoundIn.ar([0,1]);\n in;\n}\n)\n```"}, {"role": "assistant", "content": "Code for using Supercollider as a realtime livecode FX processor for audio input. Blog post explaing this code: http://schemawound.com/post/53528545022/fxloop."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BinaryOpUGen`."}, {"role": "assistant", "content": "```supercollider\na = WhiteNoise.ar; // a WhiteNoise\nb = a + 2; // a BinaryOpUGen.\nb.operator; // +\n\n// sound example\n(\n{\n var a = LFSaw.ar(300);\n var b = LFSaw.ar(329.1);\n a % b * 0.1\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n///////////////////// beat accurate playing /////////////////////\n\n\n\n\na = NodeProxy.audio(s, 2);\na.play;\n\na.quant = 2.0; // quantize changes to the next 2.0-beat multiple\na.source = { Ringz.ar(Impulse.ar(0.5, 0, 0.3), 3000, 0.01) };\na[1] = { Ringz.ar(Impulse.ar([0.5, 1], 0, 0.3), 1000, 0.01) };\na[2] = { Ringz.ar(Impulse.ar([3, 5]/2, 0, 0.3), 8000, 0.01) };\na[3] = { Ringz.ar(Impulse.ar([3, 5]*16, 0, 0.3), 5000,\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n///////////////////// beat accurate playing /////////////////////\n\n\n\n\na = NodeProxy.audio(s, 2);\na.play;\n\na.quant = 2.0; // quantize changes to the next 2.0-beat multiple\na.source = { Ringz.ar(Impulse.ar(0.5, 0, 0.3), 3000, 0.01) };\na[1] = { Ringz.ar(Impulse.ar([0.5, 1], 0, 0.3), 1000, 0.01) };\na[2] = { Ringz.ar(Impulse.ar([3, 5]/2, 0, 0.3), 8000, 0.01) };\na[3] = { Ringz.ar(Impulse.ar([3, 5]*16, 0, 0.3), 5000, 0.01) * LFPulse.kr(0.5, 0, 0.05) };\n\na.removeLast;\na.removeAt(2);\n\na.clear;\n```"}]} -{"conversations": [{"role": "user", "content": "I get 'syntax error, unexpected NAME' on a block that looks fine."}, {"role": "assistant", "content": "Almost always a missing semicolon between two statements — SuperCollider does not insert them.\n\n```supercollider\n// broken: two statements, no separator\n{ var sig = SinOsc.ar(440) sig = sig * 0.1; sig }.play\n```\n\n```supercollider\n// fixed\n{ var sig = SinOsc.ar(440); sig = sig * 0.1; sig }.play\n```\nThe error points at the second statement, not at the missing semicolon before it, which is why it looks\nfine. If it is not a semicolon, count the brackets: `.ar(` open, `)` closed."}]} -{"conversations": [{"role": "user", "content": "I get \"Message 'ar' not understood\". Why?"}, {"role": "assistant", "content": "You called a rate method on something that is not a UGen. `Env.ar(...)` and `Buffer.ar(...)` are the classic cases: Env is a language-side description and is played by `EnvGen.ar(env, ...)`; a Buffer is server memory and is played by `PlayBuf.ar` or `BufRd.ar`. The UGen is the thing with a rate method — if it is a description or a container, there is another UGen that consumes it."}]} -{"conversations": [{"role": "user", "content": "Explain `APF` in SuperCollider briefly."}, {"role": "assistant", "content": "APF — FIXME: APF purpose. FIXME: APF description. Category: UGens > Filters > Linear, UGens > Undocumented."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pproto`."}, {"role": "assistant", "content": "```supercollider\nPbind(\\freq, 700, \\amp, 0.1)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Feedback with beats."}, {"role": "assistant", "content": "```supercollider\nNdef(\\a, {\n var src, loc, delay=0.01;\n src = Decay2.ar(Impulse.ar(1/8), LFNoise2.kr(4).range(0.001, 0.0001),\n LFNoise2.kr(4).range(0.005, 0.05))!2\n * Saw.ar(LFNoise2.kr(4).exprange(40, 4000));\n loc = BPF.ar(LocalIn.ar(2) + [src, 0], LFNoise0.kr(1/4).range(100, 1200).lag, 3.2);\n loc = GVerb.ar(loc, 100, 4, mul:0.02, add:loc);\n loc = Compander.ar(loc, loc, 0.9, 1, 0.001);\n loc = (loc * 0.501).tanh;\n loc = Compander.ar(loc, loc, 0.1, 1, 0.1); \n loc = DelayC.ar(loc, delay * 2, delay * 1);\n LocalOut.ar(loc.reverse * 0.49);\n Out.ar(0, loc * 0.9)\n}).play;\n\nNdef(\\b, {\n var src, loc, del;\n del = 1/100;\n src = Decay2.ar(TDuty.ar(1/4,0,Dseq([1, 0.5, 0.3, 0.1],inf)), \n LFNoise2.kr(4).range(0.001, 0.0001), LFNoise2.kr(4).range(0.005, 0.05))!2\n * Saw.ar(LFNoise2.kr(200).exprange(40, 14000));\n loc = BPF.ar(LocalIn.ar(2) + [src, 0], LFNoise2.kr(0.1).range(40, 400), 3.2);\n loc = GVerb.ar(loc, 100, 4, mul:0.02, add:loc);\n loc = Compander.ar(loc, loc, 0.9, 1, 0.001);\n loc = (loc * 0.51).tanh;\n loc = Compander.ar(loc, loc, 0.1, 1, 0.1); \n loc = DelayC.ar(loc, del * 2, del * 1);\n LocalOut.ar(loc.reverse * 0.45);\n Out.ar(0, Compander.ar(loc,loc,0.1, 1, 0.05) * 1.2)\n}).play;\n\nNdef(\\c, {\n var src, loc, del=1/4;\n src = Decay2.ar(Impulse.ar(1), 0.0001, 0.05) * SinOsc.ar(60);\n loc = src + LocalIn.ar(2);\n loc = BPF.ar(loc, 800, 3.2).softclip;\n loc = DelayN.ar(loc, del, [0, del]);\n LocalOut.ar(loc.reverse * 0.99);\n Out.ar(0, loc * 2)\n}).play;\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for LFDNoise Modular version?"}, {"role": "assistant", "content": "```supercollider\n(\n~lfd={\n var signal, myFrequency, frequencyMin=0.1, frequencyMax=30, myAmplitude, amplitudeMin=0.01, amplitudeMax=0.6, myPhase, phaseMin=0, phaseMax=1.5;\n myFrequency = Array.fill(2, {[rrand(frequencyMin, frequencyMax)]});\n myAmplitude = Array.fill(2, {[rrand(amplitudeMin, amplitudeMax)]});\n myPhase = Array.fill(2, {[rrand(phaseMin, phaseMax)]});\n signal = LeakDC.ar([LFDNoise1, LFDNoise0, LFDNoise3, LFDClipNoise].choose.ar(myFrequency, myPhase, myAmplitude));\n Out.ar(0, signal);\n};\n);\n\n~lfd.scope\n```"}]} +{"conversations": [{"role": "user", "content": "What does `PatchOut.scalar` do? What arguments does it take?"}, {"role": "assistant", "content": "manages a Player's output when connecting to other Players Arguments: source; group; bus."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nNdef(\\sound, { |freq = 56, numHarm = 10| Blip.ar(freq, numHarm, 30) * 0.2 }).play;\nNdef(\\sound).set(\\freq, 15);\nNdef(\\sound).set(\\freq, 15, \\numHarm, 100);\n\nNdef(\\lfo, { LFNoise2.kr(2).exprange(10, 200) });\nNdef(\\sound).map(\\numHarm, Ndef(\\lfo));\nNdef(\\sound).set(\\numHarm, nil); // unmap.\nNdef(\\sound.stop;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nNdef(\\sound, { |freq = 56, numHarm = 10| Blip.ar(freq, numHarm, 30) * 0.2 }).play;\nNdef(\\sound).set(\\freq, 15);\nNdef(\\sound).set(\\freq, 15, \\numHarm, 100);\n\nNdef(\\lfo, { LFNoise2.kr(2).exprange(10, 200) });\nNdef(\\sound).map(\\numHarm, Ndef(\\lfo));\nNdef(\\sound).set(\\numHarm, nil); // unmap.\nNdef(\\sound).stop;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Ndef\nNdef(\\a, { Saw.ar(12) }).asCode;\n\n// in a pushed proxy space\np = ProxySpace.push(s.boot);\n~x = { Saw.ar(123, 0.1 };\n~x.play;\n~x.asCode;\n\np.end.pop;\n\n// anonymous nodeproxy also posts instructions:\nx = NodeProxy.new.source = { DC.ar };\nx.asCode;\n\nx.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Ndef\nNdef(\\a, { Saw.ar(12) }).asCode;\n\n// in a pushed proxy space\np = ProxySpace.push(s.boot);\n~x = { Saw.ar(123, 0.1) };\n~x.play;\n~x.asCode;\n\np.end.pop;\n\n// anonymous nodeproxy also posts instructions:\nx = NodeProxy.new.source = { DC.ar };\nx.asCode;\n\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `Dust` in SuperCollider briefly."}, {"role": "assistant", "content": "Dust — Random impulses. Generates random impulses from 0 to +1. Category: UGens > Generators > Stochastic."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\AcnSn3dIn;\n~description = \"A live ambisonic input (ACN_SN3D)\";\n~channelLayout = \\ambi;\n\n~function = { |order=1, t_trig = 0, bus = 0|\n var env = EnvGen.kr(Env([0,1], [1]), t_trig);\n var chans = Array.series(\n size: (order + 1).pow(2).asInteger,\n start: bus,\n step: 1\n );\n var input = SoundIn.ar(chans) * env;\n HOAConverterAcnSn3d2AcnN3d.ar(order, input);\n};\n```"}, {"role": "assistant", "content": "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see ."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SortedList`."}, {"role": "assistant", "content": "```supercollider\nt = SortedList.new(8, {|a,b| a.first < b.first });\nt.add([10, \"last\"]);\nt.add([1, \"first\"]);\nt.postln;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Kepler 22-b atmosphere. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\nfork { \n Ndef(\\ttwnd).play;//(d,2,addAction:\\addToHead);\n loop {\n var seed = thisThread.randSeed = 100000000.rand.debug('seed');\n Ndef(\\ttwnd, {\n var freq = [20, 7500];\n Splay.ar(\n { \n var bands = 2.rrand(10);\n var sig = { [BPF,RLPF,RHPF].choose.ar(\n LFNoise2.ar(freq[0].rrand(freq[1]), LFNoise2.kr(0.1.exprand(10))),\n Array.rand(bands, freq[0], freq[1]),\n Array.rand(bands, 0.2, 1.8)\n ).mean } ! 2;\n Rotate2.ar(sig[0], sig[1], LFSaw.kr(0.1.exprand(10)));\n } ! 4.rrand(6).debug('source'),\n 0.5.rrand(1)\n );\n }).fadeTime_(1.rrand(4.0));\n 10.0.rrand(40).debug('wait(bts)').wait;\n }\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `KeyMode.kr` do? What arguments does it take?"}, {"role": "assistant", "content": "Find best correlated key mode with chromagram between major, minor and chromatic cluster Arguments: chain — [fft] Audio input to track. This must have been pre-analysed by a 4096 size FFT. No other FFT sizes are valid except as noted below. `// With standard hop of half FFT size = 2048 samples`; keydecay — [sk] Number of seconds for the influence of a window on the final key decision to decay by 40dB (to 0.01 its original value).; chromaleak — [sk] Each frame, the chroma values are set to the previous value multiplied by the chromadecay. 0.0 will start each frame afresh with no memory.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// default params\n{ QuadL.ar(SampleRate.ir/4) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// default params\n{ QuadL.ar(SampleRate.ir/4) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// for Nil: return the argument unmodified (an event).\nnil.transformEvent((x: 8));\n// for Dictionary (and thus for Event): add to the argument.\n(y: 100, z: 1).transformEvent((x: 8));\n// for Association: add the association to the event\n(\\a -> \\x).transformEvent((x: 8));\n// for Function: use the function receive the event as argument.\n{ |event| event.use { ~x = ~x + 1 }; event }.transformEvent((x: 8));\n```"}, {"role": "assistant", "content": "for Nil: return the argument unmodified (an event). for Dictionary (and thus for Event): add to the argument. (Nil: Represents uninitialized data)"}]} +{"conversations": [{"role": "user", "content": "What does `PlayerSocket.env` do?"}, {"role": "assistant", "content": "a player that can play other players using a cross-faded and fuse-protected socket"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `BusPlug` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\ns.boot;\nz = Bus.control(s, 16);\nz.setn({ |i| (i * 5).nthPrime } ! 16 * 5 + 100);\na = BusPlug.for(z);\n{ Splay.ar(SinOsc.ar(a.kr(3, MouseX.kr(0, 25)))) * 0.1 }.play; // selectively play 3 channel of the 16, modulate offset\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `Pgpar` in SuperCollider briefly."}, {"role": "assistant", "content": "Pgpar — embed event streams in parallel and put each in its own group Embeds several event streams so that they form a single output stream with all their events in temporal order. When one stream ends, the other streams are further embedded until all have ended. Category: Streams-Patterns-Events > Patterns > Parallel."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var w, x, y, p, q, a, b, c, d;\n\n p = LFSaw.ar(200);\n q = LFSaw.ar(301);\n\n // B-format encode\n #w, x, y = BiPanB2.ar(p, q, MouseX.kr(-1, 1), 0.1);\n\n // B-format decode to quad\n #a, b, c, d = DecodeB2.ar(4, w, x, y);\n\n [a, b, d, c] // reorder to my speaker arrangement: Lf Rf Lr Rr\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var w, x, y, p, q, a, b, c, d;\n\n p = LFSaw.ar(200);\n q = LFSaw.ar(301);\n\n // B-format encode\n #w, x, y = BiPanB2.ar(p, q, MouseX.kr(-1, 1), 0.1);\n\n // B-format decode to quad\n #a, b, c, d = DecodeB2.ar(4, w, x, y);\n\n [a, b, d, c] // reorder to my speaker arrangement: Lf Rf Lr Rr\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `AbstractWrappingDispatcher.updateFuncForFuncProxy` do? What arguments does it take?"}, {"role": "assistant", "content": "This method is called within #-update to update any changes to one of this dispatcher's responder funcs' function(s). Users should not call this method directly, but subclasses may need to extend this method to do additional Arguments: funcProxy — An instance of a subclass of AbstractResponderFunc.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nx = {\n // A collection of different tones:\n var son = SinOsc.ar((100, 100.3 .. 110));\n var val = ArrayMin.ar(son).at(0);\n val = LeakDC.ar(val); // the operation tends to induce DC offset\n Pan2.ar(val)\n}.play\n;\nx.free\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nx = {\n // A collection of different tones:\n var son = SinOsc.ar((100, 100.3 .. 110));\n var val = ArrayMin.ar(son).at(0);\n val = LeakDC.ar(val); // the operation tends to induce DC offset\n Pan2.ar(val)\n}.play\n);\nx.free\n```"}]} {"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// check blockSize before (or reset blockSize in examples)\n\n(\nif (s.options.blockSize != 64) {\n s.options.blockSize = 64;\n s.quit.reboot;\n}\n);\n\n// With divisions we must avoid division by zero resp. blowup, here it's max in the divisor.\n// The example also establishes a cross-feedback of the two channels by using reverse.\n\ns.scope\n\n// start fb fx Synth\n\n(\n~bus = Bus.audio(s, 2);\n\ny = {\n var inSig = In.ar(~bus, 2);\n var lfo = LFDNoise3.ar(1).linexp(-1, 1, 0.2, 10);\n LPF.ar(\n Fb1({ |\n// …\n```"}, {"role": "assistant", "content": "check blockSize before (or reset blockSize in examples) With divisions we must avoid division by zero resp. blowup, here it's max in the divisor. (Fb1: single sample feedback / feedforward pseudo ugen)"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Tap`."}, {"role": "assistant", "content": "```supercollider\n// Create a buffer.\nb = Buffer.alloc(s, s.sampleRate, 1); // enough space for one second of mono audio\n\n// Write to the Buffer with BufWr, read using two Taps, one for each ear!\n(\nSynthDef(\\helpTap, { |out, bufnum|\n var source, capture;\n\n source = SoundIn.ar(0); // use headphones to avoid feedback\n capture = BufWr.ar(source, bufnum, Phasor.ar(0, 1, 0, BufFrames.ir(bufnum), 1));\n\n Out.ar(out, Tap.ar(bufnum, 1, [0.1, 0.9])); // multichannel expansion, so one tap each ear\n}).add;\n);\n\nx = Synth(\\helpTap, [\\bufnum, b]);\n\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `HistoryGui.docFlag` do?"}, {"role": "assistant", "content": "get or set the symbol for the doc strategy to use: `\\sameDoc` tries to re-use a single text window, `\\newDoc` always makes a new one (and keep track of old"}]} -{"conversations": [{"role": "user", "content": "What is a UGen graph in SuperCollider?"}, {"role": "assistant", "content": "A UGen graph is the directed acyclic graph of unit generators that a SynthDef describes: sources (SinOsc, WhiteNoise) feed processors (LPF, EnvGen, Pan2) and end at an output such as Out.ar. The language builds the graph; the server instantiates it once per Synth. A signal path is drawn by passing one UGen's output as another's input, and because UGens are multi-channel by default, the same expression can build a stereo or 8-channel graph depending on the arrays inside it."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for redo_minimalish sketch."}, {"role": "assistant", "content": "```supercollider\n//redFrik - redo_minimalish sketch\n(\ns.waitForBoot{\n \n SynthDef(\\p, {|out= 0, freq= 400, amp= 0.1, gate= 1, detune= 0|\n var env= EnvGen.ar(Env.perc(Rand(0.001, 0.01), LinRand(0.2, 0.4), amp, Rand(-9, -1)), doneAction:2);\n var snd= Mix(SinOsc.ar(freq+[0, detune*0.1], env*2pi));\n Out.ar(out, Pan2.ar(snd*env, Rand(-1, 1)));\n }).add;\n Ndef(\\p, Pspawn(Pbind(\\method,\\par,\\delta,1/8,\\pattern,{Pbind(\\instrument, \\p, \\dur,a=Pseq((1..9).sputter),\\sustain,1/8/a,\\degree,a,\\detune,a)})));\n Ndef(\\p).play(vol:0.5);\n \n Ndef(\\t, {\n var mod= Saw.ar([3, 4], Saw.ar(1, 32, 128), Duty.ar(1, 0, flop(Dseq([0, 8, 1, 5])*[1, 4, 8])));\n var snd= SinOsc.ar(Saw.ar(2, 64, 99), mod)/9;\n CombN.ar(snd, 1/4, 1/4.125, SinOsc.kr(0.005, 1.5pi).range(0, 6));\n });\n Ndef(\\t).play(vol:0.5);\n \n Routine.run({\n var cnt= 1;\n loop{\n var syn;\n cnt= cnt%8+1;\n syn= {\n var del= DelayN.ar(InFeedback.ar(0, 2)+(InFeedback.ar(100, 2)), 1, 1);\n SinOsc.ar(cnt*99+[0, 2], del[1..0])/4;\n }.play(outbus: 64);\n {syn.release(16)}.defer(9-cnt);\n wait(9-cnt);\n };\n });\n Ndef(\\c, {InFeedback.ar(64, 2)}).play(vol:0.5);\n \n Ndef(\\r, {\n var lfos= LFNoise1.ar(0.5!2);\n var snd= Crackle.ar(lfos.range(1.8, 1.98));\n Formlet.ar(snd, TExpRand.ar(200, 2000, lfos).lag(2), lfos.range(5e-4, 1e-3), 0.0012);\n });\n Ndef(\\r).play(vol:0.25);\n \n Routine.run({\n loop{\n var syn= {\n var snd= Pluck.ar(Crackle.ar([1.9, 1.8]), Mix(Impulse.ar({5.linrand+1}!2, -0.125)), 0.05, 0.05.linrand);\n BPF.ar(snd, 2000.rand+100, 0.25.rrand(1.75));\n }.play(s, 62, 18);\n {syn.release(69)}.defer(18);\n wait(18);\n };\n });\n Ndef(\\m, {InFeedback.ar(62, 2)*SinOsc.kr(0.006).range(0.25, 1)}).play(vol:0.5);\n \n NdefMixer(s);\n s.meter;\n};\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Buffer.readChannelMsg` do?"}, {"role": "assistant", "content": "as above for single channel, with last arg being"}]} -{"conversations": [{"role": "user", "content": "What is the difference between Env and EnvGen?"}, {"role": "assistant", "content": "Env is a language-side description: a list of levels, times and a curve, e.g. `Env.perc(0.01, 1)` or `Env.adsr(0.01, 0.1, 0.5, 0.8)`. EnvGen is the UGen that plays it on the server: `EnvGen.kr(env, gate, doneAction: 2)`. The same Env can be played by many EnvGens, and Env also has language-side uses such as `.asStream` inside Patterns and `.plot`."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Now to demonstrate language-side classification, we'll iterate over a grid and classify:\n(\n(0, 0.1 .. 1).collect{|y|\n(0, 0.1 .. 1).collect{|x|\nPlaneTree.classify([x,y], ~treedata)\n}\n}.do(_.postln);\"\"\n);\n\n// Server-side: run this then move the mouse left/right/up/down - classification should follow same pattern.\ns.boot;\n~treebuf = Buffer.loadCollection(s, ~treedata.flat, ~treedata[0].size);\n(\nx = {\nPlaneTree.kr(~treebuf, [MouseX.kr(0,1), MouseY.kr(0,1)]).poll\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Now to demonstrate language-side classification, we'll iterate over a grid and classify:\n(\n(0, 0.1 .. 1).collect{|y|\n(0, 0.1 .. 1).collect{|x|\nPlaneTree.classify([x,y], ~treedata)\n}\n}.do(_.postln);\"\"\n);\n\n// Server-side: run this then move the mouse left/right/up/down - classification should follow same pattern.\ns.boot;\n~treebuf = Buffer.loadCollection(s, ~treedata.flat, ~treedata[0].size);\n(\nx = {\nPlaneTree.kr(~treebuf, [MouseX.kr(0,1), MouseY.kr(0,1)]).poll\n}.play\n);\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for rough sketch of chicago minor chord pad thing."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\\ChicagoPad, { |out = 0, freq = 440, cutoff = 500, amp = 0.2|\n var snd;\n freq = freq + SinOsc.kr(0.1, 0, 1, 20);\n snd = Saw.ar([freq, freq+1, freq-1, freq*3/2, freq*6/5])*0.1;\n snd = snd + VarSaw.ar(0.99*[freq, freq+1, freq-1,freq*3/2, freq*6/5],0, LFTri.kr(0.3).range(0.25,0.9))*0.1;\n snd = Mix(snd);\n snd = RLPF.ar(snd, SinOsc.kr(0.1, 0, 100, 5000), 0.1);\n snd = GVerb.ar(snd ,40, 10, 0.6, 0.6, -3, -9, -11)*0.2;\n \n //snd = RLPF.ar(snd, SinOsc.kr(0.08, 0.5, cutoff/10, cutoff), 0.2);\n snd = MoogFF.ar(snd, SinOsc.kr(0.08, 0.5, cutoff/10, cutoff), 3, 0);\n snd = DelayC.ar(snd, 1.5, 1,0.8);\n //snd = snd * EnvGen.ar(Env.linen(0.001, 0.01,0.01,1), doneAction:2);\n Out.ar(out, [snd, AllpassC.ar(snd, 0.5, 0.05, 0.3)]*amp);\n}).send;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SimpleNumber.chebyshevTZeros` do?"}, {"role": "assistant", "content": "Returns the roots (zeros) of the `n`-th Chebyshev polynomial of the first"}]} -{"conversations": [{"role": "user", "content": "Write a kick drum in SuperCollider."}, {"role": "assistant", "content": "A pitch-swept sine with a fast decay: the frequency envelope is what makes it read as a kick.\n\n```supercollider\n(\nSynthDef(\\kick, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 50, 40], [0.03, 0.15], -4));\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -6), doneAction: 2);\n Out.ar(out, Pan2.ar(SinOsc.ar(pitch) * env * amp));\n}).add;\n);\nSynth(\\kick);\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for delay effect with accelerating echoes?"}, {"role": "assistant", "content": "```supercollider\n~buf = Buffer.alloc(s, s.sampleRate * 5);\n\n(\n{\n var trig, freq;\n var dry, snd, phase, iois;\n var cumulDelay;\n var decayFactor, lpfCutoff, numEchoes, ioiScale, ioiDecayFactor;\n\n // play with these!\n decayFactor = 0.65;\n lpfCutoff = 500;\n numEchoes = 16;\n ioiScale = 0.4;\n ioiDecayFactor = 0.75;\n\n // example input -- you can substitute other stuff here\n trig = Dust.ar(1);\n dry = Pulse.ar(100 * TIRand.ar(1, 12, trig));\n dry = dry * Decay2.ar(trig, 0.01, 0.2);\n\n phase = DelTapWr.ar(~buf, dry);\n iois = Array.geom(numEchoes, ioiScale, ioiDecayFactor);\n cumulDelay = iois.sum;\n (cumulDelay > ~buf.duration).if {\n Error(\"use a larger buffer\").throw;\n };\n snd = Silent.ar;\n iois.reverse.do { |ioi|\n snd = (snd + DelTapRd.ar(~buf, phase, cumulDelay, interp: 4)) * decayFactor;\n // one-pole lowpass -- LPF was too aggressive\n snd = OnePole.ar(snd, lpfCutoff / SampleRate.ir);\n cumulDelay = cumulDelay - ioi;\n };\n snd = snd + dry;\n \n snd * 0.5!2;\n}.play;\n\n// contributors so far: Nathan Ho\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Server.bootSync` do? What arguments does it take?"}, {"role": "assistant", "content": "Boot the Server and wait until it has completed before resuming the Arguments: condition — an optional instance of Condition used for evaluating this.."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n var time = 0.23;\n var freq = (55).midicps;\n var a = VarSaw.ar(freq/2, width: XLine.ar(0.5,1,time)).range(0,XLine.ar(0.666,1/666,time));\n var tone = SinOsc.ar(freq).fold(-0.23*a,a) * EnvGen.ar(Env([1,0],[time]));\n Out.ar(0, tone.dup);\n}.play;\n)\n```"}, {"role": "assistant", "content": "Seekers are something you should avoid.\r\nI put this code through Rakarrack to get some samples for heXon.\r\nheXon is a FOSS dual stick arcade shooter available at www.LucKeyProductions.nl."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = { |x, root = 60| x + root }; b = a.midicps; [a.value(9), b.value(9)];\na = Pseries(60, 1, inf).midicps; a.asStream.nextN(12);\n{ a = LFNoise1.ar(1) * 5 + 60; Pulse.ar(a.round.midicps * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = { |x, root = 60| x + root }; b = a.midicps; [a.value(9), b.value(9)];\na = Pseries(60, 1, inf).midicps; a.asStream.nextN(12);\n{ a = LFNoise1.ar(1) * 5 + 60; Pulse.ar(a.round.midicps) * 0.1 }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LPZ2`."}, {"role": "assistant", "content": "```supercollider\n// Compare:\n\n{ WhiteNoise.ar(0.25) }.play;\n\n{ LPZ2.ar(WhiteNoise.ar(0.25)) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// what can it sound like? see: https://www.youtube.com/watch?v=dRmY3tEwZyE \n// the youtube version has been sent through an additional reverb pedal, but\n// you don't need the pedal to get something that sounds interesting\n\n(\ns.options.memSize_(16384*10);\ns.reboot;\ns.waitForBoot({\n \n Ndef(\\bits, {\n var t = PulseCount.ar(Impulse.ar(8e3));\n var u = PulseCount.ar(Impulse.ar(7009));\n var sig = HPF.ar(\n (\n ((t * 15) & (t >> 5)) |\n ((t * 5) & (t >> [3, 4])) |\n ((t * 2) & (t >> 9)) |\n ((t * 8) & (t >> 11)) |\n (((t*t) & t) | (t >> 3))\n - 3 % 256\n ) / 127-1 * 3\n , 20\n ) * 0.1;\n var sig2 = LPF.ar(HPF.ar(gcd(t*u, u+t), WhiteNoise.ar()*2000 + 1000), 20);\n sig2 = sig2*sig;\n sig = 0.3*Splay.ar(Limiter.ar(Greyhole.ar(sig + sig2, sig, 0.5, sig), 0.5).flatten);\n }).play;\n});\n)\n```"}, {"role": "assistant", "content": "a surprisingly rich soundscape in a few lines of code (lucky accident)."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n~constructPseudoMethods = { |envir|\n var newEnvir = envir.collect { |value|\n var argNames, argBlock, namesBlock, code, func;\n if(value.isKindOf(Function)) {\n func = value;\n argNames = func.def.argumentString(withDefaultValues: true);\n namesBlock = func.def.argumentString(withDefaultValues: false);\n argBlock = if(argNames.notNil) { \"|self, \" ++ argNames ++ \"|\" };\n code = \"{ |func, envir| { % envir.use { func.value(%) } } }\".format(argBlock ? \"\", namesBlock ? \"\");\n //code.postln;\n code.interpret.value(func, envir)\n } {\n value\n }\n };\n newEnvir.know = true; // we want a prototype object style environment\n};\n```"}, {"role": "assistant", "content": "/*\r\nI often like to write out a library as an environment, like:\r\n\r\n~start_sound = { |freq, amp| <...> };\r\n~start_high_pitch_sound = { |amp| ~start_sound.(14000, amp) };\r\n\r\n… and then use loadRelative to load that library.\r\n\r\nThis, however has the problem that you can't stick the whole library into an environment that you call from the outside. e.g.\r\n\r\nq = ();\r\nq.use { resolveRelative(\"/library.sc."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\nz = { // thru\nBAllPass.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(10, 18000, \\exponential),\n 0.8, // rq\n 0.5); // mul\n}.play)\nz.release;\n\n(\nz = { // like a bandpass\n var sig;\n sig = SoundIn.ar([0, 1]) * 0.5;\n BAllPass.ar(sig, MouseX.kr(10, 18000, \\exponential), 0.8) + sig.neg\n}.play\nz.release;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\nz = { // thru\nBAllPass.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(10, 18000, \\exponential),\n 0.8, // rq\n 0.5); // mul\n}.play)\nz.release;\n\n(\nz = { // like a bandpass\n var sig;\n sig = SoundIn.ar([0, 1]) * 0.5;\n BAllPass.ar(sig, MouseX.kr(10, 18000, \\exponential), 0.8) + sig.neg\n}.play)\nz.release;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `OneZero`."}, {"role": "assistant", "content": "```supercollider\n{ OneZero.ar(WhiteNoise.ar(0.5), 0.5) }.play\n\n{ OneZero.ar(WhiteNoise.ar(0.5), -0.5) }.play\n\n{ OneZero.ar(WhiteNoise.ar(0.5), Line.kr(-0.5, 0.5, 10)) }.play\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{ var nse, env, kic;\n kic = tanh(Ringz.ar(LPF.ar(Trig.ar(Impulse.ar(1.0),SampleDur.ir),1000),30,0.25,7).sin*2);\n env = Env.perc(0.05, 1, 1, -4);\n nse = BrownNoise.ar(2) + PinkNoise.ar(0.5) * EnvGen.kr(env,Impulse.kr(1), doneAction: 2);\n\n nse = Mix.ar(BPF.ar(nse,[100,1200,80,40,20],MouseX.kr(0,1),[1,0.2,1,1,1]));\n nse = LPF.ar(nse + kic, MouseY.kr(100,1000))! 2\n\n}.play\n)\n```"}, {"role": "assistant", "content": "A muffled thump. An attempt at a Jurassic Park © glass of water sort of thing - or breaking into a silo."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Since the allpass delay has no audible effect as a resonator on\n// steady state sound ...\n\n{ AllpassL.ar(WhiteNoise.ar(0.1), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// ...these examples add the input to the effected sound and compare variants so that you can hear\n// the effect of the phase comb:\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassN.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2)\n}.play)\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassL.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Since the allpass delay has no audible effect as a resonator on\n// steady state sound ...\n\n{ AllpassL.ar(WhiteNoise.ar(0.1), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// ...these examples add the input to the effected sound and compare variants so that you can hear\n// the effect of the phase comb:\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassN.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2)\n}.play)\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassL.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2)\n}.play)\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassC.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2)\n}.play)\n\n// used as an echo - doesn't really sound different than Comb,\n// but it outputs the input signal immediately (inverted) and the echoes\n// are lower in amplitude.\n{ AllpassL.ar(Decay.ar(Dust.ar(1, 0.5), 0.2, WhiteNoise.ar), 0.2, 0.2, 3) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SoundFileView.readProgress` do?"}, {"role": "assistant", "content": "The reading progress, updated periodically when reading a soundfile using #-readWithTask or"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ var source = SinOsc.ar(40); var env = EnvFollow.ar(source, 0.999); [source,env] }.plot(0.5)\n\n\n{ var source = SoundIn.ar; var env = EnvFollow.ar(source, MouseX.kr(0.9,0.999); env }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ var source = SinOsc.ar(40); var env = EnvFollow.ar(source, 0.999); [source,env] }.plot(0.5)\n\n\n{ var source = SoundIn.ar; var env = EnvFollow.ar(source, MouseX.kr(0.9,0.999)); env }.play\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{Formants.ar(100, Vowel([\\e, \\o], [\\bass])) * 0.1 }.play\n{Formants.ar(100, Vowel(\\e, [\\bass,\\alto])) * 0.1 }.play\n{Formants.ar(100, Vowel([\\e, \\o], [\\bass,\\alto]) * 0.1 }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{Formants.ar(100, Vowel([\\e, \\o], [\\bass])) * 0.1 }.play\n{Formants.ar(100, Vowel(\\e, [\\bass,\\alto])) * 0.1 }.play\n{Formants.ar(100, Vowel([\\e, \\o], [\\bass,\\alto])) * 0.1 }.play\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `RedMixMono` in SuperCollider briefly."}, {"role": "assistant", "content": "RedMixMono — mix 2 mono channels in stereo Simple mixer that take two mono sources, combines them and output to one stereo. Category: Red > redMix."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `CombN`."}, {"role": "assistant", "content": "```supercollider\n// These examples compare the variants, so that you can hear the difference in interpolation\n\n// Comb used as a resonator. The resonant fundamental is equal to\n// reciprocal of the delay time.\n{ CombN.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ CombL.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ CombC.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// with negative feedback:\n{ CombN.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ CombL.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ CombC.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n// used as an echo.\n{ CombN.ar(Decay.ar(Dust.ar(1, 0.5), 0.2, WhiteNoise.ar), 0.2, 0.2, 3) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Pbindef`?"}, {"role": "assistant", "content": "Pbindef — incremental event pattern reference definition"}, {"role": "user", "content": "What does `Pbindef.new` do?"}, {"role": "assistant", "content": "store the pattern in the global dictionary of Pdef under key. If there is already a Pdef of this key, replace its pattern with the new one. If there is already a Pbindef af this key, set the parameters only, or add a new one (the whole pattern is replaced). Using *new(key) you can access the pattern at that key (if none is there, a default pattern is created). see Pdef."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nPbindef(\\x, \\note, Pseq([0, 7, 9]), \\dur, 0.2).play;\n```"}]} +{"conversations": [{"role": "user", "content": "List of exit codes?"}, {"role": "assistant", "content": "SuperCollider forum — List of exit codes?\n\n7068696c:\n\n```supercollider\no = s.options;\no.inDevice = nil;\no.outDevice = \"ASIO : ASIO4ALL\";\n```\n\nHmmmm... In earlier SC versions, it wouldn’t have worked to have a nil input device in scsynth either (which is admittedly a problem for devices with no inputs). This was fixed in scsynth but it’s possible that it wasn’t fully fixed in supernova.\n\n@MarcinP – any thoughts about this? (I remember you worked on scsynth device selection but I don’t recall who ported that to supernova.)\n\nhjh"}]} +{"conversations": [{"role": "user", "content": "What is `Process` in SuperCollider?"}, {"role": "assistant", "content": "Process — Runtime environment for the virtual machine and interpreter. A Process is the runtime environment for the virtual machine and interpreter. It has a subclass named Main which is where you should override the methods of Process. There are two methods of interest. One is named `startup` and is called after the class library has been compiled. The other is named `run` and is called when the user chooses the Run menu command. Category: Core > Kernel."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Lag3`."}, {"role": "assistant", "content": "```supercollider\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n Lag3.kr( // lag the modulator\n LFPulse.kr(4, 0, 0.5, 50, 400), // frequency modulator\n Line.kr(0, 1, 15) // modulate lag time\n ),\n 0, // phase\n 0.3 // sine amplitude\n )\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `UnicodeResponder.register` do? What arguments does it take?"}, {"role": "assistant", "content": "register responder functions for unicode and modifier combinations Arguments: unicode; shift; caps; opt; cntl; function."}]} +{"conversations": [{"role": "user", "content": "What does `AbstractPlayer.composeUnaryOp` do? What arguments does it take?"}, {"role": "assistant", "content": "the base class for all Players : a playable object Arguments: operator."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Hasher`."}, {"role": "assistant", "content": "```supercollider\n{ Hasher.ar(Line.ar(0, 1, 1), 0.2) }.play;\n\n// Even adding a small amount to the input can result in a very different output. Compare these two examples:\n(\n{\n SinOsc.ar(\n Hasher.kr(MouseX.kr(0, 10).round(1), 300, 500)\n ) * 0.1\n}.play;\n);\n\n(\n{\n SinOsc.ar(\n Hasher.kr(MouseX.kr(0, 10).round(1) + 0.0001, 300, 500)\n ) * 0.1\n}.play;\n);\n\n// Output stays constant while not moving the mouse.\n(\n{\n SinOsc.ar(\n Hasher.kr(MouseX.kr(0, 10), 300, 500)\n ) * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `DrawGrid.preview` do?"}, {"role": "assistant", "content": "Preview this `DrawGrid` object by creating a window with a view showing the `DrawGrid` in its current state. `d = DrawGrid(nil, \\freq.asSpec.grid, \\amp.asSpec.grid);` If the `DrawGrid` is modified, you can `-refresh` the returned `UserView` to see its updated state, or simply call `-preview` again to update the view (or create the preview again if the `Window` was closed). See #Testing and modifying#Examples Returns: A UserView which draws this `DrawGrid`."}]} +{"conversations": [{"role": "user", "content": "I made a synth and I hear nothing. Where do I start?"}, {"role": "assistant", "content": "Start with the node tree, not the code: evaluate `s.plotTree`. If your Synth is not there, it never started or it already freed itself; if it is there, the problem is in the signal. Which of the two do you see?"}, {"role": "user", "content": "It's in the tree."}, {"role": "assistant", "content": "Then the node lives and the signal is being lost. Check three things in order: does the SynthDef reach `Out.ar(0, ...)` with bus 0; is any `amp`/`mul` zero; and is a filter closed, e.g. `LPF.ar(sig, 50)` on a 440 Hz sine. Paste the SynthDef and I will read it."}, {"role": "user", "content": "SynthDef(\\x, { |out = 0| Out.ar(out, LPF.ar(Saw.ar(60), 80) * 0.1) }).add; Synth(\\x, [\\out, 2]);"}, {"role": "assistant", "content": "Two things. You wrote a low-pass at 80 Hz over a 60 Hz saw, which leaves almost nothing above the fundamental — the patch is nearly a sine at 60 Hz at very low level. And you passed `\\out, 2`, so it is going to bus 2, not the master. Try `Synth(\\x)` with the default out and a cutoff of 800:\n\n```supercollider\nSynthDef(\\x, { |out = 0, cutoff = 800| Out.ar(out, LPF.ar(Saw.ar(60), cutoff) * 0.1) }).add;\nSynth(\\x);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PulseCount`."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\"help-PulseCount\", { |out = 0|\n Out.ar(out,\n SinOsc.ar(\n PulseCount.ar(Impulse.ar(10), Impulse.ar(0.4)) * 200,\n 0, 0.05\n )\n )\n}).play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BiPanB2`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var w, x, y, p, q, a, b, c, d;\n\n p = LFSaw.ar(200);\n q = LFSaw.ar(301);\n\n // B-format encode\n #w, x, y = BiPanB2.ar(p, q, MouseX.kr(-1, 1), 0.1);\n\n // B-format decode to quad\n #a, b, c, d = DecodeB2.ar(4, w, x, y);\n\n [a, b, d, c] // reorder to my speaker arrangement: Lf Rf Lr Rr\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// default initial params\n{ FBSineL.ar(SampleRate.ir/4) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// default initial params\n{ FBSineL.ar(SampleRate.ir/4) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `RedSmooth2.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a new Arguments: factor — A Float. Less is more.; factor2 — A Float. Trend smoothing factor.; initVal — Initial value.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// this does not work:\n(\n{\n var trig = Dust.ar(4);\n Trig.kr(trig, 0.1) * SinOsc.ar(800) * 0.1\n}.play;\n);\n\n// this works:\n(\n{\n var trig = T2K.kr(Dust.ar(4));\n Trig.kr(trig, 0.1) * SinOsc.ar(800) * 0.1\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// this does not work:\n(\n{\n var trig = Dust.ar(4);\n Trig.kr(trig, 0.1) * SinOsc.ar(800) * 0.1\n}.play;\n);\n\n// this works:\n(\n{\n var trig = T2K.kr(Dust.ar(4));\n Trig.kr(trig, 0.1) * SinOsc.ar(800) * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `OpenObject.openInterpreter` do? What arguments does it take?"}, {"role": "assistant", "content": "Open the interpreter for external access. Do this only if you know what you are Arguments: addr — Address from which the messages come. `nil` means any. If a replyID (an Integer) is given, sends back a reply: The results are sent back to the sender under the OSC command `\"/oo_reply\" replyID val1 val2 …` `\"/oo_i\" string`."}]} +{"conversations": [{"role": "user", "content": "What does `FoaEncoderMatrix.newAtoB` do? What arguments does it take?"}, {"role": "assistant", "content": "A-format to B-format encoder. Encodes to a variety of tetrahedral orientations and W channel Arguments: orientation — Orientation of the A-format tetrahedron.; weight — The W weight factor. For convenience, equivalent virtual microphone pattern and decoding k are also listed.."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `SelectX` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar(300),\n Pulse.ar(230)\n ];\n\n SelectX.ar(MouseX.kr(0, 1) * a.size, a) * 0.2\n}.play;\n);\n\n(\n{\n var a;\n a = [\n SinOsc.kr(0.25),\n LFSaw.kr(10),\n LFPulse.kr(0.3)\n ];\n\n SinOsc.ar(SelectX.kr(MouseX.kr(0, 1) * a.size, a) * 300 + 400) * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is the difference between the language and the server?"}, {"role": "assistant", "content": "sclang runs your code, the clock and Patterns, and builds UGen graphs. scsynth performs the DSP in real time. They communicate over OSC, which is why a language-side mistake can leave a sound running, and why s.freeAll stops it."}]} +{"conversations": [{"role": "user", "content": "What does `MxUnit.prepareToBundle` do? What arguments does it take?"}, {"role": "assistant", "content": "Container for a musical object (Instr, NDef, Spline etc); this is a single unit that has inlets and outlets which can be connected to other units Arguments: agroup; bundle; private; bus."}]} +{"conversations": [{"role": "user", "content": "Explain `APF` in SuperCollider briefly."}, {"role": "assistant", "content": "APF — FIXME: APF purpose. FIXME: APF description. Category: UGens > Filters > Linear, UGens > Undocumented."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n// prep\ns = Server.local;\n\nn = SynthDef(\"Updater-help\", {|out, freq|\n var sin;\n sin = SinOsc.ar(freq, 0.5)*EnvGen.kr(Env.triangle(4,1), doneAction:2);\n Out.ar(out, sin);\n }).send(s);\n);\n\n(\n//create a new synth node on the server\nn = Synth.new(\"Updater-help\", [\\out, 0, \\freq, 220]);\n\n//you need to register the synth with a NodeWatcher first\nNodeWatcher.register(n);\n\n//update the client of \\n_end messages\nUpdater(n, {|node, msg|\n// …\n```"}, {"role": "assistant", "content": "create a new synth node on the server you need to register the synth with a NodeWatcher first (Updater: simple MVC utility; calls an update handler when the model changes)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// load a synthdef\ns.boot;\nSynthDef(\"pdef_grainlet\",\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.3), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n\nTdef(\\z, Pseq([1, 1, 1, 0.5, 0.5], inf));\n\n(\nPset(\\instrument, \\pdef_grainlet,\n Ppar([\n Pbind(\n \\dur, Tdef(\\z),\n \\note, Pseq([1, 3, 2, 1, 0], inf),\n \\x, Pfunc\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// load a synthdef\ns.boot;\nSynthDef(\"pdef_grainlet\",\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.3), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n\nTdef(\\z, Pseq([1, 1, 1, 0.5, 0.5], inf));\n\n(\nPset(\\instrument, \\pdef_grainlet,\n Ppar([\n Pbind(\n \\dur, Tdef(\\z),\n \\note, Pseq([1, 3, 2, 1, 0], inf),\n \\x, Pfunc { TempoClock.default.elapsedBeats.postln } // posts the onset times\n ),\n Pbind(\n \\dur, 4, // reference beat\n \\sustain, 0.1,\n \\note, 8\n )\n ])\n).play(quant: 1);\n);\n\n\nTdef(\\z, Prand([1, 1, 0.23, 0.5, 0.5], inf)); // exchange time pattern\nTdef(\\z, Pseq([1, 1, 1, 1], inf)); // pattern stays in sync.\nTdef(\\z, Pseq([1, 1, 1, 0.5, 0.5], inf)); // but might be in different order.\n // to avoid this, set quant to an appropriate value.\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Psubdivide`."}, {"role": "assistant", "content": "```supercollider\n(\na = Psubdivide(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,0,1,3,4,0], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n100.do({ x.next.postln });\n);\n\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Psubdivide(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n);\n\n\n(\na = Psubdivide(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,4,4,0,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `InspButton.new` do? What arguments does it take?"}, {"role": "assistant", "content": "displays an object by its name, when clicked the object is inspected using Insp Arguments: target — the object to be inspected; layout — the parent view, FlowView or window; minWidth — Label will automatically size itself to fit the name. minWidth specifies a minimum width so that multiple labels will align nicely.."}]} +{"conversations": [{"role": "user", "content": "What does `PatchOut.allocBus` do? What arguments does it take?"}, {"role": "assistant", "content": "manages a Player's output when connecting to other Players Arguments: name; rate; numChannels."}]} +{"conversations": [{"role": "user", "content": "What does `Pnsym.new` do? What arguments does it take?"}, {"role": "assistant", "content": "use a pattern of symbols to embed Pdefns Arguments: pattern — a pattern that returns symbols or characters. Arrays are converted to parallel patterns (Ptuple).; dict — the dictionary to be used for lookup. By default, this is `Pdefn.all`, so one can embed Pdefns by name.."}]} +{"conversations": [{"role": "user", "content": "What does `Class.browse` do?"}, {"role": "assistant", "content": "Open a graphical browser for this Class. Shows methods, arguments, variables, subclasses, and has buttons for navigating to the superclass, source, helpfile, etc."}]} +{"conversations": [{"role": "user", "content": "What is `Lorenz2DL` in SuperCollider?"}, {"role": "assistant", "content": "Lorenz2DL — lorenz 2D chaotic generator `x' = s(y - x)` Category: UGens > Generators > Stochastic."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\freq, Pseq([500, 600, 700]), \\instrument, \\sinegrain);\na = Paddp(\\freq, Pseq([30, 90, -100], inf), a);\na.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\freq, Pseq([500, 600, 700]), \\instrument, \\sinegrain);\na = Paddp(\\freq, Pseq([30, 90, -100], inf), a);\na.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Control`."}, {"role": "assistant", "content": "```supercollider\na = { SinOsc.ar(\\freq.kr(440, 1.2)) }.play;\na.set(\\freq, 330);\na.release;\na = { SinOsc.ar(\\freq.kr([440, 460], 1.2)) }.play;\na.setn(\\freq, [330, 367]);\na.release;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Interpreter`?"}, {"role": "assistant", "content": "Interpreter — The interpreter defines a context in which interactive commands are compiled and executed."}, {"role": "user", "content": "What does `Interpreter.clearAll` do?"}, {"role": "assistant", "content": "set the values of the variables `a` through `z` to nil. `x = 123;`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// typical usage\na = 4;\nb = 3;\nb = b + a;\n\n// some sound\na = Synth(\\default);\ng = fork { loop { 0.1.wait; a.set(\\freq, 200 + 20.0.rand2.postln) } };\ng.stop; a.free;\n\n// an overview of all the variables\nthis.inspect;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `BusSpec` in SuperCollider?"}, {"role": "assistant", "content": "BusSpec — datatype specifying a Bus object Category: Spec, Libraries > crucial > Spec."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// q.zoom sets all the influx'es inScalers AND RandomOrbit's excursion from current state.\n\nq.zoom = q.zoom?1;\n\nq.setZoom = {|ev, val|\n val = val.clip(0.05, 1.0).round(0.05);\n // \"global ZOOM f. RandomOrbits and Influxes: %\\n\".postf(val);\n q.zoom = val;\n // do external funcs here\n try{ q.prez.ezs.value = q.zoom };\n q.inphlux.inScaler = q.zoom;\n // return value\n val\n};\n// increment / decrement\nq.incZoom = {|ev, inc=0.1|\n q.setZoom((q.zoom + inc));\n};\n\n\n// set it to poti on ana in 8 (it was 7, not worked)\nMKtl(\\xosc).elAt('inA').at(7).action.add(\\setZoom, {|el|\n var val = el.value.clip(0.05, 1).round(0.05);\n if (val != q.zoom) {\n \"zoom from xosc: %\\n\".postf(val);\n q.setZoom(val)\n };\n});\n```"}, {"role": "assistant", "content": "q.zoom sets all the influx'es inScalers AND RandomOrbit's excursion from current state."}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nMix.ar([SinOsc.ar(220, 0, 0.1), SinOsc.ar(330, 0, 0.1)])\n```"}, {"role": "assistant", "content": "Sums two sine waves into one signal — a perfect fifth, 220 Hz and 330 Hz, at 0.1 amplitude each.\n\n`[SinOsc.ar(220, 0, 0.1), SinOsc.ar(330, 0, 0.1)]` is an Array of two audio-rate signals (each UGen\nreturns a signal; an array of them is just a list). `Mix.ar` adds the elements together. The alternative\n`+` operator does the same for two signals, and `Splay.ar` would spread them across the stereo field\ninstead of summing them."}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for very punchy snare in neurofunk style: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\neurosnare, {\n var snd;\n // a percussive click to give it some attack\n snd = LPF.ar(HPF.ar(WhiteNoise.ar, 300), 8000) * Env.linen(0.001, 0.01, 0.001).ar;\n // sine sweep body. very important!\n snd = snd + (SinOsc.ar(Env([400, 196, 160], [0.04, 0.2], \\exp).ar) * Env.perc(0.04, 0.2).ar * 6.dbamp).tanh;\n // sound of snare coils rattling\n snd = snd + (HPF.ar(BPeakEQ.ar(WhiteNoise.ar, 4000, 0.5, 3), 300) * Env.perc(0.05, 0.2).delay(0.01).ar(2) * -3.dbamp);\n // another sound sweep to improve the attack, optional\n snd = snd + (SinOsc.ar(XLine.kr(3000, 1500, 0.01)) * Env.perc(0.001, 0.02).ar);\n // distortion helps glue everything together and acts as a compressor\n snd = (snd * 1.4).tanh;\n snd = Pan2.ar(snd, \\pan.kr(0), \\amp.kr(0.1));\n Out.ar(\\out.kr(0), snd);\n}).add;\n);\n\nSynth(\\neurosnare, [amp: 0.4]);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Control.names` do? What arguments does it take?"}, {"role": "assistant", "content": "Bring signals and floats into the ugenGraph function of a SynthDef. Arguments: names — adds control names to the SynthDef.."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for danger loud click. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// proceed with caution. start at min volume, and not with your expensive speakers.\n\nfork{b=Buffer.alloc(s,512,1);inf.do{b.cheby({[1,0].choose}!2);{(Shaper.ar(b,SinOsc.ar(55,0,Line.kr(1,0,2,1,0,2))))!2}.play;0.1.wait;}};\n```"}]} {"conversations": [{"role": "user", "content": "How do I make this brighter?\n```supercollider\n{ LPF.ar(Saw.ar(110), 400) * 0.2 }.play;\n```"}, {"role": "assistant", "content": "Raise the cutoff. 400 Hz is well below the harmonics that carry brightness, so open it to 2000-4000 Hz:\n\n```supercollider\n{ LPF.ar(Saw.ar(110), 3000) * 0.2 }.play;\n```"}, {"role": "user", "content": "Still dull."}, {"role": "assistant", "content": "Then the low-pass is not the limit — the source is. A saw at 110 Hz has energy up to Nyquist, so check the amplitude: at 0.2 the high harmonics are quiet. Two moves: add resonance so the filter peak is audible, and raise the level slightly.\n\n```supercollider\n{ RLPF.ar(Saw.ar(110), 2500, 0.3) * 0.35 }.play;\n```\n\nIf that is still dull, the answer is a different source: `Saw` is band-limited and soft; try `LFSaw` or add a second detuned saw for more high content."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\\help_isRand, { |out|\n Out.ar(out,\n SinOsc.ar(Rand(400, 800), 0, 0.2) * Line.kr(1, 0, 1, doneAction: Done.freeSelf)\n )\n}).add;\n);\na = Synth(\\help_isRand);\nb = Synth(\\help_isRand; // a different randomly selected freq\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\\help_isRand, { |out|\n Out.ar(out,\n SinOsc.ar(Rand(400, 800), 0, 0.2) * Line.kr(1, 0, 1, doneAction: Done.freeSelf)\n )\n}).add;\n);\na = Synth(\\help_isRand);\nb = Synth(\\help_isRand); // a different randomly selected freq\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n var freq;\n\n freq = StreamKrDur(\n Pbrown(40,100,100,inf),\n `[ 1,2, 0.25], // an array\n 0.05);\n\n Tempo.bpm = 100; // times are in beats\n Patch({ arg freq=440;\n SinOsc.ar(freq,SinOsc.ar(600,0,0.3))\n //PMOsc.ar(freq,100,1.0,0,0.3)\n },[\n freq\n ]).play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n var freq;\n\n freq = StreamKrDur(\n Pbrown(40,100,100,inf),\n `[ 1,2, 0.25], // an array\n 0.05);\n\n Tempo.bpm = 100; // times are in beats\n Patch({ arg freq=440;\n SinOsc.ar(freq,SinOsc.ar(600,0,0.3))\n //PMOsc.ar(freq,100,1.0,0,0.3)\n },[\n freq\n ]).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Pattern transcription of intro chords of this song."}, {"role": "assistant", "content": "```supercollider\n// Crystal Waters \"Gypsy Woman (She's Homeless)\" - chords\n(\n~bpm = TempoClock.new(120/60);\nPbind(\n \\midinote, Pseq([\n Pn([45, 57, 67, 72, 76], 2),\n Pn([46, 58, 69, 74, 77], 3),\n Pn([43, 55, 67, 70, 74, 77], 2), \n Pn([48, 60, 67, 70, 73, 76], 3),\n Pseq([\n Pn([50, 62, 65, 69, 72, 76], 2),\n Pn([50, 62, 65, 69, 72, 74], 3)\n ], 2),\n Pn([45, 57, 67, 72, 76], 2),\n Pn([46, 58, 69, 74, 77], 3),\n Pn([52, 64, 76, 79, 83, 86], 2),\n Pn([51, 63, 75, 79, 82, 86], 3),\n Pseq([\n Pn([50, 62, 65, 69, 72, 76], 2),\n Pn([50, 62, 65, 69, 72, 74], 3)\n ], 2),\n ], inf),\n \\ctranspose, -12,\n \\dur, Pseq([1, Pn(3/4, 4)], inf),\n \\amp, 0.2,\n \\legato, Pseq([0.5, 0.5, Pwhite(0.2, 0.3, 3)], inf)\n).play(~bpm);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot; // start the server\n\n// something to record\n(\nSynthDef(\"bubbles\", { |out|\n var f, sound;\n f = LFSaw.kr(0.4, 0, 24, LFSaw.kr([8, 7.23], 0, 3, 80)).midicps; // glissando function\n sound = CombN.ar(SinOsc.ar(f, 0, 0.04), 0.2, 0.2, 4); // echoing sine wave\n Out.ar(out, sound);\n}).add;\n);\n\nx = Synth.new(\"bubbles\";\n\ns.prepareForRecord; // if you want to start recording at a precise moment in time, you have to call this first.\n\ns.record;\n\ns.pauseRecording; // pausable\n\ns.record\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot; // start the server\n\n// something to record\n(\nSynthDef(\"bubbles\", { |out|\n var f, sound;\n f = LFSaw.kr(0.4, 0, 24, LFSaw.kr([8, 7.23], 0, 3, 80)).midicps; // glissando function\n sound = CombN.ar(SinOsc.ar(f, 0, 0.04), 0.2, 0.2, 4); // echoing sine wave\n Out.ar(out, sound);\n}).add;\n);\n\nx = Synth.new(\"bubbles\");\n\ns.prepareForRecord; // if you want to start recording at a precise moment in time, you have to call this first.\n\ns.record;\n\ns.pauseRecording; // pausable\n\ns.record // start again\n\ns.stopRecording; // this closes the file and deallocates the buffer recording node, etc.\n\nx.free; // stop the synths\n\n// look in your recordings folder and you'll find a file named for this date and time\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Editor.patchOut` do?"}, {"role": "assistant", "content": "holds a value that can be edited with a GUI, saves as the value"}]} -{"conversations": [{"role": "user", "content": "What does `ServerOptions.zeroConf` do?"}, {"role": "assistant", "content": "A Boolean indication whether or not the server should publish its port using zero configuration networking, to facilitate network interaction. This is true by default; if you find unacceptable delays (beachballing) upon server boot, you can try setting this to"}]} -{"conversations": [{"role": "user", "content": "How do I use a metronome or check my timing?"}, {"role": "assistant", "content": "A click on the clock you are using, plus a counter to see where you are in the bar:\n\n```supercollider\n(\nTdef(\\click, {\n var count = 0;\n loop {\n (Synth(\\hat, [\\amp, if (count % 4 == 0) { 0.25 } { 0.08 }]));\n count = count + 1;\n 1.wait;\n }\n}).play;\n)\n```\n\nBecause it waits on `TempoClock.default`, it stays in sync with every Pbind you start, which makes it a\ntempo reference rather than a separate sound."}]} +{"conversations": [{"role": "user", "content": "What is `Env`?"}, {"role": "assistant", "content": "Env — Specification for a segmented envelope"}, {"role": "user", "content": "What does `Env.new` do?"}, {"role": "assistant", "content": "Create a new envelope specification."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// an envelope in a synth\n(\n{\n var env = Env([0, 1, 0.5, 1, 0], [0.01, 0.5, 0.02, 0.5]);\n SinOsc.ar(470) * EnvGen.kr(env, doneAction: Done.freeSelf)\n}.play\n);\n// an envelope to control a parameter in a pattern\n(\nPbind(\n \\note, Env([0, 12, 6, 13, 0], [1, 5, 2, 10]),\n \\dur, 0.1\n).play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n//bass synth\n{Out.ar(0,Pan2.ar(DoubleWell3.ar(f:SinOsc.ar(MouseX.kr(0,200),0,MouseY.kr(0.5,4.0))),0.0))}.play\n\n//plotting check of first samples\n{DoubleWell3.ar}.plot(0.05, minval:-1, maxval:1)\n\n//gradually changing \n{Pan2.ar(DoubleWell3.ar(0,0.05,LFSaw.ar(Line.kr(10,1000,10)),Line.kr(0.0,0.3,20)),0.0)}.play\n\n//controlled - midscreen amplitude jump\n{Pan2.ar(DoubleWell3.ar(0,0.05,L\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n//bass synth\n{Out.ar(0,Pan2.ar(DoubleWell3.ar(f:SinOsc.ar(MouseX.kr(0,200),0,MouseY.kr(0.5,4.0))),0.0))}.play\n\n//plotting check of first samples\n{DoubleWell3.ar}.plot(0.05, minval:-1, maxval:1)\n\n//gradually changing \n{Pan2.ar(DoubleWell3.ar(0,0.05,LFSaw.ar(Line.kr(10,1000,10)),Line.kr(0.0,0.3,20)),0.0)}.play\n\n//controlled - midscreen amplitude jump\n{Pan2.ar(DoubleWell3.ar(0,0.05,LFSaw.ar(MouseX.kr(10,1000)),MouseY.kr(0.0,0.5)),0.0)}.play\n\n\n\n//triggering\n{DoubleWell3.ar(Impulse.kr(MouseY.kr(0.01,100, 'exponential')),0.1,LFCub.ar(MouseX.kr(10,1000, 'exponential')),MouseY.kr(0.0,1.0),LFNoise0.kr(2.3,0.2,0.8),LFNoise1.kr(2.37,0.2,0.8))}.play\n\n\n//AudioIn as forcing\n{Pan2.ar(DoubleWell3.ar(0,0.05,LPF.ar(AudioIn.ar(1),100,MouseX.kr(0,1000)),MouseY.kr(0.0,0.5)),0.0)}.play\n```"}]} +{"conversations": [{"role": "user", "content": "What does `AbstractPlayerGui.topGui` do? What arguments does it take?"}, {"role": "assistant", "content": "does synthConsole saveConsole does writeName does guiBody then shrinks the window to Arguments: parent; bounds; ... args."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code:\n```supercollider\n{ SinOsc.ar(440) * EnvGen.kr(Env.perc(0.01, 1), doneAction: 2) }.play;\n```"}, {"role": "assistant", "content": "It plays a 440 Hz sine with a percussive envelope, and the Synth frees itself when the envelope\nends.\n\n- `SinOsc.ar(440)` is an audio-rate sine at 440 Hz.\n- `Env.perc(0.01, 1)` is a 10 ms attack to full level then a 1 s decay to zero.\n- `EnvGen.kr(...)` plays that envelope at control rate and multiplies the sine, so the sound fades out.\n- `doneAction: 2` frees the Synth at the end of the envelope, so it does not accumulate silent nodes.\n- `.play` on the function builds an anonymous SynthDef and starts one Synth of it."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LinCongN`."}, {"role": "assistant", "content": "```supercollider\n// randomly modulate params\n(\n{ LinCongN.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(0.1, 0.5, 1.4),\n LFNoise2.kr(0.1, 0.1, 0.1),\n LFNoise2.kr(0.1)\n) * 0.2 }.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `String.drawLeftJustIn` do?"}, {"role": "assistant", "content": "Draws the String into the given Rect using the Font and Color specified."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n~constructPseudoMethods = { |envir|\n var newEnvir = envir.collect { |value|\n var argNames, argBlock, namesBlock, code, func;\n if(value.isKindOf(Function)) {\n func = value;\n argNames = func.def.argumentString(withDefaultValues: true);\n namesBlock = func.def.argumentString(withDefaultValues: false);\n argBlock = if(argNames.notNil) { \"|self, \" ++ argNames ++ \"|\" };\n code = \"{ |func, envir| { % envir.use { func.value(%) } } }\".format(argBlock ? \"\", namesBlock ? \"\");\n //code.postln;\n code.interpret.value(func, envir)\n } {\n value\n }\n };\n newEnvir.know = true; // we want a prototype object style environment\n};\n```"}, {"role": "assistant", "content": "/*\r\nI often like to write out a library as an environment, like:\r\n\r\n~start_sound = { |freq, amp| <...> };\r\n~start_high_pitch_sound = { |amp| ~start_sound.(14000, amp) };\r\n\r\n… and then use loadRelative to load that library.\r\n\r\nThis, however has the problem that you can't stick the whole library into an environment that you call from the outside. e.g.\r\n\r\nq = ();\r\nq.use { resolveRelative(\"/library.sc."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `RecordBuf` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// Execute the following in order\n(\n// allocate a Buffer\ns = Server.local;\nb = Buffer.alloc(s, 44100 * 4.0, 1); // a four second 1 channel Buffer\n);\n\n// record for four seconds\n(\nSynthDef(\\help_RecordBuf, { |out = 0, bufnum = 0|\n var formant;\n formant = Formant.ar(XLine.kr(400, 1000, 4), 2000, 800, 0.125);\n RecordBuf.ar(formant, bufnum, doneAction: Done.freeSelf, loop: 0);\n}).play(s, [\\out, 0, \\bufnum, b]);\n);\n\n// play it back\n(\nSynthDef(\\help_RecordBuf_playback, { |out = 0, bufnum = 0|\n var playbuf;\n playbuf = PlayBuf.ar(1, bufnum);\n FreeSelfWhenDone.kr(playbuf); // frees the synth when the PlayBuf is finished\n Out.ar(out, playbuf);\n}).play(s, [\\out, 0, \\bufnum, b]);\n);\n\n// overdub\n(\nSynthDef(\\help_RecordBuf_overdub, { |out = 0, bufnum = 0|\n var formant;\n formant = Formant.ar(XLine.kr(200, 1000, 4), 2000, 800, 0.125);\n // mixes equally with existing data\n RecordBuf.ar(formant, bufnum, 0, 0.3, 0.5, doneAction: Done.freeSelf, loop: 0);\n}).play(s, [\\out, 0, \\bufnum, b]);\n);\n\n// play back the overdubbed version\nSynth.new(\\help_RecordBuf_playback, [\\out, 0, \\bufnum, b], s);\n\n// write the contents of the buffer to a file (see Buffer for more options)\n(\nb.write(sampleFormat: 'int16');\nthisProcess.platform.recordingsDir +/+ \"SC_\" ++ Date.localtime.stamp ++ \".aiff\"; // generated path\n);\n\nb.close; b.free; // cleanup\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// Periphonic (3D) decoder with eight channels arranged in a bi-rectangle:\n// [ [ 30, 0 ], [ -30, 0 ], [ 90, 35.3 ], [ -90, 35.3 ],\n// [ -150, -0 ], [ 150, -0 ], [ -90, -35.3 ], [ 90, -35.3 ] ]\n\n// specify 1/2 the desired directions\n~directions = [[ 30, 0 ], [ -30, 0 ], [ 90, 35.3 ], [ -90, 35.3]].degrad;\n~decoder = FoaDecoderMatrix.newDiametric(~directions);\n\n// inspect\n~decoder.dirChannels.raddeg\n```"}, {"role": "assistant", "content": "Periphonic (3D) decoder with eight channels arranged in a bi-rectangle: [ [ 30, 0 ], [ -30, 0 ], [ 90, 35.3 ], [ -90, 35.3 ], (FoaDecoderMatrix: First Order Ambisonic (FOA) decoder matrices)"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Pmulpre` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain);\nb = Pmulpre(\\freq, Pseq([1, 2, 3], inf), a);\nb.play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "What is the difference between .ar, .kr and .ir?"}, {"role": "assistant", "content": "The rate method decides how often a UGen is evaluated. `.ar` runs at the audio rate, once per sample, and produces an audio signal. `.kr` runs at the control rate, once per block of 64 samples by default, so it is cheaper and is used for parameters that do not need sample accuracy. `.ir` is evaluated once when the Synth is created and then never again, for constants such as SampleRate.ir or a size. Using .kr where you need audio-rate modulation gives stepped, zipper-noise-like control; using .ar where .kr would do costs CPU."}]} -{"conversations": [{"role": "user", "content": "What does `Symbol.tr` do?"}, {"role": "assistant", "content": "Return a TrigControl input with a default value (val). If val is an array, the control will be"}]} -{"conversations": [{"role": "user", "content": "What is `ProxySynthDef`?"}, {"role": "assistant", "content": "ProxySynthDef — synth def that wraps ugen graph"}, {"role": "user", "content": "What does `ProxySynthDef.sampleAccurate` do?"}, {"role": "assistant", "content": "always use OffsetOut, if set to true (default: false)"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na = ProxySynthDef(\"xtest\", { SinOsc.ar(400) * 0.1 });\n\na.add;\n\nx = Synth(\"xtest\");\nx.release;\n\n\n/*\n\n if the resulting number of channels is larger than a given channelConstraint,\n it behaves according to the rate: audio rate signals are wrapped around\n a smaller channel size, control rate signals are not (the exceeding channels are left out)\n\n*/\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Red3DPlane` in SuperCollider?"}, {"role": "assistant", "content": "Red3DPlane — 3D plane / rectangle A class for rotating and rendering a plane in 3D. Category: Red > redUniverse > 3D."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for little homage to \"Come Out\" by Steve Reich."}, {"role": "assistant", "content": "```supercollider\n/* A little homage to \"Come Out\" by Steve Reich.\n It explores ryhtmic aspects created by phasing, retriggering, and pitch shifting.\n It \"detours\" the original audio message available here\n http://www.freesound.org/people/ERH/sounds/34667/\n in which a police patrol recites\n \"We don't want to scare your children, that's the last thing we wanna do\".\n \n */\n\n\ns.options.memSize=128*1024;\ns.boot;\n\n~bus=Bus.audio(s,2);\n~buf=Buffer.readChannel(s,\"/home/***/Supercollider/sounds/v.wav\");\n\n(\nSynthDef(\\playbuff,{arg in=0,out=0,t_trig=0;\n var i=EnvGen.kr(Env([0,40,0.3,0.4,40,0],[0,60,20,20,30]),gate:1);\n var r=EnvGen.kr(Env([0,10,-0.9,-0.9],[40,20,15]),gate:t_trig,doneAction:2);\n var sig1=PlayBuf.ar(1,in,rate:1+r,trigger:Impulse.kr(i),loop:1);\n var sig2=PlayBuf.ar(1,in,rate:1+r,trigger:Impulse.kr(i+0.01),loop:1);\nOut.ar(out,Splay.ar([sig1,sig2],0.5));\n};\n).add;\n\nSynthDef(\\rev,{arg in=0,out=0;\n var sig=In.ar(in,2);\n sig=Compander.ar(sig,sig,0.8,1/3);\n sig=FreeVerb.ar(sig,mix:0.4);\nOut.ar(out,sig);\n};\n).add;\n);\n\nSynth(\\rev,[\\in:~bus]);\n\nfork{\nx=Synth(\\playbuff,[\\out:~bus]);\n75.wait;\nx.set(\\t_trig,1);\n};\n\ns.quit;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Out.ar(87, SinOsc.ar(MouseX.kr(340, 1000, 1) * [1, 2, 3], 0, 0.2)) }.play;\nx = Monitor.new.play(87, 3, 0, fadeTime: 3;\nx.vol = 0.3;\nx.stop;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Out.ar(87, SinOsc.ar(MouseX.kr(340, 1000, 1) * [1, 2, 3], 0, 0.2)) }.play;\nx = Monitor.new.play(87, 3, 0, fadeTime: 3);\nx.vol = 0.3;\nx.stop;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n var time = 0.23;\n var freq = (55).midicps;\n var a = VarSaw.ar(freq/2, width: XLine.ar(0.5,1,time)).range(0,XLine.ar(0.666,1/666,time));\n var tone = SinOsc.ar(freq).fold(-0.23*a,a) * EnvGen.ar(Env([1,0],[time]));\n Out.ar(0, tone.dup);\n}.play;\n)\n```"}, {"role": "assistant", "content": "Seekers are something you should avoid.\r\nI put this code through Rakarrack to get some samples for heXon.\r\nheXon is a FOSS dual stick arcade shooter available at www.LucKeyProductions.nl."}]} +{"conversations": [{"role": "user", "content": "What does `PV_PhaseShift90.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Shift phase by 90 degrees. Arguments: buffer — FFT buffer.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n Lag3.kr( // lag the modulator\n LFPulse.kr(4, 0, 0.5, 50, 400), // frequency modulator\n Line.kr(0, 1, 15) // modulate lag time\n ),\n 0, // phase\n 0.3 // sine amplitude\n )\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n Lag3.kr( // lag the modulator\n LFPulse.kr(4, 0, 0.5, 50, 400), // frequency modulator\n Line.kr(0, 1, 15) // modulate lag time\n ),\n 0, // phase\n 0.3 // sine amplitude\n )\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Compare:\n\n{ WhiteNoise.ar(0.25) }.play;\n\n{ HPZ1.ar(WhiteNoise.ar(0.25)) }.play;\n\n// HPZ1 is useful to detect changes in a signal:\n// see also HPZ2\n(\n{\n var changingSignal = LFNoise0.ar(1000);\n var hpz1 = HPZ1.ar(changingSignal);\n [hpz1, hpz1 > 0, hpz1.abs > 0]\n}.plot\n;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Compare:\n\n{ WhiteNoise.ar(0.25) }.play;\n\n{ HPZ1.ar(WhiteNoise.ar(0.25)) }.play;\n\n// HPZ1 is useful to detect changes in a signal:\n// see also HPZ2\n(\n{\n var changingSignal = LFNoise0.ar(1000);\n var hpz1 = HPZ1.ar(changingSignal);\n [hpz1, hpz1 > 0, hpz1.abs > 0]\n}.plot\n);\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `Pprob` in SuperCollider briefly."}, {"role": "assistant", "content": "Pprob — random values with arbitrary probability distribution Creates an integral table on instantiation (cpu intensive) which is then used by the streams to generate random values efficiently. Category: Streams-Patterns-Events > Patterns > Random."}]} +{"conversations": [{"role": "user", "content": "What is `Env`?"}, {"role": "assistant", "content": "Env — Specification for a segmented envelope"}, {"role": "user", "content": "What does `Env.new` do?"}, {"role": "assistant", "content": "Create a new envelope specification."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// an envelope in a synth\n(\n{\n var env = Env([0, 1, 0.5, 1, 0], [0.01, 0.5, 0.02, 0.5]);\n SinOsc.ar(470) * EnvGen.kr(env, doneAction: Done.freeSelf)\n}.play\n);\n// an envelope to control a parameter in a pattern\n(\nPbind(\n \\note, Env([0, 12, 6, 13, 0], [1, 5, 2, 10]),\n \\dur, 0.1\n).play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `BPF`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// synthdefs to play with\n(\nSynthDef(\\noise_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, rq = 0.1, amp = 0.1|\n var sig = { WhiteNoise.ar } ! 2;\n sig = BPF.ar(sig, freq, rq) *\n EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2) *\n (rq ** -1) * (250 / (freq ** 0.8));\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\sin_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { SinOsc.ar(freq, Rand(0, 2pi)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n\n\nSynthDef(\\saw_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { VarSaw.ar(freq, Rand(0, 1)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `Henon2DN` in SuperCollider briefly."}, {"role": "assistant", "content": "Henon2DN — henon map 2D chaotic generator `y = b * x(n)` Category: UGens > Generators > Stochastic."}]} +{"conversations": [{"role": "user", "content": "What does `Object.cyc` do?"}, {"role": "assistant", "content": "Embeds the receiver in the stream n times (default: inf), each time resetting it. `a ="}]} +{"conversations": [{"role": "user", "content": "How to generate paradiddles?"}, {"role": "assistant", "content": "SuperCollider forum — How to generate paradiddles?\n\nHi Rodet, I’m teaching jazz at college, and sometimes paradiddles come up in conversation (although I’m not a drummer). A paradiddle is basically a way of ‘evenly’ playing a roll (single/double/triple/whatever). If you take your drumsticks/fingers and play evenly:\n\nright, left, right, right, left, right, left, left, right, left, right, right, etc\n\nyou’ll notice that it’s possible to get an even rhythm, which when played fast becomes a roll. The idea of the single/double/triple is just to place the accents (lightly, or not) on the left, right hand, which if I understand helps keep an even stroke (and makes better sense to follow).\n\nSo, although I don’t know the goal of your idea, a simple code which would give you the solution could be a pattern. You’ll notice I’ve put in a SynthDef to give the ‘snare’ sound - not very real, but just for the demonstration. If you run these patterns, un-commenting the line needed (single, double or triple - don’t forget to comment out the lines you don’t need), you’ll hear the accents a paradiddle gives.\n\nIn this example Pbind ‘a’ gives the pulse, and Pbind ‘b’ the accents. And, if you play along with them (using your chart), you’ll notice the accents pass from right hand to left hand (or vice versa). This is (more or less) what paradiddles do, although a drummer will explain better how they ‘accent’ strokes to get more complicated/subtle rhythms.\n\n```supercollider\n(\nSynthDef(\\snare, {\n arg out=0, sus=0.1;\n var sig, env;\n sig = WhiteNoise.ar(0.1);\n env = EnvGen.kr(Env.perc(0.001, sus), doneAction:2);\n sig = sig*env;\n Out.ar(out, sig!2);\n}).add;\n);\n\n(\nt=TempoClock(80/60);\na=Pbind(\n \\instrument, \\snare,\n \\dur, 1/2,\n \\sus, 0.01\n);\nb=Pbind(\n \\instrument, \\snare,\n \\dur, 1,\n \\sus, Pseq([0.02, 0.01],inf), // single\n //\\sus, Pseq([0.02, 0.01, 0.01],inf), // double\n //\\sus, Pseq([0.02, 0.01, 0.01, 0.01],inf), // triple\n);\nPpar([a, b]).play(t);\n)\n```\n\nI hope that puts you on the right track.\n\np.s. Don’t forget to try out changing the speed to get the real effect. Try something like 320/60 on the TempoClock."}]} +{"conversations": [{"role": "user", "content": "How do I distort a signal?"}, {"role": "assistant", "content": "Drive it into a nonlinearity, then tame the level: `tanh` is soft clipping, `.distort` is harder,\nand a low-pass after the drive keeps it from getting fizzy.\n\n```supercollider\n(\n{\n var sig = SinOsc.ar(110) * 0.3;\n var driven = (sig * 12).tanh;\n LPF.ar(driven, 5000) * 0.4\n}.play;\n)\n```\n\nMore drive means more harmonics; because they are generated, the output is louder as well as brighter, so\nscale the result down after the nonlinearity."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Pseq` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Pseq(#[60, 61, 63, 65, 72], inf).asStream;\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, a.next.midicps]);\n 0.2.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Saw`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n SynthDef(\\controlList, { |out = 0, freq = 440, amp = 0.1, detune = #[0.999, 1.001], gate = 1|\n var sig = Mix(Saw.ar(freq * (detune ++ [1]), amp)),\n env = EnvGen.kr(Env.adsr, gate, doneAction: Done.freeSelf);\n Out.ar(out, (sig * env) ! 2);\n }).add;\n\n SynthDescLib.global[\\controlList]\n )\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n(\np = Pbind(\n \\instrument, \\synth_1a,\n \\preAmp, PL(\\preAmp), \n \\amp, PL(\\amp), \n \\midinote, PLseq(\\seq) + PL(\\seqAdd), \n \\dur, 0.2\n);\n\n~spec = 4.collect { |i| [\\seq, [12*i + 24, 12*i + 48, \\lin, 1, 24*i + 36] ! 5, \n \\seqAdd, [0, 12, \\lin, 1, 0],\n \\amp, [0, 0.15, \\lin, 0.01, 0.07 - (0.01 * i)],\n \\preAmp, [5, 50, \\lin, 0.01, 20]] };\n);\n\n// run all players in sync by passing a quant arg\n\nv = VarG\n// …\n```"}, {"role": "assistant", "content": "run all players in sync by passing a quant arg EventStreamPlayers derived from Pbind are run in (VarGui: slider / player gui to set envir variables and synth controllers and play synths, event patterns and tasks)"}]} +{"conversations": [{"role": "user", "content": "What does `RedEffectsRack.new` do? What arguments does it take?"}, {"role": "assistant", "content": "allround effects rack for RedEffectModule Arguments: efxClasses — An array of red effects to be used.; out — Output bus.; group — `nil` creates a group after the `defaultGroup`.; lag — a non-modulatable lag time for all parameters in all modules.."}]} +{"conversations": [{"role": "user", "content": "What is `UScoreEditor` in SuperCollider?"}, {"role": "assistant", "content": "UScoreEditor — (put short description here) (put long description here) Category: UnitLib."}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nMix.ar([SinOsc.ar(220, 0, 0.1), SinOsc.ar(330, 0, 0.1)])\n```"}, {"role": "assistant", "content": "Sums two sine waves into one signal — a perfect fifth, 220 Hz and 330 Hz, at 0.1 amplitude each.\n\n`[SinOsc.ar(220, 0, 0.1), SinOsc.ar(330, 0, 0.1)]` is an Array of two audio-rate signals (each UGen\nreturns a signal; an array of them is just a list). `Mix.ar` adds the elements together. The alternative\n`+` operator does the same for two signals, and `Splay.ar` would spread them across the stereo field\ninstead of summing them."}]} +{"conversations": [{"role": "user", "content": "Approaches to recording generated midi in DAW?"}, {"role": "assistant", "content": "SuperCollider forum — Approaches to recording generated midi in DAW?\n\nToday I spent another 6 hours or so trying to record in ardour (linux) both the midi information generated by supercollider and the audio generated by sending this midi to external synths. I finally hit the right combination of magic to make it work and I want to add my recipe in this thread so that I can find it back the future (and perhaps it also works for someone else).\n\nIngredient 1: a2jmidid. You can run it manually on the command line using “a2jmidid -e” or (like me) you can just use the “start midi bridge” button in the jack front-end application “Cadence” (enable the “export hardware ports checkbox”)\n\nIngredient 2: In supercollider itself, it is extremely important to only connect to a port and not to specify a destination uid. It seems that by specifying a destination uid, supercollider gets some kind of direct connection to the midi destination and ardour can no long introspect/record what is happening (I know it doesn’t sound scientific - this is purely the result of empiric observation/frustration.\n\nSo in supercollider, simply use\n\n```supercollider\n~synth1 = MIDIOut(0);\n~synth2 = MIDIOut(1);\n```\n\nand then in ardour’s Window->Midi Connections dialog, you can connect the out ports from supercollider to both your external synth and the track in which you want to record the midi information.\n\nFor midi driver in jack you can configure None.\n\nIf you want to record the generated midi in ardour, do NOT use connection syntax like\n\n```supercollider\n~synth1 = MIDIOut(0, MIDIClient.destinations[2].uid);\n```\n\nand do NOT use\n\n```supercollider\n~synth1 = MIDIOut.newByName(\"INTEGRA-7\", \"INTEGRA-7 MIDI 1\");\n```\n\nIf you just want to send midi to the external synth without recording the information, both previous ways of connecting work as well but these ways of connecting appear to work only if the jack MIDI driver is configured to use “ALSA sequencer” mode. It doesn’t seem to work with “None” or “ALSA Raw” (this may need some further investigation to clear out)."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SampleRate`."}, {"role": "assistant", "content": "```supercollider\n// compares a 441 Hz sine tone derived from sample rate (44100 * 0.01, left)\n// with a 440 Hz tone (right), resulting in a 1 Hz beating\n(\n{\n var freq;\n freq = [SampleRate.ir * 0.01, 440];\n SinOsc.ar(freq, 0, 0.1)\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nb = BusPlug.new;\n{ Blip.ar(b + 5) }.play;\nb.bus.set(12;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nb = BusPlug.new;\n{ Blip.ar(b + 5) }.play;\nb.bus.set(12);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `RedMatrixMixer.new` do? What arguments does it take?"}, {"role": "assistant", "content": "mix any number of input and output channels Arguments: nIn — Number of input busses.; nOut — Number of output busses.; in — Offset of first input bus.; out — Offset of first out bus.; group — if `nil` matrixmixer will boot the default server and creates a group after the `defaultGroup`. if a Group then that will be used (also its server). Note that a passed in group object is not freed with calling matrixmixer's #-free.; lag — For amplitudes in seconds.."}]} +{"conversations": [{"role": "user", "content": "How to generate paradiddles?"}, {"role": "assistant", "content": "SuperCollider forum — How to generate paradiddles?\n\nHi Rodet, I’m teaching jazz at college, and sometimes paradiddles come up in conversation (although I’m not a drummer). A paradiddle is basically a way of ‘evenly’ playing a roll (single/double/triple/whatever). If you take your drumsticks/fingers and play evenly:\n\nright, left, right, right, left, right, left, left, right, left, right, right, etc\n\nyou’ll notice that it’s possible to get an even rhythm, which when played fast becomes a roll. The idea of the single/double/triple is just to place the accents (lightly, or not) on the left, right hand, which if I understand helps keep an even stroke (and makes better sense to follow).\n\nSo, although I don’t know the goal of your idea, a simple code which would give you the solution could be a pattern. You’ll notice I’ve put in a SynthDef to give the ‘snare’ sound - not very real, but just for the demonstration. If you run these patterns, un-commenting the line needed (single, double or triple - don’t forget to comment out the lines you don’t need), you’ll hear the accents a paradiddle gives.\n\nIn this example Pbind ‘a’ gives the pulse, and Pbind ‘b’ the accents. And, if you play along with them (using your chart), you’ll notice the accents pass from right hand to left hand (or vice versa). This is (more or less) what paradiddles do, although a drummer will explain better how they ‘accent’ strokes to get more complicated/subtle rhythms.\n\n```supercollider\n(\nSynthDef(\\snare, {\n arg out=0, sus=0.1;\n var sig, env;\n sig = WhiteNoise.ar(0.1);\n env = EnvGen.kr(Env.perc(0.001, sus), doneAction:2);\n sig = sig*env;\n Out.ar(out, sig!2);\n}).add;\n);\n\n(\nt=TempoClock(80/60);\na=Pbind(\n \\instrument, \\snare,\n \\dur, 1/2,\n \\sus, 0.01\n);\nb=Pbind(\n \\instrument, \\snare,\n \\dur, 1,\n \\sus, Pseq([0.02, 0.01],inf), // single\n //\\sus, Pseq([0.02, 0.01, 0.01],inf), // double\n //\\sus, Pseq([0.02, 0.01, 0.01, 0.01],inf), // triple\n);\nPpar([a, b]).play(t);\n)\n```\n\nI hope that puts you on the right track.\n\np.s. Don’t forget to try out changing the speed to get the real effect. Try something like 320/60 on the TempoClock."}]} +{"conversations": [{"role": "user", "content": "What does `SimpleNumber.gauss` do? What arguments does it take?"}, {"role": "assistant", "content": "Returns a Float sampled from a Gaussian distribution with mean `this` and standard deviation `standardDeviation`. The range of the gaussian distribution is unbounded and thus may return +/-inf; consider using Arguments: standardDeviation — The standard deviation.. Returns: Always returns a Float."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Synth`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n// create a Synth at the head of the default Server's default group\n// based on the SynthDef \"default\"\nx = Synth.new(\"default\");\ns.queryAllNodes; // note the default group (ID 1)\nx.free;\n\n// Using an arrayed control\n// run this block first to make the SynthDef\n(\nSynthDef(\"help-synth\", { |freq = #[440, 450, 460], out = 0|\n Out.ar(out, Mix(SinOsc.ar(freq, 0, 0.1)));\n}).add;\n);\n\n// then this a short while later\nx = Synth(\"help-synth\", [freq: [500, 501, 510]]);\n\nx = Synth(\"help-synth\", [freq: [500, 501, 510]]);\nx.set(\\freq, [1, 2, 3] * 400 + [1, 2, 3], \\out, 1);\nx.set(\\freq, [3] * 400 + [1, 2, 3], \\out, 1);\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n\n ~needed_interval = 20;\n\n ~funk = {\n\n // if last time isn't defined, create it with 1000 seconds ago time\n if( ~last_time.isNil ) {\n ~last_time = Date.getDate.bootSeconds;\n ~last_time = ~last_time - 1000;\n };\n\n // if needed interval has passed, execute the funkie\n if( ( Date.getDate.bootSeconds - ~last_time ) > ~needed_interval ) {\n\n // safe last execution time, so next calls will have to wait the needed interval\n ~last_time = Date.getDate.bootSeconds;\n\n ( \"SOMETHING HAPPENS HERE AT MAXIMUN RATE OF 1 TIME EACH\" + ~needed_interval + \" SECONDS \" );\n\n } {\n ( \"YOU STILL HAVE TO WAIT\" );\n }\n };\n);\n\n~funk.value()\n```"}, {"role": "assistant", "content": "A friend of mine asked me how to limit a function to happen at maximun rate of 1 time every N seconds.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n SinOsc.ar(\n RunningMin.ar(Dust.ar(20), Impulse.ar(0.4)) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// follow a sine lfo, reset rate controlled by mouse x\n(\n{\n SinOsc.ar(\n RunningMin.kr(SinOsc.kr(0.2), Impulse.kr(MouseX.kr(0.01, 2, 1))) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n SinOsc.ar(\n RunningMin.ar(Dust.ar(20), Impulse.ar(0.4)) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// follow a sine lfo, reset rate controlled by mouse x\n(\n{\n SinOsc.ar(\n RunningMin.kr(SinOsc.kr(0.2), Impulse.kr(MouseX.kr(0.01, 2, 1))) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `HilbertFIR`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\ns.scope;\na = { HilbertFIR.ar(SinOsc.ar(100) * -20.dbamp, LocalBuf(2048)) }.play;\na.release;\n```"}]} +{"conversations": [{"role": "user", "content": "What is Env.perc and what does it take?"}, {"role": "assistant", "content": "`Env.perc(attackTime, releaseTime, level, curve)` — an attack to `level` (default 1) then a decay to zero, with curve defaulting to -4 (an exponential-ish decay). `Env.perc(0.01, 1)` is the default percussive envelope, and it is a complete Env, not a generator: pair it with EnvGen to hear it."}]} +{"conversations": [{"role": "user", "content": "What is `List`?"}, {"role": "assistant", "content": "List — list of items of variable size"}, {"role": "user", "content": "What does `List.new` do?"}, {"role": "assistant", "content": "Creates a List with the initial capacity given by size."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// Create a new empty collections with size 3:\nx = Array.new(3);\ny = Array.new(3);\nz = List.new(3);\n\n// Try to add 7 items to the array and list.\n// If the array exceeds maxSize, it will only\n// grow to an internally specified max size.\n(\n7.do { |i|\n x.add(i);\n y = y.add(i); // reassign array y on each add\n z.add(i);\n};\n);\n\n// Attempt to access the 5th item:\nx.at(4); // -> nil (out of bounds)\ny.at(4); // -> 4\nz.at(4); // -> 4\n\n// x grew only to size 4\nx.postln; // -> [ 0, 1, 2, 3 ]\ny.postln; // -> [ 0, 1, 2, 3, 4, 5, 6 ]\nz.postln; // -> List[ 0, 1, 2, 3, 4, 5, 6 ]\n```"}]} +{"conversations": [{"role": "user", "content": "What does `AbstractPlayer.isPlaying` do?"}, {"role": "assistant", "content": "the base class for all Players : a playable object"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Out`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-out\", { |out = 0, freq = 440|\n var source;\n source = SinOsc.ar(freq, 0, 0.1);\n\n // write to the bus, adding to previous contents\n Out.ar(out, source);\n\n}).add;\n);\n\n\nSynth(\"help-out\", [\\freq, 500]);\nSynth(\"help-out\", [\\freq, 600]);\nSynth(\"help-out\", [\\freq, 700]);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nVowel().brightenExp(1).dBs.postln; \nVowel().brightenExp(0.1).dBs.postln;\nVowel().brightenExp(1.5).dBs.postln;\n\n{Formants.ar(100, Vowel(\\a, \\bass).brightenExp(MouseX.kr(0,5)) * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nVowel().brightenExp(1).dBs.postln; \nVowel().brightenExp(0.1).dBs.postln;\nVowel().brightenExp(1.5).dBs.postln;\n\n{Formants.ar(100, Vowel(\\a, \\bass).brightenExp(MouseX.kr(0,5))) * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n~mdef =\n{\n |key, func, msgNum, permanent = true|\n\n MIDIdef(key, func ?? { MIDIdef(key).func }, msgNum ? MIDIdef(key).msgNum, MIDIdef(key).chan, MIDIdef(key).msgType, MIDIdef(key).srcID).permanent_(permanent)\n}\n```"}, {"role": "assistant", "content": "Change arg values of MIDIdef after instantiation (a SuperCollider snippet)."}]} +{"conversations": [{"role": "user", "content": "What does `FoaFocusZ.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "First Order Ambisonic (FOA) focus transformer Arguments: in — The B-format signal, an array: [w, x, y, z]; angle — The distortion angle, in radians. -pi/2 to pi/2; mul — Output will be multiplied by this value.; add — This value will be added to the output.."}]} +{"conversations": [{"role": "user", "content": "What is `PbindProxy`?"}, {"role": "assistant", "content": "PbindProxy — incremental event pattern reference"}, {"role": "user", "content": "What does `PbindProxy.new` do?"}, {"role": "assistant", "content": "Return a new instance of PbindProxy with the given patternpairs. Unlike Pbindef, it has no internal name. `a = PbindProxy(\\note, Pseq([0, 7, 9], inf), \\dur, 0.2).play;` It also supports keyword argument syntax: `a = PbindProxy(note: Pseq([0, 7, 9]), dur: 0.2).play;`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na = PbindProxy(\\note, Pseq([0, 7, 9], inf), \\dur, 0.2).play;\na.set(\\note, Pseq([0, 6, 10]));\na.stop;\n```"}]} +{"conversations": [{"role": "user", "content": "Approaches to recording generated midi in DAW?"}, {"role": "assistant", "content": "SuperCollider forum — Approaches to recording generated midi in DAW?\n\nToday I spent another 6 hours or so trying to record in ardour (linux) both the midi information generated by supercollider and the audio generated by sending this midi to external synths. I finally hit the right combination of magic to make it work and I want to add my recipe in this thread so that I can find it back the future (and perhaps it also works for someone else).\n\nIngredient 1: a2jmidid. You can run it manually on the command line using “a2jmidid -e” or (like me) you can just use the “start midi bridge” button in the jack front-end application “Cadence” (enable the “export hardware ports checkbox”)\n\nIngredient 2: In supercollider itself, it is extremely important to only connect to a port and not to specify a destination uid. It seems that by specifying a destination uid, supercollider gets some kind of direct connection to the midi destination and ardour can no long introspect/record what is happening (I know it doesn’t sound scientific - this is purely the result of empiric observation/frustration.\n\nSo in supercollider, simply use\n\n```supercollider\n~synth1 = MIDIOut(0);\n~synth2 = MIDIOut(1);\n```\n\nand then in ardour’s Window->Midi Connections dialog, you can connect the out ports from supercollider to both your external synth and the track in which you want to record the midi information.\n\nFor midi driver in jack you can configure None.\n\nIf you want to record the generated midi in ardour, do NOT use connection syntax like\n\n```supercollider\n~synth1 = MIDIOut(0, MIDIClient.destinations[2].uid);\n```\n\nand do NOT use\n\n```supercollider\n~synth1 = MIDIOut.newByName(\"INTEGRA-7\", \"INTEGRA-7 MIDI 1\");\n```\n\nIf you just want to send midi to the external synth without recording the information, both previous ways of connecting work as well but these ways of connecting appear to work only if the jack MIDI driver is configured to use “ALSA sequencer” mode. It doesn’t seem to work with “None” or “ALSA Raw” (this may need some further investigation to clear out)."}]} +{"conversations": [{"role": "user", "content": "What is `Pfsm` in SuperCollider?"}, {"role": "assistant", "content": "Pfsm — Finite State Machine Every state consists of an item and an array of integer indices of possible next states. The initial state is chosen at random from the array of entry states. That chosen state's item is returned, and the next state is chosen from its array of possible next states. When the end state is chosen, the stream ends. Category: Streams-Patterns-Events > Patterns > List > Indexing."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// shifting a 100Hz tone by 1 Hz rising to 500Hz\n{ FreqShift.ar(SinOsc.ar(100), XLine.kr(1, 500, 5), 0, [0.1, 0.1]) }.play(s);\n\n// shifting a complex tone by 1 Hz rising to 500Hz\n{ FreqShift.ar(Klang.ar(`[[101, 303, 606, 808]]), XLine.kr(1, 500, 10), 0, [0.1, 0.1]) }.play(s);\n\n// modulating shift and phase\n{ FreqShift.ar(SinOsc.ar(10), LFNoise2.ar(0.3, 1500), SinOsc.ar(500).range(0, 2pi), [0.1, 0.1]) }.play(s);\n// …\n```"}, {"role": "assistant", "content": "shifting a 100Hz tone by 1 Hz rising to 500Hz shifting a complex tone by 1 Hz rising to 500Hz (FreqShift: Frequency Shifter.)"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `BusPlug`."}, {"role": "assistant", "content": "```supercollider\nb = BusPlug.new;\n{ Blip.ar(b + 5) }.play;\nb.bus.set(12);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ LFCub.ar(LFCub.kr(LFCub.kr(0.2, 0, 8, 10), 0, 400, 800), 0, 0.1) }.play\n{ LFCub.ar(LFCub.kr(0.2, 0, 400, 800), 0, 0.1) }.play\n{ LFCub.ar(800, 0, 0.1) }.play\n{ LFCub.ar(XLine.kr(100, 8000, 30), 0, 0.1) }.play\n\n// compare:\n\n{ LFPar.ar(LFPar.kr(LFPar.kr(0.2, 0, 8, 10), 0, 400, 800), 0, 0.1) }.play\n{ LFPar.ar(LFPar.kr(0.2, 0, 400, 800), 0, 0.1) }.play\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ LFCub.ar(LFCub.kr(LFCub.kr(0.2, 0, 8, 10), 0, 400, 800), 0, 0.1) }.play\n{ LFCub.ar(LFCub.kr(0.2, 0, 400, 800), 0, 0.1) }.play\n{ LFCub.ar(800, 0, 0.1) }.play\n{ LFCub.ar(XLine.kr(100, 8000, 30), 0, 0.1) }.play\n\n// compare:\n\n{ LFPar.ar(LFPar.kr(LFPar.kr(0.2, 0, 8, 10), 0, 400, 800), 0, 0.1) }.play\n{ LFPar.ar(LFPar.kr(0.2, 0, 400, 800), 0, 0.1) }.play\n{ LFPar.ar(800, 0, 0.1) }.play\n{ LFPar.ar(XLine.kr(100, 8000, 30), 0, 0.1) }.play\n\n\n{ SinOsc.ar(SinOsc.kr(SinOsc.kr(0.2, 0, 8, 10), 0, 400, 800), 0, 0.1) }.play\n{ SinOsc.ar(SinOsc.kr(0.2, 0, 400, 800), 0, 0.1) }.play\n{ SinOsc.ar(800, 0, 0.1) }.play\n{ SinOsc.ar(XLine.kr(100, 8000, 30), 0, 0.1) }.play\n\n{ LFTri.ar(LFTri.kr(LFTri.kr(0.2, 0, 8, 10), 0, 400, 800), 0, 0.1) }.play\n{ LFTri.ar(LFTri.kr(0.2, 0, 400, 800), 0, 0.1) }.play\n{ LFTri.ar(800, 0, 0.1) }.play\n{ LFTri.ar(XLine.kr(100, 8000, 30), 0, 0.1) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `RHPF`."}, {"role": "assistant", "content": "```supercollider\n{ RHPF.ar(Saw.ar(200, 0.1), FSinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3600, 4000), 0.2) }.play;\n\n(\n{ var ctl = RHPF.kr(LFSaw.kr(2), SinOsc.kr(XLine.kr(0.07, 30, 20), 0, 35, 40), 0.05);\n SinOsc.ar(ctl * 200 + 500);\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `QuadN`."}, {"role": "assistant", "content": "```supercollider\n// default params\n{ QuadN.ar(SampleRate.ir/4) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//This example requires the FluCoMa tools to be installed from::\n//https://www.flucoma.org/download/\n\n(\nAlga.boot({\n //Sine oscillator with frequency modulation\n a = AN({ SinOsc.ar(\\freq.kr(10) + \\fm.ar(0)) }).play(chans:2);\n\n //Sine oscillator\n b = AN({ SinOsc.ar(\\freq.kr(440)) });\n\n //Pitch analyser\n c = AN({ FluidPitch.kr(\\in.ar) });\n\n //Patch first oscillator into the pitch analyser.\n a >> c;\n\n //Patch the pitch analyser into the \\freq input of the second oscillator\n c >>.freq b;\n\n //Create feedback: patch b's output to a's \\fm input, mapping -1 / 1 to -200 / 300\n a.from(b, \\fm, scale:[-200, 300], time:0.5);\n});\n);\n\n//Try with different scalings (change the values)\na.from(b, \\fm, scale:[-1432, 679], time:3);\n\n//Try new base frequencies (change the value)\na.from(100, \\freq, time:2);\n\n//Bye bye\n(\na.clear({\n b.clear;\n c.clear;\n}, time:3)\n);\n```"}, {"role": "assistant", "content": "This example requires the FluCoMa tools to be installed from https://www.flucoma.org/download/."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ClipNoise`."}, {"role": "assistant", "content": "```supercollider\n{ ClipNoise.ar(0.2) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// When we provide the 'root' argument an array, we should hear a chord.\n// the synth def is defined above\n(\nPbind(\n \\instrument, \\acid, \\dur, Pseq([0.25, 0.5, 0.25], inf),\n \\root, [-24, -17], // expand root\n \\degree, Pseq([0, 3, 5, 7, 9, 11, 5, 1], inf),\n \\pan, Pfunc { 1.0.rand2 },\n \\cut, Pxrand([1000, 500, 2000, 300], inf),\n \\rez, Pfunc { 0.7.rand + 0.3 },\n \\amp, 0.2).play;\n);\n\n// multiple arrays are correlated in parallel, the shorter one wraps:\n(\nPbind(\n \\instrument, \\acid,\n \\dur,\n// …\n```"}, {"role": "assistant", "content": "When we provide the 'root' argument an array, we should hear a chord. the synth def is defined above (Pbind: combine several value patterns to one event stream by binding keys to values)"}]} +{"conversations": [{"role": "user", "content": "What does `SequenceableCollection.rejectIndices` do?"}, {"role": "assistant", "content": "Return a new collection of same type as receiver which consists of all indices of those elements of the receiver for which function answers `false`. The function is passed two arguments, the item and an integer index. `#[a, b, c, g, h, h, j, h].rejectIndices({ |item, i| item ===` If you want to control what type of collection is returned, use"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// example usage:\n// on machine running the server\n(\ns.options.bindAddress = \"0.0.0.0\"; // allow connections from any address\ns.options.maxLogins = 2; // set to correct number of clients\ns.boot;\n);\n\n// on remote machine connecting to server\n(\no = ServerOptions.new;\no.maxLogins = 2;\nt = Server.remote(\\remote, NetAddr(\"192.168.0.130\", 57110), o); // set to correct address and port\n// info about returned client ID should be posted in the post window\nt.makeWindow; // make a window for monitoring\n)\n\n// if you want to use the remote server without the need to explicitly pass it to e.g. Synth or Function\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// example usage:\n// on machine running the server\n(\ns.options.bindAddress = \"0.0.0.0\"; // allow connections from any address\ns.options.maxLogins = 2; // set to correct number of clients\ns.boot;\n);\n\n// on remote machine connecting to server\n(\no = ServerOptions.new;\no.maxLogins = 2;\nt = Server.remote(\\remote, NetAddr(\"192.168.0.130\", 57110), o); // set to correct address and port\n// info about returned client ID should be posted in the post window\nt.makeWindow; // make a window for monitoring\n)\n\n// if you want to use the remote server without the need to explicitly pass it to e.g. Synth or Function -play, set it to be the default server:\n//Server.default = t;\n\n//otherwise, make some sound on the remote server\n{Resonz.ar(Saw.ar([100,101]), Line.kr(100,5000,10, doneAction: 2),mul: -12.dbamp)}.play(target: t); //use target to specify the remote server\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for simple smooth arp. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\smooth, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.linen(0.05, sustain, 0.1), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `ExpRand` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-ExpRand\", { |out = 0|\n Out.ar(out,\n FSinOsc.ar(\n ExpRand(100.0, 8000.0),\n 0, Line.kr(0.2, 0, 0.01, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n(\nRoutine({\n inf.do({ |i|\n Synth.new(\"help-ExpRand\"); 0.05.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Integer.degreeToKey` do?"}, {"role": "assistant", "content": "Interpret this as index into a scale with a given number of steps per"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for very punchy snare in neurofunk style: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\neurosnare, {\n var snd;\n // a percussive click to give it some attack\n snd = LPF.ar(HPF.ar(WhiteNoise.ar, 300), 8000) * Env.linen(0.001, 0.01, 0.001).ar;\n // sine sweep body. very important!\n snd = snd + (SinOsc.ar(Env([400, 196, 160], [0.04, 0.2], \\exp).ar) * Env.perc(0.04, 0.2).ar * 6.dbamp).tanh;\n // sound of snare coils rattling\n snd = snd + (HPF.ar(BPeakEQ.ar(WhiteNoise.ar, 4000, 0.5, 3), 300) * Env.perc(0.05, 0.2).delay(0.01).ar(2) * -3.dbamp);\n // another sound sweep to improve the attack, optional\n snd = snd + (SinOsc.ar(XLine.kr(3000, 1500, 0.01)) * Env.perc(0.001, 0.02).ar);\n // distortion helps glue everything together and acts as a compressor\n snd = (snd * 1.4).tanh;\n snd = Pan2.ar(snd, \\pan.kr(0), \\amp.kr(0.1));\n Out.ar(\\out.kr(0), snd);\n}).add;\n);\n\nSynth(\\neurosnare, [amp: 0.4]);\n```"}]} +{"conversations": [{"role": "user", "content": "What is `PV_MagSmear` in SuperCollider?"}, {"role": "assistant", "content": "PV_MagSmear — Average magnitudes across bins. Average a bin's magnitude with its neighbors. Category: UGens > FFT."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `NamedControl`."}, {"role": "assistant", "content": "```supercollider\n// multiple usage of the same name:\na = { SinOsc.ar(\\freq.kr(440, 1.0)) + Saw.ar(\\freq.kr(440, 1.0) * 0.5) * 0.1 }.play;\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n\n// with different lag values:\na = { SinOsc.ar(\\freq.kr(440).lag(3.5)) + Saw.ar(\\freq.kr(440).lag(0.05) * 0.5) * 0.1 }.play;\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n\n// control saved to a variable:\n(\na = {\n var freq = \\freq.kr(440);\n SinOsc.ar(freq.lag(3.5)) + Saw.ar(freq.lag(0.05) * 0.5) * 0.1;\n}.play;\n);\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// modulate frequency of a sine oscillator\n\n(\nSynthDef(\"help-MultiplexAnalogIn\", { |out = 0|\n Out.ar(out,\n SinOsc.ar(MultiplexAnalogIn.ar(0, 1).exprange(200, 5000), 0, 0.1)\n )\n}).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// modulate frequency of a sine oscillator\n\n(\nSynthDef(\"help-MultiplexAnalogIn\", { |out = 0|\n Out.ar(out,\n SinOsc.ar(MultiplexAnalogIn.ar(0, 1).exprange(200, 5000), 0, 0.1)\n )\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `ReplaceOut`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"ReplaceOutHelp\", { |out = 0, freq = 440|\n var source;\n source = SinOsc.ar(freq, 0, 0.1);\n\n // write to the bus, replacing previous contents\n ReplaceOut.ar(out, source);\n\n}).add;\n);\n\n// each Synth replaces the output of the previous one\nx = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 500]);\ny = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 600]);\nz = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 700]);\n\n// release them in reverse order; the older Synths are still there.\nz.free;\ny.free;\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `NodeProxy` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\na = NodeProxy.new.play; // play to hardware output.\na.fadeTime = 2; // fadeTime specifies crossfade\n// set the source\na.source = { SinOsc.ar([350, 351.3], 0, 0.2) };\na.source = { Pulse.ar([350, 351.3] / 4, 0.4) * 0.2 };\na.source = Pbind(\\dur, 0.03, \\freq, Pbrown(0, 1, 0.1, inf).linexp(0, 1, 200, 350));\n\nb = NodeProxy.new;\na.source = { Ringz.ar(b.ar, [350, 351.3] * 8, 0.2) * 4 };\nb.source = { Impulse.ar([5, 7]/2, [0, 0.5]) };\n\na.clear(3); // clear after 3 seconds\nb.clear(3);\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// augmentation of nonlinearity:\n// GFIS itself used as time-varying control of another GFIS\n\nb = Buffer.read(s, Platform.miSCellaneousDirs[0] +/+ \"Sounds\" +/+ \"kitchen_sounds_1.wav\");\n\n// load to array and fill new buffer for iteration\n\nb.loadToFloatArray(action: { |array| a = array; \"done\".postln });\n\nd = a[3150..3300].normalize;\n\nc = Buffer.loadCollection(s, d);\n\n\n(\ny = {\n var r = LFDNoise3.ar(3).range(2.7, 3.4);\n var add = GFIS.ar({ |x| sin(r * x) }, 0.5, 3\n// …\n```"}, {"role": "assistant", "content": "augmentation of nonlinearity: GFIS itself used as time-varying control of another GFIS (GFIS: generalized functional iteration synthesis pseudo ugen)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = { SinOsc.ar(\\freq.kr(440, 1.2)) }.play;\na.set(\\freq, 330);\na.release;\na = { SinOsc.ar(\\freq.kr([440, 460], 1.2)) }.play;\na.setn(\\freq, [330, 367];\na.release;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = { SinOsc.ar(\\freq.kr(440, 1.2)) }.play;\na.set(\\freq, 330);\na.release;\na = { SinOsc.ar(\\freq.kr([440, 460], 1.2)) }.play;\na.setn(\\freq, [330, 367]);\na.release;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `DissonanceCurve.fm` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a curve based on the timbre of a given FM Arguments: carrier — The carrier frequency in Hz; modulator — The modulation frequency in Hz; depth — The depth (or delta range) of the modulator, in Hz; highInterval — The largest interval to compute in cents. For octave-based systems, you would usually use 1200.."}]} +{"conversations": [{"role": "user", "content": "What does `LinTrans.rotation2D` do?"}, {"role": "assistant", "content": "2D rotation linear transformation for angle theta. `a ="}]} +{"conversations": [{"role": "user", "content": "Saving \"Presets\"?"}, {"role": "assistant", "content": "SuperCollider forum — Saving \"Presets\"?\n\nIf you don’t care too much about it being human readable, just use writeArchive and readArchive:\n\n```supercollider\na = Array.fill(400, {rrand(0,2200)});\n\na.writeArchive(\"/Users/spluta1/Documents/SC/test\");\n\nb = Object.readArchive(\"/Users/spluta1/Documents/SC/test\");\n\nb.postln;\n```\n\nSam"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\RotateAz;\n~description = \"Rotation around the z-axis (angle from -180 to 180)\";\n\n~function = { |in = 0, order = 1, rotateAziDeg = 0|\n\n // Rotating the scene is done from the perspective of the listener\n // rotation follows the right-hand rule of rotation:\n // * Positive azimuth means the listener turns head to the left\n\n HOATransRotateAz.ar(\n order: order,\n in: in,\n az: rotateAziDeg.degrad\n );\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `UnaryOpUGen` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\na = WhiteNoise.ar; // a WhiteNoise\nb = a.squared; // a UnaryOpUGen.\nb.operator; // squared\n\n// sound example\n\n{ var a = LFSaw.ar(300).range(0, 2pi); a.sin * 0.1 }.play;\n\n// Plotting the \"abs\" unary operator (via the server):\n\n{ SinOsc.ar(300).abs }.plot\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `LFClipNoise`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-LFClipNoise\", { |out = 0|\n Out.ar(out,\n LFClipNoise.ar(1000, 0.25)\n )\n}).play;\n);\n\n// modulate frequency\n(\nSynthDef(\"help-LFClipNoise\", { |out = 0|\n Out.ar(out,\n LFClipNoise.ar(XLine.kr(1000, 10000, 10), 0.25)\n )\n}).play;\n);\n\n// use as frequency control\n(\nSynthDef(\"help-LFClipNoise\", { |out = 0|\n Out.ar(out,\n SinOsc.ar(\n LFClipNoise.ar(4, 200, 600),\n 0, 0.2\n )\n )\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// proceed with caution. start at min volume, and not with your expensive speakers.\n\nfork{b=Buffer.alloc(s,512,1);inf.do{b.cheby({[1,0].choose}!2);{(Shaper.ar(b,SinOsc.ar(55,0,Line.kr(1,0,2,1,0,2))))!2}.play;0.1.wait;}};\n```"}, {"role": "assistant", "content": "can anyone tell me what the loud click is, and how to control it?\r\n\r\ni kind of really like it, but it sounds scary, \r\n\r\nand the resulting waveform is bizarre, too.\r\n\r\n[http://soundcloud.com/tengototen/m-chtegern-ikeda](http://soundcloud.com/tengototen/m-chtegern-ikeda)\r\n\r\n\r\nupdate: some discussion, and lots of interesting things to try out, [on the list](http://new-supercollider-mailing-lists-foru."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Lag`."}, {"role": "assistant", "content": "```supercollider\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n Lag.kr( // lag the modulator\n LFPulse.kr(4, 0, 0.5, 50, 400), // frequency modulator\n Line.kr(0, 1, 15) // modulate lag time\n ),\n 0, // phase\n 0.3 // sine amplitude\n )\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `TextView.selectedString` do? What arguments does it take?"}, {"role": "assistant", "content": "The plain text contained in the current selection. When getting this variable and there is no selection, the entire line at text cursor is returned (equivalent to #-currentLine). Setting this variable will replace text in the selection with the argument, or do nothing if there is no Arguments: A String.. Returns: A String."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n\n// definition for future reference in arbitrary Environments,\n// Cauchy distribution is not bounded, so do clip !\n\n(\np = Pbind(\n \\midinote, PLcauchy(\\mean, \\spread).clip(60, 90),\n \\dur, 0.1\n);\n);\n\n// prepare current Environment\n\n(\n~mean = 75;\n~spread = 0.1;\n);\n\n\n// run\n\nx = p.play;\n\n\n// move mean value and distribution\n// PLseq defaults to repeats = inf\n\n(\n~mean = PLseq((80, 79.7..70));\n~spread = PLseq([0,\n// …\n```"}, {"role": "assistant", "content": "definition for future reference in arbitrary Environments, Cauchy distribution is not bounded, so do clip ! (PLcauchy: dynamic scope Pcauchy variant)"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for get different result each time running the pattern: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\nTempoClock.default.tempo = 156/60;\n\n(\nSynthDef(\\spring, { |freq = 400, out = 0, pan = 0, gate = 1, dur = 0.15, curve = -4, amp = 1, index = 1|\n var sig = FreeVerb.ar(Pan2.ar(Blip.ar(freq, index), pan));\n var env = EnvGen.ar(Env.perc(0.01, dur, amp, curve), gate, doneAction:2);\n Out.ar(0, sig * env);\n}).add;\n);\n\n(\nPbind(*[\n instrument: \\spring,\n dur: Pseq([4, 1, 2, 1, 1, 1].scramble/ 4 / TempoClock.default.tempo, inf),\n degree: Pseq(#[1,2,3,4], inf) * Pkey(\\dur).reciprocal,\n octave: Pseq([2,3,4,4,4,3].scramble, inf),\n pan: Pxrand(Array.fill(100, { 0.gaussian(1).clip2(1) }), inf),\n amp: Pseq(#[0.95,1,0.8],inf),\n index: Pstutter(Pseq(#[4,8,12],inf), Pseq([2,3,4,5,6,8].scramble, inf))\n]).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `StreamSpec.rate` do?"}, {"role": "assistant", "content": "datatype specifying that the input or output is stream or pattern"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// derived from an answer by Sergio Luque to a mail to the sc-users SuperCollider mailing list on 2013/03/22\n\n(\nvar registerSize = 16;\nvar min =\"C2\".namemidi.asInteger;\nvar max = \"C6\".namemidi.asInteger;\nvar waitTime = 0.05; // in seconds\n//var chance = 0.1;\nvar chance = Pseq([Pseries(0, 0.1, 10), Pseries(1, -0.1, 10)], inf);\nvar change = 10; // step size\n\n\nPbind(\n \\midinote, Pswitch1(\n { \n Pbrown(min, max, Pif(Prout({ chance.trace.coin.embedInStream }), change, 0))\n } ! registerSize, \n Pseq(Array.iota(registerSize), inf)\n ),\n \\dur, waitTime\n).play\n)\n```"}, {"role": "assistant", "content": "wiard noise ring variation using a ringbuffer instead of bitshifting.\r\nRe-implemented according to Julian Parker's m4l patch.\r\nDerived from an answer by Sergio Luque to a mail to the sc-users SuperCollider mailing list on 2013/03/22."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// crucial-library - sends midi clock and song position pointer\n// x.add( MIDIClockOut(\"IAC Driver\", \"IAC Bus 1\") )\n\nMxUnit.register('MIDIClockOut',\n(\n make: { arg mco;\n ~source = mco;\n MxUnit(mco, [], [])\n },\n spawnToBundle: { arg b;\n b.addFunction({~source.start}.inEnvir)\n },\n stopToBundle: { arg b;\n b.addFunction({~source.stop}.inEnvir)\n }\n /*,\n gotoBeat: { arg beat, atBeat, bundle;\n [beat, atBeat, bundle].debug;\n ~source.gotoBeatAtBeat(beat, atBeat)\n }*/\n\n));\n```"}, {"role": "assistant", "content": "crucial-library - sends midi clock and song position pointer x.add( MIDIClockOut(\"IAC Driver\", \"IAC Bus 1\") )."}]} +{"conversations": [{"role": "user", "content": "What does `EventPatternProxy.envir` do?"}, {"role": "assistant", "content": "provide a default event for the Pdef. It is used to filter the incoming stream before it is passed to the source pattern. This is similar to NodeProxy#-nodeMap. When set for the first time, the pattern is"}]} +{"conversations": [{"role": "user", "content": "I get 'server not running' or nothing happens at all."}, {"role": "assistant", "content": "The server is not booted. In the IDE press Ctrl+B, or evaluate `s.boot`. If code depends on a SynthDef being there, put it inside `s.waitForBoot { ... }`. When a script runs headless you can do `s.boot; s.sync;` and continue. `s.serverRunning` tells you the truth; if it is false, look at the post window for the boot error (usually an audio device problem)."}]} +{"conversations": [{"role": "user", "content": "What are the arguments of PlayBuf.ar?"}, {"role": "assistant", "content": "`PlayBuf.ar(numChannels, bufnum, rate, trigger, startPos, loop)`. numChannels must match what is in the buffer, or you get a channel mismatch; bufnum is the Buffer's integer number; rate is playback speed where 1 is normal and negative plays backwards; trigger restarts playback on each trigger in loop mode; startPos is in frames; loop is 0 or 1. `PlayBuf.ar(1, ~buf, BufRateScale.kr(~buf), loop: 1)` is the standard pitch-correct form."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `IEnvGen`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var env = Env([0, 0.6, 0.3, 1.0, 0], [0.1, 0.02, 0.4, 1.1], [\\lin, \\exp, -6, \\sin]);\n var envgen = IEnvGen.kr(env, MouseX.kr(0, env.times.sum));\n env.plot;\n SinOsc.ar(envgen * 500 + 440)\n}.play;\n);\n\n// index with an SinOsc ... mouse controls amplitude of SinOsc\n// use offset so negative values of SinOsc will map into the Env\n(\n{\n var sin = SinOsc.ar(440, 0, MouseX.kr(0, 1));\n // use offset so negative values of SinOsc will map into the Env\n var env = Env([-1, -0.7, 0.7, 1], [0.8666, 0.2666, 0.8668], \\lin, offset: -1.0);\n IEnvGen.ar(env, sin) * 0.1\n}.play;\n);\n\n// index with Amplitude of input, control freq of SinOsc (uses SoundIn)\n(\n{\n var point = Amplitude.ar(SoundIn.ar(0), 0.01, 0.2);\n // use offset so negative values of SinOsc will map into the Env\n var env = Env.xyc([[0, 330, \\exp], [0.5, 440, \\exp], [1.0, 1760]]);\n SinOsc.ar(IEnvGen.kr(env, point)) * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `UGen.bipolar` do?"}, {"role": "assistant", "content": "Scales the output of this UGen to be between `(-mul..mul)` range (default"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DigitalOut`."}, {"role": "assistant", "content": "```supercollider\n// write a sine oscillator's output to a pin\n\n(\nSynthDef(\"help-DigitalOut\", { |out = 0|\n DigitalOut.ar(0, SinOsc.ar(10));\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `EaseInExpo` in SuperCollider?"}, {"role": "assistant", "content": "EaseInExpo — Exponential ease-in Easing equation for an exponential (2^t) ease-in, accelerating from zero velocity. Category: Ease."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Compander` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var z;\n\n // signal (clean)\n z = Decay2.ar(\n Impulse.ar(8, 0, LFSaw.kr(0.3, 1, -0.3, 0.3)),\n 0.001,\n 0.3\n )\n * Mix.ar(Pulse.ar([80, 81], 0.3));\n\n // apply gate (mouse x sets treshold)\n Compander.ar(z, z,\n thresh: MouseX.kr(0.001, 1),\n slopeBelow: 10,\n slopeAbove: 1,\n clampTime: 0.01,\n relaxTime: 0.01\n )\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for 003_102 (a SuperCollider snippet). Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\nSynthDef('003_102', {|out=0,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y| Out.ar(out, Pan2.ar(Normalizer.ar(( GbmanL.ar( LPF.ar( SyncSaw.ar(p, k, q, h ), FreqShift.ar(d, r, k, y, a ), h, n ), r, l, Blip.ar(r, f, u, i ), h ))*( LFPar.ar(d, x, Saw.ar(w, k, Formant.ar(s, q, d, DelayL.ar(y, 0.5, w, v, i ), e ) ), y ))*( LFCub.ar(q, a, h, g ))*( Gendy1.ar(r, c, r, QuadL.ar(h, o, j, t, t, v, f ), k, p, g, Pulse.ar(g, g, c, s ), PMOsc.ar(f, u, d, t, d, f ), f, LFNoise0.ar(k, l, e ), d ) )))) }).play(args: #[ a, 0.1, b, 0.83039082494709, c, 7.4736936148092, d, 57.834883574831, e, 0.56638920329924, f, 2.7610572022348, g, -0.60208093272399, h, 0.69731527262978, i, 0.97553825378418, j, 0.47619211673737, k, 0.45142233371735, l, 6.5229251440451, m, 0.34238355327673, n, 3.1624102065486, o, 1, p, 1, q, 5.4898714868897, r, 2.7777416341664, s, 10966.099508885, t, 0.15706503391266, u, 3.1945936724559, v, 20000, w, -4.6151277924266, x, 1.4588773159677, y, 0.0012384873762477 ])\n```"}]} +{"conversations": [{"role": "user", "content": "What does `OSCSched.xtsched` do? What arguments does it take?"}, {"role": "assistant", "content": "exclusive time based schedule any previous bundles scheduled using xtsched, xsched or xqsched will be cancelled. this is incredibly useful in situations where several bundles might be sent and you only want the last one to be used as the final answer. example: a monkey is hitting many buttons, changing his mind about which sound to play next. this would result in many bundles being stacked up all at the same time, and the server would choke trying to execute them all. so Arguments: seconds; server; bundle; onArrival."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// same as above, but we use a NetAddr with a port of nil, so we can receive from a specific host, but from any port\n\nn = NetAddr(\"127.0.0.1\", nil); // the url should be the one of computer of app 2\no = OSCresponderNode(n, '/test', { |t, r, msg| msg.postln }).add;\no.remove;\n```"}, {"role": "assistant", "content": "same as above, but we use a NetAddr with a port of nil, so we can receive from a specific host, but from any port (OSCresponderNode: client side network responder)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\\pm, { |out = 0, freq = 440, amp = 0.1, pan = 0, gate = 1, ratio = 1, index = 1, ar = 0.1, dr = 0.1|\n var z;\n z = LPF.ar(\n PMOsc.ar(freq, freq * ratio, Linen.kr(gate, ar, index, dr), 0, 0.3),\n XLine.kr(Rand(4000, 5000), Rand(2500, 3200), 1)\n ) * Linen.kr(gate, 0.01, 0.7, dr, 2);\n OffsetOut.ar(out, Pan2.ar(z, pan, amp));\n}).add;\n);\n\n(instrument: \\pm).play;\n\n(instrument: \\pm, ratio: 3.4\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\\pm, { |out = 0, freq = 440, amp = 0.1, pan = 0, gate = 1, ratio = 1, index = 1, ar = 0.1, dr = 0.1|\n var z;\n z = LPF.ar(\n PMOsc.ar(freq, freq * ratio, Linen.kr(gate, ar, index, dr), 0, 0.3),\n XLine.kr(Rand(4000, 5000), Rand(2500, 3200), 1)\n ) * Linen.kr(gate, 0.01, 0.7, dr, 2);\n OffsetOut.ar(out, Pan2.ar(z, pan, amp));\n}).add;\n);\n\n(instrument: \\pm).play;\n\n(instrument: \\pm, ratio: 3.42, index: 12, freq: 150, ar: 8, dr: 3, sustain: 10).play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a filter sweep over a saw."}, {"role": "assistant", "content": "An LFO on the cutoff of a resonant low-pass; XLine or an LFO both work, the LFO is the loopable one.\n\n```supercollider\n{ LPF.ar(Saw.ar([60, 60.2]), SinOsc.kr(0.2).exprange(150, 4000), 0.4) * 0.2 }.play;\n```\n\n`.exprange` is the exponential mapping you want for frequency; a linear `.range` sweep sounds uneven."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// allocate buffer\nb = Buffer.alloc(s, 44100, 1);\n\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nBufDelayL.ar(b.bufnum, z, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\nb.free;\n\n\n// multichannel\n\n// two channels, two buffers\nb = Buffer.allocConsecutive(2, s, 32768, 1);\n\na = { |bufs = #[0, 1]|\n var sig = SinOsc.ar([440, 880\n// …\n```"}, {"role": "assistant", "content": "Dust randomly triggers Decay to create an exponential decay envelope for the WhiteNoise input source (BufDelayL: Buffer based simple delay line with linear interpolation.)"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `FBSineN`."}, {"role": "assistant", "content": "```supercollider\n// increase feedback\n{ FBSineN.ar(SampleRate.ir, 1, Line.kr(0.01, 4, 10), 1, 0.1) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Schmidt.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Schmidt trigger. Arguments: in — Signal to be tested.; lo — Low threshold.; hi — High threshold.."}]} +{"conversations": [{"role": "user", "content": "Explain `Pproto` in SuperCollider briefly."}, {"role": "assistant", "content": "Pproto — provide a proto event for an event stream Pproto uses the makeFunction to allocate resources (buffers, buses, groups) and create a protoEvent that makes those resources available to a pattern. It is fully compatible with non-realtime synthesis using render. Category: Streams-Patterns-Events > Patterns > Server Control."}]} +{"conversations": [{"role": "user", "content": "What does `Window.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new Window instance. You will need to call #-front on it to become Arguments: name — A String for the text that will be displayed in the title bar. The default is 'panel'.; bounds — A Rect specifying the position and size of the window in screen coordinates. The size does not include the window's border and title bar. Position is measured from the bottom-left corner of the screen (This differs from View#-bounds, which uses the top-left corner). This coordinate convention origin; resizable — A Boolean indicating whether the window is resizable by the user. The default is `true`.; border — A Boolean indicating whether this window has a border. Borderless windows have no title bar and thus can only be closed in code. The default is `true`.; deprecatedServerArgument — This argument is deprecated, it was kept for SwingOSC compatibility.; scroll — A Boolean indicating whether this window will add scrollbars if its contents exceed its bounds. If this is set to `true`, then View#-resize settings will be ignored for contained views. The default is false.."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// The indices arg might get a pattern which can generate Functions as well as arrays.\n// Start with sufficient number of zeros as lookBack to fill buffer.\n\n(\np = PSloop(\n Pbind(\n \\dur, Pn(Pshuf([1, 1, 2]/6)),\n \\midinote, Prand((60..80), inf)\n ),\n bufSize: 10,\n lookBack: Pseq([Pn(0, 7), Pstutter(4, Pwhite(3, 5, 1))], inf).trace,\n indices: Pseq([1!2, { |l| (l-1..0).postln }], inf).trace\n).trace.play\n);\n\np.stop\n```"}, {"role": "assistant", "content": "The indices arg might get a pattern which can generate Functions as well as arrays. Start with sufficient number of zeros as lookBack to fill buffer. (PSloop: Pattern to derive loops from a given Pattern)"}]} +{"conversations": [{"role": "user", "content": "What is `CondVar`?"}, {"role": "assistant", "content": "CondVar — Condition variable: block one or more threads until some condition is true"}, {"role": "user", "content": "What does `CondVar.wait` do?"}, {"role": "assistant", "content": "The behavior depends on whether a `predicate` is given. If no `predicate` is given, this method simply blocks the current thread until it is woken by `signalOne` or `signalAll`. Otherwise, this method is equivalent to `while { predicate.value.not } { cond.wait }`. In other words, the thread only blocks if the predicate is false, otherwise it blocks and only resumes once the thread has been signall"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nc = CondVar();\n\nRoutine {\n 1.wait;\n \"waited for 1 second\".postln;\n 1.wait;\n \"waited for another second, now waiting for you to run 'c.signalOne'...\".postln;\n c.wait;\n \"the condition is no longer waiting\".postln;\n 1.wait;\n \"waited for another second, now waiting for you...\".postln;\n c.wait;\n \"the condition is no longer waiting\".postln;\n 1.wait;\n \"the end\".postln;\n}.play;\n);\n\n// Run this line to unblock the routine\nc.signalOne;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ Pan2.ar(SinOsc.ar(440) * 0.2, SinOsc.kr(0.1)) }.play;\n```"}, {"role": "assistant", "content": "A sine that slowly moves between the speakers.\n\n`SinOsc.kr(0.1)` is a control-rate sine at 0.1 Hz — one cycle every 10 seconds — running between -1 and 1.\n`Pan2.ar(sig, pos)` treats that as the pan position, where -1 is hard left, 0 centre, 1 hard right, so the\nsound drifts across the stereo field. Pan2 is equal-power, so the centre is -3 dB per channel rather than\nhalf amplitude on each. The `* 0.2` sets the level before panning."}]} +{"conversations": [{"role": "user", "content": "I get 'Node not found' when I call .set on a Synth after a while."}, {"role": "assistant", "content": "The Synth was freed and the language still holds a reference. That happens whenever the SynthDef used `doneAction: 2` and the envelope finished, or when something called `freeAll`/`CmdPeriod`. Guard it with `if (x.notNil and: { x.isPlaying }) { x.set(\\freq, 300) }`, or store the node in a variable that you clear when it ends. For sustained sounds the right pattern is a `gate` argument with `doneAction: 2` on the EnvGen, so the node lives until you release it."}]} +{"conversations": [{"role": "user", "content": "What does `Node.isRunning` do?"}, {"role": "assistant", "content": "Abstract superclass of Synth and Group Returns: a boolean indicating if this node is currently on the server, providing this Node has been registered with a NodeWatcher."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// examples: args are // outs, amps, ins, vol, fadeTime\n\n{ Out.ar(87, SinOsc.ar(MouseX.kr(40, 10000, 1) * [1, 2, 3], 0, 0.2)) }.play;\nx = Monitor.new;\n\n(\nx.playN(\n [0, 1, 4], // to these outs\n [0.1, 0.4, 0.3], // with these volumes\n [87, 88, 89] // from these ins\n);\n);\n(\nx.playN(\n [0, [1, 3, 2], 4], // outs can be nested: 87 -> 0, 88 -> [1, 3, 2], 89 -> 4\n [0.1, [0.4, 0.2, 0.1], 0.3], // with nested volumes 0.1, [0\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// examples: args are // outs, amps, ins, vol, fadeTime\n\n{ Out.ar(87, SinOsc.ar(MouseX.kr(40, 10000, 1) * [1, 2, 3], 0, 0.2)) }.play;\nx = Monitor.new;\n\n(\nx.playN(\n [0, 1, 4], // to these outs\n [0.1, 0.4, 0.3], // with these volumes\n [87, 88, 89] // from these ins\n);\n);\n(\nx.playN(\n [0, [1, 3, 2], 4], // outs can be nested: 87 -> 0, 88 -> [1, 3, 2], 89 -> 4\n [0.1, [0.4, 0.2, 0.1], 0.3], // with nested volumes 0.1, [0.4, 0.2, 0.1], and 0.3\n [87, 88, 89]); // reading from these ins\n);\n// can also set global volume and fadetime\nx.playN(vol: 0.0, fadeTime: 4);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Archive`."}, {"role": "assistant", "content": "```supercollider\n// make a storage place for various objects:\nq = (); // Event\n\nq[\\a_long_array] = Array.rand(128, 0.0, 1.0);\nq[\\pi_squared] = pi * pi;\nq[\\favourite_sound] = { { SinOsc.ar([300, 330]).sum * LFPulse.kr(2 + [0, 0.01]) * 0.1 }.play };\nq[\\same_long_array] = q[\\a_long_array]; // same objects may appear several times\n\nArchive.global.put(\\myData, q);\n\n\nArchive.global.at(\\myData).postcs;\n\n// after a recompile:\ns.boot;\n\nq = Archive.global.at(\\myData);\nq.postcs;\nq[\\favourite_sound].value;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `PopUpTreeMenu.action` do?"}, {"role": "assistant", "content": "Function that gets evaluated when some leaf is selected. Arguments passed in: `this,"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// modulate frequency and index multiplier\n{ FBSineC.ar(LFNoise2.kr(1, 1e4, 1e4), LFNoise2.kr(1, 16, 17), 1, 1.005, 0.7) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// modulate frequency and index multiplier\n{ FBSineC.ar(LFNoise2.kr(1, 1e4, 1e4), LFNoise2.kr(1, 16, 17), 1, 1.005, 0.7) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Node`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n(\nx = SynthDef(\"help-node-set\", { |freq = 440, out = 0|\n Out.ar(out, SinOsc.ar(freq, 0, 0.1))\n}).play\n);\nx.set(\\freq, 880, \\out, 1); // two pairs\nx.set(0, 660, 1, 0); // freq is the first argument, so it's index is 0. out is index 1.\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// default initial params\n{ LinCongC.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// default initial params\n{ LinCongC.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// modulate frequency of a sine oscillator\n\n(\nSynthDef(\"help-AnalogIn\", { |out = 0|\n Out.ar(out,\n SinOsc.ar(AnalogIn.ar(0).exprange(200, 5000), 0, 0.1)\n )\n}).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// modulate frequency of a sine oscillator\n\n(\nSynthDef(\"help-AnalogIn\", { |out = 0|\n Out.ar(out,\n SinOsc.ar(AnalogIn.ar(0).exprange(200, 5000), 0, 0.1)\n )\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LPZ1`."}, {"role": "assistant", "content": "```supercollider\n// Compare:\n\n{ WhiteNoise.ar(0.25) }.play;\n\n{ LPZ1.ar(WhiteNoise.ar(0.25)) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n Lag3.kr( // lag the modulator\n LFPulse.kr(4, 0, 0.5, 50, 400), // frequency modulator\n Line.kr(0, 1, 15) // modulate lag time\n ),\n 0, // phase\n 0.3 // sine amplitude\n )\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n Lag3.kr( // lag the modulator\n LFPulse.kr(4, 0, 0.5, 50, 400), // frequency modulator\n Line.kr(0, 1, 15) // modulate lag time\n ),\n 0, // phase\n 0.3 // sine amplitude\n )\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Resonz` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// 1st, evaluate a synthdef\n(\nSynthDef(\"pitchFromNoise\", { arg out = 0;\n Out.ar(\n out,\n Resonz.ar(\n WhiteNoise.ar(15),\n LFNoise0.kr(2, 110, 660),\n 0.005\n )\n )\n}).add;\n);\n\n// 2nd, make 2 synths\n(\nSynth(\"ringModulation\");\nSynth(\"pitchFromNoise\", [\\out, 1]);\n);\n\n// 3rd, tell the server to list its nodes\n(\ns.queryAllNodes;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Re: the perfect frequencies. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// Rumush\n// https://mycelialcordsblog.wordpress.com/\n// https://fungorumush.bandcamp.com/releases\n// https://soundcloud.com/fungorum\n\n(\nf = {\n var rep = [4, 8, 16, 32];\n var n = rep.choose;\n var x = [\n\n 54, 60, 66, 72, 81, 90, 96, 102,\n 108, 128, 132, 144, 162, 180, 192, 204,\n 216, 240, 264, 288, 324, 360, 384, 408,\n 432, 480, 528, 576, 648, 720, 768, 816,\n 864, 960, 1056, 1152, 1296, 1440, 1536, 1632,\n 1728, 1920, 2112, 2304, 2592, 2880, 3072, 3264,\n 3456, 3840, 4224, 4608, 5184, 5760, 6144, 6528,\n 6912, 7680, 8448, 9216, 10368, 11520, 12288, 528\n\n ];\n Mix.fill(n,\n {\n var detune = 5.rand;\n var sin = SinOsc.ar(x.choose, 4.rand, 0.25);\n var saw = RLPF.ar(Saw.ar(x.choose*0.01+detune, 0.75), x.choose, 2.rand).tanh;\n Pan2.ar((sin+saw) * EnvGen.kr(Env.sine(12, 1/n), 1, doneAction:2),\n 1.rand2) }\n );\n};\n);\n\n(\n// DEFINE A ROUTINE\nr = Routine({\n\n inf.do({\n f.play;\n 10.wait;\n })\n});\n);\n\nr.reset.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Object.performArgs` do? What arguments does it take?"}, {"role": "assistant", "content": "Like #-perform, but allows you to pass a key-value array of keyword arguments. Useful in #-doesNotUnderstand and other places where you might accept a variety of keyword Arguments: selector — A Symbol of the method name.; args — An Array of the arguments.; kwargs — An Array of keyword-argument pairs. Example `x.performArgs(\\foo, [1, 2], [\\bar, 10]);`."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\"help-IRand\", {\n Out.ar(\n IRand(0, 1), // play on random channel between 0 and 1\n FSinOsc.ar(500,\n 0, Line.kr(0.2, 0, 0.1, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n(\nRoutine({\n 16.do({\n Synth.new(\"help-IRand\"); 0.5.wait;\n })\n}).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\"help-IRand\", {\n Out.ar(\n IRand(0, 1), // play on random channel between 0 and 1\n FSinOsc.ar(500,\n 0, Line.kr(0.2, 0, 0.1, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n(\nRoutine({\n 16.do({\n Synth.new(\"help-IRand\"); 0.5.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `SharedOut` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\n// only works with the internal server\ns = Server.internal;\ns.boot;\n);\n\n(\nSynthDef(\"help-SharedOut\", {\n SharedOut.kr(0, SinOsc.kr(0.2));\n}).add;\n);\n\n(\ns.sendMsg(\\s_new, \"help-SharedOut\", x = s.nextNodeID, 0, 1);\ns.sendMsg(\\n_trace, x);\n\n// poll the shared control bus\nRoutine({\n 30.do({\n s.getSharedControl(0).postln;\n 0.2.wait;\n });\n}).play;\n);\n\n\ns.quit;\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Recorder`."}, {"role": "assistant", "content": "```supercollider\nr = Recorder(s);\n{ GVerb.ar(Dust.ar(4)) }.play; // play on bus 64\nr.record(numChannels: 2);\nr.stopRecording;\n```"}]} +{"conversations": [{"role": "user", "content": "I edited a SynthDef and the running sound did not change."}, {"role": "assistant", "content": "Redefining a SynthDef only affects Synths created after the new definition reaches the server; existing instances keep the graph they were built with. Free and recreate them: `~s.free; ~s = Synth(\\name)`. In JITLib, Ndef is the tool designed for this — redefining `Ndef(\\name, { ... })` crossfades to the new graph while it plays."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Kepler 22-b atmosphere. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\nfork { \n Ndef(\\ttwnd).play;//(d,2,addAction:\\addToHead);\n loop {\n var seed = thisThread.randSeed = 100000000.rand.debug('seed');\n Ndef(\\ttwnd, {\n var freq = [20, 7500];\n Splay.ar(\n { \n var bands = 2.rrand(10);\n var sig = { [BPF,RLPF,RHPF].choose.ar(\n LFNoise2.ar(freq[0].rrand(freq[1]), LFNoise2.kr(0.1.exprand(10))),\n Array.rand(bands, freq[0], freq[1]),\n Array.rand(bands, 0.2, 1.8)\n ).mean } ! 2;\n Rotate2.ar(sig[0], sig[1], LFSaw.kr(0.1.exprand(10)));\n } ! 4.rrand(6).debug('source'),\n 0.5.rrand(1)\n );\n }).fadeTime_(1.rrand(4.0));\n 10.0.rrand(40).debug('wait(bts)').wait;\n }\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Array.allTuples` do?"}, {"role": "assistant", "content": "Returns a new Array whose elements contain all possible combinations of the receiver's subcollections. `[[1, 2, 3, 4, 5], [10, 20,"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Detune idea is from James Harkins. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\na = {\n |freq = 40, wid = 0.5|\n Mix(LFPulse.ar(freq *((Array.fill(40, Pxrand((1, 2..20), inf).iter)/1000)+1),\n 0, wid, 0.05)\n ).dup\n}.play;\n);\n\n//more distorsion\n~widlfo = {Saw.kr(0.5).range(0,1)};\na.set(\\wid, ~widlfo);\n\n//stop\na.release;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for seasonal reflections ) that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n(\nfork { loop { \n Ndef(\\winter_curves, {\n var bands = 5.rrand(15) * 2;\n var freqs = Array.exprand(bands.debug('bands'), 20, 18000);\n Pan2.ar(\n SinOsc.ar(\n freqs, \n Array.rand(bands, 0, pi),\n AmpCompA.kr(freqs, freqs.sort.first)\n ).perform(0.5.coin.if(\\tanh,\\value).debug('kind')),\n FSinOsc.kr(\n Array.exprand(bands, 0.01, 15),\n Array.rand(bands, 0, pi),\n ),\n bands.reciprocal\n * LFGauss.kr(SinOsc.kr(Array.rand(bands, 0.05, 0.1)).range(1,10), 0.3)\n * FSinOsc.kr(\n Array.exprand(bands, 0.1, 15),\n 0.3\n ).range(0,1)\n ).sum\n * SelectX.kr(\n FSinOsc.kr(Array.exprand(bands, 0.1, 15)).range(0,1),\n [\n EnvGen.kr(\n Env.perc(\n FSinOsc.kr(1/16).range(0.01,0.1),\n FSinOsc.kr(1/8).range(0.25,0.3)\n ).blend(\n Env.sine( // 1/4\n FSinOsc.kr(Array.exprand(bands, 0.1, 15)).range(0.05,2)\n ).blend(\n Env.sine(1/4),\n FSinOsc.kr(Array.exprand(bands, 0.1, 15)).range(0.05,2).mean\n ),\n FSinOsc.kr(Array.exprand(bands, 0.1, 15)).range(0,1)\n ).circle,\n 1, 0.8, \n FSinOsc.kr(freqs.linlin(20,18000,0.1,20)).range(0, 0.2).mean\n ),\n 1\n ]\n ).clump(2).mean\n }).fadeTime_(0.5.rrand(2.5)).play;\n 8.rrand(30).debug('len').wait;\n} }\n)\n```"}]} +{"conversations": [{"role": "user", "content": "How do I stop all sound?"}, {"role": "assistant", "content": "s.freeAll stops every node on the server. On the language side, Ndef.clear and Pdef.clear clear the proxies. If a Pattern is still running, Pdef(\\name).stop does it; CmdPeriod immediately stops everything scheduled on the default clock."}]} +{"conversations": [{"role": "user", "content": "How do I distort a signal?"}, {"role": "assistant", "content": "Drive it into a nonlinearity, then tame the level: `tanh` is soft clipping, `.distort` is harder,\nand a low-pass after the drive keeps it from getting fizzy.\n\n```supercollider\n(\n{\n var sig = SinOsc.ar(110) * 0.3;\n var driven = (sig * 12).tanh;\n LPF.ar(driven, 5000) * 0.4\n}.play;\n)\n```\n\nMore drive means more harmonics; because they are generated, the output is louder as well as brighter, so\nscale the result down after the nonlinearity."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Pseq(#[60, 61, 63, 65, 72], inf).asStream;\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, a.next.midicps]);\n 0.2.wait;\n })\n}).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Pseq(#[60, 61, 63, 65, 72], inf).asStream;\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, a.next.midicps]);\n 0.2.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `PlayerSocket.new` do? What arguments does it take?"}, {"role": "assistant", "content": "a player that can play other players using a cross-faded and fuse-protected socket Arguments: rate — all players should be the same rate; numChannels — all players should have the same numChannels.; round — if calling qspawnPlayer this is the timing quantization setting; env — the Envelope for the internal EnvelopedPlayer."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `ReplaceOut` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// ... a reverb adapted from the \"01 Why SuperCollider document\" in the SC2 distribution\n(\nSynthDef(\"preDelay\", { arg inbus = 2;\n ReplaceOut.ar(\n 4,\n DelayN.ar(In.ar(inbus, 1), 0.048, 0.048)\n )\n}).add;\n\nSynthDef(\"combs\", {\n ReplaceOut.ar(\n 6,\n Mix.arFill(7, { CombL.ar(In.ar(4, 1), 0.1, LFNoise1.kr(Rand(0, 0.1), 0.04, 0.05), 15) })\n )\n}).add;\n\nSynthDef(\"allpass\", { arg gain = 0.2;\n var source;\n source = In.ar(6, 1);\n 4.do({ source = AllpassN.ar(source, 0.050, [Rand(0, 0.05), Rand(0, 0.05)], 1) });\n ReplaceOut.ar(\n 8,\n source * gain\n )\n}).add;\n\nSynthDef(\"theMixer\", { arg gain = 1;\n ReplaceOut.ar(\n 0,\n Mix.ar([In.ar(2, 1), In.ar(8, 2)]) * gain\n )\n}).add;\n);\n\n(\nSynth(\"fm1\", [\\bus, 2, \\freq, 440, \\carPartial, 1, \\modPartial, 1.99, \\mul, 0.071]);\nSynth(\"fm1\", [\\bus, 2, \\freq, 442, \\carPartial, 1, \\modPartial, 2.401, \\mul, 0.071]);\nSynth.tail(s, \"preDelay\");\nSynth.tail(s, \"combs\");\nSynth.tail(s, \"allpass\");\nSynth.tail(s, \"theMixer\", [\\gain, 0.64]);\n);\n\n(\ns.queryAllNodes;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\ns.scope;\na = { Hilbert.ar(SinOsc.ar(100) * -20.dbamp }.play;\na.release;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\ns.scope;\na = { Hilbert.ar(SinOsc.ar(100)) * -20.dbamp }.play;\na.release;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// hear the difference, LinPan having a slight drop in the middle (yeah, it's subtle)...\n{ LinPan2.ar(SinOsc.ar(440), Line.kr(-1, 1, 5)) }.play;\n\n// ... whereas Pan2 is more smooth\n{ Pan2.ar(SinOsc.ar(440), Line.kr(-1, 1, 5)) }.play;\n\n// other examples\n{ LinPan2.ar(PinkNoise.ar(0.4), FSinOsc.kr(2)) }.play;\n\n{ LinPan2.ar(FSinOsc.ar(800, 0, 0.1), FSinOsc.kr(3)) }.play;\n```"}, {"role": "assistant", "content": "hear the difference, LinPan having a slight drop in the middle (yeah, it's subtle)... ... whereas Pan2 is more smooth (LinPan2: Two channel linear pan.)"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for seeking an Array!: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(// * //watch the postWindow\na=[\"m\",\"x\",\"f\",\"k\",\"d\",\"p\"];\nx=Array;\ny=x.newClear(6);\n~mxfkdp=Task({\n inf.do({y.put(x.series(6,0,1).choose,a.scramble).postln;\n 0.03.wait;})}).play;\nm=fork({inf.do({\n \"array num:\".postcln;\n if(y[x.series(6,0,1).choose.postcln]==a,\n {\"lo encontraste!/found it!\".postcln;\n 1.do({GVerb.ar(\n EnvGen.ar(Env.perc(0.01,8),1,doneAction:2)*\n Blip.ar(XLine.kr(440,1600,8)),50,10,0.02)}.play);\n ~mxfkdp.stop;\n m.stop;}, \n {\"buscando.../seeking...\".postcln;});\n 0.03.wait})});\n);\n//.SCtweetLong\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\ns.boot;\n(\n{\n SinOsc.ar([225, 450, 900], 0, 0.2)\n + LPF.ar(\n LFPulse.ar(226 * [1, 2, 5], [0, 0.1, 0.1], 0.2, 0.2),\n MouseX.kr(20, 10000, 1)\n )\n}.scope;\n);\n\n// server.scope only changes the properies explicitly given:\n\ns.scope(numChannels: 5);\ns.scope(index: 12);\ns.scope(zoom: 4);\ns.scope(index: 0);\n\ns.scopeWindow.size = 600;\ns.scopeWindow.size = 222;\n\n// scoping buses:\n\na = Bus.audio(s, 4);\n{\n// …\n```"}, {"role": "assistant", "content": "server.scope only changes the properies explicitly given: note that scoping control rate buses shows block size interpolation (this is due to the (Stethoscope: An oscilloscope)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// increase phase multiplier\n{ FBSineC.ar(SampleRate.ir, 1, 0, XLine.kr(1, 2, 10), 0.1) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// increase phase multiplier\n{ FBSineC.ar(SampleRate.ir, 1, 0, XLine.kr(1, 2, 10), 0.1) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `SharedOut` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\n// only works with the internal server\ns = Server.internal;\ns.boot;\n);\n\n(\nSynthDef(\"help-SharedOut\", {\n SharedOut.kr(0, SinOsc.kr(0.2));\n}).add;\n);\n\n(\ns.sendMsg(\\s_new, \"help-SharedOut\", x = s.nextNodeID, 0, 1);\ns.sendMsg(\\n_trace, x);\n\n// poll the shared control bus\nRoutine({\n 30.do({\n s.getSharedControl(0).postln;\n 0.2.wait;\n });\n}).play;\n);\n\n\ns.quit;\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `NRand`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-NRand\", { |out = 0, n = 0|\n Out.ar(out,\n FSinOsc.ar(\n NRand(1200.0, 4000.0, n),\n 0, Line.kr(0.2, 0, 0.01, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n(\nn = 0;\nRoutine({\n inf.do({ |i|\n Synth.new(\"help-NRand\", [\\n, n]); 0.05.wait;\n })\n}).play;\n);\n\nn = 1;\nn = 2;\nn = 4;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `MIDIIn.sysex` do? What arguments does it take?"}, {"role": "assistant", "content": "receive MIDI messages Arguments: value — a Function evaluated whenever a MIDI System Exclusive message is received. It is passed the following arguments:."}]} +{"conversations": [{"role": "user", "content": "What does `WebView.onLoadFinished` do?"}, {"role": "assistant", "content": "Sets the object to be evaluated when a page has loaded successfully, passing the view as the"}]} +{"conversations": [{"role": "user", "content": "What does `Server.quit` do? What arguments does it take?"}, {"role": "assistant", "content": "quit the server Arguments: onComplete — A function that is called when quit has completed.; onFailure — A function that is called when quit has failed.; watchShutDown — a boolean to tell the server whether to watch status during shutdown.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{CrossoverDistortion.ar(SinOsc.ar([400, 404], 0, 0.2), MouseX.kr(0, 1), MouseY.kr(0, 1))}.play\n\n{CrossoverDistortion.ar(SoundIn.ar, MouseX.kr(0, 1), MouseY.kr(0, 1)}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{CrossoverDistortion.ar(SinOsc.ar([400, 404], 0, 0.2), MouseX.kr(0, 1), MouseY.kr(0, 1))}.play\n\n{CrossoverDistortion.ar(SoundIn.ar, MouseX.kr(0, 1), MouseY.kr(0, 1))}.play\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Integer.numBits` do?"}, {"role": "assistant", "content": "32-bit Integer number Returns: number of required bits"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{WalshHadamard.ar(SoundIn.ar, MouseX.kr(0,64)}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{WalshHadamard.ar(SoundIn.ar, MouseX.kr(0,64))}.play\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Convolution2L`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// one last example\n(\nb = Buffer.alloc(s, 512, 1);\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, true, true);\n);\n\n(\n{\n var input = SoundIn.ar(0);\n var framesize = 512;\n Convolution2L.ar(input, b, 0, framesize, 1, 0.5);\n}.play\n);\n\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n var mod = SinOsc.ar([0.1,0.15,0.2]).range(0,1);\n var saw = LFSaw.ar([10,12,15]);\n var out = (saw - ((saw>0)*mod)+(mod*0.5));\n Splay.ar(out)*0.4;\n}.play;\n\n{\n var mod = SinOsc.ar([0.1,0.15,0.2]).range(0,1);\n var saw = SinOsc.ar(LFSaw.ar([10,12,15]).range(200,300));\n var out = (saw - ((saw>0)*mod)+(mod*0.5));\n Splay.ar(out)*0.4;\n}.play\n)\n```"}, {"role": "assistant", "content": "Made with code from Jonatan Liljedahl and Glen Fraser. Based on the Korg Z1 sawtooth oscilator."}]} +{"conversations": [{"role": "user", "content": "What is the difference between ~foo and a local variable?"}, {"role": "assistant", "content": "`var foo` is a local: it exists only inside the function or file block that declares it. `~foo` is an environment variable: it lives in the current Environment, survives between executions of the same block, and is visible to everything running in that environment. That is why `~buf = Buffer.read(s, path)` works in one cell and `PlayBuf.ar(1, ~buf)` works in the next, while a `var` would be gone."}]} +{"conversations": [{"role": "user", "content": "What is `ControlName`?"}, {"role": "assistant", "content": "ControlName — Object to store control information of SynthDef (used internally)"}, {"role": "user", "content": "What does `ControlName.index` do?"}, {"role": "assistant", "content": "The index of the control."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nd = SynthDef(\\tone, { |out = 0, freq = 200|\n var sig;\n\n freq.spec = ControlSpec(20, 20000);\n sig = SinOsc.ar(freq);\n\n Out.ar(out, sig);\n}).add;\n);\n\nd.specs.freq.postln;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var trig = Dust.kr(10);\n SinOsc.ar(\n TExpRand.kr(300.0, 3000.0, trig)\n ) * 0.1\n}.play;\n);\n\n(\n{\n var trig = Dust.ar(MouseX.kr(1, 8000, 1));\n SinOsc.ar(\n TExpRand.ar(300.0, 3000.0, trig)\n ) * 0.1\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var trig = Dust.kr(10);\n SinOsc.ar(\n TExpRand.kr(300.0, 3000.0, trig)\n ) * 0.1\n}.play;\n);\n\n(\n{\n var trig = Dust.ar(MouseX.kr(1, 8000, 1));\n SinOsc.ar(\n TExpRand.ar(300.0, 3000.0, trig)\n ) * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `EnvelopeView.editable` do? What arguments does it take?"}, {"role": "assistant", "content": "Whether any node is Arguments: A Boolean.."}]} +{"conversations": [{"role": "user", "content": "What does `MIDIIn.polytouch` do? What arguments does it take?"}, {"role": "assistant", "content": "receive MIDI messages Arguments: value — a Function evaluated whenever a MIDI polytouch message is received. It is passed the following arguments:."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Just a dirty FM bass shuffling. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\nfork{\n SynthDef(\\basicFM, {|out = 0, gate = 1, amp = 1, carFreq = 1000, modFreq = 100, modAmount = 2000, clipAmount = 0.1|\n var modEnv = EnvGen.ar(Env.adsr(0.5, 0.5, 0.7, 0.1, peakLevel: modAmount), gate);\n var mod = SinOsc.ar(modFreq) * modEnv;\n var car = SinOsc.ar(carFreq + mod);\n var ampEnv = EnvGen.ar(Env.adsr(0.1, 0.3, 0.7, 0.2, peakLevel: amp), gate, doneAction: 2);\n var clip = clipAmount * 500;\n Out.ar(out, (car * ampEnv * clip).clip(-0.7, 0.7) * 0.1);\n }).add;\n\n s.sync;\n\n Pbind(*[\n instrument: \\basicFM,\n out: [0, 1],\n dur: Pseq([1/7, 1/3] / 1.2, inf),\n sustain: Pkey(\\dur),\n amp: 1/4,\n carFreq: Pseq([1, 1, 1, 2] * 350, inf),\n modFreq: Pkey(\\carFreq) * (1/8),\n modAmount: Pseq([2, 1, 0.5, 2, 1, 0.5, 2, 1, 2, 1, 0.5, 2, 1, 0.5, 2, 4] * 500, inf),\n clipAmount: Pseq([Pn(0.1, 32), Pn(1, 32)], inf)\n ]).play;\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n// create a Synth at the head of the default Server's default group\n// based on the SynthDef \"default\"\nx = Synth.new(\"default\");\ns.queryAllNodes; // note the default group (ID 1)\nx.free;\n\n// Using an arrayed control\n// run this block first to make the SynthDef\n(\nSynthDef(\"help-synth\", { |freq = #[440, 450, 460], out = 0|\n Out.ar(out, Mix(SinOsc.ar(freq, 0, 0.1)));\n}).add;\n);\n\n// then this a short while later\nx = Synth(\"help-synth\", [freq: [500, 501, 510]]);\n\nx = Synth(\"help-synth\",\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n// create a Synth at the head of the default Server's default group\n// based on the SynthDef \"default\"\nx = Synth.new(\"default\");\ns.queryAllNodes; // note the default group (ID 1)\nx.free;\n\n// Using an arrayed control\n// run this block first to make the SynthDef\n(\nSynthDef(\"help-synth\", { |freq = #[440, 450, 460], out = 0|\n Out.ar(out, Mix(SinOsc.ar(freq, 0, 0.1)));\n}).add;\n);\n\n// then this a short while later\nx = Synth(\"help-synth\", [freq: [500, 501, 510]]);\n\nx = Synth(\"help-synth\", [freq: [500, 501, 510]]);\nx.set(\\freq, [1, 2, 3] * 400 + [1, 2, 3], \\out, 1);\nx.set(\\freq, [3] * 400 + [1, 2, 3], \\out, 1);\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n~buf = Buffer.read(s, \"C:/sounds/break.wav\");\nPlayBuf.ar(1, ~buf, BufRateScale.kr(~buf), loop: 1);\n```"}, {"role": "assistant", "content": "Loads a sound file into server memory, then plays it in a loop at the file's original pitch.\n\n- `Buffer.read(s, path)` allocates a buffer on the server and fills it from the file. It is asynchronous:\n the Buffer object returns immediately, the samples arrive later.\n- `PlayBuf.ar(1, buf, ...)` needs the channel count first — 1 for a mono file. A wrong count is the usual\n cause of a buffer that plays wrongly or not at all.\n- `BufRateScale.kr(buf)` compensates when the file's sample rate differs from the server's, so `rate: 1` is\n the file's true speed.\n- `loop: 1` restarts at the end instead of stopping.\n\nBecause the read is asynchronous, this line pair is only safe if a `s.sync` or a wait happened in between;\notherwise PlayBuf sees a buffer with no data yet."}]} +{"conversations": [{"role": "user", "content": "What does `File.readAllSignal` do?"}, {"role": "assistant", "content": "Open the file at the given path, call #-readAllSignal, and return the signal. Whether the process succeeds or fails, the file will always be"}]} {"conversations": [{"role": "user", "content": "What are the server's default sample rate and block size?"}, {"role": "assistant", "content": "44100 Hz and 64 samples per block by default, so the control rate is 44100/64 = 689.06 Hz. You can read them from the language with `s.sampleRate` and `s.options.blockSize`, or from inside a Synth with `SampleRate.ir` and `ControlRate.ir`. A `.kr` signal therefore updates about 689 times a second, which is why it is smooth enough for filters and envelopes but not for audio-rate FM."}]} -{"conversations": [{"role": "user", "content": "What does `Color.hexString` do?"}, {"role": "assistant", "content": "Returns a String containing a 6 character web color code, preceded by a #. `Color(1.0,"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\nb = Buffer.alloc(s, 100);\nb.zero;\nb.set(33, 1.034);\n// This should detect the 33rd value as the highest...\nx = {BufMax.kr(b).poll}.play;\n\n// ...until we set a new winner...\nb.set(74, 1.038;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\nb = Buffer.alloc(s, 100);\nb.zero;\nb.set(33, 1.034);\n// This should detect the 33rd value as the highest...\nx = {BufMax.kr(b).poll}.play;\n\n// ...until we set a new winner...\nb.set(74, 1.038);\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// Periphonic (3D) encoder, a 1/2 dome of 13 loudspeakers\n// [[0, 0], [45, 0], [90, 0], [135, 0], [-180, 0], [-135, 0], [-90, 0], [-45, 0],\n// [45, 35.3], [135, 35.3], [-135, 35.3], [-45, 35.3], [0, 90]]\n\n~directions = [[0, 0], [45, 0], [90, 0], [135, 0], [-180, 0], [-135, 0], [-90, 0],\n [-45, 0], [45, 35.3], [135, 35.3], [-135, 35.3], [-45, 35.3], [0, 90]].degrad;\n~encoder = FoaE\n// …\n```"}, {"role": "assistant", "content": "Periphonic (3D) encoder, a 1/2 dome of 13 loudspeakers [[0, 0], [45, 0], [90, 0], [135, 0], [-180, 0], [-135, 0], [-90, 0], [-45, 0], (FoaEncoderMatrix: First Order Ambisonic (FOA) encoder matrices)"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `StandardL`."}, {"role": "assistant", "content": "```supercollider\n// mouse-controlled param\n{ StandardL.ar(SampleRate.ir/2, MouseX.kr(0.9, 4)) * 0.3 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes little experiment with periodicity."}, {"role": "assistant", "content": "```supercollider\n/* An little experiment with periodicity. \n Maybe there can be some sync artifact...\n */\n\ns.boot;\n\nSynthDef(\\mallet,{arg in=0,out=0,f=0,f2=0,a=0.1,r=1.8;\n\n var sig=Array.fill(3,{|n| SinOsc.ar(f*(n+1),mul:a/(n*n+1))}).sum;\n var env=EnvGen.kr(Env.perc(0.001,r),gate:Impulse.kr(f2),doneAction:0);\n\nOut.ar(out,sig*env!2);\n};\n).add;\n\n~root=60;\n~degrees=[0,4,5,7,9,12,16,17,19,21].scramble;\n~num=10;\n~coeff=0.75;\n\nArray.fill(~num,{|n| Synth.new(\\mallet,[\\f:(~root +~degrees[n]).midicps,\\a:0.2/~num,\\f2:(1+(n*~coeff))*0.1])});\n\ns.quit;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `LinLin` in SuperCollider briefly."}, {"role": "assistant", "content": "LinLin — Map a linear range to another linear range Maps a linear range of values to another linear range of values. Category: UGens > Maths."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `List`."}, {"role": "assistant", "content": "```supercollider\n// Create a new empty collections with size 3:\nx = Array.new(3);\ny = Array.new(3);\nz = List.new(3);\n\n// Try to add 7 items to the array and list.\n// If the array exceeds maxSize, it will only\n// grow to an internally specified max size.\n(\n7.do { |i|\n x.add(i);\n y = y.add(i); // reassign array y on each add\n z.add(i);\n};\n);\n\n// Attempt to access the 5th item:\nx.at(4); // -> nil (out of bounds)\ny.at(4); // -> 4\nz.at(4); // -> 4\n\n// x grew only to size 4\nx.postln; // -> [ 0, 1, 2, 3 ]\ny.postln; // -> [ 0, 1, 2, 3, 4, 5, 6 ]\nz.postln; // -> List[ 0, 1, 2, 3, 4, 5, 6 ]\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `BinaryOpUGen`."}, {"role": "assistant", "content": "```supercollider\n// trigger an envelope\n(\n{\n var trig;\n trig = SinOsc.ar(1) > 0.1;\n EnvGen.kr(Env.perc, trig, doneAction: Done.none) * SinOsc.ar(440, 0, 0.1)\n}.play\n) // > outputs 0 or 1\n```"}]} -{"conversations": [{"role": "user", "content": "What is the difference between .ar, .kr and .ir?"}, {"role": "assistant", "content": "The rate method decides how often a UGen is evaluated. `.ar` runs at the audio rate, once per sample, and produces an audio signal. `.kr` runs at the control rate, once per block of 64 samples by default, so it is cheaper and is used for parameters that do not need sample accuracy. `.ir` is evaluated once when the Synth is created and then never again, for constants such as SampleRate.ir or a size. Using .kr where you need audio-rate modulation gives stepped, zipper-noise-like control; using .ar where .kr would do costs CPU."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n~buf = BBCutBuffer(Platform.resourceDir +/+ \"sounds/break.aiff\", 8);\n\nBBCut2(CutGroup([CutBuf3(~buf, 0.3), CutBit1(16, 8000, 0, 1.0)]), WarpCutProc1()).play(2.5);\n\nBBCut2(CutGroup([CutBuf3(~buf, 0.3), CutBit1({ [3, 4, 5].choose }, 8000, 0, 0.9)]), WarpCutProc1()).play(2.5;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n~buf = BBCutBuffer(Platform.resourceDir +/+ \"sounds/break.aiff\", 8);\n\nBBCut2(CutGroup([CutBuf3(~buf, 0.3), CutBit1(16, 8000, 0, 1.0)]), WarpCutProc1()).play(2.5);\n\nBBCut2(CutGroup([CutBuf3(~buf, 0.3), CutBit1({ [3, 4, 5].choose }, 8000, 0, 0.9)]), WarpCutProc1()).play(2.5);\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n/* Audio plugin definition\n\n Each audio plugin should define the following global variables:\n ~name: (symbol) name of the spatializer\n ~description: (string) a short description\n ~function: the actual definition of the plugin\n\n*/\n\n~name = \\MonoIn;\n~description = \"A direct input\";\n~channelLayout = \\mono;\n\n~function = {\n |gate = 0, bus = 0, attack = 0.02, susL = 0.9, release = 0.1, curve = -4|\n var env = Env.asr(attack, susL, release, curve);\n SoundIn.ar(bus, EnvGen.kr(env, gate));\n}\n```"}, {"role": "assistant", "content": "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see ."}]} -{"conversations": [{"role": "user", "content": "What does `HistoryGui.showLineAt` do?"}, {"role": "assistant", "content": "show the line at that index in History.lines in the"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Warp1`."}, {"role": "assistant", "content": "```supercollider\n(\nb.free;\nb = Buffer.read(s, ExampleFiles.apollo11);\n{\n var pointer = Phasor.ar(0, SampleDur.ir / BufDur.ir(b) * XLine.kr(1, 0.25, 20));\n var sound = Warp1.ar(1, b, pointer, 1, 0.3, -1, 16, Line.kr(0, 1, 40), 4);\n Pan2.ar(sound, pointer * 2 - 1, 0.25)\n}.play\n);\nb.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SinOsc`."}, {"role": "assistant", "content": "```supercollider\n// create an audio-rate sine wave at 200 Hz,\n// starting with phase 0 and an amplitude of 0.5\n{ SinOsc.ar(200, 0, 0.5) }.play;\n\n// modulate the frequency with an exponential ramp\n{ SinOsc.ar(XLine.kr(2000, 200), 0, 0.5) }.play;\n\n// more complex frequency modulation\n{ SinOsc.ar(SinOsc.ar(XLine.kr(1, 1000, 9), 0, 200, 800), 0, 0.25) }.play;\n\n// phase modulation (see also PMOsc)\n{ SinOsc.ar(800, SinOsc.ar(XLine.kr(1, 1000, 9), 0, 2pi), 0.25) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\n(\nb = Buffer.read(s, ExampleFiles.apollo11);\nx = { |envbuf = -1|\n var pointer, pitch;\n // pointer - move from beginning to end of soundfile over 15 seconds\n pointer = LFSaw.ar(1/15).range(0, 1);\n // control pitch with MouseX\n pitch = MouseX.kr(0.5, 2);\n Warp1.ar(\n numChannels: 1,\n bufnum: b,\n pointer: pointer,\n freqScale: pitch,\n windowSize: 0.1,\n envbufnum: envbuf,\n overlaps: 8,\n windowRandRatio: 0.1,\n interp: 2\n )\n}.play\n\n);\n\n\n(\n// a custom envelope\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\n(\nb = Buffer.read(s, ExampleFiles.apollo11);\nx = { |envbuf = -1|\n var pointer, pitch;\n // pointer - move from beginning to end of soundfile over 15 seconds\n pointer = LFSaw.ar(1/15).range(0, 1);\n // control pitch with MouseX\n pitch = MouseX.kr(0.5, 2);\n Warp1.ar(\n numChannels: 1,\n bufnum: b,\n pointer: pointer,\n freqScale: pitch,\n windowSize: 0.1,\n envbufnum: envbuf,\n overlaps: 8,\n windowRandRatio: 0.1,\n interp: 2\n )\n}.play\n\n);\n\n\n(\n// a custom envelope - not a very good one, but you can hear the difference\n// between this and the default\nvar winenv = Env([0, 1, 0], [0.5, 0.5], [8, -8]);\nz = Buffer.sendCollection(s, winenv.discretize, 1);\nx.set(\\envbuf, z);\n);\n\n// the default is -1\nx.set(\\envbuf, -1);\n\n// relase and end\nx.relase; z.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Magnitude` in SuperCollider?"}, {"role": "assistant", "content": "Magnitude — Comparable value in a linear continuum Magnitudes represent values along a linear continuum which can be compared against each other. Category: Math."}]} -{"conversations": [{"role": "user", "content": "What does `Color.asHSV` do?"}, {"role": "assistant", "content": "Returns an array with `[hue, saturation, value, alpha]`, as values between 0 and"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// Kabelscahden \n// by Alberto de Campo and Julian Rohrhuber, 3/2003\n// licenced under creative commons Attribution-ShareAlike 2.5\n\n\n(\n{\n var h, n, m, k, trig;\n trig = Dust.kr( 7 ** LFNoise1.kr(0.3) );\n h = ToggleFF.kr(CoinGate.kr(0.4,trig)) *\n RLPF.ar(LFPulse.ar(50, 0, 0.5, 1, LFNoise1.kr(2, 0.5, -0.5)), 6000, 0.15);\n n = Trig.ar(trig, TRand.kr(0, 0.01, CoinGate.kr(0.4,trig))) * WhiteNoise.ar;\n m = Trig.ar(trig, TRand.kr(0, 0.01, CoinGate.kr(0.4,trig))) * BrownNoise.ar;\n k = Trig.ar(trig, LFNoise1.kr([ 4, 4.2 ], 0.1, 0.11)) *\n LFClipNoise.ar(LFNoise0.kr(7, 30, 40));\n LeakDC.ar(h + n + k + m * 10).distort;\n}.play;\n);\n\nhttps://swiki.hfbk-hamburg.de/MusicTechnology/851\n```"}, {"role": "assistant", "content": "Kabelscahden Guitar Cable Hum Buzz Noise Cable damage - Repost (a SuperCollider snippet)."}]} -{"conversations": [{"role": "user", "content": "What does `KeyCodeResponder.option` do? What arguments does it take?"}, {"role": "assistant", "content": "register responder functions for keycode and modifier combinations Arguments: ... associations."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot\n\n{ Ringz.ar(PinkNoise.ar([0.1, 0.2]).scope(\\pink), 2000, 1, 0.25 }.play; // multichannel works\ns.scope; // can still separately scope the output of the server\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot\n\n{ Ringz.ar(PinkNoise.ar([0.1, 0.2]).scope(\\pink), 2000, 1, 0.25) }.play; // multichannel works\ns.scope; // can still separately scope the output of the server\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `NestedAllpassC` in SuperCollider briefly."}, {"role": "assistant", "content": "NestedAllpassC — Nested Allpass filters as proposed by Vercoe and Pluckett Useful for reverberation, especially implementing Gardner reverbs. Category: UGens > Delays."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `IdentityDictionary`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_sinegrain, { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0.5pi, env))\n}).add;\n\na = Pbind(\\instrument, \\help_sinegrain, \\note, Pseq([0, 7, 2, 9, 11, 10, 9, 8], inf), \\dur, 1);\na.play(quant: (quant: 1, phase: 0));\na.play(quant: (quant: 1, phase: 1/3));\na.play(quant: (quant: 1, phase: 1.0.rand));\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes morning on Gliese 667Cb."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var gen = { rrand(1,10).reciprocal };\n BPF.ar(\n SelectX.ar(LFNoise2.kr(gen!4).exprange(0.02,2), [BrownNoise.ar, WhiteNoise.ar, PinkNoise.ar]).mean,\n LFNoise2.ar(gen!8).exprange(20,2e4),\n LFNoise2.ar(gen!8).exprange(0.1,2),\n LFNoise2.ar(gen!8).range(0.1,1)\n ).clump(2).mean\n + FreeVerb.ar(\n LFPar.ar(\n LFNoise2.ar(gen!8).exprange(20,2e4) * SinOsc.ar(1/gen!8).exprange(1,1.2), 0,\n LFNoise2.ar(gen!8).exprange(0.08,0.5) * EnvGen.ar(\n Env.perc.blend(Env.sine, LFNoise2.kr(gen!8)).circle, \n timeScale: gen!8 // LFNoise2.ar(gen!8).range(1/5, 5)\n )\n ).clump(2).mean,\n LFNoise2.ar(1/5)\n ) \n + Pan2.ar(\n Pluck.ar(\n WhiteNoise.ar ! 2,\n Dust.ar(LFNoise2.kr(gen!2).exprange(1/5,5)), \n 1/200, LFNoise2.kr(gen!2).exprange(1/14000,1/200),\n LFNoise2.kr(gen!2).range(1,10),\n LFNoise2.kr(gen!2).range(0,1),\n LFNoise2.kr(gen!2).exprange(0.2,1)\n ),\n LFNoise2.kr(gen!2).range(-1,1)\n ).sum\n / 3;\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `Scale` in SuperCollider briefly."}, {"role": "assistant", "content": "Scale — represents a musical scale Scale supports arbitrary octave divisions and ratios, and (in conjunction with Tuning) can generate pitch information in various ways, including as input to Patterns. Category: Math, Tuning."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for seasonal reflections )?"}, {"role": "assistant", "content": "```supercollider\n(\nfork { loop { \n Ndef(\\winter_curves, {\n var bands = 5.rrand(15) * 2;\n var freqs = Array.exprand(bands.debug('bands'), 20, 18000);\n Pan2.ar(\n SinOsc.ar(\n freqs, \n Array.rand(bands, 0, pi),\n AmpCompA.kr(freqs, freqs.sort.first)\n ).perform(0.5.coin.if(\\tanh,\\value).debug('kind')),\n FSinOsc.kr(\n Array.exprand(bands, 0.01, 15),\n Array.rand(bands, 0, pi),\n ),\n bands.reciprocal\n * LFGauss.kr(SinOsc.kr(Array.rand(bands, 0.05, 0.1)).range(1,10), 0.3)\n * FSinOsc.kr(\n Array.exprand(bands, 0.1, 15),\n 0.3\n ).range(0,1)\n ).sum\n * SelectX.kr(\n FSinOsc.kr(Array.exprand(bands, 0.1, 15)).range(0,1),\n [\n EnvGen.kr(\n Env.perc(\n FSinOsc.kr(1/16).range(0.01,0.1),\n FSinOsc.kr(1/8).range(0.25,0.3)\n ).blend(\n Env.sine( // 1/4\n FSinOsc.kr(Array.exprand(bands, 0.1, 15)).range(0.05,2)\n ).blend(\n Env.sine(1/4),\n FSinOsc.kr(Array.exprand(bands, 0.1, 15)).range(0.05,2).mean\n ),\n FSinOsc.kr(Array.exprand(bands, 0.1, 15)).range(0,1)\n ).circle,\n 1, 0.8, \n FSinOsc.kr(freqs.linlin(20,18000,0.1,20)).range(0, 0.2).mean\n ),\n 1\n ]\n ).clump(2).mean\n }).fadeTime_(0.5.rrand(2.5)).play;\n 8.rrand(30).debug('len').wait;\n} }\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// next example\n\nb = Buffer.read(s, ExampleFiles.child);\n\n(\n{\n var input = SoundIn.ar(0);\n var framesize = 2048; // must have power of two\n Convolution2L.ar(input, b, 0, 512, 1, 0.5);\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// next example\n\nb = Buffer.read(s, ExampleFiles.child);\n\n(\n{\n var input = SoundIn.ar(0);\n var framesize = 2048; // must have power of two\n Convolution2L.ar(input, b, 0, 512, 1, 0.5);\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// (thor magnusson) (2006)\n\n// An instrumentalist inside a synthdef.\n\n(\nSynthDef(\\drummer, { arg out=0, tempo=4;\n var snare, base, hihat;\n tempo = Impulse.ar(tempo); // for a drunk drummer replace Impulse with Dust !!!\n\n snare = WhiteNoise.ar(Decay2.ar(PulseDivider.ar(tempo, 4, 2), 0.005, 0.5));\n base = SinOsc.ar(Line.ar(120,60, 1), 0, Decay2.ar(PulseDivider.ar(tempo, 4, 0), 0.005, 0.5));\n hihat = HPF.ar(WhiteNoise.ar(1), 10000) * Decay2.ar(tempo, 0.005, 0.5);\n\n Out.ar(out,(snare + base + hihat) * 0.4 ! 2)\n}).add;\n);\n\na = Synth(\\drummer);\na.set(\\tempo, 6);\na.set(\\tempo, 18);\na.set(\\tempo, 180); // check the CPU! no increase.\na.free;\n```"}, {"role": "assistant", "content": "(thor magnusson) (2006) An instrumentalist inside a synthdef."}]} +{"conversations": [{"role": "user", "content": "Explain `SmoothFoldQ2` in SuperCollider briefly."}, {"role": "assistant", "content": "SmoothFoldQ2 — wave folding pseudo ugen using parabolic segments, two fold ranges Wave folding using SmoothClipQ. Values outside the range lo-hi are folded back, if the concerned foldRange > 0. A larger foldRange means less folding whereas a smaller foldRange causes more folding. The spectral result depends on the source wave form also but in general a smaller foldRange causes more energy in the higher spectrum whereas near foldRange == 0 the higher part of the spectrum again d Category: Libraries > miSCellaneous > WaveFolding."}]} {"conversations": [{"role": "user", "content": "My Synth runs but I hear nothing. How do I debug it?"}, {"role": "assistant", "content": "Check in this order, because each step eliminates a whole class of causes:\n\n1. **Is anything coming out of the bus you write to?** `Out.ar(0, sig)` for the master. A typo like\n `Out.ar(2, ...)` is silence.\n2. **Is the amplitude non-zero?** Multiply chain of `mul`/`add`, `amp`, and `env` all have to be positive;\n an envelope with `level: 0` or a gate that never opens is silent.\n3. **Did the Synth free itself immediately?** `doneAction: 2` on an EnvGen whose envelope is already\n finished at creation kills the node instantly. `s.plotTree` shows whether the node exists at all.\n4. **Is the envelope actually moving?** `env.poll` inside the SynthDef prints it per block.\n5. **Is the filter closed?** A `LPF.ar(sig, 50)` on a 440 Hz sine leaves almost nothing.\n\nThe fastest single tool is `s.plotTree`: if the Synth is not in the tree, the problem is lifecycle; if it\nis, the problem is signal."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nb = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n\n(\n{\n var snd, envTime, knee, out;\n snd = PlayBuf.ar(1, b, BufRateScale.kr(b), loop: 1);\n envTime = MouseX.kr(1.0e-3, 0.1e-3);\n knee = MouseY.kr(0, -90).dbamp;\n out = DelayC.ar(snd, 0.01, envTime * 0.5) * EnvFollow.ar(snd, 1 - (envTime * SampleRate.ir).reciprocal).max(knee).reciprocal;\n out * 0.1!2\n}.play;\n)\n```"}, {"role": "assistant", "content": "a replication of the legendary LADSPA plugin of the same name, originally written by steve harris. a compressor with a super fast attack which results in harsh distortion fx. requires sc3-plugins."}]} -{"conversations": [{"role": "user", "content": "What does `Editor.instrArgFromControl` do? What arguments does it take?"}, {"role": "assistant", "content": "holds a value that can be edited with a GUI, saves as the value Arguments: control."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// Handy code for quick class demonstrations.\n// Comparing a few intervals - Just Intonation versus 12-tone Equal Tempered\n\n// Major third (just)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 60.midicps * 5/4], mul: 0.1) }).play\n// Major third (ET12)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 64.midicps], mul: 0.1) }).play;\n\n// Major second (just)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 60.midicps * 9/8], mul: 0.1) }).play\n// Major second (ET)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 62.midicps], mul: 0.1) }).play;\n\n// Perfect fifth (just)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 60.midicps * 3/2], mul: 0.1) }).play\n// Perfect fifth (ET)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 67.midicps], mul: 0.1) });\n```"}, {"role": "assistant", "content": "Simple handy code for quick class demonstrations. Hear and compare a few intervals in Just Intonation versus 12-tone Equal Tempered tuning."}]} -{"conversations": [{"role": "user", "content": "Explain `Penvir` in SuperCollider briefly."}, {"role": "assistant", "content": "Penvir — use an environment when embedding the pattern in a stream Category: Streams-Patterns-Events > Patterns > Data Sharing."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nNdef(\\sound, { |freq = 56, numHarm = 10| Blip.ar(freq, numHarm, 30) * 0.2 }).play;\nNdef(\\sound).set(\\freq, 15);\nNdef(\\sound).set(\\freq, 15, \\numHarm, 100);\n\nNdef(\\lfo, { LFNoise2.kr(2).exprange(10, 200) });\nNdef(\\sound).map(\\numHarm, Ndef(\\lfo));\nNdef(\\sound).set(\\numHarm, nil); // unmap.\nNdef(\\sound.stop;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nNdef(\\sound, { |freq = 56, numHarm = 10| Blip.ar(freq, numHarm, 30) * 0.2 }).play;\nNdef(\\sound).set(\\freq, 15);\nNdef(\\sound).set(\\freq, 15, \\numHarm, 100);\n\nNdef(\\lfo, { LFNoise2.kr(2).exprange(10, 200) });\nNdef(\\sound).map(\\numHarm, Ndef(\\lfo));\nNdef(\\sound).set(\\numHarm, nil); // unmap.\nNdef(\\sound).stop;\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for SOUND 1, from orig Influx Example."}, {"role": "assistant", "content": "```supercollider\n// SOUND 1, from orig Influx Example\n(\n// // // if JITLibExtensions are used, you can make space local:\n// Ndef(\\dog).addSpec(\\intv, [-24, 24]);\n// Ndef(\\dog).addSpec(\\timescale, [0.01, 10, \\exp]);\n// Ndef(\\dog).addSpec(\\curve, [-10, 10]);\n// Ndef(\\dog).addSpec(\\ffreq, \\freq);\n//\n// Ndef(\\dog).addSpec(\\loopnode, [0, 12]);\n// Ndef(\\dog).addSpec(\\dens, [10, 1000, \\exp]);\n// Ndef(\\dog).addSpec(\\resfreq, \\freq);\n// Ndef(\\dog).addSpec(\\ringtime, [0.01, 1, \\exp]);\n\nSpec.add(\\intv, [-24, 24]);\nSpec.add(\\timescale, [0.01, 10, \\exp]);\nSpec.add(\\curve, [-10, 10]);\nSpec.add(\\ffreq, \\freq);\n\nSpec.add(\\loopnode, [0, 12]);\nSpec.add(\\dens, [10, 1000, \\exp]);\nSpec.add(\\resfreq, \\freq);\nSpec.add(\\ringtime, [0.01, 1, \\exp]);\n\n\nNdef(\\dog, { |amp=0, freq=250, intv=19, timescale=1, curve=0, loopnode=0, dens = 10, resfreq = 500, ringtime = 0.01|\n var n = 15;\n var env = EnvGen.kr(\n Env({ 1.0.rand2 }!(n+1), {1.0.rand}!n, curve, releaseNode: n-1, loopNode: loopnode.min(n-3)),\n timeScale: timescale);\n var pitch = (env * [1, 0.33, -1] * intv).midiratio * freq;\n var form = Formant.ar(pitch, pitch.rotate(1) * 1.6, pitch.rotate(2) * 2.6);\n\n var dusty = Ringz.ar(\n Dust.ar(dens!3),\n resfreq * LFNoise0.kr([3, 5, 7], 0.5, 1),\n ringtime)\n * ((dens ** -0.5) * (ringtime ** -0.3)\n );\n\n Splay.ar(form * dusty, level: amp) ;\n});\n);\n\nNdef(\\dog).set(\\amp, 0.2).vol_(0.2);\nNdef(\\dog).gui.moveTo(400, 380);\n\n/*\n// Ndef(\\dog).addHalo(\\orderedNames, Ndef(\\dog).controlKeys);\nNdef(\\dog).controlKeys;\nNdef(\\dog).vol_(0.5);\nNdefPreset( Ndef(\\dog) ).loadSettings;\nNdef(\\dog).play;\nNdef(\\dog).gui;\n*/\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes From a while ago."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var t, grav, sf, chain, sig;\n sf = LFPulse.ar(0.5);\n grav = LFNoise2.ar(1).range(0.1, 0.7);\n t = TBall.ar(sf, grav, 0.01, 0.0001) * 10;\n \n chain = FFT(LocalBuf(1024), t);\n chain = chain.pvcalc(1024, {|mags, phases|\n [phases, mags];\n });\n chain = PV_BrickWall(chain, LFNoise2.kr(1).range(-1, 0.5));\n chain = PV_RandComb(chain, LFNoise2.kr(1).range(0, 1), Dust.kr(20));\n sig = IFFT(chain);\n \n sig = sig ! 2;\n sig = sig + AllpassC.ar([sig[1], sig[0]], 0.1, {LFNoise2.kr(0.5).range(0.01, 0.1)} ! 2, 2);\n sig = sig + AllpassC.ar(sig, 0.1, {LFNoise2.kr(0.1).range(0.01, 0.1)} ! 2, 1);\n \n sig = LPF.ar(sig, 15000) + LPF.ar([sig[1], sig[0]], 500, 5) + LPF.ar(sig, 200, 10);\n sig = sig * 10;\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for attempt at a Star Wars sound effect!?"}, {"role": "assistant", "content": "```supercollider\n(\n\n// bye fighter\n{\n\nvar whooshPitch, whooseVol, swish, swishPitch = 970, noise, output, timeScale = 1.5;\nvar trump, trumpPitch = 400, chain, buf;\nvar panning;\n\nwhooshPitch = EnvGen.kr(\n\n Env(\n [0.8, 1.0, 0.9, 0.7, 0.5, 0.3, 0.24, 0.12, 0.0],\n [0.08, 0.2, 0.15, 0.11, 0.08, 0.09, 0.06, 0.18],\n 2\n ),\n timeScale: 1.3 * timeScale\n \n).lag(0.2);\n\nwhooseVol = EnvGen.kr(\n\n Env(\n [0.0, 0.2, 0.7, 0.9, 1.0, 0.8, 0.6, 0.43, 0.22, 0.0],\n [0.4, 0.5, 0.2, 0.15, 0.17, 0.11, 0.1, 0.16, 0.28],\n 2\n ),\n timeScale: 0.9 * timeScale\n \n).lag(0.2, 1.5) * LFNoise1.kr(37.2, 0.2, 1).lag(0.2);\n\nnoise = Mix(CombC.ar(WhiteNoise.ar(0.2), 0.1, [whooshPitch.exprange(0.16, 0.00011), whooshPitch.exprange(0.19, 0.00013)], 0.09));\nnoise = noise + BrownNoise.ar(0.1);\n\nswishPitch = swishPitch * LFNoise0.kr(365, 0.2, 1);\nswishPitch = swishPitch * whooshPitch.range(0.8, 1.3);\nswish = Mix.fill(\n 3,\n {\n |i|\n SinOsc.ar(swishPitch + (i * whooshPitch.exprange(45, 1)), rrand(0.0, 1.0), 0.4);\n }\n);\ntrumpPitch = trumpPitch * whooshPitch.range(0.92, 1.08);\ntrump = Mix.fill(3, { |i| SinOscFB.ar(trumpPitch * LFNoise0.kr(28, 0.06, 1).lag(0.8) * (0.8 + (i * 0.05)), 1.2, 0.8) }) * 0.6;\ntrump = RHPF.ar(trump, whooshPitch.range(120, 335), 0.2);\nchain = FFT(LocalBuf(2048), trump);\nchain = PV_BinShift(chain, WhiteNoise.kr.range(0.96, 1.01), whooshPitch.range(24, 28)); \ntrump = IFFT(chain) * 0.2;\npanning = Line.kr(-0.7, 0.7, 3);\noutput = noise + swish + trump;\noutput = output * whooseVol;\n\nPan2.ar(output, panning, 1.0);\n}.play;\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `MxQuery.set` do? What arguments does it take?"}, {"role": "assistant", "content": "jQuery style queries for selecting objects and performing bulk operations on them Arguments: selector; value."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nPbind(\\freq, 700, \\amp, 0.1\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nPbind(\\freq, 700, \\amp, 0.1)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// Read a sound file from disk into a buffer\ns.boot;\n// ExampleFiles helps locate audio files used in examples\np = ExampleFiles.child;\n// peek at the path to see location and the format of a path\np.postln;\n// read the file\nb = Buffer.read(s, p);\n\n// now play it\n(\nx = SynthDef(\\help_Buffer, { |out = 0, bufnum|\n Out.ar(out,\n PlayBuf.ar(1, bufnum, BufRateScale.kr(bufnum))\n )\n}).play(s, [\\bufnum, b]);\n);\nx.free; b.free;\n\n// with an action function\n// note that the vars are not immediately up-to-date\n(\nb\n// …\n```"}, {"role": "assistant", "content": "Read a sound file from disk into a buffer ExampleFiles helps locate audio files used in examples (Buffer: Client-side representation of a buffer on a server)"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n( //testing RecCutProc\nvar sf;\nvar rcdat;\n\nRoutine.run({\n\nsf= BBCutBuffer(Platform.resourceDir +/+ \"sounds/break.aiff\",8);\n\ns.sync;\n\n//argument 1-cut positions, 16 is wraparound, necessary for calculating differences\n//arg 2- offsets at any given of the 16 quantised positions along the sample length\n//arg 3- but cut up choosing blocks of size 3, 4, etc units (units must total 16 here)\n//units are taken across phraselength, so with phrase 8.0, one unit= 8.0/16= 0.5 = eighth notes\nrcdat= RCutData.new([0,4,7,10,12,15,16],[0\n// …\n```"}, {"role": "assistant", "content": "argument 1-cut positions, 16 is wraparound, necessary for calculating differences arg 2- offsets at any given of the 16 quantised positions along the sample length (RecCutProc: Recursive breakbeat cutting)"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes shred01 (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n// by Notgoodenogh\n\n(\n5.do{\n\n{FreeVerb.ar(1 / pow(2.718281, LFSaw.ar(rrand(10,100),1,1).squared / (2 * (Latch.ar(WhiteNoise.ar(1).range(0.001, 0.15), LFSaw.ar(4,1,0.5,0.5) > 0.99)).squared)) * 0.1, 0.33, 2) * EnvGen.kr(Env.linen(20, 40, 20, 1), doneAction: 2) ! 2}.play\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Re: Timpani (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\ns.boot\n\n(\nSynthDef(\\aSynth, { |rel = 0, choose = 0, amp = 0|\n var klank, env;\n\n klank = Klank.ar(`[choose ! 12, {Rand(0.128, 0.7)} ! 12], BrownNoise.ar(0.7));\n env = EnvGen.kr(Env.perc(0.01, rel), doneAction: 2);\n Out.ar(0, klank * env.dup * amp);\n}).add;\n);\n\n(\n{\n 42.do{\n x = [70, 90, 120].choose;\n y = rrand(0.01, 5);\n // attack\n Synth(\\aSynth, [\\rel, y, \\choose, x, \\amp, 128e-6]);\n // resonance\n Synth(\\aSynth, [\\rel, 1, \\choose, x, \\amp, 128e-5]);\n y.wait;\n }\n}.fork;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `ArgNameLabel` in SuperCollider briefly."}, {"role": "assistant", "content": "ArgNameLabel — simple stylized Label for displaying an argument name Category: Libraries > crucial > GUI > utils."}]} -{"conversations": [{"role": "user", "content": "What does `RedSeq.newArray` do? What arguments does it take?"}, {"role": "assistant", "content": "a sort of timeline - master sequencer Arguments: array — An array of indices and beats written together [index, beat].."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Swarm of sound files."}, {"role": "assistant", "content": "```supercollider\nb = SoundFile.collectIntoBuffers(\"yourSoundFileFolder/*\"); // By Bjørn Houdorf, December 21, 2012\n\n(\n{\nvar number = b.numChannels, randomNumber, trigger, delayed, panned, sound, mixedSound, rotatedSound;\ntrigger = Dust.kr(Array.fill(number,1), 1, -0.5); // Generates random impulses from -0.5 to 0.5. as a excitation function\nrandomNumber = TRand.kr(1, number, trigger);\nsound = PlayBuf.ar(Array.fill(number,1) ,randomNumber,1,trigger,0,0); // play sound files\ndelayed = DelayL.ar(sound, trigger, trigger); // delaying the sound files\npanned = Pan2.ar(delayed, Array.fill(number,{1.0.rand2})); // pan them out in the stereo field\nmixedSound = 0.05*Mix.new(panned);// and mix them to one stereo signal\nrotatedSound = Rotate2.ar(mixedSound[0], mixedSound[1], LFSaw.kr(0.05)); // rotate stereo signal\n}.play; // play it all\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Play your (short) soundfiles with some delay."}, {"role": "assistant", "content": "```supercollider\n// By Bjørn Houdorf March 2013, Play your (short) soundfiles with some delay.\n\nb = SoundFile.collectIntoBuffers(\"yourSoundFileFolder/*\"); // 1. rund this\n\n( // 2. and then run this\nt = Task({\n({\n var num= b.size.rand;\n var buf= b[num];\n 0.1*Splay.ar(PlayBuf.ar(buf.numChannels, buf, 1, 1, 0, 0));\n}.play;\n) \n});\n);\n\n\n( // 3. Then run this\nz = Task({\nloop({\n t.start;\n 0.1.wait;\n});\n});\n);\n\n\nz.start; // 4. and run this\nz.stop; // 5. and finally run this\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Snow (a SuperCollider snippet)?"}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\snow, { arg freq=200, pan=0, amp=0.1, speed=1;\n var sig;\n var size = 20;\n var trig = Impulse.ar({ rrand(1/1,15.0) } ! size * \\density.kr(1));\n sig = { WhiteNoise.ar } ! size;\n sig = sig.collect({ arg sig, x;\n var bpfreq = exprand(50.0,16000) * \\tone.kr(1);\n var bpfrq = 0.1 * SinOsc.ar(( x+1 ) * 1/153 * speed).exprange(0.1,4) * \\blur.kr(1);\n sig = BPF.ar(sig, bpfreq, bpfrq) * 34;\n sig = BPF.ar(sig, bpfreq, bpfrq) * 4;\n sig = sig * EnvGen.ar(Env([0,1,0],[0.1,0.8]), trig[x]);\n //sig = sig.fold2( LFNoise0.kr(1/23 * ( x+1 ) * speed).range(0.01,8) ) * 4;\n sig = sig * SinOsc.ar(1/700 * ( x+1 ) * speed).range(0.01,1);\n });\n sig = Pan2.ar(sig, ( { rrand(-1.0,1) } ! size * SinOsc.ar(1/132 * (1..size) * speed).range(0,1) ), amp).mean;\n}).play;\n);\nNdef(\\snow).fadeTime = 16;\nNdef(\\snow).edit;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `FoaEncoderMatrix.newAtoB` do? What arguments does it take?"}, {"role": "assistant", "content": "A-format to B-format encoder. Encodes to a variety of tetrahedral orientations and W channel Arguments: orientation — Orientation of the A-format tetrahedron.; weight — The W weight factor. For convenience, equivalent virtual microphone pattern and decoding k are also listed.."}]} -{"conversations": [{"role": "user", "content": "Explain `EnvelopeView` in SuperCollider briefly."}, {"role": "assistant", "content": "EnvelopeView — A configurable view with nodes and connections A view which can graphically display nodes at x/y coordinates, connection lines, cross-connections, node markers, and labels. All of the values for these are stored in arrays. While this view is typically used to make editable envelopes interfaces, it can be used to draw very complex interconnection graphs as well. Category: GUI > Views."}]} -{"conversations": [{"role": "user", "content": "What does `Block.addNum` do? What arguments does it take?"}, {"role": "assistant", "content": "A Block Arguments: Number of blocks; Number of channels."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\nPdef(\\x).play;\nPdef(\\x).quant = 0; // we don't want quant here.\nPdef(\\x, Pbind(\\degree, Pseq((0..5), inf), \\dur, 0.3)).condition_({ |val, i| i.postln % 6 == 0 });\nPdef(\\x, Pbind(\\degree, Pseq((0..7) + 5.rand, inf), \\dur, 0.3)).condition_({ |val, i| (i % 8).postln == 0 });\n\n// the above is equivalent to:\nPdef(\\x, Pbind(\\degree, Pseq((0..7) + 5.rand, inf), \\dur, 0.3)).count(8);\n\n// the value that is sent in is the event, so decisions can be made dependent on the event's fields\n```"}, {"role": "assistant", "content": "the above is equivalent to: the value that is sent in is the event, so decisions can be made dependent on the event's fields (Pdef: stream reference definition)"}]} -{"conversations": [{"role": "user", "content": "What does `SimpleNumber.log` do?"}, {"role": "assistant", "content": "one-dimensional value Returns: Base e logarithm."}]} -{"conversations": [{"role": "user", "content": "What does `AbstractWrappingDispatcher.updateFuncForFuncProxy` do? What arguments does it take?"}, {"role": "assistant", "content": "This method is called within #-update to update any changes to one of this dispatcher's responder funcs' function(s). Users should not call this method directly, but subclasses may need to extend this method to do additional Arguments: funcProxy — An instance of a subclass of AbstractResponderFunc.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\"help-LFNoise0\", { arg out=0;\n Out.ar(out,\n LFBrownNoise0.ar(1000, 1, MouseX.kr(0, 5), 0.25)\n )\n}).play;\n);\n\n//use as frequency control\n(\nSynthDef(\"help-LFNoise0\", { arg out=0;\n Out.ar(out,\n SinOsc.ar(\n LFBrownNoise0.ar(8, 0.1, 2, 400, 450),\n 0, 0.2\n )\n )\n}).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\"help-LFNoise0\", { arg out=0;\n Out.ar(out,\n LFBrownNoise0.ar(1000, 1, MouseX.kr(0, 5), 0.25)\n )\n}).play;\n);\n\n//use as frequency control\n(\nSynthDef(\"help-LFNoise0\", { arg out=0;\n Out.ar(out,\n SinOsc.ar(\n LFBrownNoise0.ar(8, 0.1, 2, 400, 450),\n 0, 0.2\n )\n )\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `RedDiskInSampler.loadedKeys` do?"}, {"role": "assistant", "content": "Report which keys have been preloaded with"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// a stereo signal, both channels at 0dB\n{ [SinOsc.ar(440), SinOsc.ar(440)] }.play\n\n// using Balance on a stereo signal with the position parameter at 0, effectively the same sound but both channels at -3dB\n{ Balance2.ar(SinOsc.ar(440), SinOsc.ar(440), 0) }.play\n\n// pan sweep from left to right\n{ Balance2.ar(SinOsc.ar(440), SinOsc.ar(1000), Line.kr(-1, 1, 5)) }.play\n\n// other examples\n{ Balance2.ar(LFSaw.ar(44), Pulse.ar(33), FSinOsc.kr(0.5), 0.1) }.play;\n{ var source; source = SinOsc\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// a stereo signal, both channels at 0dB\n{ [SinOsc.ar(440), SinOsc.ar(440)] }.play\n\n// using Balance on a stereo signal with the position parameter at 0, effectively the same sound but both channels at -3dB\n{ Balance2.ar(SinOsc.ar(440), SinOsc.ar(440), 0) }.play\n\n// pan sweep from left to right\n{ Balance2.ar(SinOsc.ar(440), SinOsc.ar(1000), Line.kr(-1, 1, 5)) }.play\n\n// other examples\n{ Balance2.ar(LFSaw.ar(44), Pulse.ar(33), FSinOsc.kr(0.5), 0.1) }.play;\n{ var source; source = SinOsc.ar([440, 550]); Balance2.ar(source[0], source[1], LFNoise0.kr(4), 0.3) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SinOscFB`."}, {"role": "assistant", "content": "```supercollider\n{ SinOscFB.ar(440, MouseX.kr(0, 4))*0.1 }.play\n\n\n{ SinOscFB.ar(MouseY.kr(10, 1000, 'exponential'), MouseX.kr(0.5pi, pi))*0.1 }.play\n\n\n{ SinOscFB.ar(100*SinOscFB.ar(MouseY.kr(1, 1000, 'exponential'))+200, MouseX.kr(0.5pi, pi))*0.1 }.play\n\n\n// Scope the wave form\n{ SinOscFB.ar([400, 301], MouseX.kr(0, 4), 0.3) }.scope;\n```"}]} -{"conversations": [{"role": "user", "content": "I get 'Node not found' when I call .set on a Synth after a while."}, {"role": "assistant", "content": "The Synth was freed and the language still holds a reference. That happens whenever the SynthDef used `doneAction: 2` and the envelope finished, or when something called `freeAll`/`CmdPeriod`. Guard it with `if (x.notNil and: { x.isPlaying }) { x.set(\\freq, 300) }`, or store the node in a variable that you clear when it ends. For sustained sounds the right pattern is a `gate` argument with `doneAction: 2` on the EnvGen, so the node lives until you release it."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\ny = BSpline([ [0,0],[1,1],[2,-1] ], 2.0,true);\n\ny.gui;\n\n\n{\n SplineOsc(y,0,true).ar(200) * 0.2\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\ny = BSpline([ [0,0],[1,1],[2,-1] ], 2.0,true);\n\ny.gui;\n\n\n{\n SplineOsc(y,0,true).ar(200) * 0.2\n}.play\n\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Modulation sequencing?"}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\rlpf, { arg out=0, amp=0.1, gate=1, pan=0, spread=0.8, freq=200, doneAction=2, ffreq=4000, rq=0.3;\n var sig, sig1, sig2, sig3;\n sig = LFSaw.ar(freq * [1.01,1,0.99]);\n sig = RLPF.ar(sig, ffreq, rq);\n sig = sig * EnvGen.ar(\\adsr.kr(Env.adsr(0.01,0.1,0.8,0.1)),gate,doneAction:doneAction);\n sig = Splay.ar(sig, spread, amp, pan);\n Out.ar(out, sig);\n}).add;\n);\n\n///////// lfo communicating with main pattern\n\n(\nNdef(\\lfo1, { EnvGen.kr(Env([1,4,1],[0.1,0.2]), \\trig.tr(0)) * \\lforange.kr(1000); });\n\nPdef(\\main, Pbind(\n \\instrument, \\rlpf,\n \\midinote, Pseq([60, 62, 64], inf),\n \\legato, 0.5,\n \\move, Pseq([0,1,0, 1,0,0],inf),\n \\lforange, Pseq([1000,2000,3000],inf).stutter(8),\n \\ffreq, Pfunc({ arg ev;\n Ndef(\\lfo1).set(\\trig, ev[\\move], \\lforange, ev[\\lforange]);\n Ndef(\\lfo1);\n }),\n \\dur, 0.5\n)).play \n);\n\n////// sub pattern way\n\n(\n Pdef(\\micro, { arg midinote, move;\n Pbind(\n \\instrument, \\rlpf,\n \\midinote, midinote + \n switch(move,\n \\up, Pseq((0..7)),\n \\down, Pseq((7..0)),\n Pseq(0!8),\n ),\n \\dur, 1/16,\n )\n });\n\n Pdef(\\main,\n Pbind(\n \\instrument, \\micro,\n \\move, Pseq([\\n, \\n, \\up, \\n, \\n, \\down],inf),\n \\type, \\phrase,\n \\midinote, Pseq([60, 62, 64], inf),\n \\dur, 1/2,\n )\n ).play;\n);\n\n//////// same in mono\n\n(\n Pdef(\\micro, { arg midinote, move;\n Pmono(\n \\rlpf,\n \\midinote, midinote + \n switch(move,\n \\up, Pseq((0..7)),\n \\down, Pseq((7..0)),\n Pseq(0!8),\n ),\n \\dur, 1/16,\n )\n });\n\n Pdef(\\main,\n Pbind(\n \\instrument, \\micro,\n \\move, Pseq([\\n, \\n, \\up, \\n, \\n, \\down],inf),\n \\type, \\phrase,\n \\midinote, Pseq([60, 62, 64], inf),\n \\dur, 1/2,\n )\n ).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "I get 'syntax error, unexpected NAME' on a block that looks fine."}, {"role": "assistant", "content": "Almost always a missing semicolon between two statements — SuperCollider does not insert them.\n\n```supercollider\n// broken: two statements, no separator\n{ var sig = SinOsc.ar(440) sig = sig * 0.1; sig }.play\n```\n\n```supercollider\n// fixed\n{ var sig = SinOsc.ar(440); sig = sig * 0.1; sig }.play\n```\nThe error points at the second statement, not at the missing semicolon before it, which is why it looks\nfine. If it is not a semicolon, count the brackets: `.ar(` open, `)` closed."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Gbman2DL.ar(MouseX.kr(20, SampleRate.ir*0.25), MouseX.kr(80, SampleRate.ir), 0.1) }.play(s);\n\n{ Gbman2DL.ar(11025, 22050, -0.7, -2.7, 0.1) }.play(s);\n\n{ Gbman2DL.ar(2200, 8800, 1.2, 2.0002, 0.1) }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Gbman2DL.ar(MouseX.kr(20, SampleRate.ir*0.25), MouseX.kr(80, SampleRate.ir), 0.1) }.play(s);\n\n{ Gbman2DL.ar(11025, 22050, -0.7, -2.7, 0.1) }.play(s);\n\n{ Gbman2DL.ar(2200, 8800, 1.2, 2.0002, 0.1) }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes random 303."}, {"role": "assistant", "content": "```supercollider\n(\n{ var lk = [0,3,7,9], jx = [3,4,2,4,2], n, ox = 10, qw, cx, oi,z,w, faz, mp,\n cs = [Select,Stepper,RLPF,LFTri,Pulse,PulseDivider,Lag2,Lag,EnvGen,\n Saw, LPF, PitchShift, AllpassN, Env, LocalIn, LocalOut, Impulse ];\n var fa,ffa, ra, eca, era, fsa, xc, fxc, rq, ec, er,xcs, o,e;\n mp = {… |n,alk| alk = alk ? lk; \n {midicps(jx .choose * 12 + lk.choose) } !n }; \n faz = [ mp.(3)* 2.midiratio, mp.( 3 )\n *1. midiratio, mp.( 2,[ 0,3,9 ])*5.midiratio,mp.(1 )*1.midiratio ]; \n fa = faz[[3,0,3,1,2,2,2,2, 1,1,1,1,0,3]].flat; \n n = fa.size; \n qw = Impulse.kr(10); \n cx = PulseDivider.kr(qw, n); \n oi = Stepper.kr(qw,0,0,n-1); \n fsa = { [0,0,0, 0.02,0.08,0.1 ].choose }!div(n,4); \n xcs = Select.kr( Stepper.kr( qw,0,0,fsa.size-1 ), fsa); \n xc = Lag2.kr( Select.kr(oi, fa), xcs ); \n ffa = { rrand( 20, 90 ) } ! n;\n ffa.size.do({ |i| var pn = [2,4,8].choose;\n if ( 0.2.coin, { ffa[i] = Select.kr(Stepper.kr(cx, 0,0,pn-1), { rrand( 4, 70 ) } ! n) }) });\n fxc = Lag2.kr( Select.kr(oi, ffa), 0.04);\n ra = { rrand(0.05,0.5) } ! n;\n rq = Lag.kr( cs[0].kr(oi, ra), 0.04);\n eca = { [-4,0,-1].choose } ! n;\n ec = Select.kr(oi,eca);\n o = Saw.ar(xc) + Pulse.ar(xc * 0.01.midiratio,1-rq) + Pulse.ar(xc *0.04.midiratio,LFTri.ar(ox/n).range(0.1,0.9),0.02) + Pulse.ar(xc *\n 24.midiratio,LFTri.ar(ox/n/4).range(0.8,0.01),0.05);\n era = { rrand(0.8,0.4) } ! 4;\n er = Select.kr(cs[1].kr(qw, 0,0,3), era);\n e = Env.new([0,1,0],[xcs/5,er],ec);\n e = EnvGen.kr(e, gate:qw);\n fxc = fxc * [1.02, 0.98];\n xc = xc * [0.8,1.2].scramble;\n z = cs[2].ar(o, (fxc * e).midiratio * xc, rq) + (cs[2].ar(o.neg, fxc * (50 * e)\n .midiratio, 0.4) *0.05) + (cs[2].ar(o.neg, fxc * (65 * e).midiratio, rq/2) *0.01) * e;\n z = (z + (cs[11].ar(z,0.001,0.5,0.1,0.1).distort * 0.5)).distort;\n w = z+ cs[14].ar (2). distort;\n 10.do({ w = cs[12].ar(w,0.4,{0.03.rand}!2,{0.06.rand}!2) });\n cs[15].ar(cs[10].ar( w*0.9,800 )); (w *0.1 ) + (z * 0.7) }.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Dseries`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a, freq, trig;\n a = Dseries(0, 1, 15);\n trig = Impulse.kr(MouseX.kr(1, 40, 1));\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n);\n\n(\n{\n var a, freq, trig;\n a = Dseries(0, 1, inf);\n trig = Dust.kr(MouseX.kr(1, 40, 1));\n freq = Demand.kr(trig, 0, a) % 15 * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a chord progression with Pbind."}, {"role": "assistant", "content": "Put an array of degrees in the pattern, use \\strum to spread the chord, and the default instrument\nplays all notes of each event.\n\n```supercollider\n(\nPbind(\n \\scale, Scale.minor,\n \\root, 2,\n \\degree, Pseq([[0, 4, 7], [-3, 0, 4], [-5, -1, 2], [0, 4, 7]], inf),\n \\dur, 1.5,\n \\strum, 0.02,\n \\amp, 0.12,\n \\legato, 0.9\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for minor scale filtered pulsewave demands?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n arg amp=0.1;\n var a, trig, basefreq, snd, cutoffmod, rqmod;\n \n a = Dseq([0, 2, 3, 5, 7, 8, 10, 12], inf);\n trig = Impulse.kr(4);\n basefreq = Demand.kr(trig, 0, a) + 38;\n basefreq = basefreq.midicps;\n cutoffmod = LFNoise2.ar(0.2).range(100,1500);\n rqmod = LFNoise2.ar(0.2).range(1,0.05);\n\n snd = (Pulse.ar(basefreq + 1 * SinOsc.kr(0.1.rand).range(0.99,1.010)) * amp) \n + (Pulse.ar(basefreq + 2 * SinOsc.kr(0.1.rand).range(0.99,1.010)) * amp) \n + (Pulse.ar(basefreq + 3 * SinOsc.kr(0.1.rand).range(0.99,1.01)) * amp)\n + (Pulse.ar(basefreq + 4 * SinOsc.kr(0.1.rand).range(0.99,1.01)) * amp)\n + (Pulse.ar(basefreq + 5 * SinOsc.kr(0.1.rand).range(0.99,1.01)) * amp)\n + (Pulse.ar(basefreq + 2 * SinOsc.kr(0.1.rand).range(0.99,1.010)) * amp) \n + (Pulse.ar(basefreq + 3 * SinOsc.kr(0.1.rand).range(0.99,1.01)) * amp)\n + (Pulse.ar(basefreq + 4 * SinOsc.kr(0.1.rand).range(0.99,1.01)) * amp)\n + (Pulse.ar(basefreq + 5 * SinOsc.kr(0.1.rand).range(0.99,1.01)) * amp)\n + (Pulse.ar(basefreq + 6 * SinOsc.kr(0.1.rand).range(0.99,1.01)) * amp);\n \n \n snd = LeakDC.ar(snd);\n snd = RLPF.ar(snd, cutoffmod, rqmod);\n snd = Limiter.ar(in: snd, level: 0.8, dur:0.001);\n snd.dup;\n \n}.play)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `FixNumChannelsPlayer.synthDefArgs` do?"}, {"role": "assistant", "content": "a utility Player that wraps another player with NumChannels"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\n(\nb = Buffer.alloc(s, 2048, 1);\nc = Buffer.read(s, ExampleFiles.child);\n);\n\n(\nSynthDef(\"help-magSquared\", { |out = 0, bufnum = 0, soundBufnum = 2|\n var in, chain;\n in = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);\n chain = FFT(bufnum, in);\n chain = PV_MagSquared(chain);\n Out.ar(out, 0.003 * IFFT(chain).dup);\n}).play(s, [\\out, 0, \\bufnum, b.bufnum, \\soundBufnum, c.bufnum]);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\n(\nb = Buffer.alloc(s, 2048, 1);\nc = Buffer.read(s, ExampleFiles.child);\n);\n\n(\nSynthDef(\"help-magSquared\", { |out = 0, bufnum = 0, soundBufnum = 2|\n var in, chain;\n in = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);\n chain = FFT(bufnum, in);\n chain = PV_MagSquared(chain);\n Out.ar(out, 0.003 * IFFT(chain).dup);\n}).play(s, [\\out, 0, \\bufnum, b.bufnum, \\soundBufnum, c.bufnum]);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "How do I add a reverb send to a whole group?"}, {"role": "assistant", "content": "Same shape as the delay: a private stereo bus, one effect reading it, instruments writing both dry\nand wet.\n\n```supercollider\n(\n~verbBus = Bus.audio(s, 2);\nSynthDef(\\verb, { |in = 0, out = 0, room = 0.85, mix = 0.5|\n Out.ar(out, FreeVerb.ar(In.ar(in, 2), mix, room, 0.5) * 0.7);\n}).add;\nSynthDef(\\blip, { |out = 0, send = 0, freq = 440, amp = 0.1|\n var env = EnvGen.kr(Env.perc(0.002, 0.4), doneAction: 2);\n var sig = SinOsc.ar(freq) * env * amp;\n Out.ar(out, sig);\n Out.ar(send, sig);\n}).add;\n);\nSynth(\\verb, [\\in, ~verbBus]);\nPbind(\\instrument, \\blip, \\send, ~verbBus, \\degree, Pseq([0, 4, 7, 11], inf), \\dur, 0.25).play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `LocalIn.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Define and read from buses local to a synth. Arguments: numChannels — The number of channels (i.e. adjacent buses) to read in. You cannot modulate this number by assigning it to an argument in a SynthDef.; default — The initial value written to the bus once, so that it can be used before overwriting it with LocalOut. An array can be passed in to specify different values for each channel.."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Midterm Question 2 (a SuperCollider snippet)?"}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"sawSynth\", {arg freq, amp;\n \n Out.ar(0, Splay.ar(LPF.ar(in: Saw.ar(freq * [0.99, 1.0, 1.001, 1.008], mul:Env.perc(attackTime:0.1, releaseTime:2, level:amp).kr(2)),freq: 2000)))\n\n}).add;\n);\n\n(\nPbind(\n \\instrument, \"sawSynth\",\n \\degree, Pseq([1,3,5,7], inf),\n \\dur, 0.111, \n \n).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BrownNoise`."}, {"role": "assistant", "content": "```supercollider\n{ BrownNoise.ar(0.1) }.play;\n{ WhiteNoise.ar(0.1) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SequenceableCollection.linrand` do?"}, {"role": "assistant", "content": "Fill a SequenceableCollection with random values in the range minVal to maxVal with a linear distribution. `Array.linrand(8, 1,"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Play your (short) soundfiles with some delay."}, {"role": "assistant", "content": "```supercollider\n// By Bjørn Houdorf March 2013, Play your (short) soundfiles with some delay.\n\nb = SoundFile.collectIntoBuffers(\"yourSoundFileFolder/*\"); // 1. rund this\n\n( // 2. and then run this\nt = Task({\n({\n var num= b.size.rand;\n var buf= b[num];\n 0.1*Splay.ar(PlayBuf.ar(buf.numChannels, buf, 1, 1, 0, 0));\n}.play;\n) \n});\n);\n\n\n( // 3. Then run this\nz = Task({\nloop({\n t.start;\n 0.1.wait;\n});\n});\n);\n\n\nz.start; // 4. and run this\nz.stop; // 5. and finally run this\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Penvir`."}, {"role": "assistant", "content": "```supercollider\n(\nx = (a: 8);\ny = Penvir(\n x,\n Pfunc { ~a * 2 }\n);\n\nt = y.asStream;\n);\n\nt.next;\n\n\n\n(\nx = (a: 8);\ny = Penvir(\n x,\n Pfunc { ~a = ~a * 2 }\n);\n\nt = y.asStream;\nz = y.asStream;\n);\n\nt.next;\nt.next;\nx.postln; // x stays unchanged\n```"}]} -{"conversations": [{"role": "user", "content": "What is `LFPar` in SuperCollider?"}, {"role": "assistant", "content": "LFPar — Parabolic oscillator A sine-like shape made of two parabolas and the integral of a triangular wave. It has audible odd harmonics and is non-band-limited. Output ranges from -1 to +1. Category: UGens > Generators > Deterministic."}]} -{"conversations": [{"role": "user", "content": "What does `Collection.size` do?"}, {"role": "assistant", "content": "Answers the number of objects contained in the Collection. `List[1, 2, 3,"}]} -{"conversations": [{"role": "user", "content": "What does `IdentityDictionary.freezeAsParent` do?"}, {"role": "assistant", "content": "For optimizing the garbage collector load, objects can be frozen and become immutable. This method creates a new dictionary with the frozen instance as a parent so that all contents can be overwritten without losing this"}]} -{"conversations": [{"role": "user", "content": "I get 'FAILURE IN SERVER /s_new SynthDef not found'. What is wrong?"}, {"role": "assistant", "content": "The server does not know that SynthDef. Three usual causes, in order of likelihood:\n\n1. **The SynthDef was added before the server booted.** `SynthDef(...).add` is asynchronous; wrap the work\n in `s.waitForBoot { ... }` or put `s.sync` after `.add`.\n2. **The name does not match.** `SynthDef(\\bell, ...)` is played by `Synth(\\bell)`, not `\\Bell` — symbols\n are case-sensitive.\n3. **`.add` was never called.** Writing `SynthDef(\\bell, { ... })` without `.add` builds the definition in\n the language and sends nothing.\n\nCheck with `SynthDescLib.global.dict.keys` ��� if the name is not there, it never reached the server."}]} -{"conversations": [{"role": "user", "content": "What is a SynthDef?"}, {"role": "assistant", "content": "A SynthDef is a named, compiled server-side instrument: a UGen graph plus named controls. You build one with SynthDef(\\name, { |args| ... }).add, and then play instances with Synth(\\name)."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for pitch tracker utility."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\\pitchTrack, {\n var soundin = SoundIn.ar(0);\n var zc = ZeroCrossing.ar(soundin);\n // var pt = Pitch.kr(soundin);\n // var tt = Tartini.kr(soundin);\n SendReply.kr(Impulse.kr(1), '/pitchTrackUtil', [zc, zc.cpsmidi]);\n}).add;\n\n~pitchTrack = {\n if(~pitchTrackSynth.isNil or: { ~pitchTrackSynth.isRunning.not }, {\n ~pitchTrackSynth = Synth(\\pitchTrack);\n ~pitchTrackNW = NodeWatcher.register(~pitchTrackSynth);\n }, {\n ~pitchTrackSynth.free;\n ~pitchTrackSynth = nil;\n \"Pitch tracker stopped.\".postln;\n });\n};\n\n~pitchTrackOSCFunc = {\n OSCFunc({\n | msg |\n (\"Pitch:\"+msg[3].round.asString.padLeft(5)+msg[4].round.asString.padLeft(3)).postln;\n }, '/pitchTrackUtil');\n};\n\n~pitchTrackOSCFunc.();\n\nCmdPeriod.add({~pitchTrackOSCFunc.();});\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\nSynthDef(\"help-Infreq\", { |bus|\n Out.ar(0, FSinOsc.ar(In.kr(bus), 0, 0.5));\n}).add;\n\nSynthDef(\"help-Outfreq\", { |freq = 400, bus|\n Out.kr(bus, SinOsc.kr(1, 0, freq/40, freq));\n}).add;\n\nb = Bus.control(s, 1);\n);\n\n// add the first control Synth at the tail of the default server; no audio yet\nx = Synth.tail(s, \"help-Outfreq\", [\\bus, b.index]);\n\n// add the sound producing Synth BEFORE it; It receives x's data from the previous cycle\ny = Synth\n// …\n```"}, {"role": "assistant", "content": "add the first control Synth at the tail of the default server; no audio yet add the sound producing Synth BEFORE it; It receives x's data from the previous cycle (In: Read a signal from a bus.)"}]} -{"conversations": [{"role": "user", "content": "What is `ClientOnTrigResponder` in SuperCollider?"}, {"role": "assistant", "content": "ClientOnTrigResponder — a helper object used by Instr to implement { }.onTrig inside of Instr functions Category: Libraries > crucial > Instr."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// When we provide the 'root' argument an array, we should hear a chord.\n// the synth def is defined above\n(\nPbind(\n \\instrument, \\acid, \\dur, Pseq([0.25, 0.5, 0.25], inf),\n \\root, [-24, -17], // expand root\n \\degree, Pseq([0, 3, 5, 7, 9, 11, 5, 1], inf),\n \\pan, Pfunc { 1.0.rand2 },\n \\cut, Pxrand([1000, 500, 2000, 300], inf),\n \\rez, Pfunc { 0.7.rand + 0.3 },\n \\amp, 0.2).play;\n);\n\n// multiple arrays are correlated in parallel, the shorter one wraps:\n(\nPbind(\n \\instrument, \\acid,\n \\dur,\n// …\n```"}, {"role": "assistant", "content": "When we provide the 'root' argument an array, we should hear a chord. the synth def is defined above (Pbind: combine several value patterns to one event stream by binding keys to values)"}]} +{"conversations": [{"role": "user", "content": "Do is not ¨returning¨ array (campanology)?"}, {"role": "assistant", "content": "SuperCollider forum — Do is not ̈returning ̈ array (campanology)\n\nYou can remove the need for all mutable variables by computing the indexes to swap first - these are stored in indexesEven and indexesOdd.\n\nThen an array of functions is made (swappers)...i.e.[indexesEven, indexesOdd, indexesEven....]\n\nFinally, .inject is used to chain these together, taking the previous result as the input to the next and building an array.\n\n```supercollider\n(\n~swap_sort_steps = {\n |parts|\n var swapConsequtiveIndexes = {|from, to|\n (from..to).clump(2).collect{|p| p.reverse }.flat\n };\n var indexesEven = swapConsequtiveIndexes.(0, parts - 1);\n var indexesOdd = [0] ++ swapConsequtiveIndexes.(1, parts - 1);\n var swappers = parts.collect{ |n|\n {|toSwap| if(n.even)\n { indexesEven.collect{|i| toSwap[i]} }\n { indexesOdd.collect{|i| toSwap[i]} }\n }\n };\n postf(\"indexesEven : %\\nindexesOdd : %\\n\", indexesEven, indexesOdd);\n swappers.inject( [(0..parts-1)], {\n |col, f|\n col ++ [f.(col.last)]\n });\n};\n)\n```\n\nAlso, as I’m sure you know, if anyone else is reading who doesn’t know what this is... its a swap sort algorithm."}]} +{"conversations": [{"role": "user", "content": "What does `ToggleButton.new` do? What arguments does it take?"}, {"role": "assistant", "content": "simple two state button Arguments: layout; title; onFunction; offFunction; init; minWidth — button width is calculated to fit the title setting minWidth will widen the button to a minimum width; minHeight — default is the GUI.skin.buttonHeight; onColor."}]} +{"conversations": [{"role": "user", "content": "What does `EnvelopeView.gridOn` do? What arguments does it take?"}, {"role": "assistant", "content": "Whether to draw the Arguments: A Boolean.."}]} +{"conversations": [{"role": "user", "content": "Explain `ScoreClock` in SuperCollider briefly."}, {"role": "assistant", "content": "ScoreClock — Create a Score by capturing OSC and timings ScoreClock simplifies NRT synthesis by capturing OSC messages and timings of anything sent to the default server, and returns a Score object that can then be rendered to file or played back. Category: Scheduling > Clocks, External Control > OSC."}]} +{"conversations": [{"role": "user", "content": "What does `Pgeom.new` do? What arguments does it take?"}, {"role": "assistant", "content": "geometric series pattern Arguments: start — start value.; grow — multiplication factor.; length — number of values produced.."}]} +{"conversations": [{"role": "user", "content": "What does `Routine.p` do?"}, {"role": "assistant", "content": "Convert the routine to a (subclass of) Returns: A Prout that (in response to `asStream`) acts as a generator of independent copies of the original routine (the receiver of `p`)."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\HOABinaural;\n~description = \"Binaural decoder using the HOABinaural class from SC-HOA\";\n\n~function = { |in = 0, order|\n HOABinaural.ar(\n order: order,\n in: in\n );\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// sound example\n(\ns.boot;\nSynthDef(\"gpdef\",\n { |out = 0, freq = 440, sustain = 0.05, amp = 0.1|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain), doneAction: Done.freeSelf) * amp;\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n// fork a thread that plays some sounds\n(\nFdef(\\freq, 440);\nFdef(\\dur, 0.2);\n\nfork {\n loop {\n s.sendMsg(\"/s_new\", \"gpdef\", -1, 1, 1, \\freq, Fdef(\\freq).value);\n Fdef(\\dur).value.wait;\n }\n};\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// sound example\n(\ns.boot;\nSynthDef(\"gpdef\",\n { |out = 0, freq = 440, sustain = 0.05, amp = 0.1|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain), doneAction: Done.freeSelf) * amp;\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n// fork a thread that plays some sounds\n(\nFdef(\\freq, 440);\nFdef(\\dur, 0.2);\n\nfork {\n loop {\n s.sendMsg(\"/s_new\", \"gpdef\", -1, 1, 1, \\freq, Fdef(\\freq).value);\n Fdef(\\dur).value.wait;\n }\n};\n);\n\n// some modifications\n\nFdef(\\freq, Fdef(\\midinote, 60).midicps);\nFdef(\\midinote, { [67, 64, 65].choose });\nFdef(\\midinote, { [67, 64, 65].choose } + Fdef(\\offset));\nFdef(\\offset, { 4.rand });\nFdef(\\dur, 0.23);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `LID.at` do?"}, {"role": "assistant", "content": "If a `spec` is defined for this device, then you can use a controlName to look up a"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `UnaryOpUGen` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\na = WhiteNoise.ar; // a WhiteNoise\nb = a.squared; // a UnaryOpUGen.\nb.operator; // squared\n\n// sound example\n\n{ var a = LFSaw.ar(300).range(0, 2pi); a.sin * 0.1 }.play;\n\n// Plotting the \"abs\" unary operator (via the server):\n\n{ SinOsc.ar(300).abs }.plot\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = {LFTri.ar(100+(1000*Maths2.ar(MouseX.kr, MouseY.kr, 0.2, 0, 1, MouseButton.kr(lag:0.001))[0]), 0, 0.1}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = {LFTri.ar(100+(1000*Maths2.ar(MouseX.kr, MouseY.kr, 0.2, 0, 1, MouseButton.kr(lag:0.001))[0]), 0, 0.1)}.play\n```"}]} +{"conversations": [{"role": "user", "content": "What does `UChain.muted` do? What arguments does it take?"}, {"role": "assistant", "content": "Determines if event will be played or not in a Arguments: bool."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// default initial params\n{ FBSineC.ar(SampleRate.ir/4) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// default initial params\n{ FBSineC.ar(SampleRate.ir/4) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What is `IdentitySet`?"}, {"role": "assistant", "content": "IdentitySet — a set according to identity"}, {"role": "user", "content": "What does `IdentitySet.add` do?"}, {"role": "assistant", "content": "Add anObject to the IdentitySet. An object which is equal to an object already in the IdentitySet will not be added. `IdentitySet[1, 2, 3].add(4);`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nIdentitySet[1, 2, 3].add(4);\nIdentitySet[1, 2, 3].add(3);\n// the two strings are equal but not identical\nIdentitySet[\"abc\", \"def\", \"ghi\"].add(\"def\");\n// symbols are guaranteed to be identical if they are equal\nIdentitySet['abc', 'def', 'ghi'].add('def');\nIdentitySet['abc', 'def', 'ghi'].add('jkl');\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// modulate frequency\n{ Blip.ar(XLine.kr(20000, 200, 6), 100, 0.2) }.play;\n\n// modulate numharmonics\n{ Blip.ar(200, Line.kr(1, 100, 20), 0.2 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// modulate frequency\n{ Blip.ar(XLine.kr(20000, 200, 6), 100, 0.2) }.play;\n\n// modulate numharmonics\n{ Blip.ar(200, Line.kr(1, 100, 20), 0.2) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Normalizer`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n// example signal to process\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n z * 0.8\n}.play\n);\n\n(\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n [z, Normalizer.ar(z, 0.4, 0.01)] * 0.5\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `Dwhite` in SuperCollider briefly."}, {"role": "assistant", "content": "Dwhite — Demand rate white noise random generator. Dwhite returns numbers in the continuous range between `lo` and `hi` . Category: UGens > Demand."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Pmulp` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\freq, Pseq([500, 600, 700]), \\instrument, \\sinegrain);\na = Pmulp(\\freq, Pseq([0.5, 0.9, 0.8], inf), a);\na.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a kick drum in SuperCollider."}, {"role": "assistant", "content": "A pitch-swept sine with a fast decay: the frequency envelope is what makes it read as a kick.\n\n```supercollider\n(\nSynthDef(\\kick, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 50, 40], [0.03, 0.15], -4));\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -6), doneAction: 2);\n Out.ar(out, Pan2.ar(SinOsc.ar(pitch) * env * amp));\n}).add;\n);\nSynth(\\kick);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Add two UGens\n{ SinOsc.ar(440, 0, 0.2) + PinkNoise.ar(0.1; }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Add two UGens\n{ SinOsc.ar(440, 0, 0.2) + PinkNoise.ar(0.1); }.play\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `PV_RandComb` in SuperCollider briefly."}, {"role": "assistant", "content": "PV_RandComb — Pass random bins. Randomly clear bins. Category: UGens > FFT."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `LFClipNoise`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-LFClipNoise\", { |out = 0|\n Out.ar(out,\n LFClipNoise.ar(1000, 0.25)\n )\n}).play;\n);\n\n// modulate frequency\n(\nSynthDef(\"help-LFClipNoise\", { |out = 0|\n Out.ar(out,\n LFClipNoise.ar(XLine.kr(1000, 10000, 10), 0.25)\n )\n}).play;\n);\n\n// use as frequency control\n(\nSynthDef(\"help-LFClipNoise\", { |out = 0|\n Out.ar(out,\n SinOsc.ar(\n LFClipNoise.ar(4, 200, 600),\n 0, 0.2\n )\n )\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Diwhite.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Demand rate white noise random generator. Arguments: lo — Minimum value.; hi — Maximum value.; length — Number of values to create.."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `RunningMin`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n SinOsc.ar(\n RunningMin.ar(Dust.ar(20), Impulse.ar(0.4)) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// follow a sine lfo, reset rate controlled by mouse x\n(\n{\n SinOsc.ar(\n RunningMin.kr(SinOsc.kr(0.2), Impulse.kr(MouseX.kr(0.01, 2, 1))) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\ns.boot;\n\nb = Buffer.alloc(s, 100);\nb.zero;\nb.set(33, 1.034);\n// This should detect the 33rd value as the highest...\nx = {BufMax.kr(b).poll}.play;\n\n// ...until we set a new winner...\nb.set(74, 1.038);\n```"}, {"role": "assistant", "content": "This should detect the 33rd value as the highest... ...until we set a new winner... (BufMax: detect the largest value (and its position) in an array of UGens)"}]} +{"conversations": [{"role": "user", "content": "What does `SCluster.release` do? What arguments does it take?"}, {"role": "assistant", "content": "fade out the sound and free all internal nodes and Arguments: releaseTime — fade out time in seconds.; onFreeFunc — a LINKClasses/Function to be evaluated after the reverberating sound disappeared.."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Tdef` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\n// load a synthdef\ns.boot;\nSynthDef(\"pdef_grainlet\",\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.3), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n\nTdef(\\z, Pseq([1, 1, 1, 0.5, 0.5], inf));\n\n(\nPset(\\instrument, \\pdef_grainlet,\n Ppar([\n Pbind(\n \\dur, Tdef(\\z),\n \\note, Pseq([1, 3, 2, 1, 0], inf),\n \\x, Pfunc { TempoClock.default.elapsedBeats.postln } // posts the onset times\n ),\n Pbind(\n \\dur, 4, // reference beat\n \\sustain, 0.1,\n \\note, 8\n )\n ])\n).play(quant: 1);\n);\n\n\nTdef(\\z, Prand([1, 1, 0.23, 0.5, 0.5], inf)); // exchange time pattern\nTdef(\\z, Pseq([1, 1, 1, 1], inf)); // pattern stays in sync.\nTdef(\\z, Pseq([1, 1, 1, 0.5, 0.5], inf)); // but might be in different order.\n // to avoid this, set quant to an appropriate value.\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Fb1_ODEdef.remove` do? What arguments does it take?"}, {"role": "assistant", "content": "Removes the Fb1_ODEdef of the Symbol key from the Arguments: key — Symbol.."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `LFPulse` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\ns.meter;\ns.scope;\n\n// synthesize 2 test signals at level 0.1 (-20 dB), first on separate channels\n(\n{ var n = 2, level = 0.1, spread = 1, pan = 0;\n LFPulse.ar({ 100.exprand(2000) } ! n).range(-1, 1) * level\n}.play;\n);\n\n// now mix/pan these 2 signals using Splay, level at 0.1 (-20dB)\n(\nx = { |spread = 1, level = 0.1, center = 0|\n var n = 2;\n var snd = LFPulse.ar({ 100.exprand(2000) } ! n).range(-1, 1);\n var stereo = Splay.ar(snd, spread, level, center);\n Peak.ar(stereo, Impulse.kr(2)).ampdb.poll(2);\n stereo\n}.play;\n);\n\n// when we set full spread, panned to center:\n// the 2 signals are discrete, left and right\n// we see the energy-based levelComp applied (1/2.sqrt).ampdb = -3\nx.set(\\spread, 1, \\center, 0); // -20 - 3 = -23dB\n\n// no spread, panned center:\n// each signal decreases by 3dB as they move to the center (from the panning function)\n// and the two signals mix on each channel, so we get -20 dB\nx.set(\\spread, 0, \\center, 0); // -20dB\n\n// no spread, panned fully right:\n// the signals fully mix in the right channel (+6 dB)\nx.set(\\spread, 0, \\center, 1); // -23 + 6 = -17db\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `OscN` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// compare examples below with interpolating Osc examples.\n\n(\ns = Server.local;\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, false, true);\nb = Buffer.alloc(s, 512, 1);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum, 500, 0, 0.5)\n )\n}).play(s, [0, 0, 1, b.bufnum]);\n\n);\nb.free;\n\n\n\n(\n// noninterpolating - there are noticeable artifacts\n// modulate freq\n\ns = Server.local;\nb.sine1(1.0/[1, 2, 3, 4, 5, 6].squared, true, false, true);\nb = Buffer.alloc(s, 512, 1);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum, XLine.kr(2000, 200), 0, 0.5)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n\n);\nb.free;\n\n(\n// sounds very different than the Osc example\ns = Server.local;\nb = Buffer.alloc(s, 512, 1);\nb.sine1([1.0], true, true, true);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum,\n OscN.ar(bufnum,\n XLine.kr(1, 1000, 9),\n 0,\n 200,\n 800),\n 0,\n 0.25)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n\n);\nb.free;\n\n(\n// modulate phase\ns = Server.local;\nb = Buffer.alloc(s, 512, 1);\nb.sine1([1.0], true, true, true);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum,\n 800,\n OscN.ar(bufnum,\n XLine.kr(20, 8000, 10),\n 0,\n 2pi),\n 0.25)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n);\nb.free;\n\n\n(\n// change the buffer while its playing\ns = Server.local;\nb = Buffer.alloc(s, 4096, 1);\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, true, true);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum, [80, 80.2], 0, 0.2)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n);\n\n(\nRoutine({\n var n = 32;\n 50.do({\n b.sine1(Array.rand(n, 0, 1).cubed, true, true, true);\n 0.25.wait;\n });\n}).play;\n);\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Bag`?"}, {"role": "assistant", "content": "Bag — Unordered collection of objects"}, {"role": "user", "content": "What does `Bag.new` do?"}, {"role": "assistant", "content": "Creates a Bag with an initial capacity for n objects."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nBag[1, 2, 3].add(4).postln;\n\nBag[1, 2, 3].add(3).postln;\n\nBag[\"abc\", \"def\", \"ghi\"].add(\"jkl\").postln;\n\nBag[\"abc\", \"def\", \"ghi\"].add(\"def\").postln;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n//a SynthDef\n(\nSynthDef(\"plucking\", {arg amp = 0.1, freq = 220, decay = 5, coef = 0.1;\n\nvar env, snd;\nenv = EnvGen.kr(Env.linen(0, decay, 0.5), doneAction: 2);\nsnd = Pluck.ar(\n in: Saw.ar(freq, 0.5*amp),\n trig: Impulse.kr(0),\n\n maxdelaytime: 0.1,\n delaytime: freq.reciprocal,\n decaytime: decay,\n coef: coef);\n Out.ar(0, [snd, snd]);\n}).add;\n);\n\n//Bugger soundtrack\n(\nPbind(\n \\instrument, \"plucking\",\n \\scale, Scale.lydian,\n \\degree, Prand([[-2.5, -4.001], [-7.002, -5], [-1, -3.003], [1.005, 0.51]], inf),\n \\amp, Pseq([0.1, 0.2, 0.3, 0.4, 0.5, 0.5, 0.5, 0.5], inf),\n \\decay, Pseq([0.25,1, 0.5, 0.125], inf),\n \\coef, Pseq([0.7, 0.8, 0.9], inf),\n \\dur, Pseq([0.01, 0.0025, 0.2475, 0.24, 0.5], inf)\n).play;\n)\n```"}, {"role": "assistant", "content": "This will be the sound track for Bugger, a Frogger clone that started as a school assignment.\r\nSimple SynthDef using Pluck, and a few Pbinds. \r\n\r\nBugger can be found on [GitLab](https://gitlab.com/Modanung/Bugger)."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// Since the allpass delay has no audible effect as a resonator on\n// steady-state sound ...\n\n{ AllpassC.ar(WhiteNoise.ar(0.1), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// ...these examples add the input to the effected sound and compare variants so that you can hear\n// the effect of the phase comb:\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassN.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2)\n}.play)\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassL.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0\n// …\n```"}, {"role": "assistant", "content": "Since the allpass delay has no audible effect as a resonator on steady-state sound ... (AllpassC: Schroeder allpass delay line with cubic interpolation.)"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LinCongC`."}, {"role": "assistant", "content": "```supercollider\n// default initial params\n{ LinCongC.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Ndef`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\nNdef(\\sound, { |freq = 56, numHarm = 10| Blip.ar(freq, numHarm, 30) * 0.2 }).play;\nNdef(\\sound).set(\\freq, 15);\nNdef(\\sound).set(\\freq, 15, \\numHarm, 100);\n\nNdef(\\lfo, { LFNoise2.kr(2).exprange(10, 200) });\nNdef(\\sound).map(\\numHarm, Ndef(\\lfo));\nNdef(\\sound).set(\\numHarm, nil); // unmap.\nNdef(\\sound).stop;\n```"}]} +{"conversations": [{"role": "user", "content": "Supernova, Groups, Threads, Ndef?"}, {"role": "assistant", "content": "SuperCollider forum — Supernova, Groups, Threads, Ndef?\n\nAbout Ndef:\n\nAFAIK you can manually move a NodeProxy’s group into another group:\n\n```supercollider\n~pargroup = ParGroup(s);\n\nNdef(\\a, { Silent.ar(1) });\n\nNdef(\\a).group.moveToHead(~pargroup);\n```\n\nBut...\n\nNodeProxies use InFeedback.\n\nI was a little suspicious about this for parallel processing. As I recalled, InFeedback’s result depends on the order of execution:\n\n-\nIf the source node for the bus finished processing before the server reaches InFeedback, then InFeedback will output the block of audio being processed now.\n\n-\nIf the source node comes after the node containing InFeedback, then it will output the previous block of audio.\n\nIn both cases, these are the most recently available audio blocks. But, if the order of evaluation is not consistent, then the output may not be consistent.\n\nLet’s test that:\n\n```supercollider\nb = Bus.audio(s, 1);\n\na = { SinOsc.ar(200, 0, 0.1) }.play(outbus: b);\n\nc = { InFeedback.ar(b, 1).dup }.play(target: a, addAction: \\addAfter);\n\n(\nfork {\n var order = Pseq([\\moveBefore, \\moveAfter], inf).asStream;\n loop {\n c.perform(order.next, a);\n 1.0.wait;\n }\n}\n)\n```\n\nOops.\n\nThis means you can’t randomly throw Ndefs into ParGroups. If one Ndef reads a signal from another, then you have to make sure that the target Ndef comes later in a serial (regular) Group. (Correctness of the result should be more important than “optimal” usage of multiple cores.)\n\nIf you don’t, and if supernova happens to put the source and target Ndefs onto separate cores at roughly the same time, then the target might evaluate InFeedback either before or after the source finishes, and there’s no guarantee of this being consistent. So you might get clicks.\n\nhjh"}]} +{"conversations": [{"role": "user", "content": "What does `Array.shift` do?"}, {"role": "assistant", "content": "Shift the values of the array n steps to the right (n positive) or to the left(n negative), dropping the excess and filling empty space with zero. `[1, 2, 3, 4, 5,"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Compander`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n Decay2.ar(\n Impulse.ar(8, 0, LFSaw.kr(0.3, 1, -0.3, 0.3)),\n 0.001,\n 0.3\n )\n * Mix.ar(Pulse.ar([80, 81], 0.3))\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `InterfaceDef` in SuperCollider?"}, {"role": "assistant", "content": "InterfaceDef — defines event, midi and GUI handlers for an Interface see Interface Category: Libraries > crucial > Instr."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// randomly modulate params\n(\n{ FBSineC.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(1, 32, 33),\n LFNoise2.kr(1, 0.5),\n LFNoise2.kr(1, 0.05, 1.05),\n LFNoise2.kr(1, 0.3, 0.3)\n) * 0.2 }.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// randomly modulate params\n(\n{ FBSineC.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(1, 32, 33),\n LFNoise2.kr(1, 0.5),\n LFNoise2.kr(1, 0.05, 1.05),\n LFNoise2.kr(1, 0.3, 0.3)\n) * 0.2 }.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n//try passing a signal through the hair cell; it won't come out like a pure sine, more like an impulse train stimulated by that input\n{ Pan2.ar(HairCell.ar(SinOsc.ar(440)),0.0) }.play;\n\n//modulation effects\n{ Pan2.ar(HairCell.ar(Saw.ar(MouseX.kr(1,1000)),0.0,MouseY.kr(0.0,1000.0)),0.0) }.play;\n\n//constantly self oscillates at 5 Hz, talk through it to modulate from base rate... \n{ Pan2.ar(HairCell.ar(SoundIn.ar,5.0,100),0.0) }.play;\n\n//sweeps and beeps\n{ Pan2.ar(HairCell.ar(Saw\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n//try passing a signal through the hair cell; it won't come out like a pure sine, more like an impulse train stimulated by that input\n{ Pan2.ar(HairCell.ar(SinOsc.ar(440)),0.0) }.play;\n\n//modulation effects\n{ Pan2.ar(HairCell.ar(Saw.ar(MouseX.kr(1,1000)),0.0,MouseY.kr(0.0,1000.0)),0.0) }.play;\n\n//constantly self oscillates at 5 Hz, talk through it to modulate from base rate... \n{ Pan2.ar(HairCell.ar(SoundIn.ar,5.0,100),0.0) }.play;\n\n//sweeps and beeps\n{ Pan2.ar(HairCell.ar(Saw.ar(MouseX.kr(1,10)),0,MouseY.kr(0,10000)),0.0) }.play;\n\n//store can run out of chemicals \n{ Pan2.ar(HairCell.ar(SinOsc.ar(440),0,440,MouseX.kr(0,1000)),0.0) }.play;\n\n//raucous\n{ Pan2.ar(HairCell.ar(Saw.ar( HairCell.ar(SoundIn.ar,0,MouseY.kr(0,10000))*1000.0),MouseX.kr(0.0,1000.0),MouseY.kr(0.0,1000.0)),0.0) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Free`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\nSynthDef(\"a\", { Out.ar(0, SinOsc.ar(800, 0, 0.2)) }).add;\n\nSynthDef(\"b\", { |t_t = 0| Out.ar(1, PinkNoise.ar(0.3)); Free.kr(t_t, 1001) }).add;\n\ns.sendMsg(\\s_new, \\a, 1001, 0, 0);\n\ns.sendMsg(\\s_new, \\b, 1002, 0, 0);\n\ns.sendMsg(\\n_set, 1002, \\t_t, 1);\n\ns.sendMsg(\\s_new, \\a, 1001, 0, 0);\n\ns.sendMsg(\\n_set, 1002, \\t_t, 1);\n\ns.sendMsg(\\s_new, \\a, 1001, 0, 0);\n\ns.sendMsg(\\n_set, 1002, \\t_t, 1);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `MultiTrackAudioSpec.tracks` do?"}, {"role": "assistant", "content": "datatype specifying multiple 'audio' rate tracks"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// By Bjørn Houdorf March 2013, Play your (short) soundfiles with some delay.\n\nb = SoundFile.collectIntoBuffers(\"yourSoundFileFolder/*\"); // 1. rund this\n\n( // 2. and then run this\nt = Task({\n({\n var num= b.size.rand;\n var buf= b[num];\n 0.1*Splay.ar(PlayBuf.ar(buf.numChannels, buf, 1, 1, 0, 0));\n}.play;\n) \n});\n);\n\n\n( // 3. Then run this\nz = Task({\nloop({\n t.start;\n 0.1.wait;\n});\n});\n);\n\n\nz.start; // 4. and run this\nz.stop; // 5. and finally run this\n```"}, {"role": "assistant", "content": "Play your (short) soundfiles with some delay. Your soundfiles should be in the folder \"yourSoundFileFolder\"."}]} +{"conversations": [{"role": "user", "content": "What is `MultiSliderView` in SuperCollider?"}, {"role": "assistant", "content": "MultiSliderView — A view displaying an array of sliders MultiSliderView displays a collection of values, each represented by the position of one of the sliders placed side by side. Category: GUI > Views."}]} +{"conversations": [{"role": "user", "content": "Can you listen to the sound you generate?"}, {"role": "assistant", "content": "No. I am 198M parameters trained on SuperCollider's documentation and class library; I have no audio input and no way to hear a result. What I can do is reason about the code: whether it reaches an output bus, whether the envelope will ever open, whether a filter at that cutoff leaves anything audible. Treat my patches as a starting point you listen to, not as a judgement about how they sound."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ LFPulse.kr(XLine.kr(1, 200, 10), 0, 0.2) * SinOsc.ar(440 * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ LFPulse.kr(XLine.kr(1, 200, 10), 0, 0.2) * SinOsc.ar(440) * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a plucked string in SuperCollider."}, {"role": "assistant", "content": "Pluck is a Karplus-Strong string: a noise burst into a tuned delay with feedback. The delay time is\nthe reciprocal of the frequency.\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 220, amp = 0.5, dur = 3|\n var period = freq.reciprocal;\n var sig = Pluck.ar(WhiteNoise.ar(0.2), Impulse.kr(0), period, period, dur, 0.5);\n Out.ar(out, Pan2.ar(sig * amp, 0));\n}).add;\n);\nSynth(\\pluck, [\\freq, 330, \\dur, 4]);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\na = RecNodeProxy.audio(s, 2);\na.source = { SinOsc.ar([400, 500], 0, 0.1) };\na.play; // monitor;\na.open(\"xproxySpace.aif\");\na.record(false);\n\na.source = { SinOsc.ar([400, 700], 0, 0.1) };\na.source = { SinOsc.ar([410, 510], 0, 0.1) };\na.source = { SinOsc.ar([LFNoise1.kr(80, 100, 300), 500], 0, 0.1 };\n\n// stop recording and close file\na.close;\n\n// monitor off\na.stop;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\na = RecNodeProxy.audio(s, 2);\na.source = { SinOsc.ar([400, 500], 0, 0.1) };\na.play; // monitor;\na.open(\"xproxySpace.aif\");\na.record(false);\n\na.source = { SinOsc.ar([400, 700], 0, 0.1) };\na.source = { SinOsc.ar([410, 510], 0, 0.1) };\na.source = { SinOsc.ar([LFNoise1.kr(80, 100, 300), 500], 0, 0.1) };\n\n// stop recording and close file\na.close;\n\n// monitor off\na.stop;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `AbstractPlayer.timeDuration` do?"}, {"role": "assistant", "content": "the base class for all Players : a playable object"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\ns.boot;\n(\n// send a synth def to server\nSynthDef(\"tpulse\", { |out = 0, freq = 700, sawFreq = 440.0|\n Out.ar(out, SyncSaw.ar(freq, sawFreq, 0.1));\n}).add;\n);\n\n// Here the defaults for *new will result in a Synth at the head of the default group\n// of the default Server. This will use the SynthDef's default arguments;\ny = Synth.new(\"tpulse\");\ny.free;\n\n// The same done explicitly\ny = Synth.new(\"tpulse\", nil, s, \\addToHead);\ny.free;\n\n// With some arguments\ny = Synth.new(\"tpulse\", [\\freq\n// …\n```"}, {"role": "assistant", "content": "send a synth def to server Here the defaults for *new will result in a Synth at the head of the default group (Synth: Client-side representation of a synth node on the server)"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Amplitude`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n // LFSaw begins at 0, illustrates attack time better\n var sig = LFSaw.ar(440);\n var amps = Amplitude.ar(\n sig,\n attackTime: [0.001, 0.01],\n releaseTime: [0.01, 0.2]\n );\n [sig] ++ amps\n}.plot\n.superpose_(true)\n.plotColor_([Color.black, Color.green, Color.blue]);\n);\n\n(\n// use input amplitude to control SinOsc frequency\n{\n SinOsc.ar(\n Amplitude.kr(\n Blip.ar(3, 20) * LFNoise1.kr(0.1).range(0, 1),\n MouseX.kr(0.001, 1, 1),\n MouseY.kr(0.001, 1, 1),\n 1200,\n 400\n ),\n 0, 0.3)\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `SelectX` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar(300),\n Pulse.ar(230)\n ];\n\n SelectX.ar(MouseX.kr(0, 1) * a.size, a) * 0.2\n}.play;\n);\n\n(\n{\n var a;\n a = [\n SinOsc.kr(0.25),\n LFSaw.kr(10),\n LFPulse.kr(0.3)\n ];\n\n SinOsc.ar(SelectX.kr(MouseX.kr(0, 1) * a.size, a) * 300 + 400) * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `UChain.removeGroup` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: group — (describe argument here). Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Scale` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\nr = {\n var scale = Scale.choose.postln;\n SinOsc.ar(\n (\n DegreeToKey.kr(\n scale.as(LocalBuf),\n MouseX.kr(0, 15), // mouse indexes into scale\n scale.stepsPerOctave,\n 1, // mul = 1\n 60 // offset by 72 notes\n )\n + LFNoise1.kr([3, 3], 0.04) // add some low freq stereo detuning\n ).midicps, // convert midi notes to hertz\n 0,\n 0.25\n )\n}.play;\n);\n\nr.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Harmonics`."}, {"role": "assistant", "content": "```supercollider\na.ramp(1.0, 1.0); // returns a harmonic series\n\nb = Buffer.alloc(s, 512, 1);\n// harmonic series for freqs, ramp down for amps\nb.sine2(a.ramp(1.0, 1.0).postln, a.ramp(0.5, -0.025).postln, true, true, true);\n(\nz = SynthDef(\"help-Osc\", { |out = 0, bufnum = 0|\n Out.ar(out,\n Osc.ar(bufnum, 200, 0, 0.5)\n )\n});\n);\ny = z.play(s, [\\out, 0, \\bufnum, b]);\ny.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// Create a new empty collections with size 3:\nx = Array.new(3);\ny = Array.new(3);\nz = List.new(3);\n\n// Try to add 7 items to the array and list.\n// If the array exceeds maxSize, it will only\n// grow to an internally specified max size.\n(\n7.do { |i|\n x.add(i);\n y = y.add(i); // reassign array y on each add\n z.add(i);\n};\n);\n\n// Attempt to access the 5th item:\nx.at(4); // -> nil (out of bounds)\ny.at(4); // -> 4\nz.at(4); // -> 4\n\n// x grew only to size 4\nx.postln; // -> [ 0, 1, 2, 3 ]\ny.postln; // -> [ 0, 1, 2\n// …\n```"}, {"role": "assistant", "content": "Create a new empty collections with size 3: Try to add 7 items to the array and list. (List: list of items of variable size)"}]} +{"conversations": [{"role": "user", "content": "What does `RedOscillator2.delta2` do?"}, {"role": "assistant", "content": "Get the second delta phase i.e. current phase"}]} +{"conversations": [{"role": "user", "content": "How do I see what a signal is doing?"}, {"role": "assistant", "content": "`.poll` prints values to the post window — `SinOsc.kr(1).poll` prints once per control block, and `.poll(10)` limits it to every 10th. `s.scope` opens an oscilloscope on the main output, and `.scope` on a UGen shows just that signal. For a numeric snapshot of many signals at once, `s.meter` shows the output levels, and `\".dump\".postln` style probes are common while debugging."}]} +{"conversations": [{"role": "user", "content": "What is `Plotter`?"}, {"role": "assistant", "content": "Plotter — Plot numerical data on a window or view"}, {"role": "user", "content": "What does `Plotter.plotGraph` do?"}, {"role": "assistant", "content": "`{ |x| sin(x) }.plotGraph(300, 0, 2*pi);`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\na = { (0..10).scramble.normalize }.dup(2).plot;\na.editMode = true;\na.editFunc = { |...args| args.postln };\n);\n\n// using plotter as a control interface\n(\na = { (0..10).scramble.normalize(300, 400) }.dup.plot;\na.specs = \\freq; a.plotMode = \\bars;\na.editMode = true;\nx = {\n var phase = SinOsc.ar(\\rate.kr(a.value[1]));\n SinOsc.ar(\\freq.kr(a.value[0]), phase).mean * 0.1\n}.play;\na.editFunc = { |plotter, plotIndex, i, val|\n x.setn(\\freq, a.value[0]);\n x.setn(\\rate, a.value[1]);\n};\na.parent.onClose = { x.release };\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Speech to midi converter?"}, {"role": "assistant", "content": "SuperCollider forum — Speech to midi converter?\n\nHello!\n\nI want to make a speech to midi converter in Supercollider.\n\nI’ve started off trying to find a way to convert FFT data to midi-numbers to send to a midi-instrument, but I’m stuck:\n\n```supercollider\n~file = Buffer.read(s, \"path_to_file\", bufnum:1);\n\n(\n{\n var buf = Buffer.alloc(s, 2048, bufnum:2);\n var sig = PlayBuf.ar(2, 1, loop:1);\n var chain = FFT(buf, sig);\n var trig = Impulse.kr(30);\n chain[0].pvcalc(80, {\n |phas, mag|\n SendReply.kr(trig, \"/anal\", mag);\n });\n}.play\n);\n\n(\nOSCdef.new(\\midiConverter, {\n |msg|\n msg.postln;\n}, \"/anal\");\n)\n```\n\nthe output looks like this:\n\n[ /anal, 1000, -1, 0.0, 3.0463190078735, 2.1142015457153, -0.64955651760101, 2.3432319164276, -0.23956227302551, -3.1334409713745, -2.1829152107239, 1.1417833566666, -2.2972648143768, -0.74415707588196, -0.88793164491653, 1.9947071075439, -1.1327115297318, 2.6084003448486, etc...]\n\nI’m not sure how to interpret theese numbers. And I’m not sure pvcalc is even the best way to get the data I need. I want to somehow be able to control the resolution on how many of the loudest bins I’m going to convert to frequency and then from frequency to midi-number to send to a midi-instrument as the soundfile plays through.\n\nAny ideas?"}]} +{"conversations": [{"role": "user", "content": "What does `HasPatchIns.setDeepInput` do? What arguments does it take?"}, {"role": "assistant", "content": "parent class for Players that have PatchIns such as Patch Arguments: ai; ag; offset."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Change MembraneCircle to MembraneHexagon for a different shaped\n// circular drum head\ns.boot;\ns.reboot;\n(\n{ var excitation = EnvGen.kr(Env.perc,\n MouseButton.kr(0, 1, 0),\n timeScale: 0.1, doneAction: 0\n ) * PinkNoise.ar(0.4);\n var tension = MouseX.kr(0.01, 0.1);\n var loss = MouseY.kr(0.999999, 0.999, 1);\n MembraneCircle.ar(excitation, tension, loss);\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Change MembraneCircle to MembraneHexagon for a different shaped\n// circular drum head\ns.boot;\ns.reboot;\n(\n{ var excitation = EnvGen.kr(Env.perc,\n MouseButton.kr(0, 1, 0),\n timeScale: 0.1, doneAction: 0\n ) * PinkNoise.ar(0.4);\n var tension = MouseX.kr(0.01, 0.1);\n var loss = MouseY.kr(0.999999, 0.999, 1);\n MembraneCircle.ar(excitation, tension, loss);\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Pmulp` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\freq, Pseq([500, 600, 700]), \\instrument, \\sinegrain);\na = Pmulp(\\freq, Pseq([0.5, 0.9, 0.8], inf), a);\na.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `SampleRate`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// compares a 441 Hz sine tone derived from sample rate (44100 * 0.01, left)\n// with a 440 Hz tone (right), resulting in a 1 Hz beating\n(\n{\n var freq;\n freq = [SampleRate.ir * 0.01, 440];\n SinOsc.ar(freq, 0, 0.1)\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `PV_MagAbove` in SuperCollider briefly."}, {"role": "assistant", "content": "PV_MagAbove — Pass bins above a threshold. Passes only bins whose magnitude is above a threshold. Category: UGens > FFT."}]} +{"conversations": [{"role": "user", "content": "Explain `MxDocument` in SuperCollider briefly."}, {"role": "assistant", "content": "MxDocument — a wrapper for placing code Documents onto the Mx grid This is for adding code documents to an Mx. Category: Mx."}]} +{"conversations": [{"role": "user", "content": "In what order should I learn SuperCollider?"}, {"role": "assistant", "content": "The order that pays off fastest:\n\n1. **One UGen and Out** — `{ SinOsc.ar(440) * 0.2 }.play`. Learn that a graph must reach Out.\n2. **Envelopes and doneAction** — the difference between a sound and a click.\n3. **SynthDef and Synth** — naming a graph, controlling it with arguments, freeing it with a gate.\n4. **Patterns** — `Pbind` for sequence, so you stop writing loops by hand.\n5. **Buses and effects** — chaining, sends, groups.\n6. **JITLib** — Ndef for patches you modify while they play.\n\nVocabulary to carry: UGen, SynthDef, Synth, bus, group, envelope, gate, doneAction, Pattern, clock. Every\nconfusion in SuperCollider tends to be one of those words."}]} +{"conversations": [{"role": "user", "content": "What does `SequenceableCollection.convertDigits` do?"}, {"role": "assistant", "content": "Returns an integer resulting from interpreting the elements as digits to a given base (default 10). See also asDigits in Integer#-asDigits for the complementary method. `[1, 0, 0,"}]} +{"conversations": [{"role": "user", "content": "What does `SplineGui.setDomainSpec` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: dsp — (describe argument here); setGridLines — (describe argument here). Returns: ControlSpec"}]} +{"conversations": [{"role": "user", "content": "What does `Sieve.dif_oi` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new Sieve object in mode 'intervals' with offsets, generated by the difference of sets of Arguments: ... data — Alternating generators and integer offsets plus an optional integer limit, wrapped into a Ref, which is included when reached. Allowed generators: Integers, Streams or Patterns producing intervals or Sieves itself. Integers and Stream/Pattern output must be strictly positive. Integers as generators ."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `RunningSum`."}, {"role": "assistant", "content": "```supercollider\n// distorts of course - would need scaling\n{ RunningSum.ar(SoundIn.ar) }.play\n\n// Running Average over x samples\n(\n{\n var x = 100;\n RunningSum.ar(LFSaw.ar, x) * (x.reciprocal)\n }.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `RecordBuf` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// Execute the following in order\n(\n// allocate a Buffer\ns = Server.local;\nb = Buffer.alloc(s, 44100 * 4.0, 1); // a four second 1 channel Buffer\n);\n\n// record for four seconds\n(\nSynthDef(\\help_RecordBuf, { |out = 0, bufnum = 0|\n var formant;\n formant = Formant.ar(XLine.kr(400, 1000, 4), 2000, 800, 0.125);\n RecordBuf.ar(formant, bufnum, doneAction: Done.freeSelf, loop: 0);\n}).play(s, [\\out, 0, \\bufnum, b]);\n);\n\n// play it back\n(\nSynthDef(\\help_RecordBuf_playback, { |out = 0, bufnum = 0|\n var playbuf;\n playbuf = PlayBuf.ar(1, bufnum);\n FreeSelfWhenDone.kr(playbuf); // frees the synth when the PlayBuf is finished\n Out.ar(out, playbuf);\n}).play(s, [\\out, 0, \\bufnum, b]);\n);\n\n// overdub\n(\nSynthDef(\\help_RecordBuf_overdub, { |out = 0, bufnum = 0|\n var formant;\n formant = Formant.ar(XLine.kr(200, 1000, 4), 2000, 800, 0.125);\n // mixes equally with existing data\n RecordBuf.ar(formant, bufnum, 0, 0.3, 0.5, doneAction: Done.freeSelf, loop: 0);\n}).play(s, [\\out, 0, \\bufnum, b]);\n);\n\n// play back the overdubbed version\nSynth.new(\\help_RecordBuf_playback, [\\out, 0, \\bufnum, b], s);\n\n// write the contents of the buffer to a file (see Buffer for more options)\n(\nb.write(sampleFormat: 'int16');\nthisProcess.platform.recordingsDir +/+ \"SC_\" ++ Date.localtime.stamp ++ \".aiff\"; // generated path\n);\n\nb.close; b.free; // cleanup\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for 003_102 (a SuperCollider snippet). Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\nSynthDef('003_102', {|out=0,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y| Out.ar(out, Pan2.ar(Normalizer.ar(( GbmanL.ar( LPF.ar( SyncSaw.ar(p, k, q, h ), FreqShift.ar(d, r, k, y, a ), h, n ), r, l, Blip.ar(r, f, u, i ), h ))*( LFPar.ar(d, x, Saw.ar(w, k, Formant.ar(s, q, d, DelayL.ar(y, 0.5, w, v, i ), e ) ), y ))*( LFCub.ar(q, a, h, g ))*( Gendy1.ar(r, c, r, QuadL.ar(h, o, j, t, t, v, f ), k, p, g, Pulse.ar(g, g, c, s ), PMOsc.ar(f, u, d, t, d, f ), f, LFNoise0.ar(k, l, e ), d ) )))) }).play(args: #[ a, 0.1, b, 0.83039082494709, c, 7.4736936148092, d, 57.834883574831, e, 0.56638920329924, f, 2.7610572022348, g, -0.60208093272399, h, 0.69731527262978, i, 0.97553825378418, j, 0.47619211673737, k, 0.45142233371735, l, 6.5229251440451, m, 0.34238355327673, n, 3.1624102065486, o, 1, p, 1, q, 5.4898714868897, r, 2.7777416341664, s, 10966.099508885, t, 0.15706503391266, u, 3.1945936724559, v, 20000, w, -4.6151277924266, x, 1.4588773159677, y, 0.0012384873762477 ])\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// a Synth with a multi-node release stage\nd = { |gate = 1|\n var env = Env([0, 1, 0, 0.5, 0], 0.5, -4, releaseNode: 1);\n { BrownNoise.ar }.dup * EnvGen.kr(env, gate, doneAction: Done.freeSelf)\n}.play;\n);\n// forced release in 2 seconds:\n// end value (0) and shape (-4) are read from the env's last node, nodes 2 and 3 are skipped\nd.release(2);\n\n// without releaseTime: normal release stage, as defined in env (3 nodes)\nd.release(;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// a Synth with a multi-node release stage\nd = { |gate = 1|\n var env = Env([0, 1, 0, 0.5, 0], 0.5, -4, releaseNode: 1);\n { BrownNoise.ar }.dup * EnvGen.kr(env, gate, doneAction: Done.freeSelf)\n}.play;\n);\n// forced release in 2 seconds:\n// end value (0) and shape (-4) are read from the env's last node, nodes 2 and 3 are skipped\nd.release(2);\n\n// without releaseTime: normal release stage, as defined in env (3 nodes)\nd.release();\n```"}]} +{"conversations": [{"role": "user", "content": "What does `TdefGui.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a new JITGui that will be watching an object and display its Arguments: object — the object to watch; numItems — the number of display items to use, e.g. how many fields for text, or how many EZSliders for single-number parameters.; parent — a parent view on which to display. If nil, a new window is created; parent can also be an existing window or a composite view.; bounds — a desired size and position where to display a JITGui. can be nil, a Point, or a Rect. JITGuis know their minimum size (minSize), and if bounds is nil, minSize is used. if bounds is a point or rect, it will be set to at least minSize. With a rect one can also supply a position where to display. If a; makeSkip — A flag whether to make a skipjack. If one uses a TdefGui as part of a larger gui ensemble, one may want to call checkUpdate on all of them together, not with separate skipJacks.; options — a list of additional information, e.g. flags about optional buttons. (this is used is some subclasses)."}]} +{"conversations": [{"role": "user", "content": "Explain `PV_MagBelow` in SuperCollider briefly."}, {"role": "assistant", "content": "PV_MagBelow — Pass bins below a threshold. Passes only bins whose magnitude is below a threshold. Category: UGens > FFT."}]} +{"conversations": [{"role": "user", "content": "What is the difference between an audio bus and a control bus?"}, {"role": "assistant", "content": "Both are numbered channels on the server used to move signal between nodes. An audio bus carries audio-rate signal and holds one or more audio channels; a control bus carries one value per block, like a parameter. You write with Out.ar / Out.kr and read with In.ar / In.kr, or with `.asMap` / `\\param, bus.asMap` to drive a Synth's control from a bus. Buses are how effects are chained: a synth writes to a private bus, the effect reads it and writes to Out.ar(0, …)."}]} +{"conversations": [{"role": "user", "content": "What does `Server.pid` do?"}, {"role": "assistant", "content": "Get process ID of the running server (if not"}]} +{"conversations": [{"role": "user", "content": "Explain `Window` in SuperCollider briefly."}, {"role": "assistant", "content": "Window — Top-level container of views The Window is the most fundamental element of the GUI. It occupies a rectangular space on the screen within which other GUI elements (Views) are displayed. Category: GUI > Views."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nNdef(\\lfo2, { LFNoise1.kr(LFNoise1.kr(0.1).exprange(1, 300) ! 2, 400, 800) });\nNdef(\\sound, { Blip.ar(Ndef.kr(\\lfo2), 30) * 0.2 }).play;\n\nNdef(\\lfo2, { [MouseX.kr(10, 300, 1), MouseY.kr(10, 300, 1)] };\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nNdef(\\lfo2, { LFNoise1.kr(LFNoise1.kr(0.1).exprange(1, 300) ! 2, 400, 800) });\nNdef(\\sound, { Blip.ar(Ndef.kr(\\lfo2), 30) * 0.2 }).play;\n\nNdef(\\lfo2, { [MouseX.kr(10, 300, 1), MouseY.kr(10, 300, 1)] });\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Mx.disconnectCable` do? What arguments does it take?"}, {"role": "assistant", "content": "A mixer and dynamic patching Arguments: cable."}]} +{"conversations": [{"role": "user", "content": "What does `SCluster.setAmplitudes` do? What arguments does it take?"}, {"role": "assistant", "content": "convenience method for CODE.set(\\amplitudes, Arguments: arr — an array of floats (0.0 to 1.0).."}]} +{"conversations": [{"role": "user", "content": "How to generate paradiddles?"}, {"role": "assistant", "content": "SuperCollider forum — How to generate paradiddles?\n\nHi Rodet, I’m teaching jazz at college, and sometimes paradiddles come up in conversation (although I’m not a drummer). A paradiddle is basically a way of ‘evenly’ playing a roll (single/double/triple/whatever). If you take your drumsticks/fingers and play evenly:\n\nright, left, right, right, left, right, left, left, right, left, right, right, etc\n\nyou’ll notice that it’s possible to get an even rhythm, which when played fast becomes a roll. The idea of the single/double/triple is just to place the accents (lightly, or not) on the left, right hand, which if I understand helps keep an even stroke (and makes better sense to follow).\n\nSo, although I don’t know the goal of your idea, a simple code which would give you the solution could be a pattern. You’ll notice I’ve put in a SynthDef to give the ‘snare’ sound - not very real, but just for the demonstration. If you run these patterns, un-commenting the line needed (single, double or triple - don’t forget to comment out the lines you don’t need), you’ll hear the accents a paradiddle gives.\n\nIn this example Pbind ‘a’ gives the pulse, and Pbind ‘b’ the accents. And, if you play along with them (using your chart), you’ll notice the accents pass from right hand to left hand (or vice versa). This is (more or less) what paradiddles do, although a drummer will explain better how they ‘accent’ strokes to get more complicated/subtle rhythms.\n\n```supercollider\n(\nSynthDef(\\snare, {\n arg out=0, sus=0.1;\n var sig, env;\n sig = WhiteNoise.ar(0.1);\n env = EnvGen.kr(Env.perc(0.001, sus), doneAction:2);\n sig = sig*env;\n Out.ar(out, sig!2);\n}).add;\n);\n\n(\nt=TempoClock(80/60);\na=Pbind(\n \\instrument, \\snare,\n \\dur, 1/2,\n \\sus, 0.01\n);\nb=Pbind(\n \\instrument, \\snare,\n \\dur, 1,\n \\sus, Pseq([0.02, 0.01],inf), // single\n //\\sus, Pseq([0.02, 0.01, 0.01],inf), // double\n //\\sus, Pseq([0.02, 0.01, 0.01, 0.01],inf), // triple\n);\nPpar([a, b]).play(t);\n)\n```\n\nI hope that puts you on the right track.\n\np.s. Don’t forget to try out changing the speed to get the real effect. Try something like 320/60 on the TempoClock."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Node`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n(\nx = SynthDef(\"help-node-set\", { |freq = 440, out = 0|\n Out.ar(out, SinOsc.ar(freq, 0, 0.1))\n}).play\n);\nx.set(\\freq, 880, \\out, 1); // two pairs\nx.set(0, 660, 1, 0); // freq is the first argument, so it's index is 0. out is index 1.\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Array`."}, {"role": "assistant", "content": "```supercollider\n(\nx = {\n SinOsc.ar([0.1, 0.2], 0).poll * 0.1\n}.play;\n);\nx.trace; // By tracing the Synth you can see the two Poll units we created\nx.free\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `RedBencode` in SuperCollider briefly."}, {"role": "assistant", "content": "RedBencode — Bencode encoder and decoder Read about this format here... http://en.wikipedia.org/wiki/Bencode Category: Red > redTools."}]} +{"conversations": [{"role": "user", "content": "What is `Rest`?"}, {"role": "assistant", "content": "Rest — Represents a rest in event patterns"}, {"role": "user", "content": "What does `Rest.new` do?"}, {"role": "assistant", "content": "Create an instance of Rest, with a value to be used in the resulting rest event."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// do nothing for 2 seconds\n(note: Rest(), dur: 2).play;\n\n// intersperse pauses in pattern\nPbind(\\note, Pseq([0, 4, 7, 11], inf), \\dur, Pseq([2, 1, Rest(1)], inf) / 5).play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `CombL`."}, {"role": "assistant", "content": "```supercollider\n// These examples compare the variants, so that you can hear the difference in interpolation\n\n// Comb used as a resonator. The resonant fundamental is equal to\n// reciprocal of the delay time.\n{ CombN.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ CombL.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ CombC.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// with negative feedback:\n{ CombN.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ CombL.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ CombC.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n// used as an echo.\n{ CombL.ar(Decay.ar(Dust.ar(1, 0.5), 0.2, WhiteNoise.ar), 0.2, 0.2, 3) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Why does every UGen have mul and add arguments?"}, {"role": "assistant", "content": "They are a convenience applied to the UGen's output: the result is `ugens_result * mul + add`. So `SinOsc.ar(440, 0, 0.2)` is the same as `SinOsc.ar(440) * 0.2`, and `SinOsc.ar(440, 0, 0.5, 1800)` is usable directly as a frequency. They exist because multiplying and offsetting is so common that folding it into the UGen saves a node in the graph and a line in the source."}]} +{"conversations": [{"role": "user", "content": "What is `DXEnvFanOut` in SuperCollider?"}, {"role": "assistant", "content": "DXEnvFanOut — sends crossfade envelopes to out buses according to demand-rate control DXEnvFanOut sends multichannel envelopes, which are used by DXMix / DXMixIn / DXFan / DXFanOut implicitely, to a sequence of out buses, which, together with fadeTimes and stepTimes, can be passed as demand rate ugens. It can be used as envelope and trigger at the same time, which leads to applications such as crossfading PlayBufs and different kinds of granulation, using a buffer or not. Category: Libraries > miSCellaneous > DX suite."}]} +{"conversations": [{"role": "user", "content": "I get 'syntax error, unexpected NAME' on a block that looks fine."}, {"role": "assistant", "content": "Almost always a missing semicolon between two statements — SuperCollider does not insert them.\n\n```supercollider\n// broken: two statements, no separator\n{ var sig = SinOsc.ar(440) sig = sig * 0.1; sig }.play\n```\n\n```supercollider\n// fixed\n{ var sig = SinOsc.ar(440); sig = sig * 0.1; sig }.play\n```\nThe error points at the second statement, not at the missing semicolon before it, which is why it looks\nfine. If it is not a semicolon, count the brackets: `.ar(` open, `)` closed."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `LinRand` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-LinRand\", { |out = 0, minmax = 1|\n Out.ar(out,\n FSinOsc.ar(\n LinRand(200.0, 10000.0, minmax),\n 0, Line.kr(0.2, 0, 0.01, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n// towards hi\n(\nRoutine({\n loop({\n Synth.new(\"help-LinRand\"); 0.04.wait;\n })\n}).play;\n);\n\n// towards lo (doesn't work like that yet)\n(\nRoutine({\n loop({\n Synth.new(\"help-LinRand\", [\\minmax, -1]); 0.04.wait;\n })\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Why does every UGen have mul and add arguments?"}, {"role": "assistant", "content": "They are a convenience applied to the UGen's output: the result is `ugens_result * mul + add`. So `SinOsc.ar(440, 0, 0.2)` is the same as `SinOsc.ar(440) * 0.2`, and `SinOsc.ar(440, 0, 0.5, 1800)` is usable directly as a frequency. They exist because multiplying and offsetting is so common that folding it into the UGen saves a node in the graph and a line in the source."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// where did I leave my keys?\n(\nvar n = 30, m = 5;\nNdef.clear(3);\nNdef.ar(\\x, n);\nNdef(\\y, { Splay.ar(Ndef.ar(\\x, m, LFNoise1.kr(1/m).range(0, n - m - 1))).clip2 * 0.5 }).play; \nNdef(\\x, { \n { \n var a = Ndef.ar(\\x, 1, LFNoise0.kr(Rand()) * Rand() + Rand() * n);\n a + 0.1 * SinOsc.ar(ExpRand(0.2, 1000)) \n } ! n\n}); \n);\n\n// where did I put my keys?\n(\nvar n = 30, m = 5;\nNdef.clear(3);\nNdef.ar(\\x, n);\nNdef(\\y, { Splay.ar(Ndef.ar(\\x, m, LFNoise1.kr(1/m).range(0, n - m - 1))).clip2 * 0.5 }).play; \nNdef(\\x, { \n {\n var a = Ndef.ar(\\x, 1, LFNoise0.kr(Rand()) * Rand() + Rand() * n);\n SinOsc.ar(ExpRand(0.2, 1000), a) \n } ! n\n}); \n)\n```"}, {"role": "assistant", "content": "Cross-tuning between multiple signal dimensions. The code is finished without listening."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// By Bjørn Houdorf March 2013, Play your (short) soundfiles with some delay.\n\nb = SoundFile.collectIntoBuffers(\"yourSoundFileFolder/*\"); // 1. rund this\n\n( // 2. and then run this\nt = Task({\n({\n var num= b.size.rand;\n var buf= b[num];\n 0.1*Splay.ar(PlayBuf.ar(buf.numChannels, buf, 1, 1, 0, 0));\n}.play;\n) \n});\n);\n\n\n( // 3. Then run this\nz = Task({\nloop({\n t.start;\n 0.1.wait;\n});\n});\n);\n\n\nz.start; // 4. and run this\nz.stop; // 5. and finally run this\n```"}, {"role": "assistant", "content": "Play your (short) soundfiles with some delay. Your soundfiles should be in the folder \"yourSoundFileFolder\"."}]} -{"conversations": [{"role": "user", "content": "What does `JITGui.getState` do?"}, {"role": "assistant", "content": "ask the object for all aspects of its current state that will be"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n~constructPseudoMethods = { |envir|\n var newEnvir = envir.collect { |value|\n var argNames, argBlock, namesBlock, code, func;\n if(value.isKindOf(Function)) {\n func = value;\n argNames = func.def.argumentString(withDefaultValues: true);\n namesBlock = func.def.argumentString(withDefaultValues: false);\n argBlock = if(argNames.notNil) { \"|self, \" ++ argNames ++ \"|\" };\n code = \"{ |func, envir| { % envir.use { func.value(%) } } }\".format(argBlock ? \"\", namesBlock ? \"\");\n //code.postln;\n code.interpret.value(func, envir)\n } {\n value\n }\n };\n newEnvir.know = true; // we want a prototype object style environment\n};\n```"}, {"role": "assistant", "content": "/*\r\nI often like to write out a library as an environment, like:\r\n\r\n~start_sound = { |freq, amp| <...> };\r\n~start_high_pitch_sound = { |amp| ~start_sound.(14000, amp) };\r\n\r\n… and then use loadRelative to load that library.\r\n\r\nThis, however has the problem that you can't stick the whole library into an environment that you call from the outside. e.g.\r\n\r\nq = ();\r\nq.use { resolveRelative(\"/library.sc."}]} -{"conversations": [{"role": "user", "content": "What is `Scale`?"}, {"role": "assistant", "content": "Scale — represents a musical scale"}, {"role": "user", "content": "What does `Scale.all` do?"}, {"role": "assistant", "content": "The scale repository, to which new scales can be added. `Scale.all.put(\\catastrophic, Scale([0, 0.01, 0.04, 11.2]));`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\na = Scale.major;\na.degrees; // [0, 2, 4, 5, 7, 9, 11]\na.semitones; // [0, 2, 4, 5, 7, 9, 11]\na.cents; // [0, 200, 300, 500, 700, 900, 1100]\na.ratios; // [1, 1.1224620483089, 1.2599210498937, 1.3348398541685, etc.]\n\nPbind(\\scale, a, \\degree, Pseq((0..7) ++ (6..0) ++ [\\rest], 1), \\dur, 0.25).play;\n\n// use non-standard tuning\na.tuning_(\\just);\na.degrees; // no change; degrees are independent of tuning\na.semitones; // [0, 2.0391000173077, 3.1564128700055, 4.9804499913461, etc.]\na.ratios.collect(_.round(0.001)); // [1, 1.125, 1.2, 1.333, 1.5, 1.667, 1.875]\n\nPbind(\\scale, a, \\degree, Pseq((0..7) ++ (6..0) ++ [\\rest], 1), \\dur, 0.25).play;\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `DetectSilence`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"detectSilence-help\", { |out|\n var z;\n z = SinOsc.ar(Rand(400, 700), 0, LFDNoise3.kr(8).max(0)).softclip * 0.3;\n DetectSilence.ar(z, doneAction: Done.freeSelf);\n Out.ar(out, z);\n}).add;\n);\n\nSynth(\"detectSilence-help\");\nSynth(\"detectSilence-help\");\nSynth(\"detectSilence-help\");\n\n\n(\nTask({\n loop({\n Synth(\"detectSilence-help\");\n [0.5, 1].choose.wait;\n })\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `NamedIntegersSpec.nisinit` do? What arguments does it take?"}, {"role": "assistant", "content": "datatype specifying an option list with names and an integer output type Arguments: n; s; d."}]} +{"conversations": [{"role": "user", "content": "What does `String.findSimilarIn` do? What arguments does it take?"}, {"role": "assistant", "content": "From a list of strings, find similar strings, sorted by edit distance and limited by similarity. `\"hi\".findSimilarIn([\"ho\", \"hu?\", \"hugs\", \"Hola\", \"else\"], Arguments: array — An array of strings to find similar strings in.; maxEditDistance — The largest SequenceableCollection#editDistance#edit distance that is accepted as a match.; minSimilarity — Keep only results whose SequenceableCollection#similarity#similarity is larger than this value. If set to `nil`, all values are accepted.; prioritizeCapitalization — If true, calculated the edit distances on lower case versions.."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LFSaw`."}, {"role": "assistant", "content": "```supercollider\n{ LFSaw.ar(500, 1, 0.1) }.play\n\n// used as both Oscillator and LFO:\n{ LFSaw.ar(LFSaw.kr(4, 0, 200, 400), 0, 0.1) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\na = Scheduler(SystemClock);\n\na.sched(3, { \"now it is 3 seconds.\".postln; nil });\na.sched(5, { \"now it is 5 seconds.\".postln; nil });\na.sched(1, { \"now it is 1 second.\".postln; nil });\n\na.advance(0.5);\na.advance(0.5);\na.advance(2);\na.advance(2);\n\n// the beats, seconds and clock are passed into the task function:\na.sched(1, { |beats, secs, clock| [beats, secs, clock].postln });\na.advance(1);\n\n// the scheduling is relative to \"now\":\na.sched(3, { \"now it was 3 seconds.\".postln });\n// …\n```"}, {"role": "assistant", "content": "the beats, seconds and clock are passed into the task function: the scheduling is relative to \"now\": (Scheduler: schedules functions to be evaluated in the future)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\nx = {\nvar son = SinOsc.ar(mul: SinOsc.ar(0.3).range(0,1) * Line.ar(0, 1, 20, doneAction: 2));\nTextVU.ar(2, son, \"Sin\");\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\nx = {\nvar son = SinOsc.ar(mul: SinOsc.ar(0.3).range(0,1) * Line.ar(0, 1, 20, doneAction: 2));\nTextVU.ar(2, son, \"Sin\");\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `In` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n(\nSynthDef(\"help-PinkNoise\", { |out = 0|\n Out.ar(out, PinkNoise.ar(0.1))\n}).add;\n\nSynthDef(\"help-In\", { |out = 0, in = 0|\n var input;\n input = In.ar(in, 1);\n Out.ar(out, input);\n\n}).add;\n);\n\n// play noise on the right channel\nx = Synth(\"help-PinkNoise\", [\\out, 1]);\n\n// read the input and play it out on the left channel\nSynth.after(x, \"help-In\", [\\out, 0, \\in, 1]);\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `AbstractSInstrument` in SuperCollider briefly."}, {"role": "assistant", "content": "AbstractSInstrument — an abstract class for all sInstruments Helper class for instruments. Category: SInstruments."}]} +{"conversations": [{"role": "user", "content": "Explain `Spec` in SuperCollider briefly."}, {"role": "assistant", "content": "Spec — input datatype specification Specs specify what kind of input is required or permissible, and what the range of those parameters are. This is an abstract class - the most common subclass is: ControlSpec. Category: Control, Spec."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Out` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-out\", { |out = 0, freq = 440|\n var source;\n source = SinOsc.ar(freq, 0, 0.1);\n\n // write to the bus, adding to previous contents\n Out.ar(out, source);\n\n}).add;\n);\n\n\nSynth(\"help-out\", [\\freq, 500]);\nSynth(\"help-out\", [\\freq, 600]);\nSynth(\"help-out\", [\\freq, 700]);\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\RotateAz;\n~description = \"Rotation around the z-axis (angle from -180 to 180)\";\n\n~function = { |in = 0, order = 1, rotateAziDeg = 0|\n\n // Rotating the scene is done from the perspective of the listener\n // rotation follows the right-hand rule of rotation:\n // * Positive azimuth means the listener turns head to the left\n\n HOATransRotateAz.ar(\n order: order,\n in: in,\n az: rotateAziDeg.degrad\n );\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `BPF`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// synthdefs to play with\n(\nSynthDef(\\noise_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, rq = 0.1, amp = 0.1|\n var sig = { WhiteNoise.ar } ! 2;\n sig = BPF.ar(sig, freq, rq) *\n EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2) *\n (rq ** -1) * (250 / (freq ** 0.8));\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\sin_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { SinOsc.ar(freq, Rand(0, 2pi)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n\n\nSynthDef(\\saw_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { VarSaw.ar(freq, Rand(0, 1)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Standard2DN.ar(220, 11025, mul:0.3) }.play(s);\n\n// mouse-controlled param\n{ Standard2DN.ar(SampleRate.ir/2, SampleRate.ir, MouseX.kr(0.9,4), mul:0.3) }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(Standard2DN.ar(10, 20, MouseX.kr(0.9,4))*800+900)*0.4 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Standard2DN.ar(220, 11025, mul:0.3) }.play(s);\n\n// mouse-controlled param\n{ Standard2DN.ar(SampleRate.ir/2, SampleRate.ir, MouseX.kr(0.9,4), mul:0.3) }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(Standard2DN.ar(10, 20, MouseX.kr(0.9,4))*800+900)*0.4 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `UScoreEditor.<|` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: events — (describe argument here). Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = {LFTri.ar(100+(1000*Maths.ar(MouseX.kr, MouseY.kr, SinOsc.ar(0.2, 0).range(0,1), 1-MouseButton.kr(lag:0.001))[0]), 0, 0.1}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = {LFTri.ar(100+(1000*Maths.ar(MouseX.kr, MouseY.kr, SinOsc.ar(0.2, 0).range(0,1), 1-MouseButton.kr(lag:0.001))[0]), 0, 0.1)}.play\n```"}]} +{"conversations": [{"role": "user", "content": "What does `GUI.set` do? What arguments does it take?"}, {"role": "assistant", "content": "Changes the current Arguments: aScheme — An instance of Symbol. The scheme to use as current scheme.."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n/* Audio plugin definition\n\n Each audio plugin should define the following global variables:\n ~name: (symbol) name of the spatializer\n ~description: (string) a short description\n ~function: the actual definition of the plugin\n\n*/\n\n~name = \\MonoIn;\n~description = \"A direct input\";\n~channelLayout = \\mono;\n\n~function = {\n |gate = 0, bus = 0, attack = 0.02, susL = 0.9, release = 0.1, curve = -4|\n var env = Env.asr(attack, susL, release, curve);\n SoundIn.ar(bus, EnvGen.kr(env, gate));\n}\n```"}, {"role": "assistant", "content": "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see ."}]} +{"conversations": [{"role": "user", "content": "What is `FoaThetaPhiA` in SuperCollider?"}, {"role": "assistant", "content": "FoaThetaPhiA — First Order Ambisonic (FOA) Azimuth & Elevation of Soundfield Active Intensity Vector Return the Azimuth & Elevation of Active Intensity Vector of a first order ambisonic (B-format) signal. Category: Libraries > Ambisonic Toolkit > UGens > FOA > Analyzer, UGens > Multichannel > Ambisonics, UGens > Analysis > Ambisonics."}]} +{"conversations": [{"role": "user", "content": "What does `Mx.at` do? What arguments does it take?"}, {"role": "assistant", "content": "Retreive the MxUnit at the channel and index. returns nil if Arguments: chan — int; index — int. Returns: MxUnit"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a, b;\na = Psetp(\\freq, Pseq([801, 1008], inf), Pbind(\\dur, Pseq([0.5, 0.111, 0.22])));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n);\n\n// Psetp overrides incoming values:\n\n(\nvar a, b;\na = Psetp(\\freq, 801, Pbind(\\freq, 108));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n);\n\n\n// sound example\n\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = En\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a, b;\na = Psetp(\\freq, Pseq([801, 1008], inf), Pbind(\\dur, Pseq([0.5, 0.111, 0.22])));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n);\n\n// Psetp overrides incoming values:\n\n(\nvar a, b;\na = Psetp(\\freq, 801, Pbind(\\freq, 108));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n);\n\n\n// sound example\n\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, Pseq([0.5, 0.3, 0.1]), \\instrument, \\sinegrain);\na = Psetp(\\freq, Pseq([500, 600, 700], inf), a);\na.play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BufRateScale`."}, {"role": "assistant", "content": "```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n(\nx = { |rate = 1|\n BufRd.ar(1, b, Phasor.ar(0, BufRateScale.kr(b) * rate, 0, BufFrames.kr(b)))\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\na = { |t_trig, t_reset|\n var d = Demand.kr(t_trig + t_reset, t_reset, Dseries(0, 1, inf));\n d.poll(t_trig + t_reset);\n 0.0;\n}.play\n);\na.set(\\t_trig, 1); // do this a few times — the demand value should increase by 1 each time\na.set(\\t_reset, 1; // goes immediately back to 0\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\na = { |t_trig, t_reset|\n var d = Demand.kr(t_trig + t_reset, t_reset, Dseries(0, 1, inf));\n d.poll(t_trig + t_reset);\n 0.0;\n}.play\n);\na.set(\\t_trig, 1); // do this a few times — the demand value should increase by 1 each time\na.set(\\t_reset, 1); // goes immediately back to 0\n```"}]} -{"conversations": [{"role": "user", "content": "What does `NumberEditor.guiClass` do?"}, {"role": "assistant", "content": "holds a float value with a spec, editable with a gui"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LFTri`."}, {"role": "assistant", "content": "```supercollider\n// plot:\n{ LFTri.ar(40) }.plot(0.1);\n{ LFTri.ar(XLine.kr(1, 800, 0.1)) }.plot(0.1);\n\n{ LFTri.ar(500, 0, 0.1) }.play\n\n// used as both Oscillator and LFO:\n{ LFTri.ar(LFTri.kr(4, 0, 200, 400), 0, 0.1) }.play\n\n// phase. compare\n{ LFTri.ar(LFTri.kr(0.1, iphase: 0) * 200 + 400, 0, 0.1) }.play\n{ LFTri.ar(LFTri.kr(0.1, iphase: 1) * 200 + 400, 0, 0.1) }.play\n{ LFTri.ar(LFTri.kr(0.1, iphase: 2) * 200 + 400, 0, 0.1) }.play\n{ LFTri.ar(LFTri.kr(0.1, iphase: 3) * 200 + 400, 0, 0.1) }.play\n\n// together\n{ LFTri.ar(LFTri.kr(0.05, iphase: (0..3)) * 200 + 400, 0, 0.1).sum }.play\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\"help-LFNoise2\", { arg out=0;\n Out.ar(out,\n LFBrownNoise2.ar(1000, 1, MouseX.kr(0, 5), 0.25)\n )\n}).play;\n);\n\n//use as frequency control\n(\nSynthDef(\"help-LFNoise2\", { arg out=0;\n Out.ar(out,\n SinOsc.ar(\n LFBrownNoise2.kr(8.dup, 0.2, 0, 400, 450),\n 0, 0.2\n )\n )\n}).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\"help-LFNoise2\", { arg out=0;\n Out.ar(out,\n LFBrownNoise2.ar(1000, 1, MouseX.kr(0, 5), 0.25)\n )\n}).play;\n);\n\n//use as frequency control\n(\nSynthDef(\"help-LFNoise2\", { arg out=0;\n Out.ar(out,\n SinOsc.ar(\n LFBrownNoise2.kr(8.dup, 0.2, 0, 400, 450),\n 0, 0.2\n )\n )\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SimpleTriggerGui.guiBody` do? What arguments does it take?"}, {"role": "assistant", "content": "gui class. just a button to trigger Arguments: layout."}]} -{"conversations": [{"role": "user", "content": "What does `BPZ2.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Two zero fixed midpass. Arguments: in — The input signal.."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\Mirror;\n~description = \"Mirror soundfield\";\n\n~function = {|in = 0, order = 1, mirrorFrontBack = 0, mirrorLeftRight = 0, mirrorUpDown = 0 |\nHOATransMirror.ar(order, in, mirrorFrontBack, mirrorLeftRight, mirrorUpDown);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "What does `FoaXformerMatrix.newFocusZ` do? What arguments does it take?"}, {"role": "assistant", "content": "Apply focus along the Arguments: angle — The distortion angle, in radians. -pi/2 to pi/2."}]} -{"conversations": [{"role": "user", "content": "What does `BeatSched.tschedAbs` do? What arguments does it take?"}, {"role": "assistant", "content": "will happen at the time specified in Arguments: time; function."}]} -{"conversations": [{"role": "user", "content": "What is a SynthDef?"}, {"role": "assistant", "content": "A SynthDef is a named, compiled server-side instrument: a UGen graph plus named controls. You build one with SynthDef(\\name, { |args| ... }).add, and then play instances with Synth(\\name)."}]} -{"conversations": [{"role": "user", "content": "What is a UGen?"}, {"role": "assistant", "content": "A UGen is a unit generator: the primitive signal-processing node of the server. SinOsc, Saw, WhiteNoise, LPF and EnvGen are UGens, and they are wired into a graph inside a SynthDef."}]} -{"conversations": [{"role": "user", "content": "What does `MIDIFunc.sysex` do?"}, {"role": "assistant", "content": "A convenience method to create a new MIDIFunc which responds to MIDI system exclusive messages. See #*new for argument descriptions. The responding `func` will be passed the arguments data (an Int8Array) and Returns: A new instance of MIDIFunc which responds to MIDI system exclusive messages."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ LorenzTrig.ar(11025, 44100) }.play(s);\n\n// randomly modulate params\n(\n{ LorenzTrig.ar(\n 11025, 44100,\n LFNoise0.kr(1, 2, 10),\n 20,\n LFNoise0.kr(1, 1.5, 2),\n 0.02\n) * 0.2 }.play(s);\n)\n\n// as a frequency control\n{ SinOsc.ar(Decay.ar(LorenzTrig.ar(1, 8, h:0.02))*800+900)*0.4 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ LorenzTrig.ar(11025, 44100) }.play(s);\n\n// randomly modulate params\n(\n{ LorenzTrig.ar(\n 11025, 44100,\n LFNoise0.kr(1, 2, 10),\n 20,\n LFNoise0.kr(1, 1.5, 2),\n 0.02\n) * 0.2 }.play(s);\n)\n\n// as a frequency control\n{ SinOsc.ar(Decay.ar(LorenzTrig.ar(1, 8, h:0.02))*800+900)*0.4 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "How do I add a reverb send to a whole group?"}, {"role": "assistant", "content": "Same shape as the delay: a private stereo bus, one effect reading it, instruments writing both dry\nand wet.\n\n```supercollider\n(\n~verbBus = Bus.audio(s, 2);\nSynthDef(\\verb, { |in = 0, out = 0, room = 0.85, mix = 0.5|\n Out.ar(out, FreeVerb.ar(In.ar(in, 2), mix, room, 0.5) * 0.7);\n}).add;\nSynthDef(\\blip, { |out = 0, send = 0, freq = 440, amp = 0.1|\n var env = EnvGen.kr(Env.perc(0.002, 0.4), doneAction: 2);\n var sig = SinOsc.ar(freq) * env * amp;\n Out.ar(out, sig);\n Out.ar(send, sig);\n}).add;\n);\nSynth(\\verb, [\\in, ~verbBus]);\nPbind(\\instrument, \\blip, \\send, ~verbBus, \\degree, Pseq([0, 4, 7, 11], inf), \\dur, 0.25).play;\n```"}]} {"conversations": [{"role": "user", "content": "How to know the hardware buffer size?"}, {"role": "assistant", "content": "SuperCollider forum — How to know the hardware buffer size\n\nSay you want to use a UGen to control an external hardware device, independently of the soundcard. At first, one would think that this calculation is time-locked to the control rate, so e.g. at 1.5 kHz for a 48 kHz sample rate and a block size of 32.\n\nBut no, of course this calculation is time-locked to the hardware buffer size (I/O buffer size) of the soundcard you happen to use. EDIT: For a typical (low) setting, this is something like 256, so that would be about 190 Hz (5 ms). This may be too much delay for some applications, so we may want a smaller buffer size.\n\nIn scsynth, we can set a value for this size via ServerOptions:\n\n```supercollider\n // reduce to block size\ns.options.hardwareBufferSize = s.options.blockSize;\ns.reboot;\n```\n\nUnfortunately, not all soundcards support low block sizes. Also high quality sound cards may have very large ones, actually – this is a cultural thing, when you use them for recording, it is not a problem. But for live I/O it introduces delay (a quarter second is like an eternity then).\n\nSo now my question: how do I know if the above setting has been actually successful? How do I know what buffer size is current?\n\nI am sure that on different OSes there are ways to derive this in different ways. Maybe there is a way in supercollider as well?"}]} -{"conversations": [{"role": "user", "content": "How do I make a delay line?"}, {"role": "assistant", "content": "`CombN.ar(in, maxdelaytime, delaytime, decaytime)` is a feedback delay: maxdelaytime is the buffer size, delaytime the actual delay (and it can modulate), decaytime how long the repeats take to die. For a clean single echo use `DelayN.ar(in, maxdelaytime, delaytime)`, which has no feedback. Both replace the `in` with the delayed signal, so mix with the dry: `dry + CombN.ar(dry, 0.5, 0.3, 2) * 0.4`."}]} -{"conversations": [{"role": "user", "content": "What is the difference between .ar, .kr and .ir?"}, {"role": "assistant", "content": "The rate method decides how often a UGen is evaluated. `.ar` runs at the audio rate, once per sample, and produces an audio signal. `.kr` runs at the control rate, once per block of 64 samples by default, so it is cheaper and is used for parameters that do not need sample accuracy. `.ir` is evaluated once when the Synth is created and then never again, for constants such as SampleRate.ir or a size. Using .kr where you need audio-rate modulation gives stepped, zipper-noise-like control; using .ar where .kr would do costs CPU."}]} -{"conversations": [{"role": "user", "content": "What does `TextView.defaultGetDrag` do?"}, {"role": "assistant", "content": "A view displaying editable formatted text Returns: The #-selectedString."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for smooth arpeggio, updated envelope (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\bass, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.perc(0.2), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PV_Mul`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n(\nSynthDef(\"help-mul\", { |out = 0|\n var inA, chainA, inB, chainB, chain ;\n inA = SinOsc.ar(500, 0, 0.5);\n inB = SinOsc.ar(Line.kr(100, 400, 5), 0, 0.5);\n chainA = FFT(LocalBuf(2048), inA);\n chainB = FFT(LocalBuf(2048), inB);\n chain = PV_Mul(chainA, chainB);\n Out.ar(out, 0.1 * IFFT(chain).dup);\n}).play(s);\ns.scope;\n);\n\n(\nSynthDef(\"help-mul2\", { |out = 0|\n var inA, chainA, inB, chainB, chain ;\n inA = SinOsc.ar(500, 0, 0.5) * Line.kr;\n inB = LFNoise1.ar(20);\n chainA = FFT(LocalBuf(2048), inA);\n chainB = FFT(LocalBuf(2048), inB);\n chain = PV_Mul(chainA, chainB);\n Out.ar(out, 0.1 * IFFT(chain).dup);\n}).play(s);\ns.scope;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Function.r` do?"}, {"role": "assistant", "content": "Returns a Routine using this as its func argument. `a = r { 5.do { |i| i.rand.yield }"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `FBSineC`."}, {"role": "assistant", "content": "```supercollider\n// default initial params\n{ FBSineC.ar(SampleRate.ir/4) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `XFade2`."}, {"role": "assistant", "content": "```supercollider\n{ XFade2.ar(Saw.ar, SinOsc.ar, LFTri.kr(0.1)) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n// Three nodes in this data. First is always the root.\n// So the first is applied to decide whether to branch down to the second or third.\n// Then those nodes decide whether to classify the datum as 1/2/3/4.\n~treedata = [\n/* xoff,yoff, xvec,yvec, lisl, risl */\n [0.5, 0.5, -0.7, 0.4, 0, 0], // this is the root node, its number is 1\n [0.3, 0.7, 0.4, 0.7, 1, 1], // this one's number is 2\n [0.5, 0.2, -0.8,-0.8, 1, 1] // this one's number is 3\n];\n)\n```"}, {"role": "assistant", "content": "Three nodes in this data. First is always the root. So the first is applied to decide whether to branch down to the second or third. (PlaneTree: Tree classifier using (hyper)planes – UGen or language-side)"}]} +{"conversations": [{"role": "user", "content": "What does `MassEditUChain.prepareAndStart` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: target — (describe argument here); loadDef — (describe argument here). Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "What is `FoaPushZ` in SuperCollider?"}, {"role": "assistant", "content": "FoaPushZ — First Order Ambisonic (FOA) push transformer Apply push to a First Order Ambisonic signal (B-format) along the z-axis. Category: Libraries > Ambisonic Toolkit > UGens > FOA > Transformer, UGens > Multichannel > Ambisonics."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Latch`."}, {"role": "assistant", "content": "```supercollider\n{ Blip.ar(Latch.ar(WhiteNoise.ar, Impulse.ar(9)) * 400 + 500, 4, 0.2) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `EnvelopeView.colors` do?"}, {"role": "assistant", "content": "Sets the #-strokeColor and the #-fillColor to the arguments,"}]} +{"conversations": [{"role": "user", "content": "What does `AbstractGridLines.getParams` do? What arguments does it take?"}, {"role": "assistant", "content": "Specifically for use by DrawGrid. This returns a Dictionary with keys: `'lines'`, an array of values where lines should be drawn, and `'labels'`, an array of 2-element arrays `[value, \"formatted label\"]` for each line. Note that the highest and lowest values returned don't necessarily contain your valueMin and valueMax, but rather represent the values where grid lines will be drawn by `DrawGrid` (endcap lines are subsequently drawn at the data/grid Arguments: valueMin — Minimum value of the data to be plotted. The lowest grid line value returned may be higher than this value.; valueMax — Maximum value of the data to be plotted. The highest grid line value returned may be lower than this value.; pixelMin — Lower bound of the grid's range, in pixels. Used to calculate the size of the available grid space when determining grid values based on tickSpacing (if numTicks is `nil`).; pixelMax — Upper bound of the grid's range, in pixels. Used to calculate the size of the available grid space when determining grid values based on tickSpacing (if numTicks is `nil`).; numTicks — Explicit number of ticks you would like to see on the graph (though the result is approximate). Set to `nil` if you'd like the number of ticks to be found automatically, based on pixelMin, pixelMax, and tickSpacing.; tickSpacing — Minimum distance between ticks (in pixels). This value is only used when numTicks is `nil`.. Returns: A Dictionary."}]} +{"conversations": [{"role": "user", "content": "What does `Wrap.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Wrap a signal outside given thresholds. Arguments: in — Signal to be wrapped.; lo — Low threshold of wrapping.; hi — High threshold of wrapping.."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `CombN`."}, {"role": "assistant", "content": "```supercollider\n// These examples compare the variants, so that you can hear the difference in interpolation\n\n// Comb used as a resonator. The resonant fundamental is equal to\n// reciprocal of the delay time.\n{ CombN.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ CombL.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ CombC.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// with negative feedback:\n{ CombN.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ CombL.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ CombC.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n// used as an echo.\n{ CombN.ar(Decay.ar(Dust.ar(1, 0.5), 0.2, WhiteNoise.ar), 0.2, 0.2, 3) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Do is not ¨returning¨ array (campanology)?"}, {"role": "assistant", "content": "SuperCollider forum — Do is not ̈returning ̈ array (campanology)\n\nYou can remove the need for all mutable variables by computing the indexes to swap first - these are stored in indexesEven and indexesOdd.\n\nThen an array of functions is made (swappers)...i.e.[indexesEven, indexesOdd, indexesEven....]\n\nFinally, .inject is used to chain these together, taking the previous result as the input to the next and building an array.\n\n```supercollider\n(\n~swap_sort_steps = {\n |parts|\n var swapConsequtiveIndexes = {|from, to|\n (from..to).clump(2).collect{|p| p.reverse }.flat\n };\n var indexesEven = swapConsequtiveIndexes.(0, parts - 1);\n var indexesOdd = [0] ++ swapConsequtiveIndexes.(1, parts - 1);\n var swappers = parts.collect{ |n|\n {|toSwap| if(n.even)\n { indexesEven.collect{|i| toSwap[i]} }\n { indexesOdd.collect{|i| toSwap[i]} }\n }\n };\n postf(\"indexesEven : %\\nindexesOdd : %\\n\", indexesEven, indexesOdd);\n swappers.inject( [(0..parts-1)], {\n |col, f|\n col ++ [f.(col.last)]\n });\n};\n)\n```\n\nAlso, as I’m sure you know, if anyone else is reading who doesn’t know what this is... its a swap sort algorithm."}]} +{"conversations": [{"role": "user", "content": "What does `Canvas3D.mScale` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a matrix for Arguments: sX — X scaling; sY — Y scaling; sZ — Z scaling."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `MulAdd`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n// The mul and add arguments of SinOsc themselves use MulAdd!\n// These two examples will create precisely the same synth graph:\nx = { SinOsc.ar(440, 0, 0.1, 0.05) }.play(s);\nx.trace; // You should see a \"MulAdd\" in the trace\nx.free;\n\nx = { MulAdd(SinOsc.ar(440, 0), 0.1, 0.05) }.play(s);\nx.trace;\nx.free;\n\n// In fact this will produce the same graph too - the separate multiply and add are optimised into one MulAdd\nx = { SinOsc.ar(440, 0) * 0.1 + 0.05 }.play(s);\nx.trace;\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n+ String {\n decodeHex {\n var new = String.new, stream = CollStream(this), ch, int;\n while {\n ch = stream.next;\n ch.notNil\n } {\n if(ch == $%) {\n ch = stream.next;\n if(ch.notNil) {\n int = ch.digit << 4;\n } {\n // If the string ends with %, then 'ch' after that is nil\n // so we can just append the %\n ^new.add($%);\n };\n ch = stream.next;\n if(ch.notNil) {\n ch = (int + ch.digit).asAscii;\n } {\n // If we got this far, we know there was one (only one) char after %\n // so add them both\n ^new.add($%).add(this.last);\n };\n };\n new = new.add(ch);\n };\n ^new\n }\n}\n```"}, {"role": "assistant", "content": "A quick utility function for decoding UTF-8 characters in %hex codes (such as for web URLs). Save the code into a .sc file in your Extensions/ directory, recompile, and then:\r\n\r\n\"%E5%A4%A7%E5%AE%B6%E5%A5%BD\".decodeHex;\r\n-> 大家好\r\n\r\nThis probably works only for UTF-8. SC can save the individual bytes of Unicode characters into String objects, and the IDE will print UTF-8 code points correctly, but th."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `WrapIndex`."}, {"role": "assistant", "content": "```supercollider\n// indexing into a table\n(\n{\n var buf = LocalBuf.newFrom([200, 300, 400, 500, 600, 800]);\n var freq = WrapIndex.kr(buf, MouseX.kr(0, BufFrames.ir(buf) * 3));\n SinOsc.ar(freq) * 0.1\n}.play;\n);\n\n// the same using a global buffer\n(\nt = [200, 300, 400, 500, 600, 800];\nb = Buffer(s, t.size, 1);\n\n// alloc and set the values\ns.listSendMsg(b.allocMsg(b.setnMsg(0, t)).postln);\n\nSynthDef(\\help_Index, { |out = 0, bufnum = 0|\n Out.ar(out,\n SinOsc.ar(\n WrapIndex.kr(\n bufnum,\n MouseX.kr(0, BufFrames.ir(bufnum) * 3)\n ),\n 0,\n 0.5\n )\n )\n}).play(s, [\\bufnum, b.bufnum]);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a snare drum in SuperCollider."}, {"role": "assistant", "content": "Two ingredients: a short tonal body and band-passed noise for the rattle.\n\n```supercollider\n(\nSynthDef(\\snare, { |out = 0, amp = 0.6|\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -6), doneAction: 2);\n var body = SinOsc.ar(180) * 0.4;\n var rattle = BPF.ar(WhiteNoise.ar, 1800, 0.4) * 3;\n Out.ar(out, Pan2.ar((body + rattle) * env * amp));\n}).add;\n);\nSynth(\\snare);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nb = BSpline([ [ 0.0, 0.0 ], [ 0.28177966101695, 0.27 ], [ 0.77118644067797, 0.932 ], [ 0.89618644067797, 0.424 ], [ 1.0, 0.132 ] ], 4.0, false);\nb.gui(nil,500@500,\\unipolar,\\unipolar);\n);\n\n// in case you want to print a spline to save it\nb.asCompileString\n\n(\n{\n PinkNoise.ar * SplineMapper(b).kr( MouseX.kr(0,1),32 )\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nb = BSpline([ [ 0.0, 0.0 ], [ 0.28177966101695, 0.27 ], [ 0.77118644067797, 0.932 ], [ 0.89618644067797, 0.424 ], [ 1.0, 0.132 ] ], 4.0, false);\nb.gui(nil,500@500,\\unipolar,\\unipolar);\n);\n\n// in case you want to print a spline to save it\nb.asCompileString\n\n(\n{\n PinkNoise.ar * SplineMapper(b).kr( MouseX.kr(0,1),32 )\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Synth`?"}, {"role": "assistant", "content": "Synth — Client-side representation of a synth node on the server"}, {"role": "user", "content": "What does `Synth.new` do?"}, {"role": "assistant", "content": "Create and return a new Synth object, and immediately start the corresponding synth node on the server."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n// create a Synth at the head of the default Server's default group\n// based on the SynthDef \"default\"\nx = Synth.new(\"default\");\ns.queryAllNodes; // note the default group (ID 1)\nx.free;\n\n// Using an arrayed control\n// run this block first to make the SynthDef\n(\nSynthDef(\"help-synth\", { |freq = #[440, 450, 460], out = 0|\n Out.ar(out, Mix(SinOsc.ar(freq, 0, 0.1)));\n}).add;\n);\n\n// then this a short while later\nx = Synth(\"help-synth\", [freq: [500, 501, 510]]);\n\nx = Synth(\"help-synth\", [freq: [500, 501, 510]]);\nx.set(\\freq, [1, 2, 3] * 400 + [1, 2, 3], \\out, 1);\nx.set(\\freq, [3] * 400 + [1, 2, 3], \\out, 1);\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar synth = { Out.ar(99, SinOsc.ar([300, 700])) }.play;\n{ In.ar(99, 2) }.plot(0.02, synth);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar synth = { Out.ar(99, SinOsc.ar([300, 700])) }.play;\n{ In.ar(99, 2) }.plot(0.02, synth);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `RedVector` in SuperCollider?"}, {"role": "assistant", "content": "RedVector — a vector of any dimension Category: Red > redUniverse."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `InFeedback`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-InFeedback\", { |out = 0, in = 0|\n Out.ar(out,\n InFeedback.ar(in, 1)\n );\n}).add;\nSynthDef(\"help-SinOsc\", { |out = 0, freq = 440|\n Out.ar(out, SinOsc.ar(freq, 0, 0.1))\n}).add;\n);\n\nx = Bus.audio(s, 1);\n\n// read from bus n play to bus 0 (silent)\na = Synth(\"help-InFeedback\", [\\in, x.index, \\out, 0]);\n\n// now play a synth after this one, playing to bus x\nb = Synth.after(a, \"help-SinOsc\", [\\out, x.index]);\n\n// add another synth before a which also writes to bus x\n// now you can't hear b, as its data is one cycle old, and is overwritten by c\nc = Synth.before(a, \"help-SinOsc\", [\\out, x.index, \\freq, 800]);\n\n// free c and you can hear b again\nc.free;\nx.free;\n\na.free; b.free;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n NLFiltN.ar(\n LFSaw.ar([120, 180], 0, mul:0.1),\n 0.5,\n -0.04,\n 0.8,\n 0.2,\n LFCub.kr(0.2, [0, 0.5 * pi], 63, 103)\n )\n}.play\n);\n\n(\n{\n NLFiltN.ar(\n LFSaw.ar(XLine.kr([60, 90], [360, 540], 20), 0, mul:0.1),\n 0.0,\n 0.0,\n 0.7,\n 0.4,\n LFCub.kr(0.2, [0, 0.5 * pi], 3, 9)\n )\n}.play\n);\n\n(\n// internal mirroring keeps it from blowing up and makes for some gross distortion\n// this is\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n NLFiltN.ar(\n LFSaw.ar([120, 180], 0, mul:0.1),\n 0.5,\n -0.04,\n 0.8,\n 0.2,\n LFCub.kr(0.2, [0, 0.5 * pi], 63, 103)\n )\n}.play\n);\n\n(\n{\n NLFiltN.ar(\n LFSaw.ar(XLine.kr([60, 90], [360, 540], 20), 0, mul:0.1),\n 0.0,\n 0.0,\n 0.7,\n 0.4,\n LFCub.kr(0.2, [0, 0.5 * pi], 3, 9)\n )\n}.play\n);\n\n(\n// internal mirroring keeps it from blowing up and makes for some gross distortion\n// this is a little loud\n{\n NLFiltN.ar(\n LFPulse.ar([100, 150], mul:0.1),\n LFNoise2.kr(1).range(0.3, 0.5),\n 0.2,\n 0.7,\n 0.4,\n LFCub.kr(0.2, [0, 0.5 * pi], 100, 400)\n )\n}.play\n);\n\n(\n{\n NLFiltN.ar(\n LFPulse.ar([100, 150], mul:0.1),\n 0.35,\n -0.3,\n 0.95,\n 0.2,\n LFCub.kr(0.2, [0, 0.5 * pi], 50, 100)\n )\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Fb1_ODE` in SuperCollider?"}, {"role": "assistant", "content": "Fb1_ODE — general ordinary differential equation integrator pseudo ugen Pseudo ugen for integrating / audifying ordinary (systems of) differential equations with initial values in realtime, based on the Fb1 single sample feedback class. It makes use of Fb1_ODEdef and Fb1_ODEintdef, containers for ODEs and numerical solution methods, which provide an interface for adding new ODE systems or integration methods interactively. There exists a huge number of ODE models in d Category: Libraries > miSCellaneous > Nonlinear."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Add two UGens\n{ SinOsc.ar(440, 0, 0.2) + PinkNoise.ar(0.1; }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Add two UGens\n{ SinOsc.ar(440, 0, 0.2) + PinkNoise.ar(0.1); }.play\n```"}]} +{"conversations": [{"role": "user", "content": "What is rq in BPF.ar?"}, {"role": "assistant", "content": "rq is the reciprocal of Q, so it is a bandwidth control, not a Q control. Small rq means a narrow, resonant band; large rq means a wide, gentle one. The signature is `BPF.ar(in, freq, rq, mul, add)`. A common idiom is `rq = 0.3` for a broad sweep and `rq = 0.02` for a whistle. The same rq convention applies to RLPF and RHPF."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, gate = 1|\n var env;\n env = EnvGen.kr(Env.asr(0.001, 1, 0.2), gate, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain, \\freq, 440);\nb = Padd(\\freq, Pseq([10, 30, 100], inf), a);\nb.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, gate = 1|\n var env;\n env = EnvGen.kr(Env.asr(0.001, 1, 0.2), gate, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain, \\freq, 440);\nb = Padd(\\freq, Pseq([10, 30, 100], inf), a);\nb.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `PV_MagGate` in SuperCollider briefly."}, {"role": "assistant", "content": "PV_MagGate — reduces magnitudes above or below thresh For positive values of thresh, acts something like a noise reduction. For negative values, highlights smaller sounds. Category: UGens > FFT."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SortedList`."}, {"role": "assistant", "content": "```supercollider\nt = SortedList.new(8, {|a,b| a.first < b.first });\nt.add([10, \"last\"]);\nt.add([1, \"first\"]);\nt.postln;\n```"}]} {"conversations": [{"role": "user", "content": "Supernova, Groups, Threads, Ndef?"}, {"role": "assistant", "content": "SuperCollider forum — Supernova, Groups, Threads, Ndef?\n\nAbout Ndef:\n\nAFAIK you can manually move a NodeProxy’s group into another group:\n\n```supercollider\n~pargroup = ParGroup(s);\n\nNdef(\\a, { Silent.ar(1) });\n\nNdef(\\a).group.moveToHead(~pargroup);\n```\n\nBut...\n\nNodeProxies use InFeedback.\n\nI was a little suspicious about this for parallel processing. As I recalled, InFeedback’s result depends on the order of execution:\n\n-\nIf the source node for the bus finished processing before the server reaches InFeedback, then InFeedback will output the block of audio being processed now.\n\n-\nIf the source node comes after the node containing InFeedback, then it will output the previous block of audio.\n\nIn both cases, these are the most recently available audio blocks. But, if the order of evaluation is not consistent, then the output may not be consistent.\n\nLet’s test that:\n\n```supercollider\nb = Bus.audio(s, 1);\n\na = { SinOsc.ar(200, 0, 0.1) }.play(outbus: b);\n\nc = { InFeedback.ar(b, 1).dup }.play(target: a, addAction: \\addAfter);\n\n(\nfork {\n var order = Pseq([\\moveBefore, \\moveAfter], inf).asStream;\n loop {\n c.perform(order.next, a);\n 1.0.wait;\n }\n}\n)\n```\n\nOops.\n\nThis means you can’t randomly throw Ndefs into ParGroups. If one Ndef reads a signal from another, then you have to make sure that the target Ndef comes later in a serial (regular) Group. (Correctness of the result should be more important than “optimal” usage of multiple cores.)\n\nIf you don’t, and if supernova happens to put the source and target Ndefs onto separate cores at roughly the same time, then the target might evaluate InFeedback either before or after the source finishes, and there’s no guarantee of this being consistent. So you might get clicks.\n\nhjh"}]} -{"conversations": [{"role": "user", "content": "Why LeakDC and not a standard HPF for DC removal?"}, {"role": "assistant", "content": "SuperCollider forum — Why LeakDC and not a standard HPF for DC removal?\n\nHello everyone,\n\nI’m a bit sceptical of the DC removal implementation in LeakDC. As I understand it, DC removal is nothing but a HPF, preferably placed below the audible range. For this purpose, LeakDC seems to be reaching far too high, attenuating the audible low frequencies. You can run the following code and look at the server meter to see the difference in level between the two audio channels (note: there is of course no DC offset in this example that would need fixing):\n\n```supercollider\n( play { [\n SinOsc.ar(50),\n LeakDC.ar(SinOsc.ar(50))\n] * 0.2 } )\n```\n\nAlso, LeakDC’s behaviour is not consistent between sample rates (as is mentioned in the help file).\n\nI ran the it through Plugin Doctor to back up my suspicions and got these results:\n\nstandard coefficient of 0.995:\n\nSR 48 kHz: Filter starts rolling off at 200 Hz, -2dB at 50 Hz.\n\nSR 96 kHz: Filter starts rolling off at 500 hz! It reaches already -2dB at 100 Hz, -5 dB at 50 Hz.\n\ncoefficient of 0.999:\n\nSR 48 kHz: Filter starts rolling off at 50 Hz, -2 dB at 10 Hz.\n\nSR 96 kHz: Filter starts rolling off at 100 Hz, -2 dB at 20 Hz.\n\nI wonder why one wouldn’t just use a standard HPF at 10 Hz (or so) instead? It is consistent between sample rates, it only starts to roll of below 30 Hz and it reaches only -0.5 dB at 20 Hz. So this actually looks much better in the server meter:\n\n```supercollider\n( play { [\n SinOsc.ar(50),\n HPF.ar(SinOsc.ar(50), 10)\n] * 0.2 } )\n```\n\nSo my question is: Is there any reason why the LeakDC implementation would be peferable to such a standard butterworth HPF?\n\nOne difference I can see is that the HPF still has an initial offset spike before settling around zero phase, LeakDC does not show that behaviour:\n\n```supercollider\n{ LeakDC.ar(DC.ar(0.5)) }.plot(0.5);\n{ HPF.ar(DC.ar(0.5), 10) }.plot(0.5);\n\n{ LeakDC.ar(SinOsc.ar + DC.ar(0.5)) }.plot(0.02);\n{ HPF.ar(SinOsc.ar + DC.ar(0.5), 10) }.plot(0.02);\n```\n\nSo this could be a reason – I don’t know enough about filters to understand why this happens though. Any enlightenment would be appreciated."}]} -{"conversations": [{"role": "user", "content": "What does `PlayerSocket.new` do? What arguments does it take?"}, {"role": "assistant", "content": "a player that can play other players using a cross-faded and fuse-protected socket Arguments: rate — all players should be the same rate; numChannels — all players should have the same numChannels.; round — if calling qspawnPlayer this is the timing quantization setting; env — the Envelope for the internal EnvelopedPlayer."}]} -{"conversations": [{"role": "user", "content": "Explain `NumberBox` in SuperCollider briefly."}, {"role": "assistant", "content": "NumberBox — A view displaying a modifiable numerical value. A view that displays a numerical value and allows to modify it by typing the value in, and incrementing or decrementing it using the keyboard, or mouse. Category: GUI > Views."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n//MUST be a buffer with data in format [sizeofcurrentsieve,sieveentry1,sieveentry2,...] where currentsize always less than initially allocated buffer length -1. \n\n{ Sieve1.ar(LocalBuf.newFrom([10]++({0.75.rand}!10)),MouseX.kr(2,100))*0.2}.play\n\n{ Sieve1.ar(LocalBuf.newFrom([88]++({[0.1.rand,0.5.rand].wchoose([0.8,0.2])}!88)),MouseX.kr(1,100))*0.2}.play\n\nb = Buffer.alloc(s,300); \n\nb.setn(0, [88]++({[0.1.rand,0.5.rand]\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n//MUST be a buffer with data in format [sizeofcurrentsieve,sieveentry1,sieveentry2,...] where currentsize always less than initially allocated buffer length -1. \n\n{ Sieve1.ar(LocalBuf.newFrom([10]++({0.75.rand}!10)),MouseX.kr(2,100))*0.2}.play\n\n{ Sieve1.ar(LocalBuf.newFrom([88]++({[0.1.rand,0.5.rand].wchoose([0.8,0.2])}!88)),MouseX.kr(1,100))*0.2}.play\n\nb = Buffer.alloc(s,300); \n\nb.setn(0, [88]++({[0.1.rand,0.5.rand].wchoose([0.8,0.2])}!88))\n\n{ Sieve1.ar(b,MouseX.kr(2,100),0)*0.2}.play\n\n//dynamically swap buffer\nb.setn(0, [8]++(1.0!8))\n\nb.setn(0, [8]++({rrand(0.1,1.0)}!8))\n\nb.setn(0, [18]++({[0.0,1.0].choose}!18))\n\nb.setn(0, [188]++({[0.0,rrand(0.96,1.0)].wchoose([0.3,0.7])}!188))\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Band-limited hard sync oscillator."}, {"role": "assistant", "content": "```supercollider\n(\n~syncSaw = {\n arg syncFreq=440, sawFreq=440, maxRatio=20, minFreq = 10;\n var maxDelay = 1/minFreq;\n var n = floor(maxRatio);\n var b = LocalBuf(Server.default.sampleRate*maxDelay ,1).clear;\n var baseWaveform = Saw.ar(syncFreq);\n var sig = 0;\n n.do {\n arg i;\n var delay = i/sawFreq;\n var amplitude = (sawFreq/syncFreq-i) min: 1 max: 0;\n sig = sig + (BufDelayL.ar(b,baseWaveform,delay)*amplitude);\n };\n sig;\n};\n);\n\n(\n// test it\nplay {~syncSaw.(100,MouseX.kr.range(100,2000).lag)!2}\n);\n\n(\n// compare with aliased version\nplay {SyncSaw.ar(100,MouseX.kr.range(100,2000).lag)!2}\n);\n\n\n(\n// audio rate modulation of sawFreq results in a waveform that's not strictly\n// correct, but sounds good.\nplay {~syncSaw.(MouseY.kr(50,200),MouseX.kr.range(100,2000).lag+SinOsc.ar(20,mul:150))!2}\n// (audio rate modulation of syncFreq doesn't really work.)\n);\n\n(\n// aliased version of the above\nplay {SyncSaw.ar(MouseY.kr(50,200),MouseX.kr.range(100,2000).lag+SinOsc.ar(20,mul:150))!2}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "I get 'index out of range' when playing a buffer."}, {"role": "assistant", "content": "A read position is past the end of the buffer. `PlayBuf` with a `startPos` in frames beyond `~buf.numFrames`, or a `BufRd`/`GrainBuf` whose phase goes above 1, produces this. For GrainBuf, pos is normalised 0..1, so pass `LFNoise1.kr(1).range(0, 1)` rather than a frame count; for PlayBuf, cap the position at `~buf.numFrames - 1`. If you just loaded the file, check `~buf.numFrames` — a failed read gives 0 frames and every position is out of range."}]} -{"conversations": [{"role": "user", "content": "What is `UnaryOpUGen`?"}, {"role": "assistant", "content": "UnaryOpUGen — Apply a unary operation to the values of an input ugen"}, {"role": "user", "content": "What does `UnaryOpUGen.new` do?"}, {"role": "assistant", "content": "return a new instance that applies the operator `selector` to the ugen `a`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na = WhiteNoise.ar; // a WhiteNoise\nb = a.squared; // a UnaryOpUGen.\nb.operator; // squared\n\n// sound example\n\n{ var a = LFSaw.ar(300).range(0, 2pi); a.sin * 0.1 }.play;\n\n// Plotting the \"abs\" unary operator (via the server):\n\n{ SinOsc.ar(300).abs }.plot\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SynthDesc.controls` do?"}, {"role": "assistant", "content": "Description of a synth definition Returns: an array of instances of ControlName, each of which have the following fields: name, index, rate, defaultValue"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// set() creates a local environment that overrides the outer currentEnvironment\n\nPdefn(\\z).set(\\a, 1, \\b, 5);\n(\nPdefn(\\z, { |e|\n loop { yield((e.a + e.b) + 0.1.rand.round(0.01)) }\n})\n); // [1]\n\nt = Pdefn(\\z).asStream;\n\nt.nextN(3);\n\n(\nPdefn(\\z, { |e|\n // (e.a + e.b) + 0.1.rand.round(0.01) 1\n Pseq([1, 2, e.a], 1)\n})\n);\n\nPdefn(\\z, Pseq([1, 2, 3], 1));\n\ne = Pdefn(\\z).envir\n\n\nPdefn(\\z).set(\\a, 3);\n\nt.next\n// …\n```"}, {"role": "assistant", "content": "set() creates a local environment that overrides the outer currentEnvironment (e.a + e.b) + 0.1.rand.round(0.01) 1 (Pdefn: non event stream reference definition)"}]} -{"conversations": [{"role": "user", "content": "What are you not good at?"}, {"role": "assistant", "content": "Everything outside SuperCollider. I have no audio input, no live data, and my knowledge ends at the documentation snapshot I was trained on — so I can be confidently wrong about Quarks and new UGens."}]} -{"conversations": [{"role": "user", "content": "What is `TaskProxy` in SuperCollider?"}, {"role": "assistant", "content": "TaskProxy — event stream reference Keeps a reference to a task (time pattern) that can be replaced while playing. It plays on when the old stream ended and a new stream is set and schedules the changes to the beat. Category: JITLib > Patterns, Live Coding."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ProxySpace`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\np = ProxySpace.new;\np.fadeTime = 2; // fadeTime specifies crossfade\np[\\out].play; // monitor an empty placeholder through hardware output\n// set its source\np[\\out] = { SinOsc.ar([350, 351.3], 0, 0.2) };\np[\\out] = { Pulse.ar([350, 351.3] / 4, 0.4) * 0.2 };\np[\\out] = Pbind(\\dur, 0.03, \\freq, Pbrown(0, 1, 0.1, inf).linexp(0, 1, 200, 350));\n\n// route one proxy through another:\np[\\out] = { Ringz.ar(p[\\in].ar, [350, 351.3] * 8, 0.2) * 4 };\np[\\in] = { Impulse.ar([5, 7]/2, [0, 0.5]) };\n\np.clear(3); // clear after 3 seconds\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Server.volume` do?"}, {"role": "assistant", "content": "Get an instance of Volume that runs after the default group, or sets the Volume of the Server's output to level. Level is in"}]} -{"conversations": [{"role": "user", "content": "What does `Group.addReplaceMsg` do?"}, {"role": "assistant", "content": "Returns a message of the type g_new which can be bundled. When sent to the server this message will instantiate this group, replacing nodeToReplace in the server's node"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LeastChange`."}, {"role": "assistant", "content": "```supercollider\n(\nd = { |freq = 440|\n var internalFreq;\n internalFreq = LFNoise0.ar(0.3, 300, 800);\n SinOsc.ar(\n LeastChange.kr(freq, internalFreq) // two sources of change: one external, one internal\n ) * 0.1\n}.play\n);\n\nd.set(\\freq, 800);\nd.set(\\freq, 900);\nd.free;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// It might also be desirable to start with a fade from silence.\n// This can be done with a negative initOutOffset:\n\n(\nx = {\n var lfo = XLine.ar(1, 0.5, 60);\n DXMix.ar(\n Dseq([0, 4, 1, 5, 2, 6, 3, 7], inf),\n `(Saw.ar((1..8) * 70 * lfo, 0.075)),\n fadeTime: 2,\n width: 2,\n initOutOffset: -1\n ) ! 2\n}.play\n;\n\nx.release\n\n\n// overlap scheme with width = 2 and initOutOffset = -1:\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// It might also be desirable to start with a fade from silence.\n// This can be done with a negative initOutOffset:\n\n(\nx = {\n var lfo = XLine.ar(1, 0.5, 60);\n DXMix.ar(\n Dseq([0, 4, 1, 5, 2, 6, 3, 7], inf),\n `(Saw.ar((1..8) * 70 * lfo, 0.075)),\n fadeTime: 2,\n width: 2,\n initOutOffset: -1\n ) ! 2\n}.play\n);\n\nx.release\n\n\n// overlap scheme with width = 2 and initOutOffset = -1:\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Josh Parmenter (2007) record scratcher?"}, {"role": "assistant", "content": "```supercollider\n// Josh Parmenter (2007)\n// record scratcher\n\nSynthDef(\\scratch, {arg gate = 1, buffer;\n var buf, speed, env;\n env = EnvGen.kr(\n Env([0,1,0], [0.1, 0.1], \\sin, 1),\n gate, doneAction: 20);\n speed = MouseX.kr(-10, 10);\n speed = speed - DelayN.kr(speed, 0.1, 0.1);\n speed = MouseButton.kr(1, 0, 0.3) + speed ;\n buf = PlayBuf.ar(1, buffer, speed * BufRateScale.kr(buffer), loop: 1);\n Out.ar(0, (buf * env).dup );\n}).add;\n\ns.boot;\n\n// path to a mono soundfile here\na = Buffer.read(s, ExampleFiles.child);\n\nb = Synth(\\scratch, [\\buffer, a]);\n\n// move mouse to scrub the record.\n// press mouse button to 'stop the record', you can scrub while it is stopped.\n\n// stop the synth\nb.set(\\gate, 0);\n// free the Buffer\na.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// ============================\n// extra demos for \\waveguideFlute\n// ============================\n\n\n(\n// Made by Meha Gupta\n// Inspired by The Village by Wrabel\nPbindef(\\dmwaveguideFlute,\n \\instrument, \"waveguideFlute\",\n \\midinote, Pseq([57, 60,\n [46, 62], [53, 62], [58, 62], [58, 64], [58, 62], [58, 60],\n [50, 57], [50, 57], [50, 57], [50, 60], [50, 57], [50, 53],\n [53, 55], [53, 55], [53, 55], [53, 57], [53, 55], [41, 53], 52]),\n \\amp, 0.3,\n \\dur, Pseq([0.25, 0.25, 0.5, 0.5, 0.25, 0.25, 0.25, 0.25,\n 0.5, 0.5, 0.25, 0.25, 0.25, 0.25,\n 0.5, 0.5, 0.25, 0.25, 0.25, 0.25, 1]),\n).play;\n)\n```"}, {"role": "assistant", "content": "============================ extra demos for \\waveguideFlute ============================."}]} -{"conversations": [{"role": "user", "content": "What does `AbstractFunction.even` do?"}, {"role": "assistant", "content": "An object which responds to a set of messages that represent mathematical functions"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// (thor magnusson) (2006)\n\n// An instrumentalist inside a synthdef.\n\n(\nSynthDef(\\drummer, { arg out=0, tempo=4;\n var snare, base, hihat;\n tempo = Impulse.ar(tempo); // for a drunk drummer replace Impulse with Dust !!!\n\n snare = WhiteNoise.ar(Decay2.ar(PulseDivider.ar(tempo, 4, 2), 0.005, 0.5));\n base = SinOsc.ar(Line.ar(120,60, 1), 0, Decay2.ar(PulseDivider.ar(tempo, 4, 0), 0.005, 0.5));\n hihat = HPF.ar(WhiteNoise.ar(1), 10000) * Decay2.ar(tempo, 0.005, 0.5);\n\n Out.ar(out,(snare + base + hihat) * 0.4 ! 2)\n}).add;\n);\n\na = Synth(\\drummer);\na.set(\\tempo, 6);\na.set(\\tempo, 18);\na.set(\\tempo, 180); // check the CPU! no increase.\na.free;\n```"}, {"role": "assistant", "content": "(thor magnusson) (2006) An instrumentalist inside a synthdef."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// schedule for a random number of beats after the next integer\nPfuncn({ thisThread.clock.beats.debug(\"scheduled for\"); nil }, 1)\n .play(quant: (\n nextTimeOnGrid: { |self, clock|\n clock.beats.roundUp(1).debug(\"clock beats\") + rrand(self.lo, self.hi).debug(\"rand\")\n },\n lo: 0, hi: 4\n );\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// schedule for a random number of beats after the next integer\nPfuncn({ thisThread.clock.beats.debug(\"scheduled for\"); nil }, 1)\n .play(quant: (\n nextTimeOnGrid: { |self, clock|\n clock.beats.roundUp(1).debug(\"clock beats\") + rrand(self.lo, self.hi).debug(\"rand\")\n },\n lo: 0, hi: 4\n ));\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n \n// definition for future reference in arbitrary Environments\n\np = PLmeanrand(\\lo, \\hi);\n\n\n// prepare current Environment\n// PLseq repeats arg defaults to inf\n\n(\n~lo = PLseq((60, 60.25..70));\n~hi = PLseq((70, 69.75..60));\n);\n\n\n// run\n\n(\nx = Pbind(\n \\midinote, Ptuple([p, 65]), \n \\amp, [0.1, 0.06], \n \\dur, 0.1\n).play;\n);\n\n\n// replace\n\n(\n~lo = 60.5;\n~hi = 61;\n);\n\nx.st\n// …\n```"}, {"role": "assistant", "content": "definition for future reference in arbitrary Environments prepare current Environment (PLmeanrand: dynamic scope Pmeanrand variant)"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Blowing ambient with lots of reverb."}, {"role": "assistant", "content": "```supercollider\nfork{\n // notes sequence\n var seq = Pxrand([0,3,5,7,8],inf).asStream;\n loop{\n var dur = 8;\n var num = 8;\n var root = 36;\n var freq = (seq.next+root).midicps;\n var spread = rrand(0.4,0.8);\n var attack = rrand(0.05, 0.3);\n \n // play the cluster\n play{\n var harm = Array.geom(num, 1, 1.5);\n var harma = Array.geom(num, 0.5, 0.8);\n var detune = Array.fill(num, { LFNoise2.kr(1,0.01,1) });\n var source = PinkNoise.ar;\n var bandwidth = Rand(0.001,0.01);\n var generator = [\n SinOsc.ar(freq*harm*detune, mul:harma*0.3).scramble,\n Resonz.ar(source, freq*harm*detune, bandwidth, mul:harma).scramble * 50\n ].wchoose([0.2,0.8]);\n var snd = Splay.ar(generator,spread);\n snd * LFGauss.ar(dur, attack, loop:0, doneAction:2);\n };\n dur.wait;\n };\n \n};\n\n// global triple super gverb\n{\n var in = In.ar(0,2);\n in = (in*0.2) + GVerb.ar(in, 220, 12, mul:0.6);\n in = (in*0.2) + GVerb.ar(in, 220, 12, mul:0.6);\n in = (in*0.2) + GVerb.ar(in, 220, 12, mul:0.6);\n ReplaceOut.ar(0, Limiter.ar(LeakDC.ar(in)))\n}.play(addAction:\\addToTail)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Loudness` in SuperCollider?"}, {"role": "assistant", "content": "Loudness — Extraction of instantaneous loudness in sones A perceptual loudness function which outputs loudness in sones; this is a variant of an MP3 perceptual model, summing excitation in ERB bands. It models simple spectral and temporal masking, with equal loudness contour correction in ERB bands to obtain phons (relative dB), then a phon to sone transform. The final output is typically in the range of 0 to 64 sones, though higher values can occur wit Category: UGens > Analysis > Amplitude."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// Analogizer\n// a quick draft of a model of the EHX Analogizer pedal\n// some info from \"https://www.bassic.de/threads/electro-harmonix-ehx-analogizer.14865686/\"\n\ns.default\ns.boot\n\n// used this for testing: https://www.freesound.org/people/wescwave/sounds/169885/\n~buf = Buffer.read(s, \"169884__wescwave__double-bass-test2.wav\");\n\n(\n~x.free;\n~x = {\n var a, d, s;\n\n a = PlayBuf.ar(2, ~buf, 1, 1, 0, 1);\n a = a.sum!2; // go mono to make the effect more prominent\n\n // the \"distortion modeling\" could use some more love...\n s = (a * MouseY.kr(26/2, 0).dbamp).tanh;\n s = s * MouseY.kr(-16/2, 0).dbamp;\n\n // a simple delay\n d = DelayC.ar(s, 0.1, MouseX.kr(3.5/1000, 65/1000));\n\n // dry/wet...\n a = a + (d * MouseY.kr(0, -96).dbamp);\n\n Out.ar(0, a);\n}.play\n)\n```"}, {"role": "assistant", "content": "The EHX Analogizer (http://www.ehx.com/products/analogizer) is a guitar pedal that apparently consists of a ultra-short delay with some gain stage. It's supposed to \"fatten\" and somehow \"spread\" the sound to make it appear more \"analog\" (thus: dirty). I wanted to quickly test the effect myself.\r\n\r\nI guess with some additional care of the distortion stage and maybe some very little modulation (ster."}]} -{"conversations": [{"role": "user", "content": "What does `SCViewHolder.background` do? What arguments does it take?"}, {"role": "assistant", "content": "This method is forwarded to the Arguments: b. Returns: The result of calling the method on the proxied view"}]} -{"conversations": [{"role": "user", "content": "What does doneAction do?"}, {"role": "assistant", "content": "It tells the server what to do to the enclosing Synth when the UGen finishes. The one that matters most is `doneAction: 2`, which frees the Synth: that is how a percussive sound cleans itself up instead of leaking silent nodes. `doneAction: 0` does nothing, so the Synth keeps running. EnvGen, Line, XLine, LinePan and friends all accept it, which is why `EnvGen.kr(Env.perc(0.01, 1), doneAction: 2)` is the standard envelope idiom."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PV_MagNoise`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\nb = Buffer.read(s, ExampleFiles.child);\n\n(\nSynthDef(\"help-magNoise\", { |out = 0|\n var in, chain;\n in = SinOsc.ar(SinOsc.kr(SinOsc.kr(0.08, 0, 6, 6.2).squared, 0, 100, 800));\n chain = FFT(LocalBuf(2048), in);\n chain = PV_MagNoise(chain);\n Out.ar(out, 0.1 * IFFT(chain).dup);\n}).play(s);\n);\n\n(\nSynthDef(\"help-magNoise2\", { |out = 0, soundBufnum = 2|\n var in, chain;\n in = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);\n chain = FFT(LocalBuf(2048), in);\n chain = PV_MagNoise(chain);\n Out.ar(out, 0.2 * IFFT(chain).dup);\n}).play(s, [\\soundBufnum, b]);\n);\n\nb.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nPbind(\\degree, Pseq([0, 2, 4, 7], inf), \\dur, 0.25).play;\n```"}, {"role": "assistant", "content": "It plays a four-note major arpeggio in a loop, one note every 250 ms.\n\n`Pbind` builds an event stream: each event is the current value of every key. `Pseq([0, 2, 4, 7], inf)`\ncycles the degrees forever, and `\\dur, 0.25` sets the time between events in beats on the default\nTempoClock. With no `\\instrument`, the `\\default` SynthDef is used, which converts `\\degree` to a\nfrequency through the current scale (major, rooted at C by default). `.play` schedules it on the clock\nand returns an EventStreamPlayer."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Electronic Waves in the beach."}, {"role": "assistant", "content": "```supercollider\n// 2012.05.10\n// Work for NX013 Class\n// Comment: Ocean of Bass.\n\np = ProxySpace.push(s.boot);\n\n~a.play;\n\n~a = { var array;\n array = Array.series(rrand(1,1000),rrand(1,1000),rrand(1,30));\n array = array ++ array.reverse;\n Pan2.ar(LeakDC.ar(Normalizer.ar(\n BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(FreeVerb.ar(\n BPF.ar(\n LPF.ar(FreeVerb.ar(WhiteNoise.ar(),\n rrand(0.5,1.0),rrand(0.5,1.0),rrand(0.5,1.0))\n ,Demand.kr(Impulse.kr(rrand(5,20)),0,Dseq(array,inf)))\n ,rrand(100,5000),rrand(0.1,1.0))\n ,0.1,0.1,0.1)\n ,100,6.0,6),1000,6.0,0),5000,6.0,0),10000,6.0,6)\n ,(1.33/0.999)*1.0,0.1)),0)\n};\n\n~a = nil;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Detune idea is from James Harkins."}, {"role": "assistant", "content": "```supercollider\n(\na = {\n |freq = 40, wid = 0.5|\n Mix(LFPulse.ar(freq *((Array.fill(40, Pxrand((1, 2..20), inf).iter)/1000)+1),\n 0, wid, 0.05)\n ).dup\n}.play;\n);\n\n//more distorsion\n~widlfo = {Saw.kr(0.5).range(0,1)};\na.set(\\wid, ~widlfo);\n\n//stop\na.release;\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Pnsym`?"}, {"role": "assistant", "content": "Pnsym — use a pattern of symbols to embed Pdefns"}, {"role": "user", "content": "What does `Pnsym.dict` do?"}, {"role": "assistant", "content": "set the dictionary to be used."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\n// load a synthdef\ns.boot;\nSynthDef(\"gpdef\",\n { |out = 0, freq = 440, sustain = 0.05, amp = 0.1, pan|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain), doneAction: Done.freeSelf) * amp;\n Out.ar(out, Pan2.ar(SinOsc.ar(freq, 0, env), pan))\n }).add;\n);\n\nPdefn(\\x, Pn(1, 3));\nPdefn(\\y, Prand([5, 9, 1], 2));\nPdefn(\\z, Pdefn(\\y) * 2);\n\n(\nPdef(\\play,\n Pbind(\n \\instrument, \\gpdef,\n \\harmonic, Pnsym(Pseq([\\x, \\x, Prand([\\x, \\y]), [\\z, \\y], \\y], inf)).trace,\n \\dur, 0.2, \\note, 10\n )\n).play;\n);\n\n// change root pattern:\nPdefn(\\x, Pn(2, 3));\nPdefn(\\x, Pseq([1, 3, 1, 2, 1, 4, 5]));\nPdefn(\\x, Pseq([1, 3, 1, 2, [1, 3], 4, 5]));\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Pdef.envir` do?"}, {"role": "assistant", "content": "Set the event for the Pdef. It is used to filter the incoming stream before it is passed to the source pattern. This is similar to NodeProxy#-nodeMap. When set for the first time, the pattern is"}]} -{"conversations": [{"role": "user", "content": "What is `Latency`?"}, {"role": "assistant", "content": "Latency — Measure audio latency for multiple channels"}, {"role": "user", "content": "What does `Latency.testAudio` do?"}, {"role": "assistant", "content": "main method to measure audio latency"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// server has hardwareBufferSize 512 for this example.\ns.options.hardwareBufferSize = 512; s.reboot;\n// do something that sends messages with server latency\nPbind(\\degree, Pbrown(-14, 14, 3), \\dur, 1/8).play;\ns.latency;\ns.latency = 0.1; // tune down ...\ns.latency = 0.05;\ns.latency = 0.025;\ns.latency = 0.012; // ... until every message posts \"late 0.01....\" now\ns.latency = 0.018; // go back up -> fewer late messages\ns.latency = 0.021; // go back up until ...\ns.latency = 0.024; // late messages are completely gone again\n\ns.latency = 0.03; // this works on many systems\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Pmul`."}, {"role": "assistant", "content": "```supercollider\n(\nvar a, b;\na = Pmul(\\freq, Pseq([3, 4, 6], 2), Pbind(\\freq, 100));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Saving \"Presets\"?"}, {"role": "assistant", "content": "SuperCollider forum — Saving \"Presets\"?\n\nIf you don’t care too much about it being human readable, just use writeArchive and readArchive:\n\n```supercollider\na = Array.fill(400, {rrand(0,2200)});\n\na.writeArchive(\"/Users/spluta1/Documents/SC/test\");\n\nb = Object.readArchive(\"/Users/spluta1/Documents/SC/test\");\n\nb.postln;\n```\n\nSam"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n{Mix({|i|var j=Impulse,t=TChoose.kr(j.kr(1/8),[1,6,3]/8),r=Ringz.ar(j.ar(i*t+0.25),600*t*i+[0,9]);CombC.ar(r,1,0.5,4,0.1,r)}!4).tanh/4}.play\n```"}, {"role": "assistant", "content": "Hi colliders, this is my first post here, and also my very first sc tweet! \r\nIt's nothing special, just a little rhythmic Ringz thingy...\r\nAs a beginner, I found this really useful getting the hang of some syntax shortcuts:\r\nhttp://schemawound.com/post/25710867587/supercollider-tweets-background-tips."}]} -{"conversations": [{"role": "user", "content": "What are the server's default sample rate and block size?"}, {"role": "assistant", "content": "44100 Hz and 64 samples per block by default, so the control rate is 44100/64 = 689.06 Hz. You can read them from the language with `s.sampleRate` and `s.options.blockSize`, or from inside a Synth with `SampleRate.ir` and `ControlRate.ir`. A `.kr` signal therefore updates about 689 times a second, which is why it is smooth enough for filters and envelopes but not for audio-rate FM."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for rough sketch of chicago minor chord pad thing."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\\ChicagoPad, { |out = 0, freq = 440, cutoff = 500, amp = 0.2|\n var snd;\n freq = freq + SinOsc.kr(0.1, 0, 1, 20);\n snd = Saw.ar([freq, freq+1, freq-1, freq*3/2, freq*6/5])*0.1;\n snd = snd + VarSaw.ar(0.99*[freq, freq+1, freq-1,freq*3/2, freq*6/5],0, LFTri.kr(0.3).range(0.25,0.9))*0.1;\n snd = Mix(snd);\n snd = RLPF.ar(snd, SinOsc.kr(0.1, 0, 100, 5000), 0.1);\n snd = GVerb.ar(snd ,40, 10, 0.6, 0.6, -3, -9, -11)*0.2;\n \n //snd = RLPF.ar(snd, SinOsc.kr(0.08, 0.5, cutoff/10, cutoff), 0.2);\n snd = MoogFF.ar(snd, SinOsc.kr(0.08, 0.5, cutoff/10, cutoff), 3, 0);\n snd = DelayC.ar(snd, 1.5, 1,0.8);\n //snd = snd * EnvGen.ar(Env.linen(0.001, 0.01,0.01,1), doneAction:2);\n Out.ar(out, [snd, AllpassC.ar(snd, 0.5, 0.05, 0.3)]*amp);\n}).send;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `Red3DBox` in SuperCollider briefly."}, {"role": "assistant", "content": "Red3DBox — 3D box / cube A class for rotating and rendering a box in 3D. Category: Red > redUniverse > 3D."}]} -{"conversations": [{"role": "user", "content": "How do I make this brighter?\n```supercollider\n{ LPF.ar(Saw.ar(110), 400) * 0.2 }.play;\n```"}, {"role": "assistant", "content": "Raise the cutoff. 400 Hz is well below the harmonics that carry brightness, so open it to 2000-4000 Hz:\n\n```supercollider\n{ LPF.ar(Saw.ar(110), 3000) * 0.2 }.play;\n```"}, {"role": "user", "content": "Still dull."}, {"role": "assistant", "content": "Then the low-pass is not the limit — the source is. A saw at 110 Hz has energy up to Nyquist, so check the amplitude: at 0.2 the high harmonics are quiet. Two moves: add resonance so the filter peak is audible, and raise the level slightly.\n\n```supercollider\n{ RLPF.ar(Saw.ar(110), 2500, 0.3) * 0.35 }.play;\n```\n\nIf that is still dull, the answer is a different source: `Saw` is band-limited and soft; try `LFSaw` or add a second detuned saw for more high content."}]} -{"conversations": [{"role": "user", "content": "What does `IdentityDictionary.proto` do?"}, {"role": "assistant", "content": "The two instance variables proto and parent may hold dictionaries which are used to look up all those keys that have no value in the current dictionary. First, proto is looked up, then parent. In other words: proto overrides parent. This allows you to construct systems with complex defaults or multiple inheritance. `x = (freq:"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// examples: args are // outs, amps, ins, vol, fadeTime\n\n{ Out.ar(87, SinOsc.ar(MouseX.kr(40, 10000, 1) * [1, 2, 3], 0, 0.2)) }.play;\nx = Monitor.new;\n\n(\nx.playN(\n [0, 1, 4], // to these outs\n [0.1, 0.4, 0.3], // with these volumes\n [87, 88, 89] // from these ins\n);\n);\n(\nx.playN(\n [0, [1, 3, 2], 4], // outs can be nested: 87 -> 0, 88 -> [1, 3, 2], 89 -> 4\n [0.1, [0.4, 0.2, 0.1], 0.3], // with nested volumes 0.1, [0\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// examples: args are // outs, amps, ins, vol, fadeTime\n\n{ Out.ar(87, SinOsc.ar(MouseX.kr(40, 10000, 1) * [1, 2, 3], 0, 0.2)) }.play;\nx = Monitor.new;\n\n(\nx.playN(\n [0, 1, 4], // to these outs\n [0.1, 0.4, 0.3], // with these volumes\n [87, 88, 89] // from these ins\n);\n);\n(\nx.playN(\n [0, [1, 3, 2], 4], // outs can be nested: 87 -> 0, 88 -> [1, 3, 2], 89 -> 4\n [0.1, [0.4, 0.2, 0.1], 0.3], // with nested volumes 0.1, [0.4, 0.2, 0.1], and 0.3\n [87, 88, 89]); // reading from these ins\n);\n// can also set global volume and fadetime\nx.playN(vol: 0.0, fadeTime: 4);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes an experiment with roots of unity in supercollider."}, {"role": "assistant", "content": "```supercollider\n(\n\n~divisors = {\n arg n;\n ~divs = List.newClear(0);\n for( 1, floor(sqrt(n)), {arg i; if(n%i==0,{\n //i.postln;\n ~divs.add(i);\n // (i==n.div(i)).postln;\n if(i==n.div(i),{},{~divs.add(n.div(i))});\n },{});\n });\n ~divs.sort;\n ~divs;\n};\n\n\nSynthDef(\\rootsOfUnitySum, { |out=0,freq=1,amp=1,n=1,ks=#[1]|\n var l,sigl,sigr,env;\n\n\n sigl = SinOsc.ar(freq:0,mul:0);\n sigr = SinOsc.ar(freq:0,mul:0);\n ks.do({arg item,i;\n k = item;\n sigr = sigr+SinOsc.ar(freq:freq*2pi*k/n,mul:amp,phase:0.5*pi);\n sigl = sigl+SinOsc.ar(freq:freq*2pi*k/n,mul:amp);\n });\n env = EnvGen.kr(Env.linen(attackTime: 0.001, sustainTime: 1, releaseTime: 0.01, level: 1.0, curve: 'lin'), doneAction: Done.freeSelf);\n sigr = sigr*env;\n sigl = sigl*env;\n\n Out.ar(out, [sigl,sigr])\n}).add;\n\n\n~getPbind = { arg n, amps, durs, freq;\n ~nums = ~divisors.value(n);\n r = Pbind(\\instrument,\\rootsOfUnitySum,\n \\amp,amps,\n \\dur,durs,\n \\freq,freq,\n \\n,Pseq([n],~nums.size),\n \\ks , Pseq(all{:~divisors.value(n),n<-~nums},1)).trace();\n r\n};\n\n~seq = (1..13);\n~tau = all{:~divisors.value(n).size,n<-~seq};\n\n\n~r = Pseq(all{:~getPbind.value(\n n:n,\n amps:Pseq(all{:0.5/t,t<-~tau},1),\n durs:Pseq(all{:0.3333/t,t<-~tau},1),\n freq:220/3),n<-~seq},1);\n\n~s = Pseq(all{:~getPbind.value(\n n:n,\n amps:Pseq(all{:0.5/t,t<-~tau},1),\n durs:Pseq(all{:0.5/t,t<-~tau},1),\n freq:110),n<-~seq},1);\n\n~t = Pseq(all{:~getPbind.value(\n n:n,\n amps:Pseq(all{:0.5/t,t<-~tau},1),\n durs:Pseq(all{:1/t,t<-~tau},1),\n freq:220),n<-~seq},1);\n\n~x = Pseq([\n Ppar([~t],1),\n Ppar([~s],1),\n Ppar([~s,~t],1),\n Ppar([~r],1),\n Ppar([~r,~t],1),\n Ppar([~r,~s],1),\n Ppar([~r,~s,~t],1),\n ],inf);\n\n);\n\nPdef(\\mplayer, ~x).clock_(TempoClock(100/60)).play;\nPdef(\\mplayer, Pn(Event.silent)).fadeTime_(8);\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Rest`."}, {"role": "assistant", "content": "```supercollider\n(\nPbind(\n \\degree, Pif(\n 0.1.loop.coin,\n Pseq([Rest(), 7], inf), // every second is a Rest\n Pseries(0, 1, inf).fold(-7, 7)\n ),\n \\dur, 0.125\n).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Semideterministic JitLib Code for Experimental Livecoding."}, {"role": "assistant", "content": "```supercollider\n// NX102\n// 2012-08-07_23_05_45\n\n// La ment no té límits.\n\n// Use with Jitlib:\n\np = ProxySpace.push(s.boot);\n\n// Read one sample on your collection:\n\nb = Buffer.read(s,Platform.userAppSupportDir +/+\"/audio/a11wlk01.wav\",bufnum:1);\n\n// Play and fun:\n\n~nx102.play;\n\n~nx102 = {\n Pan2.ar(LeakDC.ar(Normalizer.ar(\n BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(FreeVerb.ar(\n RHPF.ar(RLPF.ar(\n Pulse.ar(\n (PlayBuf.kr(1,1,Rand(50,100),1,0,1)*Rand(100,1000)).clip(\n Rand(5,12),Rand(12,20))) \n ,Rand(100,5000),Rand(0.005,0.1))\n ,Rand(5000,20000),Rand(0.005,0.1))\n ,0.0,0.0,0.0)\n ,100,6.0,6),1000,6.0,0),5000,6.0,0),10000,6.0,6)\n ,(1.25/0.999)*1.0,0.1)),0)\n};\n\n~nx102 = nil;\nb.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What is a bus, in one sentence?"}, {"role": "assistant", "content": "A numbered channel on the server that nodes write signal into and read signal out of, which is how sounds are chained without cables."}, {"role": "user", "content": "Show me using one for an effect."}, {"role": "assistant", "content": "Write the source to a private bus, read it in the effect, send the effect to the master:\n\n```supercollider\n(\n~bus = Bus.audio(s, 1);\nSynthDef(\\src, { |out = 0| Out.ar(out, Saw.ar(110) * 0.1) }).add;\nSynthDef(\\fx, { |in = 0| Out.ar(0, RLPF.ar(In.ar(in, 1), 1200, 0.3)) }).add;\n);\nSynth(\\fx, [\\in, ~bus]);\nSynth(\\src, [\\out, ~bus]);\n```\n\nOrder matters: the effect exists before the source, so the source's output has a listener."}]} -{"conversations": [{"role": "user", "content": "What does `View.absoluteBounds` do?"}, {"role": "assistant", "content": "The basic visible element of GUI Returns: A Rect describing the absolute position and the size of the view on the screen."}]} -{"conversations": [{"role": "user", "content": "What is `Symbol`?"}, {"role": "assistant", "content": "Symbol — a unique name for something"}, {"role": "user", "content": "What does `Symbol.isClassName` do?"}, {"role": "assistant", "content": "Answer whether the symbol can be a class name. This does not say if the class exists. `\\Array.isClassName;`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na = { SinOsc.ar(\\freq.kr(440, 1.2)) }.play;\na.set(\\freq, 330);\na.release;\na = { SinOsc.ar(\\freq.kr([440, 460], 1.2)) }.play;\na.setn(\\freq, [330, 367]);\na.release;\n```"}]} -{"conversations": [{"role": "user", "content": "Which keys does a Pbind understand?"}, {"role": "assistant", "content": "The ones you use constantly are \\instrument (a SynthDef name), \\dur (seconds), \\degree (scale degree), \\midinote, \\freq, \\amp, \\legato (note length as a fraction of \\dur), and \\scale plus \\root for the scale used by \\degree. Everything else is passed to the Synth as an argument, so a SynthDef with `|cutoff = 800|` can be driven by `\\cutoff, Pwhite(400, 4000)`."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for SOUND 1, from orig Influx Example."}, {"role": "assistant", "content": "```supercollider\n// SOUND 1, from orig Influx Example\n(\n// // // if JITLibExtensions are used, you can make space local:\n// Ndef(\\dog).addSpec(\\intv, [-24, 24]);\n// Ndef(\\dog).addSpec(\\timescale, [0.01, 10, \\exp]);\n// Ndef(\\dog).addSpec(\\curve, [-10, 10]);\n// Ndef(\\dog).addSpec(\\ffreq, \\freq);\n//\n// Ndef(\\dog).addSpec(\\loopnode, [0, 12]);\n// Ndef(\\dog).addSpec(\\dens, [10, 1000, \\exp]);\n// Ndef(\\dog).addSpec(\\resfreq, \\freq);\n// Ndef(\\dog).addSpec(\\ringtime, [0.01, 1, \\exp]);\n\nSpec.add(\\intv, [-24, 24]);\nSpec.add(\\timescale, [0.01, 10, \\exp]);\nSpec.add(\\curve, [-10, 10]);\nSpec.add(\\ffreq, \\freq);\n\nSpec.add(\\loopnode, [0, 12]);\nSpec.add(\\dens, [10, 1000, \\exp]);\nSpec.add(\\resfreq, \\freq);\nSpec.add(\\ringtime, [0.01, 1, \\exp]);\n\n\nNdef(\\dog, { |amp=0, freq=250, intv=19, timescale=1, curve=0, loopnode=0, dens = 10, resfreq = 500, ringtime = 0.01|\n var n = 15;\n var env = EnvGen.kr(\n Env({ 1.0.rand2 }!(n+1), {1.0.rand}!n, curve, releaseNode: n-1, loopNode: loopnode.min(n-3)),\n timeScale: timescale);\n var pitch = (env * [1, 0.33, -1] * intv).midiratio * freq;\n var form = Formant.ar(pitch, pitch.rotate(1) * 1.6, pitch.rotate(2) * 2.6);\n\n var dusty = Ringz.ar(\n Dust.ar(dens!3),\n resfreq * LFNoise0.kr([3, 5, 7], 0.5, 1),\n ringtime)\n * ((dens ** -0.5) * (ringtime ** -0.3)\n );\n\n Splay.ar(form * dusty, level: amp) ;\n});\n);\n\nNdef(\\dog).set(\\amp, 0.2).vol_(0.2);\nNdef(\\dog).gui.moveTo(400, 380);\n\n/*\n// Ndef(\\dog).addHalo(\\orderedNames, Ndef(\\dog).controlKeys);\nNdef(\\dog).controlKeys;\nNdef(\\dog).vol_(0.5);\nNdefPreset( Ndef(\\dog) ).loadSettings;\nNdef(\\dog).play;\nNdef(\\dog).gui;\n*/\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DelayN`."}, {"role": "assistant", "content": "```supercollider\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nDelayN.ar(z, 0.2, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\n(\n// recursive application of delay.\n{\nz = Decay2.ar(Dust.ar(1, 0.5), 0.01, 0.1, Saw.ar(100 + [0, 1]));\n5.do { |i| z = DelayN.ar(RLPF.ar(z, Rand(100, 3000), 0.03), 1, 1 / (2**i), 1, z * 0.5) };\nz\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n \n// definition for future reference in arbitrary Environments,\n// intervals grow together with base tone\n\n(\nq = PLexprand(\\lo, \\hi);\n\np = Pbind(\n \\midinote, 60 + q + PLtuple([0, q]),\n \\dur, 0.1\n);\n);\n\n\n// prepare current Environment\n\n(\n~lo = 0.1;\n~hi = 10;\n);\n\n\n// run\n\nx = p.play;\n\n\n// replace \n\n~hi = 20;\n\nx.stop;\n```"}, {"role": "assistant", "content": "definition for future reference in arbitrary Environments, intervals grow together with base tone (PLexprand: dynamic scope Pexprand variant)"}]} -{"conversations": [{"role": "user", "content": "What does `PathName.allFolders` do?"}, {"role": "assistant", "content": "returns a list of all the folder names contained in the pathname itself."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nPbindef(\\x, \\note, Pseq([0, 7, 9]), \\dur, 0.2.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nPbindef(\\x, \\note, Pseq([0, 7, 9]), \\dur, 0.2).play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `IBVA.getFilterCutoff` do?"}, {"role": "assistant", "content": "send a request to the device for the current filter cutoff ratio. calls #-frAction when"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nx = { |gate = 1| BrownNoise.ar(0.5) * EnvGen.kr(Env.cutoff(1), gate, doneAction: Done.freeSelf) }.play;\nx.release(5; // override the Env's specified 1 second release time\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nx = { |gate = 1| BrownNoise.ar(0.5) * EnvGen.kr(Env.cutoff(1), gate, doneAction: Done.freeSelf) }.play;\nx.release(5); // override the Env's specified 1 second release time\n```"}]} -{"conversations": [{"role": "user", "content": "What is `CutStream1` in SuperCollider?"}, {"role": "assistant", "content": "CutStream1 — BBCut2 with live input Playback for a stream of audio which can be cut-up. The stream can be any bus on the Server, so might be a file streamed off disk, a current audio input or some synthesised data. Category: Libraries > BBCut > Cut synths."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `SortedList`."}, {"role": "assistant", "content": "```supercollider\nSortedList[1, 2, 5, 6].add(4).postln;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `RedParticle.age` do?"}, {"role": "assistant", "content": "Scalar that decrease by 1 for every update. The default is"}]} -{"conversations": [{"role": "user", "content": "What does `PageLayout.asPageLayout` do? What arguments does it take?"}, {"role": "assistant", "content": "Similar to asFlowView, this message converts nil and various other objects to a PageLayout. This is already a PageLayout, so it returns Arguments: name — Ignored. If the receiver had been nil then the name would be the Window name.; bounds — Ignored. Would have been used to size the PageLayout. Returns: self"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for algorithmic/aleatoric composition for mallets and proxy patterns."}, {"role": "assistant", "content": "```supercollider\n/*\"Musical Toys For Little Robots\"\n\n or\n\n \"How I learned to stop worrying and love the proxy\"\n\nhttp://soundcloud.com/unknown-artist-6/musical-toys-for-little-robots\n\n */\n\n~fx=Bus.audio(s,2);\n\n(\nSynthDef(\\mallet,{arg in=0,out=0,m=48,a=1,r=1,p=0;\n\n var sig=Array.fill(3,{|n| SinOsc.ar(m.midicps+(n*0.01),mul:a*0.3)}).sum;\n var env=EnvGen.kr(Env.perc(0.001,r),gate:1,doneAction:2);\n\n Out.ar(out,Pan2.ar(sig*env,pos:p));\n};\n).add;\n\nSynthDef(\\rev,{arg in=0,out=0;\n var sig=In.ar(in,2);\n sig=sig*0.8+CombC.ar(sig,0.5,0.3,0.5,0.2);\n Out.ar(out,sig)\n };\n).add;\n);\n\nSynth(\\rev,[\\in:~fx]);\n\n\n(\nfork{\n var degrees=Prand([0,4,5,7,9,12],inf).asStream;\n var root=[36,48,60,72];\n var x;\n x=Array.new;\n a=PatternProxy(Pseq([0+root.wchoose([0.3,0.4,0.2,0.1])],inf));\n d=1/8;\n\n ~streams=[];\n ~names={|pbind| ~streams=~streams++pbind.play(quant:1)};\n\n ~names.value(Pbind(*[\\instrument:\\mallet,\n \\m:a,\n \\dur:d,\n \\a:{rrand(0.4,1)*0.05},\n \\p:{rrand(-0.2,0.2)},\n \\r:{rrand(0.5,0.8)},\n \\out:~fx\n ]));\n\n\n 20.do({|n|\n x=x.add(degrees.next+root.wchoose([0.3,0.4,0.2,0.1]));\n x.postln;\n a.source=Pseq(x.scramble,inf);\n if ((n+1) % 6 == 0,{~names.value(Pbind(*[\\instrument:\\mallet,\n \\m:Pcollect({arg inval;inval-[-24,12].choose},a),\n \\dur:d,\n \\a:{rrand(0.4,1)*0.05/(n+1)},\n \\p:{rrand(-0.2,0.2)},\n \\r:{rrand(0.5,0.8)},\n \\out:~fx\n ]));\"new stream\".postln});\n (n+1).wait});\n\n 19.do({|n|\n x.removeAt(0);\n x.postln;\n a.source=Pseq(x.scramble,inf);\n (19-(n+1)).wait;});\n4.wait;\n ~streams.do{|n| n.stop;2.wait};\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What are you good at?"}, {"role": "assistant", "content": "SuperCollider. I can explain its classes and UGens, write SynthDefs and patches, read a patch back to you, and tell you why one does not compile. I am 198M parameters; I am not a general assistant."}]} +{"conversations": [{"role": "user", "content": "What does `IBVAplayer.stop` do? What arguments does it take?"}, {"role": "assistant", "content": "stop playing (and optionally plug back the input from the serial Arguments: unmutePort — a Booelan indicating if the serial data should be restored or not."}]} +{"conversations": [{"role": "user", "content": "Explain `PSVdif` in SuperCollider briefly."}, {"role": "assistant", "content": "PSVdif — Sieve pattern for difference of integer generators with point output Pattern for difference of integer generators with point output. Corresponds to Sieve's methods Sieve#*dif and Sieve#-dif. For an introduction and more examples see Sieves_and_Psieve_patterns. Category: Libraries > miSCellaneous > Sieves and Psieve Patterns, Streams-Patterns-Events > Sieves and Psieve Patterns."}]} +{"conversations": [{"role": "user", "content": "What does `MIDIIn.replaceFuncTo` do? What arguments does it take?"}, {"role": "assistant", "content": "Replace a Function or similar object in the list to be evaluated whenever a particular MIDI message is received with another one. This method is preferable to the setters below, since it will not overwrite any existing Arguments: what — A Symbol indicating the message type to wait for, one of `'noteOn'` `'noteOff'`, `'polytouch'`, `'control'`, `'program'`, `'touch'`, `'bend'`, `'sysex'`, `'sysrt'`, `'smpte'`, or `'invalid'` (for invalid sysex messages).; func — The Function or similar object to be replaced.; newFunc — A Function or similar object to be evaluated when a message of the specified type is received. See the setters below for the arguments which will be passed at evaluation time.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n VarLag.kr( // lag the modulator\n LFPulse.kr(1).range(100, 400), // frequency modulator\n 0.2, // lag time\n Line.kr(-8, 8, 15, doneAction: Done.freeSelf) // modulate shape\n ),\n 0, // sine phase\n 0.3 // sine amplitude\n )\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n VarLag.kr( // lag the modulator\n LFPulse.kr(1).range(100, 400), // frequency modulator\n 0.2, // lag time\n Line.kr(-8, 8, 15, doneAction: Done.freeSelf) // modulate shape\n ),\n 0, // sine phase\n 0.3 // sine amplitude\n )\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SCViewHolder.doesNotUnderstand` do? What arguments does it take?"}, {"role": "assistant", "content": "Messages that are not understood by the view holder are forwarded to the proxied view. So when the interpreter is told to send a message to a view holder object and that message is not understood, it calls Arguments: selector — The message that was not understood; ... args — The arguments that were supplied. Returns: the result of calling the method on the proxied view"}]} +{"conversations": [{"role": "user", "content": "What is SuperCollider?"}, {"role": "assistant", "content": "SuperCollider is a platform for audio synthesis and algorithmic composition, written in C++ and SuperCollider. It splits into a language client (sclang) that runs your code and builds UGen graphs, and an audio server (scsynth) that does the DSP in real time. They talk over OSC."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// plot:\n{ LFTri.ar(40) }.plot(0.1);\n{ LFTri.ar(XLine.kr(1, 800, 0.1)) }.plot(0.1);\n\n{ LFTri.ar(500, 0, 0.1) }.play\n\n// used as both Oscillator and LFO:\n{ LFTri.ar(LFTri.kr(4, 0, 200, 400), 0, 0.1) }.play\n\n// phase. compare\n{ LFTri.ar(LFTri.kr(0.1, iphase: 0) * 200 + 400, 0, 0.1) }.play\n{ LFTri.ar(LFTri.kr(0.1, iphase: 1) * 200 + 400, 0, 0.1) }.play\n{ LFTri.ar(LFTri.kr(0\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// plot:\n{ LFTri.ar(40) }.plot(0.1);\n{ LFTri.ar(XLine.kr(1, 800, 0.1)) }.plot(0.1);\n\n{ LFTri.ar(500, 0, 0.1) }.play\n\n// used as both Oscillator and LFO:\n{ LFTri.ar(LFTri.kr(4, 0, 200, 400), 0, 0.1) }.play\n\n// phase. compare\n{ LFTri.ar(LFTri.kr(0.1, iphase: 0) * 200 + 400, 0, 0.1) }.play\n{ LFTri.ar(LFTri.kr(0.1, iphase: 1) * 200 + 400, 0, 0.1) }.play\n{ LFTri.ar(LFTri.kr(0.1, iphase: 2) * 200 + 400, 0, 0.1) }.play\n{ LFTri.ar(LFTri.kr(0.1, iphase: 3) * 200 + 400, 0, 0.1) }.play\n\n// together\n{ LFTri.ar(LFTri.kr(0.05, iphase: (0..3)) * 200 + 400, 0, 0.1).sum }.play\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n Ndef(\\x, {\n var output;\n var delayTime;\n var delayMax = 0.2;\n var delayAdd = 0.1;\n var pulseFreq = 0.5;\n var proxyMul = 2;\n var pulseMin = 40;\n var pulseMax = 130;\n var numOfEchos = 2;\n\n var mainPulse = LFPulse.ar(pulseFreq, 0, 0.5).range(pulseMin, pulseMax);\n var proxy = Ndef(\\x).ar * proxyMul;\n var ampModFreq = SinOsc.ar(0.01, 0).range(0.3, 30);\n var ampMod = LFNoise1.ar(ampModFreq, 6);\n output = SinOsc.ar(mainPulse + proxy, 0, ampMod).tanh;\n numOfEchos.do{\n delayTime = {delayMax.rand + delayAdd}!2;\n output = AllpassL.ar(output, 0.1, delayTime, 5);\n };\n output.tanh;\n }).play\n)\n```"}, {"role": "assistant", "content": "Something I put together a while back by forking Dark Sea Horns."}]} +{"conversations": [{"role": "user", "content": "What does `EaseOutInCubic.value` do? What arguments does it take?"}, {"role": "assistant", "content": "Cubic ease-out/in Arguments: t — a Float between 0.0 and 1.0.."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// If one wants to start width full width there's the possibility to do this by \n// passing an initOutOffset argument.\n\n// Here we start with initOutOffset = 1, fadeMode = 1 (step first),\n// index = 4 (5th partial) is the middle of the channel span with most weight,\n// which can be clearly perceived.\n\n(\nx = {\n var lfo = XLine.ar(1, 0.5, 60);\n DXMix.ar(\n Dseq([0, 4, 1, 5, 2, 6, 3, 7], inf),\n `(Saw.ar((1..8) * 70 * lfo, 0.075)),\n fadeTime: 0.1,\n stepTime: 2,\n fadeMode: 1,\n width: 3,\n maxWidth: 8,\n initOutOffset: 1\n// …\n```"}, {"role": "assistant", "content": "If one wants to start width full width there's the possibility to do this by passing an initOutOffset argument. (DXMix: crossfades between signals according to demand-rate control)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// modulate frequency\n{ Blip.ar(XLine.kr(20000, 200, 6), 100, 0.2) }.play;\n\n// modulate numharmonics\n{ Blip.ar(200, Line.kr(1, 100, 20), 0.2 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// modulate frequency\n{ Blip.ar(XLine.kr(20000, 200, 6), 100, 0.2) }.play;\n\n// modulate numharmonics\n{ Blip.ar(200, Line.kr(1, 100, 20), 0.2) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// zig zag partial dome\na = VBAPSpeakerArray.new(3, [[-22.5, 14.97], [22.5, 14.97], [-67.5, 14.97], [67.5, 14.97], [-112.5, 14.97], [112.5, 14.97], [-157.5, 14.97], [157.5, 14.97], [-45, 0], [45, 0], [-90, 0], [90, 0], [-135, 0], [135, 0], [0, 0], [180, 0]]);\n\nb = Buffer.loadCollection(s, a.getSetsAndMatrices);\n\n(\n// pan around the circle up and down\nx = { |azi = 0, ele = 0, spr = 0|\n var source;\n source = PinkNoise.ar(0\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// zig zag partial dome\na = VBAPSpeakerArray.new(3, [[-22.5, 14.97], [22.5, 14.97], [-67.5, 14.97], [67.5, 14.97], [-112.5, 14.97], [112.5, 14.97], [-157.5, 14.97], [157.5, 14.97], [-45, 0], [45, 0], [-90, 0], [90, 0], [-135, 0], [135, 0], [0, 0], [180, 0]]);\n\nb = Buffer.loadCollection(s, a.getSetsAndMatrices);\n\n(\n// pan around the circle up and down\nx = { |azi = 0, ele = 0, spr = 0|\n var source;\n source = PinkNoise.ar(0.2);\n VBAP.ar(16, source, b.bufnum, LFSaw.kr(0.5, 0).range(-180, 180) * -1, SinOsc.kr(3, 0).range(0, 14.97), spr);\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `MxCable.setInitial` do?"}, {"role": "assistant", "content": "Some cable strategies need to set an initial value on the target inlet at the time that the changes are being enacted. For instance when a cable is connected it does not immediately set the value on the target inlet until the Mx calls .update and the first the units are spawned and then the cables are spawned. setInitial allows the cable to set a value for the unit which the unit needs when it spawns, because the unit must spawn before the Returns: this"}]} {"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nc = Condition.new(false);\n\nRoutine {\n 1.wait;\n \"waited for 1 second\".postln;\n 1.wait;\n \"waited for another second, now waiting for you ... \".postln;\n c.wait;\n \"the condition has stopped waiting.\".postln;\n 1.wait;\n \"waited for another second\".postln;\n \"waiting for you ... \".postln;\n c.test = false;\n c.wait;\n \"the condition has stopped waiting.\".postln;\n 1.wait;\n \"the end\".postln;\n}.play;\n);\n\n// continue\n(\nc.test = true;\nc.signal;\n);\n\n// a typical use is a routine that can pause under certain conditions:\n(\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nc = Condition.new(false);\n\nRoutine {\n 1.wait;\n \"waited for 1 second\".postln;\n 1.wait;\n \"waited for another second, now waiting for you ... \".postln;\n c.wait;\n \"the condition has stopped waiting.\".postln;\n 1.wait;\n \"waited for another second\".postln;\n \"waiting for you ... \".postln;\n c.test = false;\n c.wait;\n \"the condition has stopped waiting.\".postln;\n 1.wait;\n \"the end\".postln;\n}.play;\n);\n\n// continue\n(\nc.test = true;\nc.signal;\n);\n\n// a typical use is a routine that can pause under certain conditions:\n(\nc = Condition.new;\nfork { loop { 1.wait; \"going\".postln; c.wait } };\n);\nc.test = true; c.signal;\nc.test = false;\n```"}]} -{"conversations": [{"role": "user", "content": "Can you listen to the sound you generate?"}, {"role": "assistant", "content": "No. I am 198M parameters trained on SuperCollider's documentation and class library; I have no audio input and no way to hear a result. What I can do is reason about the code: whether it reaches an output bus, whether the envelope will ever open, whether a filter at that cutoff leaves anything audible. Treat my patches as a starting point you listen to, not as a judgement about how they sound."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\nvar trigger, fund, flashInst;\nflashInst = Array.fill(7,\n{\ntrigger = Dust.kr(2)*PinkNoise.ar(1);\nfund = rrand(100, 137);\nPan2.ar(\nMix.ar(\nArray.fill(7,\n{arg counter;\nvar partial;\npartial = counter + 3;\n//HenonC.ar(fund*partial).atan *\nDPW3Tri.ar(fund*partial).atan *\nEnvGen.kr(Env.adsr(0.01, 0, 0.1, 7.0),\ntrigger, 1/partial) *AY.ar(713)* max(0, LFNoise1.kr(rrand(37.0, 73.0)))\n})\n)*0.2,\n1.0.rand2)\n});\nMix.ar(flashInst)*0.6\n}.play\n)\n```"}, {"role": "assistant", "content": "\"High-energy Radio Bursts, generated by an old coffee machine of Arab origin, manifest themselves as noise and audio signals, and trigger a magnetic alteration with unpredictable effects;\"\r\n\r\n\r\n\r\nhttp://bz-buzz.blogspot.com/2018/10/radio-bursts-from-old-coffee-pot.html\r\n\r\nhttp://bzakirasantjago.blogspot.com/."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\na = AllGui.new;\n // test adding things that should show up: \na = 12;\nz = 42;\n~bar = 345;\n~foo = 345;\nTdef(\\a); \nTdef(\\b); \nPdef(\\a);\nPdef(\\b);\nPdefn(\\trala);\nPdefn(\\hopsa);\nNdef(\\a);\nNdef(\\b);\n // then try clicking the open button on one!\n\n // all these guis are reasonably non-overlapping / tiled:\na = AllGui(12);\nAllGui.openFuncs.do(_.value(8)); // small screens\nAllGui.openFuncs.do(_.value(12));\n```"}, {"role": "assistant", "content": "test adding things that should show up: then try clicking the open button on one! (AllGui: Overview of many globally stored objects)"}]} -{"conversations": [{"role": "user", "content": "My sustained synth never stops, even when I set the gate to 0."}, {"role": "assistant", "content": "A sustained EnvGen only releases when the gate goes from positive to non-positive *after* the envelope has started, and the Synth only disappears if that EnvGen has `doneAction: 2`. Check three things: the SynthDef actually takes a `gate = 1` argument, the Env is a sustained shape (Env.adsr or Env.asr, not Env.perc), and you call `x.set(\\gate, 0)` on the Synth object. Setting the gate on a different Synth, or on a Group, does nothing."}]} -{"conversations": [{"role": "user", "content": "Supernova, Groups, Threads, Ndef?"}, {"role": "assistant", "content": "SuperCollider forum — Supernova, Groups, Threads, Ndef?\n\nAbout Ndef:\n\nAFAIK you can manually move a NodeProxy’s group into another group:\n\n```supercollider\n~pargroup = ParGroup(s);\n\nNdef(\\a, { Silent.ar(1) });\n\nNdef(\\a).group.moveToHead(~pargroup);\n```\n\nBut...\n\nNodeProxies use InFeedback.\n\nI was a little suspicious about this for parallel processing. As I recalled, InFeedback’s result depends on the order of execution:\n\n-\nIf the source node for the bus finished processing before the server reaches InFeedback, then InFeedback will output the block of audio being processed now.\n\n-\nIf the source node comes after the node containing InFeedback, then it will output the previous block of audio.\n\nIn both cases, these are the most recently available audio blocks. But, if the order of evaluation is not consistent, then the output may not be consistent.\n\nLet’s test that:\n\n```supercollider\nb = Bus.audio(s, 1);\n\na = { SinOsc.ar(200, 0, 0.1) }.play(outbus: b);\n\nc = { InFeedback.ar(b, 1).dup }.play(target: a, addAction: \\addAfter);\n\n(\nfork {\n var order = Pseq([\\moveBefore, \\moveAfter], inf).asStream;\n loop {\n c.perform(order.next, a);\n 1.0.wait;\n }\n}\n)\n```\n\nOops.\n\nThis means you can’t randomly throw Ndefs into ParGroups. If one Ndef reads a signal from another, then you have to make sure that the target Ndef comes later in a serial (regular) Group. (Correctness of the result should be more important than “optimal” usage of multiple cores.)\n\nIf you don’t, and if supernova happens to put the source and target Ndefs onto separate cores at roughly the same time, then the target might evaluate InFeedback either before or after the source finishes, and there’s no guarantee of this being consistent. So you might get clicks.\n\nhjh"}]} -{"conversations": [{"role": "user", "content": "What does `UChain.fadeOut` do? What arguments does it take?"}, {"role": "assistant", "content": "Set fade out Arguments: fadeOut — A Float bigger then zero.."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PV_LocalMax`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\nb = Buffer.read(s, ExampleFiles.child);\n\n\n(\nSynthDef(\"help-localMax\", { |out = 0|\n var in, chain;\n in = Mix.arFill(3, { LFSaw.ar(exprand(100, 500), 0, 0.1) });\n chain = FFT(LocalBuf(2048), in);\n chain = PV_LocalMax(chain, MouseX.kr(0, 50));\n Out.ar(out, 0.5 * IFFT(chain).dup);\n}).play(s);\n);\n\n(\nSynthDef(\"help-localMax2\", { |out = 0, soundBufnum = 2|\n var in, chain;\n in = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);\n chain = FFT(LocalBuf(2048), in);\n chain = PV_LocalMax(chain, MouseX.kr(0, 100));\n Out.ar(out, 0.1 * IFFT(chain).dup);\n}).play(s, [\\soundBufnum, b]);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Electronic Waves in the beach."}, {"role": "assistant", "content": "```supercollider\n// 2012.05.10\n// Work for NX013 Class\n// Comment: Ocean of Bass.\n\np = ProxySpace.push(s.boot);\n\n~a.play;\n\n~a = { var array;\n array = Array.series(rrand(1,1000),rrand(1,1000),rrand(1,30));\n array = array ++ array.reverse;\n Pan2.ar(LeakDC.ar(Normalizer.ar(\n BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(FreeVerb.ar(\n BPF.ar(\n LPF.ar(FreeVerb.ar(WhiteNoise.ar(),\n rrand(0.5,1.0),rrand(0.5,1.0),rrand(0.5,1.0))\n ,Demand.kr(Impulse.kr(rrand(5,20)),0,Dseq(array,inf)))\n ,rrand(100,5000),rrand(0.1,1.0))\n ,0.1,0.1,0.1)\n ,100,6.0,6),1000,6.0,0),5000,6.0,0),10000,6.0,6)\n ,(1.33/0.999)*1.0,0.1)),0)\n};\n\n~a = nil;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n~listing = [\"ls\", \"/\"].unixCmdGetStdOut; // Grab\n~listing.reverse.as(Array.dupEach.join.postln; // Mangle\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n~listing = [\"ls\", \"/\"].unixCmdGetStdOut; // Grab\n~listing.reverse.as(Array).dupEach.join.postln; // Mangle\n```"}]} -{"conversations": [{"role": "user", "content": "What is `InterplPairs` in SuperCollider?"}, {"role": "assistant", "content": "InterplPairs — envelope specification Takes an array of [x, y] pairs and a curve value for all break points. x values can be negative (for use in indexing with negative values or signals). See InterplEnv Help for more info. Category: Control, Envelopes."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for very punchy snare in neurofunk style."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\neurosnare, {\n var snd;\n // a percussive click to give it some attack\n snd = LPF.ar(HPF.ar(WhiteNoise.ar, 300), 8000) * Env.linen(0.001, 0.01, 0.001).ar;\n // sine sweep body. very important!\n snd = snd + (SinOsc.ar(Env([400, 196, 160], [0.04, 0.2], \\exp).ar) * Env.perc(0.04, 0.2).ar * 6.dbamp).tanh;\n // sound of snare coils rattling\n snd = snd + (HPF.ar(BPeakEQ.ar(WhiteNoise.ar, 4000, 0.5, 3), 300) * Env.perc(0.05, 0.2).delay(0.01).ar(2) * -3.dbamp);\n // another sound sweep to improve the attack, optional\n snd = snd + (SinOsc.ar(XLine.kr(3000, 1500, 0.01)) * Env.perc(0.001, 0.02).ar);\n // distortion helps glue everything together and acts as a compressor\n snd = (snd * 1.4).tanh;\n snd = Pan2.ar(snd, \\pan.kr(0), \\amp.kr(0.1));\n Out.ar(\\out.kr(0), snd);\n}).add;\n);\n\nSynth(\\neurosnare, [amp: 0.4]);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes SyncSaw madness."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\fun, {\n var src, freq = 25;\n var lagTime = \\lagTime.kr(0);\n var vibrato = \\vibrato.kr([ 1.3515662384033, 1.3061940193176, 0.604791264534, 1.2328997278214, 0.33569867610931, 0.40528120040894, 1.0865307760239, 1.22394572258, 1.7781081724167, 0.15319232463837 ], lagTime);\n \n var vibRatio = \\vibRatio.kr([ 2.9047239411079, 0.39578121743921, 0.10932490532285, 0.051738858660565, 0.17840235868831, 0.024495380749894, 3.9689920754869, 4.1139229659643, 0.23327501819885, 0.97643604193256 ], lagTime);\n \n var freqVary = \\freqVary.kr([ 143.76541377614, 14.25479545154, 6.6728691888342, 58.434807398325, 154.89385962072, 34.112274650688, 3.1140823758236, 10.42040949808, 158.59959972037, 1.2163188440936 ], lagTime);\n \n \n var numSrcs = vibrato.size;\n\n src = numSrcs.collect{|i|\n var freq2 = (freq * freqVary[i]) * LFNoise2.kr(0.01).range(1, 1.5);\n     \n SyncSaw.ar(freq2, freq2 * SinOsc.ar(Line.kr(1, vibrato[i], 20) * vibRatio[i], Rand(0, 0.8)).range(pi, pi * 0.1)) * rrand(0.05, 0.1)\n };\n \n src = Splay.ar(src);\n \n}).play\n);\n\nNdef(\\fun).fadeTime = 20;\n\nNdef(\\fun).rebuild\n\n(\nNdef(\\fun).setn(\n \\lagTime, [5],\n \\vibRatio, {exprand(0.1, 3)}!10,\n \\freqVary, {exprand(1, 150)}!10,\n \\vibrato, {exprand(0.3, 3)}!10\n)\n);\n(\nNdef(\\fun).setn(\n \\lagTime, [200],\n \\vibRatio, ({exprand(0.1, 3)}!10).sort,\n \\freqVary, ({exprand(1, 150)}!10).sort,\n \\vibrato, ({exprand(0.3, 3)}!10).sort\n)\n);\n\n(\nNdef(\\fun).xsetn(\n \\lagTime, [100],\n \\vibRatio, {exprand(0.1, 3)}!10,\n \\freqVary, {exprand(1, 150)}!10,\n \\vibrato, {exprand(0.3, 3)}!10\n))\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Convolution2L`."}, {"role": "assistant", "content": "```supercollider\n// longer crossfade\n(\nSynthDef(\\conv_test2, { |out, kernel, t_trig = 0|\n var input = Impulse.ar(1);\n var framesize = 2048; // must have power of two\n var result = Convolution2L.ar(input, kernel, t_trig, 2048, 5, 0.5);\n Out.ar(out, result);\n}).add\n);\n\nx = Synth(\\conv_test2, [\\kernel, b]);\n\n// changing the buffer number:\nx.set(\\kernel, c);\nx.set(\\t_trig, 1); // after this trigger, the change will take effect.\nx.set(\\kernel, d);\nx.set(\\t_trig, 1); // after this trigger, the change will take effect.\n\nd.zero;\n\n40.do { |it| d.set(20 * it + 10, 1) }; // changing the buffers' contents\n\nx.set(\\t_trig, 1); // after this trigger, the change will take effect.\n\nx.set(\\kernel, b);\nx.set(\\t_trig, 1); // after this trigger, the change will take effect.\n\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Dbrown`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a, freq, trig;\n a = Dbrown(0, 15, 1, inf);\n trig = Impulse.kr(MouseX.kr(1, 40, 1));\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `BBCutQuantise1` in SuperCollider?"}, {"role": "assistant", "content": "BBCutQuantise1 — Adds a swing rhythm in BBCut2 BBCutQuantise1 is experimental. Category: Libraries > BBCut > Cut procedures."}]} -{"conversations": [{"role": "user", "content": "What does `SimpleNumber.rectWindow` do?"}, {"role": "assistant", "content": "one-dimensional value Returns: a value for a rectangular window function between 0 and 1."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Creaking door or roulette wheel?."}, {"role": "assistant", "content": "```supercollider\n(\n\n{\n\nvar output, basePitch = 387, macroPitch, macroPitchAmt = 400;\nvar modOsc, modAmt = 1.3, amp = 0.8;\nvar creakRate, creakTrig, creakEnvGen, noise, combs, oscFreq;\n\nnoise = LFNoise1.ar(LFNoise0.kr(4.8).lag(0.4).range(3646, 7777), 0.6);\n\ncreakRate = EnvGen.kr(\n Env(\n [40, 25, 15, 2],\n [0.9, 0.6, 1.0],\n -4\n ),\n doneAction: 2\n\n);\ncreakTrig = Impulse.kr(creakRate);\n\ncreakEnvGen = EnvGen.kr(\n Env(\n [0.0, 1.0, 0.0],\n [0.02, 0.1],\n [5, -8]\n ),\n creakTrig,\n timeScale: SinOsc.kr(1.5).range(0.12, 0.26) * Line.kr(0.5, 2.3, 2)\n\n);\n\nmacroPitch = EnvGen.kr(\n Env(\n [0.0, 4, 0.1, 0.3, 0.4, 0.7, 0.9],\n [0.2, 0.2, 0.4, 0.3, 0.48, 0.59],\n [2, 2, -4, -3, -2, -4]\n )\n\n);\nmodOsc = SinOsc.ar( (basePitch + (macroPitch * macroPitchAmt)) * 0.17);\nmodOsc = SinOsc.ar( (basePitch + (macroPitch * macroPitchAmt)) * 0.232, modOsc * 0.3);\n\noscFreq = basePitch + (macroPitch * macroPitchAmt);\noscFreq = oscFreq * (1 + (creakEnvGen * 2));\noutput = SinOsc.ar(oscFreq, modOsc * modAmt, 1);\noutput = output * SinOsc.ar(SinOsc.kr(1.6).range(1220, 1355));\noutput = output + noise;\noutput = output.clip(-0.5, 0.5) * creakEnvGen * amp * TRand.kr(0.8, 1.0, creakTrig);\n\ncombs = Mix([CombC.ar(output, 0.2, 0.0084, 0.12), CombC.ar(output, 0.2, 0.00181, 0.03)]);\noutput = output + (combs * 0.2);\noutput ! 2\n}.play\n\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// data sharing between streams of same PmonoPar and streams of second PmonoPar,\n// use of Ptpar ensures that first stream of second PmonoPar comes after first stream of first PmonoPar,\n// consider also PpolyPar for such type of usage\n\n(\np = PmonoPar([\n [\n \\dur, Prand([1, 1, 2]/3, 40).collect(~dur = _),\n \\amp, Pseq([0.3, 0.1], 15) \n ],[\n \\dur, Pfunc { ~dur / 2 },\n \\midinote, Pshuf((50..70)) \n ]\n]);\n\nq = PmonoPar([\n [\n \\dur, Pfunc { ~dur },\n \\amp, Pseq([0.3, 0\n// …\n```"}, {"role": "assistant", "content": "data sharing between streams of same PmonoPar and streams of second PmonoPar, use of Ptpar ensures that first stream of second PmonoPar comes after first stream of first PmonoPar, (PmonoPar: monophonic event pattern for an arbitrary number of timed setting streams)"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//simple particlesystem.\n//with mouse controlling world gravity and system position\n\n(\nvar width= 300, height= 300, w, world,\nsys;\n\n//--world\nw= RedWindow(\"particlesystem test\", Rect(128, 64, width, height)).front;\nworld= RedWorld3(RedVector2D[width, height], 0, 20, -0.25); //dim,grav,maxvel,damp\n\n//--system\nsys= RedParticleSystem.new;\n\n//--loop\nw.draw{\n world.gravity= RedVector2D.newFrom(w.mouse/([width, height])-0.5);\n\n //--add new particles and update old\n sys.add(RedParticle(world, w.mouse+5.rand2, 0, RedVector2D[2.rand2, 10.rand], 1.5, 5.rand).age_(40.rrand(50)));\n sys.addForce(world.gravity);\n sys.update;\n\n //--render\n sys.do{|o| //iterate all particles in the system\n Pen.fillColor= Color.grey((o.age/50), 1);\n Pen.fillOval(Rect.aboutRedObject2D(o));\n };\n};\nw.play;\nCmdPeriod.doOnce({w.close});\n)\n```"}, {"role": "assistant", "content": "simple particlesystem. with mouse controlling world gravity and system position."}]} -{"conversations": [{"role": "user", "content": "Explain `BufSamples` in SuperCollider briefly."}, {"role": "assistant", "content": "BufSamples — Current number of samples in buffer. Returns the current number of allocated samples. A sample is not the same as a frame (compare with BufFrames); a frame includes the samples in each channel of the buffer. Only for a mono buffer are samples the same as frames. `samples = frames * numChannels` Category: UGens > Buffer > Info."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `GrayNoise`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-GrayNoise\", { |out = 0|\n Out.ar(out,\n GrayNoise.ar(-20.dbamp)\n )\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "How does multi-channel expansion work?"}, {"role": "assistant", "content": "If any argument of a UGen is an Array, the UGen is built once per element and the results are returned as an Array. So `SinOsc.ar([220, 330, 440])` is three oscillators, and `SinOsc.ar(220 * [1, 1.5])` is two. This is not a special stereo feature: it is uniform expansion, which is why `Splay.ar(SinOsc.ar([220,330,440]) * 0.1)` gives you a spread stereo field from three mono sources."}]} -{"conversations": [{"role": "user", "content": "What does `UChain.prepareWaitAndStart` do? What arguments does it take?"}, {"role": "assistant", "content": "Start preparation, then wait during waitTime seconds, and finally start the Arguments: target — A collection of targets.; startPos — Offset in seconds from the start of the event.."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PV_PhaseShift`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n(\nSynthDef(\"help-phaseShift\", { |out = 0|\n var in, chain;\n in = SinOsc.ar(500);\n chain = FFT(LocalBuf(2048), in);\n chain = PV_PhaseShift(chain, LFNoise2.kr(1, 180, 180));\n Out.ar(out, 0.1 * IFFT(chain).dup);\n}).play(s);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// q.zoom sets all the influx'es inScalers AND RandomOrbit's excursion from current state.\n\nq.zoom = q.zoom?1;\n\nq.setZoom = {|ev, val|\n val = val.clip(0.05, 1.0).round(0.05);\n // \"global ZOOM f. RandomOrbits and Influxes: %\\n\".postf(val);\n q.zoom = val;\n // do external funcs here\n try{ q.prez.ezs.value = q.zoom };\n q.inphlux.inScaler = q.zoom;\n // return value\n val\n};\n// increment / decrement\nq.incZoom = {|ev, inc=0.1|\n q.setZoom((q.zoom + inc));\n};\n\n\n// set it to poti on ana in 8 (it was 7, not worked)\nMKtl(\\xosc).elAt('inA').at(7).action.add(\\setZoom, {|el|\n var val = el.value.clip(0.05, 1).round(0.05);\n if (val != q.zoom) {\n \"zoom from xosc: %\\n\".postf(val);\n q.setZoom(val)\n };\n});\n```"}, {"role": "assistant", "content": "q.zoom sets all the influx'es inScalers AND RandomOrbit's excursion from current state."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// randomly modulate params\n(\n{ FBSineL.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(1, 32, 33),\n LFNoise2.kr(1, 0.5),\n LFNoise2.kr(1, 0.05, 1.05),\n LFNoise2.kr(1, 0.3, 0.3)\n) * 0.2 }.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// randomly modulate params\n(\n{ FBSineL.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(1, 32, 33),\n LFNoise2.kr(1, 0.5),\n LFNoise2.kr(1, 0.05, 1.05),\n LFNoise2.kr(1, 0.3, 0.3)\n) * 0.2 }.play(s);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Where does the magic frequency 261.6255653006 come from?"}, {"role": "assistant", "content": "SuperCollider forum — Where does the magic frequency 261.6255653006 come from?\n\nThinking about this a bit more, on one hand it might be useful if set (and everything else in Event) could fetch not only the msgFunc from the synthDesc, which it does (if args are set to []), but perhaps also the default values for the synth controls... and then used those in preference to Event defaults if “nothing is specified” for some key in the event. Alas “nothing is specified” is tedious to detect in Event, as it does its own calculations which have a lot of inputs (esp. for the frequency stuff). So, one could implement such a policy more explicitly in a \\finish callback that e.g. looks up in synthDesc only specific keys (say specified in a defArgs, possibly with [] meaning all found in the synthDesc) and sets only those if “not set” in event.\n\nI almost started coding this idea, but I realised that’s actually inferior to just putting the synth defaults in another event/environment, and chaining that before the event... which is exactly what I usually do with a Pdef.envir. That approach, besides sidestepping the issue of detecting what’s “not set” in the Event, has an extra advantage that a persistent set of defaults, after being initialized with the synthdef ones, can be easily tweaked in a gui. When I find myself that I often change the default value of some control like that, I go back and change the synthdef default. Because of that workflow, in which I always have the defaults loaded in an chained envir, I didn’t even have much realization of Event defaults for things like amp, freq etc. And I didn’t need type: \\set much until recently... for which getting the args constructed in that case is also rather easy as Pdef(...).controlKeys. Even without Pdefs, that’s straightforward (past loading those defaults into an event)\n\n```supercollider\ne = SynthDescLib.global.synthDescs.at(\\default).controls.inject((), { |e, c| e[c.name] = c.defaultValue });\n(instrument: \\default, dur: 1, amp: 0.2).next(e).play\n```"}]} -{"conversations": [{"role": "user", "content": "What does `UChain.removeGroup` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: group — (describe argument here). Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Wow, the conciseness of SuperCollider is wonderful!."}, {"role": "assistant", "content": "```supercollider\n(\na=Array.fib(64,0,1);b=Array.fill(size:12,function:{arg i;a[i]%8});\np=1/8;Pdef(\\x,Pbind(\\dur,p,\\degree,Pseq(b,1,0)));\nr=Array.fill(12,{arg i;Pbindf(Pdef(\\x),\\mtranspose,b[i]);});\nPseq(r,(1/p)).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Just experimenting with patterns."}, {"role": "assistant", "content": "```supercollider\n/* Some Funky Klangs - Totally botched the math on what I was trying to do but it sounds better this way */\n\n( \nSynthDef(\\DistKlangBlip, { \n | out = 0, release = 1, freq1 = 1, freq2 = 5, freq3 = 8, freqMult = 4 | \n var env = Linen.kr(Impulse.kr(0), 0.01, 1, release, doneAction:2); \n var freqs = ([freq1, freq2, freq3] * freqMult).midicps; \n var klang = Klang.ar(`[freqs, nil, nil ], 1, 0); \n Out.ar(out, klang.tanh!2 * env * 0.5) \n}).add\n\n);\n\n( \n Pbind(*[ \n instrument: \\DistKlangBlip, \n dur: Pxrand([0.25, 0.5], inf) * 0.5, \n release: Pkey(\\dur), \n freqMult: Pxrand((3..12), inf), \n freq2: Prand([4,5], inf), \n freq3: Prand([8,12], inf) \n]).play; \n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes an experiment with roots of unity in supercollider."}, {"role": "assistant", "content": "```supercollider\n(\n\n~divisors = {\n arg n;\n ~divs = List.newClear(0);\n for( 1, floor(sqrt(n)), {arg i; if(n%i==0,{\n //i.postln;\n ~divs.add(i);\n // (i==n.div(i)).postln;\n if(i==n.div(i),{},{~divs.add(n.div(i))});\n },{});\n });\n ~divs.sort;\n ~divs;\n};\n\n\nSynthDef(\\rootsOfUnitySum, { |out=0,freq=1,amp=1,n=1,ks=#[1]|\n var l,sigl,sigr,env;\n\n\n sigl = SinOsc.ar(freq:0,mul:0);\n sigr = SinOsc.ar(freq:0,mul:0);\n ks.do({arg item,i;\n k = item;\n sigr = sigr+SinOsc.ar(freq:freq*2pi*k/n,mul:amp,phase:0.5*pi);\n sigl = sigl+SinOsc.ar(freq:freq*2pi*k/n,mul:amp);\n });\n env = EnvGen.kr(Env.linen(attackTime: 0.001, sustainTime: 1, releaseTime: 0.01, level: 1.0, curve: 'lin'), doneAction: Done.freeSelf);\n sigr = sigr*env;\n sigl = sigl*env;\n\n Out.ar(out, [sigl,sigr])\n}).add;\n\n\n~getPbind = { arg n, amps, durs, freq;\n ~nums = ~divisors.value(n);\n r = Pbind(\\instrument,\\rootsOfUnitySum,\n \\amp,amps,\n \\dur,durs,\n \\freq,freq,\n \\n,Pseq([n],~nums.size),\n \\ks , Pseq(all{:~divisors.value(n),n<-~nums},1)).trace();\n r\n};\n\n~seq = (1..13);\n~tau = all{:~divisors.value(n).size,n<-~seq};\n\n\n~r = Pseq(all{:~getPbind.value(\n n:n,\n amps:Pseq(all{:0.5/t,t<-~tau},1),\n durs:Pseq(all{:0.3333/t,t<-~tau},1),\n freq:220/3),n<-~seq},1);\n\n~s = Pseq(all{:~getPbind.value(\n n:n,\n amps:Pseq(all{:0.5/t,t<-~tau},1),\n durs:Pseq(all{:0.5/t,t<-~tau},1),\n freq:110),n<-~seq},1);\n\n~t = Pseq(all{:~getPbind.value(\n n:n,\n amps:Pseq(all{:0.5/t,t<-~tau},1),\n durs:Pseq(all{:1/t,t<-~tau},1),\n freq:220),n<-~seq},1);\n\n~x = Pseq([\n Ppar([~t],1),\n Ppar([~s],1),\n Ppar([~s,~t],1),\n Ppar([~r],1),\n Ppar([~r,~t],1),\n Ppar([~r,~s],1),\n Ppar([~r,~s,~t],1),\n ],inf);\n\n);\n\nPdef(\\mplayer, ~x).clock_(TempoClock(100/60)).play;\nPdef(\\mplayer, Pn(Event.silent)).fadeTime_(8);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `EaseOutInQuad.value` do? What arguments does it take?"}, {"role": "assistant", "content": "Quadratic ease-out/in Arguments: t — a Float between 0.0 and 1.0.."}]} -{"conversations": [{"role": "user", "content": "What is `Harmonics`?"}, {"role": "assistant", "content": "Harmonics — Convenient factory for filling buffers with harmonics on the server"}, {"role": "user", "content": "What does `Harmonics.new` do?"}, {"role": "assistant", "content": "Create a new Harmonics array of size. Nothing is filled in for you, until instance methods are applied. `a = Harmonics.new(16); // just returns an instance of Harmon`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na.ramp(1.0, 1.0); // returns a harmonic series\n\nb = Buffer.alloc(s, 512, 1);\n// harmonic series for freqs, ramp down for amps\nb.sine2(a.ramp(1.0, 1.0).postln, a.ramp(0.5, -0.025).postln, true, true, true);\n(\nz = SynthDef(\"help-Osc\", { |out = 0, bufnum = 0|\n Out.ar(out,\n Osc.ar(bufnum, 200, 0, 0.5)\n )\n});\n);\ny = z.play(s, [\\out, 0, \\bufnum, b]);\ny.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// The finishing of a ZeroXBufRd is not detemined by finite demand rate ugens but by an overall envelope, \n// its release section is triggered by a maximum number of half wavesets ('length') or a maximum time. \n\n// Buffers from Ex.4\n\n{ ZeroXBufRd.ar(b[0], z[0], rate: 1, length: 10, rel: 0.01) }.plot(0.03)\n\n{ ZeroXBufRd.ar(b[0], z[0], rate: 1, maxTime: 0.01, rel: 0.01) }.plot(0.03)\n\n\n// envelopes can be differentiated\n\n{ ZeroXBufRd.ar(b[0..1], z[0..1], rate: 1, maxTime: [0.01, 0.005], rel: [0.00\n// …\n```"}, {"role": "assistant", "content": "The finishing of a ZeroXBufRd is not detemined by finite demand rate ugens but by an overall envelope, its release section is triggered by a maximum number of half wavesets ('length') or a maximum time. (ZeroXBufRd: reads consecutive sequences of segments between zero crossings from one or more buffers with demand-rate control)"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Pan Sonic emulation - Katodivaihe - lahetys?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a, b, c, d, n, e, f, out;\n\n a = Impulse.ar(8)*1.5;\n\n b = WhiteNoise.ar * Env([1.0,1.0,0.0],[0.01,0.01],\\step).ar(0, Impulse.ar(1 )) ;\n b = FreeVerb.ar(b, 0.5, 0.4)*2.5;\n\n c = SinOsc.ar(40) * Env.perc(0.01,0.2).ar(0, TDuty.ar(Dseq([1/4,1/2,1/8,1/8],inf)));\n 5.do{ c = (c.distort + c)*0.75};\n c = c * 1.5;\n\n d = LPF.ar(Saw.ar([20,47]).sum , XLine.ar(4000,200,0.5)) * Env.perc.ar(0, Impulse.ar(1/16)) * 0.5;\n d = (GVerb.ar( d , roomsize:10, revtime:6) * 200).clip(-1.0,1.0) * 0.3;\n\n n = 12;\n e = ( Saw.ar( 40*(1..n) * ({ LFNoise1.ar(0.1).range(1,1.01) } ! n) ) *\n ({ LFNoise1.ar(0.1).range(0.0,1.0) }!n)).sum * 10;\n e = CombC.ar(e, 0.1, 0.1, 4) + e;\n e = e.tanh * 0.3 * SinOsc.ar(0.05).range(0.5,1.0);\n e = e.dup;\n e = e * SinOsc.ar(0.03).range(0.2,1.0) * 0.5;\n\n f = Blip.ar(100) * Blip.ar(100) * Env([0.0,0.0,1.0],[8,8],[\\step,\\linear,\\step])\n .ar(0, Impulse.ar(1/16)) * 2 ;\n\n out = ((a + b + c + f) ! 2) + d + e;\n out = out * 0.2\n\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot; // start the server\n(\n// something to record\nSynthDef(\"bubbles\", { |out|\n var f, zout;\n f = LFSaw.kr(0.4, 0, 24, LFSaw.kr([8, 7.23], 0, 3, 80)).midicps; // glissando function\n zout = CombN.ar(SinOsc.ar(f, 0, 0.04), 0.2, 0.2, 4); // echoing sine wave\n Out.ar(out, zout)\n}).add;\n\n// this will record to the disk\nSynthDef(\"help-Diskout\", { |bufnum|\n DiskOut.ar(bufnum, In.ar(0, 2));\n}).add;\n\n// this will play it back\nSynthDef(\"help-Diskin-2ch\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot; // start the server\n(\n// something to record\nSynthDef(\"bubbles\", { |out|\n var f, zout;\n f = LFSaw.kr(0.4, 0, 24, LFSaw.kr([8, 7.23], 0, 3, 80)).midicps; // glissando function\n zout = CombN.ar(SinOsc.ar(f, 0, 0.04), 0.2, 0.2, 4); // echoing sine wave\n Out.ar(out, zout)\n}).add;\n\n// this will record to the disk\nSynthDef(\"help-Diskout\", { |bufnum|\n DiskOut.ar(bufnum, In.ar(0, 2));\n}).add;\n\n// this will play it back\nSynthDef(\"help-Diskin-2chan\", { |out, bufnum = 0|\n Out.ar(out, DiskIn.ar(2, bufnum))\n}).add;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\ns.boot;\nNdef(\\a).ar;\nNdef(\\k).kr;\n\n // make a MonitorGui with all bells and whistles\nm = MonitorGui.new(bounds: 500@40, options: [\\name, \\level, \\fade]);\n\n // when it has a kr proxy, it is visible, but disabled\nm.object_(Ndef(\\k));\n // with an ar proxy, it is enabled\nm.object_(Ndef(\\a));\n\n\n // show its play state\nNdef(\\a).play\n // and volume\nNdef(\\a).vol_(0.25);\n\n // NOTE: shift-clicking the play button opens a playN dialog!\n\nNdef(\\a).stop;\nNdef(\\a).play(0);\n```"}, {"role": "assistant", "content": "make a MonitorGui with all bells and whistles when it has a kr proxy, it is visible, but disabled (MonitorGui: display and control a Monitor)"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes THX Deep Note inspired synth sketch."}, {"role": "assistant", "content": "```supercollider\n// A. Broz: Deep Choir (v2, 2020-10-29)\n(\n~numVoices = 30;\n\n~chaos = { |range = 1.0|\n ~numVoices collect: { exprand(180 / range, 260 * range) }\n};\n\n~bigChord = { |fund = 30, harmonics = 5|\n ~numVoices collect: {\n fund\n * rrand(1, harmonics) // build chord\n * rrand(1, 2) * rrand(1, 2) // octaves\n + rrand(-1.2, 1.2) // beats\n }\n};\n\n// Try with Pmono\nSynthDef(\\fakeTHX, {\n var env = EnvGen.kr(\n envelope: Env.adsr(15, \\decay.kr(10), 1, 10, curve: \\sine),\n gate: \\gate.kr(1),\n doneAction: Done.freeSelf,\n );\n var chord = \\freq.kr(~chaos.value, \\lag.kr(10));\n var meander = \\meander.kr(0.3, 8);\n var sig = chord collect: { |f|\n f = f * LFNoise2.kr(rrand(0.3, 0.8)).exprange(1 - meander, 1 + meander);\n BLowPass.ar(Saw.ar(f), f, 0.6);\n };\n sig = Splay.ar(sig, 0.8) * env * \\mul.kr(0.5, 3);\n Out.ar(0, sig);\n}).add;\n);\n\n(\nRoutine({\n var fakeTHX = Synth(\\fakeTHX);\n\n 10.wait;\n\n fakeTHX.set(\\meander, 0);\n\n fakeTHX.set(\\freq, ~bigChord.(30, 5));\n\n 10.wait;\n\n fakeTHX.set(\\gate, 0);\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `DbufTag` in SuperCollider briefly."}, {"role": "assistant", "content": "DbufTag — demand rate tag system on a buffer Emil Post's tag system as a demand rate ugen - Buffer version. Category: UGens > Demand."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\n(\nvar winenv;\n// a custom envelope\nwinenv = Env([0, 1, 0], [0.5, 0.5], [8, -8]);\nz = Buffer.sendCollection(s, winenv.discretize, 1);\n\nSynthDef(\\in_grain_test, { |out, gate = 1, amp = 1, envbuf|\n var pan, env;\n // use mouse x to control panning\n pan = MouseX.kr(-1, 1);\n env = EnvGen.kr(\n Env([0, 1, 0], [1, 1], \\sin, 1),\n gate,\n levelScale: amp,\n doneAction: Done.freeSelf);\n Out.ar(out,\n GrainIn.ar(2\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\n(\nvar winenv;\n// a custom envelope\nwinenv = Env([0, 1, 0], [0.5, 0.5], [8, -8]);\nz = Buffer.sendCollection(s, winenv.discretize, 1);\n\nSynthDef(\\in_grain_test, { |out, gate = 1, amp = 1, envbuf|\n var pan, env;\n // use mouse x to control panning\n pan = MouseX.kr(-1, 1);\n env = EnvGen.kr(\n Env([0, 1, 0], [1, 1], \\sin, 1),\n gate,\n levelScale: amp,\n doneAction: Done.freeSelf);\n Out.ar(out,\n GrainIn.ar(2, Impulse.kr(32), 1, PinkNoise.ar * 0.05, pan, envbuf) * env)\n}).add;\n\n);\n\n// use built-in env\nx = Synth(\\in_grain_test, [\\envbuf, -1])\n\n// switch to the custom env\nx.set(\\envbuf, z)\nx.set(\\envbuf, -1);\n\nx.set(\\gate, 0);\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// use input amplitude to control Pulse amplitude - use headphones to prevent feedback.\n{ Pulse.ar(90, 0.3, Amplitude.kr(SoundIn.ar(0))) }.play;\n```"}, {"role": "assistant", "content": "use input amplitude to control Pulse amplitude - use headphones to prevent feedback. (Amplitude: Amplitude follower)"}]} -{"conversations": [{"role": "user", "content": "What are you good at?"}, {"role": "assistant", "content": "SuperCollider. I can explain its classes and UGens, write SynthDefs and patches, read a patch back to you, and tell you why one does not compile. I am 198M parameters; I am not a general assistant."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PackFFT`."}, {"role": "assistant", "content": "```supercollider\n// Reminder: This isn't the intended typical usage! It's OK to do this though.\n(\nx = {\n var mags, phases, chain, sig;\n // Create simple undulating magnitudes\n mags = { FSinOsc.kr(ExpRand(0.1, 1)).range(0, 1) }.dup(100);\n // Then give them a \"rolloff\" to make the sound less unpleasant\n mags = mags * ((1, 0.99 .. 0.01).squared);\n // Let's turn the bins on and off at different rates, I'm *sure* that'll sound interesting\n mags = mags * { LFPulse.kr(2 ** IRand(-3, 5)).range(0, 1) }.dup(100);\n // Let's ignore phase for now\n phases = 0.dup(100);\n // We need to create an FFT chain to feed our data in to.\n // The easiest way is to do an FFT on some signal which we then ignore!\n chain = FFT(LocalBuf(512), FSinOsc.ar);\n // Now we can do the packing\n chain = PackFFT(chain, 512, [mags, phases].flop.flatten, 0, 99, 1);\n sig = IFFT(chain);\n sig.dup\n}.play\n);\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(SynthDef(\\x, {|midi = 60, amp = 0.8| Out.ar(0, Pan2.ar(SinOsc.ar(midi.midicps, mul: EnvGen.kr(Env.perc(0, 0.5), timeScale: 0.5, levelScale: 0.3)), Rand(-1, 1)) * EnvGen.kr(Env.perc(0, 0.5), timeScale: 1.3*0.5, levelScale: Rand(0.3, 0.5), doneAction:2));}).add;)\n\n(~phase = Pbind(*[ instrument: \\x, dur: 0.5, midi: Pseq([0, 4, 7] + 60, inf)]);\n5.do({|val| ~phase.play(TempoClock.new((110 + (0.5 * val)) / 60))}); )\n```"}, {"role": "assistant", "content": "Experimenting with some Reich style phasings\r\n\r\nAudio: http://soundcloud.com/schemawound/goodnightworld."}]} -{"conversations": [{"role": "user", "content": "What is a SynthDef?"}, {"role": "assistant", "content": "A SynthDef is a named, compiled server-side instrument: a UGen graph plus named controls. You build one with SynthDef(\\name, { |args| ... }).add, and then play instances with Synth(\\name)."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes a Panthera Pardus meditates about his melanism."}, {"role": "assistant", "content": "```supercollider\n// a Panthera Pardus meditates about his melanism\n\n(\n~chrs = {|in, speed| DelayC.ar(in, 0.5, Array.fill(12, {|i| LFNoise2.ar(speed).range(0.022, 0.024);}).sum)};\n~phas = {|in, speed=1| var chain; chain = in+FreqShift.ar(in, 0, SinOsc.kr(speed).range(0, pi)).tanh; chain = chain + FreqShift.ar(chain, 0, SinOsc.kr(speed*0.97).range(0, pi)).tanh; chain=(chain*0.5).tanh; };\n~smear = {|in, bins=50| var chain; chain=FFT(LocalBuf(2048), in); chain=PV_MagSmear(chain, bins); chain=IFFT(chain)*0.5; };\n\nNdef.clear;\nNdef(\\pantheraPardus___).play;\nNdef(\\___hisInner).play;\nNdef(\\pantheraPardus___).fadeTime = 5;\nNdef(\\___hisInner).fadeTime = 50;\n\nNdef(\\pantheraPardus___, {arg amp=1;\n var sig, env, sig0, ctrl;\n ctrl = LFGauss.kr(5, 0.15);\n sig = (Saw.ar([LFNoise1.kr(1).range(15, 30), 0.025], 0.14)) * LFNoise2.kr(1).range(0.5, 1);\n sig = (sig + PinkNoise.ar(0.1) * LFNoise2.kr(1).range(0.1, 0.4)) * ctrl;\n sig = sig*0.25 + ~chrs.(~phas.(sig, [0.2, 0.174]), [0.1, 0.12]);\n sig = DynKlank.ar(`[[100, 200, 300, 1000, 4000, 9000], (ctrl.range(0.2/6, 1/6)*LFNoise2.kr(1).range(0.2, 1))!6, 0.025], sig*0.2);\n sig = ~smear.(sig, 5);\n sig = HPF.ar(LPF.ar(sig, (LFNoise2.kr(1.25).range(100, 2000))), 250); \n sig = Limiter.ar(GVerb.ar(Limiter.ar(sig), 4.5, 0.2, 0.9, 0.1), -6.dbamp)*15;\n});\n\nNdef(\\___hisInner, {arg amp=1;\n var sig = Saw.ar(Duty.kr(Dseq([2, 4, 1, 1/4, 8], inf), 0, Dseq([61+(1/6), [63+(3/6), 58+(3/6)], 64+(3/6)].midicps, inf)), 0.14);\n sig = LPF.ar(sig, LFNoise0.kr(15).range(5120, 9400).lag(0.001), 0.01);\n sig = DynKlank.ar(`[[100, LFNoise0.kr(2).range(300, 320), 4000], 1/3, 0.04], sig);\n sig = ~chrs.(~phas.(sig, [0.2, 0.174]), [0.1, 0.12]);\n sig = HPF.ar(LPF.ar(sig, 1200), 400)*15;\n sig = Limiter.ar(FreeVerb.ar(sig, [0.8, 0.78]), -6.dbamp);\n});\n)\n```"}]} -{"conversations": [{"role": "user", "content": "How do I make a delay line?"}, {"role": "assistant", "content": "`CombN.ar(in, maxdelaytime, delaytime, decaytime)` is a feedback delay: maxdelaytime is the buffer size, delaytime the actual delay (and it can modulate), decaytime how long the repeats take to die. For a clean single echo use `DelayN.ar(in, maxdelaytime, delaytime)`, which has no feedback. Both replace the `in` with the delayed signal, so mix with the dry: `dry + CombN.ar(dry, 0.5, 0.3, 2) * 0.4`."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LinLin`."}, {"role": "assistant", "content": "```supercollider\n// examples:\n\n(\n{\n var mod = SinOsc.kr(Line.kr(1, 10, 10));\n SinOsc.ar(LinLin.kr(mod, -1, 1, 100, 900)) * 0.1\n}.play;\n);\n\n// modulating destination values.\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(LinLin.ar(mod, -1, 1, MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1))) * 0.1\n}.play;\n);\n\n// modulating source and destination values.\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(\n LinLin.ar(mod,\n SinOsc.kr(0.2), SinOsc.kr(0.2543),\n MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1)\n )\n ) * 0.1\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `LADSPA.ladspalist_path` do?"}, {"role": "assistant", "content": "set/get the location of the `ladspalist` binary, used to print a list of available"}]} -{"conversations": [{"role": "user", "content": "What does `SimpleNumber.ellintD` do?"}, {"role": "assistant", "content": "Returns the incomplete elliptic integral D(phi, k), Legendre form. Requires `-1 <= k <="}]} -{"conversations": [{"role": "user", "content": "What does `ArrayedCollection.series` do?"}, {"role": "assistant", "content": "Fill an ArrayedCollection with an arithmetic series. `Array.series(5, 10,"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Dshuf`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a, freq, trig;\n a = Dseq([Dshuf([1, 3, 2, 7, 8.5], 3)], inf);\n trig = Impulse.kr(MouseX.kr(1, 40, 1));\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n);\n\n// audio rate\n(\n{\n var a, freq, trig;\n a = Dseq([Dshuf({ 10.rand } ! 81, 5)], inf).poll;\n trig = Impulse.ar(MouseX.kr(1, 10000, 1));\n freq = Demand.ar(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n);\n\n// embedded structures\n(\n{\n var a, freq, trig;\n a = Dseq([Dshuf([Drand([1, 2, 3], 1), 3, Drand([20, 23, 56], 1), 7, 8.5], 8)], inf);\n trig = Impulse.kr(MouseX.kr(1, 40, 1));\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What are the arguments of EnvGen?"}, {"role": "assistant", "content": "`EnvGen.ar(envelope, gate, levelScale, levelBias, timeScale, doneAction)` — or the .kr form. Envelope is an Env; gate is the signal that holds the envelope open (a number for a one-shot, a trigger or gate control for a sustained sound); levelScale and levelBias scale and offset the output; timeScale stretches durations. Use `doneAction: 2` on a one-shot so the Synth frees itself."}]} -{"conversations": [{"role": "user", "content": "What does `AbstractPlayerProxy.socketStatus` do?"}, {"role": "assistant", "content": "base class for players that act as proxies for another player"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// example: two SuperCollider apps communicating\n\n// application 1:\nn = NetAddr(\"127.0.0.1\", 57120); // the url should be the one of computer of app 2 (or nil)\n\no = OSCresponderNode(n, '/chat', { |t, r, msg| (\"time:\" + t).postln; msg[1].postln }).add;\n\n// application 2:\nm = NetAddr(\"127.0.0.1\", 57120); // the url should be the one of computer of app 1\nm.sendMsg(\"/chat\", \"Hello App 1\");\n\n// sending bundles (including timestamps)\n(\nm.sendBundle(2.0, [\"/chat\", \"Hello App 1\"], [\"/chat\", \"Hallo Wurld\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// example: two SuperCollider apps communicating\n\n// application 1:\nn = NetAddr(\"127.0.0.1\", 57120); // the url should be the one of computer of app 2 (or nil)\n\no = OSCresponderNode(n, '/chat', { |t, r, msg| (\"time:\" + t).postln; msg[1].postln }).add;\n\n// application 2:\nm = NetAddr(\"127.0.0.1\", 57120); // the url should be the one of computer of app 1\nm.sendMsg(\"/chat\", \"Hello App 1\");\n\n// sending bundles (including timestamps)\n(\nm.sendBundle(2.0, [\"/chat\", \"Hello App 1\"], [\"/chat\", \"Hallo Wurld\"]);\nm.sendBundle(0.0, [\"/chat\", \"Hello App 1\"], [\"/chat\", \"Hallo Wurld\"]);\n);\n\n// end application 1:\no.remove;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `KeyMode.kr` do? What arguments does it take?"}, {"role": "assistant", "content": "Find best correlated key mode with chromagram between major, minor and chromatic cluster Arguments: chain — [fft] Audio input to track. This must have been pre-analysed by a 4096 size FFT. No other FFT sizes are valid except as noted below. `// With standard hop of half FFT size = 2048 samples`; keydecay — [sk] Number of seconds for the influence of a window on the final key decision to decay by 40dB (to 0.01 its original value).; chromaleak — [sk] Each frame, the chroma values are set to the previous value multiplied by the chromadecay. 0.0 will start each frame afresh with no memory.."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `RunningMin`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n SinOsc.ar(\n RunningMin.ar(Dust.ar(20), Impulse.ar(0.4)) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// follow a sine lfo, reset rate controlled by mouse x\n(\n{\n SinOsc.ar(\n RunningMin.kr(SinOsc.kr(0.2), Impulse.kr(MouseX.kr(0.01, 2, 1))) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `RedSFPlayer.stop` do? What arguments does it take?"}, {"role": "assistant", "content": "plays soundfiles (from memory) Arguments: fadeTime — In seconds.."}]} -{"conversations": [{"role": "user", "content": "What is a UGen?"}, {"role": "assistant", "content": "A UGen is a unit generator: the primitive signal-processing node of the server. SinOsc, Saw, WhiteNoise, LPF and EnvGen are UGens, and they are wired into a graph inside a SynthDef."}]} -{"conversations": [{"role": "user", "content": "What does `SplineGui.onSelect` do?"}, {"role": "assistant", "content": "A handler evaluated when you select a point. arg: selected index, Returns: function"}]} -{"conversations": [{"role": "user", "content": "List of exit codes?"}, {"role": "assistant", "content": "SuperCollider forum — List of exit codes?\n\n7068696c:\n\n```supercollider\no = s.options;\no.inDevice = nil;\no.outDevice = \"ASIO : ASIO4ALL\";\n```\n\nHmmmm... In earlier SC versions, it wouldn’t have worked to have a nil input device in scsynth either (which is admittedly a problem for devices with no inputs). This was fixed in scsynth but it’s possible that it wasn’t fully fixed in supernova.\n\n@MarcinP – any thoughts about this? (I remember you worked on scsynth device selection but I don’t recall who ported that to supernova.)\n\nhjh"}]} -{"conversations": [{"role": "user", "content": "Where does the magic frequency 261.6255653006 come from?"}, {"role": "assistant", "content": "SuperCollider forum — Where does the magic frequency 261.6255653006 come from?\n\nThinking about this a bit more, on one hand it might be useful if set (and everything else in Event) could fetch not only the msgFunc from the synthDesc, which it does (if args are set to []), but perhaps also the default values for the synth controls... and then used those in preference to Event defaults if “nothing is specified” for some key in the event. Alas “nothing is specified” is tedious to detect in Event, as it does its own calculations which have a lot of inputs (esp. for the frequency stuff). So, one could implement such a policy more explicitly in a \\finish callback that e.g. looks up in synthDesc only specific keys (say specified in a defArgs, possibly with [] meaning all found in the synthDesc) and sets only those if “not set” in event.\n\nI almost started coding this idea, but I realised that’s actually inferior to just putting the synth defaults in another event/environment, and chaining that before the event... which is exactly what I usually do with a Pdef.envir. That approach, besides sidestepping the issue of detecting what’s “not set” in the Event, has an extra advantage that a persistent set of defaults, after being initialized with the synthdef ones, can be easily tweaked in a gui. When I find myself that I often change the default value of some control like that, I go back and change the synthdef default. Because of that workflow, in which I always have the defaults loaded in an chained envir, I didn’t even have much realization of Event defaults for things like amp, freq etc. And I didn’t need type: \\set much until recently... for which getting the args constructed in that case is also rather easy as Pdef(...).controlKeys. Even without Pdefs, that’s straightforward (past loading those defaults into an event)\n\n```supercollider\ne = SynthDescLib.global.synthDescs.at(\\default).controls.inject((), { |e, c| e[c.name] = c.defaultValue });\n(instrument: \\default, dur: 1, amp: 0.2).next(e).play\n```"}]} -{"conversations": [{"role": "user", "content": "Write a chord progression with Pbind."}, {"role": "assistant", "content": "Put an array of degrees in the pattern, use \\strum to spread the chord, and the default instrument\nplays all notes of each event.\n\n```supercollider\n(\nPbind(\n \\scale, Scale.minor,\n \\root, 2,\n \\degree, Pseq([[0, 4, 7], [-3, 0, 4], [-5, -1, 2], [0, 4, 7]], inf),\n \\dur, 1.5,\n \\strum, 0.02,\n \\amp, 0.12,\n \\legato, 0.9\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PV_RandWipe`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n(\n// trig with MouseY\nSynthDef(\"help-randWipe\", { |out = 0|\n var inA, chainA, inB, chainB, chain;\n inA = Mix.arFill(6, { LFSaw.ar(exprand(400, 1000), 0, 0.1) });\n inB = Mix.arFill(6, { LFPulse.ar(exprand(80, 400), 0, 0.2, SinOsc.kr(8.0.rand, 0, 0.2).max(0)) });\n chainA = FFT(LocalBuf(2048), inA);\n chainB = FFT(LocalBuf(2048), inB);\n chain = PV_RandWipe(chainA, chainB, MouseX.kr.poll, MouseY.kr.poll > 0.5);\n Out.ar(out, 0.5 * IFFT(chain).dup);\n}).play(s);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// ServerQuit\ns.boot;\nf = { |server| \"------------The server '%' has quit.------------\\n\".postf(server) };\nServerQuit.add(f, \\default);\ns.quit; // quit the server and observe the post\ns.boot;\nServerQuit.remove(f, \\default); // remove it again\ns.quit; // no post.\nServerQuit.add(f, Server.internal;\nServer.internal.boot;\nServer.internal.quit;\nServerQuit.removeAll; // clear all\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// ServerQuit\ns.boot;\nf = { |server| \"------------The server '%' has quit.------------\\n\".postf(server) };\nServerQuit.add(f, \\default);\ns.quit; // quit the server and observe the post\ns.boot;\nServerQuit.remove(f, \\default); // remove it again\ns.quit; // no post.\nServerQuit.add(f, Server.internal);\nServer.internal.boot;\nServer.internal.quit;\nServerQuit.removeAll; // clear all\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Condition`."}, {"role": "assistant", "content": "```supercollider\n// the same, using hang\n\n(\nc = Condition.new;\n\nRoutine {\n 1.wait;\n \"waited for 1 second\".postln;\n 1.wait;\n \"waited for another second, now waiting for you ... \".postln;\n c.hang;\n \"the condition has stopped waiting.\".postln;\n 1.wait;\n \"waited for another second\".postln;\n \"waiting for you ... \".postln;\n c.hang;\n \"the condition has stopped waiting.\".postln;\n}.play;\n);\n\n// continue\nc.unhang;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n \n// definition for future reference in arbitrary Environments\n\n(\np = Pbind(\n \\midinote, PLnaryFunc(\\f, \\src, [\\dev]),\n \\dur, 0.1\n);\n);\n\n\n// define Environment and play\n\n(\ne = (f: { |x,y| x + y }, src: PLseq([61, 62]), dev: Pbrown(-5, 5, 0.2) );\n\ne.use { x = p.play };\n);\n\n\n// replace Function input Patterns\n\ne.dev = PLseq((0, 0.5..7));\n\ne.src = PLseq([61,64,6\n// …\n```"}, {"role": "assistant", "content": "definition for future reference in arbitrary Environments define Environment and play (PLnaryFunc: dynamic scope PnaryFunc variant)"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes ~chaos2 (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\n~chaos2={\n var signal, myFrequency, frequencyMin=0.1, frequencyMax=30, myAmplitude, amplitudeMin=0.01, amplitudeMax=0.6, myPhase, phaseMin=0, phaseMax=1.5;\n myFrequency = Array.fill(2, {[rrand(frequencyMin, frequencyMax)]});\n myAmplitude = Array.fill(2, {[rrand(amplitudeMin, amplitudeMax)]});\n myPhase = Array.fill(2, {[rrand(phaseMin, phaseMax)]});\n signal = LeakDC.ar(ChaosGen.allSubclasses.choose.ar(myFrequency, myPhase, myAmplitude));\n myFrequency = (myFrequency + Array.fill(2, {[rrand(frequencyMin, frequencyMax)]})) * (signal);\n myAmplitude = (myAmplitude + Array.fill(2, {[rrand(amplitudeMin, amplitudeMax)]})) * (signal);\n myPhase = (myPhase + Array.fill(2, {[rrand(phaseMin, phaseMax)]}))* (signal);\n signal = LeakDC.ar(ChaosGen.allSubclasses.choose.ar(myFrequency, myPhase, myAmplitude));\n myFrequency = (myFrequency + Array.fill(2, {[rrand(frequencyMin, frequencyMax)]})) * (signal);\n myAmplitude = (myAmplitude + Array.fill(2, {[rrand(amplitudeMin, amplitudeMax)]})) * (signal);\n myPhase = (myPhase + Array.fill(2, {[rrand(phaseMin, phaseMax)]}))* (signal);\n signal = LeakDC.ar(ChaosGen.allSubclasses.choose.ar(myFrequency, myPhase, myAmplitude));\n Out.ar(0, LeakDC.ar(signal * 0.3));\n};\n);\n\n~chaosmegafeedback={Mix.new(~chaos2 ! 16) * 0.00000000000000000000000003}.scope;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `FBSineN`."}, {"role": "assistant", "content": "```supercollider\n// default initial params\n{ FBSineN.ar(SampleRate.ir/4) * 0.2 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "What is `EaseOutCubic` in SuperCollider?"}, {"role": "assistant", "content": "EaseOutCubic — Cubic ease-out Easing equation for a cubic (t^3) ease-out, decelerating to zero velocity. Category: Ease."}]} -{"conversations": [{"role": "user", "content": "What can you do?"}, {"role": "assistant", "content": "Write and explain SuperCollider: SynthDefs, UGens, Patterns, Ndef, buses and envelopes, and tell you why a patch is silent or will not compile. I am 198M parameters, so I am narrow on purpose."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\"help-IRand\", {\n Out.ar(\n IRand(0, 1), // play on random channel between 0 and 1\n FSinOsc.ar(500,\n 0, Line.kr(0.2, 0, 0.1, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n(\nRoutine({\n 16.do({\n Synth.new(\"help-IRand\"); 0.5.wait;\n })\n}).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\"help-IRand\", {\n Out.ar(\n IRand(0, 1), // play on random channel between 0 and 1\n FSinOsc.ar(500,\n 0, Line.kr(0.2, 0, 0.1, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n(\nRoutine({\n 16.do({\n Synth.new(\"help-IRand\"); 0.5.wait;\n })\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `FBSineL`."}, {"role": "assistant", "content": "```supercollider\n// default initial params\n{ FBSineL.ar(SampleRate.ir/4) * 0.2 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n{ BlitB3Square.ar(XLine.kr(1000, 20, 10)) }.play;\n\n{ BlitB3Square.ar(MouseX.kr(20,1000,'exponential'),MouseY.kr(0.001,0.999)) }.play;\n\n//comparison\n//blit version is cheaper, but aliases once pushed over 4000 or so at 44100 SR\n{ Pulse.ar(4000, 0.5) }.play;\n{ BlitB3Square.ar(4000) }.play;\n\n\n//spot the difference in CPU usage\n{ Mix.fill(100, {Pan2.ar(0.1*BlitB3Square.ar( ((LFNoise0.kr(rrand(2,3))).range(0,36)+36).midic\n// …\n```"}, {"role": "assistant", "content": "blit version is cheaper, but aliases once pushed over 4000 or so at 44100 SR spot the difference in CPU usage (BlitB3Square: Bipolar BLIT derived square waveform)"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n pitches.size.do{ |i|\n {\n var freq = pitches[i].midicps;\n var env = Env.perc.ar(Done.freeSelf);\n SinOsc.ar(freq) * 0.1 * env\n }.play;\n 0.2.wait\n }\n}\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n pitches.size.do{ |i|\n {\n var freq = pitches[i].midicps;\n var env = Env.perc.ar(Done.freeSelf);\n SinOsc.ar(freq) * 0.1 * env\n }.play;\n 0.2.wait\n }\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Midterm Q2 (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"sawSynth\",{arg freq, amp;\n var env, snd;\n\n env = Env.perc(\n attackTime:0.1,\n releaseTime:2,\n level:amp).kr(doneAction: 2);\n snd = Saw.ar(\n freq:freq*[0.99, 1.0, 1.001, 1.008],\n mul: env);\n snd = LPF.ar(in: snd,freq:2000);\n snd = Splay.ar(snd);\n Out.ar(0,snd);\n\n}).add;\n);\n\n(\nPbind(\n \\instrument, \"sawSynth\",\n \\freq, Pwhite(300, 700, inf),\n \\amp, Pwhite(0.15, 0.2)\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `In`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n(\nSynthDef(\"help-PinkNoise\", { |out = 0|\n Out.ar(out, PinkNoise.ar(0.1))\n}).add;\n\nSynthDef(\"help-In\", { |out = 0, in = 0|\n var input;\n input = In.ar(in, 1);\n Out.ar(out, input);\n\n}).add;\n);\n\n// play noise on the right channel\nx = Synth(\"help-PinkNoise\", [\\out, 1]);\n\n// read the input and play it out on the left channel\nSynth.after(x, \"help-In\", [\\out, 0, \\in, 1]);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `FPSignal.storePrevious` do?"}, {"role": "assistant", "content": "Implementation of Functional Reactive Programming."}]} -{"conversations": [{"role": "user", "content": "What does `String.findSimilarIn` do? What arguments does it take?"}, {"role": "assistant", "content": "From a list of strings, find similar strings, sorted by edit distance and limited by similarity. `\"hi\".findSimilarIn([\"ho\", \"hu?\", \"hugs\", \"Hola\", \"else\"], Arguments: array — An array of strings to find similar strings in.; maxEditDistance — The largest SequenceableCollection#editDistance#edit distance that is accepted as a match.; minSimilarity — Keep only results whose SequenceableCollection#similarity#similarity is larger than this value. If set to `nil`, all values are accepted.; prioritizeCapitalization — If true, calculated the edit distances on lower case versions.."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LazyEnvir`."}, {"role": "assistant", "content": "```supercollider\nl = LazyEnvir.push;\n\n// default objects are created on access\n~a;\n~a.value; // defaults to nil\n\n// operations on placeholders\n(\n~c = ~a + ~b;\n\n~c.value; // doesn't fail, instead returns nil\n);\n\n// variables can be assigned later\n(\n~a = 800;\n~b = { 1.0.rand };\n\n~c.value;\n);\n\n// variables can be exchanged later\n(\n~b = { 1000.rand };\n~c.value;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n~lfd={\n var signal, myFrequency, frequencyMin=0.1, frequencyMax=30, myAmplitude, amplitudeMin=0.01, amplitudeMax=0.6, myPhase, phaseMin=0, phaseMax=1.5;\n myFrequency = Array.fill(2, {[rrand(frequencyMin, frequencyMax)]});\n myAmplitude = Array.fill(2, {[rrand(amplitudeMin, amplitudeMax)]});\n myPhase = Array.fill(2, {[rrand(phaseMin, phaseMax)]});\n signal = LeakDC.ar([LFDNoise1, LFDNoise0, LFDNoise3, LFDClipNoise].choose.ar(myFrequency, myPhase, myAmplitude));\n Out.ar(0, signal);\n};\n);\n\n~lfd.scope\n```"}, {"role": "assistant", "content": "a draft of a modular function for LFDNoise sctochastically selection. i shall be turning this into a pseudo ugen, using high level classes abstraction layer."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\AcnSn3dIn;\n~description = \"A live ambisonic input (ACN_SN3D)\";\n~channelLayout = \\ambi;\n\n~function = { |order=1, t_trig = 0, bus = 0|\n var env = EnvGen.kr(Env([0,1], [1]), t_trig);\n var chans = Array.series(\n size: (order + 1).pow(2).asInteger,\n start: bus,\n step: 1\n );\n var input = SoundIn.ar(chans) * env;\n HOAConverterAcnSn3d2AcnN3d.ar(order, input);\n};\n```"}, {"role": "assistant", "content": "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see ."}]} -{"conversations": [{"role": "user", "content": "What does `Atk.getAtkMatrixSubPath` do?"}, {"role": "assistant", "content": "A shortcut for `Atk.getAtkOpSubPath(set, op,"}]} -{"conversations": [{"role": "user", "content": "What does `RedKCS.stopListening` do?"}, {"role": "assistant", "content": "free internal analyser synth and responder. also a `CmdPeriod` will clear"}]} -{"conversations": [{"role": "user", "content": "What does `PlayerSocket.instrArgFromControl` do? What arguments does it take?"}, {"role": "assistant", "content": "a player that can play other players using a cross-faded and fuse-protected socket Arguments: control."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Random arpeggio by default (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\n Pbind(\n \\instrument, \\default,\n \\degree, Pwalk(#[c, e, g, c],1, Prand([-1,1],inf).stutter(Pwhite(1,10))) +\n Pseq([Pn(0,64),\n Prand([\n 0,\n [0,2,3],\n ],inf)\n ]),\n \\root, Pwhite(0,-8).stutter(32),\n \\mtranspose, Pwhite(-8,8).stutter(8),\n \\dur, 1/8,\n \\isRest, Pwrand([0,1], [0.1,1],inf).coin.not,\n \\legato, Pwhite(0.1,1.2),\n \\amp, 0.1\n ).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n \n// definition for future reference in arbitrary Environments,\n// Poisson distribution gives positive integer values\n\n(\np = Pbind(\n \\midinote, (PLpoisson(\\mean) + 50).clip(60, 90),\n \\dur, 0.1\n);\n);\n\n\n// prepare current Environment\n\n~mean = 10;\n\n\n// run\n\nx = p.play;\n\n\n// changing mean value \n\n~mean = Pstutter(5, PLseq((0, 5..30)));\n\nx.stop;\n```"}, {"role": "assistant", "content": "definition for future reference in arbitrary Environments, Poisson distribution gives positive integer values (PLpoisson: dynamic scope Ppoisson variant)"}]} -{"conversations": [{"role": "user", "content": "What is `PatternConductor`?"}, {"role": "assistant", "content": "PatternConductor — Simple interactive control for playing patterns"}, {"role": "user", "content": "What does `PatternConductor.tempo` do?"}, {"role": "assistant", "content": "Sets the tempo of the PatternConductor"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\n// a pattern with long notes\np = Pbind(\n \\freq, Pwhite(0, log(32)).exp.round(1) * 36.midicps,\n \\detune, Pfunc({ |ev| ev[\\freq] * rand(0.01) }),\n \\sustain, Pwhite(log(0.1), log(20)).exp,\n \\dur, Prand([0.1, 0.1, 0.1, 0.1, 0.2, 1, 2], inf),\n \\db, Pstep(Pseq([-20, -30, -25, -30], inf), 0.2)\n);\n\n// unrelated cluster pattern running on TempoClock.default\nPbind(\\dur, 2, \\midinote, Pseq([(48..60)], 20), \\db, -30).play;\n\n// make a conductor\na = PatternConductor(p, quant: 2);\na.play;\n);\n\n\n// now try some interactive control options line by line:\na.quant = 0;\na.pause;\na.resume;\na.stop;\na.play;\na.pause;\na.play;\na.stop(1000);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `NumberBox.shift_scale` do? What arguments does it take?"}, {"role": "assistant", "content": "The factor by which #-step or #-scroll_step is multiplied when incrementing or decrementing the value using keyboard or mouse while the Shift key is Arguments: A Float.."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Re: Timpani (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\ns.boot\n\n(\nSynthDef(\\aSynth, { |rel = 0, choose = 0, amp = 0|\n var klank, env;\n\n klank = Klank.ar(`[choose ! 12, {Rand(0.128, 0.7)} ! 12], BrownNoise.ar(0.7));\n env = EnvGen.kr(Env.perc(0.01, rel), doneAction: 2);\n Out.ar(0, klank * env.dup * amp);\n}).add;\n);\n\n(\n{\n 42.do{\n x = [70, 90, 120].choose;\n y = rrand(0.01, 5);\n // attack\n Synth(\\aSynth, [\\rel, y, \\choose, x, \\amp, 128e-6]);\n // resonance\n Synth(\\aSynth, [\\rel, 1, \\choose, x, \\amp, 128e-5]);\n y.wait;\n }\n}.fork;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `ServerOptions.verbosity` do?"}, {"role": "assistant", "content": "Controls the verbosity of server messages. A value of 0 is normal behaviour. -1 suppresses informational messages. -2 suppresses informational and many error messages, as well as messages from Poll. The default is"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes nothing much )."}, {"role": "assistant", "content": "```supercollider\n(\n{|atk=0.05,dur=10,freq=50,amp=0.8|\n PMOsc.ar(\n Line.kr(1,2,dur,freq),\n LFNoise2.kr([1,2]).range(1,2)*freq,\n LFNoise2.kr([2,1]).range(0.1,3.5),\n 0,\n Decay2.ar(\n Impulse.ar(XLine.kr(1, 25, dur)) * SinOsc.ar(4/dur,[0,pi/2],0.05,1),\n 0.023, XLine.ar(1,35,dur).reciprocal,\n Line.ar(1,0.8,dur) * LFNoise2.kr(4/dur,0.05,1).dup\n ) * EnvGen.ar(Env([0,1,1,0],[atk,dur-atk,0.3]),1,amp, doneAction:2)\n )\n // * LFPulse.ar(XLine.kr(5,20,dur,freq * LFNoise2.kr([1,2]).range(0.95,1.05)))\n}.play(args:[\n freq:50.rrand(350).debug('freq'),\n dur:10.rrand(20).debug('dur')\n])\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for julian rohrhuber (c 2007)."}, {"role": "assistant", "content": "```supercollider\n// julian rohrhuber (c 2007)\n\n(\nSynthDef(\"deepsea\", { arg out, pan=0, amp=0.1, variation=0.9;\n var dt, n, freq, mul, t, u;\n n = Rand(7, 46);\n dt = 25.0 + Rand(-1.7, 1.7);\n dt = dt + LFNoise2.kr(2, variation) * 0.001;\n freq = 901 + Rand(0, 65);\n t = Impulse.ar(dt.reciprocal, 0, 100);\n mul = PulseCount.ar(t) < n;\n u = BPF.ar(mul * t, freq, 0.1);\n u = BPF.ar(u, freq, 0.2);\n DetectSilence.ar(u, doneAction:2);\n Out.ar(out, Pan2.ar(u, pan, amp));\n}).add;\n);\n\n(\nSynthDef(\"deepsea\", { arg out, pan=0, amp=0.1, variation=0.9;\n var dt, n, freq, mul, t, u, count;\n n = Rand(7, 46);\n dt = 25.0 + Rand(-1.7, 1.7);\n dt = dt + LFNoise2.kr(2, variation) * 0.001;\n freq = 901 + Rand(0, 65);\n t = Impulse.ar(dt.reciprocal, 0, 100);\n count = PulseCount.ar(t);\n mul = count < n;\n u = BPF.ar(mul * t, freq, 0.1);\n u = BPF.ar(u, freq * (count % LFNoise1.kr(1).range(2, 20) + 1), 0.2);\n DetectSilence.ar(u, doneAction:2);\n Out.ar(out, Pan2.ar(u, pan, amp * 10));\n}).add;\n);\n\n\n\ns.sendMsg(\"/s_new\", \"deepsea\", -1);\n\n\np = ProxySpace.push(s.boot);\n\n~out.play;\n~out.fadeTime = 10;\n\n(\n~fish = Pbind(\n \\instrument, \\deepsea,\n \\dur, Pfunc #{ rrand(9.0, 2.0) },\n \\pan, Pfunc #{ 1.0.rand2 }\n );\n);\n\n~out = ~fish;\n~out[1] = \\filter -> #{ arg in; BPF.ar(in * 5, 700, 0.1) };\n\n(\n~out[2] = \\filter -> #{ arg in;\n CombL.ar(LPF.ar(in * LFNoise1.kr(0.1).max(0), 800), 0.5, 0.5) + in.reverse\n};\n);\n\n(\n~out[3] = \\filter -> #{ arg in; var x; x = in;\n 5.do { x = AllpassN.ar(x, 0.18, {0.06.rand} ! 2 + 0.06, 8) };\n LPF.ar(x + in, 400) + (LFNoise1.kr(0.2) * in)\n };\n\n);\n\n\n\n~out[1] = nil;\n~out[2] = nil;\n\n\np.clear(10).pop;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `PInRange.new` do? What arguments does it take?"}, {"role": "assistant", "content": "UGenPatterns quark library Arguments: pattern; lo; hi."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = {LFTri.ar(100+(1000*Maths2.ar(MouseX.kr, MouseY.kr, 0.2, 1-MouseButton.kr(lag:0.001))[0]), 0, 0.1)}.play //notice how I am taking the [0th channel of the Maths and ignoring the other outputs\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = {LFTri.ar(100+(1000*Maths2.ar(MouseX.kr, MouseY.kr, 0.2, 1-MouseButton.kr(lag:0.001))[0]), 0, 0.1)}.play //notice how I am taking the [0]th channel of the Maths and ignoring the other outputs\n```"}]} -{"conversations": [{"role": "user", "content": "What are the arguments of EnvGen?"}, {"role": "assistant", "content": "`EnvGen.ar(envelope, gate, levelScale, levelBias, timeScale, doneAction)` — or the .kr form. Envelope is an Env; gate is the signal that holds the envelope open (a number for a one-shot, a trigger or gate control for a sustained sound); levelScale and levelBias scale and offset the output; timeScale stretches durations. Use `doneAction: 2` on a one-shot so the Synth frees itself."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Buffer`."}, {"role": "assistant", "content": "```supercollider\n// Read a sound file from disk into a buffer\ns.boot;\n// ExampleFiles helps locate audio files used in examples\np = ExampleFiles.child;\n// peek at the path to see location and the format of a path\np.postln;\n// read the file\nb = Buffer.read(s, p);\n\n// now play it\n(\nx = SynthDef(\\help_Buffer, { |out = 0, bufnum|\n Out.ar(out,\n PlayBuf.ar(1, bufnum, BufRateScale.kr(bufnum))\n )\n}).play(s, [\\bufnum, b]);\n);\nx.free; b.free;\n\n// with an action function\n// note that the vars are not immediately up-to-date\n(\nb = Buffer.read(s, p, action: { |buffer|\n (\"After update:\" + buffer.numFrames).postln;\n x = { PlayBuf.ar(1, buffer, BufRateScale.kr(buffer)) }.play;\n});\n(\"Before update:\" + b.numFrames).postln;\n);\nx.free; b.free;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na.geom(1.2);\n\nb.sine2(a.ramp(1.0, 1.0).postln, a.geom(1.2).postln, true, true, true);\ny = z.play(s, [\\out, 0, \\bufnum, b];\ny.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na.geom(1.2);\n\nb.sine2(a.ramp(1.0, 1.0).postln, a.geom(1.2).postln, true, true, true);\ny = z.play(s, [\\out, 0, \\bufnum, b]);\ny.free;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// indexing into a table\n(\n{\n var buf = LocalBuf.newFrom([200, 300, 400, 500, 600, 800]);\n var freq = WrapIndex.kr(buf, MouseX.kr(0, BufFrames.ir(buf) * 3));\n SinOsc.ar(freq) * 0.1\n}.play;\n);\n\n// the same using a global buffer\n(\nt = [200, 300, 400, 500, 600, 800];\nb = Buffer(s, t.size, 1);\n\n// alloc and set the values\ns.listSendMsg(b.allocMsg(b.setnMsg(0, t)).postln);\n\nSynthDef(\\help_Index, { |out = 0, buf\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// indexing into a table\n(\n{\n var buf = LocalBuf.newFrom([200, 300, 400, 500, 600, 800]);\n var freq = WrapIndex.kr(buf, MouseX.kr(0, BufFrames.ir(buf) * 3));\n SinOsc.ar(freq) * 0.1\n}.play;\n);\n\n// the same using a global buffer\n(\nt = [200, 300, 400, 500, 600, 800];\nb = Buffer(s, t.size, 1);\n\n// alloc and set the values\ns.listSendMsg(b.allocMsg(b.setnMsg(0, t)).postln);\n\nSynthDef(\\help_Index, { |out = 0, bufnum = 0|\n Out.ar(out,\n SinOsc.ar(\n WrapIndex.kr(\n bufnum,\n MouseX.kr(0, BufFrames.ir(bufnum) * 3)\n ),\n 0,\n 0.5\n )\n )\n}).play(s, [\\bufnum, b.bufnum]);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Symbol.kr` do?"}, {"role": "assistant", "content": "Return a control rate NamedControl input with a default value (val), and if supplied, with a lag. If val is an array, the control will be multichannel. A ControlSpec provided to the `spec` parameter will be written into the spec metadata for the current"}]} -{"conversations": [{"role": "user", "content": "What does `PlayerAmp.defName` do?"}, {"role": "assistant", "content": "adds a simple amplitude control to a Player"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `SortedList`."}, {"role": "assistant", "content": "```supercollider\nSortedList[1, 2, 5, 6].add(4).postln;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nNdef(\\x, { Saw.ar(110) * 0.1 }).play;\nNdef(\\x)[1] = \\filter -> { |in| RLPF.ar(in, 800, 0.4) };\n```"}, {"role": "assistant", "content": "Two nodes in one named proxy: a saw source, then a resonant low-pass filter fed by it.\n\n`Ndef(\\x, { ... })` defines the first node of the chain and `.play` starts it. `Ndef(\\x)[1] = \\filter ->`\ninserts a second node at index 1; the `\\filter` key says 'make this node an effect that receives the\nprevious node's output as `in`'. So the patch is `Saw -> RLPF -> out`. Because it is an Ndef, calling\n`Ndef(\\x, { ... })` again replaces the source with a crossfade instead of restarting, and\n`Ndef(\\x).stop` removes the whole chain."}]} -{"conversations": [{"role": "user", "content": "In what order should I learn SuperCollider?"}, {"role": "assistant", "content": "The order that pays off fastest:\n\n1. **One UGen and Out** — `{ SinOsc.ar(440) * 0.2 }.play`. Learn that a graph must reach Out.\n2. **Envelopes and doneAction** — the difference between a sound and a click.\n3. **SynthDef and Synth** — naming a graph, controlling it with arguments, freeing it with a gate.\n4. **Patterns** — `Pbind` for sequence, so you stop writing loops by hand.\n5. **Buses and effects** — chaining, sends, groups.\n6. **JITLib** — Ndef for patches you modify while they play.\n\nVocabulary to carry: UGen, SynthDef, Synth, bus, group, envelope, gate, doneAction, Pattern, clock. Every\nconfusion in SuperCollider tends to be one of those words."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\nthis.preProcessor = PreProcessor.new;\n\n// prepare an event\ne = (\n lang: \\minimouse,\n languages:\n (\n minimouse: {|code, event|\n var output;\n output = Pbind(\\degree, Pseq(code.ascii).trace % 24, \\dur, event[\\dur] ? 0.1);\n event.put(\\result, output)\n },\n maximouse: {|code, event|\n var output;\n output = Pbind(\\freq, Pseq(code.ascii).trace + 200, \\dur, event[\\dur] ? 0.1);\n event.put(\\result, output)\n }\n )\n\n);\n);\n\n// ok, assuming such a little interpreter exists for a given language,\n// one can now use it in code.\n// …\n```"}, {"role": "assistant", "content": "ok, assuming such a little interpreter exists for a given language, one can now use it in code. (PreProcessor: Embed languages in SuperCollider)"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes THX Deep Note inspired synth sketch."}, {"role": "assistant", "content": "```supercollider\n// A. Broz: Deep Choir (v2, 2020-10-29)\n(\n~numVoices = 30;\n\n~chaos = { |range = 1.0|\n ~numVoices collect: { exprand(180 / range, 260 * range) }\n};\n\n~bigChord = { |fund = 30, harmonics = 5|\n ~numVoices collect: {\n fund\n * rrand(1, harmonics) // build chord\n * rrand(1, 2) * rrand(1, 2) // octaves\n + rrand(-1.2, 1.2) // beats\n }\n};\n\n// Try with Pmono\nSynthDef(\\fakeTHX, {\n var env = EnvGen.kr(\n envelope: Env.adsr(15, \\decay.kr(10), 1, 10, curve: \\sine),\n gate: \\gate.kr(1),\n doneAction: Done.freeSelf,\n );\n var chord = \\freq.kr(~chaos.value, \\lag.kr(10));\n var meander = \\meander.kr(0.3, 8);\n var sig = chord collect: { |f|\n f = f * LFNoise2.kr(rrand(0.3, 0.8)).exprange(1 - meander, 1 + meander);\n BLowPass.ar(Saw.ar(f), f, 0.6);\n };\n sig = Splay.ar(sig, 0.8) * env * \\mul.kr(0.5, 3);\n Out.ar(0, sig);\n}).add;\n);\n\n(\nRoutine({\n var fakeTHX = Synth(\\fakeTHX);\n\n 10.wait;\n\n fakeTHX.set(\\meander, 0);\n\n fakeTHX.set(\\freq, ~bigChord.(30, 5));\n\n 10.wait;\n\n fakeTHX.set(\\gate, 0);\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `FoaDecoderMatrix.new5_0` do? What arguments does it take?"}, {"role": "assistant", "content": "First Order Ambisonic (FOA) decoder matrices Arguments: irregKind — Three kinds are available:."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for delay effect with accelerating echoes?"}, {"role": "assistant", "content": "```supercollider\n~buf = Buffer.alloc(s, s.sampleRate * 5);\n\n(\n{\n var trig, freq;\n var dry, snd, phase, iois;\n var cumulDelay;\n var decayFactor, lpfCutoff, numEchoes, ioiScale, ioiDecayFactor;\n\n // play with these!\n decayFactor = 0.65;\n lpfCutoff = 500;\n numEchoes = 16;\n ioiScale = 0.4;\n ioiDecayFactor = 0.75;\n\n // example input -- you can substitute other stuff here\n trig = Dust.ar(1);\n dry = Pulse.ar(100 * TIRand.ar(1, 12, trig));\n dry = dry * Decay2.ar(trig, 0.01, 0.2);\n\n phase = DelTapWr.ar(~buf, dry);\n iois = Array.geom(numEchoes, ioiScale, ioiDecayFactor);\n cumulDelay = iois.sum;\n (cumulDelay > ~buf.duration).if {\n Error(\"use a larger buffer\").throw;\n };\n snd = Silent.ar;\n iois.reverse.do { |ioi|\n snd = (snd + DelTapRd.ar(~buf, phase, cumulDelay, interp: 4)) * decayFactor;\n // one-pole lowpass -- LPF was too aggressive\n snd = OnePole.ar(snd, lpfCutoff / SampleRate.ir);\n cumulDelay = cumulDelay - ioi;\n };\n snd = snd + dry;\n \n snd * 0.5!2;\n}.play;\n\n// contributors so far: Nathan Ho\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `String.underlined` do?"}, {"role": "assistant", "content": "Return this string followed by dashes in the next line (`-`)."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `TRand`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var trig = Dust.kr(10);\n SinOsc.ar(\n TRand.kr(300, 3000, trig)\n ) * 0.1\n}.play;\n);\n\n(\n{\n var trig = Dust.ar(MouseX.kr(1, 8000, 1));\n SinOsc.ar(\n TRand.ar(300, 3000, trig)\n ) * 0.1\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `MxUnitApp.remove` do?"}, {"role": "assistant", "content": "Disconnect and remove the unit from the Returns: this"}]} -{"conversations": [{"role": "user", "content": "What is `Scheduler`?"}, {"role": "assistant", "content": "Scheduler — schedules functions to be evaluated in the future"}, {"role": "user", "content": "What does `Scheduler.play` do?"}, {"role": "assistant", "content": "Schedules the task immediately. Equivalent to `sched(0, task)`."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na = Scheduler(SystemClock);\n\na.sched(3, { \"now it is 3 seconds.\".postln; nil });\na.sched(5, { \"now it is 5 seconds.\".postln; nil });\na.sched(1, { \"now it is 1 second.\".postln; nil });\n\na.advance(0.5);\na.advance(0.5);\na.advance(2);\na.advance(2);\n\n// the beats, seconds and clock are passed into the task function:\na.sched(1, { |beats, secs, clock| [beats, secs, clock].postln });\na.advance(1);\n\n// the scheduling is relative to \"now\":\na.sched(3, { \"now it was 3 seconds.\".postln });\na.sched(5, { \"now it was 5 seconds.\".postln });\na.sched(1, { \"now it was 1 second.\".postln });\n\na.advance(0.5);\na.advance(0.5);\na.advance(2);\na.advance(2);\n\n// play a Routine or a task:\na.play(Routine { 5.do { |i| i.postln; 1.yield } });\na.advance(0.9);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `PlayerUnop.new` do? What arguments does it take?"}, {"role": "assistant", "content": "the result of performing a unary op on a Player Arguments: operator; a."}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ Pan2.ar(SinOsc.ar(440) * 0.2, SinOsc.kr(0.1)) }.play;\n```"}, {"role": "assistant", "content": "A sine that slowly moves between the speakers.\n\n`SinOsc.kr(0.1)` is a control-rate sine at 0.1 Hz — one cycle every 10 seconds — running between -1 and 1.\n`Pan2.ar(sig, pos)` treats that as the pan position, where -1 is hard left, 0 centre, 1 hard right, so the\nsound drifts across the stereo field. Pan2 is equal-power, so the centre is -3 dB per channel rather than\nhalf amplitude on each. The `* 0.2` sets the level before panning."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `TaskProxy`."}, {"role": "assistant", "content": "```supercollider\n(\n#a, c = { TaskProxy.new } ! 2;\na.source = { \"one\".postln; 1.wait; \"two\".postln };\nc.source = { var z; z = Synth(\\default); 0.5.wait; z.release };\nr = Task {\n \"counting...\".postln;\n 2.wait;\n a.embedInStream;\n 1.wait;\n c.embedInStream;\n \"done.\".postln;\n};\n);\n\nr.play; // play a stream\n\nc.source = { var z; z = Synth(\\default, [\\freq, 300]); 1.5.wait; z.release }; // change the def\n\nr.reset;\nr.play;\n\n// of course TaskProxies can be used in other Tdefs:\n(\nb = TaskProxy.new;\nb.source = {\n \"counting...\".postln;\n 2.wait;\n a.embedInStream;\n 1.wait;\n c.embedInStream;\n \"done.\".postln;\n};\n);\nb.playOnce;\n\n// if one wants to branch off a stream in a separate thread, asStream is used.\n(\nRoutine {\n c.asStream.play;\n 0.1.wait;\n c.asStream.play;\n 0.1.wait;\n a.asStream.play;\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `EnvelopeView.selectionColor` do? What arguments does it take?"}, {"role": "assistant", "content": "The color of a node when it is Arguments: A Color.."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n// Three nodes in this data. First is always the root.\n// So the first is applied to decide whether to branch down to the second or third.\n// Then those nodes decide whether to classify the datum as 1/2/3/4.\n~treedata = [\n/* xoff,yoff, xvec,yvec, lisl, risl */\n [0.5, 0.5, -0.7, 0.4, 0, 0], // this is the root node, its number is 1\n [0.3, 0.7, 0.4, 0.7, 1, 1], // this one's number is 2\n [0.5, 0.2, -0.8,-0.8, 1, 1] // this one's number is 3\n];\n)\n```"}, {"role": "assistant", "content": "Three nodes in this data. First is always the root. So the first is applied to decide whether to branch down to the second or third. (PlaneTree: Tree classifier using (hyper)planes – UGen or language-side)"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// The indices arg might get a pattern which can generate Functions as well as arrays.\n// Start with sufficient number of zeros as lookBack to fill buffer.\n\n(\np = PSloop(\n Pbind(\n \\dur, Pn(Pshuf([1, 1, 2]/6)),\n \\midinote, Prand((60..80), inf)\n ),\n bufSize: 10,\n lookBack: Pseq([Pn(0, 7), Pstutter(4, Pwhite(3, 5, 1))], inf).trace,\n indices: Pseq([1!2, { |l| (l-1..0).postln }], inf).trace\n).trace.play\n;\n\np.stop\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// The indices arg might get a pattern which can generate Functions as well as arrays.\n// Start with sufficient number of zeros as lookBack to fill buffer.\n\n(\np = PSloop(\n Pbind(\n \\dur, Pn(Pshuf([1, 1, 2]/6)),\n \\midinote, Prand((60..80), inf)\n ),\n bufSize: 10,\n lookBack: Pseq([Pn(0, 7), Pstutter(4, Pwhite(3, 5, 1))], inf).trace,\n indices: Pseq([1!2, { |l| (l-1..0).postln }], inf).trace\n).trace.play\n);\n\np.stop\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for electric guitar (a SuperCollider snippet)?"}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\noisecomb2, { arg out, gate=1, pan=0, freq=300, amp=0.1, noiselevel=0.2,\n minfreq=100, decaytime=1, doneAction=2, ffreq=500, rq=0.3, spread=0.8;\n var sig, env;\n sig = WhiteNoise.ar(noiselevel);\n sig = sig + ClipNoise.ar(noiselevel);\n sig = sig + AllpassC.ar(sig, 1/minfreq, 1/freq, decaytime);\n sig = RLPF.ar(sig, ffreq * \\ffreqtab.kr(1!10), rq);\n env = EnvGen.kr(\\adsr.kr(Env.adsr(0.6,0.1,0.8,0.1)), gate, doneAction:doneAction);\n sig = sig * env;\n sig = Splay.ar(sig, spread, 1, pan);\n sig = sig * amp;\n Out.ar(out, sig);\n}).store;\n);\n\n(\nPdef(\\plopbla, Pbind(\n \\instrument, \\noisecomb2,\n \\note, Pseq([[0,7],[1,8],[-1,5]]-2,inf),\n //\\note, Pseq([0,1,2,3,4],inf)\n \\octave, Pstep(Pseq([3,4],inf),Pseq([5,0.75],inf)),\n \\minfreq, 50,\n \\decaytime, 1.0,\n \\adsr, Pseq([\n [Env.adsr(0.02,0.1,0.8,0.4,curve:0.5)],\n [Env.adsr(0.02,0.1,0.8,0.4,curve:0.5)],\n [Env.adsr(0.02,0.1,0.8,0.4,curve:0.5)],\n [Env.adsr(0.03,0.1,0.8,0.1,curve:0.5)],\n [Env.adsr(0.03,0.1,0.8,0.1,curve:0.5)],\n [Env.adsr(0.03,0.1,0.8,0.1,curve:0.5)],\n ],inf),\n \\legato, 1.0,\n //\\ffreq, [500,610,820,140],\n \\ffreq, 500,\n //\\ffreqtab, [[0.8,1,1.1,1.2, 2,4,5,6, 8,10].scramble.postln],\n //\\ffreqtab, Pfunc{ [[ 0.1, 0.2, 0.3, 0.5, 1,2,3,8, 10, 12 ].scramble] + rrand(0.01,1.0); },\n //\\ffreqtab, [ 6, 4, 5, 10, 1, 1.2, 0.8, 1.1, 2, 8 ], // also nice\n \\ffreqtab, [[ 6, 4, 5, 10, 1, 1.2, 0.8, 0.4, 2, 8 ]],\n \\dur, Pseq([3,1,1, 0.25,0.25,0.25],inf),\n \\amp, 1.1\n)).play;\n);\n```"}]} -{"conversations": [{"role": "user", "content": "How do I make a piece reproducible instead of a different take every time?"}, {"role": "assistant", "content": "Three things make a SuperCollider piece repeatable: a fixed seed, a fixed tempo, and no live input.\n\n```supercollider\n(\nthisThread.randSeed = 1234;\nTempoClock.default.tempo = 2;\nPbind(\\degree, Pwhite(0, 7, inf), \\dur, 0.25).play;\n)\n```\n\n`thisThread.randSeed` fixes the random sequence of the current thread, so `Pwhite`, `Prand` and friends give\nthe same values again. Recording with `s.record(path, duration: 30)` then makes the take an artifact rather\nthan a performance. Input from `MouseX` or a MIDI controller is the usual remaining source of difference."}]} -{"conversations": [{"role": "user", "content": "How do I make a piece reproducible instead of a different take every time?"}, {"role": "assistant", "content": "Three things make a SuperCollider piece repeatable: a fixed seed, a fixed tempo, and no live input.\n\n```supercollider\n(\nthisThread.randSeed = 1234;\nTempoClock.default.tempo = 2;\nPbind(\\degree, Pwhite(0, 7, inf), \\dur, 0.25).play;\n)\n```\n\n`thisThread.randSeed` fixes the random sequence of the current thread, so `Pwhite`, `Prand` and friends give\nthe same values again. Recording with `s.record(path, duration: 30)` then makes the take an artifact rather\nthan a performance. Input from `MouseX` or a MIDI controller is the usual remaining source of difference."}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n~pad = Synth(\\pad, [\\freq, 165]);\n~pad.set(\\gate, 0);\n```"}, {"role": "assistant", "content": "It starts a sustained synth and then releases it.\n\n`Synth(\\pad, [\\freq, 165])` creates an instance of a SynthDef that takes a `gate` argument (default 1). The\narray after the name is alternating argument names and values: `\\freq, 165`. Setting `\\gate` to 0 does not\ncut the sound dead — the EnvGen inside sees the gate close and runs the release stage of its Env, then frees\nthe Synth because that EnvGen has `doneAction: 2`. This is the standard lifecycle for pads, drones and any\nsound you want to stop gracefully."}]} -{"conversations": [{"role": "user", "content": "What does `RedWindow.play` do?"}, {"role": "assistant", "content": "Starts an internal thread on the AppClock updating at rate"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Signal`."}, {"role": "assistant", "content": "```supercollider\nb = Signal.sineFill(512, [1]).play(true, 0.2);\nb.free; // free the buffer again.\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n\nSynthDef(\\param, { arg freq = 100, sustain, amp;\n var sig;\n sig = LFPar.ar(freq: freq,\n mul: EnvGen.kr(Env.perc(0, sustain, 0.5), doneAction:2) * amp);\n sig = Splay.ar(sig);\n Out.ar(0, sig);\n}).add;\n\ne = Pbind(\n \\midinote, Prout({\n var tone0, tone1, tone2, interval, freq0, delta;\n loop {\n tone0 = rrand(0,11);\n interval = rrand(2,4);\n tone1 = Scale.minor(\\pythagorean).at(tone0) + [0,12,24].choose + 0.07;\n tone2 = Scale.minor(\\pythagorean).at(tone0 + interval) + [0,12,24].choose;\n freq0 = [tone1,tone2]+48;\n postln(freq0);\n freq0.yield;\n }\n }),\n \\dur, Prand([1,2,4,8,12,16,4,6,8], inf),\n \\instrument, \\param,\n \\amp, 0.5,\n \\sustain, 2,\n).play(quant:1); // returns an EventStream\nTempoClock.default.tempo = 1200/60;\n\n)\n```"}, {"role": "assistant", "content": "minor random bliss in two for Prout (a SuperCollider snippet)."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Digital Bird sounds."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\birdy, {arg freq=1500, amp=0.5, rate=10;\n var osc, son, convIn, rand;\n osc=LFCub;\n rand = LFNoise1.ar(rate);\n convIn=LinCongN.ar(rate);\n son = osc.ar(Convolution.ar(convIn,convIn));\n freq = Latch.kr(rand.range(0,1).round(0.1), rand) * freq;\n freq = osc.ar(osc.ar(rand)*rand.range(0,10)).range(freq, freq*3);\n son = Formlet.ar(son, freq, convIn.abs*0.1, rand.abs);\n son = Normalizer.ar(son, 0.9, 0.1) * convIn.abs * LFPulse.kr(LFPulse.kr(rand.abs), 0, rand.abs);\n son = son + GVerb.ar(son, 99, 2, mul: rand.range(0,0.3));\n son * amp\n}).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n//listen to x and y output with defaults\n{Out.ar(0,0.5*SpruceBudworm.ar(0.0))}.play\n\n\n//be careful with rate range, can blow-up easily here, or just not sound\n{Out.ar(0,0.5*SpruceBudworm.ar(0.0,MouseX.kr(0.09,0.1)))}.play\n\n\n{Out.ar(0,0.5*SpruceBudworm.ar(0.0,,MouseX.kr(0.09,0.1),MouseY.kr(25.0,28.0)))}.play\n\n\n{Out.ar(0,0.5*SpruceBudworm.ar(Impulse.kr(MouseY.kr(1,50,'exponential')),0.1))}\n// …\n```"}, {"role": "assistant", "content": "listen to x and y output with defaults be careful with rate range, can blow-up easily here, or just not sound (SpruceBudworm: Spruce bud worm model equations)"}]} -{"conversations": [{"role": "user", "content": "What does `RedDiskInSampler.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a new sampler on a Arguments: server — If this is `nil` it will use `Server.default`. The server must be booted.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nPbind(*[freq: 700, amp: 0.1]\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nPbind(*[freq: 700, amp: 0.1])\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a, b;\na = Psetp(\\freq, Pseq([801, 1008], inf), Pbind(\\dur, Pseq([0.5, 0.111, 0.22])));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n);\n\n// Psetp overrides incoming values:\n\n(\nvar a, b;\na = Psetp(\\freq, 801, Pbind(\\freq, 108));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n);\n\n\n// sound example\n\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = En\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a, b;\na = Psetp(\\freq, Pseq([801, 1008], inf), Pbind(\\dur, Pseq([0.5, 0.111, 0.22])));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n);\n\n// Psetp overrides incoming values:\n\n(\nvar a, b;\na = Psetp(\\freq, 801, Pbind(\\freq, 108));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n);\n\n\n// sound example\n\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, Pseq([0.5, 0.3, 0.1]), \\instrument, \\sinegrain);\na = Psetp(\\freq, Pseq([500, 600, 700], inf), a);\na.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// connect will connect to all midi in devices\n// if you need to specify one,\n// check the sources at: MIDIClient.sources\n// and connect using MIDIIn.connect( source_index )\nMIDIIn.connect;\n\n// show incoming control data\n~control = { arg src, chan, num, val; \n [chan,num,val].postln; \n};\n\nMIDIIn.addFuncTo(\\control, ~control);\n```"}, {"role": "assistant", "content": "Simple example showing how to listen for MIDI control messages."}]} -{"conversations": [{"role": "user", "content": "What is `Gate` in SuperCollider?"}, {"role": "assistant", "content": "Gate — Gate or hold. Allows input signal value to pass when gate is positive, otherwise holds last value. Category: UGens > Triggers."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// a Function passed to loopFunc is applied to all items of the looping\n\n(\n~lookBack = 0;\n\np = Pbind(\n \\dur, Pn(Pshuf([1, 1, 2]/6)),\n \\midinote, PSloop(\n Prand((60..80), inf),\n bufSize: 10,\n lookBack: { ~lookBack },\n loopFunc: { |x| x + [0, 5] }\n )\n).play\n);\n\n// wait a bit to fill buffer\n// loop with Function applied\n\n~lookBack = 3\n\n~lookBack = 6\n\n\n// go on and stop\n\n~lookBack = 0\n\np.stop\n```"}, {"role": "assistant", "content": "a Function passed to loopFunc is applied to all items of the looping wait a bit to fill buffer (PSloop: Pattern to derive loops from a given Pattern)"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{SmoothDecimator.ar(SinOsc.ar([400, 404], 0, 0.2), MouseX.kr(0, 44100), MouseY.kr(0, 1))}.play\n\n{SmoothDecimator.ar(SoundIn.ar, MouseX.kr(0, 44100), MouseY.kr(0, 1)}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{SmoothDecimator.ar(SinOsc.ar([400, 404], 0, 0.2), MouseX.kr(0, 44100), MouseY.kr(0, 1))}.play\n\n{SmoothDecimator.ar(SoundIn.ar, MouseX.kr(0, 44100), MouseY.kr(0, 1))}.play\n```"}]} -{"conversations": [{"role": "user", "content": "What does `MxTimeGui.zoom` do? What arguments does it take?"}, {"role": "assistant", "content": "Timeline view Arguments: argFrom; argTo; updateZoomControl."}]} -{"conversations": [{"role": "user", "content": "What is a bus, in one sentence?"}, {"role": "assistant", "content": "A numbered channel on the server that nodes write signal into and read signal out of, which is how sounds are chained without cables."}, {"role": "user", "content": "Show me using one for an effect."}, {"role": "assistant", "content": "Write the source to a private bus, read it in the effect, send the effect to the master:\n\n```supercollider\n(\n~bus = Bus.audio(s, 1);\nSynthDef(\\src, { |out = 0| Out.ar(out, Saw.ar(110) * 0.1) }).add;\nSynthDef(\\fx, { |in = 0| Out.ar(0, RLPF.ar(In.ar(in, 1), 1200, 0.3)) }).add;\n);\nSynth(\\fx, [\\in, ~bus]);\nSynth(\\src, [\\out, ~bus]);\n```\n\nOrder matters: the effect exists before the source, so the source's output has a listener."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n// p = ProxySpace.push(s.boot);\n\nl = NodeProxyEditor(nil, 3); l.w.bounds_(l.w.bounds.moveBy(0, 120));\nm = NodeProxyEditor(nil, 3); m.w.bounds_(m.w.bounds.moveBy(0, 240));\nn = NodeProxyEditor(nil, 3); n.w.bounds_(n.w.bounds.moveBy(0, 360));\no = NodeProxyEditor(nil, 3); o.w.bounds_(o.w.bounds.moveBy(0, 480));\n\nSpec.add(\\dens, [0.1, 300, \\exp]);\n\n // make 3 kinds of proxies: using tilde/pro\n// …\n```"}, {"role": "assistant", "content": "p = ProxySpace.push(s.boot); make 3 kinds of proxies: using tilde/proxyspace, Ndef, and unnamed. (NodeProxyEditor: editor for a nodeproxy - replaced by NdefGui!)"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Another fibonaccy melody."}, {"role": "assistant", "content": "```supercollider\n(\nc=13;a=Array.fib(64,0,1);b=Array.fill(size:c,function:{arg i;a[i]%12});\np=1/(21-c);Pdef(\\x,Pbind(\\dur,p,\\degree,Pseq(b,1,0)));\nr=Array.fill(c,{arg i;Pbindf(Pdef(\\x),\\mtranspose,1-b[i]);});\nPseq(r,(1/p)).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Pbus.new` do? What arguments does it take?"}, {"role": "assistant", "content": "isolate a pattern by restricting it to a bus Arguments: pattern; dur — delay to allow inner patterns to decay.; fadeTime — fading out the inner pattern after dur over this time.; numChannels — number of channels of the bus (should match the synthdef).; rate — bus rate.."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Algorithmic melancholy (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nvar n = 20, baseFreq = 45.midicps;\nvar lsin, rsin, arg1, arg2, sig;\nvar bus, busIndex, scale, freq, freqIndex, amp;\nvar responder;\n\nscale = Scale.nikriz.ratios * baseFreq;\n\nbus = Bus.control( s, 2 * n );\nbus.setn( { 1.0.rand2 } ! ( 2 * n ) );\nbusIndex = bus.index;\n\nfreq = Bus.control( s, n );\nfreqIndex = freq.index;\n\nresponder = OSCFunc({ | id |\n freq.setAt( id[2] , scale.choose * 1.rrand( 3 ) );\n},'/tr', s.addr);\n\nCmdPeriod.doOnce { [ bus, freq, responder ].free; };\n\nn.do {|i|\n freq.setn( { scale.choose * rrand( 1, 3) } ! n );\n {\n #arg1, arg2 = In.kr( 2 * i + busIndex, 2 );\n\n #lsin, rsin = SinOsc.kr( [ arg1, arg2 ], { 2.0.rrand(20.0) } ! 2 * [ arg2, arg1 ] ); \n\n sig = Formant.ar( \n LFNoise0.kr( 0.05, 2.5, 7) * arg1, \n arg2,\n 500.0.rrand(700) \n );\n\n ReplaceOut.kr( 2 * i + busIndex, [ rsin, lsin ] );\n\n sig = Pluck.ar( \n BrownNoise.ar(0.5), \n sig, \n 0.025, \n freq.kr( 1, i ).reciprocal, \n 3.7\n ) * 0.6;\n\n amp = Line.kr( dur: rrand( 1.0, 20.0) ) * max( 0, LFNoise1.kr( 0.05, 0.6, 0.4 ) ) ;\n sig = sig * amp;\n SendTrig.kr( amp <= 0, i, i );\n\n Pan2.ar( sig, 0.8.rand2 )\n }.play\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\ns.boot;\n// create a Synth at the head of the default Server's default group\n// based on the SynthDef \"default\"\nx = Synth.new(\"default\");\ns.queryAllNodes; // note the default group (ID 1)\nx.free;\n\n// Using an arrayed control\n// run this block first to make the SynthDef\n(\nSynthDef(\"help-synth\", { |freq = #[440, 450, 460], out = 0|\n Out.ar(out, Mix(SinOsc.ar(freq, 0, 0.1)));\n}).add;\n);\n\n// then this a short while later\nx = Synth(\"help-synth\", [freq: [500, 501, 510]]);\n\nx = Synth(\"help-synth\",\n// …\n```"}, {"role": "assistant", "content": "create a Synth at the head of the default Server's default group based on the SynthDef \"default\" (Synth: Client-side representation of a synth node on the server)"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Streson.ar(LFSaw.ar([220, 180], 0, mul:EnvGen.kr(Env.asr(0.5, 1, 0.02), 1.0) * 0.2), LinExp.kr(LFCub.kr(0.1, 0.5*pi), -1, 1, 280, 377).reciprocal, 0.9, 0.3 }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Streson.ar(LFSaw.ar([220, 180], 0, mul:EnvGen.kr(Env.asr(0.5, 1, 0.02), 1.0) * 0.2), LinExp.kr(LFCub.kr(0.1, 0.5*pi), -1, 1, 280, 377).reciprocal, 0.9, 0.3) }.play\n```"}]} -{"conversations": [{"role": "user", "content": "What does `TdefGui.close` do?"}, {"role": "assistant", "content": "(if the jitGui is in its own window) and close its"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `UGen`."}, {"role": "assistant", "content": "```supercollider\n{ UGen.buildSynthDef.dump; Silent.ar }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Random deep fryer?"}, {"role": "assistant", "content": "```supercollider\n// random deep fryer. can turn in to rain, waves and other stuff.\n// nice with multichannel iteration. Change number at \"!2\".\n// volume compensation for high quality filter with \"1/q.sqrt\" for mul in BPF.\n// variable \"dist\" for distortion, increasing can go loud, decrease \"amp\" if so.\n// LFNoise1 with noisefreq,noisemul,noiseoffset gives it the wavy feel.\n\n(\nSynthDef(\\friture, {\n arg amp=0.5, dist=2, dens=12, dustamp=1, offset=0, noisefreq=2, noisemul=2,\n noiseoffset=0, frq1=200, frq2=2500, rq1=0.5, rq2=0.1, out=0;\n\n var sig, env;\n\n sig = {BPF.ar((Dust2.ar(dens, dustamp, offset)*LFNoise1.ar(noisefreq,noisemul,noiseoffset)),rrand(frq1,frq2),q=rrand(rq1,rq2),1/q.sqrt)}!2;\n sig = (sig*dist).tanh*amp;\n\n\n Out.ar(out,sig);\n\n }).add;\n);\n\ny = Synth.new(\\friture);\ny.free;\n\ny.set(\\dens,161);\ny.set(\\amp,0.5);\ny.set(\\dist,1);\ny.set(\\rq1,0.2);\ny.set(\\rq2,0.4);\ny.set(\\frq1,133);\ny.set(\\frq2,193);\ny.set(\\noisefreq,1);\ny.set(\\noisemul,2);\ny.set(\\noiseoffset,(-2));\ny.set(\\out,0);\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n var time = 30;\n var line = Line.kr(3000, 290, time);\n var line2 = Line.kr(280, 290, time);\n var line3 = Line.kr(0.01, 10, time);\n var sin = Mix.ar(SinOsc.ar([line, line2]) * SinOsc.ar(line3));\n var comb = CombC.ar(sin, time, SinOsc.kr(0.1).range(0.1, 0.2), time);\n var env = EnvGen.ar(Env.linen(0.01, time, 10), 1, doneAction:2);\n comb * env * 0.05!2;\n}.play\n)\n```"}, {"role": "assistant", "content": "Here is some quick code that sounds like an old sci-fi UFO landing."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n//Version 1\n//P(eace)Bind\n//If error messages could experience Nirvanna, it would sound like this.\n(\n{\nSaw.ar(\n freq: SinOsc.kr([60, 63, 67, 70]).range(440,880),\n mul:LFNoise0.kr(freq: [0.25,1]).range(0,1),\n )\n}.play\n\n);\n\n\n//Version 2\n//SuperCollider\n//Sometimes in life, you feel like you need to collide with things.\n(\n{\nPulse.ar(\n freq: SinOsc.kr([60, 63, 67, 70]).range(30,70),\n mul: LFPulse.kr(freq: [0.25,1]).range(0,1)\n )\n}.play\n\n)\n```"}, {"role": "assistant", "content": "Quiz 4a for MUSC 115, pp. 62-84 from Gentle Intro to SuperCollider."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes DelayPannerSawSine (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n//delaypannersawsine\n{XFade2.ar(AllpassC.ar(HPF.ar(RLPF.ar(Saw.ar(LFPar.kr(0.25).range(220,440)),LFPar.kr(MouseX.kr(0,8),pi).range(220,20000),0.3),LFPar.kr(MouseY.kr(0,8)).range(220,20000)),2,MouseX.kr(0,2),2),AllpassC.ar(HPF.ar(RLPF.ar(WhiteNoise.ar * Saw.ar(LFPar.kr(0.25).range(220,440)),LFPar.kr(MouseX.kr(0,8),pi).range(220,20000),0.3),LFPar.kr(MouseY.kr(0,8)).range(220,20000)),2,MouseY.kr(0,2),2),MouseX.kr(-1,1))}.play\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for in the jungle."}, {"role": "assistant", "content": "```supercollider\n({\nvar nz = { |...args| LFDNoise3.kr(*args) };\nvar sig = Limiter.ar(\n BPF.ar(\n RHPF.ar(\n RLPF.ar(\n WhiteNoise.ar(nz.(1/[9,10],0.25,0.75)),\n nz.(5!2).exprange(1000, 2000),\n nz.(1/5!2).range(0.1,1)),\n nz.(5!2).exprange(50,150),\n nz.(1/5!2).range(0.1,1)),\n nz.(5!2).exprange(150,1000),\n nz.(1/5!2).range(0.1,1)))\n* LFGauss.ar([3,4],0.33) * LFGauss.ar(1/[4,9],0.25)\n* SinOsc.ar(Lag2UD.kr(Duty.kr(1,0,{Dibrown(300,2400,250)}!2),0.25,0.8));\nRotate2.ar(sig[0], sig[1], LFSaw.kr(1/5));\n}.play)\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Harmonics`."}, {"role": "assistant", "content": "```supercollider\na.decay(1.0);\n\nb.sine2(a.ramp(1.0, 1.0).postln, a.decay(1.0).postln, true, true, true);\ny = z.play(s, [\\out, 0, \\bufnum, b]);\ny.free;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// create an audio-rate sine wave at 200 Hz,\n// starting with phase 0 and an amplitude of 0.5\n{ SinOsc.ar(200, 0, 0.5) }.play;\n\n// modulate the frequency with an exponential ramp\n{ SinOsc.ar(XLine.kr(2000, 200), 0, 0.5) }.play;\n\n// more complex frequency modulation\n{ SinOsc.ar(SinOsc.ar(XLine.kr(1, 1000, 9), 0, 200, 800), 0, 0.25) }.play;\n\n// phase modulation (see also PMOsc)\n{ SinOsc.ar(800, SinOsc.ar(XLine.kr(1, 1000, 9), 0, 2pi), 0.25 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// create an audio-rate sine wave at 200 Hz,\n// starting with phase 0 and an amplitude of 0.5\n{ SinOsc.ar(200, 0, 0.5) }.play;\n\n// modulate the frequency with an exponential ramp\n{ SinOsc.ar(XLine.kr(2000, 200), 0, 0.5) }.play;\n\n// more complex frequency modulation\n{ SinOsc.ar(SinOsc.ar(XLine.kr(1, 1000, 9), 0, 200, 800), 0, 0.25) }.play;\n\n// phase modulation (see also PMOsc)\n{ SinOsc.ar(800, SinOsc.ar(XLine.kr(1, 1000, 9), 0, 2pi), 0.25) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n~x.play;\n\n~x = { var alpha,beta; alpha = rrand(99,399); beta = alpha = rrand(99,399);Pan2.ar(LeakDC.ar(Normalizer.ar(BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(\nFreeVerb.ar(Formant.ar(TRand.kr(alpha,alpha+(rrand(5,20)),Impulse.kr(rrand(10,100))), TRand.kr(beta,beta+(rrand(5,20)),Impulse.kr(rrand(10,100))), EnvGen.kr(Env.adsr,Impulse.kr(rrand(100,666)))*rrand(666,3333),0.125),\nrrand(0.5,1.0),rrand(0.5,1.0),rrand(0.5,1.0))\n,100,6.0,12),1000,6.0,0),5000,6.0,0),10000,6.0,12),0.6,0.1)),0)\n};\n```"}, {"role": "assistant", "content": "A drone insect-string from:\r\n\r\nhttp://musicnumbers.wordpress.com/2011/11/25/nx010/."}]} -{"conversations": [{"role": "user", "content": "Explain `Instr` in SuperCollider briefly."}, {"role": "assistant", "content": "Instr — An enhanced version of SynthDef with a library An Instrument is a function that has a unique name attached to it and Specs that describe the input and output datatypes. Category: Libraries > crucial > Instr."}]} -{"conversations": [{"role": "user", "content": "What is `CXAbstractLabel` in SuperCollider?"}, {"role": "assistant", "content": "CXAbstractLabel — parent class for Label classes Category: Libraries > crucial > GUI > abstract."}]} -{"conversations": [{"role": "user", "content": "What does `MxUnit.prepareToBundle` do? What arguments does it take?"}, {"role": "assistant", "content": "Container for a musical object (Instr, NDef, Spline etc); this is a single unit that has inlets and outlets which can be connected to other units Arguments: agroup; bundle; private; bus."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `EventPatternProxy`."}, {"role": "assistant", "content": "```supercollider\n// using a protoEvent\nPdef(\\x, Pbind(\\dur, 0.1));\nPdef(\\x).trace.play(protoEvent: (freq: 1000));\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SelectX`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar(300),\n Pulse.ar(230)\n ];\n\n SelectX.ar(MouseX.kr(0, 1) * a.size, a) * 0.2\n}.play;\n);\n\n(\n{\n var a;\n a = [\n SinOsc.kr(0.25),\n LFSaw.kr(10),\n LFPulse.kr(0.3)\n ];\n\n SinOsc.ar(SelectX.kr(MouseX.kr(0, 1) * a.size, a) * 300 + 400) * 0.2\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nDelayN.ar(z, 0.2, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\n(\n// recursive application of delay.\n{\nz = Decay2.ar(Dust.ar(1, 0.5), 0.01, 0.1, Saw.ar(100 + [0, 1]));\n5.do { |i| z = DelayN.ar(RLPF.ar(z, Rand(100, 3000), 0.03), 1, 1 / (2**i), 1, z * 0.5) };\nz\n}.play\n)\n```"}, {"role": "assistant", "content": "Dust randomly triggers Decay to create an exponential decay envelope for the WhiteNoise input source (DelayN: Simple delay line with no interpolation.)"}]} -{"conversations": [{"role": "user", "content": "Explain `ListTrig` in SuperCollider briefly."}, {"role": "assistant", "content": "ListTrig — Emit a sequence of triggers at specified time offsets The data stored in the [Buffer] atbufnum should be a (single-channel) ordered list of time offsets in seconds. ListTrig will then emit a trigger signal (a single-sample value of 1, at control rate) at each of those times, which are measured from the beginning of the synth's existence, or from the most recentreset trigger (which also resets reading back to the beginning of the buffer). Category: UGens > Buffer."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nMIDIIn.connectAll;\n// MIDIClient.init;\n\n\n(\n// A SynthDef with ADSR envelope\nSynthDef(\"quick2\", {arg freq = 440, amp = 0.1, gate = 1;\n var snd, env;\n env = Env.adsr(0.01, 0.1, 0.3, 2, amp).kr(2, gate);\n snd = Saw.ar(freq: [freq, freq*1.5], mul: env);\n Out.ar(0, snd)\n}).add;\n);\n\n// Play it with a MIDI keyboard\n(\nvar noteArray = Array.newClear(128); // array has one slot per possible MIDI note\n\nMIDIdef.noteOn(\\myKeyDown, {arg vel, note;\n noteArray[note] = Synth(\"quick2\", [\\freq, note.midicps, \\amp, vel.linlin(0, 127, 0, 1)]);\n [\"NOTE ON\", note].postln;\n});\n\nMIDIdef.noteOff(\\myKeyUp, {arg vel, note;\n noteArray[note].set(\\gate, 0);\n [\"NOTE OFF\", note].postln;\n});\n)\n// PS. Make sure SC MIDI connections are made (MIDIIn.connectAll)\n```"}, {"role": "assistant", "content": "Basic example - how to use a MIDI keyboard with a simple synth."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for in the jungle."}, {"role": "assistant", "content": "```supercollider\n({\nvar nz = { |...args| LFDNoise3.kr(*args) };\nvar sig = Limiter.ar(\n BPF.ar(\n RHPF.ar(\n RLPF.ar(\n WhiteNoise.ar(nz.(1/[9,10],0.25,0.75)),\n nz.(5!2).exprange(1000, 2000),\n nz.(1/5!2).range(0.1,1)),\n nz.(5!2).exprange(50,150),\n nz.(1/5!2).range(0.1,1)),\n nz.(5!2).exprange(150,1000),\n nz.(1/5!2).range(0.1,1)))\n* LFGauss.ar([3,4],0.33) * LFGauss.ar(1/[4,9],0.25)\n* SinOsc.ar(Lag2UD.kr(Duty.kr(1,0,{Dibrown(300,2400,250)}!2),0.25,0.8));\nRotate2.ar(sig[0], sig[1], LFSaw.kr(1/5));\n}.play)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Wow, the conciseness of SuperCollider is wonderful!."}, {"role": "assistant", "content": "```supercollider\n(\na=Array.fib(64,0,1);b=Array.fill(size:12,function:{arg i;a[i]%8});\np=1/8;Pdef(\\x,Pbind(\\dur,p,\\degree,Pseq(b,1,0)));\nr=Array.fill(12,{arg i;Pbindf(Pdef(\\x),\\mtranspose,b[i]);});\nPseq(r,(1/p)).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n~buf = Buffer.read(s, \"C:/sounds/break.wav\");\nPlayBuf.ar(1, ~buf, BufRateScale.kr(~buf), loop: 1);\n```"}, {"role": "assistant", "content": "Loads a sound file into server memory, then plays it in a loop at the file's original pitch.\n\n- `Buffer.read(s, path)` allocates a buffer on the server and fills it from the file. It is asynchronous:\n the Buffer object returns immediately, the samples arrive later.\n- `PlayBuf.ar(1, buf, ...)` needs the channel count first — 1 for a mono file. A wrong count is the usual\n cause of a buffer that plays wrongly or not at all.\n- `BufRateScale.kr(buf)` compensates when the file's sample rate differs from the server's, so `rate: 1` is\n the file's true speed.\n- `loop: 1` restarts at the end instead of stopping.\n\nBecause the read is asynchronous, this line pair is only safe if a `s.sync` or a wait happened in between;\notherwise PlayBuf sees a buffer with no data yet."}]} -{"conversations": [{"role": "user", "content": "What is `PackFFT` in SuperCollider?"}, {"role": "assistant", "content": "PackFFT — Pack separate demand-rate FFT bin streams into an FFT chain buffer Takes an array of magnitudes and phases, and packs them into an FFT buffer ready for transforming back into time-domain audio using IFFT. Category: UGens > FFT."}]} -{"conversations": [{"role": "user", "content": "What does `Maybe.value` do?"}, {"role": "assistant", "content": "set the contained object or return the source, or the value of the contained object, if it is a Maybe. If there is a recursion, return nil. `a ="}]} -{"conversations": [{"role": "user", "content": "What is `Pair` in SuperCollider?"}, {"role": "assistant", "content": "Pair — LISP-like two element cells Category: Collections > Ordered."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Migration from the old SourceForge wiki."}, {"role": "assistant", "content": "```supercollider\n// Sing whatever pitch you like into the microphone, but have the output conform to the key you press on your connected MIDI keyboard, like a very low-rent Autotune.\n// by nonprivate April 2009\n// best used with headphones\n// execute one by one...\n\ns = Server.local.boot;\nb = 200; // no. of control bus to use for pitch control\n(\n SynthDef(\"straightenUp\",\n { |baseFreq = 100|\n \n var in, freq, hasFreq, out;\n in = Mix.new(SoundIn.ar([0,1]));\n # freq, hasFreq = Pitch.kr(in, ampThreshold: 0.02, median: 7);\n out = PitchShift.ar(in, 0.08, (baseFreq / freq), 0.0, 0.0);\n Out.ar(0,[out, out])\n }\n ).send(s);\n);\n\ns.sendMsg(\"/s_new\", \"straightenUp\", n = s.nextNodeID, 1, 0);\n\ns.sendMsg(\"/n_map\", n, \"baseFreq\", b);\n\n(\n c = NoteOnResponder(\n { |src,chan,note,vel|\n \n s.sendMsg(\"/c_set\", b, note.midicps);\n \n },\n nil, // any source\n nil, // any channel\n nil, // any note\n nil // any vel\n );\n \n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Sinking in the Ocean (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nx= {\n var lfn = LFNoise2.kr(1);\n var saw = Saw.ar(\n freq: 30,\n mul: LFPulse.kr(\n freq: LFNoise1.kr(1).range(1, 5),\n width: 0.1));\n var bpf = BPF.ar( in: saw, freq: lfn.range(300, 1000), rq: 0.01, mul: 20);\n Pan2.ar(in: bpf, pos: lfn);\n}.play;\n\n\n{LPF.ar(\n in: WhiteNoise.ar(mul: 0.2),\n freq: LFNoise1.kr(1).range(100, 1000)\n)\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `StreamSpec.minval` do?"}, {"role": "assistant", "content": "datatype specifying that the input or output is stream or pattern"}]} -{"conversations": [{"role": "user", "content": "SC can't open or read files?"}, {"role": "assistant", "content": "SuperCollider forum — SC can't open or read files\n\nIt looks as though it’s finally working!\n\nI moved the file to a folder I created in the user support directory for SuperCollider and then changed the quotes to ascii.\n\nI think the issue was that at first I had the file name listed without the extension, then I added the extension to the file name and added the file extension to the file path in the code and this must have created a conflict.\n\nIn the first instance SC needed the file extension, ascii quotes, and since I’m on windows the path needed double \\ in the path file.\n\nThe final working code looks like this:\n\n```supercollider\nb = Buffer.readChannel(s, \"C:\\\\Users\\\\44774\\\\AppData\\\\Local\\\\SuperCollider\\\\Tables\\\\wubsquare.wav\", startFrame:0, numFrames: -1);\n```\n\nThe wav file is simply named wubsquare and I included the file extension in the code."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Re: Re: the perfect frequencies?"}, {"role": "assistant", "content": "```supercollider\n(\nf = {\n var rep = [4, 8, 16, 32];\n var n = rep.choose;\n var x = [\n\n 54, 60, 66, 72, 81, 90, 96, 102,\n 108, 128, 132, 144, 162, 180, 192, 204,\n 216, 240, 264, 288, 324, 360, 384, 408,\n 432, 480, 528, 576, 648, 720, 768, 816,\n 864, 960, 1056, 1152, 1296, 1440, 1536, 1632,\n 1728, 1920, 2112, 2304, 2592, 2880, 3072, 3264,\n 3456, 3840, 4224, 4608, 5184, 5760, 6144, 6528,\n 6912, 7680, 8448, 9216, 10368, 11520, 12288, 528\n\n ];\n var fac1 = [1,10,100,1000].choose;\n var fac2 = [1,10,100,1000].choose;\n var fac3 = [1,10,100,1000].choose;\n Mix.fill(n,\n {\n var detune = 5.rand;\n var saw;\n var sin;\n detune = XLine.kr(0.1,1+250.0.rand ,2+9.0.rand) * 2.0.rand* [1,-1].choose;\n sin = SinOsc.ar(x.choose * ( 1 + ( SinOsc.ar(x.choose/fac1) * x.choose/fac2 )) + detune, 4.rand, 0.25);\n saw = RLPF.ar(Saw.ar(x.choose*0.01+detune, 0.75), x.choose, 2.rand);\n saw = [\n saw,\n saw.fold2( SinOsc.ar(x.choose/fac3).range(0.1,1) ),\n saw.wrap2( SinOsc.ar(x.choose/fac3).range(0.1,1) ),\n saw * SinOsc.ar(x.choose/2),\n ( saw * SinOsc.ar(x.choose/fac3).range(1,20) ).tanh/2,\n ].choose;\n Pan2.ar((sin+saw) * EnvGen.kr(Env.sine(12, 1/n), 1, doneAction:2),\n 1.rand2) \n }\n );\n};\n);\n\n(\n// DEFINE A ROUTINE\nr = Routine({\n\n inf.do({\n f.play;\n 10.wait;\n })\n});\n);\n\nr.reset.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `MassEditUChain.gui` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: parent — (describe argument here); bounds — (describe argument here). Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// By Bjørn Houdorf March 2013, Play your (short) soundfiles with some delay.\n\nb = SoundFile.collectIntoBuffers(\"yourSoundFileFolder/*\"); // 1. rund this\n\n( // 2. and then run this\nt = Task({\n({\n var num= b.size.rand;\n var buf= b[num];\n 0.1*Splay.ar(PlayBuf.ar(buf.numChannels, buf, 1, 1, 0, 0));\n}.play;\n) \n});\n);\n\n\n( // 3. Then run this\nz = Task({\nloop({\n t.start;\n 0.1.wait;\n});\n});\n);\n\n\nz.start; // 4. and run this\nz.stop; // 5. and finally run this\n```"}, {"role": "assistant", "content": "Play your (short) soundfiles with some delay. Your soundfiles should be in the folder \"yourSoundFileFolder\"."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes 003_102 (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\nSynthDef('003_102', {|out=0,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y| Out.ar(out, Pan2.ar(Normalizer.ar(( GbmanL.ar( LPF.ar( SyncSaw.ar(p, k, q, h ), FreqShift.ar(d, r, k, y, a ), h, n ), r, l, Blip.ar(r, f, u, i ), h ))*( LFPar.ar(d, x, Saw.ar(w, k, Formant.ar(s, q, d, DelayL.ar(y, 0.5, w, v, i ), e ) ), y ))*( LFCub.ar(q, a, h, g ))*( Gendy1.ar(r, c, r, QuadL.ar(h, o, j, t, t, v, f ), k, p, g, Pulse.ar(g, g, c, s ), PMOsc.ar(f, u, d, t, d, f ), f, LFNoise0.ar(k, l, e ), d ) )))) }).play(args: #[ a, 0.1, b, 0.83039082494709, c, 7.4736936148092, d, 57.834883574831, e, 0.56638920329924, f, 2.7610572022348, g, -0.60208093272399, h, 0.69731527262978, i, 0.97553825378418, j, 0.47619211673737, k, 0.45142233371735, l, 6.5229251440451, m, 0.34238355327673, n, 3.1624102065486, o, 1, p, 1, q, 5.4898714868897, r, 2.7777416341664, s, 10966.099508885, t, 0.15706503391266, u, 3.1945936724559, v, 20000, w, -4.6151277924266, x, 1.4588773159677, y, 0.0012384873762477 ])\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `NetAddr`."}, {"role": "assistant", "content": "```supercollider\nn = NetAddr(\"localhost\", 12345);\nn = s.addr;\n\n// Example sending symbols, integers, and a float\nn.sendMsg('/s_new', \\default, 2000, 0, s.defaultGroup.nodeID, \\freq, 60.midicps);\n\n// The initial forward slash can be omitted\nn.sendMsg(\\n_set, 2000, \\gate, 0);\n\n// Using the performList syntax, you can use an array to store an OSC message\n~msg = [\\n_set, 2000, \\gate, 0];\nn.sendMsg(*~msg);\n```"}]} -{"conversations": [{"role": "user", "content": "What is `UGen`?"}, {"role": "assistant", "content": "UGen — Abstract superclass of all unit generators"}, {"role": "user", "content": "What does `UGen.multiNew` do?"}, {"role": "assistant", "content": "These methods are responsible for multichannel expansion. They call `*new1(rate, ...args)` for each parallel combination. Most `*ar / *kr` methods delegate to #*multiNewList."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n{ Blip.ar(Blip.kr(4, 5, 500, 60), 59, 0.1) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `VarGui.gui` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a gui Arguments: sliderHeight — Gui slider height. Defaults to 18.; sliderWidth — Gui slider width. Depends on number of columns if not given explicitely.; labelWidth — Slider label width. Default depends on platform and gui scheme (70 or 75).; numberWidth — Slider numberbox width. Default depends on platform and gui scheme (40 or 45).; sliderType — One of the Symbols \\standard, \\smooth, \\round. Both latter refer to EZSmoothSlider and EZRoundSlider from wslib (Quark), which needs to be installed for that choice. See #Ex. 8#Ex.8 . Defaults to \\standard.; sliderMode — One of the Symbols \\jump, \\move. Only relevant in case of sliderType \\smooth or \\round. Determines behaviour if slider field is clicked apart from the knob. See #Ex. 8#Ex.8. Defaults to \\jump.; playerHeight — Gui player height. Defaults to 18.; precisionSpan — Integer. Precision span to be regarded for representation of controlspec step. See #Ex. 9#Ex.9. Defaults to 10.."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nSynthDef(\\madtraffic, {|out, sig, gate=1, freq=440|\n // doneAction: 2 rilascia la synth quando EvnGen ha finito\n sig = (Blip.ar(freq)*0.7+Blip.ar(freq/2+Rand(1,12))*0.7)\n*EnvGen.kr(Env.asr(0.1, 0.3, 0.3), gate, doneAction:2);\n sig = RLPF.ar(sig,SinOsc.kr(0.3, 0, 200, 1500), 0.1);\n sig = FreeVerb.ar(sig, 0.5, 0.5, 0.5);\n Out.ar(out, sig);\n\n}).add;\n);\n\n(\nPbind(\n \\instrument, \\madtraffic,\n \\freq, Pseq([137, 373, Prand([237, 473, 713],1)], inf),\n \\legato, Pseq([1.7, 0.3], inf),\n \\dur, 0.3,\n \\out, Pseq([1, 0], inf)\n).play;\n)\n```"}, {"role": "assistant", "content": "\"It's the lack of eye contact that makes us more idiots, to the point that convertible riders give less to escalation. Closed in the car, explain the psychologists, we regress to childhood and react by shouting, or with that surrogate of the shock that is the horn.\"\r\n\r\n\r\n\r\nhttp://bz-buzz.blogspot.com/2018/09/mad-traffic.html\r\n\r\nhttp://bzakirasantjago.blogspot.it/."}]} -{"conversations": [{"role": "user", "content": "What does `Rational.wrap` do?"}, {"role": "assistant", "content": "Map into a range, wrapping or reflecting. These follow"}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nMix.ar([SinOsc.ar(220, 0, 0.1), SinOsc.ar(330, 0, 0.1)])\n```"}, {"role": "assistant", "content": "Sums two sine waves into one signal — a perfect fifth, 220 Hz and 330 Hz, at 0.1 amplitude each.\n\n`[SinOsc.ar(220, 0, 0.1), SinOsc.ar(330, 0, 0.1)]` is an Array of two audio-rate signals (each UGen\nreturns a signal; an array of them is just a list). `Mix.ar` adds the elements together. The alternative\n`+` operator does the same for two signals, and `Splay.ar` would spread them across the stereo field\ninstead of summing them."}]} -{"conversations": [{"role": "user", "content": "Rand or rand difference?"}, {"role": "assistant", "content": "SuperCollider forum — Rand or rand difference?\n\nI think you meant to compare Rand and rrand (not rand) – both generate a random number between a given low and high, but Rand is intended to be used inside a SynthDef and the behavior is slightly different. Compare:\n\n```supercollider\n(\nSynthDef(\\test, {\n var freq = rrand(400, 600);\n Out.ar(0, SinOsc.ar(freq) * 0.2);\n}).add;\n);\n\nSynth(\\test); // run and stop multiple times: always same freq\n\n(\nSynthDef(\\test2, {\n var freq = Rand(400, 600);\n Out.ar(0, SinOsc.ar(freq) * 0.2);\n}).add;\n);\n\nSynth(\\test2); // run and stop multiple times: every time a different freq\n```\n\nAs you can read in the help file, Rand is intended to be used inside SynthDefs when you want the particular behavior of a newly generated random frequency for each Synth called. You can use rrand(lo, hi) inside a SynthDef too, if you want the random number to be generated only once at time of SynthDef creation (it gets “inscribed in the recipe” for good), so all future and all Synth calls based on that SynthDef to use on that same random number.\n\nAs a side note, rand (as opposed to rrand) generates a random number between zero and the receiver:\n\n```supercollider\nrand(8); // random numbers between 0 and and 8 (excluding 8)\n\nrand(0.5, 8); // random numbers between 0 and 0.5; second argument is ignored here\n```\n\nAlso in regards to the specific way you present the example (as Functions, indicated by the curly braces): note the difference when you evaluate them:\n\n```supercollider\n{Rand(0.5,8)}.value; // returns 'a Rand'\n{rrand(0.5,8)}.value; // returns an actual random choice between lo and hi\n```\n\nHope this helps,\n\nB"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// The indices arg might get a pattern which can generate Functions as well as arrays.\n// Start with sufficient number of zeros as lookBack to fill buffer.\n\n(\np = PSloop(\n Pbind(\n \\dur, Pn(Pshuf([1, 1, 2]/6)),\n \\midinote, Prand((60..80), inf)\n ),\n bufSize: 10,\n lookBack: Pseq([Pn(0, 7), Pstutter(4, Pwhite(3, 5, 1))], inf).trace,\n indices: Pseq([1!2, { |l| (l-1..0).postln }], inf).trace\n).trace.play\n);\n\np.stop\n```"}, {"role": "assistant", "content": "The indices arg might get a pattern which can generate Functions as well as arrays. Start with sufficient number of zeros as lookBack to fill buffer. (PSloop: Pattern to derive loops from a given Pattern)"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// play SinOscs silently and wait for granulation envelopes\n\n(\na = Bus.audio(s, 10);\nx = { Splay.ar(In.ar(a, 10) * SinOsc.ar((3..12) * 100, 0, 0.05)) }.play\n);\n\n\n// send envelopes to buses\n\n(\nz = {\n DXEnvFanOut.ar(\n Dseq((0..5) + a.index, inf) + Diwhite(1, 4),\n \n // with newer SC versions you can also write:\n // Dseq((0..5), inf) + Diwhite(1, 4) + a.index,\n \n fadeTime: 0.05,\n width: 1,\n initOutOffset: -0.5\n )\n}.play\n);\n\nx.release;\n\n// clean\n// …\n```"}, {"role": "assistant", "content": "play SinOscs silently and wait for granulation envelopes send envelopes to buses (DXEnvFanOut: sends crossfade envelopes to out buses according to demand-rate control)"}]} -{"conversations": [{"role": "user", "content": "What is `SinOscFB` in SuperCollider?"}, {"role": "assistant", "content": "SinOscFB — Feedback FM oscillator SinOscFB is a sine oscillator that has phase modulation feedback; its output plugs back into the phase input. Basically this allows a modulation between a sine wave and a sawtooth like wave. Overmodulation causes chaotic oscillation. It may be useful if you want to simulate feedback FM synths. Category: UGens > Generators > Deterministic, UGens > Generators > Chaotic."}]} -{"conversations": [{"role": "user", "content": "What does `EventStreamPlayer.reschedule` do?"}, {"role": "assistant", "content": "Switch the Task to a different clock, or a different time, without stopping. See Routine#-reschedule for complete"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Now with a little more stick?"}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\cowbell, {\n | out=0, amp=0.3, gate=1, fund_freq=540, pan=0.0 |\n var sig, env, hash;\n\n // hash = DC.ar(0);\n hash = BPF.ar(\n Hasher.ar(Sweep.ar(rate: TRand.kr(1.0, 10.0))), \n fund_freq * 1.4, \n 0.5,\n 2\n ).tanh * Env.perc(0.001, 0.02).ar(0);\n sig = Pulse.ar( fund_freq * [ 1, 1.5085 ], [ 0.565, 0.445 ], [ 0.4, 0.6 ] ).atan;\n env = EnvGen.ar(\n Env(\n [ 0, 0.05, 1, 0.1, 0 ], [ 0.003, 0.002, 0.05, 0.5 ], [2, -4, -4, -4]\n ),\n gate: gate,\n timeScale: [ 1.0, 1.5 ],\n doneAction: 2\n );\n sig = Mix( (hash + sig) * env );\n sig = BPF.ar( sig, fund_freq * 2, 1.808 );\n\n Out.ar( out, Pan2.ar( sig, pan, amp ) );\n}).add;\n);\n\nSynth(\\cowbell);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Granular electromaton."}, {"role": "assistant", "content": "```supercollider\n(\nServer.local.waitForBoot({\n(\nz.free;\nz = Buffer.alloc(s, 512, 1);\nz.sine1(1.0 / [1, 2, 3, 4], true, true, true);\n\n fork( { loop {\n SynthDef(\"g1\",{ arg out=0,bufnum=0,dur=1,rate=1,pos=0,sdens=1,edens=1;\n var dens = Line.kr(sdens,edens,dur);\n var trig = [LFNoise0,SinOsc,Impulse,LFPulse,LFSaw].choose.ar(Line.kr(sdens,edens,dur));\n //var env = EnvGen.kr(Env.perc(0.0001.rrand(0.1),dur*0.5.rrand(2)),doneAction:2);\n var env = EnvGen.kr(Env.perc(0.0001.rrand(0.1),dur*(0.5.rrand(4))),doneAction:2);\n Out.ar(out,\n GrainBuf.ar(2,trig,1/dens,bufnum,rate,pos)*env;\n )\n }).add();\n [1,2,4,8,16,32].choose.postln.wait;\n }\n }\n );\n\n\na = Pbind(\\instrument,\\g1,\\dur,Pseq([Pseq([0.25],32),Pseq([0.25,0.125,0.125],32),Pseq([0.125],32)],inf),\\sdens,Pseq([9000,1000,500]/10,inf),\\edens,Prand([Pseq([9000,1000,500]/10,4),Pseq([1],1)],inf),\\rate,Pfunc({-10.0.rrand(10)}),\\pos,Pfunc({1.0.rand}),\\bufnum,z.bufnum);\nb = Pbind(\\instrument,\\g1,\\dur,Pseq([4],inf),\\sdens,Pseq([9000,1000,500]/100,inf),\\edens,Prand([Pseq([9000,1000,500]/10,1),Pseq([1],3)],inf),\\rate,Pfunc({-10.0.rrand(10)}),\\pos,Pfunc({-10.0.rrand(10)}),\\bufnum,z.bufnum);\nc = Pbind(\\instrument,\\g1,\\dur,Pseq([4/3],inf),\\sdens,Pseq([9000,1000,500,25],inf),\\edens,Prand([Pseq([9000,1000,500,25],1),Pseq([1],4)],inf),\\rate,Pfunc({-100.0.rrand(100)}),\\pos,Pfunc({-10.0.rrand(10)}),\\bufnum,z.bufnum);\n\n\na =a.play;\nb =b.play;\nc =c.play;\n\n)\n});\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `AbstractPlayer.cmdPeriod` do?"}, {"role": "assistant", "content": "the base class for all Players : a playable object"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `MouseX`."}, {"role": "assistant", "content": "```supercollider\n{ SinOsc.ar(MouseX.kr(40, 10000, 1), 0, 0.1) }.play;\n{ SinOsc.ar(MouseX.kr(500, 10000, 1).poll, 0, 0.1) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\na = { |tempo = 1| Ringz.ar(Impulse.ar(tempo), [501, 500], 1/tempo) }.play;\nt = TempoBusClock(a);\nTask { loop { \"klink\".postln; 1.wait } }.play(t);\n);\n\nt.tempo = 1.3;\nt.tempo = 0.5;\nt.tempo = 1.0;\n\n\n// in ProxySpace, a TempoBusClock can be added together with a ~tempo NodeProxy:\n\np = ProxySpace.push(s);\np.makeTempoClock;\np.clock; // now the ProxySpace's clock is a TempoBusClock\n\n~out.play;\n~out = { Ringz.ar(Impulse\n// …\n```"}, {"role": "assistant", "content": "in ProxySpace, a TempoBusClock can be added together with a ~tempo NodeProxy: patterns and tasks are synchronized: (TempoBusClock: a clock that synchronizes its tempo with the server)"}]} -{"conversations": [{"role": "user", "content": "How should I organise a SuperCollider project on disk?"}, {"role": "assistant", "content": "One folder per piece, with a fixed shape:\n\n```text\nmy-piece/\n synthdefs.scd // only SynthDef(...).add, loaded first\n material.scd // buffers, samples, scales\n piece.scd // the performance: Tdefs, Pbinds, Ndefs\n README.md // tempo, required samples, how to run it\n```\n\nThen the workflow is: open `synthdefs.scd`, Ctrl+A Ctrl+Enter to load it, load `material.scd`, and work in\n`piece.scd`. Keeping definitions out of the performance file is what makes a reboot survivable and a piece\nre-runnable six months later."}]} -{"conversations": [{"role": "user", "content": "What is `PMOsc` in SuperCollider?"}, {"role": "assistant", "content": "PMOsc — Phase modulation oscillator pair. Phase modulation sine oscillator pair. Category: UGens > Generators > Deterministic."}]} -{"conversations": [{"role": "user", "content": "What does `Gendy3.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Dynamic stochastic synthesis generator. Arguments: ampdist — Choice of probability distribution for the next perturbation of the amplitude of a control point. The distributions are (adapted from the GENDYN program in Formalized Music):; durdist — Choice of distribution for the perturbation of the current inter control point duration.; adparam — A parameter for the shape of the amplitude probability distribution, requires values in the range 0.0001 to 1 (there are safety checks in the code so don't worry too much if you want to modulate!).; ddparam — A parameter for the shape of the duration probability distribution, requires values in the range 0.0001 to 1.; freq — Oscillation frequency.; ampscale — Normally 0.0 to 1.0, multiplier for the distribution's delta value for amplitude. An ampscale of 1.0 allows the full range of -1 to 1 for a change of amplitude.; durscale — Normally 0.0 to 1.0, multiplier for the distribution's delta value for duration. An ampscale of 1.0 allows the full range of -1 to 1 for a change of duration.; initCPs — Initialise the number of control points in the memory. Xenakis specifies 12. There would be this number of control points per cycle of the oscillator, though the oscillator's period will constantly change due to the duration distribution.."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for attempt at emulating a breathing sound."}, {"role": "assistant", "content": "```supercollider\n(\n//s.options.memSize_(64000);\nTempoClock.tempo_(1.0);\n\ns.waitForBoot({\n SynthDef(\\breathe_in, {\n | out = 0, gate = 1, in1=0.11, in2=0.63, in3=0.18, amdb= -10 |\n var menv = EnvGen.kr(Env.new([0,1,1,0],[in1, in2, in3], curve:'lin'),\n gate,\n doneAction:Done.freeSelf);\n var noise = WhiteNoise.ar(amdb.dbamp);\n var f1 = BPF.ar(in:noise, freq:5790, rq:0.1, mul:-29.dbamp);\n var f2 = BPF.ar(in:noise, freq:3400, rq:0.2, mul:-16.dbamp);\n var f3 = BPF.ar(in:noise, freq:1990, rq:0.1, mul:-23.dbamp);\n var f4 = BPF.ar(in:noise, freq:1250, rq:0.1, mul:-26.dbamp);\n Out.ar(out, menv*(f1+f2+f3+f4)!2);\n }).add;\n\n SynthDef(\\breathe_out, {\n | out = 0, gate=1, out1=0.343, out2=0.387, amdb= -4.33 |\n var menv = EnvGen.kr(Env.new([0, 1, 0], [out1,out2], curve:'lin'),\n gate,\n doneAction:Done.freeSelf);\n var noise = WhiteNoise.ar(amdb.dbamp);\n var f1 = BPF.ar(in:noise, freq:2290, rq:0.1, mul:-17.dbamp);\n var f2 = BPF.ar(in:noise, freq:1290, rq:0.1, mul:-19.dbamp);\n var f3 = BPF.ar(in:noise, freq:490, rq:0.1, mul:-18.dbamp);\n Out.ar(out, menv*(f1+f2+f3)!2);\n }).add;\n\n\n s.sync;\n\n fork {\n 50.do({\n var in1 = 0.11.rrand(0.22);\n var in2 = 0.6.rrand(0.8);\n var in3 = 0.16.rrand(0.30);\n var pausein = 0.11.rrand(0.20);\n var out1 = 0.30.rrand(0.50);\n var out2 = 0.36.rrand(0.50);\n var pauseout = 0.11.rrand(0.20);\n var amdb = -10.0.rrand(-14.0);\n var amdb2 = amdb/2.5;\n //(\"in1: \" ++ in1 ++ \" in2: \" ++ in2 ++ \" in3: \" ++ in3 ++ \" pausein: \" ++ pausein ++ \" out1: \" ++ out1 ++ \" out2: \" ++ out2 + \" pauseout: \" ++ pauseout).postln;\n Synth(\\breathe_in, [\\in1, in1, \\in2, in2, \\in3, in3, \\amdb, amdb]);\n (in1+in2+in3+pausein).wait;\n Synth(\\breathe_out, [\\out1, out1, \\out2, out2, \\amdb, amdb2]);\n (out1+out2+pauseout).wait;\n });\n };\n\n});\n);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\np = Patch({ arg audio=0,ffreq=300;\n RHPF.ar(audio,ffreq,0.1)\n});\nq = Patch({\n Saw.ar(mul: 0.3)\n});\n\np.play;\nq.play;\n\n// adds a connection\n// but q is still out of main outs\np.connectInputToPlayer(0,q)\n\n\nq.patchTo(p,0;\n\n\np.gui\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\np = Patch({ arg audio=0,ffreq=300;\n RHPF.ar(audio,ffreq,0.1)\n});\nq = Patch({\n Saw.ar(mul: 0.3)\n});\n\np.play;\nq.play;\n\n// adds a connection\n// but q is still out of main outs\np.connectInputToPlayer(0,q)\n\n\nq.patchTo(p,0);\n\n\np.gui\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SparseArray.newClear` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a new SparseArray of the specified size, with each slot's value being default. `g = SparseArray.newClear(20, Arguments: size — Number of slots in the desired array. Note that slots are not explicitly created, so the speed of creation is not related to the array size.; default — The default value, i.e. the value that all slots should take at first.."}]} +{"conversations": [{"role": "user", "content": "What does `InstrSynthDef.secretDefArgs` do?"}, {"role": "assistant", "content": "Extends SynthDef enabling the extra capabilities of Instr with Patch"}]} +{"conversations": [{"role": "user", "content": "What does `MxChannel.prepareToBundle` do? What arguments does it take?"}, {"role": "assistant", "content": "a group of MxUnits Arguments: parentGroup; bundle; private; bus; groupToUse."}]} +{"conversations": [{"role": "user", "content": "The server stopped responding. What do I do?"}, {"role": "assistant", "content": "In order: `Ctrl+.` (CmdPeriod) to reset scheduling, then `s.reboot` if the server itself is wedged.\nA reboot drops every SynthDef and buffer, so re-add them — which is why real projects keep their SynthDefs\nin a file you can re-evaluate rather than typing them in the REPL.\n\nIf the boot itself fails, the post window has the reason: usually the audio device (another application\nholding exclusive access) or a sample-rate mismatch. `Server.default.options.device` picks a device before\n`s.boot`."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// increase feedback\n{ FBSineC.ar(SampleRate.ir, 1, Line.kr(0.01, 4, 10), 1, 0.1) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// increase feedback\n{ FBSineC.ar(SampleRate.ir, 1, Line.kr(0.01, 4, 10), 1, 0.1) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `AbstractFunction`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\na = { |x| #[440, 720, 801, 1020.2].at(x) }; b = a.cpsmidi; [a.value(3), b.value(3)];\na = Pseries(220, 220, inf).cpsmidi; a.asStream.nextN(12); // overtone series as midinotes\n// follow but round to next midinote\n{ a = Pitch.kr(SoundIn.ar).at(1); Pulse.ar(a.cpsmidi.round.midicps) * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "[ 1, 2, 1, 1, 2, 1, 1 ] how to find adjacent elements in an array?"}, {"role": "assistant", "content": "SuperCollider forum — [ 1, 2, 1, 1, 2, 1, 1 ] how to find adjacent elements in an array\n\nRandColors:\n\nI need to find the index, the how many times (the adjacent values are equal) and what is the adjacent value.\n\nThis is perhaps a bit verbose and clunky, but it meets the above specification:\n\n```supercollider\n(\n~repeats = {|array|\n // return [index, number of repeats, the value] for each repeated value\n var results = [];\n var thisIndex = 0;\n var thisCount = 1;\n var thisValue = array[0];\n array[1..].do{|val, i|\n if(val == thisValue,\n {thisCount = thisCount + 1},\n {\n if(\n thisCount > 1,\n {results = results.add([thisIndex, thisCount, thisValue])},\n );\n thisValue = val;\n thisIndex = i + 1;\n thisCount = 1;\n }\n )\n };\n if(thisCount > 1, {results = results.add([thisIndex, thisCount, thisValue])});\n results;\n}\n);\n\na = [1, 2, 1, 1, 1, 2, 1, 1];\nb = ~repeats.value(a);\n\na = [2, 3, 5, 5];\nb = ~repeats.value(a);\n```"}]} +{"conversations": [{"role": "user", "content": "What is `GlitchRHPF` in SuperCollider?"}, {"role": "assistant", "content": "GlitchRHPF — backward compatibility after sc3.4 HPF and RHPF were changed to use double-precision floats (svn revision: 10300 - 8sep2010). GlitchHPF and GlitchRHPF can be used as drop-in replacements to get the old behavior back. Good for very noise and glitchy sounds. Category: UGens > Filters > Linear, UGens > Filters > GlitchUGens."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LinExp`."}, {"role": "assistant", "content": "```supercollider\n// compare:\n(\n{\n var mod = SinOsc.kr(Line.kr(1, 10, 10));\n SinOsc.ar(mod * 400 + 500) * 0.1\n}.play;\n);\n\n(\n{\n var mod = SinOsc.kr(Line.kr(1, 10, 10));\n SinOsc.ar(LinExp.kr(mod, -1, 1, 100, 900)) * 0.1\n}.play;\n);\n\n// modulating destination values.\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(LinExp.ar(mod, -1, 1, MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1))) * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ BPF.ar(Saw.ar(200, 0.5), FSinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3600, 4000), 0.3) }.play;\n\n{ BPF.ar(Saw.ar(200, 0.5), MouseX.kr(100, 10000, 1), 0.3) }.play;\n\n // BPF on control signals:\n(\n{ var vib = BPF.kr(PinkNoise.kr, MouseX.kr(1, 100, 1), 0.3) * 10;\n SinOsc.ar(vib * 200 + 600) * 0.2 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ BPF.ar(Saw.ar(200, 0.5), FSinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3600, 4000), 0.3) }.play;\n\n{ BPF.ar(Saw.ar(200, 0.5), MouseX.kr(100, 10000, 1), 0.3) }.play;\n\n // BPF on control signals:\n(\n{ var vib = BPF.kr(PinkNoise.kr, MouseX.kr(1, 100, 1), 0.3) * 10;\n SinOsc.ar(vib * 200 + 600) * 0.2 }.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `AbstractFunction.log2` do?"}, {"role": "assistant", "content": "An object which responds to a set of messages that represent mathematical functions"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// default initial params\n{ LatoocarfianL.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// default initial params\n{ LatoocarfianL.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `EnvGen`."}, {"role": "assistant", "content": "```supercollider\n// as amplitude envelope\n(\n{\n var env = Env([0, 1, 0.5, 1, 0], [0.01, 0.5, 0.02, 0.5]);\n SinOsc.ar(470) * EnvGen.kr(env, doneAction: Done.freeSelf)\n}.play\n);\n\n// as amplitude and modulation envelope\n(\n{\n var env = Env([0, 1, 0.5, 0.8, 0, 1.2, 0], [0.01, 0.5, 0.02, 0.5, 0.2, 0.5]);\n var gate = Impulse.kr(MouseX.kr(0.2, 3), 0.5);\n var gen = EnvGen.kr(env, gate);\n SinOsc.ar(270, SinOsc.ar(gen * 473)) * gen * 0.2\n}.play\n);\n// EnvGen multichannel expands when passed a multichannel envelope\n(\n{\n SinOsc.ar(\n EnvGen.kr(\n Env.circle([0, 1, 0, (2..4), 0, LFNoise1.kr(0.1 ! 5) * 10, 0], [0.01, 0.6])\n )\n * 240 + 300\n ).sum * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// default initial params\n{ LatoocarfianL.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// default initial params\n{ LatoocarfianL.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LFPulse`."}, {"role": "assistant", "content": "```supercollider\n{ LFPulse.ar(50) * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// It might also be desirable to start with a fade from silence.\n// This can be done with a negative initOutOffset:\n\n(\nx = {\n var lfo = XLine.ar(1, 0.5, 60);\n DXMix.ar(\n Dseq([0, 4, 1, 5, 2, 6, 3, 7], inf),\n `(Saw.ar((1..8) * 70 * lfo, 0.075)),\n fadeTime: 2,\n width: 2,\n initOutOffset: -1\n ) ! 2\n}.play\n;\n\nx.release\n\n\n// overlap scheme with width = 2 and initOutOffset = -1:\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// It might also be desirable to start with a fade from silence.\n// This can be done with a negative initOutOffset:\n\n(\nx = {\n var lfo = XLine.ar(1, 0.5, 60);\n DXMix.ar(\n Dseq([0, 4, 1, 5, 2, 6, 3, 7], inf),\n `(Saw.ar((1..8) * 70 * lfo, 0.075)),\n fadeTime: 2,\n width: 2,\n initOutOffset: -1\n ) ! 2\n}.play\n);\n\nx.release\n\n\n// overlap scheme with width = 2 and initOutOffset = -1:\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Control`."}, {"role": "assistant", "content": "```supercollider\na = { SinOsc.ar(\\freq.kr(440, 1.2)) }.play;\na.set(\\freq, 330);\na.release;\na = { SinOsc.ar(\\freq.kr([440, 460], 1.2)) }.play;\na.setn(\\freq, [330, 367]);\na.release;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// modulating the frequency\n\n{ Saw.ar(XLine.kr(40, 4000, 6), 0.2) }.play;\n\n// two band limited sawtooth waves through a resonant low pass filter\n\n{ RLPF.ar(Saw.ar([100, 250], 0.1), XLine.kr(8000, 400, 5), 0.05) }.play;\n```"}, {"role": "assistant", "content": "modulating the frequency two band limited sawtooth waves through a resonant low pass filter (Saw: Band limited sawtooth.)"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n\nSynthDef(\\param, { arg freq = 100, sustain, amp;\n var sig;\n sig = LFPar.ar(freq: freq,\n mul: EnvGen.kr(Env.perc(0, sustain, 0.5), doneAction:2) * amp);\n sig = Splay.ar(sig);\n Out.ar(0, sig);\n}).add;\n\ne = Pbind(\n \\midinote, Prout({\n var tone0, tone1, tone2, interval, freq0, delta;\n loop {\n tone0 = rrand(0,11);\n interval = rrand(2,4);\n tone1 = Scale.minor(\\pythagorean).at(tone0) + [0,12,24].choose + 0.07;\n tone2 = Scale.minor(\\pythagorean).at(tone0 + interval) + [0,12,24].choose;\n freq0 = [tone1,tone2]+48;\n postln(freq0);\n freq0.yield;\n }\n }),\n \\dur, Prand([1,2,4,8,12,16,4,6,8], inf),\n \\instrument, \\param,\n \\amp, 0.5,\n \\sustain, 2,\n).play(quant:1); // returns an EventStream\nTempoClock.default.tempo = 1200/60;\n\n)\n```"}, {"role": "assistant", "content": "minor random bliss in two for Prout (a SuperCollider snippet)."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Psubdivide`."}, {"role": "assistant", "content": "```supercollider\n(\na = Psubdivide(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,0,1,3,4,0], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n100.do({ x.next.postln });\n);\n\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Psubdivide(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n);\n\n\n(\na = Psubdivide(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,4,4,0,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `MIDIdef.tick` do?"}, {"role": "assistant", "content": "A convenience method to create a new MIDIdef which responds to MIDI tick messages. See #*new for argument descriptions. The responding `func` will be passed the argument Returns: A new instance of MIDIdef which responds to MIDI tick messages."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `QuadL`."}, {"role": "assistant", "content": "```supercollider\n// logistic map\n// equation: x1 = -r*x0^2 + r*x0\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n QuadL.ar(SampleRate.ir/4, r.neg, r, 0, 0.1) * 0.4;\n}.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Compander` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var z;\n\n // signal (clean)\n z = Decay2.ar(\n Impulse.ar(8, 0, LFSaw.kr(0.3, 1, -0.3, 0.3)),\n 0.001,\n 0.3\n )\n * Mix.ar(Pulse.ar([80, 81], 0.3));\n\n // apply gate (mouse x sets treshold)\n Compander.ar(z, z,\n thresh: MouseX.kr(0.001, 1),\n slopeBelow: 10,\n slopeAbove: 1,\n clampTime: 0.01,\n relaxTime: 0.01\n )\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Pmulp` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\freq, Pseq([500, 600, 700]), \\instrument, \\sinegrain);\na = Pmulp(\\freq, Pseq([0.5, 0.9, 0.8], inf), a);\na.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is the difference between \\degree, \\midinote and \\freq in a Pbind?"}, {"role": "assistant", "content": "`\\freq` is the frequency in Hz and is used as-is. `\\midinote` is a MIDI note number, converted to frequency by the default instrument. `\\degree` is a scale degree, quantised to the scale in \\scale (default major) rooted at \\root; degrees can be negative or fractional. If you set both, the more specific conversion wins, so set exactly one."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nx = {\n |lookBack = 3, thr = 1|\n var trig = Impulse.ar(7);\n // for a non-integer source it makes sense to take a sufficiently large threshold thr\n var midi = Demand.ar(trig, 0, DIdev(SinOsc.ar(0.2, 0, 15, 82), 5, -6, 5, lookBack, thr: thr));\n midi.poll(7, label: \\midi);\n SinOsc.ar(midi.midicps.lag(0.007)) ! 2 * 0.1\n}.play;\n);\n\n// close floats can occur here \nx.set(\\thr, 0.01)\n\n// not here\nx.set(\\thr, 2\n\nx.release\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nx = {\n |lookBack = 3, thr = 1|\n var trig = Impulse.ar(7);\n // for a non-integer source it makes sense to take a sufficiently large threshold thr\n var midi = Demand.ar(trig, 0, DIdev(SinOsc.ar(0.2, 0, 15, 82), 5, -6, 5, lookBack, thr: thr));\n midi.poll(7, label: \\midi);\n SinOsc.ar(midi.midicps.lag(0.007)) ! 2 * 0.1\n}.play;\n);\n\n// close floats can occur here \nx.set(\\thr, 0.01)\n\n// not here\nx.set(\\thr, 2)\n\nx.release\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,0,1,3,4,0], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n100.do({ x.next.postln });\n);\n\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = PdurStutter\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,0,1,3,4,0], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n100.do({ x.next.postln });\n);\n\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n);\n\n\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,4,4,0,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// try wiggling mouse quickly;\n// LFNoise frequently seems stuck, LFDNoise changes smoothly.\n\n{ SinOsc.ar(LFNoise1.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n{ SinOsc.ar(LFDNoise1.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFNoise1.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n\n{ LFDNoise1.ar(XLine.kr(2000, 20000, 8), 0.1 }.scope;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// try wiggling mouse quickly;\n// LFNoise frequently seems stuck, LFDNoise changes smoothly.\n\n{ SinOsc.ar(LFNoise1.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n{ SinOsc.ar(LFDNoise1.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFNoise1.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n\n{ LFDNoise1.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// By Bjørn Houdorf March 2013, Play your (short) soundfiles with some delay.\n\nb = SoundFile.collectIntoBuffers(\"yourSoundFileFolder/*\"); // 1. rund this\n\n( // 2. and then run this\nt = Task({\n({\n var num= b.size.rand;\n var buf= b[num];\n 0.1*Splay.ar(PlayBuf.ar(buf.numChannels, buf, 1, 1, 0, 0));\n}.play;\n) \n});\n);\n\n\n( // 3. Then run this\nz = Task({\nloop({\n t.start;\n 0.1.wait;\n});\n});\n);\n\n\nz.start; // 4. and run this\nz.stop; // 5. and finally run this\n```"}, {"role": "assistant", "content": "Play your (short) soundfiles with some delay. Your soundfiles should be in the folder \"yourSoundFileFolder\"."}]} +{"conversations": [{"role": "user", "content": "What does `Ppoisson.new` do? What arguments does it take?"}, {"role": "assistant", "content": "random values that follow a Poisson Distribution (positive integer values) Arguments: mean — The mean of the distribution.; length — Number of values produced.."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `UGen`."}, {"role": "assistant", "content": "```supercollider\n{ Blip.ar(Blip.kr(4, 5, 500, 60), 59, 0.1) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LinCongL`."}, {"role": "assistant", "content": "```supercollider\n// default initial params\n{ LinCongL.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `NRand`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-NRand\", { |out = 0, n = 0|\n Out.ar(out,\n FSinOsc.ar(\n NRand(1200.0, 4000.0, n),\n 0, Line.kr(0.2, 0, 0.01, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n(\nn = 0;\nRoutine({\n inf.do({ |i|\n Synth.new(\"help-NRand\", [\\n, n]); 0.05.wait;\n })\n}).play;\n);\n\nn = 1;\nn = 2;\nn = 4;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `BBandPass` in SuperCollider?"}, {"role": "assistant", "content": "BBandPass — Band Pass Filter The B equalization suite is based on the Second Order Section (SOS) biquad UGen. Category: UGens > Filters > BEQSuite."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for gabber kick (a SuperCollider snippet) that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\gabberkick, {\n var snd;\n snd = SinOsc.ar(Env([1000, 69, 60], [0.015, 0.1], \\exp).ar * [-0.1, 0, 0.1].midiratio);\n snd = Mix(snd);\n snd = (snd * 10).tanh;\n snd = (snd * 5.1).atan;\n snd = BPeakEQ.ar(snd, XLine.kr(2000, 100, 0.3), 2.0, 8);\n snd = snd + DelayC.ar(snd, 0.01, SinOsc.ar(4).range(0.0, 0.001));\n snd = RLPF.ar(snd, 8000, 0.7);\n snd = snd * Env([0, 1, 0.7, 0.7, 0], [0.001, 0.01, 0.3, 0.02]).ar(2);\n snd = (snd * 0.6).clip(-1, 1);\n Out.ar(\\out.kr(0), Pan2.ar(snd, \\pan.kr(0), \\amp.kr(0.1)));\n}).add;\n);\n\nSynth(\\gabberkick, [amp: 0.6])\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Resonz`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"pitchFromNoise\", { arg out = 0;\n Out.ar(\n out,\n Resonz.ar(\n WhiteNoise.ar(15),\n LFNoise0.kr(2, 110, 660),\n 0.005\n )\n )\n}).add;\n);\n\n\n(\nSynth(\"ringModulation\");\nSynth(\"pitchFromNoise\", [\\out, 1]);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nx = { |freq = 440, amp = 0.2| SinOsc.ar(freq) * amp }.play;\nx.set(\\freq, 660);\n```"}, {"role": "assistant", "content": "Starts an anonymous synth with two controls, then changes one of them while it plays.\n\nThe `|freq = 440, amp = 0.2|` are arguments of the function, and `.play` turns each into a Synth control\nwith that default value. `x` holds the Synth node. `.set(\\freq, 660)` sends a `/n_set` message to the\nserver, so the oscillator changes frequency without being restarted — that is why the sound glides rather\nthan re-triggering. Note that `\\freq` is a Symbol: the backslash is part of the name."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LinSelectX`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar(300),\n Pulse.ar(230)\n ];\n\n LinSelectX.ar(MouseX.kr(0, 1) * a.size, a) * 0.2\n}.play;\n);\n\n(\n{\n var a;\n a = [\n SinOsc.kr(0.25),\n LFSaw.kr(10),\n LFPulse.kr(0.3)\n ];\n\n SinOsc.ar(LinSelectX.kr(MouseX.kr(0, 1) * a.size, a) * 300 + 400) * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for seeking an Array!: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(// * //watch the postWindow\na=[\"m\",\"x\",\"f\",\"k\",\"d\",\"p\"];\nx=Array;\ny=x.newClear(6);\n~mxfkdp=Task({\n inf.do({y.put(x.series(6,0,1).choose,a.scramble).postln;\n 0.03.wait;})}).play;\nm=fork({inf.do({\n \"array num:\".postcln;\n if(y[x.series(6,0,1).choose.postcln]==a,\n {\"lo encontraste!/found it!\".postcln;\n 1.do({GVerb.ar(\n EnvGen.ar(Env.perc(0.01,8),1,doneAction:2)*\n Blip.ar(XLine.kr(440,1600,8)),50,10,0.02)}.play);\n ~mxfkdp.stop;\n m.stop;}, \n {\"buscando.../seeking...\".postcln;});\n 0.03.wait})});\n);\n//.SCtweetLong\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// start a noise patch and set the id of the generator\n(\nSynthDef(\"help-RandID\", { |out = 0, id = 1|\n RandID.ir(id);\n Out.ar(out,\n WhiteNoise.ar(0.05) + Dust2.ar(70)\n )\n}).add;\n);\n\n// reset the seed of my rgen at a variable rate\n(\nSynthDef(\"help-RandSeed\", { |seed = 1910, id = 1|\n RandID.kr(id);\n RandSeed.kr(Impulse.kr(FSinOsc.kr(0.2, 0, 10, 11)), seed);\n}).add;\n\n);\n\n// start two noise synths on left and right channel with a different randgen id\na = Synth(\"help-RandID\", [\\\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// start a noise patch and set the id of the generator\n(\nSynthDef(\"help-RandID\", { |out = 0, id = 1|\n RandID.ir(id);\n Out.ar(out,\n WhiteNoise.ar(0.05) + Dust2.ar(70)\n )\n}).add;\n);\n\n// reset the seed of my rgen at a variable rate\n(\nSynthDef(\"help-RandSeed\", { |seed = 1910, id = 1|\n RandID.kr(id);\n RandSeed.kr(Impulse.kr(FSinOsc.kr(0.2, 0, 10, 11)), seed);\n}).add;\n\n);\n\n// start two noise synths on left and right channel with a different randgen id\na = Synth(\"help-RandID\", [\\out, 0, \\id, 1]);\nb = Synth(\"help-RandID\", [\\out, 1, \\id, 2]);\n\n// reset the seed of randgen 1\nx = Synth(\"help-RandSeed\", [\\id, 1]);\n\n// change the target randgen to 2 (affects right channel)\nx.set(\\id, 2);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for attempt at emulating a breathing sound. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\n//s.options.memSize_(64000);\nTempoClock.tempo_(1.0);\n\ns.waitForBoot({\n SynthDef(\\breathe_in, {\n | out = 0, gate = 1, in1=0.11, in2=0.63, in3=0.18, amdb= -10 |\n var menv = EnvGen.kr(Env.new([0,1,1,0],[in1, in2, in3], curve:'lin'),\n gate,\n doneAction:Done.freeSelf);\n var noise = WhiteNoise.ar(amdb.dbamp);\n var f1 = BPF.ar(in:noise, freq:5790, rq:0.1, mul:-29.dbamp);\n var f2 = BPF.ar(in:noise, freq:3400, rq:0.2, mul:-16.dbamp);\n var f3 = BPF.ar(in:noise, freq:1990, rq:0.1, mul:-23.dbamp);\n var f4 = BPF.ar(in:noise, freq:1250, rq:0.1, mul:-26.dbamp);\n Out.ar(out, menv*(f1+f2+f3+f4)!2);\n }).add;\n\n SynthDef(\\breathe_out, {\n | out = 0, gate=1, out1=0.343, out2=0.387, amdb= -4.33 |\n var menv = EnvGen.kr(Env.new([0, 1, 0], [out1,out2], curve:'lin'),\n gate,\n doneAction:Done.freeSelf);\n var noise = WhiteNoise.ar(amdb.dbamp);\n var f1 = BPF.ar(in:noise, freq:2290, rq:0.1, mul:-17.dbamp);\n var f2 = BPF.ar(in:noise, freq:1290, rq:0.1, mul:-19.dbamp);\n var f3 = BPF.ar(in:noise, freq:490, rq:0.1, mul:-18.dbamp);\n Out.ar(out, menv*(f1+f2+f3)!2);\n }).add;\n\n\n s.sync;\n\n fork {\n 50.do({\n var in1 = 0.11.rrand(0.22);\n var in2 = 0.6.rrand(0.8);\n var in3 = 0.16.rrand(0.30);\n var pausein = 0.11.rrand(0.20);\n var out1 = 0.30.rrand(0.50);\n var out2 = 0.36.rrand(0.50);\n var pauseout = 0.11.rrand(0.20);\n var amdb = -10.0.rrand(-14.0);\n var amdb2 = amdb/2.5;\n //(\"in1: \" ++ in1 ++ \" in2: \" ++ in2 ++ \" in3: \" ++ in3 ++ \" pausein: \" ++ pausein ++ \" out1: \" ++ out1 ++ \" out2: \" ++ out2 + \" pauseout: \" ++ pauseout).postln;\n Synth(\\breathe_in, [\\in1, in1, \\in2, in2, \\in3, in3, \\amdb, amdb]);\n (in1+in2+in3+pausein).wait;\n Synth(\\breathe_out, [\\out1, out1, \\out2, out2, \\amdb, amdb2]);\n (out1+out2+pauseout).wait;\n });\n };\n\n});\n);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Ringz` that runs as it is."}, {"role": "assistant", "content": "```supercollider\na = NodeProxy(s);\na[0] = { |freq = 440, dt=0.1, rate=2| Ringz.ar(Impulse.ar(rate * [1, 1.2]), freq, dt)*0.1 };\na.play;\n(\na[1] = \\set -> Pbind(\n \\dur, Prand([1, 0.5], inf),\n \\freq, Pwhite(200.0, 1000, inf),\n \\rate, Pdup(4, Prand([1, 3, 6, 10], inf)),\n \\dt, Pwhite(0.01, 0.1, inf)\n)\n);\n// modify the source in the meanwhile:\na[0] = { |freq = 440, dt=0.1, rate=2| Ringz.ar(Dust.ar(rate * 10.dup), freq, dt)*0.1 };\n\na.nodeMap.postln; // the values are not set in the node map.\na.clear(3);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Just going crazy with modulation. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"additivePad\", \n { arg numOfCycles = 100;\n var lfo;\n var lfo2;\n var lfo3;\n lfo = SinOsc.kr([Rand(0.5,1000),Rand(0.5,1000)], 1.5pi, 0.5, 0.5);\n lfo3 = SinOsc.kr([Rand(0.1,0.5),Rand(0.1,0.5)], 1.5pi, 0.5, 0.5);\n lfo2 = SinOsc.kr([(Rand(0.5,1000) * lfo) * lfo3, (Rand(0.5,1000) * (1 - lfo)) * (1 - lfo3)], 1.5pi, 0.5, 0.5);\n Out.ar(\n 0, \n Mix.arFill(\n numOfCycles,\n { \n SinOsc.ar(\n Rand(40,1000),\n 0, \n (numOfCycles.reciprocal * 0.75) * lfo2)\n }\n ) * EnvGen.kr(Env.perc(Rand(0.1,30), Rand(0.1,30)), doneAction: 2)\n )\n }\n).send(s); \n);\n\n(\nr = Routine({\n 200.do({\n x = Synth.new(\"additivePad\"); \n 10.wait;\n });\n});\n);\n\nr.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DC`."}, {"role": "assistant", "content": "```supercollider\n// won't work (the output is 0.5*0.0), which is why we need the DC UGen!\n{ 0.5 }.play\n\n// constantly zero\n{ DC.ar(0.0) }.play;\n\n\n// DC offset; will click on start and finish\n{ DC.ar(0.5) + SinOsc.ar(440, 0, 0.1) }.play;\n\n\n// test - note the transient before LeakDC adapts and suppresses the offset\n{ LeakDC.ar(DC.ar(0.5)) }.play;\n\n\n// show scope\ns.scope\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n(\n#a, c = { TaskProxy.new } ! 2;\na.source = { \"one\".postln; 1.wait; \"two\".postln };\nc.source = { var z; z = Synth(\\default); 0.5.wait; z.release };\nr = Task {\n \"counting...\".postln;\n 2.wait;\n a.embedInStream;\n 1.wait;\n c.embedInStream;\n \"done.\".postln;\n};\n);\n\nr.play; // play a stream\n\nc.source = { var z; z = Synth(\\default, [\\freq, 300]); 1.5.wait; z.release }; // change the def\n\nr.reset;\nr.play;\n\n// of course Task\n// …\n```"}, {"role": "assistant", "content": "of course TaskProxies can be used in other Tdefs: if one wants to branch off a stream in a separate thread, asStream is used. (TaskProxy: event stream reference)"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LinCongC`."}, {"role": "assistant", "content": "```supercollider\n// default initial params\n{ LinCongC.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `AudacityLabels.read` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a new instance an read labels into the Arguments: labelPath — Path to the file that contains the label information."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// SynthDefs from Ex. 1a\n\n(\n// Similar to Ex. 1b, but the midinote pattern will cause the stream to generate arrays of two elements,\n// they will be distributed to the indicated synths\n\nr = { |add = 0, int = 7| Pstutter(5, Pwhite(60, 65) + [0, int] + add) };\n\n// each setting streams affects two synths: those of corresponding indices of \\synths\n\np = PpolyPar([[\n \\synths, [0, 1],\n \\dur, 1/6,\n \\midinote, r.(0, 5),\n \\amp, 0.04\n ],[\n \\synths, [0, 2],\n \\dur, 1/4,\n \\midinote, r.(10, 6),\n \\amp, 0.\n// …\n```"}, {"role": "assistant", "content": "SynthDefs from Ex. 1a Similar to Ex. 1b, but the midinote pattern will cause the stream to generate arrays of two elements, (PpolyPar: polyphonic event pattern for an arbitrary number of timed setting streams)"}]} +{"conversations": [{"role": "user", "content": "What does `Color.rand` do? What arguments does it take?"}, {"role": "assistant", "content": "A random RGB Color where the colors are randomly chosen between `lo` and `hi`. See Arguments: lo — An instance of Float between 0 and 1.; hi — An instance of Float between 0 and 1.."}]} +{"conversations": [{"role": "user", "content": "What is `SmoothFoldQ` in SuperCollider?"}, {"role": "assistant", "content": "SmoothFoldQ — wave folding pseudo ugen using parabolic segments Wave folding using SmoothClipQ. Values outside the range lo-hi are folded back, if foldRange > 0. A larger foldRange means less folding whereas a smaller foldRange causes more folding. The spectral result depends on the source wave form also but in general a smaller foldRange causes more energy in the higher spectrum whereas near foldRange == 0 the higher part of the spectrum again decreases. Note Category: Libraries > miSCellaneous > WaveFolding."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Symbol`."}, {"role": "assistant", "content": "```supercollider\na = { SinOsc.ar(\\freq.kr(440, 1.2)) }.play;\na.set(\\freq, 330);\na.release;\na = { SinOsc.ar(\\freq.kr([440, 460], 1.2)) }.play;\na.setn(\\freq, [330, 367]);\na.release;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `T2K`."}, {"role": "assistant", "content": "```supercollider\n// this does not work:\n(\n{\n var trig = Dust.ar(4);\n Trig.kr(trig, 0.1) * SinOsc.ar(800) * 0.1\n}.play;\n);\n\n// this works:\n(\n{\n var trig = T2K.kr(Dust.ar(4));\n Trig.kr(trig, 0.1) * SinOsc.ar(800) * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write an FM bell in SuperCollider."}, {"role": "assistant", "content": "PMOsc is phase modulation: a non-integer modulator ratio gives the inharmonic clang.\n\n```supercollider\n(\nSynthDef(\\fmBell, { |out = 0, freq = 440, amp = 0.2, dur = 4|\n var index = EnvGen.kr(Env([8, 0.2], [dur], -4));\n var sig = PMOsc.ar(freq, freq * 1.4, index, 0, 1);\n var env = EnvGen.kr(Env.perc(0.002, dur, 1, -5), doneAction: 2);\n Out.ar(out, Pan2.ar(sig * env * amp, 0));\n}).add;\n);\nSynth(\\fmBell, [\\freq, 550]);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// result of BufRd is used as index for the next BufRd\n// needs Buffer c prepared above\n\n(\ny = {\n GFIS.ar(\n { |x| BufRd.ar(1, c, c.numFrames * x) },\n (LFDNoise3.ar(3) * [1, 1.1]).range(0.5, 0.51), 7\n ) * 0.2\n}.play\n;\n\ny.release\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// result of BufRd is used as index for the next BufRd\n// needs Buffer c prepared above\n\n(\ny = {\n GFIS.ar(\n { |x| BufRd.ar(1, c, c.numFrames * x) },\n (LFDNoise3.ar(3) * [1, 1.1]).range(0.5, 0.51), 7\n ) * 0.2\n}.play\n);\n\ny.release\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Interpreter.codeDump` do?"}, {"role": "assistant", "content": "this interpreter variable can be set to evaluate a function with any successfully compiled code. see e.g. the class History. `a = []; // store all the code evaluated in"}]} +{"conversations": [{"role": "user", "content": "What is `AllpassN` in SuperCollider?"}, {"role": "assistant", "content": "AllpassN — Schroeder allpass delay line with no interpolation. A Schroeder allpass filter is given by the difference equations Category: UGens > Delays."}]} +{"conversations": [{"role": "user", "content": "What does `PlayerSocket.qspawnPlayer` do? What arguments does it take?"}, {"role": "assistant", "content": "you should have already prepared the Arguments: player; releaseTime."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\ns.boot;\n\n(\nb = Buffer.read(s, ExampleFiles.apollo11);\nx = { |envbuf = -1|\n var pointer, pitch;\n // pointer - move from beginning to end of soundfile over 15 seconds\n pointer = LFSaw.ar(1/15).range(0, 1);\n // control pitch with MouseX\n pitch = MouseX.kr(0.5, 2);\n Warp1.ar(\n numChannels: 1,\n bufnum: b,\n pointer: pointer,\n freqScale: pitch,\n windowSize: 0.1,\n envbufnum: envbuf,\n overlaps: 8,\n windowRandRatio: 0.1,\n interp: 2\n )\n}.play\n\n);\n\n\n(\n// a custom envelope\n// …\n```"}, {"role": "assistant", "content": "pointer - move from beginning to end of soundfile over 15 seconds control pitch with MouseX (Warp1: Warp a buffer with a time pointer)"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PeakFollower`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n// no decay\n(\n{\n SinOsc.ar(\n PeakFollower.ar(Dust.ar(20, Line.kr(0, 1, 4)), 1.0) * 1500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// a little decay\n(\n{\n SinOsc.ar(\n PeakFollower.ar(Dust.ar(20, Line.kr(0, 1, 4)), 0.999) * 1500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// mouse x controls decay, center of the\n(\n{\n var decay;\n decay = MouseX.kr(0.99, 1.00001).min(1.0);\n SinOsc.ar(\n PeakFollower.ar(Dust.ar(20), decay) * 1500 + 200,\n 0, 0.2\n );\n\n}.play;\n);\n\n\n\n\n// follow a sine lfo, decay controlled by mouse x\n(\n{\n var decay;\n decay = MouseX.kr(0, 1.1).min(1.0);\n SinOsc.ar(\n PeakFollower.kr(SinOsc.kr(0.2), decay) * 200 + 500,\n 0, 0.2\n )\n\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Ndef`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\nNdef(\\sound, { |freq = 56, numHarm = 10| Blip.ar(freq, numHarm, 30) * 0.2 }).play;\nNdef(\\sound).set(\\freq, 15);\nNdef(\\sound).set(\\freq, 15, \\numHarm, 100);\n\nNdef(\\lfo, { LFNoise2.kr(2).exprange(10, 200) });\nNdef(\\sound).map(\\numHarm, Ndef(\\lfo));\nNdef(\\sound).set(\\numHarm, nil); // unmap.\nNdef(\\sound).stop;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Buffer.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Create and return a new Buffer object, without immediately allocating the corresponding memory on the server. This combined with 'message' methods can be flexible with Arguments: server — The server on which to allocate the buffer. The default is the default Server.; numFrames — The number of frames to allocate. Actual memory use will correspond to numFrames * numChannels.; numChannels — The number of channels for the Buffer. The default is 1.; bufnum — An explicitly specified buffer number. Supplying a number bypasses the server's buffer allocator, which can lead to conflicts. The best practice is to leave this unset and let the buffer number allocator choose the next available bufnum.; sampleRate — The sample rate of the buffer. The default is the sample rate of the server.."}]} +{"conversations": [{"role": "user", "content": "What does `IRand.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Single integer random number generator. Arguments: lo — Lower limit of the output range.; hi — Upper limit of the output range.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// This can go towards granulation\n\n// load sound file\n\nb = Buffer.read(s, Platform.miSCellaneousDirs[0] +/+ \"Sounds\" +/+ \"kitchen_sounds_1.wav\");\n\n\n// switch between looping PlayBufs\n\n(\nx = {\n var sig = {\n DXMix.ar(\n Dxrand([0, 1, 2], inf),\n `(PlayBuf.ar(1, b, BufRateScale.kr(b) * [0.4, 1, 2.2], loop: 1)),\n stepTime: 0.2,\n fadeTime: 0.01,\n fadeMode: 1,\n width: 2\n ) } ! 2;\n // do a bit correlation\n Splay.ar(sig, 0.8\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// This can go towards granulation\n\n// load sound file\n\nb = Buffer.read(s, Platform.miSCellaneousDirs[0] +/+ \"Sounds\" +/+ \"kitchen_sounds_1.wav\");\n\n\n// switch between looping PlayBufs\n\n(\nx = {\n var sig = {\n DXMix.ar(\n Dxrand([0, 1, 2], inf),\n `(PlayBuf.ar(1, b, BufRateScale.kr(b) * [0.4, 1, 2.2], loop: 1)),\n stepTime: 0.2,\n fadeTime: 0.01,\n fadeMode: 1,\n width: 2\n ) } ! 2;\n // do a bit correlation\n Splay.ar(sig, 0.8)\n}.play\n);\n\nx.release\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Re: the perfect frequencies. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// Rumush\n// https://mycelialcordsblog.wordpress.com/\n// https://fungorumush.bandcamp.com/releases\n// https://soundcloud.com/fungorum\n\n(\nf = {\n var rep = [4, 8, 16, 32];\n var n = rep.choose;\n var x = [\n\n 54, 60, 66, 72, 81, 90, 96, 102,\n 108, 128, 132, 144, 162, 180, 192, 204,\n 216, 240, 264, 288, 324, 360, 384, 408,\n 432, 480, 528, 576, 648, 720, 768, 816,\n 864, 960, 1056, 1152, 1296, 1440, 1536, 1632,\n 1728, 1920, 2112, 2304, 2592, 2880, 3072, 3264,\n 3456, 3840, 4224, 4608, 5184, 5760, 6144, 6528,\n 6912, 7680, 8448, 9216, 10368, 11520, 12288, 528\n\n ];\n Mix.fill(n,\n {\n var detune = 5.rand;\n var sin = SinOsc.ar(x.choose, 4.rand, 0.25);\n var saw = RLPF.ar(Saw.ar(x.choose*0.01+detune, 0.75), x.choose, 2.rand).tanh;\n Pan2.ar((sin+saw) * EnvGen.kr(Env.sine(12, 1/n), 1, doneAction:2),\n 1.rand2) }\n );\n};\n);\n\n(\n// DEFINE A ROUTINE\nr = Routine({\n\n inf.do({\n f.play;\n 10.wait;\n })\n});\n);\n\nr.reset.play;\n```"}]} {"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ OneZero.ar(WhiteNoise.ar(0.5), 0.5) }.play\n\n{ OneZero.ar(WhiteNoise.ar(0.5), -0.5) }.play\n\n{ OneZero.ar(WhiteNoise.ar(0.5), Line.kr(-0.5, 0.5, 10) }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ OneZero.ar(WhiteNoise.ar(0.5), 0.5) }.play\n\n{ OneZero.ar(WhiteNoise.ar(0.5), -0.5) }.play\n\n{ OneZero.ar(WhiteNoise.ar(0.5), Line.kr(-0.5, 0.5, 10)) }.play\n```"}]} -{"conversations": [{"role": "user", "content": "How to generate paradiddles?"}, {"role": "assistant", "content": "SuperCollider forum — How to generate paradiddles?\n\nHi Rodet, I’m teaching jazz at college, and sometimes paradiddles come up in conversation (although I’m not a drummer). A paradiddle is basically a way of ‘evenly’ playing a roll (single/double/triple/whatever). If you take your drumsticks/fingers and play evenly:\n\nright, left, right, right, left, right, left, left, right, left, right, right, etc\n\nyou’ll notice that it’s possible to get an even rhythm, which when played fast becomes a roll. The idea of the single/double/triple is just to place the accents (lightly, or not) on the left, right hand, which if I understand helps keep an even stroke (and makes better sense to follow).\n\nSo, although I don’t know the goal of your idea, a simple code which would give you the solution could be a pattern. You’ll notice I’ve put in a SynthDef to give the ‘snare’ sound - not very real, but just for the demonstration. If you run these patterns, un-commenting the line needed (single, double or triple - don’t forget to comment out the lines you don’t need), you’ll hear the accents a paradiddle gives.\n\nIn this example Pbind ‘a’ gives the pulse, and Pbind ‘b’ the accents. And, if you play along with them (using your chart), you’ll notice the accents pass from right hand to left hand (or vice versa). This is (more or less) what paradiddles do, although a drummer will explain better how they ‘accent’ strokes to get more complicated/subtle rhythms.\n\n```supercollider\n(\nSynthDef(\\snare, {\n arg out=0, sus=0.1;\n var sig, env;\n sig = WhiteNoise.ar(0.1);\n env = EnvGen.kr(Env.perc(0.001, sus), doneAction:2);\n sig = sig*env;\n Out.ar(out, sig!2);\n}).add;\n);\n\n(\nt=TempoClock(80/60);\na=Pbind(\n \\instrument, \\snare,\n \\dur, 1/2,\n \\sus, 0.01\n);\nb=Pbind(\n \\instrument, \\snare,\n \\dur, 1,\n \\sus, Pseq([0.02, 0.01],inf), // single\n //\\sus, Pseq([0.02, 0.01, 0.01],inf), // double\n //\\sus, Pseq([0.02, 0.01, 0.01, 0.01],inf), // triple\n);\nPpar([a, b]).play(t);\n)\n```\n\nI hope that puts you on the right track.\n\np.s. Don’t forget to try out changing the speed to get the real effect. Try something like 320/60 on the TempoClock."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Re: Timpani (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\ns.boot\n\n(\nSynthDef(\\aSynth, { |rel = 0, choose = 0, amp = 0|\n var klank, env;\n\n klank = Klank.ar(`[choose ! 12, {Rand(0.128, 0.7)} ! 12], BrownNoise.ar(0.7));\n env = EnvGen.kr(Env.perc(0.01, rel), doneAction: 2);\n Out.ar(0, klank * env.dup * amp);\n}).add;\n);\n\n(\n{\n 42.do{\n x = [70, 90, 120].choose;\n y = rrand(0.01, 5);\n // attack\n Synth(\\aSynth, [\\rel, y, \\choose, x, \\amp, 128e-6]);\n // resonance\n Synth(\\aSynth, [\\rel, 1, \\choose, x, \\amp, 128e-5]);\n y.wait;\n }\n}.fork;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `EZSlider.set` do?"}, {"role": "assistant", "content": "Set the args after creation. You can only set the label if it was not nil from the"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nb = BusPlug.new;\nx = Pbind(\\z, b).asStream;\nx.next(()); // returns the map argument for the bus\nb.defineBus(\\audio, 3);\nx.next((); // returns map arguments for the audio rate bus\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nb = BusPlug.new;\nx = Pbind(\\z, b).asStream;\nx.next(()); // returns the map argument for the bus\nb.defineBus(\\audio, 3);\nx.next(()); // returns map arguments for the audio rate bus\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(SynthDef(\\x, {|midi = 60, amp = 0.8| Out.ar(0, Pan2.ar(SinOsc.ar(midi.midicps, mul: EnvGen.kr(Env.perc(0, 0.5), timeScale: 0.5, levelScale: 0.3)), Rand(-1, 1)) * EnvGen.kr(Env.perc(0, 0.5), timeScale: 1.3*0.5, levelScale: Rand(0.3, 0.5), doneAction:2));}).add;)\n\n(~phase = Pbind(*[ instrument: \\x, dur: 0.5, midi: Pseq([0, 4, 7] + 60, inf)]);\n5.do({|val| ~phase.play(TempoClock.new((110 + (0.5 * val)) / 60))}); )\n```"}, {"role": "assistant", "content": "Experimenting with some Reich style phasings\r\n\r\nAudio: http://soundcloud.com/schemawound/goodnightworld."}]} -{"conversations": [{"role": "user", "content": "What does `Platform.case` do?"}, {"role": "assistant", "content": "Perform actions depending on the current platform (name), just like Object:switch:"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for how to generate the synthdef with a pattern?"}, {"role": "assistant", "content": "```supercollider\n(\nPdef(\\zed, \n Pbind(\n \\osc, Pseq([SinOsc, LFSaw],inf),\n \\instrument, Prout({ arg ev;\n SynthDef(\\zed, { arg out=0, gate=1, amp=0.1, pan=0, freq=200;\n var sig;\n sig = ev[\\osc].ar(freq);\n sig = sig * EnvGen.kr(\\adsr.kr(Env.adsr(0.1,0.1,0.8,0.1)), gate, doneAction:2);\n sig = Pan2.ar(sig, pan, amp);\n Out.ar(out, sig);\n }).add.yield;\n }).loop,\n \\degree, Pseq([0],inf),\n \\dur, 1,\n \\amp, 0.1,\n )\n).play;\n);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes sine ocean."}, {"role": "assistant", "content": "```supercollider\n(\n//fundamental pitch triad\n~notes = [45,55,60].midicps;\n\ns.waitForBoot({\n Routine{\n\n SynthDef.new(\\tone, {\n arg freq=440, pan=0, rel=0.05;\n var sig;\n sig = SinOsc.ar(freq);\n sig = sig * EnvGen.kr(Env.perc(0.005,rel), doneAction:2);\n sig = Pan2.ar(sig, pan, 0.05);\n Out.ar(0, sig);\n }).add;\n\n s.sync;\n\n 50.do{\n Pbind(\n \\instrument, \\tone,\n\n //trace some event times just for fun\n \\dur, Pseq(Array.geom(50, rrand(1.5,1.51), rrand(0.923,0.929)).mirror,inf).trace,\n\n \\freq, exprand(~notes[0],8000).round(~notes[0]),\n \\pan, rrand(-1.0,1.0),\n \\rel, exprand(0.005,0.35),\n ).play;\n\n Pbind(\n \\instrument, \\tone,\n \\dur, Pseq(Array.geom(50, rrand(1.5,1.51), rrand(0.923,0.929)).mirror,inf),\n \\freq, exprand(~notes[1],11000).round(~notes[1]),\n \\pan, rrand(-1.0,1.0),\n \\rel, exprand(0.005,0.35),\n ).play;\n\n Pbind(\n \\instrument, \\tone,\n \\dur, Pseq(\n Array.geom(50, rrand(1.5,1.51), rrand(0.923,0.929)).mirror,inf\n ),\n \\freq, exprand(~notes[2],15000).round(~notes[2]),\n \\pan, rrand(-1.0,1.0),\n \\rel, exprand(0.005,0.35),\n ).play;\n };\n }.play(AppClock);\n});\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// you have to write the sample path in the firts line\n\n~bufferdue = Buffer.read(s,\" WRITE YOUR SAMPLE PATH HERE \", bufnum:2);\n\n(\nSynthDef.new(\\bufbeat, {\n arg amp = 1, out = 0, buf, start, end, freq = 1;\n var sig, ptr;\n ptr = LFNoise1.ar(freq).range(0.0,end);\n sig = BufRd.ar(2, buf, ptr);\n sig = sig * amp;\n Out.ar(out, sig);\n}).add\n);\n\nx = Synth.new(\\bufbeat, [\\buf, ~bufferdue.bufnum, \\start,0, \\end, ~bufferdue.numFrames-1, \\freq, 1, \\amp, 0.5],g);\n\nx.free;\n```"}, {"role": "assistant", "content": "a simple BufRd with the starting point of lecture randomized by LFNoise1."}]} -{"conversations": [{"role": "user", "content": "What does `FlowLayout.left` do? What arguments does it take?"}, {"role": "assistant", "content": "Get the current left indentation or manually set Arguments: arg1 — A number.."}]} -{"conversations": [{"role": "user", "content": "What does `UScoreEditor.<|` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: events — (describe argument here). Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "What does `EZLists.initViews` do?"}, {"role": "assistant", "content": "Called by init and overridden by all subclasses. This is where the class specific views are"}]} -{"conversations": [{"role": "user", "content": "What is `LTI` in SuperCollider?"}, {"role": "assistant", "content": "LTI — Linear Time Invariant General Filter Equation General Linear Time-Invariant (LTI) filter UGen where you specify any coefficient set via a Buffer Represents the general LTI filter difference equation in the time domain: Category: UGens > Filters."}]} -{"conversations": [{"role": "user", "content": "What is `Delay1` in SuperCollider?"}, {"role": "assistant", "content": "Delay1 — Single sample delay. Delays the input by one audio frame or control period. Category: UGens > Delays."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n// trig with MouseY crossing center of screen\n{\n var in, chain;\n in = Mix.ar(SinOsc.ar(200 * (1..10), 0, Array.fill(10, { rrand(0.1, 0.2) })));\n chain = FFT(LocalBuf(2048), in);\n chain = PV_Diffuser(chain, MouseY.kr > 0.5);\n 0.5 * IFFT(chain).dup;\n}.play\n);\n\n(\nb = Buffer.read(s, ExampleFiles.child);\n\n// trig with MouseY crossing center of screen\n{\n var in, chain;\n in = PlayBuf.ar(1, b, BufRateScale.kr(b), loop: 1);\n chain = FFT(Local\n// …\n```"}, {"role": "assistant", "content": "trig with MouseY crossing center of screen trig with MouseY crossing center of screen (PV_Diffuser: Random phase shifting.)"}]} +{"conversations": [{"role": "user", "content": "What does `Array.dupEach` do? What arguments does it take?"}, {"role": "assistant", "content": "Return a new Array whose elements are repeated n times. The receiver is unchanged. `[1, 2, Arguments: n — Number of repeats.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = Env.adsr;\na.levels;\na.range(42, 45).levels;\na.exprange(42, 45).levels;\na.curverange(42, 45, -4).levels;\n\n(\n// Mapping an Env to an exponential frequency range:\n{\n SinOsc.ar(EnvGen.ar(Env.perc(0.01, 0.7).exprange(40, 10000), doneAction: Done.freeSelf)) * 0.2;\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = Env.adsr;\na.levels;\na.range(42, 45).levels;\na.exprange(42, 45).levels;\na.curverange(42, 45, -4).levels;\n\n(\n// Mapping an Env to an exponential frequency range:\n{\n SinOsc.ar(EnvGen.ar(Env.perc(0.01, 0.7).exprange(40, 10000), doneAction: Done.freeSelf)) * 0.2;\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Scale`?"}, {"role": "assistant", "content": "Scale — represents a musical scale"}, {"role": "user", "content": "What does `Scale.all` do?"}, {"role": "assistant", "content": "The scale repository, to which new scales can be added. `Scale.all.put(\\catastrophic, Scale([0, 0.01, 0.04, 11.2]));`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\na = Scale.major;\na.degrees; // [0, 2, 4, 5, 7, 9, 11]\na.semitones; // [0, 2, 4, 5, 7, 9, 11]\na.cents; // [0, 200, 300, 500, 700, 900, 1100]\na.ratios; // [1, 1.1224620483089, 1.2599210498937, 1.3348398541685, etc.]\n\nPbind(\\scale, a, \\degree, Pseq((0..7) ++ (6..0) ++ [\\rest], 1), \\dur, 0.25).play;\n\n// use non-standard tuning\na.tuning_(\\just);\na.degrees; // no change; degrees are independent of tuning\na.semitones; // [0, 2.0391000173077, 3.1564128700055, 4.9804499913461, etc.]\na.ratios.collect(_.round(0.001)); // [1, 1.125, 1.2, 1.333, 1.5, 1.667, 1.875]\n\nPbind(\\scale, a, \\degree, Pseq((0..7) ++ (6..0) ++ [\\rest], 1), \\dur, 0.25).play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Archive`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// make a storage place for various objects:\nq = (); // Event\n\nq[\\a_long_array] = Array.rand(128, 0.0, 1.0);\nq[\\pi_squared] = pi * pi;\nq[\\favourite_sound] = { { SinOsc.ar([300, 330]).sum * LFPulse.kr(2 + [0, 0.01]) * 0.1 }.play };\nq[\\same_long_array] = q[\\a_long_array]; // same objects may appear several times\n\nArchive.global.put(\\myData, q);\n\n\nArchive.global.at(\\myData).postcs;\n\n// after a recompile:\ns.boot;\n\nq = Archive.global.at(\\myData);\nq.postcs;\nq[\\favourite_sound].value;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `UScore.openWFS` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: path — (describe argument here); action — (describe argument here). Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "What is `GrainBuf` in SuperCollider?"}, {"role": "assistant", "content": "GrainBuf — Granular synthesis with sound stored in a buffer Category: UGens > Buffer, UGens > Generators > Granular."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `MIDIFreqPlayer`."}, {"role": "assistant", "content": "```supercollider\n/*\n( // PlayerBinop not yet implemented\n\nPatch(\\monosynth,[\n BeatClockPlayer.new(16) * MIDIGatePlayer.new,\n MIDIFreqPlayer.new,\n CCPlayer(50,[100,3000,\\exp,0.0,1500.0]),\n CCPlayer(51,[0.1,0.9,\\exp,0.0,0.2]),\n CCPlayer(52,[0.05,1.0])\n]).play\n\n)\n*/\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = { |x, root = 60| x + root }; b = a.midicps; [a.value(9), b.value(9)];\na = Pseries(60, 1, inf).midicps; a.asStream.nextN(12);\n{ a = LFNoise1.ar(1) * 5 + 60; Pulse.ar(a.round.midicps * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = { |x, root = 60| x + root }; b = a.midicps; [a.value(9), b.value(9)];\na = Pseries(60, 1, inf).midicps; a.asStream.nextN(12);\n{ a = LFNoise1.ar(1) * 5 + 60; Pulse.ar(a.round.midicps) * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nx = SynthDef(\\test, {\n Out.ar(0, \n Formants.ar(420, Vowel(\\a).addControls(3)) * 0.01\n )\n}).play\n);\n\nx.inspect\n\nx.setn(*Vowel(\\i).asKeyValuePairs(3);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nx = SynthDef(\\test, {\n Out.ar(0, \n Formants.ar(420, Vowel(\\a).addControls(3)) * 0.01\n )\n}).play\n);\n\nx.inspect\n\nx.setn(*Vowel(\\i).asKeyValuePairs(3));\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nx = {\n |loDev = -6, hiDev = 5, lookBack = 2|\n var trig = Impulse.ar(5);\n // define maxLookBack, minLoDev and maxHiDev\n var midi = Demand.ar(trig, 0, DIdev(72, 11, -6, 5, lookBack, loDev, hiDev));\n midi.poll(5, label: \\midi);\n SinOsc.ar(midi.midicps.lag(0.007)) ! 2 * 0.1\n}.play;\n);\n\n\n// as lookBack equals 2, this defines a fixed sequence (up or down anyway)\n\n(\nx.set(\\loDev, -1);\nx.set(\\hiDev, 1)\n);\n\n\n// widen range\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nx = {\n |loDev = -6, hiDev = 5, lookBack = 2|\n var trig = Impulse.ar(5);\n // define maxLookBack, minLoDev and maxHiDev\n var midi = Demand.ar(trig, 0, DIdev(72, 11, -6, 5, lookBack, loDev, hiDev));\n midi.poll(5, label: \\midi);\n SinOsc.ar(midi.midicps.lag(0.007)) ! 2 * 0.1\n}.play;\n);\n\n\n// as lookBack equals 2, this defines a fixed sequence (up or down anyway)\n\n(\nx.set(\\loDev, -1);\nx.set(\\hiDev, 1)\n);\n\n\n// widen range\n\n(\nx.set(\\loDev, -6);\nx.set(\\hiDev, 5);\n);\n\n\n// force a twelve-tone row\n\nx.set(\\lookBack, 11)\n\n\n// contradictory input, lookBack 11 not possible within range, causes repetitions\n\n(\nx.set(\\loDev, -3);\nx.set(\\hiDev, 2)\n);\n\nx.release\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Psubdivide` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\na = Psubdivide(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,0,1,3,4,0], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n100.do({ x.next.postln });\n);\n\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Psubdivide(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n);\n\n\n(\na = Psubdivide(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,4,4,0,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Collection`?"}, {"role": "assistant", "content": "Collection — Abstract superclass of all collections"}, {"role": "user", "content": "What does `Collection.newFrom` do?"}, {"role": "assistant", "content": "Creates a new Collection from another collection. This supports the interface for the method \"as\". `Array.newFrom(Set[4, 2, 1]);`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n~closet = [\\hat, \\hat, \\hat, \\coat, \\coat, \\shoe, \\shoe];\n~closet.removeAll([\\hat, \\coat, \\shoe, \\shoe]); // Doesn't empty the closet, just removes what we wanted to\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// python preprocessor, given that you have python installed\n// thanks to tasos tsesmetzis\n\n(\nthis.preProcessor = PreProcessor.new.startDelimiter_(\"{-\").endDelimiter_(\"-}\");\n\n// a simple python call\ne = (\n lang: \\python,\n languages:\n (\n python: // code is the incoming string, event is the event for parameters and output\n {|code, event|\n var input, pipe, output;\n code = e[\\prefix] ++ \"print\" ++ \"(\" ++ code ++ \")\";\n input = \"python -c '%'\".format(code);\n pipe = Pipe(input, \"r\");\n output = pipe.readUpTo;\n pipe.close;\n event.put(\\result, output)\n }\n ),\n prefix: \"import math;\"\n);\n);\n\n// ok, assuming such a little interpreter exists for a given language,\n// one can now use it in code.\n\n(\ne =\n{-\n math.factorial(61)\n-}.value(e);\ne.result;\n);\n\ne.calc_result = e.result.as(Array).collect { |x| x.asString.interpret };\n\nPbind(\\note, Pseq(e.calc_result), \\dur, 0.1).play;\n```"}, {"role": "assistant", "content": "python preprocessor, given that you have python installed thanks to tasos tsesmetzis."}]} +{"conversations": [{"role": "user", "content": "What does `SynthDesc.controlDict` do?"}, {"role": "assistant", "content": "An IdentityDictionary of the ControlName's, indexed by name. This can be used for fast lookup of control index by name, for example to set a specific element of a multichannel"}]} +{"conversations": [{"role": "user", "content": "What does `CampCutProc.chooseblock` do?"}, {"role": "assistant", "content": "this uses the setoffset method of BBCutSynth to specify offset jumps relative to the current phrase size. In normal use phrasesize will be the same as the beat length of the source you wish to permute. Note that sources which don't respond to setoffset will not be effected by CampCutProc except for any enveloping/panning etc caused by"}]} +{"conversations": [{"role": "user", "content": "Why does every UGen have mul and add arguments?"}, {"role": "assistant", "content": "They are a convenience applied to the UGen's output: the result is `ugens_result * mul + add`. So `SinOsc.ar(440, 0, 0.2)` is the same as `SinOsc.ar(440) * 0.2`, and `SinOsc.ar(440, 0, 0.5, 1800)` is usable directly as a frequency. They exist because multiplying and offsetting is so common that folding it into the UGen saves a node in the graph and a line in the source."}]} +{"conversations": [{"role": "user", "content": "Can I run SuperCollider without the IDE?"}, {"role": "assistant", "content": "Yes. `sclang` runs the language and `scsynth` the server, and they are separate processes by design\n— the IDE is only a client. A headless script is a `.scd` run with `sclang my-piece.scd`, and it must boot\nthe server itself:\n\n```supercollider\ns.boot;\ns.waitForBoot {\n // build SynthDefs, play, then wait\n 30.wait;\n s.quit;\n};\n```\n\nThat shape — boot, wait, play, quit, exit — is what makes a piece runnable from a cron job or a\nRaspberry Pi."}]} +{"conversations": [{"role": "user", "content": "I get 'syntax error, unexpected NAME' on a block that looks fine."}, {"role": "assistant", "content": "Almost always a missing semicolon between two statements — SuperCollider does not insert them.\n\n```supercollider\n// broken: two statements, no separator\n{ var sig = SinOsc.ar(440) sig = sig * 0.1; sig }.play\n```\n\n```supercollider\n// fixed\n{ var sig = SinOsc.ar(440); sig = sig * 0.1; sig }.play\n```\nThe error points at the second statement, not at the missing semicolon before it, which is why it looks\nfine. If it is not a semicolon, count the brackets: `.ar(` open, `)` closed."}]} +{"conversations": [{"role": "user", "content": "What does `SynthDesc.canFreeSynth` do?"}, {"role": "assistant", "content": "is true if the Synth can free itself (via some means, usually a"}]} +{"conversations": [{"role": "user", "content": "What does `Pseed.new` do? What arguments does it take?"}, {"role": "assistant", "content": "set the random seed in subpattern Arguments: randSeed — integer number, pattern or stream that returns an integer number.; pattern."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\nSynthDef(\\a, { Out.ar(0, SinOsc.ar(800, 0, 0.2)) }).add;\n\nSynthDef(\\b, { |gate = 1| Out.ar(1, PinkNoise.ar(0.3)); Pause.kr(gate, 1001) }).add;\n\ns.sendMsg(\\s_new, \\a, 1001, 0, 0);\n\ns.sendMsg(\\s_new, \\b, 1002, 0, 0);\n\ns.sendMsg(\\n_set, 1002, \\gate, 0);\n\ns.sendMsg(\\n_set, 1002, \\gate, 1;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\nSynthDef(\\a, { Out.ar(0, SinOsc.ar(800, 0, 0.2)) }).add;\n\nSynthDef(\\b, { |gate = 1| Out.ar(1, PinkNoise.ar(0.3)); Pause.kr(gate, 1001) }).add;\n\ns.sendMsg(\\s_new, \\a, 1001, 0, 0);\n\ns.sendMsg(\\s_new, \\b, 1002, 0, 0);\n\ns.sendMsg(\\n_set, 1002, \\gate, 0);\n\ns.sendMsg(\\n_set, 1002, \\gate, 1);\n```"}]} +{"conversations": [{"role": "user", "content": "Synth Iteration Help?"}, {"role": "assistant", "content": "SuperCollider forum — Synth Iteration Help\n\n```supercollider\n(\nSynthDef (\\sine_tone) {\narg freq = 440, amp = 1, len = 1, bus = 0;\nvar sig, env;\nenv = Env.step ([ amp ], [ len ]);\nenv = EnvGen.kr (env, doneAction: 2);\nsig = SinOsc.ar (freq, 0, env);\nOut.ar (bus % 2, sig); // bus modulo 2 here to wrap to stereo\n}.add;\n)\n```\n\nmaybe try wrapping the bus array to [ 0, 1 ] by using modulo: bus % 2. this should let you hear what is going on using a stereo output\n\nby using a Pbind, each “note” is being instantiated as a separate synth with its own length, amplitude, frequency and bus. the doneAction: 2 argument in the EnvGen.kr ugen just means each synth will free itself once it is done playing the note it has been assigned."}]} {"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// randomly modulate params\n(\n{ FBSineC.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(1, 32, 33),\n LFNoise2.kr(1, 0.5),\n LFNoise2.kr(1, 0.05, 1.05),\n LFNoise2.kr(1, 0.3, 0.3)\n) * 0.2 }.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// randomly modulate params\n(\n{ FBSineC.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(1, 32, 33),\n LFNoise2.kr(1, 0.5),\n LFNoise2.kr(1, 0.05, 1.05),\n LFNoise2.kr(1, 0.3, 0.3)\n) * 0.2 }.play(s);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nNdef(\\lfo2, { LFNoise1.kr(LFNoise1.kr(0.1).exprange(1, 300) ! 2, 400, 800) });\nNdef(\\sound, { Blip.ar(Ndef.kr(\\lfo2), 30) * 0.2 }).play;\n\nNdef(\\lfo2, { [MouseX.kr(10, 300, 1), MouseY.kr(10, 300, 1)] };\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nNdef(\\lfo2, { LFNoise1.kr(LFNoise1.kr(0.1).exprange(1, 300) ! 2, 400, 800) });\nNdef(\\sound, { Blip.ar(Ndef.kr(\\lfo2), 30) * 0.2 }).play;\n\nNdef(\\lfo2, { [MouseX.kr(10, 300, 1), MouseY.kr(10, 300, 1)] });\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for 2 channels of chuckling sawtooths."}, {"role": "assistant", "content": "```supercollider\n//hall of mirrors\n{[AllpassC.ar(HPF.ar(RLPF.ar(Saw.ar(LFPar.kr(0.25).range(220,440)),LFPar.kr(MouseX.kr(0,8),pi).range(220,20000),0.3),LFPar.kr(MouseY.kr(0,8)).range(220,20000)),2,MouseX.kr(0,0.5),2),AllpassC.ar(HPF.ar(RLPF.ar(Saw.ar(LFPar.kr(0.25,pi).range(440,220)),LFPar.kr(MouseX.kr(8,0),pi).range(20000,220),0.3),LFPar.kr(MouseY.kr(8,0),pi).range(20000,220)),2,MouseX.kr(0.5,0),2)]}.play\n```"}]} -{"conversations": [{"role": "user", "content": "What does `ScalarSpec.rate` do?"}, {"role": "assistant", "content": "datatype specifiying a \\scalar \"rate\" input or output"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes DelayPannerSawSine (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n//delaypannersawsine\n{XFade2.ar(AllpassC.ar(HPF.ar(RLPF.ar(Saw.ar(LFPar.kr(0.25).range(220,440)),LFPar.kr(MouseX.kr(0,8),pi).range(220,20000),0.3),LFPar.kr(MouseY.kr(0,8)).range(220,20000)),2,MouseX.kr(0,2),2),AllpassC.ar(HPF.ar(RLPF.ar(WhiteNoise.ar * Saw.ar(LFPar.kr(0.25).range(220,440)),LFPar.kr(MouseX.kr(0,8),pi).range(220,20000),0.3),LFPar.kr(MouseY.kr(0,8)).range(220,20000)),2,MouseY.kr(0,2),2),MouseX.kr(-1,1))}.play\n```"}]} -{"conversations": [{"role": "user", "content": "How do I pan notes around the stereo field in a pattern?"}, {"role": "assistant", "content": "Put `\\pan` in the Pbind: the default instrument understands it and passes it to Pan2.\n\n```supercollider\n(\nPbind(\n \\scale, Scale.minorPentatonic,\n \\degree, Pseq([0, 2, 4, 7, 9, 7, 4, 2], inf),\n \\dur, 0.2,\n \\pan, Pseq([-1, -0.5, 0, 0.5, 1, 0.5, 0, -0.5], inf),\n \\amp, 0.15\n).play;\n)\n```\n\nTo pan an arbitrary synth, add a `pan = 0` argument to the SynthDef and wrap the output in\n`Pan2.ar(sig, pan)`."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for mixolydian flat six meditation in pythagorean?"}, {"role": "assistant", "content": "```supercollider\n// last updated on sccode.org fri 7. jun, 14:57 CET\n\n( // load this first - synth def\nSynthDef(\\harpsi, { \n arg outbus = 0, freq = 440, ffreq = 2, amp = 1, gate = 1, release = 1;\n var out;\n freq = freq * Rand(1, 1.005);\n out = EnvGen.ar(Env.adsr(releaseTime:release), gate, doneAction: Done.freeSelf)\n * amp * Pulse.ar([freq,freq*1.005]/1, 0.25, mul:0.75 );\n out = out * [Rand(0.0, 1.0), Rand(0.0, 1.0)];\n out = RLPF.ar(out, freq * (ffreq / 4) + 1 );\n Out.ar(outbus, out); \n}).add; \n);\n\n\n( // then run this - sequence\nTempoClock.default.tempo = 1.4;\n~scale = Scale.new(#[0,2,4,5,7,8,10],tuning: \\pythagorean, name: \"mixolydianb6\");\np = Pbind(\n \\instrument, \\harpsi,\n \\root, -12,\n \\scale, ~scale,\n \\ffreq, Pseq(((1..2) ++ (3..1)),inf),\n \\degree, Pseq([\n Pseries({ rrand(0, 7) }, { ([1,2]).choose }, { rrand(4, 8) }),\n Pseries({ rrand(0, 7) }, {([1,2]).choose}, { rrand(4, 8) }),\n Pseries({ rrand(7, 14) }, 0-{([1,2]).choose}, { rrand(4, 8) })\n ], inf),\n \\release, Prand([5,6,7,8],inf),\n \\dur, Prand((1..8)/4, inf),\n \\amp, Prand(((1..8)/8)+1, inf)\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `PV_CommonMag` in SuperCollider briefly."}, {"role": "assistant", "content": "PV_CommonMag — returns common magnitudes Returns magnitudes common to bufferA & bufferB within a tolerance level. Category: UGens > FFT."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SOS`."}, {"role": "assistant", "content": "```supercollider\n// example: same as TwoPole\n(\n{\n var rho, theta, b1, b2;\n theta = MouseX.kr(0.2pi, pi);\n rho = MouseY.kr(0.6, 0.99);\n b1 = 2.0 * rho * cos(theta);\n b2 = rho.squared.neg;\n SOS.ar(LFSaw.ar(200, 0, 0.1), 1.0, 0.0, 0.0, b1, b2)\n}.play\n);\n\n\n(\n{\n var rho, theta, b1, b2;\n theta = MouseX.kr(0.2pi, pi);\n rho = MouseY.kr(0.6, 0.99);\n b1 = 2.0 * rho * cos(theta);\n b2 = rho.squared.neg;\n SOS.ar(WhiteNoise.ar(0.1 ! 2), 1.0, 0.0, 0.0, b1, b2)\n}.play\n);\n\n// example with SOS.kr kr as modulator\n(\n{\n var rho, theta, b1, b2, vib;\n theta = MouseX.kr(0.2pi, pi);\n rho = MouseY.kr(0.6, 0.99);\n b1 = 2.0 * rho * cos(theta);\n b2 = rho.squared.neg;\n\n vib = SOS.kr(LFSaw.kr(3.16), 1.0, 0.0, 0.0, b1, b2);\n SinOsc.ar(vib * 200 + 600) * 0.2\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `AudioPatchOut` in SuperCollider briefly."}, {"role": "assistant", "content": "AudioPatchOut — manages state and resources for a Player's output when connecting to other Players Category: Libraries > crucial > internals."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Function`."}, {"role": "assistant", "content": "```supercollider\n(\ne = Environment.make({ ~a = 3; ~b = 10 });\n{ |a, b| (a * b) }.valueWithEnvir(e);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\na = {\n // rectangular pulse exciter (deterministic input)\n var exc = EnvGen.ar(Env([1, 1, 0], [0.01, 0], \\lin)),\n sig = Ringz.ar(exc, 440, decaytime: 0.2),\n rms = sqrt(Integrator.ar(sig.squared) * (0.2 / SampleRate.ir)),\n end = DetectSilence.ar(sig, doneAction: 2);\n rms.poll(end);\n Silent.ar(1)\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\na = {\n // rectangular pulse exciter (deterministic input)\n var exc = EnvGen.ar(Env([1, 1, 0], [0.01, 0], \\lin)),\n sig = Ringz.ar(exc, 440, decaytime: 0.2),\n rms = sqrt(Integrator.ar(sig.squared) * (0.2 / SampleRate.ir)),\n end = DetectSilence.ar(sig, doneAction: 2);\n rms.poll(end);\n Silent.ar(1)\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `PatternConductor`?"}, {"role": "assistant", "content": "PatternConductor — Simple interactive control for playing patterns"}, {"role": "user", "content": "What does `PatternConductor.tempo` do?"}, {"role": "assistant", "content": "Sets the tempo of the PatternConductor"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\n// a pattern with long notes\np = Pbind(\n \\freq, Pwhite(0, log(32)).exp.round(1) * 36.midicps,\n \\detune, Pfunc({ |ev| ev[\\freq] * rand(0.01) }),\n \\sustain, Pwhite(log(0.1), log(20)).exp,\n \\dur, Prand([0.1, 0.1, 0.1, 0.1, 0.2, 1, 2], inf),\n \\db, Pstep(Pseq([-20, -30, -25, -30], inf), 0.2)\n);\n\n// unrelated cluster pattern running on TempoClock.default\nPbind(\\dur, 2, \\midinote, Pseq([(48..60)], 20), \\db, -30).play;\n\n// make a conductor\na = PatternConductor(p, quant: 2);\na.play;\n);\n\n\n// now try some interactive control options line by line:\na.quant = 0;\na.pause;\na.resume;\na.stop;\na.play;\na.pause;\na.play;\na.stop(1000);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `PlayerAmp.asSynthDef` do?"}, {"role": "assistant", "content": "adds a simple amplitude control to a Player"}]} -{"conversations": [{"role": "user", "content": "What is `BufRateScale` in SuperCollider?"}, {"role": "assistant", "content": "BufRateScale — Buffer rate scaling in respect to server samplerate. Returns a ratio by which the playback of a soundfile is to be scaled. Category: UGens > Buffer > Info."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for piece i'm working on for a dance performance."}, {"role": "assistant", "content": "```supercollider\n( // 'random' sequences of rhythms, reverb,...\nz = {\n var trig, seq;\n trig = Impulse.kr(6);\n seq = Drand([\n Dseq([4,0,0,1,Drand([1,4]),1,0,1]),\n Dseq([1,0,2,0,Drand([0,1,4]),0,1,1]),\n Dseq([4,0,0,2,Drand([1,2,4]),0,1,1]),\n Dseq([4,0,1,2,Drand([0,1,4]),1,2,0]),\n Dseq([1,1,4,1,Drand([1,4]),2,3,3]),\n Dseq([4,1,0,1,Drand([0,4]),1,0,1])\n ], inf);\n\n g = HenonN.ar(\n [120,120],\n LFNoise2.kr(1, 0.2, 1.2),\n LFNoise2.kr(1, 0.15, 0.15)\n )\n * 0.2\n + SinOsc.ar([61,40], mul:0.7)\n\n // add lovely chaos noise (taken from documentation example)\n + {\n LatoocarfianC.ar(\n SampleRate.ir/4,\n LFNoise2.kr(2,1.5,1.5),\n LFNoise2.kr(2,1.5,1.5),\n LFNoise2.kr(2,0.5,1.5),\n LFNoise2.kr(2,0.5,1.5)\n ) * 0.1 // volume\n }\n +\n { FBSineN.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(1, 32, 33),\n LFNoise2.kr(1, 0.5),\n LFNoise2.kr(1, 0.05, 1.05),\n LFNoise2.kr(1, 0.3, 0.3)\n ) * 0.2 * SinOsc.kr(0.01) }\n ;\n\n trig = Demand.kr(trig, 0, seq * 0.2) * trig;\n { MoogFF.ar(\n g,\n SinOsc.kr(0.1,0,1,1) * 1000 + 3000)}.dup\n * Decay.kr(trig, Demand.kr(trig,0,Drand([1,2,4,6], inf)*0.1)) // envelope\n ;\n};\n\n{\n GVerb.ar(\n in: EnvGen.kr(Env.linen(20, 240, 40, 0.6, \\sine)) * z * 0.9,\n roomsize: 30,\n revtime: 4, // SinOsc.kr(0.1,0,4,4.1),\n damping:0.4, // SinOsc.kr(0.12,0,0.4,0.5),\n inputbw:1,\n spread:15,\n drylevel:SinOsc.kr(0.02,0,0.5,0.5),\n earlyreflevel:SinOsc.kr(0.01,0,0.5,0.5),\n taillevel:SinOsc.kr(0.02,pi,0.05,0.05)\n );\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `AbstractPlayer.group` do? What arguments does it take?"}, {"role": "assistant", "content": "the base class for all Players : a playable object Arguments: g."}]} -{"conversations": [{"role": "user", "content": "How big are you?"}, {"role": "assistant", "content": "198M parameters in total, 64M active per token because the feed-forward layers are a mixture of four experts with top-1 routing. That is small enough to train in minutes on one GPU."}]} -{"conversations": [{"role": "user", "content": "What does `Date.resolve` do?"}, {"role": "assistant", "content": "Resolve any inconsistencies in the Date object, updating all the fields (in particular `dayOfWeek` and `rawSeconds`) as necessary. If the instance properties (`year`, `month`, `day`, `hour`, `minute`, `second`) are modified, the Date will be in an inconsistent state — its `rawSeconds` won't reflect the modifications, and the properties may fall outside of \"normal\" ranges (`month: 1-12, day:1-31, hour: 0-23, minute/second: 0-59`). Also, using the string conversion methods may"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for smooth arpeggio, updated envelope (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\bass, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.perc(0.2), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// randomly modulate params\n(\n{ LinCongL.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(0.1, 0.5, 1.4),\n LFNoise2.kr(0.1, 0.1, 0.1),\n LFNoise2.kr(0.1)\n) * 0.2 }.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// randomly modulate params\n(\n{ LinCongL.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(0.1, 0.5, 1.4),\n LFNoise2.kr(0.1, 0.1, 0.1),\n LFNoise2.kr(0.1)\n) * 0.2 }.play(s);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `SampleGui` in SuperCollider?"}, {"role": "assistant", "content": "SampleGui — gui class Category: Libraries > crucial > GuiClasses."}]} -{"conversations": [{"role": "user", "content": "What does `MxChannelApp.fader` do?"}, {"role": "assistant", "content": "the MxChannelFader is an audio unit with level, mute, solo and circuit breaker protection (bad values and sudden peaks). This returns that unit. You can connect to it: unit.out >> Returns: MxChannelFader"}]} -{"conversations": [{"role": "user", "content": "What does `RedOscillator2.delta2` do?"}, {"role": "assistant", "content": "Get the second delta phase i.e. current phase"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for vinil 10."}, {"role": "assistant", "content": "```supercollider\n// vinil 10\n// Esta cosa tiene un delay de maximo 10 segundos. La posicion X controla el tiempo de delay.\n// nos permite hacer una especie de 'scratch' como el de los djs con lo que entra por el mic\n(\nSynthDef.new(\"vinil10\", {arg gain=2; var in, delay;\n in = SoundIn.ar(0,mul:gain);\n delay = DelayL.ar(in!2,10,MouseX.kr(0,10))!2;\n Out.ar(0,delay)\n}).add;\n);\n\na = Synth(\"vinil10\");\n\na.free // libera (desactiva) el oscilador\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SequenceableCollection.blendAt` do?"}, {"role": "assistant", "content": "Returns a linearly interpolated value between the two closest indices. Inverse operation is #-indexInBetween. `x = [2, 5,"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Re: Dark sea horns."}, {"role": "assistant", "content": "```supercollider\n(\n Ndef(\\x, {\n var output;\n var delayTime;\n var delayMax = 0.2;\n var delayAdd = 0.1;\n var pulseFreq = 0.5;\n var proxyMul = 2;\n var pulseMin = 40;\n var pulseMax = 130;\n var numOfEchos = 2;\n\n var mainPulse = LFPulse.ar(pulseFreq, 0, 0.5).range(pulseMin, pulseMax);\n var proxy = Ndef(\\x).ar * proxyMul;\n var ampModFreq = SinOsc.ar(0.01, 0).range(0.3, 30);\n var ampMod = LFNoise1.ar(ampModFreq, 6);\n output = SinOsc.ar(mainPulse + proxy, 0, ampMod).tanh;\n numOfEchos.do{\n delayTime = {delayMax.rand + delayAdd}!2;\n output = AllpassL.ar(output, 0.1, delayTime, 5);\n };\n output.tanh;\n }).play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n var saw, bpf;\n saw = Pulse.ar(\n freq: [100,150],\n mul: LFPulse.kr(\n freq: [0, 0.03, 0.04],\n width: 0.15));\n bpf = LPF.ar(in: saw, freq: SinOsc.kr(-10, -5, 3).range(200, 400));\n Out.ar(0, bpf);\n}.play;\n)\n```"}, {"role": "assistant", "content": "//Pulse is the UGen. There is multichannel expansion due to the lists in the freqs. The range is a big part of the reason this sounds so deep."}]} +{"conversations": [{"role": "user", "content": "How do I add a reverb send to a whole group?"}, {"role": "assistant", "content": "Same shape as the delay: a private stereo bus, one effect reading it, instruments writing both dry\nand wet.\n\n```supercollider\n(\n~verbBus = Bus.audio(s, 2);\nSynthDef(\\verb, { |in = 0, out = 0, room = 0.85, mix = 0.5|\n Out.ar(out, FreeVerb.ar(In.ar(in, 2), mix, room, 0.5) * 0.7);\n}).add;\nSynthDef(\\blip, { |out = 0, send = 0, freq = 440, amp = 0.1|\n var env = EnvGen.kr(Env.perc(0.002, 0.4), doneAction: 2);\n var sig = SinOsc.ar(freq) * env * amp;\n Out.ar(out, sig);\n Out.ar(send, sig);\n}).add;\n);\nSynth(\\verb, [\\in, ~verbBus]);\nPbind(\\instrument, \\blip, \\send, ~verbBus, \\degree, Pseq([0, 4, 7, 11], inf), \\dur, 0.25).play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Pmulpre` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain);\nb = Pmulpre(\\freq, Pseq([1, 2, 3], inf), a);\nb.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// using timer to modulate sine frequency: the slower the trigger is the higher the frequency\n(\n{ var trig;\n trig = Impulse.kr(MouseX.kr(0.5, 20, 1));\n SinOsc.ar(Timer.kr(trig) * 500 + 500, 0, 0.2)\n}.play;\n)\n```"}, {"role": "assistant", "content": "using timer to modulate sine frequency: the slower the trigger is the higher the frequency (Timer: Returns time since last triggered.)"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Normalizer`."}, {"role": "assistant", "content": "```supercollider\n(\n// example signal to process\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n z * 0.8\n}.play\n);\n\n(\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n [z, Normalizer.ar(z, 0.4, 0.01)] * 0.5\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// you have to write the sample path in the firts line\n\n~bufferdue = Buffer.read(s,\" WRITE YOUR SAMPLE PATH HERE \", bufnum:2);\n\n(\nSynthDef.new(\\bufbeat, {\n arg amp = 1, out = 0, buf, start, end, freq = 1;\n var sig, ptr;\n ptr = LFNoise1.ar(freq).range(0.0,end);\n sig = BufRd.ar(2, buf, ptr);\n sig = sig * amp;\n Out.ar(out, sig);\n}).add\n);\n\nx = Synth.new(\\bufbeat, [\\buf, ~bufferdue.bufnum, \\start,0, \\end, ~bufferdue.numFrames-1, \\freq, 1, \\amp, 0.5],g);\n\nx.free;\n```"}, {"role": "assistant", "content": "a simple BufRd with the starting point of lecture randomized by LFNoise1."}]} {"conversations": [{"role": "user", "content": "Speech to midi converter?"}, {"role": "assistant", "content": "SuperCollider forum — Speech to midi converter?\n\nHello!\n\nI want to make a speech to midi converter in Supercollider.\n\nI’ve started off trying to find a way to convert FFT data to midi-numbers to send to a midi-instrument, but I’m stuck:\n\n```supercollider\n~file = Buffer.read(s, \"path_to_file\", bufnum:1);\n\n(\n{\n var buf = Buffer.alloc(s, 2048, bufnum:2);\n var sig = PlayBuf.ar(2, 1, loop:1);\n var chain = FFT(buf, sig);\n var trig = Impulse.kr(30);\n chain[0].pvcalc(80, {\n |phas, mag|\n SendReply.kr(trig, \"/anal\", mag);\n });\n}.play\n);\n\n(\nOSCdef.new(\\midiConverter, {\n |msg|\n msg.postln;\n}, \"/anal\");\n)\n```\n\nthe output looks like this:\n\n[ /anal, 1000, -1, 0.0, 3.0463190078735, 2.1142015457153, -0.64955651760101, 2.3432319164276, -0.23956227302551, -3.1334409713745, -2.1829152107239, 1.1417833566666, -2.2972648143768, -0.74415707588196, -0.88793164491653, 1.9947071075439, -1.1327115297318, 2.6084003448486, etc...]\n\nI’m not sure how to interpret theese numbers. And I’m not sure pvcalc is even the best way to get the data I need. I want to somehow be able to control the resolution on how many of the loudest bins I’m going to convert to frequency and then from frequency to midi-number to send to a midi-instrument as the soundfile plays through.\n\nAny ideas?"}]} -{"conversations": [{"role": "user", "content": "What does `AbstractFunction. crucial > Constraints."}]} -{"conversations": [{"role": "user", "content": "What does `MKtlElement.removeAction` do?"}, {"role": "assistant", "content": "Remove an action from the list of current actions. The action to be removed has to be the exact same function"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n{Mix({|i|var j=Impulse,t=TChoose.kr(j.kr(1/8),[1,6,3]/8),r=Ringz.ar(j.ar(i*t+0.25),600*t*i+[0,9]);CombC.ar(r,1,0.5,4,0.1,r)}!4).tanh/4}.play\n```"}, {"role": "assistant", "content": "Hi colliders, this is my first post here, and also my very first sc tweet! \r\nIt's nothing special, just a little rhythmic Ringz thingy...\r\nAs a beginner, I found this really useful getting the hang of some syntax shortcuts:\r\nhttp://schemawound.com/post/25710867587/supercollider-tweets-background-tips."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// encoder (two rings of 6)\n~encoder = FoaEncoderMatrix.newPeri(6\n\n// inspect\n~encoder.dirChannels.raddeg\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// encoder (two rings of 6)\n~encoder = FoaEncoderMatrix.newPeri(6)\n\n// inspect\n~encoder.dirChannels.raddeg\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// syntax can be more condensed with EventShortcuts, turn it on, post defaults\n\nEventShortcuts.on\n\nEventShortcuts.postCurrent\n\n\n(\nPLbindef(\\u,\n \\i, \\saw_grain,\n \\d, 0.2,\n \\m, Pwhite(60, 90)\n)\n);\n\n~u.play\n\n~u.d = 0.1\n\n\n~u.m = Pn(Plazy { Pseries(rrand(50, 70), 1.5, 20) })\n\n~u.m = ~u.m + [0, 4, 7]\n\n~u.i = PLseq([\\sin_grain, \\saw_grain])\n\n\n~u.a = Pn(Pseries(0.05, 0.01, 20))\n// …\n```"}, {"role": "assistant", "content": "syntax can be more condensed with EventShortcuts, turn it on, post defaults stop + cleanup in one (PLbindef: wrapper for Pbindef which allows replacement in object prototyping style)"}]} -{"conversations": [{"role": "user", "content": "What does `QPalette.light` do?"}, {"role": "assistant", "content": "A predefined palette using light colors. All colors are considered to be set (see"}]} -{"conversations": [{"role": "user", "content": "What does `PlayerSocket.prepareChildrenToBundle` do? What arguments does it take?"}, {"role": "assistant", "content": "a player that can play other players using a cross-faded and fuse-protected socket Arguments: bundle."}]} -{"conversations": [{"role": "user", "content": "What does `UGenInstr.path` do?"}, {"role": "assistant", "content": "converts a single UGen into an Instr eg. UGenInstr(RLPF)"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Migration from the old SourceForge wiki."}, {"role": "assistant", "content": "```supercollider\n// Sing whatever pitch you like into the microphone, but have the output conform to the key you press on your connected MIDI keyboard, like a very low-rent Autotune.\n// by nonprivate April 2009\n// best used with headphones\n// execute one by one...\n\ns = Server.local.boot;\nb = 200; // no. of control bus to use for pitch control\n(\n SynthDef(\"straightenUp\",\n { |baseFreq = 100|\n \n var in, freq, hasFreq, out;\n in = Mix.new(SoundIn.ar([0,1]));\n # freq, hasFreq = Pitch.kr(in, ampThreshold: 0.02, median: 7);\n out = PitchShift.ar(in, 0.08, (baseFreq / freq), 0.0, 0.0);\n Out.ar(0,[out, out])\n }\n ).send(s);\n);\n\ns.sendMsg(\"/s_new\", \"straightenUp\", n = s.nextNodeID, 1, 0);\n\ns.sendMsg(\"/n_map\", n, \"baseFreq\", b);\n\n(\n c = NoteOnResponder(\n { |src,chan,note,vel|\n \n s.sendMsg(\"/c_set\", b, note.midicps);\n \n },\n nil, // any source\n nil, // any channel\n nil, // any note\n nil // any vel\n );\n \n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `MultiSplineFr.focusedPoint` do? What arguments does it take?"}, {"role": "assistant", "content": "Multi dimensional spline frame rate device Arguments: fp."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// modulate frequency\n{ Pulse .ar(XLine.kr(40,4000,6),0.1, 0.2) }.play;\n{ PulseDPW.ar(XLine.kr(40,4000,6),0.1, 0.2) }.play;\n\n// two band limited square waves thru a resonant low pass filter\n{ RLPF.ar(Pulse .ar([100,250],0.5,0.1), XLine.kr(8000,400,5), 0.05) }.play;\n{ RLPF.ar(PulseDPW.ar([100,250],0.5,0.1), XLine.kr(8000,400,5), 0.05 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// modulate frequency\n{ Pulse .ar(XLine.kr(40,4000,6),0.1, 0.2) }.play;\n{ PulseDPW.ar(XLine.kr(40,4000,6),0.1, 0.2) }.play;\n\n// two band limited square waves thru a resonant low pass filter\n{ RLPF.ar(Pulse .ar([100,250],0.5,0.1), XLine.kr(8000,400,5), 0.05) }.play;\n{ RLPF.ar(PulseDPW.ar([100,250],0.5,0.1), XLine.kr(8000,400,5), 0.05) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Dictionary.keys` do?"}, {"role": "assistant", "content": "Return a Set of all keys. `d = Dictionary.newFrom([\\hello, 9, \\whello,"}]} -{"conversations": [{"role": "user", "content": "What does `ScopeView.stop` do?"}, {"role": "assistant", "content": "Tells the ScopeView object to stop plotting. Plotting can be resumed anytime with the #start"}]} -{"conversations": [{"role": "user", "content": "What does `PV_PhaseShift90.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Shift phase by 90 degrees. Arguments: buffer — FFT buffer.."}]} -{"conversations": [{"role": "user", "content": "What does `SDrone.xsetFrequencies` do? What arguments does it take?"}, {"role": "assistant", "content": "convenience method for CODE.xset(\\frequencies, ...) will Arguments: arr — an array of floats in Hz.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Now to demonstrate language-side classification, we'll iterate over a grid and classify:\n(\n(0, 0.1 .. 1).collect{|y|\n(0, 0.1 .. 1).collect{|x|\nPlaneTree.classify([x,y], ~treedata)\n}\n}.do(_.postln);\"\"\n);\n\n// Server-side: run this then move the mouse left/right/up/down - classification should follow same pattern.\ns.boot;\n~treebuf = Buffer.loadCollection(s, ~treedata.flat, ~treedata[0].size);\n(\nx = {\nPlaneTree.kr(~treebuf, [MouseX.kr(0,1), MouseY.kr(0,1)]).poll\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Now to demonstrate language-side classification, we'll iterate over a grid and classify:\n(\n(0, 0.1 .. 1).collect{|y|\n(0, 0.1 .. 1).collect{|x|\nPlaneTree.classify([x,y], ~treedata)\n}\n}.do(_.postln);\"\"\n);\n\n// Server-side: run this then move the mouse left/right/up/down - classification should follow same pattern.\ns.boot;\n~treebuf = Buffer.loadCollection(s, ~treedata.flat, ~treedata[0].size);\n(\nx = {\nPlaneTree.kr(~treebuf, [MouseX.kr(0,1), MouseY.kr(0,1)]).poll\n}.play\n);\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// NTMI.zoom sets all the influx'es inScalers AND RandomOrbit's excursion from current state.\n\nNTMI.zoom = NTMI.zoom?1;\n\n// tune this for jitter on zoom pot on NTMI\nSpec.add(\\zoom, [0, 1, \\lin, 0.025]);\n\nNTMI.setZoom = {|ev, val|\n val = \\zoom.asSpec.constrain(val);\n // \"global ZOOM f. RandomOrbits and Influxes: %\\n\".postf(val);\n NTMI.zoom = val;\n\n NTMI.inphlux.inScaler = NTMI.zoom;\n \"zoom: %\\n\".postf(NTMI.zoom);\n // return value\n val\n};\n// increment / decrement\nNTMI.incZoom = {|ev, inc=0.1|\n NTMI.setZoom((NTMI.zoom + inc));\n};\n```"}, {"role": "assistant", "content": "NTMI.zoom sets all the influx'es inScalers AND RandomOrbit's excursion from current state."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Fdef`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\ns.boot;\nSynthDef(\"gpdef\",\n { |out = 0, freq = 440, sustain = 0.05, amp = 0.1|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain), doneAction: Done.freeSelf) * amp;\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n// fork a thread that plays some sounds\n(\nFdef(\\freq, 440);\nFdef(\\dur, 0.2);\n\nfork {\n loop {\n s.sendMsg(\"/s_new\", \"gpdef\", -1, 1, 1, \\freq, Fdef(\\freq).value);\n Fdef(\\dur).value.wait;\n }\n};\n);\n\n// some modifications\n\nFdef(\\freq, Fdef(\\midinote, 60).midicps);\nFdef(\\midinote, { [67, 64, 65].choose });\nFdef(\\midinote, { [67, 64, 65].choose } + Fdef(\\offset));\nFdef(\\offset, { 4.rand });\nFdef(\\dur, 0.23);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// default initial params\n{ FBSineC.ar(SampleRate.ir/4) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// default initial params\n{ FBSineC.ar(SampleRate.ir/4) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `OnePole` in SuperCollider briefly."}, {"role": "assistant", "content": "OnePole — One pole filter. A one pole filter. Implements the formula: Category: UGens > Filters > Linear."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// default initial params\n{ FBSineL.ar(SampleRate.ir/4) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// default initial params\n{ FBSineL.ar(SampleRate.ir/4) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BRF`."}, {"role": "assistant", "content": "```supercollider\n{ BRF.ar(Saw.ar(200, 0.1), FSinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3800, 4000), 0.3) }.play;\n\n{ BRF.ar(Saw.ar(200, 0.5), MouseX.kr(100, 10000, 1), 0.3) }.play;\n\n\n // BRF on control signals:\n(\n{ var vib = BRF.kr(SinOsc.kr([1, 3, 10], 0, [1, 0.5, 0.25]).sum, MouseX.kr(1, 10, 1), 0.3);\n SinOsc.ar(vib * 200 + 600) * 0.2 }.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `OpenBCIboard.on` do? What arguments does it take?"}, {"role": "assistant", "content": "turn on (unmute) one ore more Arguments: channel — can be an Integer or an Array of Integers. `c.on(1) //turn on the first channel`."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Pmul`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, gate = 1|\n var env;\n env = EnvGen.kr(Env.asr(0.001, 1, 0.2), gate, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain, \\freq, 440);\nb = Pmul(\\freq, Pseq([1, 2, 3, 4, 5, 6, 7], inf), a);\nb.play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Interfacing SC with external software: MIDI or OSC?"}, {"role": "assistant", "content": "SuperCollider forum — Interfacing SC with external software: MIDI or OSC?\n\nI found this partial solution on sccode.org :\n\n```supercollider\n // declare an event type which sends OSC commands to Renoise\n\n(\nEvent.addEventType(\\renoise, { |server|\n var renoiseOscServer = NetAddr(\"127.0.0.1\", 8000);\n var notes = [~midinote.value, ~ctranspose.value, ~velocity.value, ~sustain.value, ~lag.value, ~timingOffset.value, ~instr.value, ~track.value].flop;\n var timeNoteOn, timeNoteOff, instrument, track, velocity;\n var serverLatency;\n\n serverLatency = server.latency ? 0;\n\n notes.do {|note|\n instrument = note[6] ? -1;\n track = note[7] ? -1;\n velocity = note[2].asInt.clip(0,127);\n\n // sustain and timingOffset are in beats, lag is in seconds\n timeNoteOn = (thisThread.clock.tempo.reciprocal*note[5])+note[4]+server.latency;\n timeNoteOff = (thisThread.clock.tempo.reciprocal*(note[3]+note[5]))+note[4]+server.latency;\n SystemClock.sched(timeNoteOn, {renoiseOscServer.sendMsg(\"/renoise/trigger/note_on\", instrument.asInt, track.asInt, (note[0]+note[1]).asInt, velocity )});\n SystemClock.sched(timeNoteOff, {renoiseOscServer.sendMsg(\"/renoise/trigger/note_off\", instrument.asInt, track.asInt, (note[0]+note[1]).asInt)});\n }\n});\n);\n\n// Now start Renoise OSC server, load a sample, and try some patterns\n\n// straight timing\n(\nPbind(*[\n type: \\renoise,\n legato: Pgauss(0.2,0.05,inf),\n dur: 0.2,\n degree: [2,5,12],\n track: Prand([0,1], inf),\n ctranspose: Pseq([0,0,0,0,4,4,4,4,5,5,5,5],inf),\n velocity: Pgauss(64,10,inf),\n]).play;\n)\n```\n\nhttp://sccode.org/1-4SN\n\nBut what I couldn’t find there was a simple syntax for sending Note Events or Midi Events as OSC messages... Do I really need to re-implement the whole SC’s defaultParentEvent as new OSC Event to send it using regular pattern’s syntax?"}]} -{"conversations": [{"role": "user", "content": "What does `Server.default` do?"}, {"role": "assistant", "content": "Get or set the default server. By default this is the local server (see"}]} -{"conversations": [{"role": "user", "content": "How big are you?"}, {"role": "assistant", "content": "198M parameters in total, 64M active per token because the feed-forward layers are a mixture of four experts with top-1 routing. That is small enough to train in minutes on one GPU."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, gate = 1|\n var env;\n env = EnvGen.kr(Env.asr(0.001, 1, 0.2), gate, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain, \\freq, 440);\nb = Padd(\\freq, Pseq([10, 30, 100], inf), a);\nb.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, gate = 1|\n var env;\n env = EnvGen.kr(Env.asr(0.001, 1, 0.2), gate, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain, \\freq, 440);\nb = Padd(\\freq, Pseq([10, 30, 100], inf), a);\nb.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `MxArJack.guiClass` do?"}, {"role": "assistant", "content": "A hot swappable input point for use in internal patching"}]} -{"conversations": [{"role": "user", "content": "What does `UserView.background` do? What arguments does it take?"}, {"role": "assistant", "content": "Sets the color used to fill the whole area occupied by the view below the drawing done in #-drawFunc. You can set the background at any moment, even within the `drawFunc`, but any drawing done in that Function will always be displayed on top of the Arguments: A Color.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// a piece from 2001\n\n//_____genes you have to enyoy slowly\n(\nSynthDef(\"amino\", { arg out, freq=440, sustain=1.0, pan, p, amp=0.1;\n var u;\n u = Line.kr(1, 0, sustain, doneAction:2) *\n SinOsc.ar(freq,\n SinOsc.ar(freq * p, 0, BrownNoise.kr(pi/8))\n );\n Out.ar(out, Pan2.ar(u, pan, amp));\n\n}).store;\n);\n\nx = AminoacidPattern.new.loadData(\"data/escherichia-coli\".resolveRelative);\n\n\n(\nPbind(\n \\instrument, \\amino,\n \\degree, x - 4 ,\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// a piece from 2001\n\n//_____genes you have to enyoy slowly\n(\nSynthDef(\"amino\", { arg out, freq=440, sustain=1.0, pan, p, amp=0.1;\n var u;\n u = Line.kr(1, 0, sustain, doneAction:2) *\n SinOsc.ar(freq,\n SinOsc.ar(freq * p, 0, BrownNoise.kr(pi/8))\n );\n Out.ar(out, Pan2.ar(u, pan, amp));\n\n}).store;\n);\n\nx = AminoacidPattern.new.loadData(\"data/escherichia-coli\".resolveRelative);\n\n\n(\nPbind(\n \\instrument, \\amino,\n \\degree, x - 4 ,\n \\stepsPerOctave, 24,\n \\dur, 0.13*3,\n \\p, x / 20,\n \\legato, Prand([1, 0.5, 2], inf) * 1.4,\n \\pan, x / 10 - 1,\n \\amp, Pbrown(0.01, 0.15, 0.05, inf)\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Impulse.ar(800, 0.0, 0.5, 0) }.play\n\n{ Impulse.ar(XLine.kr(800, 100, 5), 0.0, 0.5, 0 }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Impulse.ar(800, 0.0, 0.5, 0) }.play\n\n{ Impulse.ar(XLine.kr(800, 100, 5), 0.0, 0.5, 0) }.play\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// example signal to process\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n z * 0.8\n}.play\n);\n\n(\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n [z, Normalizer.ar(z, 0.4, 0.01)] * 0.5\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// example signal to process\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n z * 0.8\n}.play\n);\n\n(\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n [z, Normalizer.ar(z, 0.4, 0.01)] * 0.5\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `PLinExp.new` do? What arguments does it take?"}, {"role": "assistant", "content": "UGenPatterns quark library Arguments: pattern; srclo; srchi; dstlo; dsthi."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Pproto`."}, {"role": "assistant", "content": "```supercollider\nPbind(*[freq: 700, amp: 0.1])\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for minor random bliss in two for Prout."}, {"role": "assistant", "content": "```supercollider\n(\n\nSynthDef(\\param, { arg freq = 100, sustain, amp;\n var sig;\n sig = LFPar.ar(freq: freq,\n mul: EnvGen.kr(Env.perc(0, sustain, 0.5), doneAction:2) * amp);\n sig = Splay.ar(sig);\n Out.ar(0, sig);\n}).add;\n\ne = Pbind(\n \\midinote, Prout({\n var tone0, tone1, tone2, interval, freq0, delta;\n loop {\n tone0 = rrand(0,11);\n interval = rrand(2,4);\n tone1 = Scale.minor(\\pythagorean).at(tone0) + [0,12,24].choose + 0.07;\n tone2 = Scale.minor(\\pythagorean).at(tone0 + interval) + [0,12,24].choose;\n freq0 = [tone1,tone2]+48;\n postln(freq0);\n freq0.yield;\n }\n }),\n \\dur, Prand([1,2,4,8,12,16,4,6,8], inf),\n \\instrument, \\param,\n \\amp, 0.5,\n \\sustain, 2,\n).play(quant:1); // returns an EventStream\nTempoClock.default.tempo = 1200/60;\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Sieve.union_oi` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new Sieve object in mode 'intervals' with offsets, generated by the union of sets of Arguments: ... data — Alternating generators and integer offsets plus an optional integer limit, wrapped into a Ref, which is included when reached. Allowed generators: Integers, Streams or Patterns producing intervals or Sieves itself. Integers and Stream/Pattern output must be strictly positive. Integers as generators ."}]} -{"conversations": [{"role": "user", "content": "What does `Document.implementationClass` do? What arguments does it take?"}, {"role": "assistant", "content": "The editor implementation specific class which will handle Arguments: value — A class for implementing Document.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// modulate frequency of a sine oscillator\n\n(\nSynthDef(\"help-MultiplexAnalogIn\", { |out = 0|\n Out.ar(out,\n SinOsc.ar(MultiplexAnalogIn.ar(0, 1).exprange(200, 5000), 0, 0.1)\n )\n}).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// modulate frequency of a sine oscillator\n\n(\nSynthDef(\"help-MultiplexAnalogIn\", { |out = 0|\n Out.ar(out,\n SinOsc.ar(MultiplexAnalogIn.ar(0, 1).exprange(200, 5000), 0, 0.1)\n )\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Close in Counters of the Fourth Mind."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\closeN, { |out=0, freq=440, gate=1|\n var son = BPF.ar(in: WhiteNoise.ar(20!2),\n freq: freq,\n rq: 0.005,\n mul: 1,\n );\n var env = EnvGen.ar(\n Env.linen(0.1, 0.5, 0.55, 0.8, \\welch),\n doneAction:2\n );\n son = FreeVerb2.ar(son, son, mix: 0.7, room: 1.0, damp: 0.3);\n Out.ar(out, son * env);\n\n\n}).add;\n);\n\n\n(\na = {\n var saw, bpf;\n saw = Saw.ar(\n freq: [200, 250],\n mul: LFPulse.kr(\n freq: [2, 3],\n width: 0.15));\n bpf = LPF.ar(in: saw, freq: SinOsc.kr(1/5).range(200, 4000));\n bpf = FreeVerb2.ar(bpf, bpf, mix: 0.4, room: 0.7);\n Out.ar(0, bpf);\n};\ns = {\n var saw, bpf;\n saw = Saw.ar(\n freq: [100, 150],\n mul: LFPulse.kr(\n freq: [1, 1.5],\n width: 0.15));\n bpf = LPF.ar(in: saw, freq: SinOsc.kr(1/5).range(200, 4000));\n bpf = FreeVerb2.ar(bpf, bpf, mix: 0.4, room: 0.7);\n Out.ar(0, bpf);\n};\nd = {\n var saw, bpf;\n saw = Pulse.ar(\n freq: [800, 1000],\n mul: LFPulse.kr(\n freq: [1, 1.5],\n width: 0.15).range(0.0,0.7));\n bpf = LPF.ar(in: saw, freq: SinOsc.kr(1/5).range(200, 4000));\n bpf = FreeVerb2.ar(bpf, bpf, mix: 0.4, room: 0.7);\n Out.ar(0, bpf);\n};\nf = Pbind(\n \\instrument, \\closeN,\n \\freq, Pseq([800, 1000, 900, 400, 600], inf),\n \\dur, Pseq([1, 1, 1, 1, 4], inf),\n \\amp, 1);\ng = Pbind(\n \\instrument, \\closeN,\n \\freq, Pseq([1000, 1150, 1200, 1500, 1200], inf),\n \\dur, Pseq([1, 1, 1, 1, 4], inf),\n \\amp, 0.5);\n{\n a.play;\n 3.75.wait;\n f.play();\n 4.25.wait;\n s.play;\n 8.wait;\n d.play;\n 3.75.wait;\n g.play;\n}.fork;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BusPlug`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\nz = Bus.control(s, 16);\nz.setn({ |i| (i * 5).nthPrime } ! 16 * 5 + 100);\na = BusPlug.for(z);\n{ Splay.ar(SinOsc.ar(a.kr(3, MouseX.kr(0, 25)))) * 0.1 }.play; // selectively play 3 channel of the 16, modulate offset\n```"}]} -{"conversations": [{"role": "user", "content": "Can I run SuperCollider without the IDE?"}, {"role": "assistant", "content": "Yes. `sclang` runs the language and `scsynth` the server, and they are separate processes by design\n— the IDE is only a client. A headless script is a `.scd` run with `sclang my-piece.scd`, and it must boot\nthe server itself:\n\n```supercollider\ns.boot;\ns.waitForBoot {\n // build SynthDefs, play, then wait\n 30.wait;\n s.quit;\n};\n```\n\nThat shape — boot, wait, play, quit, exit — is what makes a piece runnable from a cron job or a\nRaspberry Pi."}]} -{"conversations": [{"role": "user", "content": "Explain `FormantTable` in SuperCollider briefly."}, {"role": "assistant", "content": "FormantTable — Lookup table for emulating vocal tracts Returns a set of frequencies+resonances+amplitudes for a set of 5 bandpass filters, useful for emulating the main 5 formants of a vocal tract. To see the available voice types run this line: Category: Collections."}]} +{"conversations": [{"role": "user", "content": "Resetting start count with PulseDivider?"}, {"role": "assistant", "content": "SuperCollider forum — Resetting start count with PulseDivider?\n\ni think in your example Sweep is receiving a trigger while going from 0 to 1 causing the discontinuity in the phase because the duration between one trigger and the next is unknown.\n\nwith this example you get at least a continiuous phase with random triggers to drive the hanning window (evaluate it several times). but its not multichannel with distributed phases / windows accross channels:\n\n```supercollider\n(\nvar randomTrigPhase = { |triggerRate = 10, randomness = 1|\n var minDuration = (2 ** randomness) / triggerRate;\n var maxDuration = (2 ** (-1 * randomness)) / triggerRate;\n var demand = Dunique(minDuration * ((maxDuration / minDuration) ** Dwhite(0, 1)));\n var duration = Duty.ar(demand, DC.ar(0), demand);\n var phase = Phasor.ar(DC.ar(0), (1 / duration) / SampleRate.ir, 0, 1);\n (phase: phase, trigger: HPZ1.ar(phase) < 0);\n};\n\nvar hanningWindow = { |phase|\n (1 - (phase * 2pi).cos) / 2 * (phase < 1);\n};\n\n{\n var rate = 100;\n var phase = randomTrigPhase.(rate, 1).phase;\n hanningWindow.(phase);\n}.plot(0.1);\n)\n```\n\nim not sure if this is helping it just reminded me of some issue with multichannel random triggers and continiuous phases i have been trying to solve."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// linexp\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(mod.linexp(-1, 1, MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1))) * 0.1\n}.play;\n);\n\n// exprange\n(\n{\n var mod = LFNoise2.ar(80).exprange(MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1));\n SinOsc.ar(mod) * 0.1\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// linexp\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(mod.linexp(-1, 1, MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1))) * 0.1\n}.play;\n);\n\n// exprange\n(\n{\n var mod = LFNoise2.ar(80).exprange(MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1));\n SinOsc.ar(mod) * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Henon2DN.ar(SampleRate.ir/4, SampleRate.ir, MouseX.kr(1,1.4), MouseY.kr(0,0.3)) * 0.2 }.play(s);\n\n(\n{ Henon2DN.ar(\n 2200, 8800,\n LFNoise2.kr(1, 0.2, 1.2),\n LFNoise2.kr(1, 0.15, 0.15)\n) * 0.2 }.play(s);\n)\n\n{ SinOsc.ar(Henon2DN.ar(20, 40, MouseX.kr(1,1.4), MouseY.kr(0,0.3))*800+900)*0.4 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Henon2DN.ar(SampleRate.ir/4, SampleRate.ir, MouseX.kr(1,1.4), MouseY.kr(0,0.3)) * 0.2 }.play(s);\n\n(\n{ Henon2DN.ar(\n 2200, 8800,\n LFNoise2.kr(1, 0.2, 1.2),\n LFNoise2.kr(1, 0.15, 0.15)\n) * 0.2 }.play(s);\n)\n\n{ SinOsc.ar(Henon2DN.ar(20, 40, MouseX.kr(1,1.4), MouseY.kr(0,0.3))*800+900)*0.4 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Server.sync_s` do?"}, {"role": "assistant", "content": "If kept true (default), when the default server is changed, also the interpreter variable s is changed. `Server.default = Server(\\alice, NetAddr(\"127.0.0.1\","}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Control`."}, {"role": "assistant", "content": "```supercollider\na = { SinOsc.ar(\\freq.kr(440, 1.2)) }.play;\na.set(\\freq, 330);\na.release;\na = { SinOsc.ar(\\freq.kr([440, 460], 1.2)) }.play;\na.setn(\\freq, [330, 367]);\na.release;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nVowel().brightenExp(1).dBs.postln; \nVowel().brightenExp(0.1).dBs.postln;\nVowel().brightenExp(1.5).dBs.postln;\n\n{Formants.ar(100, Vowel(\\a, \\bass).brightenExp(MouseX.kr(0,5)) * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nVowel().brightenExp(1).dBs.postln; \nVowel().brightenExp(0.1).dBs.postln;\nVowel().brightenExp(1.5).dBs.postln;\n\n{Formants.ar(100, Vowel(\\a, \\bass).brightenExp(MouseX.kr(0,5))) * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `In`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-InKr\", { |out = 0, in = 0|\n Out.ar(out,\n SinOsc.ar(In.kr(in, 1), 0, 0.1)\n )\n}).add;\nSynthDef(\"help-lfo\", { |out = 0|\n Out.kr(out, LFNoise1.kr(0.3, 200, 800))\n}).add;\n);\n\n\nb = Bus.control(s, 1);\nb.set(800);\n\nSynth(\"help-InKr\", [\\in, b.index]);\nb.set(400);\nb.set(300);\nSynth(\"help-lfo\", [\\out, b.index]);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Window.setTopLeftBounds` do? What arguments does it take?"}, {"role": "assistant", "content": "A convenience method that, unlike #-bounds, sets the bounds by measuring position from the top-left corner of the screen, and vertically offset by Arguments: rect — A Rect.; menuSpacer — An Integer amount of pixels.."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LinSelectX`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar(300),\n Pulse.ar(230)\n ];\n\n LinSelectX.ar(MouseX.kr(0, 1) * a.size, a) * 0.2\n}.play;\n);\n\n(\n{\n var a;\n a = [\n SinOsc.kr(0.25),\n LFSaw.kr(10),\n LFPulse.kr(0.3)\n ];\n\n SinOsc.ar(LinSelectX.kr(MouseX.kr(0, 1) * a.size, a) * 300 + 400) * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `ArraySpec.canAccept` do? What arguments does it take?"}, {"role": "assistant", "content": "datatype specifying an array with an itemSpec which describes its items Arguments: ting."}]} +{"conversations": [{"role": "user", "content": "How should I organise a SuperCollider project on disk?"}, {"role": "assistant", "content": "One folder per piece, with a fixed shape:\n\n```text\nmy-piece/\n synthdefs.scd // only SynthDef(...).add, loaded first\n material.scd // buffers, samples, scales\n piece.scd // the performance: Tdefs, Pbinds, Ndefs\n README.md // tempo, required samples, how to run it\n```\n\nThen the workflow is: open `synthdefs.scd`, Ctrl+A Ctrl+Enter to load it, load `material.scd`, and work in\n`piece.scd`. Keeping definitions out of the performance file is what makes a reboot survivable and a piece\nre-runnable six months later."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Saw` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\event_set, { |freq = 440, gate = 1, amp = 0.1, lagTime = 0.1,\n ffreq = 2000, detune = 1.005, out = 0|\n var sig = Saw.ar(Lag.kr(freq, lagTime) * [1, detune]).sum * amp\n * EnvGen.kr(Env.adsr, gate, doneAction: Done.freeSelf);\n Out.ar(out, sig ! 2);\n}).add;\n);\n\na = Synth(\\event_set);\n\n(\np = Pbind(\n \\type, \\set,\n \\id, a,\n \\instrument, \\event_set,\n \\args, #[],\n \\freq, Pexprand(200, 600, inf),\n \\dur, Pwhite(1, 5, inf) * 0.125\n).play;\n);\n\np.stop;\na.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `SampleRate`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// compares a 441 Hz sine tone derived from sample rate (44100 * 0.01, left)\n// with a 440 Hz tone (right), resulting in a 1 Hz beating\n(\n{\n var freq;\n freq = [SampleRate.ir * 0.01, 440];\n SinOsc.ar(freq, 0, 0.1)\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Pmulpre` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain);\nb = Pmulpre(\\freq, Pseq([1, 2, 3], inf), a);\nb.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Resizing FreqScope?"}, {"role": "assistant", "content": "SuperCollider forum — Resizing FreqScope?\n\nOddly, this seems to work:\n\n```supercollider\n// max partial = 20 kHz\n// do not play this loudly\na = { Blip.ar(100, 200, 0.02).dup }.play;\n\nv = FreqScope(800, 600); // top partial is shown below 1.75 kHz (?)\n\nv.scope.scope.xZoom = 1; // seems correct, by eyeballing\n\n// let's try another resolution\nv = FreqScope(600, 500);\nv.scope.scope.xZoom = 1; // hm, zoom = 1 seems OK here too\n```\n\nFreqScope includes the line scope.xZoom_((scope.bufSize*0.25) / width); so it may be that this calculation is incorrect. I’m unclear, for instance, why it’s dividing by width – apparently zooming out for larger windows...?\n\nBut I tried three different widths (800x600, 600x500, 200x150), and for all of them, xZoom = 1 appeared to be correct. It’s possible that this calculation is vestigial, then – maybe we needed it for the older version of frequency scope, but the Qt version might not need it at all.\n\nhjh"}]} +{"conversations": [{"role": "user", "content": "Do is not ¨returning¨ array (campanology)?"}, {"role": "assistant", "content": "SuperCollider forum — Do is not ̈returning ̈ array (campanology)\n\nYou can remove the need for all mutable variables by computing the indexes to swap first - these are stored in indexesEven and indexesOdd.\n\nThen an array of functions is made (swappers)...i.e.[indexesEven, indexesOdd, indexesEven....]\n\nFinally, .inject is used to chain these together, taking the previous result as the input to the next and building an array.\n\n```supercollider\n(\n~swap_sort_steps = {\n |parts|\n var swapConsequtiveIndexes = {|from, to|\n (from..to).clump(2).collect{|p| p.reverse }.flat\n };\n var indexesEven = swapConsequtiveIndexes.(0, parts - 1);\n var indexesOdd = [0] ++ swapConsequtiveIndexes.(1, parts - 1);\n var swappers = parts.collect{ |n|\n {|toSwap| if(n.even)\n { indexesEven.collect{|i| toSwap[i]} }\n { indexesOdd.collect{|i| toSwap[i]} }\n }\n };\n postf(\"indexesEven : %\\nindexesOdd : %\\n\", indexesEven, indexesOdd);\n swappers.inject( [(0..parts-1)], {\n |col, f|\n col ++ [f.(col.last)]\n });\n};\n)\n```\n\nAlso, as I’m sure you know, if anyone else is reading who doesn’t know what this is... its a swap sort algorithm."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n//Chaos engine hum\n(\n{\n SinOsc.ar(10 + (50 * SinOsc.kr([50, 51], 0, SinOsc.kr(101, Saw.kr(0.12345, 678, 9), 0.2, 0.8), Pulse.kr([25, 25.5], 0.25, 0.125, -0.25))), 0, 0.5, 0);\n}.play();\n)\n```"}, {"role": "assistant", "content": "A deep binaural cycle reminiscent of the engine of a space ship."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Out.ar(87, SinOsc.ar(MouseX.kr(340, 1000, 1) * [1, 2, 3], 0, 0.2)) }.play;\nx = Monitor.new.play(87, 3, 0, fadeTime: 3;\nx.vol = 0.3;\nx.stop;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Out.ar(87, SinOsc.ar(MouseX.kr(340, 1000, 1) * [1, 2, 3], 0, 0.2)) }.play;\nx = Monitor.new.play(87, 3, 0, fadeTime: 3);\nx.vol = 0.3;\nx.stop;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nVowel(); // defaults to A bass\nVowel(\\a, \\bass); \nVowel(\\e, \\tenor); \nVowel(\\i, \\counterTenor); \nVowel(\\o, \\alto); \nVowel(\\u, \\soprano); \n\n{Formants.ar(100, Vowel(\\e, \\bass)) * 0.1 }.play\n{Formants.ar(200, Vowel(\\o, \\alto)) * 0.1 }.play\n{Formants.ar(300, Vowel(\\i, \\soprano) * 0.1 }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nVowel(); // defaults to A bass\nVowel(\\a, \\bass); \nVowel(\\e, \\tenor); \nVowel(\\i, \\counterTenor); \nVowel(\\o, \\alto); \nVowel(\\u, \\soprano); \n\n{Formants.ar(100, Vowel(\\e, \\bass)) * 0.1 }.play\n{Formants.ar(200, Vowel(\\o, \\alto)) * 0.1 }.play\n{Formants.ar(300, Vowel(\\i, \\soprano)) * 0.1 }.play\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Hilbert`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\ns.scope;\na = { Hilbert.ar(SinOsc.ar(100)) * -20.dbamp }.play;\na.release;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LFDNoise3`."}, {"role": "assistant", "content": "```supercollider\n// try wiggling mouse quickly:\n// LFNoise2 overshoots when going from high to low freqs, LFDNoise changes smoothly.\n\n{ SinOsc.ar(LFNoise2.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n{ SinOsc.ar(LFDNoise3.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFNoise2.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n\n{ LFDNoise3.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n\n// use as frequency control\n(\n{\n SinOsc.ar(\n LFDNoise3.ar(4, 400, 450),\n 0, 0.2\n )\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\ns.boot;\n// Simple polling of median values - you could do this without a UGen!\nx = {|val=1, t_trig=0| MedianTriggered.kr(val, t_trig, 3).poll(t_trig, \"Median of recent 3 values\"); }.play;\nx.set(\\val, 10.rand.postln, \\t_trig, 1); // Execute this repeatedly\n\nx.free;\n\n// Same but with 4 values - note the way medians behave with even-sized sets\nx = {|val=1, t_trig=0| MedianTriggered.kr(val, t_trig, 4).poll(t_trig, \"Median of recent 4 values\"); }.play;\nx.set(\\val, 10.rand.postln, \\t_tr\n// …\n```"}, {"role": "assistant", "content": "Simple polling of median values - you could do this without a UGen! Same but with 4 values - note the way medians behave with even-sized sets (MedianTriggered: Median of recent values, triggered)"}]} +{"conversations": [{"role": "user", "content": "What are the arguments of PlayBuf.ar?"}, {"role": "assistant", "content": "`PlayBuf.ar(numChannels, bufnum, rate, trigger, startPos, loop)`. numChannels must match what is in the buffer, or you get a channel mismatch; bufnum is the Buffer's integer number; rate is playback speed where 1 is normal and negative plays backwards; trigger restarts playback on each trigger in loop mode; startPos is in frames; loop is 0 or 1. `PlayBuf.ar(1, ~buf, BufRateScale.kr(~buf), loop: 1)` is the standard pitch-correct form."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `ProxySpace`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\np = ProxySpace.new;\np.fadeTime = 2; // fadeTime specifies crossfade\np[\\out].play; // monitor an empty placeholder through hardware output\n// set its source\np[\\out] = { SinOsc.ar([350, 351.3], 0, 0.2) };\np[\\out] = { Pulse.ar([350, 351.3] / 4, 0.4) * 0.2 };\np[\\out] = Pbind(\\dur, 0.03, \\freq, Pbrown(0, 1, 0.1, inf).linexp(0, 1, 200, 350));\n\n// route one proxy through another:\np[\\out] = { Ringz.ar(p[\\in].ar, [350, 351.3] * 8, 0.2) * 4 };\np[\\in] = { Impulse.ar([5, 7]/2, [0, 0.5]) };\n\np.clear(3); // clear after 3 seconds\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SClusterDistortions.def` do?"}, {"role": "assistant", "content": "the definition that send out control data on bus Returns: a LINKClasses/SynthDef."}]} +{"conversations": [{"role": "user", "content": "What is rq in BPF.ar?"}, {"role": "assistant", "content": "rq is the reciprocal of Q, so it is a bandwidth control, not a Q control. Small rq means a narrow, resonant band; large rq means a wide, gentle one. The signature is `BPF.ar(in, freq, rq, mul, add)`. A common idiom is `rq = 0.3` for a broad sweep and `rq = 0.02` for a whistle. The same rq convention applies to RLPF and RHPF."}]} +{"conversations": [{"role": "user", "content": "Explain `Pslide` in SuperCollider briefly."}, {"role": "assistant", "content": "Pslide — slide over a list of values and embed them Category: Streams-Patterns-Events > Patterns > List."}]} +{"conversations": [{"role": "user", "content": "Explain `Position` in SuperCollider briefly."}, {"role": "assistant", "content": "Position — an object that holds the value of the current play position for an object Category: Libraries > crucial > Scheduling."}]} +{"conversations": [{"role": "user", "content": "What does `MKtlElement.removeAction` do?"}, {"role": "assistant", "content": "Remove an action from the list of current actions. The action to be removed has to be the exact same function"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = { LPF.ar(Saw.ar(200), 600) * EnvGate.new }.play;\na.set(\\fadeTime, 2);\na.release;\n\n// the same as:\na.set(\\gate, 0);\n\n// several env gates can coexist in one synth def.\n(\na = {\n var sound1 = LPF.ar(Saw.ar(80), 600) * EnvGate.new;\n var sound2 = RLPF.ar(Saw.ar(200) * 0.5, 6000 * EnvGate.new + 60, 0.1) * EnvGate.new;\n sound1 + sound2\n}.play;\n);\na.set(\\fadeTime, 5;\na.release;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = { LPF.ar(Saw.ar(200), 600) * EnvGate.new }.play;\na.set(\\fadeTime, 2);\na.release;\n\n// the same as:\na.set(\\gate, 0);\n\n// several env gates can coexist in one synth def.\n(\na = {\n var sound1 = LPF.ar(Saw.ar(80), 600) * EnvGate.new;\n var sound2 = RLPF.ar(Saw.ar(200) * 0.5, 6000 * EnvGate.new + 60, 0.1) * EnvGate.new;\n sound1 + sound2\n}.play;\n);\na.set(\\fadeTime, 5);\na.release;\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `PdurStutter`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,0,1,3,4,0], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n100.do({ x.next.postln });\n);\n\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n);\n\n\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,4,4,0,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `PlayerSocket.instrArgFromControl` do? What arguments does it take?"}, {"role": "assistant", "content": "a player that can play other players using a cross-faded and fuse-protected socket Arguments: control."}]} +{"conversations": [{"role": "user", "content": "Explain `AbstractSFPGui` in SuperCollider briefly."}, {"role": "assistant", "content": "AbstractSFPGui — gui class Category: Libraries > crucial > GuiClasses."}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nPbind(\\degree, Pseq([0, 2, 4, 7], inf), \\dur, 0.25).play;\n```"}, {"role": "assistant", "content": "It plays a four-note major arpeggio in a loop, one note every 250 ms.\n\n`Pbind` builds an event stream: each event is the current value of every key. `Pseq([0, 2, 4, 7], inf)`\ncycles the degrees forever, and `\\dur, 0.25` sets the time between events in beats on the default\nTempoClock. With no `\\instrument`, the `\\default` SynthDef is used, which converts `\\degree` to a\nfrequency through the current scale (major, rooted at C by default). `.play` schedules it on the clock\nand returns an EventStreamPlayer."}]} +{"conversations": [{"role": "user", "content": "What does `History.end` do?"}, {"role": "assistant", "content": "end adding interpreted code to (current)"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `OscN` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// compare examples below with interpolating Osc examples.\n\n(\ns = Server.local;\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, false, true);\nb = Buffer.alloc(s, 512, 1);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum, 500, 0, 0.5)\n )\n}).play(s, [0, 0, 1, b.bufnum]);\n\n);\nb.free;\n\n\n\n(\n// noninterpolating - there are noticeable artifacts\n// modulate freq\n\ns = Server.local;\nb.sine1(1.0/[1, 2, 3, 4, 5, 6].squared, true, false, true);\nb = Buffer.alloc(s, 512, 1);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum, XLine.kr(2000, 200), 0, 0.5)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n\n);\nb.free;\n\n(\n// sounds very different than the Osc example\ns = Server.local;\nb = Buffer.alloc(s, 512, 1);\nb.sine1([1.0], true, true, true);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum,\n OscN.ar(bufnum,\n XLine.kr(1, 1000, 9),\n 0,\n 200,\n 800),\n 0,\n 0.25)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n\n);\nb.free;\n\n(\n// modulate phase\ns = Server.local;\nb = Buffer.alloc(s, 512, 1);\nb.sine1([1.0], true, true, true);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum,\n 800,\n OscN.ar(bufnum,\n XLine.kr(20, 8000, 10),\n 0,\n 2pi),\n 0.25)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n);\nb.free;\n\n\n(\n// change the buffer while its playing\ns = Server.local;\nb = Buffer.alloc(s, 4096, 1);\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, true, true);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum, [80, 80.2], 0, 0.2)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n);\n\n(\nRoutine({\n var n = 32;\n 50.do({\n b.sine1(Array.rand(n, 0, 1).cubed, true, true, true);\n 0.25.wait;\n });\n}).play;\n);\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `EaseInCubic` in SuperCollider?"}, {"role": "assistant", "content": "EaseInCubic — Cubic ease-in Easing equation function for a cubic (t^3) ease-in, accelerating from zero velocity. Category: Ease."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// For more SynthDefs and examples please head to: https://mycelialcordsblog.wordpress.com/ \n\n(\nSynthDef(\\hasherTest,\n{\narg rate = 1, freq = 60, index = 1000, tRate = 100,\nout = 0, fRate = 0.1;\n\nvar t_trig = LFPulse.kr(0.5/fRate, 0.5);\nvar random = LFNoise0.ar(rate, add:1);\nvar noise = Hasher.ar(random);\nvar sound = Saw.ar((freq+(noise*index)), Decay.kr(Impulse.kr(tRate), noise*0.001)).tanh;\nsound = Pan2.ar(sound, noise-0.3*2);\nFreeSelf.kr(t_trig);\nOut.ar(out, sound);\n}).store;\n);\n\n(\nPbind(\n\\instrument, \\hasherTest,\n\\dur, 5,\n\\rate, Pfuncn({100.rand}, inf),\n\\freq, Pfuncn({10000.rand}, inf),\n\\index, Pfuncn({20000.rand}, inf),\n\\tRate, Pfuncn({1000.rand}, inf),\n\\fRate, 5,\n).play;\n)\n```"}, {"role": "assistant", "content": "It is a simple SynthDef I made after having a look at Hasher UGen with a pattern to play it. It creates nice and varied glitch sounds."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Node`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n(\nx = SynthDef(\"help-node-set\", { |freq = 440, out = 0|\n Out.ar(out, SinOsc.ar(freq, 0, 0.1))\n}).play\n);\nx.run(false);\nx.run; // default is true\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Impulse.ar(4, [0, MouseX.kr(0, 1)], 0.2 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Impulse.ar(4, [0, MouseX.kr(0, 1)], 0.2) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Fdef`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\ns.boot;\nSynthDef(\"gpdef\",\n { |out = 0, freq = 440, sustain = 0.05, amp = 0.1|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain), doneAction: Done.freeSelf) * amp;\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n// fork a thread that plays some sounds\n(\nFdef(\\freq, 440);\nFdef(\\dur, 0.2);\n\nfork {\n loop {\n s.sendMsg(\"/s_new\", \"gpdef\", -1, 1, 1, \\freq, Fdef(\\freq).value);\n Fdef(\\dur).value.wait;\n }\n};\n);\n\n// some modifications\n\nFdef(\\freq, Fdef(\\midinote, 60).midicps);\nFdef(\\midinote, { [67, 64, 65].choose });\nFdef(\\midinote, { [67, 64, 65].choose } + Fdef(\\offset));\nFdef(\\offset, { 4.rand });\nFdef(\\dur, 0.23);\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// For most cases the symmetric symplectic procedures with prefix 'sym' should be used (default 'sym2').\n// They deliver best results with regard to long-term stability, see links at top.\n// In case you suspect instability coming from numerics \n// you can take symplectic variants of higher order: \n// \\sym2, \\sym4, \\sym6, \\sym8, \\sym12, \\sym16, \\sym32, \\sym64.\n\n// Note that already a simple harmonic oscillator can fail with a standard procedure\n\n// This is decaying after a few seconds with classical Runge-Kutta 3rd order !\n// ATTENTION: with other non-symplectic procedures this can lead to immediate blow\n// …\n```"}, {"role": "assistant", "content": "For most cases the symmetric symplectic procedures with prefix 'sym' should be used (default 'sym2'). They deliver best results with regard to long-term stability, see links at top. (Fb1_ODE: general ordinary differential equation integrator pseudo ugen)"}]} +{"conversations": [{"role": "user", "content": "What is `COsc` in SuperCollider?"}, {"role": "assistant", "content": "COsc — Chorusing wavetable oscillator. Chorusing wavetable lookup oscillator. Produces sum of two signals at Category: UGens > Generators > Deterministic."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n b = {|x,y|\n var arr = List[];\n case\n {y % x.size == 0} // condition 1\n {\n var per = y / x.size;\n x.size.do{|oo|\n var pp = 1,i = 1;\n arr.add( x[oo] );\n while({i < per},{\n arr.add(0);\n i = i+1;\n });\n }\n }\n {x.size % y == 0} // condition 2\n {\n var pp = x.size / y, i = 0, sz = x.size;\n while({i < sz},{\n if(i % pp == 0)\n { arr.add(x[i]) };\n i=i+1;\n });\n };\n arr\n };\n a = [1,1,1,1];\n c = b.value(a,16) \n // [ 1, 1, 1, 1 ]\n // becomes\n // [ 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 ]\n\n b.value(c,4); \n // [ 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 ]\n // becomes\n // [ 1, 1, 1, 1 ]\n)\n```"}, {"role": "assistant", "content": "useful for expanding or reducing arrays by 2^x.\r\nI would like to know if there is a more concise way to write this!\r\nAny suggestions?\r\n\r\n(duplicate post, sorry! forgot to log in!)."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Ndef`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\nNdef(\\sound, { |freq = 56, numHarm = 10| Blip.ar(freq, numHarm, 30) * 0.2 }).play;\nNdef(\\sound).set(\\freq, 15);\nNdef(\\sound).set(\\freq, 15, \\numHarm, 100);\n\nNdef(\\lfo, { LFNoise2.kr(2).exprange(10, 200) });\nNdef(\\sound).map(\\numHarm, Ndef(\\lfo));\nNdef(\\sound).set(\\numHarm, nil); // unmap.\nNdef(\\sound).stop;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Dictionary.includesKey` do?"}, {"role": "assistant", "content": "Returns true if the specified item is stored in the Dictionary as a key. Element is checked for equality (not for identity). For identity matching see subclasses: IdentityDictionary or Event. `var d = Dictionary.newFrom([\"hey\", 1, \"hello\","}]} +{"conversations": [{"role": "user", "content": "What is the node tree and what is a Group for?"}, {"role": "assistant", "content": "Everything running on the server is a node: Synths and Groups, arranged in a tree under the root group. Order matters, because audio flows through buses from earlier to later nodes in the same branch. A Group is a container that lets you address many nodes at once, which is what you want for an effect chain — put the instruments in one group, the effect in another, and `freeAll` or a volume change hits the whole group instead of a list of node ids."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// vary frequency\n{ StandardN.ar(MouseX.kr(20, SampleRate.ir)) * 0.3 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// vary frequency\n{ StandardN.ar(MouseX.kr(20, SampleRate.ir)) * 0.3 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\smooth, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.linen(0.05, sustain, 0.1), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n)\n```"}, {"role": "assistant", "content": "plays an arpeggio on the \"left hand\" and an arpeggio on the \"right hand\"."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Very quick-and-dirty hack to show stereo phase. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\nb = Bus.audio(s, 2);\na = { |inbus = 0|\n var sig = In.ar(inbus, 2);\n // x axis is side, oriented toward right;\n // y axis is mid\n [sig[1] - sig[0], sig.sum]\n}.play(s.defaultGroup, outbus: b, addAction: \\addAfter);\nc = s.scope;\nc.style = 2;\nc.bus = b;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `ListView.stringColor` do? What arguments does it take?"}, {"role": "assistant", "content": "The color used to display all the text of all unselected Arguments: A Color.."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// A beautiful sc140 tweet by Batuhan Bozkurt, parametrized for real-time changes\n(\n// Start sound here\na = { | rateL = 5, rateR = 6, blipMul = 100, blipAdd = 50, fMul = 50, kMul = 1 |\n f = LocalIn.ar(2).tanh;\n k = Latch.kr(f[0].abs,Impulse.kr(1/4)) * kMul;\n LocalOut.ar(\n f +\n CombC.ar(Blip.ar([rateL, rateR], blipMul * k + blipAdd, 0.9), 1, k*0.3, fMul * f));f\n}.play\n);\n\n// Set parameters for changing sound here: \n\na.set(\\rateL, 10);\n\na.set(\\rateR, 8);\n\na.set(\\blipMul, 25);\n\na.set(\\blipAdd, 70);\n\na.set(\\fMul, 30);\n\n\na.set(\\kMul, 0.01);\n```"}, {"role": "assistant", "content": "A beautiful sc140 tweet by Batuhan Bozkurt, parametrized for real-time changes. To do: Add gui widgets for easier interactive control."}]} +{"conversations": [{"role": "user", "content": "What is `SubsampleOffset` in SuperCollider?"}, {"role": "assistant", "content": "SubsampleOffset — Offset from synth start within one sample. When a synth is created from a time stamped osc-bundle, it starts calculation at the next possible block (normally 64 samples). Using an OffsetOut UGen, one can delay the audio so that it matches sample accurately. Category: UGens > Info."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ExpRand`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-ExpRand\", { |out = 0|\n Out.ar(out,\n FSinOsc.ar(\n ExpRand(100.0, 8000.0),\n 0, Line.kr(0.2, 0, 0.01, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n(\nRoutine({\n inf.do({ |i|\n Synth.new(\"help-ExpRand\"); 0.05.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Sieve.-*` do? What arguments does it take?"}, {"role": "assistant", "content": "Binary operator for instance method dif_i. Creates a new Sieve object in mode 'intervals', generated by the difference of the receiver and a Arguments: gen — A generator. Allowed generators: Integers, Streams or Patterns producing intervals or Sieves itself. Integers and Stream/Pattern output must be strictly positive. Integers as generators produce zero and its positive multiples. Integer intervals might be collected up to default summation limit of 655."}]} +{"conversations": [{"role": "user", "content": "List of exit codes?"}, {"role": "assistant", "content": "SuperCollider forum — List of exit codes?\n\n7068696c:\n\n```supercollider\no = s.options;\no.inDevice = nil;\no.outDevice = \"ASIO : ASIO4ALL\";\n```\n\nHmmmm... In earlier SC versions, it wouldn’t have worked to have a nil input device in scsynth either (which is admittedly a problem for devices with no inputs). This was fixed in scsynth but it’s possible that it wasn’t fully fixed in supernova.\n\n@MarcinP – any thoughts about this? (I remember you worked on scsynth device selection but I don’t recall who ported that to supernova.)\n\nhjh"}]} +{"conversations": [{"role": "user", "content": "I get 'Node not found' when I call .set on a Synth after a while."}, {"role": "assistant", "content": "The Synth was freed and the language still holds a reference. That happens whenever the SynthDef used `doneAction: 2` and the envelope finished, or when something called `freeAll`/`CmdPeriod`. Guard it with `if (x.notNil and: { x.isPlaying }) { x.set(\\freq, 300) }`, or store the node in a variable that you clear when it ends. For sustained sounds the right pattern is a `gate` argument with `doneAction: 2` on the EnvGen, so the node lives until you release it."}]} +{"conversations": [{"role": "user", "content": "What does `AnnotatedDebugNodeWatcher.n_go` do? What arguments does it take?"}, {"role": "assistant", "content": "Watches server replies for node ended/started events using AbstractPlayer's Node annotation system Arguments: nodeID; groupID; prevID; nextID."}]} +{"conversations": [{"role": "user", "content": "What does `EnvelopedPlayer.didSpawn` do?"}, {"role": "assistant", "content": "takes a Player as input and plays it through an Env with fused protection"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.quit;\nf = { Group.new(s.defaultGroup); \"Other code can be evaluated too\".postln };\nServerTree.add(f);\ns.boot;\ns.queryAllNodes; // note the group within the default group\nServerTree.remove(f;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.quit;\nf = { Group.new(s.defaultGroup); \"Other code can be evaluated too\".postln };\nServerTree.add(f);\ns.boot;\ns.queryAllNodes; // note the group within the default group\nServerTree.remove(f);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nx = { |freq = 440| SinOsc.ar(freq, 0, 0.3) }.play; // this returns a Synth object;\nx.set(\\freq, 880); // note you can set the freq argument\nx.defName; // the name of the resulting SynthDef\nx.release(4; // fadeout over 4 seconds\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nx = { |freq = 440| SinOsc.ar(freq, 0, 0.3) }.play; // this returns a Synth object;\nx.set(\\freq, 880); // note you can set the freq argument\nx.defName; // the name of the resulting SynthDef\nx.release(4); // fadeout over 4 seconds\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SimpleNumber.cylNeumannPrime` do?"}, {"role": "assistant", "content": "Returns the first derivative with respect to x of the corresponding Neumann function. Requires `x >"}]} +{"conversations": [{"role": "user", "content": "What does `Pevent.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Provide an inval for an event stream. Arguments: pattern — pattern or stream that returns or modifies events.; event — an event with objects to embed. If none is provided, it uses Event#*default.."}]} +{"conversations": [{"role": "user", "content": "What does `CCBank.guiOne` do? What arguments does it take?"}, {"role": "assistant", "content": "a set of named MIDI CCResponders Arguments: layout; assc; minWidth."}]} +{"conversations": [{"role": "user", "content": "What does `Nil.notNil` do?"}, {"role": "assistant", "content": "Answer false. In class Object this message answers true. `[1, 2, nil,"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for UI sounds (pt1): bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n// UI sounds\n// this code is an attempt to recreate a sound\n// inspired from some technological/electrical UI interface\n\n// 1. first define the synth\n// Here we are using the FM technique\n(\nSynthDef(\\fmmod, {\n |\n amp=0.2,\n fc=1000,\n fm = 100,\n idx = 100,\n atk=0.01,\n rls=0.1\n |\n var env = EnvGen.ar(Env.perc(atk, rls), doneAction:2);\n var modulator = SinOsc.ar(fm);\n var carrier = SinOsc.ar(fc + (idx*modulator) );\n var sig = carrier * env * amp;\n sig = HPF.ar(sig, 1000);\n Out.ar(0, sig!2);\n}).add;\n);\n\n// 2. then define the Pbind which will play the sequence\n// of UI sounds simulating variuos characters showing up on an\n// imaginary display.\n// Play around FC, FM, ATK and RLS to obtain different sound characters.\n(\np = Pbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 100,\n \\idx, 100,\n \\amp, 0.6,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).asEventStreamPlayer;\n);\n\n// 3. play it\np.play;\n\n// 4. Here are some presets\n\n// \"cricket\" preset\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 100,\n \\idx, 100,\n \\amp, 0.6,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 2\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 1000,\n \\idx, 100,\n \\amp, 0.6,\n \\atk, 0.001,\n \\rls, 0.01,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 3\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 100,\n \\idx, 10,\n \\amp, 0.4,\n \\atk, 0.01,\n \\rls, 0.01,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 4\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 1000,\n \\fm, 100,\n \\idx, 1000,\n \\amp, 0.2,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n\n// preset 5\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 5000,\n \\fm, 1000,\n \\idx, 1000,\n \\amp, 0.4,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 5\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 8000,\n \\fm, 1000,\n \\idx, 1000,\n \\amp, 0.7,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nm = SimpleMIDIFile.read( \"~/Téléchargements/Super Mario Bros 2 - Mario Dreams.mid\" ); \n(\n TempoClock.default.tempo = m.tempo/60;\n Pdef(\\bla, \n Pbind(\n \\instrument, \\default,\n [\\midinote, \\dur, \\sustain, \\amp], Prout({ arg ev;\n var timescale = 1/16/60;\n var prevev;\n m.noteSustainEvents.collect({ arg item, idx;\n // [track, absTime, \\noteOn, channel, note, velo, dur, upVelo]\n if(idx == 0) {\n prevev = [item[4], item[1], item[6] * timescale, item[5]/127]\n } {\n prevev[1] = item[1] - prevev[1] * timescale;\n ev = prevev.yield;\n prevev = [item[4], item[1], item[6] * timescale, item[5]/127];\n };\n });\n prevev[1] = prevev[2];\n ev = prevev.yield;\n }),\n )\n ).play\n)\n```"}, {"role": "assistant", "content": "There is the .p method (see http://sccode.org/1-5aT) but here is also a way to retrieve the values directly."}]} +{"conversations": [{"role": "user", "content": "Write a warm pad in SuperCollider."}, {"role": "assistant", "content": "Detuned saws through a slow filter envelope and a long release: the detune is what makes it wide.\n\n```supercollider\n(\nSynthDef(\\pad, { |out = 0, freq = 220, amp = 0.15, gate = 1|\n var detune = [-0.06, -0.02, 0.02, 0.06];\n var sig = Mix(Saw.ar(freq * (1 + detune))) * 0.25;\n var env = EnvGen.kr(Env.adsr(1.2, 0.5, 0.7, 3), gate, doneAction: 2);\n var cutoff = SinOsc.kr(0.05).exprange(300, 2000);\n sig = RLPF.ar(sig, cutoff, 0.4);\n Out.ar(out, Splay.ar([sig, DelayN.ar(sig, 0.02, 0.012)]) * env * amp);\n}).add;\n);\n~pad = Synth(\\pad, [\\freq, 165]);\n~pad.set(\\gate, 0);\n```\n`gate` is what makes a sustained sound controllable: `\\gate, 0` releases it and `doneAction: 2` then\nfrees the Synth."}]} +{"conversations": [{"role": "user", "content": "What is the difference between an audio bus and a control bus?"}, {"role": "assistant", "content": "Both are numbered channels on the server used to move signal between nodes. An audio bus carries audio-rate signal and holds one or more audio channels; a control bus carries one value per block, like a parameter. You write with Out.ar / Out.kr and read with In.ar / In.kr, or with `.asMap` / `\\param, bus.asMap` to drive a Synth's control from a bus. Buses are how effects are chained: a synth writes to a private bus, the effect reads it and writes to Out.ar(0, …)."}]} +{"conversations": [{"role": "user", "content": "What does `PExpRand.new` do? What arguments does it take?"}, {"role": "assistant", "content": "UGenPatterns quark library Arguments: lo; hi; length — Number of values produced.."}]} +{"conversations": [{"role": "user", "content": "What does `View.fixedHeight` do? What arguments does it take?"}, {"role": "assistant", "content": "Set both minimum and maximum allowed height of the view, thus making it Arguments: height — An Int.."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DecodeB2`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var w, x, y, p, a, b, c, d;\n\n p = PinkNoise.ar; // source\n\n // B-format encode\n #w, x, y = PanB2.ar(p, MouseX.kr(-1, 1), 0.1);\n\n // B-format decode to quad\n #a, b, c, d = DecodeB2.ar(4, w, x, y);\n\n [a, b, d, c] // reorder to my speaker arrangement: Lf Rf Lr Rr\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `GVerb`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\n// CAUTION: THE FOLLOWING CAN BE EXTREMELY LOUD\n// set the following variable to true if you want to run this code\nvar run = false;\nif (run) {\n { GVerb.ar(Dust.ar(5), SinOsc.kr(0.3).range(10, 14), drylevel:0) }.play\n}\n// 3.13 super loud glitch (crackling)! 3.14: super loud glitch (cleaner pitch shifting)!\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `Latency` in SuperCollider briefly."}, {"role": "assistant", "content": "Latency — Measure audio latency for multiple channels Latency is the time delay between when one initiates something and when it happens. There are several places in the SC architecture where latencies occur: Category: Utilities."}]} +{"conversations": [{"role": "user", "content": "What does `AbstractPlayerProxy.defName` do?"}, {"role": "assistant", "content": "base class for players that act as proxies for another player"}]} +{"conversations": [{"role": "user", "content": "Explain `Pevent` in SuperCollider briefly."}, {"role": "assistant", "content": "Pevent — Provide an inval for an event stream. Category: Streams-Patterns-Events > Patterns."}]} +{"conversations": [{"role": "user", "content": "What does `EaseInOutQuart.value` do? What arguments does it take?"}, {"role": "assistant", "content": "Quartic ease-in/out Arguments: t — a Float between 0.0 and 1.0.."}]} +{"conversations": [{"role": "user", "content": "What does `RedHuffman.binaryStringToBytes` do?"}, {"role": "assistant", "content": "Converts a binary string into 8-bit bytes. Up to 7 zeros might be padded automatically at the end. The number of zeros is stored in #*pad. #*pad is semi-private and used when converting back to"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `GVerb`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\n// CAUTION: THE FOLLOWING CAN BE EXTREMELY LOUD\n// set the following variable to true if you want to run this code\nvar run = false;\nif (run) {\n { GVerb.ar(Dust.ar(5), SinOsc.kr(0.3).range(10, 14), drylevel:0) }.play\n}\n// 3.13 super loud glitch (crackling)! 3.14: super loud glitch (cleaner pitch shifting)!\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// example usage:\n// on machine running the server\n(\ns.options.bindAddress = \"0.0.0.0\"; // allow connections from any address\ns.options.maxLogins = 2; // set to correct number of clients\ns.boot;\n);\n\n// on remote machine connecting to server\n(\no = ServerOptions.new;\no.maxLogins = 2;\nt = Server.remote(\\remote, NetAddr(\"192.168.0.130\", 57110), o); // set to correct address and port\n// info about returned client ID should be posted in the post window\nt.makeWindow; // make a window for monitoring\n)\n\n// if you want to use the remote server without the need to explicitly pass it to e.g. Synth or Function\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// example usage:\n// on machine running the server\n(\ns.options.bindAddress = \"0.0.0.0\"; // allow connections from any address\ns.options.maxLogins = 2; // set to correct number of clients\ns.boot;\n);\n\n// on remote machine connecting to server\n(\no = ServerOptions.new;\no.maxLogins = 2;\nt = Server.remote(\\remote, NetAddr(\"192.168.0.130\", 57110), o); // set to correct address and port\n// info about returned client ID should be posted in the post window\nt.makeWindow; // make a window for monitoring\n)\n\n// if you want to use the remote server without the need to explicitly pass it to e.g. Synth or Function -play, set it to be the default server:\n//Server.default = t;\n\n//otherwise, make some sound on the remote server\n{Resonz.ar(Saw.ar([100,101]), Line.kr(100,5000,10, doneAction: 2),mul: -12.dbamp)}.play(target: t); //use target to specify the remote server\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nb = NodeProxy.audio(s, 2);\nb.play; // listen to b\nb.source = { SinOsc.ar([400, 500], 0, 0.1) }; // play something\n\nr = RecNodeProxy.newFrom(b);\nr.open(\"recproxy514.aif\"); // open file\nr.record; // start recorder (paused)\n\nr.unpause; // start recording\n\nb.source = { SinOsc.ar([430, 500], 0, 0.1) };\nb.source = { SinOsc.ar([410, 510], 0, 0.1) };\nb.source = { SinOsc.ar([LFNoise1.kr(80, 100, 300), 500], 0, 0.1) };\nr.pause;\nb.source = { Wh\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nb = NodeProxy.audio(s, 2);\nb.play; // listen to b\nb.source = { SinOsc.ar([400, 500], 0, 0.1) }; // play something\n\nr = RecNodeProxy.newFrom(b);\nr.open(\"recproxy514.aif\"); // open file\nr.record; // start recorder (paused)\n\nr.unpause; // start recording\n\nb.source = { SinOsc.ar([430, 500], 0, 0.1) };\nb.source = { SinOsc.ar([410, 510], 0, 0.1) };\nb.source = { SinOsc.ar([LFNoise1.kr(80, 100, 300), 500], 0, 0.1) };\nr.pause;\nb.source = { WhiteNoise.ar(0.01) };\nr.unpause;\nr.pause;\n\n\n// stop recording and close file\nr.close;\nb.stop; // stop listen to b\n```"}]} +{"conversations": [{"role": "user", "content": "What does `UGen.binaryValue` do?"}, {"role": "assistant", "content": "Outputs 1, representing true for positive, 0 representing false for negative or zero input"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\na = Ptime.new;\nx = a.asStream;\n);\n\nx.next;\nx.next;\nx.next;\n\n// post time in a playing event stream\n(\nPbind(\n \\pfunc, Ptime.new.trace,\n \\dur, Pseries(0.5, 0.5, 5)\n).play;\n);\n\n\n// change degree independant of number of events that have been playing\n\n(\nvar a, b;\na = Pbind(\n \\degree, Pswitch(#[0, 2b, 3], Ptime(8).round(2) / 2),\n \\dur, Prand(#[0.2, 0.5, 1.1, 0.25, 0.15], inf)\n);\nb = Pbind(\n \\degree, Pseq(#[0, 2b, 3], 1),\n \\dur, 2,\n// …\n```"}, {"role": "assistant", "content": "post time in a playing event stream change degree independant of number of events that have been playing (Ptime: returns time in beats from moment of embedding in stream)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\ns.scope;\na = { Hilbert.ar(SinOsc.ar(100) * -20.dbamp }.play;\na.release;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\ns.scope;\na = { Hilbert.ar(SinOsc.ar(100)) * -20.dbamp }.play;\na.release;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `BufWr` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\n// allocate a buffer for writinig into\ns = Server.local;\ns.sendMsg(\"/b_alloc\", 0, 44100 * 2);\n);\n\n\n// write into the buffer with a BufWr\n(\ny = { |rate = 1|\n var in;\n in = SinOsc.ar(LFNoise1.kr(2, 300, 400), 0, 0.1);\n BufWr.ar(in, 0, Phasor.ar(0, BufRateScale.kr(0) * rate, 0, BufFrames.kr(0)));\n 0.0 // quiet\n}.play;\n);\n\n// read it with a BufRd\n(\nx = { |rate = 1|\n BufRd.ar(1, 0, Phasor.ar(0, BufRateScale.kr(0) * rate, 0, BufFrames.kr(0)))\n}.play(s);\n);\n\n\n\nx.set(\\rate, 5);\ny.set(\\rate, 2.0.rand);\nx.set(\\rate, 2);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// randomly modulate all params\n(\n{ LatoocarfianC.ar(\n SampleRate.ir/4,\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5)\n) * 0.2 }.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// randomly modulate all params\n(\n{ LatoocarfianC.ar(\n SampleRate.ir/4,\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5)\n) * 0.2 }.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `List`."}, {"role": "assistant", "content": "```supercollider\n(\n// Create a new empty List with size: 3\nx = List.new(3);\n\nx.postln; // -> List[ ]\n\n// Add numbers 0 to 4 to the List\n5.do({ |i| x.add(i) });\n\n// The list has been modified in-place with each added item\nx.postln; // -> List[ 0, 1, 2, 3, 4 ]\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `StreamKrDurGui` in SuperCollider briefly."}, {"role": "assistant", "content": "StreamKrDurGui — gui class Category: Libraries > crucial > GuiClasses."}]} +{"conversations": [{"role": "user", "content": "What does `Font.pixelSize` do? What arguments does it take?"}, {"role": "assistant", "content": "Gets or sets the pixel-size of the font. When getting, returns nil if the font has point-size instead. See #-hasPointSize for Arguments: Any number, but note that floats will be rounded to integer values when setting pixel-size.."}]} +{"conversations": [{"role": "user", "content": "What does `RedMixerChannel.peaks` do?"}, {"role": "assistant", "content": "Array with maximum amplitudes. Clear with"}]} +{"conversations": [{"role": "user", "content": "What is `EZRanger` in SuperCollider?"}, {"role": "assistant", "content": "EZRanger — A wrapper class for a label, a rangeslider, and numberboxes EZRanger is wrapper class which creates an (optional) StaticText, and a RangeSlider plus a NumberBox. If the parent is `nil`, then EZRanger will create its own window. See EZGui more options. Category: GUI > EZ-GUI."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// proceed with caution. start at min volume, and not with your expensive speakers.\n\nfork{b=Buffer.alloc(s,512,1);inf.do{b.cheby({[1,0].choose}!2);{(Shaper.ar(b,SinOsc.ar(55,0,Line.kr(1,0,2,1,0,2))))!2}.play;0.1.wait;}};\n```"}, {"role": "assistant", "content": "can anyone tell me what the loud click is, and how to control it?\r\n\r\ni kind of really like it, but it sounds scary, \r\n\r\nand the resulting waveform is bizarre, too.\r\n\r\n[http://soundcloud.com/tengototen/m-chtegern-ikeda](http://soundcloud.com/tengototen/m-chtegern-ikeda)\r\n\r\n\r\nupdate: some discussion, and lots of interesting things to try out, [on the list](http://new-supercollider-mailing-lists-foru."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Play it with the mouse\n{DFM1.ar(PinkNoise.ar(mul: 0.5), MouseX.kr(80, 5000, 'exponential'), MouseY.kr(0.1, 1.2))}.play;\n\n// Throbby bass\n{DFM1.ar(Pulse.ar(100, mul:0.4) + Pulse.ar(100.1, mul:0.4), SinOsc.kr(SinOsc.kr(0.3).range(0.2, 5)).range(80, 2000), 1.1, inputgain: 2.0, mul:0.7!2}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Play it with the mouse\n{DFM1.ar(PinkNoise.ar(mul: 0.5), MouseX.kr(80, 5000, 'exponential'), MouseY.kr(0.1, 1.2))}.play;\n\n// Throbby bass\n{DFM1.ar(Pulse.ar(100, mul:0.4) + Pulse.ar(100.1, mul:0.4), SinOsc.kr(SinOsc.kr(0.3).range(0.2, 5)).range(80, 2000), 1.1, inputgain: 2.0, mul:0.7)!2}.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n/* Audio plugin definition\n\n Each audio plugin should define the following global variables:\n ~name: (symbol) name of the spatializer\n ~description: (string) a short description\n ~function: the actual definition of the plugin\n\n*/\n\n~name = \\emptySource;\n~description = \"dummy/template\";\n~channelLayout = \\mono;\n\n~function = {\n DC.ar(0);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "What does `PopUpMenu.action` do?"}, {"role": "assistant", "content": "The action object evaluated whenever the user changes the selected item from the menu. See #-allowsReselection for"}]} +{"conversations": [{"role": "user", "content": "What does `AbstractSController.new` do? What arguments does it take?"}, {"role": "assistant", "content": "an abstract class for all sInstrument controllers Arguments: numChannels — number of internal control rate channels.; target — used to figure out which server to use for the internal bus and synth. if CODEnil then the default (localhost) server will be used.; args — extra arguments as an LINKClasses/Array with key/value pairs.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// This can go towards granulation\n\n// load sound file\n\nb = Buffer.read(s, Platform.miSCellaneousDirs[0] +/+ \"Sounds\" +/+ \"kitchen_sounds_1.wav\");\n\n\n// switch between looping PlayBufs\n\n(\nx = {\n var sig = {\n DXMix.ar(\n Dxrand([0, 1, 2], inf),\n `(PlayBuf.ar(1, b, BufRateScale.kr(b) * [0.4, 1, 2.2], loop: 1)),\n stepTime: 0.2,\n fadeTime: 0.01,\n fadeMode: 1,\n width: 2\n ) } ! 2;\n // do a bit correlation\n Splay.ar(sig, 0.8\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// This can go towards granulation\n\n// load sound file\n\nb = Buffer.read(s, Platform.miSCellaneousDirs[0] +/+ \"Sounds\" +/+ \"kitchen_sounds_1.wav\");\n\n\n// switch between looping PlayBufs\n\n(\nx = {\n var sig = {\n DXMix.ar(\n Dxrand([0, 1, 2], inf),\n `(PlayBuf.ar(1, b, BufRateScale.kr(b) * [0.4, 1, 2.2], loop: 1)),\n stepTime: 0.2,\n fadeTime: 0.01,\n fadeMode: 1,\n width: 2\n ) } ! 2;\n // do a bit correlation\n Splay.ar(sig, 0.8)\n}.play\n);\n\nx.release\n```"}]} +{"conversations": [{"role": "user", "content": "What does `LID.slots` do?"}, {"role": "assistant", "content": "An IdentityDictionary holding all the slots, i.e. controls, of the"}]} +{"conversations": [{"role": "user", "content": "How do I get a Euclidean-style rhythm in SuperCollider?"}, {"role": "assistant", "content": "Describe the pattern as a list of hits and rests; `Rest` gives the gap without starting a Synth.\n\n```supercollider\n(\nPbind(\n \\instrument, \\hat,\n \\dur, 0.125,\n \\amp, Pseq([0.3, 0, 0, 0.3, 0, 0.3, 0, 0], inf).collect { |x| x + 0.001 }\n).play;\n)\n```\n\nFor real Euclidean generation use `Pseq([1,0,0,1,0,1,0,0], inf)` on a duration multiplier and wrap rests\nwith `Rest`, or compute the pattern with `bjorklund`-style logic in a Function and `Pseq` the result."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\nb = Buffer.alloc(s, 100);\nb.zero;\nb.set(33, 1.034);\n// This should detect the 33rd value as the highest...\nx = {BufMax.kr(b).poll}.play;\n\n// ...until we set a new winner...\nb.set(74, 1.038;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\nb = Buffer.alloc(s, 100);\nb.zero;\nb.set(33, 1.034);\n// This should detect the 33rd value as the highest...\nx = {BufMax.kr(b).poll}.play;\n\n// ...until we set a new winner...\nb.set(74, 1.038);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Hasher`."}, {"role": "assistant", "content": "```supercollider\n{ Hasher.ar(Line.ar(0, 1, 1), 0.2) }.play;\n\n// Even adding a small amount to the input can result in a very different output. Compare these two examples:\n(\n{\n SinOsc.ar(\n Hasher.kr(MouseX.kr(0, 10).round(1), 300, 500)\n ) * 0.1\n}.play;\n);\n\n(\n{\n SinOsc.ar(\n Hasher.kr(MouseX.kr(0, 10).round(1) + 0.0001, 300, 500)\n ) * 0.1\n}.play;\n);\n\n// Output stays constant while not moving the mouse.\n(\n{\n SinOsc.ar(\n Hasher.kr(MouseX.kr(0, 10), 300, 500)\n ) * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Pulse`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\\harpsi, { |outbus = 0, freq = 440, amp = 0.1, gate = 1|\n var out;\n out = EnvGen.ar(Env.adsr, gate, doneAction: Done.freeSelf) * amp *\n Pulse.ar(freq, 0.25, 0.75);\n Out.ar(outbus, out ! 2);\n}).add; // see below for more on .add\n\np = Pbind(\n // Use \\harpsi, not \\default\n \\instrument, \\harpsi,\n \\degree, Pseries(0, 1, 8),\n \\dur, 0.25\n).play;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\HOABinaural;\n~description = \"Binaural decoder using the HOABinaural class from SC-HOA\";\n\n~function = { |in = 0, order|\n HOABinaural.ar(\n order: order,\n in: in\n );\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "What does `Buffer.updateInfo` do? What arguments does it take?"}, {"role": "assistant", "content": "Sends a b_query message to the server, asking for a description of this buffer. Upon reply this Buffer's instance variables are automatically Arguments: action — A Function to be evaluated once the file has been read and this Buffer's instance variables have been updated. The function will be passed this Buffer as an argument.."}]} +{"conversations": [{"role": "user", "content": "What does `SerialPort.next` do?"}, {"role": "assistant", "content": "Read a byte from the device. Non-blocking"}]} +{"conversations": [{"role": "user", "content": "What does `PappliedInstr.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "partial application for Instr Arguments: ... args."}]} +{"conversations": [{"role": "user", "content": "What does `MultiplePlayers.children` do?"}, {"role": "assistant", "content": "parent class for players that have multiple tracks / voices"}]} +{"conversations": [{"role": "user", "content": "What does `Cyton.uVScale` do?"}, {"role": "assistant", "content": "A Float scaling factor used internally to convert from 24bit to microvolt (uV). This factor differ for each"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nNdef(\\birdy, {arg freq=1500, amp=0.5, rate=10;\n var osc, son, convIn, rand;\n osc=LFCub;\n rand = LFNoise1.ar(rate);\n convIn=LinCongN.ar(rate);\n son = osc.ar(Convolution.ar(convIn,convIn));\n freq = Latch.kr(rand.range(0,1).round(0.1), rand) * freq;\n freq = osc.ar(osc.ar(rand)*rand.range(0,10)).range(freq, freq*3);\n son = Formlet.ar(son, freq, convIn.abs*0.1, rand.abs);\n son = Normalizer.ar(son, 0.9, 0.1) * convIn.abs * LFPulse.kr(LFPulse.kr(rand.abs), 0, rand.abs);\n son = son + GVerb.ar(son, 99, 2, mul: rand.range(0,0.3));\n son * amp\n}).play\n)\n```"}, {"role": "assistant", "content": "I just rewrote one of autocsi's tweets and came out with this which sounds like a digital bird of some kind:."}]} +{"conversations": [{"role": "user", "content": "Explain `Fhn2DN` in SuperCollider briefly."}, {"role": "assistant", "content": "Fhn2DN — FitzHughNagumo Neuron Firing Oscillator `du/dt= rateu*(u-0.3333*u^3 - w)` Category: UGens > Generators > Stochastic."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot\n\n{ Ringz.ar(PinkNoise.ar([0.1, 0.2]).scope(\\pink), 2000, 1, 0.25 }.play; // multichannel works\ns.scope; // can still separately scope the output of the server\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot\n\n{ Ringz.ar(PinkNoise.ar([0.1, 0.2]).scope(\\pink), 2000, 1, 0.25) }.play; // multichannel works\ns.scope; // can still separately scope the output of the server\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Document.keyUpAction` do? What arguments does it take?"}, {"role": "assistant", "content": "Get/set the action to be performed on Arguments: action — An instance of Function or FunctionList. The arguments passed to the function are: `document`, `char`, `modifiers`, `unicode`, `keycode`. See View#Key actions for details on these arguments.."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `SelectXFocus` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a;\n a = [\n Saw.ar(LFSaw.kr(3 * [1, 1.01], 0, 100, 230)),\n SinOsc.ar,\n Pulse.ar(LFPulse.kr(3 * [1, 1.02], 0, 0.4, 100, 230)),\n SinOsc.ar(SinOsc.kr(4 * [1, 1.03], 0, 200, 300))\n ];\n\n SelectXFocus.ar(MouseX.kr(0, 1) * a.size, a, MouseY.kr(0, a.size)) * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Are you an AI?"}, {"role": "assistant", "content": "Yes. I am a small language model specialised in SuperCollider. I generate text; I cannot hear audio, run sclang, or check whether a patch sounds the way you want."}]} +{"conversations": [{"role": "user", "content": "Which keys does a Pbind understand?"}, {"role": "assistant", "content": "The ones you use constantly are \\instrument (a SynthDef name), \\dur (seconds), \\degree (scale degree), \\midinote, \\freq, \\amp, \\legato (note length as a fraction of \\dur), and \\scale plus \\root for the scale used by \\degree. Everything else is passed to the Synth as an argument, so a SynthDef with `|cutoff = 800|` can be driven by `\\cutoff, Pwhite(400, 4000)`."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// \\b should thus take twice the value of \\a in each event:\np = Pbind(\\a, Pwhite(1, 10, inf), \\b, Pkey(\\a) * 2).asStream;\n\n\np.next(()) // for Pbind, must pass in a default event even if empty\n\n('a': 10, 'b': 20)\n('a': 2, 'b': 4)\n('a': 5, 'b': 10)\n('a': 4, 'b': 8)\n('a': 2, 'b': 4)\n\n// note: to check if a Pkey's result /equals/ another value,\n// be sure to use |==|\np = Pbind(\n \\a, Pseries(1, 1, inf),\n \\b, Pif(\n Pkey(\\a) == 2,\n \"equals 2\",\n \"nope\"\n )\n).asStream;\n\np.next(());\n// …\n```"}, {"role": "assistant", "content": "\\b should thus take twice the value of \\a in each event: note: to check if a Pkey's result /equals/ another value, (Pkey: access a key in an event stream)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a, b;\na = Pwrand.new([1, 2, 3], [1, 3, 5].normalizeSum, 6); // return 6 items\nb = a.asStream;\n7.do({ b.next.postln });\n);\n\n// Prand used as a sequence of pitches:\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n(\na = Pwrand([60, 61, 63, 65, 72], [10, 2\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a, b;\na = Pwrand.new([1, 2, 3], [1, 3, 5].normalizeSum, 6); // return 6 items\nb = a.asStream;\n7.do({ b.next.postln });\n);\n\n// Prand used as a sequence of pitches:\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n(\na = Pwrand([60, 61, 63, 65, 72], [10, 2, 3, 1, 3].normalizeSum, inf).asStream;\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, a.next.midicps]);\n 0.1.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `ProxySynthDef`?"}, {"role": "assistant", "content": "ProxySynthDef — synth def that wraps ugen graph"}, {"role": "user", "content": "What does `ProxySynthDef.sampleAccurate` do?"}, {"role": "assistant", "content": "always use OffsetOut, if set to true (default: false)"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na = ProxySynthDef(\"xtest\", { SinOsc.ar(400) * 0.1 });\n\na.add;\n\nx = Synth(\"xtest\");\nx.release;\n\n\n/*\n\n if the resulting number of channels is larger than a given channelConstraint,\n it behaves according to the rate: audio rate signals are wrapped around\n a smaller channel size, control rate signals are not (the exceeding channels are left out)\n\n*/\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = NodeProxy(s); a.play;\na.source = { Splay.ar(Blip.ar(\\freq.kr(18 ! 4))) * 0.2 };\na.set(\\freq, [1, 3, 56, 13]);\na.source = { Splay.ar(SinOsc.ar(LFSaw.ar(\\freq.kr(18 ! 4)) * 250 + 400)) * 0.2 };\nb = NodeProxy(s); b.source = { MouseX.kr(0, 3) * [1, 3, 56, 13] };\na.set(\\freq, b;\na.clear; b.clear;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = NodeProxy(s); a.play;\na.source = { Splay.ar(Blip.ar(\\freq.kr(18 ! 4))) * 0.2 };\na.set(\\freq, [1, 3, 56, 13]);\na.source = { Splay.ar(SinOsc.ar(LFSaw.ar(\\freq.kr(18 ! 4)) * 250 + 400)) * 0.2 };\nb = NodeProxy(s); b.source = { MouseX.kr(0, 3) * [1, 3, 56, 13] };\na.set(\\freq, b);\na.clear; b.clear;\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `DiskIn`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n\n\n// create with cueSoundFile class method\nb = Buffer.cueSoundFile(s, ExampleFiles.apollo11, 0, 1);\nx = { DiskIn.ar(1, b) }.play;\nb.close; // must call close in between cueing\n// now use like named instance method, but different arguments\nb.cueSoundFile(ExampleFiles.apollo11);\n// have to do all this to clean up properly!\nx.free; b.close; b.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `ListView.enterKeyAction` do?"}, {"role": "assistant", "content": "The action object evaluated whenever the user presses the Enter (Return)"}]} +{"conversations": [{"role": "user", "content": "What does `Window.removeFromOnClose` do?"}, {"role": "assistant", "content": "Removes an object from #-onClose, if the latter is an"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `CoinGate`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\na = SynthDef(\"help-TCoin\", { |out = 0, prob = 0.5|\n var trig;\n trig = CoinGate.kr(prob, Impulse.kr(10));\n Out.ar(out,\n SinOsc.ar(\n TRand.kr(300.0, 400.0, trig), 0, 0.2\n )\n )\n}).play;\n);\n\na.set(\\prob, 1.0);\na.set(\\prob, 0.0);\na.set(\\prob, 0.1);\n\n\n(\na = SynthDef(\"help-TCoin\", { |out = 0, prob = 0.5|\n var trig;\n trig = Impulse.ar(20, 0, SinOsc.kr(0.5, 0, 1, 1));\n Out.ar(out,\n Mix.fill(3, { Ringz.ar(CoinGate.ar(prob, trig*0.5), #[1, 1.5]*Rand(1000, 9000), 0.01) })\n )\n}).play;\n);\n\na.set(\\prob, 1.0);\na.set(\\prob, 0.0);\na.set(\\prob, 0.1);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ DynKlank.ar(`[[800, 1071, 1153, 1723], nil, [1, 1, 1, 1]], Impulse.ar(2, 0, 0.1)) }.play;\n\n{ DynKlank.ar(`[[800, 1071, 1353, 1723], nil, [1, 1, 1, 1]], Dust.ar(8, 0.1)) }.play;\n\n{ DynKlank.ar(`[[800, 1071, 1353, 1723], nil, [1, 1, 1, 1]], PinkNoise.ar(0.007)) }.play;\n\n{ DynKlank.ar(`[[200, 671, 1153, 1723], nil, [1, 1, 1, 1]], PinkNoise.ar([0.007, 0.007]) }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ DynKlank.ar(`[[800, 1071, 1153, 1723], nil, [1, 1, 1, 1]], Impulse.ar(2, 0, 0.1)) }.play;\n\n{ DynKlank.ar(`[[800, 1071, 1353, 1723], nil, [1, 1, 1, 1]], Dust.ar(8, 0.1)) }.play;\n\n{ DynKlank.ar(`[[800, 1071, 1353, 1723], nil, [1, 1, 1, 1]], PinkNoise.ar(0.007)) }.play;\n\n{ DynKlank.ar(`[[200, 671, 1153, 1723], nil, [1, 1, 1, 1]], PinkNoise.ar([0.007, 0.007])) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `FlowLayout.left` do? What arguments does it take?"}, {"role": "assistant", "content": "Get the current left indentation or manually set Arguments: arg1 — A number.."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `SyncSaw` that runs as it is."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n(\n// send a synth def to server\nSynthDef(\"tpulse\", { arg out=0,freq=700,sawFreq=440.0;\n Out.ar(out, SyncSaw.ar(freq, sawFreq,0.1) )\n}).send(s);\n);\n\n// all OSC commands generated in the function contained below will be added to a bundle\n// and executed simultaneously after 2 seconds.\n(\ns.makeBundle(2.0, {\n x = Synth.new(\"tpulse\");\n a = Bus.control.set(440);\n x.map(\\freq, a);\n});\n);\nx.free;\n\n// don't send\n(\nb = s.makeBundle(false, {\n x = { PinkNoise.ar(0.1) * In.kr(0, 1); }.play;\n});\n);\n// now pass b as a pre-existing bundle, and start both synths synchronously\n(\ns.makeBundle(nil, { // nil executes ASAP\n y = { SinOsc.kr(0.2).abs }.play(x, 0, 0, \\addBefore); // sine envelope\n}, b);\n);\nx.free; y.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// set() creates a local environment that overrides the outer currentEnvironment\n\nPdefn(\\z).set(\\a, 1, \\b, 5);\n(\nPdefn(\\z, { |e|\n loop { yield((e.a + e.b) + 0.1.rand.round(0.01)) }\n})\n); // [1]\n\nt = Pdefn(\\z).asStream;\n\nt.nextN(3);\n\n(\nPdefn(\\z, { |e|\n // (e.a + e.b) + 0.1.rand.round(0.01) 1\n Pseq([1, 2, e.a], 1)\n})\n);\n\nPdefn(\\z, Pseq([1, 2, 3], 1));\n\ne = Pdefn(\\z).envir\n\n\nPdefn(\\z).set(\\a, 3);\n\nt.next\n// …\n```"}, {"role": "assistant", "content": "set() creates a local environment that overrides the outer currentEnvironment (e.a + e.b) + 0.1.rand.round(0.01) 1 (Pdefn: non event stream reference definition)"}]} +{"conversations": [{"role": "user", "content": "Explain `Dgeom` in SuperCollider briefly."}, {"role": "assistant", "content": "Dgeom — Demand rate geometric series UGen. Category: UGens > Demand."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `LPF`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\\default, { arg out=0, freq=440, amp=0.1, pan=0, gate=1;\n var z;\n z = LPF.ar(\n Mix.new(VarSaw.ar(freq + [0, Rand(-0.4,0.0), Rand(0.0,0.4)], 0, 0.3)),\n XLine.kr(Rand(4000,5000), Rand(2500,3200), 1)\n ) * Linen.kr(gate, 0.01, 0.7, 0.3, 2);\n OffsetOut.ar(out, Pan2.ar(z, pan, amp));\n}, [\\ir]);\n```"}]} {"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n\n~remapConfig = IdentityDictionary[\n 0 -> 1,\n 1 -> 2,\n 2 -> 3,\n 3 -> 4,\n 4 -> 5,\n 5 -> 6,\n 6 -> 7,\n 7 -> 8,\n 8 -> 9,\n 9 -> 12,\n 10 -> 13,\n 11 -> 14,\n 12 -> 15,\n 13 -> 16,\n 14 -> 17\n];\n\n\n~generateRemapSynthDef = { |numInputChannels, numOutputChannels|\n SynthDef(\\remapOutputs, {\n var sig = In.ar(0, numInputChannels); \n var remapped = Array.fill(numOutputChannels, { Silent.ar(1) }); \n\n ~remapConfig.keysValuesDo { |src, dest|\n if (src < numInputChannels and: { dest < numOutputChannels }) {\n remapped[dest] = sig[src];\n }\n };\n\n ReplaceOut.ar(0, remapped);\n }).add;\n};\n\n~generateRemapSynthDef.(16, 18); \n);\n\n(\n~createRemapSynth = {\n ~remapSynth = Synth(\\remapOutputs, target: s.defaultGroup, addAction: \\addAfter);\n};\n\nServerTree.add( ~createRemapSynth);\n\n)\n```"}, {"role": "assistant", "content": "This code sets up a remapping system where input channels are mapped to output channels based on a predefined configuration. The remapping is done using a SynthDef that reads input signals, applies the remapping, and outputs the remapped signals. The ServerTree.add ensures that the remap synth is created and added to the server's node tree upon server startup and cmd-. and ctrl-.\r\n\r\nBased on discu."}]} -{"conversations": [{"role": "user", "content": "What is `PBlip` in SuperCollider?"}, {"role": "assistant", "content": "PBlip — UGenPatterns quark library Based on Blip Category: Streams-Patterns-Events > UGenPatterns > Generators."}]} -{"conversations": [{"role": "user", "content": "What does `Pen.rotate` do?"}, {"role": "assistant", "content": "Rotates subsequent drawing around the Point `x@y` by the amount angle in radians"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SerialPort`."}, {"role": "assistant", "content": "```supercollider\n(\np = SerialPort(\n \"/dev/tty.usbserial-A800crTT\", // edit to match your port. SerialPort.listDevices\n baudrate: 9600, // check that baudrate is the same as in arduino sketch\n crtscts: true);\n);\n\n// send serial data - slow pulsating\n(\nr = Routine({\n inf.do{ |i|\n p.put(i.fold(0, 100).linexp(0, 100, 1, 255).asInteger.postln);\n 0.02.wait;\n };\n}).play;\n);\n\nr.stop;\np.close;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `ScopeView.yZoom` do? What arguments does it take?"}, {"role": "assistant", "content": "The scaling factor on the vertical Arguments: A Float.."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for load all files for the hyperdisco setup."}, {"role": "assistant", "content": "```supercollider\n//// load all files for the hyperdisco setup.\n\nq = q ? ();\nq.hyperfolder = q.hyperfolder ?? { thisProcess.nowExecutingPath.dirname };\n\n(q.hyperfolder +/+ \"libs/_SynthLib.scd\").loadPaths;\n(q.hyperfolder +/+ \"libs/_FXLib.scd\").loadPaths;\n(q.hyperfolder +/+ \"setup_files/2_makeHistory.scd\").loadPaths;\n\nif (Platform.hasQt) {\n (q.hyperfolder +/+ \"setup_files/1a_Butz.scd\").loadPaths;\n (q.hyperfolder +/+ \"setup_files/1b_winbounds.scd\").loadPaths;\n (q.hyperfolder +/+ \"setup_files/2b_makeHistoryGUI.scd\").loadPaths;\n};\n\n// this may be too harsh - comment out if not needed!\nServer.killAll;\n\nTask {\n try { (q.hyperfolder +/+ \"setup_files/1_logMeIn.scd\").loadPaths } {\n \"*** setup_files/1_logMeIn.scd failed!\".postln;\n };\n 1.wait;\n\n (q.hyperfolder +/+ \"setup_files/3_runCode*.scd\").loadPaths;\n\n // this could be problematic,\n if (Platform.hasQt) {\n // maybe we need a non-doc- SyncText version?\n (q.hyperfolder +/+ \"setup_files/4_makeSyncedEditor.scd\").loadPaths;\n // sent drawing code will just be ignored ...\n /// would be nice if it did get shown!\n (q.hyperfolder +/+ \"setup_files/5_drawer.scd\").loadPaths;\n };\n\n s.options.memSize = (2 ** 18).asInteger;\n s.waitForBoot {\n s.sync;\n (q.hyperfolder +/+ \"setup_files/6_HyperMasterFX.scd\").loadPaths;\n };\n\n}.play(AppClock);\n```"}]} -{"conversations": [{"role": "user", "content": "How do I make a delay line?"}, {"role": "assistant", "content": "`CombN.ar(in, maxdelaytime, delaytime, decaytime)` is a feedback delay: maxdelaytime is the buffer size, delaytime the actual delay (and it can modulate), decaytime how long the repeats take to die. For a clean single echo use `DelayN.ar(in, maxdelaytime, delaytime)`, which has no feedback. Both replace the `in` with the delayed signal, so mix with the dry: `dry + CombN.ar(dry, 0.5, 0.3, 2) * 0.4`."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DelayC`."}, {"role": "assistant", "content": "```supercollider\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nDelayC.ar(z, 0.2, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\n(\n// recursive application of delay.\n{\nz = Decay2.ar(Dust.ar(1, 0.5), 0.01, 0.1, Saw.ar(100 + [0, 1]));\n5.do { |i| z = DelayC.ar(RLPF.ar(z, Rand(100, 3000), 0.03), 1, 1 / (2**i), 1, z * 0.5) };\nz\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SimpleDMX.getUniverse` do? What arguments does it take?"}, {"role": "assistant", "content": "returns the `SimpleDMXUniverse` with the given `universeId`. If no such universe exists, returns Arguments: id — the `universeId` of the universe to return.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nx = { |gate = 1| BrownNoise.ar(0.5) * EnvGen.kr(Env.cutoff(1), gate, doneAction: Done.freeSelf) }.play;\nx.release(5; // override the Env's specified 1 second release time\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nx = { |gate = 1| BrownNoise.ar(0.5) * EnvGen.kr(Env.cutoff(1), gate, doneAction: Done.freeSelf) }.play;\nx.release(5); // override the Env's specified 1 second release time\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Standard2DC.ar(220, 11025, mul:0.3) }.play(s);\n\n// mouse-controlled param\n{ Standard2DC.ar(8000, 20000, MouseX.kr(0.9,4), mul:0.3) }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(Standard2DC.ar(10, 20, MouseX.kr(0.9,4))*800+900)*0.4 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Standard2DC.ar(220, 11025, mul:0.3) }.play(s);\n\n// mouse-controlled param\n{ Standard2DC.ar(8000, 20000, MouseX.kr(0.9,4), mul:0.3) }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(Standard2DC.ar(10, 20, MouseX.kr(0.9,4))*800+900)*0.4 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a granular texture in SuperCollider."}, {"role": "assistant", "content": "Read a sound file into a buffer, then trigger grains from it. Grain density is the Impulse rate and\ngrain length is dur; keep the density times the length under maxGrains or raise it.\n\n```supercollider\n(\ns.waitForBoot {\n ~buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n SynthDef(\\grain, { |out = 0, amp = 0.4, density = 30, dur = 0.08|\n var trig = Impulse.kr(density);\n var sig = GrainBuf.ar(2, trig, dur, ~buf, 1, LFNoise0.kr(2).range(0, 1), 2, 0, -1, 512);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n Synth(\\grain);\n};\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DynKlang`."}, {"role": "assistant", "content": "```supercollider\n// frequency modulation\n(\nplay {\n DynKlang.ar(`[\n [800, 1000, 1200] + SinOsc.kr([2, 3, 4.2], 0, [13, 24, 12]),\n [0.3, 0.3, 0.3],\n [pi, pi, pi]\n ]\n) * 0.1\n};\n);\n\n\n// building new synths every 2 seconds\n(\nfork {\n loop {\n play {\n var mod = SinOsc.kr(Rand(0.1, 0.9), 0, Rand(5, 20));\n Pan2.ar(DynKlang.ar(`[Array.rand(12, 200.0, 2000.0), 1, mod]), 1.0.rand)\n * EnvGen.kr(Env.sine(4), 1, 0.02, doneAction: Done.freeSelf)\n };\n 2.wait;\n }\n}\n);\n\n\n// resetting the frequencies and amplitudes after the synth has been created\n(\nSynthDef('help-dynKlang', { |out,\n freqs = #[220, 440, 880, 1760],\n amps = #[0.35, 0.23, 0.12, 0.05],\n phases = #[1, 1.5, 2, 2.5]|\n\n Out.ar(out, DynKlang.ar(`[freqs, amps, phases]))\n}).add\n);\n\na = Synth('help-dynKlang');\n\na.setn(\\freqs, Array.rand(4, 500, 2000));\na.setn(\\amps, Array.rand(4, 0.01, 0.25));\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\\conv_test, { |out, kernel, t_trig = 0|\n var input = Impulse.ar(1);\n var framesize = 2048; // must have power of two\n var result = Convolution2L.ar(input, kernel, t_trig, framesize, 1, 0.5);\n Out.ar(out, result);\n}).add\n);\n\nx = Synth(\\conv_test, [\\kernel, b]);\n\n// changing the buffer number:\nx.set(\\kernel, c);\nx.set(\\t_trig, 1); // after this trigger, the change will take effect.\nx.set(\\kernel, d);\nx.set(\\t_trig, 1); // after this trigger, the change will take effect.\n\nd.zero;\n40.do {\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\\conv_test, { |out, kernel, t_trig = 0|\n var input = Impulse.ar(1);\n var framesize = 2048; // must have power of two\n var result = Convolution2L.ar(input, kernel, t_trig, framesize, 1, 0.5);\n Out.ar(out, result);\n}).add\n);\n\nx = Synth(\\conv_test, [\\kernel, b]);\n\n// changing the buffer number:\nx.set(\\kernel, c);\nx.set(\\t_trig, 1); // after this trigger, the change will take effect.\nx.set(\\kernel, d);\nx.set(\\t_trig, 1); // after this trigger, the change will take effect.\n\nd.zero;\n40.do { |it| d.set(20 * it + 10, 1) }; // changing the buffers' contents\nx.set(\\t_trig, 1); // after this trigger, the change will take effect.\n\nx.set(\\kernel, b);\nx.set(\\t_trig, 1); // after this trigger, the change will take effect.\n\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Midterm Q2 (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"sawSynth\",{arg freq, amp;\n var env, snd;\n\n env = Env.perc(\n attackTime:0.1,\n releaseTime:2,\n level:amp).kr(doneAction: 2);\n snd = Saw.ar(\n freq:freq*[0.99, 1.0, 1.001, 1.008],\n mul: env);\n snd = LPF.ar(in: snd,freq:2000);\n snd = Splay.ar(snd);\n Out.ar(0,snd);\n\n}).add;\n);\n\n(\nPbind(\n \\instrument, \"sawSynth\",\n \\freq, Pwhite(300, 700, inf),\n \\amp, Pwhite(0.15, 0.2)\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `InstrBrowser.search` do? What arguments does it take?"}, {"role": "assistant", "content": "Browse your instrument library, with customizable actions Arguments: q."}]} -{"conversations": [{"role": "user", "content": "What is `PatternConductor`?"}, {"role": "assistant", "content": "PatternConductor — Simple interactive control for playing patterns"}, {"role": "user", "content": "What does `PatternConductor.tempo` do?"}, {"role": "assistant", "content": "Sets the tempo of the PatternConductor"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\n// a pattern with long notes\np = Pbind(\n \\freq, Pwhite(0, log(32)).exp.round(1) * 36.midicps,\n \\detune, Pfunc({ |ev| ev[\\freq] * rand(0.01) }),\n \\sustain, Pwhite(log(0.1), log(20)).exp,\n \\dur, Prand([0.1, 0.1, 0.1, 0.1, 0.2, 1, 2], inf),\n \\db, Pstep(Pseq([-20, -30, -25, -30], inf), 0.2)\n);\n\n// unrelated cluster pattern running on TempoClock.default\nPbind(\\dur, 2, \\midinote, Pseq([(48..60)], 20), \\db, -30).play;\n\n// make a conductor\na = PatternConductor(p, quant: 2);\na.play;\n);\n\n\n// now try some interactive control options line by line:\na.quant = 0;\na.pause;\na.resume;\na.stop;\na.play;\na.pause;\na.play;\na.stop(1000);\n```"}]} -{"conversations": [{"role": "user", "content": "What is Env.perc and what does it take?"}, {"role": "assistant", "content": "`Env.perc(attackTime, releaseTime, level, curve)` — an attack to `level` (default 1) then a decay to zero, with curve defaulting to -4 (an exponential-ish decay). `Env.perc(0.01, 1)` is the default percussive envelope, and it is a complete Env, not a generator: pair it with EnvGen to hear it."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `FBSineC`."}, {"role": "assistant", "content": "```supercollider\n// default initial params\n{ FBSineC.ar(SampleRate.ir/4) * 0.2 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// using a different clock: here a Scheduler\nPdef(\\x, Pbind(\\dur, Pwhite(0.1, 0.2, inf), \\count, Pseries()));\na = Scheduler(TempoClock.default);\nPdef(\\x).trace.play(a);\na.advance(0.2;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// using a different clock: here a Scheduler\nPdef(\\x, Pbind(\\dur, Pwhite(0.1, 0.2, inf), \\count, Pseries()));\na = Scheduler(TempoClock.default);\nPdef(\\x).trace.play(a);\na.advance(0.2);\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ SinOsc.ar(SinOsc.ar(0.3).curverange(440, 660, -3), 0, 0.5 * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ SinOsc.ar(SinOsc.ar(0.3).curverange(440, 660, -3), 0, 0.5) * 0.1 }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Class.dumpInterface` do?"}, {"role": "assistant", "content": "Post all the methods defined in this Class and their arguments."}]} -{"conversations": [{"role": "user", "content": "What does `Pdef.condition` do?"}, {"role": "assistant", "content": "Provide a condition under which the pattern is switched when a new one is inserted. The stream value and a count value is passed into the"}]} -{"conversations": [{"role": "user", "content": "Explain `Psym` in SuperCollider briefly."}, {"role": "assistant", "content": "Psym — use a pattern of symbols to embed Pdefs for non-event patterns see Pnsym. Overview: JITLib. Category: JITLib > Patterns, Live Coding."}]} -{"conversations": [{"role": "user", "content": "What does `MxUnit.freeToBundle` do? What arguments does it take?"}, {"role": "assistant", "content": "Container for a musical object (Instr, NDef, Spline etc); this is a single unit that has inlets and outlets which can be connected to other units Arguments: bundle."}]} -{"conversations": [{"role": "user", "content": "What is `Char` in SuperCollider?"}, {"role": "assistant", "content": "Char — ASCII character A Char is a signed 8-bit integer (-128 to 127) that is used to represent that bytes inside a String. You can also make a Char with an ASCII literal by prefixing an ASCII character with a dollar symbol: code:$x:. These ASCII values are in the range 0-127. Some special characters can be expressed as literals using escape sequences (for example, `$\\n` for newline). See Literals#Characters for more in Category: Core."}]} -{"conversations": [{"role": "user", "content": "What is `RedMixer` in SuperCollider?"}, {"role": "assistant", "content": "RedMixer — create and hold multiple RedMixerChannel A mixer that can mix any number of channels (RedMixerChannel) into one or more subgroups. Category: Red > redMixer."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `NodeMap`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n(\nSynthDef(\"modsine\",\n { |out, freq = 320, amp = 0.2|\n Out.ar(out, SinOsc.ar(freq, 0, amp));\n }).add;\nSynthDef(\"lfo\",\n { |out, rate = 2|\n Out.kr(out, LFPulse.kr(rate, 0, 0.1, 0.2))\n }).add;\n);\n\n// start nodes\n(\nb = Bus.control(s, 1);\nx = Synth(\"modsine\");\ny = Synth.before(x, \"lfo\", [\\out, b]);\n);\n\n// create some node maps\n(\nh = NodeMap.new;\nh.set(\\freq, 800);\nh.map(\\amp, b);\n\nk = NodeMap.new;\nk.set(\\freq, 400);\nk.unmap(\\amp);\n);\n\n// apply the maps\n\nh.sendToNode(x); // the first time a new bundle is made\nk.sendToNode(x);\n\nh.sendToNode(x); // the second time the cache is used\nk.sendToNode(x);\n\nh.set(\\freq, 600);\n\nh.sendToNode(x); // when a value was changed, a new bundle is made\n\n// free all\nx.free; b.free; y.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What is SuperCollider?"}, {"role": "assistant", "content": "SuperCollider is a platform for audio synthesis and algorithmic composition, written in C++ and SuperCollider. It splits into a language client (sclang) that runs your code and builds UGen graphs, and an audio server (scsynth) that does the DSP in real time. They talk over OSC."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Just a lunch time tweet."}, {"role": "assistant", "content": "```supercollider\n{CombC.ar(Klang.ar(`[[100,101,1000,1001]],1,0)*0.1,0.33,LFTri.ar(0.1, 0, 0.1, 0.11)+LFTri.ar(0.17, 0, 0.1, 0.22),10)!2}.play;\n\n//Variation\n‎{CombC.ar(Klang.ar(`[[100,101,1000,1001]],1,0)*0.1,1.33,LFTri.ar(0.3, 0, 0.1, 0.71)+LFTri.ar(0.7, 0, 0.1, 0.52),10)!2}.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Migration from the old SourceForge wiki?"}, {"role": "assistant", "content": "```supercollider\np = ProxySpace.push(s.boot);\n\n~out.play(0,2);\n\n// taube eule und maus\n(\n~out = { \n var tr, e, eg, fm, maus;\n maus = MouseX.kr(0.1, 2);\n e = Env([0, 1, 0.4, 1, 0], [0.03, 0.2 * maus, 0.2, maus]);\n tr = Dust.kr(0.3);\n eg = EnvGen.kr(e, tr);\n fm = SinOsc.ar(30, 0, 0.2 * (1 - eg), 1);\n SinOsc.ar(100 * eg + 200 * fm) * 0.1 * eg\n};\n);\n\n// taube eulen und maus\n(\n~out = { \n var tr, e, eg, fm, maus;\n maus = MouseX.kr(0.1, 2);\n e = { Env([0, 1, 0.4, 1, 0], [0.03, 0.2.rand, 0.2, maus]) };\n tr = { Dust.kr(0.3) };\n eg = [\n EnvGen.kr(e.value, tr.value), \n EnvGen.kr(e.value, tr.value)\n ];\n fm = SinOsc.ar(30, 0, 0.2 * (1 - eg), 1);\n SinOsc.ar(100 * eg + 200 * [1, 1.15] * fm) * 0.1 * eg\n};\n);\n\n\n// eulenschlag und maus\n(\n~out = { \n var tr, e, eg, fm, maus, n, u;\n n = 6;\n maus = MouseX.kr(0.1, 2);\n e = { Env([0, 1, 0.4, 1, 0], [0.03, 0.2.rand, 0.2, maus]) };\n tr = { Dust.kr(0.1) };\n eg = (e ! n).collect { arg env; EnvGen.kr(env, tr.value) };\n fm = SinOsc.ar({ 30 + 2.0.rand2 } ! n, 0, 0.2 * (1 - eg), 1);\n u = SinOsc.ar(100 * eg + 200 * { rrand(0.9, 1.1) } ! n * fm) * 0.1 * eg;\n u.clump(2).sum\n};\n);\n\n/*\nauthors so far:\njrh\n*/\n```"}]} -{"conversations": [{"role": "user", "content": "Write a kick drum in SuperCollider."}, {"role": "assistant", "content": "A pitch-swept sine with a fast decay: the frequency envelope is what makes it read as a kick.\n\n```supercollider\n(\nSynthDef(\\kick, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 50, 40], [0.03, 0.15], -4));\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -6), doneAction: 2);\n Out.ar(out, Pan2.ar(SinOsc.ar(pitch) * env * amp));\n}).add;\n);\nSynth(\\kick);\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for reflection on seasonal change )."}, {"role": "assistant", "content": "```supercollider\n(\n{ \n LPF.ar(\n DynKlank.ar(\n `[[900, 971, 1153, 1823, 1401], nil, [\n SinOsc.kr(0.2).range(0.1,1), \n SinOsc.kr(0.6).range(0.1,1), \n SinOsc.kr(0.8).range(0.1,1), \n SinOsc.kr(1.2).range(0.1,1), \n SinOsc.kr(2).range(0.1,1)]\n ], \n Limiter.ar(Dust.ar(2, 0.65) + Impulse.ar(1,0,0.9))\n )\n ) ! 2 \n}.play;\n{ \n Pan2.ar(\n DynKlank.ar(`[[800, 1071, 1353, 723 + SinOsc.ar(SinOsc.ar(0.2).range(0, 10)).range(0,330)], nil, [1, 1, 0.5, 1]], PinkNoise.ar(0.007)),\n TRand.kr(-1, 1, trig: Pulse.ar(10))\n )\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Electronic Waves in the beach."}, {"role": "assistant", "content": "```supercollider\n// 2012.05.10\n// Work for NX013 Class\n// Comment: Ocean of Bass.\n\np = ProxySpace.push(s.boot);\n\n~a.play;\n\n~a = { var array;\n array = Array.series(rrand(1,1000),rrand(1,1000),rrand(1,30));\n array = array ++ array.reverse;\n Pan2.ar(LeakDC.ar(Normalizer.ar(\n BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(FreeVerb.ar(\n BPF.ar(\n LPF.ar(FreeVerb.ar(WhiteNoise.ar(),\n rrand(0.5,1.0),rrand(0.5,1.0),rrand(0.5,1.0))\n ,Demand.kr(Impulse.kr(rrand(5,20)),0,Dseq(array,inf)))\n ,rrand(100,5000),rrand(0.1,1.0))\n ,0.1,0.1,0.1)\n ,100,6.0,6),1000,6.0,0),5000,6.0,0),10000,6.0,6)\n ,(1.33/0.999)*1.0,0.1)),0)\n};\n\n~a = nil;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{SinOsc.ar(WrapSummer.kr(Impulse.kr(10), 1.5, 3, 13).poll * 100, 0, 0.1)}.play;\n\n{SinOsc.ar(WrapSummer.kr(Impulse.kr(12), 1.33, MouseX.kr(1, 5), MouseY.kr(5, 10)) * 100, 0, 0.1)}.play;\n\n(\n{\n var trig = Dust.kr([5, 5]);\n BPF.ar(Saw.ar(WrapSummer.kr(trig, 1.0008, 1, 8) * 100, 0.2));\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{SinOsc.ar(WrapSummer.kr(Impulse.kr(10), 1.5, 3, 13).poll * 100, 0, 0.1)}.play;\n\n{SinOsc.ar(WrapSummer.kr(Impulse.kr(12), 1.33, MouseX.kr(1, 5), MouseY.kr(5, 10)) * 100, 0, 0.1)}.play;\n\n(\n{\n var trig = Dust.kr([5, 5]);\n BPF.ar(Saw.ar(WrapSummer.kr(trig, 1.0008, 1, 8) * 100, 0.2));\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `String.drawLeftJustIn` do?"}, {"role": "assistant", "content": "Draws the String into the given Rect using the Font and Color specified."}]} -{"conversations": [{"role": "user", "content": "What does `Clothesline.addScore` do? What arguments does it take?"}, {"role": "assistant", "content": "Register a code file from a given Arguments: path — The full path (use `resolveRelative`) for relative paths.; callInContext — If true, make a persistent separate environment for each code file, which has the captured environment as parent. This allows you to access global data, but also use the local environment in each code without messing up other environments.."}]} -{"conversations": [{"role": "user", "content": "What does `NodeProxy.group` do?"}, {"role": "assistant", "content": "The node proxy's group (a Group). This is maintained by the proxy and serves as a context in which all synths are"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Exception`."}, {"role": "assistant", "content": "```supercollider\n(\n~inPlaceSub = { |array, find, replace|\n array.do({ |item, i|\n if(item == find) { array[i] = replace };\n });\n};\n\n~trySub = { |array, find, replace|\n try {\n ~inPlaceSub.(array, find, replace)\n } { |error|\n switch(error.species.name)\n { 'PrimitiveFailedError' } {\n if(error.what.find(\"immutable\").notNil) {\n \"caught ImmutableError\".postln;\n ~inPlaceSub.(array.copy, find, replace)\n } { \"unknown primitive exception\".postln; error.throw }\n }\n // default case: unhandled exception, should die so re-throw error\n { \"unknown exception\".postln; error.throw }\n };\n};\n);\n\n// pass in a mutable array, OK\n~trySub.((0..9), 9, 19);\n\n// pass in a literal array, Immutable exception is caught and handled\n~trySub.(#[0, 1, 2, 3, 4, 5], 5, 6);\n\n// pass in a nonsense value, other exception is re-thrown\n~trySub.(10, 5, 6);\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nn = NetAddr(\"localhost\", 12345);\nn = s.addr;\n\n// Example sending symbols, integers, and a float\nn.sendMsg('/s_new', \\default, 2000, 0, s.defaultGroup.nodeID, \\freq, 60.midicps);\n\n// The initial forward slash can be omitted\nn.sendMsg(\\n_set, 2000, \\gate, 0);\n\n// Using the performList syntax, you can use an array to store an OSC message\n~msg = [\\n_set, 2000, \\gate, 0];\nn.sendMsg(*~msg;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nn = NetAddr(\"localhost\", 12345);\nn = s.addr;\n\n// Example sending symbols, integers, and a float\nn.sendMsg('/s_new', \\default, 2000, 0, s.defaultGroup.nodeID, \\freq, 60.midicps);\n\n// The initial forward slash can be omitted\nn.sendMsg(\\n_set, 2000, \\gate, 0);\n\n// Using the performList syntax, you can use an array to store an OSC message\n~msg = [\\n_set, 2000, \\gate, 0];\nn.sendMsg(*~msg);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Midterm Q1 (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef( \"pulsey\",{arg freq, amp;\n var env, snd;\n env = Env.perc(attackTime: 0.2,\n releaseTime: 4,\n level: amp).kr(doneAction:2);\n snd = Pulse.ar(\n freq: freq*LFNoise2.kr([4, 5, 7]).range(0.988, 1.011),\n mul:env);\n snd = LPF.ar(in: snd, freq: 1000);\n snd = Splay.ar(snd);\n Out.ar(0, snd);\n\n\n}).add;\n);\n\n(\nm = [72, 79, 77, 79, 82, 79, 87, 86, 84, 82, 84, 79];\n\n\nPbind(\n \\instrument, \"pulsey\",\n \\midinote, Pseq(m, inf),\n \\dur, Pseq([Pn(0.5, 5), 1.5], inf),\n \\amp, Pwhite(0.15, 0.2)\n).play;\n\n\nPbind(\n \\instrument, \"pulsey\",\n \\midinote, Pseq(m.reverse, inf),\n \\dur, Pseq([Pn(0.5, 5), 1.5], inf),\n \\ctranspose, Pwrand([-12, -7, -24], [0.8, 0.1, 0.1], inf),\n \\amp, 0.08,\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `PlayerRecorder.player` do?"}, {"role": "assistant", "content": "utility class to prepare and precisely record a player to a soundfile"}]} -{"conversations": [{"role": "user", "content": "What does `MultiSplineFr.liveValues` do?"}, {"role": "assistant", "content": "Multi dimensional spline frame rate device"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nSynthDef(\\Synth3,\n {arg ress = 0;\n var klank, env;\n klank = Klank.ar(`[{Rand(70,21000)}!7, {Rand(0.128,0.700)}!7],BrownNoise.ar(0.7));\n klank = klank;\n env = EnvGen.kr(Env.perc(0.07, ress), doneAction:2);\n Out.ar(0, klank*env.dup*0.0128);\n}).add;\n)\n\n\n{inf.do{x = rrand(0.01,0.7); Synth(\\Synth3, [\\ress, x+(7*x)]); x.wait;}}.fork\n```"}, {"role": "assistant", "content": "Play around with {Rand(70, 21000)}!7\r\n\r\nA simple example for the begginers... hope I can contribute to something =)."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for very punchy snare in neurofunk style."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\neurosnare, {\n var snd;\n // a percussive click to give it some attack\n snd = LPF.ar(HPF.ar(WhiteNoise.ar, 300), 8000) * Env.linen(0.001, 0.01, 0.001).ar;\n // sine sweep body. very important!\n snd = snd + (SinOsc.ar(Env([400, 196, 160], [0.04, 0.2], \\exp).ar) * Env.perc(0.04, 0.2).ar * 6.dbamp).tanh;\n // sound of snare coils rattling\n snd = snd + (HPF.ar(BPeakEQ.ar(WhiteNoise.ar, 4000, 0.5, 3), 300) * Env.perc(0.05, 0.2).delay(0.01).ar(2) * -3.dbamp);\n // another sound sweep to improve the attack, optional\n snd = snd + (SinOsc.ar(XLine.kr(3000, 1500, 0.01)) * Env.perc(0.001, 0.02).ar);\n // distortion helps glue everything together and acts as a compressor\n snd = (snd * 1.4).tanh;\n snd = Pan2.ar(snd, \\pan.kr(0), \\amp.kr(0.1));\n Out.ar(\\out.kr(0), snd);\n}).add;\n);\n\nSynth(\\neurosnare, [amp: 0.4]);\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `Group` in SuperCollider briefly."}, {"role": "assistant", "content": "Group — Client-side representation of a group node on the server A Group is the client-side representation of a group node on the server, which is a collection of other nodes organized as a linked list. The Nodes within a Group may be controlled together, and may be both Synths and other Groups. Groups are thus useful for controlling a number of nodes at once, and when used as targets can be very helpful in controlling order of execution. (See Order-of-executio Category: Server > Nodes, Server > Abstractions."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for late night experimenting."}, {"role": "assistant", "content": "```supercollider\n(\nvar seed = thisThread.randSeed = 1e8.rand.debug('seed');\n{|dur = 30|\n var voices = 2.pow(1.rrand(4)),\n sig = DelayC.ar({ Pan2.ar(\n PMOsc.performList(\\ar, {\n var freq = Lag.ar(LFSaw.ar([10,15]/((1..5).choose*[1,2,4].choose)).exprange(\n {200.rrand(400)}!2, {500.rrand(1100)}!2\n * Line.kr(0.5.rrand(2), 3.rrand(8.0),dur)\n ));\n [freq, freq/[2,4].choose + SinOsc.kr([10,25],0,5), XLine.kr(0.1,1.rrand(3.0),dur/1.rrand(2.0))]\n }.()).sum/2,\n [SinOsc,LFTri].choose.kr({4.0.rrand(11)}!2 * [XLine,Line].choose.kr(1,4,dur))\n ).sum/2 \n * LFGauss.kr(XLine.kr(\\beat.kr, \\beat.kr / \\beat_change.kr, dur) / [0.5,1,2,4].choose, 0.3) \n * EnvGen.kr([\n Env.perc(0.1,dur),\n Env.sine(dur),\n Env.performList(\\new, {|len| [\n [0]++Array.rand(len,0.1,1)++[0],\n Array.rand(len,0.1,1).normalizeSum * dur,\n Array.rand(len-1,-3.0,3.0)+[0]\n ]}.(2.rrand(10)))\n ].choose) } ! voices, 4, { 0.1.rrand(4) } ! voices, 1 / voices).sum * Line.kr(1,1,dur+5,doneAction:2);\n sig = Rotate2.ar(sig[0],sig[1], LFSaw.kr(Duty.kr(dur/4.rrand(16), 0, Drand([-1*\\beat.kr,\\beat.kr].reciprocal,inf))));\n}.play(args:[\n dur:1.rrand(25.0).debug('dur'), \n beat:1.rrand(6)*(1..4).reciprocal.choose/4, \n beat_change:1.rrand(8)\n])\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n~mdef =\n{\n |key, func, msgNum, permanent = true|\n\n MIDIdef(key, func ?? { MIDIdef(key).func }, msgNum ? MIDIdef(key).msgNum, MIDIdef(key).chan, MIDIdef(key).msgType, MIDIdef(key).srcID).permanent_(permanent)\n}\n```"}, {"role": "assistant", "content": "Change arg values of MIDIdef after instantiation (a SuperCollider snippet)."}]} -{"conversations": [{"role": "user", "content": "Explain `MxDocument` in SuperCollider briefly."}, {"role": "assistant", "content": "MxDocument — a wrapper for placing code Documents onto the Mx grid This is for adding code documents to an Mx. Category: Mx."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// vibrato at 1 Hz, note the use of DC.ar UGen; a constant of 400.0 doesn't work\n{ SinOsc.ar(Vibrato.ar(DC.ar(400.0), 1, 0.02)) }.play\n\n// compare: k-rate freq input can be a constant\n{ SinOsc.ar(Vibrato.kr(400.0, 1, 0.02)) }.play\n\n// control rate and rateVariation\n{ SinOsc.ar(Vibrato.ar(DC.ar(400.0), MouseX.kr(2.0, 100.0), 0.1, 1.0, 1.0, MouseY.kr(0.0, 1.0), 0.1)) }.play\n\n// control depth and depthVariation\n{ SinOsc.ar(Vibrato.ar(DC.ar(4\n// …\n```"}, {"role": "assistant", "content": "vibrato at 1 Hz, note the use of DC.ar UGen; a constant of 400.0 doesn't work compare: k-rate freq input can be a constant (Vibrato: The Vibrato oscillator models a slow frequency modulation.)"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Seekers are something you should avoid?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n var time = 0.23;\n var freq = (55).midicps;\n var a = VarSaw.ar(freq/2, width: XLine.ar(0.5,1,time)).range(0,XLine.ar(0.666,1/666,time));\n var tone = SinOsc.ar(freq).fold(-0.23*a,a) * EnvGen.ar(Env([1,0],[time]));\n Out.ar(0, tone.dup);\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Pisano Periods are used to generate melodies."}, {"role": "assistant", "content": "```supercollider\n/*\nThe Fibonacci-sequence as controlsignal: melodies from Pisano Periods.\nBecause the sequence runs more or less exponentially, it seems best to assign the values to frequencies. \n*/\ns.boot;\nSynthDef( \\puls, {|freq=30, out|\n Out.ar(out,\n SinOsc.ar(freq, mul: 0.5*EnvGen.kr(Env.perc(0.01,0.75), doneAction: 2)),0)\n}).add;\n(\nm=3000; //max index, 5 minutes = 300 when dur=0.1\na=Array.newClear(m);//two arrays to store numbers from the Pisano Periods\nb=Array.newClear(m);\na.put(0,0); \na.put(1,1);\nd=2; //even divisor\ni=2; //index\nwhile ({i 0.0, restart with new initial conditions sampled from initx, inity; rate — update rate for a sample step; k1 — equation constant; k2 — equation constant; alpha — equation constant; beta — equation constant; mu — equation constant; rho — equation constant."}]} -{"conversations": [{"role": "user", "content": "What does `U.setAudioIn` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: id — (describe argument here); bus — (describe argument here). Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Swarm of sound files."}, {"role": "assistant", "content": "```supercollider\nb = SoundFile.collectIntoBuffers(\"yourSoundFileFolder/*\"); // By Bjørn Houdorf, December 21, 2012\n\n(\n{\nvar number = b.numChannels, randomNumber, trigger, delayed, panned, sound, mixedSound, rotatedSound;\ntrigger = Dust.kr(Array.fill(number,1), 1, -0.5); // Generates random impulses from -0.5 to 0.5. as a excitation function\nrandomNumber = TRand.kr(1, number, trigger);\nsound = PlayBuf.ar(Array.fill(number,1) ,randomNumber,1,trigger,0,0); // play sound files\ndelayed = DelayL.ar(sound, trigger, trigger); // delaying the sound files\npanned = Pan2.ar(delayed, Array.fill(number,{1.0.rand2})); // pan them out in the stereo field\nmixedSound = 0.05*Mix.new(panned);// and mix them to one stereo signal\nrotatedSound = Rotate2.ar(mixedSound[0], mixedSound[1], LFSaw.kr(0.05)); // rotate stereo signal\n}.play; // play it all\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Just experimental sketch of somewhere audio background."}, {"role": "assistant", "content": "```supercollider\n(\n{ \n Limiter.ar(\n GVerb.ar(\n ( \n BPF.ar(\n WhiteNoise.ar([0.07,0.07]) + Blip.ar([13,19], 200.rand, mul:0.5),\n SinOsc.kr(\n SinOsc.kr([1/108,1/109]).range(1/108, 1/13)\n ).exprange(10, 23000),\n PMOsc.kr(1/54,1/216, 3).range(0.1, 2)\n ) \n * \n SinOsc.ar(Array.rand(20, 1/216, 1), mul: Array.rand(20, 0.2, 1)).reshape(10,2)\n ).sum,\n roomsize:10,\n damping: PMOsc.kr(1/27, 1/108, 3).range(0.5, 1), \n drylevel: SinOsc.kr(1/9).range(0.1, 1)\n )\n +\n GVerb.ar(\n Pan2.ar(\n LPF.ar(\n DynKlank.ar(\n `[\n Array.rand(6, 600, 4000).collect({|freq|\n SinOsc.kr(1/108).range(freq/2,freq)\n }), \n nil, \n Array.rand(6, 1/108, 1/27).collect({|freq|\n SinOsc.kr(freq).range(1/108,1/3)\n })\n ],\n Limiter.ar(\n Dust.ar( SinOsc.kr(1/256).exprange(1/27, 3), TRand.kr(0.15, 0.25, Dust.kr(1/9))) \n + \n Impulse.ar( SinOsc.kr(1/108).exprange(1/54, 3), 0, TRand.kr(0.6, 0.8, Dust.kr(1/3)))\n )\n ),\n 1700,\n LFPar.kr(1/27).exprange(0.05, 0.2)\n ),\n SinOsc.kr(1/9).range(-0.2, 0.2)\n ),\n roomsize: 30,\n drylevel: 0.5\n )\n )\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is the difference between TempoClock and SystemClock?"}, {"role": "assistant", "content": "SystemClock runs in real time and is what `.wait` uses by default. TempoClock runs in beats and has a tempo, so it can be changed while things are playing and Patterns scheduled on it follow. `TempoClock.default` is the clock Patterns use unless told otherwise, which is why `TempoClock.default.tempo = 2` changes the speed of everything you already have running."}]} -{"conversations": [{"role": "user", "content": "What does `Red3D.rotationMatrices` do?"}, {"role": "assistant", "content": "Returns an array of 3 arrays each holding a 3-row matrix for the current rotation in X, Y and Z dimensions. This is calculated when calling"}]} -{"conversations": [{"role": "user", "content": "What is `PbindProxy`?"}, {"role": "assistant", "content": "PbindProxy — incremental event pattern reference"}, {"role": "user", "content": "What does `PbindProxy.new` do?"}, {"role": "assistant", "content": "Return a new instance of PbindProxy with the given patternpairs. Unlike Pbindef, it has no internal name. `a = PbindProxy(\\note, Pseq([0, 7, 9], inf), \\dur, 0.2).play;` It also supports keyword argument syntax: `a = PbindProxy(note: Pseq([0, 7, 9]), dur: 0.2).play;`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na = PbindProxy(\\note, Pseq([0, 7, 9], inf), \\dur, 0.2).play;\na.set(\\note, Pseq([0, 6, 10]));\na.stop;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = [1, 2, 3]\na.wrapAt(2) // same as at\na.wrapAt(3) // wraps\na.wrapAt([-1, 3, 1]) // array of indices\na@@3 //syntactic shortcut\n\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n 32.do{ |i|\n {\n var freq = pitches.wrapAt(i).midicps;\n var env = Env.perc.ar(Done.freeSelf);\n SinOsc.ar(freq) * 0.1 * env\n }.play;\n 0.2.wait\n }\n}\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = [1, 2, 3]\na.wrapAt(2) // same as at\na.wrapAt(3) // wraps\na.wrapAt([-1, 3, 1]) // array of indices\na@@3 //syntactic shortcut\n\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n 32.do{ |i|\n {\n var freq = pitches.wrapAt(i).midicps;\n var env = Env.perc.ar(Done.freeSelf);\n SinOsc.ar(freq) * 0.1 * env\n }.play;\n 0.2.wait\n }\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `EaseInQuad` in SuperCollider?"}, {"role": "assistant", "content": "EaseInQuad — Quadratic ease-in Easing equation for a quadratic (t^2) ease-in, accelerating from zero velocity. Category: Ease."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PlazyEnvir`."}, {"role": "assistant", "content": "```supercollider\n(\na = PlazyEnvir({ |a = 0, b = 1| Pshuf([a, a, b], 2) }); // a, b default to 0, 1\nx = Pn(a, inf).asStream;\n\n10.do { x.next.postln }; Post.nl;\ne = (a: 100);\n10.do { x.next(e).postln }; Post.nl;\ne = (a: 100, b: 200);\n10.do { x.next(e).postln };\n);\n\n\n// PlazyEnvir used to produce a Pbind:\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05, pan = 0|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, Pan2.ar(SinOsc.ar(freq, 0, env), pan))\n }).add;\n\na = PlazyEnvir({ |g = 0, h = 0, dur = 1|\n postf(\"g: %, h: %, dur: %\\n\", g, h, dur);\n Pbind(\n \\instrument, \\help_sinegrain,\n \\dur, dur,\n \\degree, Pseq([g, g, h, g, h], 2)\n )\n});\n);\n\n// different variants\n(a <> (g: 0, h: 3, dur: 0.2)).play; // single stream\n(a <> (g: [0, 4], h: [3, -1], dur: 0.2)).play; // same durations, two streams\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// try wiggling mouse quickly:\n// LFNoise2 overshoots when going from high to low freqs, LFDNoise changes smoothly.\n\n{ SinOsc.ar(LFNoise2.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n{ SinOsc.ar(LFDNoise3.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFNoise2.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n\n{ LFDNoise3.ar(XLine.kr(2000, 20000, 8), 0.1\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// try wiggling mouse quickly:\n// LFNoise2 overshoots when going from high to low freqs, LFDNoise changes smoothly.\n\n{ SinOsc.ar(LFNoise2.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n{ SinOsc.ar(LFDNoise3.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFNoise2.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n\n{ LFDNoise3.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n\n// use as frequency control\n(\n{\n SinOsc.ar(\n LFDNoise3.ar(4, 400, 450),\n 0, 0.2\n )\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `EnvelopeView.gridOn` do? What arguments does it take?"}, {"role": "assistant", "content": "Whether to draw the Arguments: A Boolean.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// mixer parametric eq as wahwah\n{ MidEQ.ar(Saw.ar(200, 0.2), FSinOsc.kr(1, 0, 24, 84).midicps, 0.3, 12) }.play\n\n\n// notch filter\n(\n{ var in;\n in = PinkNoise.ar(0.2) + SinOsc.ar(600, 0, 0.1);\n MidEQ.ar(in, SinOsc.kr(0.2, 0.5pi) * 2 + 600, 0.01, -24)\n}.play\n);\n\n/////\n// first start the synth\n(\nx = { |freq = 400, db = 0, rq = 0.1|\n var in;\n in = SinOsc.ar([400, 420], 0, 0.4);\n MidEQ.ar(in, freq\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// mixer parametric eq as wahwah\n{ MidEQ.ar(Saw.ar(200, 0.2), FSinOsc.kr(1, 0, 24, 84).midicps, 0.3, 12) }.play\n\n\n// notch filter\n(\n{ var in;\n in = PinkNoise.ar(0.2) + SinOsc.ar(600, 0, 0.1);\n MidEQ.ar(in, SinOsc.kr(0.2, 0.5pi) * 2 + 600, 0.01, -24)\n}.play\n);\n\n/////\n// first start the synth\n(\nx = { |freq = 400, db = 0, rq = 0.1|\n var in;\n in = SinOsc.ar([400, 420], 0, 0.4);\n MidEQ.ar(in, freq, Lag.kr(rq, 0.3), db)\n }.play\n);\n\n// now play with its parameters to hear how the filter affects two frequencies\n// that are very close to each other\n\nx.set(\\db, -12)\nx.set(\\rq, 0.1)\nx.set(\\rq, 0.03)\nx.set(\\freq, 410)\nx.set(\\freq, 420)\nx.set(\\freq, 400)\nx.set(\\freq, 500)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `FoaThetaPhiA.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "First Order Ambisonic (FOA) Azimuth & Elevation of Soundfield Active Intensity Vector Arguments: in — The B-format signal, an array: [w, x, y, z]; size — Analysis filter kernel size.; method — The Soundfield analysis method:."}]} -{"conversations": [{"role": "user", "content": "What does `SimpleNumber.excess` do?"}, {"role": "assistant", "content": "Returns the difference of the receiver and its clipped"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LPZ1`."}, {"role": "assistant", "content": "```supercollider\n// Compare:\n\n{ WhiteNoise.ar(0.25) }.play;\n\n{ LPZ1.ar(WhiteNoise.ar(0.25)) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `IdentityDictionary`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_sinegrain, { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0.5pi, env))\n}).add;\n\na = Pbind(\\instrument, \\help_sinegrain, \\note, Pseq([0, 7, 2, 9, 11, 10, 9, 8], inf), \\dur, 1);\na.play(quant: (quant: 1, phase: 0));\na.play(quant: (quant: 1, phase: 1/3));\na.play(quant: (quant: 1, phase: 1.0.rand));\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SynthlessPlayer.proxyControlClass` do?"}, {"role": "assistant", "content": "parent class for Players that will not spawn a synth"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SendTrig`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n(\nSynthDef(\"help-SendTrig\", {\n SendTrig.kr(Dust.kr(1.0), 0, 0.9);\n}).add;\n\n// register to receive this message\no = OSCFunc({ |msg, time|\n [time, msg].postln;\n}, '/tr', s.addr);\n);\n\nSynth(\"help-SendTrig\");\n\no.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `AbstractSController.free` do?"}, {"role": "assistant", "content": "free the internal synth and bus that was created for this controller"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Random deep fryer?"}, {"role": "assistant", "content": "```supercollider\n// random deep fryer. can turn in to rain, waves and other stuff.\n// nice with multichannel iteration. Change number at \"!2\".\n// volume compensation for high quality filter with \"1/q.sqrt\" for mul in BPF.\n// variable \"dist\" for distortion, increasing can go loud, decrease \"amp\" if so.\n// LFNoise1 with noisefreq,noisemul,noiseoffset gives it the wavy feel.\n\n(\nSynthDef(\\friture, {\n arg amp=0.5, dist=2, dens=12, dustamp=1, offset=0, noisefreq=2, noisemul=2,\n noiseoffset=0, frq1=200, frq2=2500, rq1=0.5, rq2=0.1, out=0;\n\n var sig, env;\n\n sig = {BPF.ar((Dust2.ar(dens, dustamp, offset)*LFNoise1.ar(noisefreq,noisemul,noiseoffset)),rrand(frq1,frq2),q=rrand(rq1,rq2),1/q.sqrt)}!2;\n sig = (sig*dist).tanh*amp;\n\n\n Out.ar(out,sig);\n\n }).add;\n);\n\ny = Synth.new(\\friture);\ny.free;\n\ny.set(\\dens,161);\ny.set(\\amp,0.5);\ny.set(\\dist,1);\ny.set(\\rq1,0.2);\ny.set(\\rq2,0.4);\ny.set(\\frq1,133);\ny.set(\\frq2,193);\ny.set(\\noisefreq,1);\ny.set(\\noisemul,2);\ny.set(\\noiseoffset,(-2));\ny.set(\\out,0);\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for micro-beat repeat, based on delay."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\stutter,{\n arg in=0, out=0;\n var sig, delayTime, increment, trigger;\n var reset=\\reset.kr(0);\n var delayPitch=\\pitch.kr(12);\n var offsetms=\\offsetms.kr(0)/1000;\n var strobe=\\strobe.kr(1);\n var on=\\onoff.kr(0);\n var envGen, sustainTime;\n var atkTime=0.002, relTime=0.002;\n\n reset=reset*on;\n // Convert pitch to delay time in seconds\n delayTime = delayPitch.midicps.reciprocal;\n\n // Trigger for incrementing delay time\n trigger = Impulse.ar(delayTime.reciprocal);\n\n // Calculate sustain time to ensure envelope stays high for the chunk duration minus attack and release\n sustainTime = delayTime - (atkTime + relTime);\n\n // Ensure sustainTime is not negative\n sustainTime = max(sustainTime, 0)*strobe;\n\n // Increment delay time\n increment = Dseries(0, delayTime, inf)*on;\n increment = Demand.ar(trigger, reset, increment);\n\n // Generate an envelope to soften clicks\n envGen = EnvGen.ar(Env([0, 1, 1, 0], [atkTime, sustainTime, relTime], 'lin'), trigger);\n\n\n // Get input signal\n sig = In.ar(in, 1); // Assuming stereo input\n\n // Apply delay\n sig = DelayC.ar(sig, 24, increment+offsetms);\n\n // Apply envGen\n sig=sig*envGen;\n\n // Output\n Out.ar(out, sig);\n}).add();\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// vary frequency\n{ CuspN.ar(MouseX.kr(20, SampleRate.ir), 1.0, 1.99) * 0.3 }.play(s);\n\n// mouse-controlled params\n{ CuspN.ar(SampleRate.ir/4, MouseX.kr(0.9, 1.1, 1), MouseY.kr(1.8, 2, 1)) * 0.3 }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(CuspN.ar(40, MouseX.kr(0.9, 1.1, 1), MouseY.kr(1.8, 2, 1))*800+900)*0.4 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// vary frequency\n{ CuspN.ar(MouseX.kr(20, SampleRate.ir), 1.0, 1.99) * 0.3 }.play(s);\n\n// mouse-controlled params\n{ CuspN.ar(SampleRate.ir/4, MouseX.kr(0.9, 1.1, 1), MouseY.kr(1.8, 2, 1)) * 0.3 }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(CuspN.ar(40, MouseX.kr(0.9, 1.1, 1), MouseY.kr(1.8, 2, 1))*800+900)*0.4 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// used to lag pitch\n(\nSynthDef(\\lag3ud_help, { |out, freq = 300, lagup = 1, lagdown = 5|\n Out.ar(out,\n SinOsc.ar( // sine wave\n Lag3UD.kr( // lag the frequency\n freq,\n lagup,\n lagdown\n ),\n 0, // phase\n 0.2 // sine amplitude\n )\n )\n}).add;\n);\n\nx = Synth(\\lag3ud_help); // create the synth\n\nx.set(\\freq, 500); // set the frequency to a higher value (takes 1 second)\nx.set(\\freq, 100); // set the frequency to a lower value (takes 5 seconds\nx.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// used to lag pitch\n(\nSynthDef(\\lag3ud_help, { |out, freq = 300, lagup = 1, lagdown = 5|\n Out.ar(out,\n SinOsc.ar( // sine wave\n Lag3UD.kr( // lag the frequency\n freq,\n lagup,\n lagdown\n ),\n 0, // phase\n 0.2 // sine amplitude\n )\n )\n}).add;\n);\n\nx = Synth(\\lag3ud_help); // create the synth\n\nx.set(\\freq, 500); // set the frequency to a higher value (takes 1 second)\nx.set(\\freq, 100); // set the frequency to a lower value (takes 5 seconds)\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `ProxySpace`."}, {"role": "assistant", "content": "```supercollider\np = ProxySpace.push(s.boot);\np.reshaping = \\elastic;\n~out.play;\n~out = { Blip.ar(~freq, ~numharm) };\n~freq = 70;\n~numharm = { MouseX.kr(2, 100, 1) };\n\nq = p.copy; p.pop; q.push;\n\nq.reshaping.postln; // also elastic\n~out.play;\n~freq = { MouseY.kr(2, 1000, 1) * [1, 1.2] };\n\np.end; q.end;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `ServerOptions.outputStreamsEnabled` do?"}, {"role": "assistant", "content": "A String which allows turning off output streams that you are not interested in on the audio device. If the string is \"11000\", for example, then only the first two output streams on the device will be enabled. Turning off streams can reduce CPU"}]} +{"conversations": [{"role": "user", "content": "What is `IsOdd` in SuperCollider?"}, {"role": "assistant", "content": "IsOdd — validates that the tested object is an odd number Category: Libraries > crucial > Constraints."}]} +{"conversations": [{"role": "user", "content": "What does `Editor.synthArg` do?"}, {"role": "assistant", "content": "holds a value that can be edited with a GUI, saves as the value"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nSynthDef(\\madtraffic, {|out, sig, gate=1, freq=440|\n // doneAction: 2 rilascia la synth quando EvnGen ha finito\n sig = (Blip.ar(freq)*0.7+Blip.ar(freq/2+Rand(1,12))*0.7)\n*EnvGen.kr(Env.asr(0.1, 0.3, 0.3), gate, doneAction:2);\n sig = RLPF.ar(sig,SinOsc.kr(0.3, 0, 200, 1500), 0.1);\n sig = FreeVerb.ar(sig, 0.5, 0.5, 0.5);\n Out.ar(out, sig);\n\n}).add;\n);\n\n(\nPbind(\n \\instrument, \\madtraffic,\n \\freq, Pseq([137, 373, Prand([237, 473, 713],1)], inf),\n \\legato, Pseq([1.7, 0.3], inf),\n \\dur, 0.3,\n \\out, Pseq([1, 0], inf)\n).play;\n)\n```"}, {"role": "assistant", "content": "\"It's the lack of eye contact that makes us more idiots, to the point that convertible riders give less to escalation. Closed in the car, explain the psychologists, we regress to childhood and react by shouting, or with that surrogate of the shock that is the horn.\"\r\n\r\n\r\n\r\nhttp://bz-buzz.blogspot.com/2018/09/mad-traffic.html\r\n\r\nhttp://bzakirasantjago.blogspot.it/."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(//*********PREPARE**********\np.pop;\n//Any code that needs to access your own environment goes here\np = ProxySpace.push(s);\n~fxLoop.play.fadeTime_(5);\n);\n\n(//*********FXLoop**********\n~fxLoop = {\n var in = SoundIn.ar([0,1]);\n in;\n}\n)\n```"}, {"role": "assistant", "content": "Code for using Supercollider as a realtime livecode FX processor for audio input. Blog post explaing this code: http://schemawound.com/post/53528545022/fxloop."}]} +{"conversations": [{"role": "user", "content": "Explain `TimeStretch` in SuperCollider briefly."}, {"role": "assistant", "content": "TimeStretch — Time Stretch TimeStretch is the 1952 Cadillac Fleetwood of extreme time stretching algorithms - a big, hulking, and slow beauty. All calculations and audio processing are done in the language, thus calculations move at a glacial pace. For a faster version that uses the server, but doesn't sound quite as good, check out TimeStretch2. Category: UGens > FFT."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LinCongC`."}, {"role": "assistant", "content": "```supercollider\n// default initial params\n{ LinCongC.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "I get 'Message not understood' on a nil variable."}, {"role": "assistant", "content": "`~buffer` (or any variable) was never assigned, or it was assigned in a different environment. Environment variables are per-environment: a `~buf` set in one server-side file block is not visible in another. Check with `~buf.postln` before using it. The other common cause is an assignment that failed silently, e.g. `~buf = Buffer.read(...)` where the file was missing — the error is posted but ~buf stays nil."}]} +{"conversations": [{"role": "user", "content": "What does `DragSink.defaultCanReceiveDrag` do?"}, {"role": "assistant", "content": "A simple drag-and-drop receiver. Returns: Always True."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `WhiteNoise`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-WhiteNoise\", { |out = 0|\n Out.ar(out,\n WhiteNoise.ar(0.25)\n )\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// default values\n{ Logistic.ar }.play\n\n// onset of chaos\n{ Logistic.ar(Line.kr(3.55, 3.6, 5), 1000) }.play\n\n// explore via Mouse\n{ Logistic.ar(MouseX.kr(3, 3.99), MouseY.kr(10, 10000, 'exponential'), 0.25, 0.5 }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// default values\n{ Logistic.ar }.play\n\n// onset of chaos\n{ Logistic.ar(Line.kr(3.55, 3.6, 5), 1000) }.play\n\n// explore via Mouse\n{ Logistic.ar(MouseX.kr(3, 3.99), MouseY.kr(10, 10000, 'exponential'), 0.25, 0.5) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `Pseries` in SuperCollider briefly."}, {"role": "assistant", "content": "Pseries — arithmetic series pattern Returns a stream that behaves like an arithmetic series. Category: Streams-Patterns-Events > Patterns > List."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Plambda`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n/*\n\nA simple example:\nTwo patterns playing in parallel,\nsharing data between eachother\n\n*/\n(\n // a melody playing random scale degrees\n a = Pbind(\n \\dur, 0.125,\n \\octave, 4,\n \\degree, Plet(\\melody, pattern: Pwhite(0, 7))\n );\n\n // the bass, scale degrees sampled from the \\melody variable defined above\n b = Pbind(\n \\dur, 0.5,\n \\octave, 3,\n \\degree, Pget(\\melody, default: 1, repeats: inf).trace\n );\n\n // Play the patterns in parallel\n Plambda(\n Ppar([a, b], inf)\n ).play;\n);\n/*\n\nA more complex example:\nThree patterns running in parallel\n\n*/\n(\nSynthDef(\\sine,\n { |out = 0, freq = 440, sustain = 0.05, pan = 0, amp = 0.1|\n var env;\n env = EnvGen.kr(Env.perc(Rand(0.001, 0.02), sustain, AmpCompA.kr(freq)*amp), doneAction: Done.freeSelf);\n Out.ar(out, Pan2.ar(SinOsc.ar(freq), pan, env))\n }).add;\n);\n\n(\na = Plambda(\n Pseq([\n Pfindur(5,\n Ppar([\n Pbind(\\note, Plet(\\x, Prand([1, 5, 1, [10, 14]], inf)), \\dur, 8/3, \\pan, -1),\n Pbind(\\note, Plet(\\y, Pseq([5, 3, 2, 0, [0, 5, 6, 9]], inf)), \\dur, 0.5, \\pan, 1),\n Pbind(\\note, Pseq([Pget(\\x), Pget(\\y)], inf) + 12, \\pan, 0, \\dur, 2/3)\n ])\n ),\n Pbind(\\note, Pget(\\x, 0, 6) + [0, 5], \\dur, Pdup(inf, Prand([2/3, 1/6])))\n ], inf).trace(\\eventScope) // internally, the values are shared via \\eventScope\n);\n\nb = Pbindf(a, \\instrument, \\sine, \\legato, 0.1);\nb.play\n);\n\n// Play two copies of the complex pattern above in parallel, one of them transposed and playing with shorter durations\nPpar([b, Pbindf(b, \\ctranspose, 24, \\dur, Pkey(\\dur) * 0.25)]).play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `StreamSpec.constrain` do? What arguments does it take?"}, {"role": "assistant", "content": "datatype specifying that the input or output is stream or pattern Arguments: value."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns = Server.local;\nb = Bus.control(s, 1);\n\nSynthDef(\"help-InTrig\", { |out = 0, busnum = 0|\n var inTrig;\n inTrig = InTrig.kr(busnum);\n Out.ar(out,\n EnvGen.kr(Env.perc, gate: inTrig, levelScale: inTrig) * SinOsc.ar\n )\n}).play(s, [\\out, 0, \\busnum, b.index]);\n\n\nb.set(1.0;\n\nb.value = 1.0;\n\nb.value = 0.2;\n\nb.value = 0.1;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns = Server.local;\nb = Bus.control(s, 1);\n\nSynthDef(\"help-InTrig\", { |out = 0, busnum = 0|\n var inTrig;\n inTrig = InTrig.kr(busnum);\n Out.ar(out,\n EnvGen.kr(Env.perc, gate: inTrig, levelScale: inTrig) * SinOsc.ar\n )\n}).play(s, [\\out, 0, \\busnum, b.index]);\n\n\nb.set(1.0);\n\nb.value = 1.0;\n\nb.value = 0.2;\n\nb.value = 0.1;\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `In`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-InKr\", { |out = 0, in = 0|\n Out.ar(out,\n SinOsc.ar(In.kr(in, 1), 0, 0.1)\n )\n}).add;\nSynthDef(\"help-lfo\", { |out = 0|\n Out.kr(out, LFNoise1.kr(0.3, 200, 800))\n}).add;\n);\n\n\nb = Bus.control(s, 1);\nb.set(800);\n\nSynth(\"help-InKr\", [\\in, b.index]);\nb.set(400);\nb.set(300);\nSynth(\"help-lfo\", [\\out, b.index]);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `BufCombN` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// These examples compare the variants, so that you can hear the difference in interpolation\n\n// allocate buffer\nb = Buffer.alloc(s, 44100, 1);\n\n// Comb used as a resonator. The resonant fundamental is equal to\n// reciprocal of the delay time.\n{ BufCombN.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ BufCombL.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ BufCombC.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// with negative feedback:\n{ BufCombN.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ BufCombL.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ BufCombC.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n// used as an echo.\n{ BufCombL.ar(b.bufnum, Decay.ar(Dust.ar(1, 0.5), 0.2, WhiteNoise.ar), 0.2, 3) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `PopUpMenu.background` do? What arguments does it take?"}, {"role": "assistant", "content": "Setting this variable colors the area of the view under the text with the given Arguments: A Color.."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n//algorithm to approach the square root of n\n~next = { |n| { |x| (x + n/x)/2 } };\n\n//look for a good enough match in the stream\n~within = { |eps, list| \n list.match({},\n { |a, rest|\n rest.match({},{ |b, rest2|\n if( (a-b).abs < eps){ b }{ ~within.(eps, rest) }\n });\n })\n};\n\n// A better way is to see how close a/b is to 1,\n// to avoid the rounding errors\n~relative = { |eps, list| \n list.match({},\n { |a, rest|\n rest.match({},{ |b, rest2|\n if( (a/b -1).abs < eps){ b }{\n// …\n```"}, {"role": "assistant", "content": "algorithm to approach the square root of n look for a good enough match in the stream (LazyList: Implementation of lazy list or stream)"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Impulse`."}, {"role": "assistant", "content": "```supercollider\n{ Impulse.ar(4, [0, MouseX.kr(0, 1)], 0.2) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nv = Vowel()\nv.addFormants([3000,4000], -6, [200, 200])\n\n{Formants.ar(100, v) * 0.1 }.play\n{Formants.ar(100, Vowel()) * 0.1}.play\n \n{[Formants.ar(100, Vowel()) * 0.1, Formants.ar(100, v) * 0.1 ]}.play\n\nv.removeFormants([5,6]\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nv = Vowel()\nv.addFormants([3000,4000], -6, [200, 200])\n\n{Formants.ar(100, v) * 0.1 }.play\n{Formants.ar(100, Vowel()) * 0.1}.play\n \n{[Formants.ar(100, Vowel()) * 0.1, Formants.ar(100, v) * 0.1 ]}.play\n\nv.removeFormants([5,6])\n```"}]} +{"conversations": [{"role": "user", "content": "What does `MxOutletApp.spec` do?"}, {"role": "assistant", "content": "Spec of the outlet as defined in the objects driver file in Returns: a Spec subclass"}]} +{"conversations": [{"role": "user", "content": "How to know the hardware buffer size?"}, {"role": "assistant", "content": "SuperCollider forum — How to know the hardware buffer size\n\nSay you want to use a UGen to control an external hardware device, independently of the soundcard. At first, one would think that this calculation is time-locked to the control rate, so e.g. at 1.5 kHz for a 48 kHz sample rate and a block size of 32.\n\nBut no, of course this calculation is time-locked to the hardware buffer size (I/O buffer size) of the soundcard you happen to use. EDIT: For a typical (low) setting, this is something like 256, so that would be about 190 Hz (5 ms). This may be too much delay for some applications, so we may want a smaller buffer size.\n\nIn scsynth, we can set a value for this size via ServerOptions:\n\n```supercollider\n // reduce to block size\ns.options.hardwareBufferSize = s.options.blockSize;\ns.reboot;\n```\n\nUnfortunately, not all soundcards support low block sizes. Also high quality sound cards may have very large ones, actually – this is a cultural thing, when you use them for recording, it is not a problem. But for live I/O it introduces delay (a quarter second is like an eternity then).\n\nSo now my question: how do I know if the above setting has been actually successful? How do I know what buffer size is current?\n\nI am sure that on different OSes there are ways to derive this in different ways. Maybe there is a way in supercollider as well?"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n \n// definition for future reference in arbitrary Environments,\n// intervals grow together with base tone\n\n(\nq = PLexprand(\\lo, \\hi);\n\np = Pbind(\n \\midinote, 60 + q + PLtuple([0, q]),\n \\dur, 0.1\n);\n);\n\n\n// prepare current Environment\n\n(\n~lo = 0.1;\n~hi = 10;\n);\n\n\n// run\n\nx = p.play;\n\n\n// replace \n\n~hi = 20;\n\nx.stop;\n```"}, {"role": "assistant", "content": "definition for future reference in arbitrary Environments, intervals grow together with base tone (PLexprand: dynamic scope Pexprand variant)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nb = Bus(\\audio, 0, 2);\ns.bind {\n SynthDef(\\sinPerc, { |out = 0|\n var signal = SinOsc.ar * Env.sine(0.1).ar(gate: Impulse.ar(2));\n OffsetOut.ar(out, signal ! 2) }\n ).add;\n s.sync;\n Synth(\\sinPerc, [\\out, b]);\n b.plot(1);\n}\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nb = Bus(\\audio, 0, 2);\ns.bind {\n SynthDef(\\sinPerc, { |out = 0|\n var signal = SinOsc.ar * Env.sine(0.1).ar(gate: Impulse.ar(2));\n OffsetOut.ar(out, signal ! 2) }\n ).add;\n s.sync;\n Synth(\\sinPerc, [\\out, b]);\n b.plot(1);\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n// p = ProxySpace.push(s.boot);\n\nl = NodeProxyEditor(nil, 3); l.w.bounds_(l.w.bounds.moveBy(0, 120));\nm = NodeProxyEditor(nil, 3); m.w.bounds_(m.w.bounds.moveBy(0, 240));\nn = NodeProxyEditor(nil, 3); n.w.bounds_(n.w.bounds.moveBy(0, 360));\no = NodeProxyEditor(nil, 3); o.w.bounds_(o.w.bounds.moveBy(0, 480));\n\nSpec.add(\\dens, [0.1, 300, \\exp]);\n\n // make 3 kinds of proxies: using tilde/pro\n// …\n```"}, {"role": "assistant", "content": "p = ProxySpace.push(s.boot); make 3 kinds of proxies: using tilde/proxyspace, Ndef, and unnamed. (NodeProxyEditor: editor for a nodeproxy - replaced by NdefGui!)"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `BinaryOpUGen`."}, {"role": "assistant", "content": "```supercollider\n// trigger an envelope\n(\n{\n var trig;\n trig = SinOsc.ar(1) > 0.1;\n EnvGen.kr(Env.perc, trig, doneAction: Done.none) * SinOsc.ar(440, 0, 0.1)\n}.play\n) // > outputs 0 or 1\n```"}]} +{"conversations": [{"role": "user", "content": "What does `FoaGamma.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "First Order Ambisonic (FOA) Soundfield Active-Reactive Intensity Alignment Arguments: in — The B-format signal, an array: [w, x, y, z]; size — Analysis filter kernel size.; method — The Soundfield analysis method:."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BHiPass`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n(\nz = {\n BHiPass.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(10, 20000, \\exponential), // cutoff freq.\n MouseY.kr(0.0, 1.0, \\linear), // rq\n 0.5); // mul\n}.play\n);\nz.release;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Ndef`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\nNdef(\\a).play; // play to hardware output.\nNdef(\\a).fadeTime = 2; // fadeTime specifies crossfade\n// set the source\nNdef(\\a, { SinOsc.ar([350, 351.3], 0, 0.2) });\nNdef(\\a, { Pulse.ar([350, 351.3] / 4, 0.4, 0.2) });\nNdef(\\a, Pbind(\\dur, 0.03, \\freq, Pbrown(0, 1, 0.1, inf).linexp(0, 1, 200, 350)));\n\nNdef(\\a, { Ringz.ar(Ndef.ar(\\b), [350, 351.3] * 2, 0.4) });\nNdef(\\b, { Impulse.ar([5, 7]/2, [0, 0.5], 0.15) });\n\nNdef.clear(3); // clear all after 3 seconds\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// this frees after the Decay has become quiet enough for a long enough time\n{ var signal = Decay.ar(Impulse.ar(0), 2, PinkNoise.ar(0.2)); DetectSilence.ar(signal, doneAction: Done.freeSelf; signal }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// this frees after the Decay has become quiet enough for a long enough time\n{ var signal = Decay.ar(Impulse.ar(0), 2, PinkNoise.ar(0.2)); DetectSilence.ar(signal, doneAction: Done.freeSelf); signal }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Pmulp` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\freq, Pseq([500, 600, 700]), \\instrument, \\sinegrain);\na = Pmulp(\\freq, Pseq([0.5, 0.9, 0.8], inf), a);\na.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Just going crazy with modulation. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"additivePad\", \n { arg numOfCycles = 100;\n var lfo;\n var lfo2;\n var lfo3;\n lfo = SinOsc.kr([Rand(0.5,1000),Rand(0.5,1000)], 1.5pi, 0.5, 0.5);\n lfo3 = SinOsc.kr([Rand(0.1,0.5),Rand(0.1,0.5)], 1.5pi, 0.5, 0.5);\n lfo2 = SinOsc.kr([(Rand(0.5,1000) * lfo) * lfo3, (Rand(0.5,1000) * (1 - lfo)) * (1 - lfo3)], 1.5pi, 0.5, 0.5);\n Out.ar(\n 0, \n Mix.arFill(\n numOfCycles,\n { \n SinOsc.ar(\n Rand(40,1000),\n 0, \n (numOfCycles.reciprocal * 0.75) * lfo2)\n }\n ) * EnvGen.kr(Env.perc(Rand(0.1,30), Rand(0.1,30)), doneAction: 2)\n )\n }\n).send(s); \n);\n\n(\nr = Routine({\n 200.do({\n x = Synth.new(\"additivePad\"); \n 10.wait;\n });\n});\n);\n\nr.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Ndef`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\nNdef(\\sound, { |freq = 56, numHarm = 10| Blip.ar(freq, numHarm, 30) * 0.2 }).play;\nNdef(\\sound).set(\\freq, 15);\nNdef(\\sound).set(\\freq, 15, \\numHarm, 100);\n\nNdef(\\lfo, { LFNoise2.kr(2).exprange(10, 200) });\nNdef(\\sound).map(\\numHarm, Ndef(\\lfo));\nNdef(\\sound).set(\\numHarm, nil); // unmap.\nNdef(\\sound).stop;\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for smooth arpeggio, updated envelope (a SuperCollider snippet): bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\bass, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.perc(0.2), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is a Buffer, and how is it different from a SoundFile?"}, {"role": "assistant", "content": "A Buffer is server-side memory: an array of samples (or a wavetable) living on scsynth, addressed by an integer bufnum. A SoundFile is a language-side object for reading or writing a file on disk. `Buffer.read(s, path)` loads a sound file into server memory and gives you a Buffer; `SoundFile.openRead(path)` just reads metadata such as duration and sample rate without loading audio. PlayBuf, GrainBuf and BufRd all take a Buffer, never a SoundFile."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\"help-InKr\", { |out = 0, in = 0|\n Out.ar(out,\n SinOsc.ar(In.kr(in, 1), 0, 0.1)\n )\n}).add;\nSynthDef(\"help-lfo\", { |out = 0|\n Out.kr(out, LFNoise1.kr(0.3, 200, 800))\n}).add;\n);\n\n\nb = Bus.control(s, 1);\nb.set(800);\n\nSynth(\"help-InKr\", [\\in, b.index]);\nb.set(400);\nb.set(300);\nSynth(\"help-lfo\", [\\out, b.index];\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\"help-InKr\", { |out = 0, in = 0|\n Out.ar(out,\n SinOsc.ar(In.kr(in, 1), 0, 0.1)\n )\n}).add;\nSynthDef(\"help-lfo\", { |out = 0|\n Out.kr(out, LFNoise1.kr(0.3, 200, 800))\n}).add;\n);\n\n\nb = Bus.control(s, 1);\nb.set(800);\n\nSynth(\"help-InKr\", [\\in, b.index]);\nb.set(400);\nb.set(300);\nSynth(\"help-lfo\", [\\out, b.index]);\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nNdef(\\birdy, {arg freq=1500, amp=0.5, rate=10;\n var osc, son, convIn, rand;\n osc=LFCub;\n rand = LFNoise1.ar(rate);\n convIn=LinCongN.ar(rate);\n son = osc.ar(Convolution.ar(convIn,convIn));\n freq = Latch.kr(rand.range(0,1).round(0.1), rand) * freq;\n freq = osc.ar(osc.ar(rand)*rand.range(0,10)).range(freq, freq*3);\n son = Formlet.ar(son, freq, convIn.abs*0.1, rand.abs);\n son = Normalizer.ar(son, 0.9, 0.1) * convIn.abs * LFPulse.kr(LFPulse.kr(rand.abs), 0, rand.abs);\n son = son + GVerb.ar(son, 99, 2, mul: rand.range(0,0.3));\n son * amp\n}).play\n)\n```"}, {"role": "assistant", "content": "I just rewrote one of autocsi's tweets and came out with this which sounds like a digital bird of some kind:."}]} +{"conversations": [{"role": "user", "content": "What does `JITGui.makeScroller` do?"}, {"role": "assistant", "content": "Some objects may have more elements to display than the gui has slots, e.g. a ProxySpace can have more proxies than the mixer has numItems. Then, only #-numItems elements are shown, and the others can be scrolled to with #-scroller - an EZScroller next to the slot elements. The makeScroller method should knows where in the zone to put the"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{var n= 1024; WaveletDaub.ar(SoundIn.ar, n, MouseX.kr(0,n))}.play\n\n{var n= 1024; WaveletDaub.ar(Saw.ar(MouseY.kr(50,10000, 'exponential'),0.5), n, MouseX.kr(0,n)}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{var n= 1024; WaveletDaub.ar(SoundIn.ar, n, MouseX.kr(0,n))}.play\n\n{var n= 1024; WaveletDaub.ar(Saw.ar(MouseY.kr(50,10000, 'exponential'),0.5), n, MouseX.kr(0,n))}.play\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `NodeProxy`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\na = NodeProxy.new.play; // play to hardware output.\na.fadeTime = 2; // fadeTime specifies crossfade\n// set the source\na.source = { SinOsc.ar([350, 351.3], 0, 0.2) };\na.source = { Pulse.ar([350, 351.3] / 4, 0.4) * 0.2 };\na.source = Pbind(\\dur, 0.03, \\freq, Pbrown(0, 1, 0.1, inf).linexp(0, 1, 200, 350));\n\nb = NodeProxy.new;\na.source = { Ringz.ar(b.ar, [350, 351.3] * 8, 0.2) * 4 };\nb.source = { Impulse.ar([5, 7]/2, [0, 0.5]) };\n\na.clear(3); // clear after 3 seconds\nb.clear(3);\n```"}]} +{"conversations": [{"role": "user", "content": "What is `PSdup` in SuperCollider?"}, {"role": "assistant", "content": "PSdup — Pattern which returns last values from other patterns via PSx PSdup uses the storage functionality of other PSx patterns. To track a value stream or event stream from a pattern you'd have to wrap the pattern into a PSx. Category: Libraries > miSCellaneous > PSx stream patterns, Streams-Patterns-Events > PSx stream patterns."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// write a sine oscillator's output to a pin\n\n(\nSynthDef(\"help-AnalogOut\", { |out = 0|\n AnalogOut.ar(0, SinOsc.ar(10));\n}).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// write a sine oscillator's output to a pin\n\n(\nSynthDef(\"help-AnalogOut\", { |out = 0|\n AnalogOut.ar(0, SinOsc.ar(10));\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is a UGen?"}, {"role": "assistant", "content": "A UGen is a unit generator: the primitive signal-processing node of the server. SinOsc, Saw, WhiteNoise, LPF and EnvGen are UGens, and they are wired into a graph inside a SynthDef."}]} +{"conversations": [{"role": "user", "content": "What does `Collection.size` do?"}, {"role": "assistant", "content": "Answers the number of objects contained in the Collection. `List[1, 2, 3,"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nf = ();\nf.beatAndBar = {\n var t = currentEnvironment.clock; // t= TempoClock.new;\n var text = \"xB: \";\n\n var nBeatsPerBar = { arg n, beats, clock;\n var nBpb = clock.beatsPerBar * n;\n \"\" ++ n ++ text ++ (nBpb - (beats%(nBpb))).asInteger\n };\n\n t.play({arg beats, time, clock;\n ( //[\"beat: \" ++ (t.beatInBar + 1).asInteger] ++ //uncomment for beat in bar\n [1,2,4,8,16,32].collect( {|n,i| nBeatsPerBar.value(n, beats, clock)})\n ).postln;\n 1});\n \"beatAntBar\";\n}\n);\n\nf[\\beatAndBar].value;\n\n(\nf[\\beatAndBar].value;\nCmdPeriod.add(f[\\beatAndBar]);\n)\n```"}, {"role": "assistant", "content": "Prints beats to bars for a mutiple of bar.\r\nHow many beats left until next 1, 2, 4, 8, 16, 32, etc bar."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nd = { |freq = 440| SinOsc.ar(LastValue.ar(freq, 20), 0, 0.2) }.play;\n\nd.set(\\freq, 400);\nd.set(\\freq, 200);\nd.set(\\freq, 670);\nd.set(\\freq, 680);\nd.set(\\freq, 695;\nd.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nd = { |freq = 440| SinOsc.ar(LastValue.ar(freq, 20), 0, 0.2) }.play;\n\nd.set(\\freq, 400);\nd.set(\\freq, 200);\nd.set(\\freq, 670);\nd.set(\\freq, 680);\nd.set(\\freq, 695);\nd.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// python preprocessor, given that you have python installed\n// thanks to tasos tsesmetzis\n\n(\nthis.preProcessor = PreProcessor.new.startDelimiter_(\"{-\").endDelimiter_(\"-}\");\n\n// a simple python call\ne = (\n lang: \\python,\n languages:\n (\n python: // code is the incoming string, event is the event for parameters and output\n {|code, event|\n var input, pipe, output;\n code = e[\\prefix] ++ \"print\" ++ \"(\" ++ code ++ \")\";\n input = \"python -c '%'\".format(code);\n pipe = Pipe(input, \"r\");\n output = pipe.readUpTo;\n pipe.close;\n event.put(\\result, output)\n }\n ),\n prefix: \"import math;\"\n);\n);\n\n// ok, assuming such a little interpreter exists for a given language,\n// one can now use it in code.\n\n(\ne =\n{-\n math.factorial(61)\n-}.value(e);\ne.result;\n);\n\ne.calc_result = e.result.as(Array).collect { |x| x.asString.interpret };\n\nPbind(\\note, Pseq(e.calc_result), \\dur, 0.1).play;\n```"}, {"role": "assistant", "content": "python preprocessor, given that you have python installed thanks to tasos tsesmetzis."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// No args: loopback is immediate\n{ EnvGen.kr(Env([0.1, 1, 0.5], [0.01, 0.03]).circle) }.plot(0.2).plotMode_(\\dlines)\n\n// With loopback time and curve specified\n{ EnvGen.kr(Env([0.1, 1, 0.5], [0.01, 0.03]).circle(0.05, \\sin)) }.plot(0.2).plotMode_(\\dlines)\n\n( // Looping frequency modulation\n{\n SinOsc.ar(\n EnvGen.kr(\n Env(\n [6000, 700, 100], [1, 1], ['exp', 'lin']\n ).circle.postcs // post internal representation\n )\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// No args: loopback is immediate\n{ EnvGen.kr(Env([0.1, 1, 0.5], [0.01, 0.03]).circle) }.plot(0.2).plotMode_(\\dlines)\n\n// With loopback time and curve specified\n{ EnvGen.kr(Env([0.1, 1, 0.5], [0.01, 0.03]).circle(0.05, \\sin)) }.plot(0.2).plotMode_(\\dlines)\n\n( // Looping frequency modulation\n{\n SinOsc.ar(\n EnvGen.kr(\n Env(\n [6000, 700, 100], [1, 1], ['exp', 'lin']\n ).circle.postcs // post internal representation\n )\n ) * 0.1\n // add an audible metronome\n + (SinOsc.ar(280) * Decay.ar(Impulse.ar(1), 0.05) * 0.5)\n}.play;\n);\n\n( // Control the gate with MouseX\n{\n SinOsc.ar(\n EnvGen.kr(\n Env(\n [6000, 700, 100], [0.5, 0.5], ['exp', 'lin']\n ).circle(1).postcs,\n MouseX.kr > 0.5\n )\n ) * 0.1\n + (SinOsc.ar(280) * Decay.ar(Impulse.ar(1), 0.05) * 0.5)\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `NdefMixer` in SuperCollider briefly."}, {"role": "assistant", "content": "NdefMixer — mix control for an Ndef proxyspace NdefMixer is nearly identical to ProxyMixer, except that it looks at the proxyspaces for each server that `Ndef.all` contains. Category: JITLib > GUI, Live Coding."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\"help-LFNoise0\", { arg out=0;\n Out.ar(out,\n LFBrownNoise0.ar(1000, 1, MouseX.kr(0, 5), 0.25)\n )\n}).play;\n);\n\n//use as frequency control\n(\nSynthDef(\"help-LFNoise0\", { arg out=0;\n Out.ar(out,\n SinOsc.ar(\n LFBrownNoise0.ar(8, 0.1, 2, 400, 450),\n 0, 0.2\n )\n )\n}).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\"help-LFNoise0\", { arg out=0;\n Out.ar(out,\n LFBrownNoise0.ar(1000, 1, MouseX.kr(0, 5), 0.25)\n )\n}).play;\n);\n\n//use as frequency control\n(\nSynthDef(\"help-LFNoise0\", { arg out=0;\n Out.ar(out,\n SinOsc.ar(\n LFBrownNoise0.ar(8, 0.1, 2, 400, 450),\n 0, 0.2\n )\n )\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Pseq` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Pseq(#[60, 61, 63, 65, 72], inf).asStream;\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, a.next.midicps]);\n 0.2.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// =========================\n// extra demos for \\glockenspiel\n// =========================\n\n(\n// made by Diya Menon\n// demo\nPbindef(\\dmglockenspiel,\n \\instrument, \"glockenspiel\",\n \\midinote, Pseq([\n [65, 68, 72, 75],\n 72, 72, 72, 70, 72, 70, 68,\n [61, 65, 70, 73, 77],\n 73, 73, 73, 72, 72, 70, 68], 2),\n \\amp, Pseq([0.015, 0.005, 0.005, 0.0075, 0.0075, 0.01, 0.01, 0.02], 4) * 3,\n \\dur, Pseq([0.3, 0.3, 0.3, 0.15, 0.15, 0.3, 0.15, 0.15], 4),\n \\rel, 3,\n \\exciterRel, 0.03,\n \\att, 0.0005,\n).play;\n)\n```"}, {"role": "assistant", "content": "========================= extra demos for \\glockenspiel =========================."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// modulating the frequency\n\n{ Saw.ar(XLine.kr(40, 4000, 6), 0.2) }.play;\n\n// two band limited sawtooth waves through a resonant low pass filter\n\n{ RLPF.ar(Saw.ar([100, 250], 0.1), XLine.kr(8000, 400, 5), 0.05 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// modulating the frequency\n\n{ Saw.ar(XLine.kr(40, 4000, 6), 0.2) }.play;\n\n// two band limited sawtooth waves through a resonant low pass filter\n\n{ RLPF.ar(Saw.ar([100, 250], 0.1), XLine.kr(8000, 400, 5), 0.05) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for nothing much ). Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n{|atk=0.05,dur=10,freq=50,amp=0.8|\n PMOsc.ar(\n Line.kr(1,2,dur,freq),\n LFNoise2.kr([1,2]).range(1,2)*freq,\n LFNoise2.kr([2,1]).range(0.1,3.5),\n 0,\n Decay2.ar(\n Impulse.ar(XLine.kr(1, 25, dur)) * SinOsc.ar(4/dur,[0,pi/2],0.05,1),\n 0.023, XLine.ar(1,35,dur).reciprocal,\n Line.ar(1,0.8,dur) * LFNoise2.kr(4/dur,0.05,1).dup\n ) * EnvGen.ar(Env([0,1,1,0],[atk,dur-atk,0.3]),1,amp, doneAction:2)\n )\n // * LFPulse.ar(XLine.kr(5,20,dur,freq * LFNoise2.kr([1,2]).range(0.95,1.05)))\n}.play(args:[\n freq:50.rrand(350).debug('freq'),\n dur:10.rrand(20).debug('dur')\n])\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Mix`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var n;\n n = 8; // number of 'voices'\n Mix.new( // mix all stereo pairs down.\n Pan2.ar( // pan the voice to a stereo position\n CombL.ar( // a comb filter used as a string resonator\n Dust.ar( // random impulses as an excitation function\n // an array to cause expansion of Dust to n channels\n // 1 means one impulse per second on average\n Array.fill(n, 1),\n 0.3 // amplitude\n ),\n 0.01, // max delay time in seconds\n // array of different random lengths for each 'string'\n Array.fill(n, {0.004.rand+0.0003}),\n 4 // decay time in seconds\n ),\n Array.fill(n,{1.0.rand2}) // give each voice a different pan position\n )\n )\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "I get 'Buffer UGen: no buffer data'. What does it mean?"}, {"role": "assistant", "content": "The UGen got a bufnum that the server has no data for. `Buffer.read` is asynchronous: the Buffer object exists immediately but the samples arrive later, so a Synth created straight after `Buffer.read` reads nothing. Wait for it — `s.sync` after the read, or `Buffer.read(s, path, action: { |b| ... })` and create the Synth in the action. The other cause is a nil or wrong buffer: `PlayBuf.ar(1, ~buf)` where ~buf was never assigned passes 0, which is 'no buffer'."}]} +{"conversations": [{"role": "user", "content": "What are the server's default sample rate and block size?"}, {"role": "assistant", "content": "44100 Hz and 64 samples per block by default, so the control rate is 44100/64 = 689.06 Hz. You can read them from the language with `s.sampleRate` and `s.options.blockSize`, or from inside a Synth with `SampleRate.ir` and `ControlRate.ir`. A `.kr` signal therefore updates about 689 times a second, which is why it is smooth enough for filters and envelopes but not for audio-rate FM."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `CuspN`."}, {"role": "assistant", "content": "```supercollider\n// vary frequency\n{ CuspN.ar(MouseX.kr(20, SampleRate.ir), 1.0, 1.99) * 0.3 }.play(s);\n\n// mouse-controlled params\n{ CuspN.ar(SampleRate.ir/4, MouseX.kr(0.9, 1.1, 1), MouseY.kr(1.8, 2, 1)) * 0.3 }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(CuspN.ar(40, MouseX.kr(0.9, 1.1, 1), MouseY.kr(1.8, 2, 1))*800+900)*0.4 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `LFSaw`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\nfork {\n ~group = Group();\n\n 2.wait;\n\n SynthDef(\\buzz, {\n |out = 0, freq = 300, amp = 0.1, filter = 1.7|\n var sig = LFSaw.ar(freq * [1, 3, 5], 0, amp * [1, 0.5, 0.25]).sum;\n sig = LPF.ar(sig, freq * filter);\n Out.ar(out, sig);\n }).add;\n\n [50, 53, 58, 46, 60].midicps.do {\n |f, i|\n Synth(\\buzz, [\n \\out: 0, \\freq, f, \\filter: (i / 2) + 1\n ], target:~group);\n 2.wait;\n };\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `MIDIIn.removeFuncFrom` do? What arguments does it take?"}, {"role": "assistant", "content": "Remove a Function or similar object from the list of those to be evaluated whenever a particular MIDI message is received. This method is preferable to the setters below, since it will leave any existing functions in Arguments: what — A Symbol indicating the message type, one of `'noteOn'` `'noteOff'`, `'polytouch'`, `'control'`, `'program'`, `'touch'`, `'bend'`, `'sysex'`, `'sysrt'`, `'smpte'`, or `'invalid'` (for invalid sysex messages).; func — The Function or similar object to be removed.."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nt = TempoClock(120/60).permanent_(true);\n\n(\n~change_clock_tempo = {|clock, tempo, beats=1|\n beats.do {|beat|\n var stepTempo = beat.linexp(0, beats-1, clock.tempo, tempo);\n clock.schedAbs(clock.nextBar + beat, {\n \"New Tempo: \".post; (stepTempo*60).post; \" BPM\".postln;\n clock.tempo_(stepTempo);\n });\n };\n nil;\n};\nPbindef(\\n,\n \\octave, 4,\n \\dur, 0.5,\n \\degree, Pseq((0..7), inf)\n).play(t, quant: 4);\n);\n\n~change_clock_tempo.value(t, 200/60, 16);\n~change_clock_tempo.value(t, 50/60, 8);\nt.tempo*60\n```"}, {"role": "assistant", "content": "This gradually changes the tempo of a TempoClock, each beat of a specified number of beats, and starting at the next bar.\r\n\r\n\r\nPersonally, I was not able to heavily distinguish between `.linlin` and `.linexp` for reasonable musical tempos.\r\n\r\n\r\nThere may be a mathematically smoother way of handling this at the control rate.\r\n\r\n\r\nThis function does not gracefully handle multiple simultaneous invoca."}]} +{"conversations": [{"role": "user", "content": "Explain `KrNumberEditorGui` in SuperCollider briefly."}, {"role": "assistant", "content": "KrNumberEditorGui — gui class Category: Libraries > crucial > GuiClasses."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LFTri`."}, {"role": "assistant", "content": "```supercollider\n// plot:\n{ LFTri.ar(40) }.plot(0.1);\n{ LFTri.ar(XLine.kr(1, 800, 0.1)) }.plot(0.1);\n\n{ LFTri.ar(500, 0, 0.1) }.play\n\n// used as both Oscillator and LFO:\n{ LFTri.ar(LFTri.kr(4, 0, 200, 400), 0, 0.1) }.play\n\n// phase. compare\n{ LFTri.ar(LFTri.kr(0.1, iphase: 0) * 200 + 400, 0, 0.1) }.play\n{ LFTri.ar(LFTri.kr(0.1, iphase: 1) * 200 + 400, 0, 0.1) }.play\n{ LFTri.ar(LFTri.kr(0.1, iphase: 2) * 200 + 400, 0, 0.1) }.play\n{ LFTri.ar(LFTri.kr(0.1, iphase: 3) * 200 + 400, 0, 0.1) }.play\n\n// together\n{ LFTri.ar(LFTri.kr(0.05, iphase: (0..3)) * 200 + 400, 0, 0.1).sum }.play\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// The code below generates a series of test signals for each speaker of \n// the currently active setup. In the default settings this generates \n// short pink noise bursts, twice on each group of 8 speakers.\n\n(\nn = 8; // size of speaker groups\nz = 1/4; // duration per burst\nt = \\pinkNoise; // udef name for sound generation\nr = 2; // number of repeats per group\nx = UScore();\n\n(WFSSpeakerConf.default.speakerCount / n).ceil.do({ |i|\n var folder;\n folder = UScore( i * (r * (n + 1) * z) );\n x.add( folder );\n r.do({ |ii|\n n.do({ |iii|\n folder.add( UChain( ((ii * (n + 1)) + iii) * z, iii, z * (3/4), \n [ t, [ \\seed, 12345 ] ],\n [ \\wfsIndex, [ \\index, (i * 8) + iii, \\gain, 0 ] ]\n )\n );\n });\n });\n folder.name = ([1,n] + (i*8)).join(\"-\"); \n});\n\nx.gui;\n)\n```"}, {"role": "assistant", "content": "The code below generates a series of test signals for each speaker of the currently active setup. In the default settings this generates short pink noise bursts, twice on each group of 8 speakers."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// modulate frequency and index multiplier\n{ FBSineL.ar(LFNoise2.kr(1, 1e4, 1e4), LFNoise2.kr(1, 16, 17), 1, 1.005, 0.7) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// modulate frequency and index multiplier\n{ FBSineL.ar(LFNoise2.kr(1, 1e4, 1e4), LFNoise2.kr(1, 16, 17), 1, 1.005, 0.7) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What is `TrigControl` in SuperCollider?"}, {"role": "assistant", "content": "TrigControl — FIXME: TrigControl purpose. FIXME: TrigControl description. Category: UGens > Synth control, UGens > Undocumented."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\ns.boot // Boot the server, if you need to\n\n// read a whole sound into memory\n\n// ExampleFiles helps locate audio files used in examples\np = ExampleFiles.child;\n// peek at the path to see location and the format of a path\np.postln;\n// read the file into a buffer\nb = Buffer.read(s, p); // remember to free the buffer later.\n\nSynthDef(\\help_PlayBuf, { |out = 0, bufnum = 0|\n Out.ar(out,\n PlayBuf.ar(1, bufnum, BufRateScale.kr(bufnum), doneAction: Done.freeSelf)\n )\n}).play(s, [\\out, 0, \\bufnum, b]);\n```"}, {"role": "assistant", "content": "read a whole sound into memory ExampleFiles helps locate audio files used in examples (PlayBuf: Sample playback oscillator.)"}]} +{"conversations": [{"role": "user", "content": "What does `Object.asArray` do?"}, {"role": "assistant", "content": "Returns an Array with the receiver, unless it is an Array already. `[1, 2,"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `FreqScope`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n// create a new analyzer\nFreqScope.new(400, 200, 0, server: s);\n\n// basic sine\n{ SinOsc.ar(2000, 0, 0.25) }.play(s);\n\n// random saw\n{ RLPF.ar(Saw.ar(110, 0.2), LFNoise2.kr(1, 1e4, 1e4), LFNoise2.kr(1, 0.2, 0.22)) }.play(s);\n\n// modulate phase\n{ SinOsc.ar(800, SinOsc.ar(XLine.kr(20, 8000, 10), 0, 2pi), 0.25) }.play(s);\n\n// all harmonics\n{ Blip.ar(200, Line.kr(1, 100, 10), 0.2) }.play(s);\n\n// access the FreqScopeView object to set properties of the Qt Object:\nFreqScope.getInstance // get the FreqScope instance\n .scope // and its FreqScopeView\n .setProperty(\\updateInterval, 1000)\n // set updateInterval to 1000 ms because of reasons\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n/* Audio plugin definition\n\n Each audio plugin should define the following global variables:\n ~name: (symbol) name of the spatializer\n ~description: (string) a short description\n ~function: the actual definition of the plugin\n\n*/\n\n~name = \\PinkSin;\n~description = \"Mix of pink noise and sine wave\";\n~channelLayout = \\mono;\n\n~function = {| sfreq = 200, amp = 1 |\n amp*(PinkNoise.ar() + FSinOsc.ar(sfreq))\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "What does `Knob.mode` do? What arguments does it take?"}, {"role": "assistant", "content": "The way value is controlled with respect to mouse movement after clicking on the Arguments: One of the symbols listed above.."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `AbstractFunction`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\na = { |x| #[440, 720, 801, 1020.2].at(x) }; b = a.cpsmidi; [a.value(3), b.value(3)];\na = Pseries(220, 220, inf).cpsmidi; a.asStream.nextN(12); // overtone series as midinotes\n// follow but round to next midinote\n{ a = Pitch.kr(SoundIn.ar).at(1); Pulse.ar(a.cpsmidi.round.midicps) * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\"help-out\", { |out = 0, freq = 440|\n var source;\n source = SinOsc.ar(freq, 0, 0.1);\n\n // write to the bus, adding to previous contents\n Out.ar(out, source);\n\n}).add;\n);\n\n\nSynth(\"help-out\", [\\freq, 500]);\nSynth(\"help-out\", [\\freq, 600]);\nSynth(\"help-out\", [\\freq, 700];\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\"help-out\", { |out = 0, freq = 440|\n var source;\n source = SinOsc.ar(freq, 0, 0.1);\n\n // write to the bus, adding to previous contents\n Out.ar(out, source);\n\n}).add;\n);\n\n\nSynth(\"help-out\", [\\freq, 500]);\nSynth(\"help-out\", [\\freq, 600]);\nSynth(\"help-out\", [\\freq, 700]);\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for get different result each time running the pattern: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\nTempoClock.default.tempo = 156/60;\n\n(\nSynthDef(\\spring, { |freq = 400, out = 0, pan = 0, gate = 1, dur = 0.15, curve = -4, amp = 1, index = 1|\n var sig = FreeVerb.ar(Pan2.ar(Blip.ar(freq, index), pan));\n var env = EnvGen.ar(Env.perc(0.01, dur, amp, curve), gate, doneAction:2);\n Out.ar(0, sig * env);\n}).add;\n);\n\n(\nPbind(*[\n instrument: \\spring,\n dur: Pseq([4, 1, 2, 1, 1, 1].scramble/ 4 / TempoClock.default.tempo, inf),\n degree: Pseq(#[1,2,3,4], inf) * Pkey(\\dur).reciprocal,\n octave: Pseq([2,3,4,4,4,3].scramble, inf),\n pan: Pxrand(Array.fill(100, { 0.gaussian(1).clip2(1) }), inf),\n amp: Pseq(#[0.95,1,0.8],inf),\n index: Pstutter(Pseq(#[4,8,12],inf), Pseq([2,3,4,5,6,8].scramble, inf))\n]).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nNdef(\\sound).fadeTime = 3;\n(\nNdef(\\sound, { |fadeTime = 1, gate = 1|\n var e = Env.adsr(fadeTime, 0.01, 0.4, fadeTime).ar(2, gate);\n SinOsc.ar(100 + (e * 700), SinOsc.ar(208) * (1 - e) * 6) * e * 0.1\n}).play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nNdef(\\sound).fadeTime = 3;\n(\nNdef(\\sound, { |fadeTime = 1, gate = 1|\n var e = Env.adsr(fadeTime, 0.01, 0.4, fadeTime).ar(2, gate);\n SinOsc.ar(100 + (e * 700), SinOsc.ar(208) * (1 - e) * 6) * e * 0.1\n}).play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// another example\n\n(\n// must have power of two framesize- FFT size will be sorted by Convolution2 to be double this\n// maximum is currently a = 8192 for FFT of size 16384\na = 2048;\n// kernel buffer\ng = Buffer.alloc(s, a, 1);\n);\n\n(\ng.set(0, 1.0);\n100.do { |i| g.set(a.rand, (i + 1).reciprocal) };\n);\n\n(\n// random impulse response\n{\n var input, inputAmp, threshhold, gate;\n\n input = SoundIn.ar(0);\n inputAmp = Amplitude.kr(input);\n threshhold = 0.02; // noise gating threshold\n gate = Lag.kr(inputAmp > threshhold, 0\n// …\n```"}, {"role": "assistant", "content": "must have power of two framesize- FFT size will be sorted by Convolution2 to be double this maximum is currently a = 8192 for FFT of size 16384 (Convolution2L: Real-time convolver with linear interpolation)"}]} +{"conversations": [{"role": "user", "content": "What does `Vowel.brightenRel` do? What arguments does it take?"}, {"role": "assistant", "content": "lift the upper formants by multiplying their dBs with a factor. The sum of all dBs remains Arguments: bright — coefficient to brighten the vowel. Typical ranges are from 1 (no change) to 3.; refFormant — reference formant, whose amplitude remains unchanged. Default value is 0 (first formant)."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `List`."}, {"role": "assistant", "content": "```supercollider\n(\n// Create a new empty List with size: 3\nx = List.new(3);\n\nx.postln; // -> List[ ]\n\n// Add numbers 0 to 4 to the List\n5.do({ |i| x.add(i) });\n\n// The list has been modified in-place with each added item\nx.postln; // -> List[ 0, 1, 2, 3, 4 ]\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Splay` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\nx = { |spread = 1, level = 0.1, center = 0|\n var n = 20;\n var snd = Splay.ar(LFPulse.ar({ 100.exprand(2000) } ! n).range(-1, 1),\n spread, level, center);\n Peak.ar(snd, 0.01, 1).ampdb.poll(1);\n snd\n}.play;\n);\n\n// at full spread, level -20, pan to center:\n// peak is higher at -11 db\nx.set(\\spread, 1, \\center, 0);\n// with no spread, i.e. all panned center, slightly higher -10\nx.set(\\spread, 0, \\center, 0);\n// worst case: no spread, pan full left: -8db\nx.set(\\spread, 0, \\center, -1); // -8\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `NRand`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-NRand\", { |out = 0, n = 0|\n Out.ar(out,\n FSinOsc.ar(\n NRand(1200.0, 4000.0, n),\n 0, Line.kr(0.2, 0, 0.01, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n(\nn = 0;\nRoutine({\n inf.do({ |i|\n Synth.new(\"help-NRand\", [\\n, n]); 0.05.wait;\n })\n}).play;\n);\n\nn = 1;\nn = 2;\nn = 4;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `LinRand` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-LinRand\", { |out = 0, minmax = 1|\n Out.ar(out,\n FSinOsc.ar(\n LinRand(200.0, 10000.0, minmax),\n 0, Line.kr(0.2, 0, 0.01, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n// towards hi\n(\nRoutine({\n loop({\n Synth.new(\"help-LinRand\"); 0.04.wait;\n })\n}).play;\n);\n\n// towards lo (doesn't work like that yet)\n(\nRoutine({\n loop({\n Synth.new(\"help-LinRand\", [\\minmax, -1]); 0.04.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Pulse`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\\harpsi, { |outbus = 0, freq = 440, amp = 0.1, gate = 1|\n var out;\n out = EnvGen.ar(Env.adsr, gate, doneAction: Done.freeSelf) * amp *\n Pulse.ar(freq, 0.25, 0.75);\n Out.ar(outbus, out ! 2);\n}).add; // see below for more on .add\n\np = Pbind(\n // Use \\harpsi, not \\default\n \\instrument, \\harpsi,\n \\degree, Pseries(0, 1, 8),\n \\dur, 0.25\n).play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `String.help` do?"}, {"role": "assistant", "content": "Performs #-findHelpFile on this, and opens the file it if it exists, otherwise opens the main helpfile."}]} +{"conversations": [{"role": "user", "content": "What does `BusPlug.audio` do?"}, {"role": "assistant", "content": "Create a new audio rate instance on the given"}]} +{"conversations": [{"role": "user", "content": "What does `Patch.rand` do? What arguments does it take?"}, {"role": "assistant", "content": "call .rand on all inputs that support .rand; specifically NumberEditors will do a gaussian distribution randomization centered on the default value of the Arguments: standardDeviation — for the gaussian randomization in NumberEditors. default 0.15. Returns: this"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Klank`."}, {"role": "assistant", "content": "```supercollider\n{ Klank.ar(`[[800, 1071, 1153, 1723], nil, [1, 1, 1, 1]], Impulse.ar(2, 0, 0.1)) }.play;\n\n{ Klank.ar(`[[800, 1071, 1353, 1723], nil, [1, 1, 1, 1]], Dust.ar(8, 0.1)) }.play;\n\n{ Klank.ar(`[[800, 1071, 1353, 1723], nil, [1, 1, 1, 1]], PinkNoise.ar(0.007)) }.play;\n\n{ Klank.ar(`[[200, 671, 1153, 1723], nil, [1, 1, 1, 1]], PinkNoise.ar([0.007, 0.007])) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SinOsc.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Interpolating sine wavetable oscillator. Arguments: freq — Frequency in Hertz. Sampled at audio-rate.; phase — Phase in radians. Sampled at audio-rate.; mul — Output will be multiplied by this value.; add — This value will be added to the output.."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n~constructPseudoMethods = { |envir|\n var newEnvir = envir.collect { |value|\n var argNames, argBlock, namesBlock, code, func;\n if(value.isKindOf(Function)) {\n func = value;\n argNames = func.def.argumentString(withDefaultValues: true);\n namesBlock = func.def.argumentString(withDefaultValues: false);\n argBlock = if(argNames.notNil) { \"|self, \" ++ argNames ++ \"|\" };\n code = \"{ |func, envir| { % envir.use { func.value(%) } } }\".format(argBlock ? \"\", namesBlock ? \"\");\n //code.postln;\n code.interpret.value(func, envir)\n } {\n value\n }\n };\n newEnvir.know = true; // we want a prototype object style environment\n};\n```"}, {"role": "assistant", "content": "/*\r\nI often like to write out a library as an environment, like:\r\n\r\n~start_sound = { |freq, amp| <...> };\r\n~start_high_pitch_sound = { |amp| ~start_sound.(14000, amp) };\r\n\r\n… and then use loadRelative to load that library.\r\n\r\nThis, however has the problem that you can't stick the whole library into an environment that you call from the outside. e.g.\r\n\r\nq = ();\r\nq.use { resolveRelative(\"/library.sc."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `In` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n(\nSynthDef(\"help-PinkNoise\", { |out = 0|\n Out.ar(out, PinkNoise.ar(0.1))\n}).add;\n\nSynthDef(\"help-In\", { |out = 0, in = 0|\n var input;\n input = In.ar(in, 1);\n Out.ar(out, input);\n\n}).add;\n);\n\n// play noise on the right channel\nx = Synth(\"help-PinkNoise\", [\\out, 1]);\n\n// read the input and play it out on the left channel\nSynth.after(x, \"help-In\", [\\out, 0, \\in, 1]);\n```"}]} +{"conversations": [{"role": "user", "content": "I get 'index out of range' when playing a buffer."}, {"role": "assistant", "content": "A read position is past the end of the buffer. `PlayBuf` with a `startPos` in frames beyond `~buf.numFrames`, or a `BufRd`/`GrainBuf` whose phase goes above 1, produces this. For GrainBuf, pos is normalised 0..1, so pass `LFNoise1.kr(1).range(0, 1)` rather than a frame count; for PlayBuf, cap the position at `~buf.numFrames - 1`. If you just loaded the file, check `~buf.numFrames` — a failed read gives 0 frames and every position is out of range."}]} {"conversations": [{"role": "user", "content": "What does `Dictionary.merge` do? What arguments does it take?"}, {"role": "assistant", "content": "Combine two dictionaries into a new one by applying a function to each value. If fill is true (default: true), values missing from one of them are kept as they are. `d = Dictionary[\\a -> 5, \\b -> 7, \\d -> Arguments: that — another dictionary.; func — a Function.; fill — a Boolean.."}]} -{"conversations": [{"role": "user", "content": "What does `Tdef.count` do?"}, {"role": "assistant", "content": "Create and update condition that simply counts up to n and switches the pattern"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// create a def with some variants\n(\nSynthDef(\\vartest, { |out, freq = 440, amp = 0.2, a = 0.01, r = 1|\n // the EnvGen with doneAction: Done.freeSelf frees the synth automatically when done\n Out.ar(out, SinOsc.ar(freq, 0, EnvGen.kr(Env.perc(a, r, amp), doneAction: Done.freeSelf)));\n}, variants: (alpha: [a: 0.5, r: 0.5], beta: [a: 3, r: 0.01], gamma: [a: 0.01, r: 4])\n).add;\n);\n\n// now make some synths. First using the arg defaults\nSynth(\\vartest);\n\n// now the variant def\n// …\n```"}, {"role": "assistant", "content": "create a def with some variants the EnvGen with doneAction: Done.freeSelf frees the synth automatically when done (SynthDef: Client-side representation of a synth definition)"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\AcnSn3dIn;\n~description = \"A live ambisonic input (ACN_SN3D)\";\n~channelLayout = \\ambi;\n\n~function = { |order=1, t_trig = 0, bus = 0|\n var env = EnvGen.kr(Env([0,1], [1]), t_trig);\n var chans = Array.series(\n size: (order + 1).pow(2).asInteger,\n start: bus,\n step: 1\n );\n var input = SoundIn.ar(chans) * env;\n HOAConverterAcnSn3d2AcnN3d.ar(order, input);\n};\n```"}, {"role": "assistant", "content": "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see ."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// embedding an event\na = (z: 77);\nb = Pset(\\y, 8, a.streamArg(true)).asStream;\nc = Pset(\\y, 8, a.streamArg(false)).asStream;\nb.nextN(3, ()); // this ends\nc.nextN(3, ()); // this loops\n\n// embedding a pattern\na = Pbind(\\note, Pseq([1, 2]));\nb = Pset(\\y, 8, a.streamArg(true)).asStream;\nc = Pset(\\y, 8, a.streamArg(false)).asStream;\nb.nextN(3, ()); // this ends\nc.nextN(3, (); // this ends, too\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// embedding an event\na = (z: 77);\nb = Pset(\\y, 8, a.streamArg(true)).asStream;\nc = Pset(\\y, 8, a.streamArg(false)).asStream;\nb.nextN(3, ()); // this ends\nc.nextN(3, ()); // this loops\n\n// embedding a pattern\na = Pbind(\\note, Pseq([1, 2]));\nb = Pset(\\y, 8, a.streamArg(true)).asStream;\nc = Pset(\\y, 8, a.streamArg(false)).asStream;\nb.nextN(3, ()); // this ends\nc.nextN(3, ()); // this ends, too\n```"}]} -{"conversations": [{"role": "user", "content": "What is `BHiPass`?"}, {"role": "assistant", "content": "BHiPass — 12db/oct rolloff - 2nd order resonant Hi Pass Filter"}, {"role": "user", "content": "What does `BHiPass.sc` do?"}, {"role": "assistant", "content": "calculate filter coefficients."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n(\nz = {\n BHiPass.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(10, 20000, \\exponential), // cutoff freq.\n MouseY.kr(0.0, 1.0, \\linear), // rq\n 0.5); // mul\n}.play\n);\nz.release;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = { |x| sin(x) } rrand: { |x| sin(x) * -1 };\n(0..1000).normalize(0, 5pi).collect(a).plot;\n\n(\n{ a = SinOsc.ar(335); b = SinOsc.ar(MouseX.kr(1, 1000, 1));\nrrand(a, b) * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = { |x| sin(x) } rrand: { |x| sin(x) * -1 };\n(0..1000).normalize(0, 5pi).collect(a).plot;\n\n(\n{ a = SinOsc.ar(335); b = SinOsc.ar(MouseX.kr(1, 1000, 1));\nrrand(a, b) * 0.1 }.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Fb1_ODE` in SuperCollider?"}, {"role": "assistant", "content": "Fb1_ODE — general ordinary differential equation integrator pseudo ugen Pseudo ugen for integrating / audifying ordinary (systems of) differential equations with initial values in realtime, based on the Fb1 single sample feedback class. It makes use of Fb1_ODEdef and Fb1_ODEintdef, containers for ODEs and numerical solution methods, which provide an interface for adding new ODE systems or integration methods interactively. There exists a huge number of ODE models in d Category: Libraries > miSCellaneous > Nonlinear."}]} +{"conversations": [{"role": "user", "content": "What does `Ndef.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Return a new node proxy and store it in a global ProxySpace under the key. If there is already an Ndef there, replace its object with the new one. The object can be any supported class, see NodeProxy#Supported sources help. Internally, all instances are kept in a ProxySpace. The EnvironmentRedirect#dispatch function is called when the source is Arguments: key — the name of the proxy (usually a symbol). If only the key is given and no object, it returns the proxy object: `Ndef(\\x) // get the proxy` If key is an association, it is interpreted as key -> server name. (order changed in SC3.3 !). If no name is given, it uses the default server that was default w; object — an object `Ndef(\\x, { Dust.ar }); // returns the proxy and set the sour`."}]} +{"conversations": [{"role": "user", "content": "What does `SimpleNumber.ellintD` do?"}, {"role": "assistant", "content": "Returns the incomplete elliptic integral D(phi, k), Legendre form. Requires `-1 <= k <="}]} +{"conversations": [{"role": "user", "content": "What is `SynthDesc`?"}, {"role": "assistant", "content": "SynthDesc — Description of a synth definition"}, {"role": "user", "content": "What does `SynthDesc.read` do?"}, {"role": "assistant", "content": "Adds all synthDescs in a path to a dict. You should not use this method or *readFile to read SynthDescs into a SynthDescLib. Use SynthDescLib#read or SynthDescLib#readStream instead."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"test\", { |out, freq, xFade|\n XOut.ar(out, xFade, SinOsc.ar(freq))\n}).store\n);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Balance2`."}, {"role": "assistant", "content": "```supercollider\n// a stereo signal, both channels at 0dB\n{ [SinOsc.ar(440), SinOsc.ar(440)] }.play\n\n// using Balance on a stereo signal with the position parameter at 0, effectively the same sound but both channels at -3dB\n{ Balance2.ar(SinOsc.ar(440), SinOsc.ar(440), 0) }.play\n\n// pan sweep from left to right\n{ Balance2.ar(SinOsc.ar(440), SinOsc.ar(1000), Line.kr(-1, 1, 5)) }.play\n\n// other examples\n{ Balance2.ar(LFSaw.ar(44), Pulse.ar(33), FSinOsc.kr(0.5), 0.1) }.play;\n{ var source; source = SinOsc.ar([440, 550]); Balance2.ar(source[0], source[1], LFNoise0.kr(4), 0.3) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.quit;\nf = { Group.new(s.defaultGroup); \"Other code can be evaluated too\".postln };\nServerTree.add(f);\ns.boot;\ns.queryAllNodes; // note the group within the default group\nServerTree.remove(f;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.quit;\nf = { Group.new(s.defaultGroup); \"Other code can be evaluated too\".postln };\nServerTree.add(f);\ns.boot;\ns.queryAllNodes; // note the group within the default group\nServerTree.remove(f);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `TwoPole`."}, {"role": "assistant", "content": "```supercollider\n{ TwoPole.ar(WhiteNoise.ar(0.005), 2000, 0.95) }.play\n\n{ TwoPole.ar(WhiteNoise.ar(0.005), XLine.kr(800, 8000, 8), 0.95) }.play\n\n{ TwoPole.ar(WhiteNoise.ar(0.005), MouseX.kr(800, 8000, 1), 0.95) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `CuspN`."}, {"role": "assistant", "content": "```supercollider\n// vary frequency\n{ CuspN.ar(MouseX.kr(20, SampleRate.ir), 1.0, 1.99) * 0.3 }.play(s);\n\n// mouse-controlled params\n{ CuspN.ar(SampleRate.ir/4, MouseX.kr(0.9, 1.1, 1), MouseY.kr(1.8, 2, 1)) * 0.3 }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(CuspN.ar(40, MouseX.kr(0.9, 1.1, 1), MouseY.kr(1.8, 2, 1))*800+900)*0.4 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `AbstractFunction.asin` do?"}, {"role": "assistant", "content": "An object which responds to a set of messages that represent mathematical functions"}]} +{"conversations": [{"role": "user", "content": "What does `EZRanger.action` do?"}, {"role": "assistant", "content": "Set/get a Function or FunctionList to be evaluated when the value changes. The first argument will be the"}]} +{"conversations": [{"role": "user", "content": "What is `RefCopy` in SuperCollider?"}, {"role": "assistant", "content": "RefCopy — a reference to the copy of a value A Ref instance is an object with a single slot named 'value' that serves as a holder of an object. RefCopy, in difference to Ref, returns only copies of the value when next is called. This can be useful when the original is to be kept unchanged. Category: Core."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nNdef(\\birdy, {arg freq=1500, amp=0.5, rate=10;\n var osc, son, convIn, rand;\n osc=LFCub;\n rand = LFNoise1.ar(rate);\n convIn=LinCongN.ar(rate);\n son = osc.ar(Convolution.ar(convIn,convIn));\n freq = Latch.kr(rand.range(0,1).round(0.1), rand) * freq;\n freq = osc.ar(osc.ar(rand)*rand.range(0,10)).range(freq, freq*3);\n son = Formlet.ar(son, freq, convIn.abs*0.1, rand.abs);\n son = Normalizer.ar(son, 0.9, 0.1) * convIn.abs * LFPulse.kr(LFPulse.kr(rand.abs), 0, rand.abs);\n son = son + GVerb.ar(son, 99, 2, mul: rand.range(0,0.3));\n son * amp\n}).play\n)\n```"}, {"role": "assistant", "content": "I just rewrote one of autocsi's tweets and came out with this which sounds like a digital bird of some kind:."}]} +{"conversations": [{"role": "user", "content": "Write a chord progression with Pbind."}, {"role": "assistant", "content": "Put an array of degrees in the pattern, use \\strum to spread the chord, and the default instrument\nplays all notes of each event.\n\n```supercollider\n(\nPbind(\n \\scale, Scale.minor,\n \\root, 2,\n \\degree, Pseq([[0, 4, 7], [-3, 0, 4], [-5, -1, 2], [0, 4, 7]], inf),\n \\dur, 1.5,\n \\strum, 0.02,\n \\amp, 0.12,\n \\legato, 0.9\n).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `HilbertPDNRe` in SuperCollider briefly."}, {"role": "assistant", "content": "HilbertPDNRe — Applies the Real part of the Hilbert Transform to an input signal. [1] Offers the Hilbert Transform of an input signal via Weaver's Second Method,footWeaver, Donald. “A Third Method of Generation and Detection of Single-Sideband Signals.” Proceedings of the IRE, vol. 44, no. 12, 1956, pp. 1703–1705. known as Hartley Phasing,footUS Patent 1,666,206, Modulation System, April 17, 1928, United States Patent and Trademark Office. expressed as a 12th-order Phase Differenci Category: Libraries > Hilbert > Pseudo-UGens, UGens > Filters > Nonlinear."}]} +{"conversations": [{"role": "user", "content": "Explain `MIDIFuncBothCAMessageMatcher` in SuperCollider briefly."}, {"role": "assistant", "content": "MIDIFuncBothCAMessageMatcher — Matches incoming MIDI messages to responder funcs based on message channel and source This is used by MIDIMessageDispatcher to match incoming MIDI messages to instances of MIDIFunc or MIDIdef using message source and MIDI channel (when the MIDIFunc specifies an array of channels). This class is private, and generally users should not need to address instances directly. Category: External Control > MIDI > Matchers."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nr = Recorder(s);\n{ GVerb.ar(Dust.ar(4)) }.play; // play on bus 64\nr.record(numChannels: 2;\nr.stopRecording;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nr = Recorder(s);\n{ GVerb.ar(Dust.ar(4)) }.play; // play on bus 64\nr.record(numChannels: 2);\nr.stopRecording;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `In` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n(\nSynthDef(\"help-PinkNoise\", { |out = 0|\n Out.ar(out, PinkNoise.ar(0.1))\n}).add;\n\nSynthDef(\"help-In\", { |out = 0, in = 0|\n var input;\n input = In.ar(in, 1);\n Out.ar(out, input);\n\n}).add;\n);\n\n// play noise on the right channel\nx = Synth(\"help-PinkNoise\", [\\out, 1]);\n\n// read the input and play it out on the left channel\nSynth.after(x, \"help-In\", [\\out, 0, \\in, 1]);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `MIDIdef.smpte` do?"}, {"role": "assistant", "content": "A convenience method to create a new MIDIdef which responds to MIDI smpte messages. See #*new for argument descriptions. The responding `func` will be passed the arguments seconds, framerate, dropframe, and srcID. (dropframe is a Returns: A new instance of MIDIdef which responds to MIDI smpte messages."}]} +{"conversations": [{"role": "user", "content": "What does `Boolean.asInteger` do?"}, {"role": "assistant", "content": "abstract class whose instances represent a logical value"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `CombN`."}, {"role": "assistant", "content": "```supercollider\n// These examples compare the variants, so that you can hear the difference in interpolation\n\n// Comb used as a resonator. The resonant fundamental is equal to\n// reciprocal of the delay time.\n{ CombN.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ CombL.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ CombC.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// with negative feedback:\n{ CombN.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ CombL.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ CombC.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n// used as an echo.\n{ CombN.ar(Decay.ar(Dust.ar(1, 0.5), 0.2, WhiteNoise.ar), 0.2, 0.2, 3) }.play;\n```"}]} {"conversations": [{"role": "user", "content": "What are the arguments of EnvGen?"}, {"role": "assistant", "content": "`EnvGen.ar(envelope, gate, levelScale, levelBias, timeScale, doneAction)` — or the .kr form. Envelope is an Env; gate is the signal that holds the envelope open (a number for a one-shot, a trigger or gate control for a sustained sound); levelScale and levelBias scale and offset the output; timeScale stretches durations. Use `doneAction: 2` on a one-shot so the Synth frees itself."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// Very artificial example - just filtering some noise.\ns.boot;\nb = Buffer.alloc(s,2048,1);\n(\nx = {\nvar in, chain, freq, rq, val;\n//freq = LFPar.kr(0.3).exprange(100, 1000);\nfreq = MouseY.kr(1000, 100, 1);\nrq = MouseX.kr(0.001, 10, 1);\nin = BPF.ar(WhiteNoise.ar, freq, rq);\nchain = FFT(b.bufnum, in);\n\nval = FFTSpread.kr(chain);\n\nOut.ar(0, in.dup * 0.1);\n(val * 0.000001).poll(10); // Poll but scaled down so more readable!\n}.play(s);\n);\n// …\n```"}, {"role": "assistant", "content": "Very artificial example - just filtering some noise. freq = LFPar.kr(0.3).exprange(100, 1000); (FFTSpread: Spectral spread)"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n~name = \\defaultMapper;\n\n// default mapper does nothing. It could have been named 'identity'\n~function = { |aziDeg = 0, eleDeg = 0, gainDB = -99, delayMs = 1, lpHz = 15000, hpHz = 5, spread = 0.01, nfIndex = 0|\n [[aziDeg, eleDeg, gainDB, delayMs, lpHz, hpHz, spread, nfIndex]];\n };\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "What does `NodeProxyEditor.new` do?"}, {"role": "assistant", "content": "Returns a new instance for a given proxy. If a window (win) or a composite view is given, it uses"}]} -{"conversations": [{"role": "user", "content": "What does `MxIOletsApp.out` do?"}, {"role": "assistant", "content": "usually returns the first outlet if there is one. This is a useful shorthand if you are working with objects that you dont know what name was used for the output, and you dont much care, you just want to connect the Returns: an MxInletApp or MxOuletApp"}]} -{"conversations": [{"role": "user", "content": "What does `TreeView.onItemChanged` do?"}, {"role": "assistant", "content": "The object to be evaluated whenever the current item changes, passing this view as the"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `VarLag`."}, {"role": "assistant", "content": "```supercollider\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n VarLag.kr( // lag the modulator\n LFPulse.kr(1).range(100, 400), // frequency modulator\n 0.2, // lag time\n Line.kr(-8, 8, 15, doneAction: Done.freeSelf) // modulate shape\n ),\n 0, // sine phase\n 0.3 // sine amplitude\n )\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for lurking line noise."}, {"role": "assistant", "content": "```supercollider\n({var\n rf = 7\n , rt = Impulse.kr(rf)\n , bs = 8.collect({|i| PulseDivider.kr(rt, 16, i*2)})\n , bt = bs[0] + bs[2] + Dust.kr(SinOsc.kr(0.01, 0, 0.25, 0.25))\n , be = Decay.kr(bt, 0.2)\n , se = Decay.kr(bs[5]+bs[6], 0.01)\n , bass = be*SinOsc.ar(SinOsc.ar([5,6], 0, 20, \n Demand.kr(bt, 0, Drand((30..48), inf)).midicps\n ))\n , snar = se*SinOsc.ar(2000+[0, 5])\n , off = (LPF.kr(BrownNoise.kr([1,1]), 10)**(1/3))>0\n , hat = DelayL.kr(Decay.kr(Mix.kr(bs), 0.01), 20, rf.reciprocal*off)*PinkNoise.ar\n , line = Saw.ar(50)*0.1*(LFNoise0.kr(50)>0)*SinOsc.kr(0.1, 0, 0.4, 0.45)\n ;\n Out.ar(0, FreeVerb.ar(bass+snar + hat + line, \n SinOsc.kr(0.01, 0, 0.4, 0.5), \n 0.8, 0.5))\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\np = Patch({ arg audio=0,ffreq=300;\n RHPF.ar(audio,ffreq,0.1)\n});\nq = Patch({\n Saw.ar(mul: 0.3)\n});\n\np.play;\nq.play;\n\n// adds a connection\n// but q is still out of main outs\np.connectInputToPlayer(0,q)\n\n\nq.patchTo(p,0;\n\n\np.gui\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\np = Patch({ arg audio=0,ffreq=300;\n RHPF.ar(audio,ffreq,0.1)\n});\nq = Patch({\n Saw.ar(mul: 0.3)\n});\n\np.play;\nq.play;\n\n// adds a connection\n// but q is still out of main outs\np.connectInputToPlayer(0,q)\n\n\nq.patchTo(p,0);\n\n\np.gui\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Words in a matchbox?"}, {"role": "assistant", "content": "```supercollider\n// really early first approach...\n(\nx.free;\nx = {\n var note = Duty.kr(\n 6/3.2,\n 0, \n Dseq([45, 45, 48, 41], inf));\n var snd = Saw.ar(note.midicps * SinOsc.kr(7.421).range(0.998, 1.001)) * -12.dbamp!2;\n var trigs = TDuty.kr(\n Dseq([1, 2, 3]/3.2, inf),\n 0,\n 1);\n var lvls = Duty.kr(\n Dseq([1, 2, 3]/3.2, inf),\n 0,\n Dseq([-9, -3, -6], inf));\n snd = snd * lvls.dbamp.lag2(0.1);\n snd = snd * EnvGen.kr(Env.perc(0.3, 0.3), trigs);\n snd = RLPF.ar(snd, EnvGen.kr(Env.perc(0.5, 0.2), trigs) * 3201 + 2311, 0.2);\n snd = LPF.ar(snd, 3000);\n snd = snd * (1 + Latch.ar(WhiteNoise.ar(-8.dbamp), Dust.ar(830))).lag2(0.01);\n snd = snd + LPF.ar(CombC.ar(snd, 0.4, 0.33, 0.52, -4.dbamp), 932);\n snd = FreeVerb2.ar(snd, snd, 0.21, 0.93, 0.9);\n snd * -12.dbamp;\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Server`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n{ SinOsc.ar * 0.1 }.play(s); // play a synth on the server\n```"}]} -{"conversations": [{"role": "user", "content": "The server stopped responding. What do I do?"}, {"role": "assistant", "content": "In order: `Ctrl+.` (CmdPeriod) to reset scheduling, then `s.reboot` if the server itself is wedged.\nA reboot drops every SynthDef and buffer, so re-add them — which is why real projects keep their SynthDefs\nin a file you can re-evaluate rather than typing them in the REPL.\n\nIf the boot itself fails, the post window has the reason: usually the audio device (another application\nholding exclusive access) or a sample-rate mismatch. `Server.default.options.device` picks a device before\n`s.boot`."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pgtpar`."}, {"role": "assistant", "content": "```supercollider\n// synthdef\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n}).add;\n);\n\n// pattern with different start times\n(\nx = Pbind(\n \\instrument, \\help_sinegrain,\n \\degree, Pseq(#[0, 5, 4, 2, 1, 1, 3], inf),\n \\dur, Pseq(#[0.25, 0.5, 1.0], inf),\n \\scale, #[0, 3, 5, 9, 10]\n);\na = Pbus(Pgtpar([0.0, x, 1.5, x, 2.25, x])).play;\n);\ns.plotTree;\na.stop;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BufDelayL`."}, {"role": "assistant", "content": "```supercollider\n// allocate buffer\nb = Buffer.alloc(s, 44100, 1);\n\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nBufDelayL.ar(b.bufnum, z, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\nb.free;\n\n\n// multichannel\n\n// two channels, two buffers\nb = Buffer.allocConsecutive(2, s, 32768, 1);\n\na = { |bufs = #[0, 1]|\n var sig = SinOsc.ar([440, 880]) * Decay2.kr(Impulse.kr([2, 4]), 0.01, 0.15);\n sig + BufDelayL.ar(bufs, sig, delaytime: 0.125)\n}.play(args: [bufs: b]);\n\na.free;\nb.do(_.free);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Object.post` do?"}, {"role": "assistant", "content": "Print a string representation of the receiver to the post window. `\"hello\".post; \"hello\".post;"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pitch`."}, {"role": "assistant", "content": "```supercollider\n// (use headphones!)\n\n(\n SynthDef(\"pitchFollow1\", { |out|\n var in, amp, freq, hasFreq, sound;\n in = Mix.new(SoundIn.ar([0, 1]));\n amp = Amplitude.kr(in, 0.05, 0.05);\n # freq, hasFreq = Pitch.kr(in, ampThreshold: 0.02, median: 7);\n // freq = Lag.kr(freq.cpsmidi.round(1).midicps, 0.05);\n sound = Mix.new(VarSaw.ar(freq * [0.5, 1, 2], 0, LFNoise1.kr(0.3, 0.1, 0.1), amp));\n 6.do {\n sound = AllpassN.ar(sound, 0.040, [0.040.rand, 0.040.rand], 2)\n };\n Out.ar(out, sound);\n }).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\np = PS(Pseries(), 5);\n\n// evaluate more than once\n\np.asStream.all;\n\n\n\n// compare\n\nq = { PS(Pseries(), 5) };\n\n// evaluate more than once\n\nq.value.asStream.all;\n\n\n\n// For recursively generating data see PSrecur.\n// Referring to buffered last values of a PS can\n// easily be done with method .at.\n\n\n// canonical brown movement\n// define 3 voices refering to a PS\n// use separate PS to collect data\n// plot\n\n(\np = PS(Pbrown(65, 90, 2.1), inf, 16);\np.iter.nextN(16);\n\nq = Pfunc { p[5] - 7 };\nr = Pfunc { p[10]\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\np = PS(Pseries(), 5);\n\n// evaluate more than once\n\np.asStream.all;\n\n\n\n// compare\n\nq = { PS(Pseries(), 5) };\n\n// evaluate more than once\n\nq.value.asStream.all;\n\n\n\n// For recursively generating data see PSrecur.\n// Referring to buffered last values of a PS can\n// easily be done with method .at.\n\n\n// canonical brown movement\n// define 3 voices refering to a PS\n// use separate PS to collect data\n// plot\n\n(\np = PS(Pbrown(65, 90, 2.1), inf, 16);\np.iter.nextN(16);\n\nq = Pfunc { p[5] - 7 };\nr = Pfunc { p[10] - 14 };\nt = Pfunc { p[15] - 21 };\n\nu = PS(Ptuple([p,q,r,t]), bufSize: 100);\n\na = Plotter().superpose_(true).plotMode_(\\plines);\na.value = u.iter.nextN(100).flop\n);\n\n// playback stored pitches\n\n(\nv = Pbind(\n \\midinote, Pseq(u.bufSeq),\n \\dur, 0.2\n).trace.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n//you must have run this line before any of the examples below\nf= BBCutBuffer(Platform.resourceDir +/+ \"sounds/break.aiff\",8);\n\nTempoClock.default.tempo_(2.3);\n\n//default\na=BBCut2(CutBuf1(f),CageCut.new).play;\n\na.end;\n\n//weirder\na=BBCut2(CutBuf1(f),CageCut(8.0,[0.2,0.3,0.4,0.1])).play;\n\na.end;\n\n//using your own permutation function\na=BBCut2(CutBuf1(f),CageCut(16.0,[1,3,3,1,1,2,2,1],{arg array; array.scramble\n// …\n```"}, {"role": "assistant", "content": "you must have run this line before any of the examples below using your own permutation function (CageCut: Automatic breakbeat cutting algorithm inspired by John Cage)"}]} -{"conversations": [{"role": "user", "content": "Write a closed hi-hat in SuperCollider."}, {"role": "assistant", "content": "High-passed noise with a very short envelope — the filter is what makes it a hat rather than a hiss.\n\n```supercollider\n(\nSynthDef(\\hat, { |out = 0, amp = 0.3, dur = 0.06|\n var env = EnvGen.kr(Env.perc(0.001, dur, 1, -6), doneAction: 2);\n Out.ar(out, Pan2.ar(HPF.ar(WhiteNoise.ar, 7000) * env * amp));\n}).add;\n);\nSynth(\\hat, [\\dur, 0.04]);\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\delay;\n~description = \"Simple delay line\";\n~channelLayout = \\mono;\n~function = {|in = 0, del = 0.5|\n DelayC.ar(in, 2, del);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "What does `Collection.collectInPlace` do?"}, {"role": "assistant", "content": "Iterate over the collection and replace each item with a new one, returned by the function. This can be useful when one wants to aviod creating a new array in memory. In most cases, it is better to use #-collect. `a = [1, 5, 3,"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Interpolate between Envs with Pseg?"}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\sin, { arg out=0, gate=1, amp=0.1, pan=0, freq=200;\n var sig;\n sig = SinOsc.ar(freq);\n sig = sig * EnvGen.kr(\\adsr.kr(Env.adsr(0.1,0.1,0.8,0.1)), gate, doneAction:2);\n sig = Pan2.ar(sig, pan, amp);\n Out.ar(out, sig);\n}).add;\n);\n\n(\n// sequence Envs\n// need [] else it is inlined or does pattern multichannel expansion\nPdef(\\demo, \n Pbind(\n \\instrument, \\sin,\n \\degree, Pseq([0, Pwhite(0,7,1)],inf),\n \\legato, 0.5,\n \\adsr, Pseq([\n [ Env.adsr(1.1,0.1,0.8,1.01) ],\n [ Env.adsr(0.01,0.1,0.8,0.01) ],\n [ Env.adsr(0.01,1.1,0.3,0.01) ],\n ],inf),\n )\n).play;\n);\n\n(\n// interpolate using Pseg\n// need .asArray\nPdef(\\demo, \n Pbind(\n \\instrument, \\sin,\n \\degree, Pseq([0, Pwhite(0,7,1)],inf),\n \\legato, 0.5,\n \\adsr, Pseg(Pseq([\n [ Env.adsr(1.1,0.1,0.8,1.01).asArray ],\n [ Env.adsr(0.01,0.1,0.8,0.01).asArray ],\n [ Env.adsr(0.01,1.1,0.3,0.01).asArray ],\n ],inf),8),\n )\n).play;\n);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `RedBMP.asImage` do?"}, {"role": "assistant", "content": "Converts the data to an Image and return it. NOTE: remember to free the"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Wow, the conciseness of SuperCollider is wonderful!."}, {"role": "assistant", "content": "```supercollider\n(\na=Array.fib(64,0,1);b=Array.fill(size:12,function:{arg i;a[i]%8});\np=1/8;Pdef(\\x,Pbind(\\dur,p,\\degree,Pseq(b,1,0)));\nr=Array.fill(12,{arg i;Pbindf(Pdef(\\x),\\mtranspose,b[i]);});\nPseq(r,(1/p)).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// result of BufRd is used as index for the next BufRd\n// needs Buffer c prepared above\n\n(\ny = {\n GFIS.ar(\n { |x| BufRd.ar(1, c, c.numFrames * x) },\n (LFDNoise3.ar(3) * [1, 1.1]).range(0.5, 0.51), 7\n ) * 0.2\n}.play\n;\n\ny.release\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// result of BufRd is used as index for the next BufRd\n// needs Buffer c prepared above\n\n(\ny = {\n GFIS.ar(\n { |x| BufRd.ar(1, c, c.numFrames * x) },\n (LFDNoise3.ar(3) * [1, 1.1]).range(0.5, 0.51), 7\n ) * 0.2\n}.play\n);\n\ny.release\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes flanger (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"flange\", {arg freq=440, release=0.1;\n var x, sig,out, mod1, depth, mfreq,maxfreq, maxdepth, maxdelay, basedelay;\n maxfreq=3;\n maxdelay=0.01;\n basedelay=maxdelay/2;\n maxdepth=basedelay/2;\n depth = MouseY.kr(0,maxdepth);\n mfreq = MouseX.kr(0,maxfreq);\n mod1 = SinOsc.ar(mfreq,0,depth);\n sig = SoundIn.ar(0,mul:2);\n out = DelayC.ar(sig, maxdelay,basedelay+ mod1);\n out = Mix.ar([out,sig]);\n Out.ar(0,out);\n Out.ar(1,out);\n}).load(s);\n);\n\na = Synth(\"flange\");\na.free\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Buffer.allocConsecutive` do? What arguments does it take?"}, {"role": "assistant", "content": "Allocates a range of consecutively-numbered buffers, for use with UGens like VOsc and VOsc3 that require a contiguous block of buffers, and returns an array of corresponding Buffer Arguments: numBufs — The number of consecutively indexed buffers to allocate.; server — The server on which to allocate the buffers. The default is the default Server.; numFrames — The number of frames to allocate in each buffer. Actual memory use will correspond to numFrames * numChannels. (A floating-point value is truncated to integer.); numChannels — The number of channels for each buffer. The default is 1. (A floating-point value is truncated to integer.); completionMessage — A valid OSC message or a Function which will return one. A Function will be passed each Buffer and its index in the array as arguments when evaluated.; bufnum — An explicitly specified buffer number. Supplying a number bypasses the server's buffer allocator, which can lead to conflicts. The best practice is to leave this unset and let the buffer number allocator choose the next available bufnum.; sampleRate — The sample rate of the buffer. The default is the sample rate of the server.."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ClipNoise`."}, {"role": "assistant", "content": "```supercollider\n{ ClipNoise.ar(0.2) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `Convolution2` in SuperCollider briefly."}, {"role": "assistant", "content": "Convolution2 — Real-time fixed kernel convolver. Strict convolution with fixed kernel which can be updated using a trigger signal. Category: UGens > FFT, UGens > Convolution."}]} -{"conversations": [{"role": "user", "content": "Write a filter sweep over a saw."}, {"role": "assistant", "content": "An LFO on the cutoff of a resonant low-pass; XLine or an LFO both work, the LFO is the loopable one.\n\n```supercollider\n{ LPF.ar(Saw.ar([60, 60.2]), SinOsc.kr(0.2).exprange(150, 4000), 0.4) * 0.2 }.play;\n```\n\n`.exprange` is the exponential mapping you want for frequency; a linear `.range` sweep sounds uneven."}]} -{"conversations": [{"role": "user", "content": "What is `Plorenz` in SuperCollider?"}, {"role": "assistant", "content": "Plorenz — lorenz 3D chaotic pattern Returns a stream that behaves like a strange attractor (x, y, z). Category: Streams-Patterns-Events > Patterns > Random."}]} -{"conversations": [{"role": "user", "content": "What does `View.getParents` do?"}, {"role": "assistant", "content": "The basic visible element of GUI Returns: Same as #-parents#parents."}]} -{"conversations": [{"role": "user", "content": "Explain `UnpackFFT` in SuperCollider briefly."}, {"role": "assistant", "content": "UnpackFFT — Unpack an FFT chain into separate demand-rate FFT bin streams Takes an FFT chain and separates the magnitude and phase data into separate demand-rate streams, for arithmetic manipulation etc. Category: UGens > FFT, UGens > Demand."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nq = Patch({ Saw.ar * 0.2 });\nr = Patch({ Saw.ar(800) * 0.2 });\np = PlayerSocket.new(numChannels: 1);\ne = Patch({ arg audio; RLPF.ar(audio,200) },[ p ]);\ne.play;\n);\n\n\np.prepareAndSpawn(q);\n\np.prepareAndSpawn(r);\n\np.prepareAndSpawn(q);\n\np.prepareAndSpawn(r);\n\n// if you know that you have prepared it\np.spawnPlayer(q);\n\nq.readyForPlay\n\np.spawnPlayer(r;\n\n\np.releaseVoice\n\np.insp\ne.insp\np.synthArg\n\ne.free\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nq = Patch({ Saw.ar * 0.2 });\nr = Patch({ Saw.ar(800) * 0.2 });\np = PlayerSocket.new(numChannels: 1);\ne = Patch({ arg audio; RLPF.ar(audio,200) },[ p ]);\ne.play;\n);\n\n\np.prepareAndSpawn(q);\n\np.prepareAndSpawn(r);\n\np.prepareAndSpawn(q);\n\np.prepareAndSpawn(r);\n\n// if you know that you have prepared it\np.spawnPlayer(q);\n\nq.readyForPlay\n\np.spawnPlayer(r);\n\n\np.releaseVoice\n\np.insp\ne.insp\np.synthArg\n\ne.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `RedComb.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "comb delay line with crossfade Arguments: in — Input signal.; maxdelaytime; delaytime; decaytime; lagTime — Time for crossfade.; mul; add."}]} -{"conversations": [{"role": "user", "content": "How do I make an additive bell with Klank?"}, {"role": "assistant", "content": "Klank is a bank of resonant filters excited by a short impulse: you describe the partials as\nfrequencies, amplitudes and decay times.\n\n```supercollider\n(\nSynthDef(\\klank, { |out = 0, freq = 440, amp = 0.3|\n var ratios = [1, 2.2, 3.7, 5.1, 7.3];\n var decays = [4, 2.6, 1.8, 1.2, 0.8];\n var sig = Klank.ar(`[ratios * freq, nil, decays], Impulse.ar(0, 0, 0.2), 1, 0, 0.3);\n Out.ar(out, Pan2.ar(sig * amp, 0));\n}).add;\n);\nSynth(\\klank);\n```"}]} -{"conversations": [{"role": "user", "content": "What is `CCPlayer` in SuperCollider?"}, {"role": "assistant", "content": "CCPlayer — adds a MIDI CC responder and plays it to a bus as control rate Category: Libraries > crucial > Players, External Control > MIDI."}]} -{"conversations": [{"role": "user", "content": "My Synth runs but I hear nothing. How do I debug it?"}, {"role": "assistant", "content": "Check in this order, because each step eliminates a whole class of causes:\n\n1. **Is anything coming out of the bus you write to?** `Out.ar(0, sig)` for the master. A typo like\n `Out.ar(2, ...)` is silence.\n2. **Is the amplitude non-zero?** Multiply chain of `mul`/`add`, `amp`, and `env` all have to be positive;\n an envelope with `level: 0` or a gate that never opens is silent.\n3. **Did the Synth free itself immediately?** `doneAction: 2` on an EnvGen whose envelope is already\n finished at creation kills the node instantly. `s.plotTree` shows whether the node exists at all.\n4. **Is the envelope actually moving?** `env.poll` inside the SynthDef prints it per block.\n5. **Is the filter closed?** A `LPF.ar(sig, 50)` on a 440 Hz sine leaves almost nothing.\n\nThe fastest single tool is `s.plotTree`: if the Synth is not in the tree, the problem is lifecycle; if it\nis, the problem is signal."}]} -{"conversations": [{"role": "user", "content": "What does `Env.duration` do?"}, {"role": "assistant", "content": "Set the total duration of times, by stretching"}]} -{"conversations": [{"role": "user", "content": "What does `Ppoisson.new` do? What arguments does it take?"}, {"role": "assistant", "content": "random values that follow a Poisson Distribution (positive integer values) Arguments: mean — The mean of the distribution.; length — Number of values produced.."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// Analogizer\n// a quick draft of a model of the EHX Analogizer pedal\n// some info from \"https://www.bassic.de/threads/electro-harmonix-ehx-analogizer.14865686/\"\n\ns.default\ns.boot\n\n// used this for testing: https://www.freesound.org/people/wescwave/sounds/169885/\n~buf = Buffer.read(s, \"169884__wescwave__double-bass-test2.wav\");\n\n(\n~x.free;\n~x = {\n var a, d, s;\n\n a = PlayBuf.ar(2, ~buf, 1, 1, 0, 1);\n a = a.sum!2; // go mono to make the effect more prominent\n\n // the \"distortion modeling\" could use some more love...\n s = (a * MouseY.kr(26/2, 0).dbamp).tanh;\n s = s * MouseY.kr(-16/2, 0).dbamp;\n\n // a simple delay\n d = DelayC.ar(s, 0.1, MouseX.kr(3.5/1000, 65/1000));\n\n // dry/wet...\n a = a + (d * MouseY.kr(0, -96).dbamp);\n\n Out.ar(0, a);\n}.play\n)\n```"}, {"role": "assistant", "content": "The EHX Analogizer (http://www.ehx.com/products/analogizer) is a guitar pedal that apparently consists of a ultra-short delay with some gain stage. It's supposed to \"fatten\" and somehow \"spread\" the sound to make it appear more \"analog\" (thus: dirty). I wanted to quickly test the effect myself.\r\n\r\nI guess with some additional care of the distortion stage and maybe some very little modulation (ster."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nTempoClock.default.tempo = 120 / 60.0;\nd = Routine({\n 20.do({\n var t;\n t = BeatSched.global.tdeltaTillNext(4.0);\n t.postln;\n t.wait;\n });\n });\n SystemClock.play(d);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nTempoClock.default.tempo = 120 / 60.0;\nd = Routine({\n 20.do({\n var t;\n t = BeatSched.global.tdeltaTillNext(4.0);\n t.postln;\n t.wait;\n });\n });\n SystemClock.play(d);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `CheckBadValues.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Test for infinity, not-a-number, and denormals Arguments: in — the UGen whose output is to be tested.; id — an id number to identify this UGen. The default is 0.; post — One of three post modes:."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n(\n// Pbind with default synth\n// ~freq can be a collection, then pitch or chord are shifted by ~freqFac,\n// ascending (~step > 0) or descending (~step < 0) groups of 4 items\n\np = Pbind(\n \\dur, 0.4,\n \\amp, PL(\\amp),\n \\freq, PL(\\step) ** PLseq((0..3)) * PL(\\freq) * PL(\\freqFac) \n);\n\n// Synth producing an ascending line, it ends as envelope params are defined,\n// end notifications will be reflected in the VarGui\n\nSynthDef(\\synth_2, { |out = 0, freq = #[600, 700, 900, 1000], freqFac = 1\n// …\n```"}, {"role": "assistant", "content": "Pbind with default synth ~freq can be a collection, then pitch or chord are shifted by ~freqFac, (VarGui: slider / player gui to set envir variables and synth controllers and play synths, event patterns and tasks)"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Detuneable fat-saw with a pattern (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\fatsaw,\n {\n arg freq=440, amp=0.3, fat=0.0033, ffreq=2000, atk=0.001, dec=0.3, sus=0.5, rls=0.1,gate=1;\n\n var f1,f2,f3,f4,synth;\n\n f1=freq-(freq*fat);\n f2=freq-(freq*fat/2);\n f3=freq+(freq*fat/2);\n f4=freq+(freq*fat);\n\n synth = LFSaw.ar([f1,f2,f3,f4],[0,0.001,0.002,0.004,0.008]);\n synth = synth * EnvGen.kr(Env([0,1,sus,0],[atk,dec,rls],'lin',2),gate,doneAction:0);\n synth=Splay.ar(synth,0.7);\n synth=RLPF.ar(synth,ffreq*Linen.kr(gate,0.1,0.4,0.2,0),0.4);\n Out.ar([0,1],synth*amp);\n},[0.1,0.3,4,2]).add;\n);\n(\nTempoClock.default = TempoClock.new(2);\nfork{\n\n z = Synth(\\fatsaw,[\\gate,0,\\ffreq,500,\\fat,0.5]);\n\n a=Pseq([0,7,12,5],inf).asStream; // musical degrees\n c = Pseq([40,38,45,47],inf).asStream; // root midi notes\n e = Pseq([0.825,0.375,0.25,0.25],inf).asStream; // note durations\n f = Pseq([1000,1500,2000,2500],inf).asStream; // filter freq value\n\n 0.1.wait;\n z.set(\\gate,1);\n\n //set first root note\n d = c.next;\n\n 8.do{\n\n // move filter freq once every 4 notes\n z.set(\\ffreq, f.next);\n 4.do {\n z.set(\\gate,1);\n z.set(\\freq,(a.next + d).midicps);\n x=[0.451,0.45,0.449].choose;\n x.wait;\n z.set(\\gate,0);\n\n e.next.wait;\n };\n\n d = c.next;\n };\n 2.wait;\n z.free;\n};\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `CrossoverDistortion.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "class B/AB power amp distortion simulation Arguments: in — The input signal.; amp — Controls the point at which the output signal becomes linear.; smooth — Controls degree of smoothing of the crossover point.; mul — Output will be multiplied by this value.; add — This value will be added to the output.."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// a stereo signal, both channels at 0dB\n{ [SinOsc.ar(440), SinOsc.ar(440)] }.play\n\n// using Balance on a stereo signal with the position parameter at 0, effectively the same sound but both channels at -3dB\n{ Balance2.ar(SinOsc.ar(440), SinOsc.ar(440), 0) }.play\n\n// pan sweep from left to right\n{ Balance2.ar(SinOsc.ar(440), SinOsc.ar(1000), Line.kr(-1, 1, 5)) }.play\n\n// other examples\n{ Balance2.ar(LFSaw.ar(44), Pulse.ar(33), FSinOsc.kr(0.5), 0.1) }.play;\n{ var source; source = SinOsc\n// …\n```"}, {"role": "assistant", "content": "a stereo signal, both channels at 0dB using Balance on a stereo signal with the position parameter at 0, effectively the same sound but both channels at -3dB (Balance2: Stereo signal balancer)"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nSortedList[1, 2, 5, 6].add(4.postln;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nSortedList[1, 2, 5, 6].add(4).postln;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\np = Pbind(...);\np.play;\np.stop; // does not stop because p is not the EventStreamPlayer that is actually playing\n\np = Pbind(....play;\np.stop; // DOES stop because p is the EventStreamPlayer\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\np = Pbind(...);\np.play;\np.stop; // does not stop because p is not the EventStreamPlayer that is actually playing\n\np = Pbind(...).play;\np.stop; // DOES stop because p is the EventStreamPlayer\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Red3D.render` do?"}, {"role": "assistant", "content": "Call this to perform the projection and scaling calculations. This updates the variable"}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nx = { |freq = 440, amp = 0.2| SinOsc.ar(freq) * amp }.play;\nx.set(\\freq, 660);\n```"}, {"role": "assistant", "content": "Starts an anonymous synth with two controls, then changes one of them while it plays.\n\nThe `|freq = 440, amp = 0.2|` are arguments of the function, and `.play` turns each into a Synth control\nwith that default value. `x` holds the Synth node. `.set(\\freq, 660)` sends a `/n_set` message to the\nserver, so the oscillator changes frequency without being restarted — that is why the sound glides rather\nthan re-triggering. Note that `\\freq` is a Symbol: the backslash is part of the name."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\np = ProxySpace.new;\np.fadeTime = 2; // fadeTime specifies crossfade\np[\\out].play; // monitor an empty placeholder through hardware output\n// set its source\np[\\out] = { SinOsc.ar([350, 351.3], 0, 0.2) };\np[\\out] = { Pulse.ar([350, 351.3] / 4, 0.4) * 0.2 };\np[\\out] = Pbind(\\dur, 0.03, \\freq, Pbrown(0, 1, 0.1, inf).linexp(0, 1, 200, 350));\n\n// route one proxy through another:\np[\\out] = { Ringz.ar(p[\\in].ar, [350, 351.3] *\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\np = ProxySpace.new;\np.fadeTime = 2; // fadeTime specifies crossfade\np[\\out].play; // monitor an empty placeholder through hardware output\n// set its source\np[\\out] = { SinOsc.ar([350, 351.3], 0, 0.2) };\np[\\out] = { Pulse.ar([350, 351.3] / 4, 0.4) * 0.2 };\np[\\out] = Pbind(\\dur, 0.03, \\freq, Pbrown(0, 1, 0.1, inf).linexp(0, 1, 200, 350));\n\n// route one proxy through another:\np[\\out] = { Ringz.ar(p[\\in].ar, [350, 351.3] * 8, 0.2) * 4 };\np[\\in] = { Impulse.ar([5, 7]/2, [0, 0.5]) };\n\np.clear(3); // clear after 3 seconds\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\HOABinaural;\n~description = \"Binaural decoder using the HOABinaural class from SC-HOA\";\n\n~function = { |in = 0, order|\n HOABinaural.ar(\n order: order,\n in: in\n );\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\np = ProxySpace.push(s.boot);\n\nl = NdefGui(nil, 3).moveTo(10, 120);\nm = NdefGui(nil, 3).moveTo(10, 240);\nn = NdefGui(nil, 3).moveTo(10, 360);\no = NdefGui(nil, 3).moveTo(10, 480);\n\nSpec.add(\\dens, [0.1, 300, \\exp]);\n\n// make 3 kinds of proxies: using tilde/proxyspace, Ndef, and unnamed.\n~spacy = { |dens = 5| Formlet.ar(Dust.ar(dens ! 2), LFDNoise0.kr(20 ! 2).lag(0.1).linexp(-1, 1, 300, 5000), 0.003,\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\np = ProxySpace.push(s.boot);\n\nl = NdefGui(nil, 3).moveTo(10, 120);\nm = NdefGui(nil, 3).moveTo(10, 240);\nn = NdefGui(nil, 3).moveTo(10, 360);\no = NdefGui(nil, 3).moveTo(10, 480);\n\nSpec.add(\\dens, [0.1, 300, \\exp]);\n\n// make 3 kinds of proxies: using tilde/proxyspace, Ndef, and unnamed.\n~spacy = { |dens = 5| Formlet.ar(Dust.ar(dens ! 2), LFDNoise0.kr(20 ! 2).lag(0.1).linexp(-1, 1, 300, 5000), 0.003, 0.03) };\nNdef(\\ndeffy, { GrayNoise.ar(0.1 ! 2) });\nc = NodeProxy.audio.source_({ PinkNoise.ar(0.1 ! 2) });\n\n// put one in each editor\nl.object_(~spacy);\nm.object_(Ndef(\\ndeffy));\nn.object_(c);\n);\n// One should also be able to drag and drop text into the drag,\n// but this is also not working yet.\n( Ndef(\\a) )\n```"}]} +{"conversations": [{"role": "user", "content": "What does `MIDIFunc.sysex` do?"}, {"role": "assistant", "content": "A convenience method to create a new MIDIFunc which responds to MIDI system exclusive messages. See #*new for argument descriptions. The responding `func` will be passed the arguments data (an Int8Array) and Returns: A new instance of MIDIFunc which responds to MIDI system exclusive messages."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LinExp`."}, {"role": "assistant", "content": "```supercollider\n// linexp\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(mod.linexp(-1, 1, MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1))) * 0.1\n}.play;\n);\n\n// exprange\n(\n{\n var mod = LFNoise2.ar(80).exprange(MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1));\n SinOsc.ar(mod) * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nNdef(\\x, { SinOsc.ar(Rand(500, 900)) * 0.1 }).play;\nNdef(\\x).copy(\\y);\nNdef(\\y.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nNdef(\\x, { SinOsc.ar(Rand(500, 900)) * 0.1 }).play;\nNdef(\\x).copy(\\y);\nNdef(\\y).play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\np = Pif(Pfunc({ 0.3.coin }), Pwhite(0, 9, inf), Pwhite(100, 109, inf)).asStream;\np.nextN(20);\n\n// 7 of the 20 values, or roughly 30%, are in the 0-9 range:\n\n[105, 107, 107, 8, 100, 3, 105, 5, 107, 106, 1, 104, 8, 102, 102, 4, 108, 8, 109, 101]\n\n\n// sound example\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinO\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\np = Pif(Pfunc({ 0.3.coin }), Pwhite(0, 9, inf), Pwhite(100, 109, inf)).asStream;\np.nextN(20);\n\n// 7 of the 20 values, or roughly 30%, are in the 0-9 range:\n\n[105, 107, 107, 8, 100, 3, 105, 5, 107, 106, 1, 104, 8, 102, 102, 4, 108, 8, 109, 101]\n\n\n// sound example\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n(\nvar a;\na = Pif(Pfunc({ 0.3.coin }), Pn(Pseries(0.5, 0.1, 10)), Pn(Pseries(6, -0.1, 10))).asStream;\n{\n loop {\n Synth(\\help_sinegrain, [\\freq, a.next * 600 + 300]);\n 0.2.wait;\n }\n}.fork;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SplineFr.update` do?"}, {"role": "assistant", "content": "Mx frame rate driven time domain spline for automation curves"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// modulate frequency\n{ Pulse .ar(XLine.kr(40,4000,6),0.1, 0.2) }.play;\n{ PulseDPW.ar(XLine.kr(40,4000,6),0.1, 0.2) }.play;\n\n// two band limited square waves thru a resonant low pass filter\n{ RLPF.ar(Pulse .ar([100,250],0.5,0.1), XLine.kr(8000,400,5), 0.05) }.play;\n{ RLPF.ar(PulseDPW.ar([100,250],0.5,0.1), XLine.kr(8000,400,5), 0.05) }.play;\n```"}, {"role": "assistant", "content": "modulate frequency two band limited square waves thru a resonant low pass filter (PulseDPW: super-efficient square-wave oscillator with low aliasing)"}]} +{"conversations": [{"role": "user", "content": "What does `RedMixer.gui` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a Arguments: position — A Point.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// vibrato at 1 Hz, note the use of DC.ar UGen; a constant of 400.0 doesn't work\n{ SinOsc.ar(Vibrato.ar(DC.ar(400.0), 1, 0.02)) }.play\n\n// compare: k-rate freq input can be a constant\n{ SinOsc.ar(Vibrato.kr(400.0, 1, 0.02)) }.play\n\n// control rate and rateVariation\n{ SinOsc.ar(Vibrato.ar(DC.ar(400.0), MouseX.kr(2.0, 100.0), 0.1, 1.0, 1.0, MouseY.kr(0.0, 1.0), 0.1)) }.play\n\n// control depth and depthVariation\n{ SinOsc.ar(Vibrato.ar(DC.ar(4\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// vibrato at 1 Hz, note the use of DC.ar UGen; a constant of 400.0 doesn't work\n{ SinOsc.ar(Vibrato.ar(DC.ar(400.0), 1, 0.02)) }.play\n\n// compare: k-rate freq input can be a constant\n{ SinOsc.ar(Vibrato.kr(400.0, 1, 0.02)) }.play\n\n// control rate and rateVariation\n{ SinOsc.ar(Vibrato.ar(DC.ar(400.0), MouseX.kr(2.0, 100.0), 0.1, 1.0, 1.0, MouseY.kr(0.0, 1.0), 0.1)) }.play\n\n// control depth and depthVariation\n{ SinOsc.ar(Vibrato.ar(DC.ar(400.0), LFNoise1.kr(1, 3, 7), MouseX.kr(0.0, 1.0), 1.0, 1.0, MouseY.kr(0.0, 1.0), 0.1)) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LinExp`."}, {"role": "assistant", "content": "```supercollider\n// linexp\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(mod.linexp(-1, 1, MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1))) * 0.1\n}.play;\n);\n\n// exprange\n(\n{\n var mod = LFNoise2.ar(80).exprange(MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1));\n SinOsc.ar(mod) * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\n\n\n// create with cueSoundFile class method\nb = Buffer.cueSoundFile(s, ExampleFiles.apollo11, 0, 1);\nx = { DiskIn.ar(1, b) }.play;\nb.close; // must call close in between cueing\n// now use like named instance method, but different arguments\nb.cueSoundFile(ExampleFiles.apollo11;\n// have to do all this to clean up properly!\nx.free; b.close; b.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\n\n\n// create with cueSoundFile class method\nb = Buffer.cueSoundFile(s, ExampleFiles.apollo11, 0, 1);\nx = { DiskIn.ar(1, b) }.play;\nb.close; // must call close in between cueing\n// now use like named instance method, but different arguments\nb.cueSoundFile(ExampleFiles.apollo11);\n// have to do all this to clean up properly!\nx.free; b.close; b.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Instr.<>>` do? What arguments does it take?"}, {"role": "assistant", "content": "function composition : construct a CompositeInstr by patching this Instr into another Arguments: that — another Instr (or a CompositeInstr or Papplied Instr). Returns: a CompositeInstr"}]} {"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `CuspN`."}, {"role": "assistant", "content": "```supercollider\n// vary frequency\n{ CuspN.ar(MouseX.kr(20, SampleRate.ir), 1.0, 1.99) * 0.3 }.play(s);\n\n// mouse-controlled params\n{ CuspN.ar(SampleRate.ir/4, MouseX.kr(0.9, 1.1, 1), MouseY.kr(1.8, 2, 1)) * 0.3 }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(CuspN.ar(40, MouseX.kr(0.9, 1.1, 1), MouseY.kr(1.8, 2, 1))*800+900)*0.4 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PV_MagSquared`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n(\nb = Buffer.alloc(s, 2048, 1);\nc = Buffer.read(s, ExampleFiles.child);\n);\n\n(\nSynthDef(\"help-magSquared\", { |out = 0, bufnum = 0, soundBufnum = 2|\n var in, chain;\n in = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);\n chain = FFT(bufnum, in);\n chain = PV_MagSquared(chain);\n Out.ar(out, 0.003 * IFFT(chain).dup);\n}).play(s, [\\out, 0, \\bufnum, b.bufnum, \\soundBufnum, c.bufnum]);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a;\na = Plorenz(8, 20, 2.5, 0.02);\na.asStream.nextN(1000).flop.plot; //note 3 channels\n);\n\n// sound example\n(\nSynthDef(\\help_sinegrain2,\n { arg out=0, freq=440, sustain=0.05, pan= 0;\n var env= EnvGen.ar(Env.perc(0.01, sustain, 0.2), doneAction:2);\n Out.ar(out, Pan2.ar(SinOsc.ar(freq, 0, env), pan));\n}).add;\n);\n\n(\nvar a = Plorenz(10, 28, 2.667, 0.01, 0,09, 2.9, 24).asStream;\n{\n loop {\n var x,\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a;\na = Plorenz(8, 20, 2.5, 0.02);\na.asStream.nextN(1000).flop.plot; //note 3 channels\n);\n\n// sound example\n(\nSynthDef(\\help_sinegrain2,\n { arg out=0, freq=440, sustain=0.05, pan= 0;\n var env= EnvGen.ar(Env.perc(0.01, sustain, 0.2), doneAction:2);\n Out.ar(out, Pan2.ar(SinOsc.ar(freq, 0, env), pan));\n}).add;\n);\n\n(\nvar a = Plorenz(10, 28, 2.667, 0.01, 0,09, 2.9, 24).asStream;\n{\n loop {\n var x, y, z;\n #x, y, z = a.next;\n Synth(\\help_sinegrain2, [\\freq, x * 600 + 300, \\pan, -1]);\n 0.02.wait;\n Synth(\\help_sinegrain2, [\\freq, y * 600 + 300, \\pan, 0]);\n 0.02.wait;\n Synth(\\help_sinegrain2, [\\freq, z * 600 + 300, \\pan, 1]);\n 0.02.wait;\n }\n}.fork;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `FPSignal.reactimate` do?"}, {"role": "assistant", "content": "Implementation of Functional Reactive Programming. Returns: nil"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// data sharing between streams of same PmonoPar and streams of second PmonoPar,\n// use of Ptpar ensures that first stream of second PmonoPar comes after first stream of first PmonoPar,\n// consider also PpolyPar for such type of usage\n\n(\np = PmonoPar([\n [\n \\dur, Prand([1, 1, 2]/3, 40).collect(~dur = _),\n \\amp, Pseq([0.3, 0.1], 15) \n ],[\n \\dur, Pfunc { ~dur / 2 },\n \\midinote, Pshuf((50..70)) \n ]\n]);\n\nq = PmonoPar([\n [\n \\dur, Pfunc { ~dur },\n \\amp, Pseq([0.3, 0\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// data sharing between streams of same PmonoPar and streams of second PmonoPar,\n// use of Ptpar ensures that first stream of second PmonoPar comes after first stream of first PmonoPar,\n// consider also PpolyPar for such type of usage\n\n(\np = PmonoPar([\n [\n \\dur, Prand([1, 1, 2]/3, 40).collect(~dur = _),\n \\amp, Pseq([0.3, 0.1], 15) \n ],[\n \\dur, Pfunc { ~dur / 2 },\n \\midinote, Pshuf((50..70)) \n ]\n]);\n\nq = PmonoPar([\n [\n \\dur, Pfunc { ~dur },\n \\amp, Pseq([0.3, 0.1], 15) \n ],[\n \\dur, Pfunc { ~dur / 3 },\n \\midinote, Pshuf((75..95), 2) \n ]\n]);\n\nr = Ptpar([0, p, 1e-5, q]).trace.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `WrapIndex` in SuperCollider?"}, {"role": "assistant", "content": "WrapIndex — Index into a table with a signal. The input signal value is truncated to an integer value and used as an index into the table. Out-of-range index values are wrapped cyclically to the valid range. Category: UGens > Buffer."}]} +{"conversations": [{"role": "user", "content": "What does `SimpleNumber.beta` do?"}, {"role": "assistant", "content": "The beta function is defined by: `tgamma(a)*tgamma(b) /"}]} +{"conversations": [{"role": "user", "content": "Explain `ContiguousBlockAllocator` in SuperCollider briefly."}, {"role": "assistant", "content": "ContiguousBlockAllocator — for better handling of dynamic allocation The default allocator used in servers to allocate bus numbers and buffer numbers. Compared to its predecessor, PowerOfTwoAllocator, it can reserve a block of numbers at the beginning of its range, and it can offset its entire range of numbers to support multiple clientIDs. Category: Control."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `BusPlug` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\ns.boot;\nz = Bus.control(s, 16);\nz.setn({ |i| (i * 5).nthPrime } ! 16 * 5 + 100);\na = BusPlug.for(z);\n{ Splay.ar(SinOsc.ar(a.kr(3, MouseX.kr(0, 25)))) * 0.1 }.play; // selectively play 3 channel of the 16, modulate offset\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n \n// definition for future reference in arbitrary Environments\n\np = PLbrown(\\lo, \\hi, \\step);\n\n\n// prepare current Environment\n// PLseq repeats arg defaults to inf\n\n(\n~lo = 55;\n~hi = 80;\n~step = Pstutter(10, PLseq([0.05, 3.5]));\n);\n\n\n// run\n\n(\nx = Pbind(\n \\midinote, Ptuple(p!2), \n \\dur, 0.1\n).play;\n);\n\n// replace\n\n(\n~lo = Pseq((50..90));\n~hi = Pseq((50..90) + 15);\n)\n```"}, {"role": "assistant", "content": "definition for future reference in arbitrary Environments prepare current Environment (PLbrown: dynamic scope Pbrown variant)"}]} +{"conversations": [{"role": "user", "content": "What does `EnvelopeView.selectionColor` do? What arguments does it take?"}, {"role": "assistant", "content": "The color of a node when it is Arguments: A Color.."}]} +{"conversations": [{"role": "user", "content": "Explain `Dstutter` in SuperCollider briefly."}, {"role": "assistant", "content": "Dstutter — Demand rate input replicator Category: UGens > Demand."}]} +{"conversations": [{"role": "user", "content": "What is `Splay`?"}, {"role": "assistant", "content": "Splay — Splay spreads an array of channels across the stereo field"}, {"role": "user", "content": "What does `Splay.arFill` do?"}, {"role": "assistant", "content": "In analogy to Mix:arFill, this method takes a function that produces the channels. The counting index is passed to it."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// splay 10 chans of sound into 2\n(\nx = { |spread = 1, level = 0.2, center = 0.0|\n var numchans = 10;\n Splay.ar(\n SinOsc.ar({ |i| LFNoise2.kr(1).exprange(200, 4000) } ! numchans),\n spread,\n level,\n center\n // use levelComp default true\n );\n}.play;\n);\n\ns.meter;\ns.scope;\n\n// change settings dynamically:\n\nx.set(\\spread, 1, \\center, 0); // full stereo\nx.set(\\spread, 0.5, \\center, 0); // less wide\nx.set(\\spread, 0, \\center, 0); // mono center\nx.set(\\spread, 0.5, \\center, 0.5); // spread from center to right\nx.set(\\spread, 0, \\center, -1); // all left\nx.set(\\spread, 1, \\center, 0); // full stereo\n\n// A similar example written with arFill:\n(\nx = { |spread = 1, level = 0.2, center = 0.0|\n var numchans = 10;\n Splay.arFill(numchans,\n { |i| SinOsc.ar(LFNoise2.kr(rrand(10, 20), 200, i + 3 * 100)) },\n spread,\n level,\n center\n );\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "How does multi-channel expansion work?"}, {"role": "assistant", "content": "If any argument of a UGen is an Array, the UGen is built once per element and the results are returned as an Array. So `SinOsc.ar([220, 330, 440])` is three oscillators, and `SinOsc.ar(220 * [1, 1.5])` is two. This is not a special stereo feature: it is uniform expansion, which is why `Splay.ar(SinOsc.ar([220,330,440]) * 0.1)` gives you a spread stereo field from three mono sources."}]} +{"conversations": [{"role": "user", "content": "What does `EffectSpec.new` do? What arguments does it take?"}, {"role": "assistant", "content": "datatype specifying an object that is an 'audio' rate effect Arguments: numChannels; numInputs."}]} +{"conversations": [{"role": "user", "content": "What does `OSCSched.tsched` do? What arguments does it take?"}, {"role": "assistant", "content": "time based scheduling delta specified in Arguments: seconds; server; bundle; onArrival."}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nNdef(\\x, { Saw.ar(110) * 0.1 }).play;\nNdef(\\x)[1] = \\filter -> { |in| RLPF.ar(in, 800, 0.4) };\n```"}, {"role": "assistant", "content": "Two nodes in one named proxy: a saw source, then a resonant low-pass filter fed by it.\n\n`Ndef(\\x, { ... })` defines the first node of the chain and `.play` starts it. `Ndef(\\x)[1] = \\filter ->`\ninserts a second node at index 1; the `\\filter` key says 'make this node an effect that receives the\nprevious node's output as `in`'. So the patch is `Saw -> RLPF -> out`. Because it is an Ndef, calling\n`Ndef(\\x, { ... })` again replaces the source with a crossfade instead of restarting, and\n`Ndef(\\x).stop` removes the whole chain."}]} +{"conversations": [{"role": "user", "content": "Explain `PCombN` in SuperCollider briefly."}, {"role": "assistant", "content": "PCombN — UGenPatterns quark library Based on CombN Category: Streams-Patterns-Events > UGenPatterns > Modifiers."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nVowel().brightenRel(1 ).dBs.postln; \nVowel().brightenRel(0.1).dBs.postln;\nVowel().brightenRel(1.5).dBs.postln;\n\n// refFormant = 0 loud on the left\n{Formants.ar(100, Vowel().brightenRel(MouseX.kr(0, 2), 0 )) * 0.1}.play\n// refFormant = 1\n{Formants.ar(100, Vowel().brightenRel(MouseX.kr(0, 2), 1 )) * 0.1}.play\n// refFormant = 2\n{Formants.ar(100, Vowel().brightenRel(MouseX.kr(0, 2), 2 )) * 0.1}.play\n// refFormant = 3\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nVowel().brightenRel(1 ).dBs.postln; \nVowel().brightenRel(0.1).dBs.postln;\nVowel().brightenRel(1.5).dBs.postln;\n\n// refFormant = 0 loud on the left\n{Formants.ar(100, Vowel().brightenRel(MouseX.kr(0, 2), 0 )) * 0.1}.play\n// refFormant = 1\n{Formants.ar(100, Vowel().brightenRel(MouseX.kr(0, 2), 1 )) * 0.1}.play\n// refFormant = 2\n{Formants.ar(100, Vowel().brightenRel(MouseX.kr(0, 2), 2 )) * 0.1}.play\n// refFormant = 3\n{Formants.ar(100, Vowel().brightenRel(MouseX.kr(0, 2), 3 )) * 0.1}.play\n// refFormant = 4 loud on the right\n{Formants.ar(100, Vowel().brightenRel(MouseX.kr(0, 2), 4 )) * 0.1}.play\n```"}]} +{"conversations": [{"role": "user", "content": "Who made you?"}, {"role": "assistant", "content": "I was trained by the person who runs this project, on top of the MiniMind architecture. My weights started from random numbers and learned from the SuperCollider sources — no teacher model, no distillation."}]} +{"conversations": [{"role": "user", "content": "What does `Linen.kr` do? What arguments does it take?"}, {"role": "assistant", "content": "Simple linear envelope generator. Arguments: gate — This triggers the envelope and holds it open while > 0. If gate < 0, force release with time `-1.0 - gate`. See EnvGen#Forced release.; attackTime — The duration of the attack portion.; susLevel — The level of the sustain portion.; releaseTime — The duration of the release portion.; doneAction — An integer representing an action to be executed when the envelope is finished. See."}]} +{"conversations": [{"role": "user", "content": "What does `TempoPlayer.synthArg` do?"}, {"role": "assistant", "content": "a control rate player that plays the TempoBus [which is the current Tempo]"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `BufRd`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_playbuf, { |out = 0, bufnum = 0, rate = 1, startPos = 0, amp = 0.1, sustain = 1, pan = 0, loop = 1|\n var audio;\n rate = rate * BufRateScale.ir(bufnum);\n startPos = startPos * BufFrames.ir(bufnum);\n\n audio = BufRd.ar(1, bufnum, Phasor.ar(0, rate, startPos, BufFrames.ir(bufnum)), 1, 1);\n audio = EnvGen.ar(Env.sine, 1, timeScale: sustain, doneAction: Done.freeSelf) * audio;\n audio = Pan2.ar(audio, pan, amp);\n OffsetOut.ar(out, audio);\n}).add; // use .store for rendering example below\n\na = Pproto({\n ~newgroup = (type: \\group).yield;\n ~sf1 = (type: \\allocRead, path: ExampleFiles.apollo11).yield;\n},\n Pbind(*[\n instrument: \\help_playbuf,\n dur: Pseg([0, 0, 0.25, 0.5, 0.75, 1], 10).linexp(0, 1, 0.01, 2),\n legato: 4,\n startPos: Pn(Pseg([0, 1], 20), inf),\n rate: Pwhite(1, 1).midiratio,\n loop: 0,\n group: Pkey(\\newgroup),\n bufnum: Pkey(\\sf1)\n ])\n);\na.play;\n)\n\n// a.render(\"sounds/test.aif\", 40)\n// SoundFile.openRead(\"sounds/test.aif\").play\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\AcnSn3dIn;\n~description = \"A live ambisonic input (ACN_SN3D)\";\n~channelLayout = \\ambi;\n\n~function = { |order=1, t_trig = 0, bus = 0|\n var env = EnvGen.kr(Env([0,1], [1]), t_trig);\n var chans = Array.series(\n size: (order + 1).pow(2).asInteger,\n start: bus,\n step: 1\n );\n var input = SoundIn.ar(chans) * env;\n HOAConverterAcnSn3d2AcnN3d.ar(order, input);\n};\n```"}, {"role": "assistant", "content": "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see ."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `RecordBuf`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\nb = Buffer.alloc(s, s.sampleRate * 5, 1); // a 5 second 1 channel Buffer\n\n// record for four seconds\n(\nx = SynthDef(\"tutorial-RecordBuf\",{ arg out=0,bufnum=0;\n var noise;\n noise = PinkNoise.ar(0.3); // record some PinkNoise\n RecordBuf.ar(noise, bufnum); // by default this loops\n}).play(s,[\\out, 0, \\bufnum, b]);\n);\n\n// free the record synth after a few seconds\nx.free;\n\n// play it back\n(\nSynthDef(\"tutorial-playback\",{ arg out=0,bufnum=0;\n var playbuf;\n playbuf = PlayBuf.ar(1,bufnum);\n FreeSelfWhenDone.kr(playbuf); // frees the synth when the PlayBuf has played through once\n Out.ar(out, playbuf);\n}).play(s,[\\out, 0, \\bufnum, b]);\n);\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Float` in SuperCollider?"}, {"role": "assistant", "content": "Float — 64-bit Floating point number A 64-bit double precision floating point number. Float inherits most of its behaviour from its superclass, SimpleNumber. Category: Math."}]} +{"conversations": [{"role": "user", "content": "What is `Splay`?"}, {"role": "assistant", "content": "Splay — Splay spreads an array of channels across the stereo field"}, {"role": "user", "content": "What does `Splay.arFill` do?"}, {"role": "assistant", "content": "In analogy to Mix:arFill, this method takes a function that produces the channels. The counting index is passed to it."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// splay 10 chans of sound into 2\n(\nx = { |spread = 1, level = 0.2, center = 0.0|\n var numchans = 10;\n Splay.ar(\n SinOsc.ar({ |i| LFNoise2.kr(1).exprange(200, 4000) } ! numchans),\n spread,\n level,\n center\n // use levelComp default true\n );\n}.play;\n);\n\ns.meter;\ns.scope;\n\n// change settings dynamically:\n\nx.set(\\spread, 1, \\center, 0); // full stereo\nx.set(\\spread, 0.5, \\center, 0); // less wide\nx.set(\\spread, 0, \\center, 0); // mono center\nx.set(\\spread, 0.5, \\center, 0.5); // spread from center to right\nx.set(\\spread, 0, \\center, -1); // all left\nx.set(\\spread, 1, \\center, 0); // full stereo\n\n// A similar example written with arFill:\n(\nx = { |spread = 1, level = 0.2, center = 0.0|\n var numchans = 10;\n Splay.arFill(numchans,\n { |i| SinOsc.ar(LFNoise2.kr(rrand(10, 20), 200, i + 3 * 100)) },\n spread,\n level,\n center\n );\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ SinOsc.ar(500 + LFPulse.ar(4).bipolar(40), 0, 0.5 * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ SinOsc.ar(500 + LFPulse.ar(4).bipolar(40), 0, 0.5) * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `FunctionList.new` do? What arguments does it take?"}, {"role": "assistant", "content": "create a new Arguments: functions — An array of functions or objects."}]} +{"conversations": [{"role": "user", "content": "What does `UScoreEditor.muteEvents` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: events — (describe argument here). Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for Re: Dark sea horns: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\n Ndef(\\x, {\n var output;\n var delayTime;\n var delayMax = 0.2;\n var delayAdd = 0.1;\n var pulseFreq = 0.5;\n var proxyMul = 2;\n var pulseMin = 40;\n var pulseMax = 130;\n var numOfEchos = 2;\n\n var mainPulse = LFPulse.ar(pulseFreq, 0, 0.5).range(pulseMin, pulseMax);\n var proxy = Ndef(\\x).ar * proxyMul;\n var ampModFreq = SinOsc.ar(0.01, 0).range(0.3, 30);\n var ampMod = LFNoise1.ar(ampModFreq, 6);\n output = SinOsc.ar(mainPulse + proxy, 0, ampMod).tanh;\n numOfEchos.do{\n delayTime = {delayMax.rand + delayAdd}!2;\n output = AllpassL.ar(output, 0.1, delayTime, 5);\n };\n output.tanh;\n }).play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = {LFTri.ar(100+(1000*Maths2.ar(MouseX.kr, MouseY.kr, 0.2, 1-MouseButton.kr(lag:0.001))[0]), 0, 0.1)}.play //notice how I am taking the [0th channel of the Maths and ignoring the other outputs\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = {LFTri.ar(100+(1000*Maths2.ar(MouseX.kr, MouseY.kr, 0.2, 1-MouseButton.kr(lag:0.001))[0]), 0, 0.1)}.play //notice how I am taking the [0]th channel of the Maths and ignoring the other outputs\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Sieve.plotCharacteristicPeriod` do?"}, {"role": "assistant", "content": "Plots the characteristic period returned by"}]} +{"conversations": [{"role": "user", "content": "What does `View.alwaysOnTop` do? What arguments does it take?"}, {"role": "assistant", "content": "If the view is a window, gets or sets whether it should always stay on top of other Arguments: boolean — A Boolean stating whether the view should always stay on top.."}]} +{"conversations": [{"role": "user", "content": "What is `Lag2UD` in SuperCollider?"}, {"role": "assistant", "content": "Lag2UD — Exponential lag Lag2 is equivalent to Lag.kr(Lag.kr(in, time), time), thus resulting in a smoother transition. This saves on CPU as you only have to calculate the decay factor once instead of twice. See Lag for more details. Category: UGens > Filters."}]} +{"conversations": [{"role": "user", "content": "What does `AudioPatchOut.audio` do? What arguments does it take?"}, {"role": "assistant", "content": "manages state and resources for a Player's output when connecting to other Players Arguments: audioPatchIn; needsValueSetNow."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ProxySpace`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\np = ProxySpace.new;\np.fadeTime = 2; // fadeTime specifies crossfade\np[\\out].play; // monitor an empty placeholder through hardware output\n// set its source\np[\\out] = { SinOsc.ar([350, 351.3], 0, 0.2) };\np[\\out] = { Pulse.ar([350, 351.3] / 4, 0.4) * 0.2 };\np[\\out] = Pbind(\\dur, 0.03, \\freq, Pbrown(0, 1, 0.1, inf).linexp(0, 1, 200, 350));\n\n// route one proxy through another:\np[\\out] = { Ringz.ar(p[\\in].ar, [350, 351.3] * 8, 0.2) * 4 };\np[\\in] = { Impulse.ar([5, 7]/2, [0, 0.5]) };\n\np.clear(3); // clear after 3 seconds\n```"}]} +{"conversations": [{"role": "user", "content": "Are you an AI?"}, {"role": "assistant", "content": "Yes. I am a small language model specialised in SuperCollider. I generate text; I cannot hear audio, run sclang, or check whether a patch sounds the way you want."}]} +{"conversations": [{"role": "user", "content": "A starting point to start experimenting with non-standard synthesis?"}, {"role": "assistant", "content": "SuperCollider forum — A starting point to start experimenting with non-standard synthesis?\n\nI while ago I did this noise cloud generator which might serve as inspiration. Other ideas: scramble signals with FFT tools, granular synthesis, FM-synthesis with extreme settings, like index-of-modulation = 4000.\n\n```supercollider\nSynthDef(\\clouds, {\n var num = 10;\n var dur = \\duration.kr(1/6);\n var sig = num.collect{\n var freq = Rand(30, 5000) * SinOsc.kr(LFNoise1.kr(dur).range(30, 1000), 0, LFNoise1.kr(dur)\n .range(0.01, 8)).midiratio;\n var sig = Select.ar(LFNoise0.kr(dur).range(0, 2).round,\n [SinOsc.ar(freq, 0, 0.3), Saw.ar(freq, 0.3), Pulse.ar(freq, 0, 0.3)]);\n var filtFreq = Rand(30, 1000) * LFNoise1.kr(dur).range(1.0, 5.0);\n var filt = Select.ar(LFNoise0.kr(dur).range(0, 2).round,\n [LPF.ar(sig, filtFreq), HPF.ar(sig, filtFreq), BPF.ar(sig, filtFreq)]\n );\n sig = CombL.ar(filt, 0.5, LFNoise1.kr(dur).range(0.02, 0.5), rrand(0.3, 2));\n sig\n };\n var env = Env.perc(\\atk.kr(0.02), \\rel.kr(6), 1, \\cur.kr(-4)).ar(2);\n sig = Splay.ar(sig); // nb! levelComp: true, so if removed signal will be extremely loud!\n sig = LPF.ar(sig, 2000);\n sig = FreeVerb2.ar(sig[0], sig[1], LFNoise1.kr(dur).range(0, 1.0), LFNoise1.kr(dur).range(0.2, 2));\n sig = sig * env * \\amp.kr(1);\n Out.ar(\\out.kr(0), sig)\n}).add;\n\nSynth(\\clouds, [\\atk, rrand(0.01, 2), \\rel, rrand(1, 6.0), \\duration, rrand(0.01, 1)])\n// run it several times, the outcome is highly random\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Server.waitForBoot` do? What arguments does it take?"}, {"role": "assistant", "content": "Evaluate \"onComplete\" as soon as the server has booted. This method will boot the server for you if it is not already running or booting. If the server is already running, \"onComplete\" is executed Arguments: onComplete — A function to evaluate after the server has booted successfully.; limit — The number of times to check for a successful boot. (5 times/sec); onFailure — A function to evaluate after the server fails to boot. If onFailure is not given, an error message is posted. Providing a function suppresses the error message. If you want to supply a function and print the normal error message, make sure that your function returns \"false,\" e.g. `s.waitForBoot(onFa; clock — The default Clock is AppClock. Use SystemClock or TempoClock if time accuracy is important.."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `InFeedback`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-InFeedback\", { |out = 0, in = 0|\n Out.ar(out,\n InFeedback.ar(in, 1)\n );\n}).add;\nSynthDef(\"help-SinOsc\", { |out = 0, freq = 440|\n Out.ar(out, SinOsc.ar(freq, 0, 0.1))\n}).add;\n);\n\nx = Bus.audio(s, 1);\n\n// read from bus n play to bus 0 (silent)\na = Synth(\"help-InFeedback\", [\\in, x.index, \\out, 0]);\n\n// now play a synth after this one, playing to bus x\nb = Synth.after(a, \"help-SinOsc\", [\\out, x.index]);\n\n// add another synth before a which also writes to bus x\n// now you can't hear b, as its data is one cycle old, and is overwritten by c\nc = Synth.before(a, \"help-SinOsc\", [\\out, x.index, \\freq, 800]);\n\n// free c and you can hear b again\nc.free;\nx.free;\n\na.free; b.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Pfsm` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n(\na = Pfsm([\n #[0, 1],\n 67, #[0, 0, 3],\n 72, #[2],\n 73, #[0, 2],\n Pseq([74, 75, 76, 77]), #[2, 3, 3],\n nil, nil\n ], inf).asStream;\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, a.next.midicps]);\n 0.1.wait;\n })\n}).play;\n);\n\n(\nPfsm([\n #[5, 6, 7], // entry states\n\n // e1 (== state 0)\n Pbind(\\dur, Pseq([1/8, 3/8]), \\midinote, Pseq([86, 75])),\n // #[1], // as given in CMJ\n // my de-boredom-ated version..\n #[1, 1, 1, 1, 1, 1, 1, 8],\n // e2 (== state 1)\n Pbind(\\dur, 1/2, \\midinote, Pseq([69])),\n #[0, 1],\n // e3 (== state 2)\n Pbind(\\dur, 1/3, \\midinote, Pseq([55, 60, 66])),\n #[0, 1, 2, 2, 2, 2, 3, 3, 3, 3],\n // e4 (== state 3)\n Pbind(\\dur, 1/4, \\midinote, Pseq([81, 80, 77, 76])),\n #[1, 4, 4, 4, 4],\n // e5 (== state 4)\n Pbind(\\dur, Pseq([1, 2/3, 2/3, 2/3, 1]), \\midinote, Pseq([\\, 70, 70, 70, \\])),\n #[2, 3],\n // e6 (== state 5)\n Pbind(\\dur, 1/4, \\midinote, Pseq([59, 61])),\n #[0, 2, 4, 5, 5, 5, 5, 5, 5, 5],\n // e7 (== state 6)\n Pbind(\\dur, 1/4, \\midinote, Pseq([87, 88], 2)),\n #[4, 4, 4, 4, 6, 6, 6, 7, 7, 7],\n // e8 (== state 7)\n Pbind(\\dur, 1, \\midinote, Pseq([56])),\n #[1, 3, 6, 6, 6],\n // terminal state\n nil, nil\n]).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n\n ~needed_interval = 20;\n\n ~funk = {\n\n // if last time isn't defined, create it with 1000 seconds ago time\n if( ~last_time.isNil ) {\n ~last_time = Date.getDate.bootSeconds;\n ~last_time = ~last_time - 1000;\n };\n\n // if needed interval has passed, execute the funkie\n if( ( Date.getDate.bootSeconds - ~last_time ) > ~needed_interval ) {\n\n // safe last execution time, so next calls will have to wait the needed interval\n ~last_time = Date.getDate.bootSeconds;\n\n ( \"SOMETHING HAPPENS HERE AT MAXIMUN RATE OF 1 TIME EACH\" + ~needed_interval + \" SECONDS \" );\n\n } {\n ( \"YOU STILL HAVE TO WAIT\" );\n }\n };\n);\n\n~funk.value()\n```"}, {"role": "assistant", "content": "A friend of mine asked me how to limit a function to happen at maximun rate of 1 time every N seconds.."}]} +{"conversations": [{"role": "user", "content": "What does `BusPlug.defaultNumControl` do?"}, {"role": "assistant", "content": "Default number of channels when initializing in control rate and no specific number is given (default:"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BPF`."}, {"role": "assistant", "content": "```supercollider\n{ BPF.ar(Saw.ar(200, 0.5), FSinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3600, 4000), 0.3) }.play;\n\n{ BPF.ar(Saw.ar(200, 0.5), MouseX.kr(100, 10000, 1), 0.3) }.play;\n\n // BPF on control signals:\n(\n{ var vib = BPF.kr(PinkNoise.kr, MouseX.kr(1, 100, 1), 0.3) * 10;\n SinOsc.ar(vib * 200 + 600) * 0.2 }.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nMix.ar([SinOsc.ar(220, 0, 0.1), SinOsc.ar(330, 0, 0.1)])\n```"}, {"role": "assistant", "content": "Sums two sine waves into one signal — a perfect fifth, 220 Hz and 330 Hz, at 0.1 amplitude each.\n\n`[SinOsc.ar(220, 0, 0.1), SinOsc.ar(330, 0, 0.1)]` is an Array of two audio-rate signals (each UGen\nreturns a signal; an array of them is just a list). `Mix.ar` adds the elements together. The alternative\n`+` operator does the same for two signals, and `Splay.ar` would spread them across the stereo field\ninstead of summing them."}]} +{"conversations": [{"role": "user", "content": "Who are you?"}, {"role": "assistant", "content": "I am sc-mind, a 198M MiniMind-3-MoE trained from scratch on the SuperCollider source and help corpus. I write and explain SuperCollider: SynthDefs, UGens, Patterns, Ndef, the language/server split, and how to make sound that is not silence."}]} +{"conversations": [{"role": "user", "content": "What is `Cepstrum` in SuperCollider?"}, {"role": "assistant", "content": "Cepstrum — Quefrency analysis and liftering Fourier analysis of the shape of a signal's log-power spectrum. Because this transform applies to magnitudes and not the phases (i.e. it ignores half of the data), the cepstral Buffer is half the size of the FFT Buffer. Category: UGens > FFT."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BinaryOpUGen`."}, {"role": "assistant", "content": "```supercollider\na = WhiteNoise.ar; // a WhiteNoise\nb = a + 2; // a BinaryOpUGen.\nb.operator; // +\n\n// sound example\n(\n{\n var a = LFSaw.ar(300);\n var b = LFSaw.ar(329.1);\n a % b * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `MxDocument` in SuperCollider?"}, {"role": "assistant", "content": "MxDocument — a wrapper for placing code Documents onto the Mx grid This is for adding code documents to an Mx. Category: Mx."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `DelayN` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// これは(SC2の配布物の中の)\"01 Why SuperCollider document\"からのリバーブ\n(\nSynthDef(\"preDelay\", { arg inbus = 2;\n Out.ar(\n 4,\n DelayN.ar(In.ar(inbus, 1), 0.048, 0.048)\n )\n}).add;\n\nSynthDef(\"combs\", {\n Out.ar(\n 6,\n Mix.arFill(7, { CombL.ar(In.ar(4, 1), 0.1, LFNoise1.kr(Rand(0, 0.1), 0.04, 0.05), 15) })\n )\n}).add;\n\nSynthDef(\"allpass\", { arg gain = 0.2;\n var source;\n source = In.ar(6, 1);\n 4.do({ source = AllpassN.ar(source, 0.050, [Rand(0, 0.05), Rand(0, 0.05)], 1) });\n Out.ar(\n 8,\n source * gain\n )\n}).add;\n\nSynthDef(\"theMixer\", { arg gain = 1;\n Out.ar(\n 0,\n Mix.ar([In.ar(2, 1), In.ar(8, 2)]) * gain\n )\n}).add;\n);\n\n(\nSynth(\"fm1\", [\\bus, 2, \\freq, 440, \\carPartial, 1, \\modPartial, 1.99, \\mul, 0.071]);\nSynth(\"fm1\", [\\bus, 2, \\freq, 442, \\carPartial, 1, \\modPartial, 2.401, \\mul, 0.071]);\nSynth.tail(s, \"preDelay\");\nSynth.tail(s, \"combs\");\nSynth.tail(s, \"allpass\");\nSynth.tail(s, \"theMixer\", [\\gain, 0.64]);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for nothing much ). Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n{|atk=0.05,dur=10,freq=50,amp=0.8|\n PMOsc.ar(\n Line.kr(1,2,dur,freq),\n LFNoise2.kr([1,2]).range(1,2)*freq,\n LFNoise2.kr([2,1]).range(0.1,3.5),\n 0,\n Decay2.ar(\n Impulse.ar(XLine.kr(1, 25, dur)) * SinOsc.ar(4/dur,[0,pi/2],0.05,1),\n 0.023, XLine.ar(1,35,dur).reciprocal,\n Line.ar(1,0.8,dur) * LFNoise2.kr(4/dur,0.05,1).dup\n ) * EnvGen.ar(Env([0,1,1,0],[atk,dur-atk,0.3]),1,amp, doneAction:2)\n )\n // * LFPulse.ar(XLine.kr(5,20,dur,freq * LFNoise2.kr([1,2]).range(0.95,1.05)))\n}.play(args:[\n freq:50.rrand(350).debug('freq'),\n dur:10.rrand(20).debug('dur')\n])\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PanB2`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var w, x, y, p, a, b, c, d;\n\n p = PinkNoise.ar; // source\n\n // B-format encode\n #w, x, y = PanB2.ar(p, MouseX.kr(-1, 1), 0.1);\n\n // B-format decode to quad\n #a, b, c, d = DecodeB2.ar(4, w, x, y);\n\n [a, b, d, c] // reorder to my speaker arrangement: Lf Rf Lr Rr\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//This example requires the FluCoMa tools to be installed from::\n//https://www.flucoma.org/download/\n\n(\nAlga.boot({\n //Sine oscillator with frequency modulation\n a = AN({ SinOsc.ar(\\freq.kr(10) + \\fm.ar(0)) }).play(chans:2);\n\n //Sine oscillator\n b = AN({ SinOsc.ar(\\freq.kr(440)) });\n\n //Pitch analyser\n c = AN({ FluidPitch.kr(\\in.ar) });\n\n //Patch first oscillator into the pitch analyser.\n a >> c;\n\n //Patch the pitch analyser into the \\freq input of the second oscillator\n c >>.freq b;\n\n //Create feedback: patch b's output to a's \\fm input, mapping -1 / 1 to -200 / 300\n a.from(b, \\fm, scale:[-200, 300], time:0.5);\n});\n);\n\n//Try with different scalings (change the values)\na.from(b, \\fm, scale:[-1432, 679], time:3);\n\n//Try new base frequencies (change the value)\na.from(100, \\freq, time:2);\n\n//Bye bye\n(\na.clear({\n b.clear;\n c.clear;\n}, time:3)\n);\n```"}, {"role": "assistant", "content": "This example requires the FluCoMa tools to be installed from https://www.flucoma.org/download/."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Normalizer`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n// example signal to process\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n z * 0.8\n}.play\n);\n\n(\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n [z, Normalizer.ar(z, 0.4, 0.01)] * 0.5\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What can you do?"}, {"role": "assistant", "content": "Write and explain SuperCollider: SynthDefs, UGens, Patterns, Ndef, buses and envelopes, and tell you why a patch is silent or will not compile. I am 198M parameters, so I am narrow on purpose."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SampleRate`."}, {"role": "assistant", "content": "```supercollider\n// compares a 441 Hz sine tone derived from sample rate (44100 * 0.01, left)\n// with a 440 Hz tone (right), resulting in a 1 Hz beating\n(\n{\n var freq;\n freq = [SampleRate.ir * 0.01, 440];\n SinOsc.ar(freq, 0, 0.1)\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `List`."}, {"role": "assistant", "content": "```supercollider\n(\n// Create a new empty List with size: 3\nx = List.new(3);\n\nx.postln; // -> List[ ]\n\n// Add numbers 0 to 4 to the List\n5.do({ |i| x.add(i) });\n\n// The list has been modified in-place with each added item\nx.postln; // -> List[ 0, 1, 2, 3, 4 ]\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// as frequency control...\n(\n{\nSinOsc.ar(\n LinCongC.ar(\n 40,\n LFNoise2.kr(0.1, 0.1, 1),\n LFNoise2.kr(0.1, 0.1, 0.1),\n LFNoise2.kr(0.1),\n 0, 500, 600\n )\n) * 0.4 }.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// as frequency control...\n(\n{\nSinOsc.ar(\n LinCongC.ar(\n 40,\n LFNoise2.kr(0.1, 0.1, 1),\n LFNoise2.kr(0.1, 0.1, 0.1),\n LFNoise2.kr(0.1),\n 0, 500, 600\n )\n) * 0.4 }.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Just a dirty FM bass shuffling. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\nfork{\n SynthDef(\\basicFM, {|out = 0, gate = 1, amp = 1, carFreq = 1000, modFreq = 100, modAmount = 2000, clipAmount = 0.1|\n var modEnv = EnvGen.ar(Env.adsr(0.5, 0.5, 0.7, 0.1, peakLevel: modAmount), gate);\n var mod = SinOsc.ar(modFreq) * modEnv;\n var car = SinOsc.ar(carFreq + mod);\n var ampEnv = EnvGen.ar(Env.adsr(0.1, 0.3, 0.7, 0.2, peakLevel: amp), gate, doneAction: 2);\n var clip = clipAmount * 500;\n Out.ar(out, (car * ampEnv * clip).clip(-0.7, 0.7) * 0.1);\n }).add;\n\n s.sync;\n\n Pbind(*[\n instrument: \\basicFM,\n out: [0, 1],\n dur: Pseq([1/7, 1/3] / 1.2, inf),\n sustain: Pkey(\\dur),\n amp: 1/4,\n carFreq: Pseq([1, 1, 1, 2] * 350, inf),\n modFreq: Pkey(\\carFreq) * (1/8),\n modAmount: Pseq([2, 1, 0.5, 2, 1, 0.5, 2, 1, 2, 1, 0.5, 2, 1, 0.5, 2, 4] * 500, inf),\n clipAmount: Pseq([Pn(0.1, 32), Pn(1, 32)], inf)\n ]).play;\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SoundFileView.read` do? What arguments does it take?"}, {"role": "assistant", "content": "Reads a section of the #-soundfile and displays it in the view. For large files, you may want to use readWithTask instead. The 'block' argument has no effect; the display resolution is Arguments: startFrame — The beginning of the section, in frames.; frames — The size of the section, in frames.; block — The block size - visual resolution of the display. An Integer of the form 2**n.; closeFile — If true, closes the SoundFile after reading.; doneAction — A Function called when the file reading has completed.."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for rough sketch of chicago minor chord pad thing. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\\ChicagoPad, { |out = 0, freq = 440, cutoff = 500, amp = 0.2|\n var snd;\n freq = freq + SinOsc.kr(0.1, 0, 1, 20);\n snd = Saw.ar([freq, freq+1, freq-1, freq*3/2, freq*6/5])*0.1;\n snd = snd + VarSaw.ar(0.99*[freq, freq+1, freq-1,freq*3/2, freq*6/5],0, LFTri.kr(0.3).range(0.25,0.9))*0.1;\n snd = Mix(snd);\n snd = RLPF.ar(snd, SinOsc.kr(0.1, 0, 100, 5000), 0.1);\n snd = GVerb.ar(snd ,40, 10, 0.6, 0.6, -3, -9, -11)*0.2;\n \n //snd = RLPF.ar(snd, SinOsc.kr(0.08, 0.5, cutoff/10, cutoff), 0.2);\n snd = MoogFF.ar(snd, SinOsc.kr(0.08, 0.5, cutoff/10, cutoff), 3, 0);\n snd = DelayC.ar(snd, 1.5, 1,0.8);\n //snd = snd * EnvGen.ar(Env.linen(0.001, 0.01,0.01,1), doneAction:2);\n Out.ar(out, [snd, AllpassC.ar(snd, 0.5, 0.05, 0.3)]*amp);\n}).send;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n/* Audio plugin definition\n\n Each audio plugin should define the following global variables:\n ~name: (symbol) name of the spatializer\n ~description: (string) a short description\n ~function: the actual definition of the plugin\n\n*/\n\n~name = \\MonoIn;\n~description = \"A direct input\";\n~channelLayout = \\mono;\n\n~function = {\n |gate = 0, bus = 0, attack = 0.02, susL = 0.9, release = 0.1, curve = -4|\n var env = Env.asr(attack, susL, release, curve);\n SoundIn.ar(bus, EnvGen.kr(env, gate));\n}\n```"}, {"role": "assistant", "content": "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see ."}]} +{"conversations": [{"role": "user", "content": "What does `EnvelopeView.setString` do? What arguments does it take?"}, {"role": "assistant", "content": "Sets the label of the node at the given Arguments: index — the index of the node.; string — A String.."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `FreqScopeView`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// Start server\ns.boot;\n\n// Create analyzer in a window\n(\nw = Window(\"My Analyzer\", Rect(0, 0, 511, 300)); // width should be 511\nf = FreqScopeView(w, w.view.bounds);\nf.active_(true); // turn it on the first time;\n\nw.onClose_({ f.kill }); // you must have this\nw.front;\n{ SinOsc.ar([500, 1000], 0, 0.25).mean.dup }.play(s); // start two sine waves\n)\n```"}]} {"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// python preprocessor, given that you have python installed\n// thanks to tasos tsesmetzis\n\n(\nthis.preProcessor = PreProcessor.new.startDelimiter_(\"{-\").endDelimiter_(\"-}\");\n\n// a simple python call\ne = (\n lang: \\python,\n languages:\n (\n python: // code is the incoming string, event is the event for parameters and output\n {|code, event|\n var input, pipe, output;\n code = e[\\prefix] ++ \"print\" ++ \"(\" ++ code ++ \")\";\n input = \"python -c '%'\".format(code);\n pipe = Pipe(input, \"r\");\n output = pipe.readUpTo;\n pipe.close;\n event.put(\\result, output)\n }\n ),\n prefix: \"import math;\"\n);\n);\n\n// ok, assuming such a little interpreter exists for a given language,\n// one can now use it in code.\n\n(\ne =\n{-\n math.factorial(61)\n-}.value(e);\ne.result;\n);\n\ne.calc_result = e.result.as(Array).collect { |x| x.asString.interpret };\n\nPbind(\\note, Pseq(e.calc_result), \\dur, 0.1).play;\n```"}, {"role": "assistant", "content": "python preprocessor, given that you have python installed thanks to tasos tsesmetzis."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Ringz`."}, {"role": "assistant", "content": "```supercollider\n(\na = {\n // rectangular pulse exciter (deterministic input)\n var exc = EnvGen.ar(Env([1, 1, 0], [0.01, 0], \\lin)),\n sig = Ringz.ar(exc, 440, decaytime: 0.2),\n rms = sqrt(Integrator.ar(sig.squared) * (0.2 / SampleRate.ir)),\n end = DetectSilence.ar(sig, doneAction: 2);\n rms.poll(end);\n Silent.ar(1)\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SelectXFocus`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var array = { Saw.ar(rrand(1.0, 3.0)) * Saw.ar(rrand(100.0, 3000.0)) } ! 8;\n SelectXFocus.ar(MouseX.kr(-20, 20), array, 0.3, true) * 0.1\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What's the difference between Env.perc and Env.adsr?"}, {"role": "assistant", "content": "`Env.perc(attack, release)` goes up once and decays to zero — one-shot sounds. `Env.adsr(a, d, s, r)` holds at a sustain level while its gate is open and only releases when the gate closes — notes you start and stop."}, {"role": "user", "content": "So which do I use for a pad?"}, {"role": "assistant", "content": "adsr, with `gate` as a Synth argument and `doneAction: 2` on the EnvGen:\n\n```supercollider\nSynthDef(\\pad, { |out = 0, freq = 220, gate = 1|\n var env = EnvGen.kr(Env.adsr(0.8, 0.4, 0.7, 2), gate, doneAction: 2);\n Out.ar(out, Saw.ar(freq) * env * 0.1)\n}).add;\n```\n\nThen `x.set(\\gate, 0)` releases it over the 2 seconds of release time."}]} -{"conversations": [{"role": "user", "content": "What does `U.addSynth` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: synth — (describe argument here). Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "What does `RedMixerChannel.insertClass` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new RedEffectModule before the Arguments: redEfxClass — A class or an array of classes.; addAction — Local to the inserts. The default `\\addToHead` will put it first in the chain of inserts.."}]} -{"conversations": [{"role": "user", "content": "What does `UnicodeResponder.option` do? What arguments does it take?"}, {"role": "assistant", "content": "register responder functions for unicode and modifier combinations Arguments: ... assns."}]} -{"conversations": [{"role": "user", "content": "What does `Fb1_ODEdef.remove` do? What arguments does it take?"}, {"role": "assistant", "content": "Removes the Fb1_ODEdef of the Symbol key from the Arguments: key — Symbol.."}]} -{"conversations": [{"role": "user", "content": "What does `OpenBCI.buffer` do?"}, {"role": "assistant", "content": "an Array of n-channel Lists acting as an internal buffer. the buffer is rotated one step each time a new datapoint arrives (each subclass call #-updateBuffer). the buffer is mainly useful for filtering. set its size with"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Scale`."}, {"role": "assistant", "content": "```supercollider\n(\nr = {\n var scale = Scale.choose.postln;\n SinOsc.ar(\n (\n DegreeToKey.kr(\n scale.as(LocalBuf),\n MouseX.kr(0, 15), // mouse indexes into scale\n scale.stepsPerOctave,\n 1, // mul = 1\n 60 // offset by 72 notes\n )\n + LFNoise1.kr([3, 3], 0.04) // add some low freq stereo detuning\n ).midicps, // convert midi notes to hertz\n 0,\n 0.25\n )\n}.play;\n);\n\nr.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `NodeProxy`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\na = NodeProxy.new.play; // play to hardware output.\na.fadeTime = 2; // fadeTime specifies crossfade\n// set the source\na.source = { SinOsc.ar([350, 351.3], 0, 0.2) };\na.source = { Pulse.ar([350, 351.3] / 4, 0.4) * 0.2 };\na.source = Pbind(\\dur, 0.03, \\freq, Pbrown(0, 1, 0.1, inf).linexp(0, 1, 200, 350));\n\nb = NodeProxy.new;\na.source = { Ringz.ar(b.ar, [350, 351.3] * 8, 0.2) * 4 };\nb.source = { Impulse.ar([5, 7]/2, [0, 0.5]) };\n\na.clear(3); // clear after 3 seconds\nb.clear(3);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Just experimental sketch of somewhere audio background."}, {"role": "assistant", "content": "```supercollider\n(\n{ \n Limiter.ar(\n GVerb.ar(\n ( \n BPF.ar(\n WhiteNoise.ar([0.07,0.07]) + Blip.ar([13,19], 200.rand, mul:0.5),\n SinOsc.kr(\n SinOsc.kr([1/108,1/109]).range(1/108, 1/13)\n ).exprange(10, 23000),\n PMOsc.kr(1/54,1/216, 3).range(0.1, 2)\n ) \n * \n SinOsc.ar(Array.rand(20, 1/216, 1), mul: Array.rand(20, 0.2, 1)).reshape(10,2)\n ).sum,\n roomsize:10,\n damping: PMOsc.kr(1/27, 1/108, 3).range(0.5, 1), \n drylevel: SinOsc.kr(1/9).range(0.1, 1)\n )\n +\n GVerb.ar(\n Pan2.ar(\n LPF.ar(\n DynKlank.ar(\n `[\n Array.rand(6, 600, 4000).collect({|freq|\n SinOsc.kr(1/108).range(freq/2,freq)\n }), \n nil, \n Array.rand(6, 1/108, 1/27).collect({|freq|\n SinOsc.kr(freq).range(1/108,1/3)\n })\n ],\n Limiter.ar(\n Dust.ar( SinOsc.kr(1/256).exprange(1/27, 3), TRand.kr(0.15, 0.25, Dust.kr(1/9))) \n + \n Impulse.ar( SinOsc.kr(1/108).exprange(1/54, 3), 0, TRand.kr(0.6, 0.8, Dust.kr(1/3)))\n )\n ),\n 1700,\n LFPar.kr(1/27).exprange(0.05, 0.2)\n ),\n SinOsc.kr(1/9).range(-0.2, 0.2)\n ),\n roomsize: 30,\n drylevel: 0.5\n )\n )\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var freq, trig;\n var in = Dseq([1, 2, 3], inf);\n var rep = Ddup(Diwhite(2, 8, inf), in);\n trig = Impulse.kr(MouseX.kr(1, 40, 1));\n freq = Demand.kr(trig, 0, rep).poll(trig) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var freq, trig;\n var in = Dseq([1, 2, 3], inf);\n var rep = Ddup(Diwhite(2, 8, inf), in);\n trig = Impulse.kr(MouseX.kr(1, 40, 1));\n freq = Demand.kr(trig, 0, rep).poll(trig) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `IdentityBag`."}, {"role": "assistant", "content": "```supercollider\nIdentityBag[1, 2, 3].add(4);\nIdentityBag[1, 2, 3].add(3);\nIdentityBag[\"abc\", \"def\", \"ghi\"].add(\"jkl\");\nIdentityBag[\"abc\", \"def\", \"ghi\"].add(\"def\");\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Server-side sequencing (a SuperCollider snippet)?"}, {"role": "assistant", "content": "```supercollider\n(\nf = { |f0=200, rate=4|\n {\n var seq = Dseq(f0*[1/2,3/4, Dstutter(4, Drand([1/2,1,2,3,4,5,6],1)), 2,3/2,3,4/3], inf);\n var trig = Impulse.ar(rate);\n var freq = Demand.ar(trig,0, seq);\n var env = Decay2.ar(trig,1e-3,1);\n FreeVerb.ar(\n Splay.ar(SinOsc.ar(freq*[0.995, 1, 1.005]).fold(-0.995,0.995)*0.25*env),\n 0.5,\n 0.5\n );\n }\n};\n\nfork{ 4.do{\n fork{\n f.(100,2).play;\n (1/8).wait;\n f.(200,4).play;\n (1/4).wait;\n f.(100*4/3,8).play;\n (1/2).wait;\n f.(400,4).play;\n };\n (1/4).wait;\n}}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for simple smooth arp."}, {"role": "assistant", "content": "```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\smooth, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.linen(0.05, sustain, 0.1), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LFCub`."}, {"role": "assistant", "content": "```supercollider\n{ LFCub.ar(LFCub.kr(LFCub.kr(0.2, 0, 8, 10), 0, 400, 800), 0, 0.1) }.play\n{ LFCub.ar(LFCub.kr(0.2, 0, 400, 800), 0, 0.1) }.play\n{ LFCub.ar(800, 0, 0.1) }.play\n{ LFCub.ar(XLine.kr(100, 8000, 30), 0, 0.1) }.play\n\n// compare:\n\n{ LFPar.ar(LFPar.kr(LFPar.kr(0.2, 0, 8, 10), 0, 400, 800), 0, 0.1) }.play\n{ LFPar.ar(LFPar.kr(0.2, 0, 400, 800), 0, 0.1) }.play\n{ LFPar.ar(800, 0, 0.1) }.play\n{ LFPar.ar(XLine.kr(100, 8000, 30), 0, 0.1) }.play\n\n\n{ SinOsc.ar(SinOsc.kr(SinOsc.kr(0.2, 0, 8, 10), 0, 400, 800), 0, 0.1) }.play\n{ SinOsc.ar(SinOsc.kr(0.2, 0, 400, 800), 0, 0.1) }.play\n{ SinOsc.ar(800, 0, 0.1) }.play\n{ SinOsc.ar(XLine.kr(100, 8000, 30), 0, 0.1) }.play\n\n{ LFTri.ar(LFTri.kr(LFTri.kr(0.2, 0, 8, 10), 0, 400, 800), 0, 0.1) }.play\n{ LFTri.ar(LFTri.kr(0.2, 0, 400, 800), 0, 0.1) }.play\n{ LFTri.ar(800, 0, 0.1) }.play\n{ LFTri.ar(XLine.kr(100, 8000, 30), 0, 0.1) }.play\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// kr modulation of time\n\n(\nx = {\n var f = 0.2, mass = 0.001, spring = 50, dampen = 0.0005,\n sig = Fb1_ODE.ar(\\MSD, \n [f, mass, spring, dampen],\n tMul: SinOsc.kr(0.6).range(0.5, 1.5),\n leakDC: false\n );\n SinOsc.ar(sig[0].linlin(0, 0.005, [100, 101], 700), 0, 0.1)\n}.play\n);\n\nx.release\n\n// ar modulation of time\n// including mainly negative multipliers\n// questionable physical sense, but can be fun\n\n(\nx = {\n var f = 0.2, mass = 0.001, spring = 50, dampen =\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// kr modulation of time\n\n(\nx = {\n var f = 0.2, mass = 0.001, spring = 50, dampen = 0.0005,\n sig = Fb1_ODE.ar(\\MSD, \n [f, mass, spring, dampen],\n tMul: SinOsc.kr(0.6).range(0.5, 1.5),\n leakDC: false\n );\n SinOsc.ar(sig[0].linlin(0, 0.005, [100, 101], 700), 0, 0.1)\n}.play\n);\n\nx.release\n\n// ar modulation of time\n// including mainly negative multipliers\n// questionable physical sense, but can be fun\n\n(\nx = {\n var f = 0.2, mass = 0.001, spring = 50, dampen = 0.0005,\n sig = Fb1_ODE.ar(\\MSD, \n [f, mass, spring, dampen],\n tMul: SinOsc.ar(5).range(-5, 1.5),\n leakDC: false,\n withTimeChannel: true // include time as third channel\n );\n sig[2].poll;\n SinOsc.ar(sig[0].linlin(0, 0.005, [100, 101], 700), 0, 0.1);\n}.play\n);\n\nx.release\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `PV_Mul` in SuperCollider briefly."}, {"role": "assistant", "content": "PV_Mul — Complex multiply. Complex Multiplication: Category: UGens > FFT."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for minor random bliss in two for Prout."}, {"role": "assistant", "content": "```supercollider\n(\n\nSynthDef(\\param, { arg freq = 100, sustain, amp;\n var sig;\n sig = LFPar.ar(freq: freq,\n mul: EnvGen.kr(Env.perc(0, sustain, 0.5), doneAction:2) * amp);\n sig = Splay.ar(sig);\n Out.ar(0, sig);\n}).add;\n\ne = Pbind(\n \\midinote, Prout({\n var tone0, tone1, tone2, interval, freq0, delta;\n loop {\n tone0 = rrand(0,11);\n interval = rrand(2,4);\n tone1 = Scale.minor(\\pythagorean).at(tone0) + [0,12,24].choose + 0.07;\n tone2 = Scale.minor(\\pythagorean).at(tone0 + interval) + [0,12,24].choose;\n freq0 = [tone1,tone2]+48;\n postln(freq0);\n freq0.yield;\n }\n }),\n \\dur, Prand([1,2,4,8,12,16,4,6,8], inf),\n \\instrument, \\param,\n \\amp, 0.5,\n \\sustain, 2,\n).play(quant:1); // returns an EventStream\nTempoClock.default.tempo = 1200/60;\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Psetpre does not override incoming values:\n\n(\nvar a, b;\na = Psetpre(\\freq, 801, Pbind(\\freq, 108));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n);\n\n\n(\nvar a, b;\na = Psetpre(\\freq, Pseq([401, 801], 2), Pbind(\\dur, 0.5));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n);\n\n\n// sound example\n\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.per\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Psetpre does not override incoming values:\n\n(\nvar a, b;\na = Psetpre(\\freq, 801, Pbind(\\freq, 108));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n);\n\n\n(\nvar a, b;\na = Psetpre(\\freq, Pseq([401, 801], 2), Pbind(\\dur, 0.5));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n);\n\n\n// sound example\n\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain);\na = Psetpre(\\freq, Pseq([500, 600, 700], inf), a);\na = Psetpre(\\legato, Pseq([0.01, 1], inf), a);\na.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// check blockSize before (or reset blockSize in examples)\n\n(\nif (s.options.blockSize != 64) {\n s.options.blockSize = 64;\n s.quit.reboot;\n}\n);\n\n\n// exponentiation can also be interesting\n// here an area of instability is crossed by a stereo lfo\n\ns.scope\n\n// start fb fx Synth\n\n(\n~bus = Bus.audio(s, 1);\n\ny = {\n var inSig = In.ar(~bus);\n var lfo = { LFDNoise3.ar(0.5).linexp(-1, 1, 0.1, 150) } ! 2;\n\n Fb1({ |in, out|\n in[1][0] * 0.07 +\n // out[0]\n// …\n```"}, {"role": "assistant", "content": "check blockSize before (or reset blockSize in examples) exponentiation can also be interesting (Fb1: single sample feedback / feedforward pseudo ugen)"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// 3D:\n~positions = [ [ x0, y0, z0 ], [ x1, y1, z1 ], ... [ xN, yN, zN ] ;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// 3D:\n~positions = [ [ x0, y0, z0 ], [ x1, y1, z1 ], ... [ xN, yN, zN ] ];\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Synth`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n// create a Synth at the head of the default Server's default group\n// based on the SynthDef \"default\"\nx = Synth.new(\"default\");\ns.queryAllNodes; // note the default group (ID 1)\nx.free;\n\n// Using an arrayed control\n// run this block first to make the SynthDef\n(\nSynthDef(\"help-synth\", { |freq = #[440, 450, 460], out = 0|\n Out.ar(out, Mix(SinOsc.ar(freq, 0, 0.1)));\n}).add;\n);\n\n// then this a short while later\nx = Synth(\"help-synth\", [freq: [500, 501, 510]]);\n\nx = Synth(\"help-synth\", [freq: [500, 501, 510]]);\nx.set(\\freq, [1, 2, 3] * 400 + [1, 2, 3], \\out, 1);\nx.set(\\freq, [3] * 400 + [1, 2, 3], \\out, 1);\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `Pxrand` in SuperCollider briefly."}, {"role": "assistant", "content": "Pxrand — embed values randomly chosen from a list Like Prand, returns one item from the list at random for each repeat, but Pxrand never repeats the same element twice in a row. Category: Streams-Patterns-Events > Patterns > List."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Polyrhythmic and dynamic FM drone."}, {"role": "assistant", "content": "```supercollider\n// https://recarteblog.wordpress.com/\n//droneFM01\n\n// 1. Añadir al servidor\n(\nSynthDef(\\droneFM, {\n arg f1Freq=0.1, f2Freq=1.1, f3Freq=2.2, nFreq=440, m1Ratio=1, m2Ratio=2, m3Ratio=3,\n amp=0.1, dur=55, ampM=0.84 , pan=0;\n var sig, car1, mod1, car2, mod2, car3, mod3, env, index;\n index = LFNoise1.kr(0.2).range(2, 12);\n env = EnvGen.kr(Env.new([0, 0.70, 0.70, 0], [dur*0.333, dur*0.333, dur*0.333]), doneAction:2);\n mod1 = SinOsc.ar([nFreq * m1Ratio, nFreq+0.7 * m1Ratio], mul:nFreq * m1Ratio * index) * ampM;\n car1 = SinOsc.ar(f1Freq + mod1);\n mod2 = SinOsc.ar([nFreq * m2Ratio, nFreq+1.4 * m2Ratio], mul:nFreq * m2Ratio * index) * ampM;\n car2 = SinOsc.ar(f2Freq + mod2);\n mod3 = SinOsc.ar([nFreq * m3Ratio, nFreq+0.35 * m3Ratio], mul:nFreq * m3Ratio * index) * ampM;\n car3 = SinOsc.ar(f3Freq + mod3) * 0.4;\n sig = car1 + car2 + car3 * env * amp;\n sig = Pan2.ar(sig, pan);\n Out.ar(0, sig);\n}).add;\n);\n\n// 2. Ejecutar los Synths\n(\nSynth(\\droneFM, [\\nFreq, 50.midicps]);\nSynth(\\droneFM, [\\nFreq, 57.midicps]);\nSynth(\\droneFM, [\\nFreq, 41.midicps]);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `AllpassC` in SuperCollider?"}, {"role": "assistant", "content": "AllpassC — Schroeder allpass delay line with cubic interpolation. A Schroeder allpass filter is given by the difference equations Category: UGens > Delays."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nNdef(\\lfo2, { LFNoise1.kr(LFNoise1.kr(0.1).exprange(1, 300) ! 2, 400, 800) });\nNdef(\\sound, { Blip.ar(Ndef.kr(\\lfo2), 30) * 0.2 }).play;\n\nNdef(\\lfo2, { [MouseX.kr(10, 300, 1), MouseY.kr(10, 300, 1)] };\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nNdef(\\lfo2, { LFNoise1.kr(LFNoise1.kr(0.1).exprange(1, 300) ! 2, 400, 800) });\nNdef(\\sound, { Blip.ar(Ndef.kr(\\lfo2), 30) * 0.2 }).play;\n\nNdef(\\lfo2, { [MouseX.kr(10, 300, 1), MouseY.kr(10, 300, 1)] });\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `LinCongN` in SuperCollider briefly."}, {"role": "assistant", "content": "LinCongN — Linear congruential chaotic generator A non-interpolating sound generator based on the difference equation: Category: UGens > Generators > Chaotic."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Just going crazy with modulation."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"additivePad\", \n { arg numOfCycles = 100;\n var lfo;\n var lfo2;\n var lfo3;\n lfo = SinOsc.kr([Rand(0.5,1000),Rand(0.5,1000)], 1.5pi, 0.5, 0.5);\n lfo3 = SinOsc.kr([Rand(0.1,0.5),Rand(0.1,0.5)], 1.5pi, 0.5, 0.5);\n lfo2 = SinOsc.kr([(Rand(0.5,1000) * lfo) * lfo3, (Rand(0.5,1000) * (1 - lfo)) * (1 - lfo3)], 1.5pi, 0.5, 0.5);\n Out.ar(\n 0, \n Mix.arFill(\n numOfCycles,\n { \n SinOsc.ar(\n Rand(40,1000),\n 0, \n (numOfCycles.reciprocal * 0.75) * lfo2)\n }\n ) * EnvGen.kr(Env.perc(Rand(0.1,30), Rand(0.1,30)), doneAction: 2)\n )\n }\n).send(s); \n);\n\n(\nr = Routine({\n 200.do({\n x = Synth.new(\"additivePad\"); \n 10.wait;\n });\n});\n);\n\nr.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write an FM bell in SuperCollider."}, {"role": "assistant", "content": "PMOsc is phase modulation: a non-integer modulator ratio gives the inharmonic clang.\n\n```supercollider\n(\nSynthDef(\\fmBell, { |out = 0, freq = 440, amp = 0.2, dur = 4|\n var index = EnvGen.kr(Env([8, 0.2], [dur], -4));\n var sig = PMOsc.ar(freq, freq * 1.4, index, 0, 1);\n var env = EnvGen.kr(Env.perc(0.002, dur, 1, -5), doneAction: 2);\n Out.ar(out, Pan2.ar(sig * env * amp, 0));\n}).add;\n);\nSynth(\\fmBell, [\\freq, 550]);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Function.value` do?"}, {"role": "assistant", "content": "Evaluates the FunctionDef referred to by the Function. The Function is passed the args given. `// different way of expressing the same:` Default arguments can be omitted in the call: `{ |a=3, b=10| a * b }.value; // use default arguments only` The results of functions composed with operators distribute the keyword arguments to each of the operands. `f = { |a, b=1| a ** b } * { |a, c = 0| a + c"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nSynthDef(\\dubecho,{|in, out, length = 1, fb = 0.8, sep = 0.012|\n var input = In.ar(in, 2);\n var feedback = LocalIn.ar(2);\n var output = LeakDC.ar(feedback*fb + input);\n output = HPF.ar(output, 400);\n output = LPF.ar(output, 5000);\n output = output.tanh;\n LocalOut.ar(DelayC.ar(output, 1, LFNoise2.ar(12).range([length,length+sep],[length+sep,length])).reverse);\n ReplaceOut.ar(out, output);\n}).add;\n\n// Example as effecet bus\n~bus = Bus.audio(s, 2);\n~echo = Synth(\\dubecho, [\\in, ~bus, \\length, TempoClock.default.tempo*(3/8), \\fb, 0.7, \\sep, 0.0012], addAction: \\addToTail);\n\n// send something\nplay{ Out.ar(~bus, LFGauss.ar(1, 0.1, loop:0, doneAction:2) * Blip.ar(80!2, 8)) }\n\n// turn it off\n~echo.free;\n```"}, {"role": "assistant", "content": "Fork of Bjorn's Dub echo, rewritten w/o the Feedback Quark (using LocalIn + LocalOut) and adding a ping pong (can be removed by deleting the .reverse method in the LocalOut line)."}]} -{"conversations": [{"role": "user", "content": "What does `RedMixerChannel.restoreArchive` do? What arguments does it take?"}, {"role": "assistant", "content": "Similar to #*restoreFile but directly takes an Archive as Arguments: archive — An Archive.."}]} -{"conversations": [{"role": "user", "content": "Explain `DoubleWell2` in SuperCollider briefly."}, {"role": "assistant", "content": "DoubleWell2 — Forced DoubleWell Oscillator Improved Euler ODE solver implementation of the chaotic Forced Double Well Oscillator (see Strogatz, Steven H. (1994) Nonlinear Dynamics and Chaos. Addison-Wesley, Reading, MA. pp441-7). Category: UGens > Generators > Chaotic."}]} -{"conversations": [{"role": "user", "content": "What are you good at?"}, {"role": "assistant", "content": "SuperCollider. I can explain its classes and UGens, write SynthDefs and patches, read a patch back to you, and tell you why one does not compile. I am 198M parameters; I am not a general assistant."}]} -{"conversations": [{"role": "user", "content": "What is `List` in SuperCollider?"}, {"role": "assistant", "content": "List — list of items of variable size List is a subclass of SequenceableCollection with unlimited growth in size. Although not a subclass of Array or its superclass ArrayedCollection it uses an Array in its implementation and is in many cases interchangeable with one. (List implements many of the same methods as Array.) Category: Collections > Ordered."}]} -{"conversations": [{"role": "user", "content": "What does `Bus.audio` do? What arguments does it take?"}, {"role": "assistant", "content": "Allocate a private audio bus on the Arguments: server — The Server. Defaults to Server.default.; numChannels — Number of channels to allocate."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// (thor magnusson) (2006)\n\n// An instrumentalist inside a synthdef.\n\n(\nSynthDef(\\drummer, { arg out=0, tempo=4;\n var snare, base, hihat;\n tempo = Impulse.ar(tempo); // for a drunk drummer replace Impulse with Dust !!!\n\n snare = WhiteNoise.ar(Decay2.ar(PulseDivider.ar(tempo, 4, 2), 0.005, 0.5));\n base = SinOsc.ar(Line.ar(120,60, 1), 0, Decay2.ar(PulseDivider.ar(tempo, 4, 0), 0.005, 0.5));\n hihat = HPF.ar(WhiteNoise.ar(1), 10000) * Decay2.ar(tempo, 0.005, 0.5);\n\n Out.ar(out,(snare + base + hihat) * 0.4 ! 2)\n}).add;\n);\n\na = Synth(\\drummer);\na.set(\\tempo, 6);\na.set(\\tempo, 18);\na.set(\\tempo, 180); // check the CPU! no increase.\na.free;\n```"}, {"role": "assistant", "content": "(thor magnusson) (2006) An instrumentalist inside a synthdef."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Klank`."}, {"role": "assistant", "content": "```supercollider\n(\n{\nKlank.ar([ // the multichannel-expansion\n `[[500, 1078, 1201.5, 1723], nil, [1, 1, 0.5, 0.3]], // left channel\n `[[700, 1071, 1053, 1723], nil, [1, 1, 1, 1]] // right channel\n ], Impulse.ar([1.5, 1.875], 0, 0.1))\n}.play\n);\n\n// expanding specs within the parameter array\n{ Klank.ar(`[[[800, 6000], 1071, [1153, 8000], 1723], nil, [1, 1, 1, 1]], Impulse.ar([2, 3], 0, 0.1)) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `HPZ2`."}, {"role": "assistant", "content": "```supercollider\n// Compare:\n\n{ WhiteNoise.ar(0.25) }.play;\n\n{ HPZ2.ar(WhiteNoise.ar(0.25)) }.play;\n\n// HPZ2 is useful to detect changes in a signal:\n// see also HPZ1\n(\n{\n var changingSignal = LFNoise0.ar(1000);\n var hpz2 = HPZ2.ar(changingSignal);\n [hpz2, hpz2 > 0]\n}.plot\n);\n```"}]} -{"conversations": [{"role": "user", "content": "What's the difference between Env.perc and Env.adsr?"}, {"role": "assistant", "content": "`Env.perc(attack, release)` goes up once and decays to zero — one-shot sounds. `Env.adsr(a, d, s, r)` holds at a sustain level while its gate is open and only releases when the gate closes — notes you start and stop."}, {"role": "user", "content": "So which do I use for a pad?"}, {"role": "assistant", "content": "adsr, with `gate` as a Synth argument and `doneAction: 2` on the EnvGen:\n\n```supercollider\nSynthDef(\\pad, { |out = 0, freq = 220, gate = 1|\n var env = EnvGen.kr(Env.adsr(0.8, 0.4, 0.7, 2), gate, doneAction: 2);\n Out.ar(out, Saw.ar(freq) * env * 0.1)\n}).add;\n```\n\nThen `x.set(\\gate, 0)` releases it over the 2 seconds of release time."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Unfunky Drummer - Insert samples, extract joy?"}, {"role": "assistant", "content": "```supercollider\n(\nfork{\n //---------Source Files---------\n ~numOfPatterns = 16;\n ~synthDefToUse = \\bufPlay; //Change to \\bufPlay2 to use stereo samples\n ~rate = 2; //Rate of playback\n ~source = [ // Create an array of your samples. ~media.samples points at my base sample directory and is defined in my startup file.\n ~media.samples ++ \"808/kicks/808 kick 6.wav\",\n ~media.samples ++ \"808/snares/808 snare 6.wav\",\n ~media.samples ++ \"808/hats/808 hat 2.wav\",\n ~media.samples ++ \"808/other/808 cowbell.wav\",\n ~media.samples ++ \"808/other/808 clap.wav\",\n ~media.samples ++ \"808/other/808 rim.wav\",\n ~media.samples ++ \"808/other/808 maraca.wav\"\n ];\n Buffer.freeAll;\n ~buffers = ~source.collect{|source| Buffer.read(s, source)};\n ~patterns = ~numOfPatterns.collect{|val| Pbind(*[dur: Pn(1/val, val)])};\n ~randPattern = Prand(~patterns, 1);\n ~patterns = ~buffers.collect{|buf| Pbind(*[bufnum: buf]) <> ~randPattern};\n SynthDef(\\bufPlay, {|out = 0, bufnum, rateScale = 1, amp = 1| Out.ar(out, PlayBuf.ar(1, bufnum, BufRateScale.kr(bufnum) * rateScale, doneAction: 2) * amp!2);}).add;\n SynthDef(\\bufPlay2, {|out = 0, bufnum, rateScale = 1, amp = 1| Out.ar(out, PlayBuf.ar(2, bufnum, BufRateScale.kr(bufnum) * rateScale, doneAction: 2) * amp);}).add;\n s.sync;\n Ppar(~patterns, inf).play(TempoClock(~rate, 0), protoEvent: (instrument: ~synthDefToUse, amp: 0.25)); //Change to /bufPlay2 for stereo samples\n};\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ LPF.ar(Saw.ar(100), SinOsc.kr(0.5).exprange(200, 2000)) * 0.2 }.play;\n```"}, {"role": "assistant", "content": "A sawtooth through a low-pass filter whose cutoff is swept slowly up and down — a classic filter\nsweep.\n\n- `Saw.ar(100)` is a 100 Hz sawtooth, rich in harmonics.\n- `SinOsc.kr(0.5)` is a control-rate sine at 0.5 Hz, so one full cycle takes 2 seconds.\n- `.exprange(200, 2000)` maps that -1..1 sine exponentially onto 200..2000 Hz — exponential is the right\n mapping for frequency, because we hear pitch logarithmically.\n- `LPF.ar(sig, cutoff)` removes harmonics above the cutoff; as it opens and closes you hear the tone\n brighten and darken.\n- `* 0.2` keeps the output from clipping."}]} -{"conversations": [{"role": "user", "content": "What is `Main` in SuperCollider?"}, {"role": "assistant", "content": "Main — The concrete instance of Process Main is the concrete instance of Process (the runtime environment for the virtual machine and interpreter). Main overrides some methods of Process. There are two methods of interest. One is named startup and is called after the class library has been compiled. The other is called shutdown which gets called when the library gets re-compiled. Category: Core > Kernel."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Simple relaxing white noise generator simulating a seaside."}, {"role": "assistant", "content": "```supercollider\n// A.Broz: Waves & Surf (2020-10-29)\n\n/*\n _.====.._\n ,:._ ~-_\n `\\ ~-_\n | `.\n ,/ ~-_\n -..__..-'' ~~--..__...----...\n*/\n(\n~waves = {\n var noise = { WhiteNoise.ar(0.04 + LFNoise1.kr(0.3, 0.03)) };\n var motion = { LFNoise1.kr(0.2).exprange(100, 2000) };\n var hps = { HPF.ar(noise.value, 50) };\n var wave = { LPF.ar(hps.value, motion.value).tanh };\n var sig = wave!10;\n sig = Splay.ar(sig, 0.6).tanh;\n sig = sig * Line.kr(0, 1, 10); // fade in\n LeakDC.ar(sig);\n}.play;\n);\n\n~waves release: 10;\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for 2 channels of chuckling sawtooths."}, {"role": "assistant", "content": "```supercollider\n//hall of mirrors\n{[AllpassC.ar(HPF.ar(RLPF.ar(Saw.ar(LFPar.kr(0.25).range(220,440)),LFPar.kr(MouseX.kr(0,8),pi).range(220,20000),0.3),LFPar.kr(MouseY.kr(0,8)).range(220,20000)),2,MouseX.kr(0,0.5),2),AllpassC.ar(HPF.ar(RLPF.ar(Saw.ar(LFPar.kr(0.25,pi).range(440,220)),LFPar.kr(MouseX.kr(8,0),pi).range(20000,220),0.3),LFPar.kr(MouseY.kr(8,0),pi).range(20000,220)),2,MouseX.kr(0.5,0),2)]}.play\n```"}]} -{"conversations": [{"role": "user", "content": "How do I record my output to a file?"}, {"role": "assistant", "content": "`s.record(path)` starts recording the server's output; `s.stopRecording` stops it.\n\n```supercollider\ns.record(\"C:/audio/take1.wav\");\n// play for a while\ns.stopRecording;\n```\n\nThe path must be writable and the format follows the extension (.wav, .aiff, .flac). The file is written\nby the server, so it captures exactly what the master bus produces — including your effects, which is what\nyou want. `s.record` also accepts `duration:` to stop by itself, which is the reproducible form for a take."}]} -{"conversations": [{"role": "user", "content": "What does `AbstractPlayer.prepareChildrenToBundle` do? What arguments does it take?"}, {"role": "assistant", "content": "the base class for all Players : a playable object Arguments: bundle."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LatoocarfianL`."}, {"role": "assistant", "content": "```supercollider\n// randomly modulate all params\n(\n{ LatoocarfianL.ar(\n SampleRate.ir/4,\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5)\n) * 0.2 }.play(s);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Array.poll` do?"}, {"role": "assistant", "content": "apply an array of Poll units to an array of UGens (see those helpfiles for more details)."}]} -{"conversations": [{"role": "user", "content": "What does `SimpleNumber.cylBesselIPrime` do?"}, {"role": "assistant", "content": "Returns the first derivative with respect to x of the corresponding Bessel"}]} -{"conversations": [{"role": "user", "content": "What does `LinCongC.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Linear congruential chaotic generator Arguments: freq — Iteration frequency in Hertz; a — Multiplier amount; c — Increment amount; m — Modulus amount; xi — Initial value of x."}]} -{"conversations": [{"role": "user", "content": "What is the difference between TempoClock and SystemClock?"}, {"role": "assistant", "content": "SystemClock runs in real time and is what `.wait` uses by default. TempoClock runs in beats and has a tempo, so it can be changed while things are playing and Patterns scheduled on it follow. `TempoClock.default` is the clock Patterns use unless told otherwise, which is why `TempoClock.default.tempo = 2` changes the speed of everything you already have running."}]} -{"conversations": [{"role": "user", "content": "What does `Red3D.update` do?"}, {"role": "assistant", "content": "Call this to perform the rotation calculations. This updates the variable"}]} -{"conversations": [{"role": "user", "content": "What does `SequenceableCollection.rejectIndices` do?"}, {"role": "assistant", "content": "Return a new collection of same type as receiver which consists of all indices of those elements of the receiver for which function answers `false`. The function is passed two arguments, the item and an integer index. `#[a, b, c, g, h, h, j, h].rejectIndices({ |item, i| item ===` If you want to control what type of collection is returned, use"}]} -{"conversations": [{"role": "user", "content": "What does `MKtl.sync` do?"}, {"role": "assistant", "content": "send all current MKtl values to the physical device, e.g. to move all motorfaders to a freshly recalled"}]} -{"conversations": [{"role": "user", "content": "What is `Env`?"}, {"role": "assistant", "content": "Env — Specification for a segmented envelope"}, {"role": "user", "content": "What does `Env.new` do?"}, {"role": "assistant", "content": "Create a new envelope specification."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// an envelope in a synth\n(\n{\n var env = Env([0, 1, 0.5, 1, 0], [0.01, 0.5, 0.02, 0.5]);\n SinOsc.ar(470) * EnvGen.kr(env, doneAction: Done.freeSelf)\n}.play\n);\n// an envelope to control a parameter in a pattern\n(\nPbind(\n \\note, Env([0, 12, 6, 13, 0], [1, 5, 2, 10]),\n \\dur, 0.1\n).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `SpecFlatness` in SuperCollider briefly."}, {"role": "assistant", "content": "SpecFlatness — Spectral Flatness measure Given an FFT chain this calculates the Spectral Flatness measure, defined as a power spectrum's geometric mean divided by its arithmetic mean. This gives a measure which ranges from approx 0 for a pure sinusoid, to approx 1 for white noise. Category: UGens > FFT."}]} -{"conversations": [{"role": "user", "content": "What does `MultiSliderView.fillColor` do? What arguments does it take?"}, {"role": "assistant", "content": "The color used to visualize the areas described in Arguments: A Color.."}]} -{"conversations": [{"role": "user", "content": "What does `SaveConsole.new` do? What arguments does it take?"}, {"role": "assistant", "content": "widget with Save/SaveAs/Open controls Arguments: object — anything that can respond to .asCompileString and thus be saved to disk; path — supply this if the object you are supplying was already loaded from disk and has a known path. This is used for the save/save as behavior.; layout."}]} -{"conversations": [{"role": "user", "content": "Saving \"Presets\"?"}, {"role": "assistant", "content": "SuperCollider forum — Saving \"Presets\"?\n\nIf you don’t care too much about it being human readable, just use writeArchive and readArchive:\n\n```supercollider\na = Array.fill(400, {rrand(0,2200)});\n\na.writeArchive(\"/Users/spluta1/Documents/SC/test\");\n\nb = Object.readArchive(\"/Users/spluta1/Documents/SC/test\");\n\nb.postln;\n```\n\nSam"}]} -{"conversations": [{"role": "user", "content": "What does `Patch.didFree` do?"}, {"role": "assistant", "content": "Pairs an Instr with inputs that that will be passed to the Instr"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// For more SynthDefs and examples please head to: https://mycelialcordsblog.wordpress.com/ \n\n(\nSynthDef(\\hasherTest,\n{\narg rate = 1, freq = 60, index = 1000, tRate = 100,\nout = 0, fRate = 0.1;\n\nvar t_trig = LFPulse.kr(0.5/fRate, 0.5);\nvar random = LFNoise0.ar(rate, add:1);\nvar noise = Hasher.ar(random);\nvar sound = Saw.ar((freq+(noise*index)), Decay.kr(Impulse.kr(tRate), noise*0.001)).tanh;\nsound = Pan2.ar(sound, noise-0.3*2);\nFreeSelf.kr(t_trig);\nOut.ar(out, sound);\n}).store;\n);\n\n(\nPbind(\n\\instrument, \\hasherTest,\n\\dur, 5,\n\\rate, Pfuncn({100.rand}, inf),\n\\freq, Pfuncn({10000.rand}, inf),\n\\index, Pfuncn({20000.rand}, inf),\n\\tRate, Pfuncn({1000.rand}, inf),\n\\fRate, 5,\n).play;\n)\n```"}, {"role": "assistant", "content": "It is a simple SynthDef I made after having a look at Hasher UGen with a pattern to play it. It creates nice and varied glitch sounds."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `MouseX`."}, {"role": "assistant", "content": "```supercollider\n{ SinOsc.ar(MouseX.kr(40, 10000, 1), 0, 0.1) }.play;\n{ SinOsc.ar(MouseX.kr(500, 10000, 1).poll, 0, 0.1) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `RedHuffman.compress` do?"}, {"role": "assistant", "content": "Compresses an array into a string of binary numbers. Creates a #*tree and a #*dict as"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `IEnvGen`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var env = Env([0, 0.6, 0.3, 1.0, 0], [0.1, 0.02, 0.4, 1.1], [\\lin, \\exp, -6, \\sin]);\n var envgen = IEnvGen.kr(env, MouseX.kr(0, env.times.sum));\n env.plot;\n SinOsc.ar(envgen * 500 + 440)\n}.play;\n);\n\n// index with an SinOsc ... mouse controls amplitude of SinOsc\n// use offset so negative values of SinOsc will map into the Env\n(\n{\n var sin = SinOsc.ar(440, 0, MouseX.kr(0, 1));\n // use offset so negative values of SinOsc will map into the Env\n var env = Env([-1, -0.7, 0.7, 1], [0.8666, 0.2666, 0.8668], \\lin, offset: -1.0);\n IEnvGen.ar(env, sin) * 0.1\n}.play;\n);\n\n// index with Amplitude of input, control freq of SinOsc (uses SoundIn)\n(\n{\n var point = Amplitude.ar(SoundIn.ar(0), 0.01, 0.2);\n // use offset so negative values of SinOsc will map into the Env\n var env = Env.xyc([[0, 330, \\exp], [0.5, 440, \\exp], [1.0, 1760]]);\n SinOsc.ar(IEnvGen.kr(env, point)) * 0.2\n}.play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Show another SuperCollider example using `InFeedback`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-InFeedback\", { |out = 0, in = 0|\n Out.ar(out,\n InFeedback.ar(in, 1)\n );\n}).add;\nSynthDef(\"help-SinOsc\", { |out = 0, freq = 440|\n Out.ar(out, SinOsc.ar(freq, 0, 0.1))\n}).add;\n);\n\nx = Bus.audio(s, 1);\n\n// read from bus n play to bus 0 (silent)\na = Synth(\"help-InFeedback\", [\\in, x.index, \\out, 0]);\n\n// now play a synth after this one, playing to bus x\nb = Synth.after(a, \"help-SinOsc\", [\\out, x.index]);\n\n// add another synth before a which also writes to bus x\n// now you can't hear b, as its data is one cycle old, and is overwritten by c\nc = Synth.before(a, \"help-SinOsc\", [\\out, x.index, \\freq, 800]);\n\n// free c and you can hear b again\nc.free;\nx.free;\n\na.free; b.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// ===========================\n// extra demos for pluck\n// ===========================\n\n\n(\n// Made by Meha Gupta\n// Inspired by Happy by Julia Michaels\nPbindef(\\dmpluck,\n \\instrument, \"pluck\",\n \\midinote, Pseq([\n Pseq([\n [57, 69, 73, 76],\n [57, 69, 73, 76],\n [57, 71, 73, 80],\n [52, 78, 76, 80],\n [52, 78, 76, 80],\n [59, 71, 75],\n [59, 71, 75]], 2),\n 64]),\n \\amp, Pseq([0.2, 0.1, 0.2, 0.2, 0.1, 0.1, 0.1], inf) * 0.5,\n \\dur, Pseq([Pn(Pseq([0.25, 0.75, 1, 0.5, 0.5, 0.5, 0.5]), 2), 1]),\n \\decay, Pseq([1, 3, 3, 2, 2, 3, 3, 1, 3, 3, 2, 2, 3, 3, 4]),\n).play;\n)\n```"}, {"role": "assistant", "content": "=========================== extra demos for pluck ===========================."}]} -{"conversations": [{"role": "user", "content": "What is `RedLZW` in SuperCollider?"}, {"role": "assistant", "content": "RedLZW — lzw compression/decompression See http://en.wikipedia.org/wiki/LZW and http://marknelson.us/1989/10/01/lzw-data-compression/ Category: Red > redTools."}]} -{"conversations": [{"role": "user", "content": "What does `DataBuffer.new` do? What arguments does it take?"}, {"role": "assistant", "content": "create a new Arguments: board — an instance of a OpenBCI subclass (for example a CytonSerial or GanglionWifi).; maxSize — the number of slots in both data and accelerometer buffers. If the data is not read fast enough, the buffers will fill up to this size and then start dropping values (fifo).; dataActive — a Boolean flag indicating if data should be buffered or not.; accelActive — a Boolean flag indicating if accelerometer data should be buffered or not.."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Midterm Question 2 (a SuperCollider snippet)?"}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"sawSynth\", {arg freq, amp;\n \n Out.ar(0, Splay.ar(LPF.ar(in: Saw.ar(freq * [0.99, 1.0, 1.001, 1.008], mul:Env.perc(attackTime:0.1, releaseTime:2, level:amp).kr(2)),freq: 2000)))\n\n}).add;\n);\n\n(\nPbind(\n \\instrument, \"sawSynth\",\n \\degree, Pseq([1,3,5,7], inf),\n \\dur, 0.111, \n \n).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SOS`."}, {"role": "assistant", "content": "```supercollider\n// example: same as TwoPole\n(\n{\n var rho, theta, b1, b2;\n theta = MouseX.kr(0.2pi, pi);\n rho = MouseY.kr(0.6, 0.99);\n b1 = 2.0 * rho * cos(theta);\n b2 = rho.squared.neg;\n SOS.ar(LFSaw.ar(200, 0, 0.1), 1.0, 0.0, 0.0, b1, b2)\n}.play\n);\n\n\n(\n{\n var rho, theta, b1, b2;\n theta = MouseX.kr(0.2pi, pi);\n rho = MouseY.kr(0.6, 0.99);\n b1 = 2.0 * rho * cos(theta);\n b2 = rho.squared.neg;\n SOS.ar(WhiteNoise.ar(0.1 ! 2), 1.0, 0.0, 0.0, b1, b2)\n}.play\n);\n\n// example with SOS.kr kr as modulator\n(\n{\n var rho, theta, b1, b2, vib;\n theta = MouseX.kr(0.2pi, pi);\n rho = MouseY.kr(0.6, 0.99);\n b1 = 2.0 * rho * cos(theta);\n b2 = rho.squared.neg;\n\n vib = SOS.kr(LFSaw.kr(3.16), 1.0, 0.0, 0.0, b1, b2);\n SinOsc.ar(vib * 200 + 600) * 0.2\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// an envelope in a synth\n(\n{\n var env = Env([0, 1, 0.5, 1, 0], [0.01, 0.5, 0.02, 0.5]);\n SinOsc.ar(470) * EnvGen.kr(env, doneAction: Done.freeSelf)\n}.play\n);\n// an envelope to control a parameter in a pattern\n(\nPbind(\n \\note, Env([0, 12, 6, 13, 0], [1, 5, 2, 10]),\n \\dur, 0.1\n).play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// an envelope in a synth\n(\n{\n var env = Env([0, 1, 0.5, 1, 0], [0.01, 0.5, 0.02, 0.5]);\n SinOsc.ar(470) * EnvGen.kr(env, doneAction: Done.freeSelf)\n}.play\n);\n// an envelope to control a parameter in a pattern\n(\nPbind(\n \\note, Env([0, 12, 6, 13, 0], [1, 5, 2, 10]),\n \\dur, 0.1\n).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// Periphonic (3D) encoder, a 1/2 dome of 13 loudspeakers\n// [[0, 0], [45, 0], [90, 0], [135, 0], [-180, 0], [-135, 0], [-90, 0], [-45, 0],\n// [45, 35.3], [135, 35.3], [-135, 35.3], [-45, 35.3], [0, 90]]\n\n~directions = [[0, 0], [45, 0], [90, 0], [135, 0], [-180, 0], [-135, 0], [-90, 0],\n [-45, 0], [45, 35.3], [135, 35.3], [-135, 35.3], [-45, 35.3], [0, 90]].degrad;\n~encoder = FoaE\n// …\n```"}, {"role": "assistant", "content": "Periphonic (3D) encoder, a 1/2 dome of 13 loudspeakers [[0, 0], [45, 0], [90, 0], [135, 0], [-180, 0], [-135, 0], [-90, 0], [-45, 0], (FoaEncoderMatrix: First Order Ambisonic (FOA) encoder matrices)"}]} -{"conversations": [{"role": "user", "content": "What does `Delay2.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Two sample delay. Arguments: in — The input signal.; mul — The output will be multiplied by this value.; add — This value will be added to the output.; x1 — The sample directly preceding the delayed input signal, which is the second output sample. This can be a numeric value or a `UGen`.; x2 — The sample preceding the delayed input signal by two samples, which is the first output sample. This can be a numeric value or a `UGen`.."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n// restricting fm to harmonic sidebands after\n// [Chowning, 1973] Chowning, J. (1973). The synthesis of complex spectra by means of frequency modulation. Journal of the Audio Engineering Society, 21(7):526–534.\n// restriction actually happens because of the specs, not server-side.\n\nSpec.add(\\index, [0, 40]);\nSpec.add(\\harm1, [0, 20, \\lin, 1]);\nSpec.add(\\harm2, [0, 20, \\lin, 1]);\nSpec.add(\\fundFreq, \\freq);\n\nNdef(\\fmk, {\n \n PMOsc.ar(\n \\carFreq.kr(100, 0.1), \n (\\harm1.kr(1, 1)/(\\harm2.kr(1, 1)) * LFNoise1.ar(50).range(0.995, 1.001))*\\carFreq.kr(100), \n \\index.kr(1, 0.1) * SinOsc.ar(2.5).range(0.995, 1.005)\n ) \n})\n);\nNdef(\\fmk).gui\n```"}, {"role": "assistant", "content": "Restricting fm to harmonic sidebands after[Chowning, 1973]. Restriction actually happens because of the specs, not server-side.\r\n----- \r\nChowning, J. (1973). The synthesis of complex spectra by means of frequency modulation. Journal of the Audio Engineering Society, 21(7):526–534."}]} -{"conversations": [{"role": "user", "content": "Synth Iteration Help?"}, {"role": "assistant", "content": "SuperCollider forum — Synth Iteration Help\n\n```supercollider\n(\nSynthDef (\\sine_tone) {\narg freq = 440, amp = 1, len = 1, bus = 0;\nvar sig, env;\nenv = Env.step ([ amp ], [ len ]);\nenv = EnvGen.kr (env, doneAction: 2);\nsig = SinOsc.ar (freq, 0, env);\nOut.ar (bus % 2, sig); // bus modulo 2 here to wrap to stereo\n}.add;\n)\n```\n\nmaybe try wrapping the bus array to [ 0, 1 ] by using modulo: bus % 2. this should let you hear what is going on using a stereo output\n\nby using a Pbind, each “note” is being instantiated as a separate synth with its own length, amplitude, frequency and bus. the doneAction: 2 argument in the EnvGen.kr ugen just means each synth will free itself once it is done playing the note it has been assigned."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// play SinOscs silently and wait for granulation envelopes\n\n(\na = Bus.audio(s, 10);\nx = { Splay.ar(In.ar(a, 10) * SinOsc.ar((3..12) * 100, 0, 0.05)) }.play\n);\n\n\n// send envelopes to buses\n\n(\nz = {\n DXEnvFanOut.ar(\n Dseq((0..5) + a.index, inf) + Diwhite(1, 4),\n \n // with newer SC versions you can also write:\n // Dseq((0..5), inf) + Diwhite(1, 4) + a.index,\n \n fadeTime: 0.05,\n width: 1,\n initOutOffset: -0.5\n )\n}.play\n);\n\nx.release;\n\n// clean\n// …\n```"}, {"role": "assistant", "content": "play SinOscs silently and wait for granulation envelopes send envelopes to buses (DXEnvFanOut: sends crossfade envelopes to out buses according to demand-rate control)"}]} -{"conversations": [{"role": "user", "content": "What is the difference between \\degree, \\midinote and \\freq in a Pbind?"}, {"role": "assistant", "content": "`\\freq` is the frequency in Hz and is used as-is. `\\midinote` is a MIDI note number, converted to frequency by the default instrument. `\\degree` is a scale degree, quantised to the scale in \\scale (default major) rooted at \\root; degrees can be negative or fractional. If you set both, the more specific conversion wins, so set exactly one."}]} -{"conversations": [{"role": "user", "content": "How to know the hardware buffer size?"}, {"role": "assistant", "content": "SuperCollider forum — How to know the hardware buffer size\n\nSay you want to use a UGen to control an external hardware device, independently of the soundcard. At first, one would think that this calculation is time-locked to the control rate, so e.g. at 1.5 kHz for a 48 kHz sample rate and a block size of 32.\n\nBut no, of course this calculation is time-locked to the hardware buffer size (I/O buffer size) of the soundcard you happen to use. EDIT: For a typical (low) setting, this is something like 256, so that would be about 190 Hz (5 ms). This may be too much delay for some applications, so we may want a smaller buffer size.\n\nIn scsynth, we can set a value for this size via ServerOptions:\n\n```supercollider\n // reduce to block size\ns.options.hardwareBufferSize = s.options.blockSize;\ns.reboot;\n```\n\nUnfortunately, not all soundcards support low block sizes. Also high quality sound cards may have very large ones, actually – this is a cultural thing, when you use them for recording, it is not a problem. But for live I/O it introduces delay (a quarter second is like an eternity then).\n\nSo now my question: how do I know if the above setting has been actually successful? How do I know what buffer size is current?\n\nI am sure that on different OSes there are ways to derive this in different ways. Maybe there is a way in supercollider as well?"}]} -{"conversations": [{"role": "user", "content": "I get \"Message 'ar' not understood\". Why?"}, {"role": "assistant", "content": "You called a rate method on something that is not a UGen. `Env.ar(...)` and `Buffer.ar(...)` are the classic cases: Env is a language-side description and is played by `EnvGen.ar(env, ...)`; a Buffer is server memory and is played by `PlayBuf.ar` or `BufRd.ar`. The UGen is the thing with a rate method — if it is a description or a container, there is another UGen that consumes it."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nx = {\n |lookBack = 3, thr = 1|\n var trig = Impulse.ar(7);\n // for a non-integer source it makes sense to take a sufficiently large threshold thr\n var midi = Demand.ar(trig, 0, DIdev(SinOsc.ar(0.2, 0, 15, 82), 5, -6, 5, lookBack, thr: thr));\n midi.poll(7, label: \\midi);\n SinOsc.ar(midi.midicps.lag(0.007)) ! 2 * 0.1\n}.play;\n);\n\n// close floats can occur here \nx.set(\\thr, 0.01)\n\n// not here\nx.set(\\thr, 2\n\nx.release\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nx = {\n |lookBack = 3, thr = 1|\n var trig = Impulse.ar(7);\n // for a non-integer source it makes sense to take a sufficiently large threshold thr\n var midi = Demand.ar(trig, 0, DIdev(SinOsc.ar(0.2, 0, 15, 82), 5, -6, 5, lookBack, thr: thr));\n midi.poll(7, label: \\midi);\n SinOsc.ar(midi.midicps.lag(0.007)) ! 2 * 0.1\n}.play;\n);\n\n// close floats can occur here \nx.set(\\thr, 0.01)\n\n// not here\nx.set(\\thr, 2)\n\nx.release\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LFDClipNoise`."}, {"role": "assistant", "content": "```supercollider\n// try wiggling the mouse quickly;\n// LFNoise frequently seems stuck, LFDNoise changes smoothly.\n\n{ LFClipNoise.ar(MouseX.kr(0.1, 1000, 1), 0.1) }.play\n\n{ LFDClipNoise.ar(MouseX.kr(0.1, 1000, 1), 0.1) }.play\n\n// silent for 2 secs before going up in freq\n\n{ LFClipNoise.ar(XLine.kr(0.5, 10000, 3), 0.1) }.scope;\n\n{ LFDClipNoise.ar(XLine.kr(0.5, 10000, 3), 0.1) }.scope;\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFClipNoise.ar(XLine.kr(1000, 20000, 10), 0.1) }.scope;\n\n{ LFDClipNoise.ar(XLine.kr(1000, 20000, 10), 0.1) }.scope;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `PHS.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new PHS Arguments: helpSynth — A HS object.; helpSynthArgs — Collection of key / value pairs for the HS synth.; ... pbindArgs — dur1, pbindData1, ... , durN, pbindDataN where dur is duration value or pattern / stream of durations for corresponding Pbind(s) and pbindData is a collection of Pbind pairs or a collection of Pbind pair collections, defining possibly several Pbinds with the same event timing.."}]} +{"conversations": [{"role": "user", "content": "How do I set the tempo?"}, {"role": "assistant", "content": "TempoClock.default.tempo = 120/60; the argument is beats per second, so 120 BPM is 2.0. Patterns scheduled on the default clock then follow it."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `IEnvGen`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var env = Env([0, 0.6, 0.3, 1.0, 0], [0.1, 0.02, 0.4, 1.1], [\\lin, \\exp, -6, \\sin]);\n var envgen = IEnvGen.kr(env, MouseX.kr(0, env.times.sum));\n env.plot;\n SinOsc.ar(envgen * 500 + 440)\n}.play;\n);\n\n// index with an SinOsc ... mouse controls amplitude of SinOsc\n// use offset so negative values of SinOsc will map into the Env\n(\n{\n var sin = SinOsc.ar(440, 0, MouseX.kr(0, 1));\n // use offset so negative values of SinOsc will map into the Env\n var env = Env([-1, -0.7, 0.7, 1], [0.8666, 0.2666, 0.8668], \\lin, offset: -1.0);\n IEnvGen.ar(env, sin) * 0.1\n}.play;\n);\n\n// index with Amplitude of input, control freq of SinOsc (uses SoundIn)\n(\n{\n var point = Amplitude.ar(SoundIn.ar(0), 0.01, 0.2);\n // use offset so negative values of SinOsc will map into the Env\n var env = Env.xyc([[0, 330, \\exp], [0.5, 440, \\exp], [1.0, 1760]]);\n SinOsc.ar(IEnvGen.kr(env, point)) * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `EnvGen` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// as amplitude envelope\n(\n{\n var env = Env([0, 1, 0.5, 1, 0], [0.01, 0.5, 0.02, 0.5]);\n SinOsc.ar(470) * EnvGen.kr(env, doneAction: Done.freeSelf)\n}.play\n);\n\n// as amplitude and modulation envelope\n(\n{\n var env = Env([0, 1, 0.5, 0.8, 0, 1.2, 0], [0.01, 0.5, 0.02, 0.5, 0.2, 0.5]);\n var gate = Impulse.kr(MouseX.kr(0.2, 3), 0.5);\n var gen = EnvGen.kr(env, gate);\n SinOsc.ar(270, SinOsc.ar(gen * 473)) * gen * 0.2\n}.play\n);\n// EnvGen multichannel expands when passed a multichannel envelope\n(\n{\n SinOsc.ar(\n EnvGen.kr(\n Env.circle([0, 1, 0, (2..4), 0, LFNoise1.kr(0.1 ! 5) * 10, 0], [0.01, 0.6])\n )\n * 240 + 300\n ).sum * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a;\na = Plorenz(8, 20, 2.5, 0.02);\na.asStream.nextN(1000).flop.plot; //note 3 channels\n);\n\n// sound example\n(\nSynthDef(\\help_sinegrain2,\n { arg out=0, freq=440, sustain=0.05, pan= 0;\n var env= EnvGen.ar(Env.perc(0.01, sustain, 0.2), doneAction:2);\n Out.ar(out, Pan2.ar(SinOsc.ar(freq, 0, env), pan));\n}).add;\n);\n\n(\nvar a = Plorenz(10, 28, 2.667, 0.01, 0,09, 2.9, 24).asStream;\n{\n loop {\n var x,\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a;\na = Plorenz(8, 20, 2.5, 0.02);\na.asStream.nextN(1000).flop.plot; //note 3 channels\n);\n\n// sound example\n(\nSynthDef(\\help_sinegrain2,\n { arg out=0, freq=440, sustain=0.05, pan= 0;\n var env= EnvGen.ar(Env.perc(0.01, sustain, 0.2), doneAction:2);\n Out.ar(out, Pan2.ar(SinOsc.ar(freq, 0, env), pan));\n}).add;\n);\n\n(\nvar a = Plorenz(10, 28, 2.667, 0.01, 0,09, 2.9, 24).asStream;\n{\n loop {\n var x, y, z;\n #x, y, z = a.next;\n Synth(\\help_sinegrain2, [\\freq, x * 600 + 300, \\pan, -1]);\n 0.02.wait;\n Synth(\\help_sinegrain2, [\\freq, y * 600 + 300, \\pan, 0]);\n 0.02.wait;\n Synth(\\help_sinegrain2, [\\freq, z * 600 + 300, \\pan, 1]);\n 0.02.wait;\n }\n}.fork;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Ndef`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\nNdef(\\a).play; // play to hardware output.\nNdef(\\a).fadeTime = 2; // fadeTime specifies crossfade\n// set the source\nNdef(\\a, { SinOsc.ar([350, 351.3], 0, 0.2) });\nNdef(\\a, { Pulse.ar([350, 351.3] / 4, 0.4, 0.2) });\nNdef(\\a, Pbind(\\dur, 0.03, \\freq, Pbrown(0, 1, 0.1, inf).linexp(0, 1, 200, 350)));\n\nNdef(\\a, { Ringz.ar(Ndef.ar(\\b), [350, 351.3] * 2, 0.4) });\nNdef(\\b, { Impulse.ar([5, 7]/2, [0, 0.5], 0.15) });\n\nNdef.clear(3); // clear all after 3 seconds\n```"}]} +{"conversations": [{"role": "user", "content": "What does `PathName.isFile` do?"}, {"role": "assistant", "content": "returns a Boolean indicating whether or not the path represents a file (not a folder)."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Archive`."}, {"role": "assistant", "content": "```supercollider\n// make a storage place for various objects:\nq = (); // Event\n\nq[\\a_long_array] = Array.rand(128, 0.0, 1.0);\nq[\\pi_squared] = pi * pi;\nq[\\favourite_sound] = { { SinOsc.ar([300, 330]).sum * LFPulse.kr(2 + [0, 0.01]) * 0.1 }.play };\nq[\\same_long_array] = q[\\a_long_array]; // same objects may appear several times\n\nArchive.global.put(\\myData, q);\n\n\nArchive.global.at(\\myData).postcs;\n\n// after a recompile:\ns.boot;\n\nq = Archive.global.at(\\myData);\nq.postcs;\nq[\\favourite_sound].value;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `UGen.signalRange` do?"}, {"role": "assistant", "content": "Abstract superclass of all unit generators Returns: A symbol indicating the signal range of the receiver. Either `\\bipolar` or `\\unipolar`."}]} +{"conversations": [{"role": "user", "content": "What is `PbindProxy`?"}, {"role": "assistant", "content": "PbindProxy — incremental event pattern reference"}, {"role": "user", "content": "What does `PbindProxy.new` do?"}, {"role": "assistant", "content": "Return a new instance of PbindProxy with the given patternpairs. Unlike Pbindef, it has no internal name. `a = PbindProxy(\\note, Pseq([0, 7, 9], inf), \\dur, 0.2).play;` It also supports keyword argument syntax: `a = PbindProxy(note: Pseq([0, 7, 9]), dur: 0.2).play;`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na = PbindProxy(\\note, Pseq([0, 7, 9], inf), \\dur, 0.2).play;\na.set(\\note, Pseq([0, 6, 10]));\na.stop;\n```"}]} +{"conversations": [{"role": "user", "content": "How should I organise a SuperCollider project on disk?"}, {"role": "assistant", "content": "One folder per piece, with a fixed shape:\n\n```text\nmy-piece/\n synthdefs.scd // only SynthDef(...).add, loaded first\n material.scd // buffers, samples, scales\n piece.scd // the performance: Tdefs, Pbinds, Ndefs\n README.md // tempo, required samples, how to run it\n```\n\nThen the workflow is: open `synthdefs.scd`, Ctrl+A Ctrl+Enter to load it, load `material.scd`, and work in\n`piece.scd`. Keeping definitions out of the performance file is what makes a reboot survivable and a piece\nre-runnable six months later."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `MIDIFreqPlayer`."}, {"role": "assistant", "content": "```supercollider\n/*\n( // PlayerBinop not yet implemented\n\nPatch(\\monosynth,[\n BeatClockPlayer.new(16) * MIDIGatePlayer.new,\n MIDIFreqPlayer.new,\n CCPlayer(50,[100,3000,\\exp,0.0,1500.0]),\n CCPlayer(51,[0.1,0.9,\\exp,0.0,0.2]),\n CCPlayer(52,[0.05,1.0])\n]).play\n\n)\n*/\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Pseq` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Pseq(#[60, 61, 63, 65, 72], inf).asStream;\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, a.next.midicps]);\n 0.2.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `LPF`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\\default, { arg out=0, freq=440, amp=0.1, pan=0, gate=1;\n var z;\n z = LPF.ar(\n Mix.new(VarSaw.ar(freq + [0, Rand(-0.4,0.0), Rand(0.0,0.4)], 0, 0.3)),\n XLine.kr(Rand(4000,5000), Rand(2500,3200), 1)\n ) * Linen.kr(gate, 0.01, 0.7, 0.3, 2);\n OffsetOut.ar(out, Pan2.ar(z, pan, amp));\n}, [\\ir]);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SimpleNumber.jacobiZeta` do?"}, {"role": "assistant", "content": "Returns the result of the Jacobi Zeta Function. Requires `-1 <= k <="}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n//bass synth\n{Out.ar(0,Pan2.ar(DoubleWell3.ar(f:SinOsc.ar(MouseX.kr(0,200),0,MouseY.kr(0.5,4.0))),0.0))}.play\n\n//plotting check of first samples\n{DoubleWell3.ar}.plot(0.05, minval:-1, maxval:1)\n\n//gradually changing \n{Pan2.ar(DoubleWell3.ar(0,0.05,LFSaw.ar(Line.kr(10,1000,10)),Line.kr(0.0,0.3,20)),0.0)}.play\n\n//controlled - midscreen amplitude jump\n{Pan2.ar(DoubleWell3.ar(0,0.05,L\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n//bass synth\n{Out.ar(0,Pan2.ar(DoubleWell3.ar(f:SinOsc.ar(MouseX.kr(0,200),0,MouseY.kr(0.5,4.0))),0.0))}.play\n\n//plotting check of first samples\n{DoubleWell3.ar}.plot(0.05, minval:-1, maxval:1)\n\n//gradually changing \n{Pan2.ar(DoubleWell3.ar(0,0.05,LFSaw.ar(Line.kr(10,1000,10)),Line.kr(0.0,0.3,20)),0.0)}.play\n\n//controlled - midscreen amplitude jump\n{Pan2.ar(DoubleWell3.ar(0,0.05,LFSaw.ar(MouseX.kr(10,1000)),MouseY.kr(0.0,0.5)),0.0)}.play\n\n\n\n//triggering\n{DoubleWell3.ar(Impulse.kr(MouseY.kr(0.01,100, 'exponential')),0.1,LFCub.ar(MouseX.kr(10,1000, 'exponential')),MouseY.kr(0.0,1.0),LFNoise0.kr(2.3,0.2,0.8),LFNoise1.kr(2.37,0.2,0.8))}.play\n\n\n//AudioIn as forcing\n{Pan2.ar(DoubleWell3.ar(0,0.05,LPF.ar(AudioIn.ar(1),100,MouseX.kr(0,1000)),MouseY.kr(0.0,0.5)),0.0)}.play\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `FreqScopeView`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// Start server\ns.boot;\n\n// Create analyzer in a window\n(\nw = Window(\"My Analyzer\", Rect(0, 0, 511, 300)); // width should be 511\nf = FreqScopeView(w, w.view.bounds);\nf.active_(true); // turn it on the first time;\n\nw.onClose_({ f.kill }); // you must have this\nw.front;\n{ SinOsc.ar([500, 1000], 0, 0.25).mean.dup }.play(s); // start two sine waves\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `FoaSpeakerMatrix.numChannels` do?"}, {"role": "assistant", "content": "Answers the number of loudspeaker feeds (output"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar,\n Pulse.ar\n ];\n TWChoose.ar(Dust.ar(MouseX.kr(1, 1000, 1)), a, [0.99, 0.05, 0.05].normalizeSum) * 0.2\n\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar,\n Pulse.ar\n ];\n TWChoose.ar(Dust.ar(MouseX.kr(1, 1000, 1)), a, [0.99, 0.05, 0.05].normalizeSum) * 0.2\n\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Window.view` do?"}, {"role": "assistant", "content": "When a Window is created, it creates a container view, accessible using this method, that occupies the whole area of the window, and which will be used as the actual parent of the child Returns: A View."}]} +{"conversations": [{"role": "user", "content": "What does `Tempo.destroy` do?"}, {"role": "assistant", "content": "for control of tempo and for use in tempo based calculations"}]} +{"conversations": [{"role": "user", "content": "What does `EnvelopedPlayer.storeArgs` do?"}, {"role": "assistant", "content": "takes a Player as input and plays it through an Env with fused protection"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `BiPanB2`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var w, x, y, p, q, a, b, c, d;\n\n p = LFSaw.ar(200);\n q = LFSaw.ar(301);\n\n // B-format encode\n #w, x, y = BiPanB2.ar(p, q, MouseX.kr(-1, 1), 0.1);\n\n // B-format decode to quad\n #a, b, c, d = DecodeB2.ar(4, w, x, y);\n\n [a, b, d, c] // reorder to my speaker arrangement: Lf Rf Lr Rr\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = NodeProxy.new.play;\na.source = { RLPF.ar(\\in.ar(0!2), [4600, 7000], 0.1) };\nb = NodeProxy.new.source_ { Impulse.ar([5, 7] / 2 };\na <<> b;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = NodeProxy.new.play;\na.source = { RLPF.ar(\\in.ar(0!2), [4600, 7000], 0.1) };\nb = NodeProxy.new.source_ { Impulse.ar([5, 7] / 2) };\na <<> b;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// needs Buffer c prepared above\n\n(\ny = {\n var add = LFDNoise3.ar(0.3) * [0.05, 0.0505];\n GFIS.ar(\n { |x| BufRd.ar(1, c, c.numFrames * (x + add)) }, \n (LFDNoise3.ar(0.3) * [1, 1.01]).range(0.5, 0.505), 7\n ) * 0.2\n}.play\n;\n\ny.release\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// needs Buffer c prepared above\n\n(\ny = {\n var add = LFDNoise3.ar(0.3) * [0.05, 0.0505];\n GFIS.ar(\n { |x| BufRd.ar(1, c, c.numFrames * (x + add)) }, \n (LFDNoise3.ar(0.3) * [1, 1.01]).range(0.5, 0.505), 7\n ) * 0.2\n}.play\n);\n\ny.release\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Editor.addToDefName` do? What arguments does it take?"}, {"role": "assistant", "content": "holds a value that can be edited with a GUI, saves as the value Arguments: stream."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `BufSampleRate`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n// compares a 1102.5 Hz sine tone (11025 * 0.1, left) with a 1100 Hz tone (right)\n// the apollo sample has a sample rate of 11.025 kHz\n(\n{\n var freq;\n freq = [BufSampleRate.kr(b) * 0.1, 1100];\n SinOsc.ar(freq, 0, 0.1)\n}.play;\n);\n\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What are you not good at?"}, {"role": "assistant", "content": "Everything outside SuperCollider. I have no audio input, no live data, and my knowledge ends at the documentation snapshot I was trained on — so I can be confidently wrong about Quarks and new UGens."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// logistic map as frequency control\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n SinOsc.ar(QuadC.ar(40, r.neg, r, 0, 0.1, 800, 900)) * 0.4;\n}.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// logistic map as frequency control\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n SinOsc.ar(QuadC.ar(40, r.neg, r, 0, 0.1, 800, 900)) * 0.4;\n}.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar,\n Pulse.ar\n ];\n TChoose.ar(Dust.ar(MouseX.kr(1, 1000, 1)), a) * 0.2\n\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar,\n Pulse.ar\n ];\n TChoose.ar(Dust.ar(MouseX.kr(1, 1000, 1)), a) * 0.2\n\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ TwoZero.ar(WhiteNoise.ar(0.125), XLine.kr(20, 20000, 8), 1 }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ TwoZero.ar(WhiteNoise.ar(0.125), XLine.kr(20, 20000, 8), 1) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Splay` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\nx = { |spread = 1, level = 0.1, center = 0|\n var n = 20;\n var snd = Splay.ar(LFPulse.ar({ 100.exprand(2000) } ! n).range(-1, 1),\n spread, level, center);\n Peak.ar(snd, 0.01, 1).ampdb.poll(1);\n snd\n}.play;\n);\n\n// at full spread, level -20, pan to center:\n// peak is higher at -11 db\nx.set(\\spread, 1, \\center, 0);\n// with no spread, i.e. all panned center, slightly higher -10\nx.set(\\spread, 0, \\center, 0);\n// worst case: no spread, pan full left: -8db\nx.set(\\spread, 0, \\center, -1); // -8\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LinCongN`."}, {"role": "assistant", "content": "```supercollider\n// default initial params\n{ LinCongN.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `AnnotatedDebugNodeWatcher.getAnnotation` do? What arguments does it take?"}, {"role": "assistant", "content": "Watches server replies for node ended/started events using AbstractPlayer's Node annotation system Arguments: server; nodeID."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Saw`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n SynthDef(\\controlList, { |out = 0, freq = 440, amp = 0.1, detune = #[0.999, 1.001], gate = 1|\n var sig = Mix(Saw.ar(freq * (detune ++ [1]), amp)),\n env = EnvGen.kr(Env.adsr, gate, doneAction: Done.freeSelf);\n Out.ar(out, (sig * env) ! 2);\n }).add;\n\n SynthDescLib.global[\\controlList]\n )\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n//listen to x and y output\n{Out.ar(0,Brusselator.ar(Impulse.kr(MouseY.kr(1,50,'exponential')),MouseX.kr(0.01,1,'exponential')))}.play\n\n//avoid DC offset (default gamma is 1.0, listening to x only, so take off gamma\n{Out.ar(0,Pan2.ar((Brusselator.ar(Impulse.kr(MouseY.kr(1,50,'exponential')),MouseX.kr(0.01,1,'exponential')))[0] - 1.0) )}.play\n\n\n//fun time, stable oscillation with these parameters\n{var mu = MouseY.kr(1.0,1.5); Out.ar(0,Pan2.\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n//listen to x and y output\n{Out.ar(0,Brusselator.ar(Impulse.kr(MouseY.kr(1,50,'exponential')),MouseX.kr(0.01,1,'exponential')))}.play\n\n//avoid DC offset (default gamma is 1.0, listening to x only, so take off gamma\n{Out.ar(0,Pan2.ar((Brusselator.ar(Impulse.kr(MouseY.kr(1,50,'exponential')),MouseX.kr(0.01,1,'exponential')))[0] - 1.0) )}.play\n\n\n//fun time, stable oscillation with these parameters\n{var mu = MouseY.kr(1.0,1.5); Out.ar(0,Pan2.ar(Brusselator.ar(0.0,MouseX.kr(0.01,0.1,'exponential'),mu,0.25)[0] ) )}.play\n\n\n{ Out.ar(0,Pan2.ar(Brusselator.ar(Impulse.kr(10),MouseX.kr(0.01,0.1,'exponential'),1.5,0.25,MouseY.kr(-1.0,1.0),0.0)[0]) )}.play\n\n\n{ Out.ar(0,Brusselator.ar(Impulse.kr(MouseY.kr(1,500,'exponential')),MouseX.kr(0.01,0.1,'exponential'),1.15,0.5,0.5,1.0) )}.play\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `RedHiddenObject` in SuperCollider briefly."}, {"role": "assistant", "content": "RedHiddenObject — an invisible object An object that behaves like a normal RedObject but does not add itself to the world. Sometimes useful for non rendered objects e.g. points of attraction. Category: Red > redUniverse."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Splay` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\nx = { |spread = 1, level = 0.1, center = 0|\n var n = 20;\n var snd = Splay.ar(LFPulse.ar({ 100.exprand(2000) } ! n).range(-1, 1),\n spread, level, center);\n Peak.ar(snd, 0.01, 1).ampdb.poll(1);\n snd\n}.play;\n);\n\n// at full spread, level -20, pan to center:\n// peak is higher at -11 db\nx.set(\\spread, 1, \\center, 0);\n// with no spread, i.e. all panned center, slightly higher -10\nx.set(\\spread, 0, \\center, 0);\n// worst case: no spread, pan full left: -8db\nx.set(\\spread, 0, \\center, -1); // -8\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Klank.ar(`[[800, 1071, 1153, 1723], nil, [1, 1, 1, 1]], Impulse.ar(2, 0, 0.1) }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Klank.ar(`[[800, 1071, 1153, 1723], nil, [1, 1, 1, 1]], Impulse.ar(2, 0, 0.1)) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Lorenz2DC.ar(8800, 16000) }.play(s);\n\n// randomly modulate params\n(\n{ Lorenz2DC.ar(\n 110, 22050,\n LFNoise2.kr(1, 2, 10),\n 20,\n LFNoise2.kr(1, 1.5, 2),\n 0.01\n) * 0.2 }.play(s);\n)\n\n// as a frequency control\n{ SinOsc.ar(Lorenz2DC.kr(40, 80, h:0.01)*800+900)*0.4 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Lorenz2DC.ar(8800, 16000) }.play(s);\n\n// randomly modulate params\n(\n{ Lorenz2DC.ar(\n 110, 22050,\n LFNoise2.kr(1, 2, 10),\n 20,\n LFNoise2.kr(1, 1.5, 2),\n 0.01\n) * 0.2 }.play(s);\n)\n\n// as a frequency control\n{ SinOsc.ar(Lorenz2DC.kr(40, 80, h:0.01)*800+900)*0.4 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var z;\n\n // signal (clean)\n z = Decay2.ar(\n Impulse.ar(8, 0, LFSaw.kr(0.3, 1, -0.3, 0.3)),\n 0.001,\n 0.3\n )\n * Mix.ar(Pulse.ar([80, 81], 0.3));\n\n // apply compression (mouse x sets amount)\n Compander.ar(z, z,\n thresh: MouseX.kr(0.01, 1),\n slopeBelow: 1,\n slopeAbove: 0.5,\n clampTime: 0.01,\n relaxTime: 0.01\n )\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var z;\n\n // signal (clean)\n z = Decay2.ar(\n Impulse.ar(8, 0, LFSaw.kr(0.3, 1, -0.3, 0.3)),\n 0.001,\n 0.3\n )\n * Mix.ar(Pulse.ar([80, 81], 0.3));\n\n // apply compression (mouse x sets amount)\n Compander.ar(z, z,\n thresh: MouseX.kr(0.01, 1),\n slopeBelow: 1,\n slopeAbove: 0.5,\n clampTime: 0.01,\n relaxTime: 0.01\n )\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Seekers are something you should avoid. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var time = 0.23;\n var freq = (55).midicps;\n var a = VarSaw.ar(freq/2, width: XLine.ar(0.5,1,time)).range(0,XLine.ar(0.666,1/666,time));\n var tone = SinOsc.ar(freq).fold(-0.23*a,a) * EnvGen.ar(Env([1,0],[time]));\n Out.ar(0, tone.dup);\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(//*********PREPARE**********\np.pop;\n//Any code that needs to access your own environment goes here\np = ProxySpace.push(s);\n~fxLoop.play.fadeTime_(5);\n);\n\n(//*********FXLoop**********\n~fxLoop = {\n var in = SoundIn.ar([0,1]);\n // in = in + (in * SinOsc.ar(LFTri.ar([0.1, 0.09]).range(215, 321)));\n in = in + CombC.ar(in, 2, SinOsc.ar(0.015).range(0.5, 1) * [0.13, 0.17], 7);\n in = in + CombC.ar(in, 2, SinOsc.ar(0.01).range(0.5, 1) * [0.1, 0.15], 7);\n in = in + CombC.ar(in, 2, [1.5, 1.0], 7);\n in = in + GVerb.ar(in, 10);\n in = in / 3;\n in;\n}\n)\n```"}, {"role": "assistant", "content": "Audio Sample: https://soundcloud.com/schemawound/supercollider-guitar-fx-test."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n{var a=LFNoise0,b=SinOscFB,c=Pulse;b.ar(a.ar([2,3])*(c.ar([5,7],b.kr([7,5]))*(a.ar([3,2]))*[800,1200]),(c.kr([100,80])*[2,3]))}.play\n```"}, {"role": "assistant", "content": "dirty and noisy \"result\" of remembering/learning sc again. still dont understand why it does not work when i move .ar/kr to var definition. hh... will turn it into synthdef..."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n{ CheckBadValues.kr(SinOsc.ar); 0 }.play // nothing wrong here\n\n{ CheckBadValues.kr(1 / 0, 1).poll; 0 }.play // check infinity\n\nx = { |test = -1| CheckBadValues.kr(test); 0 }.play // check NaN\nx.set(\\test, -1.sqrt);\n\n// don't post, but do something with the output\n(\nx = { |freq = 440|\n var good;\n good = BinaryOpUGen('==', CheckBadValues.kr(freq, 0, 0), 0);\n SinOsc.ar(freq, 0, 0.1) * good // silence the output if freq is bad\n}.play;\n);\nx.set(\\freq, -1.sqrt);\n// …\n```"}, {"role": "assistant", "content": "don't post, but do something with the output the UGen method checkBadValues passes through the input for quick testing (CheckBadValues: Test for infinity, not-a-number, and denormals)"}]} +{"conversations": [{"role": "user", "content": "What does `UScore.arrayForPlayTask` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: startPos — (describe argument here); assumePrepared — (describe argument here); startEventsActiveAtStartPos — (describe argument here); loop — (describe argument here). Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// modulate frequency\n{ Pulse.ar(XLine.kr(40, 4000, 6), 0.1, 0.2) }.play;\n\n// modulate pulse width\n{ Pulse.ar(200, SinOsc.kr(0.2).range(0.01, 0.99), 0.2) }.play;\n\n// two band limited square waves thru a resonant low pass filter\n{ RLPF.ar(Pulse.ar([100, 250], 0.5, 0.1), XLine.kr(8000, 400, 5), 0.05 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// modulate frequency\n{ Pulse.ar(XLine.kr(40, 4000, 6), 0.1, 0.2) }.play;\n\n// modulate pulse width\n{ Pulse.ar(200, SinOsc.kr(0.2).range(0.01, 0.99), 0.2) }.play;\n\n// two band limited square waves thru a resonant low pass filter\n{ RLPF.ar(Pulse.ar([100, 250], 0.5, 0.1), XLine.kr(8000, 400, 5), 0.05) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// For more SynthDefs and examples please head to: https://mycelialcordsblog.wordpress.com/ \n\n(\nSynthDef(\\hasherTest,\n{\narg rate = 1, freq = 60, index = 1000, tRate = 100,\nout = 0, fRate = 0.1;\n\nvar t_trig = LFPulse.kr(0.5/fRate, 0.5);\nvar random = LFNoise0.ar(rate, add:1);\nvar noise = Hasher.ar(random);\nvar sound = Saw.ar((freq+(noise*index)), Decay.kr(Impulse.kr(tRate), noise*0.001)).tanh;\nsound = Pan2.ar(sound, noise-0.3*2);\nFreeSelf.kr(t_trig);\nOut.ar(out, sound);\n}).store;\n);\n\n(\nPbind(\n\\instrument, \\hasherTest,\n\\dur, 5,\n\\rate, Pfuncn({100.rand}, inf),\n\\freq, Pfuncn({10000.rand}, inf),\n\\index, Pfuncn({20000.rand}, inf),\n\\tRate, Pfuncn({1000.rand}, inf),\n\\fRate, 5,\n).play;\n)\n```"}, {"role": "assistant", "content": "It is a simple SynthDef I made after having a look at Hasher UGen with a pattern to play it. It creates nice and varied glitch sounds."}]} +{"conversations": [{"role": "user", "content": "What does `Date.rawSeconds` do?"}, {"role": "assistant", "content": "Get or set the receiver's raw time in seconds (relative to the \"epoch\" of January 1, 1970). If you modify this property, the other properties will not update. See note at #-resolve — there is no \"resolveFromRawSeconds\" method, but you can generate a new self-consistent Date instance by passing the `rawSeconds` as an argument to"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//simple particlesystem.\n//with mouse controlling world gravity and system position\n\n(\nvar width= 300, height= 300, w, world,\nsys;\n\n//--world\nw= RedWindow(\"particlesystem test\", Rect(128, 64, width, height)).front;\nworld= RedWorld3(RedVector2D[width, height], 0, 20, -0.25); //dim,grav,maxvel,damp\n\n//--system\nsys= RedParticleSystem.new;\n\n//--loop\nw.draw{\n world.gravity= RedVector2D.newFrom(w.mouse/([width, height])-0.5);\n\n //--add new particles and update old\n sys.add(RedParticle(world, w.mouse+5.rand2, 0, RedVector2D[2.rand2, 10.rand], 1.5, 5.rand).age_(40.rrand(50)));\n sys.addForce(world.gravity);\n sys.update;\n\n //--render\n sys.do{|o| //iterate all particles in the system\n Pen.fillColor= Color.grey((o.age/50), 1);\n Pen.fillOval(Rect.aboutRedObject2D(o));\n };\n};\nw.play;\nCmdPeriod.doOnce({w.close});\n)\n```"}, {"role": "assistant", "content": "simple particlesystem. with mouse controlling world gravity and system position."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// what can it sound like? see: https://www.youtube.com/watch?v=dRmY3tEwZyE \n// the youtube version has been sent through an additional reverb pedal, but\n// you don't need the pedal to get something that sounds interesting\n\n(\ns.options.memSize_(16384*10);\ns.reboot;\ns.waitForBoot({\n \n Ndef(\\bits, {\n var t = PulseCount.ar(Impulse.ar(8e3));\n var u = PulseCount.ar(Impulse.ar(7009));\n var sig = HPF.ar(\n (\n ((t * 15) & (t >> 5)) |\n ((t * 5) & (t >> [3, 4])) |\n ((t * 2) & (t >> 9)) |\n ((t * 8) & (t >> 11)) |\n (((t*t) & t) | (t >> 3))\n - 3 % 256\n ) / 127-1 * 3\n , 20\n ) * 0.1;\n var sig2 = LPF.ar(HPF.ar(gcd(t*u, u+t), WhiteNoise.ar()*2000 + 1000), 20);\n sig2 = sig2*sig;\n sig = 0.3*Splay.ar(Limiter.ar(Greyhole.ar(sig + sig2, sig, 0.5, sig), 0.5).flatten);\n }).play;\n});\n)\n```"}, {"role": "assistant", "content": "a surprisingly rich soundscape in a few lines of code (lucky accident)."}]} +{"conversations": [{"role": "user", "content": "What does `Condition.wait` do?"}, {"role": "assistant", "content": "Wait until the condition is true and signalled. This only works in a Routine. This method yields a symbol (\\hang), so that the clock doesn't reschedule the Routine. `c = Condition(false); fork { 0.5.wait; \"started"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nx = { |gate = 1| BrownNoise.ar(0.5) * EnvGen.kr(Env.cutoff(1), gate, doneAction: Done.freeSelf) }.play;\nx.release(5; // override the Env's specified 1 second release time\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nx = { |gate = 1| BrownNoise.ar(0.5) * EnvGen.kr(Env.cutoff(1), gate, doneAction: Done.freeSelf) }.play;\nx.release(5); // override the Env's specified 1 second release time\n```"}]} +{"conversations": [{"role": "user", "content": "What is `DrawGrid`?"}, {"role": "assistant", "content": "DrawGrid — Draws grid lines on a UserView for plotting"}, {"role": "user", "content": "What does `DrawGrid.draw` do?"}, {"role": "assistant", "content": "This draws to the currently active UserView. This method is meant to be called from inside the UserView#-drawFunc#-drawFunc of a `UserView`."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nx = [0, 10].asSpec.units_(\"sec\");\ny = [0, 1].asSpec.units_(\"amp\");\nd = DrawGrid((500@250).asRect, x.grid, y.grid);\n\n// set its properties before testing\nd.x.tickSpacing_(25);\nd.linePattern_(FloatArray[10.0, 5.0, 2.0, 5.0]);\n\n// generate a preview\n~testView = d.preview;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Env`."}, {"role": "assistant", "content": "```supercollider\n// an envelope in a synth\n(\n{\n var env = Env([0, 1, 0.5, 1, 0], [0.01, 0.5, 0.02, 0.5]);\n SinOsc.ar(470) * EnvGen.kr(env, doneAction: Done.freeSelf)\n}.play\n);\n// an envelope to control a parameter in a pattern\n(\nPbind(\n \\note, Env([0, 12, 6, 13, 0], [1, 5, 2, 10]),\n \\dur, 0.1\n).play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `QtGUI.debugLevel` do?"}, {"role": "assistant", "content": "Gets or sets the verbosity level for debug output from \"QtCollider\" code. SuperCollider must have been built in debug mode for messages to appear. Valid values are -1 (none), 0 (warnings only, default), 1 (most messages), and 2 (verbose). Values outside this range are effectively"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `CoinGate`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\na = SynthDef(\"help-TCoin\", { |out = 0, prob = 0.5|\n var trig;\n trig = CoinGate.kr(prob, Impulse.kr(10));\n Out.ar(out,\n SinOsc.ar(\n TRand.kr(300.0, 400.0, trig), 0, 0.2\n )\n )\n}).play;\n);\n\na.set(\\prob, 1.0);\na.set(\\prob, 0.0);\na.set(\\prob, 0.1);\n\n\n(\na = SynthDef(\"help-TCoin\", { |out = 0, prob = 0.5|\n var trig;\n trig = Impulse.ar(20, 0, SinOsc.kr(0.5, 0, 1, 1));\n Out.ar(out,\n Mix.fill(3, { Ringz.ar(CoinGate.ar(prob, trig*0.5), #[1, 1.5]*Rand(1000, 9000), 0.01) })\n )\n}).play;\n);\n\na.set(\\prob, 1.0);\na.set(\\prob, 0.0);\na.set(\\prob, 0.1);\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `Penvir` in SuperCollider briefly."}, {"role": "assistant", "content": "Penvir — use an environment when embedding the pattern in a stream Category: Streams-Patterns-Events > Patterns > Data Sharing."}]} +{"conversations": [{"role": "user", "content": "When should I use a Pattern instead of writing Synth code by hand?"}, {"role": "assistant", "content": "Use a Pattern when what you want to express is a sequence over time — notes, durations, amplitudes, parameters — rather than a signal. A Pbind describes events, and `.play` turns each event into a Synth (by default of the \\default instrument, or of \\instrument if you name one). Hand-written Synth code is for the sound itself; Patterns are for what plays when. The two compose: a SynthDef named \\bell is triggered from `Pbind(\\instrument, \\bell, ...)`."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Padd`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, gate = 1|\n var env;\n env = EnvGen.kr(Env.asr(0.001, 1, 0.2), gate, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain, \\freq, 440);\nb = Padd(\\freq, Pseq([10, 30, 100], inf), a);\nb.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Lag2`."}, {"role": "assistant", "content": "```supercollider\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n Lag2.kr( // lag the modulator\n LFPulse.kr(4, 0, 0.5, 50, 400), // frequency modulator\n Line.kr(0, 1, 15) // modulate lag time\n ),\n 0, // phase\n 0.3 // sine amplitude\n )\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `RandID`."}, {"role": "assistant", "content": "```supercollider\n// start a noise patch and set the id of the generator\n(\nSynthDef(\"help-RandID\", { |out = 0, id = 1|\n RandID.ir(id);\n Out.ar(out,\n WhiteNoise.ar(0.05) + Dust2.ar(70)\n )\n}).add;\n);\n\n// reset the seed of my rgen at a variable rate\n(\nSynthDef(\"help-RandSeed\", { |seed = 1910, id = 1|\n RandID.kr(id);\n RandSeed.kr(Impulse.kr(FSinOsc.kr(0.2, 0, 10, 11)), seed);\n}).add;\n\n);\n\n// start two noise synths on left and right channel with a different randgen id\na = Synth(\"help-RandID\", [\\out, 0, \\id, 1]);\nb = Synth(\"help-RandID\", [\\out, 1, \\id, 2]);\n\n// reset the seed of randgen 1\nx = Synth(\"help-RandSeed\", [\\id, 1]);\n\n// change the target randgen to 2 (affects right channel)\nx.set(\\id, 2);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Patch.didFree` do?"}, {"role": "assistant", "content": "Pairs an Instr with inputs that that will be passed to the Instr"}]} +{"conversations": [{"role": "user", "content": "Explain `NdefParamGui` in SuperCollider briefly."}, {"role": "assistant", "content": "NdefParamGui — display the settings of a nodeproxy NdefParamGui displays all settings and mappings of a nodeproxy, so one can change them flexibly. Single number get displayed with an EZSlider, and anything else is shown as an EZText (a text field). Its main use is within NdefGui. Category: JITLib > GUI, Live Coding."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns.waitForBoot {\n // Open a plotTree window with a refresh rate of 2 seconds:\n s.plotTree(2);\n\n // Define and play a repeating pattern that generates a new synth every 0.5 seconds:\n x = Pn((dur: 0.5, midinote: 69, amp: 0.1)).play;\n\n /*\n Since the plotTree window refreshes every 2 seconds,\n displaying only the most recent node,\n the first node will appear after a 2-second delay (once four notes have played),\n meaning only every fourth synth node is visible.\n */\n\n 5.wait; // wait for 5 seconds.\n\n x.stop; // stop the playback of the pattern\n\n 2.wait; // wait for 2 seconds.\n\n s.nodeTreeV\n// …\n```"}, {"role": "assistant", "content": "Open a plotTree window with a refresh rate of 2 seconds: Define and play a repeating pattern that generates a new synth every 0.5 seconds: (Server: Object representing a server application)"}]} {"conversations": [{"role": "user", "content": "What does `Object.dump` do?"}, {"role": "assistant", "content": "Print a detailed low level representation of the receiver to the post window. Any object understands this method (this means metaclasses, classes and their instances). Note that in List class, this method dumps the list's internal array. `Meta_Object.dump // the meta class of the class Object` `Object.dump // the class called Object` `Object.new.dump // an istance of the class"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ LFPulse.ar(50 * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ LFPulse.ar(50) * 0.1 }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Converting an environment in a prototype object."}, {"role": "assistant", "content": "```supercollider\n~constructPseudoMethods = { |envir|\n var newEnvir = envir.collect { |value|\n var argNames, argBlock, namesBlock, code, func;\n if(value.isKindOf(Function)) {\n func = value;\n argNames = func.def.argumentString(withDefaultValues: true);\n namesBlock = func.def.argumentString(withDefaultValues: false);\n argBlock = if(argNames.notNil) { \"|self, \" ++ argNames ++ \"|\" };\n code = \"{ |func, envir| { % envir.use { func.value(%) } } }\".format(argBlock ? \"\", namesBlock ? \"\");\n //code.postln;\n code.interpret.value(func, envir)\n } {\n value\n }\n };\n newEnvir.know = true; // we want a prototype object style environment\n};\n```"}]} -{"conversations": [{"role": "user", "content": "What is `PV_ChainUGen`?"}, {"role": "assistant", "content": "PV_ChainUGen — Base class for UGens that operate on FFT chains"}, {"role": "user", "content": "What does `PV_ChainUGen.fftSize` do?"}, {"role": "assistant", "content": "Returns the FFT chain buffer's size. `(`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var chain = FFT(LocalBuf(1024));\n chain.fftSize.poll;\n 0.0\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Just experimenting with patterns."}, {"role": "assistant", "content": "```supercollider\n/* Some Funky Klangs - Totally botched the math on what I was trying to do but it sounds better this way */\n\n( \nSynthDef(\\DistKlangBlip, { \n | out = 0, release = 1, freq1 = 1, freq2 = 5, freq3 = 8, freqMult = 4 | \n var env = Linen.kr(Impulse.kr(0), 0.01, 1, release, doneAction:2); \n var freqs = ([freq1, freq2, freq3] * freqMult).midicps; \n var klang = Klang.ar(`[freqs, nil, nil ], 1, 0); \n Out.ar(out, klang.tanh!2 * env * 0.5) \n}).add\n\n);\n\n( \n Pbind(*[ \n instrument: \\DistKlangBlip, \n dur: Pxrand([0.25, 0.5], inf) * 0.5, \n release: Pkey(\\dur), \n freqMult: Pxrand((3..12), inf), \n freq2: Prand([4,5], inf), \n freq3: Prand([8,12], inf) \n]).play; \n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `IndexInBetween` in SuperCollider?"}, {"role": "assistant", "content": "IndexInBetween — Finds the (lowest) point in the Buffer at which the input signal lies in-between the two values Finds the (lowest) point in the Buffer at which the input signal lies in-between the two values, and returns the index. The fractional part of the index is suitable for linearly interpolating between the buffer slot values. Category: UGens > Buffer."}]} -{"conversations": [{"role": "user", "content": "SC can't open or read files?"}, {"role": "assistant", "content": "SuperCollider forum — SC can't open or read files\n\nIt looks as though it’s finally working!\n\nI moved the file to a folder I created in the user support directory for SuperCollider and then changed the quotes to ascii.\n\nI think the issue was that at first I had the file name listed without the extension, then I added the extension to the file name and added the file extension to the file path in the code and this must have created a conflict.\n\nIn the first instance SC needed the file extension, ascii quotes, and since I’m on windows the path needed double \\ in the path file.\n\nThe final working code looks like this:\n\n```supercollider\nb = Buffer.readChannel(s, \"C:\\\\Users\\\\44774\\\\AppData\\\\Local\\\\SuperCollider\\\\Tables\\\\wubsquare.wav\", startFrame:0, numFrames: -1);\n```\n\nThe wav file is simply named wubsquare and I included the file extension in the code."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var env = Env.step([0, 3, 5, 2, 7, 3, 0, 3, 4, 0], [0.5, 0.1, 0.2, 1.0, 1.5, 2, 0.2, 0.1, 0.2, 0.1]);\n var envgen = EnvGen.kr(env);\n var freq = (envgen + 60).midicps;\n SinOsc.ar(freq) * 0.1\n}.play\n;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var env = Env.step([0, 3, 5, 2, 7, 3, 0, 3, 4, 0], [0.5, 0.1, 0.2, 1.0, 1.5, 2, 0.2, 0.1, 0.2, 0.1]);\n var envgen = EnvGen.kr(env);\n var freq = (envgen + 60).midicps;\n SinOsc.ar(freq) * 0.1\n}.play\n);\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n\nInterface({\n\n ~freq = KrNumberEditor(400,[100,1200,\\exp]);\n ~amp = KrNumberEditor(0.1,[0.01,0.4,\\exp]);\n\n Patch({ arg freq,amp;\n SinOsc.ar(freq) * amp\n },[\n ~freq,\n ~amp\n ])\n\n})\n.onPlay_({\n \"playing\".postln;\n})\n.onStop_({ // also on command-.\n \"stopping\".postln;\n})\n.onFree_({\n \"freeing\".postln;\n}).play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n\nInterface({\n\n ~freq = KrNumberEditor(400,[100,1200,\\exp]);\n ~amp = KrNumberEditor(0.1,[0.01,0.4,\\exp]);\n\n Patch({ arg freq,amp;\n SinOsc.ar(freq) * amp\n },[\n ~freq,\n ~amp\n ])\n\n})\n.onPlay_({\n \"playing\".postln;\n})\n.onStop_({ // also on command-.\n \"stopping\".postln;\n})\n.onFree_({\n \"freeing\".postln;\n}).play\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `RLPF`."}, {"role": "assistant", "content": "```supercollider\n{ RLPF.ar(Saw.ar(200, 0.1), SinOsc.ar(XLine.kr(0.7, 300, 20), 0, 3600, 4000), 0.2) }.play;\n\n\n(\n{ var ctl = RLPF.ar(Saw.ar(5, 0.1), 25, 0.03);\n SinOsc.ar(ctl * 200 + 400) * 0.1;\n}.play;\n);\n\n\n(\n{ var ctl = RLPF.ar(Saw.ar(5, 0.1), MouseX.kr(2, 200, 1), MouseY.kr(0.01, 1, 1));\n SinOsc.ar(ctl * 200 + 400) * 0.1;\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `HasPatchIns.inputs` do?"}, {"role": "assistant", "content": "parent class for Players that have PatchIns such as Patch"}]} -{"conversations": [{"role": "user", "content": "What is `Dpoll` in SuperCollider?"}, {"role": "assistant", "content": "Dpoll — Print the current output value of a demand rate UGen Print the current output value of a demand rate UGen. Category: UGens > Demand, UGens > Info."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Out.ar(87, SinOsc.ar(MouseX.kr(340, 1000, 1) * [1, 2, 3], 0, 0.2)) }.play;\nx = Monitor.new.play(87, 3, 0, fadeTime: 3;\nx.stop;\nx.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Out.ar(87, SinOsc.ar(MouseX.kr(340, 1000, 1) * [1, 2, 3], 0, 0.2)) }.play;\nx = Monitor.new.play(87, 3, 0, fadeTime: 3);\nx.stop;\nx.play;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nx = {\n // A collection of different tones:\n var son = SinOsc.ar((100, 100.3 .. 110));\n var val = ArrayMax.ar(son).at(0);\n val = LeakDC.ar(val); // the operation tends to induce DC offset\n Pan2.ar(val)\n}.play\n;\nx.free\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nx = {\n // A collection of different tones:\n var son = SinOsc.ar((100, 100.3 .. 110));\n var val = ArrayMax.ar(son).at(0);\n val = LeakDC.ar(val); // the operation tends to induce DC offset\n Pan2.ar(val)\n}.play\n);\nx.free\n```"}]} -{"conversations": [{"role": "user", "content": "What does `MKtl.loadDescsMatching` do?"}, {"role": "assistant", "content": "load device description file(s) matching with name from indicated"}]} -{"conversations": [{"role": "user", "content": "How do I make a delay line?"}, {"role": "assistant", "content": "`CombN.ar(in, maxdelaytime, delaytime, decaytime)` is a feedback delay: maxdelaytime is the buffer size, delaytime the actual delay (and it can modulate), decaytime how long the repeats take to die. For a clean single echo use `DelayN.ar(in, maxdelaytime, delaytime)`, which has no feedback. Both replace the `in` with the delayed signal, so mix with the dry: `dry + CombN.ar(dry, 0.5, 0.3, 2) * 0.4`."}]} -{"conversations": [{"role": "user", "content": "How do I use a metronome or check my timing?"}, {"role": "assistant", "content": "A click on the clock you are using, plus a counter to see where you are in the bar:\n\n```supercollider\n(\nTdef(\\click, {\n var count = 0;\n loop {\n (Synth(\\hat, [\\amp, if (count % 4 == 0) { 0.25 } { 0.08 }]));\n count = count + 1;\n 1.wait;\n }\n}).play;\n)\n```\n\nBecause it waits on `TempoClock.default`, it stays in sync with every Pbind you start, which makes it a\ntempo reference rather than a separate sound."}]} -{"conversations": [{"role": "user", "content": "Rand or rand difference?"}, {"role": "assistant", "content": "SuperCollider forum — Rand or rand difference?\n\nI think you meant to compare Rand and rrand (not rand) – both generate a random number between a given low and high, but Rand is intended to be used inside a SynthDef and the behavior is slightly different. Compare:\n\n```supercollider\n(\nSynthDef(\\test, {\n var freq = rrand(400, 600);\n Out.ar(0, SinOsc.ar(freq) * 0.2);\n}).add;\n);\n\nSynth(\\test); // run and stop multiple times: always same freq\n\n(\nSynthDef(\\test2, {\n var freq = Rand(400, 600);\n Out.ar(0, SinOsc.ar(freq) * 0.2);\n}).add;\n);\n\nSynth(\\test2); // run and stop multiple times: every time a different freq\n```\n\nAs you can read in the help file, Rand is intended to be used inside SynthDefs when you want the particular behavior of a newly generated random frequency for each Synth called. You can use rrand(lo, hi) inside a SynthDef too, if you want the random number to be generated only once at time of SynthDef creation (it gets “inscribed in the recipe” for good), so all future and all Synth calls based on that SynthDef to use on that same random number.\n\nAs a side note, rand (as opposed to rrand) generates a random number between zero and the receiver:\n\n```supercollider\nrand(8); // random numbers between 0 and and 8 (excluding 8)\n\nrand(0.5, 8); // random numbers between 0 and 0.5; second argument is ignored here\n```\n\nAlso in regards to the specific way you present the example (as Functions, indicated by the curly braces): note the difference when you evaluate them:\n\n```supercollider\n{Rand(0.5,8)}.value; // returns 'a Rand'\n{rrand(0.5,8)}.value; // returns an actual random choice between lo and hi\n```\n\nHope this helps,\n\nB"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Very quick-and-dirty hack to show stereo phase."}, {"role": "assistant", "content": "```supercollider\n(\nb = Bus.audio(s, 2);\na = { |inbus = 0|\n var sig = In.ar(inbus, 2);\n // x axis is side, oriented toward right;\n // y axis is mid\n [sig[1] - sig[0], sig.sum]\n}.play(s.defaultGroup, outbus: b, addAction: \\addAfter);\nc = s.scope;\nc.style = 2;\nc.bus = b;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Recorder`."}, {"role": "assistant", "content": "```supercollider\n(\n{ SinOsc.ar(\n SinOsc.ar(\n XLine.kr(1, 100, 5)).exprange(*XLine.kr([20, 800], [7000, 200], 10)\n )\n ) * 0.1\n\n}.play;\ns.record(duration: 10);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `AbstractFunction`."}, {"role": "assistant", "content": "```supercollider\na = { |x| #[440, 720, 801, 1020.2].at(x) }; b = a.cpsmidi; [a.value(3), b.value(3)];\na = Pseries(220, 220, inf).cpsmidi; a.asStream.nextN(12); // overtone series as midinotes\n// follow but round to next midinote\n{ a = Pitch.kr(SoundIn.ar).at(1); Pulse.ar(a.cpsmidi.round.midicps) * 0.1 }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `AbstractSPlayFile` in SuperCollider briefly."}, {"role": "assistant", "content": "AbstractSPlayFile — an abstract class for all soundfile players Helper class for soundfile players. Category: SInstruments."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes beats to bar printing."}, {"role": "assistant", "content": "```supercollider\n(\nf = ();\nf.beatAndBar = {\n var t = currentEnvironment.clock; // t= TempoClock.new;\n var text = \"xB: \";\n\n var nBeatsPerBar = { arg n, beats, clock;\n var nBpb = clock.beatsPerBar * n;\n \"\" ++ n ++ text ++ (nBpb - (beats%(nBpb))).asInteger\n };\n\n t.play({arg beats, time, clock;\n ( //[\"beat: \" ++ (t.beatInBar + 1).asInteger] ++ //uncomment for beat in bar\n [1,2,4,8,16,32].collect( {|n,i| nBeatsPerBar.value(n, beats, clock)})\n ).postln;\n 1});\n \"beatAntBar\";\n}\n);\n\nf[\\beatAndBar].value;\n\n(\nf[\\beatAndBar].value;\nCmdPeriod.add(f[\\beatAndBar]);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `List`?"}, {"role": "assistant", "content": "List — list of items of variable size"}, {"role": "user", "content": "What does `List.new` do?"}, {"role": "assistant", "content": "Creates a List with the initial capacity given by size."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// Create a new empty collections with size 3:\nx = Array.new(3);\ny = Array.new(3);\nz = List.new(3);\n\n// Try to add 7 items to the array and list.\n// If the array exceeds maxSize, it will only\n// grow to an internally specified max size.\n(\n7.do { |i|\n x.add(i);\n y = y.add(i); // reassign array y on each add\n z.add(i);\n};\n);\n\n// Attempt to access the 5th item:\nx.at(4); // -> nil (out of bounds)\ny.at(4); // -> 4\nz.at(4); // -> 4\n\n// x grew only to size 4\nx.postln; // -> [ 0, 1, 2, 3 ]\ny.postln; // -> [ 0, 1, 2, 3, 4, 5, 6 ]\nz.postln; // -> List[ 0, 1, 2, 3, 4, 5, 6 ]\n```"}]} -{"conversations": [{"role": "user", "content": "What is `PSloop` in SuperCollider?"}, {"role": "assistant", "content": "PSloop — Pattern to derive loops from a given Pattern Although PSloop is not a subclass of PStream, instances of PSloop have a state by storing a PStream of the source pattern in an instance variable. So the specific characteristics of PSx patterns are indirectly inherited by PSloop. This especially concerns the way to generate new, fresh PSloop streams, see examples in PSx_stream_patterns. Category: Libraries > miSCellaneous > PSx stream patterns, Streams-Patterns-Events > PSx stream patterns."}]} -{"conversations": [{"role": "user", "content": "Supernova, Groups, Threads, Ndef?"}, {"role": "assistant", "content": "SuperCollider forum — Supernova, Groups, Threads, Ndef?\n\nAbout Ndef:\n\nAFAIK you can manually move a NodeProxy’s group into another group:\n\n```supercollider\n~pargroup = ParGroup(s);\n\nNdef(\\a, { Silent.ar(1) });\n\nNdef(\\a).group.moveToHead(~pargroup);\n```\n\nBut...\n\nNodeProxies use InFeedback.\n\nI was a little suspicious about this for parallel processing. As I recalled, InFeedback’s result depends on the order of execution:\n\n-\nIf the source node for the bus finished processing before the server reaches InFeedback, then InFeedback will output the block of audio being processed now.\n\n-\nIf the source node comes after the node containing InFeedback, then it will output the previous block of audio.\n\nIn both cases, these are the most recently available audio blocks. But, if the order of evaluation is not consistent, then the output may not be consistent.\n\nLet’s test that:\n\n```supercollider\nb = Bus.audio(s, 1);\n\na = { SinOsc.ar(200, 0, 0.1) }.play(outbus: b);\n\nc = { InFeedback.ar(b, 1).dup }.play(target: a, addAction: \\addAfter);\n\n(\nfork {\n var order = Pseq([\\moveBefore, \\moveAfter], inf).asStream;\n loop {\n c.perform(order.next, a);\n 1.0.wait;\n }\n}\n)\n```\n\nOops.\n\nThis means you can’t randomly throw Ndefs into ParGroups. If one Ndef reads a signal from another, then you have to make sure that the target Ndef comes later in a serial (regular) Group. (Correctness of the result should be more important than “optimal” usage of multiple cores.)\n\nIf you don’t, and if supernova happens to put the source and target Ndefs onto separate cores at roughly the same time, then the target might evaluate InFeedback either before or after the source finishes, and there’s no guarantee of this being consistent. So you might get clicks.\n\nhjh"}]} -{"conversations": [{"role": "user", "content": "What does `PlayerRecorder.makePath` do?"}, {"role": "assistant", "content": "utility class to prepare and precisely record a player to a soundfile"}]} -{"conversations": [{"role": "user", "content": "What does `Date.>=` do?"}, {"role": "assistant", "content": "Compare two Dates based on their rawSeconds. `Date(1999, 12, 31, 23, 59, 59) < Date(2000, 1, 1, 0, 0,"}]} +{"conversations": [{"role": "user", "content": "What does `U.controlOuts` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: unit — (describe argument here). Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nb = SoundFile.collectIntoBuffers(\"yourSoundFileFolder/*\"); // By Bjørn Houdorf, December 21, 2012\n\n(\n{\nvar number = b.numChannels, randomNumber, trigger, delayed, panned, sound, mixedSound, rotatedSound;\ntrigger = Dust.kr(Array.fill(number,1), 1, -0.5); // Generates random impulses from -0.5 to 0.5. as a excitation function\nrandomNumber = TRand.kr(1, number, trigger);\nsound = PlayBuf.ar(Array.fill(number,1) ,randomNumber,1,trigger,0,0); // play sound files\ndelayed = DelayL.ar(sound, trigger, trigger); // delaying the sound files\npanned = Pan2.ar(delayed, Array.fill(number,{1.0.rand2})); // pan them out in the stereo field\nmixedSound = 0.05*Mix.new(panned);// and mix them to one stereo signal\nrotatedSound = Rotate2.ar(mixedSound[0], mixedSound[1], LFSaw.kr(0.05)); // rotate stereo signal\n}.play; // play it all\n)\n```"}, {"role": "assistant", "content": "Put your sound files in the sound file folder. The code plays random sound files panned out in the stereo field. A swarm of sound files."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// without any modification, convert FFT chain (frequency domain signal) back to audio (time domain signal)\n(\n{ var in, chain;\n in = WhiteNoise.ar;\n chain = FFT(LocalBuf(2048), in);\n IFFT.ar(chain) * -20.dbamp // inverse FFT\n}.play;\n)\n```"}, {"role": "assistant", "content": "without any modification, convert FFT chain (frequency domain signal) back to audio (time domain signal) (IFFT: Inverse Fast Fourier Transform)"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Amplitude`."}, {"role": "assistant", "content": "```supercollider\n// use input amplitude to control Pulse amplitude - use headphones to prevent feedback.\n{ Pulse.ar(90, 0.3, Amplitude.kr(SoundIn.ar(0))) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What is a SynthDef?"}, {"role": "assistant", "content": "A SynthDef is a named, compiled server-side instrument: a UGen graph plus named controls. You build one with SynthDef(\\name, { |args| ... }).add, and then play instances with Synth(\\name)."}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for some pattern exprimenting: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\brumm, { |dur = 1, pan = 2, freq = 40, index = 20|\n var sig = Pan2.ar(\n Blip.ar(freq, index),\n pan\n ) * EnvGen.ar(Env.perc(0.01, dur), doneAction: 2);\n Out.ar(0, sig);\n}).add;\n);\n\n(\nPbind(*[\n dur: Pseq([1.2, 0.2, 0.5, Pseries(0.1, -0.001, 100)], inf),\n pan: Pxrand(#[-0.5, 0.5, 0.1, -0.1, 0.8, -1], inf),\n freq: 40,\n instrument: \\brumm\n]).play();\n);\n\n(\nPbind(*[\n dur: Pseq([1.2, 0.2, 0.5, Pseries(0.1, -0.001, 100)], inf),\n pan: Pxrand(#[-0.5, 0.5, 0.1, -0.1, 0.8, -1], inf),\n freq: Pseq([Pseries(140, 0.5, 200)], inf),\n instrument: \\brumm\n]).play;\n);\n\n(\nPbind(*[\n dur: Pseq(Signal.chebyFill(1024, Array.rand(10, 0.0, 10.0)).abs + 0.05, inf),\n pan: Pxrand(#[-0.5, 0.5, 0.1, -0.1, 0.8, -1], inf),\n freq: Pseq(Signal.chebyFill(1024, Array.rand(10, 0.0, 10.0)).abs * 18000 + 120, inf),\n instrument: \\brumm\n]).play;\n);\n\n\n(\nPbind(*[\n dur: Pseq([1.2, 0.2, 0.5, Pseries(0.1, -0.002, 50)], inf),\n pan: Pxrand(#[-0.5, 0.5, 0.1, -0.1, 0.8, -1, 1, -0.8], inf),\n freq: Pseq([Pseries(740, 0.5, 200), Pxrand(Array.series(740, 0.5, 200), 50)], inf),\n instrument: \\brumm\n]).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LatoocarfianL`."}, {"role": "assistant", "content": "```supercollider\n// default initial params\n{ LatoocarfianL.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Impulse`."}, {"role": "assistant", "content": "```supercollider\n{ Impulse.ar(4, [0, MouseX.kr(0, 1)], 0.2) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does Splay.ar do?"}, {"role": "assistant", "content": "`Splay.ar(inArray, spread, level, center, levelComp)` takes an array of mono signals and distributes them across the stereo field, so `Splay.ar(SinOsc.ar([220, 330, 440]) * 0.1)` is a three-source stereo chord rather than three separate synths. spread (0..1) controls how far the voices fan out and center shifts the middle. It is the shorthand for 'make this array stereo'."}]} +{"conversations": [{"role": "user", "content": "What does `Mx.disconnectOutlet` do? What arguments does it take?"}, {"role": "assistant", "content": "A mixer and dynamic patching Arguments: outlet."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// default initial params\n{ HenonL.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n\n// mouse-control of params\n{ HenonL.ar(SampleRate.ir/4, MouseX.kr(1, 1.4), MouseY.kr(1, 0.3)) * 0.2 }.play(s);\n\n// randomly modulate params\n(\n{ HenonL.ar(\n SampleRate.ir/8,\n LFNoise2.kr(1, 0.2, 1.2),\n LFNoise2.kr(1, 0.15, 0.15)\n) * 0.2 }.play(s);\n)\n\n// as a frequency control\n{ SinOsc.ar(HenonL.ar(40, MouseX.kr(1, 1.4), MouseY\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// default initial params\n{ HenonL.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n\n// mouse-control of params\n{ HenonL.ar(SampleRate.ir/4, MouseX.kr(1, 1.4), MouseY.kr(1, 0.3)) * 0.2 }.play(s);\n\n// randomly modulate params\n(\n{ HenonL.ar(\n SampleRate.ir/8,\n LFNoise2.kr(1, 0.2, 1.2),\n LFNoise2.kr(1, 0.15, 0.15)\n) * 0.2 }.play(s);\n)\n\n// as a frequency control\n{ SinOsc.ar(HenonL.ar(40, MouseX.kr(1, 1.4), MouseY.kr(1, 0.3))*800+900)*0.4 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `MAbstractElement.kr` do? What arguments does it take?"}, {"role": "assistant", "content": "Use the value directly on the server (on a Arguments: server — optional argument that you only have to set once, and only if the server for the bus is not Server#-default.. Returns: an In#-kr holding the current value of this element. Reflects changes of the value."}]} {"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// try wiggling mouse quickly;\n// LFNoise frequently seems stuck, LFDNoise changes smoothly.\n\n{ LFNoise0.ar(MouseX.kr(0.1, 1000, 1), 0.1) }.play\n\n{ LFDNoise0.ar(MouseX.kr(0.1, 1000, 1), 0.1) }.play\n\n// silent for 2 secs before going up in freq\n\n{ LFNoise0.ar(XLine.kr(0.5, 10000, 3), 0.1) }.scope;\n\n{ LFDNoise0.ar(XLine.kr(0.5, 10000, 3), 0.1) }.scope;\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFNoise0.ar(XLine.k\n// …\n```"}, {"role": "assistant", "content": "try wiggling mouse quickly; LFNoise frequently seems stuck, LFDNoise changes smoothly. (LFDNoise0: Dynamic step noise)"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\np = Pbind(\n \\degree, Pxrand([0, 2, 3, 4, 6, 7], 12),\n \\dur, Pdiff(Pkey(\\degree)).abs/4,\n.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\np = Pbind(\n \\degree, Pxrand([0, 2, 3, 4, 6, 7], 12),\n \\dur, Pdiff(Pkey(\\degree)).abs/4,\n).play;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nl = LazyEnvir.push;\n\n// default objects are created on access\n~a;\n~a.value; // defaults to nil\n\n// operations on placeholders\n(\n~c = ~a + ~b;\n\n~c.value; // doesn't fail, instead returns nil\n);\n\n// variables can be assigned later\n(\n~a = 800;\n~b = { 1.0.rand };\n\n~c.value;\n);\n\n// variables can be exchanged later\n(\n~b = { 1000.rand };\n~c.value;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nl = LazyEnvir.push;\n\n// default objects are created on access\n~a;\n~a.value; // defaults to nil\n\n// operations on placeholders\n(\n~c = ~a + ~b;\n\n~c.value; // doesn't fail, instead returns nil\n);\n\n// variables can be assigned later\n(\n~a = 800;\n~b = { 1.0.rand };\n\n~c.value;\n);\n\n// variables can be exchanged later\n(\n~b = { 1000.rand };\n~c.value;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\ns.plotTree;\n\n// Define and play a repeating pattern that generates a new synth every 0.4 seconds:\nx = Pn((dur: 0.4, midinote: 69, amp: 0.1)).play;\n\n/*\nThe NodeTreeView window dynamically displays active synth nodes.\nInitially, it shows the first node, and upon each refresh, it retains the previous node while adding a new one.\nThis results in the display of one or two subsequent nodes at each interval.\n*/\n\n// stop updating plotTree:\ns.nodeTreeView.stop;\n\n// start updating plotTree:\ns.nodeTreeView.start;\n\n// stop the playback of the pattern:\nx.stop;\n\ns.nodeTreeV\n// …\n```"}, {"role": "assistant", "content": "Define and play a repeating pattern that generates a new synth every 0.4 seconds: stop updating plotTree: (Server: Object representing a server application)"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\ns.boot;\n\n(\nvar winenv;\n// a custom envelope\nwinenv = Env([0, 1, 0], [0.5, 0.5], [8, -8]);\nz = Buffer.sendCollection(s, winenv.discretize, 1);\n\nSynthDef(\\sin_grain_test, { |out, gate = 1, amp = 1, envbuf|\n var pan, env, freqdev;\n // use mouse x to control panning\n pan = MouseX.kr(-1, 1);\n // use WhiteNoise and mouse y to control deviation from center pitch\n freqdev = WhiteNoise.kr(MouseY.kr(0, 400));\n env = EnvGen.kr(\n Env([0, 1\n// …\n```"}, {"role": "assistant", "content": "use mouse x to control panning use WhiteNoise and mouse y to control deviation from center pitch (GrainSin: Granular synthesis with sine tones)"}]} -{"conversations": [{"role": "user", "content": "What does `SimpleDMX.new` do? What arguments does it take?"}, {"role": "assistant", "content": "create a new SimpleDMX Arguments: universeSizes — An array of integers, one for each universe, specifying the number of channels in each universe. If not specified, defaults to 512 channels per universe.; cmdperiod — if `true`, the serial port will be closed on command-period.."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SynthDef`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_notRand, { |out|\n Out.ar(out,\n SinOsc.ar(rrand(400, 800), 0, 0.2) * Line.kr(1, 0, 1, doneAction: Done.freeSelf)\n )\n}).add;\n);\na = Synth(\\help_notRand);\nb = Synth(\\help_notRand); // the same freq as a\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `T2K`."}, {"role": "assistant", "content": "```supercollider\n// this does not work:\n(\n{\n var trig = Dust.ar(4);\n Trig.kr(trig, 0.1) * SinOsc.ar(800) * 0.1\n}.play;\n);\n\n// this works:\n(\n{\n var trig = T2K.kr(Dust.ar(4));\n Trig.kr(trig, 0.1) * SinOsc.ar(800) * 0.1\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `UnicodeResponder.dict` do?"}, {"role": "assistant", "content": "register responder functions for unicode and modifier combinations"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Using sine waves to generate a saw waveform."}, {"role": "assistant", "content": "```supercollider\nq={|f,e|a=Array.fill(e,{|j|e-j}).reverse;(Mix.ar(a.collect{|x|SinOsc.ar(f*x,0,1/x)})/2)!2};{q.(60,300)}.play //saw from sine #supercollider\n\n//Change the values passed to q to control the frequency and how many sines are used.\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for how to generate the synthdef with a pattern?"}, {"role": "assistant", "content": "```supercollider\n(\nPdef(\\zed, \n Pbind(\n \\osc, Pseq([SinOsc, LFSaw],inf),\n \\instrument, Prout({ arg ev;\n SynthDef(\\zed, { arg out=0, gate=1, amp=0.1, pan=0, freq=200;\n var sig;\n sig = ev[\\osc].ar(freq);\n sig = sig * EnvGen.kr(\\adsr.kr(Env.adsr(0.1,0.1,0.8,0.1)), gate, doneAction:2);\n sig = Pan2.ar(sig, pan, amp);\n Out.ar(out, sig);\n }).add.yield;\n }).loop,\n \\degree, Pseq([0],inf),\n \\dur, 1,\n \\amp, 0.1,\n )\n).play;\n);\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for pattern of kicks."}, {"role": "assistant", "content": "```supercollider\n(\n{ | dur = 0.15, atk = 0.015, amp = 0.8, pan = 0 |\n Pan2.ar(\n SinOsc.ar(\n EnvGen.ar(Env(\\freq_l.kr([2960, 70, 90]), \\freq_d.kr([0.07, 0.15]), \\freq_c.kr([-13, -1]))),\n mul:EnvGen.ar(\n Env.perc( atk, max(dur - atk, atk), curve: \\amp_c.kr([-1, 5])),\n doneAction: 2 ) ), \n pan, amp )\n}.asSynthDef.name_(\"ckick\").add.play;\n);\n\n(\nPbind(*[\n instrument: \\ckick,\n delta: Pseg(Pwhite()/*Pbrown(step:0.05)*/.linexp(0, 1, 1/32, 1), Pbrown(0,1,0.05).linexp(0, 1, 1/8, 8), \\sine),\n //delta: Pseg(Pbrown(0,1,0.05).linexp(0, 1, 1/32, 1), Pbrown(0,1,0.05).linexp(0, 1, 1, 4), \\step),\n dur: Pfunc({ thisThread.clock.beatDur }) * Pkey(\\delta),\n atk: min(0.01, Pkey(\\dur)/2),\n freq_l: Pcollect(`_, Ptuple([Pbrown(1500, 4000, 50), Pbrown(40, 65, 1)/*+Pseq([0,300,100,0,50,0],inf)*/, Pbrown(45, 90, 5)], inf)),\n freq_d: Pfunc({ |e| `[e.atk*7, e.dur - 0.07] }),\n //freq_c: Pcollect(`_, Ptuple([Pbrown(-17, -4q, 0.5), Pbrown(0, 4)], inf)),\n freq_c: Ptuple({Pcollect(`_, Ptuple([Pbrown(-17, -4, 0.5), Pbrown(0, 4)], inf))}!2,inf),\n //amp_c: ``[-6,6],\n amp_c: Ptuple({Pcollect(`_, Ptuple([Pbrown(0, -6, 0.5), Pbrown(1, 6)], inf))}!2,inf), \n pan: Ptuple({Pbrown(-1,1)}!2, inf),\n amp: Ptuple({Pbrown(0.1,0.5,0.1)}!2, inf)\n])\n//.trace\n.play(TempoClock(156/60))\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `LatoocarfianN` in SuperCollider briefly."}, {"role": "assistant", "content": "LatoocarfianN — Latoocarfian chaotic generator A non-interpolating sound generator based on a function given in Clifford Pickover's book Chaos In Wonderland, pg 26. The function is: Category: UGens > Generators > Chaotic."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// This SynthDef has a harder attack than the default, illustrating rearticulation more clearly.\n(\nSynthDef(\\sawpulse, { |out, freq = 440, gate = 0.5, plfofreq = 6, mw = 0, ffreq = 2000, rq = 0.3, freqlag = 0.05, amp = 1|\n var sig, plfo, fcurve;\n plfo = SinOsc.kr(plfofreq, mul: mw, add: 1);\n freq = Lag.kr(freq, freqlag) * plfo;\n fcurve = EnvGen.kr(Env.adsr(0, 0.3, 0.1, 20), gate);\n fcurve = (fcurve - 1).madd(0.7\n// …\n```"}, {"role": "assistant", "content": "This SynthDef has a harder attack than the default, illustrating rearticulation more clearly. (PmonoArtic: partly monophonic event stream)"}]} -{"conversations": [{"role": "user", "content": "What happens when I call .play on a function?"}, {"role": "assistant", "content": "`.play` on a Function builds a SynthDef from the function body, adds it to the server under an anonymous name, and starts one Synth of it. You get back the Synth, so `x = { SinOsc.ar(440) * 0.1 }.play; x.free;` stops it. It is the fastest way to hear something, but it is not how you write a piece: nothing is named, nothing can be reused, and the definition is lost when the Synth is freed."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nd = { |amp = 1.0|\n var in1, in2;\n in1 = LFNoise0.ar(800, amp);\n in2 = SinOsc.ar(800);\n LeastChange.ar(in1, in2) * 0.1;\n}.play;\n);\n\nd.set(\\amp, 0.1);\nd.set(\\amp, 0);\nd.set(\\amp, 3;\nd.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nd = { |amp = 1.0|\n var in1, in2;\n in1 = LFNoise0.ar(800, amp);\n in2 = SinOsc.ar(800);\n LeastChange.ar(in1, in2) * 0.1;\n}.play;\n);\n\nd.set(\\amp, 0.1);\nd.set(\\amp, 0);\nd.set(\\amp, 3);\nd.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Buffer`."}, {"role": "assistant", "content": "```supercollider\n// Read a sound file from disk into a buffer\ns.boot;\n// ExampleFiles helps locate audio files used in examples\np = ExampleFiles.child;\n// peek at the path to see location and the format of a path\np.postln;\n// read the file\nb = Buffer.read(s, p);\n\n// now play it\n(\nx = SynthDef(\\help_Buffer, { |out = 0, bufnum|\n Out.ar(out,\n PlayBuf.ar(1, bufnum, BufRateScale.kr(bufnum))\n )\n}).play(s, [\\bufnum, b]);\n);\nx.free; b.free;\n\n// with an action function\n// note that the vars are not immediately up-to-date\n(\nb = Buffer.read(s, p, action: { |buffer|\n (\"After update:\" + buffer.numFrames).postln;\n x = { PlayBuf.ar(1, buffer, BufRateScale.kr(buffer)) }.play;\n});\n(\"Before update:\" + b.numFrames).postln;\n);\nx.free; b.free;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// Pbind with default synth\n// ~freq can be a collection, then pitch or chord are shifted by ~freqFac,\n// ascending (~step > 0) or descending (~step < 0) groups of 4 items\n\np = Pbind(\n \\dur, 0.4,\n \\amp, PL(\\amp),\n \\freq, PL(\\step) ** PLseq((0..3)) * PL(\\freq) * PL(\\freqFac) \n);\n\n// Synth producing an ascending line, it ends as envelope params are defined,\n// end notifications will be reflected in the VarGui\n\nSynthDef(\\synth_2, { |out = 0, freq = #[600, 700, 900, 1000], freqFac = 1\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// Pbind with default synth\n// ~freq can be a collection, then pitch or chord are shifted by ~freqFac,\n// ascending (~step > 0) or descending (~step < 0) groups of 4 items\n\np = Pbind(\n \\dur, 0.4,\n \\amp, PL(\\amp),\n \\freq, PL(\\step) ** PLseq((0..3)) * PL(\\freq) * PL(\\freqFac) \n);\n\n// Synth producing an ascending line, it ends as envelope params are defined,\n// end notifications will be reflected in the VarGui\n\nSynthDef(\\synth_2, { |out = 0, freq = #[600, 700, 900, 1000], freqFac = 1, \n amp = 0.1, ampFac = 0.5, preAmp = 5, attTime = 0.2, relTime = 2, susTime = 6|\n var src = SinOsc.ar(freq * XLine.kr(freqFac/2, freqFac, attTime + susTime), 0, mul: preAmp).tanh ! 2;\n Out.ar(0, src * amp * ampFac * EnvGen.ar(Env.linen(attTime, susTime, relTime), doneAction: 2))\n}).add;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `AnnotatedDebugNodeWatcher.n_go` do? What arguments does it take?"}, {"role": "assistant", "content": "Watches server replies for node ended/started events using AbstractPlayer's Node annotation system Arguments: nodeID; groupID; prevID; nextID."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes SOUND 1, from orig Influx Example."}, {"role": "assistant", "content": "```supercollider\n// SOUND 1, from orig Influx Example\n(\nNdef(\\dog).addSpec(\\intv, [-24, 24]);\nNdef(\\dog).addSpec(\\timescale, [0.01, 10, \\exp]);\nNdef(\\dog).addSpec(\\curve, [-10, 10]);\nNdef(\\dog).addSpec(\\ffreq, \\freq);\n\nNdef(\\dog).addSpec(\\loopnode, [0, 12]);\nNdef(\\dog).addSpec(\\dens, [10, 1000]);\nNdef(\\dog).addSpec(\\resfreq, \\freq);\nNdef(\\dog).addSpec(\\ringtime, [0.01, 1, \\exp]);\n\nNdef(\\dog, { |amp, freq=250, intv=19, timescale=1, curve=0, loopnode=0, dens = 10, resfreq = 500, ringtime = 0.01|\n var n = 15;\n var env = EnvGen.kr(\n Env({ 1.0.rand2 }!(n+1), {1.0.rand}!n, curve, releaseNode: n-1, loopNode: loopnode.min(n-3)),\n timeScale: timescale);\n var pitch = (env * [1, 0.33, -1] * intv).midiratio * freq;\n var form = Formant.ar(pitch, pitch.rotate(1) * 1.6, pitch.rotate(2) * 2.6);\n\n var dusty = Ringz.ar(\n Dust.ar(dens!3), \n resfreq * LFNoise0.kr([3, 5, 7], 0.5, 1), \n ringtime) \n * ((dens ** -0.5) * (ringtime ** -0.3)\n );\n \n Splay.ar(form * dusty, level: amp) ;\n});\n);\n\nNdef(\\dog).addHalo(\\orderedNames, Ndef(\\dog).controlKeys);\n\n/*\nNdef(\\dog).controlKeys;\nNdef(\\dog).vol_(0.5);\nNdefPreset( Ndef(\\dog) ).loadSettings;\nNdef(\\dog).play;\nNdef(\\dog).gui;\n*/\n```"}]} -{"conversations": [{"role": "user", "content": "I edited a SynthDef and the running sound did not change."}, {"role": "assistant", "content": "Redefining a SynthDef only affects Synths created after the new definition reaches the server; existing instances keep the graph they were built with. Free and recreate them: `~s.free; ~s = Synth(\\name)`. In JITLib, Ndef is the tool designed for this — redefining `Ndef(\\name, { ... })` crossfades to the new graph while it plays."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes SOUND 1, from orig Influx Example."}, {"role": "assistant", "content": "```supercollider\n// SOUND 1, from orig Influx Example\n(\nNdef(\\dog).addSpec(\\intv, [-24, 24]);\nNdef(\\dog).addSpec(\\timescale, [0.01, 10, \\exp]);\nNdef(\\dog).addSpec(\\curve, [-10, 10]);\nNdef(\\dog).addSpec(\\ffreq, \\freq);\n\nNdef(\\dog).addSpec(\\loopnode, [0, 12]);\nNdef(\\dog).addSpec(\\dens, [10, 1000]);\nNdef(\\dog).addSpec(\\resfreq, \\freq);\nNdef(\\dog).addSpec(\\ringtime, [0.01, 1, \\exp]);\n\nNdef(\\dog, { |amp, freq=250, intv=19, timescale=1, curve=0, loopnode=0, dens = 10, resfreq = 500, ringtime = 0.01|\n var n = 15;\n var env = EnvGen.kr(\n Env({ 1.0.rand2 }!(n+1), {1.0.rand}!n, curve, releaseNode: n-1, loopNode: loopnode.min(n-3)),\n timeScale: timescale);\n var pitch = (env * [1, 0.33, -1] * intv).midiratio * freq;\n var form = Formant.ar(pitch, pitch.rotate(1) * 1.6, pitch.rotate(2) * 2.6);\n\n var dusty = Ringz.ar(\n Dust.ar(dens!3), \n resfreq * LFNoise0.kr([3, 5, 7], 0.5, 1), \n ringtime) \n * ((dens ** -0.5) * (ringtime ** -0.3)\n );\n \n Splay.ar(form * dusty, level: amp) ;\n});\n);\n\nNdef(\\dog).addHalo(\\orderedNames, Ndef(\\dog).controlKeys);\n\n/*\nNdef(\\dog).controlKeys;\nNdef(\\dog).vol_(0.5);\nNdefPreset( Ndef(\\dog) ).loadSettings;\nNdef(\\dog).play;\nNdef(\\dog).gui;\n*/\n```"}]} -{"conversations": [{"role": "user", "content": "What does `MIDIFunc.activeSense` do?"}, {"role": "assistant", "content": "A convenience method to create a new MIDIFunc which responds to MIDI active sense messages. See #*new for argument descriptions. The responding `func` will be passed the argument Returns: A new instance of MIDIFunc which responds to MIDI active sense messages."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `TwoPole`."}, {"role": "assistant", "content": "```supercollider\n{ TwoPole.ar(WhiteNoise.ar(0.005), 2000, 0.95) }.play\n\n{ TwoPole.ar(WhiteNoise.ar(0.005), XLine.kr(800, 8000, 8), 0.95) }.play\n\n{ TwoPole.ar(WhiteNoise.ar(0.005), MouseX.kr(800, 8000, 1), 0.95) }.play\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for minor random bliss in two for Prout."}, {"role": "assistant", "content": "```supercollider\n(\n\nSynthDef(\\param, { arg freq = 100, sustain, amp;\n var sig;\n sig = LFPar.ar(freq: freq,\n mul: EnvGen.kr(Env.perc(0, sustain, 0.5), doneAction:2) * amp);\n sig = Splay.ar(sig);\n Out.ar(0, sig);\n}).add;\n\ne = Pbind(\n \\midinote, Prout({\n var tone0, tone1, tone2, interval, freq0, delta;\n loop {\n tone0 = rrand(0,11);\n interval = rrand(2,4);\n tone1 = Scale.minor(\\pythagorean).at(tone0) + [0,12,24].choose + 0.07;\n tone2 = Scale.minor(\\pythagorean).at(tone0 + interval) + [0,12,24].choose;\n freq0 = [tone1,tone2]+48;\n postln(freq0);\n freq0.yield;\n }\n }),\n \\dur, Prand([1,2,4,8,12,16,4,6,8], inf),\n \\instrument, \\param,\n \\amp, 0.5,\n \\sustain, 2,\n).play(quant:1); // returns an EventStream\nTempoClock.default.tempo = 1200/60;\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `EventStreamSpec.rate` do?"}, {"role": "assistant", "content": "datatype specifying a Pbind-like object that produces a playable stream of Events"}]} -{"conversations": [{"role": "user", "content": "What does `UGen.linlin` do?"}, {"role": "assistant", "content": "Wraps the receiver so that a linear input range is mapped to a linear output"}]} -{"conversations": [{"role": "user", "content": "What is `AbstractOut` in SuperCollider?"}, {"role": "assistant", "content": "AbstractOut — Abstract class for out ugens Category: UGens > InOut."}]} -{"conversations": [{"role": "user", "content": "What is `MKtlElement` in SuperCollider?"}, {"role": "assistant", "content": "MKtlElement — An element of an MKtl. A named element within an MKtl, which typically represents a slider, a button, a joystick axis etc etc. It has a description with a deviceSpec (e.g. \\midiNum for a midi faderbox slider), and a type (e.g. \\slider). It also has a deviceValue (in the deviceSpec range), and a value (in range 0.0 - 1.0). It is mostly created automatically when an MKtl is made. Category: Libraries > Modality."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes sclang fun )."}, {"role": "assistant", "content": "```supercollider\n( // whatever\nNdef(\\ff_twist, {\n var tempo = 156/60;//TempoClock.tempo;\n var bands = 4.rrand(16).debug('bands');\n var sync = bands.factors.scramble.pop.debug('sync');\n var gen = [LFNoise1,LFNoise2,LFNoise0];\n var sig = Splay.ar(\n VarSaw.ar(//LFSaw.kr(Array.rand(bands/sync, 8, 390).stutter(sync)).range(0.97,1.03) * \n Array.exprand(bands, 50, 400) * ({ gen.choose.kr(1/1.rrand(10)).exprange(1, 10) } ! (bands/sync)).stutter(sync), \n 0, \n { gen.choose.kr(1/1.rrand(10)).range(0.1,1) } ! bands, \n { gen.choose.kr(1/1.rrand(10)).range(0.1,1) } ! bands\n ) * ({ EnvGen.kr(Env.perc(0.008.exprand(0.03), tempo.reciprocal / [1,2,4,8].choose, 1, rrand(-7,-1.0)).circle) } ! (bands/sync)).stutter(sync)\n );\n sig = sig * 0.7 + GVerb.ar(sig, mul:0.3);\n sig = Rotate2.ar(\n sig[0], sig[1], \n LFSaw.kr( Duty.kr(tempo.reciprocal * (2,8..24).choose, 0, Drand((1..4)*tempo, inf)) )\n );\n sig;\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Object.idle` do?"}, {"role": "assistant", "content": "within a routine, return values (the receiver) until this time is over. (see also Routine#-play) Time is measured relative to the thread's clock. `a = Routine { 1.yield; 0.idle(3); 400.yield"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `GbmanL`."}, {"role": "assistant", "content": "```supercollider\n// default initial params\n{ GbmanL.ar(MouseX.kr(20, SampleRate.ir)) * 0.1 }.play(s);\n\n// different initial params\n{ GbmanL.ar(MouseX.kr(20, SampleRate.ir), -0.7, -2.7) * 0.1 }.play(s);\n\n// wait for it...\n{ GbmanL.ar(MouseX.kr(20, SampleRate.ir), 1.2, 2.0002) * 0.1 }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(GbmanL.ar(40)*400+500)*0.4 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `HenonL` in SuperCollider briefly."}, {"role": "assistant", "content": "HenonL — Henon map chaotic generator A linear-interpolating sound generator based on the difference equation: Category: UGens > Generators > Chaotic."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n// definition for future reference in arbitrary Environments\n\np = PLtuple(\\a);\n\n\n// prepare current Environment\n// PLtuple defaults to repeats = inf,\n// so inner Patterns are repeatedly embedded\n\n~a = [ Pshuf((60..65)), 70, Pshuf((75..80)) ];\n\n\n// run\n\nx = Pbind(\\midinote, p, \\dur, 0.2).trace.play;\n\n\n// replace elements\n\n~a[0] = 72.5;\n\n~a[1] = 74.5;\n\n~a[2] = Prand([85, 86, 87]);\n\n\n// re\n// …\n```"}, {"role": "assistant", "content": "definition for future reference in arbitrary Environments prepare current Environment (PLtuple: dynamic scope Ptuple variant)"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Band-limited hard sync oscillator."}, {"role": "assistant", "content": "```supercollider\n(\n~syncSaw = {\n arg syncFreq=440, sawFreq=440, maxRatio=20, minFreq = 10;\n var maxDelay = 1/minFreq;\n var n = floor(maxRatio);\n var b = LocalBuf(Server.default.sampleRate*maxDelay ,1).clear;\n var baseWaveform = Saw.ar(syncFreq);\n var sig = 0;\n n.do {\n arg i;\n var delay = i/sawFreq;\n var amplitude = (sawFreq/syncFreq-i) min: 1 max: 0;\n sig = sig + (BufDelayL.ar(b,baseWaveform,delay)*amplitude);\n };\n sig;\n};\n);\n\n(\n// test it\nplay {~syncSaw.(100,MouseX.kr.range(100,2000).lag)!2}\n);\n\n(\n// compare with aliased version\nplay {SyncSaw.ar(100,MouseX.kr.range(100,2000).lag)!2}\n);\n\n\n(\n// audio rate modulation of sawFreq results in a waveform that's not strictly\n// correct, but sounds good.\nplay {~syncSaw.(MouseY.kr(50,200),MouseX.kr.range(100,2000).lag+SinOsc.ar(20,mul:150))!2}\n// (audio rate modulation of syncFreq doesn't really work.)\n);\n\n(\n// aliased version of the above\nplay {SyncSaw.ar(MouseY.kr(50,200),MouseX.kr.range(100,2000).lag+SinOsc.ar(20,mul:150))!2}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n(\n// PLseq not used as proxy, only taken as it defaults to repeats = inf\n\np = Pbind(\n \\midinote, PLseq([PLser(\\a, \\r), 60, 61]),\n \\dur, 0.2\n);\n\n// prepare current Environment\n\n~a = (67..70);\n~r = 6;\n);\n\nx = p.play;\n\n\n// replace repeats\n\n~r = 3;\n\n\n// replace array elements\n\n~a[0] = [77, 93.5];\n\n~a[2] = Pseq((94..96));\n\n\n// replace whole array\n\n~a = [55, 52];\n\nx.stop;\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n(\n// PLseq not used as proxy, only taken as it defaults to repeats = inf\n\np = Pbind(\n \\midinote, PLseq([PLser(\\a, \\r), 60, 61]),\n \\dur, 0.2\n);\n\n// prepare current Environment\n\n~a = (67..70);\n~r = 6;\n);\n\nx = p.play;\n\n\n// replace repeats\n\n~r = 3;\n\n\n// replace array elements\n\n~a[0] = [77, 93.5];\n\n~a[2] = Pseq((94..96));\n\n\n// replace whole array\n\n~a = [55, 52];\n\nx.stop;\n\n\n\n\n//////////////////////\n\n\n// placeholder may also get lists of event patterns\n\n(\np = PLser(\\a, 3);\n\n~a = [\n Pbind(\n \\midinote, Pwhite(60, 65, 3),\n \\dur, 0.1\n ),\n Pbind(\n \\midinote, Pwhite(80, 85, 3),\n \\dur, 0.1\n )\n];\n\nx = p.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `AbstractPlayerEffect` in SuperCollider?"}, {"role": "assistant", "content": "AbstractPlayerEffect — parent class for any player that takes another player and adds effects Category: Libraries > crucial > Players > abstract."}]} -{"conversations": [{"role": "user", "content": "What does `ObjectTable.add` do? What arguments does it take?"}, {"role": "assistant", "content": "Put an object in the main ObjectTable and generate an Integer Arguments: obj — the object to put in the table.."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for short piece which plays random major music."}, {"role": "assistant", "content": "```supercollider\np = ProxySpace.push(s.boot);\n~a.play.quant_(4); ~b.play.quant_(4);\n~c = { LFNoise1.kr(8).range(0,15).round };\n~a = Pbind(\\degree, Pstutter(4, Pseq([0,2,3,4], inf)), \\octave, [3,4], \\dur, 0.25, \\amp, 0.3);\n~b = Pbind(\\octave, 4, \\scale, Scale.majorPentatonic, \\degree, ~c, \\dur, 1/4, \\legato, 0.5);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `MxQuery.where` do? What arguments does it take?"}, {"role": "assistant", "content": "Filters the results by testing each source object if objects.selector == equalsValue. eg. qs.inlets.where(\\name,\\freq) would return all inlets with the name Arguments: selector — The selector will be called on the source. For a unit this is what is inside it. For inlets, outlets and channels it is the inlet,outlet,channel itself. Thus inlet.name == 'freq' is asking the inlet.; equalsValue — The value to be matched for equality. Returns: an MxQuery with the selected results"}]} -{"conversations": [{"role": "user", "content": "Explain `EventStreamSpec` in SuperCollider briefly."}, {"role": "assistant", "content": "EventStreamSpec — datatype specifying a Pbind-like object that produces a playable stream of Events Streams/Patterns are commonly of two primary types: those that return numerical streams and those that return streams of Events which will spawn Synths. Category: Spec, Libraries > crucial > Spec, Streams-Patterns-Events > Patterns > Spec."}]} +{"conversations": [{"role": "user", "content": "What does `PatternProxy.embedInStream` do? What arguments does it take?"}, {"role": "assistant", "content": "Given a Stream like e.g. Routine, yield all values from the pattern in the proxy before continuing. One pattern proxy can be used to produce values for any number of independent Arguments: inval — The inval is passed into all substreams and can be used to control how they behave from the outside.; embed — See Object#-streamArg for explanation.; default — Replacement for `nil` outputs of the source pattern. One use case is #-endless. `a = PatternProxy.new;`."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ HPF.ar(Saw.ar(200, 0.1), FSinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3600, 4000), 5) }.play;\n\n(\n{ var ctl = HPF.kr(LFSaw.kr(5), SinOsc.kr(XLine.kr(0.07, 30, 20), 0, 35, 40)) ;\n SinOsc.ar(ctl * 200 + 500);\n}.play;\n);\n\n(\n{ var ctl = HPF.kr(LFSaw.kr(5, 0.1), MouseX.kr(2, 200, 1));\n SinOsc.ar(ctl * 200 + 400) * 0.1;\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ HPF.ar(Saw.ar(200, 0.1), FSinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3600, 4000), 5) }.play;\n\n(\n{ var ctl = HPF.kr(LFSaw.kr(5), SinOsc.kr(XLine.kr(0.07, 30, 20), 0, 35, 40)) ;\n SinOsc.ar(ctl * 200 + 500);\n}.play;\n);\n\n(\n{ var ctl = HPF.kr(LFSaw.kr(5, 0.1), MouseX.kr(2, 200, 1));\n SinOsc.ar(ctl * 200 + 400) * 0.1;\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Signal` in SuperCollider?"}, {"role": "assistant", "content": "Signal — Sampled audio buffer A Signal is a FloatArray that represents a sampled function of time buffer. Signals support math operations. Category: Collections > Ordered."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nServer.local.quit; // If server running, need to stop it for this example\n\n// We'll modify the server boot procedure to set our env var...\n~realserverprogram = Server.program;\nServer.program = \"export PANCREAS=220;\" + Server.program\ns.boot;\n\n(\nx = {\n// Env var specifies frequency.\n// If you change the env var name to one that isn't set, 440 is used.\nSinOsc.ar(Getenv(\\PANCREAS, 440), 0, 0.1);\n}.play(Server.local);\n;\nx.free;\n\n// This should restore the variable to what it was\nServer.program = ~realserverprogram;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nServer.local.quit; // If server running, need to stop it for this example\n\n// We'll modify the server boot procedure to set our env var...\n~realserverprogram = Server.program;\nServer.program = \"export PANCREAS=220;\" + Server.program\ns.boot;\n\n(\nx = {\n// Env var specifies frequency.\n// If you change the env var name to one that isn't set, 440 is used.\nSinOsc.ar(Getenv(\\PANCREAS, 440), 0, 0.1);\n}.play(Server.local);\n);\nx.free;\n\n// This should restore the variable to what it was\nServer.program = ~realserverprogram;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Fdef`."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\ns.boot;\nSynthDef(\"gpdef\",\n { |out = 0, freq = 440, sustain = 0.05, amp = 0.1|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain), doneAction: Done.freeSelf) * amp;\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n// fork a thread that plays some sounds\n(\nFdef(\\freq, 440);\nFdef(\\dur, 0.2);\n\nfork {\n loop {\n s.sendMsg(\"/s_new\", \"gpdef\", -1, 1, 1, \\freq, Fdef(\\freq).value);\n Fdef(\\dur).value.wait;\n }\n};\n);\n\n// some modifications\n\nFdef(\\freq, Fdef(\\midinote, 60).midicps);\nFdef(\\midinote, { [67, 64, 65].choose });\nFdef(\\midinote, { [67, 64, 65].choose } + Fdef(\\offset));\nFdef(\\offset, { 4.rand });\nFdef(\\dur, 0.23);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// result of BufRd is used as index for the next BufRd\n// needs Buffer c prepared above\n\n(\ny = {\n GFIS.ar(\n { |x| BufRd.ar(1, c, c.numFrames * x) },\n (LFDNoise3.ar(3) * [1, 1.1]).range(0.5, 0.51), 7\n ) * 0.2\n}.play\n;\n\ny.release\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// result of BufRd is used as index for the next BufRd\n// needs Buffer c prepared above\n\n(\ny = {\n GFIS.ar(\n { |x| BufRd.ar(1, c, c.numFrames * x) },\n (LFDNoise3.ar(3) * [1, 1.1]).range(0.5, 0.51), 7\n ) * 0.2\n}.play\n);\n\ny.release\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Archive`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// make a storage place for various objects:\nq = (); // Event\n\nq[\\a_long_array] = Array.rand(128, 0.0, 1.0);\nq[\\pi_squared] = pi * pi;\nq[\\favourite_sound] = { { SinOsc.ar([300, 330]).sum * LFPulse.kr(2 + [0, 0.01]) * 0.1 }.play };\nq[\\same_long_array] = q[\\a_long_array]; // same objects may appear several times\n\nArchive.global.put(\\myData, q);\n\n\nArchive.global.at(\\myData).postcs;\n\n// after a recompile:\ns.boot;\n\nq = Archive.global.at(\\myData);\nq.postcs;\nq[\\favourite_sound].value;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `PLIdev` in SuperCollider briefly."}, {"role": "assistant", "content": "PLIdev — dynamic scope pattern searching for numbers with integer distance from a source pattern, optionally avoiding repetitions within a span DIdev / PIdef / PLIdev search for numbers with integer distance from a source signal / pattern up to a given deviation. Repetitions within a lookback span are avoided, DIdev / PIdef / PLIdev randomly choose from possible solutions. Intended for search within integer grids (pitches, indices etc.), however applications with non-integer sources are possible, see examples. Category: Libraries > miSCellaneous > Other patterns, Libraries > miSCellaneous > Idev suite."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `StandardN`."}, {"role": "assistant", "content": "```supercollider\n// vary frequency\n{ StandardN.ar(MouseX.kr(20, SampleRate.ir)) * 0.3 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `DetectSilence.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Detect when input falls below an amplitude threshold Arguments: in — The input signal.; amp — When input falls below this for long enough, evaluate `doneAction` .; time — The minimum duration for which input must fall below `amp` before this triggers.; doneAction — An integer representing the doneAction. See. Returns: This UGen outputs 1 if silence is detected, otherwise 0."}]} +{"conversations": [{"role": "user", "content": "What does `SeenBefore.reset` do?"}, {"role": "assistant", "content": "eliminates duplicates by saving a history of objects it has tested"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for UI sounds (pt1): bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n// UI sounds\n// this code is an attempt to recreate a sound\n// inspired from some technological/electrical UI interface\n\n// 1. first define the synth\n// Here we are using the FM technique\n(\nSynthDef(\\fmmod, {\n |\n amp=0.2,\n fc=1000,\n fm = 100,\n idx = 100,\n atk=0.01,\n rls=0.1\n |\n var env = EnvGen.ar(Env.perc(atk, rls), doneAction:2);\n var modulator = SinOsc.ar(fm);\n var carrier = SinOsc.ar(fc + (idx*modulator) );\n var sig = carrier * env * amp;\n sig = HPF.ar(sig, 1000);\n Out.ar(0, sig!2);\n}).add;\n);\n\n// 2. then define the Pbind which will play the sequence\n// of UI sounds simulating variuos characters showing up on an\n// imaginary display.\n// Play around FC, FM, ATK and RLS to obtain different sound characters.\n(\np = Pbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 100,\n \\idx, 100,\n \\amp, 0.6,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).asEventStreamPlayer;\n);\n\n// 3. play it\np.play;\n\n// 4. Here are some presets\n\n// \"cricket\" preset\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 100,\n \\idx, 100,\n \\amp, 0.6,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 2\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 1000,\n \\idx, 100,\n \\amp, 0.6,\n \\atk, 0.001,\n \\rls, 0.01,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 3\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 100,\n \\idx, 10,\n \\amp, 0.4,\n \\atk, 0.01,\n \\rls, 0.01,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 4\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 1000,\n \\fm, 100,\n \\idx, 1000,\n \\amp, 0.2,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n\n// preset 5\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 5000,\n \\fm, 1000,\n \\idx, 1000,\n \\amp, 0.4,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 5\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 8000,\n \\fm, 1000,\n \\idx, 1000,\n \\amp, 0.7,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "In what order should I learn SuperCollider?"}, {"role": "assistant", "content": "The order that pays off fastest:\n\n1. **One UGen and Out** — `{ SinOsc.ar(440) * 0.2 }.play`. Learn that a graph must reach Out.\n2. **Envelopes and doneAction** — the difference between a sound and a click.\n3. **SynthDef and Synth** — naming a graph, controlling it with arguments, freeing it with a gate.\n4. **Patterns** — `Pbind` for sequence, so you stop writing loops by hand.\n5. **Buses and effects** — chaining, sends, groups.\n6. **JITLib** — Ndef for patches you modify while they play.\n\nVocabulary to carry: UGen, SynthDef, Synth, bus, group, envelope, gate, doneAction, Pattern, clock. Every\nconfusion in SuperCollider tends to be one of those words."}]} +{"conversations": [{"role": "user", "content": "What does `UChain.dispose` do?"}, {"role": "assistant", "content": "Calls .dispose on each unit. This will dispose of Buffers or other resources"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Kepler 22-b atmosphere. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\nfork { \n Ndef(\\ttwnd).play;//(d,2,addAction:\\addToHead);\n loop {\n var seed = thisThread.randSeed = 100000000.rand.debug('seed');\n Ndef(\\ttwnd, {\n var freq = [20, 7500];\n Splay.ar(\n { \n var bands = 2.rrand(10);\n var sig = { [BPF,RLPF,RHPF].choose.ar(\n LFNoise2.ar(freq[0].rrand(freq[1]), LFNoise2.kr(0.1.exprand(10))),\n Array.rand(bands, freq[0], freq[1]),\n Array.rand(bands, 0.2, 1.8)\n ).mean } ! 2;\n Rotate2.ar(sig[0], sig[1], LFSaw.kr(0.1.exprand(10)));\n } ! 4.rrand(6).debug('source'),\n 0.5.rrand(1)\n );\n }).fadeTime_(1.rrand(4.0));\n 10.0.rrand(40).debug('wait(bts)').wait;\n }\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nRoutine({ loop { Synth(\\kick); 0.5.wait } }).play;\n```"}, {"role": "assistant", "content": "It starts a kick every half second, forever.\n\nA Routine is a language-side coroutine: `.play` runs it on the clock, and `wait` suspends it until the next\nbeat without blocking anything else. Inside the `loop`, `Synth(\\kick)` creates a kick and `0.5.wait` waits\nhalf a beat on the current TempoClock — the tempo, not seconds, so changing the clock changes the rate.\nBecause the kick SynthDef frees itself with `doneAction: 2`, the loop can run for hours without leaking\nnodes."}]} +{"conversations": [{"role": "user", "content": "Resetting start count with PulseDivider?"}, {"role": "assistant", "content": "SuperCollider forum — Resetting start count with PulseDivider?\n\ni think in your example Sweep is receiving a trigger while going from 0 to 1 causing the discontinuity in the phase because the duration between one trigger and the next is unknown.\n\nwith this example you get at least a continiuous phase with random triggers to drive the hanning window (evaluate it several times). but its not multichannel with distributed phases / windows accross channels:\n\n```supercollider\n(\nvar randomTrigPhase = { |triggerRate = 10, randomness = 1|\n var minDuration = (2 ** randomness) / triggerRate;\n var maxDuration = (2 ** (-1 * randomness)) / triggerRate;\n var demand = Dunique(minDuration * ((maxDuration / minDuration) ** Dwhite(0, 1)));\n var duration = Duty.ar(demand, DC.ar(0), demand);\n var phase = Phasor.ar(DC.ar(0), (1 / duration) / SampleRate.ir, 0, 1);\n (phase: phase, trigger: HPZ1.ar(phase) < 0);\n};\n\nvar hanningWindow = { |phase|\n (1 - (phase * 2pi).cos) / 2 * (phase < 1);\n};\n\n{\n var rate = 100;\n var phase = randomTrigPhase.(rate, 1).phase;\n hanningWindow.(phase);\n}.plot(0.1);\n)\n```\n\nim not sure if this is helping it just reminded me of some issue with multichannel random triggers and continiuous phases i have been trying to solve."}]} +{"conversations": [{"role": "user", "content": "What is `InterplPairs` in SuperCollider?"}, {"role": "assistant", "content": "InterplPairs — envelope specification Takes an array of [x, y] pairs and a curve value for all break points. x values can be negative (for use in indexing with negative values or signals). See InterplEnv Help for more info. Category: Control, Envelopes."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// the following two lines produce equivalent results\n{ SinOsc.ar(440, 0, 0.3) }.play(fadeTime: 0.0);\nSynthDef(\\help_FuncPlay, { Out.ar(0, SinOsc.ar(440, 0, 0.3)) }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// the following two lines produce equivalent results\n{ SinOsc.ar(440, 0, 0.3) }.play(fadeTime: 0.0);\nSynthDef(\\help_FuncPlay, { Out.ar(0, SinOsc.ar(440, 0, 0.3)) }).play;\n```"}]} +{"conversations": [{"role": "user", "content": "What are the arguments of EnvGen?"}, {"role": "assistant", "content": "`EnvGen.ar(envelope, gate, levelScale, levelBias, timeScale, doneAction)` — or the .kr form. Envelope is an Env; gate is the signal that holds the envelope open (a number for a one-shot, a trigger or gate control for a sustained sound); levelScale and levelBias scale and offset the output; timeScale stretches durations. Use `doneAction: 2` on a one-shot so the Synth frees itself."}]} +{"conversations": [{"role": "user", "content": "How do I put reverb on everything?"}, {"role": "assistant", "content": "Send it: one private bus, one FreeVerb instance reading it, and every instrument writing dry to the master and wet to the bus.\n\n```supercollider\n~verb = Bus.audio(s, 2);\nSynthDef(\\verb, { |in = 0| Out.ar(0, FreeVerb.ar(In.ar(in, 2), 0.5, 0.85, 0.5) * 0.7) }).add;\nSynth(\\verb, [\\in, ~verb]);\n```"}, {"role": "user", "content": "Too much reverb now."}, {"role": "assistant", "content": "Lower the wet mix and the return level, not the room size: the room is what makes it sound like a space, the mix is how much of it you hear. `FreeVerb.ar(In.ar(in, 2), 0.25, 0.85, 0.5) * 0.5`. To change it live without restarting, add a control and `.set` it: `|mix = 0.5|` then `~verbSynth.set(\\mix, 0.25)`."}]} +{"conversations": [{"role": "user", "content": "What does `String.underlined` do?"}, {"role": "assistant", "content": "Return this string followed by dashes in the next line (`-`)."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `DiskIn`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n\n\n// create with cueSoundFile class method\nb = Buffer.cueSoundFile(s, ExampleFiles.apollo11, 0, 1);\nx = { DiskIn.ar(1, b) }.play;\nb.close; // must call close in between cueing\n// now use like named instance method, but different arguments\nb.cueSoundFile(ExampleFiles.apollo11);\n// have to do all this to clean up properly!\nx.free; b.close; b.free;\n```"}]} +{"conversations": [{"role": "user", "content": "How do I pan notes around the stereo field in a pattern?"}, {"role": "assistant", "content": "Put `\\pan` in the Pbind: the default instrument understands it and passes it to Pan2.\n\n```supercollider\n(\nPbind(\n \\scale, Scale.minorPentatonic,\n \\degree, Pseq([0, 2, 4, 7, 9, 7, 4, 2], inf),\n \\dur, 0.2,\n \\pan, Pseq([-1, -0.5, 0, 0.5, 1, 0.5, 0, -0.5], inf),\n \\amp, 0.15\n).play;\n)\n```\n\nTo pan an arbitrary synth, add a `pan = 0` argument to the SynthDef and wrap the output in\n`Pan2.ar(sig, pan)`."}]} +{"conversations": [{"role": "user", "content": "Write a filter sweep over a saw."}, {"role": "assistant", "content": "An LFO on the cutoff of a resonant low-pass; XLine or an LFO both work, the LFO is the loopable one.\n\n```supercollider\n{ LPF.ar(Saw.ar([60, 60.2]), SinOsc.kr(0.2).exprange(150, 4000), 0.4) * 0.2 }.play;\n```\n\n`.exprange` is the exponential mapping you want for frequency; a linear `.range` sweep sounds uneven."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `AnalogIn`."}, {"role": "assistant", "content": "```supercollider\n// modulate frequency of a sine oscillator\n\n(\nSynthDef(\"help-AnalogIn\", { |out = 0|\n Out.ar(out,\n SinOsc.ar(AnalogIn.ar(0).exprange(200, 5000), 0, 0.1)\n )\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `FoaThetaPhiR` in SuperCollider?"}, {"role": "assistant", "content": "FoaThetaPhiR — First Order Ambisonic (FOA) Azimuth & Elevation of Soundfield Reactive Intensity Vector Return the Azimuth & Elevation of Reactive Intensity Vector of a first order ambisonic (B-format) signal. Category: Libraries > Ambisonic Toolkit > UGens > FOA > Analyzer, UGens > Multichannel > Ambisonics, UGens > Analysis > Ambisonics."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n// timing offset = 0\np = Pbind(\\freq, 440, \\pan, -1, \\delta, 1.0, \\sustain, 0.1).play(quant: [2, 0, 0]);\n// timing offest = 0.1\nq = Pbind(\\freq, 880, \\pan, 1, \\delta, 0.5, \\sustain, 0.1).play(quant: [2, 0, 0.1]);\n);\n\n// p's nextBeat is x.0 - q's is x.4 or x.9 (e.g., halves of a beat minus 0.1)\n[p.nextBeat, q.nextBeat]\n\np.stop; q.stop;\n```"}, {"role": "assistant", "content": "timing offest = 0.1 p's nextBeat is x.0 - q's is x.4 or x.9 (e.g., halves of a beat minus 0.1) (Quant: encapsulate quantization issues associated with EventStreamPlayer and TempoClock)"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LFDClipNoise`."}, {"role": "assistant", "content": "```supercollider\n// try wiggling the mouse quickly;\n// LFNoise frequently seems stuck, LFDNoise changes smoothly.\n\n{ LFClipNoise.ar(MouseX.kr(0.1, 1000, 1), 0.1) }.play\n\n{ LFDClipNoise.ar(MouseX.kr(0.1, 1000, 1), 0.1) }.play\n\n// silent for 2 secs before going up in freq\n\n{ LFClipNoise.ar(XLine.kr(0.5, 10000, 3), 0.1) }.scope;\n\n{ LFDClipNoise.ar(XLine.kr(0.5, 10000, 3), 0.1) }.scope;\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFClipNoise.ar(XLine.kr(1000, 20000, 10), 0.1) }.scope;\n\n{ LFDClipNoise.ar(XLine.kr(1000, 20000, 10), 0.1) }.scope;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// distorts of course - would need scaling\n{ RunningSum.ar(SoundIn.ar) }.play\n\n// Running Average over x samples\n(\n{\n var x = 100;\n RunningSum.ar(LFSaw.ar, x) * (x.reciprocal)\n }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// distorts of course - would need scaling\n{ RunningSum.ar(SoundIn.ar) }.play\n\n// Running Average over x samples\n(\n{\n var x = 100;\n RunningSum.ar(LFSaw.ar, x) * (x.reciprocal)\n }.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `LinRand` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-LinRand\", { |out = 0, minmax = 1|\n Out.ar(out,\n FSinOsc.ar(\n LinRand(200.0, 10000.0, minmax),\n 0, Line.kr(0.2, 0, 0.01, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n// towards hi\n(\nRoutine({\n loop({\n Synth.new(\"help-LinRand\"); 0.04.wait;\n })\n}).play;\n);\n\n// towards lo (doesn't work like that yet)\n(\nRoutine({\n loop({\n Synth.new(\"help-LinRand\", [\\minmax, -1]); 0.04.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `BlitB3.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Band limited impulse generation Arguments: freq."}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for exploring of morphing cycled envelopes (i.e: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\ro_v19, {\n var freq = 40.rrand(90).debug('base freq');\n var seed = thisThread.randSeed = 1000000000.rand.debug('seed');\n var gen = [LFNoise2,LFNoise0,SinOsc,LFPulse,LFSaw];\n var sig = Splay.ar({\n var i = 4.exprand(40).asInteger;\n Median.ar(\n 3.exprand(18),\n EnvGen.ar(\n Env( // wave form\n [0] ++ Array.fill(i-1, { \n gen.choose.kr(\n 0.25.coin.if({ gen.choose.kr(0.01.exprand(0.1)).exprange(0.1,1) }, { 0.1.exprand(1) }), \n mul: 0.25.coin.if({ gen.choose.kr(0.05.exprand(10)).range(0.1,1) }, { 0.1.rrand(1) })\n )\n }) ++ [0],\n Array.rand(i-1, 0.1,1.0).normalizeSum,\n [[-5.0.rrand(5),\\sin].choose] ++ Array.fill(i-2, {\n [\\sin ! 1.rrand(6), -5.0.rrand(5) ! 1.rrand(4)].flat.choose\n }) ++ [[-5.0.rrand(5),\\sin].choose]\n ).circle,\n timeScale: Duty.kr( // freq\n Drand([4,8,16,24], inf), 0,\n Dwrand([1,2,4,8,16,32,64]*freq, ((14..7) ** 1.rrand(3)).normalizeSum, inf) // octave\n * 0.75.coin.if({ Duty.kr( // note\n [Dxrand, Drand].choose.new([0.125,0.25,0.5,1,2,4,6,8,12], inf), 0,\n Dshuf({ (0..11).choose.midiratio } ! 1.exprand(8), inf)\n ) }, { (0..11).choose.midiratio })\n ).reciprocal\n )\n ) * EnvGen.kr( // rhythm\n Env.perc(\n 0.01.exprand(0.4) * 0.25.coin.if({ Duty.kr( // atk\n Drand([0.5,1,2,4,8,12,16], inf), 0,\n Dshuf({ [1,2,3,4].choose } ! 1.exprand(8), inf)\n ) }, { 1 }),\n 0.1.exprand(4) * 0.75.coin.if({ Duty.kr( // release\n Drand([0.5,1,2,4,8,12,16], inf), 0,\n Dshuf({ [1,2,4,8,16].choose.reciprocal } ! 1.exprand(8), inf)\n ) }, { 1 }),\n LFNoise2.kr(0.1.exprand(10)).range(0.05,1), // appearance\n LFNoise2.kr(0.1.exprand(10)).range(-4,4),\n ).circle\n );\n } ! 3.rrand(9).debug('source'));\n BHiShelf.ar(\n GVerb.ar(\n Rotate2.ar(sig[0], sig[1], Duty.kr(Drand([2,4,8],inf), 0, Drand([-1,1,0],inf)) * LFSaw.kr(0.1.exprand(1))),\n 40.rrand(150).debug('room')\n ),\n LFNoise2.kr(0.1.exprand(0.5)).range(4000,6500),\n LFNoise2.kr(0.1.exprand(1)).range(1,3),\n LFNoise2.kr(0.1.exprand(1)).range(-24,-16)\n );\n}).play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for little experiment with periodicity: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n/* An little experiment with periodicity. \n Maybe there can be some sync artifact...\n */\n\ns.boot;\n\nSynthDef(\\mallet,{arg in=0,out=0,f=0,f2=0,a=0.1,r=1.8;\n\n var sig=Array.fill(3,{|n| SinOsc.ar(f*(n+1),mul:a/(n*n+1))}).sum;\n var env=EnvGen.kr(Env.perc(0.001,r),gate:Impulse.kr(f2),doneAction:0);\n\nOut.ar(out,sig*env!2);\n};\n).add;\n\n~root=60;\n~degrees=[0,4,5,7,9,12,16,17,19,21].scramble;\n~num=10;\n~coeff=0.75;\n\nArray.fill(~num,{|n| Synth.new(\\mallet,[\\f:(~root +~degrees[n]).midicps,\\a:0.2/~num,\\f2:(1+(n*~coeff))*0.1])});\n\ns.quit;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `StreamSpec.minval` do?"}, {"role": "assistant", "content": "datatype specifying that the input or output is stream or pattern"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Blip.ar(Latch.ar(WhiteNoise.ar, Impulse.ar(9)) * 400 + 500, 4, 0.2 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Blip.ar(Latch.ar(WhiteNoise.ar, Impulse.ar(9)) * 400 + 500, 4, 0.2) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ LPF.ar(Saw.ar(100), SinOsc.kr(0.5).exprange(200, 2000)) * 0.2 }.play;\n```"}, {"role": "assistant", "content": "A sawtooth through a low-pass filter whose cutoff is swept slowly up and down — a classic filter\nsweep.\n\n- `Saw.ar(100)` is a 100 Hz sawtooth, rich in harmonics.\n- `SinOsc.kr(0.5)` is a control-rate sine at 0.5 Hz, so one full cycle takes 2 seconds.\n- `.exprange(200, 2000)` maps that -1..1 sine exponentially onto 200..2000 Hz — exponential is the right\n mapping for frequency, because we hear pitch logarithmically.\n- `LPF.ar(sig, cutoff)` removes harmonics above the cutoff; as it opens and closes you hear the tone\n brighten and darken.\n- `* 0.2` keeps the output from clipping."}]} +{"conversations": [{"role": "user", "content": "What does `UpdatingScalarPatchOut.control` do? What arguments does it take?"}, {"role": "assistant", "content": "utility for connecting NumberEditor > Synth Arguments: controlPatchIn; needsValueSetNow."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `AbstractFunction`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\na = { |x| #[440, 720, 801, 1020.2].at(x) }; b = a.cpsmidi; [a.value(3), b.value(3)];\na = Pseries(220, 220, inf).cpsmidi; a.asStream.nextN(12); // overtone series as midinotes\n// follow but round to next midinote\n{ a = Pitch.kr(SoundIn.ar).at(1); Pulse.ar(a.cpsmidi.round.midicps) * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Server-side sequencing (a SuperCollider snippet) that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n(\nf = { |f0=200, rate=4|\n {\n var seq = Dseq(f0*[1/2,3/4, Dstutter(4, Drand([1/2,1,2,3,4,5,6],1)), 2,3/2,3,4/3], inf);\n var trig = Impulse.ar(rate);\n var freq = Demand.ar(trig,0, seq);\n var env = Decay2.ar(trig,1e-3,1);\n FreeVerb.ar(\n Splay.ar(SinOsc.ar(freq*[0.995, 1, 1.005]).fold(-0.995,0.995)*0.25*env),\n 0.5,\n 0.5\n );\n }\n};\n\nfork{ 4.do{\n fork{\n f.(100,2).play;\n (1/8).wait;\n f.(200,4).play;\n (1/4).wait;\n f.(100*4/3,8).play;\n (1/2).wait;\n f.(400,4).play;\n };\n (1/4).wait;\n}}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `BHiShelf` in SuperCollider?"}, {"role": "assistant", "content": "BHiShelf — Hi Shelf The B equalization suite is based on the Second Order Section (SOS) biquad UGen. Category: UGens > Filters > BEQSuite."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// hand code a mono signal to a decorrelated soundfield in B-format\n// NOTE: the demonstrated kernel is not ideal for this task\n\n// define encoding kernel\n(\nvar kernelSize;\nvar scale;\n\nkernelSize = 256;\nscale = 24.neg.dbamp;\n\n~kernel = [[\n Buffer.loadCollection(s, FloatArray.fill(kernelSize, {(3/2).sqrt * scale.rand2})),\n Buffer.loadCollection(s, FloatArray.fill(kernelSize, {scale.rand2})),\n Buffer.loadCollection(s, FloatArray.fill(kernelSize, {scale.rand2})),\n Buffer.loadCollection(\n// …\n```"}, {"role": "assistant", "content": "hand code a mono signal to a decorrelated soundfield in B-format NOTE: the demonstrated kernel is not ideal for this task (AtkKernelConv: Kernel convolution from the Ambisonic Toolkit (ATK))"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Resonz`."}, {"role": "assistant", "content": "```supercollider\n{ Resonz.ar(WhiteNoise.ar(0.5), 2000, 0.1) }.play\n\n// modulate frequency\n{ Resonz.ar(WhiteNoise.ar(0.5), XLine.kr(1000, 8000, 10), 0.05) }.play\n\n// modulate bandwidth\n{ Resonz.ar(WhiteNoise.ar(0.5), 2000, XLine.kr(1, 0.001, 8)) }.play\n\n// modulate bandwidth opposite direction\n{ Resonz.ar(WhiteNoise.ar(0.5), 2000, XLine.kr(0.001, 1, 8)) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n// indexing with a phasor\n{ BufRd.ar(1, b, Phasor.ar(0, BufRateScale.kr(b), 0, BufFrames.kr(b))) }.play;\n\n// indexing by hand\n{ BufRd.ar(1, b, K2A.ar(MouseX.kr(0, BufFrames.kr(b))) }.play;\n\nb.free\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n// indexing with a phasor\n{ BufRd.ar(1, b, Phasor.ar(0, BufRateScale.kr(b), 0, BufFrames.kr(b))) }.play;\n\n// indexing by hand\n{ BufRd.ar(1, b, K2A.ar(MouseX.kr(0, BufFrames.kr(b)))) }.play;\n\nb.free\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(// * //watch the postWindow\na=[\"m\",\"x\",\"f\",\"k\",\"d\",\"p\"];\nx=Array;\ny=x.newClear(6);\n~mxfkdp=Task({\n inf.do({y.put(x.series(6,0,1).choose,a.scramble).postln;\n 0.03.wait;})}).play;\nm=fork({inf.do({\n \"array num:\".postcln;\n if(y[x.series(6,0,1).choose.postcln]==a,\n {\"lo encontraste!/found it!\".postcln;\n 1.do({GVerb.ar(\n EnvGen.ar(Env.perc(0.01,8),1,doneAction:2)*\n Blip.ar(XLine.kr(440,1600,8)),50,10,0.02)}.play);\n ~mxfkdp.stop;\n m.stop;}, \n {\"buscando.../seeking...\".postcln;});\n 0.03.wait})});\n);\n//.SCtweetLong\n```"}, {"role": "assistant", "content": "this code throws a scrambled array of arrays seeking among them for the original array,\r\nIt only sounds when it founds it. (may take a while)\r\nthe idea started trying a SCtweet, but became with this funny code!."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n var time = 0.23;\n var freq = (55).midicps;\n var a = VarSaw.ar(freq/2, width: XLine.ar(0.5,1,time)).range(0,XLine.ar(0.666,1/666,time));\n var tone = SinOsc.ar(freq).fold(-0.23*a,a) * EnvGen.ar(Env([1,0],[time]));\n Out.ar(0, tone.dup);\n}.play;\n)\n```"}, {"role": "assistant", "content": "Seekers are something you should avoid.\r\nI put this code through Rakarrack to get some samples for heXon.\r\nheXon is a FOSS dual stick arcade shooter available at www.LucKeyProductions.nl."}]} +{"conversations": [{"role": "user", "content": "How do I get a Euclidean-style rhythm in SuperCollider?"}, {"role": "assistant", "content": "Describe the pattern as a list of hits and rests; `Rest` gives the gap without starting a Synth.\n\n```supercollider\n(\nPbind(\n \\instrument, \\hat,\n \\dur, 0.125,\n \\amp, Pseq([0.3, 0, 0, 0.3, 0, 0.3, 0, 0], inf).collect { |x| x + 0.001 }\n).play;\n)\n```\n\nFor real Euclidean generation use `Pseq([1,0,0,1,0,1,0,0], inf)` on a duration multiplier and wrap rests\nwith `Rest`, or compute the pattern with `bjorklund`-style logic in a Function and `Pseq` the result."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BusPlug`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\nz = Bus.control(s, 16);\nz.setn({ |i| (i * 5).nthPrime } ! 16 * 5 + 100);\na = BusPlug.for(z);\n{ Splay.ar(SinOsc.ar(a.kr(3, MouseX.kr(0, 25)))) * 0.1 }.play; // selectively play 3 channel of the 16, modulate offset\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for gabber kick (a SuperCollider snippet) that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\gabberkick, {\n var snd;\n snd = SinOsc.ar(Env([1000, 69, 60], [0.015, 0.1], \\exp).ar * [-0.1, 0, 0.1].midiratio);\n snd = Mix(snd);\n snd = (snd * 10).tanh;\n snd = (snd * 5.1).atan;\n snd = BPeakEQ.ar(snd, XLine.kr(2000, 100, 0.3), 2.0, 8);\n snd = snd + DelayC.ar(snd, 0.01, SinOsc.ar(4).range(0.0, 0.001));\n snd = RLPF.ar(snd, 8000, 0.7);\n snd = snd * Env([0, 1, 0.7, 0.7, 0], [0.001, 0.01, 0.3, 0.02]).ar(2);\n snd = (snd * 0.6).clip(-1, 1);\n Out.ar(\\out.kr(0), Pan2.ar(snd, \\pan.kr(0), \\amp.kr(0.1)));\n}).add;\n);\n\nSynth(\\gabberkick, [amp: 0.6])\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `BufCombN` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// These examples compare the variants, so that you can hear the difference in interpolation\n\n// allocate buffer\nb = Buffer.alloc(s, 44100, 1);\n\n// Comb used as a resonator. The resonant fundamental is equal to\n// reciprocal of the delay time.\n{ BufCombN.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ BufCombL.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ BufCombC.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// with negative feedback:\n{ BufCombN.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ BufCombL.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ BufCombC.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n// used as an echo.\n{ BufCombC.ar(b.bufnum, Decay.ar(Dust.ar(1, 0.5), 0.2, WhiteNoise.ar), 0.2, 3) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `ArrayedCollection` in SuperCollider briefly."}, {"role": "assistant", "content": "ArrayedCollection — Abstract superclass of Collections of fixed maximum size `ArrayedCollection` is an abstract class, a subclass of SequenceableCollection whose items are held in a vector of slots, indexable by a SimpleNumber starting from 0. If a float is used as index, it will be truncated. Instances of `ArrayedCollection` have a fixed maximum size beyond which they may not grow. Category: Collections > Ordered."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LPF`."}, {"role": "assistant", "content": "```supercollider\n{ LPF.ar(Saw.ar(200, 0.1), SinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3600, 4000)) }.play;\n\n// kr:\n(\n{ var ctl = LPF.kr(LFPulse.kr(8), SinOsc.kr(XLine.kr(1, 30, 5)) + 2);\n SinOsc.ar(ctl * 200 + 400)\n}.play;\n);\n\n(\n{ var ctl = LPF.kr(LFPulse.kr(8), MouseX.kr(2, 50, 1));\n SinOsc.ar(ctl * 200 + 400)\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Instr.objectAt` do? What arguments does it take?"}, {"role": "assistant", "content": "An enhanced version of SynthDef with a library Arguments: name."}]} +{"conversations": [{"role": "user", "content": "Speech to midi converter?"}, {"role": "assistant", "content": "SuperCollider forum — Speech to midi converter?\n\nHello!\n\nI want to make a speech to midi converter in Supercollider.\n\nI’ve started off trying to find a way to convert FFT data to midi-numbers to send to a midi-instrument, but I’m stuck:\n\n```supercollider\n~file = Buffer.read(s, \"path_to_file\", bufnum:1);\n\n(\n{\n var buf = Buffer.alloc(s, 2048, bufnum:2);\n var sig = PlayBuf.ar(2, 1, loop:1);\n var chain = FFT(buf, sig);\n var trig = Impulse.kr(30);\n chain[0].pvcalc(80, {\n |phas, mag|\n SendReply.kr(trig, \"/anal\", mag);\n });\n}.play\n);\n\n(\nOSCdef.new(\\midiConverter, {\n |msg|\n msg.postln;\n}, \"/anal\");\n)\n```\n\nthe output looks like this:\n\n[ /anal, 1000, -1, 0.0, 3.0463190078735, 2.1142015457153, -0.64955651760101, 2.3432319164276, -0.23956227302551, -3.1334409713745, -2.1829152107239, 1.1417833566666, -2.2972648143768, -0.74415707588196, -0.88793164491653, 1.9947071075439, -1.1327115297318, 2.6084003448486, etc...]\n\nI’m not sure how to interpret theese numbers. And I’m not sure pvcalc is even the best way to get the data I need. I want to somehow be able to control the resolution on how many of the loudest bins I’m going to convert to frequency and then from frequency to midi-number to send to a midi-instrument as the soundfile plays through.\n\nAny ideas?"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Pfsm` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n(\na = Pfsm([\n #[0, 1],\n 67, #[0, 0, 3],\n 72, #[2],\n 73, #[0, 2],\n Pseq([74, 75, 76, 77]), #[2, 3, 3],\n nil, nil\n ], inf).asStream;\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, a.next.midicps]);\n 0.1.wait;\n })\n}).play;\n);\n\n(\nPfsm([\n #[5, 6, 7], // entry states\n\n // e1 (== state 0)\n Pbind(\\dur, Pseq([1/8, 3/8]), \\midinote, Pseq([86, 75])),\n // #[1], // as given in CMJ\n // my de-boredom-ated version..\n #[1, 1, 1, 1, 1, 1, 1, 8],\n // e2 (== state 1)\n Pbind(\\dur, 1/2, \\midinote, Pseq([69])),\n #[0, 1],\n // e3 (== state 2)\n Pbind(\\dur, 1/3, \\midinote, Pseq([55, 60, 66])),\n #[0, 1, 2, 2, 2, 2, 3, 3, 3, 3],\n // e4 (== state 3)\n Pbind(\\dur, 1/4, \\midinote, Pseq([81, 80, 77, 76])),\n #[1, 4, 4, 4, 4],\n // e5 (== state 4)\n Pbind(\\dur, Pseq([1, 2/3, 2/3, 2/3, 1]), \\midinote, Pseq([\\, 70, 70, 70, \\])),\n #[2, 3],\n // e6 (== state 5)\n Pbind(\\dur, 1/4, \\midinote, Pseq([59, 61])),\n #[0, 2, 4, 5, 5, 5, 5, 5, 5, 5],\n // e7 (== state 6)\n Pbind(\\dur, 1/4, \\midinote, Pseq([87, 88], 2)),\n #[4, 4, 4, 4, 6, 6, 6, 7, 7, 7],\n // e8 (== state 7)\n Pbind(\\dur, 1, \\midinote, Pseq([56])),\n #[1, 3, 6, 6, 6],\n // terminal state\n nil, nil\n]).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Formant`."}, {"role": "assistant", "content": "```supercollider\n// modulate fundamental frequency, formant freq stays constant\n{ Formant.ar(XLine.kr(400, 1000, 8), 2000, 800, 0.125) }.play\n\n// modulate formant frequency, fundamental freq stays constant\n{ Formant.ar(200, XLine.kr(400, 4000, 8), 200, 0.125) }.play\n\n// modulate width frequency, other freqs stay constant\n{ Formant.ar(400, 2000, XLine.kr(800, 8000, 8), 0.125) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "How should I organise a SuperCollider project on disk?"}, {"role": "assistant", "content": "One folder per piece, with a fixed shape:\n\n```text\nmy-piece/\n synthdefs.scd // only SynthDef(...).add, loaded first\n material.scd // buffers, samples, scales\n piece.scd // the performance: Tdefs, Pbinds, Ndefs\n README.md // tempo, required samples, how to run it\n```\n\nThen the workflow is: open `synthdefs.scd`, Ctrl+A Ctrl+Enter to load it, load `material.scd`, and work in\n`piece.scd`. Keeping definitions out of the performance file is what makes a reboot survivable and a piece\nre-runnable six months later."}]} +{"conversations": [{"role": "user", "content": "What does `LevelIndicator.style` do? What arguments does it take?"}, {"role": "assistant", "content": "Sets the style of the Arguments: val — An QLevelIndicatorStyle \\continuous or \\led (see #-stepWidth) `(`."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Bus`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\nb = Bus(\\audio, 0, 2);\ns.bind {\n SynthDef(\\sinPerc, { |out = 0|\n var signal = SinOsc.ar * Env.sine(0.1).ar(gate: Impulse.ar(2));\n OffsetOut.ar(out, signal ! 2) }\n ).add;\n s.sync;\n Synth(\\sinPerc, [\\out, b]);\n b.plot(1);\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Buffer.sine3` do? What arguments does it take?"}, {"role": "assistant", "content": "Fill this buffer with a series of sine wave partials using specified frequencies, amplitudes, and initial Arguments: freqs — An Array containing frequencies (in cycles per buffer) for the partials.; amps — An Array containing amplitudes for the partials. This should contain the same number of items as freqs.; phases — An Array containing initial phase for the partials (in radians). This should contain the same number of items as freqs.; normalize — A Boolean indicating whether or not to normalize the buffer to a peak value of 1.0. The default is true.; asWavetable — A Boolean indicating whether or not to write to the buffer in wavetable format so that it can be read by interpolating oscillators. The default is true.; clearFirst — A Boolean indicating whether or not to clear the buffer before writing. The default is true.."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nMIDIIn.connectAll;\n// MIDIClient.init;\n\n\n(\n// A SynthDef with ADSR envelope\nSynthDef(\"quick2\", {arg freq = 440, amp = 0.1, gate = 1;\n var snd, env;\n env = Env.adsr(0.01, 0.1, 0.3, 2, amp).kr(2, gate);\n snd = Saw.ar(freq: [freq, freq*1.5], mul: env);\n Out.ar(0, snd)\n}).add;\n);\n\n// Play it with a MIDI keyboard\n(\nvar noteArray = Array.newClear(128); // array has one slot per possible MIDI note\n\nMIDIdef.noteOn(\\myKeyDown, {arg vel, note;\n noteArray[note] = Synth(\"quick2\", [\\freq, note.midicps, \\amp, vel.linlin(0, 127, 0, 1)]);\n [\"NOTE ON\", note].postln;\n});\n\nMIDIdef.noteOff(\\myKeyUp, {arg vel, note;\n noteArray[note].set(\\gate, 0);\n [\"NOTE OFF\", note].postln;\n});\n)\n// PS. Make sure SC MIDI connections are made (MIDIIn.connectAll)\n```"}, {"role": "assistant", "content": "Basic example - how to use a MIDI keyboard with a simple synth."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for simple smooth arp. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\smooth, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.linen(0.05, sustain, 0.1), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Object.performMsg` do?"}, {"role": "assistant", "content": "The argument must be a List or Array whose first element is a Symbol representing a method selector. The remaining elements are unpacked and passed as arguments to the method named by the selector. `a = { |a, b, c| postf(\"% plus % plus % is %\\n\", a, b, c, a"}]} +{"conversations": [{"role": "user", "content": "What is `Tdef`?"}, {"role": "assistant", "content": "Tdef — task reference definition"}, {"role": "user", "content": "What does `Tdef.all` do?"}, {"role": "assistant", "content": "A global IdentityDictionary with all proxies."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nTdef(\\x, { loop { 0.5.wait; \"aaaaaaaaaaaaaazz\".scramble.postln } }).play;\nTdef(\\x, { loop { 0.125.wait; \"aazz\".scramble.postln } });\nTdef(\\x, { loop { 0.5.wait; (note: 14.rand).play } });\nTdef(\\x, { loop { 0.5.wait; (note: 14.rand + [0, 3, 6, 7].keep(4.rand)).play } });\nTdef(\\x).stop;\nTdef(\\x).play;\nTdef(\\x).clear;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\ns.scope;\na = { HilbertFIR.ar(SinOsc.ar(100) * -20.dbamp, LocalBuf(2048) }.play;\na.release;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\ns.scope;\na = { HilbertFIR.ar(SinOsc.ar(100) * -20.dbamp, LocalBuf(2048)) }.play;\na.release;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `IdentityDictionary`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_sinegrain, { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0.5pi, env))\n}).add;\n\na = Pbind(\\instrument, \\help_sinegrain, \\note, Pseq([0, 7, 2, 9, 11, 10, 9, 8], inf), \\dur, 1);\na.play(quant: (quant: 1, phase: 0));\na.play(quant: (quant: 1, phase: 1/3));\na.play(quant: (quant: 1, phase: 1.0.rand));\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\Mirror;\n~description = \"Mirror soundfield\";\n\n~function = {|in = 0, order = 1, mirrorFrontBack = 0, mirrorLeftRight = 0, mirrorUpDown = 0 |\nHOATransMirror.ar(order, in, mirrorFrontBack, mirrorLeftRight, mirrorUpDown);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "What is `Nil`?"}, {"role": "assistant", "content": "Nil — Represents uninitialized data"}, {"role": "user", "content": "What does `Nil.isNil` do?"}, {"role": "assistant", "content": "Answers true because this is nil. In class Object this message is defined to answer false. `[1, 2, nil, 3].collect(_.isNil);`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nx = nil;\nx = x.add(8); // returns an array\nx = x.add(7); // appends to the array\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// example usage:\n// on machine running the server\n(\ns.options.bindAddress = \"0.0.0.0\"; // allow connections from any address\ns.options.maxLogins = 2; // set to correct number of clients\ns.boot;\n);\n\n// on remote machine connecting to server\n(\no = ServerOptions.new;\no.maxLogins = 2;\nt = Server.remote(\\remote, NetAddr(\"192.168.0.130\", 57110), o); // set to correct address and port\n// info about returned client ID should be posted in the post window\nt.makeWindow; // make a window for monitoring\n)\n\n// if you want to use the remote server without the need to explicitly pass it to e.g. Synth or Function\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// example usage:\n// on machine running the server\n(\ns.options.bindAddress = \"0.0.0.0\"; // allow connections from any address\ns.options.maxLogins = 2; // set to correct number of clients\ns.boot;\n);\n\n// on remote machine connecting to server\n(\no = ServerOptions.new;\no.maxLogins = 2;\nt = Server.remote(\\remote, NetAddr(\"192.168.0.130\", 57110), o); // set to correct address and port\n// info about returned client ID should be posted in the post window\nt.makeWindow; // make a window for monitoring\n)\n\n// if you want to use the remote server without the need to explicitly pass it to e.g. Synth or Function -play, set it to be the default server:\n//Server.default = t;\n\n//otherwise, make some sound on the remote server\n{Resonz.ar(Saw.ar([100,101]), Line.kr(100,5000,10, doneAction: 2),mul: -12.dbamp)}.play(target: t); //use target to specify the remote server\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// use input amplitude to control Pulse amplitude - use headphones to prevent feedback.\nSynthDef(\"help-AmplitudeMod\",{ arg out=0;\n Out.ar(out,\n Pulse.ar(90, 0.3, Amplitude.kr(SoundIn.ar))\n )\n}).play;\n\n);\n\n\n(\n// use input amplitude to control SinOsc frequency - use headphones to prevent feedback.\nz = SynthDef(\"help-AmplitudeMod\",{ arg out=0, attack=0.01, release=0.01;\n Out.ar(out,\n SinOsc.ar(\n AmplitudeMod.kr(\n SoundIn.ar,\n attack,\n release,\n 1200,\n 4\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// use input amplitude to control Pulse amplitude - use headphones to prevent feedback.\nSynthDef(\"help-AmplitudeMod\",{ arg out=0;\n Out.ar(out,\n Pulse.ar(90, 0.3, Amplitude.kr(SoundIn.ar))\n )\n}).play;\n\n);\n\n\n(\n// use input amplitude to control SinOsc frequency - use headphones to prevent feedback.\nz = SynthDef(\"help-AmplitudeMod\",{ arg out=0, attack=0.01, release=0.01;\n Out.ar(out,\n SinOsc.ar(\n AmplitudeMod.kr(\n SoundIn.ar,\n attack,\n release,\n 1200,\n 400)\n , 0, 0.3)\n )\n}).play;\n\n);\nz.set(\\attack, 0.050)\nz.set(\\release, 0.125)\n\nz.free\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SinOsc`."}, {"role": "assistant", "content": "```supercollider\n// create an audio-rate sine wave at 200 Hz,\n// starting with phase 0 and an amplitude of 0.5\n{ SinOsc.ar(200, 0, 0.5) }.play;\n\n// modulate the frequency with an exponential ramp\n{ SinOsc.ar(XLine.kr(2000, 200), 0, 0.5) }.play;\n\n// more complex frequency modulation\n{ SinOsc.ar(SinOsc.ar(XLine.kr(1, 1000, 9), 0, 200, 800), 0, 0.25) }.play;\n\n// phase modulation (see also PMOsc)\n{ SinOsc.ar(800, SinOsc.ar(XLine.kr(1, 1000, 9), 0, 2pi), 0.25) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\ns.boot;\n\n\n\n// create with cueSoundFile class method\nb = Buffer.cueSoundFile(s, ExampleFiles.apollo11, 0, 1);\nx = { DiskIn.ar(1, b) }.play;\nb.close; // must call close in between cueing\n// now use like named instance method, but different arguments\nb.cueSoundFile(ExampleFiles.apollo11);\n// have to do all this to clean up properly!\nx.free; b.close; b.free;\n```"}, {"role": "assistant", "content": "create with cueSoundFile class method now use like named instance method, but different arguments (Buffer: Client-side representation of a buffer on a server)"}]} +{"conversations": [{"role": "user", "content": "Resizing FreqScope?"}, {"role": "assistant", "content": "SuperCollider forum — Resizing FreqScope?\n\nOddly, this seems to work:\n\n```supercollider\n// max partial = 20 kHz\n// do not play this loudly\na = { Blip.ar(100, 200, 0.02).dup }.play;\n\nv = FreqScope(800, 600); // top partial is shown below 1.75 kHz (?)\n\nv.scope.scope.xZoom = 1; // seems correct, by eyeballing\n\n// let's try another resolution\nv = FreqScope(600, 500);\nv.scope.scope.xZoom = 1; // hm, zoom = 1 seems OK here too\n```\n\nFreqScope includes the line scope.xZoom_((scope.bufSize*0.25) / width); so it may be that this calculation is incorrect. I’m unclear, for instance, why it’s dividing by width – apparently zooming out for larger windows...?\n\nBut I tried three different widths (800x600, 600x500, 200x150), and for all of them, xZoom = 1 appeared to be correct. It’s possible that this calculation is vestigial, then – maybe we needed it for the older version of frequency scope, but the Qt version might not need it at all.\n\nhjh"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// randomly modulate params\n(\n{ FBSineL.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(1, 32, 33),\n LFNoise2.kr(1, 0.5),\n LFNoise2.kr(1, 0.05, 1.05),\n LFNoise2.kr(1, 0.3, 0.3)\n) * 0.2 }.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// randomly modulate params\n(\n{ FBSineL.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(1, 32, 33),\n LFNoise2.kr(1, 0.5),\n LFNoise2.kr(1, 0.05, 1.05),\n LFNoise2.kr(1, 0.3, 0.3)\n) * 0.2 }.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nr = {\n var scale = Scale.choose.postln;\n SinOsc.ar(\n (\n DegreeToKey.kr(\n scale.as(LocalBuf),\n MouseX.kr(0, 15), // mouse indexes into scale\n scale.stepsPerOctave,\n 1, // mul = 1\n 60 // offset by 72 notes\n )\n + LFNoise1.kr([3, 3], 0.04) // add some low freq stereo detuning\n ).midicps, // convert midi notes to hertz\n 0,\n 0.25\n )\n}.play;\n;\n\nr.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nr = {\n var scale = Scale.choose.postln;\n SinOsc.ar(\n (\n DegreeToKey.kr(\n scale.as(LocalBuf),\n MouseX.kr(0, 15), // mouse indexes into scale\n scale.stepsPerOctave,\n 1, // mul = 1\n 60 // offset by 72 notes\n )\n + LFNoise1.kr([3, 3], 0.04) // add some low freq stereo detuning\n ).midicps, // convert midi notes to hertz\n 0,\n 0.25\n )\n}.play;\n);\n\nr.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Ringz` that runs as it is."}, {"role": "assistant", "content": "```supercollider\na = NodeProxy(s);\na[0] = { |freq = 440, dt=0.1, rate=2| Ringz.ar(Impulse.ar(rate * [1, 1.2]), freq, dt)*0.1 };\na.play;\n(\na[1] = \\set -> Pbind(\n \\dur, Prand([1, 0.5], inf),\n \\freq, Pwhite(200.0, 1000, inf),\n \\rate, Pdup(4, Prand([1, 3, 6, 10], inf)),\n \\dt, Pwhite(0.01, 0.1, inf)\n)\n);\n// modify the source in the meanwhile:\na[0] = { |freq = 440, dt=0.1, rate=2| Ringz.ar(Dust.ar(rate * 10.dup), freq, dt)*0.1 };\n\na.nodeMap.postln; // the values are not set in the node map.\na.clear(3);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\nz = {\n BHiPass4.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(10, 20000, \\exponential), // cutoff freq.\n MouseY.kr(0.1, 1.0, \\linear), // rq\n 0.5); // mul\n}.play\nz.release;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\nz = {\n BHiPass4.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(10, 20000, \\exponential), // cutoff freq.\n MouseY.kr(0.1, 1.0, \\linear), // rq\n 0.5); // mul\n}.play)\nz.release;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `HPZ1` in SuperCollider?"}, {"role": "assistant", "content": "HPZ1 — Two point difference filter A special case fixed filter. Implements the formula: Category: UGens > Filters > Linear."}]} +{"conversations": [{"role": "user", "content": "What does `Function.awake` do? What arguments does it take?"}, {"role": "assistant", "content": "This method is called by a Clock on which the function was scheduled when its scheduling time is up. It calls #-value, passing on the scheduling time in beats as an Arguments: beats — The scheduling time in beats. This is equal to the current logical time (Thread#-beats).; seconds — The scheduling time in seconds. This is equal to the current logical time (Thread#-seconds).; clock — The clock on which the object was scheduled.. Returns: The value returned by the function's #-value. A caller clock uses this value to reschedule the function. `// Runs every 2 seconds`"}]} +{"conversations": [{"role": "user", "content": "What does `Window.drawFunc` do? What arguments does it take?"}, {"role": "assistant", "content": "Just like the UserView, the window can be given a Function to evaluate whenever it is asked to redraw itself, so you can use the Pen class to draw on the window. See UserView#-drawFunc for Arguments: A Function.."}]} +{"conversations": [{"role": "user", "content": "My pattern keeps playing after I press Ctrl+."}, {"role": "assistant", "content": "Ctrl+. (CmdPeriod) stops everything scheduled on the clocks, including Patterns. If yours survives, it is not scheduled on a clock — most often it is a `Synth` created directly, or a `Task`/`Routine` started on `SystemClock` in a way that outlived the period. Do you still see the node in `s.plotTree`?"}, {"role": "user", "content": "Yes, there's a synth."}, {"role": "assistant", "content": "Then the sound is a node, not a pattern: `s.freeAll` will stop it. The likely cause is a SynthDef whose EnvGen has no `doneAction`, or a drone with `gate = 1` that nothing releases. Add `doneAction: 2` to the envelope, or keep a reference and `x.set(\\gate, 0)` when you want it to end."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na.ramp(1.0, 1.0); // returns a harmonic series\n\nb = Buffer.alloc(s, 512, 1);\n// harmonic series for freqs, ramp down for amps\nb.sine2(a.ramp(1.0, 1.0).postln, a.ramp(0.5, -0.025).postln, true, true, true);\n(\nz = SynthDef(\"help-Osc\", { |out = 0, bufnum = 0|\n Out.ar(out,\n Osc.ar(bufnum, 200, 0, 0.5)\n )\n});\n);\ny = z.play(s, [\\out, 0, \\bufnum, b];\ny.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na.ramp(1.0, 1.0); // returns a harmonic series\n\nb = Buffer.alloc(s, 512, 1);\n// harmonic series for freqs, ramp down for amps\nb.sine2(a.ramp(1.0, 1.0).postln, a.ramp(0.5, -0.025).postln, true, true, true);\n(\nz = SynthDef(\"help-Osc\", { |out = 0, bufnum = 0|\n Out.ar(out,\n Osc.ar(bufnum, 200, 0, 0.5)\n )\n});\n);\ny = z.play(s, [\\out, 0, \\bufnum, b]);\ny.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `EventPatternProxy.default` do?"}, {"role": "assistant", "content": "a default source, if none is given. the default is a Pbind with resting notes of 1.0 beat"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ReplaceOut`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"ReplaceOutHelp\", { |out = 0, freq = 440|\n var source;\n source = SinOsc.ar(freq, 0, 0.1);\n\n // write to the bus, replacing previous contents\n ReplaceOut.ar(out, source);\n\n}).add;\n);\n\n// each Synth replaces the output of the previous one\nx = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 500]);\ny = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 600]);\nz = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 700]);\n\n// release them in reverse order; the older Synths are still there.\nz.free;\ny.free;\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//spinning hypercube / tesseract\n//after Shiffman https://codingtrain.github.io/website-archive/CodingChallenges/113-hypercube.html\n\n\n(\nvar width= 640, height= 480, w,\ntheta= 0, speed= 0.005, hypercube;\n\nw= RedWindow(\"3Dhypercube\", Rect(128, 64, width, height)).front;\nhypercube= Red4DTesseract();\n\n//--loop\nw.draw{\n theta= theta+speed;\n hypercube.rotation= RedVector[theta, 0, 0, 0, 0, theta];\n hypercube.update;\n\n //--render\n hypercube.render(2, 500); //1= exaggerate, 2= standard\n Pen.translate(width*0.5, height*0.5);\n Pen.fillColor= Color.white;\n hypercube.draw;\n Pen.strokeColor= Color.white;\n hypercube.drawOutlines;\n};\nw.play;\nCmdPeriod.doOnce({w.close});\n)\n```"}, {"role": "assistant", "content": "spinning hypercube / tesseract after Shiffman https://codingtrain.github.io/website-archive/CodingChallenges/113-hypercube.html."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Standard2DC.ar(220, 11025, mul:0.3) }.play(s);\n\n// mouse-controlled param\n{ Standard2DC.ar(8000, 20000, MouseX.kr(0.9,4), mul:0.3) }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(Standard2DC.ar(10, 20, MouseX.kr(0.9,4))*800+900)*0.4 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Standard2DC.ar(220, 11025, mul:0.3) }.play(s);\n\n// mouse-controlled param\n{ Standard2DC.ar(8000, 20000, MouseX.kr(0.9,4), mul:0.3) }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(Standard2DC.ar(10, 20, MouseX.kr(0.9,4))*800+900)*0.4 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `LPF`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\\default, { arg out=0, freq=440, amp=0.1, pan=0, gate=1;\n var z;\n z = LPF.ar(\n Mix.new(VarSaw.ar(freq + [0, Rand(-0.4,0.0), Rand(0.0,0.4)], 0, 0.3)),\n XLine.kr(Rand(4000,5000), Rand(2500,3200), 1)\n ) * Linen.kr(gate, 0.01, 0.7, 0.3, 2);\n OffsetOut.ar(out, Pan2.ar(z, pan, amp));\n}, [\\ir]);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Integrator.ar(LFPulse.ar(300, 0.2, 0.1), MouseX.kr(0.001, 0.999, 1)) }.play\n\n// used as an envelope\n{ Integrator.ar(LFPulse.ar(3, 0.2, 0.0004), 0.999, FSinOsc.ar(700), 0) }.play\n\n\n// scope\n\n{ Integrator.ar(LFPulse.ar(1500 / 4, 0.2, 0.1), MouseX.kr(0.01, 0.999, 1) }.scope\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Integrator.ar(LFPulse.ar(300, 0.2, 0.1), MouseX.kr(0.001, 0.999, 1)) }.play\n\n// used as an envelope\n{ Integrator.ar(LFPulse.ar(3, 0.2, 0.0004), 0.999, FSinOsc.ar(700), 0) }.play\n\n\n// scope\n\n{ Integrator.ar(LFPulse.ar(1500 / 4, 0.2, 0.1), MouseX.kr(0.01, 0.999, 1)) }.scope\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n~lfd={\n var signal, myFrequency, frequencyMin=0.1, frequencyMax=30, myAmplitude, amplitudeMin=0.01, amplitudeMax=0.6, myPhase, phaseMin=0, phaseMax=1.5;\n myFrequency = Array.fill(2, {[rrand(frequencyMin, frequencyMax)]});\n myAmplitude = Array.fill(2, {[rrand(amplitudeMin, amplitudeMax)]});\n myPhase = Array.fill(2, {[rrand(phaseMin, phaseMax)]});\n signal = LeakDC.ar([LFDNoise1, LFDNoise0, LFDNoise3, LFDClipNoise].choose.ar(myFrequency, myPhase, myAmplitude));\n Out.ar(0, signal);\n};\n);\n\n~lfd.scope\n```"}, {"role": "assistant", "content": "a draft of a modular function for LFDNoise sctochastically selection. i shall be turning this into a pseudo ugen, using high level classes abstraction layer."}]} +{"conversations": [{"role": "user", "content": "What does `UserView.frameRate` do? What arguments does it take?"}, {"role": "assistant", "content": "The interval at which the view regularly redraws itself, if #-animate is `true`. You can change the desired frame rate by setting this variable. The default frame rate is Arguments: fps — A Float defining the interval between frames of animation, in frames per second.."}]} +{"conversations": [{"role": "user", "content": "Explain `ClientOnTrigResponder` in SuperCollider briefly."}, {"role": "assistant", "content": "ClientOnTrigResponder — a helper object used by Instr to implement { }.onTrig inside of Instr functions Category: Libraries > crucial > Instr."}]} +{"conversations": [{"role": "user", "content": "What is `Rest`?"}, {"role": "assistant", "content": "Rest — Represents a rest in event patterns"}, {"role": "user", "content": "What does `Rest.new` do?"}, {"role": "assistant", "content": "Create an instance of Rest, with a value to be used in the resulting rest event."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// do nothing for 2 seconds\n(note: Rest(), dur: 2).play;\n\n// intersperse pauses in pattern\nPbind(\\note, Pseq([0, 4, 7, 11], inf), \\dur, Pseq([2, 1, Rest(1)], inf) / 5).play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Standard2DN.ar(220, 11025, mul:0.3) }.play(s);\n\n// mouse-controlled param\n{ Standard2DN.ar(SampleRate.ir/2, SampleRate.ir, MouseX.kr(0.9,4), mul:0.3) }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(Standard2DN.ar(10, 20, MouseX.kr(0.9,4))*800+900)*0.4 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Standard2DN.ar(220, 11025, mul:0.3) }.play(s);\n\n// mouse-controlled param\n{ Standard2DN.ar(SampleRate.ir/2, SampleRate.ir, MouseX.kr(0.9,4), mul:0.3) }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(Standard2DN.ar(10, 20, MouseX.kr(0.9,4))*800+900)*0.4 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `ApplicationStart` in SuperCollider briefly."}, {"role": "assistant", "content": "ApplicationStart — register functions to be evaluated on Application start Available in macOS SuperCollider.app only. Category: Control, Platform > macOS."}]} +{"conversations": [{"role": "user", "content": "What is `Loudness` in SuperCollider?"}, {"role": "assistant", "content": "Loudness — Extraction of instantaneous loudness in sones A perceptual loudness function which outputs loudness in sones; this is a variant of an MP3 perceptual model, summing excitation in ERB bands. It models simple spectral and temporal masking, with equal loudness contour correction in ERB bands to obtain phons (relative dB), then a phon to sone transform. The final output is typically in the range of 0 to 64 sones, though higher values can occur wit Category: UGens > Analysis > Amplitude."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LinSelectX`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar(300),\n Pulse.ar(230)\n ];\n\n LinSelectX.ar(MouseX.kr(0, 1) * a.size, a) * 0.2\n}.play;\n);\n\n(\n{\n var a;\n a = [\n SinOsc.kr(0.25),\n LFSaw.kr(10),\n LFPulse.kr(0.3)\n ];\n\n SinOsc.ar(LinSelectX.kr(MouseX.kr(0, 1) * a.size, a) * 300 + 400) * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `RunningMax`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n SinOsc.ar(\n RunningMax.ar(Dust.ar(20), Impulse.ar(0.4)) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// follow a sine lfo, reset rate controlled by mouse x\n(\n{\n SinOsc.ar(\n RunningMax.kr(SinOsc.kr(0.2), Impulse.kr(MouseX.kr(0.01, 2, 1))) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "How do I put reverb on everything?"}, {"role": "assistant", "content": "Send it: one private bus, one FreeVerb instance reading it, and every instrument writing dry to the master and wet to the bus.\n\n```supercollider\n~verb = Bus.audio(s, 2);\nSynthDef(\\verb, { |in = 0| Out.ar(0, FreeVerb.ar(In.ar(in, 2), 0.5, 0.85, 0.5) * 0.7) }).add;\nSynth(\\verb, [\\in, ~verb]);\n```"}, {"role": "user", "content": "Too much reverb now."}, {"role": "assistant", "content": "Lower the wet mix and the return level, not the room size: the room is what makes it sound like a space, the mix is how much of it you hear. `FreeVerb.ar(In.ar(in, 2), 0.25, 0.85, 0.5) * 0.5`. To change it live without restarting, add a control and `.set` it: `|mix = 0.5|` then `~verbSynth.set(\\mix, 0.25)`."}]} +{"conversations": [{"role": "user", "content": "Explain `FoaPushZ` in SuperCollider briefly."}, {"role": "assistant", "content": "FoaPushZ — First Order Ambisonic (FOA) push transformer Apply push to a First Order Ambisonic signal (B-format) along the z-axis. Category: Libraries > Ambisonic Toolkit > UGens > FOA > Transformer, UGens > Multichannel > Ambisonics."}]} +{"conversations": [{"role": "user", "content": "Strange offset behaviour when plotting some .kr uGens?"}, {"role": "assistant", "content": "SuperCollider forum — Strange offset behaviour when plotting some .kr uGens\n\nI’ve got a workaround for this now.\n\n```supercollider\ns.quit;\nServer.local.options.blockSize = 4;\ns.boot;\n\n{[\n LFTri.ar(s.sampleRate/2, 1, 2), // just to show where the samples are\n Impulse.ar(0), // audio rate impulse in correct place\n Impulse.kr(0), // control rate impulse with offset issue\n Trig1.kr(1, 0) // control rate impulse in correct place\n]}.plot(70/s.sampleRate);\n\n{[\n LFTri.ar(s.sampleRate/2, 1, 2), // just to show where the samples are\n Phasor.ar(Impulse.ar(0), 1/8, -2, 2, -0.625), // Phasor as it behaves in audio rate\n Phasor.kr(Impulse.kr(0), 1/2, -2, 2, -0.625), // Phasor as it behaves in control rate\n Phasor.kr(Impulse.kr(0), 1/2, -2, 2, -0.5) + (1.5 * Trig1.kr(1, 0)) // Phasor in control rate patched to match audio rate\n]}.plot(70/s.sampleRate)\n```\n\nI assume the problem is that the first control rate sample is meant to be more of a ‘sample -1’ than ‘sample 0’, hence why plot omits it when the output is at control rate. This would be fine if audio rate uGens started after one control period. Since they don’t, I’m happy to just adjust the code to make the subsequent samples correct, and then use ​ + (x * Trig1.kr(1, 0)) to patch the first sample. The only problem now is that it’s more complicated to do that with some other uGens."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LatoocarfianL`."}, {"role": "assistant", "content": "```supercollider\n// randomly modulate all params\n(\n{ LatoocarfianL.ar(\n SampleRate.ir/4,\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5)\n) * 0.2 }.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `FSinOsc`."}, {"role": "assistant", "content": "```supercollider\n{ FSinOsc.ar(800) * 0.2 }.play;\n\n{ FSinOsc.ar(XLine.kr(200, 4000, 1)) * 0.2 }.play;\n\n// loses amplitude towards the end\n{ FSinOsc.ar(FSinOsc.ar(XLine.kr(4, 401, 8), 0.0, 200, 800)) * 0.2 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `TExpRand`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var trig = Dust.kr(10);\n SinOsc.ar(\n TExpRand.kr(300.0, 3000.0, trig)\n ) * 0.1\n}.play;\n);\n\n(\n{\n var trig = Dust.ar(MouseX.kr(1, 8000, 1));\n SinOsc.ar(\n TExpRand.ar(300.0, 3000.0, trig)\n ) * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `RedRock` in SuperCollider?"}, {"role": "assistant", "content": "RedRock — an obstacle object with infinite mass The differences from RedObject are that it is not possible to change the mass and the mass is always infinite. Category: Red > redUniverse."}]} +{"conversations": [{"role": "user", "content": "What are the server's default sample rate and block size?"}, {"role": "assistant", "content": "44100 Hz and 64 samples per block by default, so the control rate is 44100/64 = 689.06 Hz. You can read them from the language with `s.sampleRate` and `s.options.blockSize`, or from inside a Synth with `SampleRate.ir` and `ControlRate.ir`. A `.kr` signal therefore updates about 689 times a second, which is why it is smooth enough for filters and envelopes but not for audio-rate FM."}]} +{"conversations": [{"role": "user", "content": "What does `SimpleNumber.gammaPInvA` do?"}, {"role": "assistant", "content": "Returns a value such that `p = gamma_p(a, x)`. Requires `x` > 0 and 1 >= `p,q` >="}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n/* Audio plugin definition\n\n Each audio plugin should define the following global variables:\n ~name: (symbol) name of the spatializer\n ~description: (string) a short description\n ~function: the actual definition of the plugin\n\n*/\n\n~name = \\MonoIn;\n~description = \"A direct input\";\n~channelLayout = \\mono;\n\n~function = {\n |gate = 0, bus = 0, attack = 0.02, susL = 0.9, release = 0.1, curve = -4|\n var env = Env.asr(attack, susL, release, curve);\n SoundIn.ar(bus, EnvGen.kr(env, gate));\n}\n```"}, {"role": "assistant", "content": "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see ."}]} +{"conversations": [{"role": "user", "content": "What does `EnvironmentRedirect.envir` do?"}, {"role": "assistant", "content": "return or replace the source environment `e ="}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// Create a new empty List with size: 3\nx = List.new(3);\n\nx.postln; // -> List[ ]\n\n// Add numbers 0 to 4 to the List\n5.do({ |i| x.add(i) });\n\n// The list has been modified in-place with each added item\nx.postln; // -> List[ 0, 1, 2, 3, 4 ]\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// Create a new empty List with size: 3\nx = List.new(3);\n\nx.postln; // -> List[ ]\n\n// Add numbers 0 to 4 to the List\n5.do({ |i| x.add(i) });\n\n// The list has been modified in-place with each added item\nx.postln; // -> List[ 0, 1, 2, 3, 4 ]\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `Clothesline` in SuperCollider briefly."}, {"role": "assistant", "content": "Clothesline — Timeline for Code When compoising larger pieces out of many smaller programs, one is often drawn towards recording the elements and arranging the piece in a timeline of a digital audio workstation. The class Clothesline gives a simple way to schedule code in a timeline, each with beginning and end. It has a GUI for simple navigation. This is all, it has no further controls, no dragging, no convenience. It is experi Category: live coding."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\\sine, { |freq = 400, amp = 0.1| Out.ar(0, SinOsc.ar(freq, mul: amp)) }).add;\nSynthDef(\\pulse, { |freq = 400, amp = 0.1| Out.ar(0, Pulse.ar(freq, mul: amp)) }).add;\n);\n\n(\nx = Synth(\\sine).register;\ny = Synth(\\pulse).register;\n);\n\n// pause pulse \n\ny.run(false);\n\n// VarGui checks state, definition is known, new Synths of same definition can be started\n\nv = VarGui(synth: [x,y]).gui;\n\n\n// With nodeIDs or non-regist\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\\sine, { |freq = 400, amp = 0.1| Out.ar(0, SinOsc.ar(freq, mul: amp)) }).add;\nSynthDef(\\pulse, { |freq = 400, amp = 0.1| Out.ar(0, Pulse.ar(freq, mul: amp)) }).add;\n);\n\n(\nx = Synth(\\sine).register;\ny = Synth(\\pulse).register;\n);\n\n// pause pulse \n\ny.run(false);\n\n// VarGui checks state, definition is known, new Synths of same definition can be started\n\nv = VarGui(synth: [x,y]).gui;\n\n\n// With nodeIDs or non-registered Synths VarGui demands addtional state info\n\n(\nx = { SinOsc.ar(400, mul: 0.1) }.play;\ny = { Pulse.ar(700, mul: 0.01) }.play;\n);\n\ny.run(false);\n\n// no new Synths from temporary synth definition\n\nv = VarGui(synth: [x,y], assumePlaying: true, assumeRunning: [true, false]).gui;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Saw`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n SynthDef(\\controlList, { |out = 0, freq = 440, amp = 0.1, detune = #[0.999, 1.001], gate = 1|\n var sig = Mix(Saw.ar(freq * (detune ++ [1]), amp)),\n env = EnvGen.kr(Env.adsr, gate, doneAction: Done.freeSelf);\n Out.ar(out, (sig * env) ! 2);\n }).add;\n\n SynthDescLib.global[\\controlList]\n )\n```"}]} +{"conversations": [{"role": "user", "content": "GrainBuf complains about too many grains."}, {"role": "assistant", "content": "The number of simultaneous grains is `density × dur` in seconds, and it exceeds maxGrains (512 by default). Either lower the trigger rate, shorten the grains, or raise the limit: `GrainBuf.ar(2, trig, dur, buf, 1, pos, 2, 0, -1, 1024)` — the 1024 is maxGrains. Raising it costs server CPU per grain, so prefer halving the density if the sound does not need it."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Fdef`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\ns.boot;\nSynthDef(\"gpdef\",\n { |out = 0, freq = 440, sustain = 0.05, amp = 0.1|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain), doneAction: Done.freeSelf) * amp;\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n// fork a thread that plays some sounds\n(\nFdef(\\freq, 440);\nFdef(\\dur, 0.2);\n\nfork {\n loop {\n s.sendMsg(\"/s_new\", \"gpdef\", -1, 1, 1, \\freq, Fdef(\\freq).value);\n Fdef(\\dur).value.wait;\n }\n};\n);\n\n// some modifications\n\nFdef(\\freq, Fdef(\\midinote, 60).midicps);\nFdef(\\midinote, { [67, 64, 65].choose });\nFdef(\\midinote, { [67, 64, 65].choose } + Fdef(\\offset));\nFdef(\\offset, { 4.rand });\nFdef(\\dur, 0.23);\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `PV_MagShift` in SuperCollider briefly."}, {"role": "assistant", "content": "PV_MagShift — shift and stretch magnitude bin position. Shift and stretch the positions of only the magnitude of the bins. Can be used as a very crude frequency shifter/scaler. Category: UGens > FFT."}]} {"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n\nx = PlayerSocket.new(\\audio,1);\nx.play;\n\np = EnvelopedPlayer(\n Patch({\n SinOsc.ar * 0.1\n }),\n Env.adsr(releaseTime: 2.0),\n 1\n);\n\n\nx.prepareAndQSpawn(p)\n\n);\n\n\n\nx.preparePlayer(p)\n\np.insp\n\nx.qspawnPlayer(p)\n\n\n\n(\n\nEnvelopedPlayer(\n EnvelopedPlayer(\n Patch({\n SinOsc.ar * 0.1\n }),\n Env.adsr(releaseTime: 2.0),\n 1\n ),\n Env.adsr(releaseTime: 3.0),\n 1\n).play\n\n/*\nGroup(0)\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n\nx = PlayerSocket.new(\\audio,1);\nx.play;\n\np = EnvelopedPlayer(\n Patch({\n SinOsc.ar * 0.1\n }),\n Env.adsr(releaseTime: 2.0),\n 1\n);\n\n\nx.prepareAndQSpawn(p)\n\n);\n\n\n\nx.preparePlayer(p)\n\np.insp\n\nx.qspawnPlayer(p)\n\n\n\n(\n\nEnvelopedPlayer(\n EnvelopedPlayer(\n Patch({\n SinOsc.ar * 0.1\n }),\n Env.adsr(releaseTime: 2.0),\n 1\n ),\n Env.adsr(releaseTime: 3.0),\n 1\n).play\n\n/*\nGroup(0)\n Group(1)\n Synth(\"-15n~Em\" : 1000) Patch[ f-33811036 ]:synth\n Synth(\"EnvelopedPlayer1yeG~u\" : 1001) an EnvelopedPlayer:synth\n Synth(\"EnvelopedPlayer1-ysI-H\" : 1002) an EnvelopedPlayer:synth\n*/\n\n);\n\n(\n EnvelopedPlayer(\n Patch({\n SinOsc.ar * 0.1\n }),\n Env.adsr(releaseTime: 2.0),\n 1\n ).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a, b;\na = Pfset({\n ~legato = 0.3;\n ~detune = rrand(0, 30);\n}, Pbind(\\dur, 0.5));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a, b;\na = Pfset({\n ~legato = 0.3;\n ~detune = rrand(0, 30);\n}, Pbind(\\dur, 0.5));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// try wiggling the mouse quickly;\n// LFNoise frequently seems stuck, LFDNoise changes smoothly.\n\n{ LFClipNoise.ar(MouseX.kr(0.1, 1000, 1), 0.1) }.play\n\n{ LFDClipNoise.ar(MouseX.kr(0.1, 1000, 1), 0.1) }.play\n\n// silent for 2 secs before going up in freq\n\n{ LFClipNoise.ar(XLine.kr(0.5, 10000, 3), 0.1) }.scope;\n\n{ LFDClipNoise.ar(XLine.kr(0.5, 10000, 3), 0.1) }.scope;\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFClipNoise.ar\n// …\n```"}, {"role": "assistant", "content": "try wiggling the mouse quickly; LFNoise frequently seems stuck, LFDNoise changes smoothly. (LFDClipNoise: Dynamic clipped noise)"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for short piece which plays random major music."}, {"role": "assistant", "content": "```supercollider\np = ProxySpace.push(s.boot);\n~a.play.quant_(4); ~b.play.quant_(4);\n~c = { LFNoise1.kr(8).range(0,15).round };\n~a = Pbind(\\degree, Pstutter(4, Pseq([0,2,3,4], inf)), \\octave, [3,4], \\dur, 0.25, \\amp, 0.3);\n~b = Pbind(\\octave, 4, \\scale, Scale.majorPentatonic, \\degree, ~c, \\dur, 1/4, \\legato, 0.5);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Dwhite`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a, freq, trig;\n a = Dwhite(0, 15, inf);\n trig = Impulse.kr(MouseX.kr(1, 40, 1));\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `ProxySynthDef`?"}, {"role": "assistant", "content": "ProxySynthDef — synth def that wraps ugen graph"}, {"role": "user", "content": "What does `ProxySynthDef.sampleAccurate` do?"}, {"role": "assistant", "content": "always use OffsetOut, if set to true (default: false)"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na = ProxySynthDef(\"xtest\", { SinOsc.ar(400) * 0.1 });\n\na.add;\n\nx = Synth(\"xtest\");\nx.release;\n\n\n/*\n\n if the resulting number of channels is larger than a given channelConstraint,\n it behaves according to the rate: audio rate signals are wrapped around\n a smaller channel size, control rate signals are not (the exceeding channels are left out)\n\n*/\n```"}]} -{"conversations": [{"role": "user", "content": "What does `DrawGrid.preview` do?"}, {"role": "assistant", "content": "Preview this `DrawGrid` object by creating a window with a view showing the `DrawGrid` in its current state. `d = DrawGrid(nil, \\freq.asSpec.grid, \\amp.asSpec.grid);` If the `DrawGrid` is modified, you can `-refresh` the returned `UserView` to see its updated state, or simply call `-preview` again to update the view (or create the preview again if the `Window` was closed). See #Testing and modifying#Examples Returns: A UserView which draws this `DrawGrid`."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for change stuff in running Pbind with patternproxies?"}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\clusterboom, {| out = 0, freq=55, dur=1, amp=1|\n Out.ar(\n out,\n Splay.ar({SinOsc.ar(exprand(freq-(freq/128),freq+(freq/128)),0,0.1)}!33)\n * EnvGen.kr(Env.perc,1,1,0,dur,2)\n * amp\n ) \n}).add;\n);\n\n\n(\n~notes = [ 21, 21, 9, 19, 19, 9 ];\n~durs = [ 1/4, 1/4, 1/2, 1/8, 1/8, 14/8 ];\n~amps = [ 4, 4, 0, 3, 3, 0 ];\n\n~notespatternproxy = PatternProxy(Pxrand(~notes,inf)); \n~durspatternproxy = PatternProxy(Pxrand(~durs, inf));\n~ampspatternproxy = PatternProxy(Pxrand(~amps, inf)); \n\np = Pbind(\n \\instrument, \\clusterboom,\n \\midinote, ~notespatternproxy,\n \\dur, ~durspatternproxy,\n 'amp', ~ampspatternproxy, \n);\n);\np.play;\n\n// eval while running:\n\n~notespatternproxy.source = Pxrand(~notes + 7,inf); \n~notespatternproxy.source = Pxrand(union(~notes, ~notes + 7),inf); \n~notespatternproxy.source = Pxrand(~notes,inf);\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for midified arpeggiator/auto-accompaniment using patterns."}, {"role": "assistant", "content": "```supercollider\n(\ns.waitForBoot({\n var right, left;\n var n0, n1, n2;\n var note_getter;\n\n MIDIdef.freeAll;\n if (~midi_initilized.isNil) {\n MIDIClient.init;\n MIDIIn.connectAll;\n ~midi_initialized = 1;\n };\n\n ~note_table = 0!127;\n ~n = nil;\n\n MIDIdef.noteOn(\n \\mynoteonhandler, // just a name for this handler\n {\n |val, num, chan, src|\n ~note_table[num] = 1; // update note table and update ~n\n ~n = ~note_table.selectIndices({|item, i| item != 0});\n }\n );\n\n MIDIdef.noteOff(\n \\mynoteoffhandler, // just a name for this handler\n {\n |val, num, chan, src|\n ~note_table[num] = 0; // update note table and update ~n\n /*\n // only enable the following lines if you want the arpeggio to stop as soon as you release the keys\n ~n = ~note_table.selectIndices({|item, i| item != 0});\n if (~n == []) { ~n = nil; };\n */\n }\n );\n\n note_getter = {\n | index |\n Plazy {\n if (~n.isNil) {\n Pseq([Rest(1)]);\n } {\n ~n[index] ?? (~n[0] ?? Pseq([Rest(1)]));\n };\n };\n };\n\n n0 = note_getter.(0);\n n1 = note_getter.(1);\n n2 = note_getter.(2);\n\n right = Pbind(\n \\instrument, \\default,\n \\midinote, Pseq([ n0, n2, n1, n2] ++ (([ n0, n2, n1, n2] + 12)!2).flatten),\n \\dur, Pseq([1, 1, 1, 1, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5 ].normalizeSum*2)\n );\n left = Pbind(\n \\instrument, \\default,\n \\midinote, Pseq([ n0, n2, n0, n2, n0, n2, n0, n2] - 12),\n \\dur, Pseq([1, 1, 1, 1, 1, 1, 1, 1].normalizeSum*2)\n );\n if (~player.notNil) { ~player.stop; };\n ~player = Pn(Ppar([right,left])).play;\n});\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Pbindef`?"}, {"role": "assistant", "content": "Pbindef — incremental event pattern reference definition"}, {"role": "user", "content": "What does `Pbindef.new` do?"}, {"role": "assistant", "content": "store the pattern in the global dictionary of Pdef under key. If there is already a Pdef of this key, replace its pattern with the new one. If there is already a Pbindef af this key, set the parameters only, or add a new one (the whole pattern is replaced). Using *new(key) you can access the pattern at that key (if none is there, a default pattern is created). see Pdef."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nPbindef(\\x, \\note, Pseq([0, 7, 9]), \\dur, 0.2).play;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `TBetaRand` in SuperCollider briefly."}, {"role": "assistant", "content": "TBetaRand — triggered beta random distribution Generates a random float value in beta distribution from `lo` to `hi` each time the trigger signal changes from nonpositive to positive values. Category: UGens > Random, UGens > Triggers."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n‎{h={|f|1-LFTri.ar(f)};l={|s,e|Line.ar(s,e,1200,1,0,2)};FreeVerb.ar(h.(l.(147,5147))*h.(l.(1117,17))*h.(100)*h.([55,55.1])*0.05,0.7,1)}.play\n\n//Explanation of this piece - http://schemawound.com/post/40100438722/11-13-2012-tweet-explained\n```"}, {"role": "assistant", "content": "Explanation of this piece - http://schemawound.com/post/40100438722/11-13-2012-tweet-explained."}]} -{"conversations": [{"role": "user", "content": "What is `DigitalIO`?"}, {"role": "assistant", "content": "DigitalIO — Read or write data to a digital pin"}, {"role": "user", "content": "What does `DigitalIO.ar` do?"}, {"role": "assistant", "content": "The output of this UGen is always the last value read when the digital pin was an input."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// write a sine oscillator's output to a pin, and read the pin value at other times\n\n(\nSynthDef(\"help-DigitalIO\", { |out = 0|\n DigitalIO.ar(0, SinOsc.ar(10), LFPulse.kr(0.1)).poll;\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for mrcl snippets #3: feedback timer (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\fbTimer){\n m = (Dust.ar(0.5!2)*20).tanh+\\in.ar(0!2);\n r = Timer.kr(Onsets.kr(FFT(LocalBuf(128)!2,m)));\n c = CombL.ar(m+(LocalIn.ar(2)*0.8),4,r.clip(0.0001,4),r*4);\n l = Resonz.ar(c,TRand.kr(20,20000,m),0.1,1000).tanh;\n LocalOut.ar(m+l);\n m+c;\n}.play\n);\n\n\n(\nNdef(\\fbTimerSel){\n m = (Dust.ar(0.5!2)*20).tanh+\\in.ar(0!2);\n r = Timer.kr(Onsets.kr(FFT(LocalBuf(128)!2,m)));\n c = CombL.ar(m+(LocalIn.ar(2)*0.8),4,r.clip(0.0001,4),r*4);\n l = Resonz.ar(c,TRand.kr(20,20000,m),0.1,1000).tanh;\n n = SelectX.ar(LFNoise0.kr(r.linlin(0,4,0.1,10)).range(0,4),[m,K2A.ar(r),c,l]);\n\n LocalOut.ar(n);\n n\n\n}.play\n);\n\n\n(\nNdef(\\fbTimer3){\n var localin = (LocalIn.ar(2)*0.98)+\\in.ar(0!2);\n var dust = (Dust.ar(Rand(0.5,10)!2)*200)+\\in.ar;\n var timer = Timer.ar(dust);\n var comb = CombL.ar(dust+localin,4,timer.clip(0.0001,4),timer*4);\n var filt = Resonz.ar(comb,TRand.kr(20,Rand(20,20000),dust),0.1,1000).tanh;\n LocalOut.ar(dust+filt);\n comb+dust;\n comb+dust*timer;\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// using sweep to modulate sine frequency\n(\n{ var trig;\n trig = Impulse.kr(MouseX.kr(0.5, 20, 1));\n SinOsc.ar(Sweep.kr(trig, 700) + 500, 0, 0.2)\n}.play;\n);\n\n\n// using sweep to index into a buffer\nb = Buffer.read(s, ExampleFiles.child);\n\n(\n{ var trig;\n trig = Impulse.kr(MouseX.kr(0.5, 10, 1));\n BufRd.ar(1, b, Sweep.ar(trig, BufSampleRate.ir(0)))\n}.play;\n);\n\n// backwards, variable offset\n(\n{ var trig, pos, rate;\n trig = Impulse.\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// using sweep to modulate sine frequency\n(\n{ var trig;\n trig = Impulse.kr(MouseX.kr(0.5, 20, 1));\n SinOsc.ar(Sweep.kr(trig, 700) + 500, 0, 0.2)\n}.play;\n);\n\n\n// using sweep to index into a buffer\nb = Buffer.read(s, ExampleFiles.child);\n\n(\n{ var trig;\n trig = Impulse.kr(MouseX.kr(0.5, 10, 1));\n BufRd.ar(1, b, Sweep.ar(trig, BufSampleRate.ir(0)))\n}.play;\n);\n\n// backwards, variable offset\n(\n{ var trig, pos, rate;\n trig = Impulse.kr(MouseX.kr(0.5, 10, 1));\n rate = BufSampleRate.ir(0);\n pos = Sweep.ar(trig, rate.neg) + (BufFrames.ir(0) * LFNoise0.kr(0.2));\n BufRd.ar(1, b, pos)\n}.play;\n);\n\n// raising rate\n(\n{ var trig, rate;\n trig = Impulse.kr(MouseX.kr(0.5, 10, 1));\n rate = Sweep.kr(trig, 2) + 0.5;\n BufRd.ar(1, b, Sweep.ar(trig, BufSampleRate.ir(0) * rate))\n}.play;\n);\n\nb.free\n```"}]} -{"conversations": [{"role": "user", "content": "What does `HelpBrowser.goTo` do? What arguments does it take?"}, {"role": "assistant", "content": "When using the SCIDE, go to `url` in the built-in helpbrowser; otherwise, go to url with singleton `HelpBrowser` instance or a new window, depending on the `openNewWindows` Arguments: url — A String representing a web address, a local address in the URI format (`file:///path`), or a local path.."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes little experiment with periodicity."}, {"role": "assistant", "content": "```supercollider\n/* An little experiment with periodicity. \n Maybe there can be some sync artifact...\n */\n\ns.boot;\n\nSynthDef(\\mallet,{arg in=0,out=0,f=0,f2=0,a=0.1,r=1.8;\n\n var sig=Array.fill(3,{|n| SinOsc.ar(f*(n+1),mul:a/(n*n+1))}).sum;\n var env=EnvGen.kr(Env.perc(0.001,r),gate:Impulse.kr(f2),doneAction:0);\n\nOut.ar(out,sig*env!2);\n};\n).add;\n\n~root=60;\n~degrees=[0,4,5,7,9,12,16,17,19,21].scramble;\n~num=10;\n~coeff=0.75;\n\nArray.fill(~num,{|n| Synth.new(\\mallet,[\\f:(~root +~degrees[n]).midicps,\\a:0.2/~num,\\f2:(1+(n*~coeff))*0.1])});\n\ns.quit;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nPbind(\\degree, Pseq([0, 2, 4, 7], inf), \\dur, 0.25).play;\n```"}, {"role": "assistant", "content": "It plays a four-note major arpeggio in a loop, one note every 250 ms.\n\n`Pbind` builds an event stream: each event is the current value of every key. `Pseq([0, 2, 4, 7], inf)`\ncycles the degrees forever, and `\\dur, 0.25` sets the time between events in beats on the default\nTempoClock. With no `\\instrument`, the `\\default` SynthDef is used, which converts `\\degree` to a\nfrequency through the current scale (major, rooted at C by default). `.play` schedules it on the clock\nand returns an EventStreamPlayer."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PulseCount`."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\"help-PulseCount\", { |out = 0|\n Out.ar(out,\n SinOsc.ar(\n PulseCount.ar(Impulse.ar(10), Impulse.ar(0.4)) * 200,\n 0, 0.05\n )\n )\n}).play;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n~loDev = -6;\n~hiDev = 5;\n~lookBack = 3;\n~thr = 1;\n\np = Pbind(\n \\dur, 1/7,\n \\midinote, PIdev(\n Pseg(Pseq([65, 90], inf), 5, \\sin),\n 5,\n Pfunc { ~loDev },\n Pfunc { ~hiDev },\n Pfunc { ~lookBack },\n Pfunc { ~thr }\n ).trace(prefix: \"midi \"),\n).play;\n;\n\n// close floats can occur here\n~thr = 0.01\n\n// not here\n~thr = 2\n\np.stop\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n~loDev = -6;\n~hiDev = 5;\n~lookBack = 3;\n~thr = 1;\n\np = Pbind(\n \\dur, 1/7,\n \\midinote, PIdev(\n Pseg(Pseq([65, 90], inf), 5, \\sin),\n 5,\n Pfunc { ~loDev },\n Pfunc { ~hiDev },\n Pfunc { ~lookBack },\n Pfunc { ~thr }\n ).trace(prefix: \"midi \"),\n).play;\n);\n\n// close floats can occur here\n~thr = 0.01\n\n// not here\n~thr = 2\n\np.stop\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n~resize_enveloppe = { | levels, times |\n var reverted_levels, index;\n index = 0;\n reverted_levels = levels.reverse;\n while( { reverted_levels[index] == 0 && reverted_levels[index+1] == 0 }, { times[ times.size - 1 - index] = 0.01; index = index + 1 } );\n};\n)\n```"}, {"role": "assistant", "content": "Enveloppes sizes are fixed. This means that if enveloppe's levels are equals to [ 1, 0, 0, 0, 0, 0, 0, 0 ] and times are equals to [ 1, 1, 1, 1, 1, 1, 1, 1 ], the synth UGens will take resources 8 seconds but will only be audible 1 second. To avoid this, passing both the levels and the times to this function will detect when the sound stops playing and will reduce the \"silence\" times to 0.01s, thu."}]} -{"conversations": [{"role": "user", "content": "What does `InstrBrowser.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Browse your instrument library, with customizable actions Arguments: toolbarFunc; topBarFunc; showUGenInstr."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Feedback with beats."}, {"role": "assistant", "content": "```supercollider\nNdef(\\a, {\n var src, loc, delay=0.01;\n src = Decay2.ar(Impulse.ar(1/8), LFNoise2.kr(4).range(0.001, 0.0001),\n LFNoise2.kr(4).range(0.005, 0.05))!2\n * Saw.ar(LFNoise2.kr(4).exprange(40, 4000));\n loc = BPF.ar(LocalIn.ar(2) + [src, 0], LFNoise0.kr(1/4).range(100, 1200).lag, 3.2);\n loc = GVerb.ar(loc, 100, 4, mul:0.02, add:loc);\n loc = Compander.ar(loc, loc, 0.9, 1, 0.001);\n loc = (loc * 0.501).tanh;\n loc = Compander.ar(loc, loc, 0.1, 1, 0.1); \n loc = DelayC.ar(loc, delay * 2, delay * 1);\n LocalOut.ar(loc.reverse * 0.49);\n Out.ar(0, loc * 0.9)\n}).play;\n\nNdef(\\b, {\n var src, loc, del;\n del = 1/100;\n src = Decay2.ar(TDuty.ar(1/4,0,Dseq([1, 0.5, 0.3, 0.1],inf)), \n LFNoise2.kr(4).range(0.001, 0.0001), LFNoise2.kr(4).range(0.005, 0.05))!2\n * Saw.ar(LFNoise2.kr(200).exprange(40, 14000));\n loc = BPF.ar(LocalIn.ar(2) + [src, 0], LFNoise2.kr(0.1).range(40, 400), 3.2);\n loc = GVerb.ar(loc, 100, 4, mul:0.02, add:loc);\n loc = Compander.ar(loc, loc, 0.9, 1, 0.001);\n loc = (loc * 0.51).tanh;\n loc = Compander.ar(loc, loc, 0.1, 1, 0.1); \n loc = DelayC.ar(loc, del * 2, del * 1);\n LocalOut.ar(loc.reverse * 0.45);\n Out.ar(0, Compander.ar(loc,loc,0.1, 1, 0.05) * 1.2)\n}).play;\n\nNdef(\\c, {\n var src, loc, del=1/4;\n src = Decay2.ar(Impulse.ar(1), 0.0001, 0.05) * SinOsc.ar(60);\n loc = src + LocalIn.ar(2);\n loc = BPF.ar(loc, 800, 3.2).softclip;\n loc = DelayN.ar(loc, del, [0, del]);\n LocalOut.ar(loc.reverse * 0.99);\n Out.ar(0, loc * 2)\n}).play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `LADSPA.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Run any LADSPA plugin inside SuperCollider Arguments: nChans — the number of output audio channels; id — the UniqueID for the LADSPA ugen that should be used; ... args — all the inputs in the same order as shown in `listPlugins`."}]} -{"conversations": [{"role": "user", "content": "What are you good at?"}, {"role": "assistant", "content": "SuperCollider. I can explain its classes and UGens, write SynthDefs and patches, read a patch back to you, and tell you why one does not compile. I am 198M parameters; I am not a general assistant."}]} -{"conversations": [{"role": "user", "content": "I edited a SynthDef and the running sound did not change."}, {"role": "assistant", "content": "Redefining a SynthDef only affects Synths created after the new definition reaches the server; existing instances keep the graph they were built with. Free and recreate them: `~s.free; ~s = Synth(\\name)`. In JITLib, Ndef is the tool designed for this — redefining `Ndef(\\name, { ... })` crossfades to the new graph while it plays."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for IP detector."}, {"role": "assistant", "content": "```supercollider\n// The following strings are to avoid listing network bridges which seem to be created by Parallels Desktop:\n// | grep -Fv \"inet 10.\" \n\n(\n~getLocalIPs = {\n var winCMD, macCMD, linCMD, ips;\n \n winCMD = {\n \"ipconfig | findstr /C:IPv4\"\n .unixCmdGetStdOut\n .replace(\" IPv4 Address. . . . . . . . . . . : \", \"\");\n };\n \n macCMD = {\n (\"ifconfig | grep -Fv\" + \"inet 10.\"\n .quote + \"| grep\" + \"inet \"\n .quote + \"| grep -Fv 127.0.0.1 | awk '{print $2}'\"\n ).unixCmdGetStdOut;\n };\n \n linCMD = {\n (\"ip address | grep \\\"inet \\\" | grep -Fv 127.0.0.1 | awk '{print $2}' | cut -d '/' -f1\")\n .unixCmdGetStdOut;\n };\n //linCMD = { (\n // \"ifconfig | grep\" + \"inet \".quote +\n // \"| grep -Fv 127.0.0.1 | awk '{print $2}'\" \n //).unixCmdGetStdOut };\n \n ips = Platform.case(\n \\osx, { macCMD.() },\n \\linux, { linCMD.() },\n \\windows, { winCMD.() }\n );\n \n ips = ips.split(Char.nl);\n ips.removeAt(ips.size-1);\n ips\n}\n);\n\n~getLocalIPs.()\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// check blockSize before (or reset blockSize in examples)\n\n(\nif (s.options.blockSize != 64) {\n s.options.blockSize = 64;\n s.quit.reboot;\n}\n);\n\n// func can take an index as third arg, it runs from 0 to blockSize - 1\n// this can be used to define the feedback relation depending on it\n\n// note that inDepth is set to [2, 1] as we look back to inSig[i-1] (in[1][0]),\n// but not to lfo[i-1] (in[0][1] == lfo[0]), this saves 128 UGens !\n\n\n(\nx = {\n var inSig = SinOsc.ar([50, 50.1]);\n var lfo = SinOsc\n// …\n```"}, {"role": "assistant", "content": "check blockSize before (or reset blockSize in examples) func can take an index as third arg, it runs from 0 to blockSize - 1 (Fb1: single sample feedback / feedforward pseudo ugen)"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Klank`."}, {"role": "assistant", "content": "```supercollider\n{ Klank.ar(`[[800, 1071, 1153, 1723], nil, [1, 1, 1, 1]], Impulse.ar(2, 0, 0.1)) }.play;\n\n{ Klank.ar(`[[800, 1071, 1353, 1723], nil, [1, 1, 1, 1]], Dust.ar(8, 0.1)) }.play;\n\n{ Klank.ar(`[[800, 1071, 1353, 1723], nil, [1, 1, 1, 1]], PinkNoise.ar(0.007)) }.play;\n\n{ Klank.ar(`[[200, 671, 1153, 1723], nil, [1, 1, 1, 1]], PinkNoise.ar([0.007, 0.007])) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// Let's extract the DC component - i.e. the magnitude at binindex zero.\n(\n{\n var sig, chain, stream, windowStarts, demand;\n var fftsize = 1024;\n\n sig = SinOsc.ar(LFDNoise3.kr(LFNoise0.kr(1) * 40 + 60) * 700 + 800);\n\n chain = FFT(LocalBuf(fftsize), sig);\n stream = Unpack1FFT(chain, bufsize: fftsize, binindex: 0, whichmeasure: 0);\n\n // each time an FFT window starts, the unpacker returns a new value\n windowStarts = chain > -1;\n demand = Demand.kr(windowStarts, 0, stream);\n demand.poll(\n// …\n```"}, {"role": "assistant", "content": "Let's extract the DC component - i.e. the magnitude at binindex zero. each time an FFT window starts, the unpacker returns a new value (Unpack1FFT: Unpack a single value (magnitude or phase) from an FFT chain)"}]} +{"conversations": [{"role": "user", "content": "Explain `PIRand` in SuperCollider briefly."}, {"role": "assistant", "content": "PIRand — UGenPatterns quark library Based on IRand Category: Streams-Patterns-Events > UGenPatterns > Generators."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a, b;\na = Pgbrown(0.0, 1.0, 0.2, inf);\nb = a.asStream;\n7.do({ b.next.postln });\n);\n\n\n// sound example\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\nvar a;\na = Pgbrown(1.0, 2.0, 0.1, inf).asStream;\nRoutine({\n loop({\n Synth(\\help\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a, b;\na = Pgbrown(0.0, 1.0, 0.2, inf);\nb = a.asStream;\n7.do({ b.next.postln });\n);\n\n\n// sound example\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\nvar a;\na = Pgbrown(1.0, 2.0, 0.1, inf).asStream;\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, a.next * 600 + 300]);\n 0.02.wait;\n })\n}).play;\n);\n\n// compare with normal brownian motion:\n\n(\nvar a;\na = Pbrown(1.0, 2.0, 0.1, inf).asStream;\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, a.next * 600 + 300]);\n 0.02.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Dictionary.asPairs` do? What arguments does it take?"}, {"role": "assistant", "content": "Return the values in an array of alternating key value pairs, like `[\\freq, 1848, \\amp, 0.2]`. This is part of the Key-Value-Pairs Arguments: class — The class of the collection to be returned. By default this is an Array.."}]} +{"conversations": [{"role": "user", "content": "What does `ListView.defaultCanReceiveDrag` do?"}, {"role": "assistant", "content": "A view displaying a list of text items. Returns: True if the current drag data is a number."}]} +{"conversations": [{"role": "user", "content": "What does `Pprob.new` do? What arguments does it take?"}, {"role": "assistant", "content": "random values with arbitrary probability distribution Arguments: distribution — desired probability distribution (histogram).; lo — lower bound of the resulting values.; hi — upper bound of the resulting values.; length — number of values to repeat.; tableSize — resample table to this size. If the size of the distribution is smaller than 64, it is (linearly) resampled to this minimum size.; distribution — set the distribution, the table is recalculated.; tableSize — set the resample size, the table is recalculated.."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Monitor`."}, {"role": "assistant", "content": "```supercollider\n{ Out.ar(87, SinOsc.ar(MouseX.kr(240, 1000, 1) * [1, 2, 3], 0, 0.2)) }.play; // play three sine tone on channels 87, 88, and 89\nx = Monitor.new; // create a new monitor\nx.play(fromIndex: 87, fromNumChannels: 3, toIndex: 0, toNumChannels: 2); // play them back to the stereo hardware channels\n```"}]} +{"conversations": [{"role": "user", "content": "What is `IdentitySet` in SuperCollider?"}, {"role": "assistant", "content": "IdentitySet — a set according to identity An IdentitySet is a collection of objects, no two of which are the same object (aka. \"identical\"). Most of its methods are inherited (see Collection and Set classes). The contents of an IdentitySet are unordered. You must not depend on the order of items in an IdentitySet. For an ordered set, see OrderedIdentitySet. Category: Collections > Unordered."}]} +{"conversations": [{"role": "user", "content": "What does `ServerOptions.threadPinning` do?"}, {"role": "assistant", "content": "Enable/disable thread pinning. For scsynth this value is ignored. Thread pinning forces each thread to only run on a particular CPU core. Depending on the system, this might give better or worse performance. Default is `nil` which means that the value is chosen by Supernova. (At the time of writing, it is by default enabled on Linux and disabled on macOS and"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// a Buffer for the UGens to use, one second at the current sample rate\nb = Buffer.alloc(s, s.sampleRate * 1, 1);\n\n// write a signal into a delay, tap it at multiple times\nSynthDef(\\test, { |out, buffer|\n var src, tapPhase, tap1, tap2, tap3;\n src = WhiteNoise.ar(0.2) * Decay.kr(Dust.kr(3), 0.2);\n tapPhase = DelTapWr.ar(buffer, src);\n #tap1, tap2, tap3 = DelTapRd.ar(buffer, tapPhase,\n [0.2, 0.27, 0.303], // tap times\n 1, // no interp\n [1.\n// …\n```"}, {"role": "assistant", "content": "a Buffer for the UGens to use, one second at the current sample rate write a signal into a delay, tap it at multiple times (DelTapWr: Write to a buffer for a DelTapRd UGen)"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `PdurStutter`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,0,1,3,4,0], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n100.do({ x.next.postln });\n);\n\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n);\n\n\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,4,4,0,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Function`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\nx = { |freq = 440| SinOsc.ar(freq, 0, 0.3) }.play; // this returns a Synth object;\nx.set(\\freq, 880); // note you can set the freq argument\nx.defName; // the name of the resulting SynthDef\nx.release(4); // fadeout over 4 seconds\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n \n// definition for future reference in arbitrary Environments\n\np = PLlprand(\\lo, \\hi);\n\n\n// prepare current Environment\n// PLseq repeats arg defaults to inf\n\n(\n~lo = 60;\n~hi = PLseq((92..62));\n);\n\n\n// run\n\n(\nx = Pbind(\n \\midinote, Ptuple(p!5), \n \\dur, 0.1,\n \\amp, 0.05\n).play;\n);\n\n\n// replace, converging bounds\n\n(\n~lo = PLseq((40..70) ++ (70!5));\n~hi = 70.5;\n);\n\nx.stop;\n```"}, {"role": "assistant", "content": "definition for future reference in arbitrary Environments prepare current Environment (PLlprand: dynamic scope Plprand variant)"}]} +{"conversations": [{"role": "user", "content": "What does `Mx.nextID` do?"}, {"role": "assistant", "content": "A mixer and dynamic patching Returns: int"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `BPF`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// synthdefs to play with\n(\nSynthDef(\\noise_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, rq = 0.1, amp = 0.1|\n var sig = { WhiteNoise.ar } ! 2;\n sig = BPF.ar(sig, freq, rq) *\n EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2) *\n (rq ** -1) * (250 / (freq ** 0.8));\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\sin_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { SinOsc.ar(freq, Rand(0, 2pi)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n\n\nSynthDef(\\saw_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { VarSaw.ar(freq, Rand(0, 1)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Pmulpre` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain);\nb = Pmulpre(\\freq, Pseq([1, 2, 3], inf), a);\nb.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `PulseDivider`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\"help-PulseDivider\", { |out = 0|\n var p, a, b;\n p = Impulse.ar(8);\n a = SinOsc.ar(1200, 0, Decay2.ar(p, 0.005, 0.1));\n b = SinOsc.ar(600, 0, Decay2.ar(PulseDivider.ar(p, 4), 0.005, 0.5));\n\n Out.ar(out, (a + b) * 0.4)\n}).play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LFDNoise0`."}, {"role": "assistant", "content": "```supercollider\n// try wiggling mouse quickly;\n// LFNoise frequently seems stuck, LFDNoise changes smoothly.\n\n{ LFNoise0.ar(MouseX.kr(0.1, 1000, 1), 0.1) }.play\n\n{ LFDNoise0.ar(MouseX.kr(0.1, 1000, 1), 0.1) }.play\n\n// silent for 2 secs before going up in freq\n\n{ LFNoise0.ar(XLine.kr(0.5, 10000, 3), 0.1) }.scope;\n\n{ LFDNoise0.ar(XLine.kr(0.5, 10000, 3), 0.1) }.scope;\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFNoise0.ar(XLine.kr(1000, 20000, 10), 0.1) }.scope;\n\n{ LFDNoise0.ar(XLine.kr(1000, 20000, 10), 0.1) }.scope;\n\n{ LFNoise2.ar(1000, 0.25) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `PatchIn` in SuperCollider briefly."}, {"role": "assistant", "content": "PatchIn — manages a Player's input when connecting to other Players These objects hold information about a Player's inputs and outputs. They are used to make connections to other Players, and to manage that connection and all subsequent repatching or disconnections. Category: Libraries > crucial > internals."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Klank`."}, {"role": "assistant", "content": "```supercollider\n(\n{\nKlank.ar([ // the multichannel-expansion\n `[[500, 1078, 1201.5, 1723], nil, [1, 1, 0.5, 0.3]], // left channel\n `[[700, 1071, 1053, 1723], nil, [1, 1, 1, 1]] // right channel\n ], Impulse.ar([1.5, 1.875], 0, 0.1))\n}.play\n);\n\n// expanding specs within the parameter array\n{ Klank.ar(`[[[800, 6000], 1071, [1153, 8000], 1723], nil, [1, 1, 1, 1]], Impulse.ar([2, 3], 0, 0.1)) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Speech to midi converter?"}, {"role": "assistant", "content": "SuperCollider forum — Speech to midi converter?\n\nHello!\n\nI want to make a speech to midi converter in Supercollider.\n\nI’ve started off trying to find a way to convert FFT data to midi-numbers to send to a midi-instrument, but I’m stuck:\n\n```supercollider\n~file = Buffer.read(s, \"path_to_file\", bufnum:1);\n\n(\n{\n var buf = Buffer.alloc(s, 2048, bufnum:2);\n var sig = PlayBuf.ar(2, 1, loop:1);\n var chain = FFT(buf, sig);\n var trig = Impulse.kr(30);\n chain[0].pvcalc(80, {\n |phas, mag|\n SendReply.kr(trig, \"/anal\", mag);\n });\n}.play\n);\n\n(\nOSCdef.new(\\midiConverter, {\n |msg|\n msg.postln;\n}, \"/anal\");\n)\n```\n\nthe output looks like this:\n\n[ /anal, 1000, -1, 0.0, 3.0463190078735, 2.1142015457153, -0.64955651760101, 2.3432319164276, -0.23956227302551, -3.1334409713745, -2.1829152107239, 1.1417833566666, -2.2972648143768, -0.74415707588196, -0.88793164491653, 1.9947071075439, -1.1327115297318, 2.6084003448486, etc...]\n\nI’m not sure how to interpret theese numbers. And I’m not sure pvcalc is even the best way to get the data I need. I want to somehow be able to control the resolution on how many of the loudest bins I’m going to convert to frequency and then from frequency to midi-number to send to a midi-instrument as the soundfile plays through.\n\nAny ideas?"}]} +{"conversations": [{"role": "user", "content": "What does `EZKnob.value` do? What arguments does it take?"}, {"role": "assistant", "content": "Gets/sets the list/menu to the index at value. Does not perform the Arguments: val — An Integer.."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BufWr`."}, {"role": "assistant", "content": "```supercollider\n(\n// allocate a buffer for writinig into\ns = Server.local;\ns.sendMsg(\"/b_alloc\", 0, 44100 * 2);\n);\n\n\n// write into the buffer with a BufWr\n(\ny = { |rate = 1|\n var in;\n in = SinOsc.ar(LFNoise1.kr(2, 300, 400), 0, 0.1);\n BufWr.ar(in, 0, Phasor.ar(0, BufRateScale.kr(0) * rate, 0, BufFrames.kr(0)));\n 0.0 // quiet\n}.play;\n);\n\n// read it with a BufRd\n(\nx = { |rate = 1|\n BufRd.ar(1, 0, Phasor.ar(0, BufRateScale.kr(0) * rate, 0, BufFrames.kr(0)))\n}.play(s);\n);\n\n\n\nx.set(\\rate, 5);\ny.set(\\rate, 2.0.rand);\nx.set(\\rate, 2);\n```"}]} +{"conversations": [{"role": "user", "content": "What is `GbmanN` in SuperCollider?"}, {"role": "assistant", "content": "GbmanN — Gingerbreadman map chaotic generator A non-interpolating sound generator based on the difference equations: Category: UGens > Generators > Chaotic."}]} +{"conversations": [{"role": "user", "content": "What does `PopUpEditor.selectedIndex` do?"}, {"role": "assistant", "content": "selects from an integer => name option array"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n Ramp.kr( // lag the modulator\n LFPulse.kr(4, 0, 0.5, 50, 400), // frequency modulator\n Line.kr(0, 1, 15) // modulate lag time\n ),\n 0, // phase\n 0.3 // sine amplitude\n )\n}.scope;\n);\n\n// Compare\n(\nvar pulse;\n{\n pulse = LFPulse.kr(8.772);\n Out.kr(0, [Ramp.kr(pulse, 0.025), Lag.kr(pulse, 0.025), pulse]);\n}.play;\ns.scope(3, bufsize: 4\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n Ramp.kr( // lag the modulator\n LFPulse.kr(4, 0, 0.5, 50, 400), // frequency modulator\n Line.kr(0, 1, 15) // modulate lag time\n ),\n 0, // phase\n 0.3 // sine amplitude\n )\n}.scope;\n);\n\n// Compare\n(\nvar pulse;\n{\n pulse = LFPulse.kr(8.772);\n Out.kr(0, [Ramp.kr(pulse, 0.025), Lag.kr(pulse, 0.025), pulse]);\n}.play;\ns.scope(3, bufsize: 44100, rate: \\control, zoom: 40);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BrownNoise`."}, {"role": "assistant", "content": "```supercollider\n{ BrownNoise.ar(0.1) }.play;\n{ WhiteNoise.ar(0.1) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Routine`?"}, {"role": "assistant", "content": "Routine — Functions that can return in the middle and then resume where they left off"}, {"role": "user", "content": "What does `Routine.new` do?"}, {"role": "assistant", "content": "Creates an instance of Routine, passing it the Function with code to run."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nr = Routine { |inval|\n loop {\n // thisThread refers to the routine.\n postf(\"beats: % seconds: % time: % \\n\",\n thisThread.beats, thisThread.seconds, Main.elapsedTime\n );\n 1.0.yield;\n\n }\n}.play;\n);\n\nr.stop;\nr.beats;\nr.seconds;\nr.clock;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n//a SynthDef\n(\nSynthDef(\"plucking\", {arg amp = 0.1, freq = 220, decay = 5, coef = 0.1;\n\nvar env, snd;\nenv = EnvGen.kr(Env.linen(0, decay, 0.5), doneAction: 2);\nsnd = Pluck.ar(\n in: Saw.ar(freq, 0.5*amp),\n trig: Impulse.kr(0),\n\n maxdelaytime: 0.1,\n delaytime: freq.reciprocal,\n decaytime: decay,\n coef: coef);\n Out.ar(0, [snd, snd]);\n}).add;\n);\n\n//Bugger soundtrack\n(\nPbind(\n \\instrument, \"plucking\",\n \\scale, Scale.lydian,\n \\degree, Prand([[-2.5, -4.001], [-7.002, -5], [-1, -3.003], [1.005, 0.51]], inf),\n \\amp, Pseq([0.1, 0.2, 0.3, 0.4, 0.5, 0.5, 0.5, 0.5], inf),\n \\decay, Pseq([0.25,1, 0.5, 0.125], inf),\n \\coef, Pseq([0.7, 0.8, 0.9], inf),\n \\dur, Pseq([0.01, 0.0025, 0.2475, 0.24, 0.5], inf)\n).play;\n)\n```"}, {"role": "assistant", "content": "This will be the sound track for Bugger, a Frogger clone that started as a school assignment.\r\nSimple SynthDef using Pluck, and a few Pbinds. \r\n\r\nBugger can be found on [GitLab](https://gitlab.com/Modanung/Bugger)."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// randomly modulate params\n(\n{ FBSineN.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(1, 32, 33),\n LFNoise2.kr(1, 0.5),\n LFNoise2.kr(1, 0.05, 1.05),\n LFNoise2.kr(1, 0.3, 0.3)\n) * 0.2 }.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// randomly modulate params\n(\n{ FBSineN.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(1, 32, 33),\n LFNoise2.kr(1, 0.5),\n LFNoise2.kr(1, 0.05, 1.05),\n LFNoise2.kr(1, 0.3, 0.3)\n) * 0.2 }.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `NRand`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-NRand\", { |out = 0, n = 0|\n Out.ar(out,\n FSinOsc.ar(\n NRand(1200.0, 4000.0, n),\n 0, Line.kr(0.2, 0, 0.01, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n(\nn = 0;\nRoutine({\n inf.do({ |i|\n Synth.new(\"help-NRand\", [\\n, n]); 0.05.wait;\n })\n}).play;\n);\n\nn = 1;\nn = 2;\nn = 4;\n```"}]} +{"conversations": [{"role": "user", "content": "What are the arguments of EnvGen?"}, {"role": "assistant", "content": "`EnvGen.ar(envelope, gate, levelScale, levelBias, timeScale, doneAction)` — or the .kr form. Envelope is an Env; gate is the signal that holds the envelope open (a number for a one-shot, a trigger or gate control for a sustained sound); levelScale and levelBias scale and offset the output; timeScale stretches durations. Use `doneAction: 2` on a one-shot so the Synth frees itself."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// This can go towards granulation\n\n// load sound file\n\nb = Buffer.read(s, Platform.miSCellaneousDirs[0] +/+ \"Sounds\" +/+ \"kitchen_sounds_1.wav\");\n\n\n// switch between looping PlayBufs\n\n(\nx = {\n var sig = {\n DXMix.ar(\n Dxrand([0, 1, 2], inf),\n `(PlayBuf.ar(1, b, BufRateScale.kr(b) * [0.4, 1, 2.2], loop: 1)),\n stepTime: 0.2,\n fadeTime: 0.01,\n fadeMode: 1,\n width: 2\n ) } ! 2;\n // do a bit correlation\n Splay.ar(sig, 0.8\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// This can go towards granulation\n\n// load sound file\n\nb = Buffer.read(s, Platform.miSCellaneousDirs[0] +/+ \"Sounds\" +/+ \"kitchen_sounds_1.wav\");\n\n\n// switch between looping PlayBufs\n\n(\nx = {\n var sig = {\n DXMix.ar(\n Dxrand([0, 1, 2], inf),\n `(PlayBuf.ar(1, b, BufRateScale.kr(b) * [0.4, 1, 2.2], loop: 1)),\n stepTime: 0.2,\n fadeTime: 0.01,\n fadeMode: 1,\n width: 2\n ) } ! 2;\n // do a bit correlation\n Splay.ar(sig, 0.8)\n}.play\n);\n\nx.release\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Every` in SuperCollider?"}, {"role": "assistant", "content": "Every — holds a list of Contraints, validates that the test object satisifes all of those Given a list of contraints (or simple functions), the .value method will validate that the test object satisfies all of them. This is like chaining many (constraint and: constaint) together Category: Libraries > crucial > Constraints."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for 003_102 (a SuperCollider snippet). Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\nSynthDef('003_102', {|out=0,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y| Out.ar(out, Pan2.ar(Normalizer.ar(( GbmanL.ar( LPF.ar( SyncSaw.ar(p, k, q, h ), FreqShift.ar(d, r, k, y, a ), h, n ), r, l, Blip.ar(r, f, u, i ), h ))*( LFPar.ar(d, x, Saw.ar(w, k, Formant.ar(s, q, d, DelayL.ar(y, 0.5, w, v, i ), e ) ), y ))*( LFCub.ar(q, a, h, g ))*( Gendy1.ar(r, c, r, QuadL.ar(h, o, j, t, t, v, f ), k, p, g, Pulse.ar(g, g, c, s ), PMOsc.ar(f, u, d, t, d, f ), f, LFNoise0.ar(k, l, e ), d ) )))) }).play(args: #[ a, 0.1, b, 0.83039082494709, c, 7.4736936148092, d, 57.834883574831, e, 0.56638920329924, f, 2.7610572022348, g, -0.60208093272399, h, 0.69731527262978, i, 0.97553825378418, j, 0.47619211673737, k, 0.45142233371735, l, 6.5229251440451, m, 0.34238355327673, n, 3.1624102065486, o, 1, p, 1, q, 5.4898714868897, r, 2.7777416341664, s, 10966.099508885, t, 0.15706503391266, u, 3.1945936724559, v, 20000, w, -4.6151277924266, x, 1.4588773159677, y, 0.0012384873762477 ])\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(//*********PREPARE**********\np.pop;\n//Any code that needs to access your own environment goes here\np = ProxySpace.push(s);\n~fxLoop.play.fadeTime_(5);\n);\n\n(//*********FXLoop**********\n~fxLoop = {\n var in = SoundIn.ar([0,1]);\n in;\n}\n)\n```"}, {"role": "assistant", "content": "Code for using Supercollider as a realtime livecode FX processor for audio input. Blog post explaing this code: http://schemawound.com/post/53528545022/fxloop."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for blaplop (a SuperCollider snippet) that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\bla, { arg out=0, amp=0.1, gate=1, pan=0, freq=200;\n var sig;\n var tab;\n tab = \\tab.kr(1 ! 15);\n sig = LFSaw.ar(freq * tab.abs);\n sig = sig.sum;\n sig = RLPF.ar(sig, Rand(10,freq*2) + 100 * SinOsc.ar(tab.abs).range(0.01,Rand(2,7)));\n sig = sig.sum;\n sig = sig / 100;\n sig = sig.tanh;\n sig = sig * EnvGen.ar(Env.adsr(0.01,0.1,0.8,0.1+ExpRand(0.001,0.2)),gate,doneAction:2);\n sig = Pan2.ar(sig, pan, amp);\n Out.ar(out, sig);\n}).add;\n);\n\n(\nPdef(\\plop, Pbind(\n \\instrument, \\bla,\n \\degree, Pstep(Pseq([\n Pseq([0,2,4],4),\n Pseq([0,12,6],4),\n Pseq([0,12,6]+7,1),\n ],inf), 1),\n \\octave, 3,\n \\tab, Pfunc {\n var tab;\n [\n //tab = { arg n; (n + 1.asFloat.rand + 1).tanh / (n.rand+1) } ! 15;\n tab = { arg n; (n + 2.asFloat.rand + 1) / (n+1) } ! 15;\n tab.postln;\n ]\n },\n \\dur, PdurStutter( Prand([1,2,4],inf), Pseq([1,2,3]/2,inf)),\n \\amp, 0.4\n)).play;\n);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SGUIelement.asView` do?"}, {"role": "assistant", "content": "layout support. only latest (last) view is returned. makes adding views to layouts"}]} +{"conversations": [{"role": "user", "content": "What is `FFTSubbandFlatness` in SuperCollider?"}, {"role": "assistant", "content": "FFTSubbandFlatness — Spectral flatness, divided into subbands Calculates the spectral flatness measure, in the same manner as FFTFlatness, but divides the spectrum into (adjacent, non-overlapping) subbands, so returns separate measures for the different subbands. Category: UGens > Analysis, UGens > FFT."}]} +{"conversations": [{"role": "user", "content": "Write a bell in SuperCollider."}, {"role": "assistant", "content": "A bell is a set of inharmonic partials with a long percussive decay. The ratios below are the\nclassic bell ones; the envelope frees the Synth when it ends.\n\n```supercollider\n(\nSynthDef(\\bell, { |out = 0, freq = 440, amp = 0.2, dur = 3|\n var partials = [1, 2.76, 5.4, 8.93];\n var amps = [1, 0.5, 0.3, 0.15];\n var sig = SinOsc.ar(freq * partials) * amps;\n var env = EnvGen.kr(Env.perc(0.001, dur, 1, -6), doneAction: 2);\n Out.ar(out, Pan2.ar(Mix(sig) * env * amp, 0));\n}).add;\n);\nSynth(\\bell, [\\freq, 660, \\dur, 4]);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `DataFilter.filt_b` do?"}, {"role": "assistant", "content": "current filter constants. looked up at instance creation or when changing sample"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `EnvGen` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// as amplitude envelope\n(\n{\n var env = Env([0, 1, 0.5, 1, 0], [0.01, 0.5, 0.02, 0.5]);\n SinOsc.ar(470) * EnvGen.kr(env, doneAction: Done.freeSelf)\n}.play\n);\n\n// as amplitude and modulation envelope\n(\n{\n var env = Env([0, 1, 0.5, 0.8, 0, 1.2, 0], [0.01, 0.5, 0.02, 0.5, 0.2, 0.5]);\n var gate = Impulse.kr(MouseX.kr(0.2, 3), 0.5);\n var gen = EnvGen.kr(env, gate);\n SinOsc.ar(270, SinOsc.ar(gen * 473)) * gen * 0.2\n}.play\n);\n// EnvGen multichannel expands when passed a multichannel envelope\n(\n{\n SinOsc.ar(\n EnvGen.kr(\n Env.circle([0, 1, 0, (2..4), 0, LFNoise1.kr(0.1 ! 5) * 10, 0], [0.01, 0.6])\n )\n * 240 + 300\n ).sum * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `RunningSum`."}, {"role": "assistant", "content": "```supercollider\n// distorts of course - would need scaling\n{ RunningSum.ar(SoundIn.ar) }.play\n\n// Running Average over x samples\n(\n{\n var x = 100;\n RunningSum.ar(LFSaw.ar, x) * (x.reciprocal)\n }.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `AbstractFunction.cpsmidi` do?"}, {"role": "assistant", "content": "Converts cycles per seconds (Hz) into midinote. `a = { |x| #[440, 720, 801, 1020.2].at(x) }; b = a.cpsmidi;"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Ringz` that runs as it is."}, {"role": "assistant", "content": "```supercollider\na = NodeProxy(s);\na[0] = { |freq = 440, dt=0.1, rate=2| Ringz.ar(Impulse.ar(rate * [1, 1.2]), freq, dt)*0.1 };\na.play;\n(\na[1] = \\set -> Pbind(\n \\dur, Prand([1, 0.5], inf),\n \\freq, Pwhite(200.0, 1000, inf),\n \\rate, Pdup(4, Prand([1, 3, 6, 10], inf)),\n \\dt, Pwhite(0.01, 0.1, inf)\n)\n);\n// modify the source in the meanwhile:\na[0] = { |freq = 440, dt=0.1, rate=2| Ringz.ar(Dust.ar(rate * 10.dup), freq, dt)*0.1 };\n\na.nodeMap.postln; // the values are not set in the node map.\na.clear(3);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Gbman2DN.ar(MouseX.kr(20, SampleRate.ir*0.25), MouseX.kr(80, SampleRate.ir), 0.1) }.play(s);\n\n{ Gbman2DN.ar(11025, 22050, -0.7, -2.7, 0.1) }.play(s);\n\n{ Gbman2DN.ar(2200, 8800, 1.2, 2.0002, 0.1) }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Gbman2DN.ar(MouseX.kr(20, SampleRate.ir*0.25), MouseX.kr(80, SampleRate.ir), 0.1) }.play(s);\n\n{ Gbman2DN.ar(11025, 22050, -0.7, -2.7, 0.1) }.play(s);\n\n{ Gbman2DN.ar(2200, 8800, 1.2, 2.0002, 0.1) }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a filter sweep over a saw."}, {"role": "assistant", "content": "An LFO on the cutoff of a resonant low-pass; XLine or an LFO both work, the LFO is the loopable one.\n\n```supercollider\n{ LPF.ar(Saw.ar([60, 60.2]), SinOsc.kr(0.2).exprange(150, 4000), 0.4) * 0.2 }.play;\n```\n\n`.exprange` is the exponential mapping you want for frequency; a linear `.range` sweep sounds uneven."}]} +{"conversations": [{"role": "user", "content": "What does `EZNumber.setColors` do? What arguments does it take?"}, {"role": "assistant", "content": "Wrapper class for label and number box Arguments: stringBackground — An instance of Color. The `background` of the label and unit views.; stringColor — An instance of Color. The `stringColor` of the label and unit views.; numBackground — An instance of Color. The `background` of the number view.; numStringColor — An instance of Color. The `stringColor` of the number view.; numNormalColor — An instance of Color. The `normalColor` of the number view.; numTypingColor — An instance of Color. The `typingColor` of the number view.; background — An instance of Color. The `background` of the enclosing view.."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\limiter;\n~description = \"hard limiter\";\n~channelLayout = \\mono;\n~function = {|in = 0, limitDB = 0 |\nvar limit = limitDB.dbamp;\nLimiter.ar(in, limit);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "What does `RedBMP.asInt32Array` do?"}, {"role": "assistant", "content": "Converts the data to an Int32Array and return"}]} +{"conversations": [{"role": "user", "content": "I get 'Message not understood' on a nil variable."}, {"role": "assistant", "content": "`~buffer` (or any variable) was never assigned, or it was assigned in a different environment. Environment variables are per-environment: a `~buf` set in one server-side file block is not visible in another. Check with `~buf.postln` before using it. The other common cause is an assignment that failed silently, e.g. `~buf = Buffer.read(...)` where the file was missing — the error is posted but ~buf stays nil."}]} +{"conversations": [{"role": "user", "content": "Explain `PV_MagMul` in SuperCollider briefly."}, {"role": "assistant", "content": "PV_MagMul — Multiply magnitudes. Multiplies magnitudes of two inputs and keeps the phases of the first input. Category: UGens > FFT."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// This question comes up sometimes.\n// one way to do it is to define an event type:\n\n\n(\nEvent.addEventType(\\dnote, { |server|\n \n var instrument = ~instrument.asDefName;\n var synthLib = ~synthLib ?? { SynthDescLib.global };\n var desc = synthLib.at(instrument);\n \n \n if (desc.notNil) {\n desc.controls.do { |x|\n x.defaultValue !? { x.name.asSymbol.envirPut(x.defaultValue) }\n };\n // for efficiency, get this now\n ~hasGate = desc.hasGate;\n ~msgFunc = desc.msgFunc;\n };\n ~type = \\note;\n \n currentEnvironment.play;\n});\n);\n\n(\nSynthDef(\\test, { |out, freq = 1000| \n Out.ar(out, Line.ar(0.1, 0, 0.1, doneAction:2) * SinOsc.ar(freq)) \n}).add\n);\n\nPbind(\\type, \\dnote, \\instrument, \\test, \\dur, 0.3).play;\n```"}, {"role": "assistant", "content": "One answer to the question \"how to use the SynthDef's default argument in an Event?\"."}]} +{"conversations": [{"role": "user", "content": "What does `U.makeBundle` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: targets — (describe argument here); startPos — (describe argument here); synthAction — (describe argument here). Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "Can I run SuperCollider without the IDE?"}, {"role": "assistant", "content": "Yes. `sclang` runs the language and `scsynth` the server, and they are separate processes by design\n— the IDE is only a client. A headless script is a `.scd` run with `sclang my-piece.scd`, and it must boot\nthe server itself:\n\n```supercollider\ns.boot;\ns.waitForBoot {\n // build SynthDefs, play, then wait\n 30.wait;\n s.quit;\n};\n```\n\nThat shape — boot, wait, play, quit, exit — is what makes a piece runnable from a cron job or a\nRaspberry Pi."}]} +{"conversations": [{"role": "user", "content": "Explain `IFFT` in SuperCollider briefly."}, {"role": "assistant", "content": "IFFT — Inverse Fast Fourier Transform The inverse fast fourier transform converts from frequency content to a signal. Category: UGens > FFT."}]} +{"conversations": [{"role": "user", "content": "What is `Henon2DN` in SuperCollider?"}, {"role": "assistant", "content": "Henon2DN — henon map 2D chaotic generator `y = b * x(n)` Category: UGens > Generators > Stochastic."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = Env.adsr;\na.levels;\na.range(42, 45).levels;\na.exprange(42, 45).levels;\na.curverange(42, 45, -4).levels;\n\n(\n// Mapping an Env to an exponential frequency range:\n{\n SinOsc.ar(EnvGen.ar(Env.perc(0.01, 0.7).exprange(40, 10000), doneAction: Done.freeSelf)) * 0.2;\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = Env.adsr;\na.levels;\na.range(42, 45).levels;\na.exprange(42, 45).levels;\na.curverange(42, 45, -4).levels;\n\n(\n// Mapping an Env to an exponential frequency range:\n{\n SinOsc.ar(EnvGen.ar(Env.perc(0.01, 0.7).exprange(40, 10000), doneAction: Done.freeSelf)) * 0.2;\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// use input amplitude to control Pulse amplitude - use headphones to prevent feedback.\n{ Pulse.ar(90, 0.3, Amplitude.kr(SoundIn.ar(0))) }.play;\n```"}, {"role": "assistant", "content": "use input amplitude to control Pulse amplitude - use headphones to prevent feedback. (Amplitude: Amplitude follower)"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// allocate buffer\nb = Buffer.alloc(s, 44100, 1);\n\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nBufDelayC.ar(b.bufnum, z, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\nb.free;\n\n\n// multichannel\n\n// two channels, two buffers\nb = Buffer.allocConsecutive(2, s, 32768, 1);\n\na = { |bufs = #[0, 1]|\n var sig = SinOsc.ar([440, 880\n// …\n```"}, {"role": "assistant", "content": "Dust randomly triggers Decay to create an exponential decay envelope for the WhiteNoise input source (BufDelayC: Buffer based simple delay line with cubic interpolation.)"}]} +{"conversations": [{"role": "user", "content": "What does `RedDiskInSampler.free` do?"}, {"role": "assistant", "content": "Clear all keys, close files, free synths and"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\smooth, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.linen(0.05, sustain, 0.1), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n)\n```"}, {"role": "assistant", "content": "plays an arpeggio on the \"left hand\" and an arpeggio on the \"right hand\"."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Trig`."}, {"role": "assistant", "content": "```supercollider\n{ Trig.ar(Dust.ar(1), 0.2) * FSinOsc.ar(800, 0.5) }.play\n\n{ Trig.ar(Dust.ar(4), 0.1) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Compander`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var z;\n\n // signal (clean)\n z = Decay2.ar(\n Impulse.ar(8, 0, LFSaw.kr(0.3, 1, -0.3, 0.3)),\n 0.001,\n 0.3\n )\n * Mix.ar(Pulse.ar([80, 81], 0.3));\n\n // apply gate (mouse x sets treshold)\n Compander.ar(z, z,\n thresh: MouseX.kr(0.001, 1),\n slopeBelow: 10,\n slopeAbove: 1,\n clampTime: 0.01,\n relaxTime: 0.01\n )\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Gendy3.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Dynamic stochastic synthesis generator. Arguments: ampdist — Choice of probability distribution for the next perturbation of the amplitude of a control point. The distributions are (adapted from the GENDYN program in Formalized Music):; durdist — Choice of distribution for the perturbation of the current inter control point duration.; adparam — A parameter for the shape of the amplitude probability distribution, requires values in the range 0.0001 to 1 (there are safety checks in the code so don't worry too much if you want to modulate!).; ddparam — A parameter for the shape of the duration probability distribution, requires values in the range 0.0001 to 1.; freq — Oscillation frequency.; ampscale — Normally 0.0 to 1.0, multiplier for the distribution's delta value for amplitude. An ampscale of 1.0 allows the full range of -1 to 1 for a change of amplitude.; durscale — Normally 0.0 to 1.0, multiplier for the distribution's delta value for duration. An ampscale of 1.0 allows the full range of -1 to 1 for a change of duration.; initCPs — Initialise the number of control points in the memory. Xenakis specifies 12. There would be this number of control points per cycle of the oscillator, though the oscillator's period will constantly change due to the duration distribution.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Gbman2DL.ar(MouseX.kr(20, SampleRate.ir*0.25), MouseX.kr(80, SampleRate.ir), 0.1) }.play(s);\n\n{ Gbman2DL.ar(11025, 22050, -0.7, -2.7, 0.1) }.play(s);\n\n{ Gbman2DL.ar(2200, 8800, 1.2, 2.0002, 0.1) }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Gbman2DL.ar(MouseX.kr(20, SampleRate.ir*0.25), MouseX.kr(80, SampleRate.ir), 0.1) }.play(s);\n\n{ Gbman2DL.ar(11025, 22050, -0.7, -2.7, 0.1) }.play(s);\n\n{ Gbman2DL.ar(2200, 8800, 1.2, 2.0002, 0.1) }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// modulating the frequency\n\n{ Saw.ar(XLine.kr(40, 4000, 6), 0.2) }.play;\n\n// two band limited sawtooth waves through a resonant low pass filter\n\n{ RLPF.ar(Saw.ar([100, 250], 0.1), XLine.kr(8000, 400, 5), 0.05 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// modulating the frequency\n\n{ Saw.ar(XLine.kr(40, 4000, 6), 0.2) }.play;\n\n// two band limited sawtooth waves through a resonant low pass filter\n\n{ RLPF.ar(Saw.ar([100, 250], 0.1), XLine.kr(8000, 400, 5), 0.05) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `View.focusGainedAction` do?"}, {"role": "assistant", "content": "Sets or gets the object to be evaluated when the view gains the keyboard focus. It is passed the view as an"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Hasher`."}, {"role": "assistant", "content": "```supercollider\n{ Hasher.ar(Line.ar(0, 1, 1), 0.2) }.play;\n\n// Even adding a small amount to the input can result in a very different output. Compare these two examples:\n(\n{\n SinOsc.ar(\n Hasher.kr(MouseX.kr(0, 10).round(1), 300, 500)\n ) * 0.1\n}.play;\n);\n\n(\n{\n SinOsc.ar(\n Hasher.kr(MouseX.kr(0, 10).round(1) + 0.0001, 300, 500)\n ) * 0.1\n}.play;\n);\n\n// Output stays constant while not moving the mouse.\n(\n{\n SinOsc.ar(\n Hasher.kr(MouseX.kr(0, 10), 300, 500)\n ) * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n {\n var a, n = 5, m = 64;\n a = {\n var x;\n x = { 0.2.rand2 } ! m;\n x = x ++ ({ Drand({ 0.2.rand2 } ! n) } ! m.rand);\n Dseq(x.scramble, inf)\n } ! n;\n Duty.ar(\n MouseX.kr(1, 125, 1) * SampleDur.ir * [1, 1.02],\n 0,\n Dswitch1(a, MouseY.kr(0, n-1))\n )\n\n }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n {\n var a, n = 5, m = 64;\n a = {\n var x;\n x = { 0.2.rand2 } ! m;\n x = x ++ ({ Drand({ 0.2.rand2 } ! n) } ! m.rand);\n Dseq(x.scramble, inf)\n } ! n;\n Duty.ar(\n MouseX.kr(1, 125, 1) * SampleDur.ir * [1, 1.02],\n 0,\n Dswitch1(a, MouseY.kr(0, n-1))\n )\n\n }.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Set.keyAt` do?"}, {"role": "assistant", "content": "Returns the object at the internal index. This index is not"}]} +{"conversations": [{"role": "user", "content": "What does `LevelIndicator.numTicks` do? What arguments does it take?"}, {"role": "assistant", "content": "The number of ticks to display in the view's Arguments: number — An Integer >= 0. `(`."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// larger pitch range and lookBack in upper voice, \n// as with most patterns, no automatic array expansion of pattern arguments\n\n(\np = Pbind(\n \\dur, 1/7,\n \\src, Pseg(Pseq([65, 85], inf), 5, \\sin).round,\n \\midinote, Ptuple([\n PIdev(Pkey(\\src), 1, -1, 1),\n PIdev(Pkey(\\src) + 8.5, 3, -5, 5)\n ]).trace(prefix: \"midi \"),\n).play;\n);\n\np.stop\n```"}, {"role": "assistant", "content": "larger pitch range and lookBack in upper voice, as with most patterns, no automatic array expansion of pattern arguments (PIdev: pattern searching for numbers with integer distance from a source pattern, optionally avoiding repetitions within a span)"}]} +{"conversations": [{"role": "user", "content": "What does `Object.repeat` do?"}, {"role": "assistant", "content": "Repeatedly embeds the receiver in the stream using a Pn (may thus be used for patterns and other objects alike) `a ="}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BPZ2`."}, {"role": "assistant", "content": "```supercollider\n// Compare:\n\n{ WhiteNoise.ar(0.25) }.play;\n\n{ BPZ2.ar(WhiteNoise.ar(0.25)) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Since the allpass delay has no audible effect as a resonator on\n// steady state sound ...\n\n{ AllpassN.ar(WhiteNoise.ar(0.1), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// ...these examples add the input to the effected sound and compare variants so that you can hear\n// the effect of the phase comb:\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassN.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2)\n}.play)\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassL.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Since the allpass delay has no audible effect as a resonator on\n// steady state sound ...\n\n{ AllpassN.ar(WhiteNoise.ar(0.1), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// ...these examples add the input to the effected sound and compare variants so that you can hear\n// the effect of the phase comb:\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassN.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2)\n}.play)\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassL.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2)\n}.play)\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassC.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2)\n}.play)\n\n// used as an echo - doesn't really sound different than Comb,\n// but it outputs the input signal immediately (inverted) and the echoes\n// are lower in amplitude.\n{ AllpassN.ar(Decay.ar(Dust.ar(1, 0.5), 0.2, WhiteNoise.ar), 0.2, 0.2, 3) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// sound example\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05, amp = 0.1|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2, amp), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\nvar a;\na = Pnaryop(\\wrap, Pseries(0, 1, 12), [3, 7]).asStream;\n{\n a.do { |val|\n Synth(\\help_sinegrain, [\\freq, (val + 72) .midicps.postln]);\n 0.5.wait;\n }\n}.for\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// sound example\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05, amp = 0.1|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2, amp), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\nvar a;\na = Pnaryop(\\wrap, Pseries(0, 1, 12), [3, 7]).asStream;\n{\n a.do { |val|\n Synth(\\help_sinegrain, [\\freq, (val + 72) .midicps.postln]);\n 0.5.wait;\n }\n}.fork;\n);\n\n(\nPbind(\n \\dur, 0.1,\n \\instrument, \\help_sinegrain,\n \\note, Pnaryop(\\wrap, Pseries(0, 1, 12), [3, 7]);\n).play;\n);\n\n\n\n// these are the same as:\n\n(\nvar a;\na = Pseries(0, 1, 12).wrap(3, 7).asStream;\n{\n a.do { |val|\n Synth(\\help_sinegrain, [\\freq, (val + 72) .midicps.postln]);\n 0.5.wait;\n }\n}.fork;\n);\n\n(\nPbind(\n \\dur, 0.1,\n \\instrument, \\help_sinegrain,\n \\note, Pwhite(0, 12, inf).wrap(3, 7);\n).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `PageLayout.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a Window with a FlowView on it. The PageLayout object can be treated like a Window or like a Arguments: title — Window title; bounds — Bounds or nil. Default of nil will size the window to the entire screen size. Use .resizeToFit to shrink the window to the content size.; margin — FlowLayout margin.; background — Background color; scroll — boolean: add scroll bars or not.; front — boolean: whether to immediately display the window, bringing it to the front. default is true. You may choose to first add your views to the window and then front it which is useful for large slow GUIs. Returns: a PageLayout"}]} +{"conversations": [{"role": "user", "content": "What is `Server`?"}, {"role": "assistant", "content": "Server — Object representing a server application"}, {"role": "user", "content": "What does `Server.new` do?"}, {"role": "assistant", "content": "Create a new Server instance."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n{ SinOsc.ar * 0.1 }.play(s); // play a synth on the server\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\nvar trigger, fund, flashInst;\nflashInst = Array.fill(7,\n{\ntrigger = Dust.kr(2)*PinkNoise.ar(1);\nfund = rrand(100, 137);\nPan2.ar(\nMix.ar(\nArray.fill(7,\n{arg counter;\nvar partial;\npartial = counter + 3;\n//HenonC.ar(fund*partial).atan *\nDPW3Tri.ar(fund*partial).atan *\nEnvGen.kr(Env.adsr(0.01, 0, 0.1, 7.0),\ntrigger, 1/partial) *AY.ar(713)* max(0, LFNoise1.kr(rrand(37.0, 73.0)))\n})\n)*0.2,\n1.0.rand2)\n});\nMix.ar(flashInst)*0.6\n}.play\n)\n```"}, {"role": "assistant", "content": "\"High-energy Radio Bursts, generated by an old coffee machine of Arab origin, manifest themselves as noise and audio signals, and trigger a magnetic alteration with unpredictable effects;\"\r\n\r\n\r\n\r\nhttp://bz-buzz.blogspot.com/2018/10/radio-bursts-from-old-coffee-pot.html\r\n\r\nhttp://bzakirasantjago.blogspot.com/."}]} +{"conversations": [{"role": "user", "content": "What is a bus, in one sentence?"}, {"role": "assistant", "content": "A numbered channel on the server that nodes write signal into and read signal out of, which is how sounds are chained without cables."}, {"role": "user", "content": "Show me using one for an effect."}, {"role": "assistant", "content": "Write the source to a private bus, read it in the effect, send the effect to the master:\n\n```supercollider\n(\n~bus = Bus.audio(s, 1);\nSynthDef(\\src, { |out = 0| Out.ar(out, Saw.ar(110) * 0.1) }).add;\nSynthDef(\\fx, { |in = 0| Out.ar(0, RLPF.ar(In.ar(in, 1), 1200, 0.3)) }).add;\n);\nSynth(\\fx, [\\in, ~bus]);\nSynth(\\src, [\\out, ~bus]);\n```\n\nOrder matters: the effect exists before the source, so the source's output has a listener."}]} +{"conversations": [{"role": "user", "content": "What does `PHSuse.new` do? What arguments does it take?"}, {"role": "assistant", "content": "defines Pbind(s) for using synth values of a HS Arguments: helpSynth — A HS object.; ... pbindArgs — dur1, pbindData1, ... , durN, pbindDataN where dur is duration value or pattern / stream of durations for corresponding Pbind(s) and pbindData is a collection of Pbind pairs or a collection of Pbind pair collections, defining possibly several Pbinds with the same event timing.."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Simple animated 2D user interface. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// needs shared memory interface (SC 3.5+)\n\nServer.default = s = Server.local;\ns.waitForBoot{\n if (s.hasShmInterface) {\n w = Window().front;\n u = UserView(w, w.view.bounds);\n f = { |x, y|\n var size = 20 + (y/4);\n k = k.center_(Point(x, y));\n k = k.size_(Size(size, size));\n b.setSynchronous(x.linlin(0,u.bounds.width, 1/4, 16));\n c.setSynchronous(50*(y/4));\n };\n w.onClose = { Ndef(\\sound).end(1) };\n u.background = Color.blue(0.5);\n u.animate = true;\n k = Rect(100, 100, 50, 50);\n u.drawFunc = {\n var osc = Ndef(\\osc).bus.getSynchronous * 0.5 + 0.5;\n Pen.strokeColor = Color.blue;\n Pen.addOval(k);\n Pen.fillRadialGradient(\n k.center,\n k.center,\n k.width/8,\n k.width,\n Color(1,1,1,0),\n Color(1,0,0,osc)\n );\n };\n \n u.mouseMoveAction = { |u, x, y| f.(x, y) }; \n u.mouseDownAction = { |u, x, y| f.(x, y) }; \n \n b = Bus.control(s);\n c = Bus.control(s);\n b.setSynchronous(4);\n c.setSynchronous(500);\n \n Ndef(\\osc, { SinOsc.kr(b.kr) });\n Ndef(\\sound).fadeTime = 1;\n Ndef(\\sound, { MoogFF.ar(LFSaw.ar(50+[0,1]), Ndef(\\osc).kr.linexp(-1,1,50,c.kr)) }).play;\n } {\n \"get SC 3.5 or higher ;)\".warn;\n };\n};\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Array`."}, {"role": "assistant", "content": "```supercollider\n(\nx = {\n SinOsc.ar([0.1, 0.2], 0).poll * 0.1\n}.play;\n);\nx.trace; // By tracing the Synth you can see the two Poll units we created\nx.free\n```"}]} +{"conversations": [{"role": "user", "content": "What does `PV_Compander.new` do? What arguments does it take?"}, {"role": "assistant", "content": "simple spectral compression/expansion Arguments: buffer — fft buffer; thresh — mag thresh; slopeBelow, slopeAbove — same as Compander."}]} +{"conversations": [{"role": "user", "content": "What is `Nil`?"}, {"role": "assistant", "content": "Nil — Represents uninitialized data"}, {"role": "user", "content": "What does `Nil.isNil` do?"}, {"role": "assistant", "content": "Answers true because this is nil. In class Object this message is defined to answer false. `[1, 2, nil, 3].collect(_.isNil);`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nx = nil;\nx = x.add(8); // returns an array\nx = x.add(7); // appends to the array\n```"}]} +{"conversations": [{"role": "user", "content": "What are you not good at?"}, {"role": "assistant", "content": "Everything outside SuperCollider. I have no audio input, no live data, and my knowledge ends at the documentation snapshot I was trained on — so I can be confidently wrong about Quarks and new UGens."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BPF`."}, {"role": "assistant", "content": "```supercollider\n{ BPF.ar(Saw.ar(200, 0.5), FSinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3600, 4000), 0.3) }.play;\n\n{ BPF.ar(Saw.ar(200, 0.5), MouseX.kr(100, 10000, 1), 0.3) }.play;\n\n // BPF on control signals:\n(\n{ var vib = BPF.kr(PinkNoise.kr, MouseX.kr(1, 100, 1), 0.3) * 10;\n SinOsc.ar(vib * 200 + 600) * 0.2 }.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is Env.perc and what does it take?"}, {"role": "assistant", "content": "`Env.perc(attackTime, releaseTime, level, curve)` — an attack to `level` (default 1) then a decay to zero, with curve defaulting to -4 (an exponential-ish decay). `Env.perc(0.01, 1)` is the default percussive envelope, and it is a complete Env, not a generator: pair it with EnvGen to hear it."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar(300),\n Pulse.ar(230)\n ];\n\n LinSelectX.ar(MouseX.kr(0, 1) * a.size, a) * 0.2\n}.play;\n);\n\n(\n{\n var a;\n a = [\n SinOsc.kr(0.25),\n LFSaw.kr(10),\n LFPulse.kr(0.3)\n ];\n\n SinOsc.ar(LinSelectX.kr(MouseX.kr(0, 1) * a.size, a) * 300 + 400) * 0.2\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar(300),\n Pulse.ar(230)\n ];\n\n LinSelectX.ar(MouseX.kr(0, 1) * a.size, a) * 0.2\n}.play;\n);\n\n(\n{\n var a;\n a = [\n SinOsc.kr(0.25),\n LFSaw.kr(10),\n LFPulse.kr(0.3)\n ];\n\n SinOsc.ar(LinSelectX.kr(MouseX.kr(0, 1) * a.size, a) * 300 + 400) * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Duty`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// this is useful when two UGens need to be called, but only one of their outputs is needed\n(\n{\n var a, b, c;\n a = Dseq([1, 2, 3, 4], inf).dpoll(\"a\");\n b = Dseq([1955, 1952, 1823, 1452], inf).dpoll(\"b\");\n c = (a a > 5)) |\n ((t * 5) & (t >> [3, 4])) |\n ((t * 2) & (t >> 9)) |\n ((t * 8) & (t >> 11)) |\n (((t*t) & t) | (t >> 3))\n - 3 % 256\n ) / 127-1 * 3\n , 20\n ) * 0.1;\n var sig2 = LPF.ar(HPF.ar(gcd(t*u, u+t), WhiteNoise.ar()*2000 + 1000), 20);\n sig2 = sig2*sig;\n sig = 0.3*Splay.ar(Limiter.ar(Greyhole.ar(sig + sig2, sig, 0.5, sig), 0.5).flatten);\n }).play;\n});\n)\n```"}, {"role": "assistant", "content": "a surprisingly rich soundscape in a few lines of code (lucky accident)."}]} +{"conversations": [{"role": "user", "content": "What does `ScalarSpec.newFrom` do? What arguments does it take?"}, {"role": "assistant", "content": "datatype specifiying a \\scalar \"rate\" input or output Arguments: similar."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n var gspring;\n gspring = { |freq|\n var delay, sinc, env, line, impul;\n\n delay = freq.reciprocal;\n impul = Impulse.ar(0);\n env = Env.perc(0.001, 0.01).ar;\n line = Line.ar(1000, 50, 0.01 );\n sinc = SinOsc.ar(line);\n\n Pluck.ar( sinc * env, impul, delay, delay, 5, 0.5);\n };\n\n\nSynthDef.new('eguitar',\n { arg amp=1, freq=150, out_bus=0, pan=0;\n\n var snd;\n\n snd = gspring.value(freq-50) +\n gspring.value(freq) +\n gspring.value(freq+50);\n\n snd = (snd * 32.dbamp).tanh;\n snd = RLPF.ar(snd, 2800+freq, 0.5);\n snd = (snd * 32.dbamp).tanh;\n snd = RLPF.ar(snd, 300+freq, 0.5);\n snd = (snd * 32.dbamp).tanh;\n\n snd * -20.dbamp;\n\n Out.ar(out_bus, snd );\n}).add\n);\n\nSynth('eguitar', [freq: 360]);\n```"}, {"role": "assistant", "content": "just a very limited attempt for reference purpose of a hoped for eguitar synth ´\r\nbased on https://sccode.org/1-5aC#c982."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\nz = { // toy around with boost/cut\nBLowShelf.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(40, 6000, \\exponential),\n 1.0, // rs\n MouseY.kr(24.0, -24.0, \\linear),\n 0.5); // mul\n}.play)\nz.release;\n\n(\nz = { // toy around with rs\nBLowShelf.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(20, 6000, \\exponential),\n MouseY.kr(0.1, 1.0, \\linear), // rs\n 6,\n 0.5); // mul\n}.play\nz.release;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\nz = { // toy around with boost/cut\nBLowShelf.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(40, 6000, \\exponential),\n 1.0, // rs\n MouseY.kr(24.0, -24.0, \\linear),\n 0.5); // mul\n}.play)\nz.release;\n\n(\nz = { // toy around with rs\nBLowShelf.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(20, 6000, \\exponential),\n MouseY.kr(0.1, 1.0, \\linear), // rs\n 6,\n 0.5); // mul\n}.play)\nz.release;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DelayN`."}, {"role": "assistant", "content": "```supercollider\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nDelayN.ar(z, 0.2, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\n(\n// recursive application of delay.\n{\nz = Decay2.ar(Dust.ar(1, 0.5), 0.01, 0.1, Saw.ar(100 + [0, 1]));\n5.do { |i| z = DelayN.ar(RLPF.ar(z, Rand(100, 3000), 0.03), 1, 1 / (2**i), 1, z * 0.5) };\nz\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `GVerb`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\n// CAUTION: THE FOLLOWING CAN BE EXTREMELY LOUD\n// set the following variable to true if you want to run this code\nvar run = false;\nif (run) {\n { GVerb.ar(Dust.ar(5), SinOsc.kr(0.3).range(10, 14), drylevel:0) }.play\n}\n// 3.13 super loud glitch (crackling)! 3.14: super loud glitch (cleaner pitch shifting)!\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Fomus` in SuperCollider?"}, {"role": "assistant", "content": "Fomus — SuperCollider bindings to Fomus Music Notation Category: MusicNotation."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\nthis.preProcessor = PreProcessor.new;\n\n// prepare an event\ne = (\n lang: \\minimouse,\n languages:\n (\n minimouse: {|code, event|\n var output;\n output = Pbind(\\degree, Pseq(code.ascii).trace % 24, \\dur, event[\\dur] ? 0.1);\n event.put(\\result, output)\n },\n maximouse: {|code, event|\n var output;\n output = Pbind(\\freq, Pseq(code.ascii).trace + 200, \\dur, event[\\dur] ? 0.1);\n event.put(\\result, output)\n }\n )\n\n);\n);\n\n// ok, assuming such a little interpreter exists for a given language,\n// one can now use it in code.\n// …\n```"}, {"role": "assistant", "content": "ok, assuming such a little interpreter exists for a given language, one can now use it in code. (PreProcessor: Embed languages in SuperCollider)"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `InTrig`."}, {"role": "assistant", "content": "```supercollider\ns = Server.local;\nb = Bus.control(s, 1);\n\nSynthDef(\"help-InTrig\", { |out = 0, busnum = 0|\n var inTrig;\n inTrig = InTrig.kr(busnum);\n Out.ar(out,\n EnvGen.kr(Env.perc, gate: inTrig, levelScale: inTrig) * SinOsc.ar\n )\n}).play(s, [\\out, 0, \\busnum, b.index]);\n\n\nb.set(1.0);\n\nb.value = 1.0;\n\nb.value = 0.2;\n\nb.value = 0.1;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `LinearSpline.createPoint` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a new point, inserting it in the points Arguments: p — The point, either as a Point object or as an array.; i — The point index to insert the point at. Note that the subsequent points are moved along the spline's point array but their values are not changed.."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Lag`."}, {"role": "assistant", "content": "```supercollider\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n Lag.kr( // lag the modulator\n LFPulse.kr(4, 0, 0.5, 50, 400), // frequency modulator\n Line.kr(0, 1, 15) // modulate lag time\n ),\n 0, // phase\n 0.3 // sine amplitude\n )\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a random pentatonic melody that plays by itself."}, {"role": "assistant", "content": "Pick degrees from a pentatonic scale; `\\scale` and `\\root` define the pitch space, and `\\degree`\npicks within it.\n\n```supercollider\n(\nPbind(\n \\instrument, \\default,\n \\scale, Scale.minorPentatonic,\n \\root, 3,\n \\degree, Pwhite(0, 9, inf),\n \\octave, 5,\n \\dur, Pwhite(0.12, 0.28, inf),\n \\amp, 0.2,\n \\legato, 0.8\n).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Normalizer`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n// example signal to process\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n z * 0.8\n}.play\n);\n\n(\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n [z, Normalizer.ar(z, 0.4, 0.01)] * 0.5\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for smooth arpeggio, updated envelope (a SuperCollider snippet): bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\bass, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.perc(0.2), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Limiter`."}, {"role": "assistant", "content": "```supercollider\n(\n// example signal to process\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n z * 0.8\n}.play\n);\n\n(\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n [z, Limiter.ar(z, 0.4, 0.01)] * 0.5\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Button.defaultCanReceiveDrag` do?"}, {"role": "assistant", "content": "The method called by default when attempting to drop a drag in this object. By default, Button will respond only to drags where the drag contains a Number or"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nx = {\n // A collection of different tones:\n var son = SinOsc.ar((100, 100.3 .. 110));\n var val = ArrayMax.ar(son).at(0);\n val = LeakDC.ar(val); // the operation tends to induce DC offset\n Pan2.ar(val)\n}.play\n;\nx.free\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nx = {\n // A collection of different tones:\n var son = SinOsc.ar((100, 100.3 .. 110));\n var val = ArrayMax.ar(son).at(0);\n val = LeakDC.ar(val); // the operation tends to induce DC offset\n Pan2.ar(val)\n}.play\n);\nx.free\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n//try passing a signal through the hair cell\nx = { Meddis.ar(SinOsc.ar(440)) }.play;\nx.free;\n\n//recursive hair cell compression\n{ Meddis.ar(Meddis.ar(SoundIn.ar) }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n//try passing a signal through the hair cell\nx = { Meddis.ar(SinOsc.ar(440)) }.play;\nx.free;\n\n//recursive hair cell compression\n{ Meddis.ar(Meddis.ar(SoundIn.ar)) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What model are you?"}, {"role": "assistant", "content": "I am sc-mind: a 198M MiniMind-3-MoE, eight layers, 768 wide, four experts with top-1 routing. I was trained from scratch on the SuperCollider documentation, class library and help pages, then fine-tuned on questions and answers about them."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\ns.boot;\n// Simple polling of mean values - you could do this without a UGen!\nx = {|val=1, t_trig=0| MeanTriggered.kr(val, t_trig, 3).poll(t_trig, \"Mean of recent 3 values\"); }.play;\nx.set(\\val, 10.rand.postln, \\t_trig, 1); // Execute this repeatedly\n\nx.free;\n\n// Using it as an audio filter - compare the sounds of these:\nx = {WhiteNoise.ar(0.1)}.play;\nx.free;\nx = {MeanTriggered.ar(WhiteNoise.ar(0.1), 1, 3)}.play; // Note that \".sum\" would be more efficient here...\nx.free;\nx = {MeanT\n// …\n```"}, {"role": "assistant", "content": "Simple polling of mean values - you could do this without a UGen! Using it as an audio filter - compare the sounds of these: (MeanTriggered: Mean of recent values, triggered)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// given a simple instrument\nInstr(\\Pulse,{ arg freq=440.0,width=0.5,mul=0.1;\n Pulse.ar( freq, width, mul )\n});\n\n// a patch specifies inputs (arguments) to that instrument\np = Patch( \\Pulse, [ 300, 0.2, 0.1 ]);\n\n//the default server will be booted, the SynthDef written and loaded\np.play;\n\n;\n\np.stop;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// given a simple instrument\nInstr(\\Pulse,{ arg freq=440.0,width=0.5,mul=0.1;\n Pulse.ar( freq, width, mul )\n});\n\n// a patch specifies inputs (arguments) to that instrument\np = Patch( \\Pulse, [ 300, 0.2, 0.1 ]);\n\n//the default server will be booted, the SynthDef written and loaded\np.play;\n\n);\n\np.stop;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ SinOsc.ar(ControlRate.ir * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ SinOsc.ar(ControlRate.ir) * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `NRand`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-NRand\", { |out = 0, n = 0|\n Out.ar(out,\n FSinOsc.ar(\n NRand(1200.0, 4000.0, n),\n 0, Line.kr(0.2, 0, 0.01, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n(\nn = 0;\nRoutine({\n inf.do({ |i|\n Synth.new(\"help-NRand\", [\\n, n]); 0.05.wait;\n })\n}).play;\n);\n\nn = 1;\nn = 2;\nn = 4;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `PopUpTreeMenu` in SuperCollider?"}, {"role": "assistant", "content": "PopUpTreeMenu — hierarchical PopUp menu This class is modelled after PopUpMenu, but implements submenus. Category: GUI."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\ambiIn;\n~description = \"A live ambisonic input (ACN_N3D)\";\n~channelLayout = \\ambi;\n\n~function = { |order = 1, t_trig = 0, bus = 0|\n var env = EnvGen.kr(Env([0,1], [1]), t_trig);\n var chans = Array.series(\n size: (order + 1).pow(2).asInteger,\n start: bus,\n step: 1\n );\n SoundIn.ar(chans) * env;\n};\n```"}, {"role": "assistant", "content": "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see ."}]} +{"conversations": [{"role": "user", "content": "What does `SplineGen.dimension` do?"}, {"role": "assistant", "content": "get/set the dimension that represents time. Usually 0. The value dimension is then considered to be Returns: Integer"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ TwoZero.ar(WhiteNoise.ar(0.125), XLine.kr(20, 20000, 8), 1 }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ TwoZero.ar(WhiteNoise.ar(0.125), XLine.kr(20, 20000, 8), 1) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Event` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\pm, { |out = 0, freq = 440, amp = 0.1, pan = 0, gate = 1, ratio = 1, index = 1, ar = 0.1, dr = 0.1|\n var z;\n z = LPF.ar(\n PMOsc.ar(freq, freq * ratio, Linen.kr(gate, ar, index, dr), 0, 0.3),\n XLine.kr(Rand(4000, 5000), Rand(2500, 3200), 1)\n ) * Linen.kr(gate, 0.01, 0.7, dr, 2);\n OffsetOut.ar(out, Pan2.ar(z, pan, amp));\n}).add;\n);\n\n(instrument: \\pm).play;\n\n(instrument: \\pm, ratio: 3.42, index: 12, freq: 150, ar: 8, dr: 3, sustain: 10).play;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `RedArduino` in SuperCollider briefly."}, {"role": "assistant", "content": "RedArduino — for uploading sketches to arduino This class can be used for uploading sketches to an Arduino from SuperCollider via the soundcard. No FTDI chip needed! It's a very cheap way to program barebone arduino boards. Category: Red > redTools."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Re: the perfect frequencies. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// Rumush\n// https://mycelialcordsblog.wordpress.com/\n// https://fungorumush.bandcamp.com/releases\n// https://soundcloud.com/fungorum\n\n(\nf = {\n var rep = [4, 8, 16, 32];\n var n = rep.choose;\n var x = [\n\n 54, 60, 66, 72, 81, 90, 96, 102,\n 108, 128, 132, 144, 162, 180, 192, 204,\n 216, 240, 264, 288, 324, 360, 384, 408,\n 432, 480, 528, 576, 648, 720, 768, 816,\n 864, 960, 1056, 1152, 1296, 1440, 1536, 1632,\n 1728, 1920, 2112, 2304, 2592, 2880, 3072, 3264,\n 3456, 3840, 4224, 4608, 5184, 5760, 6144, 6528,\n 6912, 7680, 8448, 9216, 10368, 11520, 12288, 528\n\n ];\n Mix.fill(n,\n {\n var detune = 5.rand;\n var sin = SinOsc.ar(x.choose, 4.rand, 0.25);\n var saw = RLPF.ar(Saw.ar(x.choose*0.01+detune, 0.75), x.choose, 2.rand).tanh;\n Pan2.ar((sin+saw) * EnvGen.kr(Env.sine(12, 1/n), 1, doneAction:2),\n 1.rand2) }\n );\n};\n);\n\n(\n// DEFINE A ROUTINE\nr = Routine({\n\n inf.do({\n f.play;\n 10.wait;\n })\n});\n);\n\nr.reset.play;\n```"}]} {"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nt = TempoClock(120/60).permanent_(true);\n\n(\n~change_clock_tempo = {|clock, tempo, beats=1|\n beats.do {|beat|\n var stepTempo = beat.linexp(0, beats-1, clock.tempo, tempo);\n clock.schedAbs(clock.nextBar + beat, {\n \"New Tempo: \".post; (stepTempo*60).post; \" BPM\".postln;\n clock.tempo_(stepTempo);\n });\n };\n nil;\n};\nPbindef(\\n,\n \\octave, 4,\n \\dur, 0.5,\n \\degree, Pseq((0..7), inf)\n).play(t, quant: 4);\n);\n\n~change_clock_tempo.value(t, 200/60, 16);\n~change_clock_tempo.value(t, 50/60, 8);\nt.tempo*60\n```"}, {"role": "assistant", "content": "This gradually changes the tempo of a TempoClock, each beat of a specified number of beats, and starting at the next bar.\r\n\r\n\r\nPersonally, I was not able to heavily distinguish between `.linlin` and `.linexp` for reasonable musical tempos.\r\n\r\n\r\nThere may be a mathematically smoother way of handling this at the control rate.\r\n\r\n\r\nThis function does not gracefully handle multiple simultaneous invoca."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n~buf = BBCutBuffer(Platform.resourceDir +/+ \"sounds/break.aiff\", 8);\n\n// cresc\nBBCut2(CutGroup([CutBuf3(~buf, 0.3), CutMixer(0, 1, RollAmplitude(1))]), WarpCutProc1()).play(2.5);\n\n// dim\nBBCut2(CutGroup([CutBuf3(~buf, 0.3), CutMixer(0, 1, RollAmplitude(-1))]), WarpCutProc1()).play(2.5;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n~buf = BBCutBuffer(Platform.resourceDir +/+ \"sounds/break.aiff\", 8);\n\n// cresc\nBBCut2(CutGroup([CutBuf3(~buf, 0.3), CutMixer(0, 1, RollAmplitude(1))]), WarpCutProc1()).play(2.5);\n\n// dim\nBBCut2(CutGroup([CutBuf3(~buf, 0.3), CutMixer(0, 1, RollAmplitude(-1))]), WarpCutProc1()).play(2.5);\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\ns.boot;\n\n(\nvar winenv;\n// a custom envelope\nwinenv = Env([0, 1, 0], [0.5, 0.5], [8, -8]);\nz = Buffer.sendCollection(s, winenv.discretize, 1);\n\nSynthDef(\\fm_grain_test, { |out, gate = 1, amp = 1, envbuf|\n var pan, env, freqdev;\n // use mouse x to control panning\n pan = MouseX.kr(-1, 1);\n // use WhiteNoise and mouse y to control deviation from center pitch\n freqdev = WhiteNoise.kr(MouseY.kr(0, 400));\n env = EnvGen.kr(\n Env([0,\n// …\n```"}, {"role": "assistant", "content": "use mouse x to control panning use WhiteNoise and mouse y to control deviation from center pitch (GrainFM: Granular synthesis with frequency modulated sine tones)"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Dstutter`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var freq, trig;\n var in = Dseq([1, 2, 3], inf);\n var rep = Dstutter(Diwhite(2, 8, inf), in);\n trig = Impulse.kr(MouseX.kr(1, 40, 1));\n freq = Demand.kr(trig, 0, rep).poll(trig) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `PBRZ2.new` do? What arguments does it take?"}, {"role": "assistant", "content": "UGenPatterns quark library Arguments: pattern; mul; add."}]} -{"conversations": [{"role": "user", "content": "What is `LFGauss` in SuperCollider?"}, {"role": "assistant", "content": "LFGauss — Gaussian function oscillator A non-band-limited gaussian function oscillator. Category: UGens > Generators > Deterministic."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Fdef`."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\ns.boot;\nSynthDef(\"gpdef\",\n { |out = 0, freq = 440, sustain = 0.05, amp = 0.1|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain), doneAction: Done.freeSelf) * amp;\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n// fork a thread that plays some sounds\n(\nFdef(\\freq, 440);\nFdef(\\dur, 0.2);\n\nfork {\n loop {\n s.sendMsg(\"/s_new\", \"gpdef\", -1, 1, 1, \\freq, Fdef(\\freq).value);\n Fdef(\\dur).value.wait;\n }\n};\n);\n\n// some modifications\n\nFdef(\\freq, Fdef(\\midinote, 60).midicps);\nFdef(\\midinote, { [67, 64, 65].choose });\nFdef(\\midinote, { [67, 64, 65].choose } + Fdef(\\offset));\nFdef(\\offset, { 4.rand });\nFdef(\\dur, 0.23);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `WebView.toHtml` do? What arguments does it take?"}, {"role": "assistant", "content": "Fetch the HTML of the current Arguments: A callback function. Called with the resulting HTML string when the operation is finished.."}]} -{"conversations": [{"role": "user", "content": "Explain `Spring` in SuperCollider briefly."}, {"role": "assistant", "content": "Spring — physical model of resonating spring models the force of a resonating spring Category: UGens > Filters > Nonlinear, UGens > Generators > PhysicalModels."}]} -{"conversations": [{"role": "user", "content": "What is `Main`?"}, {"role": "assistant", "content": "Main — The concrete instance of Process"}, {"role": "user", "content": "What does `Main.thisProcess` do?"}, {"role": "assistant", "content": "The singleton instance of Main is available through the special keyword thisProcess. For example, to find out what platform you're on: `thisProcess.platform; // --> e.g. \"an OSXPlatform\", \"a Linux`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nShutDown.add({ \"Good bye!!\".postln });\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\n// send a synth def to server\nSynthDef(\"tpulse\", { |out = 0, freq = 700, sawFreq = 440.0|\n Out.ar(out, SyncSaw.ar(freq, sawFreq, 0.1));\n}).add;\n);\n\n// Here the defaults for *new will result in a Synth at the head of the default group\n// of the default Server. This will use the SynthDef's default arguments;\ny = Synth.new(\"tpulse\");\ny.free;\n\n// The same done explicitly\ny = Synth.new(\"tpulse\", nil, s, \\addToHead);\ny.free;\n\n// With some arguments\ny = Synth.new(\"tpulse\", [\\freq\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\n// send a synth def to server\nSynthDef(\"tpulse\", { |out = 0, freq = 700, sawFreq = 440.0|\n Out.ar(out, SyncSaw.ar(freq, sawFreq, 0.1));\n}).add;\n);\n\n// Here the defaults for *new will result in a Synth at the head of the default group\n// of the default Server. This will use the SynthDef's default arguments;\ny = Synth.new(\"tpulse\");\ny.free;\n\n// The same done explicitly\ny = Synth.new(\"tpulse\", nil, s, \\addToHead);\ny.free;\n\n// With some arguments\ny = Synth.new(\"tpulse\", [\\freq, 350, \\sawFreq, 220]);\ny.free;\n\n// make a new synth\ny = Synth(\"tpulse\");\n\n// pause\ny.run(false);\n\ny.run(true);\n\n// set a control by argument name\ny.set(\"freq\", 200);\n\n// or by index\ny.set(2, 100.0);\n\n// modulate out to bus number 1 (the right speaker)\ny.set(0, 1);\n\n// multiple set commands in one message\ny.set(\"out\", 0, \"freq\", 300);\n\n// free the synth from the server\ny.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Synth.addAfterMsg` do?"}, {"role": "assistant", "content": "See *new above for details on Returns: a message of the type s_new which can be bundled. When sent to the server this message will instantiate this synth, immediately after aNode."}]} -{"conversations": [{"role": "user", "content": "What is `NamedControl`?"}, {"role": "assistant", "content": "NamedControl — Named reference to a control"}, {"role": "user", "content": "What does `NamedControl.ar` do?"}, {"role": "assistant", "content": "add a new instance of AudioControl with given name and default values. If lags are given, apply a Lag UGen to it."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// use NamedControl to create a number of multichannel controls:\n\na = { SinOsc.ar(NamedControl.kr(\\freq, [300, 330, 370], [1, 0.3, 0.02])).sum * 0.1 }.play;\na.setn(\\freq, [700, 705, 890]);\na.setn(\\freq, [0, 2, 5].midiratio * 400);\n\n// synonymous:\na = { SinOsc.ar(\\freq.kr([300, 330, 370], [1, 0.3, 0.02])).sum * 0.1 }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `CutGroup.new` do? What arguments does it take?"}, {"role": "assistant", "content": "A group in BBCut2 Arguments: cutsynths — an Array of CutSynths, though this argument can also cope with being passed a CutSynth directly.; group — A Group instance.; bus — A Bus instance.; numChannels — If 1, rendering is mono until the final CutMixer. If 2, rendering is stereo, and there is no pan functionality in the final CutMixer. The CutMixer will automatically be configured appropriately based on the numChannels variable in the CutGroup.."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Buffer`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n// allocate an array of Buffers and fill them with different harmonics\n(\nb = Buffer.allocConsecutive(8, s, 4096, 1, { |buf, i|\n buf.sine1Msg((1 .. ((i + 1) * 6)).reciprocal) // completion messages\n});\n\na = { VOsc.ar(SinOsc.kr(0.5, 0).range(b.first.bufnum + 0.1, b.last.bufnum - 0.1),\n [440, 441], 0, 0.2) }.play;\n);\na.free;\n\n// iterate over the array and free it\nb.do(_.free);\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot // Boot the server, if you need to\n\n// read a whole sound into memory\n\n// ExampleFiles helps locate audio files used in examples\np = ExampleFiles.child;\n// peek at the path to see location and the format of a path\np.postln;\n// read the file into a buffer\nb = Buffer.read(s, p); // remember to free the buffer later.\n\nSynthDef(\\help_PlayBuf, { |out = 0, bufnum = 0|\n Out.ar(out,\n PlayBuf.ar(1, bufnum, BufRateScale.kr(bufnum), doneAction: Done.freeSelf)\n )\n}).play(s, [\\out, 0, \\bufnum, b];\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot // Boot the server, if you need to\n\n// read a whole sound into memory\n\n// ExampleFiles helps locate audio files used in examples\np = ExampleFiles.child;\n// peek at the path to see location and the format of a path\np.postln;\n// read the file into a buffer\nb = Buffer.read(s, p); // remember to free the buffer later.\n\nSynthDef(\\help_PlayBuf, { |out = 0, bufnum = 0|\n Out.ar(out,\n PlayBuf.ar(1, bufnum, BufRateScale.kr(bufnum), doneAction: Done.freeSelf)\n )\n}).play(s, [\\out, 0, \\bufnum, b]);\n```"}]} -{"conversations": [{"role": "user", "content": "What does Splay.ar do?"}, {"role": "assistant", "content": "`Splay.ar(inArray, spread, level, center, levelComp)` takes an array of mono signals and distributes them across the stereo field, so `Splay.ar(SinOsc.ar([220, 330, 440]) * 0.1)` is a three-source stereo chord rather than three separate synths. spread (0..1) controls how far the voices fan out and center shifts the middle. It is the shorthand for 'make this array stereo'."}]} -{"conversations": [{"role": "user", "content": "What does `LID.slot` do? What arguments does it take?"}, {"role": "assistant", "content": "Access a slot by its evtType and evtCode. See also Arguments: evtType — The eventType to access the slot.; evtCode — The eventCode to access the slot.."}]} +{"conversations": [{"role": "user", "content": "What does `InterfaceDef.onNoteOn` do?"}, {"role": "assistant", "content": "defines event, midi and GUI handlers for an Interface"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n//listen to x and y output with defaults\n{Out.ar(0,0.5*SpruceBudworm.ar(0.0))}.play\n\n\n//be careful with rate range, can blow-up easily here, or just not sound\n{Out.ar(0,0.5*SpruceBudworm.ar(0.0,MouseX.kr(0.09,0.1)))}.play\n\n\n{Out.ar(0,0.5*SpruceBudworm.ar(0.0,,MouseX.kr(0.09,0.1),MouseY.kr(25.0,28.0)))}.play\n\n\n{Out.ar(0,0.5*SpruceBudworm.ar(Impulse.kr(MouseY.kr(1,50,'exponential')),0.1))}\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n//listen to x and y output with defaults\n{Out.ar(0,0.5*SpruceBudworm.ar(0.0))}.play\n\n\n//be careful with rate range, can blow-up easily here, or just not sound\n{Out.ar(0,0.5*SpruceBudworm.ar(0.0,MouseX.kr(0.09,0.1)))}.play\n\n\n{Out.ar(0,0.5*SpruceBudworm.ar(0.0,,MouseX.kr(0.09,0.1),MouseY.kr(25.0,28.0)))}.play\n\n\n{Out.ar(0,0.5*SpruceBudworm.ar(Impulse.kr(MouseY.kr(1,50,'exponential')),0.1))}.play\n\n\n\n{Out.ar(0,Pan2.ar(0.5*(SpruceBudworm.ar(Impulse.kr(MouseX.kr(1,50)),0.1,24.8,0.5,initx:MouseY.kr(0.2,1.2))[0])))}.play\n\n\n{10.0*(SpruceBudworm.ar(Impulse.kr(Line.kr(1,200,0.1)),0.1,19.8,0.5,initx:0.6)[0]-1.0)}.plot(0.1)\n\n\n{10.0*(SpruceBudworm.ar(Impulse.kr(MouseX.kr(1,200)),0.1,19.8,0.5,initx:0.6)[0]-1.0)}.play\n\n\n{10.0*(SpruceBudworm.ar(Impulse.kr(MouseX.kr(1,200)),0.1,MouseY.kr(19,28),0.5,initx:0.6)[0]-1.0)}.play\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nNdef(\\x, { Saw.ar(110) * 0.1 }).play;\nNdef(\\x)[1] = \\filter -> { |in| RLPF.ar(in, 800, 0.4) };\n```"}, {"role": "assistant", "content": "Two nodes in one named proxy: a saw source, then a resonant low-pass filter fed by it.\n\n`Ndef(\\x, { ... })` defines the first node of the chain and `.play` starts it. `Ndef(\\x)[1] = \\filter ->`\ninserts a second node at index 1; the `\\filter` key says 'make this node an effect that receives the\nprevious node's output as `in`'. So the patch is `Saw -> RLPF -> out`. Because it is an Ndef, calling\n`Ndef(\\x, { ... })` again replaces the source with a crossfade instead of restarting, and\n`Ndef(\\x).stop` removes the whole chain."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Detune idea is from James Harkins. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\na = {\n |freq = 40, wid = 0.5|\n Mix(LFPulse.ar(freq *((Array.fill(40, Pxrand((1, 2..20), inf).iter)/1000)+1),\n 0, wid, 0.05)\n ).dup\n}.play;\n);\n\n//more distorsion\n~widlfo = {Saw.kr(0.5).range(0,1)};\na.set(\\wid, ~widlfo);\n\n//stop\na.release;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = {LFTri.ar(100+(1000*Maths.ar(MouseX.kr, MouseY.kr, 0.2, 0, 1, MouseButton.kr(lag:0.001))[0]), 0, 0.1}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = {LFTri.ar(100+(1000*Maths.ar(MouseX.kr, MouseY.kr, 0.2, 0, 1, MouseButton.kr(lag:0.001))[0]), 0, 0.1)}.play\n```"}]} +{"conversations": [{"role": "user", "content": "What is `UGen`?"}, {"role": "assistant", "content": "UGen — Abstract superclass of all unit generators"}, {"role": "user", "content": "What does `UGen.multiNew` do?"}, {"role": "assistant", "content": "These methods are responsible for multichannel expansion. They call `*new1(rate, ...args)` for each parallel combination. Most `*ar / *kr` methods delegate to #*multiNewList."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n{ Blip.ar(Blip.kr(4, 5, 500, 60), 59, 0.1) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `TraerParticleSystem.makeParticle` do?"}, {"role": "assistant", "content": "Create a new particle in the system with some mass and at some x, y, z position. The default is a new particle with mass CODE1.0 at CODE(0, 0,"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ RLPF.ar(Saw.ar(200, 0.1), SinOsc.ar(XLine.kr(0.7, 300, 20), 0, 3600, 4000), 0.2) }.play;\n\n\n(\n{ var ctl = RLPF.ar(Saw.ar(5, 0.1), 25, 0.03);\n SinOsc.ar(ctl * 200 + 400) * 0.1;\n}.play;\n);\n\n\n(\n{ var ctl = RLPF.ar(Saw.ar(5, 0.1), MouseX.kr(2, 200, 1), MouseY.kr(0.01, 1, 1));\n SinOsc.ar(ctl * 200 + 400) * 0.1;\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ RLPF.ar(Saw.ar(200, 0.1), SinOsc.ar(XLine.kr(0.7, 300, 20), 0, 3600, 4000), 0.2) }.play;\n\n\n(\n{ var ctl = RLPF.ar(Saw.ar(5, 0.1), 25, 0.03);\n SinOsc.ar(ctl * 200 + 400) * 0.1;\n}.play;\n);\n\n\n(\n{ var ctl = RLPF.ar(Saw.ar(5, 0.1), MouseX.kr(2, 200, 1), MouseY.kr(0.01, 1, 1));\n SinOsc.ar(ctl * 200 + 400) * 0.1;\n}.play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "What does `MxCable.register` do? What arguments does it take?"}, {"role": "assistant", "content": "Registers an Arguments: outAdapterClassName — an AbsMxAdapter subclass; inAdapterClassName — an AbsMxAdapter subclass; strategy — an MxCableStrategy. Returns: this"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a, b;\na = Pmulpre(\\freq, 801, Pset(\\freq, 500, Pbind(\\dur, 0.2)));\nx = a.asStream;\n9.do({ x.next(Event.default).postln });\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a, b;\na = Pmulpre(\\freq, 801, Pset(\\freq, 500, Pbind(\\dur, 0.2)));\nx = a.asStream;\n9.do({ x.next(Event.default).postln });\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Stream2Trig.spec` do?"}, {"role": "assistant", "content": "a 'control' rate player that takes a stream of durations and emits triggers"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for pitch tracker utility."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\\pitchTrack, {\n var soundin = SoundIn.ar(0);\n var zc = ZeroCrossing.ar(soundin);\n // var pt = Pitch.kr(soundin);\n // var tt = Tartini.kr(soundin);\n SendReply.kr(Impulse.kr(1), '/pitchTrackUtil', [zc, zc.cpsmidi]);\n}).add;\n\n~pitchTrack = {\n if(~pitchTrackSynth.isNil or: { ~pitchTrackSynth.isRunning.not }, {\n ~pitchTrackSynth = Synth(\\pitchTrack);\n ~pitchTrackNW = NodeWatcher.register(~pitchTrackSynth);\n }, {\n ~pitchTrackSynth.free;\n ~pitchTrackSynth = nil;\n \"Pitch tracker stopped.\".postln;\n });\n};\n\n~pitchTrackOSCFunc = {\n OSCFunc({\n | msg |\n (\"Pitch:\"+msg[3].round.asString.padLeft(5)+msg[4].round.asString.padLeft(3)).postln;\n }, '/pitchTrackUtil');\n};\n\n~pitchTrackOSCFunc.();\n\nCmdPeriod.add({~pitchTrackOSCFunc.();});\n```"}]} -{"conversations": [{"role": "user", "content": "How does multi-channel expansion work?"}, {"role": "assistant", "content": "If any argument of a UGen is an Array, the UGen is built once per element and the results are returned as an Array. So `SinOsc.ar([220, 330, 440])` is three oscillators, and `SinOsc.ar(220 * [1, 1.5])` is two. This is not a special stereo feature: it is uniform expansion, which is why `Splay.ar(SinOsc.ar([220,330,440]) * 0.1)` gives you a spread stereo field from three mono sources."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// play at the next beat, with offset 0.4\n(\nRoutine({ loop {\n \"///\".postln; (delta: 0.5).yield;\n \"_/_\".postln; (delta: 0.1).wait;\n} }).asEventStreamPlayer.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// play at the next beat, with offset 0.4\n(\nRoutine({ loop {\n \"///\".postln; (delta: 0.5).yield;\n \"_/_\".postln; (delta: 0.1).wait;\n} }).asEventStreamPlayer.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LFDNoise0`."}, {"role": "assistant", "content": "```supercollider\n// try wiggling mouse quickly;\n// LFNoise frequently seems stuck, LFDNoise changes smoothly.\n\n{ LFNoise0.ar(MouseX.kr(0.1, 1000, 1), 0.1) }.play\n\n{ LFDNoise0.ar(MouseX.kr(0.1, 1000, 1), 0.1) }.play\n\n// silent for 2 secs before going up in freq\n\n{ LFNoise0.ar(XLine.kr(0.5, 10000, 3), 0.1) }.scope;\n\n{ LFDNoise0.ar(XLine.kr(0.5, 10000, 3), 0.1) }.scope;\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFNoise0.ar(XLine.kr(1000, 20000, 10), 0.1) }.scope;\n\n{ LFDNoise0.ar(XLine.kr(1000, 20000, 10), 0.1) }.scope;\n\n{ LFNoise2.ar(1000, 0.25) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SynthlessPlayer.connectToPatchIn` do? What arguments does it take?"}, {"role": "assistant", "content": "parent class for Players that will not spawn a synth Arguments: patchIn; needsValueSetNow."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n//code that utilizes the glitch.\n//warning! extremely loud.\n//note: might not sound the same on all soundcards\n(\n{GlitchBPF.ar(\n    ClipNoise.ar(1.dup),\n    0.5,\n    SinOsc.kr(1, 10)\n)}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n//code that utilizes the glitch.\n//warning! extremely loud.\n//note: might not sound the same on all soundcards\n(\n{GlitchBPF.ar(\n    ClipNoise.ar(1.dup),\n    0.5,\n    SinOsc.kr(1, 10)\n)}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "How should I organise a SuperCollider project on disk?"}, {"role": "assistant", "content": "One folder per piece, with a fixed shape:\n\n```text\nmy-piece/\n synthdefs.scd // only SynthDef(...).add, loaded first\n material.scd // buffers, samples, scales\n piece.scd // the performance: Tdefs, Pbinds, Ndefs\n README.md // tempo, required samples, how to run it\n```\n\nThen the workflow is: open `synthdefs.scd`, Ctrl+A Ctrl+Enter to load it, load `material.scd`, and work in\n`piece.scd`. Keeping definitions out of the performance file is what makes a reboot survivable and a piece\nre-runnable six months later."}]} -{"conversations": [{"role": "user", "content": "What is `Interpreter`?"}, {"role": "assistant", "content": "Interpreter — The interpreter defines a context in which interactive commands are compiled and executed."}, {"role": "user", "content": "What does `Interpreter.clearAll` do?"}, {"role": "assistant", "content": "set the values of the variables `a` through `z` to nil. `x = 123;`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// typical usage\na = 4;\nb = 3;\nb = b + a;\n\n// some sound\na = Synth(\\default);\ng = fork { loop { 0.1.wait; a.set(\\freq, 200 + 20.0.rand2.postln) } };\ng.stop; a.free;\n\n// an overview of all the variables\nthis.inspect;\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for late night experimenting."}, {"role": "assistant", "content": "```supercollider\n(\nvar seed = thisThread.randSeed = 1e8.rand.debug('seed');\n{|dur = 30|\n var voices = 2.pow(1.rrand(4)),\n sig = DelayC.ar({ Pan2.ar(\n PMOsc.performList(\\ar, {\n var freq = Lag.ar(LFSaw.ar([10,15]/((1..5).choose*[1,2,4].choose)).exprange(\n {200.rrand(400)}!2, {500.rrand(1100)}!2\n * Line.kr(0.5.rrand(2), 3.rrand(8.0),dur)\n ));\n [freq, freq/[2,4].choose + SinOsc.kr([10,25],0,5), XLine.kr(0.1,1.rrand(3.0),dur/1.rrand(2.0))]\n }.()).sum/2,\n [SinOsc,LFTri].choose.kr({4.0.rrand(11)}!2 * [XLine,Line].choose.kr(1,4,dur))\n ).sum/2 \n * LFGauss.kr(XLine.kr(\\beat.kr, \\beat.kr / \\beat_change.kr, dur) / [0.5,1,2,4].choose, 0.3) \n * EnvGen.kr([\n Env.perc(0.1,dur),\n Env.sine(dur),\n Env.performList(\\new, {|len| [\n [0]++Array.rand(len,0.1,1)++[0],\n Array.rand(len,0.1,1).normalizeSum * dur,\n Array.rand(len-1,-3.0,3.0)+[0]\n ]}.(2.rrand(10)))\n ].choose) } ! voices, 4, { 0.1.rrand(4) } ! voices, 1 / voices).sum * Line.kr(1,1,dur+5,doneAction:2);\n sig = Rotate2.ar(sig[0],sig[1], LFSaw.kr(Duty.kr(dur/4.rrand(16), 0, Drand([-1*\\beat.kr,\\beat.kr].reciprocal,inf))));\n}.play(args:[\n dur:1.rrand(25.0).debug('dur'), \n beat:1.rrand(6)*(1..4).reciprocal.choose/4, \n beat_change:1.rrand(8)\n])\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Harmonics`?"}, {"role": "assistant", "content": "Harmonics — Convenient factory for filling buffers with harmonics on the server"}, {"role": "user", "content": "What does `Harmonics.new` do?"}, {"role": "assistant", "content": "Create a new Harmonics array of size. Nothing is filled in for you, until instance methods are applied. `a = Harmonics.new(16); // just returns an instance of Harmon`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na.ramp(1.0, 1.0); // returns a harmonic series\n\nb = Buffer.alloc(s, 512, 1);\n// harmonic series for freqs, ramp down for amps\nb.sine2(a.ramp(1.0, 1.0).postln, a.ramp(0.5, -0.025).postln, true, true, true);\n(\nz = SynthDef(\"help-Osc\", { |out = 0, bufnum = 0|\n Out.ar(out,\n Osc.ar(bufnum, 200, 0, 0.5)\n )\n});\n);\ny = z.play(s, [\\out, 0, \\bufnum, b]);\ny.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Detune idea is from James Harkins."}, {"role": "assistant", "content": "```supercollider\n(\na = {\n |freq = 40, wid = 0.5|\n Mix(LFPulse.ar(freq *((Array.fill(40, Pxrand((1, 2..20), inf).iter)/1000)+1),\n 0, wid, 0.05)\n ).dup\n}.play;\n);\n\n//more distorsion\n~widlfo = {Saw.kr(0.5).range(0,1)};\na.set(\\wid, ~widlfo);\n\n//stop\na.release;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes farfisa organ like sound."}, {"role": "assistant", "content": "```supercollider\n// define the violin-like sound synth\n(\nSynthDef(\\violin, {\n | midinote=60, gate=1, amp=0.25 |\n var env = EnvGen.kr(Env.asr(0.1, 1, 0.1), gate, doneAction:2);\n var sig = VarSaw.ar(\n midinote.midicps,\n width:LFNoise2.kr(1).range(0.2, 0.8)*SinOsc.kr(5, Rand(0.0, 1.0)).range(0.7,0.8))*0.25;\n sig = sig * env * amp;\n Out.ar(0, sig!2);\n}).add;\n);\n\n\n// play a chord (farfisa-like sound)\n(\n[60, 64, 67].do ({\n | note |\n Synth(\\violin, [\\midinote, note]);\n})\n);\n\n// play a single note (it seems also a flute!)\nx = Synth(\\violin, [\\midinote, 84]);\nx.set(\\gate, 0); // stop the note\n\n\n// play some random notes\n(\np = Pbind(\n \\instrument, \\violin,\n \\midinote, Prand( Scale.majorPentatonic.degrees, inf) + 60,\n \\dur, 3,\n \\legato, 1\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SoundFileView.read` do? What arguments does it take?"}, {"role": "assistant", "content": "Reads a section of the #-soundfile and displays it in the view. For large files, you may want to use readWithTask instead. The 'block' argument has no effect; the display resolution is Arguments: startFrame — The beginning of the section, in frames.; frames — The size of the section, in frames.; block — The block size - visual resolution of the display. An Integer of the form 2**n.; closeFile — If true, closes the SoundFile after reading.; doneAction — A Function called when the file reading has completed.."}]} -{"conversations": [{"role": "user", "content": "What does `Number.complex` do?"}, {"role": "assistant", "content": "Create a new Complex number whose real part is the receiver with the given imaginary"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\\stealMe, { |out, gate = 1|\n Out.ar(out, { BrownNoise.ar }.dup * EnvGen.kr(Env.asr, gate, doneAction: Done.freeSelf))\n}).add;\n);\n\na = Synth(\\stealMe);\na.release(3); // // cutoff in 3 seconds\n\n// this is how the OSC data looks like:\ns.sendMsg(\\s_new, \\stealMe, 1001, 1, 0);\ns.sendMsg(\\n_set, 1001, \\gate, -1.1; // cutoff in 0.1 seconds\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\\stealMe, { |out, gate = 1|\n Out.ar(out, { BrownNoise.ar }.dup * EnvGen.kr(Env.asr, gate, doneAction: Done.freeSelf))\n}).add;\n);\n\na = Synth(\\stealMe);\na.release(3); // // cutoff in 3 seconds\n\n// this is how the OSC data looks like:\ns.sendMsg(\\s_new, \\stealMe, 1001, 1, 0);\ns.sendMsg(\\n_set, 1001, \\gate, -1.1); // cutoff in 0.1 seconds\n```"}]} -{"conversations": [{"role": "user", "content": "How do I structure a live-coding performance in one file?"}, {"role": "assistant", "content": "One Tdef per musical layer, each with its own loop, so you can start and stop layers while the set\nruns.\n\n```supercollider\n(\nTdef(\\kick, {\n loop {\n Synth(\\kick);\n 0.5.wait;\n }\n}).play;\n\nTdef(\\hats, {\n loop {\n Synth(\\hat, [\\amp, 0.15]);\n (1/8).wait;\n }\n}).play;\n)\n```\n`Tdef(\\kick).stop` stops one layer, `Tdef(\\kick).reset` restarts it at the next cycle, and\n`CmdPeriod.run` stops everything."}]} -{"conversations": [{"role": "user", "content": "What does `Platform.when` do?"}, {"role": "assistant", "content": "Evaluate ifFunction if all features are present, otherwise evaluate elseFunction. `Platform.when(#[\\Document, \\Window], { \"yeehah!\".postln"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Words in a matchbox?"}, {"role": "assistant", "content": "```supercollider\n// really early first approach...\n(\nx.free;\nx = {\n var note = Duty.kr(\n 6/3.2,\n 0, \n Dseq([45, 45, 48, 41], inf));\n var snd = Saw.ar(note.midicps * SinOsc.kr(7.421).range(0.998, 1.001)) * -12.dbamp!2;\n var trigs = TDuty.kr(\n Dseq([1, 2, 3]/3.2, inf),\n 0,\n 1);\n var lvls = Duty.kr(\n Dseq([1, 2, 3]/3.2, inf),\n 0,\n Dseq([-9, -3, -6], inf));\n snd = snd * lvls.dbamp.lag2(0.1);\n snd = snd * EnvGen.kr(Env.perc(0.3, 0.3), trigs);\n snd = RLPF.ar(snd, EnvGen.kr(Env.perc(0.5, 0.2), trigs) * 3201 + 2311, 0.2);\n snd = LPF.ar(snd, 3000);\n snd = snd * (1 + Latch.ar(WhiteNoise.ar(-8.dbamp), Dust.ar(830))).lag2(0.01);\n snd = snd + LPF.ar(CombC.ar(snd, 0.4, 0.33, 0.52, -4.dbamp), 932);\n snd = FreeVerb2.ar(snd, snd, 0.21, 0.93, 0.9);\n snd * -12.dbamp;\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `FreqScopeView.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Frequency analysis view Arguments: parent — The parent view.; bounds — An instance of Rect, or a Point indicating `width@height`.; server — The server to be shown in scope.."}]} -{"conversations": [{"role": "user", "content": "What is `SinOsc` in SuperCollider?"}, {"role": "assistant", "content": "SinOsc — Interpolating sine wavetable oscillator. Generates a sine wave. Uses a wavetable lookup oscillator with linear interpolation. Frequency and phase modulation are provided for audio-rate modulation. Technically, `SinOsc` uses the same implementation as Osc except that its table is fixed to be a sine wave made of `8192` samples. Category: UGens > Generators > Deterministic."}]} -{"conversations": [{"role": "user", "content": "What does `Sieve.union_o` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new Sieve object in mode 'points' with offsets, generated by the union of sets of Arguments: ... data — Alternating generators and integer offsets plus an optional integer limit, wrapped into a Ref, which is included when reached. Allowed generators: Integers, Streams or Patterns producing intervals or Sieves itself. Integers and Stream/Pattern output must be strictly positive. Integers as generators ."}]} +{"conversations": [{"role": "user", "content": "What is `BooleanEditor` in SuperCollider?"}, {"role": "assistant", "content": "BooleanEditor — holds and edits a boolean `b = BooleanEditor(false);` Category: Libraries > crucial > Editors."}]} +{"conversations": [{"role": "user", "content": "Write a granular texture in SuperCollider."}, {"role": "assistant", "content": "Read a sound file into a buffer, then trigger grains from it. Grain density is the Impulse rate and\ngrain length is dur; keep the density times the length under maxGrains or raise it.\n\n```supercollider\n(\ns.waitForBoot {\n ~buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n SynthDef(\\grain, { |out = 0, amp = 0.4, density = 30, dur = 0.08|\n var trig = Impulse.kr(density);\n var sig = GrainBuf.ar(2, trig, dur, ~buf, 1, LFNoise0.kr(2).range(0, 1), 2, 0, -1, 512);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n Synth(\\grain);\n};\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Add two UGens\n{ SinOsc.ar(440, 0, 0.2) + PinkNoise.ar(0.1; }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Add two UGens\n{ SinOsc.ar(440, 0, 0.2) + PinkNoise.ar(0.1); }.play\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DelayC`."}, {"role": "assistant", "content": "```supercollider\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nDelayC.ar(z, 0.2, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\n(\n// recursive application of delay.\n{\nz = Decay2.ar(Dust.ar(1, 0.5), 0.01, 0.1, Saw.ar(100 + [0, 1]));\n5.do { |i| z = DelayC.ar(RLPF.ar(z, Rand(100, 3000), 0.03), 1, 1 / (2**i), 1, z * 0.5) };\nz\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `KDRMaskTester.value` do? What arguments does it take?"}, {"role": "assistant", "content": "KeyCodeResponder utility for comparing modifier masks Arguments: view; char; modifier; unicode; keycode."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Granular electromaton. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\nServer.local.waitForBoot({\n(\nz.free;\nz = Buffer.alloc(s, 512, 1);\nz.sine1(1.0 / [1, 2, 3, 4], true, true, true);\n\n fork( { loop {\n SynthDef(\"g1\",{ arg out=0,bufnum=0,dur=1,rate=1,pos=0,sdens=1,edens=1;\n var dens = Line.kr(sdens,edens,dur);\n var trig = [LFNoise0,SinOsc,Impulse,LFPulse,LFSaw].choose.ar(Line.kr(sdens,edens,dur));\n //var env = EnvGen.kr(Env.perc(0.0001.rrand(0.1),dur*0.5.rrand(2)),doneAction:2);\n var env = EnvGen.kr(Env.perc(0.0001.rrand(0.1),dur*(0.5.rrand(4))),doneAction:2);\n Out.ar(out,\n GrainBuf.ar(2,trig,1/dens,bufnum,rate,pos)*env;\n )\n }).add();\n [1,2,4,8,16,32].choose.postln.wait;\n }\n }\n );\n\n\na = Pbind(\\instrument,\\g1,\\dur,Pseq([Pseq([0.25],32),Pseq([0.25,0.125,0.125],32),Pseq([0.125],32)],inf),\\sdens,Pseq([9000,1000,500]/10,inf),\\edens,Prand([Pseq([9000,1000,500]/10,4),Pseq([1],1)],inf),\\rate,Pfunc({-10.0.rrand(10)}),\\pos,Pfunc({1.0.rand}),\\bufnum,z.bufnum);\nb = Pbind(\\instrument,\\g1,\\dur,Pseq([4],inf),\\sdens,Pseq([9000,1000,500]/100,inf),\\edens,Prand([Pseq([9000,1000,500]/10,1),Pseq([1],3)],inf),\\rate,Pfunc({-10.0.rrand(10)}),\\pos,Pfunc({-10.0.rrand(10)}),\\bufnum,z.bufnum);\nc = Pbind(\\instrument,\\g1,\\dur,Pseq([4/3],inf),\\sdens,Pseq([9000,1000,500,25],inf),\\edens,Prand([Pseq([9000,1000,500,25],1),Pseq([1],4)],inf),\\rate,Pfunc({-100.0.rrand(100)}),\\pos,Pfunc({-10.0.rrand(10)}),\\bufnum,z.bufnum);\n\n\na =a.play;\nb =b.play;\nc =c.play;\n\n)\n});\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var env = Env([0, 0.6, 0.3, 1.0, 0], [0.1, 0.02, 0.4, 1.1], [\\lin, \\exp, -6, \\sin]);\n var envgen = IEnvGen.kr(env, MouseX.kr(0, env.times.sum));\n env.plot;\n SinOsc.ar(envgen * 500 + 440)\n}.play;\n);\n\n// index with an SinOsc ... mouse controls amplitude of SinOsc\n// use offset so negative values of SinOsc will map into the Env\n(\n{\n var sin = SinOsc.ar(440, 0, MouseX.kr(0, 1));\n // use offset so negative values of SinOsc will map into the Env\n v\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var env = Env([0, 0.6, 0.3, 1.0, 0], [0.1, 0.02, 0.4, 1.1], [\\lin, \\exp, -6, \\sin]);\n var envgen = IEnvGen.kr(env, MouseX.kr(0, env.times.sum));\n env.plot;\n SinOsc.ar(envgen * 500 + 440)\n}.play;\n);\n\n// index with an SinOsc ... mouse controls amplitude of SinOsc\n// use offset so negative values of SinOsc will map into the Env\n(\n{\n var sin = SinOsc.ar(440, 0, MouseX.kr(0, 1));\n // use offset so negative values of SinOsc will map into the Env\n var env = Env([-1, -0.7, 0.7, 1], [0.8666, 0.2666, 0.8668], \\lin, offset: -1.0);\n IEnvGen.ar(env, sin) * 0.1\n}.play;\n);\n\n// index with Amplitude of input, control freq of SinOsc (uses SoundIn)\n(\n{\n var point = Amplitude.ar(SoundIn.ar(0), 0.01, 0.2);\n // use offset so negative values of SinOsc will map into the Env\n var env = Env.xyc([[0, 330, \\exp], [0.5, 440, \\exp], [1.0, 1760]]);\n SinOsc.ar(IEnvGen.kr(env, point)) * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nNdef(\\sound, { SinOsc.ar([600, 635], Ndef.ar(\\sound), LFNoise1.kr(2).max(0) * 0.2) });\nNdef(\\sound.play;\nNdef.clear;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nNdef(\\sound, { SinOsc.ar([600, 635], Ndef.ar(\\sound), LFNoise1.kr(2).max(0) * 0.2) });\nNdef(\\sound).play;\nNdef.clear;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n//a SynthDef\n(\nSynthDef(\"plucking\", {arg amp = 0.1, freq = 220, decay = 5, coef = 0.1;\n\nvar env, snd;\nenv = EnvGen.kr(Env.linen(0, decay, 0.5), doneAction: 2);\nsnd = Pluck.ar(\n in: Saw.ar(freq, 0.5*amp),\n trig: Impulse.kr(0),\n\n maxdelaytime: 0.1,\n delaytime: freq.reciprocal,\n decaytime: decay,\n coef: coef);\n Out.ar(0, [snd, snd]);\n}).add;\n);\n\n//Bugger soundtrack\n(\nPbind(\n \\instrument, \"plucking\",\n \\scale, Scale.lydian,\n \\degree, Prand([[-2.5, -4.001], [-7.002, -5], [-1, -3.003], [1.005, 0.51]], inf),\n \\amp, Pseq([0.1, 0.2, 0.3, 0.4, 0.5, 0.5, 0.5, 0.5], inf),\n \\decay, Pseq([0.25,1, 0.5, 0.125], inf),\n \\coef, Pseq([0.7, 0.8, 0.9], inf),\n \\dur, Pseq([0.01, 0.0025, 0.2475, 0.24, 0.5], inf)\n).play;\n)\n```"}, {"role": "assistant", "content": "This will be the sound track for Bugger, a Frogger clone that started as a school assignment.\r\nSimple SynthDef using Pluck, and a few Pbinds. \r\n\r\nBugger can be found on [GitLab](https://gitlab.com/Modanung/Bugger)."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n‎{h={|f|1-LFTri.ar(f)};l={|s,e|Line.ar(s,e,1200,1,0,2)};FreeVerb.ar(h.(l.(147,5147))*h.(l.(1117,17))*h.(100)*h.([55,55.1])*0.05,0.7,1)}.play\n\n//Explanation of this piece - http://schemawound.com/post/40100438722/11-13-2012-tweet-explained\n```"}, {"role": "assistant", "content": "Explanation of this piece - http://schemawound.com/post/40100438722/11-13-2012-tweet-explained."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// This SynthDef has a harder attack than the default, illustrating rearticulation more clearly.\n(\nSynthDef(\\sawpulse, { |out, freq = 440, gate = 0.5, plfofreq = 6, mw = 0, ffreq = 2000, rq = 0.3, freqlag = 0.05, amp = 1|\n var sig, plfo, fcurve;\n plfo = SinOsc.kr(plfofreq, mul: mw, add: 1);\n freq = Lag.kr(freq, freqlag) * plfo;\n fcurve = EnvGen.kr(Env.adsr(0, 0.3, 0.1, 20), gate);\n fcurve = (fcurve - 1).madd(0.7\n// …\n```"}, {"role": "assistant", "content": "This SynthDef has a harder attack than the default, illustrating rearticulation more clearly. (PmonoArtic: partly monophonic event stream)"}]} {"conversations": [{"role": "user", "content": "How do I structure a live-coding performance in one file?"}, {"role": "assistant", "content": "One Tdef per musical layer, each with its own loop, so you can start and stop layers while the set\nruns.\n\n```supercollider\n(\nTdef(\\kick, {\n loop {\n Synth(\\kick);\n 0.5.wait;\n }\n}).play;\n\nTdef(\\hats, {\n loop {\n Synth(\\hat, [\\amp, 0.15]);\n (1/8).wait;\n }\n}).play;\n)\n```\n`Tdef(\\kick).stop` stops one layer, `Tdef(\\kick).reset` restarts it at the next cycle, and\n`CmdPeriod.run` stops everything."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nNdef(\\sound).fadeTime = 3;\n(\nNdef(\\sound, { |fadeTime = 1, gate = 1|\n var e = Env.adsr(fadeTime, 0.01, 0.4, fadeTime).ar(2, gate);\n SinOsc.ar(100 + (e * 700), SinOsc.ar(208) * (1 - e) * 6) * e * 0.1\n}).play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nNdef(\\sound).fadeTime = 3;\n(\nNdef(\\sound, { |fadeTime = 1, gate = 1|\n var e = Env.adsr(fadeTime, 0.01, 0.4, fadeTime).ar(2, gate);\n SinOsc.ar(100 + (e * 700), SinOsc.ar(208) * (1 - e) * 6) * e * 0.1\n}).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Modes, scales, keys (tonal music) inside Pbinds."}, {"role": "assistant", "content": "```supercollider\n// MODES, SCALES, KEYS inside Pbinds\n\n// How to write Pbinds in a specific key, for example G minor\n// (using \\scale and \\degree inside Pbind)\n\n(\nPbind(\n \\scale, Scale.minor, // natural minor scale\n \\degree, Pseq([0, 1, 2, 3, 4, 5, 6s, 7, 8, 9, 10, 11]), // s for sharp, b for flats as needed\n \\root, 7, // 0 is C, 1 is C#, etc. For G minor, we put the root at 7 (seven semitones above C)\n \\dur, 1/2\n).play\n);\n\n// \\degree considers 0 to be the first scale degree.\n// If you prefer to think of 1 as the first scale degree (like in \"movable do\" solfege), simply add -1 to the end of the line.\n// The example below is in Eb Major\n(\nPbind(\n \\scale, Scale.major,\n \\degree, Pseq([1, 2, 3, 4, 5, 6, 7, 8]) - 1,\n \\root, 3, // Eb Major\n \\dur, 1/2\n).play\n);\n\n// F Mixolydian #4\n(\nPbind(\n \\scale, Scale.mixolydian,\n \\degree, Pseq([1, 2, 3, 4s, 5, 6, 7, 8], 3) - 1,\n \\root, 5, // F mixolydian with #4\n \\dur, 1/4\n).play\n);\n\nScale.directory;\n```"}]} -{"conversations": [{"role": "user", "content": "What are you not good at?"}, {"role": "assistant", "content": "Everything outside SuperCollider. I have no audio input, no live data, and my knowledge ends at the documentation snapshot I was trained on — so I can be confidently wrong about Quarks and new UGens."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n Instr(\\sin).asSynthDef( (amp:0.2) )\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n Instr(\\sin).asSynthDef( (amp:0.2) )\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a random pentatonic melody that plays by itself."}, {"role": "assistant", "content": "Pick degrees from a pentatonic scale; `\\scale` and `\\root` define the pitch space, and `\\degree`\npicks within it.\n\n```supercollider\n(\nPbind(\n \\instrument, \\default,\n \\scale, Scale.minorPentatonic,\n \\root, 3,\n \\degree, Pwhite(0, 9, inf),\n \\octave, 5,\n \\dur, Pwhite(0.12, 0.28, inf),\n \\amp, 0.2,\n \\legato, 0.8\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `RedDiskInSampler.buffers` do?"}, {"role": "assistant", "content": "Return an array of buffer for this key. The number of buffers depend on how many overlaps you had when"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// hear the difference, LinPan having a slight drop in the middle (yeah, it's subtle)...\n{ LinPan2.ar(SinOsc.ar(440), Line.kr(-1, 1, 5)) }.play;\n\n// ... whereas Pan2 is more smooth\n{ Pan2.ar(SinOsc.ar(440), Line.kr(-1, 1, 5)) }.play;\n\n// other examples\n{ LinPan2.ar(PinkNoise.ar(0.4), FSinOsc.kr(2)) }.play;\n\n{ LinPan2.ar(FSinOsc.ar(800, 0, 0.1), FSinOsc.kr(3)) }.play;\n```"}, {"role": "assistant", "content": "hear the difference, LinPan having a slight drop in the middle (yeah, it's subtle)... ... whereas Pan2 is more smooth (LinPan2: Two channel linear pan.)"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `GrayNoise`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-GrayNoise\", { |out = 0|\n Out.ar(out,\n GrayNoise.ar(-20.dbamp)\n )\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Using sine waves to generate a saw waveform."}, {"role": "assistant", "content": "```supercollider\nq={|f,e|a=Array.fill(e,{|j|e-j}).reverse;(Mix.ar(a.collect{|x|SinOsc.ar(f*x,0,1/x)})/2)!2};{q.(60,300)}.play //saw from sine #supercollider\n\n//Change the values passed to q to control the frequency and how many sines are used.\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Rand`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-Rand\", { |out = 0|\n Out.ar(out,\n FSinOsc.ar(\n Rand(200.0, 400.0),\n 0, Line.kr(0.2, 0, 1, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n(\nRoutine({\n 8.do({\n Synth.new(\"help-Rand\"); 1.0.wait;\n })\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var w, x, y, p, q, a, b, c, d;\n\n p = LFSaw.ar(200);\n q = LFSaw.ar(301);\n\n // B-format encode\n #w, x, y = BiPanB2.ar(p, q, MouseX.kr(-1, 1), 0.1);\n\n // B-format decode to quad\n #a, b, c, d = DecodeB2.ar(4, w, x, y);\n\n [a, b, d, c] // reorder to my speaker arrangement: Lf Rf Lr Rr\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var w, x, y, p, q, a, b, c, d;\n\n p = LFSaw.ar(200);\n q = LFSaw.ar(301);\n\n // B-format encode\n #w, x, y = BiPanB2.ar(p, q, MouseX.kr(-1, 1), 0.1);\n\n // B-format decode to quad\n #a, b, c, d = DecodeB2.ar(4, w, x, y);\n\n [a, b, d, c] // reorder to my speaker arrangement: Lf Rf Lr Rr\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n~name = \\defaultMapper;\n\n// default mapper does nothing. It could have been named 'identity'\n~function = { |aziDeg = 0, eleDeg = 0, gainDB = -99, delayMs = 1, lpHz = 15000, hpHz = 5, spread = 0.01, nfIndex = 0|\n [[aziDeg, eleDeg, gainDB, delayMs, lpHz, hpHz, spread, nfIndex]];\n };\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// allocate buffer\nb = Buffer.alloc(s, 44100, 1);\n\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nBufDelayN.ar(b.bufnum, z, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\nb.free;\n\n\n// multichannel\n\n// two channels, two buffers\nb = Buffer.allocConsecutive(2, s, 32768, 1);\n\na = { |bufs = #[0, 1]|\n var sig = SinOsc.ar([440, 880\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// allocate buffer\nb = Buffer.alloc(s, 44100, 1);\n\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nBufDelayN.ar(b.bufnum, z, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\nb.free;\n\n\n// multichannel\n\n// two channels, two buffers\nb = Buffer.allocConsecutive(2, s, 32768, 1);\n\na = { |bufs = #[0, 1]|\n var sig = SinOsc.ar([440, 880]) * Decay2.kr(Impulse.kr([2, 4]), 0.01, 0.15);\n sig + BufDelayN.ar(bufs, sig, delaytime: 0.125)\n}.play(args: [bufs: b]);\n\na.free;\nb.do(_.free);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Modes, scales, keys (tonal music) inside Pbinds."}, {"role": "assistant", "content": "```supercollider\n// MODES, SCALES, KEYS inside Pbinds\n\n// How to write Pbinds in a specific key, for example G minor\n// (using \\scale and \\degree inside Pbind)\n\n(\nPbind(\n \\scale, Scale.minor, // natural minor scale\n \\degree, Pseq([0, 1, 2, 3, 4, 5, 6s, 7, 8, 9, 10, 11]), // s for sharp, b for flats as needed\n \\root, 7, // 0 is C, 1 is C#, etc. For G minor, we put the root at 7 (seven semitones above C)\n \\dur, 1/2\n).play\n);\n\n// \\degree considers 0 to be the first scale degree.\n// If you prefer to think of 1 as the first scale degree (like in \"movable do\" solfege), simply add -1 to the end of the line.\n// The example below is in Eb Major\n(\nPbind(\n \\scale, Scale.major,\n \\degree, Pseq([1, 2, 3, 4, 5, 6, 7, 8]) - 1,\n \\root, 3, // Eb Major\n \\dur, 1/2\n).play\n);\n\n// F Mixolydian #4\n(\nPbind(\n \\scale, Scale.mixolydian,\n \\degree, Pseq([1, 2, 3, 4s, 5, 6, 7, 8], 3) - 1,\n \\root, 5, // F mixolydian with #4\n \\dur, 1/4\n).play\n);\n\nScale.directory;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a snare drum in SuperCollider."}, {"role": "assistant", "content": "Two ingredients: a short tonal body and band-passed noise for the rattle.\n\n```supercollider\n(\nSynthDef(\\snare, { |out = 0, amp = 0.6|\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -6), doneAction: 2);\n var body = SinOsc.ar(180) * 0.4;\n var rattle = BPF.ar(WhiteNoise.ar, 1800, 0.4) * 3;\n Out.ar(out, Pan2.ar((body + rattle) * env * amp));\n}).add;\n);\nSynth(\\snare);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for simple melody algorithmically generated with a Markov Chain."}, {"role": "assistant", "content": "```supercollider\n/* Markov Chain Experiment II\n Jacob Joaquin\n\n Get a visual representation of the Markov Chain here:\n http://codehop.com/supercollider-markov-chain/\n*/\n\n(\n// Synthesizer\nSynthDef(\\my_synth, {|dur = 1.0, amp = 1.0, freq = 440|\n var env = EnvGen.ar(Env.new([1, 0.1, 0], [0.06, dur - 0.06]), doneAction: 2);\n Out.ar([0, 1], SinOsc.ar([freq * 0.995, freq * 1.005], 0, env * amp))\n}).add; \n\n// Create task\nt = Task({\n // Set attributes of each node\n // [freq, dur, [[next_state, weighted_random],…]]\n var node_list = [\n [60, 1, [[1, 2]]],\n [62, 0.5, [[0, 1], [2, 1]]],\n [63, 1, [[0, 1], [3, 1]]],\n [65, 0.5, [[0, 1], [3, 4], [4, 1]]],\n [67, 1, [[5, 1]]],\n [70, 1.5, [[4, 1], [6, 2]]],\n [69, 1, [[4, 1], [7, 2]]],\n [72, 0.5, [[4, 1], [7, 4], [0, 2]]]\n ];\n\n var node_index = 0;\n var bps = 133.0 / 60.0; // Beats per second\n \n inf.do({\n var weight = 0;\n var random;\n var accumulator;\n var node = node_list[node_index]; \n var freq = node[0].midicps;\n var dur = node[1] / bps;\n var paths = node[2];\n \n // Get total statistical weight of connected nodes\n (0 .. paths.size - 1).do {|i| weight = weight + paths[i][1]};\n \n // Generate random value for choosing next node\n random = weight.rand;\n\n // Choose next node based on statistical weights\n accumulator = paths[0][1];\n \n node_index = block {|break|\n paths.size.do {|i|\n if ((random < accumulator), {\n break.value(paths[i][0])\n }, {\n accumulator = accumulator + paths[i + 1][1] \n })\n }\n };\n \n // Play\n Synth(\\my_synth, [\\dur, dur, \\amp, -3.dbamp, \\freq, freq]); \n dur.wait;\n })\n});\n\nt.start;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `EnvirGui` in SuperCollider?"}, {"role": "assistant", "content": "EnvirGui — display the contents of an environment for editing EnvirGui displays all keys and values of an environment, so one can change them flexibly. Single number get displayed with an EZSlider, pairs of numbers with an EZRanger, and anything else is shown as an EZText (a text field). Category: JITLib > GUI, Live Coding."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for seeking an Array!."}, {"role": "assistant", "content": "```supercollider\n(// * //watch the postWindow\na=[\"m\",\"x\",\"f\",\"k\",\"d\",\"p\"];\nx=Array;\ny=x.newClear(6);\n~mxfkdp=Task({\n inf.do({y.put(x.series(6,0,1).choose,a.scramble).postln;\n 0.03.wait;})}).play;\nm=fork({inf.do({\n \"array num:\".postcln;\n if(y[x.series(6,0,1).choose.postcln]==a,\n {\"lo encontraste!/found it!\".postcln;\n 1.do({GVerb.ar(\n EnvGen.ar(Env.perc(0.01,8),1,doneAction:2)*\n Blip.ar(XLine.kr(440,1600,8)),50,10,0.02)}.play);\n ~mxfkdp.stop;\n m.stop;}, \n {\"buscando.../seeking...\".postcln;});\n 0.03.wait})});\n);\n//.SCtweetLong\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Midterm Question 2 (a SuperCollider snippet)?"}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"sawSynth\", {arg freq, amp;\n \n Out.ar(0, Splay.ar(LPF.ar(in: Saw.ar(freq * [0.99, 1.0, 1.001, 1.008], mul:Env.perc(attackTime:0.1, releaseTime:2, level:amp).kr(2)),freq: 2000)))\n\n}).add;\n);\n\n(\nPbind(\n \\instrument, \"sawSynth\",\n \\degree, Pseq([1,3,5,7], inf),\n \\dur, 0.111, \n \n).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n~inPlaceSub = { |array, find, replace|\n array.do({ |item, i|\n if(item == find) { array[i] = replace };\n });\n};\n\n~trySub = { |array, find, replace|\n try {\n ~inPlaceSub.(array, find, replace)\n } { |error|\n switch(error.species.name)\n { 'PrimitiveFailedError' } {\n if(error.what.find(\"immutable\").notNil) {\n \"caught ImmutableError\".postln;\n ~inPlaceSub.(array.copy, find, replace)\n } { \"unknown primitive exception\".postln; error.throw }\n }\n // default case: unhandled exception, should\n// …\n```"}, {"role": "assistant", "content": "default case: unhandled exception, should die so re-throw error pass in a mutable array, OK (Exception: root error class)"}]} -{"conversations": [{"role": "user", "content": "What is the difference between TempoClock and SystemClock?"}, {"role": "assistant", "content": "SystemClock runs in real time and is what `.wait` uses by default. TempoClock runs in beats and has a tempo, so it can be changed while things are playing and Patterns scheduled on it follow. `TempoClock.default` is the clock Patterns use unless told otherwise, which is why `TempoClock.default.tempo = 2` changes the speed of everything you already have running."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for UI sounds (pt1)."}, {"role": "assistant", "content": "```supercollider\n// UI sounds\n// this code is an attempt to recreate a sound\n// inspired from some technological/electrical UI interface\n\n// 1. first define the synth\n// Here we are using the FM technique\n(\nSynthDef(\\fmmod, {\n |\n amp=0.2,\n fc=1000,\n fm = 100,\n idx = 100,\n atk=0.01,\n rls=0.1\n |\n var env = EnvGen.ar(Env.perc(atk, rls), doneAction:2);\n var modulator = SinOsc.ar(fm);\n var carrier = SinOsc.ar(fc + (idx*modulator) );\n var sig = carrier * env * amp;\n sig = HPF.ar(sig, 1000);\n Out.ar(0, sig!2);\n}).add;\n);\n\n// 2. then define the Pbind which will play the sequence\n// of UI sounds simulating variuos characters showing up on an\n// imaginary display.\n// Play around FC, FM, ATK and RLS to obtain different sound characters.\n(\np = Pbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 100,\n \\idx, 100,\n \\amp, 0.6,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).asEventStreamPlayer;\n);\n\n// 3. play it\np.play;\n\n// 4. Here are some presets\n\n// \"cricket\" preset\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 100,\n \\idx, 100,\n \\amp, 0.6,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 2\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 1000,\n \\idx, 100,\n \\amp, 0.6,\n \\atk, 0.001,\n \\rls, 0.01,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 3\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 100,\n \\idx, 10,\n \\amp, 0.4,\n \\atk, 0.01,\n \\rls, 0.01,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 4\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 1000,\n \\fm, 100,\n \\idx, 1000,\n \\amp, 0.2,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n\n// preset 5\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 5000,\n \\fm, 1000,\n \\idx, 1000,\n \\amp, 0.4,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 5\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 8000,\n \\fm, 1000,\n \\idx, 1000,\n \\amp, 0.7,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `RedInterpolator` in SuperCollider briefly."}, {"role": "assistant", "content": "RedInterpolator — holds a value and interpolates to new target Interpolator. Category: Red > redScore."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n\n~remapConfig = IdentityDictionary[\n 0 -> 1,\n 1 -> 2,\n 2 -> 3,\n 3 -> 4,\n 4 -> 5,\n 5 -> 6,\n 6 -> 7,\n 7 -> 8,\n 8 -> 9,\n 9 -> 12,\n 10 -> 13,\n 11 -> 14,\n 12 -> 15,\n 13 -> 16,\n 14 -> 17\n];\n\n\n~generateRemapSynthDef = { |numInputChannels, numOutputChannels|\n SynthDef(\\remapOutputs, {\n var sig = In.ar(0, numInputChannels); \n var remapped = Array.fill(numOutputChannels, { Silent.ar(1) }); \n\n ~remapConfig.keysValuesDo { |src, dest|\n if (src < numInputChannels and: { dest < numOutputChannels }) {\n remapped[dest] = sig[src];\n }\n };\n\n ReplaceOut.ar(0, remapped);\n }).add;\n};\n\n~generateRemapSynthDef.(16, 18); \n);\n\n(\n~createRemapSynth = {\n ~remapSynth = Synth(\\remapOutputs, target: s.defaultGroup, addAction: \\addAfter);\n};\n\nServerTree.add( ~createRemapSynth);\n\n)\n```"}, {"role": "assistant", "content": "This code sets up a remapping system where input channels are mapped to output channels based on a predefined configuration. The remapping is done using a SynthDef that reads input signals, applies the remapping, and outputs the remapped signals. The ServerTree.add ensures that the remap synth is created and added to the server's node tree upon server startup and cmd-. and ctrl-.\r\n\r\nBased on discu."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Schemawound track from the SIGNALVOID compilation."}, {"role": "assistant", "content": "```supercollider\n/*\nSchemawound track from the SIGNALVOID compilation.\nSIGNALVOID is a noise compilation. Participants were asked to create up to three tracks, each of exactly one minute in length, with no gaps of silence at the beginning or end. Download the free compilation here: http://archive.org/details/SignalvoidMp3 or http://archive.org/details/SignalvoidFlac\nPhysical copies are available here http://signalvoid.bandcamp.com/merch/signalvoid-2\n\nBlog post about the creation of this track http://schemawound.tumblr.com/post/29065985817/signalvoid-1-burn-it-to-disc-then-burn-the-disc\n*/\n\n(\n {\n var saw1 = Saw.ar((10..100));\n var saw2 = Mix(Saw.ar(saw1).range(100, 600));\n var sin0 = SinOsc.ar(0.002).range(5,75);\n var sin1 = SinOsc.ar(0.1).range(1,sin0);\n var sin2 = SinOsc.ar(0.15).range(2,10);\n var sinMod = (sin1 * sin2)!2;\n var sin66 = SinOsc.ar(0.0164).range(600,1000);\n var saw3 = Saw.ar(sinMod).range(200, sin66);\n var saw4 = Saw.ar(saw3);\n var sin3 = Mix(SinOsc.ar((1..100)));\n var sum1 = (saw2 * saw4) * sin3;\n var comb1 = CombL.ar(sum1, 1, 0.2, 1) + sum1;\n var sin4 = SinOsc.ar(0.12).range(3, 1000);\n var comb2 = comb1.tanh;\n var sin5 = SinOsc.ar(sin4);\n var sin6 = SinOsc.ar(0.001);\n var comb3 = comb2 * sin5 * sin6;\n var sum2 = (comb2 + comb3) * 0.3;\n var verb1 = sum2;\n var line1 = Line.ar(1, 0.001, 60, doneAction: 2);\n var line2 = Line.ar(0, 1, 60);\n var comb4 = CombL.ar(verb1, 1, line1, 0.1) * line2;\n var sum3 = comb4 + verb1;\n sum3 * 0.5;\n }.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `DrawGrid`?"}, {"role": "assistant", "content": "DrawGrid — Draws grid lines on a UserView for plotting"}, {"role": "user", "content": "What does `DrawGrid.draw` do?"}, {"role": "assistant", "content": "This draws to the currently active UserView. This method is meant to be called from inside the UserView#-drawFunc#-drawFunc of a `UserView`."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nx = [0, 10].asSpec.units_(\"sec\");\ny = [0, 1].asSpec.units_(\"amp\");\nd = DrawGrid((500@250).asRect, x.grid, y.grid);\n\n// set its properties before testing\nd.x.tickSpacing_(25);\nd.linePattern_(FloatArray[10.0, 5.0, 2.0, 5.0]);\n\n// generate a preview\n~testView = d.preview;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// We'll hear the sawtooth wave when the two sine oscillators are both in the region x = 0.0 to 0.5, y = 0.5 to 1.0\n(\n{\n InRect.ar(\n SinOsc.ar(1), SinOsc.ar(1.3), Rect(0, 0.5, 0.5, 0.5)\n ) * LFSaw.ar(44, 0, 0.1)\n}.play\n);\n\n// Stereo effect\n(\n{\n InRect.ar(\n LFNoise0.ar([140, 141]), LFNoise0.ar(143), Rect(0, 0, 0.5, 1)\n ).lag(0.1) * LFSaw.ar(SinOsc.ar(10, 0, 5, 400), 0, 0.1)\n}.play\n);\n\n// For the Rect, create as left\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// We'll hear the sawtooth wave when the two sine oscillators are both in the region x = 0.0 to 0.5, y = 0.5 to 1.0\n(\n{\n InRect.ar(\n SinOsc.ar(1), SinOsc.ar(1.3), Rect(0, 0.5, 0.5, 0.5)\n ) * LFSaw.ar(44, 0, 0.1)\n}.play\n);\n\n// Stereo effect\n(\n{\n InRect.ar(\n LFNoise0.ar([140, 141]), LFNoise0.ar(143), Rect(0, 0, 0.5, 1)\n ).lag(0.1) * LFSaw.ar(SinOsc.ar(10, 0, 5, 400), 0, 0.1)\n}.play\n);\n\n// For the Rect, create as left, 'top', width, height;\nr = Rect(0, 0, 1, 1)\n\nr.left\nr.top\nr.right\nr.bottom\n```"}]} -{"conversations": [{"role": "user", "content": "What is `CuspL` in SuperCollider?"}, {"role": "assistant", "content": "CuspL — Cusp map chaotic generator A linear-interpolating sound generator based on the difference equation: Category: UGens > Generators > Chaotic."}]} -{"conversations": [{"role": "user", "content": "How do I set the tempo?"}, {"role": "assistant", "content": "TempoClock.default.tempo = 120/60; the argument is beats per second, so 120 BPM is 2.0. Patterns scheduled on the default clock then follow it."}]} -{"conversations": [{"role": "user", "content": "What does `Array.allTuples` do?"}, {"role": "assistant", "content": "Returns a new Array whose elements contain all possible combinations of the receiver's subcollections. `[[1, 2, 3, 4, 5], [10, 20,"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Variations for Z1 sawtooth."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var mod = SinOsc.ar([0.1,0.15,0.2]).range(0,1);\n var saw = LFSaw.ar([10,12,15]);\n var out = (saw - ((saw>0)*mod)+(mod*0.5));\n Splay.ar(out)*0.4;\n}.play;\n\n{\n var mod = SinOsc.ar([0.1,0.15,0.2]).range(0,1);\n var saw = SinOsc.ar(LFSaw.ar([10,12,15]).range(200,300));\n var out = (saw - ((saw>0)*mod)+(mod*0.5));\n Splay.ar(out)*0.4;\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Words in a matchbox?"}, {"role": "assistant", "content": "```supercollider\n// really early first approach...\n(\nx.free;\nx = {\n var note = Duty.kr(\n 6/3.2,\n 0, \n Dseq([45, 45, 48, 41], inf));\n var snd = Saw.ar(note.midicps * SinOsc.kr(7.421).range(0.998, 1.001)) * -12.dbamp!2;\n var trigs = TDuty.kr(\n Dseq([1, 2, 3]/3.2, inf),\n 0,\n 1);\n var lvls = Duty.kr(\n Dseq([1, 2, 3]/3.2, inf),\n 0,\n Dseq([-9, -3, -6], inf));\n snd = snd * lvls.dbamp.lag2(0.1);\n snd = snd * EnvGen.kr(Env.perc(0.3, 0.3), trigs);\n snd = RLPF.ar(snd, EnvGen.kr(Env.perc(0.5, 0.2), trigs) * 3201 + 2311, 0.2);\n snd = LPF.ar(snd, 3000);\n snd = snd * (1 + Latch.ar(WhiteNoise.ar(-8.dbamp), Dust.ar(830))).lag2(0.01);\n snd = snd + LPF.ar(CombC.ar(snd, 0.4, 0.33, 0.52, -4.dbamp), 932);\n snd = FreeVerb2.ar(snd, snd, 0.21, 0.93, 0.9);\n snd * -12.dbamp;\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Resizing FreqScope?"}, {"role": "assistant", "content": "SuperCollider forum — Resizing FreqScope?\n\nOddly, this seems to work:\n\n```supercollider\n// max partial = 20 kHz\n// do not play this loudly\na = { Blip.ar(100, 200, 0.02).dup }.play;\n\nv = FreqScope(800, 600); // top partial is shown below 1.75 kHz (?)\n\nv.scope.scope.xZoom = 1; // seems correct, by eyeballing\n\n// let's try another resolution\nv = FreqScope(600, 500);\nv.scope.scope.xZoom = 1; // hm, zoom = 1 seems OK here too\n```\n\nFreqScope includes the line scope.xZoom_((scope.bufSize*0.25) / width); so it may be that this calculation is incorrect. I’m unclear, for instance, why it’s dividing by width – apparently zooming out for larger windows...?\n\nBut I tried three different widths (800x600, 600x500, 200x150), and for all of them, xZoom = 1 appeared to be correct. It’s possible that this calculation is vestigial, then – maybe we needed it for the older version of frequency scope, but the Qt version might not need it at all.\n\nhjh"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\na = SynthDef(\"help-TCoin\", { |out = 0, prob = 0.5|\n var trig;\n trig = CoinGate.kr(prob, Impulse.kr(10));\n Out.ar(out,\n SinOsc.ar(\n TRand.kr(300.0, 400.0, trig), 0, 0.2\n )\n )\n}).play;\n);\n\na.set(\\prob, 1.0);\na.set(\\prob, 0.0);\na.set(\\prob, 0.1);\n\n\n(\na = SynthDef(\"help-TCoin\", { |out = 0, prob = 0.5|\n var trig;\n trig = Impulse.ar(20, 0, SinOsc.kr(0.5, 0, 1, 1));\n Out.ar(out,\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\na = SynthDef(\"help-TCoin\", { |out = 0, prob = 0.5|\n var trig;\n trig = CoinGate.kr(prob, Impulse.kr(10));\n Out.ar(out,\n SinOsc.ar(\n TRand.kr(300.0, 400.0, trig), 0, 0.2\n )\n )\n}).play;\n);\n\na.set(\\prob, 1.0);\na.set(\\prob, 0.0);\na.set(\\prob, 0.1);\n\n\n(\na = SynthDef(\"help-TCoin\", { |out = 0, prob = 0.5|\n var trig;\n trig = Impulse.ar(20, 0, SinOsc.kr(0.5, 0, 1, 1));\n Out.ar(out,\n Mix.fill(3, { Ringz.ar(CoinGate.ar(prob, trig*0.5), #[1, 1.5]*Rand(1000, 9000), 0.01) })\n )\n}).play;\n);\n\na.set(\\prob, 1.0);\na.set(\\prob, 0.0);\na.set(\\prob, 0.1);\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\nq = ();\n(\n q.instructions = (\n \\NOP: 0,\n \\ORG: 1,\n \\EQU: 2,\n \\JMP: 3,\n \\JMPZ: 4,\n \\PSHL: 5,\n \\PSH: 6,\n \\PSHI: 7,\n \\POP: 8,\n \\POPI: 9,\n \\ADD: 10,\n \\SUB: 11,\n \\INC: 12,\n \\DEC: 13,\n \\AND: 14,\n \\OR: 15,\n \\XOR: 16,\n \\NOT: 17,\n \\ROR: 18,\n \\ROL: 19,\n \\PIP: 20,\n \\PDP: 21,\n \\DUP: 22,\n \\NOTE: 23,\n \\VOX: 24,\n \\STOP: 25\n );\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\nq = ();\n(\n q.instructions = (\n \\NOP: 0,\n \\ORG: 1,\n \\EQU: 2,\n \\JMP: 3,\n \\JMPZ: 4,\n \\PSHL: 5,\n \\PSH: 6,\n \\PSHI: 7,\n \\POP: 8,\n \\POPI: 9,\n \\ADD: 10,\n \\SUB: 11,\n \\INC: 12,\n \\DEC: 13,\n \\AND: 14,\n \\OR: 15,\n \\XOR: 16,\n \\NOT: 17,\n \\ROR: 18,\n \\ROL: 19,\n \\PIP: 20,\n \\PDP: 21,\n \\DUP: 22,\n \\NOTE: 23,\n \\VOX: 24,\n \\STOP: 25\n );\n\n q.translate = {|q, val|\n q.instructions[val] ?? {val}\n };\n\n q.makeCollection = {|q, program|\n program.collect{|instr| q.translate(instr)} ++ (0!(256 - program.size))\n };\n);\n\n// a saw wave generating program\nq.program = [\\ORG, \\INC, \\INC, \\JMP, 1];\n\n// load to a buffer\nb.loadCollection(q.makeCollection(q.program))\n\n{Demand.ar(Impulse.ar(20000), 0, DetaBlockerBuf(b.bufnum, 0))}.play\n```"}]} -{"conversations": [{"role": "user", "content": "What does `ContiguousBlockAllocator.reserve` do?"}, {"role": "assistant", "content": "Mark a specific range of addresses as used so that the alloc method will not return any addresses within that"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for aurora borealis?"}, {"role": "assistant", "content": "```supercollider\n(\n~root = -13;\n~revSend = Bus.audio(s, 2);\n);\n(\ns.waitForBoot(\n {\n \n SynthDef(\\bell, {\n |\n freq=556, findex=0, frate=2,\n dur=5, pos=0,\n amp=0.25,\n out=0\n |\n var sigA, sigB, sigC, sig, env, fmod;\n env = EnvGen.ar(Env.triangle(5), doneAction:2);\n fmod = findex * SinOsc.kr(frate, mul:0.5, add:0.5) * Line.kr(0, 1, 7);\n sigA = Pulse.ar(freq + fmod, LFNoise2.kr(1).range(0.2, 0.8) );\n sigB = VarSaw.ar(freq + fmod);\n sigC = WhiteNoise.ar() * 0.125;\n sig = SelectX.ar(LFNoise2.kr(2).range(0, 2), [sigA, sigB, sigC]);\n sig = LPF.ar(sig, freq*4 );\n sig = sig * env * amp;\n Out.ar(out, Pan2.ar(sig, pos));\n }).add;\n\n s.sync;\n\n SynthDef(\\rev, {\n arg in=0, out=0, mix=1, room=0.8;\n var sig;\n sig = In.ar(in, 2);\n sig = FreeVerb.ar(sig, mix, room);\n Out.ar(out, sig);\n }).add;\n\n s.sync;\n\n ~rev = Synth(\\rev, [\\in, ~revSend]);\n\n x = Pbind(\n \\instrument, \\bell,\n \\out, ~revSend,\n \\root, Pfunc({~root}),\n \\octave, Pwrand([4, 5, 6, 7], [6,8,3,1].normalizeSum, inf),\n \\degree, Prand(Scale.lydian.degrees, inf),\n \\ctranspose, Pwhite( -0.05, 0.05, inf),\n \\amp, 1.1 * Pexprand(0.001, 0.7) * (1/(Pkey(\\octave)+1)),\n \\findex, Pexprand(2, 20),\n \\frate, Pwhite(1, 25, inf),\n \\pos, Pwhite(-0.8, 0.8, inf),\n \\dur, Pwhite(0.1, 0.5),\n ).asEventStreamPlayer;\n x.play;\n\n wait(15);\n r = Routine({\n \"starting\".postln;\n loop({\n ~root = [-13, -1, 4, 7].choose;\n wait( 10.rrand(25) );\n });\n });\n r.play;\n});\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// sound example\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05, amp = 0.1|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2, amp), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\nvar a;\na = Pnaryop(\\wrap, Pseries(0, 1, 12), [3, 7]).asStream;\n{\n a.do { |val|\n Synth(\\help_sinegrain, [\\freq, (val + 72) .midicps.postln]);\n 0.5.wait;\n }\n}.for\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// sound example\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05, amp = 0.1|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2, amp), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\nvar a;\na = Pnaryop(\\wrap, Pseries(0, 1, 12), [3, 7]).asStream;\n{\n a.do { |val|\n Synth(\\help_sinegrain, [\\freq, (val + 72) .midicps.postln]);\n 0.5.wait;\n }\n}.fork;\n);\n\n(\nPbind(\n \\dur, 0.1,\n \\instrument, \\help_sinegrain,\n \\note, Pnaryop(\\wrap, Pseries(0, 1, 12), [3, 7]);\n).play;\n);\n\n\n\n// these are the same as:\n\n(\nvar a;\na = Pseries(0, 1, 12).wrap(3, 7).asStream;\n{\n a.do { |val|\n Synth(\\help_sinegrain, [\\freq, (val + 72) .midicps.postln]);\n 0.5.wait;\n }\n}.fork;\n);\n\n(\nPbind(\n \\dur, 0.1,\n \\instrument, \\help_sinegrain,\n \\note, Pwhite(0, 12, inf).wrap(3, 7);\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "What is a UGen?"}, {"role": "assistant", "content": "A UGen is a unit generator: the primitive signal-processing node of the server. SinOsc, Saw, WhiteNoise, LPF and EnvGen are UGens, and they are wired into a graph inside a SynthDef."}]} -{"conversations": [{"role": "user", "content": "What does `Function.valueArray` do?"}, {"role": "assistant", "content": "Evaluates the FunctionDef referred to by the Function. If the last argument is an Array or List, then it is unpacked and appended to the other arguments (if any) to the Function. If the last argument is not an Array or List then this is the same as the 'value' method. `{ |a, b, c| ((a * b) + c).postln }.valueArray([3, 10, 7]);` A common syntactic shortcut: `{ |a, b, c| ((a * b) + c).postln }.value(*[3, 10,"}]} -{"conversations": [{"role": "user", "content": "What does `CondVar.signalOne` do?"}, {"role": "assistant", "content": "Wakes one thread waiting on this Condition. Threads are woken in the order in which they called `wait` or `waitFor`. If a thread is woken and was waiting with a predicate, and that predicate is still `false`, it will `wait` again and be placed at the end of the queue of threads waiting on this CondVar. Another thread will not be woken in that Returns: this object"}]} -{"conversations": [{"role": "user", "content": "What is `U` in SuperCollider?"}, {"role": "assistant", "content": "U — a basic element in Unit Lib An U (short for \"unit\") represents a single audio or control process. U's are the basic building blocks of the Unit-Lib##Unit Library. Units can be chained together in a UChain to form a series of processes. Each unit can perform it's own little task, analogous to 'plugins' in popular commercial sequencers such as Logic and Pro Tools. Each unit is an instance of a Udef, which defines what the unit Category: UnitLib."}]} -{"conversations": [{"role": "user", "content": "What does `Group.addToHeadMsg` do?"}, {"role": "assistant", "content": "Returns a message of the type g_new which can be bundled. When sent to the server this message will instantiate this group. If aGroup is a Group it will be added at the head of that group. If it is nil, it will be added at the head of the default_group of this Group's server (as specified when *basicNew was"}]} -{"conversations": [{"role": "user", "content": "What does `WebView.navigate` do?"}, {"role": "assistant", "content": "Navigate to a url. This is equivalent to clicking a link on a page - after a navigate call, back will return you to the previous"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// The driven pendulum is interesting as it's a quite simple model\n// that includes parameter zones of chaotic behaviour:\n// http://lampx.tugraz.at/~hadley/physikm/apps/numerical_integration/pendulum.en.php\n\n// y here denotes the angle\n\n// y''(t) + (y'(t) / q) + sin(y(t)) = a * cos(omega * t)\n\n// which translates to\n\n// y'(t) = w(t)\n// w'(t) = (-w(t) / q) - sin(y(t)) + (a * cos(omega * t))\n\n\n(\nFb1_ODEdef(\\DrivenPendulum, { |t, y, q = 1, omega = 0,\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// The driven pendulum is interesting as it's a quite simple model\n// that includes parameter zones of chaotic behaviour:\n// http://lampx.tugraz.at/~hadley/physikm/apps/numerical_integration/pendulum.en.php\n\n// y here denotes the angle\n\n// y''(t) + (y'(t) / q) + sin(y(t)) = a * cos(omega * t)\n\n// which translates to\n\n// y'(t) = w(t)\n// w'(t) = (-w(t) / q) - sin(y(t)) + (a * cos(omega * t))\n\n\n(\nFb1_ODEdef(\\DrivenPendulum, { |t, y, q = 1, omega = 0, a = 1|\n [\n { y[1] },\n { y[1] / q.neg - sin(y[0]) + (a * cos(omega * t)) }\n ]\n}, 0, [0, 0], 1, 1);\n);\n\n\n// move the mouse through a zone of chaotic behaviour between 0.65 and 0.68\n\n(\nx = { \n var sig = Fb1_ODE.ar(\\DrivenPendulum, [2.3, MouseX.kr(0.65, 0.68).lag(2).poll, 1.6],\n 2000,\n 0, [0, 1],\n );\n sig.poll;\n sig[1] ! 2 * 0.1\n}.play\n);\n\nx.release\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nServer.local.quit; // If server running, need to stop it for this example\n\n// We'll modify the server boot procedure to set our env var...\n~realserverprogram = Server.program;\nServer.program = \"export PANCREAS=220;\" + Server.program\ns.boot;\n\n(\nx = {\n// Env var specifies frequency.\n// If you change the env var name to one that isn't set, 440 is used.\nSinOsc.ar(Getenv(\\PANCREAS, 440), 0, 0.1);\n}.play(Server.local);\n;\nx.free;\n\n// This should restore the variable to what it was\nServer.program = ~realserverprogram;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nServer.local.quit; // If server running, need to stop it for this example\n\n// We'll modify the server boot procedure to set our env var...\n~realserverprogram = Server.program;\nServer.program = \"export PANCREAS=220;\" + Server.program\ns.boot;\n\n(\nx = {\n// Env var specifies frequency.\n// If you change the env var name to one that isn't set, 440 is used.\nSinOsc.ar(Getenv(\\PANCREAS, 440), 0, 0.1);\n}.play(Server.local);\n);\nx.free;\n\n// This should restore the variable to what it was\nServer.program = ~realserverprogram;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `LoopBuf.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "sample looping oscillator Arguments: numChannels — number of channels that the buffer will be. this must be a fixed integer. The architecture of the SynthDef cannot change after it is compiled.; bufnum — the index of the buffer to use; rate — - 1.0 is normal, 2.0 is one octave up, 0.5 is one octave down. -1.0 is backwards normal rate ... etc.; gate — positive gate starts playback from startPos. negative gate plays rest of sample from current position; startPos — sample frame to start playback; startLoop — sample frame of start of loop; endLoop — sample frame of end of loop; interpolation — 1 means no interpolation, 2 is linear, 4 is cubic interpolation."}]} -{"conversations": [{"role": "user", "content": "What is `TimeStretch2` in SuperCollider?"}, {"role": "assistant", "content": "TimeStretch2 — Server Side Time Stretch Though much slower, TimeStretch is preferred, as it sounds much better. TimeStretch2 is provided more as an experimental convenience, and I cannot guarantee its accuracy. TimeStretch2 also does not work on files with a sample rate other than 44100. Category: UGens > FFT."}]} -{"conversations": [{"role": "user", "content": "What is `Fomus` in SuperCollider?"}, {"role": "assistant", "content": "Fomus — SuperCollider bindings to Fomus Music Notation Category: MusicNotation."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Periphonic (2D) encoder, 3 cardioid microphones\n// See: http://www.michaelgerzonphotos.org.uk/microphones-calrecs.html\n// [60, -180, -60]\n\n~directions = [60, -180, -60].degrad;\n~pattern = 0.5;\n~encoder = FoaEncoderMatrix.newDirections(~directions, ~pattern;\n\n// inspect\n~encoder.dirChannels.raddeg;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Periphonic (2D) encoder, 3 cardioid microphones\n// See: http://www.michaelgerzonphotos.org.uk/microphones-calrecs.html\n// [60, -180, -60]\n\n~directions = [60, -180, -60].degrad;\n~pattern = 0.5;\n~encoder = FoaEncoderMatrix.newDirections(~directions, ~pattern);\n\n// inspect\n~encoder.dirChannels.raddeg;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `RedSmooth2.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a new Arguments: factor — A Float. Less is more.; factor2 — A Float. Trend smoothing factor.; initVal — Initial value.."}]} -{"conversations": [{"role": "user", "content": "What is `DrawGrid`?"}, {"role": "assistant", "content": "DrawGrid — Draws grid lines on a UserView for plotting"}, {"role": "user", "content": "What does `DrawGrid.draw` do?"}, {"role": "assistant", "content": "This draws to the currently active UserView. This method is meant to be called from inside the UserView#-drawFunc#-drawFunc of a `UserView`."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nx = [0, 10].asSpec.units_(\"sec\");\ny = [0, 1].asSpec.units_(\"amp\");\nd = DrawGrid((500@250).asRect, x.grid, y.grid);\n\n// set its properties before testing\nd.x.tickSpacing_(25);\nd.linePattern_(FloatArray[10.0, 5.0, 2.0, 5.0]);\n\n// generate a preview\n~testView = d.preview;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `MxQuery.disconnect` do?"}, {"role": "assistant", "content": "Disconnect all matched items. Outlets and inlets disconnect all cables. Units disconnect all of their"}]} -{"conversations": [{"role": "user", "content": "What are the server's default sample rate and block size?"}, {"role": "assistant", "content": "44100 Hz and 64 samples per block by default, so the control rate is 44100/64 = 689.06 Hz. You can read them from the language with `s.sampleRate` and `s.options.blockSize`, or from inside a Synth with `SampleRate.ir` and `ControlRate.ir`. A `.kr` signal therefore updates about 689 times a second, which is why it is smooth enough for filters and envelopes but not for audio-rate FM."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// compare:\n(\n{\n var mod = SinOsc.kr(Line.kr(1, 10, 10));\n SinOsc.ar(mod * 400 + 500) * 0.1\n}.play;\n);\n\n(\n{\n var mod = SinOsc.kr(Line.kr(1, 10, 10));\n SinOsc.ar(LinExp.kr(mod, -1, 1, 100, 900)) * 0.1\n}.play;\n);\n\n// modulating destination values.\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(LinExp.ar(mod, -1, 1, MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1))) * 0.1\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// compare:\n(\n{\n var mod = SinOsc.kr(Line.kr(1, 10, 10));\n SinOsc.ar(mod * 400 + 500) * 0.1\n}.play;\n);\n\n(\n{\n var mod = SinOsc.kr(Line.kr(1, 10, 10));\n SinOsc.ar(LinExp.kr(mod, -1, 1, 100, 900)) * 0.1\n}.play;\n);\n\n// modulating destination values.\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(LinExp.ar(mod, -1, 1, MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1))) * 0.1\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// rhythms looped too\n\n(\np = PSloop(\n Pbind(\n \\dur, Pn(Pshuf([1, 1, 2]/6)),\n \\midinote, Prand((60..80), inf)\n ),\n bufSize: 10,\n lookBack: Pseq([0, 0, 0, 2, 2, 3, 3], inf)\n).play\n;\n\np.stop\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// rhythms looped too\n\n(\np = PSloop(\n Pbind(\n \\dur, Pn(Pshuf([1, 1, 2]/6)),\n \\midinote, Prand((60..80), inf)\n ),\n bufSize: 10,\n lookBack: Pseq([0, 0, 0, 2, 2, 3, 3], inf)\n).play\n);\n\np.stop\n```"}]} -{"conversations": [{"role": "user", "content": "What is `SortedList`?"}, {"role": "assistant", "content": "SortedList — a Collection whose items are kept in a sorted order."}, {"role": "user", "content": "What does `SortedList.new` do?"}, {"role": "assistant", "content": "Creates a SortedList with the initial capacity given by size and a comparison function. The SortedList can contain equal / identical elements more than once. The function must accept two arguments and return true if and only if the first argument comes before the second argument in the sort order. If omitted, defaults to `{|a, b| a < b}`. (Note that this is slightly different from what Sequenceabl"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nt = SortedList.new(8, {|a,b| a.first < b.first });\nt.add([10, \"last\"]);\nt.add([1, \"first\"]);\nt.postln;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SendReply.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Send an array of values from the server to all notified clients Arguments: trig — a non-positive to positive transition triggers a message.; cmdName — a string or symbol, as a message name.; values — array of ugens, or valid ugen inputs.; replyID — integer id (similar to SendTrig).."}]} -{"conversations": [{"role": "user", "content": "What does `LFClipNoise.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Clipped noise Arguments: freq — Approximate rate at which to generate random values.; mul — Output will be multiplied by this value.; add — This value will be added to the output.."}]} +{"conversations": [{"role": "user", "content": "What does `UnicodeResponder.report` do?"}, {"role": "assistant", "content": "register responder functions for unicode and modifier combinations"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `NRand`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-NRand\", { |out = 0, n = 0|\n Out.ar(out,\n FSinOsc.ar(\n NRand(1200.0, 4000.0, n),\n 0, Line.kr(0.2, 0, 0.01, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n(\nn = 0;\nRoutine({\n inf.do({ |i|\n Synth.new(\"help-NRand\", [\\n, n]); 0.05.wait;\n })\n}).play;\n);\n\nn = 1;\nn = 2;\nn = 4;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `EnvGen` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// as amplitude envelope\n(\n{\n var env = Env([0, 1, 0.5, 1, 0], [0.01, 0.5, 0.02, 0.5]);\n SinOsc.ar(470) * EnvGen.kr(env, doneAction: Done.freeSelf)\n}.play\n);\n\n// as amplitude and modulation envelope\n(\n{\n var env = Env([0, 1, 0.5, 0.8, 0, 1.2, 0], [0.01, 0.5, 0.02, 0.5, 0.2, 0.5]);\n var gate = Impulse.kr(MouseX.kr(0.2, 3), 0.5);\n var gen = EnvGen.kr(env, gate);\n SinOsc.ar(270, SinOsc.ar(gen * 473)) * gen * 0.2\n}.play\n);\n// EnvGen multichannel expands when passed a multichannel envelope\n(\n{\n SinOsc.ar(\n EnvGen.kr(\n Env.circle([0, 1, 0, (2..4), 0, LFNoise1.kr(0.1 ! 5) * 10, 0], [0.01, 0.6])\n )\n * 240 + 300\n ).sum * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `LFClipNoise` in SuperCollider briefly."}, {"role": "assistant", "content": "LFClipNoise — Clipped noise Randomly generates the values -1 or +1 at a rate given by the nearest integer division of the sample rate by the `freq` argument. It is probably pretty hard on your speakers! Category: UGens > Generators > Stochastic."}]} +{"conversations": [{"role": "user", "content": "What is `PClip` in SuperCollider?"}, {"role": "assistant", "content": "PClip — UGenPatterns quark library Based on Clip Category: Streams-Patterns-Events > UGenPatterns > Modifiers."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `BufCombN` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// These examples compare the variants, so that you can hear the difference in interpolation\n\n// allocate buffer\nb = Buffer.alloc(s, 44100, 1);\n\n// Comb used as a resonator. The resonant fundamental is equal to\n// reciprocal of the delay time.\n{ BufCombN.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ BufCombL.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ BufCombC.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// with negative feedback:\n{ BufCombN.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ BufCombL.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ BufCombC.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n// used as an echo.\n{ BufCombC.ar(b.bufnum, Decay.ar(Dust.ar(1, 0.5), 0.2, WhiteNoise.ar), 0.2, 3) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for get different result each time running the pattern: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\nTempoClock.default.tempo = 156/60;\n\n(\nSynthDef(\\spring, { |freq = 400, out = 0, pan = 0, gate = 1, dur = 0.15, curve = -4, amp = 1, index = 1|\n var sig = FreeVerb.ar(Pan2.ar(Blip.ar(freq, index), pan));\n var env = EnvGen.ar(Env.perc(0.01, dur, amp, curve), gate, doneAction:2);\n Out.ar(0, sig * env);\n}).add;\n);\n\n(\nPbind(*[\n instrument: \\spring,\n dur: Pseq([4, 1, 2, 1, 1, 1].scramble/ 4 / TempoClock.default.tempo, inf),\n degree: Pseq(#[1,2,3,4], inf) * Pkey(\\dur).reciprocal,\n octave: Pseq([2,3,4,4,4,3].scramble, inf),\n pan: Pxrand(Array.fill(100, { 0.gaussian(1).clip2(1) }), inf),\n amp: Pseq(#[0.95,1,0.8],inf),\n index: Pstutter(Pseq(#[4,8,12],inf), Pseq([2,3,4,5,6,8].scramble, inf))\n]).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// nothing especially implemented\n\n(\nx = {\n var trig = Impulse.ar(7);\n var in = [0, 8.5];\n var maxLookBack = [1, 3];\n var loDev = [-1, -5];\n var hiDev = [1, 5];\n var midi = { |i| Demand.ar(trig, 0,\n DIdev(\n in[i] + SinOsc.ar(0.1, -pi/2).range(65, 85).round,\n maxLookBack: maxLookBack[i],\n loDev: loDev[i],\n hiDev: hiDev[i]\n ).dpoll(label: \"midi_\" ++ (i == 0).if { \"lo\" }{ \"hi\"})\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// nothing especially implemented\n\n(\nx = {\n var trig = Impulse.ar(7);\n var in = [0, 8.5];\n var maxLookBack = [1, 3];\n var loDev = [-1, -5];\n var hiDev = [1, 5];\n var midi = { |i| Demand.ar(trig, 0,\n DIdev(\n in[i] + SinOsc.ar(0.1, -pi/2).range(65, 85).round,\n maxLookBack: maxLookBack[i],\n loDev: loDev[i],\n hiDev: hiDev[i]\n ).dpoll(label: \"midi_\" ++ (i == 0).if { \"lo\" }{ \"hi\"})\n ) } ! 2;\n SinOsc.ar(midi.lag(0.007).midicps, 0, 0.1)\n}.play;\n);\n\nx.release\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `InFeedback`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-InFeedback\", { |out = 0, in = 0|\n Out.ar(out,\n InFeedback.ar(in, 1)\n );\n}).add;\nSynthDef(\"help-SinOsc\", { |out = 0, freq = 440|\n Out.ar(out, SinOsc.ar(freq, 0, 0.1))\n}).add;\n);\n\nx = Bus.audio(s, 1);\n\n// read from bus n play to bus 0 (silent)\na = Synth(\"help-InFeedback\", [\\in, x.index, \\out, 0]);\n\n// now play a synth after this one, playing to bus x\nb = Synth.after(a, \"help-SinOsc\", [\\out, x.index]);\n\n// add another synth before a which also writes to bus x\n// now you can't hear b, as its data is one cycle old, and is overwritten by c\nc = Synth.before(a, \"help-SinOsc\", [\\out, x.index, \\freq, 800]);\n\n// free c and you can hear b again\nc.free;\nx.free;\n\na.free; b.free;\n```"}]} +{"conversations": [{"role": "user", "content": "How do I record my output to a file?"}, {"role": "assistant", "content": "`s.record(path)` starts recording the server's output; `s.stopRecording` stops it.\n\n```supercollider\ns.record(\"C:/audio/take1.wav\");\n// play for a while\ns.stopRecording;\n```\n\nThe path must be writable and the format follows the extension (.wav, .aiff, .flac). The file is written\nby the server, so it captures exactly what the master bus produces — including your effects, which is what\nyou want. `s.record` also accepts `duration:` to stop by itself, which is the reproducible form for a take."}]} +{"conversations": [{"role": "user", "content": "What does `NodeProxy.group` do?"}, {"role": "assistant", "content": "The node proxy's group (a Group). This is maintained by the proxy and serves as a context in which all synths are"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `IEnvGen`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var env = Env([0, 0.6, 0.3, 1.0, 0], [0.1, 0.02, 0.4, 1.1], [\\lin, \\exp, -6, \\sin]);\n var envgen = IEnvGen.kr(env, MouseX.kr(0, env.times.sum));\n env.plot;\n SinOsc.ar(envgen * 500 + 440)\n}.play;\n);\n\n// index with an SinOsc ... mouse controls amplitude of SinOsc\n// use offset so negative values of SinOsc will map into the Env\n(\n{\n var sin = SinOsc.ar(440, 0, MouseX.kr(0, 1));\n // use offset so negative values of SinOsc will map into the Env\n var env = Env([-1, -0.7, 0.7, 1], [0.8666, 0.2666, 0.8668], \\lin, offset: -1.0);\n IEnvGen.ar(env, sin) * 0.1\n}.play;\n);\n\n// index with Amplitude of input, control freq of SinOsc (uses SoundIn)\n(\n{\n var point = Amplitude.ar(SoundIn.ar(0), 0.01, 0.2);\n // use offset so negative values of SinOsc will map into the Env\n var env = Env.xyc([[0, 330, \\exp], [0.5, 440, \\exp], [1.0, 1760]]);\n SinOsc.ar(IEnvGen.kr(env, point)) * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Scheduler`?"}, {"role": "assistant", "content": "Scheduler — schedules functions to be evaluated in the future"}, {"role": "user", "content": "What does `Scheduler.play` do?"}, {"role": "assistant", "content": "Schedules the task immediately. Equivalent to `sched(0, task)`."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na = Scheduler(SystemClock);\n\na.sched(3, { \"now it is 3 seconds.\".postln; nil });\na.sched(5, { \"now it is 5 seconds.\".postln; nil });\na.sched(1, { \"now it is 1 second.\".postln; nil });\n\na.advance(0.5);\na.advance(0.5);\na.advance(2);\na.advance(2);\n\n// the beats, seconds and clock are passed into the task function:\na.sched(1, { |beats, secs, clock| [beats, secs, clock].postln });\na.advance(1);\n\n// the scheduling is relative to \"now\":\na.sched(3, { \"now it was 3 seconds.\".postln });\na.sched(5, { \"now it was 5 seconds.\".postln });\na.sched(1, { \"now it was 1 second.\".postln });\n\na.advance(0.5);\na.advance(0.5);\na.advance(2);\na.advance(2);\n\n// play a Routine or a task:\na.play(Routine { 5.do { |i| i.postln; 1.yield } });\na.advance(0.9);\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// fadeTimes should be above blockSize\n// for shorter grains you can use smaller blocksizes\n\n(\ns.options.blockSize = 2;\ns.reboot;\n);\n\n// as the effect is AM on single outs we get side bands\n\n(\ns.doWhenBooted {\n x = {\n var lfo = LFDNoise3.ar(0.2);\n DXFan.ar(\n Dseq((0..7), inf),\n SinOsc.ar(lfo.range(800, 1500), 0, 0.03),\n size: 8,\n fadeTime: 0.0002\n )\n }.play\n};\n);\n\nx.release\n\n\n// go back to default\n\n(\ns.options.blockSize = 64;\ns.reboot;\n)\n```"}, {"role": "assistant", "content": "fadeTimes should be above blockSize for shorter grains you can use smaller blocksizes (DXFan: crossfades signals within a multichannel array according to demand-rate control)"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pulse`."}, {"role": "assistant", "content": "```supercollider\n// modulate frequency\n{ Pulse.ar(XLine.kr(40, 4000, 6), 0.1, 0.2) }.play;\n\n// modulate pulse width\n{ Pulse.ar(200, SinOsc.kr(0.2).range(0.01, 0.99), 0.2) }.play;\n\n// two band limited square waves thru a resonant low pass filter\n{ RLPF.ar(Pulse.ar([100, 250], 0.5, 0.1), XLine.kr(8000, 400, 5), 0.05) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LFPulse`."}, {"role": "assistant", "content": "```supercollider\n{ LFPulse.ar(50) * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "How should I check an answer you give me?"}, {"role": "assistant", "content": "Three quick checks, cheapest first. Does it evaluate without a syntax error — the post window points at the exact character. Does the node appear in `s.plotTree` — if yes, the problem is signal rather than lifecycle. Does it reach `Out.ar(0, ...)` with a non-zero amplitude and an open filter. If those three pass and it is still silent, the class's own help page will show the argument order you may have assumed wrong."}]} +{"conversations": [{"role": "user", "content": "What does `Gradient.at` do? What arguments does it take?"}, {"role": "assistant", "content": "Retrieve the colour at position `pos`, typically a value between zero and one. `at(0)` is `color1`, and `at(1)` is Arguments: pos."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `QuadC`."}, {"role": "assistant", "content": "```supercollider\n// logistic map\n// equation: x1 = -r*x0^2 + r*x0\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n QuadC.ar(SampleRate.ir/4, r.neg, r, 0, 0.1) * 0.4;\n}.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\FuMaIn;\n~description = \"A live ambisonic input (ACN_FuMa)\";\n~channelLayout = \\ambi;\n\n~function = { |order = 1, t_trig = 0, bus = 0|\n var env = EnvGen.kr(Env([0,1], [1]), t_trig);\n var chans = Array.series(\n size: (order + 1).pow(2).asInteger,\n start: bus,\n step: 1\n );\n var input = SoundIn.ar(chans, env);\n HOAConverterFuma2AcnN3d.ar(order, input);\n}\n```"}, {"role": "assistant", "content": "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see ."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ SinOsc.ar(500 + LFPulse.ar(4).bipolar(40), 0, 0.5 * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ SinOsc.ar(500 + LFPulse.ar(4).bipolar(40), 0, 0.5) * 0.1 }.play;\n```"}]} {"conversations": [{"role": "user", "content": "How do I set the tempo?"}, {"role": "assistant", "content": "TempoClock.default.tempo = 120/60; the argument is beats per second, so 120 BPM is 2.0. Patterns scheduled on the default clock then follow it."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// load a synthdef\ns.boot;\nSynthDef(\"pdef_grainlet\",\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.3), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n\nTdef(\\z, Pseq([1, 1, 1, 0.5, 0.5], inf));\n\n(\nPset(\\instrument, \\pdef_grainlet,\n Ppar([\n Pbind(\n \\dur, Tdef(\\z),\n \\note, Pseq([1, 3, 2, 1, 0], inf),\n \\x, Pfunc\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// load a synthdef\ns.boot;\nSynthDef(\"pdef_grainlet\",\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.3), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n\nTdef(\\z, Pseq([1, 1, 1, 0.5, 0.5], inf));\n\n(\nPset(\\instrument, \\pdef_grainlet,\n Ppar([\n Pbind(\n \\dur, Tdef(\\z),\n \\note, Pseq([1, 3, 2, 1, 0], inf),\n \\x, Pfunc { TempoClock.default.elapsedBeats.postln } // posts the onset times\n ),\n Pbind(\n \\dur, 4, // reference beat\n \\sustain, 0.1,\n \\note, 8\n )\n ])\n).play(quant: 1);\n);\n\n\nTdef(\\z, Prand([1, 1, 0.23, 0.5, 0.5], inf)); // exchange time pattern\nTdef(\\z, Pseq([1, 1, 1, 1], inf)); // pattern stays in sync.\nTdef(\\z, Pseq([1, 1, 1, 0.5, 0.5], inf)); // but might be in different order.\n // to avoid this, set quant to an appropriate value.\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SoundFileView.set` do? What arguments does it take?"}, {"role": "assistant", "content": "Overwrites a range of display data with another data. This method can be used after #-alloc or #-setData has been called, but not while the view is displaying a sound Arguments: offset — The frame at which to start overwriting; an Integer.; data — The new data; an Array of Floats; multiple channel data should be interleaved.."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for radio static with tuning noise (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"radiostatic\", {arg out=0;\n var hum, sineSweep, tuning, dustNoise, staticNoise, humFreq, numHarms;\n \n numHarms = 7;\n humFreq = 100;\n hum = Array.fill(numHarms, {|i| SinOsc.ar( (i+1) * humFreq, 0, 1/numHarms)});\n hum = hum.sum;\n dustNoise = Dust.ar(LFNoise1.ar(0.5).range(1000,8000));\n staticNoise = hum * dustNoise * LFNoise1.ar(1).range(0.5, 2);\n \n sineSweep = SinOsc.ar(LFNoise2.ar(1).range(20, 11000));\n tuning = SinOsc.ar(10000).ring4(sineSweep) * LFNoise2.ar(1.1).range(0.05, 0.1);\n\n Out.ar(out, Pan2.ar(staticNoise + tuning, 0));\n}).add;\n);\n \na = Synth(\"radiostatic\");\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `BBCutQuantise1` in SuperCollider briefly."}, {"role": "assistant", "content": "BBCutQuantise1 — Adds a swing rhythm in BBCut2 BBCutQuantise1 is experimental. Category: Libraries > BBCut > Cut procedures."}]} -{"conversations": [{"role": "user", "content": "What does `PV_CommonMag.new` do? What arguments does it take?"}, {"role": "assistant", "content": "returns common magnitudes Arguments: bufferA — fft buffer A.; bufferB — fft buffer B.; tolerance — magnitudes within which test will pass; remove — scale uncommon magnitudes."}]} -{"conversations": [{"role": "user", "content": "What does `AbstractFunction.rrand` do?"}, {"role": "assistant", "content": "`a = { |x| sin(x) } rrand: { |x| sin(x) * -1"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Supercollider to Renoise."}, {"role": "assistant", "content": "```supercollider\n// declare an event type which sends OSC commands to Renoise\n\n(\nEvent.addEventType(\\renoise, { |server|\n var renoiseOscServer = NetAddr(\"127.0.0.1\", 8000);\n var notes = [~midinote.value, ~ctranspose.value, ~velocity.value, ~sustain.value, ~lag.value, ~timingOffset.value, ~instr.value, ~track.value].flop;\n var timeNoteOn, timeNoteOff, instrument, track, velocity;\n var serverLatency;\n\n serverLatency = server.latency ? 0;\n\n notes.do {|note|\n instrument = note[6] ? -1;\n track = note[7] ? -1;\n velocity = note[2].asInt.clip(0,127);\n\n // sustain and timingOffset are in beats, lag is in seconds\n timeNoteOn = (thisThread.clock.tempo.reciprocal*note[5])+note[4]+server.latency;\n timeNoteOff = (thisThread.clock.tempo.reciprocal*(note[3]+note[5]))+note[4]+server.latency;\n SystemClock.sched(timeNoteOn, {renoiseOscServer.sendMsg(\"/renoise/trigger/note_on\", instrument.asInt, track.asInt, (note[0]+note[1]).asInt, velocity )});\n SystemClock.sched(timeNoteOff, {renoiseOscServer.sendMsg(\"/renoise/trigger/note_off\", instrument.asInt, track.asInt, (note[0]+note[1]).asInt)});\n }\n});\n);\n\n// Now start Renoise OSC server, load a sample, and try some patterns\n\n// straight timing\n(\nPbind(*[\n type: \\renoise,\n legato: Pgauss(0.2,0.05,inf),\n dur: 0.2,\n degree: [2,5,12],\n track: Prand([0,1], inf),\n ctranspose: Pseq([0,0,0,0,4,4,4,4,5,5,5,5],inf),\n velocity: Pgauss(64,10,inf),\n]).play;\n);\n\n// loose timing\n(\nPbind(*[\n type: \\renoise,\n legato: 0.1,\n dur: 0.2,\n midinote: [66, 69, 74],\n lag: Pwhite(-0.05!3, 0.05)\n]).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Midterm Q2 (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"sawSynth\",{arg freq, amp;\n var env, snd;\n\n env = Env.perc(\n attackTime:0.1,\n releaseTime:2,\n level:amp).kr(doneAction: 2);\n snd = Saw.ar(\n freq:freq*[0.99, 1.0, 1.001, 1.008],\n mul: env);\n snd = LPF.ar(in: snd,freq:2000);\n snd = Splay.ar(snd);\n Out.ar(0,snd);\n\n}).add;\n);\n\n(\nPbind(\n \\instrument, \"sawSynth\",\n \\freq, Pwhite(300, 700, inf),\n \\amp, Pwhite(0.15, 0.2)\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `AbstractPlayerProxy.defName` do?"}, {"role": "assistant", "content": "base class for players that act as proxies for another player"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes blipecho context."}, {"role": "assistant", "content": "```supercollider\n( \nSynthDef(\\klang_blip, { \n | out = 0, release = 1, freq1 = 1, freq2 = 5, freq3 = 8, freq_mul = 4, atk_dur = 0.01, amp = #[0.3,0.3,0.3], mod_freq = 25 | \n var sig = DynKlang.ar(\n `[([freq1, freq2, freq3].linexp(1,12,1,1140) * freq_mul), amp, nil ], \n EnvGen.kr(Env([5,1.05,0.95,0.01],[0.025,release*3/4,release/4])), \n 150\n ) * LFGauss.kr(mod_freq.reciprocal, 0.3);\n Out.ar(out, (sig/8)!2 * Linen.kr(Impulse.kr(0), atk_dur, 1, release, doneAction:2)) \n}).add;\n\nSynthDef(\\dubecho,{|in, out, length = 1, fb = 0.8, sep = 0.012|\n var input = In.ar(in, 2);\n var feedback = LocalIn.ar(2);\n var output = LeakDC.ar(feedback*fb + input);\n output = HPF.ar(output, 400);\n output = LPF.ar(output, 12000);\n output = output.tanh;\n LocalOut.ar(DelayC.ar(output, 1, LFNoise2.ar(12).range([length,length+sep],[length+sep,length])).reverse);\n ReplaceOut.ar(out, output);\n}).add;\n);\n\n( \n~bus = Bus.audio(s, 2);\n~echo = Synth(\\dubecho, [\\in, ~bus, \\length, TempoClock.default.tempo*(3/8), \\fb, 0.25, \\sep, 0.0012], addAction: \\addToTail);\n\nPbind(*[ \n instrument: \\klang_blip, \n dur: Pwrand([0.25,0.5,1,0.125], [16,16,1,1].normalizeSum, inf), \n release: Pkey(\\dur),\n freq_mul: Pstutter(Pwrand([1,2,4],[5,3,2].normalizeSum,inf), Pxrand((1..6), inf)),\n freq1: Pstutter(Pxrand((2,4..16), inf), Prand((1..4), inf)), \n freq2: Pstutter(Pxrand((2,4..16), inf), Prand((4..8), inf)), \n freq3: Pstutter(Pxrand((2,4..16), inf), Prand((8..12), inf)),\n mod_freq: Pstutter(Pxrand((2,4..16), inf), Pbrown(7,30,3)),\n atk_dur: Pkey(\\freq_mul).linlin(12,2,0.01,0.4),\n out: ~bus,\n amp: Pstutter(Pxrand((2,4..16),inf), Pfunc({[2,3,4].normalizeSum.scramble}))\n]).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `BelaScope`?"}, {"role": "assistant", "content": "BelaScope — Bela's Oscilloscope interface"}, {"role": "user", "content": "What does `BelaScope.scope` do?"}, {"role": "assistant", "content": "Send an array of UGen data to Bela's oscilloscope."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n{ BelaScope.scope(0, SinOsc.ar) }.play;\n// same using UGen\n```"}]} -{"conversations": [{"role": "user", "content": "What does `BStore.remove` do? What arguments does it take?"}, {"role": "assistant", "content": "Removes BStore Arguments: type setting.; settings.; format.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nPn((dur: 2, freq: 8000).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nPn((dur: 2, freq: 8000)).play;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `PV_MagMul` in SuperCollider briefly."}, {"role": "assistant", "content": "PV_MagMul — Multiply magnitudes. Multiplies magnitudes of two inputs and keeps the phases of the first input. Category: UGens > FFT."}]} -{"conversations": [{"role": "user", "content": "Explain `Ptuple` in SuperCollider briefly."}, {"role": "assistant", "content": "Ptuple — combine a list of streams to a stream of lists At each iteration, Ptuple returns a tuple (array) combining the output of each of the patterns in the list. When any of the patterns returns a nil, Ptuple ends that 'repeat' and restarts all of the streams. Category: Streams-Patterns-Events > Patterns > List."}]} -{"conversations": [{"role": "user", "content": "Explain `PageLayout` in SuperCollider briefly."}, {"role": "assistant", "content": "PageLayout — a Window with a FlowView on it for use in ObjectGui's MVC model This class encapsulates the common task of creating a Window, adding a FlowView (CompositeView with a FlowLayout on it). It also supports the MVC model by registering controllers that are then removed (sent the .remove message) when the Window closes. Additionally it can resize itself to fit the contents. Category: GUI."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n \n// definition for future reference in arbitrary Environments\n\np = PLlprand(\\lo, \\hi);\n\n\n// prepare current Environment\n// PLseq repeats arg defaults to inf\n\n(\n~lo = 60;\n~hi = PLseq((92..62));\n);\n\n\n// run\n\n(\nx = Pbind(\n \\midinote, Ptuple(p!5), \n \\dur, 0.1,\n \\amp, 0.05\n).play;\n);\n\n\n// replace, converging bounds\n\n(\n~lo = PLseq((40..70) ++ (70!5));\n~hi = 70.5;\n);\n\nx.stop;\n```"}, {"role": "assistant", "content": "definition for future reference in arbitrary Environments prepare current Environment (PLlprand: dynamic scope Plprand variant)"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pan2`."}, {"role": "assistant", "content": "```supercollider\n// hear the difference, LinPan having a slight drop in the middle...\n{ LinPan2.ar(SinOsc.ar(440), Line.kr(-1, 1, 5)) }.play\n\n// ... whereas Pan2 is more smooth\n{ Pan2.ar(SinOsc.ar(440), Line.kr(-1, 1, 5)) }.play\n\n// other examples\n{ Pan2.ar(PinkNoise.ar(0.4), FSinOsc.kr(2), 0.3) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\\test, {\n var a, b;\n RandID.kr(0, 1);\n RandSeed.ir(1, 88372);\n a = LFDNoise0.ar(440);\n RandID.kr(1, 1);\n RandSeed.ir(1, 88372);\n b = LFDNoise0.ar(440);\n Out.ar(1000, [a, b, a - b])\n}).dumpUGens\n);\n\n// correct order! annotated:\n\n// one RNG chain, id = 0\n[0_RandID, control, [0, 1]]\n[1_RandSeed, scalar, [1, 88372]]\n[2_LFDNoise0, audio, [440]]\n\n// another RNG chain, id = 1\n[3_\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\\test, {\n var a, b;\n RandID.kr(0, 1);\n RandSeed.ir(1, 88372);\n a = LFDNoise0.ar(440);\n RandID.kr(1, 1);\n RandSeed.ir(1, 88372);\n b = LFDNoise0.ar(440);\n Out.ar(1000, [a, b, a - b])\n}).dumpUGens\n);\n\n// correct order! annotated:\n\n// one RNG chain, id = 0\n[0_RandID, control, [0, 1]]\n[1_RandSeed, scalar, [1, 88372]]\n[2_LFDNoise0, audio, [440]]\n\n// another RNG chain, id = 1\n[3_RandID, control, [1, 1]]\n[4_RandSeed, scalar, [1, 88372]]\n[5_LFDNoise0, audio, [440]]\n\n[6_-, audio, [2_LFDNoise0, 5_LFDNoise0]]\n[7_Out, audio, [1000, 2_LFDNoise0, 5_LFDNoise0, 6_-]]\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Canvas3D.mRotateY` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a matrix for rotating around Y Arguments: ay — Y rotation."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n~a={SinOsc.ar([22.5, 23], mul: ChaosGen.allSubclasses.choose.ar(rrand(1, 30))* 0.3)};\n~b={SinOsc.ar([22.5, 23], mul: 0.3)};\n~c={SinOsc.ar([22.5, 23]*400, mul: ChaosGen.allSubclasses.choose.ar(rrand(1, 30))* 0.03)};\n~d={SinOsc.ar([22.5, 23]*400, mul: 0.03)};\nOut.ar(0, ~a+~b+~c+~d);\n}.scope\n)\n```"}, {"role": "assistant", "content": "some basic synth shamanic stuff for rising vibrational frequency (a SuperCollider snippet)."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pproto`."}, {"role": "assistant", "content": "```supercollider\nPbind(\\freq, 700, \\amp, 0.1)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `AbstractFunction.cubed` do?"}, {"role": "assistant", "content": "`a = { |x| x + 1 }; b = a.cubed; [a.value(1),"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\delay;\n~description = \"Simple delay line\";\n~channelLayout = \\mono;\n~function = {|in = 0, del = 0.5|\n DelayC.ar(in, 2, del);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "What does `Complex.abs` do?"}, {"role": "assistant", "content": "the absolute value of a complex number is its"}]} -{"conversations": [{"role": "user", "content": "What does `UChain.setGain` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: gain — (describe argument here). Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "What does `FoaEncoderKernel.set` do?"}, {"role": "assistant", "content": "Describes both the signal set and the tool set, encompassing the Ambisonic order, as well as channel ordering and normalisation. Answers `'FOA'`, aka traditional"}]} -{"conversations": [{"role": "user", "content": "Explain `BlitB3` in SuperCollider briefly."}, {"role": "assistant", "content": "BlitB3 — Band limited impulse generation Band limited impulse generator based on B-Spline interpolation of order 3. For technical details of this and the other BlitB3 UGens see: Juhan Nam, Vesa Valimaki, Jonathan S. Abel, and Julius O. Smith Efficient Antialiasing Oscillator Algorithms Using Low-Order Fractional Delay Filters IEEE Transactions on Audio, Speech, and Language Processing 18(4) May 2010, pp 773--785 Category: UGens > Generators > Deterministic."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for tired pads."}, {"role": "assistant", "content": "```supercollider\n// this is what I write when I didn't sleep last night.. zzzzzz\n// easy subsynth with dynklank and simple scale\n\n(\n\nfork{ \n loop{\n var time;\n time = 5.rand;\n {\n var sound, freqs, envs, rings, numvoices, env;\n numvoices = 40;\n freqs = {(Scale.major(\\just).degrees+26+\n (0,12..110).choose).choose}.dup(numvoices).midicps;\n rings = {1.0.rand}.dup(numvoices);\n envs = { EnvGen.kr(Env.linen( time/3.0.rand, \n time/3.0.rand, time/3.0.rand, 1.0.rand ) ) }.dup(numvoices);\n \n sound = PinkNoise.ar(numvoices.reciprocal!2);\n sound = DynKlank.ar(`[freqs,envs,rings], sound );\n sound = sound * EnvGen.kr(Env.linen(time.rand,time/3,time.rand),doneAction:2);\n \n sound = HPF.ar(sound, 120);\n \n 4.do{sound = DelayC.ar(sound, 0.4, [0.4.rand,0.4.rand], 1/8, sound) };\n \n //good call - lets turn this down \n sound*0.2;\n }.play;\n time.rand.wait;\n }\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Cyton.defaultSampleRate` do?"}, {"role": "assistant", "content": "An Integer that is different for each board. For Cyton boards it is 250"}]} -{"conversations": [{"role": "user", "content": "What does `RedMixer.gui` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a Arguments: position — A Point.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// increase feedback\n{ FBSineN.ar(SampleRate.ir, 1, Line.kr(0.01, 4, 10), 1, 0.1) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// increase feedback\n{ FBSineN.ar(SampleRate.ir, 1, Line.kr(0.01, 4, 10), 1, 0.1) * 0.2 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `FunctionDef.prototypeFrame` do?"}, {"role": "assistant", "content": "Get the array of default values for argument and temporary variables. `{ |a = 9, b = 10, c| a + b"}]} -{"conversations": [{"role": "user", "content": "Explain `SpecFile` in SuperCollider briefly."}, {"role": "assistant", "content": "SpecFile — Write specs into File A tool for reading and writing spec files. Category: Libraries > Radicles."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Migration from the old SourceForge wiki."}, {"role": "assistant", "content": "```supercollider\n// Sing whatever pitch you like into the microphone, but have the output conform to the key you press on your connected MIDI keyboard, like a very low-rent Autotune.\n// by nonprivate April 2009\n// best used with headphones\n// execute one by one...\n\ns = Server.local.boot;\nb = 200; // no. of control bus to use for pitch control\n(\n SynthDef(\"straightenUp\",\n { |baseFreq = 100|\n \n var in, freq, hasFreq, out;\n in = Mix.new(SoundIn.ar([0,1]));\n # freq, hasFreq = Pitch.kr(in, ampThreshold: 0.02, median: 7);\n out = PitchShift.ar(in, 0.08, (baseFreq / freq), 0.0, 0.0);\n Out.ar(0,[out, out])\n }\n ).send(s);\n);\n\ns.sendMsg(\"/s_new\", \"straightenUp\", n = s.nextNodeID, 1, 0);\n\ns.sendMsg(\"/n_map\", n, \"baseFreq\", b);\n\n(\n c = NoteOnResponder(\n { |src,chan,note,vel|\n \n s.sendMsg(\"/c_set\", b, note.midicps);\n \n },\n nil, // any source\n nil, // any channel\n nil, // any note\n nil // any vel\n );\n \n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `SGUIelement` in SuperCollider briefly."}, {"role": "assistant", "content": "SGUIelement — a value with one or more views This is a value with one or more views attached. Category: SInstruments."}]} -{"conversations": [{"role": "user", "content": "What is `PauseSelfWhenDone` in SuperCollider?"}, {"role": "assistant", "content": "PauseSelfWhenDone — FIXME: PauseSelfWhenDone purpose. FIXME: PauseSelfWhenDone description. Category: UGens > Synth control, UGens > Undocumented."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SortedList`."}, {"role": "assistant", "content": "```supercollider\nt = SortedList.new(8, {|a,b| a.first < b.first });\nt.add([10, \"last\"]);\nt.add([1, \"first\"]);\nt.postln;\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Ball`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var f, sf, g;\n sf = LFNoise0.ar(MouseX.kr(1, 100, 1));\n g = MouseY.kr(0.1, 10, 1);\n f = Ball.ar(sf, g, 0.01, 0.01);\n f = f * 140 + 500;\n SinOsc.ar(f, 0, 0.2)\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// see the delta values in the resulting events\n(\nvar a, b, c, t;\na = Pbind(\\x, Pseq([1, 2, 3, 4]), \\dur, 1);\nb = Pbind(\\x, Pseq([10, 20, 30, 40]), \\dur, 0.4);\nc = Ppar([a, b]);\nt = c.asStream;\n20.do({ t.next(Event.default).postln });\n);\n\n// sound example\n(\nvar a, b;\na = Pbind(\\note, Pseq([7, 4, 0], 4), \\dur, Pseq([1, 0.5, 1.5], inf));\nb = Pbind(\\note, Pseq([5, 10, 12], 4), \\dur, 1);\nPpar([a, b]).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// see the delta values in the resulting events\n(\nvar a, b, c, t;\na = Pbind(\\x, Pseq([1, 2, 3, 4]), \\dur, 1);\nb = Pbind(\\x, Pseq([10, 20, 30, 40]), \\dur, 0.4);\nc = Ppar([a, b]);\nt = c.asStream;\n20.do({ t.next(Event.default).postln });\n);\n\n// sound example\n(\nvar a, b;\na = Pbind(\\note, Pseq([7, 4, 0], 4), \\dur, Pseq([1, 0.5, 1.5], inf));\nb = Pbind(\\note, Pseq([5, 10, 12], 4), \\dur, 1);\nPpar([a, b]).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `PulseDivider` in SuperCollider?"}, {"role": "assistant", "content": "PulseDivider — Pulse divider. Outputs one impulse each time it receives a certain number of triggers at its input. Category: UGens > Triggers."}]} -{"conversations": [{"role": "user", "content": "What does `Interval.new` do?"}, {"role": "assistant", "content": "Create a new Interval. `Interval(10, 30,"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = {LFTri.ar(100+(1000*Maths2.ar(MouseX.kr, MouseY.kr, SinOsc.ar(0.2, 0).range(0,1), 1-MouseButton.kr(lag:0.001))[0]), 0, 0.1}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = {LFTri.ar(100+(1000*Maths2.ar(MouseX.kr, MouseY.kr, SinOsc.ar(0.2, 0).range(0,1), 1-MouseButton.kr(lag:0.001))[0]), 0, 0.1)}.play\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Mx.clearPending` do?"}, {"role": "assistant", "content": "very private clears any state changes requested through .add and"}]} -{"conversations": [{"role": "user", "content": "Explain `ScopeView` in SuperCollider briefly."}, {"role": "assistant", "content": "ScopeView — A buffer plotting view. ScopeView is mainly intended to support the implementation of Stethoscope (an oscilloscope), FreqScopeView (a basic frequency spectrum plotting view) and FreqScope (a frequency spectrum analyzer tool). Category: GUI > Views."}]} -{"conversations": [{"role": "user", "content": "Who are you?"}, {"role": "assistant", "content": "I am sc-mind, a 198M MiniMind-3-MoE trained from scratch on the SuperCollider source and help corpus. I write and explain SuperCollider: SynthDefs, UGens, Patterns, Ndef, the language/server split, and how to make sound that is not silence."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Function`."}, {"role": "assistant", "content": "```supercollider\n(\nEnvironment.use({\n~a = 3;\n~b = 10;\n{ |a, b| (a * b).postln }.valueEnvir;\n});\n);\n\n// or syntactically shorter using an Event:\n\n(a:3, b:10).use { { |a, b| (a * b).postln }.valueEnvir };\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\\help_Env_newClear, { |out = 0|\n var env, envctl;\n // make an empty 4 segment envelope\n env = Env.newClear(4);\n // create a control argument array\n envctl = \\env.kr(env.asArray);\n Out.ar(out,\n SinOsc.ar(EnvGen.kr(envctl, \\gate.tr), 0, 0.3) // the gate control is a trigger\n );\n}).add;\n);\n\nSynth(\\help_Env_newClear, [\\gate, 1, \\env, Env([700, 900, 900, 800], [1, 1, 1], \\exp)]); // 3 segments\n\n// reset then play again:\nSynth(\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\\help_Env_newClear, { |out = 0|\n var env, envctl;\n // make an empty 4 segment envelope\n env = Env.newClear(4);\n // create a control argument array\n envctl = \\env.kr(env.asArray);\n Out.ar(out,\n SinOsc.ar(EnvGen.kr(envctl, \\gate.tr), 0, 0.3) // the gate control is a trigger\n );\n}).add;\n);\n\nSynth(\\help_Env_newClear, [\\gate, 1, \\env, Env([700, 900, 900, 800], [1, 1, 1], \\exp)]); // 3 segments\n\n// reset then play again:\nSynth(\\help_Env_newClear, [\\gate, 1, \\env, Env({ rrand(60, 70).midicps } ! 4, [1, 1, 1], \\exp)]);\n\n// the same written as an event:\n(instrument: \\help_Env_newClear, gate: 1, env: Env({ rrand(60, 70).midicps } ! 4, [1, 1, 1], \\exp)).play;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nNdef(\\sound, {\n RHPF.ar(\n \\in1.ar([0, 0]) * \\in2.ar([0, 0]),\n \\freq.kr(6000, 2),\n \\rq.kr(0.2)\n ) * 7\n}).play;\nNdef(\\sound).fadeTime = 0.2; // avoid harsh clicks\n);\n\nNdef(\\a, { SinOsc.ar(MouseX.kr(300, 1000, 1) * [1, 1.2], \\phase.ar([0, 0]) * 0.2) });\nNdef(\\b, { LFDNoise3.ar(MouseY.kr(3, 1000, 1) * [1, 1.2]) });\nNdef(\\c, { LFTri.ar(MouseY.kr(3, 10, 1) * [1, 1.\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nNdef(\\sound, {\n RHPF.ar(\n \\in1.ar([0, 0]) * \\in2.ar([0, 0]),\n \\freq.kr(6000, 2),\n \\rq.kr(0.2)\n ) * 7\n}).play;\nNdef(\\sound).fadeTime = 0.2; // avoid harsh clicks\n);\n\nNdef(\\a, { SinOsc.ar(MouseX.kr(300, 1000, 1) * [1, 1.2], \\phase.ar([0, 0]) * 0.2) });\nNdef(\\b, { LFDNoise3.ar(MouseY.kr(3, 1000, 1) * [1, 1.2]) });\nNdef(\\c, { LFTri.ar(MouseY.kr(3, 10, 1) * [1, 1.2]).max(0) });\nNdef(\\a).fadeTime = 0.2; // avoid harsh clicks again\n\nNdef(\\sound) <<>.in1 Ndef(\\a);\nNdef(\\sound) <<>.in2 Ndef(\\b);\nNdef(\\sound) <<>.in2 Ndef(\\c);\nNdef(\\a) <<>.phase Ndef(\\sound);\nNdef(\\a) <<>.phase nil; // unmap\nNdef.clear(3); // fade out and clear all Ndefs\n```"}]} -{"conversations": [{"role": "user", "content": "What does `UScore.openWFS` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: path — (describe argument here); action — (describe argument here). Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "I get 'index out of range' when playing a buffer."}, {"role": "assistant", "content": "A read position is past the end of the buffer. `PlayBuf` with a `startPos` in frames beyond `~buf.numFrames`, or a `BufRd`/`GrainBuf` whose phase goes above 1, produces this. For GrainBuf, pos is normalised 0..1, so pass `LFNoise1.kr(1).range(0, 1)` rather than a frame count; for PlayBuf, cap the position at `~buf.numFrames - 1`. If you just loaded the file, check `~buf.numFrames` — a failed read gives 0 frames and every position is out of range."}]} -{"conversations": [{"role": "user", "content": "How do I distort a signal?"}, {"role": "assistant", "content": "Drive it into a nonlinearity, then tame the level: `tanh` is soft clipping, `.distort` is harder,\nand a low-pass after the drive keeps it from getting fizzy.\n\n```supercollider\n(\n{\n var sig = SinOsc.ar(110) * 0.3;\n var driven = (sig * 12).tanh;\n LPF.ar(driven, 5000) * 0.4\n}.play;\n)\n```\n\nMore drive means more harmonics; because they are generated, the output is louder as well as brighter, so\nscale the result down after the nonlinearity."}]} -{"conversations": [{"role": "user", "content": "What is `SynthDef`?"}, {"role": "assistant", "content": "SynthDef — Client-side representation of a synth definition"}, {"role": "user", "content": "What does `SynthDef.new` do?"}, {"role": "assistant", "content": "Create a SynthDef instance, evaluate the ugenGraphFunc and build the ugenGraph."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_notRand, { |out|\n Out.ar(out,\n SinOsc.ar(rrand(400, 800), 0, 0.2) * Line.kr(1, 0, 1, doneAction: Done.freeSelf)\n )\n}).add;\n);\na = Synth(\\help_notRand);\nb = Synth(\\help_notRand); // the same freq as a\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// example from ServerErrorGui in crucial lib\n\nf = OSCresponderNode(s.addr, '/fail', { |time, responder, msg|\n {\n var mins, secs;\n mins = (time/60).round(1);\n secs = (time%60).round(0.1);\n if(secs<10, { secs = \"0\"++secs.asString }, { secs = secs.asString });\n // put this on a gui\n // errors.label = \"% % (%:%)\".format(msg[1], msg[2], mins, secs);\n // errors.stringColor = Color.white;\n \"% % (%:%)\".format(msg[1], msg[2], mins, secs).postln;\n }.defer\n});\nf.add;\n// …\n```"}, {"role": "assistant", "content": "example from ServerErrorGui in crucial lib errors.label = \"% % (%:%)\".format(msg[1], msg[2], mins, secs); (OSCresponderNode: client side network responder)"}]} -{"conversations": [{"role": "user", "content": "Explain `ClipNoise` in SuperCollider briefly."}, {"role": "assistant", "content": "ClipNoise — Clip Noise. Generates noise whose values are either -1 or 1. This produces the maximum energy for the least peak to peak amplitude. Category: UGens > Generators > Stochastic."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes sine ocean."}, {"role": "assistant", "content": "```supercollider\n(\n//fundamental pitch triad\n~notes = [45,55,60].midicps;\n\ns.waitForBoot({\n Routine{\n\n SynthDef.new(\\tone, {\n arg freq=440, pan=0, rel=0.05;\n var sig;\n sig = SinOsc.ar(freq);\n sig = sig * EnvGen.kr(Env.perc(0.005,rel), doneAction:2);\n sig = Pan2.ar(sig, pan, 0.05);\n Out.ar(0, sig);\n }).add;\n\n s.sync;\n\n 50.do{\n Pbind(\n \\instrument, \\tone,\n\n //trace some event times just for fun\n \\dur, Pseq(Array.geom(50, rrand(1.5,1.51), rrand(0.923,0.929)).mirror,inf).trace,\n\n \\freq, exprand(~notes[0],8000).round(~notes[0]),\n \\pan, rrand(-1.0,1.0),\n \\rel, exprand(0.005,0.35),\n ).play;\n\n Pbind(\n \\instrument, \\tone,\n \\dur, Pseq(Array.geom(50, rrand(1.5,1.51), rrand(0.923,0.929)).mirror,inf),\n \\freq, exprand(~notes[1],11000).round(~notes[1]),\n \\pan, rrand(-1.0,1.0),\n \\rel, exprand(0.005,0.35),\n ).play;\n\n Pbind(\n \\instrument, \\tone,\n \\dur, Pseq(\n Array.geom(50, rrand(1.5,1.51), rrand(0.923,0.929)).mirror,inf\n ),\n \\freq, exprand(~notes[2],15000).round(~notes[2]),\n \\pan, rrand(-1.0,1.0),\n \\rel, exprand(0.005,0.35),\n ).play;\n };\n }.play(AppClock);\n});\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `NamedControl`."}, {"role": "assistant", "content": "```supercollider\n// multiple usage of the same name:\na = { SinOsc.ar(\\freq.kr(440, 1.0)) + Saw.ar(\\freq.kr(440, 1.0) * 0.5) * 0.1 }.play;\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n\n// with different lag values:\na = { SinOsc.ar(\\freq.kr(440).lag(3.5)) + Saw.ar(\\freq.kr(440).lag(0.05) * 0.5) * 0.1 }.play;\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n\n// control saved to a variable:\n(\na = {\n var freq = \\freq.kr(440);\n SinOsc.ar(freq.lag(3.5)) + Saw.ar(freq.lag(0.05) * 0.5) * 0.1;\n}.play;\n);\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// The code below generates a series of test signals for each speaker of \n// the currently active setup. In the default settings this generates \n// short pink noise bursts, twice on each group of 8 speakers.\n\n(\nn = 8; // size of speaker groups\nz = 1/4; // duration per burst\nt = \\pinkNoise; // udef name for sound generation\nr = 2; // number of repeats per group\nx = UScore();\n\n(WFSSpeakerConf.default.speakerCount / n).ceil.do({ |i|\n var folder;\n folder = UScore( i * (r * (n + 1) * z) );\n x.add( folder );\n r.do({ |ii|\n n.do({ |iii|\n folder.add( UChain( ((ii * (n + 1)) + iii) * z, iii, z * (3/4), \n [ t, [ \\seed, 12345 ] ],\n [ \\wfsIndex, [ \\index, (i * 8) + iii, \\gain, 0 ] ]\n )\n );\n });\n });\n folder.name = ([1,n] + (i*8)).join(\"-\"); \n});\n\nx.gui;\n)\n```"}, {"role": "assistant", "content": "The code below generates a series of test signals for each speaker of the currently active setup. In the default settings this generates short pink noise bursts, twice on each group of 8 speakers."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n// given a simple instrument\nInstr(\\Pulse,{ arg freq=440.0,width=0.5,mul=0.1;\n Pulse.ar( freq, width, mul )\n});\n\n// a patch specifies inputs (arguments) to that instrument\np = Patch( \\Pulse, [ 300, 0.2, 0.1 ]);\n\n//the default server will be booted, the SynthDef written and loaded\np.play;\n\n);\n\np.stop;\n```"}, {"role": "assistant", "content": "given a simple instrument a patch specifies inputs (arguments) to that instrument (Patch: Pairs an Instr with inputs that that will be passed to the Instr)"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nPdef(\\x, Pseq([Pbind(\\instrument, \\gpdef), Pdef(\\x)], inf));\nPdef(\\x.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nPdef(\\x, Pseq([Pbind(\\instrument, \\gpdef), Pdef(\\x)], inf));\nPdef(\\x).play;\n```"}]} -{"conversations": [{"role": "user", "content": "What is `DebugFrame` in SuperCollider?"}, {"role": "assistant", "content": "DebugFrame — A representation of the call frame A representation of the call frame. Can be used to reconstruct a backtrace by using #-caller. Category: Core."}]} -{"conversations": [{"role": "user", "content": "What is `Nil`?"}, {"role": "assistant", "content": "Nil — Represents uninitialized data"}, {"role": "user", "content": "What does `Nil.isNil` do?"}, {"role": "assistant", "content": "Answers true because this is nil. In class Object this message is defined to answer false. `[1, 2, nil, 3].collect(_.isNil);`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nx = nil;\nx = x.add(8); // returns an array\nx = x.add(7); // appends to the array\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PV_MagAbove`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\nb = Buffer.read(s, ExampleFiles.child);\n\n\n(\nSynthDef(\"help-magAbove\", { |out = 0|\n var in, chain;\n in = SinOsc.ar(SinOsc.kr(SinOsc.kr(0.08, 0, 6, 6.2).squared, 0, 100, 800));\n // in = WhiteNoise.ar(0.2);\n chain = FFT(LocalBuf(2048), in);\n chain = PV_MagAbove(chain, 310);\n Out.ar(out, 0.1 * IFFT(chain).dup);\n}).play(s);\n);\n\n(\nSynthDef(\"help-magAbove2\", { |out = 0|\n var in, chain;\n in = WhiteNoise.ar(0.2);\n chain = FFT(LocalBuf(2048), in);\n chain = PV_MagAbove(chain, MouseX.kr(0, 10));\n Out.ar(out, 0.1 * IFFT(chain).dup);\n}).play(s);\n);\n\n(\nSynthDef(\"help-magAbove3\", { |out = 0, soundBufnum = 2|\n var in, chain;\n in = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);\n chain = FFT(LocalBuf(2048), in);\n chain = PV_MagAbove(chain, MouseX.kr(0, 310));\n Out.ar(out, 0.1 * IFFT(chain).dup);\n}).play(s, [\\soundBufnum, b]);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `CytonDaisyWifi` in SuperCollider?"}, {"role": "assistant", "content": "CytonDaisyWifi — for communicating with a Cyton+Daisy board (16ch) this class is for communication via wifi osc (wifishield). use CytonDaisySerial for the bluetooth dongle. Category: External Control."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LFClipNoise`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-LFClipNoise\", { |out = 0|\n Out.ar(out,\n LFClipNoise.ar(1000, 0.25)\n )\n}).play;\n);\n\n// modulate frequency\n(\nSynthDef(\"help-LFClipNoise\", { |out = 0|\n Out.ar(out,\n LFClipNoise.ar(XLine.kr(1000, 10000, 10), 0.25)\n )\n}).play;\n);\n\n// use as frequency control\n(\nSynthDef(\"help-LFClipNoise\", { |out = 0|\n Out.ar(out,\n SinOsc.ar(\n LFClipNoise.ar(4, 200, 600),\n 0, 0.2\n )\n )\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Warp1`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\nb.free;\nb = Buffer.read(s, ExampleFiles.apollo11);\n{\n var pointer = Phasor.ar(0, SampleDur.ir / BufDur.ir(b) * XLine.kr(1, 0.25, 20));\n var sound = Warp1.ar(1, b, pointer, 1, 0.3, -1, 16, Line.kr(0, 1, 40), 4);\n Pan2.ar(sound, pointer * 2 - 1, 0.25)\n}.play\n);\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `BufCombN` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// These examples compare the variants, so that you can hear the difference in interpolation\n\n// allocate buffer\nb = Buffer.alloc(s, 44100, 1);\n\n// Comb used as a resonator. The resonant fundamental is equal to\n// reciprocal of the delay time.\n{ BufCombN.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ BufCombL.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ BufCombC.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// with negative feedback:\n{ BufCombN.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ BufCombL.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ BufCombC.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n// used as an echo.\n{ BufCombL.ar(b.bufnum, Decay.ar(Dust.ar(1, 0.5), 0.2, WhiteNoise.ar), 0.2, 3) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for batuhan's buzzer parametrized that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n// A beautiful sc140 tweet by Batuhan Bozkurt, parametrized for real-time changes\n(\n// Start sound here\na = { | rateL = 5, rateR = 6, blipMul = 100, blipAdd = 50, fMul = 50, kMul = 1 |\n f = LocalIn.ar(2).tanh;\n k = Latch.kr(f[0].abs,Impulse.kr(1/4)) * kMul;\n LocalOut.ar(\n f +\n CombC.ar(Blip.ar([rateL, rateR], blipMul * k + blipAdd, 0.9), 1, k*0.3, fMul * f));f\n}.play\n);\n\n// Set parameters for changing sound here: \n\na.set(\\rateL, 10);\n\na.set(\\rateR, 8);\n\na.set(\\blipMul, 25);\n\na.set(\\blipAdd, 70);\n\na.set(\\fMul, 30);\n\n\na.set(\\kMul, 0.01);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Delay2.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Two sample delay. Arguments: in — The input signal.; mul — The output will be multiplied by this value.; add — This value will be added to the output.; x1 — The sample directly preceding the delayed input signal, which is the second output sample. This can be a numeric value or a `UGen`.; x2 — The sample preceding the delayed input signal by two samples, which is the first output sample. This can be a numeric value or a `UGen`.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Change MembraneHexagon to MembraneCircle for a different shaped\n// circular drum head\ns.boot;\ns.reboot;\n(\n{ var excitation = EnvGen.kr(Env.perc,\n MouseButton.kr(0, 1, 0),\n timeScale: 0.1, doneAction: 0\n ) * PinkNoise.ar(0.4);\n var tension = MouseX.kr(0.01, 0.1);\n var loss = MouseY.kr(0.999999, 0.999, 1);\n MembraneHexagon.ar(excitation, tension, loss);\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Change MembraneHexagon to MembraneCircle for a different shaped\n// circular drum head\ns.boot;\ns.reboot;\n(\n{ var excitation = EnvGen.kr(Env.perc,\n MouseButton.kr(0, 1, 0),\n timeScale: 0.1, doneAction: 0\n ) * PinkNoise.ar(0.4);\n var tension = MouseX.kr(0.01, 0.1);\n var loss = MouseY.kr(0.999999, 0.999, 1);\n MembraneHexagon.ar(excitation, tension, loss);\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "List of exit codes?"}, {"role": "assistant", "content": "SuperCollider forum — List of exit codes?\n\n7068696c:\n\n```supercollider\no = s.options;\no.inDevice = nil;\no.outDevice = \"ASIO : ASIO4ALL\";\n```\n\nHmmmm... In earlier SC versions, it wouldn’t have worked to have a nil input device in scsynth either (which is admittedly a problem for devices with no inputs). This was fixed in scsynth but it’s possible that it wasn’t fully fixed in supernova.\n\n@MarcinP – any thoughts about this? (I remember you worked on scsynth device selection but I don’t recall who ported that to supernova.)\n\nhjh"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Timer`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// using timer to modulate sine frequency: the slower the trigger is the higher the frequency\n(\n{ var trig;\n trig = Impulse.kr(MouseX.kr(0.5, 20, 1));\n SinOsc.ar(Timer.kr(trig) * 500 + 500, 0, 0.2)\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\nx = SynthDef(\"help-node-set\", { |freq = #[440, 450, 460], out = 0|\n Out.ar(out, Mix(SinOsc.ar(freq, 0, 0.1)))\n}).play\n);\nx.set(\\freq, [1, 2, 3] * 400 + [1, 2, 3], \\out, 1); // two pairs\nx.set(\\freq, [3] * 400 + [1, 2, 3], \\out, 1); // two pairs\nx.set(0, [660, 680, 720], 1, 0; // freq is the first argument, so it's index is 0. out is index 1.\nx.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\nx = SynthDef(\"help-node-set\", { |freq = #[440, 450, 460], out = 0|\n Out.ar(out, Mix(SinOsc.ar(freq, 0, 0.1)))\n}).play\n);\nx.set(\\freq, [1, 2, 3] * 400 + [1, 2, 3], \\out, 1); // two pairs\nx.set(\\freq, [3] * 400 + [1, 2, 3], \\out, 1); // two pairs\nx.set(0, [660, 680, 720], 1, 0); // freq is the first argument, so it's index is 0. out is index 1.\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Pnsym`?"}, {"role": "assistant", "content": "Pnsym — use a pattern of symbols to embed Pdefns"}, {"role": "user", "content": "What does `Pnsym.dict` do?"}, {"role": "assistant", "content": "set the dictionary to be used."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\n// load a synthdef\ns.boot;\nSynthDef(\"gpdef\",\n { |out = 0, freq = 440, sustain = 0.05, amp = 0.1, pan|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain), doneAction: Done.freeSelf) * amp;\n Out.ar(out, Pan2.ar(SinOsc.ar(freq, 0, env), pan))\n }).add;\n);\n\nPdefn(\\x, Pn(1, 3));\nPdefn(\\y, Prand([5, 9, 1], 2));\nPdefn(\\z, Pdefn(\\y) * 2);\n\n(\nPdef(\\play,\n Pbind(\n \\instrument, \\gpdef,\n \\harmonic, Pnsym(Pseq([\\x, \\x, Prand([\\x, \\y]), [\\z, \\y], \\y], inf)).trace,\n \\dur, 0.2, \\note, 10\n )\n).play;\n);\n\n// change root pattern:\nPdefn(\\x, Pn(2, 3));\nPdefn(\\x, Pseq([1, 3, 1, 2, 1, 4, 5]));\nPdefn(\\x, Pseq([1, 3, 1, 2, [1, 3], 4, 5]));\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `InFeedback`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-InFeedback\", { |out = 0, in = 0|\n Out.ar(out,\n InFeedback.ar(in, 1)\n );\n}).add;\nSynthDef(\"help-SinOsc\", { |out = 0, freq = 440|\n Out.ar(out, SinOsc.ar(freq, 0, 0.1))\n}).add;\n);\n\nx = Bus.audio(s, 1);\n\n// read from bus n play to bus 0 (silent)\na = Synth(\"help-InFeedback\", [\\in, x.index, \\out, 0]);\n\n// now play a synth after this one, playing to bus x\nb = Synth.after(a, \"help-SinOsc\", [\\out, x.index]);\n\n// add another synth before a which also writes to bus x\n// now you can't hear b, as its data is one cycle old, and is overwritten by c\nc = Synth.before(a, \"help-SinOsc\", [\\out, x.index, \\freq, 800]);\n\n// free c and you can hear b again\nc.free;\nx.free;\n\na.free; b.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `CytonWifi` in SuperCollider briefly."}, {"role": "assistant", "content": "CytonWifi — for communicating with a Cyton board (8ch) this class is for communication via wifi osc (wifishield). use CytonSerial for the bluetooth dongle. Category: External Control."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ SinOsc.ar(LFNoise0.ar(2).range(420, 460).poll(label: \\LFNoise), 0, 0.2) }.play;\n\n// multichannel polling:\n(\n{\n var freqs = SinOsc.ar([0.2, 0.3]).range(420, 460);\n freqs.poll(label: [\\freq1, \\freq2]);\n SinOsc.ar(freqs, 0, 0.2);\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ SinOsc.ar(LFNoise0.ar(2).range(420, 460).poll(label: \\LFNoise), 0, 0.2) }.play;\n\n// multichannel polling:\n(\n{\n var freqs = SinOsc.ar([0.2, 0.3]).range(420, 460);\n freqs.poll(label: [\\freq1, \\freq2]);\n SinOsc.ar(freqs, 0, 0.2);\n}.play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Approaches to recording generated midi in DAW?"}, {"role": "assistant", "content": "SuperCollider forum — Approaches to recording generated midi in DAW?\n\nToday I spent another 6 hours or so trying to record in ardour (linux) both the midi information generated by supercollider and the audio generated by sending this midi to external synths. I finally hit the right combination of magic to make it work and I want to add my recipe in this thread so that I can find it back the future (and perhaps it also works for someone else).\n\nIngredient 1: a2jmidid. You can run it manually on the command line using “a2jmidid -e” or (like me) you can just use the “start midi bridge” button in the jack front-end application “Cadence” (enable the “export hardware ports checkbox”)\n\nIngredient 2: In supercollider itself, it is extremely important to only connect to a port and not to specify a destination uid. It seems that by specifying a destination uid, supercollider gets some kind of direct connection to the midi destination and ardour can no long introspect/record what is happening (I know it doesn’t sound scientific - this is purely the result of empiric observation/frustration.\n\nSo in supercollider, simply use\n\n```supercollider\n~synth1 = MIDIOut(0);\n~synth2 = MIDIOut(1);\n```\n\nand then in ardour’s Window->Midi Connections dialog, you can connect the out ports from supercollider to both your external synth and the track in which you want to record the midi information.\n\nFor midi driver in jack you can configure None.\n\nIf you want to record the generated midi in ardour, do NOT use connection syntax like\n\n```supercollider\n~synth1 = MIDIOut(0, MIDIClient.destinations[2].uid);\n```\n\nand do NOT use\n\n```supercollider\n~synth1 = MIDIOut.newByName(\"INTEGRA-7\", \"INTEGRA-7 MIDI 1\");\n```\n\nIf you just want to send midi to the external synth without recording the information, both previous ways of connecting work as well but these ways of connecting appear to work only if the jack MIDI driver is configured to use “ALSA sequencer” mode. It doesn’t seem to work with “None” or “ALSA Raw” (this may need some further investigation to clear out)."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Re: midified arpeggiator/auto-accompaniment using patterns?"}, {"role": "assistant", "content": "```supercollider\n(\ns.waitForBoot({\n var right, left;\n\n MIDIdef.freeAll;\n if (~midi_initilized.isNil) {\n MIDIClient.init;\n MIDIIn.connectAll;\n ~midi_initialized = 1;\n };\n\n ~n = (\n table: Order(),\n noteOn: {|n,note| n.table[note] = 1},\n noteOff: {|n,note| n.table.removeAt(note)},\n get: {|n,i| \n n.table.indices[i] ?? n.table.indices.first ?? Rest(1)\n },\n seq: {|n,notes|\n notes.asArray.collect{|i| Plazy{n.get(i)}}\n }\n );\n \n MIDIdef.noteOn(\n \\mynoteonhandler, // just a name for this handler\n {\n |val, num, chan, src|\n ~n.noteOn(num)\n }\n );\n\n MIDIdef.noteOff(\n \\mynoteoffhandler, // just a name for this handler\n {\n |val, num, chan, src|\n ~n.noteOff(num) // update note table and update ~n\n /*\n // only enable the following lines if you want the arpeggio to stop as soon as you release the keys\n ~n.table.clear\n */\n }\n );\n\n right = Pbind(\n \\instrument, \\default,\n \\midinote, Pseq(~n.seq(\n [ 0, 2, 1, 2] ++ (([ 0, 2, 1, 2] + 12)!2).flatten\n )),\n \\dur, 2*Pseq([1, 1, 1, 1, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5 ].normalizeSum)\n );\n left = Pbind(\n \\instrument, \\default,\n \\midinote, Pseq(~n.seq([ 0, 2, 0, 2, 0, 2, 0, 2] - 12)),\n \\dur, 2*Pseq([1, 1, 1, 1, 1, 1, 1, 1].normalizeSum)\n );\n if (~player.notNil) { ~player.stop; };\n ~player = Pn(Ppar([right,left])).play;\n});\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Main.scVersionPatch` do?"}, {"role": "assistant", "content": "The concrete instance of Process Returns: patch version number as Integer"}]} -{"conversations": [{"role": "user", "content": "What is `Symbol`?"}, {"role": "assistant", "content": "Symbol — a unique name for something"}, {"role": "user", "content": "What does `Symbol.isClassName` do?"}, {"role": "assistant", "content": "Answer whether the symbol can be a class name. This does not say if the class exists. `\\Array.isClassName;`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na = { SinOsc.ar(\\freq.kr(440, 1.2)) }.play;\na.set(\\freq, 330);\na.release;\na = { SinOsc.ar(\\freq.kr([440, 460], 1.2)) }.play;\na.setn(\\freq, [330, 367]);\na.release;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `ServerOptions.ugenPluginsPath` do?"}, {"role": "assistant", "content": "A path or an Array of paths. If non-nil, the standard paths are NOT searched for plugins. This corresponds with the option"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for rough sketch of chicago minor chord pad thing."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\\ChicagoPad, { |out = 0, freq = 440, cutoff = 500, amp = 0.2|\n var snd;\n freq = freq + SinOsc.kr(0.1, 0, 1, 20);\n snd = Saw.ar([freq, freq+1, freq-1, freq*3/2, freq*6/5])*0.1;\n snd = snd + VarSaw.ar(0.99*[freq, freq+1, freq-1,freq*3/2, freq*6/5],0, LFTri.kr(0.3).range(0.25,0.9))*0.1;\n snd = Mix(snd);\n snd = RLPF.ar(snd, SinOsc.kr(0.1, 0, 100, 5000), 0.1);\n snd = GVerb.ar(snd ,40, 10, 0.6, 0.6, -3, -9, -11)*0.2;\n \n //snd = RLPF.ar(snd, SinOsc.kr(0.08, 0.5, cutoff/10, cutoff), 0.2);\n snd = MoogFF.ar(snd, SinOsc.kr(0.08, 0.5, cutoff/10, cutoff), 3, 0);\n snd = DelayC.ar(snd, 1.5, 1,0.8);\n //snd = snd * EnvGen.ar(Env.linen(0.001, 0.01,0.01,1), doneAction:2);\n Out.ar(out, [snd, AllpassC.ar(snd, 0.5, 0.05, 0.3)]*amp);\n}).send;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `PLbindefParEnvironment.stop` do?"}, {"role": "assistant", "content": "Stops all PLbindefs of the corresponding"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\ns.boot;\n\n// no decay\n(\n{\n SinOsc.ar(\n PeakFollower.ar(Dust.ar(20, Line.kr(0, 1, 4)), 1.0) * 1500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// a little decay\n(\n{\n SinOsc.ar(\n PeakFollower.ar(Dust.ar(20, Line.kr(0, 1, 4)), 0.999) * 1500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// mouse x controls decay, center of the\n(\n{\n var decay;\n decay = MouseX.kr(0.99, 1.00001).min(1.0);\n SinOsc.ar(\n PeakFollower.ar(Dust\n// …\n```"}, {"role": "assistant", "content": "mouse x controls decay, center of the follow a sine lfo, decay controlled by mouse x (PeakFollower: Track peak signal amplitude.)"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\n{\n SinOsc.ar([225, 450, 900], 0, 0.2)\n + LPF.ar(\n LFPulse.ar(226 * [1, 2, 5], [0, 0.1, 0.1], 0.2, 0.2),\n MouseX.kr(20, 10000, 1)\n )\n}.scope;\n);\n\n// server.scope only changes the properies explicitly given:\n\ns.scope(numChannels: 5);\ns.scope(index: 12);\ns.scope(zoom: 4);\ns.scope(index: 0);\n\ns.scopeWindow.size = 600;\ns.scopeWindow.size = 222;\n\n// scoping buses:\n\na = Bus.audio(s, 4);\n{\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\n{\n SinOsc.ar([225, 450, 900], 0, 0.2)\n + LPF.ar(\n LFPulse.ar(226 * [1, 2, 5], [0, 0.1, 0.1], 0.2, 0.2),\n MouseX.kr(20, 10000, 1)\n )\n}.scope;\n);\n\n// server.scope only changes the properies explicitly given:\n\ns.scope(numChannels: 5);\ns.scope(index: 12);\ns.scope(zoom: 4);\ns.scope(index: 0);\n\ns.scopeWindow.size = 600;\ns.scopeWindow.size = 222;\n\n// scoping buses:\n\na = Bus.audio(s, 4);\n{ WhiteNoise.ar(0.2.dup(4)) }.play(s, a);\n\na.scope;\n\nc = Bus.control(s, 3);\n{ WhiteNoise.kr(1.dup(4) * MouseX.kr) }.play(s, c);\n\nc.scope;\n\n// note that scoping control rate buses shows block size interpolation (this is due to the\n// fact that ScopeOut.kr doesn't work yet.)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for micro-beat repeat, based on delay."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\stutter,{\n arg in=0, out=0;\n var sig, delayTime, increment, trigger;\n var reset=\\reset.kr(0);\n var delayPitch=\\pitch.kr(12);\n var offsetms=\\offsetms.kr(0)/1000;\n var strobe=\\strobe.kr(1);\n var on=\\onoff.kr(0);\n var envGen, sustainTime;\n var atkTime=0.002, relTime=0.002;\n\n reset=reset*on;\n // Convert pitch to delay time in seconds\n delayTime = delayPitch.midicps.reciprocal;\n\n // Trigger for incrementing delay time\n trigger = Impulse.ar(delayTime.reciprocal);\n\n // Calculate sustain time to ensure envelope stays high for the chunk duration minus attack and release\n sustainTime = delayTime - (atkTime + relTime);\n\n // Ensure sustainTime is not negative\n sustainTime = max(sustainTime, 0)*strobe;\n\n // Increment delay time\n increment = Dseries(0, delayTime, inf)*on;\n increment = Demand.ar(trigger, reset, increment);\n\n // Generate an envelope to soften clicks\n envGen = EnvGen.ar(Env([0, 1, 1, 0], [atkTime, sustainTime, relTime], 'lin'), trigger);\n\n\n // Get input signal\n sig = In.ar(in, 1); // Assuming stereo input\n\n // Apply delay\n sig = DelayC.ar(sig, 24, increment+offsetms);\n\n // Apply envGen\n sig=sig*envGen;\n\n // Output\n Out.ar(out, sig);\n}).add();\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// start and pchRatio are streamed\n(\nInstrSpawner({ arg sample,start=0,pchRatio=1.0,env;\n PlayBuf.ar(\n sample.numChannels,\n sample.bufnumIr,\n pchRatio,\n 1,\n start * sample.bufFramesIr,\n 1\n ) * EnvGen.kr(env,doneAction: 2)\n},[\n Sample(\"a11wlk01.wav\"),\n Pbrown(0,1,0.1,inf),\n Prand(\n Array.fill(4,{\n Pseries(rrand(-20,30),[2,-2].choose,rrand(5,20))\n }),inf).midiratio,\n Env.sine(0.2,0.4)\n\n],0.06).\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// start and pchRatio are streamed\n(\nInstrSpawner({ arg sample,start=0,pchRatio=1.0,env;\n PlayBuf.ar(\n sample.numChannels,\n sample.bufnumIr,\n pchRatio,\n 1,\n start * sample.bufFramesIr,\n 1\n ) * EnvGen.kr(env,doneAction: 2)\n},[\n Sample(\"a11wlk01.wav\"),\n Pbrown(0,1,0.1,inf),\n Prand(\n Array.fill(4,{\n Pseries(rrand(-20,30),[2,-2].choose,rrand(5,20))\n }),inf).midiratio,\n Env.sine(0.2,0.4)\n\n],0.06).play\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Henon2DN` in SuperCollider?"}, {"role": "assistant", "content": "Henon2DN — henon map 2D chaotic generator `y = b * x(n)` Category: UGens > Generators > Stochastic."}]} -{"conversations": [{"role": "user", "content": "What does `Signal.thresh` do?"}, {"role": "assistant", "content": "Thresholding replaces every value < threshold with"}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ var sig = SinOsc.ar(440) * 0.2; Out.ar(0, sig) }.play;\n```"}, {"role": "assistant", "content": "The minimal SynthDef idiom: a source multiplied by an amplitude, written to the master bus.\n\n`var sig = SinOsc.ar(440) * 0.2` builds the signal; `Out.ar(0, sig)` is the only mandatory part, because a\nUGen graph that never reaches an output produces no sound. `Out`'s first argument is the bus number — 0 is\nthe main stereo output — and the second is the signal. The function's return value does not matter here,\nwhich is why the `Out.ar` can sit on its own line. `.play` compiles this into an anonymous SynthDef and\nstarts one instance."}]} -{"conversations": [{"role": "user", "content": "How should I check an answer you give me?"}, {"role": "assistant", "content": "Three quick checks, cheapest first. Does it evaluate without a syntax error — the post window points at the exact character. Does the node appear in `s.plotTree` — if yes, the problem is signal rather than lifecycle. Does it reach `Out.ar(0, ...)` with a non-zero amplitude and an open filter. If those three pass and it is still silent, the class's own help page will show the argument order you may have assumed wrong."}]} -{"conversations": [{"role": "user", "content": "What does `SimpleNumber.raddeg` do?"}, {"role": "assistant", "content": "one-dimensional value Returns: converts radian to degree"}]} -{"conversations": [{"role": "user", "content": "What does `PlayerAmp.synthDefArgs` do?"}, {"role": "assistant", "content": "adds a simple amplitude control to a Player"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n//try passing a signal through the hair cell\nx = { Meddis.ar(SinOsc.ar(440)) }.play;\nx.free;\n\n//recursive hair cell compression\n{ Meddis.ar(Meddis.ar(SoundIn.ar) }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n//try passing a signal through the hair cell\nx = { Meddis.ar(SinOsc.ar(440)) }.play;\nx.free;\n\n//recursive hair cell compression\n{ Meddis.ar(Meddis.ar(SoundIn.ar)) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `QPalette.auto` do? What arguments does it take?"}, {"role": "assistant", "content": "Instantiates a new palette, with colors automatically derived from the given colors for 'button' and 'window' color roles. All colors are considered to be set (see Arguments: buttonColor — The Color assigned to the button role.; windowColor — The Color assigned to the window role.."}]} -{"conversations": [{"role": "user", "content": "Explain `KeyClarity` in SuperCollider briefly."}, {"role": "assistant", "content": "KeyClarity — Running score of maximum correlation of chromagram with key profiles A (12TET major/minor) key tracker based on a pitch class profile of energy across FFT bins and matching this to templates for major and minor scales in all transpositions. It assumes a 440 Hz concert A reference. Output is the strength of the match to scales, e.g. maximal correlation with key profiles. Provides a measure of the level of key clarity, e.g. unambiguous key. Category: UGens > Analysis > Pitch."}]} -{"conversations": [{"role": "user", "content": "What does `ProxySpace.play` do? What arguments does it take?"}, {"role": "assistant", "content": "returns a group that plays the NodeProxy at that Arguments: key — a Symbol; out — output channel offset; numChannels — play this number of channels.."}]} -{"conversations": [{"role": "user", "content": "What does `View.resize` do? What arguments does it take?"}, {"role": "assistant", "content": "Determines what happens with the view's position and size when its parent is resized. See GUI-Introduction#view for further Arguments: An Int (1 to 9) defining the auto-resize behavior. See Resize for a list of valid resize modes.."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Re: the perfect frequencies?"}, {"role": "assistant", "content": "```supercollider\n// Rumush\n// https://mycelialcordsblog.wordpress.com/\n// https://fungorumush.bandcamp.com/releases\n// https://soundcloud.com/fungorum\n\n(\nf = {\n var rep = [4, 8, 16, 32];\n var n = rep.choose;\n var x = [\n\n 54, 60, 66, 72, 81, 90, 96, 102,\n 108, 128, 132, 144, 162, 180, 192, 204,\n 216, 240, 264, 288, 324, 360, 384, 408,\n 432, 480, 528, 576, 648, 720, 768, 816,\n 864, 960, 1056, 1152, 1296, 1440, 1536, 1632,\n 1728, 1920, 2112, 2304, 2592, 2880, 3072, 3264,\n 3456, 3840, 4224, 4608, 5184, 5760, 6144, 6528,\n 6912, 7680, 8448, 9216, 10368, 11520, 12288, 528\n\n ];\n Mix.fill(n,\n {\n var detune = 5.rand;\n var sin = SinOsc.ar(x.choose, 4.rand, 0.25);\n var saw = RLPF.ar(Saw.ar(x.choose*0.01+detune, 0.75), x.choose, 2.rand).tanh;\n Pan2.ar((sin+saw) * EnvGen.kr(Env.sine(12, 1/n), 1, doneAction:2),\n 1.rand2) }\n );\n};\n);\n\n(\n// DEFINE A ROUTINE\nr = Routine({\n\n inf.do({\n f.play;\n 10.wait;\n })\n});\n);\n\nr.reset.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Splay`?"}, {"role": "assistant", "content": "Splay — Splay spreads an array of channels across the stereo field"}, {"role": "user", "content": "What does `Splay.arFill` do?"}, {"role": "assistant", "content": "In analogy to Mix:arFill, this method takes a function that produces the channels. The counting index is passed to it."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// splay 10 chans of sound into 2\n(\nx = { |spread = 1, level = 0.2, center = 0.0|\n var numchans = 10;\n Splay.ar(\n SinOsc.ar({ |i| LFNoise2.kr(1).exprange(200, 4000) } ! numchans),\n spread,\n level,\n center\n // use levelComp default true\n );\n}.play;\n);\n\ns.meter;\ns.scope;\n\n// change settings dynamically:\n\nx.set(\\spread, 1, \\center, 0); // full stereo\nx.set(\\spread, 0.5, \\center, 0); // less wide\nx.set(\\spread, 0, \\center, 0); // mono center\nx.set(\\spread, 0.5, \\center, 0.5); // spread from center to right\nx.set(\\spread, 0, \\center, -1); // all left\nx.set(\\spread, 1, \\center, 0); // full stereo\n\n// A similar example written with arFill:\n(\nx = { |spread = 1, level = 0.2, center = 0.0|\n var numchans = 10;\n Splay.arFill(numchans,\n { |i| SinOsc.ar(LFNoise2.kr(rrand(10, 20), 200, i + 3 * 100)) },\n spread,\n level,\n center\n );\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LFCub`."}, {"role": "assistant", "content": "```supercollider\n{ LFCub.ar(LFCub.kr(LFCub.kr(0.2, 0, 8, 10), 0, 400, 800), 0, 0.1) }.play\n{ LFCub.ar(LFCub.kr(0.2, 0, 400, 800), 0, 0.1) }.play\n{ LFCub.ar(800, 0, 0.1) }.play\n{ LFCub.ar(XLine.kr(100, 8000, 30), 0, 0.1) }.play\n\n// compare:\n\n{ LFPar.ar(LFPar.kr(LFPar.kr(0.2, 0, 8, 10), 0, 400, 800), 0, 0.1) }.play\n{ LFPar.ar(LFPar.kr(0.2, 0, 400, 800), 0, 0.1) }.play\n{ LFPar.ar(800, 0, 0.1) }.play\n{ LFPar.ar(XLine.kr(100, 8000, 30), 0, 0.1) }.play\n\n\n{ SinOsc.ar(SinOsc.kr(SinOsc.kr(0.2, 0, 8, 10), 0, 400, 800), 0, 0.1) }.play\n{ SinOsc.ar(SinOsc.kr(0.2, 0, 400, 800), 0, 0.1) }.play\n{ SinOsc.ar(800, 0, 0.1) }.play\n{ SinOsc.ar(XLine.kr(100, 8000, 30), 0, 0.1) }.play\n\n{ LFTri.ar(LFTri.kr(LFTri.kr(0.2, 0, 8, 10), 0, 400, 800), 0, 0.1) }.play\n{ LFTri.ar(LFTri.kr(0.2, 0, 400, 800), 0, 0.1) }.play\n{ LFTri.ar(800, 0, 0.1) }.play\n{ LFTri.ar(XLine.kr(100, 8000, 30), 0, 0.1) }.play\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// this does not work:\n(\n{\n var trig = Dust.ar(4);\n Trig.kr(trig, 0.1) * SinOsc.ar(800) * 0.1\n}.play;\n);\n\n// this works:\n(\n{\n var trig = T2K.kr(Dust.ar(4));\n Trig.kr(trig, 0.1) * SinOsc.ar(800) * 0.1\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// this does not work:\n(\n{\n var trig = Dust.ar(4);\n Trig.kr(trig, 0.1) * SinOsc.ar(800) * 0.1\n}.play;\n);\n\n// this works:\n(\n{\n var trig = T2K.kr(Dust.ar(4));\n Trig.kr(trig, 0.1) * SinOsc.ar(800) * 0.1\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for reflection on seasonal change )."}, {"role": "assistant", "content": "```supercollider\n(\n{ \n LPF.ar(\n DynKlank.ar(\n `[[900, 971, 1153, 1823, 1401], nil, [\n SinOsc.kr(0.2).range(0.1,1), \n SinOsc.kr(0.6).range(0.1,1), \n SinOsc.kr(0.8).range(0.1,1), \n SinOsc.kr(1.2).range(0.1,1), \n SinOsc.kr(2).range(0.1,1)]\n ], \n Limiter.ar(Dust.ar(2, 0.65) + Impulse.ar(1,0,0.9))\n )\n ) ! 2 \n}.play;\n{ \n Pan2.ar(\n DynKlank.ar(`[[800, 1071, 1353, 723 + SinOsc.ar(SinOsc.ar(0.2).range(0, 10)).range(0,330)], nil, [1, 1, 0.5, 1]], PinkNoise.ar(0.007)),\n TRand.kr(-1, 1, trig: Pulse.ar(10))\n )\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `FixNumChannelsPlayer` in SuperCollider briefly."}, {"role": "assistant", "content": "FixNumChannelsPlayer — a utility Player that wraps another player with NumChannels Ensure that a player is stereo (or mono or whatever you like) by wrapping it in this. Category: Libraries > crucial > Players."}]} -{"conversations": [{"role": "user", "content": "Explain `PHSplayer` in SuperCollider briefly."}, {"role": "assistant", "content": "PHSplayer — PHS player object Implicitely instantiated when PHS's play method is called, allows stopping and resuming with options also concerning the help synth. Category: Libraries > miSCellaneous > HS and HSpar, Streams-Patterns-Events > HS and HSpar."}]} -{"conversations": [{"role": "user", "content": "What is `GlitchBPF` in SuperCollider?"}, {"role": "assistant", "content": "GlitchBPF — backward compatibility October 2012 BPF was changed to use double-precision floats (git commit: 72412f63affa94f69e2ea7539e21831a1d0d3e01). GlitchBPF can be used as drop-in replacements to get the old behavior back. Good for very noise and glitchy sounds where the filter [nearly] blows up. Category: UGens > Filters > Linear, UGens > Filters > GlitchUGens."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n{ CheckBadValues.kr(SinOsc.ar); 0 }.play // nothing wrong here\n\n{ CheckBadValues.kr(1 / 0, 1).poll; 0 }.play // check infinity\n\nx = { |test = -1| CheckBadValues.kr(test); 0 }.play // check NaN\nx.set(\\test, -1.sqrt);\n\n// don't post, but do something with the output\n(\nx = { |freq = 440|\n var good;\n good = BinaryOpUGen('==', CheckBadValues.kr(freq, 0, 0), 0);\n SinOsc.ar(freq, 0, 0.1) * good // silence the output if freq is bad\n}.play;\n);\nx.set(\\freq, -1.sqrt);\n// …\n```"}, {"role": "assistant", "content": "don't post, but do something with the output the UGen method checkBadValues passes through the input for quick testing (CheckBadValues: Test for infinity, not-a-number, and denormals)"}]} -{"conversations": [{"role": "user", "content": "What does `NumberEditor.numChannels` do?"}, {"role": "assistant", "content": "holds a float value with a spec, editable with a gui"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n \n// definition for future reference in arbitrary Environments,\n// Poisson distribution gives positive integer values\n\n(\np = Pbind(\n \\midinote, (PLpoisson(\\mean) + 50).clip(60, 90),\n \\dur, 0.1\n);\n);\n\n\n// prepare current Environment\n\n~mean = 10;\n\n\n// run\n\nx = p.play;\n\n\n// changing mean value \n\n~mean = Pstutter(5, PLseq((0, 5..30)));\n\nx.stop;\n```"}, {"role": "assistant", "content": "definition for future reference in arbitrary Environments, Poisson distribution gives positive integer values (PLpoisson: dynamic scope Ppoisson variant)"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nPbind(x:7, y:Pseq([1, 2, 3]).patternpairs\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nPbind(x:7, y:Pseq([1, 2, 3])).patternpairs\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Nil`."}, {"role": "assistant", "content": "```supercollider\nx = nil;\nx = x.add(8); // returns an array\nx = x.add(7); // appends to the array\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n var saw, bpf;\n saw = Saw.ar(\n freq: [1700,2000],\n mul: LFPulse.kr(\n freq: [2,7],\n width: 0.115));\n bpf = LPF.ar(in: saw, freq: SinOsc.kr(1/3).range(250, 4000)); \n}.play;\n)\n```"}, {"role": "assistant", "content": "Quiz 4a for MUSC 115, pp. 62-84 from Gentle Intro to SuperCollider."}]} -{"conversations": [{"role": "user", "content": "What is `Nil` in SuperCollider?"}, {"role": "assistant", "content": "Nil — Represents uninitialized data Nil has a single instance named `nil` and is used to represent uninitialized data, bad values, or terminal values such as end-of-stream. Internally, `nil` also serves as a sentinel value, used to mark empty or unoccupied slots in hash-based data structures such as `Set`, and its subclasses. Because of this internal role, `nil` —despite being a valid object— cannot be stored as an element in `Set` Category: Core."}]} -{"conversations": [{"role": "user", "content": "Write a closed hi-hat in SuperCollider."}, {"role": "assistant", "content": "High-passed noise with a very short envelope — the filter is what makes it a hat rather than a hiss.\n\n```supercollider\n(\nSynthDef(\\hat, { |out = 0, amp = 0.3, dur = 0.06|\n var env = EnvGen.kr(Env.perc(0.001, dur, 1, -6), doneAction: 2);\n Out.ar(out, Pan2.ar(HPF.ar(WhiteNoise.ar, 7000) * env * amp));\n}).add;\n);\nSynth(\\hat, [\\dur, 0.04]);\n```"}]} -{"conversations": [{"role": "user", "content": "How do I structure a live-coding performance in one file?"}, {"role": "assistant", "content": "One Tdef per musical layer, each with its own loop, so you can start and stop layers while the set\nruns.\n\n```supercollider\n(\nTdef(\\kick, {\n loop {\n Synth(\\kick);\n 0.5.wait;\n }\n}).play;\n\nTdef(\\hats, {\n loop {\n Synth(\\hat, [\\amp, 0.15]);\n (1/8).wait;\n }\n}).play;\n)\n```\n`Tdef(\\kick).stop` stops one layer, `Tdef(\\kick).reset` restarts it at the next cycle, and\n`CmdPeriod.run` stops everything."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// using timer to modulate sine frequency: the slower the trigger is the higher the frequency\n(\n{ var trig;\n trig = Impulse.kr(MouseX.kr(0.5, 20, 1));\n SinOsc.ar(Timer.kr(trig) * 500 + 500, 0, 0.2)\n}.play;\n)\n```"}, {"role": "assistant", "content": "using timer to modulate sine frequency: the slower the trigger is the higher the frequency (Timer: Returns time since last triggered.)"}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n~buf = Buffer.read(s, \"C:/sounds/break.wav\");\nPlayBuf.ar(1, ~buf, BufRateScale.kr(~buf), loop: 1);\n```"}, {"role": "assistant", "content": "Loads a sound file into server memory, then plays it in a loop at the file's original pitch.\n\n- `Buffer.read(s, path)` allocates a buffer on the server and fills it from the file. It is asynchronous:\n the Buffer object returns immediately, the samples arrive later.\n- `PlayBuf.ar(1, buf, ...)` needs the channel count first — 1 for a mono file. A wrong count is the usual\n cause of a buffer that plays wrongly or not at all.\n- `BufRateScale.kr(buf)` compensates when the file's sample rate differs from the server's, so `rate: 1` is\n the file's true speed.\n- `loop: 1` restarts at the end instead of stopping.\n\nBecause the read is asynchronous, this line pair is only safe if a `s.sync` or a wait happened in between;\notherwise PlayBuf sees a buffer with no data yet."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Words in a matchbox?"}, {"role": "assistant", "content": "```supercollider\n// really early first approach...\n(\nx.free;\nx = {\n var note = Duty.kr(\n 6/3.2,\n 0, \n Dseq([45, 45, 48, 41], inf));\n var snd = Saw.ar(note.midicps * SinOsc.kr(7.421).range(0.998, 1.001)) * -12.dbamp!2;\n var trigs = TDuty.kr(\n Dseq([1, 2, 3]/3.2, inf),\n 0,\n 1);\n var lvls = Duty.kr(\n Dseq([1, 2, 3]/3.2, inf),\n 0,\n Dseq([-9, -3, -6], inf));\n snd = snd * lvls.dbamp.lag2(0.1);\n snd = snd * EnvGen.kr(Env.perc(0.3, 0.3), trigs);\n snd = RLPF.ar(snd, EnvGen.kr(Env.perc(0.5, 0.2), trigs) * 3201 + 2311, 0.2);\n snd = LPF.ar(snd, 3000);\n snd = snd * (1 + Latch.ar(WhiteNoise.ar(-8.dbamp), Dust.ar(830))).lag2(0.01);\n snd = snd + LPF.ar(CombC.ar(snd, 0.4, 0.33, 0.52, -4.dbamp), 932);\n snd = FreeVerb2.ar(snd, snd, 0.21, 0.93, 0.9);\n snd * -12.dbamp;\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Fdef.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Lazy function proxy Arguments: key — if no instance exists with this name, create a new one, otherwise return the existing one.; val — If a Function is given, replace the old function with the new one.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// larger pitch range and lookBack in upper voice, \n// as with most patterns, no automatic array expansion of pattern arguments\n\n(\np = Pbind(\n \\dur, 1/7,\n \\src, Pseg(Pseq([65, 85], inf), 5, \\sin).round,\n \\midinote, Ptuple([\n PIdev(Pkey(\\src), 1, -1, 1),\n PIdev(Pkey(\\src) + 8.5, 3, -5, 5)\n ]).trace(prefix: \"midi \"),\n).play;\n;\n\np.stop\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// larger pitch range and lookBack in upper voice, \n// as with most patterns, no automatic array expansion of pattern arguments\n\n(\np = Pbind(\n \\dur, 1/7,\n \\src, Pseg(Pseq([65, 85], inf), 5, \\sin).round,\n \\midinote, Ptuple([\n PIdev(Pkey(\\src), 1, -1, 1),\n PIdev(Pkey(\\src) + 8.5, 3, -5, 5)\n ]).trace(prefix: \"midi \"),\n).play;\n);\n\np.stop\n```"}]} -{"conversations": [{"role": "user", "content": "How do I use a metronome or check my timing?"}, {"role": "assistant", "content": "A click on the clock you are using, plus a counter to see where you are in the bar:\n\n```supercollider\n(\nTdef(\\click, {\n var count = 0;\n loop {\n (Synth(\\hat, [\\amp, if (count % 4 == 0) { 0.25 } { 0.08 }]));\n count = count + 1;\n 1.wait;\n }\n}).play;\n)\n```\n\nBecause it waits on `TempoClock.default`, it stays in sync with every Pbind you start, which makes it a\ntempo reference rather than a separate sound."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Abusing Convolution2 to make pitch."}, {"role": "assistant", "content": "```supercollider\n// fixed (unchanging) impulse response\n// cmd-. to stop\n\n(\ns.waitForBoot {\n var c = Condition.new, cleanfunc = { CmdPeriod.remove(cleanfunc); b.free };\n fork {\n b = Buffer.alloc(s, 2048, 1);\n CmdPeriod.add(cleanfunc);\n s.sync;\n a = {\n RecordBuf.ar(BrownNoise.ar * EnvGen.ar(Env(#[0, 1, 0], #[0.5, 0.5], \\sin), timeScale: b.duration, doneAction: 2), b, loop: 0);\n 0\n }.play;\n OSCpathResponder(s.addr, ['/n_end', a.nodeID], { |time, resp, msg|\n resp.remove;\n c.unhang;\n }).add;\n c.hang;\n a = {\n var freq = MouseX.kr(150, 450, warp: 1, lag: 0.1);\n LeakDC.ar(Convolution2.ar(Impulse.ar(freq), b, framesize: b.numFrames) * -35.dbamp) ! 2;\n }.play;\n };\n};\n);\n\n\n\n// multiple impulse responses for timbre control\n(\ns.waitForBoot {\n var c = Condition.new, cleanfunc = { CmdPeriod.remove(cleanfunc); b.free };\n fork {\n b = Buffer.allocConsecutive(3, s, 2048, 1);\n CmdPeriod.add(cleanfunc);\n s.sync;\n a = {\n var sig = [BrownNoise.ar, PinkNoise.ar, WhiteNoise.ar];\n sig.do { |chan, i|\n RecordBuf.ar(chan * EnvGen.ar(Env(#[0, 1, 0], #[0.5, 0.5], \\sin), timeScale: b[i].duration, doneAction: 2), b[i], loop: 0);\n 0\n };\n }.play;\n OSCpathResponder(s.addr, ['/n_end', a.nodeID], { |time, resp, msg|\n resp.remove;\n c.unhang;\n }).add;\n c.hang;\n a = {\n var freq = MouseX.kr(150, 450, warp: 1, lag: 0.1),\n index = MouseY.kr(0, 1.99, lag: 0.1),\n iWhole = index.trunc(2),\n iFrac = index - iWhole,\n iAdjust = iFrac >= 1.0,\n trig = Impulse.ar(freq),\n convolvers = b.collect { |buf, i|\n LeakDC.ar(Convolution2.ar(trig, buf, framesize: buf.numFrames))\n };\n (\n XFade2.ar(\n Select.ar(iWhole + (2 * iAdjust), convolvers),\n Select.ar(iWhole + 1, convolvers),\n iFrac.fold(0, 1) * 2 - 1\n ) * -30.dbamp\n ) ! 2;\n }.play;\n };\n};\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `ObjectGui` in SuperCollider briefly."}, {"role": "assistant", "content": "ObjectGui — Controller class for MVC architecture, superclass for all XYZGui classes In the MVC architecture this is the Controller, which creates Views for manipulating the properties of your Model, and receives messages from the View and enacts the changes on the Model. Category: GUI."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for redo_minimalish sketch."}, {"role": "assistant", "content": "```supercollider\n//redFrik - redo_minimalish sketch\n(\ns.waitForBoot{\n \n SynthDef(\\p, {|out= 0, freq= 400, amp= 0.1, gate= 1, detune= 0|\n var env= EnvGen.ar(Env.perc(Rand(0.001, 0.01), LinRand(0.2, 0.4), amp, Rand(-9, -1)), doneAction:2);\n var snd= Mix(SinOsc.ar(freq+[0, detune*0.1], env*2pi));\n Out.ar(out, Pan2.ar(snd*env, Rand(-1, 1)));\n }).add;\n Ndef(\\p, Pspawn(Pbind(\\method,\\par,\\delta,1/8,\\pattern,{Pbind(\\instrument, \\p, \\dur,a=Pseq((1..9).sputter),\\sustain,1/8/a,\\degree,a,\\detune,a)})));\n Ndef(\\p).play(vol:0.5);\n \n Ndef(\\t, {\n var mod= Saw.ar([3, 4], Saw.ar(1, 32, 128), Duty.ar(1, 0, flop(Dseq([0, 8, 1, 5])*[1, 4, 8])));\n var snd= SinOsc.ar(Saw.ar(2, 64, 99), mod)/9;\n CombN.ar(snd, 1/4, 1/4.125, SinOsc.kr(0.005, 1.5pi).range(0, 6));\n });\n Ndef(\\t).play(vol:0.5);\n \n Routine.run({\n var cnt= 1;\n loop{\n var syn;\n cnt= cnt%8+1;\n syn= {\n var del= DelayN.ar(InFeedback.ar(0, 2)+(InFeedback.ar(100, 2)), 1, 1);\n SinOsc.ar(cnt*99+[0, 2], del[1..0])/4;\n }.play(outbus: 64);\n {syn.release(16)}.defer(9-cnt);\n wait(9-cnt);\n };\n });\n Ndef(\\c, {InFeedback.ar(64, 2)}).play(vol:0.5);\n \n Ndef(\\r, {\n var lfos= LFNoise1.ar(0.5!2);\n var snd= Crackle.ar(lfos.range(1.8, 1.98));\n Formlet.ar(snd, TExpRand.ar(200, 2000, lfos).lag(2), lfos.range(5e-4, 1e-3), 0.0012);\n });\n Ndef(\\r).play(vol:0.25);\n \n Routine.run({\n loop{\n var syn= {\n var snd= Pluck.ar(Crackle.ar([1.9, 1.8]), Mix(Impulse.ar({5.linrand+1}!2, -0.125)), 0.05, 0.05.linrand);\n BPF.ar(snd, 2000.rand+100, 0.25.rrand(1.75));\n }.play(s, 62, 18);\n {syn.release(69)}.defer(18);\n wait(18);\n };\n });\n Ndef(\\m, {InFeedback.ar(62, 2)*SinOsc.kr(0.006).range(0.25, 1)}).play(vol:0.5);\n \n NdefMixer(s);\n s.meter;\n};\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for rough sketch of chicago minor chord pad thing."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\\ChicagoPad, { |out = 0, freq = 440, cutoff = 500, amp = 0.2|\n var snd;\n freq = freq + SinOsc.kr(0.1, 0, 1, 20);\n snd = Saw.ar([freq, freq+1, freq-1, freq*3/2, freq*6/5])*0.1;\n snd = snd + VarSaw.ar(0.99*[freq, freq+1, freq-1,freq*3/2, freq*6/5],0, LFTri.kr(0.3).range(0.25,0.9))*0.1;\n snd = Mix(snd);\n snd = RLPF.ar(snd, SinOsc.kr(0.1, 0, 100, 5000), 0.1);\n snd = GVerb.ar(snd ,40, 10, 0.6, 0.6, -3, -9, -11)*0.2;\n \n //snd = RLPF.ar(snd, SinOsc.kr(0.08, 0.5, cutoff/10, cutoff), 0.2);\n snd = MoogFF.ar(snd, SinOsc.kr(0.08, 0.5, cutoff/10, cutoff), 3, 0);\n snd = DelayC.ar(snd, 1.5, 1,0.8);\n //snd = snd * EnvGen.ar(Env.linen(0.001, 0.01,0.01,1), doneAction:2);\n Out.ar(out, [snd, AllpassC.ar(snd, 0.5, 0.05, 0.3)]*amp);\n}).send;\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Hymn #15 - generative melody by array rewriting?"}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\ping, {\n arg freq = 440, pan = 0;\n var sig;\n sig = SinOsc.ar(freq, 0, 0.3);\n sig = sig * EnvGen.ar(Env.perc(0.01, 1), doneAction:2);\n sig = Pan2.ar(sig, pan);\n Out.ar(0, sig)\n}).add;\n);\n\n(\n~scramb = {|pan|\nvar notes = [0,4,7,14,9,12,4,7,9,7];\nvar dur = [1,1,2,3,6,3,4,5,2,1,13];\nvar transp = [0, 5, 7, 3, 2];\nvar scrambRand = {|array|\n var rand = rrand(0, array.size-3);\n var end = rand + rrand(1,2);\n var range = (rand..end);\n var reverseRange = range.reverse;\n var temp = array.copy;\n range.postln;\n range.do({|item, index|\n array[item] = temp[reverseRange[index]];\n });\n array;\n};\nvar octRand = {|array|\n var rand = rrand(0, array.size-1);\n array[rand] = array[rand] + [-12,0,12].choose;\n };\nvar task = Task {\n var step = 0;\n var transpStep = 0;\n loop {\n var freq = (notes.wrapAt(step) + 60 + transp.wrapAt(transpStep)).midicps;\n Synth(\\ping, [\\freq, freq, \\pan, pan]);\n (dur.wrapAt(step) * 0.15).wait;\n step = step + 1 % (notes.size * 12;);\n if (step%32 == 0, {scrambRand.value(notes)});\n if (step%20 == 0, {scrambRand.value(dur)});\n if (step%66 == 0, {transpStep = transpStep + 1 % (transp.size)});\n if (step%24 == 0, {notes = notes.rotate(rrand(-1, 1))});\n if (step%56 ==0, {octRand.value(notes)});\n }\n}.play;\n};\n);\n\n(\n~scramb.value(-0.7);~scramb.value(0.7);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `UnaryOpUGen`?"}, {"role": "assistant", "content": "UnaryOpUGen — Apply a unary operation to the values of an input ugen"}, {"role": "user", "content": "What does `UnaryOpUGen.new` do?"}, {"role": "assistant", "content": "return a new instance that applies the operator `selector` to the ugen `a`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na = WhiteNoise.ar; // a WhiteNoise\nb = a.squared; // a UnaryOpUGen.\nb.operator; // squared\n\n// sound example\n\n{ var a = LFSaw.ar(300).range(0, 2pi); a.sin * 0.1 }.play;\n\n// Plotting the \"abs\" unary operator (via the server):\n\n{ SinOsc.ar(300).abs }.plot\n```"}]} -{"conversations": [{"role": "user", "content": "Synth Iteration Help?"}, {"role": "assistant", "content": "SuperCollider forum — Synth Iteration Help\n\n```supercollider\n(\nSynthDef (\\sine_tone) {\narg freq = 440, amp = 1, len = 1, bus = 0;\nvar sig, env;\nenv = Env.step ([ amp ], [ len ]);\nenv = EnvGen.kr (env, doneAction: 2);\nsig = SinOsc.ar (freq, 0, env);\nOut.ar (bus % 2, sig); // bus modulo 2 here to wrap to stereo\n}.add;\n)\n```\n\nmaybe try wrapping the bus array to [ 0, 1 ] by using modulo: bus % 2. this should let you hear what is going on using a stereo output\n\nby using a Pbind, each “note” is being instantiated as a separate synth with its own length, amplitude, frequency and bus. the doneAction: 2 argument in the EnvGen.kr ugen just means each synth will free itself once it is done playing the note it has been assigned."}]} -{"conversations": [{"role": "user", "content": "Write a bell in SuperCollider."}, {"role": "assistant", "content": "A bell is a set of inharmonic partials with a long percussive decay. The ratios below are the\nclassic bell ones; the envelope frees the Synth when it ends.\n\n```supercollider\n(\nSynthDef(\\bell, { |out = 0, freq = 440, amp = 0.2, dur = 3|\n var partials = [1, 2.76, 5.4, 8.93];\n var amps = [1, 0.5, 0.3, 0.15];\n var sig = SinOsc.ar(freq * partials) * amps;\n var env = EnvGen.kr(Env.perc(0.001, dur, 1, -6), doneAction: 2);\n Out.ar(out, Pan2.ar(Mix(sig) * env * amp, 0));\n}).add;\n);\nSynth(\\bell, [\\freq, 660, \\dur, 4]);\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// example: two SuperCollider apps communicating\n\n// application 1:\nn = NetAddr(\"127.0.0.1\", 57120); // the url should be the one of computer of app 2 (or nil)\n\no = OSCresponderNode(n, '/chat', { |t, r, msg| (\"time:\" + t).postln; msg[1].postln }).add;\n\n// application 2:\nm = NetAddr(\"127.0.0.1\", 57120); // the url should be the one of computer of app 1\nm.sendMsg(\"/chat\", \"Hello App 1\");\n\n// sending bundles (including timestamps)\n(\nm.sendBundle(2.0, [\"/chat\", \"Hello App 1\"], [\"/chat\", \"Hallo Wurld\n// …\n```"}, {"role": "assistant", "content": "example: two SuperCollider apps communicating sending bundles (including timestamps) (OSCresponderNode: client side network responder)"}]} -{"conversations": [{"role": "user", "content": "What does `Window.view` do?"}, {"role": "assistant", "content": "When a Window is created, it creates a container view, accessible using this method, that occupies the whole area of the window, and which will be used as the actual parent of the child Returns: A View."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n/*\n( // PlayerBinop not yet implemented\n\nPatch(\\monosynth,[\n BeatClockPlayer.new(16) * MIDIGatePlayer.new,\n MIDIFreqPlayer.new,\n CCPlayer(50,[100,3000,\\exp,0.0,1500.0]),\n CCPlayer(51,[0.1,0.9,\\exp,0.0,0.2]),\n CCPlayer(52,[0.05,1.0])\n]).play\n\n\n*/\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n/*\n( // PlayerBinop not yet implemented\n\nPatch(\\monosynth,[\n BeatClockPlayer.new(16) * MIDIGatePlayer.new,\n MIDIFreqPlayer.new,\n CCPlayer(50,[100,3000,\\exp,0.0,1500.0]),\n CCPlayer(51,[0.1,0.9,\\exp,0.0,0.2]),\n CCPlayer(52,[0.05,1.0])\n]).play\n\n)\n*/\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Ndef`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\nNdef(\\a).play; // play to hardware output.\nNdef(\\a).fadeTime = 2; // fadeTime specifies crossfade\n// set the source\nNdef(\\a, { SinOsc.ar([350, 351.3], 0, 0.2) });\nNdef(\\a, { Pulse.ar([350, 351.3] / 4, 0.4, 0.2) });\nNdef(\\a, Pbind(\\dur, 0.03, \\freq, Pbrown(0, 1, 0.1, inf).linexp(0, 1, 200, 350)));\n\nNdef(\\a, { Ringz.ar(Ndef.ar(\\b), [350, 351.3] * 2, 0.4) });\nNdef(\\b, { Impulse.ar([5, 7]/2, [0, 0.5], 0.15) });\n\nNdef.clear(3); // clear all after 3 seconds\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// vary frequency - these parameters are for \"one-pulse\" orbit\n{ RosslerL.ar(MouseX.kr(20, SampleRate.ir), 0.36, 0.35, 4.5) * 0.3 }.play(s);\n\n// randomly modulate params\n(\n{ RosslerL.ar(\n SampleRate.ir, \n 0.2, // First variable tends to lead to NaN if modulated in this example\n LFNoise0.kr(1, 0.01, 0.2),\n LFNoise0.kr(1, 0.2, 0.7)\n) * 0.2 }.play(s);\n)\n\n// as a frequency control\n{ SinOsc.ar(Lag.ar(RosslerL.ar(MouseX.kr(1, 200)))*800+900)*0.4 }.play\n// …\n```"}, {"role": "assistant", "content": "vary frequency - these parameters are for \"one-pulse\" orbit randomly modulate params (RosslerL: Rossler chaotic generator)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nfork {\n { SinOsc.ar(440 ! 2) * Line.kr(0, 1, 5, doneAction: Done.freeSelf) }.play.waitForFree;\n { PinkNoise.ar(1) * Line.kr(1, 0, 2, doneAction: Done.freeSelf) }.play.onFree { \"done\".postln };\n}\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nfork {\n { SinOsc.ar(440 ! 2) * Line.kr(0, 1, 5, doneAction: Done.freeSelf) }.play.waitForFree;\n { PinkNoise.ar(1) * Line.kr(1, 0, 2, doneAction: Done.freeSelf) }.play.onFree { \"done\".postln };\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Pan2` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\ns.bind {\n SynthDef(\"tpulse2\", { arg out=0, freq=700, sawFreq=440.0;\n Out.ar(out, Pan2.ar(SyncSaw.ar(freq, sawFreq, 0.1), SinOsc.kr(8)) )\n }).send(s);\n s.sync; // wait until synthdef is loaded\n x = Synth.new(\"tpulse2\");\n a = Bus.control.set(440);\n x.map(\\freq, a);\n};\n);\n\na.free; x.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Impulse`."}, {"role": "assistant", "content": "```supercollider\n{ Impulse.ar(800, 0.0, 0.5, 0) }.play\n\n{ Impulse.ar(XLine.kr(800, 100, 5), 0.0, 0.5, 0) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// default params\n{ QuadC.ar(SampleRate.ir/4) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// default params\n{ QuadC.ar(SampleRate.ir/4) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\ns.boot;\n\n(\nSynthDef(\"lazerdrone\", {\n var in, freq, hasFreq;\n\n \n in = SinOsc.ar(440 * LFSaw.kr(100, 1000));\n\n # freq, hasFreq = Pitch.kr(\n in,\n ampThreshold: 0.09,\n median: 1);\n freq = freq * hasFreq;\n //freq.poll;\n \n SinOsc.kr(freq).poll;\n \n Out.ar(0, in + \n SinOsc.ar(440, \n 0, \n Clip.kr(\n SinOsc.kr(freq), \n 0)\n )\n );\n}).play;\n)\n```"}, {"role": "assistant", "content": "A lazer sound then a drone with morse-code like bleeps. A byproduct of testing the triggering algorithm in the mono2eN SynthDef."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `HPF`."}, {"role": "assistant", "content": "```supercollider\n{ HPF.ar(Saw.ar(200, 0.1), FSinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3600, 4000), 5) }.play;\n\n(\n{ var ctl = HPF.kr(LFSaw.kr(5), SinOsc.kr(XLine.kr(0.07, 30, 20), 0, 35, 40)) ;\n SinOsc.ar(ctl * 200 + 500);\n}.play;\n);\n\n(\n{ var ctl = HPF.kr(LFSaw.kr(5, 0.1), MouseX.kr(2, 200, 1));\n SinOsc.ar(ctl * 200 + 400) * 0.1;\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SCDoc.helpTargetDir` do?"}, {"role": "assistant", "content": "get/set the user help target directory. Defaults to `Platform.userAppSupportDir +/+ \"Help\"` and should typically not be changed by the"}]} +{"conversations": [{"role": "user", "content": "Explain `Wavetable` in SuperCollider briefly."}, {"role": "assistant", "content": "Wavetable — sampled audio buffer in wavetable format A Wavetable is a FloatArray in a special format used by SuperCollider's interpolating oscillators. Wavetables cannot be created by new. Category: Collections > Ordered."}]} {"conversations": [{"role": "user", "content": "What is `PLbindef`?"}, {"role": "assistant", "content": "PLbindef — wrapper for Pbindef which allows replacement in object prototyping style"}, {"role": "user", "content": "What does `PLbindef.new` do?"}, {"role": "assistant", "content": "Creates a new PLbindef object or sets sources as with Pbindef."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n// synthdefs to play with\n\n(\nSynthDef(\\noise_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, rq = 0.1, amp = 0.1|\n var sig = { WhiteNoise.ar } ! 2;\n sig = BPF.ar(sig, freq, rq) *\n EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2) *\n (rq ** -1) * (250 / (freq ** 0.8));\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\sin_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { SinOsc.ar(freq, Rand(0, 2pi)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\saw_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { VarSaw.ar(freq, Rand(0, 1)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `OSCSched.qsched` do? What arguments does it take?"}, {"role": "assistant", "content": "will happen at the next even division ( 4.0 means on the downbeat of a 4/4 bar ), or immediately if you happen to be exactly on a Arguments: quantize; server; bundle; onArrival."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Re: Re: the perfect frequencies?"}, {"role": "assistant", "content": "```supercollider\n(\nf = {\n var rep = [4, 8, 16, 32];\n var n = rep.choose;\n var x = [\n\n 54, 60, 66, 72, 81, 90, 96, 102,\n 108, 128, 132, 144, 162, 180, 192, 204,\n 216, 240, 264, 288, 324, 360, 384, 408,\n 432, 480, 528, 576, 648, 720, 768, 816,\n 864, 960, 1056, 1152, 1296, 1440, 1536, 1632,\n 1728, 1920, 2112, 2304, 2592, 2880, 3072, 3264,\n 3456, 3840, 4224, 4608, 5184, 5760, 6144, 6528,\n 6912, 7680, 8448, 9216, 10368, 11520, 12288, 528\n\n ];\n var fac1 = [1,10,100,1000].choose;\n var fac2 = [1,10,100,1000].choose;\n var fac3 = [1,10,100,1000].choose;\n Mix.fill(n,\n {\n var detune = 5.rand;\n var saw;\n var sin;\n detune = XLine.kr(0.1,1+250.0.rand ,2+9.0.rand) * 2.0.rand* [1,-1].choose;\n sin = SinOsc.ar(x.choose * ( 1 + ( SinOsc.ar(x.choose/fac1) * x.choose/fac2 )) + detune, 4.rand, 0.25);\n saw = RLPF.ar(Saw.ar(x.choose*0.01+detune, 0.75), x.choose, 2.rand);\n saw = [\n saw,\n saw.fold2( SinOsc.ar(x.choose/fac3).range(0.1,1) ),\n saw.wrap2( SinOsc.ar(x.choose/fac3).range(0.1,1) ),\n saw * SinOsc.ar(x.choose/2),\n ( saw * SinOsc.ar(x.choose/fac3).range(1,20) ).tanh/2,\n ].choose;\n Pan2.ar((sin+saw) * EnvGen.kr(Env.sine(12, 1/n), 1, doneAction:2),\n 1.rand2) \n }\n );\n};\n);\n\n(\n// DEFINE A ROUTINE\nr = Routine({\n\n inf.do({\n f.play;\n 10.wait;\n })\n});\n);\n\nr.reset.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n~buf = Buffer.read(s, \"C:/sounds/break.wav\");\nPlayBuf.ar(1, ~buf, BufRateScale.kr(~buf), loop: 1);\n```"}, {"role": "assistant", "content": "Loads a sound file into server memory, then plays it in a loop at the file's original pitch.\n\n- `Buffer.read(s, path)` allocates a buffer on the server and fills it from the file. It is asynchronous:\n the Buffer object returns immediately, the samples arrive later.\n- `PlayBuf.ar(1, buf, ...)` needs the channel count first — 1 for a mono file. A wrong count is the usual\n cause of a buffer that plays wrongly or not at all.\n- `BufRateScale.kr(buf)` compensates when the file's sample rate differs from the server's, so `rate: 1` is\n the file's true speed.\n- `loop: 1` restarts at the end instead of stopping.\n\nBecause the read is asynchronous, this line pair is only safe if a `s.sync` or a wait happened in between;\notherwise PlayBuf sees a buffer with no data yet."}]} -{"conversations": [{"role": "user", "content": "What is `LFNoise0` in SuperCollider?"}, {"role": "assistant", "content": "LFNoise0 — Step noise Generates random values at a rate given by the nearest integer division of the sample rate by the `freq` argument. Category: UGens > Generators > Stochastic."}]} -{"conversations": [{"role": "user", "content": "Speech to midi converter?"}, {"role": "assistant", "content": "SuperCollider forum — Speech to midi converter?\n\nHello!\n\nI want to make a speech to midi converter in Supercollider.\n\nI’ve started off trying to find a way to convert FFT data to midi-numbers to send to a midi-instrument, but I’m stuck:\n\n```supercollider\n~file = Buffer.read(s, \"path_to_file\", bufnum:1);\n\n(\n{\n var buf = Buffer.alloc(s, 2048, bufnum:2);\n var sig = PlayBuf.ar(2, 1, loop:1);\n var chain = FFT(buf, sig);\n var trig = Impulse.kr(30);\n chain[0].pvcalc(80, {\n |phas, mag|\n SendReply.kr(trig, \"/anal\", mag);\n });\n}.play\n);\n\n(\nOSCdef.new(\\midiConverter, {\n |msg|\n msg.postln;\n}, \"/anal\");\n)\n```\n\nthe output looks like this:\n\n[ /anal, 1000, -1, 0.0, 3.0463190078735, 2.1142015457153, -0.64955651760101, 2.3432319164276, -0.23956227302551, -3.1334409713745, -2.1829152107239, 1.1417833566666, -2.2972648143768, -0.74415707588196, -0.88793164491653, 1.9947071075439, -1.1327115297318, 2.6084003448486, etc...]\n\nI’m not sure how to interpret theese numbers. And I’m not sure pvcalc is even the best way to get the data I need. I want to somehow be able to control the resolution on how many of the loudest bins I’m going to convert to frequency and then from frequency to midi-number to send to a midi-instrument as the soundfile plays through.\n\nAny ideas?"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n var time = 30;\n var line = Line.kr(3000, 290, time);\n var line2 = Line.kr(280, 290, time);\n var line3 = Line.kr(0.01, 10, time);\n var sin = Mix.ar(SinOsc.ar([line, line2]) * SinOsc.ar(line3));\n var comb = CombC.ar(sin, time, SinOsc.kr(0.1).range(0.1, 0.2), time);\n var env = EnvGen.ar(Env.linen(0.01, time, 10), 1, doneAction:2);\n comb * env * 0.05!2;\n}.play\n)\n```"}, {"role": "assistant", "content": "Here is some quick code that sounds like an old sci-fi UFO landing."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// so this does not expand:\nPbind(\\degree, [Pseq([0, 2, 3], inf), Pseq([2, 4, 5, 6], inf)]).play;\n\n// but this does:\nPbind(\\degree, Pseq([[0, 2], [2, 4], [3, 5], [0, 6]], inf).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// so this does not expand:\nPbind(\\degree, [Pseq([0, 2, 3], inf), Pseq([2, 4, 5, 6], inf)]).play;\n\n// but this does:\nPbind(\\degree, Pseq([[0, 2], [2, 4], [3, 5], [0, 6]], inf)).play;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `RedEffectModuleGUI` in SuperCollider briefly."}, {"role": "assistant", "content": "RedEffectModuleGUI — gui for effect modules A standardized gui for RedEffectModules. Category: Red > redModule."}]} -{"conversations": [{"role": "user", "content": "Explain `SPlayFileDiskView` in SuperCollider briefly."}, {"role": "assistant", "content": "SPlayFileDiskView — a sound file player that streams from disk A GUI for LINKClasses/SplayFileDisk (streaming soundfiles from disk). Category: SInstruments."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pbindef`."}, {"role": "assistant", "content": "```supercollider\nPbindef(\\x, \\note, Pseq([0, 7, 9]), \\dur, 0.2).play;\n```"}]} -{"conversations": [{"role": "user", "content": "A starting point to start experimenting with non-standard synthesis?"}, {"role": "assistant", "content": "SuperCollider forum — A starting point to start experimenting with non-standard synthesis?\n\nI while ago I did this noise cloud generator which might serve as inspiration. Other ideas: scramble signals with FFT tools, granular synthesis, FM-synthesis with extreme settings, like index-of-modulation = 4000.\n\n```supercollider\nSynthDef(\\clouds, {\n var num = 10;\n var dur = \\duration.kr(1/6);\n var sig = num.collect{\n var freq = Rand(30, 5000) * SinOsc.kr(LFNoise1.kr(dur).range(30, 1000), 0, LFNoise1.kr(dur)\n .range(0.01, 8)).midiratio;\n var sig = Select.ar(LFNoise0.kr(dur).range(0, 2).round,\n [SinOsc.ar(freq, 0, 0.3), Saw.ar(freq, 0.3), Pulse.ar(freq, 0, 0.3)]);\n var filtFreq = Rand(30, 1000) * LFNoise1.kr(dur).range(1.0, 5.0);\n var filt = Select.ar(LFNoise0.kr(dur).range(0, 2).round,\n [LPF.ar(sig, filtFreq), HPF.ar(sig, filtFreq), BPF.ar(sig, filtFreq)]\n );\n sig = CombL.ar(filt, 0.5, LFNoise1.kr(dur).range(0.02, 0.5), rrand(0.3, 2));\n sig\n };\n var env = Env.perc(\\atk.kr(0.02), \\rel.kr(6), 1, \\cur.kr(-4)).ar(2);\n sig = Splay.ar(sig); // nb! levelComp: true, so if removed signal will be extremely loud!\n sig = LPF.ar(sig, 2000);\n sig = FreeVerb2.ar(sig[0], sig[1], LFNoise1.kr(dur).range(0, 1.0), LFNoise1.kr(dur).range(0.2, 2));\n sig = sig * env * \\amp.kr(1);\n Out.ar(\\out.kr(0), sig)\n}).add;\n\nSynth(\\clouds, [\\atk, rrand(0.01, 2), \\rel, rrand(1, 6.0), \\duration, rrand(0.01, 1)])\n// run it several times, the outcome is highly random\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pgtpar`."}, {"role": "assistant", "content": "```supercollider\n// synthdef\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n}).add;\n);\n\n// pattern with different start times\n(\nx = Pbind(\n \\instrument, \\help_sinegrain,\n \\degree, Pseq(#[0, 5, 4, 2, 1, 1, 3], inf),\n \\dur, Pseq(#[0.25, 0.5, 1.0], inf),\n \\scale, #[0, 3, 5, 9, 10]\n);\na = Pbus(Pgtpar([0.0, x, 1.5, x, 2.25, x])).play;\n);\ns.plotTree;\na.stop;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `CutMixer.new` do? What arguments does it take?"}, {"role": "assistant", "content": "BBCut2 volume and panning control Arguments: outbus — Bus number for final output. The stereo output will be placed on this bus plus the one above. The default is thus 0 and 1.; volume — output volume multiplier. Defaults to 1.0.; ampfunc — Something that responds to .value and returns a cut's amplitude. This is called for every repeat in a BBCutBlock . The first argument is the repeat number in the block, and the second argument is the block itself. If ampfunc responds to .updateblock, that will also be called every block with the cur; panfunc — Something that responds to .value and returns a cut's pan position. This is called for every repeat in a BBCutBlock . The first argument is the repeat number in the block, and the second argument is the block itself. If panfunc responds to .updateblock, that will also be called every block with the ."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\\reblock_and_resample, { |out, blockSize=4|\n Resample(2); // 2x upsampling\n BlockSize(blockSize); // downblocking\n Out.ar(out, SinOsc.ar(440) * 0.1);\n}).add;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\\reblock_and_resample, { |out, blockSize=4|\n Resample(2); // 2x upsampling\n BlockSize(blockSize); // downblocking\n Out.ar(out, SinOsc.ar(440) * 0.1);\n}).add;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `RangeSlider.increment` do? What arguments does it take?"}, {"role": "assistant", "content": "Increments both #-lo and #-hi by #-step multiplied by Arguments: factor — A Float.."}]} -{"conversations": [{"role": "user", "content": "What does `InspButton.new` do? What arguments does it take?"}, {"role": "assistant", "content": "displays an object by its name, when clicked the object is inspected using Insp Arguments: target — the object to be inspected; layout — the parent view, FlowView or window; minWidth — Label will automatically size itself to fit the name. minWidth specifies a minimum width so that multiple labels will align nicely.."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `IFFT`."}, {"role": "assistant", "content": "```supercollider\n// without any modification, convert FFT chain (frequency domain signal) back to audio (time domain signal)\n(\n{ var in, chain;\n in = WhiteNoise.ar;\n chain = FFT(LocalBuf(2048), in);\n IFFT.ar(chain) * -20.dbamp // inverse FFT\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for mixolydian flat six meditation in pythagorean?"}, {"role": "assistant", "content": "```supercollider\n// last updated on sccode.org fri 7. jun, 14:57 CET\n\n( // load this first - synth def\nSynthDef(\\harpsi, { \n arg outbus = 0, freq = 440, ffreq = 2, amp = 1, gate = 1, release = 1;\n var out;\n freq = freq * Rand(1, 1.005);\n out = EnvGen.ar(Env.adsr(releaseTime:release), gate, doneAction: Done.freeSelf)\n * amp * Pulse.ar([freq,freq*1.005]/1, 0.25, mul:0.75 );\n out = out * [Rand(0.0, 1.0), Rand(0.0, 1.0)];\n out = RLPF.ar(out, freq * (ffreq / 4) + 1 );\n Out.ar(outbus, out); \n}).add; \n);\n\n\n( // then run this - sequence\nTempoClock.default.tempo = 1.4;\n~scale = Scale.new(#[0,2,4,5,7,8,10],tuning: \\pythagorean, name: \"mixolydianb6\");\np = Pbind(\n \\instrument, \\harpsi,\n \\root, -12,\n \\scale, ~scale,\n \\ffreq, Pseq(((1..2) ++ (3..1)),inf),\n \\degree, Pseq([\n Pseries({ rrand(0, 7) }, { ([1,2]).choose }, { rrand(4, 8) }),\n Pseries({ rrand(0, 7) }, {([1,2]).choose}, { rrand(4, 8) }),\n Pseries({ rrand(7, 14) }, 0-{([1,2]).choose}, { rrand(4, 8) })\n ], inf),\n \\release, Prand([5,6,7,8],inf),\n \\dur, Prand((1..8)/4, inf),\n \\amp, Prand(((1..8)/8)+1, inf)\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// same as above, but we set the address to nil so we can receive from anywhere\n// no need for a NetAddr since we are just listening (and not sending)\n\no = OSCresponderNode(nil, '/test', { |t, r, msg| msg.postln }).add;\no.remove;\n```"}, {"role": "assistant", "content": "same as above, but we set the address to nil so we can receive from anywhere no need for a NetAddr since we are just listening (and not sending) (OSCresponderNode: client side network responder)"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ HPF.ar(Saw.ar(200, 0.1), FSinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3600, 4000), 5) }.play;\n\n(\n{ var ctl = HPF.kr(LFSaw.kr(5), SinOsc.kr(XLine.kr(0.07, 30, 20), 0, 35, 40)) ;\n SinOsc.ar(ctl * 200 + 500);\n}.play;\n);\n\n(\n{ var ctl = HPF.kr(LFSaw.kr(5, 0.1), MouseX.kr(2, 200, 1));\n SinOsc.ar(ctl * 200 + 400) * 0.1;\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ HPF.ar(Saw.ar(200, 0.1), FSinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3600, 4000), 5) }.play;\n\n(\n{ var ctl = HPF.kr(LFSaw.kr(5), SinOsc.kr(XLine.kr(0.07, 30, 20), 0, 35, 40)) ;\n SinOsc.ar(ctl * 200 + 500);\n}.play;\n);\n\n(\n{ var ctl = HPF.kr(LFSaw.kr(5, 0.1), MouseX.kr(2, 200, 1));\n SinOsc.ar(ctl * 200 + 400) * 0.1;\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// Analogizer\n// a quick draft of a model of the EHX Analogizer pedal\n// some info from \"https://www.bassic.de/threads/electro-harmonix-ehx-analogizer.14865686/\"\n\ns.default\ns.boot\n\n// used this for testing: https://www.freesound.org/people/wescwave/sounds/169885/\n~buf = Buffer.read(s, \"169884__wescwave__double-bass-test2.wav\");\n\n(\n~x.free;\n~x = {\n var a, d, s;\n\n a = PlayBuf.ar(2, ~buf, 1, 1, 0, 1);\n a = a.sum!2; // go mono to make the effect more prominent\n\n // the \"distortion modeling\" could use some more love...\n s = (a * MouseY.kr(26/2, 0).dbamp).tanh;\n s = s * MouseY.kr(-16/2, 0).dbamp;\n\n // a simple delay\n d = DelayC.ar(s, 0.1, MouseX.kr(3.5/1000, 65/1000));\n\n // dry/wet...\n a = a + (d * MouseY.kr(0, -96).dbamp);\n\n Out.ar(0, a);\n}.play\n)\n```"}, {"role": "assistant", "content": "The EHX Analogizer (http://www.ehx.com/products/analogizer) is a guitar pedal that apparently consists of a ultra-short delay with some gain stage. It's supposed to \"fatten\" and somehow \"spread\" the sound to make it appear more \"analog\" (thus: dirty). I wanted to quickly test the effect myself.\r\n\r\nI guess with some additional care of the distortion stage and maybe some very little modulation (ster."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Rest`."}, {"role": "assistant", "content": "```supercollider\n(\nPbind(\n \\degree, Pif(\n 0.1.loop.coin,\n Pseq([Rest(), 7], inf), // every second is a Rest\n Pseries(0, 1, inf).fold(-7, 7)\n ),\n \\dur, 0.125\n).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does Splay.ar do?"}, {"role": "assistant", "content": "`Splay.ar(inArray, spread, level, center, levelComp)` takes an array of mono signals and distributes them across the stereo field, so `Splay.ar(SinOsc.ar([220, 330, 440]) * 0.1)` is a three-source stereo chord rather than three separate synths. spread (0..1) controls how far the voices fan out and center shifts the middle. It is the shorthand for 'make this array stereo'."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// mixer parametric eq as wahwah\n{ MidEQ.ar(Saw.ar(200, 0.2), FSinOsc.kr(1, 0, 24, 84).midicps, 0.3, 12) }.play\n\n\n// notch filter\n(\n{ var in;\n in = PinkNoise.ar(0.2) + SinOsc.ar(600, 0, 0.1);\n MidEQ.ar(in, SinOsc.kr(0.2, 0.5pi) * 2 + 600, 0.01, -24)\n}.play\n);\n\n/////\n// first start the synth\n(\nx = { |freq = 400, db = 0, rq = 0.1|\n var in;\n in = SinOsc.ar([400, 420], 0, 0.4);\n MidEQ.ar(in, freq\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// mixer parametric eq as wahwah\n{ MidEQ.ar(Saw.ar(200, 0.2), FSinOsc.kr(1, 0, 24, 84).midicps, 0.3, 12) }.play\n\n\n// notch filter\n(\n{ var in;\n in = PinkNoise.ar(0.2) + SinOsc.ar(600, 0, 0.1);\n MidEQ.ar(in, SinOsc.kr(0.2, 0.5pi) * 2 + 600, 0.01, -24)\n}.play\n);\n\n/////\n// first start the synth\n(\nx = { |freq = 400, db = 0, rq = 0.1|\n var in;\n in = SinOsc.ar([400, 420], 0, 0.4);\n MidEQ.ar(in, freq, Lag.kr(rq, 0.3), db)\n }.play\n);\n\n// now play with its parameters to hear how the filter affects two frequencies\n// that are very close to each other\n\nx.set(\\db, -12)\nx.set(\\rq, 0.1)\nx.set(\\rq, 0.03)\nx.set(\\freq, 410)\nx.set(\\freq, 420)\nx.set(\\freq, 400)\nx.set(\\freq, 500)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `ProxySynthDef.new` do? What arguments does it take?"}, {"role": "assistant", "content": "synth def that wraps ugen graph Arguments: name — like in SynthDef. todo: add variants.; func — like in SynthDef. todo: add variants.; rates — like in SynthDef. todo: add variants.; prependArgs — like in SynthDef. todo: add variants.; makeFadeEnv — if true it constructs a fader envelope and adds controls for gate and fadeTime; channelOffset — a constant offset that is added to the out number; chanConstraint — max numChannels for the synthdef. If ugenfunc returns a larger array, it wraps; rateConstraint — a symbol like \\audio, \\control or \\scalar.."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Done`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"Done-help\", { |out, t_trig|\n var line, a, b;\n\n line = Line.kr(1, 0, 1);\n\n a = SinOsc.ar(440, 0, 0.1*line); // sound fading out\n b = WhiteNoise.ar(Done.kr(line)*0.1); // noise starts at end of line\n\n Out.ar(out, Pan2.ar(a+b));\n}).add;\n);\n\nSynth(\"Done-help\"); // note that this synth doesn't have it's own doneAction, so you'll need to manually deallocate it\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PV_MagMul`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\nb = Buffer.read(s, ExampleFiles.child);\n\n(\nSynthDef(\"help-magMul\", { |out = 0|\n var inA, chainA, inB, chainB, chain;\n inA = WhiteNoise.ar(0.2);\n inB = LFSaw.ar(100, 0, 0.2);\n chainA = FFT(LocalBuf(2048), inA);\n chainB = FFT(LocalBuf(2048), inB);\n chain = PV_MagMul(chainA, chainB);\n Out.ar(out, 0.1 * IFFT(chain).dup);\n}).play(s);\n);\n\n(\nSynthDef(\"help-magMul2\", { |out = 0, soundBufnum = 2|\n var inA, chainA, inB, chainB, chain;\n inA = LFSaw.ar([100, 150], 0, 0.2);\n inB = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);\n chainA = FFT(LocalBuf(2048), inA);\n chainB = FFT(LocalBuf(2048), inB);\n chain = PV_MagMul(chainA, chainB);\n Out.ar(out, 0.03 * IFFT(chain));\n}).play(s, [\\soundBufnum, b.bufnum]);\n);\n\nb.free\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// same as above, but we set the address to nil so we can receive from anywhere\n// no need for a NetAddr since we are just listening (and not sending)\n\no = OSCresponderNode(nil, '/test', { |t, r, msg| msg.postln }.add;\no.remove;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// same as above, but we set the address to nil so we can receive from anywhere\n// no need for a NetAddr since we are just listening (and not sending)\n\no = OSCresponderNode(nil, '/test', { |t, r, msg| msg.postln }).add;\no.remove;\n```"}]} -{"conversations": [{"role": "user", "content": "What is `TrigSpec` in SuperCollider?"}, {"role": "assistant", "content": "TrigSpec — datatype specifying a 'trig' rate input or output Category: Spec, Libraries > crucial > Spec."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n\n~remapConfig = IdentityDictionary[\n 0 -> 1,\n 1 -> 2,\n 2 -> 3,\n 3 -> 4,\n 4 -> 5,\n 5 -> 6,\n 6 -> 7,\n 7 -> 8,\n 8 -> 9,\n 9 -> 12,\n 10 -> 13,\n 11 -> 14,\n 12 -> 15,\n 13 -> 16,\n 14 -> 17\n];\n\n\n~generateRemapSynthDef = { |numInputChannels, numOutputChannels|\n SynthDef(\\remapOutputs, {\n var sig = In.ar(0, numInputChannels); \n var remapped = Array.fill(numOutputChannels, { Silent.ar(1) }); \n\n ~remapConfig.keysValuesDo { |src, dest|\n if (src < numInputChannels and: { dest < numOutputChannels }) {\n remapped[dest] = sig[src];\n }\n };\n\n ReplaceOut.ar(0, remapped);\n }).add;\n};\n\n~generateRemapSynthDef.(16, 18); \n);\n\n(\n~createRemapSynth = {\n ~remapSynth = Synth(\\remapOutputs, target: s.defaultGroup, addAction: \\addAfter);\n};\n\nServerTree.add( ~createRemapSynth);\n\n)\n```"}, {"role": "assistant", "content": "This code sets up a remapping system where input channels are mapped to output channels based on a predefined configuration. The remapping is done using a SynthDef that reads input signals, applies the remapping, and outputs the remapped signals. The ServerTree.add ensures that the remap synth is created and added to the server's node tree upon server startup and cmd-. and ctrl-.\r\n\r\nBased on discu."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\na = Synth(\\MoaningDialogue)\n\n//COOL TWEAKS\n//AngryTweak\na.set(\\feedback, 29,\\freq, 6)\n//CalmTweak\na.set(\\feedback, 60, \\freq, 0.8)\n//WeirdTweak\na.set(\\feedback, 2.8, \\freq, 2)\n\n(\nSynthDef(\\MoaningDialogue, {\n |rateL = 0.2, rateR = 0.3, freq = 2, feedback = 50, mul = 1 , lpfreq = 2500|\n Out.ar(0,\n FreeVerb.ar(\n BLowPass.ar(\n SinOscFB.ar(\n LFDNoise1.kr([rateL, rateR], freq), feedback;\n , mul),\n lpfreq,\n 0.2\n ),\n 0.3,\n 0.0\n )\n )}\n).add\n)\n```"}, {"role": "assistant", "content": "One of the first synths I made.\r\nA frog-like sounding synth, with a dialogue between the left and the right channel.\r\nI've also notated some simple tweaks."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Sinking in the Ocean (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nx= {\n var lfn = LFNoise2.kr(1);\n var saw = Saw.ar(\n freq: 30,\n mul: LFPulse.kr(\n freq: LFNoise1.kr(1).range(1, 5),\n width: 0.1));\n var bpf = BPF.ar( in: saw, freq: lfn.range(300, 1000), rq: 0.01, mul: 20);\n Pan2.ar(in: bpf, pos: lfn);\n}.play;\n\n\n{LPF.ar(\n in: WhiteNoise.ar(mul: 0.2),\n freq: LFNoise1.kr(1).range(100, 1000)\n)\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "A starting point to start experimenting with non-standard synthesis?"}, {"role": "assistant", "content": "SuperCollider forum — A starting point to start experimenting with non-standard synthesis?\n\nI while ago I did this noise cloud generator which might serve as inspiration. Other ideas: scramble signals with FFT tools, granular synthesis, FM-synthesis with extreme settings, like index-of-modulation = 4000.\n\n```supercollider\nSynthDef(\\clouds, {\n var num = 10;\n var dur = \\duration.kr(1/6);\n var sig = num.collect{\n var freq = Rand(30, 5000) * SinOsc.kr(LFNoise1.kr(dur).range(30, 1000), 0, LFNoise1.kr(dur)\n .range(0.01, 8)).midiratio;\n var sig = Select.ar(LFNoise0.kr(dur).range(0, 2).round,\n [SinOsc.ar(freq, 0, 0.3), Saw.ar(freq, 0.3), Pulse.ar(freq, 0, 0.3)]);\n var filtFreq = Rand(30, 1000) * LFNoise1.kr(dur).range(1.0, 5.0);\n var filt = Select.ar(LFNoise0.kr(dur).range(0, 2).round,\n [LPF.ar(sig, filtFreq), HPF.ar(sig, filtFreq), BPF.ar(sig, filtFreq)]\n );\n sig = CombL.ar(filt, 0.5, LFNoise1.kr(dur).range(0.02, 0.5), rrand(0.3, 2));\n sig\n };\n var env = Env.perc(\\atk.kr(0.02), \\rel.kr(6), 1, \\cur.kr(-4)).ar(2);\n sig = Splay.ar(sig); // nb! levelComp: true, so if removed signal will be extremely loud!\n sig = LPF.ar(sig, 2000);\n sig = FreeVerb2.ar(sig[0], sig[1], LFNoise1.kr(dur).range(0, 1.0), LFNoise1.kr(dur).range(0.2, 2));\n sig = sig * env * \\amp.kr(1);\n Out.ar(\\out.kr(0), sig)\n}).add;\n\nSynth(\\clouds, [\\atk, rrand(0.01, 2), \\rel, rrand(1, 6.0), \\duration, rrand(0.01, 1)])\n// run it several times, the outcome is highly random\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for load all files for the hyperdisco setup."}, {"role": "assistant", "content": "```supercollider\n//// load all files for the hyperdisco setup.\n\nq = q ? ();\nq.hyperfolder = q.hyperfolder ?? { thisProcess.nowExecutingPath.dirname };\n\n(q.hyperfolder +/+ \"libs/_SynthLib.scd\").loadPaths;\n(q.hyperfolder +/+ \"libs/_FXLib.scd\").loadPaths;\n(q.hyperfolder +/+ \"setup_files/2_makeHistory.scd\").loadPaths;\n\nif (Platform.hasQt) {\n (q.hyperfolder +/+ \"setup_files/1a_Butz.scd\").loadPaths;\n (q.hyperfolder +/+ \"setup_files/1b_winbounds.scd\").loadPaths;\n (q.hyperfolder +/+ \"setup_files/2b_makeHistoryGUI.scd\").loadPaths;\n};\n\n// this may be too harsh - comment out if not needed!\nServer.killAll;\n\nTask {\n try { (q.hyperfolder +/+ \"setup_files/1_logMeIn.scd\").loadPaths } {\n \"*** setup_files/1_logMeIn.scd failed!\".postln;\n };\n 1.wait;\n\n (q.hyperfolder +/+ \"setup_files/3_runCode*.scd\").loadPaths;\n\n // this could be problematic,\n if (Platform.hasQt) {\n // maybe we need a non-doc- SyncText version?\n (q.hyperfolder +/+ \"setup_files/4_makeSyncedEditor.scd\").loadPaths;\n // sent drawing code will just be ignored ...\n /// would be nice if it did get shown!\n (q.hyperfolder +/+ \"setup_files/5_drawer.scd\").loadPaths;\n };\n\n s.options.memSize = (2 ** 18).asInteger;\n s.waitForBoot {\n s.sync;\n (q.hyperfolder +/+ \"setup_files/6_HyperMasterFX.scd\").loadPaths;\n };\n\n}.play(AppClock);\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n \n// definition for future reference in arbitrary Environments,\n// Gauss distribution is not bounded, so do clip !\n\n(\np = Pbind(\n \\midinote, PLgauss(\\mean, \\dev).clip(60, 90),\n \\dur, 0.1\n);\n);\n\n// prepare current Environment\n\n(\n~mean = 75;\n~dev = 0.3;\n);\n\n\n// run\n\nx = p.play;\n\n\n// move mean value and distribution\n// PLseq defaults to repeats = inf\n\n(\n~mean = PLseq((80, 79.75..70.25));\n~dev = Pstutter(8, PLseq\n// …\n```"}, {"role": "assistant", "content": "definition for future reference in arbitrary Environments, Gauss distribution is not bounded, so do clip ! (PLgauss: dynamic scope Pgauss variant)"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for some scale stuff by a novice-SC lovable unicorn."}, {"role": "assistant", "content": "```supercollider\n(\ns.newBusAllocators;\ns.options.numOutputBusChannels = 2;\n~reverbBus = Bus.audio(s,2);\n\ns.waitForBoot({\n\n Buffer.freeAll;\n ~scale1 = Buffer.loadCollection(\n s,Scale.new(#[0,7,15.93,5,9.7,12,17.5,13.1],12));\n\n SynthDef(\\rainbow,{\n arg buf, samp=0.2,root=37,atk=0.1,decay=10, amp=0.3;\n var sig, index, tonic, freq, env;\n index = LFSaw.kr(samp).range(\\bottom.ir(4),\\top.ir(9));\n index = index*BufFrames.kr(buf);\n tonic = DegreeToKey.kr(buf,index)+root;\n freq = tonic.midicps;\n env = EnvGen.ar(Env.perc(atk,decay,0.7,-2),doneAction:2);\n sig = SyncSaw.ar(root.midicps,freq, mul:0.5)*env;\n sig = BPF.ar(sig, \\cfreq.kr(1000),\\rq.ir(0.3))*amp;\n sig = Pan2.ar(\n sig,\n SinOsc.kr(\n \\rate.kr(0.05).range(-0.9,0.9)+{Rand(-0.6,0.6)}),\n \\level.kr(1),\n );\n Out.ar(\\out.ir(~reverbBus),sig);\n }).add;\n\n SynthDef(\\reverb, {\n arg in=0, out=0, revdecay=5;\n var wet,dry, sig;\n wet = In.ar(~reverbBus,2);\n dry = In.ar(~reverbBus,2);\n wet = CombL.ar(\n wet,\n 0.1,\n SinOsc.kr(0.01).range(0.04,0.1),\n revdecay,\n 0.7);\n wet = LPF.ar(wet,\\lpf.kr(4800));\n sig = XFade2.ar(wet,dry,\\mix.kr(0.2),\\amp.kr(0.3));\n Out.ar(out,sig);\n }).add;\n});\n\nSynth(\\reverb,[\\mix,-0.5],addAction:'addToTail');\n\n~rainbow = Pbind(\n \\instrument, \\rainbow,\n \\dur, Prand([0.2,1.3],inf),\n \\buf, ~scale1,\n \\root, Prand([23,30,35,37],inf),\n \\amp, Pwhite(0.15,0.5,inf),\n \\bottom, Prand([2,5],inf),\n \\top, Pwhite(7.0,9.1,inf),\n \\samp, Pexprand(0.07,0.5,inf),\n \\rate, Pexprand(0.1,3,inf),\n \\cfreq, Pseq([\n Pseries(120,30,76),\n Pseries(2400,-30,76),\n ],inf),\n \\rq, Pkey(\\samp)+Pwhite(0.1,0.15,inf).asStream,\n \\atk, Pexprand(0.04,0.3,inf),\n \\decay, Pexprand(6,15,inf),\n \\level, Env(#[0,1,0],#[100,110],'lin'),\n \\out, ~reverbBus,\n);\n~rainbow.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Impulse`."}, {"role": "assistant", "content": "```supercollider\n{ Impulse.ar(4, [0, MouseX.kr(0, 1)], 0.2) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n~resize_enveloppe = { | levels, times |\n var reverted_levels, index;\n index = 0;\n reverted_levels = levels.reverse;\n while( { reverted_levels[index] == 0 && reverted_levels[index+1] == 0 }, { times[ times.size - 1 - index] = 0.01; index = index + 1 } );\n};\n)\n```"}, {"role": "assistant", "content": "Enveloppes sizes are fixed. This means that if enveloppe's levels are equals to [ 1, 0, 0, 0, 0, 0, 0, 0 ] and times are equals to [ 1, 1, 1, 1, 1, 1, 1, 1 ], the synth UGens will take resources 8 seconds but will only be audible 1 second. To avoid this, passing both the levels and the times to this function will detect when the sound stops playing and will reduce the \"silence\" times to 0.01s, thu."}]} -{"conversations": [{"role": "user", "content": "How big are you?"}, {"role": "assistant", "content": "198M parameters in total, 64M active per token because the feed-forward layers are a mixture of four experts with top-1 routing. That is small enough to train in minutes on one GPU."}]} -{"conversations": [{"role": "user", "content": "I get 'server not running' or nothing happens at all."}, {"role": "assistant", "content": "The server is not booted. In the IDE press Ctrl+B, or evaluate `s.boot`. If code depends on a SynthDef being there, put it inside `s.waitForBoot { ... }`. When a script runs headless you can do `s.boot; s.sync;` and continue. `s.serverRunning` tells you the truth; if it is false, look at the post window for the boot error (usually an audio device problem)."}]} -{"conversations": [{"role": "user", "content": "What does `AbstractFunction.ring2` do?"}, {"role": "assistant", "content": "((a*b) + a + b) `({ [5, 6, 2].choose.postln } ring2: { [2, -1,"}]} -{"conversations": [{"role": "user", "content": "Resetting start count with PulseDivider?"}, {"role": "assistant", "content": "SuperCollider forum — Resetting start count with PulseDivider?\n\ni think in your example Sweep is receiving a trigger while going from 0 to 1 causing the discontinuity in the phase because the duration between one trigger and the next is unknown.\n\nwith this example you get at least a continiuous phase with random triggers to drive the hanning window (evaluate it several times). but its not multichannel with distributed phases / windows accross channels:\n\n```supercollider\n(\nvar randomTrigPhase = { |triggerRate = 10, randomness = 1|\n var minDuration = (2 ** randomness) / triggerRate;\n var maxDuration = (2 ** (-1 * randomness)) / triggerRate;\n var demand = Dunique(minDuration * ((maxDuration / minDuration) ** Dwhite(0, 1)));\n var duration = Duty.ar(demand, DC.ar(0), demand);\n var phase = Phasor.ar(DC.ar(0), (1 / duration) / SampleRate.ir, 0, 1);\n (phase: phase, trigger: HPZ1.ar(phase) < 0);\n};\n\nvar hanningWindow = { |phase|\n (1 - (phase * 2pi).cos) / 2 * (phase < 1);\n};\n\n{\n var rate = 100;\n var phase = randomTrigPhase.(rate, 1).phase;\n hanningWindow.(phase);\n}.plot(0.1);\n)\n```\n\nim not sure if this is helping it just reminded me of some issue with multichannel random triggers and continiuous phases i have been trying to solve."}]} -{"conversations": [{"role": "user", "content": "What does `SimpleNumber.legendrePZeros` do?"}, {"role": "assistant", "content": "Since the Legendre polynomials are alternatively even and odd, only the non-negative zeros are returned. For the odd Legendre polynomials, the first zero is always zero. The rest of the zeros are returned in increasing"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes SC radial icon XML(SVG) generator Batuhan Bozkurt 2012."}, {"role": "assistant", "content": "```supercollider\n//SC radial icon XML(SVG) generator\n//Batuhan Bozkurt 2012\n\n(\nvar cids, fids;\nvar circDefs, fillDefs, wrapped;\nvar radFor;\nvar canvasSize = 1024, pos = (canvasSize / 2).asInt;\n\n~color = {|shade| \"rgb(%,%,%)\".format(*((shade * 255).round.asInt ! 3)); };\n\n~linGrad = {|id, xy1, xy2, c1, c2| \"\n \n \n \n \".format(id, xy1.x, xy1.y, xy2.x, xy2.y, ~color.(c1), ~color.(c2)); };\n\n~circle = {|id, r, fill, rotate| \"\n \".format(id, r, fill, rotate) };\n\n~wrapAll = {|w, h, defs, x, y, draws| \"\n\n\n SuperCollider Icon SVG - Batuhan Bozkurt 2012%\n %\n \n\".format(w, h, defs, x, y, draws); };\n\ncids = 7.collect({|cnt| \"circ\" ++ cnt; });\nfids = 7.collect({|cnt| \"fcirc\" ++ cnt; });\nradFor = {|cnt| (90 - (13.5 * cnt)) / 100 * canvasSize / 2; };\n\nfillDefs = 7.collect({|cnt| ~linGrad.(fids[cnt], 50@0, 50@100, cnt.linlin(0, 6, 0, 0.3), 1); });\ncircDefs = 7.collect({|cnt| ~circle.(cids[cnt], radFor.(cnt), fids[cnt], (54 * cnt) % 360); });\nwrapped = ~wrapAll.(canvasSize, canvasSize, fillDefs.join, pos, pos, circDefs.join);\nwrapped.postln;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Mx.at` do? What arguments does it take?"}, {"role": "assistant", "content": "Retreive the MxUnit at the channel and index. returns nil if Arguments: chan — int; index — int. Returns: MxUnit"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Wow, the conciseness of SuperCollider is wonderful!."}, {"role": "assistant", "content": "```supercollider\n(\na=Array.fib(64,0,1);b=Array.fill(size:12,function:{arg i;a[i]%8});\np=1/8;Pdef(\\x,Pbind(\\dur,p,\\degree,Pseq(b,1,0)));\nr=Array.fill(12,{arg i;Pbindf(Pdef(\\x),\\mtranspose,b[i]);});\nPseq(r,(1/p)).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `CondVar`?"}, {"role": "assistant", "content": "CondVar — Condition variable: block one or more threads until some condition is true"}, {"role": "user", "content": "What does `CondVar.wait` do?"}, {"role": "assistant", "content": "The behavior depends on whether a `predicate` is given. If no `predicate` is given, this method simply blocks the current thread until it is woken by `signalOne` or `signalAll`. Otherwise, this method is equivalent to `while { predicate.value.not } { cond.wait }`. In other words, the thread only blocks if the predicate is false, otherwise it blocks and only resumes once the thread has been signall"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nc = CondVar();\n\nRoutine {\n 1.wait;\n \"waited for 1 second\".postln;\n 1.wait;\n \"waited for another second, now waiting for you to run 'c.signalOne'...\".postln;\n c.wait;\n \"the condition is no longer waiting\".postln;\n 1.wait;\n \"waited for another second, now waiting for you...\".postln;\n c.wait;\n \"the condition is no longer waiting\".postln;\n 1.wait;\n \"the end\".postln;\n}.play;\n);\n\n// Run this line to unblock the routine\nc.signalOne;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot\n\n{Perlin3.ar(Integrator.ar(K2A.ar(MouseX.kr(0, 0.1))), Integrator.ar(K2A.ar(MouseY.kr(0, 0.1))))}.play(s)\n\n{Perlin3.ar(*{Line.ar(0, 1000, 30)}.dup(3))}.plot(1\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot\n\n{Perlin3.ar(Integrator.ar(K2A.ar(MouseX.kr(0, 0.1))), Integrator.ar(K2A.ar(MouseY.kr(0, 0.1))))}.play(s)\n\n{Perlin3.ar(*{Line.ar(0, 1000, 30)}.dup(3))}.plot(1)\n```"}]} -{"conversations": [{"role": "user", "content": "GrainBuf complains about too many grains."}, {"role": "assistant", "content": "The number of simultaneous grains is `density × dur` in seconds, and it exceeds maxGrains (512 by default). Either lower the trigger rate, shorten the grains, or raise the limit: `GrainBuf.ar(2, trig, dur, buf, 1, pos, 2, 0, -1, 1024)` — the 1024 is maxGrains. Raising it costs server CPU per grain, so prefer halving the density if the sound does not need it."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Der Mussolini (bassline cover)?"}, {"role": "assistant", "content": "```supercollider\n/* An approach to try to reproduce the 'famous' bassline of \"Der Mussolini\" by D.A.F. */\n\n// very bad simulated analogue distorted bass synth\n// too distorted compared to the original...\n\nSynthDef(\\daf_bass,{ |out, freq=440, sustain=1, gate=1, amp=0.1|\n var snd, env, fenv, harm;\n harm = [1,1.01,2,2.02,3.5,4.01,5.501];\n harm = harm ++ (harm*2);\n snd = SinOsc.ar(freq*harm).sum.distort * 2;\n snd = snd + SinOsc.ar(freq / [1, 2]).sum!2;\n env = EnvGen.kr(Env.adsr(0.001,0.2,0.9,0.25), gate, amp, doneAction:2);\n snd = snd * env;\n OffsetOut.ar(out, (snd!2));\n}).add;\n\n// approx 63 bpm\nTempoClock.default.tempo = 63/60;\n\n// approx bass pattern + modulation of Mussolini bassline\nPdef(\\daf_bass,\n Pbind(\n \\instrument, \\daf_bass,\n \\scale, Scale.minor,\n \\octave, [3], // try out [2,3] or [3,4] for octave bass leetness\n \\ctranspose,Pseq([\n Pn(-1,16*4),\n Pn(1,16*2)\n ], inf),\n // -1 for thinking in musical degrees...\n \\degree, Pseq([1, 4, 1, 10, 1, 8, 1, 1, 8, 1, 8, 1, 8, 7, 1, 8]-1,inf),\n \\legato, Pwhite(0.75, 0.8),\n \\dur, 0.2\n )\n).play;\n\n// link: http://www.youtube.com/watch?v=15ScQivK5DY\n```"}]} -{"conversations": [{"role": "user", "content": "Can I run SuperCollider without the IDE?"}, {"role": "assistant", "content": "Yes. `sclang` runs the language and `scsynth` the server, and they are separate processes by design\n— the IDE is only a client. A headless script is a `.scd` run with `sclang my-piece.scd`, and it must boot\nthe server itself:\n\n```supercollider\ns.boot;\ns.waitForBoot {\n // build SynthDefs, play, then wait\n 30.wait;\n s.quit;\n};\n```\n\nThat shape — boot, wait, play, quit, exit — is what makes a piece runnable from a cron job or a\nRaspberry Pi."}]} -{"conversations": [{"role": "user", "content": "What does `KrNumberEditor.init` do? What arguments does it take?"}, {"role": "assistant", "content": "a number box and slider for editing a float value [\\kr rate] Arguments: val; aspec."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for vinil 10."}, {"role": "assistant", "content": "```supercollider\n// vinil 10\n// Esta cosa tiene un delay de maximo 10 segundos. La posicion X controla el tiempo de delay.\n// nos permite hacer una especie de 'scratch' como el de los djs con lo que entra por el mic\n(\nSynthDef.new(\"vinil10\", {arg gain=2; var in, delay;\n in = SoundIn.ar(0,mul:gain);\n delay = DelayL.ar(in!2,10,MouseX.kr(0,10))!2;\n Out.ar(0,delay)\n}).add;\n);\n\na = Synth(\"vinil10\");\n\na.free // libera (desactiva) el oscilador\n```"}]} -{"conversations": [{"role": "user", "content": "What does `AbstractPlayer.load` do? What arguments does it take?"}, {"role": "assistant", "content": "the base class for all Players : a playable object Arguments: obj; warnIfNotFound."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n// use input amplitude to control Pulse amplitude - use headphones to prevent feedback.\nSynthDef(\"help-AmplitudeMod\",{ arg out=0;\n Out.ar(out,\n Pulse.ar(90, 0.3, Amplitude.kr(SoundIn.ar))\n )\n}).play;\n\n);\n\n\n(\n// use input amplitude to control SinOsc frequency - use headphones to prevent feedback.\nz = SynthDef(\"help-AmplitudeMod\",{ arg out=0, attack=0.01, release=0.01;\n Out.ar(out,\n SinOsc.ar(\n AmplitudeMod.kr(\n SoundIn.ar,\n attack,\n release,\n 1200,\n 4\n// …\n```"}, {"role": "assistant", "content": "use input amplitude to control Pulse amplitude - use headphones to prevent feedback. use input amplitude to control SinOsc frequency - use headphones to prevent feedback. (AmplitudeMod: amplitude follower (deprecated))"}]} -{"conversations": [{"role": "user", "content": "What does `String.splitext` do?"}, {"role": "assistant", "content": "Split off the extension from a filename or path and return both in an Array as [path or filename, extension]."}]} -{"conversations": [{"role": "user", "content": "What does `JITGui.makeScroller` do?"}, {"role": "assistant", "content": "Some objects may have more elements to display than the gui has slots, e.g. a ProxySpace can have more proxies than the mixer has numItems. Then, only #-numItems elements are shown, and the others can be scrolled to with #-scroller - an EZScroller next to the slot elements. The makeScroller method should knows where in the zone to put the"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// server has hardwareBufferSize 512 for this example.\ns.options.hardwareBufferSize = 512; s.reboot;\n// do something that sends messages with server latency\nPbind(\\degree, Pbrown(-14, 14, 3), \\dur, 1/8).play;\ns.latency;\ns.latency = 0.1; // tune down ...\ns.latency = 0.05;\ns.latency = 0.025;\ns.latency = 0.012; // ... until every message posts \"late 0.01....\" now\ns.latency = 0.018; // go back up -> fewer late messages\ns.latency = 0.021; // go back up until ...\ns.latency = 0.024; // late mess\n// …\n```"}, {"role": "assistant", "content": "server has hardwareBufferSize 512 for this example. do something that sends messages with server latency (Latency: Measure audio latency for multiple channels)"}]} {"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// you have to write the sample path in the firts line\n\n~bufferdue = Buffer.read(s,\" WRITE YOUR SAMPLE PATH HERE \", bufnum:2);\n\n(\nSynthDef.new(\\bufbeat, {\n arg amp = 1, out = 0, buf, start, end, freq = 1;\n var sig, ptr;\n ptr = LFNoise1.ar(freq).range(0.0,end);\n sig = BufRd.ar(2, buf, ptr);\n sig = sig * amp;\n Out.ar(out, sig);\n}).add\n);\n\nx = Synth.new(\\bufbeat, [\\buf, ~bufferdue.bufnum, \\start,0, \\end, ~bufferdue.numFrames-1, \\freq, 1, \\amp, 0.5],g);\n\nx.free;\n```"}, {"role": "assistant", "content": "a simple BufRd with the starting point of lecture randomized by LFNoise1."}]} -{"conversations": [{"role": "user", "content": "What does `AbstractFunction.sumsqr` do?"}, {"role": "assistant", "content": "(a*a) + (b*b) `({ [5, 6, 2].choose.postln } sumsqr: { [2, -1,"}]} -{"conversations": [{"role": "user", "content": "What is `Stepper` in SuperCollider?"}, {"role": "assistant", "content": "Stepper — Pulse counter. Each trigger increments a counter which is output as a signal. The counter wraps between `min` and `max` . Category: UGens > Triggers."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nPevent(Pbind(\\harmonic, Pseq([24, 25, 29, 30], inf)), (octave: 3, dur: 0.2).trace.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nPevent(Pbind(\\harmonic, Pseq([24, 25, 29, 30], inf)), (octave: 3, dur: 0.2)).trace.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `BusPlug.copyState` do? What arguments does it take?"}, {"role": "assistant", "content": "Copy the internal settings of one proxy into another. Old state is cleared, the bus is Arguments: proxy — The object whose internal state is being copied.."}]} -{"conversations": [{"role": "user", "content": "What is `BinaryOpFunction`?"}, {"role": "assistant", "content": "BinaryOpFunction — represent a binary operation on a function"}, {"role": "user", "content": "What does `BinaryOpFunction.value` do?"}, {"role": "assistant", "content": "Executes each of the operand functions and then performs the selector on the result."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nvar a = { 19.rand };\nvar b = { [5, 8, 9].choose };\nvar c = a + b;\nfork {\n 15.do {\n (instrument: \\default, note: [c.value, a.value]).play;\n 0.3.wait;\n }\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `FoaDecoderKernel.newUHJ` do? What arguments does it take?"}, {"role": "assistant", "content": "Ambisonic UHJ stereo decoder. footSee: Arguments: kernelSize — 256, 512, 1024, 2048, 4096, 8192; server; sampleRate — The sample rate defaults to `nil` and is usually supplied by the running server. In NRT, you can specify a sampleRate to avoid booting a server.; score — Default is `nil` for most real time usages. When using NRT, you can supply a score (a Score or a CtkScore) onto which the kernels will be added, which lets you bypass booting a server.."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Dictionary`."}, {"role": "assistant", "content": "```supercollider\na = (note: 2);\nb = (note: [3, 5]);\nPseq([a, b]).play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes BD with ringing BPF."}, {"role": "assistant", "content": "```supercollider\n// BD with ringing BPF\n\n(\nSynthDef.new(\\bazedrum,\n {\n arg out = 0, outlevel=0.5, freq = 50, wet=0.5, q = 220, clicklevel =0, decaytrig = 0.1,\n decayfreq = 0.21, mulfreq =2 , decayamp = 1, dist = 17;\n\n var envtrig, envfreq, envamp, trigger,click, sig;\n\n envtrig = EnvGen.ar(Env.perc(1/10**5, decaytrig, 1, -9));\n envfreq = EnvGen.kr(Env.perc(0.003, decayfreq, mulfreq, -5));\n envamp = EnvGen.kr(Env.perc(0.003, decayamp,1, 2),doneAction:2);\n freq = freq * (1 + envfreq);\n trigger = envtrig*HPF.ar(PinkNoise.ar,40)+(envtrig*2);\n click = HPF.ar(envtrig*WhiteNoise.ar,2000*(1-envtrig),clicklevel);\n sig = BPF.ar(trigger, freq,1/q, sqrt(q)*5);\n sig = sig + click;\n\n sig = LeakDC.ar(sig* envamp,0.996);\n\n sig = Balance2.ar(sig,(sig*dist).tanh/3,(wet*2)-1);\n\n sig = Mix.ar(sig/2)*outlevel;\n\n out = 0;\n Out.ar(out, sig!2);\n }\n ).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "My sustained synth never stops, even when I set the gate to 0."}, {"role": "assistant", "content": "A sustained EnvGen only releases when the gate goes from positive to non-positive *after* the envelope has started, and the Synth only disappears if that EnvGen has `doneAction: 2`. Check three things: the SynthDef actually takes a `gate = 1` argument, the Env is a sustained shape (Env.adsr or Env.asr, not Env.perc), and you call `x.set(\\gate, 0)` on the Synth object. Setting the gate on a different Synth, or on a Group, does nothing."}]} -{"conversations": [{"role": "user", "content": "What are the arguments of Pan2?"}, {"role": "assistant", "content": "`Pan2.ar(in, pos, level)` — in is the mono signal, pos is -1 (left) to 1 (right) with 0 in the middle, and level scales the output. It is equal-power, so a centred signal is -3 dB per channel rather than half amplitude. `Pan2.ar(sig, SinOsc.kr(0.1))` is the simplest autopan."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{ LatoocarfianL.ar(\n SampleRate.ir/4,\n [LFDNoise0, LFClipNoise, LFDNoise1, LFDNoise3,\n LFNoise0, LFNoise1, LFNoise2].choose.kr(rrand(2, 20), rrand(2, 20)*0.1, rrand(2, 20)*0.2),\n [LFDNoise0, LFClipNoise, LFDNoise1, LFDNoise3,\n LFNoise0, LFNoise1, LFNoise2].choose.kr(rrand(2, 20), rrand(2, 20)*0.1, rrand(2, 20)*0.2),\n [LFDNoise0, LFClipNoise, LFDNoise1, LFDNoise3,\n LFNoise0, LFNoise1\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{ LatoocarfianL.ar(\n SampleRate.ir/4,\n [LFDNoise0, LFClipNoise, LFDNoise1, LFDNoise3,\n LFNoise0, LFNoise1, LFNoise2].choose.kr(rrand(2, 20), rrand(2, 20)*0.1, rrand(2, 20)*0.2),\n [LFDNoise0, LFClipNoise, LFDNoise1, LFDNoise3,\n LFNoise0, LFNoise1, LFNoise2].choose.kr(rrand(2, 20), rrand(2, 20)*0.1, rrand(2, 20)*0.2),\n [LFDNoise0, LFClipNoise, LFDNoise1, LFDNoise3,\n LFNoise0, LFNoise1, LFNoise2].choose.kr(rrand(2, 20), rrand(2, 20)*0.1, rrand(2, 20)*0.2),\n [LFDNoise0, LFClipNoise, LFDNoise1, LFDNoise3,\n LFNoise0, LFNoise1, LFNoise2].choose.kr(rrand(2, 20), rrand(2, 20)*0.1, rrand(2, 20)*0.2)\n) * 0.2 !2 }.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\Mirror;\n~description = \"Mirror soundfield\";\n\n~function = {|in = 0, order = 1, mirrorFrontBack = 0, mirrorLeftRight = 0, mirrorUpDown = 0 |\nHOATransMirror.ar(order, in, mirrorFrontBack, mirrorLeftRight, mirrorUpDown);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for UI sounds (pt1)."}, {"role": "assistant", "content": "```supercollider\n// UI sounds\n// this code is an attempt to recreate a sound\n// inspired from some technological/electrical UI interface\n\n// 1. first define the synth\n// Here we are using the FM technique\n(\nSynthDef(\\fmmod, {\n |\n amp=0.2,\n fc=1000,\n fm = 100,\n idx = 100,\n atk=0.01,\n rls=0.1\n |\n var env = EnvGen.ar(Env.perc(atk, rls), doneAction:2);\n var modulator = SinOsc.ar(fm);\n var carrier = SinOsc.ar(fc + (idx*modulator) );\n var sig = carrier * env * amp;\n sig = HPF.ar(sig, 1000);\n Out.ar(0, sig!2);\n}).add;\n);\n\n// 2. then define the Pbind which will play the sequence\n// of UI sounds simulating variuos characters showing up on an\n// imaginary display.\n// Play around FC, FM, ATK and RLS to obtain different sound characters.\n(\np = Pbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 100,\n \\idx, 100,\n \\amp, 0.6,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).asEventStreamPlayer;\n);\n\n// 3. play it\np.play;\n\n// 4. Here are some presets\n\n// \"cricket\" preset\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 100,\n \\idx, 100,\n \\amp, 0.6,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 2\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 1000,\n \\idx, 100,\n \\amp, 0.6,\n \\atk, 0.001,\n \\rls, 0.01,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 3\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 100,\n \\idx, 10,\n \\amp, 0.4,\n \\atk, 0.01,\n \\rls, 0.01,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 4\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 1000,\n \\fm, 100,\n \\idx, 1000,\n \\amp, 0.2,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n\n// preset 5\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 5000,\n \\fm, 1000,\n \\idx, 1000,\n \\amp, 0.4,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 5\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 8000,\n \\fm, 1000,\n \\idx, 1000,\n \\amp, 0.7,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes blipecho context."}, {"role": "assistant", "content": "```supercollider\n( \nSynthDef(\\klang_blip, { \n | out = 0, release = 1, freq1 = 1, freq2 = 5, freq3 = 8, freq_mul = 4, atk_dur = 0.01, amp = #[0.3,0.3,0.3], mod_freq = 25 | \n var sig = DynKlang.ar(\n `[([freq1, freq2, freq3].linexp(1,12,1,1140) * freq_mul), amp, nil ], \n EnvGen.kr(Env([5,1.05,0.95,0.01],[0.025,release*3/4,release/4])), \n 150\n ) * LFGauss.kr(mod_freq.reciprocal, 0.3);\n Out.ar(out, (sig/8)!2 * Linen.kr(Impulse.kr(0), atk_dur, 1, release, doneAction:2)) \n}).add;\n\nSynthDef(\\dubecho,{|in, out, length = 1, fb = 0.8, sep = 0.012|\n var input = In.ar(in, 2);\n var feedback = LocalIn.ar(2);\n var output = LeakDC.ar(feedback*fb + input);\n output = HPF.ar(output, 400);\n output = LPF.ar(output, 12000);\n output = output.tanh;\n LocalOut.ar(DelayC.ar(output, 1, LFNoise2.ar(12).range([length,length+sep],[length+sep,length])).reverse);\n ReplaceOut.ar(out, output);\n}).add;\n);\n\n( \n~bus = Bus.audio(s, 2);\n~echo = Synth(\\dubecho, [\\in, ~bus, \\length, TempoClock.default.tempo*(3/8), \\fb, 0.25, \\sep, 0.0012], addAction: \\addToTail);\n\nPbind(*[ \n instrument: \\klang_blip, \n dur: Pwrand([0.25,0.5,1,0.125], [16,16,1,1].normalizeSum, inf), \n release: Pkey(\\dur),\n freq_mul: Pstutter(Pwrand([1,2,4],[5,3,2].normalizeSum,inf), Pxrand((1..6), inf)),\n freq1: Pstutter(Pxrand((2,4..16), inf), Prand((1..4), inf)), \n freq2: Pstutter(Pxrand((2,4..16), inf), Prand((4..8), inf)), \n freq3: Pstutter(Pxrand((2,4..16), inf), Prand((8..12), inf)),\n mod_freq: Pstutter(Pxrand((2,4..16), inf), Pbrown(7,30,3)),\n atk_dur: Pkey(\\freq_mul).linlin(12,2,0.01,0.4),\n out: ~bus,\n amp: Pstutter(Pxrand((2,4..16),inf), Pfunc({[2,3,4].normalizeSum.scramble}))\n]).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\smooth, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.linen(0.05, sustain, 0.1), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n)\n```"}, {"role": "assistant", "content": "plays an arpeggio on the \"left hand\" and an arpeggio on the \"right hand\"."}]} -{"conversations": [{"role": "user", "content": "What does `MxChannelApp.put` do? What arguments does it take?"}, {"role": "assistant", "content": "put an object (Instr, Ndef, Spline etc) in the slot, replacing anything that might be Arguments: i — slot number; source — the object to add. Returns: an MxUnitApp whose .source is the object you added"}]} -{"conversations": [{"role": "user", "content": "What is a bus, in one sentence?"}, {"role": "assistant", "content": "A numbered channel on the server that nodes write signal into and read signal out of, which is how sounds are chained without cables."}, {"role": "user", "content": "Show me using one for an effect."}, {"role": "assistant", "content": "Write the source to a private bus, read it in the effect, send the effect to the master:\n\n```supercollider\n(\n~bus = Bus.audio(s, 1);\nSynthDef(\\src, { |out = 0| Out.ar(out, Saw.ar(110) * 0.1) }).add;\nSynthDef(\\fx, { |in = 0| Out.ar(0, RLPF.ar(In.ar(in, 1), 1200, 0.3)) }).add;\n);\nSynth(\\fx, [\\in, ~bus]);\nSynth(\\src, [\\out, ~bus]);\n```\n\nOrder matters: the effect exists before the source, so the source's output has a listener."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// By Bjørn Houdorf March 2013, Play your (short) soundfiles with some delay.\n\nb = SoundFile.collectIntoBuffers(\"yourSoundFileFolder/*\"); // 1. rund this\n\n( // 2. and then run this\nt = Task({\n({\n var num= b.size.rand;\n var buf= b[num];\n 0.1*Splay.ar(PlayBuf.ar(buf.numChannels, buf, 1, 1, 0, 0));\n}.play;\n) \n});\n);\n\n\n( // 3. Then run this\nz = Task({\nloop({\n t.start;\n 0.1.wait;\n});\n});\n);\n\n\nz.start; // 4. and run this\nz.stop; // 5. and finally run this\n```"}, {"role": "assistant", "content": "Play your (short) soundfiles with some delay. Your soundfiles should be in the folder \"yourSoundFileFolder\"."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Modanung - Return of the King."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"plucking\", {arg amp = 0.1, freq = 220, decay = 5, coef = 0.1;\nvar env, snd;\nenv = EnvGen.kr(Env.linen(0, decay, 0.5), doneAction: 2);\nsnd = Pluck.ar(\n in: SinOsc.ar(0.5*freq, 0, amp),\n trig: Impulse.kr(0),\n\n maxdelaytime: 0.1,\n delaytime: freq.reciprocal,\n decaytime: decay,\n coef: coef);\n Out.ar(0, [snd, snd]);\n}).add;\n);\n(\nSynthDef(\\FreeVerb2x2, {|outbus, mix = 0.23, room = 0.42, damp = 0.666, amp = 1.0|\n var signal;\n\n signal = In.ar(outbus, 2);\n\n ReplaceOut.ar(outbus,\n FreeVerb2.ar( // FreeVerb2 - true stereo UGen\n signal[0], // Left channel\n signal[1], // Right Channel\n mix, room, damp, amp)); // same params as FreeVerb 1 chn version\n\n}).add;\nz = Synth(\\FreeVerb2x2, [\\outbus, 0], addAction:\\addToTail)\n);\n(\nPbind(\n \\instrument, \"plucking\",\n \\scale, Scale.locrian,\n \\degree, Prand([[-2.5, -4.001], [-7.002, -5], [-1, -3.003], [-1.005, -0.51], [-5, -3], [-4, -4], [0, 1]], inf),\n \\amp, Pseq([0.23, 0.042, 0.2, 0.32], inf),\n \\decay, Pseq([0.25,2.5, 0.025, 0.25], inf),\n \\coef, Pseq([0.3, 0.2, 0.9], inf),\n \\dur, Pseq([0.2, 0.01, 0.21, 0.001, 0.0001, 0.00911, 0.191, 0.23],inf)\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(..-9).mod(-3);\n// returns [0, -1, -2, 0, -1, -2, 0, -1, -2, 0]\n(..-9).modSeaside(-3);\n// returns [0, 2, 1, 0, -4, -5, 0, -4, -5, 0]\n\n// plot\n(-25..25).modSeaside(-5).plot.plotMode_(\\steps);\n\n// modSeaside\nPbind(\\note, modSeaside(Pseries(-15, 1, 25), -5), \\dur, 0.2).play;\n\n// modSeaside with different divisors\nPbind(\\note, modSeaside(Pseries(-15, 1, 25), [3, -4, -5]), \\dur, 0.2).play;\n\n// mod\nPbind(\\note, mod(Pseries(-15, 1, 25),\n// …\n```"}, {"role": "assistant", "content": "returns [0, -1, -2, 0, -1, -2, 0, -1, -2, 0] returns [0, 2, 1, 0, -4, -5, 0, -4, -5, 0] (Integer: 32-bit Integer number)"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LinCongN`."}, {"role": "assistant", "content": "```supercollider\n// default initial params\n{ LinCongN.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nNdef(\\birdy, {arg freq=1500, amp=0.5, rate=10;\n var osc, son, convIn, rand;\n osc=LFCub;\n rand = LFNoise1.ar(rate);\n convIn=LinCongN.ar(rate);\n son = osc.ar(Convolution.ar(convIn,convIn));\n freq = Latch.kr(rand.range(0,1).round(0.1), rand) * freq;\n freq = osc.ar(osc.ar(rand)*rand.range(0,10)).range(freq, freq*3);\n son = Formlet.ar(son, freq, convIn.abs*0.1, rand.abs);\n son = Normalizer.ar(son, 0.9, 0.1) * convIn.abs * LFPulse.kr(LFPulse.kr(rand.abs), 0, rand.abs);\n son = son + GVerb.ar(son, 99, 2, mul: rand.range(0,0.3));\n son * amp\n}).play\n)\n```"}, {"role": "assistant", "content": "I just rewrote one of autocsi's tweets and came out with this which sounds like a digital bird of some kind:."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Latoocarfian2DN.ar(MouseX.kr(20, SampleRate.ir * 0.5), MouseX.kr(40, SampleRate.ir), mul:0.2) }.play(s);\n\n\n(\n{ Latoocarfian2DN.ar(\n SampleRate.ir/4,\n SampleRate.ir,\n LFNoise2.kr(2.dup, 1.5, 1.5),\n d:LFNoise2.kr(2.dup, 0.5, 1.5),\n mul:0.2\n) }.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Latoocarfian2DN.ar(MouseX.kr(20, SampleRate.ir * 0.5), MouseX.kr(40, SampleRate.ir), mul:0.2) }.play(s);\n\n\n(\n{ Latoocarfian2DN.ar(\n SampleRate.ir/4,\n SampleRate.ir,\n LFNoise2.kr(2.dup, 1.5, 1.5),\n d:LFNoise2.kr(2.dup, 0.5, 1.5),\n mul:0.2\n) }.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Play your (short) soundfiles with some delay that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n// By Bjørn Houdorf March 2013, Play your (short) soundfiles with some delay.\n\nb = SoundFile.collectIntoBuffers(\"yourSoundFileFolder/*\"); // 1. rund this\n\n( // 2. and then run this\nt = Task({\n({\n var num= b.size.rand;\n var buf= b[num];\n 0.1*Splay.ar(PlayBuf.ar(buf.numChannels, buf, 1, 1, 0, 0));\n}.play;\n) \n});\n);\n\n\n( // 3. Then run this\nz = Task({\nloop({\n t.start;\n 0.1.wait;\n});\n});\n);\n\n\nz.start; // 4. and run this\nz.stop; // 5. and finally run this\n```"}]} +{"conversations": [{"role": "user", "content": "What does `UGen.linlin` do?"}, {"role": "assistant", "content": "Wraps the receiver so that a linear input range is mapped to a linear output"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// note the pops at the beginning of signal due to lack of lookahead\n{\n var z;\n\n // signal (clean)\n z = Decay2.ar(\n Impulse.ar(8, 0, LFSaw.kr(0.3, 1, -0.3, 0.3)),\n 0.001,\n 0.3\n )\n * Mix.ar(Pulse.ar([80, 81], 0.3));\n\n // apply sustainer\n Compander.ar(z, z,\n thresh: MouseX.kr(0.1, 1),\n slopeBelow: 0.1,\n slopeAbove: 1,\n clampTime: 0.01,\n relaxTime: 0.01\n ) * 0.1\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// note the pops at the beginning of signal due to lack of lookahead\n{\n var z;\n\n // signal (clean)\n z = Decay2.ar(\n Impulse.ar(8, 0, LFSaw.kr(0.3, 1, -0.3, 0.3)),\n 0.001,\n 0.3\n )\n * Mix.ar(Pulse.ar([80, 81], 0.3));\n\n // apply sustainer\n Compander.ar(z, z,\n thresh: MouseX.kr(0.1, 1),\n slopeBelow: 0.1,\n slopeAbove: 1,\n clampTime: 0.01,\n relaxTime: 0.01\n ) * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `VarGui`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// synth definition with raising frequency\n\n(\nSynthDef(\\synth_0, { |devFactor = 0.1, devFreq = 10, amp = 0.1|\n var freq = XLine.kr(400, 1200, 10); \n Out.ar(0, SinOsc.ar(SinOsc.ar(devFreq, 0, devFactor * freq, freq), mul: amp).dup(2) * EnvGate.new) \n}).add;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `SharedOut` in SuperCollider?"}, {"role": "assistant", "content": "SharedOut — Write to a shared control bus. Category: UGens > InOut."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n//code that utilizes the glitch.\n//warning! extremely loud.\n//note: might not sound the same on all soundcards\n(\n{GlitchHPF.ar(\n BrownNoise.ar(1.dup),\n 0.5,\n Saw.kr(1, 10)\n)}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n//code that utilizes the glitch.\n//warning! extremely loud.\n//note: might not sound the same on all soundcards\n(\n{GlitchHPF.ar(\n BrownNoise.ar(1.dup),\n 0.5,\n Saw.kr(1, 10)\n)}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is rq in BPF.ar?"}, {"role": "assistant", "content": "rq is the reciprocal of Q, so it is a bandwidth control, not a Q control. Small rq means a narrow, resonant band; large rq means a wide, gentle one. The signature is `BPF.ar(in, freq, rq, mul, add)`. A common idiom is `rq = 0.3` for a broad sweep and `rq = 0.02` for a whistle. The same rq convention applies to RLPF and RHPF."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pwrap`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Pn(\n Pwrap(\n Pgeom(200, 1.07, 96),\n 200,\n 1000.0\n ),\n inf\n);\nx = a.asStream;\n\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, x.next.debug, \\dur, 0.3]);\n 0.12.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `AtkMatrixMix` in SuperCollider?"}, {"role": "assistant", "content": "AtkMatrixMix — Matrix mixer from the Ambisonic Toolkit (ATK) Mix an Array of channels to an Array of channels. Category: Libraries > Ambisonic Toolkit > UGens > Internals, UGens > Multichannel > Ambisonics."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Peak`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n SinOsc.ar(\n Peak.ar(Dust.ar(20), Impulse.ar(0.4)) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// follow a sine lfo, reset rate controlled by mouse x\n(\n{\n SinOsc.ar(\n Peak.kr(SinOsc.kr(0.2), Impulse.kr(MouseX.kr(0.01, 2, 1))) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `BPF`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// synthdefs to play with\n(\nSynthDef(\\noise_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, rq = 0.1, amp = 0.1|\n var sig = { WhiteNoise.ar } ! 2;\n sig = BPF.ar(sig, freq, rq) *\n EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2) *\n (rq ** -1) * (250 / (freq ** 0.8));\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\sin_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { SinOsc.ar(freq, Rand(0, 2pi)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n\n\nSynthDef(\\saw_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { VarSaw.ar(freq, Rand(0, 1)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `ProxySpace`?"}, {"role": "assistant", "content": "ProxySpace — an environment of references on a server"}, {"role": "user", "content": "What does `ProxySpace.push` do?"}, {"role": "assistant", "content": "replace the currentEnvironment with a new ProxySpace and clear the current one, if it is a ProxySpace (this is to avoid piling up proxy spaces). In order to move to another ProxySpace while keeping the current, use pop and then push a new one. To have multiple levels of proxy spaces, use .new.push;"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\np = ProxySpace.new;\np.fadeTime = 2; // fadeTime specifies crossfade\np[\\out].play; // monitor an empty placeholder through hardware output\n// set its source\np[\\out] = { SinOsc.ar([350, 351.3], 0, 0.2) };\np[\\out] = { Pulse.ar([350, 351.3] / 4, 0.4) * 0.2 };\np[\\out] = Pbind(\\dur, 0.03, \\freq, Pbrown(0, 1, 0.1, inf).linexp(0, 1, 200, 350));\n\n// route one proxy through another:\np[\\out] = { Ringz.ar(p[\\in].ar, [350, 351.3] * 8, 0.2) * 4 };\np[\\in] = { Impulse.ar([5, 7]/2, [0, 0.5]) };\n\np.clear(3); // clear after 3 seconds\n```"}]} +{"conversations": [{"role": "user", "content": "How big are you?"}, {"role": "assistant", "content": "198M parameters in total, 64M active per token because the feed-forward layers are a mixture of four experts with top-1 routing. That is small enough to train in minutes on one GPU."}]} +{"conversations": [{"role": "user", "content": "Explain `PV_MagClip` in SuperCollider briefly."}, {"role": "assistant", "content": "PV_MagClip — Clip bins to a threshold. Clips bin magnitudes to a maximum threshold. Category: UGens > FFT."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LFDClipNoise`."}, {"role": "assistant", "content": "```supercollider\n// try wiggling the mouse quickly;\n// LFNoise frequently seems stuck, LFDNoise changes smoothly.\n\n{ LFClipNoise.ar(MouseX.kr(0.1, 1000, 1), 0.1) }.play\n\n{ LFDClipNoise.ar(MouseX.kr(0.1, 1000, 1), 0.1) }.play\n\n// silent for 2 secs before going up in freq\n\n{ LFClipNoise.ar(XLine.kr(0.5, 10000, 3), 0.1) }.scope;\n\n{ LFDClipNoise.ar(XLine.kr(0.5, 10000, 3), 0.1) }.scope;\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFClipNoise.ar(XLine.kr(1000, 20000, 10), 0.1) }.scope;\n\n{ LFDClipNoise.ar(XLine.kr(1000, 20000, 10), 0.1) }.scope;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ClipNoise`."}, {"role": "assistant", "content": "```supercollider\n{ ClipNoise.ar(0.2) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a, b;\na = Psetp(\\freq, Pseq([801, 1008], inf), Pbind(\\dur, Pseq([0.5, 0.111, 0.22])));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n);\n\n// Psetp overrides incoming values:\n\n(\nvar a, b;\na = Psetp(\\freq, 801, Pbind(\\freq, 108));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n);\n\n\n// sound example\n\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = En\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a, b;\na = Psetp(\\freq, Pseq([801, 1008], inf), Pbind(\\dur, Pseq([0.5, 0.111, 0.22])));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n);\n\n// Psetp overrides incoming values:\n\n(\nvar a, b;\na = Psetp(\\freq, 801, Pbind(\\freq, 108));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n);\n\n\n// sound example\n\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, Pseq([0.5, 0.3, 0.1]), \\instrument, \\sinegrain);\na = Psetp(\\freq, Pseq([500, 600, 700], inf), a);\na.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `MassEditUChain.fadeOut` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: fadeOut — (describe argument here). Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "Explain `OSCFuncBothMessageMatcher` in SuperCollider briefly."}, {"role": "assistant", "content": "OSCFuncBothMessageMatcher — Matches incoming messages to responder funcs based on receive port and sender address This is used by OSCMessageDispatcher and OSCMessagePatternDispatcher to match incoming OSC messages to instances of OSCFunc or OSCdef using receive port and sender address. This class is private, and generally users should not need to address instances directly. Category: External Control > OSC > Matchers."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Pmulp`."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\freq, Pseq([500, 600, 700]), \\instrument, \\sinegrain);\na = Pmulp(\\freq, Pseq([0.5, 0.9, 0.8], inf), a);\na.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a, b;\na = Pseq([1, 2, 3], inf);\nb = Pseq([65, 76], inf);\nc = Pswitch1([a, b, 800], Pseq([2, 2, 0, 1], inf));\nx = c.asStream;\n24.do({ x.next.postln });\n);\n\n\n// Pswitch used as a sequence of pitches:\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a, b;\na = Pseq([1, 2, 3], inf);\nb = Pseq([65, 76], inf);\nc = Pswitch1([a, b, 800], Pseq([2, 2, 0, 1], inf));\nx = c.asStream;\n24.do({ x.next.postln });\n);\n\n\n// Pswitch used as a sequence of pitches:\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n(\na = Pseq([73, 71, 69], inf);\nb = Pseq([0, 0, 0, 4, 0]+64, inf);\nc = Pswitch1([a, b, 75], Pseq([2, 2, 0, 1], inf));\nx = c.asStream;\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, x.next.midicps]);\n 0.18.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `MIDIFuncChanMessageMatcher` in SuperCollider?"}, {"role": "assistant", "content": "MIDIFuncChanMessageMatcher — Matches incoming MIDI messages to responder funcs based on message channel This is used by MIDIMessageDispatcher to match incoming MIDI messages to instances of MIDIFunc or MIDIdef using MIDI channel. This class is private, and generally users should not need to address instances directly. Category: External Control > MIDI > Matchers."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\nb = Buffer.new(s);\n// read only the first channel (a Sine wave) of a stereo file\nb.allocReadChannel(ExampleFiles.sinedPink, channels: [0]);\nx = { PlayBuf.ar(1, b, BufRateScale.kr(b), loop: 1 * 0.5 }.play;\nx.free; b.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\nb = Buffer.new(s);\n// read only the first channel (a Sine wave) of a stereo file\nb.allocReadChannel(ExampleFiles.sinedPink, channels: [0]);\nx = { PlayBuf.ar(1, b, BufRateScale.kr(b), loop: 1) * 0.5 }.play;\nx.free; b.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// for the members of the cult of q\n// who don't want to ~tilde\n\n\n//-- INIT\nq = q ? ();\n\nq.local = currentEnvironment;\n\nq.local.pattern = Pbind(\\note, Pbrown(0, { 17.rand + 1 } ! 12), \\dur, 0.05, \\amp, 0.01);\n\n\n//-- PLAY\n\nq.local.player = q.local.pattern.play;\n\n\n\n\n//-- STOP\n\nq.local.player.stop;\n\n//-- FREE\n\nq.local = nil;\n```"}, {"role": "assistant", "content": "for the members of the cult of q who don't want to ~tilde -- INIT."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n//Version 1\n//P(eace)Bind\n//If error messages could experience Nirvanna, it would sound like this.\n(\n{\nSaw.ar(\n freq: SinOsc.kr([60, 63, 67, 70]).range(440,880),\n mul:LFNoise0.kr(freq: [0.25,1]).range(0,1),\n )\n}.play\n\n);\n\n\n//Version 2\n//SuperCollider\n//Sometimes in life, you feel like you need to collide with things.\n(\n{\nPulse.ar(\n freq: SinOsc.kr([60, 63, 67, 70]).range(30,70),\n mul: LFPulse.kr(freq: [0.25,1]).range(0,1)\n )\n}.play\n\n)\n```"}, {"role": "assistant", "content": "Quiz 4a for MUSC 115, pp. 62-84 from Gentle Intro to SuperCollider."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n Instr(\\helpTempoPlayer,{\n var t;\n t = TempoPlayer.new; // default global tempo\n Impulse.ar( t.kr )\n });\n\n Patch(\\helpTempoPlayer).play(atTime:1)\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n Instr(\\helpTempoPlayer,{\n var t;\n t = TempoPlayer.new; // default global tempo\n Impulse.ar( t.kr )\n });\n\n Patch(\\helpTempoPlayer).play(atTime:1)\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nb = Bus(\\audio, 0, 2);\ns.bind {\n SynthDef(\\sinPerc, { |out = 0|\n var signal = SinOsc.ar * Env.sine(0.1).ar(gate: Impulse.ar(2));\n OffsetOut.ar(out, signal ! 2) }\n ).add;\n s.sync;\n Synth(\\sinPerc, [\\out, b]);\n b.plot(1);\n}\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nb = Bus(\\audio, 0, 2);\ns.bind {\n SynthDef(\\sinPerc, { |out = 0|\n var signal = SinOsc.ar * Env.sine(0.1).ar(gate: Impulse.ar(2));\n OffsetOut.ar(out, signal ! 2) }\n ).add;\n s.sync;\n Synth(\\sinPerc, [\\out, b]);\n b.plot(1);\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Pmulp` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\freq, Pseq([500, 600, 700]), \\instrument, \\sinegrain);\na = Pmulp(\\freq, Pseq([0.5, 0.9, 0.8], inf), a);\na.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `HilbertH.calcImagCoeffs` do? What arguments does it take?"}, {"role": "assistant", "content": "Generate imaginary Arguments: size — The size of the kernel used for Hartley Phasing filtering.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\\synth_1a, { |freq = 400, preAmp = 5, amp = 0.1|\n var src = SinOsc.ar(freq, 0, mul: preAmp).tanh ! 2;\n OffsetOut.ar(0, src * amp * EnvGen.ar(Env.perc, doneAction: 2))\n}).add;\n);\n\n(\np = Pbind(\n \\instrument, \\synth_1a,\n \\preAmp, PL(\\preAmp), // or Pfunc { ~preAmp } \n \\amp, PL(\\amp), // or Pfunc { ~amp } \n \\midinote, PLseq(\\seq) + PL(\\seqAdd), \n \\dur, 0.2\n);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\\synth_1a, { |freq = 400, preAmp = 5, amp = 0.1|\n var src = SinOsc.ar(freq, 0, mul: preAmp).tanh ! 2;\n OffsetOut.ar(0, src * amp * EnvGen.ar(Env.perc, doneAction: 2))\n}).add;\n);\n\n(\np = Pbind(\n \\instrument, \\synth_1a,\n \\preAmp, PL(\\preAmp), // or Pfunc { ~preAmp } \n \\amp, PL(\\amp), // or Pfunc { ~amp } \n \\midinote, PLseq(\\seq) + PL(\\seqAdd), \n \\dur, 0.2\n);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pgtpar`."}, {"role": "assistant", "content": "```supercollider\n// synthdef\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n}).add;\n);\n\n// pattern with different start times\n(\nx = Pbind(\n \\instrument, \\help_sinegrain,\n \\degree, Pseq(#[0, 5, 4, 2, 1, 1, 3], inf),\n \\dur, Pseq(#[0.25, 0.5, 1.0], inf),\n \\scale, #[0, 3, 5, 9, 10]\n);\na = Pbus(Pgtpar([0.0, x, 1.5, x, 2.25, x])).play;\n);\ns.plotTree;\na.stop;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `CombL`."}, {"role": "assistant", "content": "```supercollider\n// These examples compare the variants, so that you can hear the difference in interpolation\n\n// Comb used as a resonator. The resonant fundamental is equal to\n// reciprocal of the delay time.\n{ CombN.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ CombL.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ CombC.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// with negative feedback:\n{ CombN.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ CombL.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ CombC.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n// used as an echo.\n{ CombL.ar(Decay.ar(Dust.ar(1, 0.5), 0.2, WhiteNoise.ar), 0.2, 0.2, 3) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Server.named` do?"}, {"role": "assistant", "content": "Object representing a server application Returns: An IdentityDictionary of all servers listed by their name `Server.named.at(\\default)`"}]} +{"conversations": [{"role": "user", "content": "Explain `Convolution2` in SuperCollider briefly."}, {"role": "assistant", "content": "Convolution2 — Real-time fixed kernel convolver. Strict convolution with fixed kernel which can be updated using a trigger signal. Category: UGens > FFT, UGens > Convolution."}]} +{"conversations": [{"role": "user", "content": "What does `AbstractPlayer.ar` do?"}, {"role": "assistant", "content": "the base class for all Players : a playable object"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Resonz` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// 1st, evaluate a synthdef\n(\nSynthDef(\"pitchFromNoise\", { arg out = 0;\n Out.ar(\n out,\n Resonz.ar(\n WhiteNoise.ar(15),\n LFNoise0.kr(2, 110, 660),\n 0.005\n )\n )\n}).add;\n);\n\n// 2nd, make 2 synths\n(\nSynth(\"ringModulation\");\nSynth(\"pitchFromNoise\", [\\out, 1]);\n);\n\n// 3rd, tell the server to list its nodes\n(\ns.queryAllNodes;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Monitor.group` do?"}, {"role": "assistant", "content": "Return the group in which all mapping synths are"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\n//with a buffer\nb = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01-44_1.aiff\");\n(\nx = {\n var in = PlayBuf.ar(1, b, BufRateScale.kr(b), loop: 1);\n PitchShiftPA.ar(\n in,\n Pitch.kr(in)[0], //pitch tracking - we take just the frequency\n MouseX.kr(0.5, 2), //pitchRatio\n MouseY.kr(0.5, 2), //formantRatio\n )\n}.play\n);\nx.free;\n\n//with live input - beware of feedback!\n(\nx = {\n var in = SoundIn.ar(0);\n PitchShift\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\n//with a buffer\nb = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01-44_1.aiff\");\n(\nx = {\n var in = PlayBuf.ar(1, b, BufRateScale.kr(b), loop: 1);\n PitchShiftPA.ar(\n in,\n Pitch.kr(in)[0], //pitch tracking - we take just the frequency\n MouseX.kr(0.5, 2), //pitchRatio\n MouseY.kr(0.5, 2), //formantRatio\n )\n}.play\n);\nx.free;\n\n//with live input - beware of feedback!\n(\nx = {\n var in = SoundIn.ar(0);\n PitchShiftPA.ar(\n in,\n Pitch.kr(in)[0], //pitch tracking - we take just the frequency\n MouseX.kr(0.5, 2), //pitchRatio\n MouseY.kr(0.5, 2), //formantRatio\n )\n}.play\n);\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for nothing much ). Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n{|atk=0.05,dur=10,freq=50,amp=0.8|\n PMOsc.ar(\n Line.kr(1,2,dur,freq),\n LFNoise2.kr([1,2]).range(1,2)*freq,\n LFNoise2.kr([2,1]).range(0.1,3.5),\n 0,\n Decay2.ar(\n Impulse.ar(XLine.kr(1, 25, dur)) * SinOsc.ar(4/dur,[0,pi/2],0.05,1),\n 0.023, XLine.ar(1,35,dur).reciprocal,\n Line.ar(1,0.8,dur) * LFNoise2.kr(4/dur,0.05,1).dup\n ) * EnvGen.ar(Env([0,1,1,0],[atk,dur-atk,0.3]),1,amp, doneAction:2)\n )\n // * LFPulse.ar(XLine.kr(5,20,dur,freq * LFNoise2.kr([1,2]).range(0.95,1.05)))\n}.play(args:[\n freq:50.rrand(350).debug('freq'),\n dur:10.rrand(20).debug('dur')\n])\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Tuning`?"}, {"role": "assistant", "content": "Tuning — represents a musical tuning"}, {"role": "user", "content": "What does `Tuning.et` do?"}, {"role": "assistant", "content": "Creates an equal-tempered scale based on pitchesPerOctave."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nt = Tuning.et12;\nt.semitones; // [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]\nt.ratios; // [1, 1.0594630943591, 1.1224620483089, 1.1892071150019, etc.]\n\nPbind(\\scale, Scale.major(t), \\degree, Pseq((0..7) ++ (6..0) ++ [\\rest], 1), \\dur, 0.25).play;\n\n// use non-standard tuning\nt = Tuning.just;\nt.semitones; // [0, 1.1173128526978, 2.0391000173077, 3.1564128700055, etc.]\nt.ratios.collect(_.round(0.001)); // [1, 1.067, 1.125, 1.2, 1.25, 1.333, 1.406, 1.5, etc.]\n\nPbind(\\scale, Scale.major(t), \\degree, Pseq((0..7) ++ (6..0) ++ [\\rest], 1), \\dur, 0.25).play;\n```"}]} +{"conversations": [{"role": "user", "content": "How do I make a delay line?"}, {"role": "assistant", "content": "`CombN.ar(in, maxdelaytime, delaytime, decaytime)` is a feedback delay: maxdelaytime is the buffer size, delaytime the actual delay (and it can modulate), decaytime how long the repeats take to die. For a clean single echo use `DelayN.ar(in, maxdelaytime, delaytime)`, which has no feedback. Both replace the `in` with the delayed signal, so mix with the dry: `dry + CombN.ar(dry, 0.5, 0.3, 2) * 0.4`."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Paddp` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\freq, Pseq([500, 600, 700]), \\instrument, \\sinegrain);\na = Paddp(\\freq, Pseq([30, 90, -100], inf), a);\na.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `LinkedListNode` in SuperCollider briefly."}, {"role": "assistant", "content": "LinkedListNode — Internally used class for LinkedList nodes LinkedListNode is used to implement the internal nodes of the LinkedList class. You should not need to deal with a LinkedListNode directly. Category: Collections."}]} +{"conversations": [{"role": "user", "content": "What does `Integer.asStringToBase` do?"}, {"role": "assistant", "content": "32-bit Integer number Returns: a string with `width`-rightmost digits in base `base`."}]} +{"conversations": [{"role": "user", "content": "What does `IndexL.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Index into a table with a signal, linear interpolated Arguments: bufnum — index of the buffer.; in — the input signal.."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nSynthDef(\"additivePad\", \n { arg numOfCycles = 100;\n var lfo;\n var lfo2;\n var lfo3;\n lfo = SinOsc.kr([Rand(0.5,1000),Rand(0.5,1000)], 1.5pi, 0.5, 0.5);\n lfo3 = SinOsc.kr([Rand(0.1,0.5),Rand(0.1,0.5)], 1.5pi, 0.5, 0.5);\n lfo2 = SinOsc.kr([(Rand(0.5,1000) * lfo) * lfo3, (Rand(0.5,1000) * (1 - lfo)) * (1 - lfo3)], 1.5pi, 0.5, 0.5);\n Out.ar(\n 0, \n Mix.arFill(\n numOfCycles,\n { \n SinOsc.ar(\n Rand(40,1000),\n 0, \n (numOfCycles.reciprocal * 0.75) * lfo2)\n }\n ) * EnvGen.kr(Env.perc(Rand(0.1,30), Rand(0.1,30)), doneAction: 2)\n )\n }\n).send(s); \n);\n\n(\nr = Routine({\n 200.do({\n x = Synth.new(\"additivePad\"); \n 10.wait;\n });\n});\n);\n\nr.play;\n```"}, {"role": "assistant", "content": "Just going crazy with modulation. Sample is available here: http://soundcloud.com/schemawound/schemawound-dawn-demo-version."}]} +{"conversations": [{"role": "user", "content": "What is rq in BPF.ar?"}, {"role": "assistant", "content": "rq is the reciprocal of Q, so it is a bandwidth control, not a Q control. Small rq means a narrow, resonant band; large rq means a wide, gentle one. The signature is `BPF.ar(in, freq, rq, mul, add)`. A common idiom is `rq = 0.3` for a broad sweep and `rq = 0.02` for a whistle. The same rq convention applies to RLPF and RHPF."}]} +{"conversations": [{"role": "user", "content": "What does `UScore.prepareWaitAndStart` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: targets — (describe argument here); startPos — (describe argument here); updatePosition — (describe argument here). Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "What is `CCPlayer` in SuperCollider?"}, {"role": "assistant", "content": "CCPlayer — adds a MIDI CC responder and plays it to a bus as control rate Category: Libraries > crucial > Players, External Control > MIDI."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `BufSampleRate`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n// compares a 1102.5 Hz sine tone (11025 * 0.1, left) with a 1100 Hz tone (right)\n// the apollo sample has a sample rate of 11.025 kHz\n(\n{\n var freq;\n freq = [BufSampleRate.kr(b) * 0.1, 1100];\n SinOsc.ar(freq, 0, 0.1)\n}.play;\n);\n\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Harmonics`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\na.ramp(1.0, 1.0); // returns a harmonic series\n\nb = Buffer.alloc(s, 512, 1);\n// harmonic series for freqs, ramp down for amps\nb.sine2(a.ramp(1.0, 1.0).postln, a.ramp(0.5, -0.025).postln, true, true, true);\n(\nz = SynthDef(\"help-Osc\", { |out = 0, bufnum = 0|\n Out.ar(out,\n Osc.ar(bufnum, 200, 0, 0.5)\n )\n});\n);\ny = z.play(s, [\\out, 0, \\bufnum, b]);\ny.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `List.clipPut` do?"}, {"role": "assistant", "content": "Same as #-put, but values for index greater than the List instance size minus one will be clipped to `size - 1`, which is the last"}]} +{"conversations": [{"role": "user", "content": "What is a UGen?"}, {"role": "assistant", "content": "A UGen is a unit generator: the primitive signal-processing node of the server. SinOsc, Saw, WhiteNoise, LPF and EnvGen are UGens, and they are wired into a graph inside a SynthDef."}]} +{"conversations": [{"role": "user", "content": "What does `SimpleNumber.bilin` do? What arguments does it take?"}, {"role": "assistant", "content": "map the receiver from two assumed linear input ranges (inMin..inCenter) and (inCenter..inMax) to two linear output ranges (outMin..outCenter) and (outCenter..outMax). If the input exceeds the input range, the following behaviours are specified by the clip Arguments: inCenter; inMin — assumed input minimum; inMax — assumed input maximum; outCenter; outMin — output minimum; outMax — output maximum; clip — nil (don't clip) \\max (clip ceiling) \\min (clip floor) \\minmax (clip both - this is default).."}]} {"conversations": [{"role": "user", "content": "Show another SuperCollider example using `BrownNoise`."}, {"role": "assistant", "content": "```supercollider\n{ SinOsc.ar(BrownNoise.ar(100, 200)) * 0.1 }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Buffer.readNoUpdate` do? What arguments does it take?"}, {"role": "assistant", "content": "As #*read above, but without the automatic update of instance variables. Call `updateInfo` (see below) to update the Arguments: server — The server on which to allocate the buffer.; path — A String representing the path of the soundfile to be read.; startFrame — The first frame of the soundfile to read. The default is 0, which is the beginning of the file.; numFrames — The number of frames to read. The default is -1, which will read the whole file.; bufnum — An explicitly specified buffer number. Supplying a number bypasses the server's buffer allocator, which can lead to conflicts. The best practice is to leave this unset and let the buffer number allocator choose the next available bufnum.; completionMessage — A valid OSC message or a Function which will return one. A Function will be passed this Buffer as an argument when evaluated.."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `AnalogOut`."}, {"role": "assistant", "content": "```supercollider\n// write a sine oscillator's output to a pin\n\n(\nSynthDef(\"help-AnalogOut\", { |out = 0|\n AnalogOut.ar(0, SinOsc.ar(10));\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "My Synth runs but I hear nothing. How do I debug it?"}, {"role": "assistant", "content": "Check in this order, because each step eliminates a whole class of causes:\n\n1. **Is anything coming out of the bus you write to?** `Out.ar(0, sig)` for the master. A typo like\n `Out.ar(2, ...)` is silence.\n2. **Is the amplitude non-zero?** Multiply chain of `mul`/`add`, `amp`, and `env` all have to be positive;\n an envelope with `level: 0` or a gate that never opens is silent.\n3. **Did the Synth free itself immediately?** `doneAction: 2` on an EnvGen whose envelope is already\n finished at creation kills the node instantly. `s.plotTree` shows whether the node exists at all.\n4. **Is the envelope actually moving?** `env.poll` inside the SynthDef prints it per block.\n5. **Is the filter closed?** A `LPF.ar(sig, 50)` on a 440 Hz sine leaves almost nothing.\n\nThe fastest single tool is `s.plotTree`: if the Synth is not in the tree, the problem is lifecycle; if it\nis, the problem is signal."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// play SinOscs silently and wait for granulation envelopes\n\n(\na = Bus.audio(s, 10);\nx = { Splay.ar(In.ar(a, 10) * SinOsc.ar((3..12) * 100, 0, 0.05)) }.play\n);\n\n// send envelope to buses in parallel\n\n(\nz = {\n DXEnvFanOut.ar(\n [0, 3] + Dseq((0..3) + a.index, inf) + Diwhite(0, 3),\n \n // with newer SC versions you can also write:\n // [0, 3] + Dseq((0..3), inf) + Diwhite(0, 3) + a.index,\n \n fadeTime: 0.05,\n width: 1,\n initOutOffset: -0.5\n )\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// play SinOscs silently and wait for granulation envelopes\n\n(\na = Bus.audio(s, 10);\nx = { Splay.ar(In.ar(a, 10) * SinOsc.ar((3..12) * 100, 0, 0.05)) }.play\n);\n\n// send envelope to buses in parallel\n\n(\nz = {\n DXEnvFanOut.ar(\n [0, 3] + Dseq((0..3) + a.index, inf) + Diwhite(0, 3),\n \n // with newer SC versions you can also write:\n // [0, 3] + Dseq((0..3), inf) + Diwhite(0, 3) + a.index,\n \n fadeTime: 0.05,\n width: 1,\n initOutOffset: -0.5\n )\n}.play\n);\n\nx.release;\n\n// cleanup\n\n(\nz.free;\na.free;\n);\n\n\n// Ex.7 from DXEnvFan help looks a bit different,\n// as DXEnvFanOut is an out ugen we don't need to mix\n\n(\na = Bus.audio(s, 4);\n{\n DXEnvFanOut.ar(\n (0..3).collect { |i| Dseq((0..3).rotate(i), inf) } + a.index,\n fadeTime: [0.01, 0.05],\n width: 1\n );\n In.ar(a, 4)\n}.plot(0.2)\n);\n\na.free\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n//a SynthDef\n(\nSynthDef(\"plucking\", {arg amp = 0.1, freq = 220, decay = 5, coef = 0.1;\n\nvar env, snd;\nenv = EnvGen.kr(Env.linen(0, decay, 0.5), doneAction: 2);\nsnd = Pluck.ar(\n in: Saw.ar(freq, 0.5*amp),\n trig: Impulse.kr(0),\n\n maxdelaytime: 0.1,\n delaytime: freq.reciprocal,\n decaytime: decay,\n coef: coef);\n Out.ar(0, [snd, snd]);\n}).add;\n);\n\n//Bugger soundtrack\n(\nPbind(\n \\instrument, \"plucking\",\n \\scale, Scale.lydian,\n \\degree, Prand([[-2.5, -4.001], [-7.002, -5], [-1, -3.003], [1.005, 0.51]], inf),\n \\amp, Pseq([0.1, 0.2, 0.3, 0.4, 0.5, 0.5, 0.5, 0.5], inf),\n \\decay, Pseq([0.25,1, 0.5, 0.125], inf),\n \\coef, Pseq([0.7, 0.8, 0.9], inf),\n \\dur, Pseq([0.01, 0.0025, 0.2475, 0.24, 0.5], inf)\n).play;\n)\n```"}, {"role": "assistant", "content": "This will be the sound track for Bugger, a Frogger clone that started as a school assignment.\r\nSimple SynthDef using Pluck, and a few Pbinds. \r\n\r\nBugger can be found on [GitLab](https://gitlab.com/Modanung/Bugger)."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `SharedIn`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n// only works with the internal server\ns = Server.internal;\ns.boot;\n);\n\n(\nSynthDef(\"help-SharedIn1\", {\n Out.ar(0, SinOsc.ar(Lag.kr(SharedIn.kr(0, 1), 0.01), 0, 0.2));\n}).add;\nSynthDef(\"help-SharedIn2\", {\n Out.ar(1, SinOsc.ar(Lag.kr(SharedIn.kr(0, 1), 0.01, 1.5), 0, 0.2));\n}).add;\n);\n\n(\ns.setSharedControl(0, 300); // an initial value\ns.sendMsg(\\s_new, \"help-SharedIn1\", x = s.nextNodeID, 0, 1);\ns.sendMsg(\\s_new, \"help-SharedIn2\", y = s.nextNodeID, 0, 1);\n\nRoutine({\n 30.do({\n s.setSharedControl(0, 300 * (10.rand + 1));\n 0.2.wait;\n });\n s.sendMsg(\\n_free, x);\n s.sendMsg(\\n_free, y);\n}).play;\n);\n\n\ns.quit;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LinCongC`."}, {"role": "assistant", "content": "```supercollider\n// default initial params\n{ LinCongC.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\\synth_1a, { |freq = 400, preAmp = 5, amp = 0.1|\n var src = SinOsc.ar(freq, 0, mul: preAmp).tanh ! 2;\n OffsetOut.ar(0, src * amp * EnvGen.ar(Env.perc, doneAction: 2))\n}).add;\n);\n\n(\np = Pbind(\n \\instrument, \\synth_1a,\n \\preAmp, PL(\\preAmp), // or Pfunc { ~preAmp } \n \\amp, PL(\\amp), // or Pfunc { ~amp } \n \\midinote, PLseq(\\seq) + PL(\\seqAdd), \n \\dur, 0.2\n);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\\synth_1a, { |freq = 400, preAmp = 5, amp = 0.1|\n var src = SinOsc.ar(freq, 0, mul: preAmp).tanh ! 2;\n OffsetOut.ar(0, src * amp * EnvGen.ar(Env.perc, doneAction: 2))\n}).add;\n);\n\n(\np = Pbind(\n \\instrument, \\synth_1a,\n \\preAmp, PL(\\preAmp), // or Pfunc { ~preAmp } \n \\amp, PL(\\amp), // or Pfunc { ~amp } \n \\midinote, PLseq(\\seq) + PL(\\seqAdd), \n \\dur, 0.2\n);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Font.pointSize` do? What arguments does it take?"}, {"role": "assistant", "content": "Gets or sets the point-size of the font. When getting, returns nil if the font has pixel-size instead. See #-hasPointSize for Arguments: A Float.."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// \\b should thus take twice the value of \\a in each event:\np = Pbind(\\a, Pwhite(1, 10, inf), \\b, Pkey(\\a) * 2).asStream;\n\n\np.next(()) // for Pbind, must pass in a default event even if empty\n\n('a': 10, 'b': 20)\n('a': 2, 'b': 4)\n('a': 5, 'b': 10)\n('a': 4, 'b': 8)\n('a': 2, 'b': 4)\n\n// note: to check if a Pkey's result /equals/ another value,\n// be sure to use |==|\np = Pbind(\n \\a, Pseries(1, 1, inf),\n \\b, Pif(\n Pkey(\\a) == 2,\n \"equals 2\",\n \"nope\"\n )\n).asStream;\n\np.next(());\n// …\n```"}, {"role": "assistant", "content": "\\b should thus take twice the value of \\a in each event: note: to check if a Pkey's result /equals/ another value, (Pkey: access a key in an event stream)"}]} +{"conversations": [{"role": "user", "content": "What does `ArrayedCollection.clipPut` do?"}, {"role": "assistant", "content": "Same as #-put, but values for index greater than the ArrayedCollection instance size minus one will be clipped to `size - 1`, which is the last"}]} +{"conversations": [{"role": "user", "content": "What does Lag do?"}, {"role": "assistant", "content": "`Lag.ar(in, lagTime)` and `Lag.kr(in, lagTime)` smooth a signal with an exponential lag towards its target, which removes the clicks and zipper noise a stepped control would produce. Lag.kr on a mouse or MIDI input is the standard way to make a parameter feel analogue: `Lag.kr(MouseX.kr(200, 4000), 0.2)`. Lag2 and Lag3 are the second- and third-order versions, smoother and slower."}]} {"conversations": [{"role": "user", "content": "How do I set the tempo?"}, {"role": "assistant", "content": "TempoClock.default.tempo = 120/60; the argument is beats per second, so 120 BPM is 2.0. Patterns scheduled on the default clock then follow it."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// where did I leave my keys?\n(\nvar n = 30, m = 5;\nNdef.clear(3);\nNdef.ar(\\x, n);\nNdef(\\y, { Splay.ar(Ndef.ar(\\x, m, LFNoise1.kr(1/m).range(0, n - m - 1))).clip2 * 0.5 }).play; \nNdef(\\x, { \n { \n var a = Ndef.ar(\\x, 1, LFNoise0.kr(Rand()) * Rand() + Rand() * n);\n a + 0.1 * SinOsc.ar(ExpRand(0.2, 1000)) \n } ! n\n}); \n);\n\n// where did I put my keys?\n(\nvar n = 30, m = 5;\nNdef.clear(3);\nNdef.ar(\\x, n);\nNdef(\\y, { Splay.ar(Ndef.ar(\\x, m, LFNoise1.kr(1/m).range(0, n - m - 1))).clip2 * 0.5 }).play; \nNdef(\\x, { \n {\n var a = Ndef.ar(\\x, 1, LFNoise0.kr(Rand()) * Rand() + Rand() * n);\n SinOsc.ar(ExpRand(0.2, 1000), a) \n } ! n\n}); \n)\n```"}, {"role": "assistant", "content": "Cross-tuning between multiple signal dimensions. The code is finished without listening."}]} -{"conversations": [{"role": "user", "content": "What is rq in BPF.ar?"}, {"role": "assistant", "content": "rq is the reciprocal of Q, so it is a bandwidth control, not a Q control. Small rq means a narrow, resonant band; large rq means a wide, gentle one. The signature is `BPF.ar(in, freq, rq, mul, add)`. A common idiom is `rq = 0.3` for a broad sweep and `rq = 0.02` for a whistle. The same rq convention applies to RLPF and RHPF."}]} -{"conversations": [{"role": "user", "content": "What does `Object.superPerformList` do?"}, {"role": "assistant", "content": "Like performList, superPerformList calls a method, however it calls the method on the superclass. selector: A Symbol representing a method selector. args: Method arguments. If the last argument is a List or an Array, then its elements are unpacked and passed as"}]} -{"conversations": [{"role": "user", "content": "What is `BLowShelf` in SuperCollider?"}, {"role": "assistant", "content": "BLowShelf — Low Shelf The B equalization suite is based on the Second Order Section (SOS) biquad UGen. Category: UGens > Filters > BEQSuite."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Der Mussolini (bassline cover)?"}, {"role": "assistant", "content": "```supercollider\n/* An approach to try to reproduce the 'famous' bassline of \"Der Mussolini\" by D.A.F. */\n\n// very bad simulated analogue distorted bass synth\n// too distorted compared to the original...\n\nSynthDef(\\daf_bass,{ |out, freq=440, sustain=1, gate=1, amp=0.1|\n var snd, env, fenv, harm;\n harm = [1,1.01,2,2.02,3.5,4.01,5.501];\n harm = harm ++ (harm*2);\n snd = SinOsc.ar(freq*harm).sum.distort * 2;\n snd = snd + SinOsc.ar(freq / [1, 2]).sum!2;\n env = EnvGen.kr(Env.adsr(0.001,0.2,0.9,0.25), gate, amp, doneAction:2);\n snd = snd * env;\n OffsetOut.ar(out, (snd!2));\n}).add;\n\n// approx 63 bpm\nTempoClock.default.tempo = 63/60;\n\n// approx bass pattern + modulation of Mussolini bassline\nPdef(\\daf_bass,\n Pbind(\n \\instrument, \\daf_bass,\n \\scale, Scale.minor,\n \\octave, [3], // try out [2,3] or [3,4] for octave bass leetness\n \\ctranspose,Pseq([\n Pn(-1,16*4),\n Pn(1,16*2)\n ], inf),\n // -1 for thinking in musical degrees...\n \\degree, Pseq([1, 4, 1, 10, 1, 8, 1, 1, 8, 1, 8, 1, 8, 7, 1, 8]-1,inf),\n \\legato, Pwhite(0.75, 0.8),\n \\dur, 0.2\n )\n).play;\n\n// link: http://www.youtube.com/watch?v=15ScQivK5DY\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\nb = Buffer.alloc(s, 512, 1, { |buf| buf.chebyMsg([1, 0, 1, 1, 0, 1]) });\n(\nx = {\n Shaper.ar(\n b,\n SinOsc.ar(300, 0, Line.kr(0, 1, 6)),\n 0.5\n )\n}.play;\n;\nx.free; b.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\nb = Buffer.alloc(s, 512, 1, { |buf| buf.chebyMsg([1, 0, 1, 1, 0, 1]) });\n(\nx = {\n Shaper.ar(\n b,\n SinOsc.ar(300, 0, Line.kr(0, 1, 6)),\n 0.5\n )\n}.play;\n);\nx.free; b.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Supernova, Groups, Threads, Ndef?"}, {"role": "assistant", "content": "SuperCollider forum — Supernova, Groups, Threads, Ndef?\n\nAbout Ndef:\n\nAFAIK you can manually move a NodeProxy’s group into another group:\n\n```supercollider\n~pargroup = ParGroup(s);\n\nNdef(\\a, { Silent.ar(1) });\n\nNdef(\\a).group.moveToHead(~pargroup);\n```\n\nBut...\n\nNodeProxies use InFeedback.\n\nI was a little suspicious about this for parallel processing. As I recalled, InFeedback’s result depends on the order of execution:\n\n-\nIf the source node for the bus finished processing before the server reaches InFeedback, then InFeedback will output the block of audio being processed now.\n\n-\nIf the source node comes after the node containing InFeedback, then it will output the previous block of audio.\n\nIn both cases, these are the most recently available audio blocks. But, if the order of evaluation is not consistent, then the output may not be consistent.\n\nLet’s test that:\n\n```supercollider\nb = Bus.audio(s, 1);\n\na = { SinOsc.ar(200, 0, 0.1) }.play(outbus: b);\n\nc = { InFeedback.ar(b, 1).dup }.play(target: a, addAction: \\addAfter);\n\n(\nfork {\n var order = Pseq([\\moveBefore, \\moveAfter], inf).asStream;\n loop {\n c.perform(order.next, a);\n 1.0.wait;\n }\n}\n)\n```\n\nOops.\n\nThis means you can’t randomly throw Ndefs into ParGroups. If one Ndef reads a signal from another, then you have to make sure that the target Ndef comes later in a serial (regular) Group. (Correctness of the result should be more important than “optimal” usage of multiple cores.)\n\nIf you don’t, and if supernova happens to put the source and target Ndefs onto separate cores at roughly the same time, then the target might evaluate InFeedback either before or after the source finishes, and there’s no guarantee of this being consistent. So you might get clicks.\n\nhjh"}]} {"conversations": [{"role": "user", "content": "What is `Tdef`?"}, {"role": "assistant", "content": "Tdef — task reference definition"}, {"role": "user", "content": "What does `Tdef.all` do?"}, {"role": "assistant", "content": "A global IdentityDictionary with all proxies."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nTdef(\\x, { loop { 0.5.wait; \"aaaaaaaaaaaaaazz\".scramble.postln } }).play;\nTdef(\\x, { loop { 0.125.wait; \"aazz\".scramble.postln } });\nTdef(\\x, { loop { 0.5.wait; (note: 14.rand).play } });\nTdef(\\x, { loop { 0.5.wait; (note: 14.rand + [0, 3, 6, 7].keep(4.rand)).play } });\nTdef(\\x).stop;\nTdef(\\x).play;\nTdef(\\x).clear;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\nq = Patch({ Saw.ar(40.midicps) * 0.05 });\nr = Patch({ Saw.ar(52.midicps) * 0.05 });\np = PlayerSocket.new(\\audio,1);\np.play;\n);\n// then get the socked to alternately spawn q and r\np.prepareAndQSpawn(q,0.1);\np.prepareAndQSpawn(r,0.1);\np.prepareAndQSpawn(q,0.1);\np.prepareAndQSpawn(r,0.1);\n\n\n(\np.prepareAndSpawn(\n Patch({ arg freq=400,gate=1.0;\n Saw.ar(freq) * EnvGen.kr(Env.adsr(0.1,2.\n// …\n```"}, {"role": "assistant", "content": "then get the socked to alternately spawn q and r the current player in the socket is set to : p.source (PlayerSocket: a player that can play other players using a cross-faded and fuse-protected socket)"}]} -{"conversations": [{"role": "user", "content": "What is `Pnsym`?"}, {"role": "assistant", "content": "Pnsym — use a pattern of symbols to embed Pdefns"}, {"role": "user", "content": "What does `Pnsym.dict` do?"}, {"role": "assistant", "content": "set the dictionary to be used."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\n// load a synthdef\ns.boot;\nSynthDef(\"gpdef\",\n { |out = 0, freq = 440, sustain = 0.05, amp = 0.1, pan|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain), doneAction: Done.freeSelf) * amp;\n Out.ar(out, Pan2.ar(SinOsc.ar(freq, 0, env), pan))\n }).add;\n);\n\nPdefn(\\x, Pn(1, 3));\nPdefn(\\y, Prand([5, 9, 1], 2));\nPdefn(\\z, Pdefn(\\y) * 2);\n\n(\nPdef(\\play,\n Pbind(\n \\instrument, \\gpdef,\n \\harmonic, Pnsym(Pseq([\\x, \\x, Prand([\\x, \\y]), [\\z, \\y], \\y], inf)).trace,\n \\dur, 0.2, \\note, 10\n )\n).play;\n);\n\n// change root pattern:\nPdefn(\\x, Pn(2, 3));\nPdefn(\\x, Pseq([1, 3, 1, 2, 1, 4, 5]));\nPdefn(\\x, Pseq([1, 3, 1, 2, [1, 3], 4, 5]));\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Just a lunch time tweet."}, {"role": "assistant", "content": "```supercollider\n{CombC.ar(Klang.ar(`[[100,101,1000,1001]],1,0)*0.1,0.33,LFTri.ar(0.1, 0, 0.1, 0.11)+LFTri.ar(0.17, 0, 0.1, 0.22),10)!2}.play;\n\n//Variation\n‎{CombC.ar(Klang.ar(`[[100,101,1000,1001]],1,0)*0.1,1.33,LFTri.ar(0.3, 0, 0.1, 0.71)+LFTri.ar(0.7, 0, 0.1, 0.52),10)!2}.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Control`."}, {"role": "assistant", "content": "```supercollider\na = { SinOsc.ar(\\freq.kr(440, 1.2)) }.play;\na.set(\\freq, 330);\na.release;\na = { SinOsc.ar(\\freq.kr([440, 460], 1.2)) }.play;\na.setn(\\freq, [330, 367]);\na.release;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Env.step` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new envelope specification where all the segments are horizontal lines. Given n values of times only n levels need to be provided, corresponding to the fixed value of each Arguments: levels — an array of levels. The first value is the initial level of the envelope and, when used with EnvGen, is held until the `gate` opens. If a level is a UGen, it's value is updated only when the envelope reaches that node. When a level is itself an array, the envelope returns a multichannel output (for ; times — an array of durations of segments in seconds. It should be the same size as the levels array.; releaseNode — an Integer or `nil`. The envelope will sustain at the release node until released.; loopNode — an Integer or `nil`. If not `nil` the output will loop through those nodes starting at the loop node to the node immediately preceding the release node, before back to the loop node, and so on. Note that the envelope only transitions to the release node when released. Examples are below. The loop is; offset — an offset to all time values (only applies in IEnvGen).."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes vinyl noise emulation."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef.new(\\vinylCrackling, { arg out=0;\n var pop,imp,modImp,midNoise,hiNoise,loNoise,loopTime=8,numChan=2,w,x,y;\n\n //Harder pops\n pop = TDuty.ar(Dseq({ 1.0.bilinrand.abs } ! loopTime,inf));\n pop = Resonz.ar(Decay.ar(pop,TRand.ar(0.001,0.1,pop)),Demand.ar(pop,0,Dseq({ 7000.bilinrand.abs+40 } ! loopTime,inf)),\n mul:Demand.ar(pop,0,Dseq({ exprand(0.1,0.87) } ! loopTime,inf)));\n pop = LeakDC.ar(pop,TRand.ar(0.9,0.9995,pop));\n #w,x,y = PanB2.ar(pop,Demand.ar(pop,0,Dseq({ 1.0.rand2 } ! loopTime,inf)));\n\n //Softer, highpass filtered impulses\n imp = { arg i; HPF.ar(LPF.ar(Dust2.ar(8),8000.0),6000.0,WhiteNoise.ar(0.7)) } ! numChan;\n\n //Faster, modulated lowpass filtered impulses\n modImp = LPF.ar(Dust.ar(LFDNoise3.ar(1).exprange(100,500),LFDNoise3.ar(10).exprange(0.01,0.07)),9000.0) ! numChan;\n\n //Mid frequency modulated noise background\n midNoise = LPF.ar(GrayNoise.ar(LFDNoise3.ar(60))*WhiteNoise.ar(0.009),12000.0) ! numChan;\n\n //High frequency modulated noise background\n hiNoise = HPF.ar(LPF.ar(GrayNoise.ar(LFDNoise3.ar(60))*WhiteNoise.ar(0.01),14000.0),8000.0) ! numChan;\n\n //Low frequency modulated noise background\n loNoise = LPF.ar(BrownNoise.ar(PinkNoise.ar.range(0.001,0.02)),1200) ! numChan;\n\n Out.ar(out,DecodeB2.ar(numChan,w,x,y)+imp+modImp+midNoise+hiNoise+loNoise);\n }).add;\n);\n\ns.sendMsg('/s_new',\\vinylCrackling,a=s.nextNodeID,0,1,\\out,0);\ns.sendMsg('/n_free',a);\n```"}]} -{"conversations": [{"role": "user", "content": "What is `RedGUI` in SuperCollider?"}, {"role": "assistant", "content": "RedGUI — base class of gui wrappers This class is an abstract class and only creates a skin at `*initClass`. Category: Red > redGUI."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pluck`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n// excitation signal is WhiteNoise, triggered twice a second with varying OnePole coef\n(\n { Pluck.ar(WhiteNoise.ar(0.1), Impulse.kr(2), 440.reciprocal, 440.reciprocal, 10,\n coef: MouseX.kr(-0.999, 0.999))\n }.play(s)\n);\ns.quit;\n// a group of angry fretless mandolin players\n(\n {\n var freq, numparts;\n numparts = 50;\n freq = SinOsc.kr(Array.fill(numparts, { Rand(0.05, 0.2) }),\n Array.fill(numparts, { Rand(0, 1.0) })).range(1000, 3000);\n LeakDC.ar(\n Pan2.ar(\n Pluck.ar(\n WhiteNoise.ar(0.1).dup(numparts),\n Impulse.kr(Array.fill(numparts, { Rand(10, 12) })),\n 100.reciprocal, freq.reciprocal, 2, Rand(0.01, 0.2), mul: 1),\n Array.fill(numparts, { Rand.new(-1.0, 1.0) }))\n .sum\n );\n }.play(s);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PparGroup`."}, {"role": "assistant", "content": "```supercollider\n(\nvar p, q, r, o;\np = Pbind(\\degree, Prand((0..7), 12), \\dur, 0.3, \\legato, 0.2);\n\nPparGroup(p).play;\n\n// post the node structure:\nfork {\n s.queryAllNodes;\n 3.wait;\n s.queryAllNodes;\n 2.wait;\n s.queryAllNodes;\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for mixolydian flat six meditation in pythagorean?"}, {"role": "assistant", "content": "```supercollider\n// last updated on sccode.org fri 7. jun, 14:57 CET\n\n( // load this first - synth def\nSynthDef(\\harpsi, { \n arg outbus = 0, freq = 440, ffreq = 2, amp = 1, gate = 1, release = 1;\n var out;\n freq = freq * Rand(1, 1.005);\n out = EnvGen.ar(Env.adsr(releaseTime:release), gate, doneAction: Done.freeSelf)\n * amp * Pulse.ar([freq,freq*1.005]/1, 0.25, mul:0.75 );\n out = out * [Rand(0.0, 1.0), Rand(0.0, 1.0)];\n out = RLPF.ar(out, freq * (ffreq / 4) + 1 );\n Out.ar(outbus, out); \n}).add; \n);\n\n\n( // then run this - sequence\nTempoClock.default.tempo = 1.4;\n~scale = Scale.new(#[0,2,4,5,7,8,10],tuning: \\pythagorean, name: \"mixolydianb6\");\np = Pbind(\n \\instrument, \\harpsi,\n \\root, -12,\n \\scale, ~scale,\n \\ffreq, Pseq(((1..2) ++ (3..1)),inf),\n \\degree, Pseq([\n Pseries({ rrand(0, 7) }, { ([1,2]).choose }, { rrand(4, 8) }),\n Pseries({ rrand(0, 7) }, {([1,2]).choose}, { rrand(4, 8) }),\n Pseries({ rrand(7, 14) }, 0-{([1,2]).choose}, { rrand(4, 8) })\n ], inf),\n \\release, Prand([5,6,7,8],inf),\n \\dur, Prand((1..8)/4, inf),\n \\amp, Prand(((1..8)/8)+1, inf)\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a closed hi-hat in SuperCollider."}, {"role": "assistant", "content": "High-passed noise with a very short envelope — the filter is what makes it a hat rather than a hiss.\n\n```supercollider\n(\nSynthDef(\\hat, { |out = 0, amp = 0.3, dur = 0.06|\n var env = EnvGen.kr(Env.perc(0.001, dur, 1, -6), doneAction: 2);\n Out.ar(out, Pan2.ar(HPF.ar(WhiteNoise.ar, 7000) * env * amp));\n}).add;\n);\nSynth(\\hat, [\\dur, 0.04]);\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\sub;\n~description = \"Dedicate a channel to subwoofer signal. Ideally use with monoSpat spatializer\";\n~channelLayout = \\mono;\n~function = { |in = 0, sub_gainDB = -99, sub_lpHz = 200|\n LPF.ar(in, sub_lpHz.clip(5.0, 18000)) * sub_gainDB.dbamp\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Now you're going to die (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\fall, { arg freq=200, pan=0, amp=0.1;\n var sig;\n sig = ( WhiteNoise.ar + 0.8 ) * LFSaw.ar({ exprand(10.0,10000) }!20 * ( 1 + ( SinOsc.ar((1..4).rand(0.0)/18 * XLine.kr(1,121200,80)) * 1/41 * XLine.kr(1,180,60) )));\n sig = DelayC.ar(sig, 0.2, {rrand(1/5,1/10000) * ( 1 + ( SinOsc.ar((1..2).rand(0.0)/18 * XLine.kr(1,121200,60)) * 1/41 * XLine.kr(1,180,60) ))}!4) + sig / 2;\n sig = DelayC.ar(sig, 0.2, {rrand(1/5,1/10000) * XLine.kr(1,1/1000,14)}!4) + sig / 2;\n sig = sig + BPF.ar(\n sig, \n { ( exprand(100.0,10000) * LFNoise1.ar(1/100.0.rand).range(1,2) ).clip(20,20000) }!10,\n { ( rand(0.01,1) * LFNoise1.ar(1/100.0.rand).range(1,2) ).clip(0.01,1) }!10\n );\n sig = BRF.ar(\n sig, \n { ( exprand(100.0,10000) * LFNoise1.ar(1/100.0.rand).range(1,2) ).clip(20,20000) }!10,\n { ( rand(0.01,1) * LFNoise1.ar(1/100.0.rand).range(1,2) ).clip(0.01,1) }!10\n );\n sig = LeakDC.ar(sig);\n sig = LPF.ar(sig, 17000 * XLine.kr(1/100,1,4));\n sig = sig * 5 * 3;\n sig = sig.mean;\n sig = sig * amp;\n sig;\n}).play;\n);\n```"}]} -{"conversations": [{"role": "user", "content": "What are the arguments of PlayBuf.ar?"}, {"role": "assistant", "content": "`PlayBuf.ar(numChannels, bufnum, rate, trigger, startPos, loop)`. numChannels must match what is in the buffer, or you get a channel mismatch; bufnum is the Buffer's integer number; rate is playback speed where 1 is normal and negative plays backwards; trigger restarts playback on each trigger in loop mode; startPos is in frames; loop is 0 or 1. `PlayBuf.ar(1, ~buf, BufRateScale.kr(~buf), loop: 1)` is the standard pitch-correct form."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Re: Variations for Z1 sawtooth?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n var mod = SinOsc.ar([0.1,0.15,0.2]).range(0,1);\n var sig = LFPulse.ar(1.1).range(1,10);\n var sig2 = LFNoise1.ar(0.08).range(0.99,1.01);\n var saw = LFSaw.ar([10,12,15]*sig*sig2);\n var out = (saw - ((saw>0)*mod)+(mod*0.5));\n Splay.ar(out)*0.1;\n}.play;\n\n{\n var mod = SinOsc.ar([0.1,0.15,0.2]).range(0,1);\n var sig = LFPulse.ar(1).range(1,10);\n var sig2 = LFTri.ar(0.1,[0,1,2,3]).range(1,10*sig);\n var sig3 = LFNoise1.ar(0.05).range(0.99,1.01);\n var saw = SinOsc.ar(LFSaw.ar([10,12,15]*sig2*sig3).range(200,300));\n var out = (saw - ((saw>0)*mod)+(mod*0.5));\n Splay.ar(out)*0.1;\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// SynthDefs from Ex. 1a\n\n(\n// Function to create midinote patterns in different ranges\n\nr = { |add = 0| Pstutter(5, Pwhite(60, 70) + add) };\n\n// each setting stream affects two synths: those of corresponding indices of \\synths,\n// but only with one value: the Integer polled from the Pstutter stream\n\np = PpolyPar([[\n \\synths, [0, 1],\n \\dur, 1/6,\n \\midinote, r.(),\n \\amp, 0.04\n ],[\n \\synths, [0, 2],\n \\dur, 1/4,\n \\midinote, r.(10),\n \\amp, 0.03\n ],[\n \\synths, [1, 2],\n \\dur, 1/3\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// SynthDefs from Ex. 1a\n\n(\n// Function to create midinote patterns in different ranges\n\nr = { |add = 0| Pstutter(5, Pwhite(60, 70) + add) };\n\n// each setting stream affects two synths: those of corresponding indices of \\synths,\n// but only with one value: the Integer polled from the Pstutter stream\n\np = PpolyPar([[\n \\synths, [0, 1],\n \\dur, 1/6,\n \\midinote, r.(),\n \\amp, 0.04\n ],[\n \\synths, [0, 2],\n \\dur, 1/4,\n \\midinote, r.(10),\n \\amp, 0.03\n ],[\n \\synths, [1, 2],\n \\dur, 1/3,\n \\midinote, r.(20),\n \\amp, 0.05\n ]],\n [\\saw, \\pulse, \\sine]\n).play\n);\n\np.stop;\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for 2 channels of chuckling sawtooths."}, {"role": "assistant", "content": "```supercollider\n//hall of mirrors\n{[AllpassC.ar(HPF.ar(RLPF.ar(Saw.ar(LFPar.kr(0.25).range(220,440)),LFPar.kr(MouseX.kr(0,8),pi).range(220,20000),0.3),LFPar.kr(MouseY.kr(0,8)).range(220,20000)),2,MouseX.kr(0,0.5),2),AllpassC.ar(HPF.ar(RLPF.ar(Saw.ar(LFPar.kr(0.25,pi).range(440,220)),LFPar.kr(MouseX.kr(8,0),pi).range(20000,220),0.3),LFPar.kr(MouseY.kr(8,0),pi).range(20000,220)),2,MouseX.kr(0.5,0),2)]}.play\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// \\b should thus take twice the value of \\a in each event:\np = Pbind(\\a, Pwhite(1, 10, inf), \\b, Pkey(\\a) * 2).asStream;\n\n\np.next(()) // for Pbind, must pass in a default event even if empty\n\n('a': 10, 'b': 20)\n('a': 2, 'b': 4)\n('a': 5, 'b': 10)\n('a': 4, 'b': 8)\n('a': 2, 'b': 4)\n\n// note: to check if a Pkey's result /equals/ another value,\n// be sure to use |==|\np = Pbind(\n \\a, Pseries(1, 1, inf),\n \\b, Pif(\n Pkey(\\a) == 2,\n \"equals 2\",\n \"nope\"\n )\n).asStream;\n\np.next(());\n// …\n```"}, {"role": "assistant", "content": "\\b should thus take twice the value of \\a in each event: note: to check if a Pkey's result /equals/ another value, (Pkey: access a key in an event stream)"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// randomly modulate all params\n(\n{ LatoocarfianL.ar(\n SampleRate.ir/4,\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5)\n) * 0.2 }.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// randomly modulate all params\n(\n{ LatoocarfianL.ar(\n SampleRate.ir/4,\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5)\n) * 0.2 }.play(s);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nNdef(\\x, { SinOsc.ar(Rand(500, 900)) * 0.1 }).play;\nNdef(\\x).copy(\\y);\nNdef(\\y.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nNdef(\\x, { SinOsc.ar(Rand(500, 900)) * 0.1 }).play;\nNdef(\\x).copy(\\y);\nNdef(\\y).play;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n SynthDef(\\multi, { |out, freq = #[100, 200, 300], amp = 0.1, pan = 0, sustain = 1|\n var audio, env;\n env = EnvGen.kr(Env.perc(0.01, sustain), doneAction: Done.freeSelf);\n audio = Mix(Saw.ar(freq));\n audio = Pan2.ar(audio * env, pan, amp);\n OffsetOut.ar(out, audio)\n }).add;\n\n (instrument: \\multi, freq: [[500, 501, 700]], sustain: 2).play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n SynthDef(\\multi, { |out, freq = #[100, 200, 300], amp = 0.1, pan = 0, sustain = 1|\n var audio, env;\n env = EnvGen.kr(Env.perc(0.01, sustain), doneAction: Done.freeSelf);\n audio = Mix(Saw.ar(freq));\n audio = Pan2.ar(audio * env, pan, amp);\n OffsetOut.ar(out, audio)\n }).add;\n\n (instrument: \\multi, freq: [[500, 501, 700]], sustain: 2).play\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// increase phase multiplier\n{ FBSineN.ar(SampleRate.ir, 1, 0, XLine.kr(1, 2, 10), 0.1) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// increase phase multiplier\n{ FBSineN.ar(SampleRate.ir, 1, 0, XLine.kr(1, 2, 10), 0.1) * 0.2 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n Lag3.kr( // lag the modulator\n LFPulse.kr(4, 0, 0.5, 50, 400), // frequency modulator\n Line.kr(0, 1, 15) // modulate lag time\n ),\n 0, // phase\n 0.3 // sine amplitude\n )\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n Lag3.kr( // lag the modulator\n LFPulse.kr(4, 0, 0.5, 50, 400), // frequency modulator\n Line.kr(0, 1, 15) // modulate lag time\n ),\n 0, // phase\n 0.3 // sine amplitude\n )\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(..-9).mod(-3);\n// returns [0, -1, -2, 0, -1, -2, 0, -1, -2, 0]\n(..-9).modSeaside(-3);\n// returns [0, 2, 1, 0, -4, -5, 0, -4, -5, 0]\n\n// plot\n(-25..25).modSeaside(-5).plot.plotMode_(\\steps);\n\n// modSeaside\nPbind(\\note, modSeaside(Pseries(-15, 1, 25), -5), \\dur, 0.2).play;\n\n// modSeaside with different divisors\nPbind(\\note, modSeaside(Pseries(-15, 1, 25), [3, -4, -5]), \\dur, 0.2).play;\n\n// mod\nPbind(\\note, mod(Pseries(-15, 1, 25),\n// …\n```"}, {"role": "assistant", "content": "returns [0, -1, -2, 0, -1, -2, 0, -1, -2, 0] returns [0, 2, 1, 0, -4, -5, 0, -4, -5, 0] (Integer: 32-bit Integer number)"}]} -{"conversations": [{"role": "user", "content": "What does `VOSIM.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "vosim pulse generator Arguments: trig — [ar kr] starts a vosim pulse when a transition from non-positive to positive occurs and no other vosim is still going. audio rate input will produce sample accurate triggering.; freq — [ar kr] the frequency of the squared sinewave.; nCycles — the number of squared sinewaves to use in one vosim pulse. nCycles gets checked when VOSIM receives a trigger.; decay — the decay factor.."}]} -{"conversations": [{"role": "user", "content": "What's the difference between Env.perc and Env.adsr?"}, {"role": "assistant", "content": "`Env.perc(attack, release)` goes up once and decays to zero — one-shot sounds. `Env.adsr(a, d, s, r)` holds at a sustain level while its gate is open and only releases when the gate closes — notes you start and stop."}, {"role": "user", "content": "So which do I use for a pad?"}, {"role": "assistant", "content": "adsr, with `gate` as a Synth argument and `doneAction: 2` on the EnvGen:\n\n```supercollider\nSynthDef(\\pad, { |out = 0, freq = 220, gate = 1|\n var env = EnvGen.kr(Env.adsr(0.8, 0.4, 0.7, 2), gate, doneAction: 2);\n Out.ar(out, Saw.ar(freq) * env * 0.1)\n}).add;\n```\n\nThen `x.set(\\gate, 0)` releases it over the 2 seconds of release time."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes SyncSaw madness."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\fun, {\n var src, freq = 25;\n var lagTime = \\lagTime.kr(0);\n var vibrato = \\vibrato.kr([ 1.3515662384033, 1.3061940193176, 0.604791264534, 1.2328997278214, 0.33569867610931, 0.40528120040894, 1.0865307760239, 1.22394572258, 1.7781081724167, 0.15319232463837 ], lagTime);\n \n var vibRatio = \\vibRatio.kr([ 2.9047239411079, 0.39578121743921, 0.10932490532285, 0.051738858660565, 0.17840235868831, 0.024495380749894, 3.9689920754869, 4.1139229659643, 0.23327501819885, 0.97643604193256 ], lagTime);\n \n var freqVary = \\freqVary.kr([ 143.76541377614, 14.25479545154, 6.6728691888342, 58.434807398325, 154.89385962072, 34.112274650688, 3.1140823758236, 10.42040949808, 158.59959972037, 1.2163188440936 ], lagTime);\n \n \n var numSrcs = vibrato.size;\n\n src = numSrcs.collect{|i|\n var freq2 = (freq * freqVary[i]) * LFNoise2.kr(0.01).range(1, 1.5);\n     \n SyncSaw.ar(freq2, freq2 * SinOsc.ar(Line.kr(1, vibrato[i], 20) * vibRatio[i], Rand(0, 0.8)).range(pi, pi * 0.1)) * rrand(0.05, 0.1)\n };\n \n src = Splay.ar(src);\n \n}).play\n);\n\nNdef(\\fun).fadeTime = 20;\n\nNdef(\\fun).rebuild\n\n(\nNdef(\\fun).setn(\n \\lagTime, [5],\n \\vibRatio, {exprand(0.1, 3)}!10,\n \\freqVary, {exprand(1, 150)}!10,\n \\vibrato, {exprand(0.3, 3)}!10\n)\n);\n(\nNdef(\\fun).setn(\n \\lagTime, [200],\n \\vibRatio, ({exprand(0.1, 3)}!10).sort,\n \\freqVary, ({exprand(1, 150)}!10).sort,\n \\vibrato, ({exprand(0.3, 3)}!10).sort\n)\n);\n\n(\nNdef(\\fun).xsetn(\n \\lagTime, [100],\n \\vibRatio, {exprand(0.1, 3)}!10,\n \\freqVary, {exprand(1, 150)}!10,\n \\vibrato, {exprand(0.3, 3)}!10\n))\n```"}]} -{"conversations": [{"role": "user", "content": "In what order should I learn SuperCollider?"}, {"role": "assistant", "content": "The order that pays off fastest:\n\n1. **One UGen and Out** — `{ SinOsc.ar(440) * 0.2 }.play`. Learn that a graph must reach Out.\n2. **Envelopes and doneAction** — the difference between a sound and a click.\n3. **SynthDef and Synth** — naming a graph, controlling it with arguments, freeing it with a gate.\n4. **Patterns** — `Pbind` for sequence, so you stop writing loops by hand.\n5. **Buses and effects** — chaining, sends, groups.\n6. **JITLib** — Ndef for patches you modify while they play.\n\nVocabulary to carry: UGen, SynthDef, Synth, bus, group, envelope, gate, doneAction, Pattern, clock. Every\nconfusion in SuperCollider tends to be one of those words."}]} -{"conversations": [{"role": "user", "content": "What does `RedBitStream.new` do? What arguments does it take?"}, {"role": "assistant", "content": "stream bits Arguments: collection — An Array of integers.; byte — Number of bits per byte in this collection of integers. If byte is 8 then integers should not be greater than 255.."}]} -{"conversations": [{"role": "user", "content": "What does `OSCFunc.recvPort` do?"}, {"role": "assistant", "content": "Get this OSCFunc's receiving Returns: An Integer"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//multiple objects within a world with gravity force\n//color and size depends on object's mass\n\n(\nvar width= 300, height= 300, w, wgrav, world, n= 80;\n\n//--world\nw= RedWindow(\"vector test\", Rect(128, 64, width, height)).front;\nwgrav= RedVector2D[-0.1, 0.98]; //world xy gravity\nworld= RedWorld3(RedVector2D[width, height], wgrav, 20, 0.2); //dim,grav,maxvel,damp\n\n//--objects\n{\n var mass= 1.0.rrand(4); //random mass for each object\n RedObject(world, RedVector2D[width, 20].rand, 0, 0, mass, mass*5); //world,loc,vel,acc,mass,size\n}.dup(n);\n\n//--loop\nw.draw{\n world.objects.do{|o|\n o.addForce(world.gravity);\n o.update;\n world.contain(o);\n\n //--render\n Pen.strokeColor= Color.grey(o.mass/4);\n Pen.strokeRect(Rect.aboutRedObject2D(o));\n };\n};\nw.play;\nCmdPeriod.doOnce({w.close});\n)\n```"}, {"role": "assistant", "content": "multiple objects within a world with gravity force color and size depends on object's mass."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Monzo function?"}, {"role": "assistant", "content": "```supercollider\n// https://en.xen.wiki/w/Monzo\n//Monzo notation of JI ratios is often used in combination with Vals for temperament theory. I wrote this not for temperament, but rather to use monzos as a possible alternative to otonality and utonality, espescially when sonifying streams that include negative numbers.\n\n(//function that takes a collection representing a monzo as an argument, and outputs the ratio it encodes\n~zo = {\n arg exponentCollection;\n var ratio = 1;\n exponentCollection.do({arg item, i; ratio = ratio * (i.nthPrime).pow(item);});\n ratio;\n};\n);\n\n//5-limit\n~zo.([-1, 1]); // 3/2\n~zo.([-2, 0, 1]); // 5/4\n~zo.([-3, 2]); // 9/8\n~zo.([-4, 4, -1]); // 81/80\n~zo.([-4, 4, -1]); // 81/80\n\n//7-limit\n~zo.([-2, 0, 0, 1]); // 7/4\n~zo.([-1, -1, 0, 1]); // 7/6\n~zo.([0, 0, -1, 1]); // 7/5\n\n//fractional monzos\n~zo.([-1/2, 3.3, 4, -5]); //sure\n//it might be fun to do monzo glissandos in different places?\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes DelayPannerSawSine (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n//delaypannersawsine\n{XFade2.ar(AllpassC.ar(HPF.ar(RLPF.ar(Saw.ar(LFPar.kr(0.25).range(220,440)),LFPar.kr(MouseX.kr(0,8),pi).range(220,20000),0.3),LFPar.kr(MouseY.kr(0,8)).range(220,20000)),2,MouseX.kr(0,2),2),AllpassC.ar(HPF.ar(RLPF.ar(WhiteNoise.ar * Saw.ar(LFPar.kr(0.25).range(220,440)),LFPar.kr(MouseX.kr(0,8),pi).range(220,20000),0.3),LFPar.kr(MouseY.kr(0,8)).range(220,20000)),2,MouseY.kr(0,2),2),MouseX.kr(-1,1))}.play\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n~loDev = -6;\n~hiDev = 5;\n~lookBack = 2;\n\np = Pbind(\n \\dur, 0.2,\n \\midinote, PLIdev(72, 11, \\loDev, \\hiDev, \\lookBack).trace(prefix: \"midi \"),\n).play;\n);\n\n\n// change on the fly\n// as lookBack equals 2, this defines a fixed sequence (up or down anyway)\n\n(\n~loDev = -1;\n~hiDev = 1;\n);\n\n\n// widen range\n\n(\n~loDev = -6;\n~hiDev = 5;\n);\n\n\n// force a twelve-tone row\n\n~lookBack = 11;\n\n\n// contradictory input, lookBack 11 not possible within range, causes\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n~loDev = -6;\n~hiDev = 5;\n~lookBack = 2;\n\np = Pbind(\n \\dur, 0.2,\n \\midinote, PLIdev(72, 11, \\loDev, \\hiDev, \\lookBack).trace(prefix: \"midi \"),\n).play;\n);\n\n\n// change on the fly\n// as lookBack equals 2, this defines a fixed sequence (up or down anyway)\n\n(\n~loDev = -1;\n~hiDev = 1;\n);\n\n\n// widen range\n\n(\n~loDev = -6;\n~hiDev = 5;\n);\n\n\n// force a twelve-tone row\n\n~lookBack = 11;\n\n\n// contradictory input, lookBack 11 not possible within range, causes repetitions\n\n(\n~loDev = -3;\n~hiDev = 2;\n);\n\np.stop\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{\nvar a, b, t = Impulse.kr(2);\na = { Dseq([1, 2, 3, 4, 5], inf) } * 100;\nb = a + 1;\nDemand.kr(t, 0, [a, b]).poll(t\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{\nvar a, b, t = Impulse.kr(2);\na = { Dseq([1, 2, 3, 4, 5], inf) } * 100;\nb = a + 1;\nDemand.kr(t, 0, [a, b]).poll(t)\n}.play\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n Instr(\\helpTempoPlayer,{\n Impulse.ar( Tempo.kr )\n });\n\n Patch(\\helpTempoPlayer).play(atTime:1)\n;\nTempo.bpm = 100;\n\nTempo.bpm = 180;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n Instr(\\helpTempoPlayer,{\n Impulse.ar( Tempo.kr )\n });\n\n Patch(\\helpTempoPlayer).play(atTime:1)\n);\nTempo.bpm = 100;\n\nTempo.bpm = 180;\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Der Mussolini (bassline cover)?"}, {"role": "assistant", "content": "```supercollider\n/* An approach to try to reproduce the 'famous' bassline of \"Der Mussolini\" by D.A.F. */\n\n// very bad simulated analogue distorted bass synth\n// too distorted compared to the original...\n\nSynthDef(\\daf_bass,{ |out, freq=440, sustain=1, gate=1, amp=0.1|\n var snd, env, fenv, harm;\n harm = [1,1.01,2,2.02,3.5,4.01,5.501];\n harm = harm ++ (harm*2);\n snd = SinOsc.ar(freq*harm).sum.distort * 2;\n snd = snd + SinOsc.ar(freq / [1, 2]).sum!2;\n env = EnvGen.kr(Env.adsr(0.001,0.2,0.9,0.25), gate, amp, doneAction:2);\n snd = snd * env;\n OffsetOut.ar(out, (snd!2));\n}).add;\n\n// approx 63 bpm\nTempoClock.default.tempo = 63/60;\n\n// approx bass pattern + modulation of Mussolini bassline\nPdef(\\daf_bass,\n Pbind(\n \\instrument, \\daf_bass,\n \\scale, Scale.minor,\n \\octave, [3], // try out [2,3] or [3,4] for octave bass leetness\n \\ctranspose,Pseq([\n Pn(-1,16*4),\n Pn(1,16*2)\n ], inf),\n // -1 for thinking in musical degrees...\n \\degree, Pseq([1, 4, 1, 10, 1, 8, 1, 1, 8, 1, 8, 1, 8, 7, 1, 8]-1,inf),\n \\legato, Pwhite(0.75, 0.8),\n \\dur, 0.2\n )\n).play;\n\n// link: http://www.youtube.com/watch?v=15ScQivK5DY\n```"}]} +{"conversations": [{"role": "user", "content": "What is `LFNoise2` in SuperCollider?"}, {"role": "assistant", "content": "LFNoise2 — Quadratic noise. Generates quadratically interpolated random values at a rate given by the nearest integer division of the sample rate by the `freq` argument. Category: UGens > Generators > Stochastic."}]} +{"conversations": [{"role": "user", "content": "What does `Gendy1.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Dynamic stochastic synthesis generator. Arguments: ampdist — Choice of probability distribution for the next perturbation of the amplitude of a control point. The distributions are (adapted from the GENDYN program in Formalized Music):; durdist — Choice of distribution for the perturbation of the current inter control point duration.; adparam — A parameter for the shape of the amplitude probability distribution, requires values in the range 0.0001 to 1 (there are safety checks in the code so don't worry too much if you want to modulate!).; ddparam — A parameter for the shape of the duration probability distribution, requires values in the range 0.0001 to 1.; minfreq — Minimum allowed frequency of oscillation for the Gendy1 oscillator, so gives the largest period the duration is allowed to take on.; maxfreq — Maximum allowed frequency of oscillation for the Gendy1 oscillator, so gives the smallest period the duration is allowed to take on.; ampscale — Normally 0.0 to 1.0, multiplier for the distribution's delta value for amplitude. An ampscale of 1.0 allows the full range of -1 to 1 for a change of amplitude.; durscale — Normally 0.0 to 1.0, multiplier for the distribution's delta value for duration. An ampscale of 1.0 allows the full range of -1 to 1 for a change of duration.."}]} +{"conversations": [{"role": "user", "content": "What does `EventStreamSpec.rate` do?"}, {"role": "assistant", "content": "datatype specifying a Pbind-like object that produces a playable stream of Events"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Blip thru Formlet, pseudo-vocal synthesis that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n// Blip thru Formlet, pseudo-vocal synthesis.\n// hh&adc, since beijing 2005\n// 2019 made quad/MC\n\n// keywords: vocal, voice, formants\n\n/*\nNdef(\\formSing).gui;\nNdef(\\formSing).play;\nNdef(\\formSing).getHalo(\\stepFdev).value;\n*/\nNdef(\\formSing).addSpec(\\root, [20, 500, 6]);\nNdef(\\formSing).addSpec(\\formfrq, [50, 5000, \\exp]);\nNdef(\\formSing).addSpec(\\harm, [1, 256, \\exp]);\nNdef(\\formSing).addSpec(\\formLag, [0.01, 100, \\exp]);\nNdef(\\formSing).addSpec(\\ndiv, [0.01, 1, \\exp]);\nNdef(\\formSing).addSpec(\\fdev, [0, 24, \\amp]);\nNdef(\\formSing).addSpec(\\round, [0, 3, \\amp, 0.05]);\n\n(\n// modulating formant frequency\nNdef(\\formSing, { arg amp=0, root=150, formfrq=500, harm=20, fdev=2, ndiv = 0.2, formLag=0.1, round = 1.5;\n var freqCompare = 1; // ((formfrq / root).log2).abs.min(1).linexp(0, 1, 0.25, 1);\n var in = Blip.ar(\n root.lag(formLag) * LFNoise0.kr(root * ndiv ! q.numChans, fdev.max(0.01) ).midiratio,\n harm.lag(formLag), // .max(formfrq / root * 0.25),\n 0.1\n ) * GrayNoise.ar(0.1 ! q.numChans, 1);\n\n Limiter.ar(Formlet.ar(in, formfrq.lag(formLag), 0.005, 0.02) * (freqCompare * amp.lag(0.1)))\n .softclip;\n});\n);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Function.flop1` do?"}, {"role": "assistant", "content": "Same as #flop, return only an array if the arguments also contains an array. This can be used to implement Multichannel-Expansion. `// multichannel expansion for if, here to protect from"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `BusPlug`."}, {"role": "assistant", "content": "```supercollider\nb = BusPlug.new;\n{ Blip.ar(b + 5) }.play;\nb.bus.set(12);\n```"}]} +{"conversations": [{"role": "user", "content": "Saving \"Presets\"?"}, {"role": "assistant", "content": "SuperCollider forum — Saving \"Presets\"?\n\nIf you don’t care too much about it being human readable, just use writeArchive and readArchive:\n\n```supercollider\na = Array.fill(400, {rrand(0,2200)});\n\na.writeArchive(\"/Users/spluta1/Documents/SC/test\");\n\nb = Object.readArchive(\"/Users/spluta1/Documents/SC/test\");\n\nb.postln;\n```\n\nSam"}]} +{"conversations": [{"role": "user", "content": "How do I play a sample from disk?"}, {"role": "assistant", "content": "Load it into a Buffer on the server, then play the buffer. `BufRateScale` keeps the pitch right when\nthe file's sample rate differs from the server's.\n\n```supercollider\n(\ns.waitForBoot {\n ~buf = Buffer.read(s, \"C:/sounds/break.wav\");\n SynthDef(\\player, { |out = 0, buf = 0, amp = 0.6, rate = 1|\n var sig = PlayBuf.ar(2, buf, BufRateScale.kr(buf) * rate, loop: 1);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n ~player = Synth(\\player, [\\buf, ~buf]);\n};\n)\n```\nUse `numChannels` 1 for a mono file; a mismatch is silent or wrong-sounding rather than an error."}]} +{"conversations": [{"role": "user", "content": "Explain `FPSignal` in SuperCollider briefly."}, {"role": "assistant", "content": "FPSignal — Implementation of Functional Reactive Programming. This is port of the reactive-core library for Scala into SuperCollider. Category: FP, TimerES."}]} +{"conversations": [{"role": "user", "content": "What does `GridLayout.setAlignment` do? What arguments does it take?"}, {"role": "assistant", "content": "Sets the alignment of an item managed by the Arguments: item — A view or a layout managed by this layout, or a Point of which x denotes the column index and y the row index of an item.; align — A symbol denoting the alignment. See gui_alignments for possible values.."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for sound of an alien weapon firing. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"raygun\", {arg amp = 0.5, sinfreq = 1000, glissf = 0.001, att = 0.01, rel = 0.9;\n var gliss = XLine.kr(sinfreq, sinfreq*glissf, rel);\n var snd = SinOsc.ar(gliss);\n var env = EnvGen.kr(Env.perc(att, rel), doneAction: 2);\n snd = snd * env * amp;\n Out.ar(0, snd);\n}).add;\n);\n\n(\nPbind(\n \\instrument, \"raygun\",\n \\dur, Pseq([0.75,0.75,0.75,0.75,0.25,0.25,0.25]*0.5, inf),\n \\amp, 0.4\n).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `PPeak` in SuperCollider briefly."}, {"role": "assistant", "content": "PPeak — UGenPatterns quark library Based on Peak Category: Streams-Patterns-Events > UGenPatterns > Modifiers."}]} +{"conversations": [{"role": "user", "content": "How do I stop all sound?"}, {"role": "assistant", "content": "s.freeAll stops every node on the server. On the language side, Ndef.clear and Pdef.clear clear the proxies. If a Pattern is still running, Pdef(\\name).stop does it; CmdPeriod immediately stops everything scheduled on the default clock."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Mix`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var n;\n n = 8; // number of 'voices'\n Mix.new( // mix all stereo pairs down.\n Pan2.ar( // pan the voice to a stereo position\n CombL.ar( // a comb filter used as a string resonator\n Dust.ar( // random impulses as an excitation function\n // an array to cause expansion of Dust to n channels\n // 1 means one impulse per second on average\n Array.fill(n, 1),\n 0.3 // amplitude\n ),\n 0.01, // max delay time in seconds\n // array of different random lengths for each 'string'\n Array.fill(n, {0.004.rand+0.0003}),\n 4 // decay time in seconds\n ),\n Array.fill(n,{1.0.rand2}) // give each voice a different pan position\n )\n )\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `ArrayedCollection.plot` do?"}, {"role": "assistant", "content": "Plot values in a GUI window. See plot for more details. When the receiver contains `nil` items, the plot fails with an"}]} +{"conversations": [{"role": "user", "content": "Explain `RedMatrixMixer` in SuperCollider briefly."}, {"role": "assistant", "content": "RedMatrixMixer — mix any number of input and output channels matrix mixer Category: Red > redMatrixMixer."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// wait\n\n(\nvar r;\nr = Routine {\n 10.do({ |a|\n a.postln;\n // Often you might see Wait being used to pause a routine\n // This waits for one second between each number\n 1.wait;\n });\n // Wait half second before saying we're done\n 0.5.wait;\n \"done\".postln;\n}.play;\n)\n```"}, {"role": "assistant", "content": "Often you might see Wait being used to pause a routine This waits for one second between each number (Routine: Functions that can return in the middle and then resume where they left off)"}]} +{"conversations": [{"role": "user", "content": "What does `SaveConsole.open` do? What arguments does it take?"}, {"role": "assistant", "content": "widget with Save/SaveAs/Open controls Arguments: onOpenF."}]} +{"conversations": [{"role": "user", "content": "What does `AbstractVector.gramSchmidt` do?"}, {"role": "assistant", "content": "Applies the gramSchmidt process to the vectors and returns an array of orthogonal vectors that span the same subspace as the original"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Pfsm` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n(\na = Pfsm([\n #[0, 1],\n 67, #[0, 0, 3],\n 72, #[2],\n 73, #[0, 2],\n Pseq([74, 75, 76, 77]), #[2, 3, 3],\n nil, nil\n ], inf).asStream;\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, a.next.midicps]);\n 0.1.wait;\n })\n}).play;\n);\n\n(\nPfsm([\n #[5, 6, 7], // entry states\n\n // e1 (== state 0)\n Pbind(\\dur, Pseq([1/8, 3/8]), \\midinote, Pseq([86, 75])),\n // #[1], // as given in CMJ\n // my de-boredom-ated version..\n #[1, 1, 1, 1, 1, 1, 1, 8],\n // e2 (== state 1)\n Pbind(\\dur, 1/2, \\midinote, Pseq([69])),\n #[0, 1],\n // e3 (== state 2)\n Pbind(\\dur, 1/3, \\midinote, Pseq([55, 60, 66])),\n #[0, 1, 2, 2, 2, 2, 3, 3, 3, 3],\n // e4 (== state 3)\n Pbind(\\dur, 1/4, \\midinote, Pseq([81, 80, 77, 76])),\n #[1, 4, 4, 4, 4],\n // e5 (== state 4)\n Pbind(\\dur, Pseq([1, 2/3, 2/3, 2/3, 1]), \\midinote, Pseq([\\, 70, 70, 70, \\])),\n #[2, 3],\n // e6 (== state 5)\n Pbind(\\dur, 1/4, \\midinote, Pseq([59, 61])),\n #[0, 2, 4, 5, 5, 5, 5, 5, 5, 5],\n // e7 (== state 6)\n Pbind(\\dur, 1/4, \\midinote, Pseq([87, 88], 2)),\n #[4, 4, 4, 4, 6, 6, 6, 7, 7, 7],\n // e8 (== state 7)\n Pbind(\\dur, 1, \\midinote, Pseq([56])),\n #[1, 3, 6, 6, 6],\n // terminal state\n nil, nil\n]).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n(\nSynthDef(\"help-InFeedback\", { |out = 0, in = 0|\n Out.ar(out,\n InFeedback.ar(in, 1)\n );\n}).add;\nSynthDef(\"help-SinOsc\", { |out = 0, freq = 440|\n Out.ar(out, SinOsc.ar(freq, 0, 0.1))\n}).add;\n);\n\nx = Bus.audio(s, 1);\n\n// read from bus n play to bus 0 (silent)\na = Synth(\"help-InFeedback\", [\\in, x.index, \\out, 0]);\n\n// now play a synth after this one, playing to bus x\nb = Synth.after(a, \"help-SinOsc\", [\\out, x.index]);\n\n// add another synth\n// …\n```"}, {"role": "assistant", "content": "read from bus n play to bus 0 (silent) now play a synth after this one, playing to bus x (InFeedback: Read signal from a bus with a current or one cycle old timestamp.)"}]} +{"conversations": [{"role": "user", "content": "What does `String.findAll` do?"}, {"role": "assistant", "content": "Returns the indices of the string in the receiver, or nil if not found. `\"These are several words which are"}]} +{"conversations": [{"role": "user", "content": "What does `AbstractFunction.>>` do?"}, {"role": "assistant", "content": "`a = { [2r10010, 2r101011, 2r11100].choose.postln"}]} +{"conversations": [{"role": "user", "content": "What does `Rect.resizeTo` do?"}, {"role": "assistant", "content": "Returns a new Rect whose dimensions are (x,"}]} +{"conversations": [{"role": "user", "content": "What is `Pspawner` in SuperCollider?"}, {"role": "assistant", "content": "Pspawner — dynamic control of multiple event streams from a Routine Pspawner allows a routine to dynamically start and stop subpatterns. Category: Streams-Patterns-Events > Patterns > Parallel."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code:\n```supercollider\n{ SinOsc.ar(440) * EnvGen.kr(Env.perc(0.01, 1), doneAction: 2) }.play;\n```"}, {"role": "assistant", "content": "It plays a 440 Hz sine with a percussive envelope, and the Synth frees itself when the envelope\nends.\n\n- `SinOsc.ar(440)` is an audio-rate sine at 440 Hz.\n- `Env.perc(0.01, 1)` is a 10 ms attack to full level then a 1 s decay to zero.\n- `EnvGen.kr(...)` plays that envelope at control rate and multiplies the sine, so the sound fades out.\n- `doneAction: 2` frees the Synth at the end of the envelope, so it does not accumulate silent nodes.\n- `.play` on the function builds an anonymous SynthDef and starts one Synth of it."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Compare:\n\n{ WhiteNoise.ar(0.25) }.play;\n\n{ LPZ1.ar(WhiteNoise.ar(0.25) }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Compare:\n\n{ WhiteNoise.ar(0.25) }.play;\n\n{ LPZ1.ar(WhiteNoise.ar(0.25)) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `GlitchBRF.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "backward compatibility Arguments: in — The input signal.; freq — Cutoff frequency in Hertz.; rq — The reciprocal of Q (bandwidth / cutoffFreq).; mul — Output will be multiplied by this value.; add — This value will be added to the output.."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Paddpre` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain);\nb = Paddpre(\\freq, Pseq([10, 30, 100], inf), a);\nb.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `KeyCodeResponder.functionKeyModifier` do?"}, {"role": "assistant", "content": "register responder functions for keycode and modifier combinations"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Out` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-out\", { |out = 0, freq = 440|\n var source;\n source = SinOsc.ar(freq, 0, 0.1);\n\n // write to the bus, adding to previous contents\n Out.ar(out, source);\n\n}).add;\n);\n\n\nSynth(\"help-out\", [\\freq, 500]);\nSynth(\"help-out\", [\\freq, 600]);\nSynth(\"help-out\", [\\freq, 700]);\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{ var nse, env, kic;\n kic = tanh(Ringz.ar(LPF.ar(Trig.ar(Impulse.ar(1.0),SampleDur.ir),1000),30,0.25,7).sin*2);\n env = Env.perc(0.05, 1, 1, -4);\n nse = BrownNoise.ar(2) + PinkNoise.ar(0.5) * EnvGen.kr(env,Impulse.kr(1), doneAction: 2);\n\n nse = Mix.ar(BPF.ar(nse,[100,1200,80,40,20],MouseX.kr(0,1),[1,0.2,1,1,1]));\n nse = LPF.ar(nse + kic, MouseY.kr(100,1000))! 2\n\n}.play\n)\n```"}, {"role": "assistant", "content": "A muffled thump. An attempt at a Jurassic Park © glass of water sort of thing - or breaking into a silo."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Granular electromaton. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\nServer.local.waitForBoot({\n(\nz.free;\nz = Buffer.alloc(s, 512, 1);\nz.sine1(1.0 / [1, 2, 3, 4], true, true, true);\n\n fork( { loop {\n SynthDef(\"g1\",{ arg out=0,bufnum=0,dur=1,rate=1,pos=0,sdens=1,edens=1;\n var dens = Line.kr(sdens,edens,dur);\n var trig = [LFNoise0,SinOsc,Impulse,LFPulse,LFSaw].choose.ar(Line.kr(sdens,edens,dur));\n //var env = EnvGen.kr(Env.perc(0.0001.rrand(0.1),dur*0.5.rrand(2)),doneAction:2);\n var env = EnvGen.kr(Env.perc(0.0001.rrand(0.1),dur*(0.5.rrand(4))),doneAction:2);\n Out.ar(out,\n GrainBuf.ar(2,trig,1/dens,bufnum,rate,pos)*env;\n )\n }).add();\n [1,2,4,8,16,32].choose.postln.wait;\n }\n }\n );\n\n\na = Pbind(\\instrument,\\g1,\\dur,Pseq([Pseq([0.25],32),Pseq([0.25,0.125,0.125],32),Pseq([0.125],32)],inf),\\sdens,Pseq([9000,1000,500]/10,inf),\\edens,Prand([Pseq([9000,1000,500]/10,4),Pseq([1],1)],inf),\\rate,Pfunc({-10.0.rrand(10)}),\\pos,Pfunc({1.0.rand}),\\bufnum,z.bufnum);\nb = Pbind(\\instrument,\\g1,\\dur,Pseq([4],inf),\\sdens,Pseq([9000,1000,500]/100,inf),\\edens,Prand([Pseq([9000,1000,500]/10,1),Pseq([1],3)],inf),\\rate,Pfunc({-10.0.rrand(10)}),\\pos,Pfunc({-10.0.rrand(10)}),\\bufnum,z.bufnum);\nc = Pbind(\\instrument,\\g1,\\dur,Pseq([4/3],inf),\\sdens,Pseq([9000,1000,500,25],inf),\\edens,Prand([Pseq([9000,1000,500,25],1),Pseq([1],4)],inf),\\rate,Pfunc({-100.0.rrand(100)}),\\pos,Pfunc({-10.0.rrand(10)}),\\bufnum,z.bufnum);\n\n\na =a.play;\nb =b.play;\nc =c.play;\n\n)\n});\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `Klang` in SuperCollider briefly."}, {"role": "assistant", "content": "Klang — Sine oscillator bank Klang is a bank of fixed frequency sine oscillators. Klang is more efficient than creating individual oscillators but offers less flexibility. Category: UGens > Generators > Deterministic."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// zig zag partial dome\na = VBAPSpeakerArray.new(3, [[-22.5, 14.97], [22.5, 14.97], [-67.5, 14.97], [67.5, 14.97], [-112.5, 14.97], [112.5, 14.97], [-157.5, 14.97], [157.5, 14.97], [-45, 0], [45, 0], [-90, 0], [90, 0], [-135, 0], [135, 0], [0, 0], [180, 0]]);\n\nb = Buffer.loadCollection(s, a.getSetsAndMatrices);\n\n(\n// pan around the circle up and down\nx = { |azi = 0, ele = 0, spr = 0|\n var source;\n source = PinkNoise.ar(0\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// zig zag partial dome\na = VBAPSpeakerArray.new(3, [[-22.5, 14.97], [22.5, 14.97], [-67.5, 14.97], [67.5, 14.97], [-112.5, 14.97], [112.5, 14.97], [-157.5, 14.97], [157.5, 14.97], [-45, 0], [45, 0], [-90, 0], [90, 0], [-135, 0], [135, 0], [0, 0], [180, 0]]);\n\nb = Buffer.loadCollection(s, a.getSetsAndMatrices);\n\n(\n// pan around the circle up and down\nx = { |azi = 0, ele = 0, spr = 0|\n var source;\n source = PinkNoise.ar(0.2);\n VBAP.ar(16, source, b.bufnum, LFSaw.kr(0.5, 0).range(-180, 180) * -1, SinOsc.kr(3, 0).range(0, 14.97), spr);\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `FFTSubbandFlatness` in SuperCollider briefly."}, {"role": "assistant", "content": "FFTSubbandFlatness — Spectral flatness, divided into subbands Calculates the spectral flatness measure, in the same manner as FFTFlatness, but divides the spectrum into (adjacent, non-overlapping) subbands, so returns separate measures for the different subbands. Category: UGens > Analysis, UGens > FFT."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `IdentityDictionary`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_sinegrain, { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0.5pi, env))\n}).add;\n\na = Pbind(\\instrument, \\help_sinegrain, \\note, Pseq([0, 7, 2, 9, 11, 10, 9, 8], inf), \\dur, 1);\na.play(quant: (quant: 1, phase: 0));\na.play(quant: (quant: 1, phase: 1/3));\na.play(quant: (quant: 1, phase: 1.0.rand));\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Crackle.ar(1.95, 0.5) }.play;\n\n// modulate chaos parameter\n{ Crackle.ar(Line.kr(1.0, 2.0, 3), 0.5, 0.5 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Crackle.ar(1.95, 0.5) }.play;\n\n// modulate chaos parameter\n{ Crackle.ar(Line.kr(1.0, 2.0, 3), 0.5, 0.5) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// play SinOscs silently and wait for granulation envelopes\n\n(\na = Bus.audio(s, 10);\nx = { Splay.ar(In.ar(a, 10) * SinOsc.ar((3..12) * 100, 0, 0.05)) }.play\n);\n\n\n// send envelopes to buses\n\n(\nz = {\n DXEnvFanOut.ar(\n Dseq((0..5) + a.index, inf) + Diwhite(1, 4),\n \n // with newer SC versions you can also write:\n // Dseq((0..5), inf) + Diwhite(1, 4) + a.index,\n \n fadeTime: 0.05,\n width: 1,\n initOutOffset: -0.5\n )\n}.play\n);\n\nx.release;\n\n// clean\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// play SinOscs silently and wait for granulation envelopes\n\n(\na = Bus.audio(s, 10);\nx = { Splay.ar(In.ar(a, 10) * SinOsc.ar((3..12) * 100, 0, 0.05)) }.play\n);\n\n\n// send envelopes to buses\n\n(\nz = {\n DXEnvFanOut.ar(\n Dseq((0..5) + a.index, inf) + Diwhite(1, 4),\n \n // with newer SC versions you can also write:\n // Dseq((0..5), inf) + Diwhite(1, 4) + a.index,\n \n fadeTime: 0.05,\n width: 1,\n initOutOffset: -0.5\n )\n}.play\n);\n\nx.release;\n\n// cleanup\n\n(\nz.free;\na.free;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `EnvirGui.putSpec` do?"}, {"role": "assistant", "content": "add a spec for a given key, or (if it is a global key) override a global spec with a local one: `// set a desired range and"}]} +{"conversations": [{"role": "user", "content": "Explain `PSchmidt` in SuperCollider briefly."}, {"role": "assistant", "content": "PSchmidt — UGenPatterns quark library Based on Schmidt Category: Streams-Patterns-Events > UGenPatterns > Modifiers."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Scale` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\nr = {\n var scale = Scale.choose.postln;\n SinOsc.ar(\n (\n DegreeToKey.kr(\n scale.as(LocalBuf),\n MouseX.kr(0, 15), // mouse indexes into scale\n scale.stepsPerOctave,\n 1, // mul = 1\n 60 // offset by 72 notes\n )\n + LFNoise1.kr([3, 3], 0.04) // add some low freq stereo detuning\n ).midicps, // convert midi notes to hertz\n 0,\n 0.25\n )\n}.play;\n);\n\nr.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SimpleNumber.ibetaC` do?"}, {"role": "assistant", "content": "Returns the normalised complement of the incomplete beta function of `a`, `b` and `x`. Require 0 <= `x` <= 1, `a,b` >= 0, and in addition that not both `a` and `b` are"}]} +{"conversations": [{"role": "user", "content": "My Synth runs but I hear nothing. How do I debug it?"}, {"role": "assistant", "content": "Check in this order, because each step eliminates a whole class of causes:\n\n1. **Is anything coming out of the bus you write to?** `Out.ar(0, sig)` for the master. A typo like\n `Out.ar(2, ...)` is silence.\n2. **Is the amplitude non-zero?** Multiply chain of `mul`/`add`, `amp`, and `env` all have to be positive;\n an envelope with `level: 0` or a gate that never opens is silent.\n3. **Did the Synth free itself immediately?** `doneAction: 2` on an EnvGen whose envelope is already\n finished at creation kills the node instantly. `s.plotTree` shows whether the node exists at all.\n4. **Is the envelope actually moving?** `env.poll` inside the SynthDef prints it per block.\n5. **Is the filter closed?** A `LPF.ar(sig, 50)` on a 440 Hz sine leaves almost nothing.\n\nThe fastest single tool is `s.plotTree`: if the Synth is not in the tree, the problem is lifecycle; if it\nis, the problem is signal."}]} +{"conversations": [{"role": "user", "content": "What does `LID.openDevices` do?"}, {"role": "assistant", "content": "A dictionary of the opened Returns: an IdentityDictionary"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Event` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\pm, { |out = 0, freq = 440, amp = 0.1, pan = 0, gate = 1, ratio = 1, index = 1, ar = 0.1, dr = 0.1|\n var z;\n z = LPF.ar(\n PMOsc.ar(freq, freq * ratio, Linen.kr(gate, ar, index, dr), 0, 0.3),\n XLine.kr(Rand(4000, 5000), Rand(2500, 3200), 1)\n ) * Linen.kr(gate, 0.01, 0.7, dr, 2);\n OffsetOut.ar(out, Pan2.ar(z, pan, amp));\n}).add;\n);\n\n(instrument: \\pm).play;\n\n(instrument: \\pm, ratio: 3.42, index: 12, freq: 150, ar: 8, dr: 3, sustain: 10).play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var trig = Dust.kr(10);\n SinOsc.ar(\n TRand.kr(300, 3000, trig)\n ) * 0.1\n}.play;\n);\n\n(\n{\n var trig = Dust.ar(MouseX.kr(1, 8000, 1));\n SinOsc.ar(\n TRand.ar(300, 3000, trig)\n ) * 0.1\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var trig = Dust.kr(10);\n SinOsc.ar(\n TRand.kr(300, 3000, trig)\n ) * 0.1\n}.play;\n);\n\n(\n{\n var trig = Dust.ar(MouseX.kr(1, 8000, 1));\n SinOsc.ar(\n TRand.ar(300, 3000, trig)\n ) * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "I get 'index out of range' when playing a buffer."}, {"role": "assistant", "content": "A read position is past the end of the buffer. `PlayBuf` with a `startPos` in frames beyond `~buf.numFrames`, or a `BufRd`/`GrainBuf` whose phase goes above 1, produces this. For GrainBuf, pos is normalised 0..1, so pass `LFNoise1.kr(1).range(0, 1)` rather than a frame count; for PlayBuf, cap the position at `~buf.numFrames - 1`. If you just loaded the file, check `~buf.numFrames` — a failed read gives 0 frames and every position is out of range."}]} +{"conversations": [{"role": "user", "content": "What does `History.keep` do?"}, {"role": "assistant", "content": "keep only the newest num lines from history. if n is negative, keep the oldest n"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Fdef`."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\ns.boot;\nSynthDef(\"gpdef\",\n { |out = 0, freq = 440, sustain = 0.05, amp = 0.1|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain), doneAction: Done.freeSelf) * amp;\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n// fork a thread that plays some sounds\n(\nFdef(\\freq, 440);\nFdef(\\dur, 0.2);\n\nfork {\n loop {\n s.sendMsg(\"/s_new\", \"gpdef\", -1, 1, 1, \\freq, Fdef(\\freq).value);\n Fdef(\\dur).value.wait;\n }\n};\n);\n\n// some modifications\n\nFdef(\\freq, Fdef(\\midinote, 60).midicps);\nFdef(\\midinote, { [67, 64, 65].choose });\nFdef(\\midinote, { [67, 64, 65].choose } + Fdef(\\offset));\nFdef(\\offset, { 4.rand });\nFdef(\\dur, 0.23);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `LeastChange`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\nd = { |freq = 440|\n var internalFreq;\n internalFreq = LFNoise0.ar(0.3, 300, 800);\n SinOsc.ar(\n LeastChange.kr(freq, internalFreq) // two sources of change: one external, one internal\n ) * 0.1\n}.play\n);\n\nd.set(\\freq, 800);\nd.set(\\freq, 900);\nd.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `CountLimit.value` do?"}, {"role": "assistant", "content": "Counts how many items have been presented to it. returns true until limit false thereafter"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Pmulpre` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain);\nb = Pmulpre(\\freq, Pseq([1, 2, 3], inf), a);\nb.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `BLowPass`?"}, {"role": "assistant", "content": "BLowPass — 12db/oct rolloff - 2nd order resonant Low Pass Filter"}, {"role": "user", "content": "What does `BLowPass.sc` do?"}, {"role": "assistant", "content": "calculate filter coefficients."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n(\nz = {\n BLowPass.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(10, 20000, \\exponential), // cutoff freq.\n MouseY.kr(0.0, 1.0, \\linear), // rq\n 0.5); // mul\n}.play\n);\nz.release;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `ScalarPatchOut.control` do? What arguments does it take?"}, {"role": "assistant", "content": "\\scalar rate PatchOut Arguments: controlPatchIn; needsValueSetNow."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Granular electromaton. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\nServer.local.waitForBoot({\n(\nz.free;\nz = Buffer.alloc(s, 512, 1);\nz.sine1(1.0 / [1, 2, 3, 4], true, true, true);\n\n fork( { loop {\n SynthDef(\"g1\",{ arg out=0,bufnum=0,dur=1,rate=1,pos=0,sdens=1,edens=1;\n var dens = Line.kr(sdens,edens,dur);\n var trig = [LFNoise0,SinOsc,Impulse,LFPulse,LFSaw].choose.ar(Line.kr(sdens,edens,dur));\n //var env = EnvGen.kr(Env.perc(0.0001.rrand(0.1),dur*0.5.rrand(2)),doneAction:2);\n var env = EnvGen.kr(Env.perc(0.0001.rrand(0.1),dur*(0.5.rrand(4))),doneAction:2);\n Out.ar(out,\n GrainBuf.ar(2,trig,1/dens,bufnum,rate,pos)*env;\n )\n }).add();\n [1,2,4,8,16,32].choose.postln.wait;\n }\n }\n );\n\n\na = Pbind(\\instrument,\\g1,\\dur,Pseq([Pseq([0.25],32),Pseq([0.25,0.125,0.125],32),Pseq([0.125],32)],inf),\\sdens,Pseq([9000,1000,500]/10,inf),\\edens,Prand([Pseq([9000,1000,500]/10,4),Pseq([1],1)],inf),\\rate,Pfunc({-10.0.rrand(10)}),\\pos,Pfunc({1.0.rand}),\\bufnum,z.bufnum);\nb = Pbind(\\instrument,\\g1,\\dur,Pseq([4],inf),\\sdens,Pseq([9000,1000,500]/100,inf),\\edens,Prand([Pseq([9000,1000,500]/10,1),Pseq([1],3)],inf),\\rate,Pfunc({-10.0.rrand(10)}),\\pos,Pfunc({-10.0.rrand(10)}),\\bufnum,z.bufnum);\nc = Pbind(\\instrument,\\g1,\\dur,Pseq([4/3],inf),\\sdens,Pseq([9000,1000,500,25],inf),\\edens,Prand([Pseq([9000,1000,500,25],1),Pseq([1],4)],inf),\\rate,Pfunc({-100.0.rrand(100)}),\\pos,Pfunc({-10.0.rrand(10)}),\\bufnum,z.bufnum);\n\n\na =a.play;\nb =b.play;\nc =c.play;\n\n)\n});\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\nq = Pbind(\\freq, 300, \\dur, Pn(0.3, 2));\nq.trace.play;\n\n// Sound-wise ineffective modification of the incoming stream\np = Pbind(\\degree, 6) <> q;\np.trace.play;\n\n// Instead\np = Pbind(\\degree, 6) <> Pfunc { |ev| ev.freq = nil } <> q;\np.trace.play;\n\n// Alternatively\np = Pbind(\\degree, Pfunc { |ev| ev.freq = nil; 6 }) <> q;\np.trace.play;\n\n// Just setting a key to nil from a Pbind pair will end the stream\np = Pbind(\\freq, nil, \\degree, 6) <>\n// …\n```"}, {"role": "assistant", "content": "Sound-wise ineffective modification of the incoming stream Just setting a key to nil from a Pbind pair will end the stream (Pfunc: Function pattern)"}]} +{"conversations": [{"role": "user", "content": "What does `Synth.head` do?"}, {"role": "assistant", "content": "Create and return a Synth. If `aGroup` is a Group add it at the head of that group. If it is a Server, add it at the head of the default_group of that server. If it is nil, add it at the head of the default_group of the default server. If it is an integer, it is created relative to a group with that"}]} +{"conversations": [{"role": "user", "content": "Explain `SClusterFrequencies` in SuperCollider briefly."}, {"role": "assistant", "content": "SClusterFrequencies — control SCluster frequencies Frequency control for LINKClasses/SCluster. Category: SInstruments."}]} +{"conversations": [{"role": "user", "content": "What does `SoundFileView.selectionDuration` do? What arguments does it take?"}, {"role": "assistant", "content": "The size of a selection in Arguments: index — The index of the selection; an Integer between 0 an 63.. Returns: A Float."}]} +{"conversations": [{"role": "user", "content": "Splay - not getting spread, wrong use?"}, {"role": "assistant", "content": "SuperCollider forum — Splay - not getting spread, wrong use?\n\nYou need to undestand that if you have two identical signal coming from left and right it will always be mono. No stereo spread possible. So you need to introduce (at least) two different signals - and just different amplification will not really work.\n\nTo expand your first example, we can introduce an array of values for paramtere pos:\n\n```supercollider\n(\nx = { arg spread=1, level=0.2, center=0.0;\n Splay.ar(\n GrainBuf.ar(numChannels: 1,\n trigger: Impulse.kr(1.2875),\n dur: Impulse.kr(1.2875),\n sndbuf: b,\n pos:[0,0.5],\n interp: 1\n ),\n spread,\n level,\n center\n );\n}.play;\n);\n\nx.set(\\spread, 1, \\center, 0); // full stereo\nx.set(\\spread, 0, \\center, 0); // mono center\n```\n\nBy way of Multichannel Expansion this creates two different signals (channels, an array of 2 UGen graphs) that you can hear as different and therefore observe the stereo spread.\n\nAnd similarly, to use your other example with In.ar where I have added in=2, so that it takes my mic in (but you can specify another bus) and wrapped it into a feedback delay with an array of two values for delayTime. Multichannel expansion thus creates two channels that are different because they have different delaytimes but the rest of UGen graph is the same (a copy). Changing spread now works:\n\n```supercollider\n(\nSynthDef(\\stereo,{|out=0, in=2, spread=1, level=1, center=0.0|\n Out.ar(out,\n Splay.ar(\n CombN.ar(\n In.ar(in, 1), 1, [0.3,0.4], 2)\n ,spread,level,center));\n}).play;\n)\n```\n\nI hope that clarifies the issue better."}]} +{"conversations": [{"role": "user", "content": "Explain `NestedAllpassN` in SuperCollider briefly."}, {"role": "assistant", "content": "NestedAllpassN — Nested Allpass filters as proposed by Vercoe and Pluckett Useful for reverberation, especially implementing Gardner reverbs. Category: UGens > Delays."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n \n// definition for future reference in arbitrary Environments\n\n(\np = Pbind(\n \\midinote, PLnaryop('+', \\src, [\\dev]),\n \\dur, 0.1\n);\n);\n\n\n// define Environment and play\n\n(\ne = (src: PLseq([61,62]), dev: Pbrown(-5, 5, 0.2) );\n\ne.use { x = p.play };\n);\n\n\n// replace\n\ne.dev = PLseq((0, 0.5..7));\n\ne.dev = Pbrown(-5, 5, 0.2);\n\ne.src = PLseq([61,64,65]);\n// …\n```"}, {"role": "assistant", "content": "definition for future reference in arbitrary Environments define Environment and play (PLnaryop: dynamic scope Pnaryop variant)"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LinExp`."}, {"role": "assistant", "content": "```supercollider\n// linexp\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(mod.linexp(-1, 1, MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1))) * 0.1\n}.play;\n);\n\n// exprange\n(\n{\n var mod = LFNoise2.ar(80).exprange(MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1));\n SinOsc.ar(mod) * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `AbstractResponderFunc.permanent` do? What arguments does it take?"}, {"role": "assistant", "content": "Get or set whether this responder func is persists when the user executes Cmd-. If false this will be disabled and removed from the global lists. The default is Arguments: bool — A Boolean indicating if this object is permanent.. Returns: The getter returns a Boolean."}]} +{"conversations": [{"role": "user", "content": "What does `WebView.setFontFamily` do? What arguments does it take?"}, {"role": "assistant", "content": "Sets a specific font family to be used in place of a CSS-specified generic font Arguments: The CSS generic font family to assign a font to; one of QWebFontFamily; A font family name to be assigned to the generic family; a String.."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `NamedControl` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// compare this:\n(\na = {\n var x, y;\n x = NamedControl.kr(\\freq, 440).lag(3.5);\n y = NamedControl.kr(\\freq, 440).lag(1);\n SinOsc.ar([x, y] * [2, 1.2]) * 0.1\n}.play;\n);\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n\n// to this:\n(\na = {\n var x, y;\n x = Control.names([\\freq]).kr(440).lag(3.5);\n y = Control.names([\\freq]).kr(440).lag(1); // this hangs when set\n SinOsc.ar([x, y] * [2, 1.2]) * 0.1\n}.play;\n);\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `PlayerAmp.defName` do?"}, {"role": "assistant", "content": "adds a simple amplitude control to a Player"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// compares a 441 Hz sine tone derived from sample rate (44100 * 0.01, left)\n// with a 440 Hz tone (right), resulting in a 1 Hz beating\n(\n{\n var freq;\n freq = [SampleRate.ir * 0.01, 440];\n SinOsc.ar(freq, 0, 0.1)\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// compares a 441 Hz sine tone derived from sample rate (44100 * 0.01, left)\n// with a 440 Hz tone (right), resulting in a 1 Hz beating\n(\n{\n var freq;\n freq = [SampleRate.ir * 0.01, 440];\n SinOsc.ar(freq, 0, 0.1)\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `ObjectWithArgs.doesNotUnderstand` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: selector — (describe argument here); ... args — (describe argument here). Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `In`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-InKr\", { |out = 0, in = 0|\n Out.ar(out,\n SinOsc.ar(In.kr(in, 1), 0, 0.1)\n )\n}).add;\nSynthDef(\"help-lfo\", { |out = 0|\n Out.kr(out, LFNoise1.kr(0.3, 200, 800))\n}).add;\n);\n\n\nb = Bus.control(s, 1);\nb.set(800);\n\nSynth(\"help-InKr\", [\\in, b.index]);\nb.set(400);\nb.set(300);\nSynth(\"help-lfo\", [\\out, b.index]);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Scale.semitones` do?"}, {"role": "assistant", "content": "Returns a tuned array of semitone values. #-as(Array) is equivalent; #-as(List) returns it as a list,"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n var saw, bpf;\n saw = Pulse.ar(\n freq: [100,150],\n mul: LFPulse.kr(\n freq: [0, 0.03, 0.04],\n width: 0.15));\n bpf = LPF.ar(in: saw, freq: SinOsc.kr(-10, -5, 3).range(200, 400));\n Out.ar(0, bpf);\n}.play;\n)\n```"}, {"role": "assistant", "content": "//Pulse is the UGen. There is multichannel expansion due to the lists in the freqs. The range is a big part of the reason this sounds so deep."}]} +{"conversations": [{"role": "user", "content": "What does `UnicodeResponder.new` do?"}, {"role": "assistant", "content": "register responder functions for unicode and modifier combinations"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ SinOscFB.ar(440, MouseX.kr(0, 4))*0.1 }.play\n\n\n{ SinOscFB.ar(MouseY.kr(10, 1000, 'exponential'), MouseX.kr(0.5pi, pi))*0.1 }.play\n\n\n{ SinOscFB.ar(100*SinOscFB.ar(MouseY.kr(1, 1000, 'exponential'))+200, MouseX.kr(0.5pi, pi))*0.1 }.play\n\n\n// Scope the wave form\n{ SinOscFB.ar([400, 301], MouseX.kr(0, 4), 0.3 }.scope;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ SinOscFB.ar(440, MouseX.kr(0, 4))*0.1 }.play\n\n\n{ SinOscFB.ar(MouseY.kr(10, 1000, 'exponential'), MouseX.kr(0.5pi, pi))*0.1 }.play\n\n\n{ SinOscFB.ar(100*SinOscFB.ar(MouseY.kr(1, 1000, 'exponential'))+200, MouseX.kr(0.5pi, pi))*0.1 }.play\n\n\n// Scope the wave form\n{ SinOscFB.ar([400, 301], MouseX.kr(0, 4), 0.3) }.scope;\n```"}]} {"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// what can it sound like? see: https://www.youtube.com/watch?v=dRmY3tEwZyE \n// the youtube version has been sent through an additional reverb pedal, but\n// you don't need the pedal to get something that sounds interesting\n\n(\ns.options.memSize_(16384*10);\ns.reboot;\ns.waitForBoot({\n \n Ndef(\\bits, {\n var t = PulseCount.ar(Impulse.ar(8e3));\n var u = PulseCount.ar(Impulse.ar(7009));\n var sig = HPF.ar(\n (\n ((t * 15) & (t >> 5)) |\n ((t * 5) & (t >> [3, 4])) |\n ((t * 2) & (t >> 9)) |\n ((t * 8) & (t >> 11)) |\n (((t*t) & t) | (t >> 3))\n - 3 % 256\n ) / 127-1 * 3\n , 20\n ) * 0.1;\n var sig2 = LPF.ar(HPF.ar(gcd(t*u, u+t), WhiteNoise.ar()*2000 + 1000), 20);\n sig2 = sig2*sig;\n sig = 0.3*Splay.ar(Limiter.ar(Greyhole.ar(sig + sig2, sig, 0.5, sig), 0.5).flatten);\n }).play;\n});\n)\n```"}, {"role": "assistant", "content": "a surprisingly rich soundscape in a few lines of code (lucky accident)."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Hymn #15 - generative melody by array rewriting?"}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\ping, {\n arg freq = 440, pan = 0;\n var sig;\n sig = SinOsc.ar(freq, 0, 0.3);\n sig = sig * EnvGen.ar(Env.perc(0.01, 1), doneAction:2);\n sig = Pan2.ar(sig, pan);\n Out.ar(0, sig)\n}).add;\n);\n\n(\n~scramb = {|pan|\nvar notes = [0,4,7,14,9,12,4,7,9,7];\nvar dur = [1,1,2,3,6,3,4,5,2,1,13];\nvar transp = [0, 5, 7, 3, 2];\nvar scrambRand = {|array|\n var rand = rrand(0, array.size-3);\n var end = rand + rrand(1,2);\n var range = (rand..end);\n var reverseRange = range.reverse;\n var temp = array.copy;\n range.postln;\n range.do({|item, index|\n array[item] = temp[reverseRange[index]];\n });\n array;\n};\nvar octRand = {|array|\n var rand = rrand(0, array.size-1);\n array[rand] = array[rand] + [-12,0,12].choose;\n };\nvar task = Task {\n var step = 0;\n var transpStep = 0;\n loop {\n var freq = (notes.wrapAt(step) + 60 + transp.wrapAt(transpStep)).midicps;\n Synth(\\ping, [\\freq, freq, \\pan, pan]);\n (dur.wrapAt(step) * 0.15).wait;\n step = step + 1 % (notes.size * 12;);\n if (step%32 == 0, {scrambRand.value(notes)});\n if (step%20 == 0, {scrambRand.value(dur)});\n if (step%66 == 0, {transpStep = transpStep + 1 % (transp.size)});\n if (step%24 == 0, {notes = notes.rotate(rrand(-1, 1))});\n if (step%56 ==0, {octRand.value(notes)});\n }\n}.play;\n};\n);\n\n(\n~scramb.value(-0.7);~scramb.value(0.7);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// not sure if this is working\n\n\n s = Server.local;\n s.boot;\n\n // play on a private bus\n p = Patch({ Saw.ar * 0.2 });\n b = Bus.audio(s);\n p.play(bus: b);\n\n // read from that bus and play main out\n e = PlayerEffectSocket.new;\n e.setInputBus(b);\n e.play;\n // but no effect is playing yet, so no sound\n\n // prepare some effects\n f = Patch({ arg audio,ffreq=300,rq=0.3;\n RLPF.ar(audio,ffreq,rq)\n });\n g = Patch({ arg audio,ffreq=300,rq=0.3;\n RHPF.ar(audio,ffreq,rq)\n });\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// not sure if this is working\n\n\n s = Server.local;\n s.boot;\n\n // play on a private bus\n p = Patch({ Saw.ar * 0.2 });\n b = Bus.audio(s);\n p.play(bus: b);\n\n // read from that bus and play main out\n e = PlayerEffectSocket.new;\n e.setInputBus(b);\n e.play;\n // but no effect is playing yet, so no sound\n\n // prepare some effects\n f = Patch({ arg audio,ffreq=300,rq=0.3;\n RLPF.ar(audio,ffreq,rq)\n });\n g = Patch({ arg audio,ffreq=300,rq=0.3;\n RHPF.ar(audio,ffreq,rq)\n });\n f.prepareForPlay;\n g.prepareForPlay;\n\n\n e.setSource(f);\n\n e.setSource(g);\n\n // if you haven't prepared them\n e.prepareAndTrigger(\n Patch({ arg audio;\n Median.ar(11,audio)\n })\n );\n\n e.insp\n)\n```"}]} -{"conversations": [{"role": "user", "content": "How do I make a delay line?"}, {"role": "assistant", "content": "`CombN.ar(in, maxdelaytime, delaytime, decaytime)` is a feedback delay: maxdelaytime is the buffer size, delaytime the actual delay (and it can modulate), decaytime how long the repeats take to die. For a clean single echo use `DelayN.ar(in, maxdelaytime, delaytime)`, which has no feedback. Both replace the `in` with the delayed signal, so mix with the dry: `dry + CombN.ar(dry, 0.5, 0.3, 2) * 0.4`."}]} -{"conversations": [{"role": "user", "content": "What does `MIDIIn.removeFuncFrom` do? What arguments does it take?"}, {"role": "assistant", "content": "Remove a Function or similar object from the list of those to be evaluated whenever a particular MIDI message is received. This method is preferable to the setters below, since it will leave any existing functions in Arguments: what — A Symbol indicating the message type, one of `'noteOn'` `'noteOff'`, `'polytouch'`, `'control'`, `'program'`, `'touch'`, `'bend'`, `'sysex'`, `'sysrt'`, `'smpte'`, or `'invalid'` (for invalid sysex messages).; func — The Function or similar object to be removed.."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for in the jungle."}, {"role": "assistant", "content": "```supercollider\n({\nvar nz = { |...args| LFDNoise3.kr(*args) };\nvar sig = Limiter.ar(\n BPF.ar(\n RHPF.ar(\n RLPF.ar(\n WhiteNoise.ar(nz.(1/[9,10],0.25,0.75)),\n nz.(5!2).exprange(1000, 2000),\n nz.(1/5!2).range(0.1,1)),\n nz.(5!2).exprange(50,150),\n nz.(1/5!2).range(0.1,1)),\n nz.(5!2).exprange(150,1000),\n nz.(1/5!2).range(0.1,1)))\n* LFGauss.ar([3,4],0.33) * LFGauss.ar(1/[4,9],0.25)\n* SinOsc.ar(Lag2UD.kr(Duty.kr(1,0,{Dibrown(300,2400,250)}!2),0.25,0.8));\nRotate2.ar(sig[0], sig[1], LFSaw.kr(1/5));\n}.play)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\na = {\n var dur;\n\n dur = 0.1;\n\n LFTri.ar(100+(1000*Maths.ar(dur/2, dur/2, 0.99, 1, 0, 1, LFNoise0.ar(1/dur).range(0,1))[0]), 0, 0.1)\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\na = {\n var dur;\n\n dur = 0.1;\n\n LFTri.ar(100+(1000*Maths.ar(dur/2, dur/2, 0.99, 1, 0, 1, LFNoise0.ar(1/dur).range(0,1))[0]), 0, 0.1)\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Resetting start count with PulseDivider?"}, {"role": "assistant", "content": "SuperCollider forum — Resetting start count with PulseDivider?\n\ni think in your example Sweep is receiving a trigger while going from 0 to 1 causing the discontinuity in the phase because the duration between one trigger and the next is unknown.\n\nwith this example you get at least a continiuous phase with random triggers to drive the hanning window (evaluate it several times). but its not multichannel with distributed phases / windows accross channels:\n\n```supercollider\n(\nvar randomTrigPhase = { |triggerRate = 10, randomness = 1|\n var minDuration = (2 ** randomness) / triggerRate;\n var maxDuration = (2 ** (-1 * randomness)) / triggerRate;\n var demand = Dunique(minDuration * ((maxDuration / minDuration) ** Dwhite(0, 1)));\n var duration = Duty.ar(demand, DC.ar(0), demand);\n var phase = Phasor.ar(DC.ar(0), (1 / duration) / SampleRate.ir, 0, 1);\n (phase: phase, trigger: HPZ1.ar(phase) < 0);\n};\n\nvar hanningWindow = { |phase|\n (1 - (phase * 2pi).cos) / 2 * (phase < 1);\n};\n\n{\n var rate = 100;\n var phase = randomTrigPhase.(rate, 1).phase;\n hanningWindow.(phase);\n}.plot(0.1);\n)\n```\n\nim not sure if this is helping it just reminded me of some issue with multichannel random triggers and continiuous phases i have been trying to solve."}]} +{"conversations": [{"role": "user", "content": "What does `Function.performKeyValuePairs` do? What arguments does it take?"}, {"role": "assistant", "content": "`a = { |a, b, c| postf(\"% plus % plus % is %\\n\", a, b, c, a Arguments: selector — A Symbol representing a method selector.; pairs — Array or List with key-value pairs.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// constant source (72), max deviation +/- 3\n// no repetition within 5 pitches\n\n(\nx = {\n var trig = Impulse.ar(5);\n var midi = Demand.ar(trig, 0, DIdev(72, 2, -1, 2));\n midi.poll(5, label: \\midi);\n SinOsc.ar(midi.midicps.lag(0.007)) ! 2 * 0.1\n}.play;\n;\n\nx.release\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// constant source (72), max deviation +/- 3\n// no repetition within 5 pitches\n\n(\nx = {\n var trig = Impulse.ar(5);\n var midi = Demand.ar(trig, 0, DIdev(72, 2, -1, 2));\n midi.poll(5, label: \\midi);\n SinOsc.ar(midi.midicps.lag(0.007)) ! 2 * 0.1\n}.play;\n);\n\nx.release\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\"help-InFeedback\", { |out = 0, in = 0|\n Out.ar(out,\n InFeedback.ar(in, 1)\n );\n}).add;\nSynthDef(\"help-SinOsc\", { |out = 0, freq = 440|\n Out.ar(out, SinOsc.ar(freq, 0, 0.1))\n}).add;\n);\n\nx = Bus.audio(s, 1);\n\n// read from bus n play to bus 0 (silent)\na = Synth(\"help-InFeedback\", [\\in, x.index, \\out, 0]);\n\n// now play a synth after this one, playing to bus x\nb = Synth.after(a, \"help-SinOsc\", [\\out, x.index]);\n\n// add another synth\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\"help-InFeedback\", { |out = 0, in = 0|\n Out.ar(out,\n InFeedback.ar(in, 1)\n );\n}).add;\nSynthDef(\"help-SinOsc\", { |out = 0, freq = 440|\n Out.ar(out, SinOsc.ar(freq, 0, 0.1))\n}).add;\n);\n\nx = Bus.audio(s, 1);\n\n// read from bus n play to bus 0 (silent)\na = Synth(\"help-InFeedback\", [\\in, x.index, \\out, 0]);\n\n// now play a synth after this one, playing to bus x\nb = Synth.after(a, \"help-SinOsc\", [\\out, x.index]);\n\n// add another synth before a which also writes to bus x\n// now you can't hear b, as its data is one cycle old, and is overwritten by c\nc = Synth.before(a, \"help-SinOsc\", [\\out, x.index, \\freq, 800]);\n\n// free c and you can hear b again\nc.free;\nx.free;\n\na.free; b.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `PopUpTreeMenu.openAction` do?"}, {"role": "assistant", "content": "Function that gets evaluated when the popup menu is clicked. Arguments passed in: `this, mouseX,"}]} +{"conversations": [{"role": "user", "content": "What does `SCDoc.didIndexDocuments` do?"}, {"role": "assistant", "content": "A Boolean indicating if `SCDoc.indexAllDocuments` was called in this session"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// default initial params\n{ LinCongL.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// default initial params\n{ LinCongL.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\ns.boot;\n\nInstr(\"saw\",{ arg freq=400; Saw.ar(freq) * EnvGen.kr(Env.perc,doneAction:2)});\n\np = Patch(\"saw\",[KrNumberEditor(300,\\freq)]);\n\nSheet({ arg f;\n p.gui(f);\n ActionButton(f,\"asEvent\",{\n p.asEvent.play.postln\n });\n});\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\ns.boot;\n\nInstr(\"saw\",{ arg freq=400; Saw.ar(freq) * EnvGen.kr(Env.perc,doneAction:2)});\n\np = Patch(\"saw\",[KrNumberEditor(300,\\freq)]);\n\nSheet({ arg f;\n p.gui(f);\n ActionButton(f,\"asEvent\",{\n p.asEvent.play.postln\n });\n});\n\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nb = NodeProxy.audio(s, 2);\nb.play; // listen to b\nb.source = { SinOsc.ar([400, 500], 0, 0.1) }; // play something\n\nr = RecNodeProxy.newFrom(b);\nr.open(\"recproxy514.aif\"); // open file\nr.record; // start recorder (paused)\n\nr.unpause; // start recording\n\nb.source = { SinOsc.ar([430, 500], 0, 0.1) };\nb.source = { SinOsc.ar([410, 510], 0, 0.1) };\nb.source = { SinOsc.ar([LFNoise1.kr(80, 100, 300), 500], 0, 0.1) };\nr.pause;\nb.source = { Wh\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nb = NodeProxy.audio(s, 2);\nb.play; // listen to b\nb.source = { SinOsc.ar([400, 500], 0, 0.1) }; // play something\n\nr = RecNodeProxy.newFrom(b);\nr.open(\"recproxy514.aif\"); // open file\nr.record; // start recorder (paused)\n\nr.unpause; // start recording\n\nb.source = { SinOsc.ar([430, 500], 0, 0.1) };\nb.source = { SinOsc.ar([410, 510], 0, 0.1) };\nb.source = { SinOsc.ar([LFNoise1.kr(80, 100, 300), 500], 0, 0.1) };\nr.pause;\nb.source = { WhiteNoise.ar(0.01) };\nr.unpause;\nr.pause;\n\n\n// stop recording and close file\nr.close;\nb.stop; // stop listen to b\n```"}]} +{"conversations": [{"role": "user", "content": "What does `U.setAudioIn` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: id — (describe argument here); bus — (describe argument here). Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\nz = { // thru\nBAllPass.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(10, 18000, \\exponential),\n 0.8, // rq\n 0.5); // mul\n}.play)\nz.release;\n\n(\nz = { // like a bandpass\n var sig;\n sig = SoundIn.ar([0, 1]) * 0.5;\n BAllPass.ar(sig, MouseX.kr(10, 18000, \\exponential), 0.8) + sig.neg\n}.play\nz.release;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\nz = { // thru\nBAllPass.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(10, 18000, \\exponential),\n 0.8, // rq\n 0.5); // mul\n}.play)\nz.release;\n\n(\nz = { // like a bandpass\n var sig;\n sig = SoundIn.ar([0, 1]) * 0.5;\n BAllPass.ar(sig, MouseX.kr(10, 18000, \\exponential), 0.8) + sig.neg\n}.play)\nz.release;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Bus`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\nb = Bus(\\audio, 0, 2);\ns.bind {\n SynthDef(\\sinPerc, { |out = 0|\n var signal = SinOsc.ar * Env.sine(0.1).ar(gate: Impulse.ar(2));\n OffsetOut.ar(out, signal ! 2) }\n ).add;\n s.sync;\n Synth(\\sinPerc, [\\out, b]);\n b.plot(1);\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SimpleDMX.new` do? What arguments does it take?"}, {"role": "assistant", "content": "create a new SimpleDMX Arguments: universeSizes — An array of integers, one for each universe, specifying the number of channels in each universe. If not specified, defaults to 512 channels per universe.; cmdperiod — if `true`, the serial port will be closed on command-period.."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `NodeProxy`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\na = NodeProxy.new.play; // play to hardware output.\na.fadeTime = 2; // fadeTime specifies crossfade\n// set the source\na.source = { SinOsc.ar([350, 351.3], 0, 0.2) };\na.source = { Pulse.ar([350, 351.3] / 4, 0.4) * 0.2 };\na.source = Pbind(\\dur, 0.03, \\freq, Pbrown(0, 1, 0.1, inf).linexp(0, 1, 200, 350));\n\nb = NodeProxy.new;\na.source = { Ringz.ar(b.ar, [350, 351.3] * 8, 0.2) * 4 };\nb.source = { Impulse.ar([5, 7]/2, [0, 0.5]) };\n\na.clear(3); // clear after 3 seconds\nb.clear(3);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// using timer to modulate sine frequency: the slower the trigger is the higher the frequency\n(\n{ var trig;\n trig = Impulse.kr(MouseX.kr(0.5, 20, 1));\n SinOsc.ar(Timer.kr(trig) * 500 + 500, 0, 0.2)\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// using timer to modulate sine frequency: the slower the trigger is the higher the frequency\n(\n{ var trig;\n trig = Impulse.kr(MouseX.kr(0.5, 20, 1));\n SinOsc.ar(Timer.kr(trig) * 500 + 500, 0, 0.2)\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `History` that runs as it is."}, {"role": "assistant", "content": "```supercollider\nHistory.clear.end; // if needed, clear History first\nHistory.start; // starts recording, opens log file\n\n// execute these lines one by one, as a little performance history\n1 + 2;\np = ProxySpace.push(s.boot);\n~a = { Dust.ar([1, 1] * 30) * 0.3 };\n~a.play;\n~a.end(3);\n\nHistory.started; // is it on now?\n\n// stops recording history and ends logging.\nHistory.end;\nHistory.started;\n\nHistory.document; // creates a document with current history\nHistory.showLogFolder; // opens the folder where logs are written.\nHistory.showLogFile; // opens the current log file as it was written.\n\n\n// make a gui window, to access code history lines at will,\n// e.g. for code reuse in performance, adaptation, sharing, etc:\ng = History.makeWin;\n// specify left-bottom position, and number of lines in textview\ng = History.makeWin(0@20, 5);\n\n// play back the recorded history line by line\nHistory.play(0);\n\n\n// history can even record and play back stops with CmdPeriod.\n// run these lines one at a time:\nHistory.clear.start;\n1 + 2;\n2 + 3;\ns.boot;\n(dur: inf).play;\n\nCmdPeriod.run; // or hit the Stop key command, Cmd-., or ctrl-.\n3 + 4; // continue recording into history\n4 + 5;\nHistory.end;\n\n// Replays history, including a CmdPeriod, and keeps replaying history.\nHistory.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `StandardN`."}, {"role": "assistant", "content": "```supercollider\n// vary frequency\n{ StandardN.ar(MouseX.kr(20, SampleRate.ir)) * 0.3 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n b = {|x,y|\n var arr = List[];\n case\n {y % x.size == 0} // condition 1\n {\n var per = y / x.size;\n x.size.do{|oo|\n var pp = 1,i = 1;\n arr.add( x[oo] );\n while({i < per},{\n arr.add(0);\n i = i+1;\n });\n }\n }\n {x.size % y == 0} // condition 2\n {\n var pp = x.size / y, i = 0, sz = x.size;\n while({i < sz},{\n if(i % pp == 0)\n { arr.add(x[i]) };\n i=i+1;\n });\n };\n arr\n };\n a = [1,1,1,1];\n c = b.value(a,16) \n // [ 1, 1, 1, 1 ]\n // becomes\n // [ 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 ]\n\n b.value(c,4); \n // [ 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 ]\n // becomes\n // [ 1, 1, 1, 1 ]\n)\n```"}, {"role": "assistant", "content": "useful for expanding or reducing arrays by 2^x.\r\nI would like to know if there is a more concise way to write this!\r\nAny suggestions?\r\n\r\n(duplicate post, sorry! forgot to log in!)."}]} +{"conversations": [{"role": "user", "content": "What is `List` in SuperCollider?"}, {"role": "assistant", "content": "List — list of items of variable size List is a subclass of SequenceableCollection with unlimited growth in size. Although not a subclass of Array or its superclass ArrayedCollection it uses an Array in its implementation and is in many cases interchangeable with one. (List implements many of the same methods as Array.) Category: Collections > Ordered."}]} +{"conversations": [{"role": "user", "content": "Write a kick drum in SuperCollider."}, {"role": "assistant", "content": "A pitch-swept sine with a fast decay: the frequency envelope is what makes it read as a kick.\n\n```supercollider\n(\nSynthDef(\\kick, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 50, 40], [0.03, 0.15], -4));\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -6), doneAction: 2);\n Out.ar(out, Pan2.ar(SinOsc.ar(pitch) * env * amp));\n}).add;\n);\nSynth(\\kick);\n```"}]} +{"conversations": [{"role": "user", "content": "What is `StreamClutch` in SuperCollider?"}, {"role": "assistant", "content": "StreamClutch — buffers a streamed value Category: Streams-Patterns-Events."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LPZ1`."}, {"role": "assistant", "content": "```supercollider\n// Compare:\n\n{ WhiteNoise.ar(0.25) }.play;\n\n{ LPZ1.ar(WhiteNoise.ar(0.25)) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Monitor`."}, {"role": "assistant", "content": "```supercollider\n{ Out.ar(87, SinOsc.ar(MouseX.kr(240, 1000, 1) * [1, 2, 3], 0, 0.2)) }.play; // play three sine tone on channels 87, 88, and 89\nx = Monitor.new; // create a new monitor\nx.play(fromIndex: 87, fromNumChannels: 3, toIndex: 0, toNumChannels: 2); // play them back to the stereo hardware channels\n```"}]} +{"conversations": [{"role": "user", "content": "What does `StaticIntegerSpec.constrain` do? What arguments does it take?"}, {"role": "assistant", "content": "an integer that is supplied at the init of a synth and cannot change Arguments: value."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for SOUND 1, from orig Influx Example. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// SOUND 1, from orig Influx Example\n(\nNdef(\\dog).addSpec(\\intv, [-24, 24]);\nNdef(\\dog).addSpec(\\timescale, [0.01, 10, \\exp]);\nNdef(\\dog).addSpec(\\curve, [-10, 10]);\nNdef(\\dog).addSpec(\\ffreq, \\freq);\n\nNdef(\\dog).addSpec(\\loopnode, [0, 12]);\nNdef(\\dog).addSpec(\\dens, [10, 1000]);\nNdef(\\dog).addSpec(\\resfreq, \\freq);\nNdef(\\dog).addSpec(\\ringtime, [0.01, 1, \\exp]);\n\nNdef(\\dog, { |amp=0, freq=250, intv=19, timescale=1, curve=0, loopnode=0, dens = 10, resfreq = 500, ringtime = 0.01|\n var n = 15;\n var env = EnvGen.kr(\n Env({ 1.0.rand2 }!(n+1), {1.0.rand}!n, curve, releaseNode: n-1, loopNode: loopnode.min(n-3)),\n timeScale: timescale);\n var pitch = (env * [1, 0.33, -1] * intv).midiratio * freq;\n var form = Formant.ar(pitch, pitch.rotate(1) * 1.6, pitch.rotate(2) * 2.6);\n\n var dusty = Ringz.ar(\n Dust.ar(dens!3),\n (resfreq * LFNoise0.kr([3, 5, 7], 0.5, 1)).lag(0.3),\n ringtime)\n * ((dens ** -0.5) * (ringtime ** -0.3)\n );\n\n Splay.ar(form * dusty, level: amp * 4) ;\n});\n);\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// (thor magnusson) (2006)\n\n// An instrumentalist inside a synthdef.\n\n(\nSynthDef(\\drummer, { arg out=0, tempo=4;\n var snare, base, hihat;\n tempo = Impulse.ar(tempo); // for a drunk drummer replace Impulse with Dust !!!\n\n snare = WhiteNoise.ar(Decay2.ar(PulseDivider.ar(tempo, 4, 2), 0.005, 0.5));\n base = SinOsc.ar(Line.ar(120,60, 1), 0, Decay2.ar(PulseDivider.ar(tempo, 4, 0), 0.005, 0.5));\n hihat = HPF.ar(WhiteNoise.ar(1), 10000) * Decay2.ar(tempo, 0.005, 0.5);\n\n Out.ar(out,(snare + base + hihat) * 0.4 ! 2)\n}).add;\n);\n\na = Synth(\\drummer);\na.set(\\tempo, 6);\na.set(\\tempo, 18);\na.set(\\tempo, 180); // check the CPU! no increase.\na.free;\n```"}, {"role": "assistant", "content": "(thor magnusson) (2006) An instrumentalist inside a synthdef."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BufFrames`."}, {"role": "assistant", "content": "```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n// indexing with a phasor\n{ BufRd.ar(1, b, Phasor.ar(0, BufRateScale.kr(b), 0, BufFrames.kr(b))) }.play;\n\n// indexing by hand\n{ BufRd.ar(1, b, K2A.ar(MouseX.kr(0, BufFrames.kr(b)))) }.play;\n\nb.free\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Env.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a new envelope Arguments: levels — an array of levels. The first value is the initial level of the envelope and, when used with EnvGen, is held until the `gate` opens. If a level is a UGen, it's value is updated only when the envelope reaches that node. When a level is itself an array, the envelope returns a multichannel output (for ; times — an array of durations of segments in seconds. There should be one fewer duration than there are levels, but if shorter, the array is extended by wrapping around the given values.; curve — a Symbol, Float, or an Array of those. Determines the shape of the envelope segments. The possible values are:; releaseNode — an Integer or `nil`. The envelope will sustain at the releaseNode until released. `(` In the above example, the release node is set to the third node, which means it will sustain at the level of 0.5 until it is released. The envelope will then continue on until its last node is reached.; loopNode — an Integer or `nil`. Creates a segment of looping nodes. You must specify a releaseNode in order for loopNode to have any effect. The loop node is the initial node of the loop and is never repeated. Upon reaching the release node, the envelope will transition back to the node that follows the loop n; offset — an offset to all time values (only applies in IEnvGen).."}]} +{"conversations": [{"role": "user", "content": "Saving \"Presets\"?"}, {"role": "assistant", "content": "SuperCollider forum — Saving \"Presets\"?\n\nIf you don’t care too much about it being human readable, just use writeArchive and readArchive:\n\n```supercollider\na = Array.fill(400, {rrand(0,2200)});\n\na.writeArchive(\"/Users/spluta1/Documents/SC/test\");\n\nb = Object.readArchive(\"/Users/spluta1/Documents/SC/test\");\n\nb.postln;\n```\n\nSam"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Klank.ar(`[[800, 1071, 1153, 1723], nil, [1, 1, 1, 1]], Impulse.ar(2, 0, 0.1) }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Klank.ar(`[[800, 1071, 1153, 1723], nil, [1, 1, 1, 1]], Impulse.ar(2, 0, 0.1)) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n var saw, bpf;\n saw = Saw.ar(\n freq: [1700,2000],\n mul: LFPulse.kr(\n freq: [2,7],\n width: 0.115));\n bpf = LPF.ar(in: saw, freq: SinOsc.kr(1/3).range(250, 4000)); \n}.play;\n)\n```"}, {"role": "assistant", "content": "Quiz 4a for MUSC 115, pp. 62-84 from Gentle Intro to SuperCollider."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ReplaceOut`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"ReplaceOutHelp\", { |out = 0, freq = 440|\n var source;\n source = SinOsc.ar(freq, 0, 0.1);\n\n // write to the bus, replacing previous contents\n ReplaceOut.ar(out, source);\n\n}).add;\n);\n\n// each Synth replaces the output of the previous one\nx = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 500]);\ny = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 600]);\nz = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 700]);\n\n// release them in reverse order; the older Synths are still there.\nz.free;\ny.free;\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `Bus` in SuperCollider briefly."}, {"role": "assistant", "content": "Bus — Representation of a bus on the server The clientside representation of an audio or control bus on a server. Encapsulates all the Browse#OpenSoundControl#OSC messages a Bus can receive. Manages allocation and deallocation of bus indices so that you don't need to worry about conflicts. The number of control busses, audio busses, and input and output busses is fixed and cannot be changed after the server has been booted. Category: Server > Abstractions."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `BufSampleRate`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n// compares a 1102.5 Hz sine tone (11025 * 0.1, left) with a 1100 Hz tone (right)\n// the apollo sample has a sample rate of 11.025 kHz\n(\n{\n var freq;\n freq = [BufSampleRate.kr(b) * 0.1, 1100];\n SinOsc.ar(freq, 0, 0.1)\n}.play;\n);\n\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `MxUnit.freeToBundle` do? What arguments does it take?"}, {"role": "assistant", "content": "Container for a musical object (Instr, NDef, Spline etc); this is a single unit that has inlets and outlets which can be connected to other units Arguments: bundle."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nSynthDef(\\bird,{\n var sig, freqenv, env, trig;\n trig = Dust.ar(2);\n env = EnvGen.ar(Env.perc(0.01,0.4,0.8,-8), trig, doneAction: 2);\n freqenv = EnvGen.ar(Env([Rand(1000,3000), Rand(3000,6000), Rand(1000,2000), Rand(2000,5000)],[0.1,0.01,0.1]);, trig);\n sig = SinOsc.ar(freqenv, 0, env);\n sig = Pan2.ar(sig, Rand(-1.0,1.0));\n Out.ar(0, sig);\n}).add;\n);\n\n(\nRoutine({\n inf.do({\n Synth(\\bird);\n rrand(1.0,2.0).wait;\n })\n}).play;\n)\n```"}, {"role": "assistant", "content": "I haven't found a quite satisfying code about birds, so here's a very simple SynthDef to start with."}]} +{"conversations": [{"role": "user", "content": "How do I add a reverb send to a whole group?"}, {"role": "assistant", "content": "Same shape as the delay: a private stereo bus, one effect reading it, instruments writing both dry\nand wet.\n\n```supercollider\n(\n~verbBus = Bus.audio(s, 2);\nSynthDef(\\verb, { |in = 0, out = 0, room = 0.85, mix = 0.5|\n Out.ar(out, FreeVerb.ar(In.ar(in, 2), mix, room, 0.5) * 0.7);\n}).add;\nSynthDef(\\blip, { |out = 0, send = 0, freq = 440, amp = 0.1|\n var env = EnvGen.kr(Env.perc(0.002, 0.4), doneAction: 2);\n var sig = SinOsc.ar(freq) * env * amp;\n Out.ar(out, sig);\n Out.ar(send, sig);\n}).add;\n);\nSynth(\\verb, [\\in, ~verbBus]);\nPbind(\\instrument, \\blip, \\send, ~verbBus, \\degree, Pseq([0, 4, 7, 11], inf), \\dur, 0.25).play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `StandardL`."}, {"role": "assistant", "content": "```supercollider\n// vary frequency\n{ StandardL.ar(MouseX.kr(20, SampleRate.ir)) * 0.3 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{Formants.ar(100, Vowel([\\e, \\o], [\\bass])) * 0.1 }.play\n{Formants.ar(100, Vowel(\\e, [\\bass,\\alto])) * 0.1 }.play\n{Formants.ar(100, Vowel([\\e, \\o], [\\bass,\\alto]) * 0.1 }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{Formants.ar(100, Vowel([\\e, \\o], [\\bass])) * 0.1 }.play\n{Formants.ar(100, Vowel(\\e, [\\bass,\\alto])) * 0.1 }.play\n{Formants.ar(100, Vowel([\\e, \\o], [\\bass,\\alto])) * 0.1 }.play\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `ScalarPatchIn` in SuperCollider briefly."}, {"role": "assistant", "content": "ScalarPatchIn — \\scalar rate PatchIn Category: Libraries > crucial > internals."}]} +{"conversations": [{"role": "user", "content": "What does `FunctionList.addFunc` do?"}, {"role": "assistant", "content": "This message is used to be able to add to an Object, to a Function, or to a FunctionList. `nil.addFunc` returns a function, if only one function is passed in the argument. `function.addFunc` then returns a"}]} +{"conversations": [{"role": "user", "content": "What does `CytonWifi.close` do?"}, {"role": "assistant", "content": "stops main loop and free the internal osc"}]} +{"conversations": [{"role": "user", "content": "I get 'server not running' or nothing happens at all."}, {"role": "assistant", "content": "The server is not booted. In the IDE press Ctrl+B, or evaluate `s.boot`. If code depends on a SynthDef being there, put it inside `s.waitForBoot { ... }`. When a script runs headless you can do `s.boot; s.sync;` and continue. `s.serverRunning` tells you the truth; if it is false, look at the post window for the boot error (usually an audio device problem)."}]} +{"conversations": [{"role": "user", "content": "What does `Thunk.new` do? What arguments does it take?"}, {"role": "assistant", "content": "unevaluated value Arguments: function — some function that returns the desired value."}]} +{"conversations": [{"role": "user", "content": "What is `GlitchBPF` in SuperCollider?"}, {"role": "assistant", "content": "GlitchBPF — backward compatibility October 2012 BPF was changed to use double-precision floats (git commit: 72412f63affa94f69e2ea7539e21831a1d0d3e01). GlitchBPF can be used as drop-in replacements to get the old behavior back. Good for very noise and glitchy sounds where the filter [nearly] blows up. Category: UGens > Filters > Linear, UGens > Filters > GlitchUGens."}]} +{"conversations": [{"role": "user", "content": "Explain `IBVAfile` in SuperCollider briefly."}, {"role": "assistant", "content": "IBVAfile — helper class some methods for reading and converting files recorded with IBVArecorder. Category: External Control."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LinCongN`."}, {"role": "assistant", "content": "```supercollider\n// randomly modulate params\n(\n{ LinCongN.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(0.1, 0.5, 1.4),\n LFNoise2.kr(0.1, 0.1, 0.1),\n LFNoise2.kr(0.1)\n) * 0.2 }.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nVowel().brightenRel(1 ).dBs.postln; \nVowel().brightenRel(0.1).dBs.postln;\nVowel().brightenRel(1.5).dBs.postln;\n\n// refFormant = 0 loud on the left\n{Formants.ar(100, Vowel().brightenRel(MouseX.kr(0, 2), 0 )) * 0.1}.play\n// refFormant = 1\n{Formants.ar(100, Vowel().brightenRel(MouseX.kr(0, 2), 1 )) * 0.1}.play\n// refFormant = 2\n{Formants.ar(100, Vowel().brightenRel(MouseX.kr(0, 2), 2 )) * 0.1}.play\n// refFormant = 3\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nVowel().brightenRel(1 ).dBs.postln; \nVowel().brightenRel(0.1).dBs.postln;\nVowel().brightenRel(1.5).dBs.postln;\n\n// refFormant = 0 loud on the left\n{Formants.ar(100, Vowel().brightenRel(MouseX.kr(0, 2), 0 )) * 0.1}.play\n// refFormant = 1\n{Formants.ar(100, Vowel().brightenRel(MouseX.kr(0, 2), 1 )) * 0.1}.play\n// refFormant = 2\n{Formants.ar(100, Vowel().brightenRel(MouseX.kr(0, 2), 2 )) * 0.1}.play\n// refFormant = 3\n{Formants.ar(100, Vowel().brightenRel(MouseX.kr(0, 2), 3 )) * 0.1}.play\n// refFormant = 4 loud on the right\n{Formants.ar(100, Vowel().brightenRel(MouseX.kr(0, 2), 4 )) * 0.1}.play\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for SOUND 1, from orig Influx Example. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// SOUND 1, from orig Influx Example\n(\nNdef(\\dog).addSpec(\\intv, [-24, 24]);\nNdef(\\dog).addSpec(\\timescale, [0.01, 10, \\exp]);\nNdef(\\dog).addSpec(\\curve, [-10, 10]);\nNdef(\\dog).addSpec(\\ffreq, \\freq);\n\nNdef(\\dog).addSpec(\\loopnode, [0, 12]);\nNdef(\\dog).addSpec(\\dens, [10, 1000]);\nNdef(\\dog).addSpec(\\resfreq, \\freq);\nNdef(\\dog).addSpec(\\ringtime, [0.01, 1, \\exp]);\n\nNdef(\\dog, { |amp=0, freq=250, intv=19, timescale=1, curve=0, loopnode=0, dens = 10, resfreq = 500, ringtime = 0.01|\n var n = 15;\n var env = EnvGen.kr(\n Env({ 1.0.rand2 }!(n+1), {1.0.rand}!n, curve, releaseNode: n-1, loopNode: loopnode.min(n-3)),\n timeScale: timescale);\n var pitch = (env * [1, 0.33, -1] * intv).midiratio * freq;\n var form = Formant.ar(pitch, pitch.rotate(1) * 1.6, pitch.rotate(2) * 2.6);\n\n var dusty = Ringz.ar(\n Dust.ar(dens!3),\n (resfreq * LFNoise0.kr([3, 5, 7], 0.5, 1)).lag(0.3),\n ringtime)\n * ((dens ** -0.5) * (ringtime ** -0.3)\n );\n\n Splay.ar(form * dusty, level: amp * 4) ;\n});\n);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Basic tone simulator of a stylophone. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n/*\nRetro Stylophone\n\nReverse engineered from: https://www.waitingforfriday.com/?p=334\n\n1. Relaxation oscillator (UJT)\n\n- generated by a combination of two oscillators. The primary oscillator is a\n current controlled PUT (Programmable Uni-Junction Transistor) relaxation oscillator which is\n responsible for generating the overall tone of the instrument.\n A secondary LFO phase-shifted provides the vibrato\n (the relative slow wavering of a sound around the notes centre pitch)\n\n- around 10 VPP\n\n2. LFO phase-shift (vibrato)\n\n- generated by a low-frequency oscillator made with a transistor and several capacitors,\n which produces a triangle/sine wave fed into the frequency control voltage operating the UJT\n\n- frequency of about 8.5Hz, phased shifted of 180 degree, around 4.2 VPP\n*/\n\n(\nSynthDef(\\stylophone, { |freq = 220, vibAmp = 2, toneAmp = 5, atkTime = 0.01, trigger = 0|\n\n var lfo = OnePole.kr(LFPar.kr(8, mul: vibAmp, add: freq), 0.9); // 180 degree inversion\n var relaxOsc = LFPulse.ar(lfo, width: 0.9, mul: toneAmp);\n\n var asr = EnvGen.kr(Env.asr(atkTime * 5, releaseTime: 0.001, curve: \\lin), gate: trigger);\n\n Out.ar(0, relaxOsc * asr)\n}).add\n);\n\nf = Synth(\\stylophone);\n\nf.set(\\freq, 208.2);\nf.set(\\freq, 233.4);\n\nf.set(\\trigger, 1);\nf.set(\\trigger, 0);\nf.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n~chaos={\n var signal, myFrequency, frequencyMin=0.1, frequencyMax=30, myAmplitude, amplitudeMin=0.01, amplitudeMax=0.6, myPhase, phaseMin=0, phaseMax=1.5;\n myFrequency = Array.fill(2, {[rrand(frequencyMin, frequencyMax)]});\n myAmplitude = Array.fill(2, {[rrand(amplitudeMin, amplitudeMax)]});\n myPhase = Array.fill(2, {[rrand(phaseMin, phaseMax)]});\n signal = LeakDC.ar(ChaosGen.allSubclasses.choose.ar(myFrequency, myPhase, myAmplitude));\n Out.ar(0, signal);\n};\n);\n\n~chaos.scope\n```"}, {"role": "assistant", "content": "chaos gen modular function for modular pseudo ugen prototyping."}]} +{"conversations": [{"role": "user", "content": "What does `DataBuffer.new` do? What arguments does it take?"}, {"role": "assistant", "content": "create a new Arguments: board — an instance of a OpenBCI subclass (for example a CytonSerial or GanglionWifi).; maxSize — the number of slots in both data and accelerometer buffers. If the data is not read fast enough, the buffers will fill up to this size and then start dropping values (fifo).; dataActive — a Boolean flag indicating if data should be buffered or not.; accelActive — a Boolean flag indicating if accelerometer data should be buffered or not.."}]} +{"conversations": [{"role": "user", "content": "What does `Image.closeAllPlotWindows` do?"}, {"role": "assistant", "content": "Close all the Image plot windows currently"}]} +{"conversations": [{"role": "user", "content": "What is `Redraw` in SuperCollider?"}, {"role": "assistant", "content": "Redraw — simple drawing with the mouse The GUI takes the following modifier keys… Category: Red > redTools."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `IRand`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-IRand\", {\n Out.ar(\n IRand(0, 1), // play on random channel between 0 and 1\n FSinOsc.ar(500,\n 0, Line.kr(0.2, 0, 0.1, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n(\nRoutine({\n 16.do({\n Synth.new(\"help-IRand\"); 0.5.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Gbman2DC.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "gingerbreadman map 2D chaotic generator Arguments: minfreq, maxfreq — iteration frequency in Hertz; x0 — initial value of x; y0 — initial value of y."}]} +{"conversations": [{"role": "user", "content": "What does `AbstractFunction.sinh` do?"}, {"role": "assistant", "content": "An object which responds to a set of messages that represent mathematical functions"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BRF`."}, {"role": "assistant", "content": "```supercollider\n{ BRF.ar(Saw.ar(200, 0.1), FSinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3800, 4000), 0.3) }.play;\n\n{ BRF.ar(Saw.ar(200, 0.5), MouseX.kr(100, 10000, 1), 0.3) }.play;\n\n\n // BRF on control signals:\n(\n{ var vib = BRF.kr(SinOsc.kr([1, 3, 10], 0, [1, 0.5, 0.25]).sum, MouseX.kr(1, 10, 1), 0.3);\n SinOsc.ar(vib * 200 + 600) * 0.2 }.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// We'll hear the sawtooth wave when the two sine oscillators are both in the region x = 0.0 to 0.5, y = 0.5 to 1.0\n(\n{\n InRect.ar(\n SinOsc.ar(1), SinOsc.ar(1.3), Rect(0, 0.5, 0.5, 0.5)\n ) * LFSaw.ar(44, 0, 0.1)\n}.play\n);\n\n// Stereo effect\n(\n{\n InRect.ar(\n LFNoise0.ar([140, 141]), LFNoise0.ar(143), Rect(0, 0, 0.5, 1)\n ).lag(0.1) * LFSaw.ar(SinOsc.ar(10, 0, 5, 400), 0, 0.1)\n}.play\n);\n\n// For the Rect, create as left\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// We'll hear the sawtooth wave when the two sine oscillators are both in the region x = 0.0 to 0.5, y = 0.5 to 1.0\n(\n{\n InRect.ar(\n SinOsc.ar(1), SinOsc.ar(1.3), Rect(0, 0.5, 0.5, 0.5)\n ) * LFSaw.ar(44, 0, 0.1)\n}.play\n);\n\n// Stereo effect\n(\n{\n InRect.ar(\n LFNoise0.ar([140, 141]), LFNoise0.ar(143), Rect(0, 0, 0.5, 1)\n ).lag(0.1) * LFSaw.ar(SinOsc.ar(10, 0, 5, 400), 0, 0.1)\n}.play\n);\n\n// For the Rect, create as left, 'top', width, height;\nr = Rect(0, 0, 1, 1)\n\nr.left\nr.top\nr.right\nr.bottom\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `FoldIndex`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// indexing into a table\n(\n{\n var buf = LocalBuf.newFrom([200, 300, 400, 500, 600, 800]);\n var freq = FoldIndex.kr(buf, MouseX.kr(0, BufFrames.ir(buf) * 3));\n SinOsc.ar(freq) * 0.1\n}.play;\n);\n\n// the same using a global buffer\n(\nt = [200, 300, 400, 500, 600, 800];\nb = Buffer(s, t.size, 1);\n\n// alloc and set the values\ns.listSendMsg(b.allocMsg(b.setnMsg(0, t)).postln);\n\nSynthDef(\\help_Index, { |out = 0, bufnum = 0|\n Out.ar(out,\n SinOsc.ar(\n FoldIndex.kr(\n bufnum,\n MouseX.kr(0, BufFrames.ir(bufnum) * 3)\n ),\n 0,\n 0.5\n )\n )\n}).play(s, [\\bufnum, b.bufnum]);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `IBVAfile.convert` do? What arguments does it take?"}, {"role": "assistant", "content": "convert file from binary to Arguments: path — input binary file; outPath — optional output text file path. if nil then `path++\"CONVERTED.txt\"` will be used.."}]} +{"conversations": [{"role": "user", "content": "What does `Pdef.clear` do?"}, {"role": "assistant", "content": "Clear all proxies, setting their source to"}]} +{"conversations": [{"role": "user", "content": "Resizing FreqScope?"}, {"role": "assistant", "content": "SuperCollider forum — Resizing FreqScope?\n\nOddly, this seems to work:\n\n```supercollider\n// max partial = 20 kHz\n// do not play this loudly\na = { Blip.ar(100, 200, 0.02).dup }.play;\n\nv = FreqScope(800, 600); // top partial is shown below 1.75 kHz (?)\n\nv.scope.scope.xZoom = 1; // seems correct, by eyeballing\n\n// let's try another resolution\nv = FreqScope(600, 500);\nv.scope.scope.xZoom = 1; // hm, zoom = 1 seems OK here too\n```\n\nFreqScope includes the line scope.xZoom_((scope.bufSize*0.25) / width); so it may be that this calculation is incorrect. I’m unclear, for instance, why it’s dividing by width – apparently zooming out for larger windows...?\n\nBut I tried three different widths (800x600, 600x500, 200x150), and for all of them, xZoom = 1 appeared to be correct. It’s possible that this calculation is vestigial, then – maybe we needed it for the older version of frequency scope, but the Qt version might not need it at all.\n\nhjh"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `UnaryOpUGen` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\na = WhiteNoise.ar; // a WhiteNoise\nb = a.squared; // a UnaryOpUGen.\nb.operator; // squared\n\n// sound example\n\n{ var a = LFSaw.ar(300).range(0, 2pi); a.sin * 0.1 }.play;\n\n// Plotting the \"abs\" unary operator (via the server):\n\n{ SinOsc.ar(300).abs }.plot\n```"}]} +{"conversations": [{"role": "user", "content": "How do I structure a live-coding performance in one file?"}, {"role": "assistant", "content": "One Tdef per musical layer, each with its own loop, so you can start and stop layers while the set\nruns.\n\n```supercollider\n(\nTdef(\\kick, {\n loop {\n Synth(\\kick);\n 0.5.wait;\n }\n}).play;\n\nTdef(\\hats, {\n loop {\n Synth(\\hat, [\\amp, 0.15]);\n (1/8).wait;\n }\n}).play;\n)\n```\n`Tdef(\\kick).stop` stops one layer, `Tdef(\\kick).reset` restarts it at the next cycle, and\n`CmdPeriod.run` stops everything."}]} +{"conversations": [{"role": "user", "content": "I get 'syntax error, unexpected NAME' on a block that looks fine."}, {"role": "assistant", "content": "Almost always a missing semicolon between two statements — SuperCollider does not insert them.\n\n```supercollider\n// broken: two statements, no separator\n{ var sig = SinOsc.ar(440) sig = sig * 0.1; sig }.play\n```\n\n```supercollider\n// fixed\n{ var sig = SinOsc.ar(440); sig = sig * 0.1; sig }.play\n```\nThe error points at the second statement, not at the missing semicolon before it, which is why it looks\nfine. If it is not a semicolon, count the brackets: `.ar(` open, `)` closed."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `NodeProxy` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\na = NodeProxy.new.play; // play to hardware output.\na.fadeTime = 2; // fadeTime specifies crossfade\n// set the source\na.source = { SinOsc.ar([350, 351.3], 0, 0.2) };\na.source = { Pulse.ar([350, 351.3] / 4, 0.4) * 0.2 };\na.source = Pbind(\\dur, 0.03, \\freq, Pbrown(0, 1, 0.1, inf).linexp(0, 1, 200, 350));\n\nb = NodeProxy.new;\na.source = { Ringz.ar(b.ar, [350, 351.3] * 8, 0.2) * 4 };\nb.source = { Impulse.ar([5, 7]/2, [0, 0.5]) };\n\na.clear(3); // clear after 3 seconds\nb.clear(3);\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n//var board= CytonSerial(\"/dev/tty.usbserial-DM00DRM0\", initAction: {|b| b.start});\nvar board= PlaybackData(\"~/Desktop/OpenBCI-RAW-2019-04-10_19-04-26.txt\", initAction: {|b| b.start});\n~board= board;\n);\n\n~board.currentTime; //time in file\n\n~board.accelAction= {|xyz| xyz.postln}; //start posting recorded accelerometer data\n\n~board.stop;\n~board.start;\n~board.close;\n```"}, {"role": "assistant", "content": "var board= CytonSerial(\"/dev/tty.usbserial-DM00DRM0\", initAction: {|b| b.start}); (PlaybackData: for playing back data from a file)"}]} +{"conversations": [{"role": "user", "content": "What is `PrintVal` in SuperCollider?"}, {"role": "assistant", "content": "PrintVal — debug assistance This is sometimes helpful just to check output values- it should post to the Post Window, but don't make it post too often or the CPU use will rise dramatically. Category: UGens > Unclassified //SLUGens released under the GNU GPL as extensions for SuperCollider 3, by Nick Collins, http://composerprogrammer.com/index.html."}]} +{"conversations": [{"role": "user", "content": "What is `Node`?"}, {"role": "assistant", "content": "Node — Abstract superclass of Synth and Group"}, {"role": "user", "content": "What does `Node.free` do?"}, {"role": "assistant", "content": "Stop this Node and free it from its parent group on the server. Once a Node has been freed, you cannot restart it."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\nx = Synth(\"default\");\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for exploring of morphing cycled envelopes (i.e: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\ro_v19, {\n var freq = 40.rrand(90).debug('base freq');\n var seed = thisThread.randSeed = 1000000000.rand.debug('seed');\n var gen = [LFNoise2,LFNoise0,SinOsc,LFPulse,LFSaw];\n var sig = Splay.ar({\n var i = 4.exprand(40).asInteger;\n Median.ar(\n 3.exprand(18),\n EnvGen.ar(\n Env( // wave form\n [0] ++ Array.fill(i-1, { \n gen.choose.kr(\n 0.25.coin.if({ gen.choose.kr(0.01.exprand(0.1)).exprange(0.1,1) }, { 0.1.exprand(1) }), \n mul: 0.25.coin.if({ gen.choose.kr(0.05.exprand(10)).range(0.1,1) }, { 0.1.rrand(1) })\n )\n }) ++ [0],\n Array.rand(i-1, 0.1,1.0).normalizeSum,\n [[-5.0.rrand(5),\\sin].choose] ++ Array.fill(i-2, {\n [\\sin ! 1.rrand(6), -5.0.rrand(5) ! 1.rrand(4)].flat.choose\n }) ++ [[-5.0.rrand(5),\\sin].choose]\n ).circle,\n timeScale: Duty.kr( // freq\n Drand([4,8,16,24], inf), 0,\n Dwrand([1,2,4,8,16,32,64]*freq, ((14..7) ** 1.rrand(3)).normalizeSum, inf) // octave\n * 0.75.coin.if({ Duty.kr( // note\n [Dxrand, Drand].choose.new([0.125,0.25,0.5,1,2,4,6,8,12], inf), 0,\n Dshuf({ (0..11).choose.midiratio } ! 1.exprand(8), inf)\n ) }, { (0..11).choose.midiratio })\n ).reciprocal\n )\n ) * EnvGen.kr( // rhythm\n Env.perc(\n 0.01.exprand(0.4) * 0.25.coin.if({ Duty.kr( // atk\n Drand([0.5,1,2,4,8,12,16], inf), 0,\n Dshuf({ [1,2,3,4].choose } ! 1.exprand(8), inf)\n ) }, { 1 }),\n 0.1.exprand(4) * 0.75.coin.if({ Duty.kr( // release\n Drand([0.5,1,2,4,8,12,16], inf), 0,\n Dshuf({ [1,2,4,8,16].choose.reciprocal } ! 1.exprand(8), inf)\n ) }, { 1 }),\n LFNoise2.kr(0.1.exprand(10)).range(0.05,1), // appearance\n LFNoise2.kr(0.1.exprand(10)).range(-4,4),\n ).circle\n );\n } ! 3.rrand(9).debug('source'));\n BHiShelf.ar(\n GVerb.ar(\n Rotate2.ar(sig[0], sig[1], Duty.kr(Drand([2,4,8],inf), 0, Drand([-1,1,0],inf)) * LFSaw.kr(0.1.exprand(1))),\n 40.rrand(150).debug('room')\n ),\n LFNoise2.kr(0.1.exprand(0.5)).range(4000,6500),\n LFNoise2.kr(0.1.exprand(1)).range(1,3),\n LFNoise2.kr(0.1.exprand(1)).range(-24,-16)\n );\n}).play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `ReplaceOut`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"ReplaceOutHelp\", { |out = 0, freq = 440|\n var source;\n source = SinOsc.ar(freq, 0, 0.1);\n\n // write to the bus, replacing previous contents\n ReplaceOut.ar(out, source);\n\n}).add;\n);\n\n// each Synth replaces the output of the previous one\nx = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 500]);\ny = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 600]);\nz = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 700]);\n\n// release them in reverse order; the older Synths are still there.\nz.free;\ny.free;\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// vary frequency\n{ LorenzL.ar(MouseX.kr(20, SampleRate.ir)) * 0.3 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// vary frequency\n{ LorenzL.ar(MouseX.kr(20, SampleRate.ir)) * 0.3 }.play(s);\n```"}]} {"conversations": [{"role": "user", "content": "What does `List.scramble` do?"}, {"role": "assistant", "content": "Returns a new List whose elements have been scrambled. The receiver is unchanged. `List[1, 2, 3, 4, 5,"}]} -{"conversations": [{"role": "user", "content": "What does `ServerGui.input` do? What arguments does it take?"}, {"role": "assistant", "content": "an alternate small server view Arguments: layout; width."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Timing variations."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\sound, {\n arg i_bus = 0, amp = 0.1, freq = 440, sustain = 1, pan = 0;\n var env, osc, out;\n env = EnvGen.kr(Env.perc(0.01, sustain, amp),doneAction:2);\n osc = SinOsc.ar([freq, freq * 1.005, freq * 0.995], mul:env);\n out = Pan2.ar(osc, pan);\n Out.ar(i_bus, out);\n}).send(s);\n);\n\n(\n~amp = 0.1;\na = Pdef(\\a,\n Pbind(\n \\instrument, \\sound,\n \\amp, ~amp * 1.5,\n \\degree, Pseq([2, 4, 5, 6, 1] - 1, inf),\n \\dur, Pseq([1, 1, 1, 1, 2] / 4, inf)\n )\n).quant_([3, 0, 0, 1]);\n\nb = Pdef(\\b,\n Pbind(\n \\instrument, \\sound,\n \\amp, ~amp,\n \\degree, Pseq(([8, 6, 5, 3, 4, 6]!3).flat[0..(6*3)-2] - 1, inf),\n \\dur, Prand([Pseq([1, 1, 1, 1, 1, 1] / 4, 4), Prand([1/8, 3/8], 1)], inf)\n )\n).quant_([3, 0, 0, 1]);\n\nc = Pdef(\\c,\n Pbind(\n \\instrument, \\sound,\n \\amp, ~amp * 0.6,\n \\degree, Pseq([1, 6, 8, 6, Pwrand([11,13], [2, 1].normalizeSum)] - 1, inf),\n \\amp, Pseq([0, 1, 1, 1, 1] / 10, inf),\n \\dur, Pseq([8, 1, 1, 1, 1] / 8, inf),\n \\sustain, 0.1\n )\n).quant_([3, 0, 0, 1]);\n);\n\n(\nSystemClock.sched(0, Routine({\n a.play; 12.yield;\n b.play; 12.yield;\n c.play; 12.yield;\n c.pause; 6.yield;\n a.pause; 6.yield;\n\n b.pause; a.play; 12.yield;\n b.play; 12.yield;\n c.play; 12.yield;\n c.pause; a.pause; 6.yield;\n b.pause; 6.yield;\n}));\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n//MUST be a buffer with data in format [sizeofcurrentsieve,sieveentry1,sieveentry2,...] where currentsize always less than initially allocated buffer length -1. \n\n{ Sieve1.ar(LocalBuf.newFrom([10]++({0.75.rand}!10)),MouseX.kr(2,100))*0.2}.play\n\n{ Sieve1.ar(LocalBuf.newFrom([88]++({[0.1.rand,0.5.rand].wchoose([0.8,0.2])}!88)),MouseX.kr(1,100))*0.2}.play\n\nb = Buffer.alloc(s,300); \n\nb.setn(0, [88]++({[0.1.rand,0.5.rand]\n// …\n```"}, {"role": "assistant", "content": "MUST be a buffer with data in format [sizeofcurrentsieve,sieveentry1,sieveentry2,...] where currentsize always less than initially allocated buffer length -1. dynamically swap buffer (Sieve1: Fuzzy sieve based synthesis)"}]} -{"conversations": [{"role": "user", "content": "What is rq in BPF.ar?"}, {"role": "assistant", "content": "rq is the reciprocal of Q, so it is a bandwidth control, not a Q control. Small rq means a narrow, resonant band; large rq means a wide, gentle one. The signature is `BPF.ar(in, freq, rq, mul, add)`. A common idiom is `rq = 0.3` for a broad sweep and `rq = 0.02` for a whistle. The same rq convention applies to RLPF and RHPF."}]} +{"conversations": [{"role": "user", "content": "What does `Color.fromArray` do? What arguments does it take?"}, {"role": "assistant", "content": "Same as Arguments: array — An instance of Array. 1-4 values between 0 and 1. See #*new.."}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ var sig = SinOsc.ar(440) * 0.2; Out.ar(0, sig) }.play;\n```"}, {"role": "assistant", "content": "The minimal SynthDef idiom: a source multiplied by an amplitude, written to the master bus.\n\n`var sig = SinOsc.ar(440) * 0.2` builds the signal; `Out.ar(0, sig)` is the only mandatory part, because a\nUGen graph that never reaches an output produces no sound. `Out`'s first argument is the bus number — 0 is\nthe main stereo output — and the second is the signal. The function's return value does not matter here,\nwhich is why the `Out.ar` can sit on its own line. `.play` compiles this into an anonymous SynthDef and\nstarts one instance."}]} +{"conversations": [{"role": "user", "content": "What does `Buffer.bufnum` do?"}, {"role": "assistant", "content": "Returns the buffer number of the corresponding server-side buffer. In normal use you should not need to access this value, since instances of Buffer can be used directly as UGen inputs or Synth"}]} +{"conversations": [{"role": "user", "content": "What does `Document.onClose` do? What arguments does it take?"}, {"role": "assistant", "content": "Get/set the action to be performed on closing the Arguments: value — An instance of Function or FunctionList.."}]} +{"conversations": [{"role": "user", "content": "What does `ProxySpace.fadeTime` do?"}, {"role": "assistant", "content": "set the fadetime of all proxies as well as the default fade"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `OscN` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// compare examples below with interpolating Osc examples.\n\n(\ns = Server.local;\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, false, true);\nb = Buffer.alloc(s, 512, 1);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum, 500, 0, 0.5)\n )\n}).play(s, [0, 0, 1, b.bufnum]);\n\n);\nb.free;\n\n\n\n(\n// noninterpolating - there are noticeable artifacts\n// modulate freq\n\ns = Server.local;\nb.sine1(1.0/[1, 2, 3, 4, 5, 6].squared, true, false, true);\nb = Buffer.alloc(s, 512, 1);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum, XLine.kr(2000, 200), 0, 0.5)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n\n);\nb.free;\n\n(\n// sounds very different than the Osc example\ns = Server.local;\nb = Buffer.alloc(s, 512, 1);\nb.sine1([1.0], true, true, true);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum,\n OscN.ar(bufnum,\n XLine.kr(1, 1000, 9),\n 0,\n 200,\n 800),\n 0,\n 0.25)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n\n);\nb.free;\n\n(\n// modulate phase\ns = Server.local;\nb = Buffer.alloc(s, 512, 1);\nb.sine1([1.0], true, true, true);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum,\n 800,\n OscN.ar(bufnum,\n XLine.kr(20, 8000, 10),\n 0,\n 2pi),\n 0.25)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n);\nb.free;\n\n\n(\n// change the buffer while its playing\ns = Server.local;\nb = Buffer.alloc(s, 4096, 1);\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, true, true);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum, [80, 80.2], 0, 0.2)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n);\n\n(\nRoutine({\n var n = 32;\n 50.do({\n b.sine1(Array.rand(n, 0, 1).cubed, true, true, true);\n 0.25.wait;\n });\n}).play;\n);\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Can you run this code and tell me if it works?"}, {"role": "assistant", "content": "No — I cannot execute SuperCollider. What I can tell you is what would break and why: bracket balance, arguments that must exist for the class, a SynthDef that never reaches Out, a SynthDef played before it is added, an envelope that frees the Synth immediately. For certainty, evaluate it: the post window reports errors precisely, and `s.plotTree` shows whether the node exists."}]} +{"conversations": [{"role": "user", "content": "What does `SynthDesc.controls` do?"}, {"role": "assistant", "content": "Description of a synth definition Returns: an array of instances of ControlName, each of which have the following fields: name, index, rate, defaultValue"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a, b;\na = Place(#[1, [2, 5], [3, 6]], inf);\nx = a.asStream;\n8.do({ x.next.postln });\n);\n\n1\n2\n3\n1\n5\n6\n1\n2\n\n\n\n// Place used as a sequence of pitches\n\n(\nSynthDef(\"help-sinegrain\",\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n(\nc = Place(#[0, 0, [0, 4, 7], [1, 5,\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a, b;\na = Place(#[1, [2, 5], [3, 6]], inf);\nx = a.asStream;\n8.do({ x.next.postln });\n);\n\n1\n2\n3\n1\n5\n6\n1\n2\n\n\n\n// Place used as a sequence of pitches\n\n(\nSynthDef(\"help-sinegrain\",\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n(\nc = Place(#[0, 0, [0, 4, 7], [1, 5, 8], [2, 6, 9]], inf) + 67;\nx = c.asStream;\nRoutine({\n loop({\n Synth(\"help-sinegrain\", [\\freq, x.next.midicps]);\n 0.17.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Hilbert` in SuperCollider?"}, {"role": "assistant", "content": "Hilbert — Applies the Hilbert transform to an input signal. Returns two channels with the original signal and a copy of that signal that has been shifted in phase by 90 degrees (0.5 pi radians). Hilbert outputs two channels containing the input signal and the transformed signal. Due to the method used, distortion occurs in the upper octave of the frequency spectrum (See HilbertFIR for an FFT implementation that avoids this, but introduces a significant del Category: UGens > Filters > Nonlinear."}]} +{"conversations": [{"role": "user", "content": "How do I make an additive bell with Klank?"}, {"role": "assistant", "content": "Klank is a bank of resonant filters excited by a short impulse: you describe the partials as\nfrequencies, amplitudes and decay times.\n\n```supercollider\n(\nSynthDef(\\klank, { |out = 0, freq = 440, amp = 0.3|\n var ratios = [1, 2.2, 3.7, 5.1, 7.3];\n var decays = [4, 2.6, 1.8, 1.2, 0.8];\n var sig = Klank.ar(`[ratios * freq, nil, decays], Impulse.ar(0, 0, 0.2), 1, 0, 0.3);\n Out.ar(out, Pan2.ar(sig * amp, 0));\n}).add;\n);\nSynth(\\klank);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Henon2DC.ar(SampleRate.ir/4, SampleRate.ir/2, MouseX.kr(1,1.4), MouseY.kr(0,0.3)) * 0.2 }.play(s);\n\n(\n{ Henon2DC.ar(\n 2200, 8800,\n LFNoise2.kr(1, 0.2, 1.2),\n LFNoise2.kr(1, 0.15, 0.15)\n) * 0.2 }.play(s);\n)\n\n{ SinOsc.ar(Henon2DC.ar(20, 40, MouseX.kr(1,1.4), MouseY.kr(0,0.3))*800+900)*0.4 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Henon2DC.ar(SampleRate.ir/4, SampleRate.ir/2, MouseX.kr(1,1.4), MouseY.kr(0,0.3)) * 0.2 }.play(s);\n\n(\n{ Henon2DC.ar(\n 2200, 8800,\n LFNoise2.kr(1, 0.2, 1.2),\n LFNoise2.kr(1, 0.15, 0.15)\n) * 0.2 }.play(s);\n)\n\n{ SinOsc.ar(Henon2DC.ar(20, 40, MouseX.kr(1,1.4), MouseY.kr(0,0.3))*800+900)*0.4 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What is `NoteOnBank` in SuperCollider?"}, {"role": "assistant", "content": "NoteOnBank — a set of named MIDI note responders Category: External Control > MIDI, Libraries > crucial > MIDI."}]} +{"conversations": [{"role": "user", "content": "What does `UChain.prepareAndStart` do? What arguments does it take?"}, {"role": "assistant", "content": "Prepare and start Arguments: target — A collection of targets.; startPos — Offset in seconds from the start of the event.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// compare:\n(\n{\n var mod = SinOsc.kr(Line.kr(1, 10, 10));\n SinOsc.ar(mod * 400 + 500) * 0.1\n}.play;\n);\n\n(\n{\n var mod = SinOsc.kr(Line.kr(1, 10, 10));\n SinOsc.ar(LinExp.kr(mod, -1, 1, 100, 900)) * 0.1\n}.play;\n);\n\n// modulating destination values.\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(LinExp.ar(mod, -1, 1, MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1))) * 0.1\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// compare:\n(\n{\n var mod = SinOsc.kr(Line.kr(1, 10, 10));\n SinOsc.ar(mod * 400 + 500) * 0.1\n}.play;\n);\n\n(\n{\n var mod = SinOsc.kr(Line.kr(1, 10, 10));\n SinOsc.ar(LinExp.kr(mod, -1, 1, 100, 900)) * 0.1\n}.play;\n);\n\n// modulating destination values.\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(LinExp.ar(mod, -1, 1, MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1))) * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `MIDIPlayer.cmdPeriod` do?"}, {"role": "assistant", "content": "parent class for Players that receive midi and send control messages to synths"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `MoogFF`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n// Play it with the mouse...\nx = { MoogFF.ar(WhiteNoise.ar(01.1), MouseY.kr(100, 10000, 1), MouseX.kr(0, 4)) }.play(s);\nx.free;\n\n// Mmmm, throbby\n(\nx = {\n MoogFF.ar(\n Pulse.ar([40, 121], [0.3, 0.7]),\n SinOsc.kr(LFNoise0.kr(0.42).range(0.001, 2.2)).range(30, 4200),\n 0.83 * 4) }.play(s);\n);\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ArrayedCollection`."}, {"role": "assistant", "content": "```supercollider\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n pitches.size.do{ |i|\n {\n var freq = pitches[i].midicps;\n var env = Env.perc.ar(Done.freeSelf);\n SinOsc.ar(freq) * 0.1 * env\n }.play;\n 0.2.wait\n }\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `List`."}, {"role": "assistant", "content": "```supercollider\n(\n// Create a new empty List with size: 3\nx = List.new(3);\n\nx.postln; // -> List[ ]\n\n// Add numbers 0 to 4 to the List\n5.do({ |i| x.add(i) });\n\n// The list has been modified in-place with each added item\nx.postln; // -> List[ 0, 1, 2, 3, 4 ]\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `PV_RectComb2.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Make gaps in spectrum. Arguments: bufferA — FFT buffer A.; bufferB — FFT buffer B.; numTeeth — Number of teeth in the comb.; phase — Starting phase of comb pulse.; width — Pulse width of the comb.."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Amplitude`."}, {"role": "assistant", "content": "```supercollider\n// use input amplitude to control Pulse amplitude - use headphones to prevent feedback.\n{ Pulse.ar(90, 0.3, Amplitude.kr(SoundIn.ar(0))) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `NumberEditor.rate` do?"}, {"role": "assistant", "content": "holds a float value with a spec, editable with a gui"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `BPF`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// synthdefs to play with\n(\nSynthDef(\\noise_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, rq = 0.1, amp = 0.1|\n var sig = { WhiteNoise.ar } ! 2;\n sig = BPF.ar(sig, freq, rq) *\n EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2) *\n (rq ** -1) * (250 / (freq ** 0.8));\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\sin_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { SinOsc.ar(freq, Rand(0, 2pi)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n\n\nSynthDef(\\saw_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { VarSaw.ar(freq, Rand(0, 1)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `DelayN` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// これは(SC2の配布物の中の)\"01 Why SuperCollider document\"からのリバーブ\n(\nSynthDef(\"preDelay\", { arg inbus = 2;\n Out.ar(\n 4,\n DelayN.ar(In.ar(inbus, 1), 0.048, 0.048)\n )\n}).add;\n\nSynthDef(\"combs\", {\n Out.ar(\n 6,\n Mix.arFill(7, { CombL.ar(In.ar(4, 1), 0.1, LFNoise1.kr(Rand(0, 0.1), 0.04, 0.05), 15) })\n )\n}).add;\n\nSynthDef(\"allpass\", { arg gain = 0.2;\n var source;\n source = In.ar(6, 1);\n 4.do({ source = AllpassN.ar(source, 0.050, [Rand(0, 0.05), Rand(0, 0.05)], 1) });\n Out.ar(\n 8,\n source * gain\n )\n}).add;\n\nSynthDef(\"theMixer\", { arg gain = 1;\n Out.ar(\n 0,\n Mix.ar([In.ar(2, 1), In.ar(8, 2)]) * gain\n )\n}).add;\n);\n\n(\nSynth(\"fm1\", [\\bus, 2, \\freq, 440, \\carPartial, 1, \\modPartial, 1.99, \\mul, 0.071]);\nSynth(\"fm1\", [\\bus, 2, \\freq, 442, \\carPartial, 1, \\modPartial, 2.401, \\mul, 0.071]);\nSynth.tail(s, \"preDelay\");\nSynth.tail(s, \"combs\");\nSynth.tail(s, \"allpass\");\nSynth.tail(s, \"theMixer\", [\\gain, 0.64]);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nPclutch(Pseq([1, 2, 3, 4, 5], 3), Pseq([0, 0, 1, 0, 0, 0, 1, 1])).asStream.nextN(10);\n\n// sound example\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\nvar a;\na = Pclutch(\n Pseq([1, 2, 3, 4, 5], inf),\n Pseq([0, 0, 1, 0, Pn(0, { 30.rand }), 0\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nPclutch(Pseq([1, 2, 3, 4, 5], 3), Pseq([0, 0, 1, 0, 0, 0, 1, 1])).asStream.nextN(10);\n\n// sound example\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\nvar a;\na = Pclutch(\n Pseq([1, 2, 3, 4, 5], inf),\n Pseq([0, 0, 1, 0, Pn(0, { 30.rand }), 0, 1, 1], inf)\n ).asStream;\n{\n loop {\n Synth(\\help_sinegrain, [\\freq, a.next * 200 + 200]);\n 0.02.wait;\n }\n}.fork;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = [1, 2, 3]\na.foldAt(2) // same as at\na.foldAt(3) // folds back\na.foldAt([-1, 3, 1]) // array of indices\na@|@3 //syntactic shortcut\n\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n 32.do{ |i|\n {\n var freq = pitches.foldAt(i).midicps;\n var env = Env.perc.ar(Done.freeSelf);\n SinOsc.ar(freq) * 0.1 * env\n }.play;\n 0.2.wait\n }\n}\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = [1, 2, 3]\na.foldAt(2) // same as at\na.foldAt(3) // folds back\na.foldAt([-1, 3, 1]) // array of indices\na@|@3 //syntactic shortcut\n\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n 32.do{ |i|\n {\n var freq = pitches.foldAt(i).midicps;\n var env = Env.perc.ar(Done.freeSelf);\n SinOsc.ar(freq) * 0.1 * env\n }.play;\n 0.2.wait\n }\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Psubdivide`."}, {"role": "assistant", "content": "```supercollider\n(\na = Psubdivide(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,0,1,3,4,0], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n100.do({ x.next.postln });\n);\n\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Psubdivide(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n);\n\n\n(\na = Psubdivide(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,4,4,0,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `U.prepareAnd` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: target — (describe argument here); loadDef — (describe argument here); action — (describe argument here). Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "What does `ServerLogGui.cmd_ngo` do? What arguments does it take?"}, {"role": "assistant", "content": "the interface for display and searching the ServerLog Arguments: msg; r. Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "What is `PV_ChainUGen`?"}, {"role": "assistant", "content": "PV_ChainUGen — Base class for UGens that operate on FFT chains"}, {"role": "user", "content": "What does `PV_ChainUGen.fftSize` do?"}, {"role": "assistant", "content": "Returns the FFT chain buffer's size. `(`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var chain = FFT(LocalBuf(1024));\n chain.fftSize.poll;\n 0.0\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// It might also be desirable to start with a fade from silence.\n// This can be done with a negative initOutOffset:\n\n(\nx = {\n var lfo = XLine.ar(1, 0.5, 60);\n DXMix.ar(\n Dseq([0, 4, 1, 5, 2, 6, 3, 7], inf),\n `(Saw.ar((1..8) * 70 * lfo, 0.075)),\n fadeTime: 2,\n width: 2,\n initOutOffset: -1\n ) ! 2\n}.play\n);\n\nx.release\n\n\n// overlap scheme with width = 2 and initOutOffset = -1:\n```"}, {"role": "assistant", "content": "It might also be desirable to start with a fade from silence. This can be done with a negative initOutOffset: (DXMix: crossfades between signals according to demand-rate control)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{\nvar a, b, t = Impulse.kr(2);\na = { Dseq([1, 2, 3, 4, 5], inf) } * 100;\nb = a + 1;\nDemand.kr(t, 0, [a, b]).poll(t\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{\nvar a, b, t = Impulse.kr(2);\na = { Dseq([1, 2, 3, 4, 5], inf) } * 100;\nb = a + 1;\nDemand.kr(t, 0, [a, b]).poll(t)\n}.play\n```"}]} +{"conversations": [{"role": "user", "content": "What is the difference between Line and XLine?"}, {"role": "assistant", "content": "Both are ramps: `Line.kr(start, end, dur, mul, add, doneAction)` moves linearly, `XLine.kr(...)` moves exponentially in a fixed ratio per unit time. Use Line for amplitude and XLine for frequency or any parameter you hear logarithmically — a linear frequency sweep sounds like it rushes at the top and crawls at the bottom. Both take doneAction, so both can end a Synth."}]} +{"conversations": [{"role": "user", "content": "Explain `IsNotIn` in SuperCollider briefly."}, {"role": "assistant", "content": "IsNotIn — given a list, validates that the test object is not in the list answers whether an item is not included in a collection Category: Libraries > crucial > Constraints."}]} +{"conversations": [{"role": "user", "content": "What is `NumRunningSynths` in SuperCollider?"}, {"role": "assistant", "content": "NumRunningSynths — Number of currently running synths. Category: UGens > Info."}]} +{"conversations": [{"role": "user", "content": "What is `PatternConductor`?"}, {"role": "assistant", "content": "PatternConductor — Simple interactive control for playing patterns"}, {"role": "user", "content": "What does `PatternConductor.tempo` do?"}, {"role": "assistant", "content": "Sets the tempo of the PatternConductor"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\n// a pattern with long notes\np = Pbind(\n \\freq, Pwhite(0, log(32)).exp.round(1) * 36.midicps,\n \\detune, Pfunc({ |ev| ev[\\freq] * rand(0.01) }),\n \\sustain, Pwhite(log(0.1), log(20)).exp,\n \\dur, Prand([0.1, 0.1, 0.1, 0.1, 0.2, 1, 2], inf),\n \\db, Pstep(Pseq([-20, -30, -25, -30], inf), 0.2)\n);\n\n// unrelated cluster pattern running on TempoClock.default\nPbind(\\dur, 2, \\midinote, Pseq([(48..60)], 20), \\db, -30).play;\n\n// make a conductor\na = PatternConductor(p, quant: 2);\na.play;\n);\n\n\n// now try some interactive control options line by line:\na.quant = 0;\na.pause;\na.resume;\na.stop;\na.play;\na.pause;\na.play;\na.stop(1000);\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Synth`?"}, {"role": "assistant", "content": "Synth — Client-side representation of a synth node on the server"}, {"role": "user", "content": "What does `Synth.new` do?"}, {"role": "assistant", "content": "Create and return a new Synth object, and immediately start the corresponding synth node on the server."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n// create a Synth at the head of the default Server's default group\n// based on the SynthDef \"default\"\nx = Synth.new(\"default\");\ns.queryAllNodes; // note the default group (ID 1)\nx.free;\n\n// Using an arrayed control\n// run this block first to make the SynthDef\n(\nSynthDef(\"help-synth\", { |freq = #[440, 450, 460], out = 0|\n Out.ar(out, Mix(SinOsc.ar(freq, 0, 0.1)));\n}).add;\n);\n\n// then this a short while later\nx = Synth(\"help-synth\", [freq: [500, 501, 510]]);\n\nx = Synth(\"help-synth\", [freq: [500, 501, 510]]);\nx.set(\\freq, [1, 2, 3] * 400 + [1, 2, 3], \\out, 1);\nx.set(\\freq, [3] * 400 + [1, 2, 3], \\out, 1);\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// won't work (the output is 0.5*0.0), which is why we need the DC UGen!\n{ 0.5 }.play\n\n// constantly zero\n{ DC.ar(0.0) }.play;\n\n\n// DC offset; will click on start and finish\n{ DC.ar(0.5) + SinOsc.ar(440, 0, 0.1) }.play;\n\n\n// test - note the transient before LeakDC adapts and suppresses the offset\n{ LeakDC.ar(DC.ar(0.5)) }.play;\n\n\n// show scope\ns.scope\n```"}, {"role": "assistant", "content": "won't work (the output is 0.5*0.0), which is why we need the DC UGen! DC offset; will click on start and finish (DC: Create a constant amplitude signal)"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `In`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n(\nSynthDef(\"help-PinkNoise\", { |out = 0|\n Out.ar(out, PinkNoise.ar(0.1))\n}).add;\n\nSynthDef(\"help-In\", { |out = 0, in = 0|\n var input;\n input = In.ar(in, 1);\n Out.ar(out, input);\n\n}).add;\n);\n\n// play noise on the right channel\nx = Synth(\"help-PinkNoise\", [\\out, 1]);\n\n// read the input and play it out on the left channel\nSynth.after(x, \"help-In\", [\\out, 0, \\in, 1]);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `String.splitext` do?"}, {"role": "assistant", "content": "Split off the extension from a filename or path and return both in an Array as [path or filename, extension]."}]} +{"conversations": [{"role": "user", "content": "What does `ControlPrototypes.firstAt` do? What arguments does it take?"}, {"role": "assistant", "content": "creates default objects for Spec / argName combinations Arguments: argName; spec."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LinCongN`."}, {"role": "assistant", "content": "```supercollider\n// randomly modulate params\n(\n{ LinCongN.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(0.1, 0.5, 1.4),\n LFNoise2.kr(0.1, 0.1, 0.1),\n LFNoise2.kr(0.1)\n) * 0.2 }.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `AbstractSFP.relativeBeats2secs` do? What arguments does it take?"}, {"role": "assistant", "content": "base class for SoundFilePlayer classes Arguments: beats."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nb = NodeProxy.audio(s, 2);\nb.play; // listen to b\nb.source = { SinOsc.ar([400, 500], 0, 0.1) }; // play something\n\nr = b.record(\"recproxy101.aiff\"); // start recorder (paused\nr.unpause; // start recording\nr.close; // end recording, close file\nb.stop; // stop listen\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nb = NodeProxy.audio(s, 2);\nb.play; // listen to b\nb.source = { SinOsc.ar([400, 500], 0, 0.1) }; // play something\n\nr = b.record(\"recproxy101.aiff\"); // start recorder (paused)\nr.unpause; // start recording\nr.close; // end recording, close file\nb.stop; // stop listen\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `BrownNoise`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// 以下のSynthDefは全て共通のコントロール名(mul)を持つ\n(\n// 3つのSynthDefとグループを作成する\nSynthDef(\"synthNumber1\", { arg mul = 0.2;\n Out.ar(\n 0,\n BrownNoise.ar(mul) * LFNoise0.kr([1, 1.01])\n )\n }, [0.1]).add;\nSynthDef(\"synthNumber2\", { arg mul = 0.2;\n Out.ar(\n 0,\n WhiteNoise.ar(mul) * LFNoise1.kr([2.99, 3])\n )\n }, [0.1]).add;\nSynthDef(\"synthNumber3\", { arg mul = 0.2;\n Out.ar(\n 0,\n PinkNoise.ar(mul) * LFNoise2.kr([0.79, 0.67])\n )\n}, [0.1]).add;\n);\n\n(\n// グループを作成する\n~myGroup = Group.new;\n);\n\n(\n// 3つのシンセを加える\nSynth.head(~myGroup, \"synthNumber1\");\nSynth.head(~myGroup, \"synthNumber2\");\nSynth.head(~myGroup, \"synthNumber3\");\n);\n\n// 3つのシンセのそれぞれの\\mulコントロール、新しい(そして同じ)値にセットする\n~myGroup.set(\\mul, 0.05)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LatoocarfianC`."}, {"role": "assistant", "content": "```supercollider\n// default initial params\n{ LatoocarfianC.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "How does multi-channel expansion work?"}, {"role": "assistant", "content": "If any argument of a UGen is an Array, the UGen is built once per element and the results are returned as an Array. So `SinOsc.ar([220, 330, 440])` is three oscillators, and `SinOsc.ar(220 * [1, 1.5])` is two. This is not a special stereo feature: it is uniform expansion, which is why `Splay.ar(SinOsc.ar([220,330,440]) * 0.1)` gives you a spread stereo field from three mono sources."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// play to buses silently\n\n(\na = Bus.audio(s, 5);\n\nx = {\n Out.ar(a.index, [\n BrownNoise.ar(0.1),\n PinkNoise.ar(0.2),\n WhiteNoise.ar(0.05),\n ClipNoise.ar(0.03),\n GrayNoise.ar(0.05)\n ])\n}.play\n);\n\n// mix from buses, mind node order\n\n(\ny = {\n DXMixIn.ar(\n Dxrand((0..4), inf) + a.index,\n fadeTime: 0.5,\n )\n}.play(addAction: \\addToTail)\n);\n\ny.release\n\n\n// cleanup\n\n(\nx.free;\na.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// play to buses silently\n\n(\na = Bus.audio(s, 5);\n\nx = {\n Out.ar(a.index, [\n BrownNoise.ar(0.1),\n PinkNoise.ar(0.2),\n WhiteNoise.ar(0.05),\n ClipNoise.ar(0.03),\n GrayNoise.ar(0.05)\n ])\n}.play\n);\n\n// mix from buses, mind node order\n\n(\ny = {\n DXMixIn.ar(\n Dxrand((0..4), inf) + a.index,\n fadeTime: 0.5,\n )\n}.play(addAction: \\addToTail)\n);\n\ny.release\n\n\n// cleanup\n\n(\nx.free;\na.free;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// needs Buffer c prepared above\n\n(\ny = {\n var add = LFDNoise3.ar(0.3) * [0.05, 0.0505];\n GFIS.ar(\n { |x| BufRd.ar(1, c, c.numFrames * (x + add)) }, \n (LFDNoise3.ar(0.3) * [1, 1.01]).range(0.5, 0.505), 7\n ) * 0.2\n}.play\n;\n\ny.release\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// needs Buffer c prepared above\n\n(\ny = {\n var add = LFDNoise3.ar(0.3) * [0.05, 0.0505];\n GFIS.ar(\n { |x| BufRd.ar(1, c, c.numFrames * (x + add)) }, \n (LFDNoise3.ar(0.3) * [1, 1.01]).range(0.5, 0.505), 7\n ) * 0.2\n}.play\n);\n\ny.release\n```"}]} +{"conversations": [{"role": "user", "content": "What does `ArrayBuffer.prepareToBundle` do? What arguments does it take?"}, {"role": "assistant", "content": "given an array, will allocate and fill a Buffer for use in Patch etc Arguments: group; bundle."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Monitor`."}, {"role": "assistant", "content": "```supercollider\n{ Out.ar(87, SinOsc.ar(MouseX.kr(240, 1000, 1) * [1, 2, 3], 0, 0.2)) }.play; // play three sine tone on channels 87, 88, and 89\nx = Monitor.new; // create a new monitor\nx.play(fromIndex: 87, fromNumChannels: 3, toIndex: 0, toNumChannels: 2); // play them back to the stereo hardware channels\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `SortedList` in SuperCollider briefly."}, {"role": "assistant", "content": "SortedList — a Collection whose items are kept in a sorted order. Category: Collections > Ordered."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n/* Audio plugin definition\n\n Each audio plugin should define the following global variables:\n ~name: (symbol) name of the spatializer\n ~description: (string) a short description\n ~function: the actual definition of the plugin\n\n*/\n\n~name = \\testtone;\n~description = \"a standard test tone (sine)\";\n~channelLayout = \\mono;\n\n~function = {| sfreq = 200 |\n FSinOsc.ar(sfreq)\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "Speech to midi converter?"}, {"role": "assistant", "content": "SuperCollider forum — Speech to midi converter?\n\nHello!\n\nI want to make a speech to midi converter in Supercollider.\n\nI’ve started off trying to find a way to convert FFT data to midi-numbers to send to a midi-instrument, but I’m stuck:\n\n```supercollider\n~file = Buffer.read(s, \"path_to_file\", bufnum:1);\n\n(\n{\n var buf = Buffer.alloc(s, 2048, bufnum:2);\n var sig = PlayBuf.ar(2, 1, loop:1);\n var chain = FFT(buf, sig);\n var trig = Impulse.kr(30);\n chain[0].pvcalc(80, {\n |phas, mag|\n SendReply.kr(trig, \"/anal\", mag);\n });\n}.play\n);\n\n(\nOSCdef.new(\\midiConverter, {\n |msg|\n msg.postln;\n}, \"/anal\");\n)\n```\n\nthe output looks like this:\n\n[ /anal, 1000, -1, 0.0, 3.0463190078735, 2.1142015457153, -0.64955651760101, 2.3432319164276, -0.23956227302551, -3.1334409713745, -2.1829152107239, 1.1417833566666, -2.2972648143768, -0.74415707588196, -0.88793164491653, 1.9947071075439, -1.1327115297318, 2.6084003448486, etc...]\n\nI’m not sure how to interpret theese numbers. And I’m not sure pvcalc is even the best way to get the data I need. I want to somehow be able to control the resolution on how many of the loudest bins I’m going to convert to frequency and then from frequency to midi-number to send to a midi-instrument as the soundfile plays through.\n\nAny ideas?"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// track audio in (try clapping a beat or beatboxing, but allow up to 6 seconds for tracking to begin) and spawning stuff at quarters, eighths and sixteenths\n(\nSynthDef(\\help_beattrack2_2, { |out|\n var trackb, trackh, trackq, tempo;\n var source, kbus;\n var bsound, hsound, qsound;\n\n source = SoundIn.ar(0);\n\n // downsampling automatic via kr from ar\n kbus = Out.kr(0, LPF.ar(source, 1000)); // ([feature1, feature3]++feature2);\n\n #trackb, trackh, trackq, tempo = BeatTrack2.kr(0, 1, weightingscheme:\n// …\n```"}, {"role": "assistant", "content": "track audio in (try clapping a beat or beatboxing, but allow up to 6 seconds for tracking to begin) and spawning stuff at quarters, eighths and sixteenths downsampling automatic via kr from ar (BeatTrack2: Template matching beat tracker)"}]} +{"conversations": [{"role": "user", "content": "What does `Date.>=` do?"}, {"role": "assistant", "content": "Compare two Dates based on their rawSeconds. `Date(1999, 12, 31, 23, 59, 59) < Date(2000, 1, 1, 0, 0,"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Using sine waves to generate a saw waveform. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\nq={|f,e|a=Array.fill(e,{|j|e-j}).reverse;(Mix.ar(a.collect{|x|SinOsc.ar(f*x,0,1/x)})/2)!2};{q.(60,300)}.play //saw from sine #supercollider\n\n//Change the values passed to q to control the frequency and how many sines are used.\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SDrone.func` do?"}, {"role": "assistant", "content": "a LINKClasses/Function that will be wrapped inside the internal"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Saw` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\event_set, { |freq = 440, gate = 1, amp = 0.1, lagTime = 0.1,\n ffreq = 2000, detune = 1.005, out = 0|\n var sig = Saw.ar(Lag.kr(freq, lagTime) * [1, detune]).sum * amp\n * EnvGen.kr(Env.adsr, gate, doneAction: Done.freeSelf);\n Out.ar(out, sig ! 2);\n}).add;\n);\n\na = Synth(\\event_set);\n\n(\np = Pbind(\n \\type, \\set,\n \\id, a,\n \\instrument, \\event_set,\n \\args, #[],\n \\freq, Pexprand(200, 600, inf),\n \\dur, Pwhite(1, 5, inf) * 0.125\n).play;\n);\n\np.stop;\na.free;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\nNdef(\\a).ar;\nNdef(\\k).kr;\n\n // make a MonitorGui with all bells and whistles\nm = MonitorGui.new(bounds: 500@40, options: [\\name, \\level, \\fade]);\n\n // when it has a kr proxy, it is visible, but disabled\nm.object_(Ndef(\\k));\n // with an ar proxy, it is enabled\nm.object_(Ndef(\\a));\n\n\n // show its play state\nNdef(\\a).play\n // and volume\nNdef(\\a).vol_(0.25);\n\n // NOTE: shift-clicking the play button opens a playN dialog!\n\nNdef(\\a).stop;\nNdef(\\a).play(0;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\nNdef(\\a).ar;\nNdef(\\k).kr;\n\n // make a MonitorGui with all bells and whistles\nm = MonitorGui.new(bounds: 500@40, options: [\\name, \\level, \\fade]);\n\n // when it has a kr proxy, it is visible, but disabled\nm.object_(Ndef(\\k));\n // with an ar proxy, it is enabled\nm.object_(Ndef(\\a));\n\n\n // show its play state\nNdef(\\a).play\n // and volume\nNdef(\\a).vol_(0.25);\n\n // NOTE: shift-clicking the play button opens a playN dialog!\n\nNdef(\\a).stop;\nNdef(\\a).play(0);\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Convolution2L`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// one last example\n(\nb = Buffer.alloc(s, 512, 1);\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, true, true);\n);\n\n(\n{\n var input = SoundIn.ar(0);\n var framesize = 512;\n Convolution2L.ar(input, b, 0, framesize, 1, 0.5);\n}.play\n);\n\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `FoaEncoderKernel.dirOutputs` do?"}, {"role": "assistant", "content": "A convenience method providing polymorphism with"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Stethoscope`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n(\n{\n SinOsc.ar([225, 450, 900], 0, 0.2)\n + LPF.ar(\n LFPulse.ar(226 * [1, 2, 5], [0, 0.1, 0.1], 0.2, 0.2),\n MouseX.kr(20, 10000, 1)\n )\n}.scope;\n);\n\n// server.scope only changes the properies explicitly given:\n\ns.scope(numChannels: 5);\ns.scope(index: 12);\ns.scope(zoom: 4);\ns.scope(index: 0);\n\ns.scopeWindow.size = 600;\ns.scopeWindow.size = 222;\n\n// scoping buses:\n\na = Bus.audio(s, 4);\n{ WhiteNoise.ar(0.2.dup(4)) }.play(s, a);\n\na.scope;\n\nc = Bus.control(s, 3);\n{ WhiteNoise.kr(1.dup(4) * MouseX.kr) }.play(s, c);\n\nc.scope;\n\n// note that scoping control rate buses shows block size interpolation (this is due to the\n// fact that ScopeOut.kr doesn't work yet.)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Pbinop` in SuperCollider?"}, {"role": "assistant", "content": "Pbinop — binary operator pattern Returns a stream that applies the binary operator to the stream values of the receiver. Usually, this is the result of applying a binary operator (i.e. a method with one argument) to a pattern. Category: Streams-Patterns-Events > Patterns > Math."}]} +{"conversations": [{"role": "user", "content": "What is the difference between Env and EnvGen?"}, {"role": "assistant", "content": "Env is a language-side description: a list of levels, times and a curve, e.g. `Env.perc(0.01, 1)` or `Env.adsr(0.01, 0.1, 0.5, 0.8)`. EnvGen is the UGen that plays it on the server: `EnvGen.kr(env, gate, doneAction: 2)`. The same Env can be played by many EnvGens, and Env also has language-side uses such as `.asStream` inside Patterns and `.plot`."}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ Pan2.ar(SinOsc.ar(440) * 0.2, SinOsc.kr(0.1)) }.play;\n```"}, {"role": "assistant", "content": "A sine that slowly moves between the speakers.\n\n`SinOsc.kr(0.1)` is a control-rate sine at 0.1 Hz — one cycle every 10 seconds — running between -1 and 1.\n`Pan2.ar(sig, pos)` treats that as the pan position, where -1 is hard left, 0 centre, 1 hard right, so the\nsound drifts across the stereo field. Pan2 is equal-power, so the centre is -3 dB per channel rather than\nhalf amplitude on each. The `* 0.2` sets the level before panning."}]} +{"conversations": [{"role": "user", "content": "What is the difference between Line and XLine?"}, {"role": "assistant", "content": "Both are ramps: `Line.kr(start, end, dur, mul, add, doneAction)` moves linearly, `XLine.kr(...)` moves exponentially in a fixed ratio per unit time. Use Line for amplitude and XLine for frequency or any parameter you hear logarithmically — a linear frequency sweep sounds like it rushes at the top and crawls at the bottom. Both take doneAction, so both can end a Synth."}]} +{"conversations": [{"role": "user", "content": "What does `EZLists.initViews` do?"}, {"role": "assistant", "content": "Called by init and overridden by all subclasses. This is where the class specific views are"}]} +{"conversations": [{"role": "user", "content": "What is `Pwrap` in SuperCollider?"}, {"role": "assistant", "content": "Pwrap — constrain the range of output values by wrapping Note: this is equivalent to pattern.wrap(lo, hi) Category: Streams-Patterns-Events > Patterns > Math."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Gbman2DC.ar(MouseX.kr(20, SampleRate.ir*0.25), MouseX.kr(80, SampleRate.ir), 0.1) }.play(s);\n\n{ Gbman2DC.ar(11025, 22050, -0.7, -2.7, 0.1) }.play(s);\n\n{ Gbman2DC.ar(2200, 8800, 1.2, 2.0002, 0.1) }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Gbman2DC.ar(MouseX.kr(20, SampleRate.ir*0.25), MouseX.kr(80, SampleRate.ir), 0.1) }.play(s);\n\n{ Gbman2DC.ar(11025, 22050, -0.7, -2.7, 0.1) }.play(s);\n\n{ Gbman2DC.ar(2200, 8800, 1.2, 2.0002, 0.1) }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Interval.new` do?"}, {"role": "assistant", "content": "Create a new Interval. `Interval(10, 30,"}]} +{"conversations": [{"role": "user", "content": "What is the difference between Env and EnvGen?"}, {"role": "assistant", "content": "Env is a language-side description: a list of levels, times and a curve, e.g. `Env.perc(0.01, 1)` or `Env.adsr(0.01, 0.1, 0.5, 0.8)`. EnvGen is the UGen that plays it on the server: `EnvGen.kr(env, gate, doneAction: 2)`. The same Env can be played by many EnvGens, and Env also has language-side uses such as `.asStream` inside Patterns and `.plot`."}]} +{"conversations": [{"role": "user", "content": "Explain `NestedAllpassC` in SuperCollider briefly."}, {"role": "assistant", "content": "NestedAllpassC — Nested Allpass filters as proposed by Vercoe and Pluckett Useful for reverberation, especially implementing Gardner reverbs. Category: UGens > Delays."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//This is almost exactly the same as kick3.scd, they've been morphed into kik3.scd!\n\n\nSynthDef(\"kik\", { |basefreq = 50, ratio = 7, sweeptime = 0.05, preamp = 1, amp = 1, decay1 = 0.3, decay1L = 0.8, decay2 = 0.15, out|\n var fcurve = EnvGen.kr(Env([basefreq * ratio, basefreq], [sweeptime], \\exp)),\n env = EnvGen.kr(Env([1, decay1L, 0], [decay1, decay2], -4), doneAction: 2),\n sig = SinOsc.ar(fcurve, 0.5pi, preamp).distort * env * amp;\n Out.ar(out, sig ! 2)\n}).add;\n```"}, {"role": "assistant", "content": "This is almost exactly the same as kick3.scd, they've been morphed into kik3.scd!."}]} +{"conversations": [{"role": "user", "content": "What does `ArrayedCollection.extend` do?"}, {"role": "assistant", "content": "Extends the object to match size by adding a number of items. If size is less than receiver size then truncate. This method may return a new ArrayedCollection. For this reason, you should always assign the result of `extend` to a variable - never depend on add changing the receiver."}]} +{"conversations": [{"role": "user", "content": "What does `DataBuffer.readAccel` do?"}, {"role": "assistant", "content": "read the accelerometer buffer and clear it. This should be called at regular intervals. Faster than the buffer is filling up (depends on sample Returns: a List of arrays with xyz values."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// result of BufRd is used as index for the next BufRd\n// needs Buffer c prepared above\n\n(\ny = {\n GFIS.ar(\n { |x| BufRd.ar(1, c, c.numFrames * x) },\n (LFDNoise3.ar(3) * [1, 1.1]).range(0.5, 0.51), 7\n ) * 0.2\n}.play\n);\n\ny.release\n```"}, {"role": "assistant", "content": "result of BufRd is used as index for the next BufRd needs Buffer c prepared above (GFIS: generalized functional iteration synthesis pseudo ugen)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var trig = Dust.kr(10);\n SinOsc.ar(\n TExpRand.kr(300.0, 3000.0, trig)\n ) * 0.1\n}.play;\n);\n\n(\n{\n var trig = Dust.ar(MouseX.kr(1, 8000, 1));\n SinOsc.ar(\n TExpRand.ar(300.0, 3000.0, trig)\n ) * 0.1\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var trig = Dust.kr(10);\n SinOsc.ar(\n TExpRand.kr(300.0, 3000.0, trig)\n ) * 0.1\n}.play;\n);\n\n(\n{\n var trig = Dust.ar(MouseX.kr(1, 8000, 1));\n SinOsc.ar(\n TExpRand.ar(300.0, 3000.0, trig)\n ) * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `FoaEncoderKernel.set` do?"}, {"role": "assistant", "content": "Describes both the signal set and the tool set, encompassing the Ambisonic order, as well as channel ordering and normalisation. Answers `'FOA'`, aka traditional"}]} +{"conversations": [{"role": "user", "content": "Interfacing SC with external software: MIDI or OSC?"}, {"role": "assistant", "content": "SuperCollider forum — Interfacing SC with external software: MIDI or OSC?\n\nI found this partial solution on sccode.org :\n\n```supercollider\n // declare an event type which sends OSC commands to Renoise\n\n(\nEvent.addEventType(\\renoise, { |server|\n var renoiseOscServer = NetAddr(\"127.0.0.1\", 8000);\n var notes = [~midinote.value, ~ctranspose.value, ~velocity.value, ~sustain.value, ~lag.value, ~timingOffset.value, ~instr.value, ~track.value].flop;\n var timeNoteOn, timeNoteOff, instrument, track, velocity;\n var serverLatency;\n\n serverLatency = server.latency ? 0;\n\n notes.do {|note|\n instrument = note[6] ? -1;\n track = note[7] ? -1;\n velocity = note[2].asInt.clip(0,127);\n\n // sustain and timingOffset are in beats, lag is in seconds\n timeNoteOn = (thisThread.clock.tempo.reciprocal*note[5])+note[4]+server.latency;\n timeNoteOff = (thisThread.clock.tempo.reciprocal*(note[3]+note[5]))+note[4]+server.latency;\n SystemClock.sched(timeNoteOn, {renoiseOscServer.sendMsg(\"/renoise/trigger/note_on\", instrument.asInt, track.asInt, (note[0]+note[1]).asInt, velocity )});\n SystemClock.sched(timeNoteOff, {renoiseOscServer.sendMsg(\"/renoise/trigger/note_off\", instrument.asInt, track.asInt, (note[0]+note[1]).asInt)});\n }\n});\n);\n\n// Now start Renoise OSC server, load a sample, and try some patterns\n\n// straight timing\n(\nPbind(*[\n type: \\renoise,\n legato: Pgauss(0.2,0.05,inf),\n dur: 0.2,\n degree: [2,5,12],\n track: Prand([0,1], inf),\n ctranspose: Pseq([0,0,0,0,4,4,4,4,5,5,5,5],inf),\n velocity: Pgauss(64,10,inf),\n]).play;\n)\n```\n\nhttp://sccode.org/1-4SN\n\nBut what I couldn’t find there was a simple syntax for sending Note Events or Midi Events as OSC messages... Do I really need to re-implement the whole SC’s defaultParentEvent as new OSC Event to send it using regular pattern’s syntax?"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `LinSelectX`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar(300),\n Pulse.ar(230)\n ];\n\n LinSelectX.ar(MouseX.kr(0, 1) * a.size, a) * 0.2\n}.play;\n);\n\n(\n{\n var a;\n a = [\n SinOsc.kr(0.25),\n LFSaw.kr(10),\n LFPulse.kr(0.3)\n ];\n\n SinOsc.ar(LinSelectX.kr(MouseX.kr(0, 1) * a.size, a) * 300 + 400) * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Red4D.rotation` do? What arguments does it take?"}, {"role": "assistant", "content": "Get or set the current rotation of the Arguments: redVec — A 6-dimensional RedVector.."}]} +{"conversations": [{"role": "user", "content": "[ 1, 2, 1, 1, 2, 1, 1 ] how to find adjacent elements in an array?"}, {"role": "assistant", "content": "SuperCollider forum — [ 1, 2, 1, 1, 2, 1, 1 ] how to find adjacent elements in an array\n\nRandColors:\n\nI need to find the index, the how many times (the adjacent values are equal) and what is the adjacent value.\n\nThis is perhaps a bit verbose and clunky, but it meets the above specification:\n\n```supercollider\n(\n~repeats = {|array|\n // return [index, number of repeats, the value] for each repeated value\n var results = [];\n var thisIndex = 0;\n var thisCount = 1;\n var thisValue = array[0];\n array[1..].do{|val, i|\n if(val == thisValue,\n {thisCount = thisCount + 1},\n {\n if(\n thisCount > 1,\n {results = results.add([thisIndex, thisCount, thisValue])},\n );\n thisValue = val;\n thisIndex = i + 1;\n thisCount = 1;\n }\n )\n };\n if(thisCount > 1, {results = results.add([thisIndex, thisCount, thisValue])});\n results;\n}\n);\n\na = [1, 2, 1, 1, 1, 2, 1, 1];\nb = ~repeats.value(a);\n\na = [2, 3, 5, 5];\nb = ~repeats.value(a);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Slider.defaultKeyDownAction` do?"}, {"role": "assistant", "content": "Implements the default effects of key presses as"}]} +{"conversations": [{"role": "user", "content": "Explain `PLser` in SuperCollider briefly."}, {"role": "assistant", "content": "PLser — dynamic scope Pser variant Takes Symbol args for later reference by the Streams, which will read from variables in the Environments of their instantiation. See PLx_suite. Category: Libraries > miSCellaneous > PLx suite, Streams-Patterns-Events > PLx suite."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DigitalIO`."}, {"role": "assistant", "content": "```supercollider\n// write a sine oscillator's output to a pin, and read the pin value at other times\n\n(\nSynthDef(\"help-DigitalIO\", { |out = 0|\n DigitalIO.ar(0, SinOsc.ar(10), LFPulse.kr(0.1)).poll;\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// Reminder: This isn't the intended typical usage! It's OK to do this though.\n(\nx = {\n var mags, phases, chain, sig;\n // Create simple undulating magnitudes\n mags = { FSinOsc.kr(ExpRand(0.1, 1)).range(0, 1) }.dup(100);\n // Then give them a \"rolloff\" to make the sound less unpleasant\n mags = mags * ((1, 0.99 .. 0.01).squared);\n // Let's turn the bins on and off at different rates, I'm *sure* that'll sound interesting\n mags = mags * { LFPulse.kr(2 ** IRand(-3, 5)).range(0, 1) }.dup(100);\n // Let's ignore phase for now\n phases = 0.\n// …\n```"}, {"role": "assistant", "content": "Reminder: This isn't the intended typical usage! It's OK to do this though. Create simple undulating magnitudes (FFTTrigger: Outputs the necessary signal for FFT chains, without doing an FFT on a signal)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ RLPFD.ar(Mix(LFSaw.ar([120, 180], 0, 0.33)), LinExp.kr(LFCub.kr(0.1, 0.5*pi), -1, 1, 280, 1500), 0.6, 0.5, mul:3.dup }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ RLPFD.ar(Mix(LFSaw.ar([120, 180], 0, 0.33)), LinExp.kr(LFCub.kr(0.1, 0.5*pi), -1, 1, 280, 1500), 0.6, 0.5, mul:3).dup }.play\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Since the allpass delay has no audible effect as a resonator on\n// steady state sound ...\n\n{ AllpassN.ar(WhiteNoise.ar(0.1), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// ...these examples add the input to the effected sound and compare variants so that you can hear\n// the effect of the phase comb:\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassN.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2)\n}.play)\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassL.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Since the allpass delay has no audible effect as a resonator on\n// steady state sound ...\n\n{ AllpassN.ar(WhiteNoise.ar(0.1), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// ...these examples add the input to the effected sound and compare variants so that you can hear\n// the effect of the phase comb:\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassN.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2)\n}.play)\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassL.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2)\n}.play)\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassC.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2)\n}.play)\n\n// used as an echo - doesn't really sound different than Comb,\n// but it outputs the input signal immediately (inverted) and the echoes\n// are lower in amplitude.\n{ AllpassN.ar(Decay.ar(Dust.ar(1, 0.5), 0.2, WhiteNoise.ar), 0.2, 0.2, 3) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// indexing into a table\n(\n{\n var buf = LocalBuf.newFrom([200, 300, 400, 500, 600, 800]);\n var freq = WrapIndex.kr(buf, MouseX.kr(0, BufFrames.ir(buf) * 3));\n SinOsc.ar(freq) * 0.1\n}.play;\n);\n\n// the same using a global buffer\n(\nt = [200, 300, 400, 500, 600, 800];\nb = Buffer(s, t.size, 1);\n\n// alloc and set the values\ns.listSendMsg(b.allocMsg(b.setnMsg(0, t)).postln);\n\nSynthDef(\\help_Index, { |out = 0, buf\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// indexing into a table\n(\n{\n var buf = LocalBuf.newFrom([200, 300, 400, 500, 600, 800]);\n var freq = WrapIndex.kr(buf, MouseX.kr(0, BufFrames.ir(buf) * 3));\n SinOsc.ar(freq) * 0.1\n}.play;\n);\n\n// the same using a global buffer\n(\nt = [200, 300, 400, 500, 600, 800];\nb = Buffer(s, t.size, 1);\n\n// alloc and set the values\ns.listSendMsg(b.allocMsg(b.setnMsg(0, t)).postln);\n\nSynthDef(\\help_Index, { |out = 0, bufnum = 0|\n Out.ar(out,\n SinOsc.ar(\n WrapIndex.kr(\n bufnum,\n MouseX.kr(0, BufFrames.ir(bufnum) * 3)\n ),\n 0,\n 0.5\n )\n )\n}).play(s, [\\bufnum, b.bufnum]);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `PdefGui.clear` do?"}, {"role": "assistant", "content": "(if the jitGui is in its own window) set the PdefGui's object to"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\"help-ExpRand\", { |out = 0|\n Out.ar(out,\n FSinOsc.ar(\n ExpRand(100.0, 8000.0),\n 0, Line.kr(0.2, 0, 0.01, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n(\nRoutine({\n inf.do({ |i|\n Synth.new(\"help-ExpRand\"); 0.05.wait;\n })\n}).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\"help-ExpRand\", { |out = 0|\n Out.ar(out,\n FSinOsc.ar(\n ExpRand(100.0, 8000.0),\n 0, Line.kr(0.2, 0, 0.01, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n(\nRoutine({\n inf.do({ |i|\n Synth.new(\"help-ExpRand\"); 0.05.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `Fb1_ODEintdef` in SuperCollider briefly."}, {"role": "assistant", "content": "Fb1_ODEintdef — container for ordinary differential equation numeric integrators For the optional definition of ODE integration procedures that can then be used with Fb1_ODE. This is an advanced feature, the built-in symplectic procedures should suffice for most use cases. See the source code in Fb1_ODEintdef.sc for the way integrators are defined and Fb1_ODE for general information about Fb1 ODE integrator UGens. Category: Libraries > miSCellaneous > Nonlinear."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n var time = 30;\n var line = Line.kr(3000, 290, time);\n var line2 = Line.kr(280, 290, time);\n var line3 = Line.kr(0.01, 10, time);\n var sin = Mix.ar(SinOsc.ar([line, line2]) * SinOsc.ar(line3));\n var comb = CombC.ar(sin, time, SinOsc.kr(0.1).range(0.1, 0.2), time);\n var env = EnvGen.ar(Env.linen(0.01, time, 10), 1, doneAction:2);\n comb * env * 0.05!2;\n}.play\n)\n```"}, {"role": "assistant", "content": "Here is some quick code that sounds like an old sci-fi UFO landing."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// use input amplitude to control Pulse amplitude - use headphones to prevent feedback.\nSynthDef(\"help-AmplitudeMod\",{ arg out=0;\n Out.ar(out,\n Pulse.ar(90, 0.3, Amplitude.kr(SoundIn.ar))\n )\n}).play;\n\n);\n\n\n(\n// use input amplitude to control SinOsc frequency - use headphones to prevent feedback.\nz = SynthDef(\"help-AmplitudeMod\",{ arg out=0, attack=0.01, release=0.01;\n Out.ar(out,\n SinOsc.ar(\n AmplitudeMod.kr(\n SoundIn.ar,\n attack,\n release,\n 1200,\n 4\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// use input amplitude to control Pulse amplitude - use headphones to prevent feedback.\nSynthDef(\"help-AmplitudeMod\",{ arg out=0;\n Out.ar(out,\n Pulse.ar(90, 0.3, Amplitude.kr(SoundIn.ar))\n )\n}).play;\n\n);\n\n\n(\n// use input amplitude to control SinOsc frequency - use headphones to prevent feedback.\nz = SynthDef(\"help-AmplitudeMod\",{ arg out=0, attack=0.01, release=0.01;\n Out.ar(out,\n SinOsc.ar(\n AmplitudeMod.kr(\n SoundIn.ar,\n attack,\n release,\n 1200,\n 400)\n , 0, 0.3)\n )\n}).play;\n\n);\nz.set(\\attack, 0.050)\nz.set(\\release, 0.125)\n\nz.free\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `CombN`."}, {"role": "assistant", "content": "```supercollider\n// These examples compare the variants, so that you can hear the difference in interpolation\n\n// Comb used as a resonator. The resonant fundamental is equal to\n// reciprocal of the delay time.\n{ CombN.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ CombL.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ CombC.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// with negative feedback:\n{ CombN.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ CombL.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ CombC.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n// used as an echo.\n{ CombN.ar(Decay.ar(Dust.ar(1, 0.5), 0.2, WhiteNoise.ar), 0.2, 0.2, 3) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nb = Bus.audio(s, 2);\na = { |inbus = 0|\n var sig = In.ar(inbus, 2);\n // x axis is side, oriented toward right;\n // y axis is mid\n [sig[1] - sig[0], sig.sum]\n}.play(s.defaultGroup, outbus: b, addAction: \\addAfter);\nc = s.scope;\nc.style = 2;\nc.bus = b;\n)\n```"}, {"role": "assistant", "content": "Very quick-and-dirty hack to show stereo phase. Center = up (12:00). Full left = 10:30, full right = 1:30."}]} +{"conversations": [{"role": "user", "content": "What does `VBAP.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Vector Base Amplitude Panner Arguments: numChans — The number of output channels.; in — The signal to be panned.; bufnum — A Buffer or its bufnum containing data calculated by an instance of VBAPSpeakerArray. Its number of channels must correspond to numChans above.; azimuth — +/- 180 degrees from the median plane (i.e. straight ahead); elevation — +/- 90 degrees from the azimuth plane.; spread — A value from 0-100. When 0, if the signal is panned exactly to a speaker location the signal is only on that speaker. At values higher than 0, the signal will always be on more than one speaker. This can smooth the panning effect by making localisation blur more constant.."}]} +{"conversations": [{"role": "user", "content": "What does `HasPatchIns.connectPatchIns` do?"}, {"role": "assistant", "content": "parent class for Players that have PatchIns such as Patch"}]} +{"conversations": [{"role": "user", "content": "What does `PSVop_oi.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new PSVop_oi Arguments: genList — An array of generators and corresponding offsets. Allowed generators: Integers, Streams or Patterns producing intervals or Sieves itself. Integers and Stream/Pattern output must be strictly positive. Integers as generators produce constant intervals. Offsets must be integers.; op — One of the Symbols 'u', 's', 'sd', 'd' as abbreviations for set operations 'union', 'sect', 'symdif', 'dif' or a Pattern/Stream to produce such. Defaults to 'u'.; difIndex — Integer or a Pattern/Stream to produce such. Determines the generator from which will be subtracted in case of operation 'dif'. Defaults to 0.; maxLength — Integer. Maximum number of items, which the stream will return. Defaults to inf.; limit — Integer. Limit up to which intervals can be returned by the stream. If no limit is passed, integer intervals might be returned up to default summation limit of 65536.."}]} +{"conversations": [{"role": "user", "content": "What does `BufferProxy.prepareToBundle` do? What arguments does it take?"}, {"role": "assistant", "content": "allocates a Buffer on play Arguments: group; bundle."}]} +{"conversations": [{"role": "user", "content": "What does `View.moveTo` do? What arguments does it take?"}, {"role": "assistant", "content": "Move the view to new position, preserving its Arguments: x — An Int: the horizontal position of the new position.; y — An Int: the vertical position of the new position.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// Pbind with default synth\n// ~freq can be a collection, then pitch or chord are shifted by ~freqFac,\n// ascending (~step > 0) or descending (~step < 0) groups of 4 items\n\np = Pbind(\n \\dur, 0.4,\n \\amp, PL(\\amp),\n \\freq, PL(\\step) ** PLseq((0..3)) * PL(\\freq) * PL(\\freqFac) \n);\n\n// Synth producing an ascending line, it ends as envelope params are defined,\n// end notifications will be reflected in the VarGui\n\nSynthDef(\\synth_2, { |out = 0, freq = #[600, 700, 900, 1000], freqFac = 1\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// Pbind with default synth\n// ~freq can be a collection, then pitch or chord are shifted by ~freqFac,\n// ascending (~step > 0) or descending (~step < 0) groups of 4 items\n\np = Pbind(\n \\dur, 0.4,\n \\amp, PL(\\amp),\n \\freq, PL(\\step) ** PLseq((0..3)) * PL(\\freq) * PL(\\freqFac) \n);\n\n// Synth producing an ascending line, it ends as envelope params are defined,\n// end notifications will be reflected in the VarGui\n\nSynthDef(\\synth_2, { |out = 0, freq = #[600, 700, 900, 1000], freqFac = 1, \n amp = 0.1, ampFac = 0.5, preAmp = 5, attTime = 0.2, relTime = 2, susTime = 6|\n var src = SinOsc.ar(freq * XLine.kr(freqFac/2, freqFac, attTime + susTime), 0, mul: preAmp).tanh ! 2;\n Out.ar(0, src * amp * ampFac * EnvGen.ar(Env.linen(attTime, susTime, relTime), doneAction: 2))\n}).add;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `FBSineL`."}, {"role": "assistant", "content": "```supercollider\n// default initial params\n{ FBSineL.ar(SampleRate.ir/4) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `RecordBuf` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// Execute the following in order\n(\n// allocate a Buffer\ns = Server.local;\nb = Buffer.alloc(s, 44100 * 4.0, 1); // a four second 1 channel Buffer\n);\n\n// record for four seconds\n(\nSynthDef(\\help_RecordBuf, { |out = 0, bufnum = 0|\n var formant;\n formant = Formant.ar(XLine.kr(400, 1000, 4), 2000, 800, 0.125);\n RecordBuf.ar(formant, bufnum, doneAction: Done.freeSelf, loop: 0);\n}).play(s, [\\out, 0, \\bufnum, b]);\n);\n\n// play it back\n(\nSynthDef(\\help_RecordBuf_playback, { |out = 0, bufnum = 0|\n var playbuf;\n playbuf = PlayBuf.ar(1, bufnum);\n FreeSelfWhenDone.kr(playbuf); // frees the synth when the PlayBuf is finished\n Out.ar(out, playbuf);\n}).play(s, [\\out, 0, \\bufnum, b]);\n);\n\n// overdub\n(\nSynthDef(\\help_RecordBuf_overdub, { |out = 0, bufnum = 0|\n var formant;\n formant = Formant.ar(XLine.kr(200, 1000, 4), 2000, 800, 0.125);\n // mixes equally with existing data\n RecordBuf.ar(formant, bufnum, 0, 0.3, 0.5, doneAction: Done.freeSelf, loop: 0);\n}).play(s, [\\out, 0, \\bufnum, b]);\n);\n\n// play back the overdubbed version\nSynth.new(\\help_RecordBuf_playback, [\\out, 0, \\bufnum, b], s);\n\n// write the contents of the buffer to a file (see Buffer for more options)\n(\nb.write(sampleFormat: 'int16');\nthisProcess.platform.recordingsDir +/+ \"SC_\" ++ Date.localtime.stamp ++ \".aiff\"; // generated path\n);\n\nb.close; b.free; // cleanup\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = { Ringz.ar(T2A.ar(\\trig.tr), \\freq.kr(500, 1), 0.8) }.play;\na.set(\\freq, 330, \\trig, 1);\na.set(\\freq, 830, \\trig, 1;\na.release;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = { Ringz.ar(T2A.ar(\\trig.tr), \\freq.kr(500, 1), 0.8) }.play;\na.set(\\freq, 330, \\trig, 1);\na.set(\\freq, 830, \\trig, 1);\na.release;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// connect will connect to all midi in devices\n// if you need to specify one,\n// check the sources at: MIDIClient.sources\n// and connect using MIDIIn.connect( source_index )\nMIDIIn.connect;\n\n// show incoming control data\n~control = { arg src, chan, num, val; \n [chan,num,val].postln; \n};\n\nMIDIIn.addFuncTo(\\control, ~control);\n```"}, {"role": "assistant", "content": "Simple example showing how to listen for MIDI control messages."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Osc`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\ns = Server.local;\nb = Buffer.alloc(s, 512, 1);\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, true, true);\n\nSynthDef(\"help-Osc\", { |out = 0, bufnum = 0|\n Out.ar(out,\n Osc.ar(bufnum, 200, 0, 0.5)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n);\n\n(\ns = Server.local;\nb = Buffer.alloc(s, 512, 1);\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, true, true);\n\nSynthDef(\"help-Osc\", { |out = 0, bufnum = 0|\n Out.ar(out,\n Osc.ar(bufnum, XLine.kr(2000, 200), 0, 0.5) // modulate freq\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n);\n\n\n(\ns = Server.local;\nb = Buffer.alloc(s, 512, 1);\nb.sine1([1.0], true, true, true);\n\nSynthDef(\"help-Osc\", { |out = 0, bufnum = 0|\n Out.ar(out,\n Osc.ar(bufnum,\n Osc.ar(bufnum,\n XLine.kr(1, 1000, 9),\n 0,\n 200,\n 800),\n 0,\n 0.25)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n);\n\n\n(\n// modulate phase\ns = Server.local;\nb = Buffer.alloc(s, 512, 1);\nb.sine1([1.0], true, true, true);\n\nSynthDef(\"help-Osc\", { |out = 0, bufnum = 0|\n Out.ar(out,\n Osc.ar(bufnum,\n 800,\n Osc.ar(bufnum,\n XLine.kr(20, 8000, 10),\n 0,\n 2pi),\n 0.25)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n);\n\n\n\n(\n// change the buffer while its playing\ns = Server.local;\nb = Buffer.alloc(s, 4096, 1);\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, true, true);\n\nSynthDef(\"help-Osc\", { |out = 0, bufnum = 0|\n Out.ar(out,\n Osc.ar(bufnum, [80, 80.2], 0, 0.2)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n);\n\n(\nfork {\n var n = 32;\n 50.do {\n b.sine1(Array.rand(n, 0, 1).cubed, true, true, true);\n 0.25.wait;\n };\n};\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `ExpRand` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-ExpRand\", { |out = 0|\n Out.ar(out,\n FSinOsc.ar(\n ExpRand(100.0, 8000.0),\n 0, Line.kr(0.2, 0, 0.01, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n(\nRoutine({\n inf.do({ |i|\n Synth.new(\"help-ExpRand\"); 0.05.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `QuadL`."}, {"role": "assistant", "content": "```supercollider\n// default params\n{ QuadL.ar(SampleRate.ir/4) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What is `SpruceBudworm` in SuperCollider?"}, {"role": "assistant", "content": "SpruceBudworm — Spruce bud worm model equations One of a number found in A Brief History of Oscillators and Hair Styles of European Men AASU Math/CS Colloquium, April 2002. Category: UGens > Generators > Chaotic //SLUGens released under the GNU GPL as extensions for SuperCollider 3, by Nick Collins, http://composerprogrammer.com/index.html."}]} {"conversations": [{"role": "user", "content": "How do I see what a signal is doing?"}, {"role": "assistant", "content": "`.poll` prints values to the post window — `SinOsc.kr(1).poll` prints once per control block, and `.poll(10)` limits it to every 10th. `s.scope` opens an oscilloscope on the main output, and `.scope` on a UGen shows just that signal. For a numeric snapshot of many signals at once, `s.meter` shows the output levels, and `\".dump\".postln` style probes are common while debugging."}]} -{"conversations": [{"role": "user", "content": "What does `PlayerMixer.addPlayer` do? What arguments does it take?"}, {"role": "assistant", "content": "takes multiple players as input, mixes them to a single (stereo) output Arguments: player."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Nuclear Fallout (a SuperCollider snippet)?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n var saw, bpf;\n saw = Saw.ar(\n freq: [60,150],\n mul: LFPulse.kr(\n freq: [2,3],\n width: 0.15));\n \n { BPF.ar(\n in: WhiteNoise.ar(mul: 1),\n freq: 1000,\n rq: 0.9\n )\n}\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes THX Deep Note inspired synth sketch."}, {"role": "assistant", "content": "```supercollider\n// A. Broz: Deep Choir (v2, 2020-10-29)\n(\n~numVoices = 30;\n\n~chaos = { |range = 1.0|\n ~numVoices collect: { exprand(180 / range, 260 * range) }\n};\n\n~bigChord = { |fund = 30, harmonics = 5|\n ~numVoices collect: {\n fund\n * rrand(1, harmonics) // build chord\n * rrand(1, 2) * rrand(1, 2) // octaves\n + rrand(-1.2, 1.2) // beats\n }\n};\n\n// Try with Pmono\nSynthDef(\\fakeTHX, {\n var env = EnvGen.kr(\n envelope: Env.adsr(15, \\decay.kr(10), 1, 10, curve: \\sine),\n gate: \\gate.kr(1),\n doneAction: Done.freeSelf,\n );\n var chord = \\freq.kr(~chaos.value, \\lag.kr(10));\n var meander = \\meander.kr(0.3, 8);\n var sig = chord collect: { |f|\n f = f * LFNoise2.kr(rrand(0.3, 0.8)).exprange(1 - meander, 1 + meander);\n BLowPass.ar(Saw.ar(f), f, 0.6);\n };\n sig = Splay.ar(sig, 0.8) * env * \\mul.kr(0.5, 3);\n Out.ar(0, sig);\n}).add;\n);\n\n(\nRoutine({\n var fakeTHX = Synth(\\fakeTHX);\n\n 10.wait;\n\n fakeTHX.set(\\meander, 0);\n\n fakeTHX.set(\\freq, ~bigChord.(30, 5));\n\n 10.wait;\n\n fakeTHX.set(\\gate, 0);\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `NodeMap`?"}, {"role": "assistant", "content": "NodeMap — store control values and bus mappings"}, {"role": "user", "content": "What does `NodeMap.map` do?"}, {"role": "assistant", "content": "map arguments of a node (synonymous with `set`, mapping is done automatically when a suitable argument is passed)."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n(\nSynthDef(\"modsine\",\n { |out, freq = 320, amp = 0.2|\n Out.ar(out, SinOsc.ar(freq, 0, amp));\n }).add;\nSynthDef(\"lfo\",\n { |out, rate = 2|\n Out.kr(out, LFPulse.kr(rate, 0, 0.1, 0.2))\n }).add;\n);\n\n// start nodes\n(\nb = Bus.control(s, 1);\nx = Synth(\"modsine\");\ny = Synth.before(x, \"lfo\", [\\out, b]);\n);\n\n// create some node maps\n(\nh = NodeMap.new;\nh.set(\\freq, 800);\nh.map(\\amp, b);\n\nk = NodeMap.new;\nk.set(\\freq, 400);\nk.unmap(\\amp);\n);\n\n// apply the maps\n\nh.sendToNode(x); // the first time a new bundle is made\nk.sendToNode(x);\n\nh.sendToNode(x); // the second time the cache is used\nk.sendToNode(x);\n\nh.set(\\freq, 600);\n\nh.sendToNode(x); // when a value was changed, a new bundle is made\n\n// free all\nx.free; b.free; y.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LinExp`."}, {"role": "assistant", "content": "```supercollider\n// linexp\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(mod.linexp(-1, 1, MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1))) * 0.1\n}.play;\n);\n\n// exprange\n(\n{\n var mod = LFNoise2.ar(80).exprange(MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1));\n SinOsc.ar(mod) * 0.1\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Nil.notNil` do?"}, {"role": "assistant", "content": "Answer false. In class Object this message answers true. `[1, 2, nil,"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Bag`."}, {"role": "assistant", "content": "```supercollider\nBag[1, 2, 3].add(4).postln;\n\nBag[1, 2, 3].add(3).postln;\n\nBag[\"abc\", \"def\", \"ghi\"].add(\"jkl\").postln;\n\nBag[\"abc\", \"def\", \"ghi\"].add(\"def\").postln;\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for little study on piano improvisation."}, {"role": "assistant", "content": "```supercollider\n/* Piano Gestures: A Little Study by mimetik\n\n This is a little study on piano improvisation, in particular on \"gestures\", by which I mean here little improvised phrasings.\n\n*/\n\nMIDIClient.init;\n\n/*\nChoose from the list of devices your internal MIDI router, so to send the notes to piano intrument in your favourite DAW\n*/\n\n~mOut = MIDIOut.new(3);\n\n//Set the scale to be Cmajor\n~scale=[0,2,4,5,7,9,11];\n\n//Define pattern proxies which will be modified by the task t below\n\na=PatternProxy(Pxrand([3,3,3,1,3,3],inf));\nb=PatternProxy(Pseq([1/2],inf));\nr=PatternProxy(Pseq([12],inf));\nn=Prand([4,8,16],inf).asStream;\n\nt=Task({\nPdef(\\x,Pbind(\\type,\\midi,\\chan,0,\n \\midiout,~mOut,\n \\scale,~scale,\n \\root,-12,\n \\degree,Pxrand([[0,3,5],[3,5,7],[4,6,8],[5,7,11]],inf),\n \\legato,1,\n \\amp,[{rrand(0.6,0.8)},{rrand(0.5,0.6)},{rrand(0.5,0.6)}]*0.7, \\dur,Prand([Pseq([1,1,1,1],1),Pseq([1,1,2],1),Pseq([1,2,1],1)],inf))).play(quant:1);\n\nPdef(\\y,Pbind(\\type,\\midi,\\chan,0,\n \\midiout,~mOut,\n \\scale,~scale,\n \\root,r,\n \\degree,a,\n \\legato,1,\n \\amp,{rrand(0.5,0.6)},\n\\dur,b)).play(quant:1);\n\n10.wait;\n\nt=Task({\n inf.do({\n if (0.7.coin,{ \n c=[[3,0,7,1,9,11,0,4],[[3,7],0,7,Rest,9,[0,11],0,4]].choose.scramble;\n r.source=Pseq([[12,24].wchoose([0.7,0.3])],inf);\n d=n.next;\n a.source=Pseq([Pxrand(c,d),Pxrand([3,3,3,1,3,3],inf)]);\n b.source=Pseq([Pseq([1/8],d),Pseq([1/2],inf)]);\n });\n rrand(3,4).wait;})}).play(quant:1);\n };\n).play(quant:1);\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `Dpoll` in SuperCollider briefly."}, {"role": "assistant", "content": "Dpoll — Print the current output value of a demand rate UGen Print the current output value of a demand rate UGen. Category: UGens > Demand, UGens > Info."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// you have to write the sample path in the firts line\n\n~bufferdue = Buffer.read(s,\" WRITE YOUR SAMPLE PATH HERE \", bufnum:2);\n\n(\nSynthDef.new(\\bufbeat, {\n arg amp = 1, out = 0, buf, start, end, freq = 1;\n var sig, ptr;\n ptr = LFNoise1.ar(freq).range(0.0,end);\n sig = BufRd.ar(2, buf, ptr);\n sig = sig * amp;\n Out.ar(out, sig);\n}).add\n);\n\nx = Synth.new(\\bufbeat, [\\buf, ~bufferdue.bufnum, \\start,0, \\end, ~bufferdue.numFrames-1, \\freq, 1, \\amp, 0.5],g);\n\nx.free;\n```"}, {"role": "assistant", "content": "a simple BufRd with the starting point of lecture randomized by LFNoise1."}]} -{"conversations": [{"role": "user", "content": "What is `BPZ2` in SuperCollider?"}, {"role": "assistant", "content": "BPZ2 — Two zero fixed midpass. A special case fixed filter. Implements the formula: Category: UGens > Filters > Linear."}]} -{"conversations": [{"role": "user", "content": "What is `LocalBuf` in SuperCollider?"}, {"role": "assistant", "content": "LocalBuf — Allocate a buffer local to the synth Category: UGens > Buffer."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// fadeTimes should be above blockSize\n// for shorter grains you can use smaller blocksizes\n\n(\ns.options.blockSize = 2;\ns.reboot;\n);\n\n// as the effect is AM on single outs we get side bands\n\n(\ns.doWhenBooted {\n x = {\n var lfo = LFDNoise3.ar(0.2);\n DXFan.ar(\n Dseq((0..7), inf),\n SinOsc.ar(lfo.range(800, 1500), 0, 0.03),\n size: 8,\n fadeTime: 0.0002\n )\n }.play\n};\n);\n\nx.release\n\n\n// go back to default\n\n(\ns.options.blockSize = 64;\ns.reboot;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// fadeTimes should be above blockSize\n// for shorter grains you can use smaller blocksizes\n\n(\ns.options.blockSize = 2;\ns.reboot;\n);\n\n// as the effect is AM on single outs we get side bands\n\n(\ns.doWhenBooted {\n x = {\n var lfo = LFDNoise3.ar(0.2);\n DXFan.ar(\n Dseq((0..7), inf),\n SinOsc.ar(lfo.range(800, 1500), 0, 0.03),\n size: 8,\n fadeTime: 0.0002\n )\n }.play\n};\n);\n\nx.release\n\n\n// go back to default\n\n(\ns.options.blockSize = 64;\ns.reboot;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `RedPendulum` in SuperCollider briefly."}, {"role": "assistant", "content": "RedPendulum — an object that oscillates Category: Red > redUniverse."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Time and relative dimensions in SC?"}, {"role": "assistant", "content": "```supercollider\n(\n\n{\nvar output, filtFreq, noise, noiseAmp, amp = 0.4, chain;\nvar tardRate = 0.4, combs;\n\nnoiseAmp = SinOsc.kr(0.38, 0.2).exprange(0.1, 1);\n\nnoise = BrownNoise.ar(noiseAmp);\n\nfiltFreq = SinOsc.kr(tardRate).range(400, 1800);\nnoise = RLPF.ar(noise, filtFreq, 0.7);\n\nchain = FFT(LocalBuf(256), noise);\nchain = PV_BinShift(chain, SinOsc.kr(tardRate * 0.986, 0.7).range(0.96, 1.052), SinOsc.kr(tardRate * 1.003, 0.61).range(-3, 2.1));\nchain = PV_BinScramble(chain, 0.05, 0.1, 1.0 ); \nnoise = IFFT(chain);\nnoise = noise.fold(-0.5, 0.5);\ncombs = Mix(\n [\n CombL.ar(noise, 0.1, SinOsc.kr(tardRate * 0.9966, 0.1).range(0.00032, 0.00028) * 3.4, 0.4, 0.06),\n CombL.ar(noise, 0.1, SinOsc.kr(tardRate * 0.99684, 0.1).range(0.000318, 0.000266) * 3.397, 0.4, 0.06)\n ]\n) * 1.2;\n\noutput = (noise + combs) * amp;\noutput = HPF.ar(output, 80);\noutput ! 2\n\n}.play\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `PlayerSocket.qspawnPlayer` do? What arguments does it take?"}, {"role": "assistant", "content": "you should have already prepared the Arguments: player; releaseTime."}]} -{"conversations": [{"role": "user", "content": "Write an FM bell in SuperCollider."}, {"role": "assistant", "content": "PMOsc is phase modulation: a non-integer modulator ratio gives the inharmonic clang.\n\n```supercollider\n(\nSynthDef(\\fmBell, { |out = 0, freq = 440, amp = 0.2, dur = 4|\n var index = EnvGen.kr(Env([8, 0.2], [dur], -4));\n var sig = PMOsc.ar(freq, freq * 1.4, index, 0, 1);\n var env = EnvGen.kr(Env.perc(0.002, dur, 1, -5), doneAction: 2);\n Out.ar(out, Pan2.ar(sig * env * amp, 0));\n}).add;\n);\nSynth(\\fmBell, [\\freq, 550]);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Red4D.position` do?"}, {"role": "assistant", "content": "Get or set the current position of the shape as a"}]} +{"conversations": [{"role": "user", "content": "What does `Mx.solo` do? What arguments does it take?"}, {"role": "assistant", "content": "A mixer and dynamic patching Arguments: channel; boo."}]} +{"conversations": [{"role": "user", "content": "Explain `FoaDecode` in SuperCollider briefly."}, {"role": "assistant", "content": "FoaDecode — First Order Ambisonic (FOA) decoder Renders (decodes) a First Order Ambisonic signal (B-format) to speaker feeds in a variety of configurations. DecodeB2 is the SuperCollider inbuilt equivalent. Category: Libraries > Ambisonic Toolkit > UGens > FOA > Decoder, UGens > Multichannel > Ambisonics."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n(\n#a, c = { TaskProxy.new } ! 2;\na.source = { \"one\".postln; 1.wait; \"two\".postln };\nc.source = { var z; z = Synth(\\default); 0.5.wait; z.release };\nr = Task {\n \"counting...\".postln;\n 2.wait;\n a.embedInStream;\n 1.wait;\n c.embedInStream;\n \"done.\".postln;\n};\n);\n\nr.play; // play a stream\n\nc.source = { var z; z = Synth(\\default, [\\freq, 300]); 1.5.wait; z.release }; // change the def\n\nr.reset;\nr.play;\n\n// of course Task\n// …\n```"}, {"role": "assistant", "content": "of course TaskProxies can be used in other Tdefs: if one wants to branch off a stream in a separate thread, asStream is used. (TaskProxy: event stream reference)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// randomly modulate all params\n(\n{ LatoocarfianL.ar(\n SampleRate.ir/4,\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5)\n) * 0.2 }.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// randomly modulate all params\n(\n{ LatoocarfianL.ar(\n SampleRate.ir/4,\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5)\n) * 0.2 }.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LatoocarfianC`."}, {"role": "assistant", "content": "```supercollider\n// default initial params\n{ LatoocarfianC.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `SpecFile` in SuperCollider briefly."}, {"role": "assistant", "content": "SpecFile — Write specs into File A tool for reading and writing spec files. Category: Libraries > Radicles."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Kepler 22-b atmosphere. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\nfork { \n Ndef(\\ttwnd).play;//(d,2,addAction:\\addToHead);\n loop {\n var seed = thisThread.randSeed = 100000000.rand.debug('seed');\n Ndef(\\ttwnd, {\n var freq = [20, 7500];\n Splay.ar(\n { \n var bands = 2.rrand(10);\n var sig = { [BPF,RLPF,RHPF].choose.ar(\n LFNoise2.ar(freq[0].rrand(freq[1]), LFNoise2.kr(0.1.exprand(10))),\n Array.rand(bands, freq[0], freq[1]),\n Array.rand(bands, 0.2, 1.8)\n ).mean } ! 2;\n Rotate2.ar(sig[0], sig[1], LFSaw.kr(0.1.exprand(10)));\n } ! 4.rrand(6).debug('source'),\n 0.5.rrand(1)\n );\n }).fadeTime_(1.rrand(4.0));\n 10.0.rrand(40).debug('wait(bts)').wait;\n }\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does Splay.ar do?"}, {"role": "assistant", "content": "`Splay.ar(inArray, spread, level, center, levelComp)` takes an array of mono signals and distributes them across the stereo field, so `Splay.ar(SinOsc.ar([220, 330, 440]) * 0.1)` is a three-source stereo chord rather than three separate synths. spread (0..1) controls how far the voices fan out and center shifts the middle. It is the shorthand for 'make this array stereo'."}]} +{"conversations": [{"role": "user", "content": "Explain `Latoocarfian2DL` in SuperCollider briefly."}, {"role": "assistant", "content": "Latoocarfian2DL — latoocarfian 2D chaotic generator `x(n+1) = sin(by(n)) + c*sin(bx(n))` Category: UGens > Generators > Stochastic."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ OnePole.ar(WhiteNoise.ar(0.5), 0.95) }.play\n\n{ OnePole.ar(WhiteNoise.ar(0.5), -0.95) }.play\n\n{ OnePole.ar(WhiteNoise.ar(0.5), Line.kr(-0.99, 0.99, 10) }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ OnePole.ar(WhiteNoise.ar(0.5), 0.95) }.play\n\n{ OnePole.ar(WhiteNoise.ar(0.5), -0.95) }.play\n\n{ OnePole.ar(WhiteNoise.ar(0.5), Line.kr(-0.99, 0.99, 10)) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "I get 'FAILURE IN SERVER /s_new SynthDef not found'. What is wrong?"}, {"role": "assistant", "content": "The server does not know that SynthDef. Three usual causes, in order of likelihood:\n\n1. **The SynthDef was added before the server booted.** `SynthDef(...).add` is asynchronous; wrap the work\n in `s.waitForBoot { ... }` or put `s.sync` after `.add`.\n2. **The name does not match.** `SynthDef(\\bell, ...)` is played by `Synth(\\bell)`, not `\\Bell` — symbols\n are case-sensitive.\n3. **`.add` was never called.** Writing `SynthDef(\\bell, { ... })` without `.add` builds the definition in\n the language and sends nothing.\n\nCheck with `SynthDescLib.global.dict.keys` — if the name is not there, it never reached the server."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Pan2` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\ng = Group.new;\n\n// make 4 synths in g\n// 1.0.rand2 returns a random number from -1 to 1.\n4.do({ { arg amp = 0.1; Pan2.ar(SinOsc.ar(440 + 110.rand, 0, amp), 1.0.rand2) }.play(g); });\n\ng.set(\\amp, 0.005); // turn them all down\n\ng.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n\n~remapConfig = IdentityDictionary[\n 0 -> 1,\n 1 -> 2,\n 2 -> 3,\n 3 -> 4,\n 4 -> 5,\n 5 -> 6,\n 6 -> 7,\n 7 -> 8,\n 8 -> 9,\n 9 -> 12,\n 10 -> 13,\n 11 -> 14,\n 12 -> 15,\n 13 -> 16,\n 14 -> 17\n];\n\n\n~generateRemapSynthDef = { |numInputChannels, numOutputChannels|\n SynthDef(\\remapOutputs, {\n var sig = In.ar(0, numInputChannels); \n var remapped = Array.fill(numOutputChannels, { Silent.ar(1) }); \n\n ~remapConfig.keysValuesDo { |src, dest|\n if (src < numInputChannels and: { dest < numOutputChannels }) {\n remapped[dest] = sig[src];\n }\n };\n\n ReplaceOut.ar(0, remapped);\n }).add;\n};\n\n~generateRemapSynthDef.(16, 18); \n);\n\n(\n~createRemapSynth = {\n ~remapSynth = Synth(\\remapOutputs, target: s.defaultGroup, addAction: \\addAfter);\n};\n\nServerTree.add( ~createRemapSynth);\n\n)\n```"}, {"role": "assistant", "content": "This code sets up a remapping system where input channels are mapped to output channels based on a predefined configuration. The remapping is done using a SynthDef that reads input signals, applies the remapping, and outputs the remapped signals. The ServerTree.add ensures that the remap synth is created and added to the server's node tree upon server startup and cmd-. and ctrl-.\r\n\r\nBased on discu."}]} +{"conversations": [{"role": "user", "content": "What does `FoaThetaPhiA.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "First Order Ambisonic (FOA) Azimuth & Elevation of Soundfield Active Intensity Vector Arguments: in — The B-format signal, an array: [w, x, y, z]; size — Analysis filter kernel size.; method — The Soundfield analysis method:."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// data sharing between streams of same PmonoPar and streams of second PmonoPar,\n// use of Ptpar ensures that first stream of second PmonoPar comes after first stream of first PmonoPar,\n// consider also PpolyPar for such type of usage\n\n(\np = PmonoPar([\n [\n \\dur, Prand([1, 1, 2]/3, 40).collect(~dur = _),\n \\amp, Pseq([0.3, 0.1], 15) \n ],[\n \\dur, Pfunc { ~dur / 2 },\n \\midinote, Pshuf((50..70)) \n ]\n]);\n\nq = PmonoPar([\n [\n \\dur, Pfunc { ~dur },\n \\amp, Pseq([0.3, 0\n// …\n```"}, {"role": "assistant", "content": "data sharing between streams of same PmonoPar and streams of second PmonoPar, use of Ptpar ensures that first stream of second PmonoPar comes after first stream of first PmonoPar, (PmonoPar: monophonic event pattern for an arbitrary number of timed setting streams)"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Duty`."}, {"role": "assistant", "content": "```supercollider\n(\n {\n var freq;\n freq = Duty.kr(\n Drand([0.01, 0.2, 0.4], inf), // demand ugen as durations\n 0,\n Dseq([204, 400, 201, 502, 300, 200], inf)\n );\n SinOsc.ar(freq * [1, 1.01]) * 0.1\n\n }.play;\n);\n\n(\n {\n var freq;\n freq = Duty.kr(\n MouseX.kr(0.001, 2, 1), // control rate ugen as durations\n 0,\n Dseq([204, 400, 201, 502, 300, 200], inf)\n );\n SinOsc.ar(freq * [1, 1.01]) * 0.1\n\n }.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is Ndef used for?"}, {"role": "assistant", "content": "Ndef is the JITLib node proxy: a named placeholder for a running signal chain that you can redefine while it plays. `Ndef(\\drone, { SinOsc.ar(55) * 0.1 }).play` starts it, and calling Ndef(\\drone, { ... }) again crossfades to the new definition without restarting the sound. It also supports chaining, `Ndef(\\drone)[1] = \\filter -> { |in| LPF.ar(in, 800) }`, which is the idiomatic way to build and modify a live patch."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\nSynthDef(\"help-Infreq\", { |bus|\n Out.ar(0, FSinOsc.ar(In.kr(bus), 0, 0.5));\n}).add;\n\nSynthDef(\"help-Outfreq\", { |freq = 400, bus|\n Out.kr(bus, SinOsc.kr(1, 0, freq/40, freq));\n}).add;\n\nb = Bus.control(s, 1);\n);\n\n// add the first control Synth at the tail of the default server; no audio yet\nx = Synth.tail(s, \"help-Outfreq\", [\\bus, b.index]);\n\n// add the sound producing Synth BEFORE it; It receives x's data from the previous cycle\ny = Synth\n// …\n```"}, {"role": "assistant", "content": "add the first control Synth at the tail of the default server; no audio yet add the sound producing Synth BEFORE it; It receives x's data from the previous cycle (In: Read a signal from a bus.)"}]} +{"conversations": [{"role": "user", "content": "What is `WalshHadamard` in SuperCollider?"}, {"role": "assistant", "content": "WalshHadamard — decomposition into square waves, and reconstruction WalshHadamard transform to a basis of square wave like functions rather than the more conventional sine waves of Fourier analysis. The advantage is that the transform is really efficient (no need for trigonometric functions) but the interpretation in a space of 'sequencies' and amplitudes is less intuitively comprehensible. Category: UGens > Analysis."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BHiPass`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n(\nz = {\n BHiPass.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(10, 20000, \\exponential), // cutoff freq.\n MouseY.kr(0.0, 1.0, \\linear), // rq\n 0.5); // mul\n}.play\n);\nz.release;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n// compares a 1102.5 Hz sine tone (11025 * 0.1, left) with a 1100 Hz tone (right)\n// the apollo sample has a sample rate of 11.025 kHz\n(\n{\n var freq;\n freq = [BufSampleRate.kr(b) * 0.1, 1100];\n SinOsc.ar(freq, 0, 0.1)\n}.play;\n);\n\nb.free;\n```"}, {"role": "assistant", "content": "compares a 1102.5 Hz sine tone (11025 * 0.1, left) with a 1100 Hz tone (right) the apollo sample has a sample rate of 11.025 kHz (BufSampleRate: Buffer sample rate.)"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `IEnvGen`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var env = Env([0, 0.6, 0.3, 1.0, 0], [0.1, 0.02, 0.4, 1.1], [\\lin, \\exp, -6, \\sin]);\n var envgen = IEnvGen.kr(env, MouseX.kr(0, env.times.sum));\n env.plot;\n SinOsc.ar(envgen * 500 + 440)\n}.play;\n);\n\n// index with an SinOsc ... mouse controls amplitude of SinOsc\n// use offset so negative values of SinOsc will map into the Env\n(\n{\n var sin = SinOsc.ar(440, 0, MouseX.kr(0, 1));\n // use offset so negative values of SinOsc will map into the Env\n var env = Env([-1, -0.7, 0.7, 1], [0.8666, 0.2666, 0.8668], \\lin, offset: -1.0);\n IEnvGen.ar(env, sin) * 0.1\n}.play;\n);\n\n// index with Amplitude of input, control freq of SinOsc (uses SoundIn)\n(\n{\n var point = Amplitude.ar(SoundIn.ar(0), 0.01, 0.2);\n // use offset so negative values of SinOsc will map into the Env\n var env = Env.xyc([[0, 330, \\exp], [0.5, 440, \\exp], [1.0, 1760]]);\n SinOsc.ar(IEnvGen.kr(env, point)) * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{SinOsc.ar(WrapSummer.kr(Impulse.kr(10), 1.5, 3, 13).poll * 100, 0, 0.1)}.play;\n\n{SinOsc.ar(WrapSummer.kr(Impulse.kr(12), 1.33, MouseX.kr(1, 5), MouseY.kr(5, 10)) * 100, 0, 0.1)}.play;\n\n(\n{\n var trig = Dust.kr([5, 5]);\n BPF.ar(Saw.ar(WrapSummer.kr(trig, 1.0008, 1, 8) * 100, 0.2));\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{SinOsc.ar(WrapSummer.kr(Impulse.kr(10), 1.5, 3, 13).poll * 100, 0, 0.1)}.play;\n\n{SinOsc.ar(WrapSummer.kr(Impulse.kr(12), 1.33, MouseX.kr(1, 5), MouseY.kr(5, 10)) * 100, 0, 0.1)}.play;\n\n(\n{\n var trig = Dust.kr([5, 5]);\n BPF.ar(Saw.ar(WrapSummer.kr(trig, 1.0008, 1, 8) * 100, 0.2));\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What are you not good at?"}, {"role": "assistant", "content": "Everything outside SuperCollider. I have no audio input, no live data, and my knowledge ends at the documentation snapshot I was trained on — so I can be confidently wrong about Quarks and new UGens."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for simple smooth arp. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\smooth, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.linen(0.05, sustain, 0.1), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// as a frequency control\n{ SinOsc.ar(StandardN.ar(40, MouseX.kr(0.9, 4))*800+900)*0.4 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// as a frequency control\n{ SinOsc.ar(StandardN.ar(40, MouseX.kr(0.9, 4))*800+900)*0.4 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// derived from an answer by Sergio Luque to a mail to the sc-users SuperCollider mailing list on 2013/03/22\n\n(\nvar registerSize = 16;\nvar min =\"C2\".namemidi.asInteger;\nvar max = \"C6\".namemidi.asInteger;\nvar waitTime = 0.05; // in seconds\n//var chance = 0.1;\nvar chance = Pseq([Pseries(0, 0.1, 10), Pseries(1, -0.1, 10)], inf);\nvar change = 10; // step size\n\n\nPbind(\n \\midinote, Pswitch1(\n { \n Pbrown(min, max, Pif(Prout({ chance.trace.coin.embedInStream }), change, 0))\n } ! registerSize, \n Pseq(Array.iota(registerSize), inf)\n ),\n \\dur, waitTime\n).play\n)\n```"}, {"role": "assistant", "content": "wiard noise ring variation using a ringbuffer instead of bitshifting.\r\nRe-implemented according to Julian Parker's m4l patch.\r\nDerived from an answer by Sergio Luque to a mail to the sc-users SuperCollider mailing list on 2013/03/22."}]} +{"conversations": [{"role": "user", "content": "Explain `FoaProximity` in SuperCollider briefly."}, {"role": "assistant", "content": "FoaProximity — First Order Ambisonic (FOA) proximity effect filter Apply proximity filtering to a First Order Ambisonic signal (B-format). Category: Libraries > Ambisonic Toolkit > UGens > FOA > Transformer, UGens > Multichannel > Ambisonics."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Re: the perfect frequencies. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// Rumush\n// https://mycelialcordsblog.wordpress.com/\n// https://fungorumush.bandcamp.com/releases\n// https://soundcloud.com/fungorum\n\n(\nf = {\n var rep = [4, 8, 16, 32];\n var n = rep.choose;\n var x = [\n\n 54, 60, 66, 72, 81, 90, 96, 102,\n 108, 128, 132, 144, 162, 180, 192, 204,\n 216, 240, 264, 288, 324, 360, 384, 408,\n 432, 480, 528, 576, 648, 720, 768, 816,\n 864, 960, 1056, 1152, 1296, 1440, 1536, 1632,\n 1728, 1920, 2112, 2304, 2592, 2880, 3072, 3264,\n 3456, 3840, 4224, 4608, 5184, 5760, 6144, 6528,\n 6912, 7680, 8448, 9216, 10368, 11520, 12288, 528\n\n ];\n Mix.fill(n,\n {\n var detune = 5.rand;\n var sin = SinOsc.ar(x.choose, 4.rand, 0.25);\n var saw = RLPF.ar(Saw.ar(x.choose*0.01+detune, 0.75), x.choose, 2.rand).tanh;\n Pan2.ar((sin+saw) * EnvGen.kr(Env.sine(12, 1/n), 1, doneAction:2),\n 1.rand2) }\n );\n};\n);\n\n(\n// DEFINE A ROUTINE\nr = Routine({\n\n inf.do({\n f.play;\n 10.wait;\n })\n});\n);\n\nr.reset.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Red3D.rotationMatrices` do?"}, {"role": "assistant", "content": "Returns an array of 3 arrays each holding a 3-row matrix for the current rotation in X, Y and Z dimensions. This is calculated when calling"}]} +{"conversations": [{"role": "user", "content": "I get 'FAILURE IN SERVER /s_new SynthDef not found'. What is wrong?"}, {"role": "assistant", "content": "The server does not know that SynthDef. Three usual causes, in order of likelihood:\n\n1. **The SynthDef was added before the server booted.** `SynthDef(...).add` is asynchronous; wrap the work\n in `s.waitForBoot { ... }` or put `s.sync` after `.add`.\n2. **The name does not match.** `SynthDef(\\bell, ...)` is played by `Synth(\\bell)`, not `\\Bell` — symbols\n are case-sensitive.\n3. **`.add` was never called.** Writing `SynthDef(\\bell, { ... })` without `.add` builds the definition in\n the language and sends nothing.\n\nCheck with `SynthDescLib.global.dict.keys` — if the name is not there, it never reached the server."}]} +{"conversations": [{"role": "user", "content": "What does `SimpleNumber.cylBesselIPrime` do?"}, {"role": "assistant", "content": "Returns the first derivative with respect to x of the corresponding Bessel"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nVowel.compose([\\a,\\e,\\i], [\\bass,\\soprano,\\alto], [0.2, 0.3, 0.5]);\nVowel.compose([\\a,\\e], [\\soprano], [9, 4].normalizeSum);\nVowel.compose([\\a], [\\tenor, \\counterTenor, \\soprano], [1, 4, 2].normalizeSum);\n\n(\n{ var v = Vowel.compose(\n [\\a, \\e, \\i], \n [\\soprano, \\bass, \\tenor, \\counterTenor, \\alto], \n ({10.rand}!5).normalizeSum\n);\nFormants.ar(50 + 300.rand, v) * 0.1; \n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nVowel.compose([\\a,\\e,\\i], [\\bass,\\soprano,\\alto], [0.2, 0.3, 0.5]);\nVowel.compose([\\a,\\e], [\\soprano], [9, 4].normalizeSum);\nVowel.compose([\\a], [\\tenor, \\counterTenor, \\soprano], [1, 4, 2].normalizeSum);\n\n(\n{ var v = Vowel.compose(\n [\\a, \\e, \\i], \n [\\soprano, \\bass, \\tenor, \\counterTenor, \\alto], \n ({10.rand}!5).normalizeSum\n);\nFormants.ar(50 + 300.rand, v) * 0.1; \n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Mx.gui` do? What arguments does it take?"}, {"role": "assistant", "content": "A mixer and dynamic patching Arguments: parent; bounds. Returns: MxGui"}]} +{"conversations": [{"role": "user", "content": "What does `MxApp.save` do?"}, {"role": "assistant", "content": "Save the Mx as a document (initiating a file dialog if there is no path yet) which should reproduce the current state of the Mx and all of its objects. Not all objects may support saving and loading, and any objects like Busses would fix their bus numbers in the document. This can also be done from the"}]} +{"conversations": [{"role": "user", "content": "What does `Env.asArray` do?"}, {"role": "assistant", "content": "Converts the Env to an Array in a specially ordered format. This allows for Env parameters to be settable arguments in a SynthDef. See example under"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n////////////// xosc nufo is unused by now ///////////\n// OSCdef(\\xoscAlive, { |msg, time|\n// if (NTMI.nufo.lastInTime == 0 or: { NTMI.nufo.timeSinceLast > 10 }) {\n// Tdef(\\allLEDs).play;\n// };\n// NTMI.nufo.deviceName = \\xosc;\n// NTMI.nufo.lastInTime = time;\n// }, \"/imu\").permanent_(true);\n```"}, {"role": "assistant", "content": "xosc nufo is unused by now /////////// OSCdef(\\xoscAlive, { |msg, time| if (NTMI.nufo.lastInTime == 0 or: { NTMI.nufo.timeSinceLast > 10 }) { Tdef(\\allLEDs).play; }; NTMI.nufo.deviceName = \\xosc; NTMI.nufo.lastInTime = time; }, \"/imu\").permanent_(true);."}]} +{"conversations": [{"role": "user", "content": "What does `ObjectGui.background` do?"}, {"role": "assistant", "content": "Each ObjectGui subclass may implement a default background Returns: a color"}]} +{"conversations": [{"role": "user", "content": "What does `FoaNF.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "First Order Ambisonic (FOA) near-field distance estimate Arguments: in — The B-format signal, an array: [w, x, y, z]; size — Analysis filter kernel size.; method — The Soundfield analysis method:."}]} +{"conversations": [{"role": "user", "content": "What does `RedEffectModuleGUI.new` do? What arguments does it take?"}, {"role": "assistant", "content": "gui for effect modules Arguments: redEffectModule — A RedEffectModule.; parent — A Window, View or `nil`.; position — A Point or `nil`.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n// Play it with the mouse...\nx = { MoogFF.ar(WhiteNoise.ar(01.1), MouseY.kr(100, 10000, 1), MouseX.kr(0, 4)) }.play(s);\nx.free;\n\n// Mmmm, throbby\n(\nx = {\n MoogFF.ar(\n Pulse.ar([40, 121], [0.3, 0.7]),\n SinOsc.kr(LFNoise0.kr(0.42).range(0.001, 2.2)).range(30, 4200),\n 0.83 * 4) }.play(s);\n;\nx.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n// Play it with the mouse...\nx = { MoogFF.ar(WhiteNoise.ar(01.1), MouseY.kr(100, 10000, 1), MouseX.kr(0, 4)) }.play(s);\nx.free;\n\n// Mmmm, throbby\n(\nx = {\n MoogFF.ar(\n Pulse.ar([40, 121], [0.3, 0.7]),\n SinOsc.kr(LFNoise0.kr(0.42).range(0.001, 2.2)).range(30, 4200),\n 0.83 * 4) }.play(s);\n);\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `AudioPatchOut` in SuperCollider briefly."}, {"role": "assistant", "content": "AudioPatchOut — manages state and resources for a Player's output when connecting to other Players Category: Libraries > crucial > internals."}]} +{"conversations": [{"role": "user", "content": "What does `PLbindefParEnvironment.num` do?"}, {"role": "assistant", "content": "Getter for PLbindefPar's number of parallel"}]} +{"conversations": [{"role": "user", "content": "What does `PV_PhaseShift.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Shift phase. Arguments: buffer — FFT buffer.; shift — Phase shift in radians.; integrate — If greater than zero, integrate the phase-shift across calls (for an accumulating phase shift).."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `T2K`."}, {"role": "assistant", "content": "```supercollider\n// this does not work:\n(\n{\n var trig = Dust.ar(4);\n Trig.kr(trig, 0.1) * SinOsc.ar(800) * 0.1\n}.play;\n);\n\n// this works:\n(\n{\n var trig = T2K.kr(Dust.ar(4));\n Trig.kr(trig, 0.1) * SinOsc.ar(800) * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Set.do` do?"}, {"role": "assistant", "content": "Evaluates function for each item in the Set. The function is passed two arguments, the item and an integer index. `Set[1, 2, 3, 300].do({ |item, i| item.postln"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `MoogFF`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n// Play it with the mouse...\nx = { MoogFF.ar(WhiteNoise.ar(01.1), MouseY.kr(100, 10000, 1), MouseX.kr(0, 4)) }.play(s);\nx.free;\n\n// Mmmm, throbby\n(\nx = {\n MoogFF.ar(\n Pulse.ar([40, 121], [0.3, 0.7]),\n SinOsc.kr(LFNoise0.kr(0.42).range(0.001, 2.2)).range(30, 4200),\n 0.83 * 4) }.play(s);\n);\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n \n// definition for future reference in arbitrary Environments\n\np = PLwhite(\\lo, \\hi);\n\n\n// prepare current Environment\n// PLseq repeats defaults to inf\n\n(\n~lo = PLseq((60..70));\n~hi = PLseq((62..72));\n);\n\n\n// run\n\n(\nx = Pbind(\n \\midinote, p, \n \\dur, 0.1 \n).play;\n);\n\n\n// replace, converging bounds, stops when ~lo ends (Pseq default repeats = 1)\n\n(\n~lo = Pseq((60..80) ++ (80!5));\n~hi = 8\n// …\n```"}, {"role": "assistant", "content": "definition for future reference in arbitrary Environments prepare current Environment (PLwhite: dynamic scope Pwhite variant)"}]} +{"conversations": [{"role": "user", "content": "What is `AbsMxAdapter` in SuperCollider?"}, {"role": "assistant", "content": "AbsMxAdapter — internal usage. describes the behavior of a source object inlet or outlet These classes are used internally to describe the behavior of an outlet or inlet of a unit. For instance a unit may play on a bus, so its behavior type is identified as MxPlaysOnBus. The MxPlaysOnBus object is supplied methods for getting that bus and for getting the group and server where relevant. Category: Mx."}]} +{"conversations": [{"role": "user", "content": "What does `PLorenzN.new` do? What arguments does it take?"}, {"role": "assistant", "content": "UGenPatterns quark library Arguments: freq; s — sigma; r — rho; b — beta; h — step amount; xi — initial value; yi — initial value; zi — initial value."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Pfsm` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n(\na = Pfsm([\n #[0, 1],\n 67, #[0, 0, 3],\n 72, #[2],\n 73, #[0, 2],\n Pseq([74, 75, 76, 77]), #[2, 3, 3],\n nil, nil\n ], inf).asStream;\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, a.next.midicps]);\n 0.1.wait;\n })\n}).play;\n);\n\n(\nPfsm([\n #[5, 6, 7], // entry states\n\n // e1 (== state 0)\n Pbind(\\dur, Pseq([1/8, 3/8]), \\midinote, Pseq([86, 75])),\n // #[1], // as given in CMJ\n // my de-boredom-ated version..\n #[1, 1, 1, 1, 1, 1, 1, 8],\n // e2 (== state 1)\n Pbind(\\dur, 1/2, \\midinote, Pseq([69])),\n #[0, 1],\n // e3 (== state 2)\n Pbind(\\dur, 1/3, \\midinote, Pseq([55, 60, 66])),\n #[0, 1, 2, 2, 2, 2, 3, 3, 3, 3],\n // e4 (== state 3)\n Pbind(\\dur, 1/4, \\midinote, Pseq([81, 80, 77, 76])),\n #[1, 4, 4, 4, 4],\n // e5 (== state 4)\n Pbind(\\dur, Pseq([1, 2/3, 2/3, 2/3, 1]), \\midinote, Pseq([\\, 70, 70, 70, \\])),\n #[2, 3],\n // e6 (== state 5)\n Pbind(\\dur, 1/4, \\midinote, Pseq([59, 61])),\n #[0, 2, 4, 5, 5, 5, 5, 5, 5, 5],\n // e7 (== state 6)\n Pbind(\\dur, 1/4, \\midinote, Pseq([87, 88], 2)),\n #[4, 4, 4, 4, 6, 6, 6, 7, 7, 7],\n // e8 (== state 7)\n Pbind(\\dur, 1, \\midinote, Pseq([56])),\n #[1, 3, 6, 6, 6],\n // terminal state\n nil, nil\n]).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Normalizer`."}, {"role": "assistant", "content": "```supercollider\n(\n// example signal to process\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n z * 0.8\n}.play\n);\n\n(\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n [z, Normalizer.ar(z, 0.4, 0.01)] * 0.5\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\nb = Buffer.alloc(s, s.sampleRate);\n(\n{\n MultiTap.ar(`[0.1, 0.2, 0.3, 0.4], `[0.1, 0.2, 0.4, 0.8],\n Decay.ar(Dust.ar(2), 0.1, PinkNoise.ar), bufnum: b.bufnum)\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\nb = Buffer.alloc(s, s.sampleRate);\n(\n{\n MultiTap.ar(`[0.1, 0.2, 0.3, 0.4], `[0.1, 0.2, 0.4, 0.8],\n Decay.ar(Dust.ar(2), 0.1, PinkNoise.ar), bufnum: b.bufnum)\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n \n// definition for future reference in arbitrary Environments\n\np = PLbrown(\\lo, \\hi, \\step);\n\n\n// prepare current Environment\n// PLseq repeats arg defaults to inf\n\n(\n~lo = 55;\n~hi = 80;\n~step = Pstutter(10, PLseq([0.05, 3.5]));\n);\n\n\n// run\n\n(\nx = Pbind(\n \\midinote, Ptuple(p!2), \n \\dur, 0.1\n).play;\n);\n\n// replace\n\n(\n~lo = Pseq((50..90));\n~hi = Pseq((50..90) + 15);\n)\n```"}, {"role": "assistant", "content": "definition for future reference in arbitrary Environments prepare current Environment (PLbrown: dynamic scope Pbrown variant)"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Lag3`."}, {"role": "assistant", "content": "```supercollider\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n Lag3.kr( // lag the modulator\n LFPulse.kr(4, 0, 0.5, 50, 400), // frequency modulator\n Line.kr(0, 1, 15) // modulate lag time\n ),\n 0, // phase\n 0.3 // sine amplitude\n )\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `RunningMax`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n SinOsc.ar(\n RunningMax.ar(Dust.ar(20), Impulse.ar(0.4)) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// follow a sine lfo, reset rate controlled by mouse x\n(\n{\n SinOsc.ar(\n RunningMax.kr(SinOsc.kr(0.2), Impulse.kr(MouseX.kr(0.01, 2, 1))) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// Analogizer\n// a quick draft of a model of the EHX Analogizer pedal\n// some info from \"https://www.bassic.de/threads/electro-harmonix-ehx-analogizer.14865686/\"\n\ns.default\ns.boot\n\n// used this for testing: https://www.freesound.org/people/wescwave/sounds/169885/\n~buf = Buffer.read(s, \"169884__wescwave__double-bass-test2.wav\");\n\n(\n~x.free;\n~x = {\n var a, d, s;\n\n a = PlayBuf.ar(2, ~buf, 1, 1, 0, 1);\n a = a.sum!2; // go mono to make the effect more prominent\n\n // the \"distortion modeling\" could use some more love...\n s = (a * MouseY.kr(26/2, 0).dbamp).tanh;\n s = s * MouseY.kr(-16/2, 0).dbamp;\n\n // a simple delay\n d = DelayC.ar(s, 0.1, MouseX.kr(3.5/1000, 65/1000));\n\n // dry/wet...\n a = a + (d * MouseY.kr(0, -96).dbamp);\n\n Out.ar(0, a);\n}.play\n)\n```"}, {"role": "assistant", "content": "The EHX Analogizer (http://www.ehx.com/products/analogizer) is a guitar pedal that apparently consists of a ultra-short delay with some gain stage. It's supposed to \"fatten\" and somehow \"spread\" the sound to make it appear more \"analog\" (thus: dirty). I wanted to quickly test the effect myself.\r\n\r\nI guess with some additional care of the distortion stage and maybe some very little modulation (ster."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n{ Hasher.ar(Line.ar(0, 1, 1), 0.2) }.play;\n\n// Even adding a small amount to the input can result in a very different output. Compare these two examples:\n(\n{\n SinOsc.ar(\n Hasher.kr(MouseX.kr(0, 10).round(1), 300, 500)\n ) * 0.1\n}.play;\n);\n\n(\n{\n SinOsc.ar(\n Hasher.kr(MouseX.kr(0, 10).round(1) + 0.0001, 300, 500)\n ) * 0.1\n}.play;\n);\n\n// Output stays constant while not moving the mouse.\n(\n{\n SinOsc.ar(\n Hasher.kr(MouseX.kr(0, 10), 300, 500)\n ) * 0.1\n}.play;\n)\n```"}, {"role": "assistant", "content": "Even adding a small amount to the input can result in a very different output. Compare these two examples: Output stays constant while not moving the mouse. (Hasher: Scrambled value with a hash function.)"}]} +{"conversations": [{"role": "user", "content": "What's the difference between Env.perc and Env.adsr?"}, {"role": "assistant", "content": "`Env.perc(attack, release)` goes up once and decays to zero — one-shot sounds. `Env.adsr(a, d, s, r)` holds at a sustain level while its gate is open and only releases when the gate closes — notes you start and stop."}, {"role": "user", "content": "So which do I use for a pad?"}, {"role": "assistant", "content": "adsr, with `gate` as a Synth argument and `doneAction: 2` on the EnvGen:\n\n```supercollider\nSynthDef(\\pad, { |out = 0, freq = 220, gate = 1|\n var env = EnvGen.kr(Env.adsr(0.8, 0.4, 0.7, 2), gate, doneAction: 2);\n Out.ar(out, Saw.ar(freq) * env * 0.1)\n}).add;\n```\n\nThen `x.set(\\gate, 0)` releases it over the 2 seconds of release time."}]} +{"conversations": [{"role": "user", "content": "What are you good at?"}, {"role": "assistant", "content": "SuperCollider. I can explain its classes and UGens, write SynthDefs and patches, read a patch back to you, and tell you why one does not compile. I am 198M parameters; I am not a general assistant."}]} +{"conversations": [{"role": "user", "content": "What are the arguments of Pan2?"}, {"role": "assistant", "content": "`Pan2.ar(in, pos, level)` — in is the mono signal, pos is -1 (left) to 1 (right) with 0 in the middle, and level scales the output. It is equal-power, so a centred signal is -3 dB per channel rather than half amplitude. `Pan2.ar(sig, SinOsc.kr(0.1))` is the simplest autopan."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Resonz.ar(WhiteNoise.ar(0.5), 2000, 0.1) }.play\n\n// modulate frequency\n{ Resonz.ar(WhiteNoise.ar(0.5), XLine.kr(1000, 8000, 10), 0.05) }.play\n\n// modulate bandwidth\n{ Resonz.ar(WhiteNoise.ar(0.5), 2000, XLine.kr(1, 0.001, 8)) }.play\n\n// modulate bandwidth opposite direction\n{ Resonz.ar(WhiteNoise.ar(0.5), 2000, XLine.kr(0.001, 1, 8) }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Resonz.ar(WhiteNoise.ar(0.5), 2000, 0.1) }.play\n\n// modulate frequency\n{ Resonz.ar(WhiteNoise.ar(0.5), XLine.kr(1000, 8000, 10), 0.05) }.play\n\n// modulate bandwidth\n{ Resonz.ar(WhiteNoise.ar(0.5), 2000, XLine.kr(1, 0.001, 8)) }.play\n\n// modulate bandwidth opposite direction\n{ Resonz.ar(WhiteNoise.ar(0.5), 2000, XLine.kr(0.001, 1, 8)) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pan2`."}, {"role": "assistant", "content": "```supercollider\n// hear the difference, LinPan having a slight drop in the middle...\n{ LinPan2.ar(SinOsc.ar(440), Line.kr(-1, 1, 5)) }.play\n\n// ... whereas Pan2 is more smooth\n{ Pan2.ar(SinOsc.ar(440), Line.kr(-1, 1, 5)) }.play\n\n// other examples\n{ Pan2.ar(PinkNoise.ar(0.4), FSinOsc.kr(2), 0.3) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `RedTrk.item` do?"}, {"role": "assistant", "content": "Object to be controlled (e.g. Pbind, Tdef, Routine"}]} +{"conversations": [{"role": "user", "content": "What does `Pdef.envir` do?"}, {"role": "assistant", "content": "Set the event for the Pdef. It is used to filter the incoming stream before it is passed to the source pattern. This is similar to NodeProxy#-nodeMap. When set for the first time, the pattern is"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var env = Env.step([0, 3, 5, 2, 7, 3, 0, 3, 4, 0], [0.5, 0.1, 0.2, 1.0, 1.5, 2, 0.2, 0.1, 0.2, 0.1]);\n var envgen = EnvGen.kr(env);\n var freq = (envgen + 60).midicps;\n SinOsc.ar(freq) * 0.1\n}.play\n;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var env = Env.step([0, 3, 5, 2, 7, 3, 0, 3, 4, 0], [0.5, 0.1, 0.2, 1.0, 1.5, 2, 0.2, 0.1, 0.2, 0.1]);\n var envgen = EnvGen.kr(env);\n var freq = (envgen + 60).midicps;\n SinOsc.ar(freq) * 0.1\n}.play\n);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Just a dirty FM bass shuffling. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\nfork{\n SynthDef(\\basicFM, {|out = 0, gate = 1, amp = 1, carFreq = 1000, modFreq = 100, modAmount = 2000, clipAmount = 0.1|\n var modEnv = EnvGen.ar(Env.adsr(0.5, 0.5, 0.7, 0.1, peakLevel: modAmount), gate);\n var mod = SinOsc.ar(modFreq) * modEnv;\n var car = SinOsc.ar(carFreq + mod);\n var ampEnv = EnvGen.ar(Env.adsr(0.1, 0.3, 0.7, 0.2, peakLevel: amp), gate, doneAction: 2);\n var clip = clipAmount * 500;\n Out.ar(out, (car * ampEnv * clip).clip(-0.7, 0.7) * 0.1);\n }).add;\n\n s.sync;\n\n Pbind(*[\n instrument: \\basicFM,\n out: [0, 1],\n dur: Pseq([1/7, 1/3] / 1.2, inf),\n sustain: Pkey(\\dur),\n amp: 1/4,\n carFreq: Pseq([1, 1, 1, 2] * 350, inf),\n modFreq: Pkey(\\carFreq) * (1/8),\n modAmount: Pseq([2, 1, 0.5, 2, 1, 0.5, 2, 1, 2, 1, 0.5, 2, 1, 0.5, 2, 4] * 500, inf),\n clipAmount: Pseq([Pn(0.1, 32), Pn(1, 32)], inf)\n ]).play;\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DetectSilence`."}, {"role": "assistant", "content": "```supercollider\n// this frees after the Decay has become quiet enough for a long enough time\n{ var signal = Decay.ar(Impulse.ar(0), 2, PinkNoise.ar(0.2)); DetectSilence.ar(signal, doneAction: Done.freeSelf); signal }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `DrawGrid.fontColor` do? What arguments does it take?"}, {"role": "assistant", "content": "Get/set the font Arguments: c — A Color.. Returns: A Color."}]} +{"conversations": [{"role": "user", "content": "What is `Pseed` in SuperCollider?"}, {"role": "assistant", "content": "Pseed — set the random seed in subpattern Set the random generator seed of the resulting stream. Category: Streams-Patterns-Events > Patterns > Language Control."}]} +{"conversations": [{"role": "user", "content": "What is `BinaryOpUGen`?"}, {"role": "assistant", "content": "BinaryOpUGen — Apply a binary operation to the values of an input UGen"}, {"role": "user", "content": "What does `BinaryOpUGen.new` do?"}, {"role": "assistant", "content": "return a new instance that applies the operator `selector` to the UGens `a` and `b` normally, this is implicitly called when applying an operator to a UGen."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na = WhiteNoise.ar; // a WhiteNoise\nb = a + 2; // a BinaryOpUGen.\nb.operator; // +\n\n// sound example\n(\n{\n var a = LFSaw.ar(300);\n var b = LFSaw.ar(329.1);\n a % b * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `FoaPush` in SuperCollider?"}, {"role": "assistant", "content": "FoaPush — First Order Ambisonic (FOA) push transformer Apply push to a First Order Ambisonic signal (B-format) along an arbitrary axis. Category: Libraries > Ambisonic Toolkit > UGens > FOA > Transformer, UGens > Multichannel > Ambisonics."}]} +{"conversations": [{"role": "user", "content": "What is `LFPulse` in SuperCollider?"}, {"role": "assistant", "content": "LFPulse — pulse oscillator A non-band-limited pulse oscillator. Outputs a high value of one and a low value of zero. Category: UGens > Generators > Deterministic."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `SelectXFocus`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a;\n a = [\n Saw.ar(LFSaw.kr(3 * [1, 1.01], 0, 100, 230)),\n SinOsc.ar,\n Pulse.ar(LFPulse.kr(3 * [1, 1.02], 0, 0.4, 100, 230)),\n SinOsc.ar(SinOsc.kr(4 * [1, 1.03], 0, 200, 300))\n ];\n\n SelectXFocus.ar(MouseX.kr(0, 1) * a.size, a, MouseY.kr(0, a.size)) * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `TempoClock.bar` do?"}, {"role": "assistant", "content": "Returns the current bar. See #-bars2beats for returning beat of current"}]} +{"conversations": [{"role": "user", "content": "What is `IndexInBetween` in SuperCollider?"}, {"role": "assistant", "content": "IndexInBetween — Finds the (lowest) point in the Buffer at which the input signal lies in-between the two values Finds the (lowest) point in the Buffer at which the input signal lies in-between the two values, and returns the index. The fractional part of the index is suitable for linearly interpolating between the buffer slot values. Category: UGens > Buffer."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\nb = Buffer.new(s);\n// read only the first channel (a Sine wave) of a stereo file\nb.allocReadChannel(ExampleFiles.sinedPink, channels: [0]);\nx = { PlayBuf.ar(1, b, BufRateScale.kr(b), loop: 1 * 0.5 }.play;\nx.free; b.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\nb = Buffer.new(s);\n// read only the first channel (a Sine wave) of a stereo file\nb.allocReadChannel(ExampleFiles.sinedPink, channels: [0]);\nx = { PlayBuf.ar(1, b, BufRateScale.kr(b), loop: 1) * 0.5 }.play;\nx.free; b.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `BRF` in SuperCollider?"}, {"role": "assistant", "content": "BRF — 2nd order Butterworth band reject filter. A second order band reject filter. Category: UGens > Filters > Linear."}]} +{"conversations": [{"role": "user", "content": "What does `Server.actualSampleRate` do?"}, {"role": "assistant", "content": "A floating-point number representing the current hardware sample rate, which may"}]} +{"conversations": [{"role": "user", "content": "How do I use a metronome or check my timing?"}, {"role": "assistant", "content": "A click on the clock you are using, plus a counter to see where you are in the bar:\n\n```supercollider\n(\nTdef(\\click, {\n var count = 0;\n loop {\n (Synth(\\hat, [\\amp, if (count % 4 == 0) { 0.25 } { 0.08 }]));\n count = count + 1;\n 1.wait;\n }\n}).play;\n)\n```\n\nBecause it waits on `TempoClock.default`, it stays in sync with every Pbind you start, which makes it a\ntempo reference rather than a separate sound."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nPsloth {\n var seed, repeats;\n\n *new { arg seed, repeats=1;\n ^super.newCopyArgs(seed, repeats);\n }\n\n storeArgs{^[seed, repeats]}\n\n embedInStream { arg inval;\n var size=seed.size;\n var pointers=List[];\n repeats.value(inval).do({ arg j;\n j = j+1;\n if(j == j.nextPowerOf(size),{ pointers.add(0); });\n pointers.collect{|i| seed.at(i)}.sum.embedInStream(inval);\n pointers.do{|x, i|\n if((i==0) || (pointers[0..(i-1)].sum==0), {pointers[i] = ((x+1)%size);})\n };\n });\n ^inval\n }\n}\n```"}, {"role": "assistant", "content": "Save this as an extension and recompile class library. You can now use `Psloth([0,1,0], 10)`, for example, instead of declaring a new routine for each pattern.\r\n\r\nI didn't persist the use cases, as this should be saved as a `.sc` file. Please refer to the ancestor code for usage.\r\n\r\nMemory/CPU usage will grow over time, but at a decreasing rate. This can be used for a large amount of repeats. Exte."}]} +{"conversations": [{"role": "user", "content": "What is `Object`?"}, {"role": "assistant", "content": "Object — abstract superclass of all objects"}, {"role": "user", "content": "What does `Object.readArchive` do?"}, {"role": "assistant", "content": "Read in an object from a text archive. `(`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// embedding an event\na = (z: 77);\nb = Pset(\\y, 8, a.streamArg(true)).asStream;\nc = Pset(\\y, 8, a.streamArg(false)).asStream;\nb.nextN(3, ()); // this ends\nc.nextN(3, ()); // this loops\n\n// embedding a pattern\na = Pbind(\\note, Pseq([1, 2]));\nb = Pset(\\y, 8, a.streamArg(true)).asStream;\nc = Pset(\\y, 8, a.streamArg(false)).asStream;\nb.nextN(3, ()); // this ends\nc.nextN(3, ()); // this ends, too\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SCDoc.helpSourceDir` do?"}, {"role": "assistant", "content": "get/set the system-wide directory of help sourcefiles. Defaults to `Platform.classLibraryDir.dirname +/+ \"HelpSource\"` and should typically not be changed by the"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `HPF`."}, {"role": "assistant", "content": "```supercollider\n{ HPF.ar(Saw.ar(200, 0.1), FSinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3600, 4000), 5) }.play;\n\n(\n{ var ctl = HPF.kr(LFSaw.kr(5), SinOsc.kr(XLine.kr(0.07, 30, 20), 0, 35, 40)) ;\n SinOsc.ar(ctl * 200 + 500);\n}.play;\n);\n\n(\n{ var ctl = HPF.kr(LFSaw.kr(5, 0.1), MouseX.kr(2, 200, 1));\n SinOsc.ar(ctl * 200 + 400) * 0.1;\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Peak`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n SinOsc.ar(\n Peak.ar(Dust.ar(20), Impulse.ar(0.4)) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// follow a sine lfo, reset rate controlled by mouse x\n(\n{\n SinOsc.ar(\n Peak.kr(SinOsc.kr(0.2), Impulse.kr(MouseX.kr(0.01, 2, 1))) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `PLrand` in SuperCollider briefly."}, {"role": "assistant", "content": "PLrand — dynamic scope Prand variant Takes Symbol args for later reference by the Streams, which will read from variables in the Environments of their instantiation. See PLx_suite. Category: Libraries > miSCellaneous > PLx suite, Streams-Patterns-Events > PLx suite."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Resonz`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"noiseToPitch\", { arg out = 0, mul = 1;\n Out.ar(\n out,\n Resonz.ar(\n WhiteNoise.ar(mul),\n LFNoise0.kr(4, 110, 660),\n [0.005, 0.005]\n )\n )\n}).add;\n);\n\n(\n// activate left and right channels\nSynth(\"noiseToPitch\", [\\out, 0, \\mul, 1]);\nSynth(\"noiseToPitch\", [\\out, 1, \\mul, 1]);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// nOut allows for switching between iteration levels up to maximum n\n\n(\ny = {\n |nOut = 10|\n GFIS.ar({ |x| sin(LFDNoise1.ar(20).range(3, 3.5) * x) }, [0.2, 0.3], 10, nOut) * 0.1\n}.play\n);\n\n\ny.set(\\nOut, 9)\n\ny.set(\\nOut, 8)\n\ny.release\n\n\n// it can be passed an array of levels, \n// the resulting multichannel signal can e.g. be used for crossfaded switching with DXMix\n\n// switch between 3 mono signals and double them\n\n(\ny = {\n var src = GFIS.ar({ |x| sin(LFDNoise3.ar(30).\n// …\n```"}, {"role": "assistant", "content": "nOut allows for switching between iteration levels up to maximum n it can be passed an array of levels, (GFIS: generalized functional iteration synthesis pseudo ugen)"}]} +{"conversations": [{"role": "user", "content": "Explain `Boolean` in SuperCollider briefly."}, {"role": "assistant", "content": "Boolean — abstract class whose instances represent a logical value Boolean is the superclass of True and False which are the concrete realizations. In code True and False are represented by the literal values `true` and `false`. Category: Core."}]} {"conversations": [{"role": "user", "content": "What can you do?"}, {"role": "assistant", "content": "Write and explain SuperCollider: SynthDefs, UGens, Patterns, Ndef, buses and envelopes, and tell you why a patch is silent or will not compile. I am 198M parameters, so I am narrow on purpose."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for muffled thump?"}, {"role": "assistant", "content": "```supercollider\n(\n{ var nse, env, kic;\n kic = tanh(Ringz.ar(LPF.ar(Trig.ar(Impulse.ar(1.0),SampleDur.ir),1000),30,0.25,7).sin*2);\n env = Env.perc(0.05, 1, 1, -4);\n nse = BrownNoise.ar(2) + PinkNoise.ar(0.5) * EnvGen.kr(env,Impulse.kr(1), doneAction: 2);\n\n nse = Mix.ar(BPF.ar(nse,[100,1200,80,40,20],MouseX.kr(0,1),[1,0.2,1,1,1]));\n nse = LPF.ar(nse + kic, MouseY.kr(100,1000))! 2\n\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Pbindf`?"}, {"role": "assistant", "content": "Pbindf — bind several value patterns to one existing event stream by binding keys to values"}, {"role": "user", "content": "What does `Pbindf.new` do?"}, {"role": "assistant", "content": "The arguments to Pbindf is the initial pattern followed by an alternating sequence of keys and patterns. A pattern can also be bound to an array of keys. In this case, the pattern must specify a sequence whose elements are arrays with at least as many elements as there are keys."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\na = Pbind(\\x, Pseq([1, 2, 3]), \\zzz, 9000); // input stream\nb = Pbindf(a, \\y, Prand([100, 300, 200], inf), \\zzz, 99);\nx = b.asStream;\n);\n\nx.next(()); // pass in an event ()\nx.next(());\nx.next(());\nx.next(()); // end: nil\n\n\n\n// sound examples\n\n// using the default synth def\na = Pbind(\\dur, 0.1);\nPbindf(a, \\freq, Prand([300, 500, 231.2, 399.2], inf)).play;\nPbindf(a, \\freq, Prand([1, 1.2, 2, 2.5, 3, 4], inf) * 200).play;\n\n\n(\n// a SynthDef\nSynthDef(\\test, { |out, freq = 440, amp = 0.1, nharms = 10, pan = 0, gate = 1|\n var audio = Blip.ar(freq, nharms, amp);\n var env = Linen.kr(gate, doneAction: Done.freeSelf);\n OffsetOut.ar(out, Pan2.ar(audio, pan, env));\n}).add;\n);\n\na = Pbind(\\instrument, \\test, \\dur, 0.1);\n\nPbindf(a, \\freq, Prand([1, 1.2, 2, 2.5, 3, 4], inf) * 200).play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LinSelectX`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar(300),\n Pulse.ar(230)\n ];\n\n LinSelectX.ar(MouseX.kr(0, 1) * a.size, a) * 0.2\n}.play;\n);\n\n(\n{\n var a;\n a = [\n SinOsc.kr(0.25),\n LFSaw.kr(10),\n LFPulse.kr(0.3)\n ];\n\n SinOsc.ar(LinSelectX.kr(MouseX.kr(0, 1) * a.size, a) * 300 + 400) * 0.2\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Change arg values of MIDIdef after instantiation."}, {"role": "assistant", "content": "```supercollider\n~mdef =\n{\n |key, func, msgNum, permanent = true|\n\n MIDIdef(key, func ?? { MIDIdef(key).func }, msgNum ? MIDIdef(key).msgNum, MIDIdef(key).chan, MIDIdef(key).msgType, MIDIdef(key).srcID).permanent_(permanent)\n}\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SequenceableCollection.convertDigits` do?"}, {"role": "assistant", "content": "Returns an integer resulting from interpreting the elements as digits to a given base (default 10). See also asDigits in Integer#-asDigits for the complementary method. `[1, 0, 0,"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n// prep\ns = Server.local;\n\nn = SynthDef(\"Updater-help\", {|out, freq|\n var sin;\n sin = SinOsc.ar(freq, 0.5)*EnvGen.kr(Env.triangle(4,1), doneAction:2);\n Out.ar(out, sin);\n }).send(s);\n);\n\n(\n//create a new synth node on the server\nn = Synth.new(\"Updater-help\", [\\out, 0, \\freq, 220]);\n\n//you need to register the synth with a NodeWatcher first\nNodeWatcher.register(n);\n\n//update the client of \\n_end messages\nUpdater(n, {|node, msg|\n// …\n```"}, {"role": "assistant", "content": "create a new synth node on the server you need to register the synth with a NodeWatcher first (Updater: simple MVC utility; calls an update handler when the model changes)"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// note the pops at the beginning of signal due to lack of lookahead\n{\n var z;\n\n // signal (clean)\n z = Decay2.ar(\n Impulse.ar(8, 0, LFSaw.kr(0.3, 1, -0.3, 0.3)),\n 0.001,\n 0.3\n )\n * Mix.ar(Pulse.ar([80, 81], 0.3));\n\n // apply sustainer\n Compander.ar(z, z,\n thresh: MouseX.kr(0.1, 1),\n slopeBelow: 0.1,\n slopeAbove: 1,\n clampTime: 0.01,\n relaxTime: 0.01\n ) * 0.1\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// note the pops at the beginning of signal due to lack of lookahead\n{\n var z;\n\n // signal (clean)\n z = Decay2.ar(\n Impulse.ar(8, 0, LFSaw.kr(0.3, 1, -0.3, 0.3)),\n 0.001,\n 0.3\n )\n * Mix.ar(Pulse.ar([80, 81], 0.3));\n\n // apply sustainer\n Compander.ar(z, z,\n thresh: MouseX.kr(0.1, 1),\n slopeBelow: 0.1,\n slopeAbove: 1,\n clampTime: 0.01,\n relaxTime: 0.01\n ) * 0.1\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `StandardN`."}, {"role": "assistant", "content": "```supercollider\n// mouse-controlled param\n{ StandardN.ar(SampleRate.ir/2, MouseX.kr(0.9, 4)) * 0.3 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes song of forest."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\sound, {\n arg i_bus = 0, amp = 0.1, freq = 440, sustain = 1, pan = 0;\n var env, osc, out;\n env = EnvGen.kr(Env.perc(0.01, sustain, amp),doneAction:2);\n osc = SinOsc.ar([freq, freq * 1.005, freq * 0.995], mul:env);\n out = Pan2.ar(osc, pan);\n Out.ar(i_bus, out);\n}).send(s);\n);\n\n(\n~amp = 0.1;\na = Pdef(\\a,\n Pbind(\n \\instrument, \\sound,\n \\amp, ~amp * 1.5,\n \\degree, Pseq([2, 4, 5, 6, 1] - 1, inf),\n \\dur, Pseq([1, 1, 1, 1, 2] / 4, inf)\n )\n).quant_([3, 0, 0, 1]);\n\nb = Pdef(\\b,\n Pbind(\n \\instrument, \\sound,\n \\amp, ~amp,\n \\degree, Pseq([8, 6, 5, 3, 4, 6] - 1, inf),\n \\dur, Pseq([1, 1, 1, 1, 1, 1] / 4, inf)\n )\n).quant_([3, 0, 0, 1]);\n\nc = Pdef(\\c,\n Pbind(\n \\instrument, \\sound,\n \\amp, ~amp * 0.6,\n \\degree, Pseq([1, 6, 8, 6, Pwrand([11,13], [2, 1].normalizeSum)] - 1, inf),\n \\amp, Pseq([0, 1, 1, 1, 1] / 10, inf),\n \\dur, Pseq([8, 1, 1, 1, 1] / 8, inf),\n \\sustain, 0.1\n )\n).quant_([3, 0, 0, 1]);\n);\n\n(\nSystemClock.sched(0, Routine({\n a.play; 12.yield;\n b.play; 12.yield;\n c.play; 12.yield;\n c.pause; 6.yield;\n a.pause; 6.yield;\n\n b.pause; a.play; 12.yield;\n b.play; 12.yield;\n c.play; 12.yield;\n c.pause; a.pause; 6.yield;\n b.pause; 6.yield;\n}));\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Why LeakDC and not a standard HPF for DC removal?"}, {"role": "assistant", "content": "SuperCollider forum — Why LeakDC and not a standard HPF for DC removal?\n\nHello everyone,\n\nI’m a bit sceptical of the DC removal implementation in LeakDC. As I understand it, DC removal is nothing but a HPF, preferably placed below the audible range. For this purpose, LeakDC seems to be reaching far too high, attenuating the audible low frequencies. You can run the following code and look at the server meter to see the difference in level between the two audio channels (note: there is of course no DC offset in this example that would need fixing):\n\n```supercollider\n( play { [\n SinOsc.ar(50),\n LeakDC.ar(SinOsc.ar(50))\n] * 0.2 } )\n```\n\nAlso, LeakDC’s behaviour is not consistent between sample rates (as is mentioned in the help file).\n\nI ran the it through Plugin Doctor to back up my suspicions and got these results:\n\nstandard coefficient of 0.995:\n\nSR 48 kHz: Filter starts rolling off at 200 Hz, -2dB at 50 Hz.\n\nSR 96 kHz: Filter starts rolling off at 500 hz! It reaches already -2dB at 100 Hz, -5 dB at 50 Hz.\n\ncoefficient of 0.999:\n\nSR 48 kHz: Filter starts rolling off at 50 Hz, -2 dB at 10 Hz.\n\nSR 96 kHz: Filter starts rolling off at 100 Hz, -2 dB at 20 Hz.\n\nI wonder why one wouldn’t just use a standard HPF at 10 Hz (or so) instead? It is consistent between sample rates, it only starts to roll of below 30 Hz and it reaches only -0.5 dB at 20 Hz. So this actually looks much better in the server meter:\n\n```supercollider\n( play { [\n SinOsc.ar(50),\n HPF.ar(SinOsc.ar(50), 10)\n] * 0.2 } )\n```\n\nSo my question is: Is there any reason why the LeakDC implementation would be peferable to such a standard butterworth HPF?\n\nOne difference I can see is that the HPF still has an initial offset spike before settling around zero phase, LeakDC does not show that behaviour:\n\n```supercollider\n{ LeakDC.ar(DC.ar(0.5)) }.plot(0.5);\n{ HPF.ar(DC.ar(0.5), 10) }.plot(0.5);\n\n{ LeakDC.ar(SinOsc.ar + DC.ar(0.5)) }.plot(0.02);\n{ HPF.ar(SinOsc.ar + DC.ar(0.5), 10) }.plot(0.02);\n```\n\nSo this could be a reason – I don’t know enough about filters to understand why this happens though. Any enlightenment would be appreciated."}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ LPF.ar(Saw.ar(100), SinOsc.kr(0.5).exprange(200, 2000)) * 0.2 }.play;\n```"}, {"role": "assistant", "content": "A sawtooth through a low-pass filter whose cutoff is swept slowly up and down — a classic filter\nsweep.\n\n- `Saw.ar(100)` is a 100 Hz sawtooth, rich in harmonics.\n- `SinOsc.kr(0.5)` is a control-rate sine at 0.5 Hz, so one full cycle takes 2 seconds.\n- `.exprange(200, 2000)` maps that -1..1 sine exponentially onto 200..2000 Hz — exponential is the right\n mapping for frequency, because we hear pitch logarithmically.\n- `LPF.ar(sig, cutoff)` removes harmonics above the cutoff; as it opens and closes you hear the tone\n brighten and darken.\n- `* 0.2` keeps the output from clipping."}]} -{"conversations": [{"role": "user", "content": "Explain `FoaNFC` in SuperCollider briefly."}, {"role": "assistant", "content": "FoaNFC — First Order Ambisonic (FOA) near-field compensation filter Apply near-field compensation filtering to a First Order Ambisonic signal (B-format). Category: Libraries > Ambisonic Toolkit > UGens > FOA > Transformer, UGens > Multichannel > Ambisonics."}]} -{"conversations": [{"role": "user", "content": "What is a Buffer, and how is it different from a SoundFile?"}, {"role": "assistant", "content": "A Buffer is server-side memory: an array of samples (or a wavetable) living on scsynth, addressed by an integer bufnum. A SoundFile is a language-side object for reading or writing a file on disk. `Buffer.read(s, path)` loads a sound file into server memory and gives you a Buffer; `SoundFile.openRead(path)` just reads metadata such as duration and sample rate without loading audio. PlayBuf, GrainBuf and BufRd all take a Buffer, never a SoundFile."}]} -{"conversations": [{"role": "user", "content": "What does `Document.selectedString` do? What arguments does it take?"}, {"role": "assistant", "content": "Gets/sets the selected Arguments: txt — An instance of String.."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `MIDIFreqPlayer`."}, {"role": "assistant", "content": "```supercollider\n/*\n( // PlayerBinop not yet implemented\n\nPatch(\\monosynth,[\n BeatClockPlayer.new(16) * MIDIGatePlayer.new,\n MIDIFreqPlayer.new,\n CCPlayer(50,[100,3000,\\exp,0.0,1500.0]),\n CCPlayer(51,[0.1,0.9,\\exp,0.0,0.2]),\n CCPlayer(52,[0.05,1.0])\n]).play\n\n)\n*/\n```"}]} -{"conversations": [{"role": "user", "content": "What is `NamedControl`?"}, {"role": "assistant", "content": "NamedControl — Named reference to a control"}, {"role": "user", "content": "What does `NamedControl.ar` do?"}, {"role": "assistant", "content": "add a new instance of AudioControl with given name and default values. If lags are given, apply a Lag UGen to it."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// use NamedControl to create a number of multichannel controls:\n\na = { SinOsc.ar(NamedControl.kr(\\freq, [300, 330, 370], [1, 0.3, 0.02])).sum * 0.1 }.play;\na.setn(\\freq, [700, 705, 890]);\na.setn(\\freq, [0, 2, 5].midiratio * 400);\n\n// synonymous:\na = { SinOsc.ar(\\freq.kr([300, 330, 370], [1, 0.3, 0.02])).sum * 0.1 }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "How do I stop all sound?"}, {"role": "assistant", "content": "s.freeAll stops every node on the server. On the language side, Ndef.clear and Pdef.clear clear the proxies. If a Pattern is still running, Pdef(\\name).stop does it; CmdPeriod immediately stops everything scheduled on the default clock."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pbindf`."}, {"role": "assistant", "content": "```supercollider\n(\na = Pbind(\\x, Pseq([1, 2, 3]), \\zzz, 9000); // input stream\nb = Pbindf(a, \\y, Prand([100, 300, 200], inf), \\zzz, 99);\nx = b.asStream;\n);\n\nx.next(()); // pass in an event ()\nx.next(());\nx.next(());\nx.next(()); // end: nil\n\n\n\n// sound examples\n\n// using the default synth def\na = Pbind(\\dur, 0.1);\nPbindf(a, \\freq, Prand([300, 500, 231.2, 399.2], inf)).play;\nPbindf(a, \\freq, Prand([1, 1.2, 2, 2.5, 3, 4], inf) * 200).play;\n\n\n(\n// a SynthDef\nSynthDef(\\test, { |out, freq = 440, amp = 0.1, nharms = 10, pan = 0, gate = 1|\n var audio = Blip.ar(freq, nharms, amp);\n var env = Linen.kr(gate, doneAction: Done.freeSelf);\n OffsetOut.ar(out, Pan2.ar(audio, pan, env));\n}).add;\n);\n\na = Pbind(\\instrument, \\test, \\dur, 0.1);\n\nPbindf(a, \\freq, Prand([1, 1.2, 2, 2.5, 3, 4], inf) * 200).play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `FixNumChannelsPlayer.new` do? What arguments does it take?"}, {"role": "assistant", "content": "a utility Player that wraps another player with NumChannels Arguments: subject; numChannels."}]} {"conversations": [{"role": "user", "content": "What does `CompositeInstr.b` do?"}, {"role": "assistant", "content": "two Instr combined together with function composition"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Tdef`."}, {"role": "assistant", "content": "```supercollider\nTdef(\\x).play; // create an empty Tdef and play it.\n\nTdef(\\x, { loop({ \"ggggggggggggggggg9999ggg999ggg999gg\".scramble.postln; 0.5.wait }) });\n\n\nTdef(\\x, { loop({ \"---------////----------------------\".scramble.postln; 0.25.wait }) });\nTdef(\\x, { loop({ thisThread.seconds.postln; 1.wait }) });\nTdef(\\x, { loop({ thisThread.seconds.postln; 1.01.wait }) });\n\nTempoClock.default.tempo = 2;\n\nTdef(\\x, { \"the end\".postln });\nTdef(\\x, { \"one more\".postln });\nTdef(\\x, { 10.do({ \"ten more\".scramble.postln; 0.25.wait }) });\nTdef(\\x, { loop({ \"lots more\".scramble.postln; 0.25.wait }) });\n\nTempoClock.default.tempo = 1;\n\nTdef(\\x).stop;\nTdef(\\x).play;\n\nTdef(\\x).clear;\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Nested ifs in a SynthDef?"}, {"role": "assistant", "content": "```supercollider\n(\n{\nvar noise, out;\nnoise = LFNoise0.kr(8);\n\nout = if( noise > 0.0,\n if(noise > 0.5, \n if(noise > 0.9, WhiteNoise.ar(0.2), Pulse.ar(60, 0.5, 0.4)),\n SinOsc.ar(500, 0, 0.25)\n ),\n Saw.ar(160, 0.5)\n);\n\nout ! 2\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// poor man's panning\n{\n var f, hornbostelwertheimerkonstante;\n f = MouseY.kr(1, 100, 1);\n hornbostelwertheimerkonstante = 0.00063;\n Impulse.ar(f, hornbostelwertheimerkonstante * f * [1, MouseX.kr(0, 2)], 0.1) \n}.play\n```"}, {"role": "assistant", "content": "If you are too poor to afford changing the amplitudes of a stereo signal, just let the channels wait. But the signal frequency is an impasse that is to be valued in itself."}]} -{"conversations": [{"role": "user", "content": "What are the arguments of Pan2?"}, {"role": "assistant", "content": "`Pan2.ar(in, pos, level)` — in is the mono signal, pos is -1 (left) to 1 (right) with 0 in the middle, and level scales the output. It is equal-power, so a centred signal is -3 dB per channel rather than half amplitude. `Pan2.ar(sig, SinOsc.kr(0.1))` is the simplest autopan."}]} -{"conversations": [{"role": "user", "content": "Write a chord progression with Pbind."}, {"role": "assistant", "content": "Put an array of degrees in the pattern, use \\strum to spread the chord, and the default instrument\nplays all notes of each event.\n\n```supercollider\n(\nPbind(\n \\scale, Scale.minor,\n \\root, 2,\n \\degree, Pseq([[0, 4, 7], [-3, 0, 4], [-5, -1, 2], [0, 4, 7]], inf),\n \\dur, 1.5,\n \\strum, 0.02,\n \\amp, 0.12,\n \\legato, 0.9\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nd = { |out = 0, val = 1|\n SinOsc.ar(\n abs(val - LastValue.kr(val)) * 400 + 200,\n 0, 0.2\n )\n}.play;\n);\n\nd.set(\\val, 3);\nd.set(\\val, 2);\nd.set(\\val, 0.2);\nd.set(\\val, 1);\nd.set(\\val, 2;\nd.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nd = { |out = 0, val = 1|\n SinOsc.ar(\n abs(val - LastValue.kr(val)) * 400 + 200,\n 0, 0.2\n )\n}.play;\n);\n\nd.set(\\val, 3);\nd.set(\\val, 2);\nd.set(\\val, 0.2);\nd.set(\\val, 1);\nd.set(\\val, 2);\nd.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n//you must have run this line before any of the examples below\nf= BBCutBuffer(Platform.resourceDir +/+ \"sounds/break.aiff\",8);\n\nTempoClock.default.tempo_(2.3);\n\n//default\na=BBCut2(CutBuf1(f),CageCut.new).play;\n\na.end;\n\n//weirder\na=BBCut2(CutBuf1(f),CageCut(8.0,[0.2,0.3,0.4,0.1])).play;\n\na.end;\n\n//using your own permutation function\na=BBCut2(CutBuf1(f),CageCut(16.0,[1,3,3,1,1,2,2,1],{arg array; array.scramble\n// …\n```"}, {"role": "assistant", "content": "you must have run this line before any of the examples below using your own permutation function (CageCut: Automatic breakbeat cutting algorithm inspired by John Cage)"}]} -{"conversations": [{"role": "user", "content": "What is `Every` in SuperCollider?"}, {"role": "assistant", "content": "Every — holds a list of Contraints, validates that the test object satisifes all of those Given a list of contraints (or simple functions), the .value method will validate that the test object satisfies all of them. This is like chaining many (constraint and: constaint) together Category: Libraries > crucial > Constraints."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for electric guitar (a SuperCollider snippet)?"}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\noisecomb2, { arg out, gate=1, pan=0, freq=300, amp=0.1, noiselevel=0.2,\n minfreq=100, decaytime=1, doneAction=2, ffreq=500, rq=0.3, spread=0.8;\n var sig, env;\n sig = WhiteNoise.ar(noiselevel);\n sig = sig + ClipNoise.ar(noiselevel);\n sig = sig + AllpassC.ar(sig, 1/minfreq, 1/freq, decaytime);\n sig = RLPF.ar(sig, ffreq * \\ffreqtab.kr(1!10), rq);\n env = EnvGen.kr(\\adsr.kr(Env.adsr(0.6,0.1,0.8,0.1)), gate, doneAction:doneAction);\n sig = sig * env;\n sig = Splay.ar(sig, spread, 1, pan);\n sig = sig * amp;\n Out.ar(out, sig);\n}).store;\n);\n\n(\nPdef(\\plopbla, Pbind(\n \\instrument, \\noisecomb2,\n \\note, Pseq([[0,7],[1,8],[-1,5]]-2,inf),\n //\\note, Pseq([0,1,2,3,4],inf)\n \\octave, Pstep(Pseq([3,4],inf),Pseq([5,0.75],inf)),\n \\minfreq, 50,\n \\decaytime, 1.0,\n \\adsr, Pseq([\n [Env.adsr(0.02,0.1,0.8,0.4,curve:0.5)],\n [Env.adsr(0.02,0.1,0.8,0.4,curve:0.5)],\n [Env.adsr(0.02,0.1,0.8,0.4,curve:0.5)],\n [Env.adsr(0.03,0.1,0.8,0.1,curve:0.5)],\n [Env.adsr(0.03,0.1,0.8,0.1,curve:0.5)],\n [Env.adsr(0.03,0.1,0.8,0.1,curve:0.5)],\n ],inf),\n \\legato, 1.0,\n //\\ffreq, [500,610,820,140],\n \\ffreq, 500,\n //\\ffreqtab, [[0.8,1,1.1,1.2, 2,4,5,6, 8,10].scramble.postln],\n //\\ffreqtab, Pfunc{ [[ 0.1, 0.2, 0.3, 0.5, 1,2,3,8, 10, 12 ].scramble] + rrand(0.01,1.0); },\n //\\ffreqtab, [ 6, 4, 5, 10, 1, 1.2, 0.8, 1.1, 2, 8 ], // also nice\n \\ffreqtab, [[ 6, 4, 5, 10, 1, 1.2, 0.8, 0.4, 2, 8 ]],\n \\dur, Pseq([3,1,1, 0.25,0.25,0.25],inf),\n \\amp, 1.1\n)).play;\n);\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `Class` in SuperCollider briefly."}, {"role": "assistant", "content": "Class — A Class describes the structure and implementation of a set of objects which are its instances. Category: Core > Kernel, Language > OOP."}]} -{"conversations": [{"role": "user", "content": "What does `OSCSched.xtsched` do? What arguments does it take?"}, {"role": "assistant", "content": "exclusive time based schedule any previous bundles scheduled using xtsched, xsched or xqsched will be cancelled. this is incredibly useful in situations where several bundles might be sent and you only want the last one to be used as the final answer. example: a monkey is hitting many buttons, changing his mind about which sound to play next. this would result in many bundles being stacked up all at the same time, and the server would choke trying to execute them all. so Arguments: seconds; server; bundle; onArrival."}]} -{"conversations": [{"role": "user", "content": "What does `Platform.platformDir` do?"}, {"role": "assistant", "content": "platform specific directory for class files (see"}]} -{"conversations": [{"role": "user", "content": "Explain `Pulse` in SuperCollider briefly."}, {"role": "assistant", "content": "Pulse — Band limited pulse wave. Band limited pulse wave generator with pulse width modulation. Category: UGens > Generators > Deterministic."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LastValue`."}, {"role": "assistant", "content": "```supercollider\n(\nd = { |out = 0, val = 1|\n SinOsc.ar(\n abs(val - LastValue.kr(val)) * 400 + 200,\n 0, 0.2\n )\n}.play;\n);\n\nd.set(\\val, 3);\nd.set(\\val, 2);\nd.set(\\val, 0.2);\nd.set(\\val, 1);\nd.set(\\val, 2);\nd.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Very quick-and-dirty hack to show stereo phase."}, {"role": "assistant", "content": "```supercollider\n(\nb = Bus.audio(s, 2);\na = { |inbus = 0|\n var sig = In.ar(inbus, 2);\n // x axis is side, oriented toward right;\n // y axis is mid\n [sig[1] - sig[0], sig.sum]\n}.play(s.defaultGroup, outbus: b, addAction: \\addAfter);\nc = s.scope;\nc.style = 2;\nc.bus = b;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Environment`."}, {"role": "assistant", "content": "```supercollider\n(\na = Environment.make({\n ~a = 100;\n ~b = 200;\n ~c = 300;\n});\na.postln;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code:\n```supercollider\n{ SinOsc.ar(440) * EnvGen.kr(Env.perc(0.01, 1), doneAction: 2) }.play;\n```"}, {"role": "assistant", "content": "It plays a 440 Hz sine with a percussive envelope, and the Synth frees itself when the envelope\nends.\n\n- `SinOsc.ar(440)` is an audio-rate sine at 440 Hz.\n- `Env.perc(0.01, 1)` is a 10 ms attack to full level then a 1 s decay to zero.\n- `EnvGen.kr(...)` plays that envelope at control rate and multiplies the sine, so the sound fades out.\n- `doneAction: 2` frees the Synth at the end of the envelope, so it does not accumulate silent nodes.\n- `.play` on the function builds an anonymous SynthDef and starts one Synth of it."}]} -{"conversations": [{"role": "user", "content": "What is `Tdef`?"}, {"role": "assistant", "content": "Tdef — task reference definition"}, {"role": "user", "content": "What does `Tdef.all` do?"}, {"role": "assistant", "content": "A global IdentityDictionary with all proxies."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nTdef(\\x, { loop { 0.5.wait; \"aaaaaaaaaaaaaazz\".scramble.postln } }).play;\nTdef(\\x, { loop { 0.125.wait; \"aazz\".scramble.postln } });\nTdef(\\x, { loop { 0.5.wait; (note: 14.rand).play } });\nTdef(\\x, { loop { 0.5.wait; (note: 14.rand + [0, 3, 6, 7].keep(4.rand)).play } });\nTdef(\\x).stop;\nTdef(\\x).play;\nTdef(\\x).clear;\n```"}]} -{"conversations": [{"role": "user", "content": "What is `AbstractDispatcher` in SuperCollider?"}, {"role": "assistant", "content": "AbstractDispatcher — Dispatches incoming messages to Functions Instances of AbstractDispatcher dispatch incoming messages (e.g. MIDI, OSC), to registered instances of AbstractResponderFunc. There will be a default dispatcher for each message type, but one can have multiple dispatchers per type in order to implement custom dispatching for groups of ResponderFuncs. (The main example of this is OSC pattern matching with OSCMessagePatternDispatcher.) Normally use Category: External Control > Abstract Classes."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Control`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_Control, { |freq = 200|\n\n freq.inspect; // at the time of compiling the def\n\n}).add\n);\n\n// synonym:\n(\nSynthDef(\\help_Control, {\n\n \\freq.kr(200).inspect; // at the time of compiling the def\n\n}).add\n);\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Ppar two intrument cumbia base."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\bass, { | atk = 0.01, dur = 0.15, freq = 50, amp=0.8 |\n var env, osc;\n env = EnvGen.kr( Env.perc( atk, dur-atk, amp, 6 ), doneAction: 2 );\n osc = BPF.ar(LFSaw.ar(freq), freq, 2, mul: env) ! 2;\n Out.ar([0,1],osc);\n}).add;\n);\n\n(\nSynthDef('wiro', { | amp = 0.1 |\n var osc, env, noise, out;\n noise = LPF.ar(WhiteNoise.ar(1),6000);\n osc = HPF.ar(noise,2000);\n //env = Line.ar(1, 0, 0.1);\n env = EnvGen.kr(Env.perc(0.01,0.05), doneAction: 2);\n out = (osc * env);\n Out.ar([0,1],out*amp)\n}).add;\n);\n\n(\nPpar([\n Pbind(\n \\instrument, \\bass,\n \\degree, Pseq([ Pseq([Pn(Pshuf([0,2,4],1),2),Pn(Pshuf([3,5,7],1),2)],2),Pn(Pshuf([-3,-1,1],1),2) ],inf),\n \\dur, Pseq([0.25,0.5,0.25],inf),\n \\legato, Pseq([ Pgeom(0.05, 0.05, 40), Pgeom(2.05, -0.05, 40) ], inf),\n \\octave, 3,\n \\amp, 0.03\n ),\n\n Pbind(\n \\instrument, \\wiro,\n \\dur, Pseq([0.5,0.25,0.25], inf),\n \\legato, Pseq([ Pgeom(0.05, 0.05, 40), Pgeom(2.05, -0.05, 40) ], inf),\n \\amp, 0.05,\n )\n]).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(//*********PREPARE**********\np.pop;\n//Any code that needs to access your own environment goes here\np = ProxySpace.push(s);\n~fxLoop.play.fadeTime_(5);\n);\n\n(//*********FXLoop**********\n~fxLoop = {\n var in = SoundIn.ar([0,1]);\n // in = in + (in * SinOsc.ar(LFTri.ar([0.1, 0.09]).range(215, 321)));\n in = in + CombC.ar(in, 2, SinOsc.ar(0.015).range(0.5, 1) * [0.13, 0.17], 7);\n in = in + CombC.ar(in, 2, SinOsc.ar(0.01).range(0.5, 1) * [0.1, 0.15], 7);\n in = in + CombC.ar(in, 2, [1.5, 1.0], 7);\n in = in + GVerb.ar(in, 10);\n in = in / 3;\n in;\n}\n)\n```"}, {"role": "assistant", "content": "Audio Sample: https://soundcloud.com/schemawound/supercollider-guitar-fx-test."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for smooth arpeggio, updated envelope (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\bass, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.perc(0.2), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `PLbeta.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new PLbeta Arguments: lo — Symbol or Pbeta lo arg. If a Symbol is passed, list can be assigned to an envir variable later on. Can be dynamically replaced by Patterns or Streams. Defaults to 0.; hi — Symbol or Pbeta hi arg. If a Symbol is passed, list can be assigned to an envir variable later on. Can be dynamically replaced by Patterns or Streams. Defaults to 1.; prob1 — Symbol or Pbeta prob1 arg. If a Symbol is passed, list can be assigned to an envir variable later on. Can be dynamically replaced by Patterns or Streams. Defaults to 1.; prob2 — Symbol or Pbeta prob2 arg. If a Symbol is passed, list can be assigned to an envir variable later on. Can be dynamically replaced by Patterns or Streams. Defaults to 1.; length — Symbol or Pbeta length arg. If a Symbol is passed, list can be assigned to an envir variable later on. Defaults to inf.; envir — Dictionary or one of the Symbols \\top, \\t (topEnvironment), \\current, \\c (currentEnvironment). Dictionary to be taken for variable reference. Defaults to \\current.."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for cosmic organ expansion )."}, {"role": "assistant", "content": "```supercollider\n(\nfork {\n TempoClock.tempo = 1;\n Ndef(\\ttso).play;\n loop {\n var seed = thisThread.randSeed = 100000000.rand.debug('seed');\n var wait = 20.rrand(60).debug('wait');\n Ndef(\\ttso, {\n var gamma= {[rrand(30,50),rrand(50,70),rrand(50,70),rrand(70,100)].choose.midicps*LFNoise2.kr(1,0.01,1)}!24;\n Pan2.ar(\n LeakDC.ar(\n Normalizer.ar(\n BPeakEQ.ar(\n FreeVerb.ar(\n Splay.ar(RLPF.ar(LFSaw.ar(gamma)/4,gamma*LFCub.kr(rrand(0.01,0.1),0,2,3),LFNoise2.kr(1/8,0.6,0.7))),\n 0.1,0.1,0.1\n ),\n [100.rrand(200),1000.rrand(2000),5000.rrand(7000),10000.rrand(15000)],Array.rand(4,0,6),Array.rand(4,0,6)\n ).mean,\n 0.8,0.1\n )\n ),\n LFNoise2.kr(0.1.exprand(10)).range(-0.1,0.1),\n SelectX.kr(\n [SinOsc,LFTri].choose.kr(2.rrand(25).reciprocal).range(0,2),\n [\n 0.7.rrand(1),\n LFGauss.kr(\n Latch.kr(\n LFNoise2.kr(1).range(1/5,5.rrand(20)).reciprocal, \n Impulse.kr(LFNoise2.kr(3.rrand(10).reciprocal).range(0.5,3.rrand(6)))\n ),\n SinOsc.kr(3.rrand(15).reciprocal).range(0.07.rrand(0.16),0.25.rrand(0.4))\n ),\n 0.1.rrand(0.5)\n ]\n )\n )\n }).fadeTime_(3.rrand(6));\n wait.wait;\n }\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `UnicodeResponder.guiClass` do?"}, {"role": "assistant", "content": "register responder functions for unicode and modifier combinations"}]} -{"conversations": [{"role": "user", "content": "Explain `CytonWifi` in SuperCollider briefly."}, {"role": "assistant", "content": "CytonWifi — for communicating with a Cyton board (8ch) this class is for communication via wifi osc (wifishield). use CytonSerial for the bluetooth dongle. Category: External Control."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ParGroup`."}, {"role": "assistant", "content": "```supercollider\nfork {\n p = ParGroup.new;\n loop {\n (\n degree: rrand(0.0, 12.0).round(1/4),\n group: p,\n db: rrand(-30, -25),\n pan: rrand(-1.0, 1.0)\n ).play;\n 0.2.wait;\n }\n}\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Shift register patch (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n/*\nShift register code adapted from here:\n\n\"http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/serial-in-parallell-out-shift-register-ugen-td6331387.html\"\n*/\n\n(\n~shift_register = {arg length = 5, trig, in;\n \n var buf = LocalBuf(length);\n var count = PulseCount.kr(trig);\n \n Demand.kr(trig, 0, Dbufwr(in, buf, count));\n Demand.kr(trig, 0, Dbufrd(buf, count + (1..length))).reverse;\n};\n\nNdef(\\n1, {\n\n var amp = 0.1;\n var pulse = Impulse.kr(1/16);\n var rate = TChoose.kr(pulse, [3,5,10]);\n var trans = TChoose.kr(pulse, [0,2,-2,7,-5]);\n\n //var trig = Impulse.kr([3,5]/2);\n var trig = Trig1.kr(CuspL.ar(rate * 3), 0.001);\n var octave = Demand.kr(PulseDivider.kr(trig, 4), 0, Drand([12,-12], inf));\n var note = Demand.kr(trig, 0, Dseq([42,46,51,54,59,63,66].scramble + trans, inf) + octave);\n var chord = ~shift_register.(5, trig, note);\n\n var sig = PMOsc.ar(\n Vibrato.ar(K2A.ar(chord.midicps)),\n chord.midicps * LFPulse.kr(1/8).range(1.01, 2.01),\n Env([3,3,0],[0, 0.2], -4).kr(gate:trig)\n );\n sig = sig * AmpCompA.kr(chord.midicps) * amp;\n\n sig = sig.flatten.sum;\n sig = XFade2.ar(sig!2, GVerb.ar(BPF.ar(sig, 90.midicps), roomsize:50, revtime:8, drylevel:0), 0.2);\n sig;\n\n}).play(fadeTime:4);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Array2D.asArray` do?"}, {"role": "assistant", "content": "Return a flat array containing the elements. Returns: Array"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\nz = { // toy with boost/cut\nBPeakEQ.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(20, 20000, \\exponential),\n 0.8, // rq\n MouseY.kr(12.0, -12.0, \\linear),\n 0.5); // mul\n}.play)\nz.release;\n\n(\nz = { // toy with rq\nBPeakEQ.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(20, 20000, \\exponential),\n MouseY.kr(10, 0.4, \\linear), // rq\n 6, // boost/cut - +6dB\n 0.5); // mul\n}.play\nz.release;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\nz = { // toy with boost/cut\nBPeakEQ.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(20, 20000, \\exponential),\n 0.8, // rq\n MouseY.kr(12.0, -12.0, \\linear),\n 0.5); // mul\n}.play)\nz.release;\n\n(\nz = { // toy with rq\nBPeakEQ.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(20, 20000, \\exponential),\n MouseY.kr(10, 0.4, \\linear), // rq\n 6, // boost/cut - +6dB\n 0.5); // mul\n}.play)\nz.release;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n// restricting fm to harmonic sidebands after\n// [Chowning, 1973] Chowning, J. (1973). The synthesis of complex spectra by means of frequency modulation. Journal of the Audio Engineering Society, 21(7):526–534.\n// restriction actually happens because of the specs, not server-side.\n\nSpec.add(\\index, [0, 40]);\nSpec.add(\\harm1, [0, 20, \\lin, 1]);\nSpec.add(\\harm2, [0, 20, \\lin, 1]);\nSpec.add(\\fundFreq, \\freq);\n\nNdef(\\fmk, {\n \n PMOsc.ar(\n \\carFreq.kr(100, 0.1), \n (\\harm1.kr(1, 1)/(\\harm2.kr(1, 1)) * LFNoise1.ar(50).range(0.995, 1.001))*\\carFreq.kr(100), \n \\index.kr(1, 0.1) * SinOsc.ar(2.5).range(0.995, 1.005)\n ) \n})\n);\nNdef(\\fmk).gui\n```"}, {"role": "assistant", "content": "Restricting fm to harmonic sidebands after[Chowning, 1973]. Restriction actually happens because of the specs, not server-side.\r\n----- \r\nChowning, J. (1973). The synthesis of complex spectra by means of frequency modulation. Journal of the Audio Engineering Society, 21(7):526–534."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for radio static with tuning noise (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"radiostatic\", {arg out=0;\n var hum, sineSweep, tuning, dustNoise, staticNoise, humFreq, numHarms;\n \n numHarms = 7;\n humFreq = 100;\n hum = Array.fill(numHarms, {|i| SinOsc.ar( (i+1) * humFreq, 0, 1/numHarms)});\n hum = hum.sum;\n dustNoise = Dust.ar(LFNoise1.ar(0.5).range(1000,8000));\n staticNoise = hum * dustNoise * LFNoise1.ar(1).range(0.5, 2);\n \n sineSweep = SinOsc.ar(LFNoise2.ar(1).range(20, 11000));\n tuning = SinOsc.ar(10000).ring4(sineSweep) * LFNoise2.ar(1.1).range(0.05, 0.1);\n\n Out.ar(out, Pan2.ar(staticNoise + tuning, 0));\n}).add;\n);\n \na = Synth(\"radiostatic\");\n```"}]} -{"conversations": [{"role": "user", "content": "What does `UnicodeResponder.registerAll` do? What arguments does it take?"}, {"role": "assistant", "content": "register responder functions for unicode and modifier combinations Arguments: ... sets."}]} -{"conversations": [{"role": "user", "content": "The server stopped responding. What do I do?"}, {"role": "assistant", "content": "In order: `Ctrl+.` (CmdPeriod) to reset scheduling, then `s.reboot` if the server itself is wedged.\nA reboot drops every SynthDef and buffer, so re-add them — which is why real projects keep their SynthDefs\nin a file you can re-evaluate rather than typing them in the REPL.\n\nIf the boot itself fails, the post window has the reason: usually the audio device (another application\nholding exclusive access) or a sample-rate mismatch. `Server.default.options.device` picks a device before\n`s.boot`."}]} -{"conversations": [{"role": "user", "content": "What does `EaseInQuart.value` do? What arguments does it take?"}, {"role": "assistant", "content": "Quartic ease-in Arguments: t — a Float between 0.0 and 1.0.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\nb = Buffer.alloc(s, 512, 1);\nb.sine1(1.0 / [1, 2, 3, 4], true, true, true);\nx = { Osc.ar(b, 200, 0, 0.5) }.play;\n;\nx.free; b.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\nb = Buffer.alloc(s, 512, 1);\nb.sine1(1.0 / [1, 2, 3, 4], true, true, true);\nx = { Osc.ar(b, 200, 0, 0.5) }.play;\n);\nx.free; b.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Detune idea is from James Harkins."}, {"role": "assistant", "content": "```supercollider\n(\na = {\n |freq = 40, wid = 0.5|\n Mix(LFPulse.ar(freq *((Array.fill(40, Pxrand((1, 2..20), inf).iter)/1000)+1),\n 0, wid, 0.05)\n ).dup\n}.play;\n);\n\n//more distorsion\n~widlfo = {Saw.kr(0.5).range(0,1)};\na.set(\\wid, ~widlfo);\n\n//stop\na.release;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// Function to check an array for repetitions within a maximum test span\n\n~repetitionCheck = { |array, maxTestSpan|\n maxTestSpan.do { |i|\n var result = (array.drop(i+1) - array).drop((i+1).neg).includes(0).not;\n (\"no repetitions within a span of \" ++ (i+2).asString ++ \" items: \").post;\n result.postln;\n }\n};\n\n// prepare buffer to store DIdev values \n\nn = 10000; // buffer size\nr = 10000; // trigger rate\nb = Buffer.alloc(s, n);\n);\n\n\n// run to store, wait until finished (a bit more than 1 second)\n(\n{\n var trig = Impulse.ar(r);\n D\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// Function to check an array for repetitions within a maximum test span\n\n~repetitionCheck = { |array, maxTestSpan|\n maxTestSpan.do { |i|\n var result = (array.drop(i+1) - array).drop((i+1).neg).includes(0).not;\n (\"no repetitions within a span of \" ++ (i+2).asString ++ \" items: \").post;\n result.postln;\n }\n};\n\n// prepare buffer to store DIdev values \n\nn = 10000; // buffer size\nr = 10000; // trigger rate\nb = Buffer.alloc(s, n);\n);\n\n\n// run to store, wait until finished (a bit more than 1 second)\n(\n{\n var trig = Impulse.ar(r);\n Demand.ar(trig, 0, Dbufwr(DIdev(Dbrown(0, 20, 0.3).round, 5, -7, 7), b, Dseries(0, 1, n), 0));\n Line.ar(dur: n / r + 0.1, doneAction: 2);\n 0\n}.play;\n);\n\n// move data to language\n\nb.loadToFloatArray(action: { |x| a = x.asInteger; \"array filled \\n\".postln; })\n\n\n// no repetitions within a maximum span of 6 (maxLookBack was 5)\n\n~repetitionCheck.(a, 10);\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Sinking in the Ocean (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nx= {\n var lfn = LFNoise2.kr(1);\n var saw = Saw.ar(\n freq: 30,\n mul: LFPulse.kr(\n freq: LFNoise1.kr(1).range(1, 5),\n width: 0.1));\n var bpf = BPF.ar( in: saw, freq: lfn.range(300, 1000), rq: 0.01, mul: 20);\n Pan2.ar(in: bpf, pos: lfn);\n}.play;\n\n\n{LPF.ar(\n in: WhiteNoise.ar(mul: 0.2),\n freq: LFNoise1.kr(1).range(100, 1000)\n)\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `TempoGui` in SuperCollider?"}, {"role": "assistant", "content": "TempoGui — gui class a slider and number box to control the current Tempo in bpm Category: Libraries > crucial > GuiClasses."}]} +{"conversations": [{"role": "user", "content": "What does `ServerOptions.numWireBufs` do?"}, {"role": "assistant", "content": "The maximum number of buffers that are allocated to interconnect unit generators. (Not to be confused with the global sample buffers represented by Buffer.) This sets the limit of complexity of SynthDefs that can be loaded at runtime. This value will be automatically increased if a more complex def is loaded at startup, but it cannot be increased thereafter without rebooting. The default is"}]} +{"conversations": [{"role": "user", "content": "Supernova, Groups, Threads, Ndef?"}, {"role": "assistant", "content": "SuperCollider forum — Supernova, Groups, Threads, Ndef?\n\nAbout Ndef:\n\nAFAIK you can manually move a NodeProxy’s group into another group:\n\n```supercollider\n~pargroup = ParGroup(s);\n\nNdef(\\a, { Silent.ar(1) });\n\nNdef(\\a).group.moveToHead(~pargroup);\n```\n\nBut...\n\nNodeProxies use InFeedback.\n\nI was a little suspicious about this for parallel processing. As I recalled, InFeedback’s result depends on the order of execution:\n\n-\nIf the source node for the bus finished processing before the server reaches InFeedback, then InFeedback will output the block of audio being processed now.\n\n-\nIf the source node comes after the node containing InFeedback, then it will output the previous block of audio.\n\nIn both cases, these are the most recently available audio blocks. But, if the order of evaluation is not consistent, then the output may not be consistent.\n\nLet’s test that:\n\n```supercollider\nb = Bus.audio(s, 1);\n\na = { SinOsc.ar(200, 0, 0.1) }.play(outbus: b);\n\nc = { InFeedback.ar(b, 1).dup }.play(target: a, addAction: \\addAfter);\n\n(\nfork {\n var order = Pseq([\\moveBefore, \\moveAfter], inf).asStream;\n loop {\n c.perform(order.next, a);\n 1.0.wait;\n }\n}\n)\n```\n\nOops.\n\nThis means you can’t randomly throw Ndefs into ParGroups. If one Ndef reads a signal from another, then you have to make sure that the target Ndef comes later in a serial (regular) Group. (Correctness of the result should be more important than “optimal” usage of multiple cores.)\n\nIf you don’t, and if supernova happens to put the source and target Ndefs onto separate cores at roughly the same time, then the target might evaluate InFeedback either before or after the source finishes, and there’s no guarantee of this being consistent. So you might get clicks.\n\nhjh"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, gate = 1|\n var env;\n env = EnvGen.kr(Env.asr(0.001, 1, 0.2), gate, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain, \\freq, 440);\nb = Padd(\\freq, Pseq([10, 30, 100], inf), a);\nb.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, gate = 1|\n var env;\n env = EnvGen.kr(Env.asr(0.001, 1, 0.2), gate, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain, \\freq, 440);\nb = Padd(\\freq, Pseq([10, 30, 100], inf), a);\nb.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `CoinGate` in SuperCollider?"}, {"role": "assistant", "content": "CoinGate — Statistical gate. When CoinGate receives a trigger, it tosses a coin and either passes the trigger or doesn't. Category: UGens > Generators > Stochastic."}]} +{"conversations": [{"role": "user", "content": "What is `Interpreter`?"}, {"role": "assistant", "content": "Interpreter — The interpreter defines a context in which interactive commands are compiled and executed."}, {"role": "user", "content": "What does `Interpreter.clearAll` do?"}, {"role": "assistant", "content": "set the values of the variables `a` through `z` to nil. `x = 123;`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// typical usage\na = 4;\nb = 3;\nb = b + a;\n\n// some sound\na = Synth(\\default);\ng = fork { loop { 0.1.wait; a.set(\\freq, 200 + 20.0.rand2.postln) } };\ng.stop; a.free;\n\n// an overview of all the variables\nthis.inspect;\n```"}]} {"conversations": [{"role": "user", "content": "Resizing FreqScope?"}, {"role": "assistant", "content": "SuperCollider forum — Resizing FreqScope?\n\nOddly, this seems to work:\n\n```supercollider\n// max partial = 20 kHz\n// do not play this loudly\na = { Blip.ar(100, 200, 0.02).dup }.play;\n\nv = FreqScope(800, 600); // top partial is shown below 1.75 kHz (?)\n\nv.scope.scope.xZoom = 1; // seems correct, by eyeballing\n\n// let's try another resolution\nv = FreqScope(600, 500);\nv.scope.scope.xZoom = 1; // hm, zoom = 1 seems OK here too\n```\n\nFreqScope includes the line scope.xZoom_((scope.bufSize*0.25) / width); so it may be that this calculation is incorrect. I’m unclear, for instance, why it’s dividing by width – apparently zooming out for larger windows...?\n\nBut I tried three different widths (800x600, 600x500, 200x150), and for all of them, xZoom = 1 appeared to be correct. It’s possible that this calculation is vestigial, then – maybe we needed it for the older version of frequency scope, but the Qt version might not need it at all.\n\nhjh"}]} -{"conversations": [{"role": "user", "content": "What does `HoaBalance.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Higher Order Ambisonic (HOA) balance transformer Arguments: in — The input signal.; angle — Distortion angle, in radians. -pi/2 to pi/2; radius — Radius, in meters.; order — Ambisonic order.."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Midterm Q2 (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"sawSynth\",{arg freq, amp;\n var env, snd;\n\n env = Env.perc(\n attackTime:0.1,\n releaseTime:2,\n level:amp).kr(doneAction: 2);\n snd = Saw.ar(\n freq:freq*[0.99, 1.0, 1.001, 1.008],\n mul: env);\n snd = LPF.ar(in: snd,freq:2000);\n snd = Splay.ar(snd);\n Out.ar(0,snd);\n\n}).add;\n);\n\n(\nPbind(\n \\instrument, \"sawSynth\",\n \\freq, Pwhite(300, 700, inf),\n \\amp, Pwhite(0.15, 0.2)\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Klank`."}, {"role": "assistant", "content": "```supercollider\n{ Klank.ar(`[[800, 1071, 1153, 1723], nil, [1, 1, 1, 1]], Impulse.ar(2, 0, 0.1)) }.play;\n\n{ Klank.ar(`[[800, 1071, 1353, 1723], nil, [1, 1, 1, 1]], Dust.ar(8, 0.1)) }.play;\n\n{ Klank.ar(`[[800, 1071, 1353, 1723], nil, [1, 1, 1, 1]], PinkNoise.ar(0.007)) }.play;\n\n{ Klank.ar(`[[200, 671, 1153, 1723], nil, [1, 1, 1, 1]], PinkNoise.ar([0.007, 0.007])) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nMIDIIn.connect;\ns.boot;\n\n(\nSynthDef(\"sik-goo\", { |out, freq = 440, formfreq = 100, gate = 0.0, bwfreq = 800|\n var x;\n x = Formant.ar(\n SinOsc.kr(0.02, 0, 10, freq),\n formfreq,\n bwfreq\n );\n x = EnvGen.kr(Env.adsr, gate, Latch.kr(gate, gate)) * x;\n Out.ar(out, x);\n}).add;\n);\n\nx = Synth(\"sik-goo\");\n\n// set the action:\n(\n~noteOn = { |src, chan, num, vel|\n x.set(\\freq, num.midicps / 4.0);\n x.\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nMIDIIn.connect;\ns.boot;\n\n(\nSynthDef(\"sik-goo\", { |out, freq = 440, formfreq = 100, gate = 0.0, bwfreq = 800|\n var x;\n x = Formant.ar(\n SinOsc.kr(0.02, 0, 10, freq),\n formfreq,\n bwfreq\n );\n x = EnvGen.kr(Env.adsr, gate, Latch.kr(gate, gate)) * x;\n Out.ar(out, x);\n}).add;\n);\n\nx = Synth(\"sik-goo\");\n\n// set the action:\n(\n~noteOn = { |src, chan, num, vel|\n x.set(\\freq, num.midicps / 4.0);\n x.set(\\gate, vel / 200);\n x.set(\\formfreq, vel / 127 * 1000);\n};\nMIDIIn.addFuncTo(\\noteOn, ~noteOn);\n\n~noteOff = { |src, chan, num, vel|\n x.set(\\gate, 0.0);\n};\nMIDIIn.addFuncTo(\\noteOff, ~noteOff);\n\n~bend = { |src, chan, val|\n // (val * 0.048828125).postln;\n x.set(\\bwfreq, val * 0.048828125);\n};\nMIDIIn.addFuncTo(\\bend, ~bend);\n);\n\n// cleanup\nMIDIIn.removeFuncFrom(\\noteOn, ~noteOn);\nMIDIIn.removeFuncFrom(\\noteOff, ~noteOff);\nMIDIIn.removeFuncFrom(\\bend, ~bend);\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n/* Audio plugin definition\n\n Each audio plugin should define the following global variables:\n ~name: (symbol) name of the spatializer\n ~description: (string) a short description\n ~function: the actual definition of the plugin\n\n*/\n\n~name = \\Limiter;\n~description = \"A simple limiter\";\n~channelLayout = \\mono;\n\n~function = { arg in, level=0.7, dur=0.01, outputDB=0;\n outputDB.dbamp * Limiter.ar(In.ar(in), level, dur);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "What does `NearestN.kr` do? What arguments does it take?"}, {"role": "assistant", "content": "Find the nearest-neighbours in a set of points Arguments: treebuf — a Buffer containing data which MUST be in the special format created using the KDTree class and NearestN.makeBufferData; in — An array representing the input point. Num channels must match the dimensionality of the points in the dataset; gate — The unit is active while gate > 0. While <=0, no search is performed and output is held steady; num — Number of points to retrieve. NOT modulatable.. Returns: A flat array containing (3 * num) channels, which is a ranked list of the nearest items (the very nearest coming first). For each match, this returns three channels [treeindex, distancesquared, label]"}]} -{"conversations": [{"role": "user", "content": "What does `Select.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Select output from an array of inputs. Arguments: which — Integer index; array — Input array of signals."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// (thor magnusson) (2006)\n\n// An instrumentalist inside a synthdef.\n\n(\nSynthDef(\\drummer, { arg out=0, tempo=4;\n var snare, base, hihat;\n tempo = Impulse.ar(tempo); // for a drunk drummer replace Impulse with Dust !!!\n\n snare = WhiteNoise.ar(Decay2.ar(PulseDivider.ar(tempo, 4, 2), 0.005, 0.5));\n base = SinOsc.ar(Line.ar(120,60, 1), 0, Decay2.ar(PulseDivider.ar(tempo, 4, 0), 0.005, 0.5));\n hihat = HPF.ar(WhiteNoise.ar(1), 10000) * Decay2.ar(tempo, 0.005, 0.5);\n\n Out.ar(out,(snare + base + hihat) * 0.4 ! 2)\n}).add;\n);\n\na = Synth(\\drummer);\na.set(\\tempo, 6);\na.set(\\tempo, 18);\na.set(\\tempo, 180); // check the CPU! no increase.\na.free;\n```"}, {"role": "assistant", "content": "(thor magnusson) (2006) An instrumentalist inside a synthdef."}]} -{"conversations": [{"role": "user", "content": "I get 'Buffer UGen: no buffer data'. What does it mean?"}, {"role": "assistant", "content": "The UGen got a bufnum that the server has no data for. `Buffer.read` is asynchronous: the Buffer object exists immediately but the samples arrive later, so a Synth created straight after `Buffer.read` reads nothing. Wait for it — `s.sync` after the read, or `Buffer.read(s, path, action: { |b| ... })` and create the Synth in the action. The other cause is a nil or wrong buffer: `PlayBuf.ar(1, ~buf)` where ~buf was never assigned passes 0, which is 'no buffer'."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\sub;\n~description = \"Dedicate a channel to subwoofer signal. Ideally use with monoSpat spatializer\";\n~channelLayout = \\mono;\n~function = { |in = 0, sub_gainDB = -99, sub_lpHz = 200|\n LPF.ar(in, sub_lpHz.clip(5.0, 18000)) * sub_gainDB.dbamp\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `CuspL`."}, {"role": "assistant", "content": "```supercollider\n// vary frequency\n{ CuspL.ar(MouseX.kr(20, SampleRate.ir), 1.0, 1.99) * 0.3 }.play(s);\n\n// mouse-controlled params\n{ CuspL.ar(SampleRate.ir/4, MouseX.kr(0.9, 1.1, 1), MouseY.kr(1.8, 2, 1)) * 0.3 }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(CuspL.ar(40, MouseX.kr(0.9, 1.1, 1), MouseY.kr(1.8, 2, 1))*800+900)*0.4 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "What is the difference between the language and the server?"}, {"role": "assistant", "content": "sclang runs your code, the clock and Patterns, and builds UGen graphs. scsynth performs the DSP in real time. They communicate over OSC, which is why a language-side mistake can leave a sound running, and why s.freeAll stops it."}]} -{"conversations": [{"role": "user", "content": "Rand or rand difference?"}, {"role": "assistant", "content": "SuperCollider forum — Rand or rand difference?\n\nI think you meant to compare Rand and rrand (not rand) – both generate a random number between a given low and high, but Rand is intended to be used inside a SynthDef and the behavior is slightly different. Compare:\n\n```supercollider\n(\nSynthDef(\\test, {\n var freq = rrand(400, 600);\n Out.ar(0, SinOsc.ar(freq) * 0.2);\n}).add;\n);\n\nSynth(\\test); // run and stop multiple times: always same freq\n\n(\nSynthDef(\\test2, {\n var freq = Rand(400, 600);\n Out.ar(0, SinOsc.ar(freq) * 0.2);\n}).add;\n);\n\nSynth(\\test2); // run and stop multiple times: every time a different freq\n```\n\nAs you can read in the help file, Rand is intended to be used inside SynthDefs when you want the particular behavior of a newly generated random frequency for each Synth called. You can use rrand(lo, hi) inside a SynthDef too, if you want the random number to be generated only once at time of SynthDef creation (it gets “inscribed in the recipe” for good), so all future and all Synth calls based on that SynthDef to use on that same random number.\n\nAs a side note, rand (as opposed to rrand) generates a random number between zero and the receiver:\n\n```supercollider\nrand(8); // random numbers between 0 and and 8 (excluding 8)\n\nrand(0.5, 8); // random numbers between 0 and 0.5; second argument is ignored here\n```\n\nAlso in regards to the specific way you present the example (as Functions, indicated by the curly braces): note the difference when you evaluate them:\n\n```supercollider\n{Rand(0.5,8)}.value; // returns 'a Rand'\n{rrand(0.5,8)}.value; // returns an actual random choice between lo and hi\n```\n\nHope this helps,\n\nB"}]} -{"conversations": [{"role": "user", "content": "What does `SinOsc.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Interpolating sine wavetable oscillator. Arguments: freq — Frequency in Hertz. Sampled at audio-rate.; phase — Phase in radians. Sampled at audio-rate.; mul — Output will be multiplied by this value.; add — This value will be added to the output.."}]} -{"conversations": [{"role": "user", "content": "What does `WebView.onJavaScriptMsg` do?"}, {"role": "assistant", "content": "Sets the object to be evaluated when a javascript console message is"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for lurking line noise."}, {"role": "assistant", "content": "```supercollider\n({var\n rf = 7\n , rt = Impulse.kr(rf)\n , bs = 8.collect({|i| PulseDivider.kr(rt, 16, i*2)})\n , bt = bs[0] + bs[2] + Dust.kr(SinOsc.kr(0.01, 0, 0.25, 0.25))\n , be = Decay.kr(bt, 0.2)\n , se = Decay.kr(bs[5]+bs[6], 0.01)\n , bass = be*SinOsc.ar(SinOsc.ar([5,6], 0, 20, \n Demand.kr(bt, 0, Drand((30..48), inf)).midicps\n ))\n , snar = se*SinOsc.ar(2000+[0, 5])\n , off = (LPF.kr(BrownNoise.kr([1,1]), 10)**(1/3))>0\n , hat = DelayL.kr(Decay.kr(Mix.kr(bs), 0.01), 20, rf.reciprocal*off)*PinkNoise.ar\n , line = Saw.ar(50)*0.1*(LFNoise0.kr(50)>0)*SinOsc.kr(0.1, 0, 0.4, 0.45)\n ;\n Out.ar(0, FreeVerb.ar(bass+snar + hat + line, \n SinOsc.kr(0.01, 0, 0.4, 0.5), \n 0.8, 0.5))\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for some scale stuff by a novice-SC lovable unicorn."}, {"role": "assistant", "content": "```supercollider\n(\ns.newBusAllocators;\ns.options.numOutputBusChannels = 2;\n~reverbBus = Bus.audio(s,2);\n\ns.waitForBoot({\n\n Buffer.freeAll;\n ~scale1 = Buffer.loadCollection(\n s,Scale.new(#[0,7,15.93,5,9.7,12,17.5,13.1],12));\n\n SynthDef(\\rainbow,{\n arg buf, samp=0.2,root=37,atk=0.1,decay=10, amp=0.3;\n var sig, index, tonic, freq, env;\n index = LFSaw.kr(samp).range(\\bottom.ir(4),\\top.ir(9));\n index = index*BufFrames.kr(buf);\n tonic = DegreeToKey.kr(buf,index)+root;\n freq = tonic.midicps;\n env = EnvGen.ar(Env.perc(atk,decay,0.7,-2),doneAction:2);\n sig = SyncSaw.ar(root.midicps,freq, mul:0.5)*env;\n sig = BPF.ar(sig, \\cfreq.kr(1000),\\rq.ir(0.3))*amp;\n sig = Pan2.ar(\n sig,\n SinOsc.kr(\n \\rate.kr(0.05).range(-0.9,0.9)+{Rand(-0.6,0.6)}),\n \\level.kr(1),\n );\n Out.ar(\\out.ir(~reverbBus),sig);\n }).add;\n\n SynthDef(\\reverb, {\n arg in=0, out=0, revdecay=5;\n var wet,dry, sig;\n wet = In.ar(~reverbBus,2);\n dry = In.ar(~reverbBus,2);\n wet = CombL.ar(\n wet,\n 0.1,\n SinOsc.kr(0.01).range(0.04,0.1),\n revdecay,\n 0.7);\n wet = LPF.ar(wet,\\lpf.kr(4800));\n sig = XFade2.ar(wet,dry,\\mix.kr(0.2),\\amp.kr(0.3));\n Out.ar(out,sig);\n }).add;\n});\n\nSynth(\\reverb,[\\mix,-0.5],addAction:'addToTail');\n\n~rainbow = Pbind(\n \\instrument, \\rainbow,\n \\dur, Prand([0.2,1.3],inf),\n \\buf, ~scale1,\n \\root, Prand([23,30,35,37],inf),\n \\amp, Pwhite(0.15,0.5,inf),\n \\bottom, Prand([2,5],inf),\n \\top, Pwhite(7.0,9.1,inf),\n \\samp, Pexprand(0.07,0.5,inf),\n \\rate, Pexprand(0.1,3,inf),\n \\cfreq, Pseq([\n Pseries(120,30,76),\n Pseries(2400,-30,76),\n ],inf),\n \\rq, Pkey(\\samp)+Pwhite(0.1,0.15,inf).asStream,\n \\atk, Pexprand(0.04,0.3,inf),\n \\decay, Pexprand(6,15,inf),\n \\level, Env(#[0,1,0],#[100,110],'lin'),\n \\out, ~reverbBus,\n);\n~rainbow.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nMix.ar([SinOsc.ar(220, 0, 0.1), SinOsc.ar(330, 0, 0.1)])\n```"}, {"role": "assistant", "content": "Sums two sine waves into one signal — a perfect fifth, 220 Hz and 330 Hz, at 0.1 amplitude each.\n\n`[SinOsc.ar(220, 0, 0.1), SinOsc.ar(330, 0, 0.1)]` is an Array of two audio-rate signals (each UGen\nreturns a signal; an array of them is just a list). `Mix.ar` adds the elements together. The alternative\n`+` operator does the same for two signals, and `Splay.ar` would spread them across the stereo field\ninstead of summing them."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// If one wants to start width full width there's the possibility to do this by \n// passing an initOutOffset argument.\n\n// Here we start with initOutOffset = 1, fadeMode = 1 (step first),\n// index = 4 (5th partial) is the middle of the channel span with most weight,\n// which can be clearly perceived.\n\n(\nx = {\n var lfo = XLine.ar(1, 0.5, 60);\n DXMix.ar(\n Dseq([0, 4, 1, 5, 2, 6, 3, 7], inf),\n `(Saw.ar((1..8) * 70 * lfo, 0.075)),\n fadeTime: 0.1,\n stepTime: 2,\n fadeMode: 1,\n width: 3,\n maxWidth: 8,\n initOutOffset: 1\n// …\n```"}, {"role": "assistant", "content": "If one wants to start width full width there's the possibility to do this by passing an initOutOffset argument. (DXMix: crossfades between signals according to demand-rate control)"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = NodeProxy(s); a.play;\na.source = { Splay.ar(Blip.ar(\\freq.kr(18 ! 4))) * 0.2 };\na.set(\\freq, [1, 3, 56, 13]);\na.source = { Splay.ar(SinOsc.ar(LFSaw.ar(\\freq.kr(18 ! 4)) * 250 + 400)) * 0.2 };\nb = NodeProxy(s); b.source = { MouseX.kr(0, 3) * [1, 3, 56, 13] };\na.set(\\freq, b;\na.clear; b.clear;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = NodeProxy(s); a.play;\na.source = { Splay.ar(Blip.ar(\\freq.kr(18 ! 4))) * 0.2 };\na.set(\\freq, [1, 3, 56, 13]);\na.source = { Splay.ar(SinOsc.ar(LFSaw.ar(\\freq.kr(18 ! 4)) * 250 + 400)) * 0.2 };\nb = NodeProxy(s); b.source = { MouseX.kr(0, 3) * [1, 3, 56, 13] };\na.set(\\freq, b);\na.clear; b.clear;\n```"}]} -{"conversations": [{"role": "user", "content": "What is `UGen`?"}, {"role": "assistant", "content": "UGen — Abstract superclass of all unit generators"}, {"role": "user", "content": "What does `UGen.multiNew` do?"}, {"role": "assistant", "content": "These methods are responsible for multichannel expansion. They call `*new1(rate, ...args)` for each parallel combination. Most `*ar / *kr` methods delegate to #*multiNewList."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n{ Blip.ar(Blip.kr(4, 5, 500, 60), 59, 0.1) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Pset overrides incoming values:\n\n(\nvar a, b;\na = Pset(\\freq, 801, Pbind(\\freq, 108));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n);\n\n\n(\nvar a, b;\na = Pset(\\freq, Pseq([401, 801], 2), Pbind(\\dur, 0.5));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n);\n\n\n// sound example\n\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.00\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Pset overrides incoming values:\n\n(\nvar a, b;\na = Pset(\\freq, 801, Pbind(\\freq, 108));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n);\n\n\n(\nvar a, b;\na = Pset(\\freq, Pseq([401, 801], 2), Pbind(\\dur, 0.5));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n);\n\n\n// sound example\n\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain);\na = Pset(\\freq, Pseq([500, 600, 700], inf), a);\na = Pset(\\legato, Pseq([0.01, 1], inf), a);\na.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Variations for Z1 sawtooth."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var mod = SinOsc.ar([0.1,0.15,0.2]).range(0,1);\n var saw = LFSaw.ar([10,12,15]);\n var out = (saw - ((saw>0)*mod)+(mod*0.5));\n Splay.ar(out)*0.4;\n}.play;\n\n{\n var mod = SinOsc.ar([0.1,0.15,0.2]).range(0,1);\n var saw = SinOsc.ar(LFSaw.ar([10,12,15]).range(200,300));\n var out = (saw - ((saw>0)*mod)+(mod*0.5));\n Splay.ar(out)*0.4;\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `List.clipPut` do?"}, {"role": "assistant", "content": "Same as #-put, but values for index greater than the List instance size minus one will be clipped to `size - 1`, which is the last"}]} -{"conversations": [{"role": "user", "content": "Explain `ChooseCutProc` in SuperCollider briefly."}, {"role": "assistant", "content": "ChooseCutProc — Automatic breakbeat cutting algorithm This cut procedure allows the user to specify a set of allowable cuts and repeats. It allows a roll at the end of a phrase. It is therefore a cross between BBCutProc11 (which automates what size cuts are permissible for a given subdiv rate) and WarpCutProc1. Derive new classes from this overriding the default instance methods to create advanced extensions of this paradigm; else pass in your own fu Category: Libraries > BBCut > Cut procedures."}]} -{"conversations": [{"role": "user", "content": "How do I stop all sound?"}, {"role": "assistant", "content": "s.freeAll stops every node on the server. On the language side, Ndef.clear and Pdef.clear clear the proxies. If a Pattern is still running, Pdef(\\name).stop does it; CmdPeriod immediately stops everything scheduled on the default clock."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ PinkNoise.ar(EnvGen.kr(Env.perc, doneAction: Done.freeSelf) }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ PinkNoise.ar(EnvGen.kr(Env.perc, doneAction: Done.freeSelf)) }.play\n```"}]} -{"conversations": [{"role": "user", "content": "Write a kick drum in SuperCollider."}, {"role": "assistant", "content": "A pitch-swept sine with a fast decay: the frequency envelope is what makes it read as a kick.\n\n```supercollider\n(\nSynthDef(\\kick, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 50, 40], [0.03, 0.15], -4));\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -6), doneAction: 2);\n Out.ar(out, Pan2.ar(SinOsc.ar(pitch) * env * amp));\n}).add;\n);\nSynth(\\kick);\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// track audio in (try clapping a beat or beatboxing, but allow up to 6 seconds for tracking to begin) and spawning stuff at quarters, eighths and sixteenths\n(\nSynthDef(\\help_beattrack2_2, { |out|\n var trackb, trackh, trackq, tempo;\n var source, kbus;\n var bsound, hsound, qsound;\n\n source = SoundIn.ar(0);\n\n // downsampling automatic via kr from ar\n kbus = Out.kr(0, LPF.ar(source, 1000)); // ([feature1, feature3]++feature2);\n\n #trackb, trackh, trackq, tempo = BeatTrack2.kr(0, 1, weightingscheme:\n// …\n```"}, {"role": "assistant", "content": "track audio in (try clapping a beat or beatboxing, but allow up to 6 seconds for tracking to begin) and spawning stuff at quarters, eighths and sixteenths downsampling automatic via kr from ar (BeatTrack2: Template matching beat tracker)"}]} -{"conversations": [{"role": "user", "content": "What is the difference between ~foo and a local variable?"}, {"role": "assistant", "content": "`var foo` is a local: it exists only inside the function or file block that declares it. `~foo` is an environment variable: it lives in the current Environment, survives between executions of the same block, and is visible to everything running in that environment. That is why `~buf = Buffer.read(s, path)` works in one cell and `PlayBuf.ar(1, ~buf)` works in the next, while a `var` would be gone."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Snow (a SuperCollider snippet)?"}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\snow, { arg freq=200, pan=0, amp=0.1, speed=1;\n var sig;\n var size = 20;\n var trig = Impulse.ar({ rrand(1/1,15.0) } ! size * \\density.kr(1));\n sig = { WhiteNoise.ar } ! size;\n sig = sig.collect({ arg sig, x;\n var bpfreq = exprand(50.0,16000) * \\tone.kr(1);\n var bpfrq = 0.1 * SinOsc.ar(( x+1 ) * 1/153 * speed).exprange(0.1,4) * \\blur.kr(1);\n sig = BPF.ar(sig, bpfreq, bpfrq) * 34;\n sig = BPF.ar(sig, bpfreq, bpfrq) * 4;\n sig = sig * EnvGen.ar(Env([0,1,0],[0.1,0.8]), trig[x]);\n //sig = sig.fold2( LFNoise0.kr(1/23 * ( x+1 ) * speed).range(0.01,8) ) * 4;\n sig = sig * SinOsc.ar(1/700 * ( x+1 ) * speed).range(0.01,1);\n });\n sig = Pan2.ar(sig, ( { rrand(-1.0,1) } ! size * SinOsc.ar(1/132 * (1..size) * speed).range(0,1) ), amp).mean;\n}).play;\n);\nNdef(\\snow).fadeTime = 16;\nNdef(\\snow).edit;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// ===========================\n// extra demos for pluck\n// ===========================\n\n\n(\n// Made by Meha Gupta\n// Inspired by Happy by Julia Michaels\nPbindef(\\dmpluck,\n \\instrument, \"pluck\",\n \\midinote, Pseq([\n Pseq([\n [57, 69, 73, 76],\n [57, 69, 73, 76],\n [57, 71, 73, 80],\n [52, 78, 76, 80],\n [52, 78, 76, 80],\n [59, 71, 75],\n [59, 71, 75]], 2),\n 64]),\n \\amp, Pseq([0.2, 0.1, 0.2, 0.2, 0.1, 0.1, 0.1], inf) * 0.5,\n \\dur, Pseq([Pn(Pseq([0.25, 0.75, 1, 0.5, 0.5, 0.5, 0.5]), 2), 1]),\n \\decay, Pseq([1, 3, 3, 2, 2, 3, 3, 1, 3, 3, 2, 2, 3, 3, 4]),\n).play;\n)\n```"}, {"role": "assistant", "content": "=========================== extra demos for pluck ===========================."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PatternConductor`."}, {"role": "assistant", "content": "```supercollider\n(\n// a pattern with long notes\np = Pbind(\n \\freq, Pwhite(0, log(32)).exp.round(1) * 36.midicps,\n \\detune, Pfunc({ |ev| ev[\\freq] * rand(0.01) }),\n \\sustain, Pwhite(log(0.1), log(20)).exp,\n \\dur, Prand([0.1, 0.1, 0.1, 0.1, 0.2, 1, 2], inf),\n \\db, Pstep(Pseq([-20, -30, -25, -30], inf), 0.2)\n);\n\n// unrelated cluster pattern running on TempoClock.default\nPbind(\\dur, 2, \\midinote, Pseq([(48..60)], 20), \\db, -30).play;\n\n// make a conductor\na = PatternConductor(p, quant: 2);\na.play;\n);\n\n\n// now try some interactive control options line by line:\na.quant = 0;\na.pause;\na.resume;\na.stop;\na.play;\na.pause;\na.play;\na.stop(1000);\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Converting an environment in a prototype object."}, {"role": "assistant", "content": "```supercollider\n~constructPseudoMethods = { |envir|\n var newEnvir = envir.collect { |value|\n var argNames, argBlock, namesBlock, code, func;\n if(value.isKindOf(Function)) {\n func = value;\n argNames = func.def.argumentString(withDefaultValues: true);\n namesBlock = func.def.argumentString(withDefaultValues: false);\n argBlock = if(argNames.notNil) { \"|self, \" ++ argNames ++ \"|\" };\n code = \"{ |func, envir| { % envir.use { func.value(%) } } }\".format(argBlock ? \"\", namesBlock ? \"\");\n //code.postln;\n code.interpret.value(func, envir)\n } {\n value\n }\n };\n newEnvir.know = true; // we want a prototype object style environment\n};\n```"}]} -{"conversations": [{"role": "user", "content": "Write a granular texture in SuperCollider."}, {"role": "assistant", "content": "Read a sound file into a buffer, then trigger grains from it. Grain density is the Impulse rate and\ngrain length is dur; keep the density times the length under maxGrains or raise it.\n\n```supercollider\n(\ns.waitForBoot {\n ~buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n SynthDef(\\grain, { |out = 0, amp = 0.4, density = 30, dur = 0.08|\n var trig = Impulse.kr(density);\n var sig = GrainBuf.ar(2, trig, dur, ~buf, 1, LFNoise0.kr(2).range(0, 1), 2, 0, -1, 512);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n Synth(\\grain);\n};\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `NodeProxy.copyState` do? What arguments does it take?"}, {"role": "assistant", "content": "Copy the internal settings of one proxy into another. Old state is Arguments: proxy — The proxy whose internal state is copied.."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Archive`."}, {"role": "assistant", "content": "```supercollider\n// make a storage place for various objects:\nq = (); // Event\n\nq[\\a_long_array] = Array.rand(128, 0.0, 1.0);\nq[\\pi_squared] = pi * pi;\nq[\\favourite_sound] = { { SinOsc.ar([300, 330]).sum * LFPulse.kr(2 + [0, 0.01]) * 0.1 }.play };\nq[\\same_long_array] = q[\\a_long_array]; // same objects may appear several times\n\nArchive.global.put(\\myData, q);\n\n\nArchive.global.at(\\myData).postcs;\n\n// after a recompile:\ns.boot;\n\nq = Archive.global.at(\\myData);\nq.postcs;\nq[\\favourite_sound].value;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes random 303."}, {"role": "assistant", "content": "```supercollider\n(\n{ var lk = [0,3,7,9], jx = [3,4,2,4,2], n, ox = 10, qw, cx, oi,z,w, faz, mp,\n cs = [Select,Stepper,RLPF,LFTri,Pulse,PulseDivider,Lag2,Lag,EnvGen,\n Saw, LPF, PitchShift, AllpassN, Env, LocalIn, LocalOut, Impulse ];\n var fa,ffa, ra, eca, era, fsa, xc, fxc, rq, ec, er,xcs, o,e;\n mp = {… |n,alk| alk = alk ? lk; \n {midicps(jx .choose * 12 + lk.choose) } !n }; \n faz = [ mp.(3)* 2.midiratio, mp.( 3 )\n *1. midiratio, mp.( 2,[ 0,3,9 ])*5.midiratio,mp.(1 )*1.midiratio ]; \n fa = faz[[3,0,3,1,2,2,2,2, 1,1,1,1,0,3]].flat; \n n = fa.size; \n qw = Impulse.kr(10); \n cx = PulseDivider.kr(qw, n); \n oi = Stepper.kr(qw,0,0,n-1); \n fsa = { [0,0,0, 0.02,0.08,0.1 ].choose }!div(n,4); \n xcs = Select.kr( Stepper.kr( qw,0,0,fsa.size-1 ), fsa); \n xc = Lag2.kr( Select.kr(oi, fa), xcs ); \n ffa = { rrand( 20, 90 ) } ! n;\n ffa.size.do({ |i| var pn = [2,4,8].choose;\n if ( 0.2.coin, { ffa[i] = Select.kr(Stepper.kr(cx, 0,0,pn-1), { rrand( 4, 70 ) } ! n) }) });\n fxc = Lag2.kr( Select.kr(oi, ffa), 0.04);\n ra = { rrand(0.05,0.5) } ! n;\n rq = Lag.kr( cs[0].kr(oi, ra), 0.04);\n eca = { [-4,0,-1].choose } ! n;\n ec = Select.kr(oi,eca);\n o = Saw.ar(xc) + Pulse.ar(xc * 0.01.midiratio,1-rq) + Pulse.ar(xc *0.04.midiratio,LFTri.ar(ox/n).range(0.1,0.9),0.02) + Pulse.ar(xc *\n 24.midiratio,LFTri.ar(ox/n/4).range(0.8,0.01),0.05);\n era = { rrand(0.8,0.4) } ! 4;\n er = Select.kr(cs[1].kr(qw, 0,0,3), era);\n e = Env.new([0,1,0],[xcs/5,er],ec);\n e = EnvGen.kr(e, gate:qw);\n fxc = fxc * [1.02, 0.98];\n xc = xc * [0.8,1.2].scramble;\n z = cs[2].ar(o, (fxc * e).midiratio * xc, rq) + (cs[2].ar(o.neg, fxc * (50 * e)\n .midiratio, 0.4) *0.05) + (cs[2].ar(o.neg, fxc * (65 * e).midiratio, rq/2) *0.01) * e;\n z = (z + (cs[11].ar(z,0.001,0.5,0.1,0.1).distort * 0.5)).distort;\n w = z+ cs[14].ar (2). distort;\n 10.do({ w = cs[12].ar(w,0.4,{0.03.rand}!2,{0.06.rand}!2) });\n cs[15].ar(cs[10].ar( w*0.9,800 )); (w *0.1 ) + (z * 0.7) }.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SequenceableCollection.multichannelExpandRef` do? What arguments does it take?"}, {"role": "assistant", "content": "This method is called internally on inputs to UGens that take multidimensional arrays, like Klank and it allows proper multichannel expansion even in those cases. For SequenceableCollection, this returns the collection itself, assuming that it contains already a number of Refs. See Ref for the corresponding method Arguments: rank — The depth at which the list is expanded. For instance the Klank spec has a rank of 2. For more examples, see SequenceableCollection#-flopDeep `([[[100, 200], 500], nil, [[[0.01, 0.3], 0.8]]]).multichann`."}]} -{"conversations": [{"role": "user", "content": "What does `Synth.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Create and return a new Synth object, and immediately start the corresponding synth node on the Arguments: defName — A String or Symbol specifying the name of the SynthDef to use in creating the Synth.; args — An optional Array specifying initial values for the SynthDef's arguments (controls). These are specified in pairs of control name or index and value. If names are used they can be specified with either Strings or Symbols. e.g. `[\\frequency, 440, \\amplitude, 1, ...]`. Values that are arrays are sent ; target — A target for this Synth. If target is not a Group or Synth, it will be converted as follows: If it is a Server, it will be converted to the default_group of that server. If it is nil, to the default_group of the default Server. If it is an integer, it is created relative to a group with that id.; addAction — one of the following Symbols:."}]} -{"conversations": [{"role": "user", "content": "What does `FoaNF.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "First Order Ambisonic (FOA) near-field distance estimate Arguments: in — The B-format signal, an array: [w, x, y, z]; size — Analysis filter kernel size.; method — The Soundfield analysis method:."}]} -{"conversations": [{"role": "user", "content": "What is `SystemSynthDefs`?"}, {"role": "assistant", "content": "SystemSynthDefs — SynthDefs assumed to exist on the server"}, {"role": "user", "content": "What does `SystemSynthDefs.numChannels` do?"}, {"role": "assistant", "content": "The SystemSynthDefs class generates SynthDefs with different number of channels that are chosen according to need. This class variable specifies the maximum number of channels."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na = { SinOsc.ar * 0.01 }.play;\na.defName; // has the prefix 'temp__', followed by a number\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Integer.pidRunning` do?"}, {"role": "assistant", "content": "32-bit Integer number Returns: a Boolean for whether or not the specified pid is running."}]} -{"conversations": [{"role": "user", "content": "What does `SimpleNumber.asWarp` do? What arguments does it take?"}, {"role": "assistant", "content": "one-dimensional value Arguments: spec — a ControlSpec. Returns: this as CurveWarp according to spec."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for attempt at emulating a breathing sound."}, {"role": "assistant", "content": "```supercollider\n(\n//s.options.memSize_(64000);\nTempoClock.tempo_(1.0);\n\ns.waitForBoot({\n SynthDef(\\breathe_in, {\n | out = 0, gate = 1, in1=0.11, in2=0.63, in3=0.18, amdb= -10 |\n var menv = EnvGen.kr(Env.new([0,1,1,0],[in1, in2, in3], curve:'lin'),\n gate,\n doneAction:Done.freeSelf);\n var noise = WhiteNoise.ar(amdb.dbamp);\n var f1 = BPF.ar(in:noise, freq:5790, rq:0.1, mul:-29.dbamp);\n var f2 = BPF.ar(in:noise, freq:3400, rq:0.2, mul:-16.dbamp);\n var f3 = BPF.ar(in:noise, freq:1990, rq:0.1, mul:-23.dbamp);\n var f4 = BPF.ar(in:noise, freq:1250, rq:0.1, mul:-26.dbamp);\n Out.ar(out, menv*(f1+f2+f3+f4)!2);\n }).add;\n\n SynthDef(\\breathe_out, {\n | out = 0, gate=1, out1=0.343, out2=0.387, amdb= -4.33 |\n var menv = EnvGen.kr(Env.new([0, 1, 0], [out1,out2], curve:'lin'),\n gate,\n doneAction:Done.freeSelf);\n var noise = WhiteNoise.ar(amdb.dbamp);\n var f1 = BPF.ar(in:noise, freq:2290, rq:0.1, mul:-17.dbamp);\n var f2 = BPF.ar(in:noise, freq:1290, rq:0.1, mul:-19.dbamp);\n var f3 = BPF.ar(in:noise, freq:490, rq:0.1, mul:-18.dbamp);\n Out.ar(out, menv*(f1+f2+f3)!2);\n }).add;\n\n\n s.sync;\n\n fork {\n 50.do({\n var in1 = 0.11.rrand(0.22);\n var in2 = 0.6.rrand(0.8);\n var in3 = 0.16.rrand(0.30);\n var pausein = 0.11.rrand(0.20);\n var out1 = 0.30.rrand(0.50);\n var out2 = 0.36.rrand(0.50);\n var pauseout = 0.11.rrand(0.20);\n var amdb = -10.0.rrand(-14.0);\n var amdb2 = amdb/2.5;\n //(\"in1: \" ++ in1 ++ \" in2: \" ++ in2 ++ \" in3: \" ++ in3 ++ \" pausein: \" ++ pausein ++ \" out1: \" ++ out1 ++ \" out2: \" ++ out2 + \" pauseout: \" ++ pauseout).postln;\n Synth(\\breathe_in, [\\in1, in1, \\in2, in2, \\in3, in3, \\amdb, amdb]);\n (in1+in2+in3+pausein).wait;\n Synth(\\breathe_out, [\\out1, out1, \\out2, out2, \\amdb, amdb2]);\n (out1+out2+pauseout).wait;\n });\n };\n\n});\n);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Looping sampler with crossfading."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\\simpler, {\n arg buf=0\n ,freq=220\n ,sampleStart=0\n ,loopStart=0\n ,loopLen=1 // between 0 (min) and 1 (max)\n ,fadeTime=0.1\n ,gate=1\n ,attack=0.01\n ,sustain=1\n ,release=1\n ,f0=220;\n\n var rate = freq / f0;\n var sr = rate*BufSampleRate.kr(buf);\n var fadeFrames = fadeTime*sr;\n var loopEnd = loopLen*(BufFrames.kr(buf) - loopStart) + loopStart;\n var loopFrames = loopEnd - loopStart + 1;\n var loopTime = (loopFrames - fadeFrames)/sr;\n var startUpTime = (loopStart - sampleStart)/sr;\n\n var trigLoop = TDuty.ar(Dseq([startUpTime + loopTime, Dseq([loopTime], inf)]), gapFirst:1);\n\n var phaseA = Phasor.ar(trigLoop, rate, sampleStart, inf, loopStart);\n var phaseB = Phasor.ar(trigLoop, rate, loopEnd - fadeFrames, inf, loopEnd - fadeFrames);\n\n var srcA = BufRd.ar(buf.numChannels, buf, phaseA);\n var srcB = BufRd.ar(buf.numChannels, buf, phaseB);\n\n var startLoop = SetResetFF.ar(trigLoop);\n var loopPan = Phasor.ar(trigLoop, 2/fadeFrames * rate, -1, inf, -1).clip(-1,1);\n\n var out = Select.ar(startLoop, [srcA, LinXFade2.ar(srcB, srcA, pan:loopPan)]);\n var env = EnvGen.ar(Env.asr(attack, sustain, release, 1), gate, doneAction:2);\n\n Out.ar(0, Splay.ar(out) * env);\n}).add;\n\n// Try it out:\n~buf = Buffer.read(s, Platform.resourceDir +/+ 'sounds/a11wlk01.wav');\n\nPdef(\\p, Pbind(*[\n instrument: \\simpler\n ,buf: ~buf\n ,octave: Prand([3,4,5],inf)\n ,degree: Pn(Plazy({Pseq([-4,0,5,7,9,12].scramble.clump(2),2)}))\n ,dur: 0.5\n ,strum: Prand([0, 0.125, 0.25], inf)\n ,strumEndsTogether: false\n ,loopStart: Pwhite(90000, 150000)\n ,sampleStart: Pwhite(50000, 85000)\n ,loopLen: 0.4\n ,fadeTime: 0.15\n ,attack: 0.25\n ,release: 4\n])).play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `NestedAllpassN.ar` do?"}, {"role": "assistant", "content": "Nested Allpass filters as proposed by Vercoe and Pluckett"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nb = BusPlug.new;\n{ Blip.ar(b + 5) }.play;\nb.bus.set(12;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nb = BusPlug.new;\n{ Blip.ar(b + 5) }.play;\nb.bus.set(12);\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for automatically playback of all soundfiles in a directory."}, {"role": "assistant", "content": "```supercollider\n(\nw = {|pathPattern|\nvar soundFiles;\n// get sounds\nsoundFiles = SoundFile.collect(pathPattern);\n\n// play back in order of their appearance\nPseq(soundFiles.collect{|file| file.cue((\\dur: file.duration))}, 1).play;\n}\n);\n\n// adjust path and evaluate the next line\nw.value(\"/Volumes/usbImport/PMD620/200804062000/*.WAV\")\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes 8-bit synth (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"AM2\", { arg freq = 440, modfreq = 12, amp = 0.5, attack = 0.01, dur = 1, pos = 0;\n var carrier, modulator, env;\n modulator = LFSaw.kr(modfreq).range(0, 1);\n carrier = LFSaw.ar(freq: freq, mul: modulator);\n env = Env.perc(attackTime: attack, releaseTime: dur - attack, level: amp).kr(2);\n carrier = carrier * env;\n Out.ar(0, Pan2.ar(carrier, pos))\n}).add;\n);\n\n//Example Melody\n\n(\na=Pbind(\n\\instrument, \"AM2\",\n\\degree, Pseq([0,1,2,3,4,5,6,7,6,5,4,3,2,1],inf),\n\\amp, 0.70,\n\\dur, 0.125,\n\\modfreq, 12, // add different values\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `ProxyNodeMap` in SuperCollider?"}, {"role": "assistant", "content": "ProxyNodeMap — store control values and bus mappings for NodeProxy Object to store control values and bus mappings independantly of a specific NodeProxy. Category: JITLib > NodeProxy."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n\n// definition for future reference in arbitrary Environments,\n// Cauchy distribution is not bounded, so do clip !\n\n(\np = Pbind(\n \\midinote, PLcauchy(\\mean, \\spread).clip(60, 90),\n \\dur, 0.1\n);\n);\n\n// prepare current Environment\n\n(\n~mean = 75;\n~spread = 0.1;\n);\n\n\n// run\n\nx = p.play;\n\n\n// move mean value and distribution\n// PLseq defaults to repeats = inf\n\n(\n~mean = PLseq((80, 79.7..70));\n~spread = PLseq([0,\n// …\n```"}, {"role": "assistant", "content": "definition for future reference in arbitrary Environments, Cauchy distribution is not bounded, so do clip ! (PLcauchy: dynamic scope Pcauchy variant)"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// pchRatio will not stream, is fixed at -1\n(\n\nInstrSpawner({ arg sample,start=0,pchRatio=1.0,env;\n PlayBuf.ar( sample.numChannels, sample.bufnumIr,pchRatio,1,start * sample.bufFramesIr,1 )\n * EnvGen.kr(env,doneAction: 2)\n},[\n Sample(\"a11wlk01.wav\"),\n Pbrown(0,1,0.1,inf),\n -1,\n Env.sine(0.2,0.4)\n\n],0.125).play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// pchRatio will not stream, is fixed at -1\n(\n\nInstrSpawner({ arg sample,start=0,pchRatio=1.0,env;\n PlayBuf.ar( sample.numChannels, sample.bufnumIr,pchRatio,1,start * sample.bufFramesIr,1 )\n * EnvGen.kr(env,doneAction: 2)\n},[\n Sample(\"a11wlk01.wav\"),\n Pbrown(0,1,0.1,inf),\n -1,\n Env.sine(0.2,0.4)\n\n],0.125).play\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `EnvironmentRedirect.envir` do?"}, {"role": "assistant", "content": "return or replace the source environment `e ="}]} -{"conversations": [{"role": "user", "content": "What are the arguments of GrainBuf.ar?"}, {"role": "assistant", "content": "`GrainBuf.ar(numChannels, trigger, dur, sndbuf, rate, pos, interp, pan, envbufnum, maxGrains, mul, add)`. The ones you always pass are numChannels (1 or 2), trigger (a UGen that fires grains, e.g. Impulse.kr(20)), dur (grain length in seconds), sndbuf (an integer buffer number, or `~buf`), rate (playback rate per grain), and pos (read position 0..1 into the buffer). Raise maxGrains if the server complains about too many grains rather than lowering density."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n//Its not the spline that loops (that would be a loop in 2 dimensional space) but the SplineGen that is set to loop.\n\n// the spline does NOT loop,\nb = BSpline( Array.fill(16,{ arg i; [ i * 0.25,1.0.rand ] }), 3.0,false );\n\nb.gui(nil,1200@300);\n\n\n);\n(\n// the SplineGen loops\n{\n Saw.ar(SplineGen(b,loop:true).kr.linexp(0.0,1.0,40,500).clip(40,500)).dup * 0.4\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n//Its not the spline that loops (that would be a loop in 2 dimensional space) but the SplineGen that is set to loop.\n\n// the spline does NOT loop,\nb = BSpline( Array.fill(16,{ arg i; [ i * 0.25,1.0.rand ] }), 3.0,false );\n\nb.gui(nil,1200@300);\n\n\n);\n(\n// the SplineGen loops\n{\n Saw.ar(SplineGen(b,loop:true).kr.linexp(0.0,1.0,40,500).clip(40,500)).dup * 0.4\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does Splay.ar do?"}, {"role": "assistant", "content": "`Splay.ar(inArray, spread, level, center, levelComp)` takes an array of mono signals and distributes them across the stereo field, so `Splay.ar(SinOsc.ar([220, 330, 440]) * 0.1)` is a three-source stereo chord rather than three separate synths. spread (0..1) controls how far the voices fan out and center shifts the middle. It is the shorthand for 'make this array stereo'."}]} -{"conversations": [{"role": "user", "content": "I get 'index out of range' when playing a buffer."}, {"role": "assistant", "content": "A read position is past the end of the buffer. `PlayBuf` with a `startPos` in frames beyond `~buf.numFrames`, or a `BufRd`/`GrainBuf` whose phase goes above 1, produces this. For GrainBuf, pos is normalised 0..1, so pass `LFNoise1.kr(1).range(0, 1)` rather than a frame count; for PlayBuf, cap the position at `~buf.numFrames - 1`. If you just loaded the file, check `~buf.numFrames` — a failed read gives 0 frames and every position is out of range."}]} -{"conversations": [{"role": "user", "content": "What is `EventStreamSpec` in SuperCollider?"}, {"role": "assistant", "content": "EventStreamSpec — datatype specifying a Pbind-like object that produces a playable stream of Events Streams/Patterns are commonly of two primary types: those that return numerical streams and those that return streams of Events which will spawn Synths. Category: Spec, Libraries > crucial > Spec, Streams-Patterns-Events > Patterns > Spec."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n////////////// xosc nufo is unused by now ///////////\n// OSCdef(\\xoscAlive, { |msg, time|\n// if (NTMI.nufo.lastInTime == 0 or: { NTMI.nufo.timeSinceLast > 10 }) {\n// Tdef(\\allLEDs).play;\n// };\n// NTMI.nufo.deviceName = \\xosc;\n// NTMI.nufo.lastInTime = time;\n// }, \"/imu\").permanent_(true);\n```"}, {"role": "assistant", "content": "xosc nufo is unused by now /////////// OSCdef(\\xoscAlive, { |msg, time| if (NTMI.nufo.lastInTime == 0 or: { NTMI.nufo.timeSinceLast > 10 }) { Tdef(\\allLEDs).play; }; NTMI.nufo.deviceName = \\xosc; NTMI.nufo.lastInTime = time; }, \"/imu\").permanent_(true);."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `IEnvGen`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var env = Env([0, 0.6, 0.3, 1.0, 0], [0.1, 0.02, 0.4, 1.1], [\\lin, \\exp, -6, \\sin]);\n var envgen = IEnvGen.kr(env, MouseX.kr(0, env.times.sum));\n env.plot;\n SinOsc.ar(envgen * 500 + 440)\n}.play;\n);\n\n// index with an SinOsc ... mouse controls amplitude of SinOsc\n// use offset so negative values of SinOsc will map into the Env\n(\n{\n var sin = SinOsc.ar(440, 0, MouseX.kr(0, 1));\n // use offset so negative values of SinOsc will map into the Env\n var env = Env([-1, -0.7, 0.7, 1], [0.8666, 0.2666, 0.8668], \\lin, offset: -1.0);\n IEnvGen.ar(env, sin) * 0.1\n}.play;\n);\n\n// index with Amplitude of input, control freq of SinOsc (uses SoundIn)\n(\n{\n var point = Amplitude.ar(SoundIn.ar(0), 0.01, 0.2);\n // use offset so negative values of SinOsc will map into the Env\n var env = Env.xyc([[0, 330, \\exp], [0.5, 440, \\exp], [1.0, 1760]]);\n SinOsc.ar(IEnvGen.kr(env, point)) * 0.2\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Using sine waves to generate a saw waveform."}, {"role": "assistant", "content": "```supercollider\nq={|f,e|a=Array.fill(e,{|j|e-j}).reverse;(Mix.ar(a.collect{|x|SinOsc.ar(f*x,0,1/x)})/2)!2};{q.(60,300)}.play //saw from sine #supercollider\n\n//Change the values passed to q to control the frequency and how many sines are used.\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ModDif`."}, {"role": "assistant", "content": "```supercollider\n// different moduli\n(\n{\n var sig = LFSaw.ar(10);\n var dist = ModDif.kr(sig, 0, (0..8) * MouseX.kr(0, 1/5));\n Splay.ar(SinOsc.ar(dist * 4000 + 400)) * 0.1\n}.play;\n);\n\n// wrapping amplitude crossfade\n(\n{\n var numChan = 12;\n var x = SinOsc.ar({ rrand(300.0, 800.0) } ! numChan);\n var dist = ModDif.kr(MouseX.kr(0, numChan * 2), (0..numChan-1), numChan);\n x = x * max(0, 1 - dist);\n Splay.ar(x) * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BufSampleRate`."}, {"role": "assistant", "content": "```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n// compares a 1102.5 Hz sine tone (11025 * 0.1, left) with a 1100 Hz tone (right)\n// the apollo sample has a sample rate of 11.025 kHz\n(\n{\n var freq;\n freq = [BufSampleRate.kr(b) * 0.1, 1100];\n SinOsc.ar(freq, 0, 0.1)\n}.play;\n);\n\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LinCongN`."}, {"role": "assistant", "content": "```supercollider\n// randomly modulate params\n(\n{ LinCongN.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(0.1, 0.5, 1.4),\n LFNoise2.kr(0.1, 0.1, 0.1),\n LFNoise2.kr(0.1)\n) * 0.2 }.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Resonz`."}, {"role": "assistant", "content": "```supercollider\n{ Resonz.ar(WhiteNoise.ar(0.5), 2000, 0.1) }.play\n\n// modulate frequency\n{ Resonz.ar(WhiteNoise.ar(0.5), XLine.kr(1000, 8000, 10), 0.05) }.play\n\n// modulate bandwidth\n{ Resonz.ar(WhiteNoise.ar(0.5), 2000, XLine.kr(1, 0.001, 8)) }.play\n\n// modulate bandwidth opposite direction\n{ Resonz.ar(WhiteNoise.ar(0.5), 2000, XLine.kr(0.001, 1, 8)) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Impulse`."}, {"role": "assistant", "content": "```supercollider\n{ Impulse.ar(4, [0, MouseX.kr(0, 1)], 0.2) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\Identity;\n~description = \"Output the Ambisonics stream to outputs channels, useful for NRT rendering\";\n\n~function = {|in = 0|\nin;\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `SharedOut` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\n// only works with the internal server\ns = Server.internal;\ns.boot;\n);\n\n(\nSynthDef(\"help-SharedOut\", {\n SharedOut.kr(0, SinOsc.kr(0.2));\n}).add;\n);\n\n(\ns.sendMsg(\\s_new, \"help-SharedOut\", x = s.nextNodeID, 0, 1);\ns.sendMsg(\\n_trace, x);\n\n// poll the shared control bus\nRoutine({\n 30.do({\n s.getSharedControl(0).postln;\n 0.2.wait;\n });\n}).play;\n);\n\n\ns.quit;\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `DiskIn`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n\n\n// create with cueSoundFile class method\nb = Buffer.cueSoundFile(s, ExampleFiles.apollo11, 0, 1);\nx = { DiskIn.ar(1, b) }.play;\nb.close; // must call close in between cueing\n// now use like named instance method, but different arguments\nb.cueSoundFile(ExampleFiles.apollo11);\n// have to do all this to clean up properly!\nx.free; b.close; b.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Stethoscope`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var f = { |l,h| SinOsc.kr(0.1, {pi.rand}).range(l, h) } ;\n Pulse.ar({ f.(20, 1000) }!6, { f.(0.0, 1) }!6, { f.(0.0, 1.0) }!6)\n}.play;\n);\n\nc = s.scope;\nc.numChannels = 6;\nc.scopeView.waveColors = [Color.red, Color.red, Color.cyan, Color.cyan, Color.white, Color.white];\nc.style = 2;\n```"}]} +{"conversations": [{"role": "user", "content": "How do I add reverb with FreeVerb?"}, {"role": "assistant", "content": "`FreeVerb.ar(in, mix, room, damp)` — mix 0..1 is dry/wet, room 0..1 is the size (0.5 is a small room, 0.9 is a hall), damp 0..1 rolls off the high end of the tail. Put it after your sound: `FreeVerb.ar(SinOsc.ar(440) * 0.1, 0.4, 0.8, 0.5)`. For a send-style reverb, write the dry signal to Out.ar(0, …) and the same signal through FreeVerb to a second bus."}]} +{"conversations": [{"role": "user", "content": "What is `DigitalIO`?"}, {"role": "assistant", "content": "DigitalIO — Read or write data to a digital pin"}, {"role": "user", "content": "What does `DigitalIO.ar` do?"}, {"role": "assistant", "content": "The output of this UGen is always the last value read when the digital pin was an input."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// write a sine oscillator's output to a pin, and read the pin value at other times\n\n(\nSynthDef(\"help-DigitalIO\", { |out = 0|\n DigitalIO.ar(0, SinOsc.ar(10), LFPulse.kr(0.1)).poll;\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// define the violin-like sound synth\n(\nSynthDef(\\violin, {\n | midinote=60, gate=1, amp=0.25 |\n var env = EnvGen.kr(Env.asr(0.1, 1, 0.1), gate, doneAction:2);\n var sig = VarSaw.ar(\n midinote.midicps,\n width:LFNoise2.kr(1).range(0.2, 0.8)*SinOsc.kr(5, Rand(0.0, 1.0)).range(0.7,0.8))*0.25;\n sig = sig * env * amp;\n Out.ar(0, sig!2);\n}).add;\n);\n\n\n// play a chord (farfisa-like sound)\n(\n[60, 64, 67].do ({\n | note |\n Synth(\\violin, [\\midinote, note]);\n})\n);\n\n// play a single note (it seems also a flute!)\nx = Synth(\\violin, [\\midinote, 84]);\nx.set(\\gate, 0); // stop the note\n\n\n// play some random notes\n(\np = Pbind(\n \\instrument, \\violin,\n \\midinote, Prand( Scale.majorPentatonic.degrees, inf) + 60,\n \\dur, 3,\n \\legato, 1\n).play;\n)\n```"}, {"role": "assistant", "content": "Trying to procedurally synthetise a violin, I eventually came out with a \"Farfisa\" organ like sound.\r\nIt can be used also as a flute!."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// randomly modulate params\n(\n{ LinCongN.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(0.1, 0.5, 1.4),\n LFNoise2.kr(0.1, 0.1, 0.1),\n LFNoise2.kr(0.1)\n) * 0.2 }.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// randomly modulate params\n(\n{ LinCongN.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(0.1, 0.5, 1.4),\n LFNoise2.kr(0.1, 0.1, 0.1),\n LFNoise2.kr(0.1)\n) * 0.2 }.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LinCongC`."}, {"role": "assistant", "content": "```supercollider\n// randomly modulate params\n(\n{ LinCongC.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(0.1, 0.5, 1.4),\n LFNoise2.kr(0.1, 0.1, 0.1),\n LFNoise2.kr(0.1)\n) * 0.2 }.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// multiple usage of the same name:\na = { SinOsc.ar(\\freq.kr(440, 1.0)) + Saw.ar(\\freq.kr(440, 1.0) * 0.5) * 0.1 }.play;\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n\n// with different lag values:\na = { SinOsc.ar(\\freq.kr(440).lag(3.5)) + Saw.ar(\\freq.kr(440).lag(0.05) * 0.5) * 0.1 }.play;\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n\n// control saved to a variable:\n(\na = {\n var freq = \\freq.kr(440);\n SinOsc\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// multiple usage of the same name:\na = { SinOsc.ar(\\freq.kr(440, 1.0)) + Saw.ar(\\freq.kr(440, 1.0) * 0.5) * 0.1 }.play;\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n\n// with different lag values:\na = { SinOsc.ar(\\freq.kr(440).lag(3.5)) + Saw.ar(\\freq.kr(440).lag(0.05) * 0.5) * 0.1 }.play;\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n\n// control saved to a variable:\n(\na = {\n var freq = \\freq.kr(440);\n SinOsc.ar(freq.lag(3.5)) + Saw.ar(freq.lag(0.05) * 0.5) * 0.1;\n}.play;\n);\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BrownNoise`."}, {"role": "assistant", "content": "```supercollider\n{ BrownNoise.ar(0.1) }.play;\n{ WhiteNoise.ar(0.1) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Pmul`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, gate = 1|\n var env;\n env = EnvGen.kr(Env.asr(0.001, 1, 0.2), gate, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain, \\freq, 440);\nb = Pmul(\\freq, Pseq([1, 2, 3, 4, 5, 6, 7], inf), a);\nb.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nSynthDef(\\Synth3,\n {arg ress = 0;\n var klank, env;\n klank = Klank.ar(`[{Rand(70,21000)}!7, {Rand(0.128,0.700)}!7],BrownNoise.ar(0.7));\n klank = klank;\n env = EnvGen.kr(Env.perc(0.07, ress), doneAction:2);\n Out.ar(0, klank*env.dup*0.0128);\n}).add;\n)\n\n\n{inf.do{x = rrand(0.01,0.7); Synth(\\Synth3, [\\ress, x+(7*x)]); x.wait;}}.fork\n```"}, {"role": "assistant", "content": "Play around with {Rand(70, 21000)}!7\r\n\r\nA simple example for the begginers... hope I can contribute to something =)."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `LFSaw`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\nfork {\n ~group = Group();\n\n 2.wait;\n\n SynthDef(\\buzz, {\n |out = 0, freq = 300, amp = 0.1, filter = 1.7|\n var sig = LFSaw.ar(freq * [1, 3, 5], 0, amp * [1, 0.5, 0.25]).sum;\n sig = LPF.ar(sig, freq * filter);\n Out.ar(out, sig);\n }).add;\n\n [50, 53, 58, 46, 60].midicps.do {\n |f, i|\n Synth(\\buzz, [\n \\out: 0, \\freq, f, \\filter: (i / 2) + 1\n ], target:~group);\n 2.wait;\n };\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `AbstractPlayer.didSpawn` do?"}, {"role": "assistant", "content": "the base class for all Players : a playable object"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// If one wants to start width full width there's the possibility to do this by \n// passing an initOutOffset argument.\n\n// Here we start with initOutOffset = 1, fadeMode = 1 (step first),\n// index = 4 (5th partial) is the middle of the channel span with most weight,\n// which can be clearly perceived.\n\n(\nx = {\n var lfo = XLine.ar(1, 0.5, 60);\n DXMix.ar(\n Dseq([0, 4, 1, 5, 2, 6, 3, 7], inf),\n `(Saw.ar((1..8) * 70 * lfo, 0.075)),\n fadeTime: 0.1,\n stepTime: 2,\n fadeMode: 1,\n width: 3,\n maxWidth: 8,\n initOutOffset: 1\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// If one wants to start width full width there's the possibility to do this by \n// passing an initOutOffset argument.\n\n// Here we start with initOutOffset = 1, fadeMode = 1 (step first),\n// index = 4 (5th partial) is the middle of the channel span with most weight,\n// which can be clearly perceived.\n\n(\nx = {\n var lfo = XLine.ar(1, 0.5, 60);\n DXMix.ar(\n Dseq([0, 4, 1, 5, 2, 6, 3, 7], inf),\n `(Saw.ar((1..8) * 70 * lfo, 0.075)),\n fadeTime: 0.1,\n stepTime: 2,\n fadeMode: 1,\n width: 3,\n maxWidth: 8,\n initOutOffset: 1\n ) ! 2\n}.play\n);\n\nx.release\n\n\n// overlap scheme with width = 3 and initOutOffset = 1:\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Archive`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// make a storage place for various objects:\nq = (); // Event\n\nq[\\a_long_array] = Array.rand(128, 0.0, 1.0);\nq[\\pi_squared] = pi * pi;\nq[\\favourite_sound] = { { SinOsc.ar([300, 330]).sum * LFPulse.kr(2 + [0, 0.01]) * 0.1 }.play };\nq[\\same_long_array] = q[\\a_long_array]; // same objects may appear several times\n\nArchive.global.put(\\myData, q);\n\n\nArchive.global.at(\\myData).postcs;\n\n// after a recompile:\ns.boot;\n\nq = Archive.global.at(\\myData);\nq.postcs;\nq[\\favourite_sound].value;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `MxOutletApp.>>` do? What arguments does it take?"}, {"role": "assistant", "content": "Connect this outlet to an inlet or to each item in a query Arguments: inlet. Returns: inlet"}]} +{"conversations": [{"role": "user", "content": "What does `Object.nextN` do? What arguments does it take?"}, {"role": "assistant", "content": "Returns an array with the results of calling #-next a given number of Arguments: n — Number of message calls; inval — argument passed to the next message `Routine { inf.do { |i| i.rand.yield } }.nextN(8)`."}]} +{"conversations": [{"role": "user", "content": "What is the difference between \\degree, \\midinote and \\freq in a Pbind?"}, {"role": "assistant", "content": "`\\freq` is the frequency in Hz and is used as-is. `\\midinote` is a MIDI note number, converted to frequency by the default instrument. `\\degree` is a scale degree, quantised to the scale in \\scale (default major) rooted at \\root; degrees can be negative or fractional. If you set both, the more specific conversion wins, so set exactly one."}]} +{"conversations": [{"role": "user", "content": "What is a Buffer, and how is it different from a SoundFile?"}, {"role": "assistant", "content": "A Buffer is server-side memory: an array of samples (or a wavetable) living on scsynth, addressed by an integer bufnum. A SoundFile is a language-side object for reading or writing a file on disk. `Buffer.read(s, path)` loads a sound file into server memory and gives you a Buffer; `SoundFile.openRead(path)` just reads metadata such as duration and sample rate without loading audio. PlayBuf, GrainBuf and BufRd all take a Buffer, never a SoundFile."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `DecodeB2`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var w, x, y, p, a, b, c, d;\n\n p = PinkNoise.ar; // source\n\n // B-format encode\n #w, x, y = PanB2.ar(p, MouseX.kr(-1, 1), 0.1);\n\n // B-format decode to quad\n #a, b, c, d = DecodeB2.ar(4, w, x, y);\n\n [a, b, d, c] // reorder to my speaker arrangement: Lf Rf Lr Rr\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `IdentityBag.add` do?"}, {"role": "assistant", "content": "Add anObject to the Bag. A Bag may contain multiple entries of the same object. `IdentityBag[1, 2,"}]} +{"conversations": [{"role": "user", "content": "A starting point to start experimenting with non-standard synthesis?"}, {"role": "assistant", "content": "SuperCollider forum — A starting point to start experimenting with non-standard synthesis?\n\nI while ago I did this noise cloud generator which might serve as inspiration. Other ideas: scramble signals with FFT tools, granular synthesis, FM-synthesis with extreme settings, like index-of-modulation = 4000.\n\n```supercollider\nSynthDef(\\clouds, {\n var num = 10;\n var dur = \\duration.kr(1/6);\n var sig = num.collect{\n var freq = Rand(30, 5000) * SinOsc.kr(LFNoise1.kr(dur).range(30, 1000), 0, LFNoise1.kr(dur)\n .range(0.01, 8)).midiratio;\n var sig = Select.ar(LFNoise0.kr(dur).range(0, 2).round,\n [SinOsc.ar(freq, 0, 0.3), Saw.ar(freq, 0.3), Pulse.ar(freq, 0, 0.3)]);\n var filtFreq = Rand(30, 1000) * LFNoise1.kr(dur).range(1.0, 5.0);\n var filt = Select.ar(LFNoise0.kr(dur).range(0, 2).round,\n [LPF.ar(sig, filtFreq), HPF.ar(sig, filtFreq), BPF.ar(sig, filtFreq)]\n );\n sig = CombL.ar(filt, 0.5, LFNoise1.kr(dur).range(0.02, 0.5), rrand(0.3, 2));\n sig\n };\n var env = Env.perc(\\atk.kr(0.02), \\rel.kr(6), 1, \\cur.kr(-4)).ar(2);\n sig = Splay.ar(sig); // nb! levelComp: true, so if removed signal will be extremely loud!\n sig = LPF.ar(sig, 2000);\n sig = FreeVerb2.ar(sig[0], sig[1], LFNoise1.kr(dur).range(0, 1.0), LFNoise1.kr(dur).range(0.2, 2));\n sig = sig * env * \\amp.kr(1);\n Out.ar(\\out.kr(0), sig)\n}).add;\n\nSynth(\\clouds, [\\atk, rrand(0.01, 2), \\rel, rrand(1, 6.0), \\duration, rrand(0.01, 1)])\n// run it several times, the outcome is highly random\n```"}]} +{"conversations": [{"role": "user", "content": "How do I make a delay line?"}, {"role": "assistant", "content": "`CombN.ar(in, maxdelaytime, delaytime, decaytime)` is a feedback delay: maxdelaytime is the buffer size, delaytime the actual delay (and it can modulate), decaytime how long the repeats take to die. For a clean single echo use `DelayN.ar(in, maxdelaytime, delaytime)`, which has no feedback. Both replace the `in` with the delayed signal, so mix with the dry: `dry + CombN.ar(dry, 0.5, 0.3, 2) * 0.4`."}]} +{"conversations": [{"role": "user", "content": "SC can't open or read files?"}, {"role": "assistant", "content": "SuperCollider forum — SC can't open or read files\n\nIt looks as though it’s finally working!\n\nI moved the file to a folder I created in the user support directory for SuperCollider and then changed the quotes to ascii.\n\nI think the issue was that at first I had the file name listed without the extension, then I added the extension to the file name and added the file extension to the file path in the code and this must have created a conflict.\n\nIn the first instance SC needed the file extension, ascii quotes, and since I’m on windows the path needed double \\ in the path file.\n\nThe final working code looks like this:\n\n```supercollider\nb = Buffer.readChannel(s, \"C:\\\\Users\\\\44774\\\\AppData\\\\Local\\\\SuperCollider\\\\Tables\\\\wubsquare.wav\", startFrame:0, numFrames: -1);\n```\n\nThe wav file is simply named wubsquare and I included the file extension in the code."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `LinSelectX`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar(300),\n Pulse.ar(230)\n ];\n\n LinSelectX.ar(MouseX.kr(0, 1) * a.size, a) * 0.2\n}.play;\n);\n\n(\n{\n var a;\n a = [\n SinOsc.kr(0.25),\n LFSaw.kr(10),\n LFPulse.kr(0.3)\n ];\n\n SinOsc.ar(LinSelectX.kr(MouseX.kr(0, 1) * a.size, a) * 300 + 400) * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ SinOsc.ar(ControlRate.ir * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ SinOsc.ar(ControlRate.ir) * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `SDrone` in SuperCollider?"}, {"role": "assistant", "content": "SDrone — a droning sInstrument Based on the Ndef used for 'Strange Foreign Bodies'. Category: SInstruments."}]} +{"conversations": [{"role": "user", "content": "What does `RangeSlider.increment` do? What arguments does it take?"}, {"role": "assistant", "content": "Increments both #-lo and #-hi by #-step multiplied by Arguments: factor — A Float.."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Routine` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// SynthDefs on the fly\ns.boot;\n(\nt = TempoClock.new;\nr = Routine.new({\n 10.do({\n // could be done with an argument instead of a new def, but proves the point\n SynthDef(\"help-EnvGen\" ++ i, { arg out = 0;\n Out.ar(\n out,\n EnvGen.kr(Env.perc, 1.0, doneAction: Done.freeSelf)\n * SinOsc.ar(100 + (100 * t.elapsedBeats), 0, 0.1)\n )\n }).play(s);\n 1.yield;\n });\n}).play(t); // Note the alternative syntax: Routine.play(aClock)\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LFSaw`."}, {"role": "assistant", "content": "```supercollider\n{ LFSaw.ar(500, 1, 0.1) }.play\n\n// used as both Oscillator and LFO:\n{ LFSaw.ar(LFSaw.kr(4, 0, 200, 400), 0, 0.1) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "How do I make an additive bell with Klank?"}, {"role": "assistant", "content": "Klank is a bank of resonant filters excited by a short impulse: you describe the partials as\nfrequencies, amplitudes and decay times.\n\n```supercollider\n(\nSynthDef(\\klank, { |out = 0, freq = 440, amp = 0.3|\n var ratios = [1, 2.2, 3.7, 5.1, 7.3];\n var decays = [4, 2.6, 1.8, 1.2, 0.8];\n var sig = Klank.ar(`[ratios * freq, nil, decays], Impulse.ar(0, 0, 0.2), 1, 0, 0.3);\n Out.ar(out, Pan2.ar(sig * amp, 0));\n}).add;\n);\nSynth(\\klank);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// create a window for a given Ndef\nNdef(\\sound).edit\n(\nNdef(\\sound, { |freq = 440, rate = 2|\n SinOsc.ar(freq * [1, 1.625]) * SinOsc.kr(rate).max(0) * 0.2\n}).play;\n);\n\n// set lags for controls:\nNdef(\\sound).lag(\\freq, 0.2, \\rate, 0.5);\nNdef(\\sound).clear(1);\n\n// create a mixer for all Ndefs:\nNdefMixer(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// create a window for a given Ndef\nNdef(\\sound).edit\n(\nNdef(\\sound, { |freq = 440, rate = 2|\n SinOsc.ar(freq * [1, 1.625]) * SinOsc.kr(rate).max(0) * 0.2\n}).play;\n);\n\n// set lags for controls:\nNdef(\\sound).lag(\\freq, 0.2, \\rate, 0.5);\nNdef(\\sound).clear(1);\n\n// create a mixer for all Ndefs:\nNdefMixer(s);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// increase phase multiplier\n{ FBSineC.ar(SampleRate.ir, 1, 0, XLine.kr(1, 2, 10), 0.1) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// increase phase multiplier\n{ FBSineC.ar(SampleRate.ir, 1, 0, XLine.kr(1, 2, 10), 0.1) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "SC can't open or read files?"}, {"role": "assistant", "content": "SuperCollider forum — SC can't open or read files\n\nIt looks as though it’s finally working!\n\nI moved the file to a folder I created in the user support directory for SuperCollider and then changed the quotes to ascii.\n\nI think the issue was that at first I had the file name listed without the extension, then I added the extension to the file name and added the file extension to the file path in the code and this must have created a conflict.\n\nIn the first instance SC needed the file extension, ascii quotes, and since I’m on windows the path needed double \\ in the path file.\n\nThe final working code looks like this:\n\n```supercollider\nb = Buffer.readChannel(s, \"C:\\\\Users\\\\44774\\\\AppData\\\\Local\\\\SuperCollider\\\\Tables\\\\wubsquare.wav\", startFrame:0, numFrames: -1);\n```\n\nThe wav file is simply named wubsquare and I included the file extension in the code."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Resonz`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"noiseToPitch\", { arg out = 0, mul = 1;\n Out.ar(\n out,\n Resonz.ar(\n WhiteNoise.ar(mul),\n LFNoise0.kr(4, 110, 660),\n [0.005, 0.005]\n )\n )\n}).add;\n);\n\n(\n// activate left and right channels\nSynth(\"noiseToPitch\", [\\out, 0, \\mul, 1]);\nSynth(\"noiseToPitch\", [\\out, 1, \\mul, 1]);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n//listen to x and y output with defaults\n{Out.ar(0,0.5*SpruceBudworm.ar(0.0))}.play\n\n\n//be careful with rate range, can blow-up easily here, or just not sound\n{Out.ar(0,0.5*SpruceBudworm.ar(0.0,MouseX.kr(0.09,0.1)))}.play\n\n\n{Out.ar(0,0.5*SpruceBudworm.ar(0.0,,MouseX.kr(0.09,0.1),MouseY.kr(25.0,28.0)))}.play\n\n\n{Out.ar(0,0.5*SpruceBudworm.ar(Impulse.kr(MouseY.kr(1,50,'exponential')),0.1))}\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n//listen to x and y output with defaults\n{Out.ar(0,0.5*SpruceBudworm.ar(0.0))}.play\n\n\n//be careful with rate range, can blow-up easily here, or just not sound\n{Out.ar(0,0.5*SpruceBudworm.ar(0.0,MouseX.kr(0.09,0.1)))}.play\n\n\n{Out.ar(0,0.5*SpruceBudworm.ar(0.0,,MouseX.kr(0.09,0.1),MouseY.kr(25.0,28.0)))}.play\n\n\n{Out.ar(0,0.5*SpruceBudworm.ar(Impulse.kr(MouseY.kr(1,50,'exponential')),0.1))}.play\n\n\n\n{Out.ar(0,Pan2.ar(0.5*(SpruceBudworm.ar(Impulse.kr(MouseX.kr(1,50)),0.1,24.8,0.5,initx:MouseY.kr(0.2,1.2))[0])))}.play\n\n\n{10.0*(SpruceBudworm.ar(Impulse.kr(Line.kr(1,200,0.1)),0.1,19.8,0.5,initx:0.6)[0]-1.0)}.plot(0.1)\n\n\n{10.0*(SpruceBudworm.ar(Impulse.kr(MouseX.kr(1,200)),0.1,19.8,0.5,initx:0.6)[0]-1.0)}.play\n\n\n{10.0*(SpruceBudworm.ar(Impulse.kr(MouseX.kr(1,200)),0.1,MouseY.kr(19,28),0.5,initx:0.6)[0]-1.0)}.play\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Nil`?"}, {"role": "assistant", "content": "Nil — Represents uninitialized data"}, {"role": "user", "content": "What does `Nil.isNil` do?"}, {"role": "assistant", "content": "Answers true because this is nil. In class Object this message is defined to answer false. `[1, 2, nil, 3].collect(_.isNil);`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nx = nil;\nx = x.add(8); // returns an array\nx = x.add(7); // appends to the array\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Atk.userSupportDir` do?"}, {"role": "assistant", "content": "a class that stores some global variables for the Ambisonic Toolkit Returns: the path to the ATK support dir. Defaults to: `Platform.userAppSupportDir.dirname ++ \"/ATK\";`"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Normalizer`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n// example signal to process\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n z * 0.8\n}.play\n);\n\n(\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n [z, Normalizer.ar(z, 0.4, 0.01)] * 0.5\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `VarGui`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// synth definition with raising frequency\n\n(\nSynthDef(\\synth_0, { |devFactor = 0.1, devFreq = 10, amp = 0.1|\n var freq = XLine.kr(400, 1200, 10); \n Out.ar(0, SinOsc.ar(SinOsc.ar(devFreq, 0, devFactor * freq, freq), mul: amp).dup(2) * EnvGate.new) \n}).add;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `QuadN`."}, {"role": "assistant", "content": "```supercollider\n// default params\n{ QuadN.ar(SampleRate.ir/4) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What is `PBlip` in SuperCollider?"}, {"role": "assistant", "content": "PBlip — UGenPatterns quark library Based on Blip Category: Streams-Patterns-Events > UGenPatterns > Generators."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// The driven pendulum is interesting as it's a quite simple model\n// that includes parameter zones of chaotic behaviour:\n// http://lampx.tugraz.at/~hadley/physikm/apps/numerical_integration/pendulum.en.php\n\n// y here denotes the angle\n\n// y''(t) + (y'(t) / q) + sin(y(t)) = a * cos(omega * t)\n\n// which translates to\n\n// y'(t) = w(t)\n// w'(t) = (-w(t) / q) - sin(y(t)) + (a * cos(omega * t))\n\n\n(\nFb1_ODEdef(\\DrivenPendulum, { |t, y, q = 1, omega = 0,\n// …\n```"}, {"role": "assistant", "content": "The driven pendulum is interesting as it's a quite simple model that includes parameter zones of chaotic behaviour: (Fb1_ODE: general ordinary differential equation integrator pseudo ugen)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// randomly modulate all params\n(\n{ LatoocarfianC.ar(\n SampleRate.ir/4,\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5)\n) * 0.2 }.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// randomly modulate all params\n(\n{ LatoocarfianC.ar(\n SampleRate.ir/4,\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5)\n) * 0.2 }.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Just experimenting with patterns that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n/* Some Funky Klangs - Totally botched the math on what I was trying to do but it sounds better this way */\n\n( \nSynthDef(\\DistKlangBlip, { \n | out = 0, release = 1, freq1 = 1, freq2 = 5, freq3 = 8, freqMult = 4 | \n var env = Linen.kr(Impulse.kr(0), 0.01, 1, release, doneAction:2); \n var freqs = ([freq1, freq2, freq3] * freqMult).midicps; \n var klang = Klang.ar(`[freqs, nil, nil ], 1, 0); \n Out.ar(out, klang.tanh!2 * env * 0.5) \n}).add\n\n);\n\n( \n Pbind(*[ \n instrument: \\DistKlangBlip, \n dur: Pxrand([0.25, 0.5], inf) * 0.5, \n release: Pkey(\\dur), \n freqMult: Pxrand((3..12), inf), \n freq2: Prand([4,5], inf), \n freq3: Prand([8,12], inf) \n]).play; \n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\\help_sinegrain, { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0.5pi, env))\n}).add;\n\na = Pbind(\\instrument, \\help_sinegrain, \\note, Pseq([0, 7, 2, 9, 11, 10, 9, 8], inf), \\dur, 1);\na.play(quant: (quant: 1, phase: 0));\na.play(quant: (quant: 1, phase: 1/3));\na.play(quant: (quant: 1, phase: 1.0.rand))\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\\help_sinegrain, { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0.5pi, env))\n}).add;\n\na = Pbind(\\instrument, \\help_sinegrain, \\note, Pseq([0, 7, 2, 9, 11, 10, 9, 8], inf), \\dur, 1);\na.play(quant: (quant: 1, phase: 0));\na.play(quant: (quant: 1, phase: 1/3));\na.play(quant: (quant: 1, phase: 1.0.rand));\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `PathName.pathOnly` do?"}, {"role": "assistant", "content": "returns the full path up to the file name itself; i.e. everything up to and including the last slash. This is handy e.g. for storing several files in the same folder."}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for very punchy snare in neurofunk style: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\neurosnare, {\n var snd;\n // a percussive click to give it some attack\n snd = LPF.ar(HPF.ar(WhiteNoise.ar, 300), 8000) * Env.linen(0.001, 0.01, 0.001).ar;\n // sine sweep body. very important!\n snd = snd + (SinOsc.ar(Env([400, 196, 160], [0.04, 0.2], \\exp).ar) * Env.perc(0.04, 0.2).ar * 6.dbamp).tanh;\n // sound of snare coils rattling\n snd = snd + (HPF.ar(BPeakEQ.ar(WhiteNoise.ar, 4000, 0.5, 3), 300) * Env.perc(0.05, 0.2).delay(0.01).ar(2) * -3.dbamp);\n // another sound sweep to improve the attack, optional\n snd = snd + (SinOsc.ar(XLine.kr(3000, 1500, 0.01)) * Env.perc(0.001, 0.02).ar);\n // distortion helps glue everything together and acts as a compressor\n snd = (snd * 1.4).tanh;\n snd = Pan2.ar(snd, \\pan.kr(0), \\amp.kr(0.1));\n Out.ar(\\out.kr(0), snd);\n}).add;\n);\n\nSynth(\\neurosnare, [amp: 0.4]);\n```"}]} {"conversations": [{"role": "user", "content": "Write a random pentatonic melody that plays by itself."}, {"role": "assistant", "content": "Pick degrees from a pentatonic scale; `\\scale` and `\\root` define the pitch space, and `\\degree`\npicks within it.\n\n```supercollider\n(\nPbind(\n \\instrument, \\default,\n \\scale, Scale.minorPentatonic,\n \\root, 3,\n \\degree, Pwhite(0, 9, inf),\n \\octave, 5,\n \\dur, Pwhite(0.12, 0.28, inf),\n \\amp, 0.2,\n \\legato, 0.8\n).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `BusPlug`."}, {"role": "assistant", "content": "```supercollider\nb = BusPlug.new;\n{ Blip.ar(b + 5) }.play;\nb.bus.set(12);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// create a new server\na = Server(\\foo, NetAddr(\"127.0.0.1\", 57123)).boot.makeWindow;\nNdef(\\sound, { SinOsc.ar([600, 635]) * SinOsc.kr(2).max(0) * 0.2 }).play; // play on default\nNdef(\\sound -> \\foo, { SinOsc.ar([700, 745]) * SinOsc.kr(2).max(0) * 0.2 }).play; // play on foo\n\n// clear definitions\nNdef(\\sound -> \\foo).clear(3);\nNdef(\\sound).clear(3;\n\na.dump; // display settings of new server\na.quit; // terminate new server\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// create a new server\na = Server(\\foo, NetAddr(\"127.0.0.1\", 57123)).boot.makeWindow;\nNdef(\\sound, { SinOsc.ar([600, 635]) * SinOsc.kr(2).max(0) * 0.2 }).play; // play on default\nNdef(\\sound -> \\foo, { SinOsc.ar([700, 745]) * SinOsc.kr(2).max(0) * 0.2 }).play; // play on foo\n\n// clear definitions\nNdef(\\sound -> \\foo).clear(3);\nNdef(\\sound).clear(3);\n\na.dump; // display settings of new server\na.quit; // terminate new server\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n// use input amplitude to control Pulse amplitude - use headphones to prevent feedback.\nSynthDef(\"help-AmplitudeMod\",{ arg out=0;\n Out.ar(out,\n Pulse.ar(90, 0.3, Amplitude.kr(SoundIn.ar))\n )\n}).play;\n\n);\n\n\n(\n// use input amplitude to control SinOsc frequency - use headphones to prevent feedback.\nz = SynthDef(\"help-AmplitudeMod\",{ arg out=0, attack=0.01, release=0.01;\n Out.ar(out,\n SinOsc.ar(\n AmplitudeMod.kr(\n SoundIn.ar,\n attack,\n release,\n 1200,\n 4\n// …\n```"}, {"role": "assistant", "content": "use input amplitude to control Pulse amplitude - use headphones to prevent feedback. use input amplitude to control SinOsc frequency - use headphones to prevent feedback. (AmplitudeMod: amplitude follower (deprecated))"}]} +{"conversations": [{"role": "user", "content": "What does `Object.cs` do?"}, {"role": "assistant", "content": "Shorthand for #-asCompileString. `{ 10.do { 10.postln }"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Stethoscope`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var f = { |l,h| SinOsc.kr(0.1, {pi.rand}).range(l, h) } ;\n Pulse.ar({ f.(20, 1000) }!6, { f.(0.0, 1) }!6, { f.(0.0, 1.0) }!6)\n}.play;\n);\n\nc = s.scope;\nc.numChannels = 6;\nc.scopeView.waveColors = [Color.red, Color.red, Color.cyan, Color.cyan, Color.white, Color.white];\nc.style = 2;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `List.wrapExtend` do?"}, {"role": "assistant", "content": "Returns a new List whose elements are repeated sequences of the receiver, up to size length. The receiver is unchanged."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// randomly modulate all params\n(\n{ LatoocarfianN.ar(\n SampleRate.ir/4,\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5)\n) * 0.2 }.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// randomly modulate all params\n(\n{ LatoocarfianN.ar(\n SampleRate.ir/4,\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5)\n) * 0.2 }.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nf = ();\nf.beatAndBar = {\n var t = currentEnvironment.clock; // t= TempoClock.new;\n var text = \"xB: \";\n\n var nBeatsPerBar = { arg n, beats, clock;\n var nBpb = clock.beatsPerBar * n;\n \"\" ++ n ++ text ++ (nBpb - (beats%(nBpb))).asInteger\n };\n\n t.play({arg beats, time, clock;\n ( //[\"beat: \" ++ (t.beatInBar + 1).asInteger] ++ //uncomment for beat in bar\n [1,2,4,8,16,32].collect( {|n,i| nBeatsPerBar.value(n, beats, clock)})\n ).postln;\n 1});\n \"beatAntBar\";\n}\n);\n\nf[\\beatAndBar].value;\n\n(\nf[\\beatAndBar].value;\nCmdPeriod.add(f[\\beatAndBar]);\n)\n```"}, {"role": "assistant", "content": "Prints beats to bars for a mutiple of bar.\r\nHow many beats left until next 1, 2, 4, 8, 16, 32, etc bar."}]} +{"conversations": [{"role": "user", "content": "What does `Sieve.new_o` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new Sieve object in mode 'points' with Arguments: gen — A generator. Allowed generators: Integers, Streams or Patterns producing intervals or Sieves itself. Integers and Stream/Pattern output must be strictly positive. Integers as generators produce zero and its positive multiples.; offset — An Integer.; limit — An integer limit, which is included when reached. If no limit is passed, returned integers might go up to default limit 65536.."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// loopFunc also takes a pattern of Functions, in this case\n// the arg loopFuncPerItem decides if next Functions are polled per item or per loop.\n\n(\n~lookBack = 0;\n~loopFuncPerItem = true; // or 1\n\np = Pbind(\n \\dur, Pn(Pshuf([1, 1, 2]/6)),\n \\midinote, PSloop(\n Prand((60..80), inf),\n bufSize: 10,\n lookBack: { ~lookBack },\n // every number gets a Function that adds an interval of that size\n loopFunc: Pxrand((3..11), inf).collect { |x| { |y| y - [0, x].postln } },\n loopFuncPerItem: { ~loopFuncPerItem }\n )\n// …\n```"}, {"role": "assistant", "content": "loopFunc also takes a pattern of Functions, in this case the arg loopFuncPerItem decides if next Functions are polled per item or per loop. (PSloop: Pattern to derive loops from a given Pattern)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Out.ar(87, SinOsc.ar(MouseX.kr(340, 1000, 1) * [1, 2, 3], 0, 0.2)) }.play;\nx = Monitor.new.play(87, 3, 0, fadeTime: 3;\nx.stop;\nx.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Out.ar(87, SinOsc.ar(MouseX.kr(340, 1000, 1) * [1, 2, 3], 0, 0.2)) }.play;\nx = Monitor.new.play(87, 3, 0, fadeTime: 3);\nx.stop;\nx.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Why LeakDC and not a standard HPF for DC removal?"}, {"role": "assistant", "content": "SuperCollider forum — Why LeakDC and not a standard HPF for DC removal?\n\nHello everyone,\n\nI’m a bit sceptical of the DC removal implementation in LeakDC. As I understand it, DC removal is nothing but a HPF, preferably placed below the audible range. For this purpose, LeakDC seems to be reaching far too high, attenuating the audible low frequencies. You can run the following code and look at the server meter to see the difference in level between the two audio channels (note: there is of course no DC offset in this example that would need fixing):\n\n```supercollider\n( play { [\n SinOsc.ar(50),\n LeakDC.ar(SinOsc.ar(50))\n] * 0.2 } )\n```\n\nAlso, LeakDC’s behaviour is not consistent between sample rates (as is mentioned in the help file).\n\nI ran the it through Plugin Doctor to back up my suspicions and got these results:\n\nstandard coefficient of 0.995:\n\nSR 48 kHz: Filter starts rolling off at 200 Hz, -2dB at 50 Hz.\n\nSR 96 kHz: Filter starts rolling off at 500 hz! It reaches already -2dB at 100 Hz, -5 dB at 50 Hz.\n\ncoefficient of 0.999:\n\nSR 48 kHz: Filter starts rolling off at 50 Hz, -2 dB at 10 Hz.\n\nSR 96 kHz: Filter starts rolling off at 100 Hz, -2 dB at 20 Hz.\n\nI wonder why one wouldn’t just use a standard HPF at 10 Hz (or so) instead? It is consistent between sample rates, it only starts to roll of below 30 Hz and it reaches only -0.5 dB at 20 Hz. So this actually looks much better in the server meter:\n\n```supercollider\n( play { [\n SinOsc.ar(50),\n HPF.ar(SinOsc.ar(50), 10)\n] * 0.2 } )\n```\n\nSo my question is: Is there any reason why the LeakDC implementation would be peferable to such a standard butterworth HPF?\n\nOne difference I can see is that the HPF still has an initial offset spike before settling around zero phase, LeakDC does not show that behaviour:\n\n```supercollider\n{ LeakDC.ar(DC.ar(0.5)) }.plot(0.5);\n{ HPF.ar(DC.ar(0.5), 10) }.plot(0.5);\n\n{ LeakDC.ar(SinOsc.ar + DC.ar(0.5)) }.plot(0.02);\n{ HPF.ar(SinOsc.ar + DC.ar(0.5), 10) }.plot(0.02);\n```\n\nSo this could be a reason – I don’t know enough about filters to understand why this happens though. Any enlightenment would be appreciated."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Dust`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-Dust\", { |out = 0|\n Out.ar(out,\n Dust.ar(200, 0.5)\n )\n}).play;\n);\n\n(\nSynthDef(\"help-Dust\", { |out = 0|\n Out.ar(out,\n Dust.ar(XLine.kr(20000, 2, 10), 0.5)\n )\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `MxCable.instr` do?"}, {"role": "assistant", "content": "This is an internally used Instr, created on Returns: Instr"}]} +{"conversations": [{"role": "user", "content": "Explain `SGUIelement` in SuperCollider briefly."}, {"role": "assistant", "content": "SGUIelement ��� a value with one or more views This is a value with one or more views attached. Category: SInstruments."}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n~buf = Buffer.read(s, \"C:/sounds/break.wav\");\nPlayBuf.ar(1, ~buf, BufRateScale.kr(~buf), loop: 1);\n```"}, {"role": "assistant", "content": "Loads a sound file into server memory, then plays it in a loop at the file's original pitch.\n\n- `Buffer.read(s, path)` allocates a buffer on the server and fills it from the file. It is asynchronous:\n the Buffer object returns immediately, the samples arrive later.\n- `PlayBuf.ar(1, buf, ...)` needs the channel count first — 1 for a mono file. A wrong count is the usual\n cause of a buffer that plays wrongly or not at all.\n- `BufRateScale.kr(buf)` compensates when the file's sample rate differs from the server's, so `rate: 1` is\n the file's true speed.\n- `loop: 1` restarts at the end instead of stopping.\n\nBecause the read is asynchronous, this line pair is only safe if a `s.sync` or a wait happened in between;\notherwise PlayBuf sees a buffer with no data yet."}]} +{"conversations": [{"role": "user", "content": "What does Splay.ar do?"}, {"role": "assistant", "content": "`Splay.ar(inArray, spread, level, center, levelComp)` takes an array of mono signals and distributes them across the stereo field, so `Splay.ar(SinOsc.ar([220, 330, 440]) * 0.1)` is a three-source stereo chord rather than three separate synths. spread (0..1) controls how far the voices fan out and center shifts the middle. It is the shorthand for 'make this array stereo'."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\"help-EnvDetect\",{Out.ar(0,Pan2.ar(\nSinOsc.ar(440,0,0.3*EnvDetect.ar(LFNoise1.ar(20), MouseX.kr(0.001,0.1,'exponential'), MouseY.kr(0.001,0.1,'exponential'))) \n,0.0))\n}).play\n);\n\n\n(\nSynthDef(\"help-EnvDetect\",{Out.ar(0,Pan2.ar(\nLFSaw.ar(EnvDetect.ar(LFNoise1.ar(11,100,200), MouseX.kr(2,0.0001,'exponential'), MouseY.kr(2,0.0001,'exponential')),0,0.3*En\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\"help-EnvDetect\",{Out.ar(0,Pan2.ar(\nSinOsc.ar(440,0,0.3*EnvDetect.ar(LFNoise1.ar(20), MouseX.kr(0.001,0.1,'exponential'), MouseY.kr(0.001,0.1,'exponential'))) \n,0.0))\n}).play\n);\n\n\n(\nSynthDef(\"help-EnvDetect\",{Out.ar(0,Pan2.ar(\nLFSaw.ar(EnvDetect.ar(LFNoise1.ar(11,100,200), MouseX.kr(2,0.0001,'exponential'), MouseY.kr(2,0.0001,'exponential')),0,0.3*EnvDetect.ar(LFSaw.ar(7), MouseX.kr(0.001,1,'exponential'), MouseY.kr(0.001,1,'exponential'))) \n,0.0))\n}).play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Synth.replace` do?"}, {"role": "assistant", "content": "Create and return a Synth and use it to replace `nodeToReplace`, taking its place in its server's node"}]} +{"conversations": [{"role": "user", "content": "Explain `SmoothFoldS2` in SuperCollider briefly."}, {"role": "assistant", "content": "SmoothFoldS2 — wave folding pseudo ugen using sine segments, two fold ranges Wave folding using SmoothClipS. Values outside the range lo-hi are folded back, if the concerned foldRange > 0. A larger foldRange means less folding whereas a smaller foldRange causes more folding. The spectral result depends on the source wave form also but in general a smaller foldRange causes more energy in the higher spectrum whereas near foldRange == 0 the higher part of the spectrum again d Category: Libraries > miSCellaneous > WaveFolding."}]} +{"conversations": [{"role": "user", "content": "What happens when I call .play on a function?"}, {"role": "assistant", "content": "`.play` on a Function builds a SynthDef from the function body, adds it to the server under an anonymous name, and starts one Synth of it. You get back the Synth, so `x = { SinOsc.ar(440) * 0.1 }.play; x.free;` stops it. It is the fastest way to hear something, but it is not how you write a piece: nothing is named, nothing can be reused, and the definition is lost when the Synth is freed."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `GbmanN`."}, {"role": "assistant", "content": "```supercollider\n// default initial params\n{ GbmanN.ar(MouseX.kr(20, SampleRate.ir)) * 0.1 }.play(s);\n\n// change initial params\n{ GbmanN.ar(MouseX.kr(20, SampleRate.ir), -0.7, -2.7) * 0.1 }.play(s);\n\n// wait for it...\n{ GbmanN.ar(MouseX.kr(20, SampleRate.ir), 1.2, 2.0002) * 0.1 }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(GbmanN.ar(40)*400+500)*0.4 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar(300),\n Pulse.ar(230)\n ];\n\n SelectX.ar(MouseX.kr(0, 1) * a.size, a) * 0.2\n}.play;\n);\n\n(\n{\n var a;\n a = [\n SinOsc.kr(0.25),\n LFSaw.kr(10),\n LFPulse.kr(0.3)\n ];\n\n SinOsc.ar(SelectX.kr(MouseX.kr(0, 1) * a.size, a) * 300 + 400) * 0.2\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar(300),\n Pulse.ar(230)\n ];\n\n SelectX.ar(MouseX.kr(0, 1) * a.size, a) * 0.2\n}.play;\n);\n\n(\n{\n var a;\n a = [\n SinOsc.kr(0.25),\n LFSaw.kr(10),\n LFPulse.kr(0.3)\n ];\n\n SinOsc.ar(SelectX.kr(MouseX.kr(0, 1) * a.size, a) * 300 + 400) * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `ClassGui.guiBody` do? What arguments does it take?"}, {"role": "assistant", "content": "a Class inspector showing superclasses, methods and internals Arguments: layout — the parent view, FlowView or window. Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `HPZ2`."}, {"role": "assistant", "content": "```supercollider\n// Compare:\n\n{ WhiteNoise.ar(0.25) }.play;\n\n{ HPZ2.ar(WhiteNoise.ar(0.25)) }.play;\n\n// HPZ2 is useful to detect changes in a signal:\n// see also HPZ1\n(\n{\n var changingSignal = LFNoise0.ar(1000);\n var hpz2 = HPZ2.ar(changingSignal);\n [hpz2, hpz2 > 0]\n}.plot\n);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BinaryOpUGen`."}, {"role": "assistant", "content": "```supercollider\na = WhiteNoise.ar; // a WhiteNoise\nb = a + 2; // a BinaryOpUGen.\nb.operator; // +\n\n// sound example\n(\n{\n var a = LFSaw.ar(300);\n var b = LFSaw.ar(329.1);\n a % b * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var trig = Dust.kr(10);\n SinOsc.ar(\n TBrownRand.kr(300, 3000, 1.0, MouseX.kr(0, 5), trig)\n ) * 0.1\n}.play;\n);\n\n(\n{\n var trig = Dust.kr(10);\n Pan2.ar(\n SinOsc.ar(LinExp.kr(TBrownRand.kr(dev:0.2, trig:trig), 0, 1, 300, 3000)),\n TBrownRand.kr(-1.0, 1.0, 1.0, 4, trig),\n 0.1\n )\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var trig = Dust.kr(10);\n SinOsc.ar(\n TBrownRand.kr(300, 3000, 1.0, MouseX.kr(0, 5), trig)\n ) * 0.1\n}.play;\n);\n\n(\n{\n var trig = Dust.kr(10);\n Pan2.ar(\n SinOsc.ar(LinExp.kr(TBrownRand.kr(dev:0.2, trig:trig), 0, 1, 300, 3000)),\n TBrownRand.kr(-1.0, 1.0, 1.0, 4, trig),\n 0.1\n )\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ SinOsc.ar(500 + LFPulse.ar(4).bipolar(40), 0, 0.5 * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ SinOsc.ar(500 + LFPulse.ar(4).bipolar(40), 0, 0.5) * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "How do I record my output to a file?"}, {"role": "assistant", "content": "`s.record(path)` starts recording the server's output; `s.stopRecording` stops it.\n\n```supercollider\ns.record(\"C:/audio/take1.wav\");\n// play for a while\ns.stopRecording;\n```\n\nThe path must be writable and the format follows the extension (.wav, .aiff, .flac). The file is written\nby the server, so it captures exactly what the master bus produces — including your effects, which is what\nyou want. `s.record` also accepts `duration:` to stop by itself, which is the reproducible form for a take."}]} +{"conversations": [{"role": "user", "content": "What does `PopUpTreeMenu.numFlashes` do?"}, {"role": "assistant", "content": "Set the number of flashes for the select item animation. The default is"}]} +{"conversations": [{"role": "user", "content": "What does `SwitchableKeyDownResponder.value` do? What arguments does it take?"}, {"role": "assistant", "content": "like Select but for key responders : dynamically switches between different responders Arguments: view; char; modifier; unicode; keycode."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// this does not work:\n(\n{\n var trig = Dust.ar(4);\n Trig.kr(trig, 0.1) * SinOsc.ar(800) * 0.1\n}.play;\n);\n\n// this works:\n(\n{\n var trig = T2K.kr(Dust.ar(4));\n Trig.kr(trig, 0.1) * SinOsc.ar(800) * 0.1\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// this does not work:\n(\n{\n var trig = Dust.ar(4);\n Trig.kr(trig, 0.1) * SinOsc.ar(800) * 0.1\n}.play;\n);\n\n// this works:\n(\n{\n var trig = T2K.kr(Dust.ar(4));\n Trig.kr(trig, 0.1) * SinOsc.ar(800) * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SelectXFocus.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Mix one output from many sources Arguments: which — Index of the selected input, which is also the center of the selection for a focus > 0.; array — A collection of inputs.; focus — The \"fuzziness\" of the selection: the larger the focus, the less adjacent inputs are mixed in.; wrap — If set to true, index will wrap around the array of inputs (see also: Array#-wrapAt). `(`."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Re: the perfect frequencies. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// Rumush\n// https://mycelialcordsblog.wordpress.com/\n// https://fungorumush.bandcamp.com/releases\n// https://soundcloud.com/fungorum\n\n(\nf = {\n var rep = [4, 8, 16, 32];\n var n = rep.choose;\n var x = [\n\n 54, 60, 66, 72, 81, 90, 96, 102,\n 108, 128, 132, 144, 162, 180, 192, 204,\n 216, 240, 264, 288, 324, 360, 384, 408,\n 432, 480, 528, 576, 648, 720, 768, 816,\n 864, 960, 1056, 1152, 1296, 1440, 1536, 1632,\n 1728, 1920, 2112, 2304, 2592, 2880, 3072, 3264,\n 3456, 3840, 4224, 4608, 5184, 5760, 6144, 6528,\n 6912, 7680, 8448, 9216, 10368, 11520, 12288, 528\n\n ];\n Mix.fill(n,\n {\n var detune = 5.rand;\n var sin = SinOsc.ar(x.choose, 4.rand, 0.25);\n var saw = RLPF.ar(Saw.ar(x.choose*0.01+detune, 0.75), x.choose, 2.rand).tanh;\n Pan2.ar((sin+saw) * EnvGen.kr(Env.sine(12, 1/n), 1, doneAction:2),\n 1.rand2) }\n );\n};\n);\n\n(\n// DEFINE A ROUTINE\nr = Routine({\n\n inf.do({\n f.play;\n 10.wait;\n })\n});\n);\n\nr.reset.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n// Simple amplitude tracker sending values to sclang\nSynthDef(\\ampTracker, { |in|\n var freq = 30; // num of values per second\n SendReply.kr(Impulse.kr(freq), '/amp', Amplitude.kr(SoundIn.ar(in)));\n}).add;\n);\n\n// start the tracker on scsynth\nSynth(\\ampTracker);\n\n(\n// receive the values in sclang\nOSCdef(\\ampTracker, { |m|\n m.postln;\n // now use m[3] for your purpose (detecting changes, etc...)\n}, '/amp');\n)\n```"}, {"role": "assistant", "content": "It's jsut an amplitude tracker, to exaplin how to send values from scsynth to sclang."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a, b;\na = Pseq([1, 2, 3], inf);\nb = Pseq([65, 76], inf);\nc = Pswitch1([a, b, 800], Pseq([2, 2, 0, 1], inf));\nx = c.asStream;\n24.do({ x.next.postln });\n);\n\n\n// Pswitch used as a sequence of pitches:\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a, b;\na = Pseq([1, 2, 3], inf);\nb = Pseq([65, 76], inf);\nc = Pswitch1([a, b, 800], Pseq([2, 2, 0, 1], inf));\nx = c.asStream;\n24.do({ x.next.postln });\n);\n\n\n// Pswitch used as a sequence of pitches:\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n(\na = Pseq([73, 71, 69], inf);\nb = Pseq([0, 0, 0, 4, 0]+64, inf);\nc = Pswitch1([a, b, 75], Pseq([2, 2, 0, 1], inf));\nx = c.asStream;\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, x.next.midicps]);\n 0.18.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `NodeControl`."}, {"role": "assistant", "content": "```supercollider\nd = SynthDef(\"help-NodeControl\", { |out = 0, freq = 400|\n Out.ar(out,\n SinOsc.ar(freq, 0, 0.5)\n )\n});\ny = d.play; // the synth\n\nc = NodeControl(y, 1);\n\nc.value = 500;\n\nc.value = 300;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `VectorSplineGui.focused` do? What arguments does it take?"}, {"role": "assistant", "content": "Switches the currently focused data dimension. Indexing starts with the first data dimension, not the 0th (time) dimension. So focused = 0 focuses spline dimension Arguments: di — Integer. Returns: Integer"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ BRF.ar(Saw.ar(200, 0.1), FSinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3800, 4000), 0.3) }.play;\n\n{ BRF.ar(Saw.ar(200, 0.5), MouseX.kr(100, 10000, 1), 0.3) }.play;\n\n\n // BRF on control signals:\n(\n{ var vib = BRF.kr(SinOsc.kr([1, 3, 10], 0, [1, 0.5, 0.25]).sum, MouseX.kr(1, 10, 1), 0.3);\n SinOsc.ar(vib * 200 + 600) * 0.2 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ BRF.ar(Saw.ar(200, 0.1), FSinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3800, 4000), 0.3) }.play;\n\n{ BRF.ar(Saw.ar(200, 0.5), MouseX.kr(100, 10000, 1), 0.3) }.play;\n\n\n // BRF on control signals:\n(\n{ var vib = BRF.kr(SinOsc.kr([1, 3, 10], 0, [1, 0.5, 0.25]).sum, MouseX.kr(1, 10, 1), 0.3);\n SinOsc.ar(vib * 200 + 600) * 0.2 }.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a bell in SuperCollider."}, {"role": "assistant", "content": "A bell is a set of inharmonic partials with a long percussive decay. The ratios below are the\nclassic bell ones; the envelope frees the Synth when it ends.\n\n```supercollider\n(\nSynthDef(\\bell, { |out = 0, freq = 440, amp = 0.2, dur = 3|\n var partials = [1, 2.76, 5.4, 8.93];\n var amps = [1, 0.5, 0.3, 0.15];\n var sig = SinOsc.ar(freq * partials) * amps;\n var env = EnvGen.kr(Env.perc(0.001, dur, 1, -6), doneAction: 2);\n Out.ar(out, Pan2.ar(Mix(sig) * env * amp, 0));\n}).add;\n);\nSynth(\\bell, [\\freq, 660, \\dur, 4]);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `FSinOsc`."}, {"role": "assistant", "content": "```supercollider\n{ FSinOsc.ar(800) * 0.2 }.play;\n\n{ FSinOsc.ar(XLine.kr(200, 4000, 1)) * 0.2 }.play;\n\n// loses amplitude towards the end\n{ FSinOsc.ar(FSinOsc.ar(XLine.kr(4, 401, 8), 0.0, 200, 800)) * 0.2 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `ControlName.rate` do?"}, {"role": "assistant", "content": "The rate of the Returns: a Symbol like `'audio'` or `'control'`"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ArrayedCollection`."}, {"role": "assistant", "content": "```supercollider\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n pitches.size.do{ |i|\n {\n var freq = pitches[i].midicps;\n var env = Env.perc.ar(Done.freeSelf);\n SinOsc.ar(freq) * 0.1 * env\n }.play;\n 0.2.wait\n }\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `DiskIn`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n\n\n// create with cueSoundFile class method\nb = Buffer.cueSoundFile(s, ExampleFiles.apollo11, 0, 1);\nx = { DiskIn.ar(1, b) }.play;\nb.close; // must call close in between cueing\n// now use like named instance method, but different arguments\nb.cueSoundFile(ExampleFiles.apollo11);\n// have to do all this to clean up properly!\nx.free; b.close; b.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Beam me up scotty. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n{\nvar time = 8;\nvar freq = (40-12).midicps;\nvar a = VarSaw.ar(freq/2, width: XLine.ar(0.5,1,time)).range(0,XLine.ar(1,1/1000,time));\nvar tone = SinOsc.ar(freq).fold(-1*a,a);\nOut.ar(0, tone.dup);\n}.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `PlayerInputProxy.rate` do?"}, {"role": "assistant", "content": "placeholder for Patch inputs for a player that will be supplied later"}]} +{"conversations": [{"role": "user", "content": "What does `ProxySpace.release` do?"}, {"role": "assistant", "content": "release all proxies (i.e. keep the groups"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\na = Psubdivide(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,0,1,3,4,0], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n100.do({ x.next.postln });\n);\n\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Psubdivide(\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\na = Psubdivide(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,0,1,3,4,0], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n100.do({ x.next.postln });\n);\n\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Psubdivide(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n);\n\n\n(\na = Psubdivide(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,4,4,0,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Why does every UGen have mul and add arguments?"}, {"role": "assistant", "content": "They are a convenience applied to the UGen's output: the result is `ugens_result * mul + add`. So `SinOsc.ar(440, 0, 0.2)` is the same as `SinOsc.ar(440) * 0.2`, and `SinOsc.ar(440, 0, 0.5, 1800)` is usable directly as a frequency. They exist because multiplying and offsetting is so common that folding it into the UGen saves a node in the graph and a line in the source."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `HPZ1`."}, {"role": "assistant", "content": "```supercollider\n// Compare:\n\n{ WhiteNoise.ar(0.25) }.play;\n\n{ HPZ1.ar(WhiteNoise.ar(0.25)) }.play;\n\n// HPZ1 is useful to detect changes in a signal:\n// see also HPZ2\n(\n{\n var changingSignal = LFNoise0.ar(1000);\n var hpz1 = HPZ1.ar(changingSignal);\n [hpz1, hpz1 > 0, hpz1.abs > 0]\n}.plot\n);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `SelectX` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar(300),\n Pulse.ar(230)\n ];\n\n SelectX.ar(MouseX.kr(0, 1) * a.size, a) * 0.2\n}.play;\n);\n\n(\n{\n var a;\n a = [\n SinOsc.kr(0.25),\n LFSaw.kr(10),\n LFPulse.kr(0.3)\n ];\n\n SinOsc.ar(SelectX.kr(MouseX.kr(0, 1) * a.size, a) * 300 + 400) * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Array.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a new array with size 0 that can grow up to the fixed Arguments: maxSize — The maximum size of the array.."}]} +{"conversations": [{"role": "user", "content": "Explain `FoaNFC` in SuperCollider briefly."}, {"role": "assistant", "content": "FoaNFC — First Order Ambisonic (FOA) near-field compensation filter Apply near-field compensation filtering to a First Order Ambisonic signal (B-format). Category: Libraries > Ambisonic Toolkit > UGens > FOA > Transformer, UGens > Multichannel > Ambisonics."}]} +{"conversations": [{"role": "user", "content": "What does `NodeProxy.clear` do? What arguments does it take?"}, {"role": "assistant", "content": "reset everything to nil, neutralizes Arguments: fadeTime — if a fadeTime is given, first fade out, then clear.."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\AcnSn3dIn;\n~description = \"A live ambisonic input (ACN_SN3D)\";\n~channelLayout = \\ambi;\n\n~function = { |order=1, t_trig = 0, bus = 0|\n var env = EnvGen.kr(Env([0,1], [1]), t_trig);\n var chans = Array.series(\n size: (order + 1).pow(2).asInteger,\n start: bus,\n step: 1\n );\n var input = SoundIn.ar(chans) * env;\n HOAConverterAcnSn3d2AcnN3d.ar(order, input);\n};\n```"}, {"role": "assistant", "content": "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see ."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\nz = {\nBBandPass.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(20, 20000, \\exponential),\n MouseY.kr(0.0, 10.0, \\linear), // bw\n 0.5); // mul\n}.play)\nz.release;\n\n(\nz = {\nBBandPass.ar(\n WhiteNoise.ar ! 2,\n MouseX.kr(20, 20000, \\exponential),\n MouseY.kr(0.0, 10.0, \\linear), // bw\n 0.5); // mul\n}.play\nz.release;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\nz = {\nBBandPass.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(20, 20000, \\exponential),\n MouseY.kr(0.0, 10.0, \\linear), // bw\n 0.5); // mul\n}.play)\nz.release;\n\n(\nz = {\nBBandPass.ar(\n WhiteNoise.ar ! 2,\n MouseX.kr(20, 20000, \\exponential),\n MouseY.kr(0.0, 10.0, \\linear), // bw\n 0.5); // mul\n}.play)\nz.release;\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Resonz`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"noiseToPitch\", { arg out = 0, mul = 1;\n Out.ar(\n out,\n Resonz.ar(\n WhiteNoise.ar(mul),\n LFNoise0.kr(4, 110, 660),\n [0.005, 0.005]\n )\n )\n}).add;\n);\n\n(\n// activate left and right channels\nSynth(\"noiseToPitch\", [\\out, 0, \\mul, 1]);\nSynth(\"noiseToPitch\", [\\out, 1, \\mul, 1]);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nv = Vowel()\nv.addFormants([3000,4000], -6, [200, 200])\n\n{Formants.ar(100, v) * 0.1 }.play\n{Formants.ar(100, Vowel()) * 0.1}.play\n \n{[Formants.ar(100, Vowel()) * 0.1, Formants.ar(100, v) * 0.1 ]}.play\n\nv.removeFormants([5,6]\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nv = Vowel()\nv.addFormants([3000,4000], -6, [200, 200])\n\n{Formants.ar(100, v) * 0.1 }.play\n{Formants.ar(100, Vowel()) * 0.1}.play\n \n{[Formants.ar(100, Vowel()) * 0.1, Formants.ar(100, v) * 0.1 ]}.play\n\nv.removeFormants([5,6])\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// write a sine oscillator's output to a pin, and read the pin value at other times\n\n(\nSynthDef(\"help-DigitalIO\", { |out = 0|\n DigitalIO.ar(0, SinOsc.ar(10), LFPulse.kr(0.1)).poll;\n}).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// write a sine oscillator's output to a pin, and read the pin value at other times\n\n(\nSynthDef(\"help-DigitalIO\", { |out = 0|\n DigitalIO.ar(0, SinOsc.ar(10), LFPulse.kr(0.1)).poll;\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n//try passing a signal through the hair cell; it won't come out like a pure sine, more like an impulse train stimulated by that input\n{ Pan2.ar(HairCell.ar(SinOsc.ar(440)),0.0) }.play;\n\n//modulation effects\n{ Pan2.ar(HairCell.ar(Saw.ar(MouseX.kr(1,1000)),0.0,MouseY.kr(0.0,1000.0)),0.0) }.play;\n\n//constantly self oscillates at 5 Hz, talk through it to modulate from base rate... \n{ Pan2.ar(HairCell.ar(SoundIn.ar,5.0,100),0.0) }.play;\n\n//sweeps and beeps\n{ Pan2.ar(HairCell.ar(Saw\n// …\n```"}, {"role": "assistant", "content": "try passing a signal through the hair cell; it won't come out like a pure sine, more like an impulse train stimulated by that input constantly self oscillates at 5 Hz, talk through it to modulate from base rate... (HairCell: Simple cochlear hair cell model)"}]} +{"conversations": [{"role": "user", "content": "What does `Bus.audio` do? What arguments does it take?"}, {"role": "assistant", "content": "Allocate a private audio bus on the Arguments: server — The Server. Defaults to Server.default.; numChannels — Number of channels to allocate."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// play SinOscs silently and wait for granulation envelopes\n\n(\na = Bus.audio(s, 10);\nx = { Splay.ar(In.ar(a, 10) * SinOsc.ar((3..12) * 100, 0, 0.05)) }.play\n);\n\n// send envelope to buses in parallel\n\n(\nz = {\n DXEnvFanOut.ar(\n [0, 3] + Dseq((0..3) + a.index, inf) + Diwhite(0, 3),\n \n // with newer SC versions you can also write:\n // [0, 3] + Dseq((0..3), inf) + Diwhite(0, 3) + a.index,\n \n fadeTime: 0.05,\n width: 1,\n initOutOffset: -0.5\n )\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// play SinOscs silently and wait for granulation envelopes\n\n(\na = Bus.audio(s, 10);\nx = { Splay.ar(In.ar(a, 10) * SinOsc.ar((3..12) * 100, 0, 0.05)) }.play\n);\n\n// send envelope to buses in parallel\n\n(\nz = {\n DXEnvFanOut.ar(\n [0, 3] + Dseq((0..3) + a.index, inf) + Diwhite(0, 3),\n \n // with newer SC versions you can also write:\n // [0, 3] + Dseq((0..3), inf) + Diwhite(0, 3) + a.index,\n \n fadeTime: 0.05,\n width: 1,\n initOutOffset: -0.5\n )\n}.play\n);\n\nx.release;\n\n// cleanup\n\n(\nz.free;\na.free;\n);\n\n\n// Ex.7 from DXEnvFan help looks a bit different,\n// as DXEnvFanOut is an out ugen we don't need to mix\n\n(\na = Bus.audio(s, 4);\n{\n DXEnvFanOut.ar(\n (0..3).collect { |i| Dseq((0..3).rotate(i), inf) } + a.index,\n fadeTime: [0.01, 0.05],\n width: 1\n );\n In.ar(a, 4)\n}.plot(0.2)\n);\n\na.free\n```"}]} +{"conversations": [{"role": "user", "content": "What is `IFFT`?"}, {"role": "assistant", "content": "IFFT — Inverse Fast Fourier Transform"}, {"role": "user", "content": "What does `IFFT.new` do?"}, {"role": "assistant", "content": "returns a time domain signal from converting the FFT frequency domain signal chain. The *new method is equivalent to the *ar message returns an audio rate signal."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// without any modification, convert FFT chain (frequency domain signal) back to audio (time domain signal)\n(\n{ var in, chain;\n in = WhiteNoise.ar;\n chain = FFT(LocalBuf(2048), in);\n IFFT.ar(chain) * -20.dbamp // inverse FFT\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `FreqScopeView`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// Start server\ns.boot;\n\n// Create analyzer in a window\n(\nw = Window(\"My Analyzer\", Rect(0, 0, 511, 300)); // width should be 511\nf = FreqScopeView(w, w.view.bounds);\nf.active_(true); // turn it on the first time;\n\nw.onClose_({ f.kill }); // you must have this\nw.front;\n{ SinOsc.ar([500, 1000], 0, 0.25).mean.dup }.play(s); // start two sine waves\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{LPCError.ar(AudioIn.ar, MouseX.kr(1,64))}.play\n\n{LPCError.ar(SinOsc.ar(LFNoise0.kr(0.2,400,500)), MouseX.kr(1,64))}.play\n\n{LPCError.ar(Resonz.ar(Mix(Saw.ar(100*[1,0.9,0.8,0.7,0.5])),1000,0.1,2), MouseX.kr(1,64)}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{LPCError.ar(AudioIn.ar, MouseX.kr(1,64))}.play\n\n{LPCError.ar(SinOsc.ar(LFNoise0.kr(0.2,400,500)), MouseX.kr(1,64))}.play\n\n{LPCError.ar(Resonz.ar(Mix(Saw.ar(100*[1,0.9,0.8,0.7,0.5])),1000,0.1,2), MouseX.kr(1,64))}.play\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns = Server.local;\nb = Bus.control(s, 1);\n\nSynthDef(\"help-InTrig\", { |out = 0, busnum = 0|\n var inTrig;\n inTrig = InTrig.kr(busnum);\n Out.ar(out,\n EnvGen.kr(Env.perc, gate: inTrig, levelScale: inTrig) * SinOsc.ar\n )\n}).play(s, [\\out, 0, \\busnum, b.index]);\n\n\nb.set(1.0;\n\nb.value = 1.0;\n\nb.value = 0.2;\n\nb.value = 0.1;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns = Server.local;\nb = Bus.control(s, 1);\n\nSynthDef(\"help-InTrig\", { |out = 0, busnum = 0|\n var inTrig;\n inTrig = InTrig.kr(busnum);\n Out.ar(out,\n EnvGen.kr(Env.perc, gate: inTrig, levelScale: inTrig) * SinOsc.ar\n )\n}).play(s, [\\out, 0, \\busnum, b.index]);\n\n\nb.set(1.0);\n\nb.value = 1.0;\n\nb.value = 0.2;\n\nb.value = 0.1;\n```"}]} +{"conversations": [{"role": "user", "content": "Resetting start count with PulseDivider?"}, {"role": "assistant", "content": "SuperCollider forum — Resetting start count with PulseDivider?\n\ni think in your example Sweep is receiving a trigger while going from 0 to 1 causing the discontinuity in the phase because the duration between one trigger and the next is unknown.\n\nwith this example you get at least a continiuous phase with random triggers to drive the hanning window (evaluate it several times). but its not multichannel with distributed phases / windows accross channels:\n\n```supercollider\n(\nvar randomTrigPhase = { |triggerRate = 10, randomness = 1|\n var minDuration = (2 ** randomness) / triggerRate;\n var maxDuration = (2 ** (-1 * randomness)) / triggerRate;\n var demand = Dunique(minDuration * ((maxDuration / minDuration) ** Dwhite(0, 1)));\n var duration = Duty.ar(demand, DC.ar(0), demand);\n var phase = Phasor.ar(DC.ar(0), (1 / duration) / SampleRate.ir, 0, 1);\n (phase: phase, trigger: HPZ1.ar(phase) < 0);\n};\n\nvar hanningWindow = { |phase|\n (1 - (phase * 2pi).cos) / 2 * (phase < 1);\n};\n\n{\n var rate = 100;\n var phase = randomTrigPhase.(rate, 1).phase;\n hanningWindow.(phase);\n}.plot(0.1);\n)\n```\n\nim not sure if this is helping it just reminded me of some issue with multichannel random triggers and continiuous phases i have been trying to solve."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar(300),\n Pulse.ar(230)\n ];\n\n LinSelectX.ar(MouseX.kr(0, 1) * a.size, a) * 0.2\n}.play;\n);\n\n(\n{\n var a;\n a = [\n SinOsc.kr(0.25),\n LFSaw.kr(10),\n LFPulse.kr(0.3)\n ];\n\n SinOsc.ar(LinSelectX.kr(MouseX.kr(0, 1) * a.size, a) * 300 + 400) * 0.2\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar(300),\n Pulse.ar(230)\n ];\n\n LinSelectX.ar(MouseX.kr(0, 1) * a.size, a) * 0.2\n}.play;\n);\n\n(\n{\n var a;\n a = [\n SinOsc.kr(0.25),\n LFSaw.kr(10),\n LFPulse.kr(0.3)\n ];\n\n SinOsc.ar(LinSelectX.kr(MouseX.kr(0, 1) * a.size, a) * 300 + 400) * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Very quick-and-dirty hack to show stereo phase. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\nb = Bus.audio(s, 2);\na = { |inbus = 0|\n var sig = In.ar(inbus, 2);\n // x axis is side, oriented toward right;\n // y axis is mid\n [sig[1] - sig[0], sig.sum]\n}.play(s.defaultGroup, outbus: b, addAction: \\addAfter);\nc = s.scope;\nc.style = 2;\nc.bus = b;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Can you run this code and tell me if it works?"}, {"role": "assistant", "content": "No — I cannot execute SuperCollider. What I can tell you is what would break and why: bracket balance, arguments that must exist for the class, a SynthDef that never reaches Out, a SynthDef played before it is added, an envelope that frees the Synth immediately. For certainty, evaluate it: the post window reports errors precisely, and `s.plotTree` shows whether the node exists."}]} +{"conversations": [{"role": "user", "content": "What does `MAbstractElement.indices` do?"}, {"role": "assistant", "content": "returns an array of indices that points to `this` from the top level of the `MKtl` elements hierarchy. These values correspond with"}]} +{"conversations": [{"role": "user", "content": "What is `SkipJack` in SuperCollider?"}, {"role": "assistant", "content": "SkipJack — A utility for background tasks that survive cmd-period SkipJack is a utility to run a function in the background repeatedly, that survive cmd-period. Category: Scheduling, JITLib > GUI."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `LFPulse` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\ns.meter;\ns.scope;\n\n// synthesize 2 test signals at level 0.1 (-20 dB), first on separate channels\n(\n{ var n = 2, level = 0.1, spread = 1, pan = 0;\n LFPulse.ar({ 100.exprand(2000) } ! n).range(-1, 1) * level\n}.play;\n);\n\n// now mix/pan these 2 signals using Splay, level at 0.1 (-20dB)\n(\nx = { |spread = 1, level = 0.1, center = 0|\n var n = 2;\n var snd = LFPulse.ar({ 100.exprand(2000) } ! n).range(-1, 1);\n var stereo = Splay.ar(snd, spread, level, center);\n Peak.ar(stereo, Impulse.kr(2)).ampdb.poll(2);\n stereo\n}.play;\n);\n\n// when we set full spread, panned to center:\n// the 2 signals are discrete, left and right\n// we see the energy-based levelComp applied (1/2.sqrt).ampdb = -3\nx.set(\\spread, 1, \\center, 0); // -20 - 3 = -23dB\n\n// no spread, panned center:\n// each signal decreases by 3dB as they move to the center (from the panning function)\n// and the two signals mix on each channel, so we get -20 dB\nx.set(\\spread, 0, \\center, 0); // -20dB\n\n// no spread, panned fully right:\n// the signals fully mix in the right channel (+6 dB)\nx.set(\\spread, 0, \\center, 1); // -23 + 6 = -17db\n```"}]} +{"conversations": [{"role": "user", "content": "What does `MxUnitApp.moveBy` do? What arguments does it take?"}, {"role": "assistant", "content": "Move the unit by a channel@slot offset. Overwrites anything that might be Arguments: vector — Point representing the offset. eg. 1@0 will move it to the next channel."}]} +{"conversations": [{"role": "user", "content": "Approaches to recording generated midi in DAW?"}, {"role": "assistant", "content": "SuperCollider forum — Approaches to recording generated midi in DAW?\n\nToday I spent another 6 hours or so trying to record in ardour (linux) both the midi information generated by supercollider and the audio generated by sending this midi to external synths. I finally hit the right combination of magic to make it work and I want to add my recipe in this thread so that I can find it back the future (and perhaps it also works for someone else).\n\nIngredient 1: a2jmidid. You can run it manually on the command line using “a2jmidid -e” or (like me) you can just use the “start midi bridge” button in the jack front-end application “Cadence” (enable the “export hardware ports checkbox”)\n\nIngredient 2: In supercollider itself, it is extremely important to only connect to a port and not to specify a destination uid. It seems that by specifying a destination uid, supercollider gets some kind of direct connection to the midi destination and ardour can no long introspect/record what is happening (I know it doesn’t sound scientific - this is purely the result of empiric observation/frustration.\n\nSo in supercollider, simply use\n\n```supercollider\n~synth1 = MIDIOut(0);\n~synth2 = MIDIOut(1);\n```\n\nand then in ardour’s Window->Midi Connections dialog, you can connect the out ports from supercollider to both your external synth and the track in which you want to record the midi information.\n\nFor midi driver in jack you can configure None.\n\nIf you want to record the generated midi in ardour, do NOT use connection syntax like\n\n```supercollider\n~synth1 = MIDIOut(0, MIDIClient.destinations[2].uid);\n```\n\nand do NOT use\n\n```supercollider\n~synth1 = MIDIOut.newByName(\"INTEGRA-7\", \"INTEGRA-7 MIDI 1\");\n```\n\nIf you just want to send midi to the external synth without recording the information, both previous ways of connecting work as well but these ways of connecting appear to work only if the jack MIDI driver is configured to use “ALSA sequencer” mode. It doesn’t seem to work with “None” or “ALSA Raw” (this may need some further investigation to clear out)."}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nRoutine({ loop { Synth(\\kick); 0.5.wait } }).play;\n```"}, {"role": "assistant", "content": "It starts a kick every half second, forever.\n\nA Routine is a language-side coroutine: `.play` runs it on the clock, and `wait` suspends it until the next\nbeat without blocking anything else. Inside the `loop`, `Synth(\\kick)` creates a kick and `0.5.wait` waits\nhalf a beat on the current TempoClock — the tempo, not seconds, so changing the clock changes the rate.\nBecause the kick SynthDef frees itself with `doneAction: 2`, the loop can run for hours without leaking\nnodes."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `SelectX` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar(300),\n Pulse.ar(230)\n ];\n\n SelectX.ar(MouseX.kr(0, 1) * a.size, a) * 0.2\n}.play;\n);\n\n(\n{\n var a;\n a = [\n SinOsc.kr(0.25),\n LFSaw.kr(10),\n LFPulse.kr(0.3)\n ];\n\n SinOsc.ar(SelectX.kr(MouseX.kr(0, 1) * a.size, a) * 300 + 400) * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `SmoothFoldQ` in SuperCollider briefly."}, {"role": "assistant", "content": "SmoothFoldQ — wave folding pseudo ugen using parabolic segments Wave folding using SmoothClipQ. Values outside the range lo-hi are folded back, if foldRange > 0. A larger foldRange means less folding whereas a smaller foldRange causes more folding. The spectral result depends on the source wave form also but in general a smaller foldRange causes more energy in the higher spectrum whereas near foldRange == 0 the higher part of the spectrum again decreases. Note Category: Libraries > miSCellaneous > WaveFolding."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n~name = \\test_noise_burst;\n~description = \"A short burst of enveloped noise that goes well with Patterns\";\n~channelLayout = \\mono;\n\n~function = { arg amp=1, trimDB = 0, attack = 0.01, release = 0.3;\n var env;\n env = EnvGen.ar(Env.perc(attack, release, 0.5), doneAction: Done.freeSelf);\n trimDB.dbamp*amp*PinkNoise.ar(1);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `BufRd` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n// indexing with a phasor\n{ BufRd.ar(1, b, Phasor.ar(0, BufRateScale.kr(b), 0, BufFrames.kr(b))) }.play;\n\n// indexing by hand\n{ BufRd.ar(1, b, K2A.ar(MouseX.kr(0, BufFrames.kr(b)))) }.play;\n\nb.free\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DC`."}, {"role": "assistant", "content": "```supercollider\n// won't work (the output is 0.5*0.0), which is why we need the DC UGen!\n{ 0.5 }.play\n\n// constantly zero\n{ DC.ar(0.0) }.play;\n\n\n// DC offset; will click on start and finish\n{ DC.ar(0.5) + SinOsc.ar(440, 0, 0.1) }.play;\n\n\n// test - note the transient before LeakDC adapts and suppresses the offset\n{ LeakDC.ar(DC.ar(0.5)) }.play;\n\n\n// show scope\ns.scope\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nSynthDef(\"mini\",{\n Out.ar( 0,\n Instr(\"minimoog.two\").ar( SinOsc.kr(1.0).range(300,500) )\n )\n}).send(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nSynthDef(\"mini\",{\n Out.ar( 0,\n Instr(\"minimoog.two\").ar( SinOsc.kr(1.0).range(300,500) )\n )\n}).send(s);\n```"}]} {"conversations": [{"role": "user", "content": "What is `CutProcStream` in SuperCollider?"}, {"role": "assistant", "content": "CutProcStream — Stream wrapper for a cut procedure Stream wrapper for a cut procedure, for use with Patterns or in your own custom code. Category: Libraries > BBCut > Core."}]} -{"conversations": [{"role": "user", "content": "What does `StackLayout.index` do?"}, {"role": "assistant", "content": "Sets or gets the index of the current view. The current view is placed on top of others, and if #-mode is 0, all the others are"}]} -{"conversations": [{"role": "user", "content": "What does `PV_PhaseShift.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Shift phase. Arguments: buffer — FFT buffer.; shift — Phase shift in radians.; integrate — If greater than zero, integrate the phase-shift across calls (for an accumulating phase shift).."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SoundFile`."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\\diskIn2, { |out, amp = 1, bufnum, sustainTime, atk = 0, rel = 0, gate = 1|\n var sig = VDiskIn.ar(2, bufnum, BufRateScale.kr(bufnum));\n var gateEnv = EnvGen.kr(Env([1, 1, 0], [sustainTime-rel, 0]));\n var env = EnvGen.kr(Env.asr(atk, 1, rel), gate * gateEnv, doneAction: Done.freeSelf);\n Out.ar(out, sig * env * amp)\n});\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// It might also be desirable to start with a fade from silence.\n// This can be done with a negative initOutOffset:\n\n(\nx = {\n var lfo = XLine.ar(1, 0.5, 60);\n DXMix.ar(\n Dseq([0, 4, 1, 5, 2, 6, 3, 7], inf),\n `(Saw.ar((1..8) * 70 * lfo, 0.075)),\n fadeTime: 2,\n width: 2,\n initOutOffset: -1\n ) ! 2\n}.play\n);\n\nx.release\n\n\n// overlap scheme with width = 2 and initOutOffset = -1:\n```"}, {"role": "assistant", "content": "It might also be desirable to start with a fade from silence. This can be done with a negative initOutOffset: (DXMix: crossfades between signals according to demand-rate control)"}]} -{"conversations": [{"role": "user", "content": "What is the difference between the language and the server?"}, {"role": "assistant", "content": "sclang runs your code, the clock and Patterns, and builds UGen graphs. scsynth performs the DSP in real time. They communicate over OSC, which is why a language-side mistake can leave a sound running, and why s.freeAll stops it."}]} -{"conversations": [{"role": "user", "content": "What does `SynthDesc.canFreeSynth` do?"}, {"role": "assistant", "content": "is true if the Synth can free itself (via some means, usually a"}]} -{"conversations": [{"role": "user", "content": "What does `AbstractPlayer.composeUnaryOp` do? What arguments does it take?"}, {"role": "assistant", "content": "the base class for all Players : a playable object Arguments: operator."}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n~pad = Synth(\\pad, [\\freq, 165]);\n~pad.set(\\gate, 0);\n```"}, {"role": "assistant", "content": "It starts a sustained synth and then releases it.\n\n`Synth(\\pad, [\\freq, 165])` creates an instance of a SynthDef that takes a `gate` argument (default 1). The\narray after the name is alternating argument names and values: `\\freq, 165`. Setting `\\gate` to 0 does not\ncut the sound dead — the EnvGen inside sees the gate close and runs the release stage of its Env, then frees\nthe Synth because that EnvGen has `doneAction: 2`. This is the standard lifecycle for pads, drones and any\nsound you want to stop gracefully."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Impulse`."}, {"role": "assistant", "content": "```supercollider\n{ Impulse.ar(4, [0, MouseX.kr(0, 1)], 0.2) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "My sustained synth never stops, even when I set the gate to 0."}, {"role": "assistant", "content": "A sustained EnvGen only releases when the gate goes from positive to non-positive *after* the envelope has started, and the Synth only disappears if that EnvGen has `doneAction: 2`. Check three things: the SynthDef actually takes a `gate = 1` argument, the Env is a sustained shape (Env.adsr or Env.asr, not Env.perc), and you call `x.set(\\gate, 0)` on the Synth object. Setting the gate on a different Synth, or on a Group, does nothing."}]} -{"conversations": [{"role": "user", "content": "What is `SynthDef`?"}, {"role": "assistant", "content": "SynthDef — Client-side representation of a synth definition"}, {"role": "user", "content": "What does `SynthDef.new` do?"}, {"role": "assistant", "content": "Create a SynthDef instance, evaluate the ugenGraphFunc and build the ugenGraph."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_notRand, { |out|\n Out.ar(out,\n SinOsc.ar(rrand(400, 800), 0, 0.2) * Line.kr(1, 0, 1, doneAction: Done.freeSelf)\n )\n}).add;\n);\na = Synth(\\help_notRand);\nb = Synth(\\help_notRand); // the same freq as a\n```"}]} -{"conversations": [{"role": "user", "content": "What is `InTrig` in SuperCollider?"}, {"role": "assistant", "content": "InTrig — Generate a trigger anytime a bus is set. Any time the bus is \"touched\", ie. has its value set (using \"/c_set\" etc.), a single impulse trigger will be generated. Its amplitude is the value that the bus was set to. Category: UGens > InOut, UGens > Triggers."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\na = Synth(\\MoaningDialogue)\n\n//COOL TWEAKS\n//AngryTweak\na.set(\\feedback, 29,\\freq, 6)\n//CalmTweak\na.set(\\feedback, 60, \\freq, 0.8)\n//WeirdTweak\na.set(\\feedback, 2.8, \\freq, 2)\n\n(\nSynthDef(\\MoaningDialogue, {\n |rateL = 0.2, rateR = 0.3, freq = 2, feedback = 50, mul = 1 , lpfreq = 2500|\n Out.ar(0,\n FreeVerb.ar(\n BLowPass.ar(\n SinOscFB.ar(\n LFDNoise1.kr([rateL, rateR], freq), feedback;\n , mul),\n lpfreq,\n 0.2\n ),\n 0.3,\n 0.0\n )\n )}\n).add\n)\n```"}, {"role": "assistant", "content": "One of the first synths I made.\r\nA frog-like sounding synth, with a dialogue between the left and the right channel.\r\nI've also notated some simple tweaks."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n \n// definition for future reference in arbitrary Environments\n\n(\np = Pbind(\n \\midinote, PLnaryFunc(\\f, \\src, [\\dev]),\n \\dur, 0.1\n);\n);\n\n\n// define Environment and play\n\n(\ne = (f: { |x,y| x + y }, src: PLseq([61, 62]), dev: Pbrown(-5, 5, 0.2) );\n\ne.use { x = p.play };\n);\n\n\n// replace Function input Patterns\n\ne.dev = PLseq((0, 0.5..7));\n\ne.src = PLseq([61,64,6\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n \n// definition for future reference in arbitrary Environments\n\n(\np = Pbind(\n \\midinote, PLnaryFunc(\\f, \\src, [\\dev]),\n \\dur, 0.1\n);\n);\n\n\n// define Environment and play\n\n(\ne = (f: { |x,y| x + y }, src: PLseq([61, 62]), dev: Pbrown(-5, 5, 0.2) );\n\ne.use { x = p.play };\n);\n\n\n// replace Function input Patterns\n\ne.dev = PLseq((0, 0.5..7));\n\ne.src = PLseq([61,64,65]);\n\n\n// replace Function \n\ne.f = { |x,y| x - y };\n\ne.f = { |x,y| y * 4 + x };\n\n\nx.stop;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `UGen.binaryValue` do?"}, {"role": "assistant", "content": "Outputs 1, representing true for positive, 0 representing false for negative or zero input"}]} -{"conversations": [{"role": "user", "content": "What does `EaseOutInBack.value` do? What arguments does it take?"}, {"role": "assistant", "content": "Back ease-out/in Arguments: t — a Float between 0.0 and 1.0.; a — overshoot. The default is 1.70158."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// patching input to output\n\n// beware of the feedback\n\n(\nServerOptions.inDevices.postln; // post available audio input devices\ns.meter; // display level meters for monitoring\nSynthDef(\\helpAudioIn, { |out|\n var input = AudioIn.ar(1); // first input\n // delay output to tame feedback in case of microphones are configured:\n Out.ar(out, CombN.ar(input * -25.dbamp, 0.5, 0.5, 0.001))\n}).play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// patching input to output\n\n// beware of the feedback\n\n(\nServerOptions.inDevices.postln; // post available audio input devices\ns.meter; // display level meters for monitoring\nSynthDef(\\helpAudioIn, { |out|\n var input = AudioIn.ar(1); // first input\n // delay output to tame feedback in case of microphones are configured:\n Out.ar(out, CombN.ar(input * -25.dbamp, 0.5, 0.5, 0.001))\n}).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `AbstractFunction`."}, {"role": "assistant", "content": "```supercollider\na = { |x, root = 60| x + root }; b = a.midicps; [a.value(9), b.value(9)];\na = Pseries(60, 1, inf).midicps; a.asStream.nextN(12);\n{ a = LFNoise1.ar(1) * 5 + 60; Pulse.ar(a.round.midicps) * 0.1 }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Select`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-Select\", { |out = 0|\n\n var a, cycle;\n a = [\n SinOsc.ar,\n Saw.ar,\n Pulse.ar\n ];\n cycle = a.size * 0.5;\n Out.ar(out,\n Select.ar(LFSaw.kr(1.0, 0.0, cycle, cycle), a) * 0.2\n )\n}).play;\n\n);\n\n// Here used as a sequencer:\n(\nSynthDef(\"help-Select-2\", { |out = 0|\n\n var a, s, cycle;\n a = Array.fill(32, { rrand(30, 80) }).midicps;\n a.postln;\n cycle = a.size * 0.5;\n\n s = Saw.ar(\n Select.kr(\n LFSaw.kr(1.0, 0.0, cycle, cycle),\n a\n ),\n 0.2\n );\n Out.ar(out, s)\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\na = PlazyEnvir({ |a = 0, b = 1| Pshuf([a, a, b], 2) }); // a, b default to 0, 1\nx = Pn(a, inf).asStream;\n\n10.do { x.next.postln }; Post.nl;\ne = (a: 100);\n10.do { x.next(e).postln }; Post.nl;\ne = (a: 100, b: 200);\n10.do { x.next(e).postln };\n);\n\n\n// PlazyEnvir used to produce a Pbind:\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05, pan = 0|\n var env;\n env = EnvGen.kr(\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\na = PlazyEnvir({ |a = 0, b = 1| Pshuf([a, a, b], 2) }); // a, b default to 0, 1\nx = Pn(a, inf).asStream;\n\n10.do { x.next.postln }; Post.nl;\ne = (a: 100);\n10.do { x.next(e).postln }; Post.nl;\ne = (a: 100, b: 200);\n10.do { x.next(e).postln };\n);\n\n\n// PlazyEnvir used to produce a Pbind:\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05, pan = 0|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, Pan2.ar(SinOsc.ar(freq, 0, env), pan))\n }).add;\n\na = PlazyEnvir({ |g = 0, h = 0, dur = 1|\n postf(\"g: %, h: %, dur: %\\n\", g, h, dur);\n Pbind(\n \\instrument, \\help_sinegrain,\n \\dur, dur,\n \\degree, Pseq([g, g, h, g, h], 2)\n )\n});\n);\n\n// different variants\n(a <> (g: 0, h: 3, dur: 0.2)).play; // single stream\n(a <> (g: [0, 4], h: [3, -1], dur: 0.2)).play; // same durations, two streams\n```"}]} -{"conversations": [{"role": "user", "content": "What does `ArrayedCollection.asRandomTable` do?"}, {"role": "assistant", "content": "Return an integral table that can be used to generate random numbers with a specified distribution. (see Randomness helpfile for a more detailed example)"}]} -{"conversations": [{"role": "user", "content": "What does `Buffer.updateInfo` do? What arguments does it take?"}, {"role": "assistant", "content": "Sends a b_query message to the server, asking for a description of this buffer. Upon reply this Buffer's instance variables are automatically Arguments: action — A Function to be evaluated once the file has been read and this Buffer's instance variables have been updated. The function will be passed this Buffer as an argument.."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// If a Function is passed to indices it takes the current lookBack arg as argument.\n\n// mirroring the full lookBack size\n// start without loop\n\n(\n~lookBack = 0;\n\np = PSloop(\n Pbind(\n \\dur, Pn(Pshuf([1, 1, 2]/6)),\n \\midinote, Prand((60..80), inf)\n ),\n bufSize: 10,\n lookBack: { ~lookBack },\n indices: { |l| (0..l-1).mirror }\n).trace.play\n);\n\n// wait a bit to fill buffer\n// mirrored loop i.e. loop with added retrograde\n\n~lookBack = 3\n\n\n// go on and loop again\n\n~lookBack = 0\n\n~lookBack = 3\n\np.stop\n```"}, {"role": "assistant", "content": "If a Function is passed to indices it takes the current lookBack arg as argument. mirroring the full lookBack size (PSloop: Pattern to derive loops from a given Pattern)"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = { |x| sin(x) } rrand: { |x| sin(x) * -1 };\n(0..1000).normalize(0, 5pi).collect(a).plot;\n\n(\n{ a = SinOsc.ar(335); b = SinOsc.ar(MouseX.kr(1, 1000, 1));\nrrand(a, b) * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = { |x| sin(x) } rrand: { |x| sin(x) * -1 };\n(0..1000).normalize(0, 5pi).collect(a).plot;\n\n(\n{ a = SinOsc.ar(335); b = SinOsc.ar(MouseX.kr(1, 1000, 1));\nrrand(a, b) * 0.1 }.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// examples:\n\n(\n{\n var mod = SinOsc.kr(Line.kr(1, 10, 10));\n SinOsc.ar(LinLin.kr(mod, -1, 1, 100, 900)) * 0.1\n}.play;\n);\n\n// modulating destination values.\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(LinLin.ar(mod, -1, 1, MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1))) * 0.1\n}.play;\n);\n\n// modulating source and destination values.\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(\n LinLin.ar(mod,\n SinOsc.kr(0.2), SinOsc.kr\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// examples:\n\n(\n{\n var mod = SinOsc.kr(Line.kr(1, 10, 10));\n SinOsc.ar(LinLin.kr(mod, -1, 1, 100, 900)) * 0.1\n}.play;\n);\n\n// modulating destination values.\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(LinLin.ar(mod, -1, 1, MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1))) * 0.1\n}.play;\n);\n\n// modulating source and destination values.\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(\n LinLin.ar(mod,\n SinOsc.kr(0.2), SinOsc.kr(0.2543),\n MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1)\n )\n ) * 0.1\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `BufCombC` in SuperCollider?"}, {"role": "assistant", "content": "BufCombC — Buffer based comb delay line with cubic interpolation. Comb delay line with cubic interpolation which uses a buffer for its internal memory. See also BufCombN which uses no interpolation, and BufCombL which uses linear interpolation. Cubic interpolation is more computationally expensive than linear, but more accurate. Category: UGens > Delays > Buffer."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `MIDIIn`."}, {"role": "assistant", "content": "```supercollider\nMIDIIn.connect;\ns.boot;\n\n(\nSynthDef(\"sik-goo\", { |out, freq = 440, formfreq = 100, gate = 0.0, bwfreq = 800|\n var x;\n x = Formant.ar(\n SinOsc.kr(0.02, 0, 10, freq),\n formfreq,\n bwfreq\n );\n x = EnvGen.kr(Env.adsr, gate, Latch.kr(gate, gate)) * x;\n Out.ar(out, x);\n}).add;\n);\n\nx = Synth(\"sik-goo\");\n\n// set the action:\n(\n~noteOn = { |src, chan, num, vel|\n x.set(\\freq, num.midicps / 4.0);\n x.set(\\gate, vel / 200);\n x.set(\\formfreq, vel / 127 * 1000);\n};\nMIDIIn.addFuncTo(\\noteOn, ~noteOn);\n\n~noteOff = { |src, chan, num, vel|\n x.set(\\gate, 0.0);\n};\nMIDIIn.addFuncTo(\\noteOff, ~noteOff);\n\n~bend = { |src, chan, val|\n // (val * 0.048828125).postln;\n x.set(\\bwfreq, val * 0.048828125);\n};\nMIDIIn.addFuncTo(\\bend, ~bend);\n);\n\n// cleanup\nMIDIIn.removeFuncFrom(\\noteOn, ~noteOn);\nMIDIIn.removeFuncFrom(\\noteOff, ~noteOff);\nMIDIIn.removeFuncFrom(\\bend, ~bend);\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n/* Audio plugin definition\n\n Each audio plugin should define the following global variables:\n ~name: (symbol) name of the spatializer\n ~description: (string) a short description\n ~function: the actual definition of the plugin\n\n*/\n\n~name = \\MonoIn;\n~description = \"A direct input\";\n~channelLayout = \\mono;\n\n~function = {\n |gate = 0, bus = 0, attack = 0.02, susL = 0.9, release = 0.1, curve = -4|\n var env = Env.asr(attack, susL, release, curve);\n SoundIn.ar(bus, EnvGen.kr(env, gate));\n}\n```"}, {"role": "assistant", "content": "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see ."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\np = ProxySpace.push(s.boot);\n~a.play.quant_(4); ~b.play.quant_(4);\n~c = { LFNoise1.kr(8).range(0,15).round };\n~a = Pbind(\\degree, Pstutter(4, Pseq([0,2,3,4], inf)), \\octave, [3,4], \\dur, 0.25, \\amp, 0.3);\n~b = Pbind(\\octave, 4, \\scale, Scale.majorPentatonic, \\degree, ~c, \\dur, 1/4, \\legato, 0.5);\n```"}, {"role": "assistant", "content": "a short piece which plays random major music. It sounded very happy."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Since the allpass delay has no audible effect as a resonator on\n// steady state sound ...\n\n{ AllpassN.ar(WhiteNoise.ar(0.1), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// ...these examples add the input to the effected sound and compare variants so that you can hear\n// the effect of the phase comb:\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassN.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2)\n}.play)\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassL.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Since the allpass delay has no audible effect as a resonator on\n// steady state sound ...\n\n{ AllpassN.ar(WhiteNoise.ar(0.1), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// ...these examples add the input to the effected sound and compare variants so that you can hear\n// the effect of the phase comb:\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassN.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2)\n}.play)\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassL.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2)\n}.play)\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassC.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2)\n}.play)\n\n// used as an echo - doesn't really sound different than Comb,\n// but it outputs the input signal immediately (inverted) and the echoes\n// are lower in amplitude.\n{ AllpassN.ar(Decay.ar(Dust.ar(1, 0.5), 0.2, WhiteNoise.ar), 0.2, 0.2, 3) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Play your (short) soundfiles with some delay."}, {"role": "assistant", "content": "```supercollider\n// By Bjørn Houdorf March 2013, Play your (short) soundfiles with some delay.\n\nb = SoundFile.collectIntoBuffers(\"yourSoundFileFolder/*\"); // 1. rund this\n\n( // 2. and then run this\nt = Task({\n({\n var num= b.size.rand;\n var buf= b[num];\n 0.1*Splay.ar(PlayBuf.ar(buf.numChannels, buf, 1, 1, 0, 0));\n}.play;\n) \n});\n);\n\n\n( // 3. Then run this\nz = Task({\nloop({\n t.start;\n 0.1.wait;\n});\n});\n);\n\n\nz.start; // 4. and run this\nz.stop; // 5. and finally run this\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Schemawound track from the SIGNALVOID compilation."}, {"role": "assistant", "content": "```supercollider\n/*\nSchemawound track from the SIGNALVOID compilation.\nSIGNALVOID is a noise compilation. Participants were asked to create up to three tracks, each of exactly one minute in length, with no gaps of silence at the beginning or end. Download the free compilation here: http://archive.org/details/SignalvoidMp3 or http://archive.org/details/SignalvoidFlac\nPhysical copies are available here http://signalvoid.bandcamp.com/merch/signalvoid-2\n\nBlog post about the creation of this track http://schemawound.tumblr.com/post/29065985817/signalvoid-1-burn-it-to-disc-then-burn-the-disc\n*/\n\n(\n {\n var saw1 = Saw.ar((10..100));\n var saw2 = Mix(Saw.ar(saw1).range(100, 600));\n var sin0 = SinOsc.ar(0.002).range(5,75);\n var sin1 = SinOsc.ar(0.1).range(1,sin0);\n var sin2 = SinOsc.ar(0.15).range(2,10);\n var sinMod = (sin1 * sin2)!2;\n var sin66 = SinOsc.ar(0.0164).range(600,1000);\n var saw3 = Saw.ar(sinMod).range(200, sin66);\n var saw4 = Saw.ar(saw3);\n var sin3 = Mix(SinOsc.ar((1..100)));\n var sum1 = (saw2 * saw4) * sin3;\n var comb1 = CombL.ar(sum1, 1, 0.2, 1) + sum1;\n var sin4 = SinOsc.ar(0.12).range(3, 1000);\n var comb2 = comb1.tanh;\n var sin5 = SinOsc.ar(sin4);\n var sin6 = SinOsc.ar(0.001);\n var comb3 = comb2 * sin5 * sin6;\n var sum2 = (comb2 + comb3) * 0.3;\n var verb1 = sum2;\n var line1 = Line.ar(1, 0.001, 60, doneAction: 2);\n var line2 = Line.ar(0, 1, 60);\n var comb4 = CombL.ar(verb1, 1, line1, 0.1) * line2;\n var sum3 = comb4 + verb1;\n sum3 * 0.5;\n }.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `BusPool.reset` do?"}, {"role": "assistant", "content": "bus allocator with retain/release counting for shared busses"}]} -{"conversations": [{"role": "user", "content": "What is the difference between Line and XLine?"}, {"role": "assistant", "content": "Both are ramps: `Line.kr(start, end, dur, mul, add, doneAction)` moves linearly, `XLine.kr(...)` moves exponentially in a fixed ratio per unit time. Use Line for amplitude and XLine for frequency or any parameter you hear logarithmically — a linear frequency sweep sounds like it rushes at the top and crawls at the bottom. Both take doneAction, so both can end a Synth."}]} -{"conversations": [{"role": "user", "content": "What does `AbstractGridLines.getParams` do? What arguments does it take?"}, {"role": "assistant", "content": "Specifically for use by DrawGrid. This returns a Dictionary with keys: `'lines'`, an array of values where lines should be drawn, and `'labels'`, an array of 2-element arrays `[value, \"formatted label\"]` for each line. Note that the highest and lowest values returned don't necessarily contain your valueMin and valueMax, but rather represent the values where grid lines will be drawn by `DrawGrid` (endcap lines are subsequently drawn at the data/grid Arguments: valueMin — Minimum value of the data to be plotted. The lowest grid line value returned may be higher than this value.; valueMax — Maximum value of the data to be plotted. The highest grid line value returned may be lower than this value.; pixelMin — Lower bound of the grid's range, in pixels. Used to calculate the size of the available grid space when determining grid values based on tickSpacing (if numTicks is `nil`).; pixelMax — Upper bound of the grid's range, in pixels. Used to calculate the size of the available grid space when determining grid values based on tickSpacing (if numTicks is `nil`).; numTicks — Explicit number of ticks you would like to see on the graph (though the result is approximate). Set to `nil` if you'd like the number of ticks to be found automatically, based on pixelMin, pixelMax, and tickSpacing.; tickSpacing — Minimum distance between ticks (in pixels). This value is only used when numTicks is `nil`.. Returns: A Dictionary."}]} -{"conversations": [{"role": "user", "content": "What is `Pbind`?"}, {"role": "assistant", "content": "Pbind — combine several value patterns to one event stream by binding keys to values"}, {"role": "user", "content": "What does `Pbind.new` do?"}, {"role": "assistant", "content": "The arguments to Pbind are an alternating sequence of keys and patterns. `Pbind(\\note, Pseq([0, 4, 7]), \\amp, 0.1, \\dur, 0.2).play` The message `new` converts keyword arguments into key value pairs, so that we can write: `Pbind(note: Pseq([0, 4, 7]), amp: 0.1, dur: 0.2).play` A pattern can also be bound to an array of keys. In this case, the pattern must specify a sequence whose elements are array"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nPbind(\\note, Pseq([0, 4, 7]), \\amp, 0.1, \\dur, 0.2).play\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `MIDIMKtlDevice` in SuperCollider briefly."}, {"role": "assistant", "content": "MIDIMKtlDevice — The Modality class for creating and accessing external midi controllers MIDIMKtlDevice provides an internal interface for MIDI controllers you can connect to your computer. Category: Libraries > Modality, External Control."}]} -{"conversations": [{"role": "user", "content": "What are the arguments of GrainBuf.ar?"}, {"role": "assistant", "content": "`GrainBuf.ar(numChannels, trigger, dur, sndbuf, rate, pos, interp, pan, envbufnum, maxGrains, mul, add)`. The ones you always pass are numChannels (1 or 2), trigger (a UGen that fires grains, e.g. Impulse.kr(20)), dur (grain length in seconds), sndbuf (an integer buffer number, or `~buf`), rate (playback rate per grain), and pos (read position 0..1 into the buffer). Raise maxGrains if the server complains about too many grains rather than lowering density."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\ns.boot;\nNdef(\\a).ar;\nNdef(\\k).kr;\n\n // make a MonitorGui with all bells and whistles\nm = MonitorGui.new(bounds: 500@40, options: [\\name, \\level, \\fade]);\n\n // when it has a kr proxy, it is visible, but disabled\nm.object_(Ndef(\\k));\n // with an ar proxy, it is enabled\nm.object_(Ndef(\\a));\n\n\n // show its play state\nNdef(\\a).play\n // and volume\nNdef(\\a).vol_(0.25);\n\n // NOTE: shift-clicking the play button opens a playN dialog!\n\nNdef(\\a).stop;\nNdef(\\a).play(0);\n```"}, {"role": "assistant", "content": "make a MonitorGui with all bells and whistles when it has a kr proxy, it is visible, but disabled (MonitorGui: display and control a Monitor)"}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ var sig = SinOsc.ar(440) * 0.2; Out.ar(0, sig) }.play;\n```"}, {"role": "assistant", "content": "The minimal SynthDef idiom: a source multiplied by an amplitude, written to the master bus.\n\n`var sig = SinOsc.ar(440) * 0.2` builds the signal; `Out.ar(0, sig)` is the only mandatory part, because a\nUGen graph that never reaches an output produces no sound. `Out`'s first argument is the bus number — 0 is\nthe main stereo output — and the second is the signal. The function's return value does not matter here,\nwhich is why the `Out.ar` can sit on its own line. `.play` compiles this into an anonymous SynthDef and\nstarts one instance."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Band-limited hard sync oscillator."}, {"role": "assistant", "content": "```supercollider\n(\n~syncSaw = {\n arg syncFreq=440, sawFreq=440, maxRatio=20, minFreq = 10;\n var maxDelay = 1/minFreq;\n var n = floor(maxRatio);\n var b = LocalBuf(Server.default.sampleRate*maxDelay ,1).clear;\n var baseWaveform = Saw.ar(syncFreq);\n var sig = 0;\n n.do {\n arg i;\n var delay = i/sawFreq;\n var amplitude = (sawFreq/syncFreq-i) min: 1 max: 0;\n sig = sig + (BufDelayL.ar(b,baseWaveform,delay)*amplitude);\n };\n sig;\n};\n);\n\n(\n// test it\nplay {~syncSaw.(100,MouseX.kr.range(100,2000).lag)!2}\n);\n\n(\n// compare with aliased version\nplay {SyncSaw.ar(100,MouseX.kr.range(100,2000).lag)!2}\n);\n\n\n(\n// audio rate modulation of sawFreq results in a waveform that's not strictly\n// correct, but sounds good.\nplay {~syncSaw.(MouseY.kr(50,200),MouseX.kr.range(100,2000).lag+SinOsc.ar(20,mul:150))!2}\n// (audio rate modulation of syncFreq doesn't really work.)\n);\n\n(\n// aliased version of the above\nplay {SyncSaw.ar(MouseY.kr(50,200),MouseX.kr.range(100,2000).lag+SinOsc.ar(20,mul:150))!2}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "A starting point to start experimenting with non-standard synthesis?"}, {"role": "assistant", "content": "SuperCollider forum — A starting point to start experimenting with non-standard synthesis?\n\nI while ago I did this noise cloud generator which might serve as inspiration. Other ideas: scramble signals with FFT tools, granular synthesis, FM-synthesis with extreme settings, like index-of-modulation = 4000.\n\n```supercollider\nSynthDef(\\clouds, {\n var num = 10;\n var dur = \\duration.kr(1/6);\n var sig = num.collect{\n var freq = Rand(30, 5000) * SinOsc.kr(LFNoise1.kr(dur).range(30, 1000), 0, LFNoise1.kr(dur)\n .range(0.01, 8)).midiratio;\n var sig = Select.ar(LFNoise0.kr(dur).range(0, 2).round,\n [SinOsc.ar(freq, 0, 0.3), Saw.ar(freq, 0.3), Pulse.ar(freq, 0, 0.3)]);\n var filtFreq = Rand(30, 1000) * LFNoise1.kr(dur).range(1.0, 5.0);\n var filt = Select.ar(LFNoise0.kr(dur).range(0, 2).round,\n [LPF.ar(sig, filtFreq), HPF.ar(sig, filtFreq), BPF.ar(sig, filtFreq)]\n );\n sig = CombL.ar(filt, 0.5, LFNoise1.kr(dur).range(0.02, 0.5), rrand(0.3, 2));\n sig\n };\n var env = Env.perc(\\atk.kr(0.02), \\rel.kr(6), 1, \\cur.kr(-4)).ar(2);\n sig = Splay.ar(sig); // nb! levelComp: true, so if removed signal will be extremely loud!\n sig = LPF.ar(sig, 2000);\n sig = FreeVerb2.ar(sig[0], sig[1], LFNoise1.kr(dur).range(0, 1.0), LFNoise1.kr(dur).range(0.2, 2));\n sig = sig * env * \\amp.kr(1);\n Out.ar(\\out.kr(0), sig)\n}).add;\n\nSynth(\\clouds, [\\atk, rrand(0.01, 2), \\rel, rrand(1, 6.0), \\duration, rrand(0.01, 1)])\n// run it several times, the outcome is highly random\n```"}]} +{"conversations": [{"role": "user", "content": "What does `RedMixerChannel.miGain` do?"}, {"role": "assistant", "content": "Get and set channel equalizer middle band gain (in dB). Note: activate band first with `eqMi="}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Mix`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var n;\n n = 8; // number of 'voices'\n Mix.new( // mix all stereo pairs down.\n Pan2.ar( // pan the voice to a stereo position\n CombL.ar( // a comb filter used as a string resonator\n Dust.ar( // random impulses as an excitation function\n // an array to cause expansion of Dust to n channels\n // 1 means one impulse per second on average\n Array.fill(n, 1),\n 0.3 // amplitude\n ),\n 0.01, // max delay time in seconds\n // array of different random lengths for each 'string'\n Array.fill(n, {0.004.rand+0.0003}),\n 4 // decay time in seconds\n ),\n Array.fill(n,{1.0.rand2}) // give each voice a different pan position\n )\n )\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `RandID` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// start a noise patch and set the id of the generator\n(\nSynthDef(\"help-RandID\", { |out = 0, id = 1|\n RandID.ir(id);\n Out.ar(out,\n WhiteNoise.ar(0.05) + Dust2.ar(70)\n )\n}).add;\n);\n\n// reset the seed of my rgen at a variable rate\n(\nSynthDef(\"help-RandSeed\", { |seed = 1910, id = 1|\n RandID.kr(id);\n RandSeed.kr(Impulse.kr(FSinOsc.kr(0.2, 0, 10, 11)), seed);\n}).add;\n\n);\n\n// start two noise synths on left and right channel with a different randgen id\na = Synth(\"help-RandID\", [\\out, 0, \\id, 1]);\nb = Synth(\"help-RandID\", [\\out, 1, \\id, 2]);\n\n// reset the seed of randgen 1\nx = Synth(\"help-RandSeed\", [\\id, 1]);\n\n// change the target randgen to 2 (affects right channel)\nx.set(\\id, 2);\n```"}]} +{"conversations": [{"role": "user", "content": "What is `SynthDesc`?"}, {"role": "assistant", "content": "SynthDesc — Description of a synth definition"}, {"role": "user", "content": "What does `SynthDesc.read` do?"}, {"role": "assistant", "content": "Adds all synthDescs in a path to a dict. You should not use this method or *readFile to read SynthDescs into a SynthDescLib. Use SynthDescLib#read or SynthDescLib#readStream instead."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"test\", { |out, freq, xFade|\n XOut.ar(out, xFade, SinOsc.ar(freq))\n}).store\n);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// increase feedback\n{ FBSineN.ar(SampleRate.ir, 1, Line.kr(0.01, 4, 10), 1, 0.1) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// increase feedback\n{ FBSineN.ar(SampleRate.ir, 1, Line.kr(0.01, 4, 10), 1, 0.1) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ ClipNoise.ar(0.2 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ ClipNoise.ar(0.2) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `BeatSched.tschedAbs` do? What arguments does it take?"}, {"role": "assistant", "content": "will happen at the time specified in Arguments: time; function."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `BufWr` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\n// allocate a buffer for writinig into\ns = Server.local;\ns.sendMsg(\"/b_alloc\", 0, 44100 * 2);\n);\n\n\n// write into the buffer with a BufWr\n(\ny = { |rate = 1|\n var in;\n in = SinOsc.ar(LFNoise1.kr(2, 300, 400), 0, 0.1);\n BufWr.ar(in, 0, Phasor.ar(0, BufRateScale.kr(0) * rate, 0, BufFrames.kr(0)));\n 0.0 // quiet\n}.play;\n);\n\n// read it with a BufRd\n(\nx = { |rate = 1|\n BufRd.ar(1, 0, Phasor.ar(0, BufRateScale.kr(0) * rate, 0, BufFrames.kr(0)))\n}.play(s);\n);\n\n\n\nx.set(\\rate, 5);\ny.set(\\rate, 2.0.rand);\nx.set(\\rate, 2);\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Red3DPoint` in SuperCollider?"}, {"role": "assistant", "content": "Red3DPoint — 3D point A class for rotating and rendering a point in 3D. Category: Red > redUniverse > shapes."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// check blockSize before (or reset blockSize in examples)\n\n(\nif (s.options.blockSize != 64) {\n s.options.blockSize = 64;\n s.quit.reboot;\n}\n);\n\n\n// exponentiation can also be interesting\n// here an area of instability is crossed by a stereo lfo\n\ns.scope\n\n// start fb fx Synth\n\n(\n~bus = Bus.audio(s, 1);\n\ny = {\n var inSig = In.ar(~bus);\n var lfo = { LFDNoise3.ar(0.5).linexp(-1, 1, 0.1, 150) } ! 2;\n\n Fb1({ |in, out|\n in[1][0] * 0.07 +\n // out[0]\n// …\n```"}, {"role": "assistant", "content": "check blockSize before (or reset blockSize in examples) exponentiation can also be interesting (Fb1: single sample feedback / feedforward pseudo ugen)"}]} +{"conversations": [{"role": "user", "content": "What does `ControlPatchOut.scalar` do? What arguments does it take?"}, {"role": "assistant", "content": "manages a Player's output when connecting to other Players Arguments: scalarPatchIn."}]} +{"conversations": [{"role": "user", "content": "What does `HS.listen` do? What arguments does it take?"}, {"role": "assistant", "content": "Make HS ready to poll values from a synth, demanded by possibly more than one stream. Therefore num trigger synths are run, ready to receive triggers for sending help synth values back to client, but a synth from HS's ugenFunc definition is not yet playing after that. If PHS / PHSuse are played there is no need to call listen Arguments: num — Integer. Number of trigger synths.; latency — Float. Latency in seconds.."}]} {"conversations": [{"role": "user", "content": "What is a Buffer, and how is it different from a SoundFile?"}, {"role": "assistant", "content": "A Buffer is server-side memory: an array of samples (or a wavetable) living on scsynth, addressed by an integer bufnum. A SoundFile is a language-side object for reading or writing a file on disk. `Buffer.read(s, path)` loads a sound file into server memory and gives you a Buffer; `SoundFile.openRead(path)` just reads metadata such as duration and sample rate without loading audio. PlayBuf, GrainBuf and BufRd all take a Buffer, never a SoundFile."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Enveloppes sizes are fixed."}, {"role": "assistant", "content": "```supercollider\n(\n~resize_enveloppe = { | levels, times |\n var reverted_levels, index;\n index = 0;\n reverted_levels = levels.reverse;\n while( { reverted_levels[index] == 0 && reverted_levels[index+1] == 0 }, { times[ times.size - 1 - index] = 0.01; index = index + 1 } );\n};\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `PV_Add` in SuperCollider briefly."}, {"role": "assistant", "content": "PV_Add — Complex addition. Complex addition: Category: UGens > FFT."}]} -{"conversations": [{"role": "user", "content": "What does `BeatClockPlayer.new` do? What arguments does it take?"}, {"role": "assistant", "content": "'trig' rate player that plays steady impulse triggers locked to tempo Arguments: tempoFactor — tempoFactor is in old-style music terms: 16 means a 16th note. 8 means an 8th note 1 is a whole note. etc.; mul; tempoBase."}]} -{"conversations": [{"role": "user", "content": "What is `Decay` in SuperCollider?"}, {"role": "assistant", "content": "Decay — Exponential decay An integrating filter which, if given an impulse, will produce an exponentially decaying envelope. `Decay` is essentially the same as Integrator, but instead of specifying the integration coefficient directly, it is calculated from the decayTime — the time required for input signal to attentuate 60 dB, or decay to 99.9% of its value. Category: UGens > Filters > Linear, UGens > Envelopes."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n~name = \\test_noise_burst;\n~description = \"A short burst of enveloped noise that goes well with Patterns\";\n~channelLayout = \\mono;\n\n~function = { arg amp=1, trimDB = 0, attack = 0.01, release = 0.3;\n var env;\n env = EnvGen.ar(Env.perc(attack, release, 0.5), doneAction: Done.freeSelf);\n trimDB.dbamp*amp*PinkNoise.ar(1);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nb = Signal.sineFill(512, [1]).play(true, 0.2;\nb.free; // free the buffer again.\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nb = Signal.sineFill(512, [1]).play(true, 0.2);\nb.free; // free the buffer again.\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nt = TempoClock.new;\n\nt.beatsPerBar = 3; // error! wrong thread\n\nt.schedAbs(t.nextBar, { t.beatsPerBar_(3) }); // OK\n\nt.beatsPerBar; // will be reflected after the barline\n\nt.schedAbs(t.nextBar, { thisThread.clock.beatsPerBar_(4) }); // OK\n\n(\nr = Routine {\n // by addressing \"this\" clock,\n // we are always changing meter in the right place\n var clock = thisThread.clock;\n\n clock.beats.debug(\"start time\");\n clock.timeToNextBeat(-1).wait;\n clock.beats.debug(\"barline\");\n\n // no need to 'sc\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nt = TempoClock.new;\n\nt.beatsPerBar = 3; // error! wrong thread\n\nt.schedAbs(t.nextBar, { t.beatsPerBar_(3) }); // OK\n\nt.beatsPerBar; // will be reflected after the barline\n\nt.schedAbs(t.nextBar, { thisThread.clock.beatsPerBar_(4) }); // OK\n\n(\nr = Routine {\n // by addressing \"this\" clock,\n // we are always changing meter in the right place\n var clock = thisThread.clock;\n\n clock.beats.debug(\"start time\");\n clock.timeToNextBeat(-1).wait;\n clock.beats.debug(\"barline\");\n\n // no need to 'sched'\n // because the Routine is already on this clock\n // flip 3/4 -> 4/4 or 4/4 -> 3/4\n clock.beatsPerBar = 7 - clock.beatsPerBar;\n clock.beatsPerBar.debug(\"set meter to\");\n\n 0.01.wait; // must be after barline for 'timeToNextBeat'\n clock.timeToNextBeat(-1).wait;\n clock.beats.debug(\"next barline\");\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for The quest for the prime numbers?"}, {"role": "assistant", "content": "```supercollider\n//Prime numbers\n \nServer.default.boot;\n(\n//maximum number\n~max=100;\n\n//synthdefs: 2 filtered sawteeth for number and divisor\nSynthDef ( \\gsaw, {arg g;\n Out.ar(1, \n RLPF.ar ( Saw.ar(20*g), 10000*(1-(g/~max)), 0.2, 0.2)\n )\n}).add;\n\nSynthDef ( \\dsaw, {arg d, g;\n Out.ar(0,\n RLPF.ar( Saw.ar(20*d), 10000*d/sqrt(g), 0.2, 0.2)\n // the square root is important: if you search for the divisors of a number,\n // don't search beyond the square root of the number. There won't be any.\n )\n}).add;\n\n//a fm-sound with carrier 20*number and modulator 20*divisor, modulation index = 10\nSynthDef (\\fm, {arg m, c;\n Out.ar(0,\n Pan2.ar(SinOsc.ar(20*c+(SinOsc.ar(20*m, 0, 200*m, 0))), 0)\n )\n}).add;\n\n);\n(\nr=Routine({\n var number, divisor;\n //the list of prime numbers\n l=Array.newClear(indexedSize: 0);\n\n for (2, ~max,{arg number;\n x=Synth(\\gsaw, [\\g, number]); //play the number\n divisor=2;\n p=true; //prime number?\n while ({((divisor <= (number.sqrt)).and(p == true))},\n { \n y=Synth(\\dsaw, [\\d, divisor, \\g, number]); //play the divisor\n z=Synth(\\fm, [\\m, divisor, \\c, number]); //play the fm sound of number and divisor\n 1.wait; //1 second should be enough to hear if a sound is harmonic\n // harmonic sound means: not a prime number\n y.free; \n z.free; \n if( number.mod(divisor) == 0, {p = false} ); //not a prime number\n divisor = divisor + 1;\n }\n );\n x.free;\n if (p == true){ //primenumber!\n l=l.add(number); //add primenumber to the list\n for (1, l.size, { arg i; //play the list of prime numbers\n z=Synth(\\fm, [\\m, l.size, \\c, l[i]]);\n 0.1.wait;\n z.free;\n });\n }\n\n });\n});\n);\nr.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n/* Audio plugin definition\n\n Each audio plugin should define the following global variables:\n ~name: (symbol) name of the spatializer\n ~description: (string) a short description\n ~function: the actual definition of the plugin\n\n*/\n\n~name = \\MonoIn;\n~description = \"A direct input\";\n~channelLayout = \\mono;\n\n~function = {\n |gate = 0, bus = 0, attack = 0.02, susL = 0.9, release = 0.1, curve = -4|\n var env = Env.asr(attack, susL, release, curve);\n SoundIn.ar(bus, EnvGen.kr(env, gate));\n}\n```"}, {"role": "assistant", "content": "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see ."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Modulating GVerb roomsize, among other things?"}, {"role": "assistant", "content": "```supercollider\nNdef(\\b, { LFDNoise0.ar(500)});\nNdef(\\c, { LFDNoise1.ar(0.3).range(5,15)});\nNdef(\\d, { LFDNoise3.ar(SinOsc.kr(0.1, 0, 1000, 300), 200, 200)});\nNdef(\\a, { Limiter.ar(GVerb.ar(SinOsc.ar(Ndef(\\d), mul: Ndef(\\b)), roomsize: Ndef(\\c) ) )});\nNdef(\\a).play;\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Env`?"}, {"role": "assistant", "content": "Env — Specification for a segmented envelope"}, {"role": "user", "content": "What does `Env.new` do?"}, {"role": "assistant", "content": "Create a new envelope specification."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// an envelope in a synth\n(\n{\n var env = Env([0, 1, 0.5, 1, 0], [0.01, 0.5, 0.02, 0.5]);\n SinOsc.ar(470) * EnvGen.kr(env, doneAction: Done.freeSelf)\n}.play\n);\n// an envelope to control a parameter in a pattern\n(\nPbind(\n \\note, Env([0, 12, 6, 13, 0], [1, 5, 2, 10]),\n \\dur, 0.1\n).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for first step?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n\nz = ( ( SinOsc.ar( ((LFSaw.kr(-0.05,1) +1) *100 + 20 ), LFTri.kr(40,0,1), LFSaw.kr(1.5) ) \n * LFTri.kr(rrand(0.005,0.03),3.99.rand,0.2) ) + \n( LFPulse.ar(60,0,0.5,Pulse.ar(0.5,0.5,0.1)) * LFTri.kr(rrand(0.005,0.03),3.99.rand,0.5) ) +\n( SinOsc.ar(65,0,LFPulse.kr(0.66666,0.5,0.3)*0.3) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) )+\n( LFPar.ar(120,0,LFPulse.kr(0.5,0.5,0.2)*0.3) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( LFCub.ar(185,0,LFPulse.kr(0.5,0.74,0.2)*0.3) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( SinOsc.ar(365,0,LFPulse.kr(1.33333333,0,0.1)*0.3) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( FreeVerb.ar(LFTri.ar(260,0,LFPulse.kr(0.5,0.25,0.01)*0.3),0.5,0.8,0.1) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( SinOsc.ar(800,0,LFPulse.kr(2,0,0.1)*0.1) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( LFPar.ar(820,0,LFPulse.kr(1.666666,0,0.1)*0.1) * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( WhiteNoise.ar( LFPulse.kr(2,0.5,0.001,1) )/2 * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( WhiteNoise.ar( LFPulse.kr(1,0.5,0.001,1) )/2 * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( WhiteNoise.ar( LFPulse.kr(1.666666,0.5,0.001,1) )/4 * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) +\n( WhiteNoise.ar( LFPulse.kr(1.333333,0.5,0.001,1) )/4 * LFTri.kr(rrand(0.005,0.03),3.99.rand,1) ) );\n\nFreeVerb.ar(\n ((CombC.ar(\n DelayN.ar(\n DelayN.ar(z, 0.5, [0.5,0.75], 1, z), \n 0.5, 0.5, 1, z), \n 0.1, LFNoise0.kr(1,0.05,0.001).abs, 2, z))+z),\n0.1,1,0.1); \n\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is SuperCollider?"}, {"role": "assistant", "content": "SuperCollider is a platform for audio synthesis and algorithmic composition, written in C++ and SuperCollider. It splits into a language client (sclang) that runs your code and builds UGen graphs, and an audio server (scsynth) that does the DSP in real time. They talk over OSC."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\ns.boot;\n\n(\nSynthDef(\"help-PinkNoise\", { |out = 0|\n Out.ar(out, PinkNoise.ar(0.1))\n}).add;\n\nSynthDef(\"help-In\", { |out = 0, in = 0|\n var input;\n input = In.ar(in, 1);\n Out.ar(out, input);\n\n}).add;\n);\n\n// play noise on the right channel\nx = Synth(\"help-PinkNoise\", [\\out, 1]);\n\n// read the input and play it out on the left channel\nSynth.after(x, \"help-In\", [\\out, 0, \\in, 1]);\n```"}, {"role": "assistant", "content": "play noise on the right channel read the input and play it out on the left channel (In: Read a signal from a bus.)"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\\berlinb, { |out = 0, freq = 80, amp = 0.01, pan = 0, gate = 1|\n var synth, env;\n env = Decay2.kr(gate, 0.05, 8, 0.0003);\n synth = RLPF.ar(\n LFPulse.ar(freq, 0, SinOsc.kr(0.12, [0, 0.5pi], 0.48, 0.5)),\n freq * SinOsc.kr(0.21, 0, 18, 20),\n 0.07\n );\n #a, b = synth*env;\n DetectSilence.ar(a, 0.1, doneAction: Done.freeSelf);\n Out.ar(out, amp * Mix.ar(PanAz.ar(4, [a, b], [\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\\berlinb, { |out = 0, freq = 80, amp = 0.01, pan = 0, gate = 1|\n var synth, env;\n env = Decay2.kr(gate, 0.05, 8, 0.0003);\n synth = RLPF.ar(\n LFPulse.ar(freq, 0, SinOsc.kr(0.12, [0, 0.5pi], 0.48, 0.5)),\n freq * SinOsc.kr(0.21, 0, 18, 20),\n 0.07\n );\n #a, b = synth*env;\n DetectSilence.ar(a, 0.1, doneAction: Done.freeSelf);\n Out.ar(out, amp * Mix.ar(PanAz.ar(4, [a, b], [pan, pan+1])));\n}).add;\n);\n\n(\nf = Pbind(\n \\degree, Pseq([0, 1, 2, 4, 6, 3, 4, 8], inf),\n \\dur, 0.5, \\octave, 3, \\instrument, \\berlinb\n).play;\n);\n\n(\nf.stream = Pbind(\n \\degree, Pseq([0, 1, 2, 4, 6, 3, 4, 8], inf),\n \\dur, 0.5, \\octave, [2, 1],\n \\instrument, \\berlinb,\n \\pan, Pfunc({ 1.0.rand2 })\n).asStream;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `LinTrans.rotation2D` do?"}, {"role": "assistant", "content": "2D rotation linear transformation for angle theta. `a ="}]} -{"conversations": [{"role": "user", "content": "What is `BHiPass`?"}, {"role": "assistant", "content": "BHiPass — 12db/oct rolloff - 2nd order resonant Hi Pass Filter"}, {"role": "user", "content": "What does `BHiPass.sc` do?"}, {"role": "assistant", "content": "calculate filter coefficients."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n(\nz = {\n BHiPass.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(10, 20000, \\exponential), // cutoff freq.\n MouseY.kr(0.0, 1.0, \\linear), // rq\n 0.5); // mul\n}.play\n);\nz.release;\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for mixolydian flat six meditation in pythagorean?"}, {"role": "assistant", "content": "```supercollider\n// last updated on sccode.org fri 7. jun, 14:57 CET\n\n( // load this first - synth def\nSynthDef(\\harpsi, { \n arg outbus = 0, freq = 440, ffreq = 2, amp = 1, gate = 1, release = 1;\n var out;\n freq = freq * Rand(1, 1.005);\n out = EnvGen.ar(Env.adsr(releaseTime:release), gate, doneAction: Done.freeSelf)\n * amp * Pulse.ar([freq,freq*1.005]/1, 0.25, mul:0.75 );\n out = out * [Rand(0.0, 1.0), Rand(0.0, 1.0)];\n out = RLPF.ar(out, freq * (ffreq / 4) + 1 );\n Out.ar(outbus, out); \n}).add; \n);\n\n\n( // then run this - sequence\nTempoClock.default.tempo = 1.4;\n~scale = Scale.new(#[0,2,4,5,7,8,10],tuning: \\pythagorean, name: \"mixolydianb6\");\np = Pbind(\n \\instrument, \\harpsi,\n \\root, -12,\n \\scale, ~scale,\n \\ffreq, Pseq(((1..2) ++ (3..1)),inf),\n \\degree, Pseq([\n Pseries({ rrand(0, 7) }, { ([1,2]).choose }, { rrand(4, 8) }),\n Pseries({ rrand(0, 7) }, {([1,2]).choose}, { rrand(4, 8) }),\n Pseries({ rrand(7, 14) }, 0-{([1,2]).choose}, { rrand(4, 8) })\n ], inf),\n \\release, Prand([5,6,7,8],inf),\n \\dur, Prand((1..8)/4, inf),\n \\amp, Prand(((1..8)/8)+1, inf)\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `AmpCompA.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Basic psychoacoustic amplitude compensation (ANSI A-weighting curve). Arguments: freq — Input frequency value. For freq == root, the output is rootAmp.; root — Root freq relative to which the curve is calculated (usually lowest freq). Non-modulatable.; minAmp — Amplitude at the minimum point of the curve (around 2512 Hz). Non-modulatable.; rootAmp — Amplitude at the root frequency. Non-modulatable.."}]} -{"conversations": [{"role": "user", "content": "What does `Tempo.beatsPerBar` do? What arguments does it take?"}, {"role": "assistant", "content": "Bored with the old 4/4 ? Tempo.beatsPerBar = Arguments: b."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\AcnSn3dIn;\n~description = \"A live ambisonic input (ACN_SN3D)\";\n~channelLayout = \\ambi;\n\n~function = { |order=1, t_trig = 0, bus = 0|\n var env = EnvGen.kr(Env([0,1], [1]), t_trig);\n var chans = Array.series(\n size: (order + 1).pow(2).asInteger,\n start: bus,\n step: 1\n );\n var input = SoundIn.ar(chans) * env;\n HOAConverterAcnSn3d2AcnN3d.ar(order, input);\n};\n```"}, {"role": "assistant", "content": "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see ."}]} -{"conversations": [{"role": "user", "content": "What does `Ndef.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Return a new node proxy and store it in a global ProxySpace under the key. If there is already an Ndef there, replace its object with the new one. The object can be any supported class, see NodeProxy#Supported sources help. Internally, all instances are kept in a ProxySpace. The EnvironmentRedirect#dispatch function is called when the source is Arguments: key — the name of the proxy (usually a symbol). If only the key is given and no object, it returns the proxy object: `Ndef(\\x) // get the proxy` If key is an association, it is interpreted as key -> server name. (order changed in SC3.3 !). If no name is given, it uses the default server that was default w; object — an object `Ndef(\\x, { Dust.ar }); // returns the proxy and set the sour`."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes danger loud click."}, {"role": "assistant", "content": "```supercollider\n// proceed with caution. start at min volume, and not with your expensive speakers.\n\nfork{b=Buffer.alloc(s,512,1);inf.do{b.cheby({[1,0].choose}!2);{(Shaper.ar(b,SinOsc.ar(55,0,Line.kr(1,0,2,1,0,2))))!2}.play;0.1.wait;}};\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\np = Pmono(\\default, \\dur, 0.2, \\freq, Pwhite(1, 8) * 100).play\n\np.stop\n\n// multi channel expansion is supported:\np = Pmono(\\default, \\dur, 0.2, \\freq, Pwhite(1, 8) * 100, \\detune, [0, 2, 5, 1]).play\n\np.stop\n\n\n// the following example will end after 5 seconds\n// or you can stop it sooner with a stop message\n(\np = Pfindur(5,\n Pset(\\detune, Pwhite(0, 1.0) * [0, 1, 3, 7],\n Ppar([\n Pmono(\\default, \\dur, 0.2, \\freq, Pwhite(1, 8) * 100),\n Pmono(\\default\n// …\n```"}, {"role": "assistant", "content": "multi channel expansion is supported: the following example will end after 5 seconds (Pmono: monophonic event stream)"}]} +{"conversations": [{"role": "user", "content": "What does `SimpleNumber.sphHankel1` do?"}, {"role": "assistant", "content": "Returns the result of the spherical Hankel functions of the first"}]} +{"conversations": [{"role": "user", "content": "What does `FBSineN.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Feedback sine with chaotic phase indexing Arguments: freq — Iteration frequency in Hertz; im — Index multiplier amount; fb — Feedback amount; a — Phase multiplier amount; c — Phase increment amount; xi — Initial value of x; yi — Initial value of y; mul."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// logistic map as frequency control\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n SinOsc.ar(QuadN.ar(40, r.neg, r, 0, 0.1, 800, 900)) * 0.4;\n}.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// logistic map as frequency control\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n SinOsc.ar(QuadN.ar(40, r.neg, r, 0, 0.1, 800, 900)) * 0.4;\n}.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `PatternProxy.asStream` do?"}, {"role": "assistant", "content": "Return a Stream from this pattern. One pattern proxy can be used to produce any number of independent streams. `a ="}]} +{"conversations": [{"role": "user", "content": "What does `Instr.head` do? What arguments does it take?"}, {"role": "assistant", "content": "spawn a Synth into the Group, adding it as the first node in that Arguments: anode; args — array or dict; bundle; atTime — see atTime; out — out bus index. Returns: a Synth"}]} +{"conversations": [{"role": "user", "content": "Explain `SPlayFileDiskView` in SuperCollider briefly."}, {"role": "assistant", "content": "SPlayFileDiskView — a sound file player that streams from disk A GUI for LINKClasses/SplayFileDisk (streaming soundfiles from disk). Category: SInstruments."}]} +{"conversations": [{"role": "user", "content": "Explain `DbufTag` in SuperCollider briefly."}, {"role": "assistant", "content": "DbufTag — demand rate tag system on a buffer Emil Post's tag system as a demand rate ugen - Buffer version. Category: UGens > Demand."}]} +{"conversations": [{"role": "user", "content": "Explain `BBCutBuffer` in SuperCollider briefly."}, {"role": "assistant", "content": "BBCutBuffer — A buffer in BBCut2 Holds data on a buffer including any segmentation (event positions). Derived from the Buffer class and has methods for choosing playback segments. Category: Libraries > BBCut > Core."}]} +{"conversations": [{"role": "user", "content": "What does `SimpleNumber.chebyshevTZeros` do?"}, {"role": "assistant", "content": "Returns the roots (zeros) of the `n`-th Chebyshev polynomial of the first"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\ns.scope;\na = { HilbertFIR.ar(SinOsc.ar(100) * -20.dbamp, LocalBuf(2048) }.play;\na.release;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\ns.scope;\na = { HilbertFIR.ar(SinOsc.ar(100) * -20.dbamp, LocalBuf(2048)) }.play;\na.release;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Harmonics`."}, {"role": "assistant", "content": "```supercollider\na.ramp(1.0, 1.0); // returns a harmonic series\n\nb = Buffer.alloc(s, 512, 1);\n// harmonic series for freqs, ramp down for amps\nb.sine2(a.ramp(1.0, 1.0).postln, a.ramp(0.5, -0.025).postln, true, true, true);\n(\nz = SynthDef(\"help-Osc\", { |out = 0, bufnum = 0|\n Out.ar(out,\n Osc.ar(bufnum, 200, 0, 0.5)\n )\n});\n);\ny = z.play(s, [\\out, 0, \\bufnum, b]);\ny.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n\nSynthDef(\\param, { arg freq = 100, sustain, amp;\n var sig;\n sig = LFPar.ar(freq: freq,\n mul: EnvGen.kr(Env.perc(0, sustain, 0.5), doneAction:2) * amp);\n sig = Splay.ar(sig);\n Out.ar(0, sig);\n}).add;\n\ne = Pbind(\n \\midinote, Prout({\n var tone0, tone1, tone2, interval, freq0, delta;\n loop {\n tone0 = rrand(0,11);\n interval = rrand(2,4);\n tone1 = Scale.minor(\\pythagorean).at(tone0) + [0,12,24].choose + 0.07;\n tone2 = Scale.minor(\\pythagorean).at(tone0 + interval) + [0,12,24].choose;\n freq0 = [tone1,tone2]+48;\n postln(freq0);\n freq0.yield;\n }\n }),\n \\dur, Prand([1,2,4,8,12,16,4,6,8], inf),\n \\instrument, \\param,\n \\amp, 0.5,\n \\sustain, 2,\n).play(quant:1); // returns an EventStream\nTempoClock.default.tempo = 1200/60;\n\n)\n```"}, {"role": "assistant", "content": "minor random bliss in two for Prout (a SuperCollider snippet)."}]} +{"conversations": [{"role": "user", "content": "Write a bell in SuperCollider."}, {"role": "assistant", "content": "A bell is a set of inharmonic partials with a long percussive decay. The ratios below are the\nclassic bell ones; the envelope frees the Synth when it ends.\n\n```supercollider\n(\nSynthDef(\\bell, { |out = 0, freq = 440, amp = 0.2, dur = 3|\n var partials = [1, 2.76, 5.4, 8.93];\n var amps = [1, 0.5, 0.3, 0.15];\n var sig = SinOsc.ar(freq * partials) * amps;\n var env = EnvGen.kr(Env.perc(0.001, dur, 1, -6), doneAction: 2);\n Out.ar(out, Pan2.ar(Mix(sig) * env * amp, 0));\n}).add;\n);\nSynth(\\bell, [\\freq, 660, \\dur, 4]);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a, b;\na = Pfindur(5, Pbind(\\dur, Prand([1, 2, 0.5, 0.1], inf)));\nx = a.asStream;\n9.do({ x.next(Event.default).postln });\n);\n\n\n(\nvar a, b;\na = Pfindur(5, Pbind(\\dur, Prand([1, 2, 0.5, 0.1], 4)));\nx = a.asStream;\n9.do({ x.next(Event.default).postln });\n);\n\n\n// Pfindur used as a sequence of pitches\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a, b;\na = Pfindur(5, Pbind(\\dur, Prand([1, 2, 0.5, 0.1], inf)));\nx = a.asStream;\n9.do({ x.next(Event.default).postln });\n);\n\n\n(\nvar a, b;\na = Pfindur(5, Pbind(\\dur, Prand([1, 2, 0.5, 0.1], 4)));\nx = a.asStream;\n9.do({ x.next(Event.default).postln });\n);\n\n\n// Pfindur used as a sequence of pitches\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\nvar c;\nc = Pbind(\n \\dur, Prand([1, 0.02, 0.2], inf),\n \\instrument, \\help_sinegrain,\n \\degree, Pseries(0, 1, inf),\n \\octave, 6\n);\n\nPn(\n Pfindur(1, c)\n).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nSynthDef(\\dubecho,{|in, out, length = 1, fb = 0.8, sep = 0.012|\n var input = In.ar(in, 2);\n var feedback = LocalIn.ar(2);\n var output = LeakDC.ar(feedback*fb + input);\n output = HPF.ar(output, 400);\n output = LPF.ar(output, 5000);\n output = output.tanh;\n LocalOut.ar(DelayC.ar(output, 1, LFNoise2.ar(12).range([length,length+sep],[length+sep,length])).reverse);\n ReplaceOut.ar(out, output);\n}).add;\n\n// Example as effecet bus\n~bus = Bus.audio(s, 2);\n~echo = Synth(\\dubecho, [\\in, ~bus, \\length, TempoClock.default.tempo*(3/8), \\fb, 0.7, \\sep, 0.0012], addAction: \\addToTail);\n\n// send something\nplay{ Out.ar(~bus, LFGauss.ar(1, 0.1, loop:0, doneAction:2) * Blip.ar(80!2, 8)) }\n\n// turn it off\n~echo.free;\n```"}, {"role": "assistant", "content": "Fork of Bjorn's Dub echo, rewritten w/o the Feedback Quark (using LocalIn + LocalOut) and adding a ping pong (can be removed by deleting the .reverse method in the LocalOut line)."}]} +{"conversations": [{"role": "user", "content": "What does `PHS.play` do?"}, {"role": "assistant", "content": "A PHSplayer object is instantiated and started using the TempoClock clock. Quant or SimpleNumber quant lets the player step into the quantization as soon as possible, with respect to the necessary latency. The PHSplayer can be stopped and resumed with several"}]} +{"conversations": [{"role": "user", "content": "What does `Maybe.value` do?"}, {"role": "assistant", "content": "set the contained object or return the source, or the value of the contained object, if it is a Maybe. If there is a recursion, return nil. `a ="}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\ns.bind {\n a = { |freq = 100| SinOsc.ar(freq, LFTri.ar(freq)) * 0.2 }.play;\n s.sync;\n a.set(\\freq, 400);\n}\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\ns.bind {\n a = { |freq = 100| SinOsc.ar(freq, LFTri.ar(freq)) * 0.2 }.play;\n s.sync;\n a.set(\\freq, 400);\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Event` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\pm, { |out = 0, freq = 440, amp = 0.1, pan = 0, gate = 1, ratio = 1, index = 1, ar = 0.1, dr = 0.1|\n var z;\n z = LPF.ar(\n PMOsc.ar(freq, freq * ratio, Linen.kr(gate, ar, index, dr), 0, 0.3),\n XLine.kr(Rand(4000, 5000), Rand(2500, 3200), 1)\n ) * Linen.kr(gate, 0.01, 0.7, dr, 2);\n OffsetOut.ar(out, Pan2.ar(z, pan, amp));\n}).add;\n);\n\n(instrument: \\pm).play;\n\n(instrument: \\pm, ratio: 3.42, index: 12, freq: 150, ar: 8, dr: 3, sustain: 10).play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Color.new255` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a new instance from 8-bit integer values between 0 and Arguments: red — An instance of Integer between 0 and 255.; green — An Integer between 0 and 255.; blue — An Integer between 0 and 255.; alpha — An Integer between 0 and 255.."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n~resize_enveloppe = { | levels, times |\n var reverted_levels, index;\n index = 0;\n reverted_levels = levels.reverse;\n while( { reverted_levels[index] == 0 && reverted_levels[index+1] == 0 }, { times[ times.size - 1 - index] = 0.01; index = index + 1 } );\n};\n)\n```"}, {"role": "assistant", "content": "Enveloppes sizes are fixed. This means that if enveloppe's levels are equals to [ 1, 0, 0, 0, 0, 0, 0, 0 ] and times are equals to [ 1, 1, 1, 1, 1, 1, 1, 1 ], the synth UGens will take resources 8 seconds but will only be audible 1 second. To avoid this, passing both the levels and the times to this function will detect when the sound stops playing and will reduce the \"silence\" times to 0.01s, thu."}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for Re: Dark sea horns: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\n Ndef(\\x, {\n var output;\n var delayTime;\n var delayMax = 0.2;\n var delayAdd = 0.1;\n var pulseFreq = 0.5;\n var proxyMul = 2;\n var pulseMin = 40;\n var pulseMax = 130;\n var numOfEchos = 2;\n\n var mainPulse = LFPulse.ar(pulseFreq, 0, 0.5).range(pulseMin, pulseMax);\n var proxy = Ndef(\\x).ar * proxyMul;\n var ampModFreq = SinOsc.ar(0.01, 0).range(0.3, 30);\n var ampMod = LFNoise1.ar(ampModFreq, 6);\n output = SinOsc.ar(mainPulse + proxy, 0, ampMod).tanh;\n numOfEchos.do{\n delayTime = {delayMax.rand + delayAdd}!2;\n output = AllpassL.ar(output, 0.1, delayTime, 5);\n };\n output.tanh;\n }).play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "How does multi-channel expansion work?"}, {"role": "assistant", "content": "If any argument of a UGen is an Array, the UGen is built once per element and the results are returned as an Array. So `SinOsc.ar([220, 330, 440])` is three oscillators, and `SinOsc.ar(220 * [1, 1.5])` is two. This is not a special stereo feature: it is uniform expansion, which is why `Splay.ar(SinOsc.ar([220,330,440]) * 0.1)` gives you a spread stereo field from three mono sources."}]} +{"conversations": [{"role": "user", "content": "What does `Group.addToHeadMsg` do?"}, {"role": "assistant", "content": "Returns a message of the type g_new which can be bundled. When sent to the server this message will instantiate this group. If aGroup is a Group it will be added at the head of that group. If it is nil, it will be added at the head of the default_group of this Group's server (as specified when *basicNew was"}]} +{"conversations": [{"role": "user", "content": "What does `Class.superclassesDo` do?"}, {"role": "assistant", "content": "Call a function passing each superclass of the receiver. `List.superclassesDo { |x| x.postln"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n~a={SinOsc.ar([22.5, 23], mul: ChaosGen.allSubclasses.choose.ar(rrand(1, 30))* 0.3)};\n~b={SinOsc.ar([22.5, 23], mul: 0.3)};\n~c={SinOsc.ar([22.5, 23]*400, mul: ChaosGen.allSubclasses.choose.ar(rrand(1, 30))* 0.03)};\n~d={SinOsc.ar([22.5, 23]*400, mul: 0.03)};\nOut.ar(0, ~a+~b+~c+~d);\n}.scope\n)\n```"}, {"role": "assistant", "content": "some basic synth shamanic stuff for rising vibrational frequency (a SuperCollider snippet)."}]} +{"conversations": [{"role": "user", "content": "What does `ObjectTable.add` do? What arguments does it take?"}, {"role": "assistant", "content": "Put an object in the main ObjectTable and generate an Integer Arguments: obj — the object to put in the table.."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `WrapIndex`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// indexing into a table\n(\n{\n var buf = LocalBuf.newFrom([200, 300, 400, 500, 600, 800]);\n var freq = WrapIndex.kr(buf, MouseX.kr(0, BufFrames.ir(buf) * 3));\n SinOsc.ar(freq) * 0.1\n}.play;\n);\n\n// the same using a global buffer\n(\nt = [200, 300, 400, 500, 600, 800];\nb = Buffer(s, t.size, 1);\n\n// alloc and set the values\ns.listSendMsg(b.allocMsg(b.setnMsg(0, t)).postln);\n\nSynthDef(\\help_Index, { |out = 0, bufnum = 0|\n Out.ar(out,\n SinOsc.ar(\n WrapIndex.kr(\n bufnum,\n MouseX.kr(0, BufFrames.ir(bufnum) * 3)\n ),\n 0,\n 0.5\n )\n )\n}).play(s, [\\bufnum, b.bufnum]);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Group.addReplaceMsg` do?"}, {"role": "assistant", "content": "Returns a message of the type g_new which can be bundled. When sent to the server this message will instantiate this group, replacing nodeToReplace in the server's node"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `FreqScopeView`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// Start server\ns.boot;\n\n// Create analyzer in a window\n(\nw = Window(\"My Analyzer\", Rect(0, 0, 511, 300)); // width should be 511\nf = FreqScopeView(w, w.view.bounds);\nf.active_(true); // turn it on the first time;\n\nw.onClose_({ f.kill }); // you must have this\nw.front;\n{ SinOsc.ar([500, 1000], 0, 0.25).mean.dup }.play(s); // start two sine waves\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `T2K`."}, {"role": "assistant", "content": "```supercollider\n// this does not work:\n(\n{\n var trig = Dust.ar(4);\n Trig.kr(trig, 0.1) * SinOsc.ar(800) * 0.1\n}.play;\n);\n\n// this works:\n(\n{\n var trig = T2K.kr(Dust.ar(4));\n Trig.kr(trig, 0.1) * SinOsc.ar(800) * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `IBVA.getFilterCutoff` do?"}, {"role": "assistant", "content": "send a request to the device for the current filter cutoff ratio. calls #-frAction when"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nSynthDef(\\Synth3,\n {arg ress = 0;\n var klank, env;\n klank = Klank.ar(`[{Rand(70,21000)}!7, {Rand(0.128,0.700)}!7],BrownNoise.ar(0.7));\n klank = klank;\n env = EnvGen.kr(Env.perc(0.07, ress), doneAction:2);\n Out.ar(0, klank*env.dup*0.0128);\n}).add;\n)\n\n\n{inf.do{x = rrand(0.01,0.7); Synth(\\Synth3, [\\ress, x+(7*x)]); x.wait;}}.fork\n```"}, {"role": "assistant", "content": "Play around with {Rand(70, 21000)}!7\r\n\r\nA simple example for the begginers... hope I can contribute to something =)."}]} +{"conversations": [{"role": "user", "content": "What is `BHiPass4` in SuperCollider?"}, {"role": "assistant", "content": "BHiPass4 — 24db/oct rolloff - 4th order resonant Hi Pass Filter [1] The B equalization suite is based on the Second Order Section (SOS) biquad UGen. Category: UGens > Filters > BEQSuite."}]} +{"conversations": [{"role": "user", "content": "What is `LatoocarfianC` in SuperCollider?"}, {"role": "assistant", "content": "LatoocarfianC — Latoocarfian chaotic generator A cubic-interpolating sound generator based on a function given in Clifford Pickover's book Chaos In Wonderland, pg 26. The function is: Category: UGens > Generators > Chaotic."}]} +{"conversations": [{"role": "user", "content": "What is `Ball` in SuperCollider?"}, {"role": "assistant", "content": "Ball — physical model of bouncing object Ball models the path of a bouncing object that is reflected by a vibrating surface. Category: UGens > Filters > Nonlinear, UGens > Generators > PhysicalModels."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n// connect a MIDI device, allNotesOff with CmdPeriod useful\n\nMIDIClient.init;\nm = MIDIOut(0);\ng = { 16.do({ |i| m.allNotesOff(i) }) };\nCmdPeriod.add(g); \n\n\np = Pbind(\n \\type, \\midi,\n \\midiout, m, \n \\chan, 0,\n\n \\amp, PL(\\amp),\n \\midinote, PLseq(\\seq) + PL(\\seqAdd), \n \\dur, 0.2\n);\n);\n\n(\nv = VarGui([\\seq, [36, 60, \\lin, 1, 36] ! 5, \n \\seqAdd, [0, 12, \\lin, 1, 0],\n \\amp, [0, 1, \\\n// …\n```"}, {"role": "assistant", "content": "connect a MIDI device, allNotesOff with CmdPeriod useful remove if not needed anymore (VarGui: slider / player gui to set envir variables and synth controllers and play synths, event patterns and tasks)"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PdurStutter`."}, {"role": "assistant", "content": "```supercollider\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,0,1,3,4,0], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n100.do({ x.next.postln });\n);\n\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n);\n\n\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,4,4,0,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// vary frequency\n{ StandardL.ar(MouseX.kr(20, SampleRate.ir)) * 0.3 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// vary frequency\n{ StandardL.ar(MouseX.kr(20, SampleRate.ir)) * 0.3 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `CutGroup.new` do? What arguments does it take?"}, {"role": "assistant", "content": "A group in BBCut2 Arguments: cutsynths — an Array of CutSynths, though this argument can also cope with being passed a CutSynth directly.; group — A Group instance.; bus — A Bus instance.; numChannels — If 1, rendering is mono until the final CutMixer. If 2, rendering is stereo, and there is no pan functionality in the final CutMixer. The CutMixer will automatically be configured appropriately based on the numChannels variable in the CutGroup.."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n\n~remapConfig = IdentityDictionary[\n 0 -> 1,\n 1 -> 2,\n 2 -> 3,\n 3 -> 4,\n 4 -> 5,\n 5 -> 6,\n 6 -> 7,\n 7 -> 8,\n 8 -> 9,\n 9 -> 12,\n 10 -> 13,\n 11 -> 14,\n 12 -> 15,\n 13 -> 16,\n 14 -> 17\n];\n\n\n~generateRemapSynthDef = { |numInputChannels, numOutputChannels|\n SynthDef(\\remapOutputs, {\n var sig = In.ar(0, numInputChannels); \n var remapped = Array.fill(numOutputChannels, { Silent.ar(1) }); \n\n ~remapConfig.keysValuesDo { |src, dest|\n if (src < numInputChannels and: { dest < numOutputChannels }) {\n remapped[dest] = sig[src];\n }\n };\n\n ReplaceOut.ar(0, remapped);\n }).add;\n};\n\n~generateRemapSynthDef.(16, 18); \n);\n\n(\n~createRemapSynth = {\n ~remapSynth = Synth(\\remapOutputs, target: s.defaultGroup, addAction: \\addAfter);\n};\n\nServerTree.add( ~createRemapSynth);\n\n)\n```"}, {"role": "assistant", "content": "This code sets up a remapping system where input channels are mapped to output channels based on a predefined configuration. The remapping is done using a SynthDef that reads input signals, applies the remapping, and outputs the remapped signals. The ServerTree.add ensures that the remap synth is created and added to the server's node tree upon server startup and cmd-. and ctrl-.\r\n\r\nBased on discu."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n//distortion creeps in under 200Hz\n{ DPW3Tri.ar(XLine.kr(2000, 20, 10)) }.play; \n\n//very fast sweeps can have transient distortion effects\n{ DPW3Tri.ar(MouseX.kr(200,12000,'exponential')) }.play;\n\n//compare:\n{LFTri.ar(MouseX.kr(200,12000,'exponential'))}.play\n\n\n//less efficient than LFTri\n{ Mix(DPW3Tri.ar(Array.rand(10,50,5000))*0.1) }.play;\n\n{ Mix(LFTri.ar(Array.rand(10,50,5000))*0.1) }.play;\n\n\n//triangle is integration of square wave; warning loud, not so kind \n{Int\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n//distortion creeps in under 200Hz\n{ DPW3Tri.ar(XLine.kr(2000, 20, 10)) }.play; \n\n//very fast sweeps can have transient distortion effects\n{ DPW3Tri.ar(MouseX.kr(200,12000,'exponential')) }.play;\n\n//compare:\n{LFTri.ar(MouseX.kr(200,12000,'exponential'))}.play\n\n\n//less efficient than LFTri\n{ Mix(DPW3Tri.ar(Array.rand(10,50,5000))*0.1) }.play;\n\n{ Mix(LFTri.ar(Array.rand(10,50,5000))*0.1) }.play;\n\n\n//triangle is integration of square wave; warning loud, not so kind \n{Integrator.ar(Pulse.ar(MouseX.kr(440,8800),0.5),0.99)}.play\n\n//differentiation of triangle is square\n{HPZ1.ar(2.0*DPW3Tri.ar(MouseX.kr(440,8800)))}.play\n\n//compare\n{Pulse.ar(MouseX.kr(440,8800),0.5)}.play\n```"}]} +{"conversations": [{"role": "user", "content": "What does `RedInterpolator.new` do? What arguments does it take?"}, {"role": "assistant", "content": "holds a value and interpolates to new target Arguments: value — Start value.; tick — Update rate / resolution.; clock — If no clock passed in the SystemClock will be used.."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// Handy code for quick class demonstrations.\n// Comparing a few intervals - Just Intonation versus 12-tone Equal Tempered\n\n// Major third (just)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 60.midicps * 5/4], mul: 0.1) }).play\n// Major third (ET12)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 64.midicps], mul: 0.1) }).play;\n\n// Major second (just)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 60.midicps * 9/8], mul: 0.1) }).play\n// Major second (ET)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 62.midicps], mul: 0.1) }).play;\n\n// Perfect fifth (just)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 60.midicps * 3/2], mul: 0.1) }).play\n// Perfect fifth (ET)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 67.midicps], mul: 0.1) });\n```"}, {"role": "assistant", "content": "Simple handy code for quick class demonstrations. Hear and compare a few intervals in Just Intonation versus 12-tone Equal Tempered tuning."}]} +{"conversations": [{"role": "user", "content": "What does `EZRanger.new` do? What arguments does it take?"}, {"role": "assistant", "content": "A wrapper class for a label, a rangeslider, and numberboxes Arguments: parent — The parent view or window. If the parent is nil, then EZRanger will create its own Window, and place it conveniently on the screen if the bounds are a Point. If the bounds are a Rect, then the Rect determines the window bounds.; bounds — An instance of Rect or Point. Default value is `160@20`.; label — The label. Default value is `nil`. If `nil`, then no StaticText is created.; controlSpec — The ControlSpec for scaling the value.; action — A Function called when the value changes. The function is passed the EZRanger instance as its argument.; initVal — An instance of Array `[lo, hi]`. If `nil`, then it uses the ControlSpec's default value.; initAction — A Boolean indicating whether the action function should be called when setting the initial value. The default is `false`.; labelWidth — Number of pixels width for the label. default is 60.."}]} +{"conversations": [{"role": "user", "content": "What does `RedManchesterCode.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new Arguments: numBits — The maximum number of bits in the data to be encoded. The default 8 can deal with values between 0 and 255.."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `EnvGate`."}, {"role": "assistant", "content": "```supercollider\na = { LPF.ar(Saw.ar(200), 600) * EnvGate.new }.play;\na.set(\\fadeTime, 2);\na.release;\n\n// the same as:\na.set(\\gate, 0);\n\n// several env gates can coexist in one synth def.\n(\na = {\n var sound1 = LPF.ar(Saw.ar(80), 600) * EnvGate.new;\n var sound2 = RLPF.ar(Saw.ar(200) * 0.5, 6000 * EnvGate.new + 60, 0.1) * EnvGate.new;\n sound1 + sound2\n}.play;\n);\na.set(\\fadeTime, 5);\na.release;\n```"}]} +{"conversations": [{"role": "user", "content": "What is Env.perc and what does it take?"}, {"role": "assistant", "content": "`Env.perc(attackTime, releaseTime, level, curve)` — an attack to `level` (default 1) then a decay to zero, with curve defaulting to -4 (an exponential-ish decay). `Env.perc(0.01, 1)` is the default percussive envelope, and it is a complete Env, not a generator: pair it with EnvGen to hear it."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `SampleRate`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// compares a 441 Hz sine tone derived from sample rate (44100 * 0.01, left)\n// with a 440 Hz tone (right), resulting in a 1 Hz beating\n(\n{\n var freq;\n freq = [SampleRate.ir * 0.01, 440];\n SinOsc.ar(freq, 0, 0.1)\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `EnvirGui.envir` do?"}, {"role": "assistant", "content": "the envir displayed - actually an alias for"}]} {"conversations": [{"role": "user", "content": "What does `Dictionary.putPairs` do?"}, {"role": "assistant", "content": "Add all items to the dictionary, using them as key and value pairwise. `d ="}]} -{"conversations": [{"role": "user", "content": "Explain `Fb1_HopfAFDC` in SuperCollider briefly."}, {"role": "assistant", "content": "Fb1_HopfAFDC — Adaptive Hopf pseudo ugen with fast dynamical coupling This is an adaptive variant of Hopf, which enhances the adaption mechanism of #[1], see #[2] (4.1.) for a description. The parameter naming follows the convention of #[2]. Category: Libraries > miSCellaneous > Nonlinear."}]} -{"conversations": [{"role": "user", "content": "What does `Mx.inlets` do?"}, {"role": "assistant", "content": "Just like an individual unit, an Mx can have inlets and can be loaded inside another Mx. (not yet fully Returns: array of MxInlet"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// This SynthDef has a harder attack than the default, illustrating rearticulation more clearly.\n(\nSynthDef(\\sawpulse, { |out, freq = 440, gate = 0.5, plfofreq = 6, mw = 0, ffreq = 2000, rq = 0.3, freqlag = 0.05, amp = 1|\n var sig, plfo, fcurve;\n plfo = SinOsc.kr(plfofreq, mul: mw, add: 1);\n freq = Lag.kr(freq, freqlag) * plfo;\n fcurve = EnvGen.kr(Env.adsr(0, 0.3, 0.1, 20), gate);\n fcurve = (fcurve - 1).madd(0.7\n// …\n```"}, {"role": "assistant", "content": "This SynthDef has a harder attack than the default, illustrating rearticulation more clearly. (PmonoArtic: partly monophonic event stream)"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// loopFunc also takes a pattern of Functions, in this case\n// the arg loopFuncPerItem decides if next Functions are polled per item or per loop.\n\n(\n~lookBack = 0;\n~loopFuncPerItem = true; // or 1\n\np = Pbind(\n \\dur, Pn(Pshuf([1, 1, 2]/6)),\n \\midinote, PSloop(\n Prand((60..80), inf),\n bufSize: 10,\n lookBack: { ~lookBack },\n // every number gets a Function that adds an interval of that size\n loopFunc: Pxrand((3..11), inf).collect { |x| { |y| y - [0, x].postln } },\n loopFuncPerItem: { ~loopFuncPerItem }\n )\n// …\n```"}, {"role": "assistant", "content": "loopFunc also takes a pattern of Functions, in this case the arg loopFuncPerItem decides if next Functions are polled per item or per loop. (PSloop: Pattern to derive loops from a given Pattern)"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n\n{\n var input, kernel;\n\n input = SoundIn.ar(0);\n kernel = Mix.ar(LFSaw.ar([300, 500, 800, 1000] * MouseX.kr(1.0, 2.0), 0, 1.0));\n\n // must have power of two framesize\n Convolution.ar(input, kernel, 1024, 0.5)\n}.play;\n\n);\n\n(\n// must have power of two framesize- FFT size will be sorted by Convolution to be double this\n// maximum is currently a = 8192 for FFT of size 16384\n\na = 2048;\ns = Server.local;\n\n// kernel buffer\ng = Buffer.alloc(s, a, 1);\n);\n\n(\n\n// random impulse response\n\ng.set(0, 1.\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n\n{\n var input, kernel;\n\n input = SoundIn.ar(0);\n kernel = Mix.ar(LFSaw.ar([300, 500, 800, 1000] * MouseX.kr(1.0, 2.0), 0, 1.0));\n\n // must have power of two framesize\n Convolution.ar(input, kernel, 1024, 0.5)\n}.play;\n\n);\n\n(\n// must have power of two framesize- FFT size will be sorted by Convolution to be double this\n// maximum is currently a = 8192 for FFT of size 16384\n\na = 2048;\ns = Server.local;\n\n// kernel buffer\ng = Buffer.alloc(s, a, 1);\n);\n\n(\n\n// random impulse response\n\ng.set(0, 1.0);\n\n100.do({ |i| g.set(a.rand, 1.0.rand) });\n\n\n{\n var input, kernel;\n\n input = SoundIn.ar(0);\n kernel = PlayBuf.ar(1, g.bufnum, BufRateScale.kr(g.bufnum), 1, 0, 1);\n\n Convolution.ar(input, kernel, 2 * a, 0.5)\n}.play;\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `Layout` in SuperCollider briefly."}, {"role": "assistant", "content": "Layout — Superclass of all GUI layouts Layout is the abstract superclass of all layouts. Any layout can be installed on a view with the view's View#-layout#'layout' setter method. See GUI-Layout-Management for details of operation common to all layouts. Category: GUI > Layout."}]} -{"conversations": [{"role": "user", "content": "My sustained synth never stops, even when I set the gate to 0."}, {"role": "assistant", "content": "A sustained EnvGen only releases when the gate goes from positive to non-positive *after* the envelope has started, and the Synth only disappears if that EnvGen has `doneAction: 2`. Check three things: the SynthDef actually takes a `gate = 1` argument, the Env is a sustained shape (Env.adsr or Env.asr, not Env.perc), and you call `x.set(\\gate, 0)` on the Synth object. Setting the gate on a different Synth, or on a Group, does nothing."}]} -{"conversations": [{"role": "user", "content": "What does `EZGui.alwaysOnTop` do? What arguments does it take?"}, {"role": "assistant", "content": "Makes the popup window always on top, if there is Arguments: bool — An Instance of Boolean. Default is false.."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pbind`."}, {"role": "assistant", "content": "```supercollider\nPbind(\\note, Pseq([0, 4, 7]), \\amp, 0.1, \\dur, 0.2).play\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Routine`."}, {"role": "assistant", "content": "```supercollider\n// wait\n\n(\nvar r;\nr = Routine {\n 10.do({ |a|\n a.postln;\n // Often you might see Wait being used to pause a routine\n // This waits for one second between each number\n 1.wait;\n });\n // Wait half second before saying we're done\n 0.5.wait;\n \"done\".postln;\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes an experiment with roots of unity in supercollider."}, {"role": "assistant", "content": "```supercollider\n(\n\n~divisors = {\n arg n;\n ~divs = List.newClear(0);\n for( 1, floor(sqrt(n)), {arg i; if(n%i==0,{\n //i.postln;\n ~divs.add(i);\n // (i==n.div(i)).postln;\n if(i==n.div(i),{},{~divs.add(n.div(i))});\n },{});\n });\n ~divs.sort;\n ~divs;\n};\n\n\nSynthDef(\\rootsOfUnitySum, { |out=0,freq=1,amp=1,n=1,ks=#[1]|\n var l,sigl,sigr,env;\n\n\n sigl = SinOsc.ar(freq:0,mul:0);\n sigr = SinOsc.ar(freq:0,mul:0);\n ks.do({arg item,i;\n k = item;\n sigr = sigr+SinOsc.ar(freq:freq*2pi*k/n,mul:amp,phase:0.5*pi);\n sigl = sigl+SinOsc.ar(freq:freq*2pi*k/n,mul:amp);\n });\n env = EnvGen.kr(Env.linen(attackTime: 0.001, sustainTime: 1, releaseTime: 0.01, level: 1.0, curve: 'lin'), doneAction: Done.freeSelf);\n sigr = sigr*env;\n sigl = sigl*env;\n\n Out.ar(out, [sigl,sigr])\n}).add;\n\n\n~getPbind = { arg n, amps, durs, freq;\n ~nums = ~divisors.value(n);\n r = Pbind(\\instrument,\\rootsOfUnitySum,\n \\amp,amps,\n \\dur,durs,\n \\freq,freq,\n \\n,Pseq([n],~nums.size),\n \\ks , Pseq(all{:~divisors.value(n),n<-~nums},1)).trace();\n r\n};\n\n~seq = (1..13);\n~tau = all{:~divisors.value(n).size,n<-~seq};\n\n\n~r = Pseq(all{:~getPbind.value(\n n:n,\n amps:Pseq(all{:0.5/t,t<-~tau},1),\n durs:Pseq(all{:0.3333/t,t<-~tau},1),\n freq:220/3),n<-~seq},1);\n\n~s = Pseq(all{:~getPbind.value(\n n:n,\n amps:Pseq(all{:0.5/t,t<-~tau},1),\n durs:Pseq(all{:0.5/t,t<-~tau},1),\n freq:110),n<-~seq},1);\n\n~t = Pseq(all{:~getPbind.value(\n n:n,\n amps:Pseq(all{:0.5/t,t<-~tau},1),\n durs:Pseq(all{:1/t,t<-~tau},1),\n freq:220),n<-~seq},1);\n\n~x = Pseq([\n Ppar([~t],1),\n Ppar([~s],1),\n Ppar([~s,~t],1),\n Ppar([~r],1),\n Ppar([~r,~t],1),\n Ppar([~r,~s],1),\n Ppar([~r,~s,~t],1),\n ],inf);\n\n);\n\nPdef(\\mplayer, ~x).clock_(TempoClock(100/60)).play;\nPdef(\\mplayer, Pn(Event.silent)).fadeTime_(8);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `BeatClockPlayer.spec` do?"}, {"role": "assistant", "content": "'trig' rate player that plays steady impulse triggers locked to tempo"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes vinyl noise emulation."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef.new(\\vinylCrackling, { arg out=0;\n var pop,imp,modImp,midNoise,hiNoise,loNoise,loopTime=8,numChan=2,w,x,y;\n\n //Harder pops\n pop = TDuty.ar(Dseq({ 1.0.bilinrand.abs } ! loopTime,inf));\n pop = Resonz.ar(Decay.ar(pop,TRand.ar(0.001,0.1,pop)),Demand.ar(pop,0,Dseq({ 7000.bilinrand.abs+40 } ! loopTime,inf)),\n mul:Demand.ar(pop,0,Dseq({ exprand(0.1,0.87) } ! loopTime,inf)));\n pop = LeakDC.ar(pop,TRand.ar(0.9,0.9995,pop));\n #w,x,y = PanB2.ar(pop,Demand.ar(pop,0,Dseq({ 1.0.rand2 } ! loopTime,inf)));\n\n //Softer, highpass filtered impulses\n imp = { arg i; HPF.ar(LPF.ar(Dust2.ar(8),8000.0),6000.0,WhiteNoise.ar(0.7)) } ! numChan;\n\n //Faster, modulated lowpass filtered impulses\n modImp = LPF.ar(Dust.ar(LFDNoise3.ar(1).exprange(100,500),LFDNoise3.ar(10).exprange(0.01,0.07)),9000.0) ! numChan;\n\n //Mid frequency modulated noise background\n midNoise = LPF.ar(GrayNoise.ar(LFDNoise3.ar(60))*WhiteNoise.ar(0.009),12000.0) ! numChan;\n\n //High frequency modulated noise background\n hiNoise = HPF.ar(LPF.ar(GrayNoise.ar(LFDNoise3.ar(60))*WhiteNoise.ar(0.01),14000.0),8000.0) ! numChan;\n\n //Low frequency modulated noise background\n loNoise = LPF.ar(BrownNoise.ar(PinkNoise.ar.range(0.001,0.02)),1200) ! numChan;\n\n Out.ar(out,DecodeB2.ar(numChan,w,x,y)+imp+modImp+midNoise+hiNoise+loNoise);\n }).add;\n);\n\ns.sendMsg('/s_new',\\vinylCrackling,a=s.nextNodeID,0,1,\\out,0);\ns.sendMsg('/n_free',a);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Real-time pattern morphing with Ndef."}, {"role": "assistant", "content": "```supercollider\n(\n~name = \"saw\";\n\nSynthDef(~name, { arg out=0, amp=0.1, gate=1, pan=0, spread=0.8, freq=200, doneAction=2, ffreq=300, rq=0.3;\n var sig;\n sig = LFSaw.ar(freq);\n sig = RLPF.ar(sig, ffreq, rq);\n sig = sig * EnvGen.ar(\\adsr.kr(Env.adsr(0.01,0.1,0.8,0.1)),gate,doneAction:doneAction);\n sig = Splay.ar(sig, spread, amp, pan);\n Out.ar(out, sig);\n}).add;\n\n\n~morph = { arg mainkey, lagtime, pat;\n var base = pat.asStream.next(());\n var bind = List.new;\n var proxy;\n base.keysValuesDo { arg key, val;\n var ndefkey = \"%.%\".format(mainkey, key).asSymbol;\n Ndef(ndefkey, { \n Line.kr(Ndef(ndefkey).kr, val, lagtime)\n });\n proxy = Ndef(ndefkey);\n bind.add(key);\n bind.add(proxy.bus.asMap);\n };\n Pbind(*bind)\n};\n);\n\n\nPdef(~name).play;\n\n\n(\n// preset 1\n\n~a = Pdef(~name, ~morph.(\\bla, 2.1, Pbind(\n \\freq, 100,\n \\ffreq, 1300,\n)) <> Pbind(\n \\instrument, ~name,\n \\dur, 1,\n));\n\n);\n\n(\n// preset 2\n\n~a = Pdef(~name, ~morph.(\\bla, 1, Pbind(\n \\freq, 1500,\n \\ffreq, 200,\n)) <> Pbind(\n \\instrument, ~name,\n \\dur, 1,\n));\n\n);\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Note that constructions like SynthDef(...) and Synth(...) are short for SynthDef.new(...), etc.\n// With SynthDef it is common to chain this with calls on the resulting instance,\n// e.g. SynthDef(...).add or SynthDef(...).play\n\n// make a simple def and send it to the server\n\ns.boot;\nSynthDef(\\SimpleSine, { |freq = 440, out| Out.ar(out, SinOsc.ar(freq, 0, 0.2)) }).add;\n\n// the above is essentially the same as the following:\nd = SynthDef(\\SimpleSine, { |freq = 440, out| Out.ar(out, SinOsc.ar(freq, 0, 0.2)) });\nd.add;\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Note that constructions like SynthDef(...) and Synth(...) are short for SynthDef.new(...), etc.\n// With SynthDef it is common to chain this with calls on the resulting instance,\n// e.g. SynthDef(...).add or SynthDef(...).play\n\n// make a simple def and send it to the server\n\ns.boot;\nSynthDef(\\SimpleSine, { |freq = 440, out| Out.ar(out, SinOsc.ar(freq, 0, 0.2)) }).add;\n\n// the above is essentially the same as the following:\nd = SynthDef(\\SimpleSine, { |freq = 440, out| Out.ar(out, SinOsc.ar(freq, 0, 0.2)) });\nd.add;\n\n// now make a synth from it, using the default value for freq, then another with a different value\nx = Synth(\\SimpleSine);\ny = Synth(\\SimpleSine, [\\freq, 660]);\n\n// now change the freq value for x\nx.set(\\freq, 880);\n\nx.free; y.free;\n\n// using the play convenience method\nx = SynthDef(\\SimpleSine, { |freq = 440, out| Out.ar(out, SinOsc.ar(freq, 0, 0.2)) }).play\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n{\n var env = Env([0, 0.6, 0.3, 1.0, 0], [0.1, 0.02, 0.4, 1.1], [\\lin, \\exp, -6, \\sin]);\n var envgen = IEnvGen.kr(env, MouseX.kr(0, env.times.sum));\n env.plot;\n SinOsc.ar(envgen * 500 + 440)\n}.play;\n);\n\n// index with an SinOsc ... mouse controls amplitude of SinOsc\n// use offset so negative values of SinOsc will map into the Env\n(\n{\n var sin = SinOsc.ar(440, 0, MouseX.kr(0, 1));\n // use offset so negative values of SinOsc will map into the Env\n v\n// …\n```"}, {"role": "assistant", "content": "index with an SinOsc ... mouse controls amplitude of SinOsc use offset so negative values of SinOsc will map into the Env (IEnvGen: Envelope generator for polling values from an Env)"}]} -{"conversations": [{"role": "user", "content": "What is `VarGui`?"}, {"role": "assistant", "content": "VarGui — slider / player gui to set envir variables and synth controllers and play synths, event patterns and tasks"}, {"role": "user", "content": "What does `VarGui.new` do?"}, {"role": "assistant", "content": "Create a new VarGui object, which holds control specifications."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\np = Pbind(\\midinote, Pfunc { ~midi } + Pseq([0, 3, 5, 7], inf), \\dur, 0.2)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\nvar noise, out;\nnoise = LFNoise0.kr(8);\n\nout = if( noise > 0.0,\n if(noise > 0.5, \n if(noise > 0.9, WhiteNoise.ar(0.2), Pulse.ar(60, 0.5, 0.4)),\n SinOsc.ar(500, 0, 0.25)\n ),\n Saw.ar(160, 0.5)\n);\n\nout ! 2\n\n}.play;\n)\n```"}, {"role": "assistant", "content": "A short, silly example of using if in a SynthDef. Using Select is generally a better thing to do."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\AcnSn3dIn;\n~description = \"A live ambisonic input (ACN_SN3D)\";\n~channelLayout = \\ambi;\n\n~function = { |order=1, t_trig = 0, bus = 0|\n var env = EnvGen.kr(Env([0,1], [1]), t_trig);\n var chans = Array.series(\n size: (order + 1).pow(2).asInteger,\n start: bus,\n step: 1\n );\n var input = SoundIn.ar(chans) * env;\n HOAConverterAcnSn3d2AcnN3d.ar(order, input);\n};\n```"}, {"role": "assistant", "content": "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see ."}]} -{"conversations": [{"role": "user", "content": "My sustained synth never stops, even when I set the gate to 0."}, {"role": "assistant", "content": "A sustained EnvGen only releases when the gate goes from positive to non-positive *after* the envelope has started, and the Synth only disappears if that EnvGen has `doneAction: 2`. Check three things: the SynthDef actually takes a `gate = 1` argument, the Env is a sustained shape (Env.adsr or Env.asr, not Env.perc), and you call `x.set(\\gate, 0)` on the Synth object. Setting the gate on a different Synth, or on a Group, does nothing."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Pchain`."}, {"role": "assistant", "content": "```supercollider\n// implicitly, the composition operator <> returns a Pchain when applied to a pattern.\n// so that a <> b creates a Pchain (a, b).\n// as seen above, in Pchain(a, b), a specifies (and overrides) b: b is the input to a.\n\n// the above example is equivalent to:\n\n(Pbind(\\degree, Pseq([1, 2, 3], inf)) <> (detune: [0, 4])).trace.play;\n\n(\na = Pbind(\\degree, Pseq([1, 2, 3], inf), \\dur, Prand([0.2, 0.4], inf));\nb = Pbind(\\detune, Pseq([-30, 0, [0, 40]], inf), \\dur, 0.1);\nc = b <> a;\nc.play; // see that the \\dur key of a is overridden by b\n);\n\n// also value streams can be composed\n(\na = Pfunc { |x| x + 1.33 };\nb = Pfunc { |x| x * 3 };\nc = Pseries(1, 2, inf);\n);\n\n// post some values from the composite streams:\n\nt = (a <> b).asStream;\n10.do { t.value(10).postln };\n\nt = (a <> b <> c).asStream;\n10.do { t.value(10).postln };\n\nt = (b <> c <> a).asStream;\n10.do { t.value(10).postln };\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n// compares a 1102.5 Hz sine tone (11025 * 0.1, left) with a 1100 Hz tone (right)\n// the apollo sample has a sample rate of 11.025 kHz\n(\n{\n var freq;\n freq = [BufSampleRate.kr(b) * 0.1, 1100];\n SinOsc.ar(freq, 0, 0.1)\n}.play;\n;\n\nb.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n// compares a 1102.5 Hz sine tone (11025 * 0.1, left) with a 1100 Hz tone (right)\n// the apollo sample has a sample rate of 11.025 kHz\n(\n{\n var freq;\n freq = [BufSampleRate.kr(b) * 0.1, 1100];\n SinOsc.ar(freq, 0, 0.1)\n}.play;\n);\n\nb.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `List.foldAt` do?"}, {"role": "assistant", "content": "Similar to #-at, but guarantees that any value for index is valid by reflecting values outside the collection's bounds. Values greater than `size - 1` are reflected back toward lower indices. Similarly, if the index is below `0` (negative), it folds in the opposite direction. This creates a symmetrical mapping of any index within the collection's boundaries. The index can also be an array of indices to extract the specified"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes an experiment with roots of unity in supercollider."}, {"role": "assistant", "content": "```supercollider\n(\n\n~divisors = {\n arg n;\n ~divs = List.newClear(0);\n for( 1, floor(sqrt(n)), {arg i; if(n%i==0,{\n //i.postln;\n ~divs.add(i);\n // (i==n.div(i)).postln;\n if(i==n.div(i),{},{~divs.add(n.div(i))});\n },{});\n });\n ~divs.sort;\n ~divs;\n};\n\n\nSynthDef(\\rootsOfUnitySum, { |out=0,freq=1,amp=1,n=1,ks=#[1]|\n var l,sigl,sigr,env;\n\n\n sigl = SinOsc.ar(freq:0,mul:0);\n sigr = SinOsc.ar(freq:0,mul:0);\n ks.do({arg item,i;\n k = item;\n sigr = sigr+SinOsc.ar(freq:freq*2pi*k/n,mul:amp,phase:0.5*pi);\n sigl = sigl+SinOsc.ar(freq:freq*2pi*k/n,mul:amp);\n });\n env = EnvGen.kr(Env.linen(attackTime: 0.001, sustainTime: 1, releaseTime: 0.01, level: 1.0, curve: 'lin'), doneAction: Done.freeSelf);\n sigr = sigr*env;\n sigl = sigl*env;\n\n Out.ar(out, [sigl,sigr])\n}).add;\n\n\n~getPbind = { arg n, amps, durs, freq;\n ~nums = ~divisors.value(n);\n r = Pbind(\\instrument,\\rootsOfUnitySum,\n \\amp,amps,\n \\dur,durs,\n \\freq,freq,\n \\n,Pseq([n],~nums.size),\n \\ks , Pseq(all{:~divisors.value(n),n<-~nums},1)).trace();\n r\n};\n\n~seq = (1..13);\n~tau = all{:~divisors.value(n).size,n<-~seq};\n\n\n~r = Pseq(all{:~getPbind.value(\n n:n,\n amps:Pseq(all{:0.5/t,t<-~tau},1),\n durs:Pseq(all{:0.3333/t,t<-~tau},1),\n freq:220/3),n<-~seq},1);\n\n~s = Pseq(all{:~getPbind.value(\n n:n,\n amps:Pseq(all{:0.5/t,t<-~tau},1),\n durs:Pseq(all{:0.5/t,t<-~tau},1),\n freq:110),n<-~seq},1);\n\n~t = Pseq(all{:~getPbind.value(\n n:n,\n amps:Pseq(all{:0.5/t,t<-~tau},1),\n durs:Pseq(all{:1/t,t<-~tau},1),\n freq:220),n<-~seq},1);\n\n~x = Pseq([\n Ppar([~t],1),\n Ppar([~s],1),\n Ppar([~s,~t],1),\n Ppar([~r],1),\n Ppar([~r,~t],1),\n Ppar([~r,~s],1),\n Ppar([~r,~s,~t],1),\n ],inf);\n\n);\n\nPdef(\\mplayer, ~x).clock_(TempoClock(100/60)).play;\nPdef(\\mplayer, Pn(Event.silent)).fadeTime_(8);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Limiter`."}, {"role": "assistant", "content": "```supercollider\n(\n// example signal to process\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n z * 0.8\n}.play\n);\n\n(\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n [z, Limiter.ar(z, 0.4, 0.01)] * 0.5\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Rest`."}, {"role": "assistant", "content": "```supercollider\n(\nPbind(\n \\degree, Pif(\n 0.1.loop.coin,\n Pseq([Rest(), 7], inf), // every second is a Rest\n Pseries(0, 1, inf).fold(-7, 7)\n ),\n \\dur, 0.125\n).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// same as above, but we use a NetAddr with a port of nil, so we can receive from a specific host, but from any port\n\nn = NetAddr(\"127.0.0.1\", nil); // the url should be the one of computer of app 2\no = OSCresponderNode(n, '/test', { |t, r, msg| msg.postln }.add;\no.remove;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// same as above, but we use a NetAddr with a port of nil, so we can receive from a specific host, but from any port\n\nn = NetAddr(\"127.0.0.1\", nil); // the url should be the one of computer of app 2\no = OSCresponderNode(n, '/test', { |t, r, msg| msg.postln }).add;\no.remove;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `View.action` do? What arguments does it take?"}, {"role": "assistant", "content": "Gets or sets the default action of the view, i.e. the object to be evaluated when the user interacts with the view in an essential way (e.g. a Button is clicked, a ListView item is selected, Arguments: func — Any object to set as default action, usually a Function or a FunctionList. When evaluated, it will be passed the view as an argument.."}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ LPF.ar(Saw.ar(100), SinOsc.kr(0.5).exprange(200, 2000)) * 0.2 }.play;\n```"}, {"role": "assistant", "content": "A sawtooth through a low-pass filter whose cutoff is swept slowly up and down — a classic filter\nsweep.\n\n- `Saw.ar(100)` is a 100 Hz sawtooth, rich in harmonics.\n- `SinOsc.kr(0.5)` is a control-rate sine at 0.5 Hz, so one full cycle takes 2 seconds.\n- `.exprange(200, 2000)` maps that -1..1 sine exponentially onto 200..2000 Hz — exponential is the right\n mapping for frequency, because we hear pitch logarithmically.\n- `LPF.ar(sig, cutoff)` removes harmonics above the cutoff; as it opens and closes you hear the tone\n brighten and darken.\n- `* 0.2` keeps the output from clipping."}]} -{"conversations": [{"role": "user", "content": "What is `BelaScope` in SuperCollider?"}, {"role": "assistant", "content": "BelaScope — Bela's Oscilloscope interface Category: UGens > Bela."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Dictionary`."}, {"role": "assistant", "content": "```supercollider\n(\nd = Dictionary.new;\nd.add(\\monkey -> 0).postln;\nd.add(\\robot -> 1).postln; // Add robot as a key with a value of 1\nd.add(\\monkey -> 2).postln; // Replaces the value for the key monkey with 2\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nt = TempoClock(120/60).permanent_(true);\n\n(\n~change_clock_tempo = {|clock, tempo, beats=1|\n beats.do {|beat|\n var stepTempo = beat.linexp(0, beats-1, clock.tempo, tempo);\n clock.schedAbs(clock.nextBar + beat, {\n \"New Tempo: \".post; (stepTempo*60).post; \" BPM\".postln;\n clock.tempo_(stepTempo);\n });\n };\n nil;\n};\nPbindef(\\n,\n \\octave, 4,\n \\dur, 0.5,\n \\degree, Pseq((0..7), inf)\n).play(t, quant: 4);\n);\n\n~change_clock_tempo.value(t, 200/60, 16);\n~change_clock_tempo.value(t, 50/60, 8);\nt.tempo*60\n```"}, {"role": "assistant", "content": "This gradually changes the tempo of a TempoClock, each beat of a specified number of beats, and starting at the next bar.\r\n\r\n\r\nPersonally, I was not able to heavily distinguish between `.linlin` and `.linexp` for reasonable musical tempos.\r\n\r\n\r\nThere may be a mathematically smoother way of handling this at the control rate.\r\n\r\n\r\nThis function does not gracefully handle multiple simultaneous invoca."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\RotateAz;\n~description = \"Rotation around the z-axis (angle from -180 to 180)\";\n\n~function = { |in = 0, order = 1, rotateAziDeg = 0|\n\n // Rotating the scene is done from the perspective of the listener\n // rotation follows the right-hand rule of rotation:\n // * Positive azimuth means the listener turns head to the left\n\n HOATransRotateAz.ar(\n order: order,\n in: in,\n az: rotateAziDeg.degrad\n );\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for UI sounds (pt1)."}, {"role": "assistant", "content": "```supercollider\n// UI sounds\n// this code is an attempt to recreate a sound\n// inspired from some technological/electrical UI interface\n\n// 1. first define the synth\n// Here we are using the FM technique\n(\nSynthDef(\\fmmod, {\n |\n amp=0.2,\n fc=1000,\n fm = 100,\n idx = 100,\n atk=0.01,\n rls=0.1\n |\n var env = EnvGen.ar(Env.perc(atk, rls), doneAction:2);\n var modulator = SinOsc.ar(fm);\n var carrier = SinOsc.ar(fc + (idx*modulator) );\n var sig = carrier * env * amp;\n sig = HPF.ar(sig, 1000);\n Out.ar(0, sig!2);\n}).add;\n);\n\n// 2. then define the Pbind which will play the sequence\n// of UI sounds simulating variuos characters showing up on an\n// imaginary display.\n// Play around FC, FM, ATK and RLS to obtain different sound characters.\n(\np = Pbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 100,\n \\idx, 100,\n \\amp, 0.6,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).asEventStreamPlayer;\n);\n\n// 3. play it\np.play;\n\n// 4. Here are some presets\n\n// \"cricket\" preset\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 100,\n \\idx, 100,\n \\amp, 0.6,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 2\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 1000,\n \\idx, 100,\n \\amp, 0.6,\n \\atk, 0.001,\n \\rls, 0.01,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 3\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 100,\n \\idx, 10,\n \\amp, 0.4,\n \\atk, 0.01,\n \\rls, 0.01,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 4\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 1000,\n \\fm, 100,\n \\idx, 1000,\n \\amp, 0.2,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n\n// preset 5\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 5000,\n \\fm, 1000,\n \\idx, 1000,\n \\amp, 0.4,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 5\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 8000,\n \\fm, 1000,\n \\idx, 1000,\n \\amp, 0.7,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes open files within the Modality workshop folder."}, {"role": "assistant", "content": "```supercollider\n// open files within the Modality workshop folder\n\n~basePath = \"\".resolveRelative;\n\n// installing Modality and other quarks for this workshop:\n(~basePath +/+ \"0_installing.scd\").openDocument;\n\n// finding and defining devices:\n(~basePath +/+ \"1_finding_and_defining_devices_hid.scd\").openDocument;\n(~basePath +/+ \"1_finding_and_defining_devices_midi.scd\").openDocument;\n\n// exploring elements and actions:\n(~basePath +/+ \"2_elements_and_actions_hid.scd\").openDocument;\n(~basePath +/+ \"2_elements_and_actions_midi.scd\").openDocument;\n\n// using ndefs:\n(~basePath +/+ \"3_using_ndefs_hid.scd\").openDocument;\n(~basePath +/+ \"3_using_ndefs_midi.scd\").openDocument;\n\n\n// some shared sound processes\n(~basePath +/+ \"shared_processes\").openOS;\n\n(~basePath +/+ \"shared_processes/*\").pathMatch.collect(_.basename).postcs;\n(~basePath +/+ \"shared_processes/*\").pathMatch.choose.openDocument;\n// open one of them:\n(~basePath +/+ \"shared_processes/cat.scd\").openDocument;\n// load one directly, e.g. for use in controller patches:\n(~basePath +/+ \"shared_processes/cat.scd\").load;\n\n// ... you are welcome to share your own sound processes here!\n\n// some more modal functionality using MFunc:\n(~basePath +/+ \"5_modal_functionality_2_hid.scd\").openDocument;\n(~basePath +/+ \"5_modal_functionality_2_midi.scd\").openDocument;\n(~basePath +/+ \"5_modal_functions_2b_midi.scd\").openDocument;\n```"}]} -{"conversations": [{"role": "user", "content": "I get 'server not running' or nothing happens at all."}, {"role": "assistant", "content": "The server is not booted. In the IDE press Ctrl+B, or evaluate `s.boot`. If code depends on a SynthDef being there, put it inside `s.waitForBoot { ... }`. When a script runs headless you can do `s.boot; s.sync;` and continue. `s.serverRunning` tells you the truth; if it is false, look at the post window for the boot error (usually an audio device problem)."}]} -{"conversations": [{"role": "user", "content": "How should I organise a SuperCollider project on disk?"}, {"role": "assistant", "content": "One folder per piece, with a fixed shape:\n\n```text\nmy-piece/\n synthdefs.scd // only SynthDef(...).add, loaded first\n material.scd // buffers, samples, scales\n piece.scd // the performance: Tdefs, Pbinds, Ndefs\n README.md // tempo, required samples, how to run it\n```\n\nThen the workflow is: open `synthdefs.scd`, Ctrl+A Ctrl+Enter to load it, load `material.scd`, and work in\n`piece.scd`. Keeping definitions out of the performance file is what makes a reboot survivable and a piece\nre-runnable six months later."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Close in Counters of the Fourth Mind."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\closeN, { |out=0, freq=440, gate=1|\n var son = BPF.ar(in: WhiteNoise.ar(20!2),\n freq: freq,\n rq: 0.005,\n mul: 1,\n );\n var env = EnvGen.ar(\n Env.linen(0.1, 0.5, 0.55, 0.8, \\welch),\n doneAction:2\n );\n son = FreeVerb2.ar(son, son, mix: 0.7, room: 1.0, damp: 0.3);\n Out.ar(out, son * env);\n\n\n}).add;\n);\n\n\n(\na = {\n var saw, bpf;\n saw = Saw.ar(\n freq: [200, 250],\n mul: LFPulse.kr(\n freq: [2, 3],\n width: 0.15));\n bpf = LPF.ar(in: saw, freq: SinOsc.kr(1/5).range(200, 4000));\n bpf = FreeVerb2.ar(bpf, bpf, mix: 0.4, room: 0.7);\n Out.ar(0, bpf);\n};\ns = {\n var saw, bpf;\n saw = Saw.ar(\n freq: [100, 150],\n mul: LFPulse.kr(\n freq: [1, 1.5],\n width: 0.15));\n bpf = LPF.ar(in: saw, freq: SinOsc.kr(1/5).range(200, 4000));\n bpf = FreeVerb2.ar(bpf, bpf, mix: 0.4, room: 0.7);\n Out.ar(0, bpf);\n};\nd = {\n var saw, bpf;\n saw = Pulse.ar(\n freq: [800, 1000],\n mul: LFPulse.kr(\n freq: [1, 1.5],\n width: 0.15).range(0.0,0.7));\n bpf = LPF.ar(in: saw, freq: SinOsc.kr(1/5).range(200, 4000));\n bpf = FreeVerb2.ar(bpf, bpf, mix: 0.4, room: 0.7);\n Out.ar(0, bpf);\n};\nf = Pbind(\n \\instrument, \\closeN,\n \\freq, Pseq([800, 1000, 900, 400, 600], inf),\n \\dur, Pseq([1, 1, 1, 1, 4], inf),\n \\amp, 1);\ng = Pbind(\n \\instrument, \\closeN,\n \\freq, Pseq([1000, 1150, 1200, 1500, 1200], inf),\n \\dur, Pseq([1, 1, 1, 1, 4], inf),\n \\amp, 0.5);\n{\n a.play;\n 3.75.wait;\n f.play();\n 4.25.wait;\n s.play;\n 8.wait;\n d.play;\n 3.75.wait;\n g.play;\n}.fork;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// play SinOscs silently and wait for granulation envelopes\n\n(\na = Bus.audio(s, 10);\nx = { Splay.ar(In.ar(a, 10) * SinOsc.ar((3..12) * 100, 0, 0.05)) }.play\n);\n\n\n// send envelopes to buses\n\n(\nz = {\n DXEnvFanOut.ar(\n Dseq((0..5) + a.index, inf) + Diwhite(1, 4),\n \n // with newer SC versions you can also write:\n // Dseq((0..5), inf) + Diwhite(1, 4) + a.index,\n \n fadeTime: 0.05,\n width: 1,\n initOutOffset: -0.5\n )\n}.play\n);\n\nx.release;\n\n// clean\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// play SinOscs silently and wait for granulation envelopes\n\n(\na = Bus.audio(s, 10);\nx = { Splay.ar(In.ar(a, 10) * SinOsc.ar((3..12) * 100, 0, 0.05)) }.play\n);\n\n\n// send envelopes to buses\n\n(\nz = {\n DXEnvFanOut.ar(\n Dseq((0..5) + a.index, inf) + Diwhite(1, 4),\n \n // with newer SC versions you can also write:\n // Dseq((0..5), inf) + Diwhite(1, 4) + a.index,\n \n fadeTime: 0.05,\n width: 1,\n initOutOffset: -0.5\n )\n}.play\n);\n\nx.release;\n\n// cleanup\n\n(\nz.free;\na.free;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// allocate buffer\nb = Buffer.alloc(s, 44100, 1);\n\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nBufDelayN.ar(b.bufnum, z, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\nb.free;\n\n\n// multichannel\n\n// two channels, two buffers\nb = Buffer.allocConsecutive(2, s, 32768, 1);\n\na = { |bufs = #[0, 1]|\n var sig = SinOsc.ar([440, 880\n// …\n```"}, {"role": "assistant", "content": "Dust randomly triggers Decay to create an exponential decay envelope for the WhiteNoise input source (BufDelayN: Buffer based simple delay line with no interpolation.)"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Another fibonaccy melody."}, {"role": "assistant", "content": "```supercollider\n(\nc=13;a=Array.fib(64,0,1);b=Array.fill(size:c,function:{arg i;a[i]%12});\np=1/(21-c);Pdef(\\x,Pbind(\\dur,p,\\degree,Pseq(b,1,0)));\nr=Array.fill(c,{arg i;Pbindf(Pdef(\\x),\\mtranspose,1-b[i]);});\nPseq(r,(1/p)).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Restricting fm to harmonic sidebands after[Chowning, 1973]?"}, {"role": "assistant", "content": "```supercollider\n(\n// restricting fm to harmonic sidebands after\n// [Chowning, 1973] Chowning, J. (1973). The synthesis of complex spectra by means of frequency modulation. Journal of the Audio Engineering Society, 21(7):526–534.\n// restriction actually happens because of the specs, not server-side.\n\nSpec.add(\\index, [0, 40]);\nSpec.add(\\harm1, [0, 20, \\lin, 1]);\nSpec.add(\\harm2, [0, 20, \\lin, 1]);\nSpec.add(\\fundFreq, \\freq);\n\nNdef(\\fmk, {\n \n PMOsc.ar(\n \\carFreq.kr(100, 0.1), \n (\\harm1.kr(1, 1)/(\\harm2.kr(1, 1)) * LFNoise1.ar(50).range(0.995, 1.001))*\\carFreq.kr(100), \n \\index.kr(1, 0.1) * SinOsc.ar(2.5).range(0.995, 1.005)\n ) \n})\n);\nNdef(\\fmk).gui\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// Compare with Ex. 2 from DXFan help.\n// As DXFanOut, other than DXFan, doesn't return an array, a mix is not necessary, \n// by internal use of Out ugens the signal is mixed to the referred buses anyway.\n\n// For the same reason a normal release doesn't work, to get this option we can add an EnvGate.\n\n(\nx = {\n var lfo = { LFDNoise3.kr(0.2) };\n DXFanOut.ar(\n [Dseq([0, 1], inf), Dseq([1, 0], inf)],\n [\n LFTri.ar(150 * lfo.().range(1, 2), 0, 0.05),\n BPF.ar(PinkNoise.ar(), lfo.().range(1000, 3000),\n// …\n```"}, {"role": "assistant", "content": "Compare with Ex. 2 from DXFan help. As DXFanOut, other than DXFan, doesn't return an array, a mix is not necessary, (DXFanOut: crossfades signals between out buses according to demand-rate control)"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for LFDNoise Modular version?"}, {"role": "assistant", "content": "```supercollider\n(\n~lfd={\n var signal, myFrequency, frequencyMin=0.1, frequencyMax=30, myAmplitude, amplitudeMin=0.01, amplitudeMax=0.6, myPhase, phaseMin=0, phaseMax=1.5;\n myFrequency = Array.fill(2, {[rrand(frequencyMin, frequencyMax)]});\n myAmplitude = Array.fill(2, {[rrand(amplitudeMin, amplitudeMax)]});\n myPhase = Array.fill(2, {[rrand(phaseMin, phaseMax)]});\n signal = LeakDC.ar([LFDNoise1, LFDNoise0, LFDNoise3, LFDClipNoise].choose.ar(myFrequency, myPhase, myAmplitude));\n Out.ar(0, signal);\n};\n);\n\n~lfd.scope\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LFDNoise3`."}, {"role": "assistant", "content": "```supercollider\n// try wiggling mouse quickly:\n// LFNoise2 overshoots when going from high to low freqs, LFDNoise changes smoothly.\n\n{ SinOsc.ar(LFNoise2.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n{ SinOsc.ar(LFDNoise3.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFNoise2.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n\n{ LFDNoise3.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n\n// use as frequency control\n(\n{\n SinOsc.ar(\n LFDNoise3.ar(4, 400, 450),\n 0, 0.2\n )\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\nNdef(\\a).play; // play to hardware output.\nNdef(\\a).fadeTime = 2; // fadeTime specifies crossfade\n// set the source\nNdef(\\a, { SinOsc.ar([350, 351.3], 0, 0.2) });\nNdef(\\a, { Pulse.ar([350, 351.3] / 4, 0.4, 0.2) });\nNdef(\\a, Pbind(\\dur, 0.03, \\freq, Pbrown(0, 1, 0.1, inf).linexp(0, 1, 200, 350)));\n\nNdef(\\a, { Ringz.ar(Ndef.ar(\\b), [350, 351.3] * 2, 0.4) });\nNdef(\\b, { Impulse.ar([5, 7]\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\nNdef(\\a).play; // play to hardware output.\nNdef(\\a).fadeTime = 2; // fadeTime specifies crossfade\n// set the source\nNdef(\\a, { SinOsc.ar([350, 351.3], 0, 0.2) });\nNdef(\\a, { Pulse.ar([350, 351.3] / 4, 0.4, 0.2) });\nNdef(\\a, Pbind(\\dur, 0.03, \\freq, Pbrown(0, 1, 0.1, inf).linexp(0, 1, 200, 350)));\n\nNdef(\\a, { Ringz.ar(Ndef.ar(\\b), [350, 351.3] * 2, 0.4) });\nNdef(\\b, { Impulse.ar([5, 7]/2, [0, 0.5], 0.15) });\n\nNdef.clear(3); // clear all after 3 seconds\n```"}]} -{"conversations": [{"role": "user", "content": "What is `FoaThetaPhiA` in SuperCollider?"}, {"role": "assistant", "content": "FoaThetaPhiA — First Order Ambisonic (FOA) Azimuth & Elevation of Soundfield Active Intensity Vector Return the Azimuth & Elevation of Active Intensity Vector of a first order ambisonic (B-format) signal. Category: Libraries > Ambisonic Toolkit > UGens > FOA > Analyzer, UGens > Multichannel > Ambisonics, UGens > Analysis > Ambisonics."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// for Nil: return the argument unmodified (an event).\nnil.transformEvent((x: 8));\n// for Dictionary (and thus for Event): add to the argument.\n(y: 100, z: 1).transformEvent((x: 8));\n// for Association: add the association to the event\n(\\a -> \\x).transformEvent((x: 8));\n// for Function: use the function receive the event as argument.\n{ |event| event.use { ~x = ~x + 1 }; event }.transformEvent((x: 8));\n```"}, {"role": "assistant", "content": "for Nil: return the argument unmodified (an event). for Dictionary (and thus for Event): add to the argument. (Nil: Represents uninitialized data)"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n~specPairs = [\\seq, [36, 60, \\lin, 1, 36] ! 5, \n \\seqAdd, [0, 12, \\lin, 1, 0],\n \\amp, [0, 0.3, \\lin, 0.01, 0.1],\n \\preAmp, [5, 50, \\lin, 0.01, 20]];\n\nv = VarGui(~specPairs, stream: p).gui;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n~specPairs = [\\seq, [36, 60, \\lin, 1, 36] ! 5, \n \\seqAdd, [0, 12, \\lin, 1, 0],\n \\amp, [0, 0.3, \\lin, 0.01, 0.1],\n \\preAmp, [5, 50, \\lin, 0.01, 20]];\n\nv = VarGui(~specPairs, stream: p).gui;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is the difference between a Synth and a SynthDef?"}, {"role": "assistant", "content": "A SynthDef is a definition: a compiled UGen graph with named controls, registered on the server once. A Synth is one running instance of that definition. You create the definition with `SynthDef(\\bell, { |freq = 440| ... }).add` and then instances with `Synth(\\bell, [\\freq, 660])`. Defining the same SynthDef twice replaces it for future instances; already running Synths keep the old graph until they are freed."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ne = LazyEnvir.new;\ne.use { ~x = ~y + ~z };\ne.at(\\x);\ne.at(\\x).source; // the source is a binary operation (addition on the placeholders)\ne.use { ~y = 5; ~z = 7 };\ne.at(\\x.value; // the value is 12\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ne = LazyEnvir.new;\ne.use { ~x = ~y + ~z };\ne.at(\\x);\ne.at(\\x).source; // the source is a binary operation (addition on the placeholders)\ne.use { ~y = 5; ~z = 7 };\ne.at(\\x).value; // the value is 12\n```"}]} -{"conversations": [{"role": "user", "content": "Why LeakDC and not a standard HPF for DC removal?"}, {"role": "assistant", "content": "SuperCollider forum — Why LeakDC and not a standard HPF for DC removal?\n\nHello everyone,\n\nI’m a bit sceptical of the DC removal implementation in LeakDC. As I understand it, DC removal is nothing but a HPF, preferably placed below the audible range. For this purpose, LeakDC seems to be reaching far too high, attenuating the audible low frequencies. You can run the following code and look at the server meter to see the difference in level between the two audio channels (note: there is of course no DC offset in this example that would need fixing):\n\n```supercollider\n( play { [\n SinOsc.ar(50),\n LeakDC.ar(SinOsc.ar(50))\n] * 0.2 } )\n```\n\nAlso, LeakDC’s behaviour is not consistent between sample rates (as is mentioned in the help file).\n\nI ran the it through Plugin Doctor to back up my suspicions and got these results:\n\nstandard coefficient of 0.995:\n\nSR 48 kHz: Filter starts rolling off at 200 Hz, -2dB at 50 Hz.\n\nSR 96 kHz: Filter starts rolling off at 500 hz! It reaches already -2dB at 100 Hz, -5 dB at 50 Hz.\n\ncoefficient of 0.999:\n\nSR 48 kHz: Filter starts rolling off at 50 Hz, -2 dB at 10 Hz.\n\nSR 96 kHz: Filter starts rolling off at 100 Hz, -2 dB at 20 Hz.\n\nI wonder why one wouldn’t just use a standard HPF at 10 Hz (or so) instead? It is consistent between sample rates, it only starts to roll of below 30 Hz and it reaches only -0.5 dB at 20 Hz. So this actually looks much better in the server meter:\n\n```supercollider\n( play { [\n SinOsc.ar(50),\n HPF.ar(SinOsc.ar(50), 10)\n] * 0.2 } )\n```\n\nSo my question is: Is there any reason why the LeakDC implementation would be peferable to such a standard butterworth HPF?\n\nOne difference I can see is that the HPF still has an initial offset spike before settling around zero phase, LeakDC does not show that behaviour:\n\n```supercollider\n{ LeakDC.ar(DC.ar(0.5)) }.plot(0.5);\n{ HPF.ar(DC.ar(0.5), 10) }.plot(0.5);\n\n{ LeakDC.ar(SinOsc.ar + DC.ar(0.5)) }.plot(0.02);\n{ HPF.ar(SinOsc.ar + DC.ar(0.5), 10) }.plot(0.02);\n```\n\nSo this could be a reason – I don’t know enough about filters to understand why this happens though. Any enlightenment would be appreciated."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Migration from the old SourceForge wiki."}, {"role": "assistant", "content": "```supercollider\n// Sing whatever pitch you like into the microphone, but have the output conform to the key you press on your connected MIDI keyboard, like a very low-rent Autotune.\n// by nonprivate April 2009\n// best used with headphones\n// execute one by one...\n\ns = Server.local.boot;\nb = 200; // no. of control bus to use for pitch control\n(\n SynthDef(\"straightenUp\",\n { |baseFreq = 100|\n \n var in, freq, hasFreq, out;\n in = Mix.new(SoundIn.ar([0,1]));\n # freq, hasFreq = Pitch.kr(in, ampThreshold: 0.02, median: 7);\n out = PitchShift.ar(in, 0.08, (baseFreq / freq), 0.0, 0.0);\n Out.ar(0,[out, out])\n }\n ).send(s);\n);\n\ns.sendMsg(\"/s_new\", \"straightenUp\", n = s.nextNodeID, 1, 0);\n\ns.sendMsg(\"/n_map\", n, \"baseFreq\", b);\n\n(\n c = NoteOnResponder(\n { |src,chan,note,vel|\n \n s.sendMsg(\"/c_set\", b, note.midicps);\n \n },\n nil, // any source\n nil, // any channel\n nil, // any note\n nil // any vel\n );\n \n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `IBVAfile.generateHeaderString` do? What arguments does it take?"}, {"role": "assistant", "content": "return a string with a Arguments: ibva — an instance of IBVA."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nPbind([\\note, \\amp], Pseq([[0, 0.05], [4, 0.5], [7, 0.1]]), dur: 0.2.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nPbind([\\note, \\amp], Pseq([[0, 0.05], [4, 0.5], [7, 0.1]]), dur: 0.2).play\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n(\nvar a, b, c;\na = Pfuncn({ exprand(0.1, 2.0) + #[1, 2, 3, 6].choose }, 2);\nb = Pfuncn({ #[-2, -3].choose }, 7);\nc = Pseq([a, b], inf).asStream;\n{\n c.do { |val|\n Synth(\\help_sinegrain\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n(\nvar a, b, c;\na = Pfuncn({ exprand(0.1, 2.0) + #[1, 2, 3, 6].choose }, 2);\nb = Pfuncn({ #[-2, -3].choose }, 7);\nc = Pseq([a, b], inf).asStream;\n{\n c.do { |val|\n Synth(\\help_sinegrain, [\\freq, val * 100 + 300]);\n 0.02.wait;\n }\n}.fork;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nPbind(\\degree, Pseq([0, 2, 4, 7], inf), \\dur, 0.25).play;\n```"}, {"role": "assistant", "content": "It plays a four-note major arpeggio in a loop, one note every 250 ms.\n\n`Pbind` builds an event stream: each event is the current value of every key. `Pseq([0, 2, 4, 7], inf)`\ncycles the degrees forever, and `\\dur, 0.25` sets the time between events in beats on the default\nTempoClock. With no `\\instrument`, the `\\default` SynthDef is used, which converts `\\degree` to a\nfrequency through the current scale (major, rooted at C by default). `.play` schedules it on the clock\nand returns an EventStreamPlayer."}]} -{"conversations": [{"role": "user", "content": "What does `Pdef.set` do?"}, {"role": "assistant", "content": "Set arguments in the default event. If there is none, it is created and the pattern is"}]} -{"conversations": [{"role": "user", "content": "Explain `Nil` in SuperCollider briefly."}, {"role": "assistant", "content": "Nil — Represents uninitialized data Nil has a single instance named `nil` and is used to represent uninitialized data, bad values, or terminal values such as end-of-stream. Internally, `nil` also serves as a sentinel value, used to mark empty or unoccupied slots in hash-based data structures such as `Set`, and its subclasses. Because of this internal role, `nil` —despite being a valid object— cannot be stored as an element in `Set` Category: Core."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes nothing much )."}, {"role": "assistant", "content": "```supercollider\n(\n{|atk=0.05,dur=10,freq=50,amp=0.8|\n PMOsc.ar(\n Line.kr(1,2,dur,freq),\n LFNoise2.kr([1,2]).range(1,2)*freq,\n LFNoise2.kr([2,1]).range(0.1,3.5),\n 0,\n Decay2.ar(\n Impulse.ar(XLine.kr(1, 25, dur)) * SinOsc.ar(4/dur,[0,pi/2],0.05,1),\n 0.023, XLine.ar(1,35,dur).reciprocal,\n Line.ar(1,0.8,dur) * LFNoise2.kr(4/dur,0.05,1).dup\n ) * EnvGen.ar(Env([0,1,1,0],[atk,dur-atk,0.3]),1,amp, doneAction:2)\n )\n // * LFPulse.ar(XLine.kr(5,20,dur,freq * LFNoise2.kr([1,2]).range(0.95,1.05)))\n}.play(args:[\n freq:50.rrand(350).debug('freq'),\n dur:10.rrand(20).debug('dur')\n])\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `LID.openDevices` do?"}, {"role": "assistant", "content": "A dictionary of the opened Returns: an IdentityDictionary"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pause`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\nSynthDef(\\a, { Out.ar(0, SinOsc.ar(800, 0, 0.2)) }).add;\n\nSynthDef(\\b, { |gate = 1| Out.ar(1, PinkNoise.ar(0.3)); Pause.kr(gate, 1001) }).add;\n\ns.sendMsg(\\s_new, \\a, 1001, 0, 0);\n\ns.sendMsg(\\s_new, \\b, 1002, 0, 0);\n\ns.sendMsg(\\n_set, 1002, \\gate, 0);\n\ns.sendMsg(\\n_set, 1002, \\gate, 1);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `EventShortcuts.copyAllDicts` do?"}, {"role": "assistant", "content": "Returns an IdentityDictionary of copies of all stored shortcut"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nx = List[1, 2, 3] //-> [1, 2, 3]\n\n// Retrieve the value at index 1:\nx.at(1) //-> 2\n// Equivalent shorthand syntax:\nx[1] //-> 2\n\n// An index can also be retrieved from an array (returns not a list, but an array):\ny = [0, 0, 2, 2, 1] //-> [0, 0, 2, 2, 1]\nx[y]; //-> [1, 1, 3, 3, 2]\n\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n pitches.size.do{ |i|\n {\n var freq = pitches[i].midicps;\n var env = Env.perc\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nx = List[1, 2, 3] //-> [1, 2, 3]\n\n// Retrieve the value at index 1:\nx.at(1) //-> 2\n// Equivalent shorthand syntax:\nx[1] //-> 2\n\n// An index can also be retrieved from an array (returns not a list, but an array):\ny = [0, 0, 2, 2, 1] //-> [0, 0, 2, 2, 1]\nx[y]; //-> [1, 1, 3, 3, 2]\n\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n pitches.size.do{ |i|\n {\n var freq = pitches[i].midicps;\n var env = Env.perc.ar(Done.freeSelf);\n SinOsc.ar(freq) * 0.1 * env\n }.play;\n 0.2.wait\n }\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SequenceableCollection.blendAt` do?"}, {"role": "assistant", "content": "Returns a linearly interpolated value between the two closest indices. Inverse operation is #-indexInBetween. `x = [2, 5,"}]} +{"conversations": [{"role": "user", "content": "Explain `StaticText` in SuperCollider briefly."}, {"role": "assistant", "content": "StaticText — A view displaying non-editable text Category: GUI > Views."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `BufCombN` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// These examples compare the variants, so that you can hear the difference in interpolation\n\n// allocate buffer\nb = Buffer.alloc(s, 44100, 1);\n\n// Comb used as a resonator. The resonant fundamental is equal to\n// reciprocal of the delay time.\n{ BufCombN.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ BufCombL.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ BufCombC.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// with negative feedback:\n{ BufCombN.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ BufCombL.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ BufCombC.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n// used as an echo.\n{ BufCombL.ar(b.bufnum, Decay.ar(Dust.ar(1, 0.5), 0.2, WhiteNoise.ar), 0.2, 3) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `EventStreamSpec` in SuperCollider?"}, {"role": "assistant", "content": "EventStreamSpec — datatype specifying a Pbind-like object that produces a playable stream of Events Streams/Patterns are commonly of two primary types: those that return numerical streams and those that return streams of Events which will spawn Synths. Category: Spec, Libraries > crucial > Spec, Streams-Patterns-Events > Patterns > Spec."}]} +{"conversations": [{"role": "user", "content": "Explain `POneZero` in SuperCollider briefly."}, {"role": "assistant", "content": "POneZero — UGenPatterns quark library Based on OneZero Category: Streams-Patterns-Events > UGenPatterns > Modifiers."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BRF`."}, {"role": "assistant", "content": "```supercollider\n{ BRF.ar(Saw.ar(200, 0.1), FSinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3800, 4000), 0.3) }.play;\n\n{ BRF.ar(Saw.ar(200, 0.5), MouseX.kr(100, 10000, 1), 0.3) }.play;\n\n\n // BRF on control signals:\n(\n{ var vib = BRF.kr(SinOsc.kr([1, 3, 10], 0, [1, 0.5, 0.25]).sum, MouseX.kr(1, 10, 1), 0.3);\n SinOsc.ar(vib * 200 + 600) * 0.2 }.play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LinLin`."}, {"role": "assistant", "content": "```supercollider\n// linlin\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(mod.linlin(-1, 1, MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1))) * 0.1\n}.play;\n);\n\n// range\n(\n{\n var mod = LFNoise2.ar(80).range(MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1));\n SinOsc.ar(mod) * 0.1\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Splay - not getting spread, wrong use?"}, {"role": "assistant", "content": "SuperCollider forum — Splay - not getting spread, wrong use?\n\nYou need to undestand that if you have two identical signal coming from left and right it will always be mono. No stereo spread possible. So you need to introduce (at least) two different signals - and just different amplification will not really work.\n\nTo expand your first example, we can introduce an array of values for paramtere pos:\n\n```supercollider\n(\nx = { arg spread=1, level=0.2, center=0.0;\n Splay.ar(\n GrainBuf.ar(numChannels: 1,\n trigger: Impulse.kr(1.2875),\n dur: Impulse.kr(1.2875),\n sndbuf: b,\n pos:[0,0.5],\n interp: 1\n ),\n spread,\n level,\n center\n );\n}.play;\n);\n\nx.set(\\spread, 1, \\center, 0); // full stereo\nx.set(\\spread, 0, \\center, 0); // mono center\n```\n\nBy way of Multichannel Expansion this creates two different signals (channels, an array of 2 UGen graphs) that you can hear as different and therefore observe the stereo spread.\n\nAnd similarly, to use your other example with In.ar where I have added in=2, so that it takes my mic in (but you can specify another bus) and wrapped it into a feedback delay with an array of two values for delayTime. Multichannel expansion thus creates two channels that are different because they have different delaytimes but the rest of UGen graph is the same (a copy). Changing spread now works:\n\n```supercollider\n(\nSynthDef(\\stereo,{|out=0, in=2, spread=1, level=1, center=0.0|\n Out.ar(out,\n Splay.ar(\n CombN.ar(\n In.ar(in, 1), 1, [0.3,0.4], 2)\n ,spread,level,center));\n}).play;\n)\n```\n\nI hope that clarifies the issue better."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Bell example using Ndef?"}, {"role": "assistant", "content": "```supercollider\n(\nvar fundamental = 131;\nvar dur = 10;\nvar partials =\n[\n [1, 0.5, dur * 1],\n [1.02, 0.3, dur * 1],\n [1.01, 0.14, dur * 0.5],\n [2.44, 0.17, dur * 0.8],\n [3.31, 0.9, dur * 0.5],\n [5.1, 0.1, dur * 0.56],\n [5.9, 0.1, dur * 0.9],\n [11.01, 0.09, dur * 1],\n [13, 0.01, dur * 0.5],\n [15, 0.01, dur * 0.2],\n [16, 0.05, dur * 0.02],\n [19, 0.10, dur * 0.01],\n [20, 0.01, dur * 0.2],\n [24, 0.01, dur * 0.2],\n [4, 3, dur * 0.002] // attack\n];\n\nNdef(\\quickBell).fadeTime = 0;\nNdef(\\quickBell, {\n var snd, env;\n env = Env.perc(\n attackTime: 0.001,\n releaseTime: partials.flop.at(2),\n level: partials.flop.at(1)\n ).kr;\n // fundamental + inharmonics\n snd = SinOsc.ar(\n freq: fundamental * partials.flop.at(0);\n );\n snd = snd * env;\n snd = Splay.ar(snd);\n snd = Limiter.ar(snd);\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `ControlName.rate` do?"}, {"role": "assistant", "content": "The rate of the Returns: a Symbol like `'audio'` or `'control'`"}]} -{"conversations": [{"role": "user", "content": "Explain `EaseOutInQuad` in SuperCollider briefly."}, {"role": "assistant", "content": "EaseOutInQuad — Quadratic ease-out/in Easing equation for a quadratic (t^2) ease-out/in, decelerating until halfway, then accelerating. Category: Ease."}]} -{"conversations": [{"role": "user", "content": "What is `VOsc` in SuperCollider?"}, {"role": "assistant", "content": "VOsc — Variable wavetable oscillator. A wavetable lookup oscillator which can be swept smoothly across wavetables. Fractional values of table will interpolate between two adjacent tables. Category: UGens > Generators > Deterministic."}]} -{"conversations": [{"role": "user", "content": "Explain `Psync` in SuperCollider briefly."}, {"role": "assistant", "content": "Psync — synchronise and limit pattern duration Psync behaves somewhat like Pfindur — it has a `maxdur` argument that limits the total duration of the event stream. Category: Streams-Patterns-Events > Patterns > Repetition."}]} -{"conversations": [{"role": "user", "content": "What does `FoaXformerMatrix.newPressX` do? What arguments does it take?"}, {"role": "assistant", "content": "Apply press along the Arguments: angle — The distortion angle, in radians. -pi/2 to pi/2."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for distobass (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\\bass, { arg out=0, amp=0.1, gate=1, pan=0, spread=0.8, freq=200, doneAction=2;\n var sig, sig1, sig2, sig3;\n freq = SinOsc.ar(freq*\\fmfreq.kr(1).lag(0.3)) * \\fmrange.kr(0.5).lag(0.3) * LFNoise1.kr(1/7).range(0.9,1.1) + 1 * freq;\n sig = SinOsc.ar(freq.lag(0.1) * [1,8,2,4,1.002]);\n sig1 = LFPulse.ar(freq * [1,4,1.001,2 * LFNoise1.kr(1/10).range(0.999,1.001),1/2], mul:1.00);\n sig = sig + sig1;\n sig = sig.fold2(SinOsc.kr(1/13).range(0.9,1));\n sig = sig.wrap2(SinOsc.kr(1/14).range(0.9,1));\n sig = RLPF.ar(sig, \\lpf.kr(500).lag(0.4) * LFNoise1.kr(1/9).range(0.9,1.1), \\rq.kr(0.5));\n sig = HPF.ar(sig, \\hpf.kr(40));\n sig = sig * EnvGen.ar(\\iadsr.kr(Env.adsr(0.01,0.1,0.8,0.1)),\\igate.kr(1),doneAction:0);\n sig = sig * EnvGen.ar(\\adsr.kr(Env.adsr(0.01,0.1,0.8,0.1)),gate,doneAction:doneAction);\n sig = Splay.ar(sig, spread, amp, pan);\n Out.ar(out, sig);\n}).add;\n\n(\nPdef(\\bass, Pmono(\\bass,\n \\freq, 70 * Pseq([0,1].midiratio,inf).stutter(16) * Pseq([1,2],inf).stutter(64),\n \\fmrange, Pseq([0.5,1,1.5],inf),\n \\fmfreq, Pseq([0.5,1,2,4],inf),\n \\dur, 1/4,\n \\igate, Pseq([\n 1,0,0,0,\n 0,0,0,0,\n ],inf),\n \\iadsr, Pseq([\n [ Env.adsr(0.1,0.1,0.8,4.1) ],\n ],inf),\n \\lpf, Pkey(\\freq) * Pseq([\n 2,1,4,8,\n 2,1,4,8,\n 2,1,4,8,\n 4,2,2,4,\n ],inf).stutter(8),\n \\hpf, Pkey(\\freq) / 2,\n\n \\amp, Pkey(\\amp) * 2,\n \\isRest, false,\n));\nPdef(\\bass).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes old school noise from needle on vinyl."}, {"role": "assistant", "content": "```supercollider\n{\n var sig, sig1, sig2, lpf, popHz, lagtime, noise, popHzMul,\n pan1, pan2, panmod1, panmod2;\n popHzMul = Decay.kr(Dust.kr(0.15), 3, 10, 0.8);\n popHz = LFNoise1.kr(20).exprange(0.1,10) * popHzMul;\n sig = Dust2.ar(popHz);\n lpf = LFNoise1.kr(10).exprange(1000,20000);\n lagtime = LFNoise1.kr(20).range(0.008,0.0001);\n sig = LPF.ar(sig, lpf);\n sig = Lag.ar(sig, lagtime);\n sig = sig + FreeVerb.ar(sig, 0.8, 1, mul:0.11);\n panmod1 = LFNoise1.kr(5).range(0.2,0.7);\n panmod2 = LFNoise1.kr(5).range(0.2,0.7);\n pan1 = SinOsc.kr(panmod1).range(-0.2,0.2);\n pan2 = SinOsc.kr(panmod2).range(-0.2,0.2);\n sig1 = Pan2.ar(sig, pan1, 0.5);\n sig2 = Pan2.ar(sig, pan2, 0.5);\n sig = sig1 + sig2;\n sig = sig + BPF.ar(BrownNoise.ar([0.0025,0.0025]), 7200, 0.4);\n sig = sig + HPF.ar(Crackle.ar([1.999,1.999], 0.0025),2000);\n Out.ar(0, sig*6);\n}.play\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n var saw, bpf;\n saw = Saw.ar(\n freq: [1700,2000],\n mul: LFPulse.kr(\n freq: [2,7],\n width: 0.115));\n bpf = LPF.ar(in: saw, freq: SinOsc.kr(1/3).range(250, 4000)); \n}.play;\n)\n```"}, {"role": "assistant", "content": "Quiz 4a for MUSC 115, pp. 62-84 from Gentle Intro to SuperCollider."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n{\n\nvar in, fft, entropy;\n\n//in = SinOsc.ar(MouseX.kr(100,1000),0,0.1);\n//in = Mix(SinOsc.ar([440,MouseX.kr(440,880)],0,0.1)); \nin= SoundIn.ar; \n\nfft = FFT(LocalBuf(2048), in);\n\nentropy=SpectralEntropy.kr(fft,2048,1); //one output band (so full spectrum's entropy)\n\nentropy.poll; \n\nOut.ar(0,Pan2.ar(0.1*Blip.ar(100,10*(entropy.sqrt)))); \n}.play\n);\n\n\n\n\n(\n{\n\nvar in, fft, entropy;\nvar amplit\n// …\n```"}, {"role": "assistant", "content": "in = SinOsc.ar(MouseX.kr(100,1000),0,0.1); in = Mix(SinOsc.ar([440,MouseX.kr(440,880)],0,0.1)); (SpectralEntropy: Spectral feature extraction)"}]} -{"conversations": [{"role": "user", "content": "What does `FoaXform.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "First Order Ambisonic (FOA) matrix transformer Arguments: in — The B-format signal, an array: [w, x, y, z]; xformer; mul — Output will be multiplied by this value.; add — This value will be added to the output.. Returns: An array of channels, the transformed B-format signal."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// vary frequency\n{ CuspL.ar(MouseX.kr(20, SampleRate.ir), 1.0, 1.99) * 0.3 }.play(s);\n\n// mouse-controlled params\n{ CuspL.ar(SampleRate.ir/4, MouseX.kr(0.9, 1.1, 1), MouseY.kr(1.8, 2, 1)) * 0.3 }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(CuspL.ar(40, MouseX.kr(0.9, 1.1, 1), MouseY.kr(1.8, 2, 1))*800+900)*0.4 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// vary frequency\n{ CuspL.ar(MouseX.kr(20, SampleRate.ir), 1.0, 1.99) * 0.3 }.play(s);\n\n// mouse-controlled params\n{ CuspL.ar(SampleRate.ir/4, MouseX.kr(0.9, 1.1, 1), MouseY.kr(1.8, 2, 1)) * 0.3 }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(CuspL.ar(40, MouseX.kr(0.9, 1.1, 1), MouseY.kr(1.8, 2, 1))*800+900)*0.4 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `StandardL`."}, {"role": "assistant", "content": "```supercollider\n// mouse-controlled param\n{ StandardL.ar(SampleRate.ir/2, MouseX.kr(0.9, 4)) * 0.3 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// synthdef\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n}).add;\n);\n\n// pattern with different start times\n(\nx = Pbind(\n \\instrument, \\help_sinegrain,\n \\degree, Pseq(#[0, 5, 4, 2, 1, 1, 3], inf),\n \\dur, Pseq(#[0.25, 0.5, 1.0], inf),\n \\scale, #[0, 3, 5, 9, 10]\n);\na = Pbus(Pgt\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// synthdef\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n}).add;\n);\n\n// pattern with different start times\n(\nx = Pbind(\n \\instrument, \\help_sinegrain,\n \\degree, Pseq(#[0, 5, 4, 2, 1, 1, 3], inf),\n \\dur, Pseq(#[0.25, 0.5, 1.0], inf),\n \\scale, #[0, 3, 5, 9, 10]\n);\na = Pbus(Pgtpar([0.0, x, 1.5, x, 2.25, x])).play;\n);\ns.plotTree;\na.stop;\n```"}]} +{"conversations": [{"role": "user", "content": "What does Lag do?"}, {"role": "assistant", "content": "`Lag.ar(in, lagTime)` and `Lag.kr(in, lagTime)` smooth a signal with an exponential lag towards its target, which removes the clicks and zipper noise a stepped control would produce. Lag.kr on a mouse or MIDI input is the standard way to make a parameter feel analogue: `Lag.kr(MouseX.kr(200, 4000), 0.2)`. Lag2 and Lag3 are the second- and third-order versions, smoother and slower."}]} +{"conversations": [{"role": "user", "content": "What does `Tempo.tempo` do? What arguments does it take?"}, {"role": "assistant", "content": "for control of tempo and for use in tempo based calculations Arguments: t."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n{ BufRd.ar(1, b, Sweep.ar(Impulse.ar(BufDur.kr(b).reciprocal), BufSampleRate.kr(b)) }.play;\n\nb.free\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n{ BufRd.ar(1, b, Sweep.ar(Impulse.ar(BufDur.kr(b).reciprocal), BufSampleRate.kr(b))) }.play;\n\nb.free\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Buffer.write` do? What arguments does it take?"}, {"role": "assistant", "content": "Write the contents of the buffer to a file. See SoundFile for information on valid values for headerFormat and Arguments: path — A String representing the path of the soundfile to be written. If no path is given, Buffer writes into the default recording directory with a generic name.; headerFormat — A String.; sampleFormat — A String.; numFrames — The number of frames to write. The default is -1, which will write the whole buffer. (A floating-point value is truncated to integer.); startFrame — The index of the frame in the buffer from which to start writing. The default is 0, which is the beginning of the buffer. (A floating-point value is truncated to integer.); leaveOpen — A boolean indicating whether or not the Buffer should be left 'open'. For use with DiskOut you will want this to be true. The default is false which is the correct value for all other cases.; completionMessage — A valid OSC message or a Function which will return one. A Function will be passed this Buffer as an argument when evaluated.."}]} +{"conversations": [{"role": "user", "content": "What does Lag do?"}, {"role": "assistant", "content": "`Lag.ar(in, lagTime)` and `Lag.kr(in, lagTime)` smooth a signal with an exponential lag towards its target, which removes the clicks and zipper noise a stepped control would produce. Lag.kr on a mouse or MIDI input is the standard way to make a parameter feel analogue: `Lag.kr(MouseX.kr(200, 4000), 0.2)`. Lag2 and Lag3 are the second- and third-order versions, smoother and slower."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n// Play it with the mouse...\nx = { MoogFF.ar(WhiteNoise.ar(01.1), MouseY.kr(100, 10000, 1), MouseX.kr(0, 4)) }.play(s);\nx.free;\n\n// Mmmm, throbby\n(\nx = {\n MoogFF.ar(\n Pulse.ar([40, 121], [0.3, 0.7]),\n SinOsc.kr(LFNoise0.kr(0.42).range(0.001, 2.2)).range(30, 4200),\n 0.83 * 4) }.play(s);\n;\nx.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n// Play it with the mouse...\nx = { MoogFF.ar(WhiteNoise.ar(01.1), MouseY.kr(100, 10000, 1), MouseX.kr(0, 4)) }.play(s);\nx.free;\n\n// Mmmm, throbby\n(\nx = {\n MoogFF.ar(\n Pulse.ar([40, 121], [0.3, 0.7]),\n SinOsc.kr(LFNoise0.kr(0.42).range(0.001, 2.2)).range(30, 4200),\n 0.83 * 4) }.play(s);\n);\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Standard2DL.ar(220, 11025, mul:0.3) }.play(s);\n\n// mouse-controlled param\n{ Standard2DL.ar(11025, 44100, MouseX.kr(0.9,4), mul:0.3) }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(Standard2DL.ar(10, 20, MouseX.kr(0.9,4))*800+900)*0.4 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Standard2DL.ar(220, 11025, mul:0.3) }.play(s);\n\n// mouse-controlled param\n{ Standard2DL.ar(11025, 44100, MouseX.kr(0.9,4), mul:0.3) }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(Standard2DL.ar(10, 20, MouseX.kr(0.9,4))*800+900)*0.4 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// These examples compare the variants, so that you can hear the difference in interpolation\n\n// Comb used as a resonator. The resonant fundamental is equal to\n// reciprocal of the delay time.\n{ CombN.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ CombL.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ CombC.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// with negative feedback:\n{ CombN.ar(WhiteNoise.ar(0.01), 0\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// These examples compare the variants, so that you can hear the difference in interpolation\n\n// Comb used as a resonator. The resonant fundamental is equal to\n// reciprocal of the delay time.\n{ CombN.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ CombL.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ CombC.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// with negative feedback:\n{ CombN.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ CombL.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ CombC.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n// used as an echo.\n{ CombL.ar(Decay.ar(Dust.ar(1, 0.5), 0.2, WhiteNoise.ar), 0.2, 0.2, 3) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n// compares a 1102.5 Hz sine tone (11025 * 0.1, left) with a 1100 Hz tone (right)\n// the apollo sample has a sample rate of 11.025 kHz\n(\n{\n var freq;\n freq = [BufSampleRate.kr(b) * 0.1, 1100];\n SinOsc.ar(freq, 0, 0.1)\n}.play;\n;\n\nb.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n// compares a 1102.5 Hz sine tone (11025 * 0.1, left) with a 1100 Hz tone (right)\n// the apollo sample has a sample rate of 11.025 kHz\n(\n{\n var freq;\n freq = [BufSampleRate.kr(b) * 0.1, 1100];\n SinOsc.ar(freq, 0, 0.1)\n}.play;\n);\n\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Synth.addReplaceMsg` do?"}, {"role": "assistant", "content": "See *new above for details on Returns: a message of the type s_new which can be bundled. When sent to the server this message will instantiate this synth, replacing nodeToReplace in the server's node order."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// ============================\n// extra demos for \\waveguideFlute\n// ============================\n\n\n(\n// Made by Meha Gupta\n// Inspired by The Village by Wrabel\nPbindef(\\dmwaveguideFlute,\n \\instrument, \"waveguideFlute\",\n \\midinote, Pseq([57, 60,\n [46, 62], [53, 62], [58, 62], [58, 64], [58, 62], [58, 60],\n [50, 57], [50, 57], [50, 57], [50, 60], [50, 57], [50, 53],\n [53, 55], [53, 55], [53, 55], [53, 57], [53, 55], [41, 53], 52]),\n \\amp, 0.3,\n \\dur, Pseq([0.25, 0.25, 0.5, 0.5, 0.25, 0.25, 0.25, 0.25,\n 0.5, 0.5, 0.25, 0.25, 0.25, 0.25,\n 0.5, 0.5, 0.25, 0.25, 0.25, 0.25, 1]),\n).play;\n)\n```"}, {"role": "assistant", "content": "============================ extra demos for \\waveguideFlute ============================."}]} +{"conversations": [{"role": "user", "content": "I made a synth and I hear nothing. Where do I start?"}, {"role": "assistant", "content": "Start with the node tree, not the code: evaluate `s.plotTree`. If your Synth is not there, it never started or it already freed itself; if it is there, the problem is in the signal. Which of the two do you see?"}, {"role": "user", "content": "It's in the tree."}, {"role": "assistant", "content": "Then the node lives and the signal is being lost. Check three things in order: does the SynthDef reach `Out.ar(0, ...)` with bus 0; is any `amp`/`mul` zero; and is a filter closed, e.g. `LPF.ar(sig, 50)` on a 440 Hz sine. Paste the SynthDef and I will read it."}, {"role": "user", "content": "SynthDef(\\x, { |out = 0| Out.ar(out, LPF.ar(Saw.ar(60), 80) * 0.1) }).add; Synth(\\x, [\\out, 2]);"}, {"role": "assistant", "content": "Two things. You wrote a low-pass at 80 Hz over a 60 Hz saw, which leaves almost nothing above the fundamental — the patch is nearly a sine at 60 Hz at very low level. And you passed `\\out, 2`, so it is going to bus 2, not the master. Try `Synth(\\x)` with the default out and a cutoff of 800:\n\n```supercollider\nSynthDef(\\x, { |out = 0, cutoff = 800| Out.ar(out, LPF.ar(Saw.ar(60), cutoff) * 0.1) }).add;\nSynth(\\x);\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nb = SoundFile.collectIntoBuffers(\"yourSoundFileFolder/*\"); // By Bjørn Houdorf, December 21, 2012\n\n(\n{\nvar number = b.numChannels, randomNumber, trigger, delayed, panned, sound, mixedSound, rotatedSound;\ntrigger = Dust.kr(Array.fill(number,1), 1, -0.5); // Generates random impulses from -0.5 to 0.5. as a excitation function\nrandomNumber = TRand.kr(1, number, trigger);\nsound = PlayBuf.ar(Array.fill(number,1) ,randomNumber,1,trigger,0,0); // play sound files\ndelayed = DelayL.ar(sound, trigger, trigger); // delaying the sound files\npanned = Pan2.ar(delayed, Array.fill(number,{1.0.rand2})); // pan them out in the stereo field\nmixedSound = 0.05*Mix.new(panned);// and mix them to one stereo signal\nrotatedSound = Rotate2.ar(mixedSound[0], mixedSound[1], LFSaw.kr(0.05)); // rotate stereo signal\n}.play; // play it all\n)\n```"}, {"role": "assistant", "content": "Put your sound files in the sound file folder. The code plays random sound files panned out in the stereo field. A swarm of sound files."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var trig = Dust.kr(10);\n SinOsc.ar(\n TBrownRand.kr(300, 3000, 1.0, MouseX.kr(0, 5), trig)\n ) * 0.1\n}.play;\n);\n\n(\n{\n var trig = Dust.kr(10);\n Pan2.ar(\n SinOsc.ar(LinExp.kr(TBrownRand.kr(dev:0.2, trig:trig), 0, 1, 300, 3000)),\n TBrownRand.kr(-1.0, 1.0, 1.0, 4, trig),\n 0.1\n )\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var trig = Dust.kr(10);\n SinOsc.ar(\n TBrownRand.kr(300, 3000, 1.0, MouseX.kr(0, 5), trig)\n ) * 0.1\n}.play;\n);\n\n(\n{\n var trig = Dust.kr(10);\n Pan2.ar(\n SinOsc.ar(LinExp.kr(TBrownRand.kr(dev:0.2, trig:trig), 0, 1, 300, 3000)),\n TBrownRand.kr(-1.0, 1.0, 1.0, 4, trig),\n 0.1\n )\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `VarGui`?"}, {"role": "assistant", "content": "VarGui — slider / player gui to set envir variables and synth controllers and play synths, event patterns and tasks"}, {"role": "user", "content": "What does `VarGui.new` do?"}, {"role": "assistant", "content": "Create a new VarGui object, which holds control specifications."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\np = Pbind(\\midinote, Pfunc { ~midi } + Pseq([0, 3, 5, 7], inf), \\dur, 0.2)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a granular texture in SuperCollider."}, {"role": "assistant", "content": "Read a sound file into a buffer, then trigger grains from it. Grain density is the Impulse rate and\ngrain length is dur; keep the density times the length under maxGrains or raise it.\n\n```supercollider\n(\ns.waitForBoot {\n ~buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n SynthDef(\\grain, { |out = 0, amp = 0.4, density = 30, dur = 0.08|\n var trig = Impulse.kr(density);\n var sig = GrainBuf.ar(2, trig, dur, ~buf, 1, LFNoise0.kr(2).range(0, 1), 2, 0, -1, 512);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n Synth(\\grain);\n};\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `OscN` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// compare examples below with interpolating Osc examples.\n\n(\ns = Server.local;\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, false, true);\nb = Buffer.alloc(s, 512, 1);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum, 500, 0, 0.5)\n )\n}).play(s, [0, 0, 1, b.bufnum]);\n\n);\nb.free;\n\n\n\n(\n// noninterpolating - there are noticeable artifacts\n// modulate freq\n\ns = Server.local;\nb.sine1(1.0/[1, 2, 3, 4, 5, 6].squared, true, false, true);\nb = Buffer.alloc(s, 512, 1);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum, XLine.kr(2000, 200), 0, 0.5)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n\n);\nb.free;\n\n(\n// sounds very different than the Osc example\ns = Server.local;\nb = Buffer.alloc(s, 512, 1);\nb.sine1([1.0], true, true, true);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum,\n OscN.ar(bufnum,\n XLine.kr(1, 1000, 9),\n 0,\n 200,\n 800),\n 0,\n 0.25)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n\n);\nb.free;\n\n(\n// modulate phase\ns = Server.local;\nb = Buffer.alloc(s, 512, 1);\nb.sine1([1.0], true, true, true);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum,\n 800,\n OscN.ar(bufnum,\n XLine.kr(20, 8000, 10),\n 0,\n 2pi),\n 0.25)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n);\nb.free;\n\n\n(\n// change the buffer while its playing\ns = Server.local;\nb = Buffer.alloc(s, 4096, 1);\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, true, true);\n\nSynthDef(\"help-OscN\", { |out = 0, bufnum = 0|\n Out.ar(out,\n OscN.ar(bufnum, [80, 80.2], 0, 0.2)\n )\n}).play(s, [\\out, 0, \\bufnum, b.bufnum]);\n);\n\n(\nRoutine({\n var n = 32;\n 50.do({\n b.sine1(Array.rand(n, 0, 1).cubed, true, true, true);\n 0.25.wait;\n });\n}).play;\n);\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Timer`."}, {"role": "assistant", "content": "```supercollider\n// using timer to modulate sine frequency: the slower the trigger is the higher the frequency\n(\n{ var trig;\n trig = Impulse.kr(MouseX.kr(0.5, 20, 1));\n SinOsc.ar(Timer.kr(trig) * 500 + 500, 0, 0.2)\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\na = Synth(\\MoaningDialogue)\n\n//COOL TWEAKS\n//AngryTweak\na.set(\\feedback, 29,\\freq, 6)\n//CalmTweak\na.set(\\feedback, 60, \\freq, 0.8)\n//WeirdTweak\na.set(\\feedback, 2.8, \\freq, 2)\n\n(\nSynthDef(\\MoaningDialogue, {\n |rateL = 0.2, rateR = 0.3, freq = 2, feedback = 50, mul = 1 , lpfreq = 2500|\n Out.ar(0,\n FreeVerb.ar(\n BLowPass.ar(\n SinOscFB.ar(\n LFDNoise1.kr([rateL, rateR], freq), feedback;\n , mul),\n lpfreq,\n 0.2\n ),\n 0.3,\n 0.0\n )\n )}\n).add\n)\n```"}, {"role": "assistant", "content": "One of the first synths I made.\r\nA frog-like sounding synth, with a dialogue between the left and the right channel.\r\nI've also notated some simple tweaks."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n//listen to x and y output\n{Out.ar(0,Brusselator.ar(Impulse.kr(MouseY.kr(1,50,'exponential')),MouseX.kr(0.01,1,'exponential')))}.play\n\n//avoid DC offset (default gamma is 1.0, listening to x only, so take off gamma\n{Out.ar(0,Pan2.ar((Brusselator.ar(Impulse.kr(MouseY.kr(1,50,'exponential')),MouseX.kr(0.01,1,'exponential')))[0] - 1.0) )}.play\n\n\n//fun time, stable oscillation with these parameters\n{var mu = MouseY.kr(1.0,1.5); Out.ar(0,Pan2.\n// …\n```"}, {"role": "assistant", "content": "listen to x and y output avoid DC offset (default gamma is 1.0, listening to x only, so take off gamma (Brusselator: Prigogine oscillator)"}]} +{"conversations": [{"role": "user", "content": "What is `Fb1` in SuperCollider?"}, {"role": "assistant", "content": "Fb1 — single sample feedback / feedforward pseudo ugen Fb1 provides an interface for single sample feedback and feedforward at audio and control rate, the defining relation with (formal) access to previous samples is passed as a Function, which might involve additional UGens. Fb1.ar works with arbitrary blockSizes and also allows to refer to samples earlier than one blockSize before. This includes linear filter definitions of arbitrary length with dyn Category: Libraries > miSCellaneous > Nonlinear."}]} +{"conversations": [{"role": "user", "content": "Explain `MxUnitApp` in SuperCollider briefly."}, {"role": "assistant", "content": "MxUnitApp — scripting interface object for a unit A unit holds an object like an Instr, NDef, Bus, Spline, SFP (soundfile player) etc. Category: Mx."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `List`."}, {"role": "assistant", "content": "```supercollider\n(\n// Create a new empty List with size: 3\nx = List.new(3);\n\nx.postln; // -> List[ ]\n\n// Add numbers 0 to 4 to the List\n5.do({ |i| x.add(i) });\n\n// The list has been modified in-place with each added item\nx.postln; // -> List[ 0, 1, 2, 3, 4 ]\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n// synthdefs to play with\n\n(\nSynthDef(\\noise_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, rq = 0.1, amp = 0.1|\n var sig = { WhiteNoise.ar } ! 2;\n sig = BPF.ar(sig, freq, rq) *\n EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2) *\n (rq ** -1) * (250 / (freq ** 0.8));\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\sin_grain, { |out = 0, freq = 4\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n// synthdefs to play with\n\n(\nSynthDef(\\noise_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, rq = 0.1, amp = 0.1|\n var sig = { WhiteNoise.ar } ! 2;\n sig = BPF.ar(sig, freq, rq) *\n EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2) *\n (rq ** -1) * (250 / (freq ** 0.8));\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\sin_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { SinOsc.ar(freq, Rand(0, 2pi)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\saw_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { VarSaw.ar(freq, Rand(0, 1)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "How do I make a delay line?"}, {"role": "assistant", "content": "`CombN.ar(in, maxdelaytime, delaytime, decaytime)` is a feedback delay: maxdelaytime is the buffer size, delaytime the actual delay (and it can modulate), decaytime how long the repeats take to die. For a clean single echo use `DelayN.ar(in, maxdelaytime, delaytime)`, which has no feedback. Both replace the `in` with the delayed signal, so mix with the dry: `dry + CombN.ar(dry, 0.5, 0.3, 2) * 0.4`."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var w, x, y, p, a, b, c, d;\n\n p = PinkNoise.ar; // source\n\n // B-format encode\n #w, x, y = PanB2.ar(p, MouseX.kr(-1, 1), 0.1);\n\n // B-format decode to quad\n #a, b, c, d = DecodeB2.ar(4, w, x, y);\n\n [a, b, d, c] // reorder to my speaker arrangement: Lf Rf Lr Rr\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var w, x, y, p, a, b, c, d;\n\n p = PinkNoise.ar; // source\n\n // B-format encode\n #w, x, y = PanB2.ar(p, MouseX.kr(-1, 1), 0.1);\n\n // B-format decode to quad\n #a, b, c, d = DecodeB2.ar(4, w, x, y);\n\n [a, b, d, c] // reorder to my speaker arrangement: Lf Rf Lr Rr\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Basic tone simulator of a stylophone. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n/*\nRetro Stylophone\n\nReverse engineered from: https://www.waitingforfriday.com/?p=334\n\n1. Relaxation oscillator (UJT)\n\n- generated by a combination of two oscillators. The primary oscillator is a\n current controlled PUT (Programmable Uni-Junction Transistor) relaxation oscillator which is\n responsible for generating the overall tone of the instrument.\n A secondary LFO phase-shifted provides the vibrato\n (the relative slow wavering of a sound around the notes centre pitch)\n\n- around 10 VPP\n\n2. LFO phase-shift (vibrato)\n\n- generated by a low-frequency oscillator made with a transistor and several capacitors,\n which produces a triangle/sine wave fed into the frequency control voltage operating the UJT\n\n- frequency of about 8.5Hz, phased shifted of 180 degree, around 4.2 VPP\n*/\n\n(\nSynthDef(\\stylophone, { |freq = 220, vibAmp = 2, toneAmp = 5, atkTime = 0.01, trigger = 0|\n\n var lfo = OnePole.kr(LFPar.kr(8, mul: vibAmp, add: freq), 0.9); // 180 degree inversion\n var relaxOsc = LFPulse.ar(lfo, width: 0.9, mul: toneAmp);\n\n var asr = EnvGen.kr(Env.asr(atkTime * 5, releaseTime: 0.001, curve: \\lin), gate: trigger);\n\n Out.ar(0, relaxOsc * asr)\n}).add\n);\n\nf = Synth(\\stylophone);\n\nf.set(\\freq, 208.2);\nf.set(\\freq, 233.4);\n\nf.set(\\trigger, 1);\nf.set(\\trigger, 0);\nf.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `MxTimeGui.zoom` do? What arguments does it take?"}, {"role": "assistant", "content": "Timeline view Arguments: argFrom; argTo; updateZoomControl."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n//bass synth\n{Out.ar(0,Pan2.ar(DoubleWell3.ar(f:SinOsc.ar(MouseX.kr(0,200),0,MouseY.kr(0.5,4.0))),0.0))}.play\n\n//plotting check of first samples\n{DoubleWell3.ar}.plot(0.05, minval:-1, maxval:1)\n\n//gradually changing \n{Pan2.ar(DoubleWell3.ar(0,0.05,LFSaw.ar(Line.kr(10,1000,10)),Line.kr(0.0,0.3,20)),0.0)}.play\n\n//controlled - midscreen amplitude jump\n{Pan2.ar(DoubleWell3.ar(0,0.05,L\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n//bass synth\n{Out.ar(0,Pan2.ar(DoubleWell3.ar(f:SinOsc.ar(MouseX.kr(0,200),0,MouseY.kr(0.5,4.0))),0.0))}.play\n\n//plotting check of first samples\n{DoubleWell3.ar}.plot(0.05, minval:-1, maxval:1)\n\n//gradually changing \n{Pan2.ar(DoubleWell3.ar(0,0.05,LFSaw.ar(Line.kr(10,1000,10)),Line.kr(0.0,0.3,20)),0.0)}.play\n\n//controlled - midscreen amplitude jump\n{Pan2.ar(DoubleWell3.ar(0,0.05,LFSaw.ar(MouseX.kr(10,1000)),MouseY.kr(0.0,0.5)),0.0)}.play\n\n\n\n//triggering\n{DoubleWell3.ar(Impulse.kr(MouseY.kr(0.01,100, 'exponential')),0.1,LFCub.ar(MouseX.kr(10,1000, 'exponential')),MouseY.kr(0.0,1.0),LFNoise0.kr(2.3,0.2,0.8),LFNoise1.kr(2.37,0.2,0.8))}.play\n\n\n//AudioIn as forcing\n{Pan2.ar(DoubleWell3.ar(0,0.05,LPF.ar(AudioIn.ar(1),100,MouseX.kr(0,1000)),MouseY.kr(0.0,0.5)),0.0)}.play\n```"}]} +{"conversations": [{"role": "user", "content": "What does `RedVector.distance` do?"}, {"role": "assistant", "content": "Get the distance between two vectors as a Float."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `PulseDivider`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\"help-PulseDivider\", { |out = 0|\n var p, a, b;\n p = Impulse.ar(8);\n a = SinOsc.ar(1200, 0, Decay2.ar(p, 0.005, 0.1));\n b = SinOsc.ar(600, 0, Decay2.ar(PulseDivider.ar(p, 4), 0.005, 0.5));\n\n Out.ar(out, (a + b) * 0.4)\n}).play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `RedFingerprint.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a new fingerprint object and do the translation ( #-calc Arguments: array — Numerical data to be plotted.; normalize — Boolean.."}]} +{"conversations": [{"role": "user", "content": "What is `BinaryOpUGen`?"}, {"role": "assistant", "content": "BinaryOpUGen — Apply a binary operation to the values of an input UGen"}, {"role": "user", "content": "What does `BinaryOpUGen.new` do?"}, {"role": "assistant", "content": "return a new instance that applies the operator `selector` to the UGens `a` and `b` normally, this is implicitly called when applying an operator to a UGen."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na = WhiteNoise.ar; // a WhiteNoise\nb = a + 2; // a BinaryOpUGen.\nb.operator; // +\n\n// sound example\n(\n{\n var a = LFSaw.ar(300);\n var b = LFSaw.ar(329.1);\n a % b * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `UnicodeResponder.registerAll` do? What arguments does it take?"}, {"role": "assistant", "content": "register responder functions for unicode and modifier combinations Arguments: ... sets."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Psubdivide` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\na = Psubdivide(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,0,1,3,4,0], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n100.do({ x.next.postln });\n);\n\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Psubdivide(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n);\n\n\n(\na = Psubdivide(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,4,4,0,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nx = {\n |lookBack = 3, thr = 1|\n var trig = Impulse.ar(7);\n // for a non-integer source it makes sense to take a sufficiently large threshold thr\n var midi = Demand.ar(trig, 0, DIdev(SinOsc.ar(0.2, 0, 15, 82), 5, -6, 5, lookBack, thr: thr));\n midi.poll(7, label: \\midi);\n SinOsc.ar(midi.midicps.lag(0.007)) ! 2 * 0.1\n}.play;\n);\n\n// close floats can occur here \nx.set(\\thr, 0.01)\n\n// not here\nx.set(\\thr, 2\n\nx.release\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nx = {\n |lookBack = 3, thr = 1|\n var trig = Impulse.ar(7);\n // for a non-integer source it makes sense to take a sufficiently large threshold thr\n var midi = Demand.ar(trig, 0, DIdev(SinOsc.ar(0.2, 0, 15, 82), 5, -6, 5, lookBack, thr: thr));\n midi.poll(7, label: \\midi);\n SinOsc.ar(midi.midicps.lag(0.007)) ! 2 * 0.1\n}.play;\n);\n\n// close floats can occur here \nx.set(\\thr, 0.01)\n\n// not here\nx.set(\\thr, 2)\n\nx.release\n```"}]} {"conversations": [{"role": "user", "content": "Explain `Pnaryop` in SuperCollider briefly."}, {"role": "assistant", "content": "Pnaryop — n-ary operator pattern Returns a stream that applies the n-ary operator to the stream values of the receiver, taking n-1 streams as arguments. Usually, this is the result of applying an n-ary operator (i.e. a method with more than one argument) to a pattern. Category: Streams-Patterns-Events > Patterns > Math."}]} -{"conversations": [{"role": "user", "content": "What does `MxApp.save` do?"}, {"role": "assistant", "content": "Save the Mx as a document (initiating a file dialog if there is no path yet) which should reproduce the current state of the Mx and all of its objects. Not all objects may support saving and loading, and any objects like Busses would fix their bus numbers in the document. This can also be done from the"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n// Everyone likes Fibonacci numbers:\nb = Buffer.loadCollection(s, [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] * 0.1);\n// Or you could load some numbers from a file:\nb = Buffer.loadCollection(s, FileReader.read(\"/Users/danstowell/svn/stored_docs/bbx annots/onsets_gt/vb5gt.txt\", true, true).collect(_.at(0).asFloat));\n(\n// ListTrig used here to output some simple grains.\n// I'm also using .poll and a ramp to output the calculated time value, to check the output.\n// Note the accuracy, which is limited to the accuracy of the control rate.\nx = { |t_\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n// Everyone likes Fibonacci numbers:\nb = Buffer.loadCollection(s, [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] * 0.1);\n// Or you could load some numbers from a file:\nb = Buffer.loadCollection(s, FileReader.read(\"/Users/danstowell/svn/stored_docs/bbx annots/onsets_gt/vb5gt.txt\", true, true).collect(_.at(0).asFloat));\n(\n// ListTrig used here to output some simple grains.\n// I'm also using .poll and a ramp to output the calculated time value, to check the output.\n// Note the accuracy, which is limited to the accuracy of the control rate.\nx = { |t_reset=0|\n var trigs, env, son, ramp;\n trigs = ListTrig.kr(b.bufnum, t_reset);\n env = EnvGen.ar(Env.perc(0.01, 0.1), trigs);\n son = SinOsc.ar(440, 0, env * 0.2);\n \n ramp = Phasor.kr(t_reset, ControlRate.ir.reciprocal, 0, inf);\n ramp.poll(trigs, \"Trigger at time offset\");\n \n son.dup;\n}.play(s)\n);\nx.set(\\t_reset, 1);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Those were the times."}, {"role": "assistant", "content": "```supercollider\n(\ns.waitForBoot({\n\n SynthDef(\\singer, {\n | out=0, freq=440, amp=0.5, vibrato=6|\n var lfo, lfo2, lfo3, sig;\n lfo = SinOsc.kr(1/5, 0).range(250,1000);\n lfo2 = SinOsc.kr(1/5, 0).range(0.1,0.9);\n lfo3 = SinOsc.kr(vibrato).range(0.3, 1);\n sig = lfo3*RLPF.ar(in:VarSaw.ar(freq:Lag.ar(in:K2A.ar(freq), lagTime:0.3), iphase:0, width:lfo2, mul:amp), freq:lfo, rq:200/lfo);\n Out.ar(out, sig!2);\n }).add;\n\n s.sync;\n\n Pdef.defaultQuant_(0);\n Pdef(\\bass, Pmono(\\default, \\dur, Pwhite(0.01, 0.1, inf), \\freq, (Pgbrown(1,8,5) * 20).round(10), \\amp, Pbrown(0.2,0.6,0.05)));\n Pdef(\\computer, Pmono(\\default, \\dur, Pwhite(0.01, 0.1, inf), \\freq, (Pgbrown(1,8,9) * 100).round(20), \\amp, Pbrown(0.2,0.6,0.05)));\n Pdef(\\soprano, Pmono(\\singer, \\dur, Pwhite(0.01, 0.1, inf), \\freq, Pgbrown(1,8,0.05) * 200, \\amp, Pbrown(0.2,0.6,0.05)/5, \\vibrato, Pbrown(4,7,0.125)));\n Pdef(\\soprano2, Pmono(\\singer, \\dur, Pwhite(0.01, 0.1, inf), \\freq, Pbrown(3,6,0.1) * 100, \\amp, Pbrown(0.2,0.6,0.05)/5, \\vibrato, Pbrown(3,8,0.125)));\n\n fork {\n Pdef(\\bass).play;\n 10.wait;\n Pdef(\\computer).play;\n 10.wait;\n Pdef(\\soprano).play;\n 10.wait;\n Pdef(\\soprano2).play;\n 10.wait;\n Pdef(\\computer).stop;\n 20.wait;\n Pdef(\\bass).stop;\n 10.wait;\n Pdef(\\soprano).stop;\n Pdef(\\soprano2).stop;\n Pdef(\\bass).play;\n Pdef(\\soprano).play;\n 10.wait;\n Pdef(\\soprano2).play;\n 10.wait;\n Pdef(\\computer).play;\n 20.wait;\n Pdef(\\bass).stop;\n Pdef(\\computer).stop;\n Pdef(\\soprano).stop;\n Pdef(\\soprano2).stop;\n }\n\n});\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Rand or rand difference?"}, {"role": "assistant", "content": "SuperCollider forum — Rand or rand difference?\n\nI think you meant to compare Rand and rrand (not rand) – both generate a random number between a given low and high, but Rand is intended to be used inside a SynthDef and the behavior is slightly different. Compare:\n\n```supercollider\n(\nSynthDef(\\test, {\n var freq = rrand(400, 600);\n Out.ar(0, SinOsc.ar(freq) * 0.2);\n}).add;\n);\n\nSynth(\\test); // run and stop multiple times: always same freq\n\n(\nSynthDef(\\test2, {\n var freq = Rand(400, 600);\n Out.ar(0, SinOsc.ar(freq) * 0.2);\n}).add;\n);\n\nSynth(\\test2); // run and stop multiple times: every time a different freq\n```\n\nAs you can read in the help file, Rand is intended to be used inside SynthDefs when you want the particular behavior of a newly generated random frequency for each Synth called. You can use rrand(lo, hi) inside a SynthDef too, if you want the random number to be generated only once at time of SynthDef creation (it gets “inscribed in the recipe” for good), so all future and all Synth calls based on that SynthDef to use on that same random number.\n\nAs a side note, rand (as opposed to rrand) generates a random number between zero and the receiver:\n\n```supercollider\nrand(8); // random numbers between 0 and and 8 (excluding 8)\n\nrand(0.5, 8); // random numbers between 0 and 0.5; second argument is ignored here\n```\n\nAlso in regards to the specific way you present the example (as Functions, indicated by the curly braces): note the difference when you evaluate them:\n\n```supercollider\n{Rand(0.5,8)}.value; // returns 'a Rand'\n{rrand(0.5,8)}.value; // returns an actual random choice between lo and hi\n```\n\nHope this helps,\n\nB"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n \n// definition for future reference in arbitrary Environments\n\np = PLwhite(\\lo, \\hi);\n\n\n// prepare current Environment\n// PLseq repeats defaults to inf\n\n(\n~lo = PLseq((60..70));\n~hi = PLseq((62..72));\n);\n\n\n// run\n\n(\nx = Pbind(\n \\midinote, p, \n \\dur, 0.1 \n).play;\n);\n\n\n// replace, converging bounds, stops when ~lo ends (Pseq default repeats = 1)\n\n(\n~lo = Pseq((60..80) ++ (80!5));\n~hi = 8\n// …\n```"}, {"role": "assistant", "content": "definition for future reference in arbitrary Environments prepare current Environment (PLwhite: dynamic scope Pwhite variant)"}]} -{"conversations": [{"role": "user", "content": "Explain `Cepstrum` in SuperCollider briefly."}, {"role": "assistant", "content": "Cepstrum — Quefrency analysis and liftering Fourier analysis of the shape of a signal's log-power spectrum. Because this transform applies to magnitudes and not the phases (i.e. it ignores half of the data), the cepstral Buffer is half the size of the FFT Buffer. Category: UGens > FFT."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pulse`."}, {"role": "assistant", "content": "```supercollider\n// modulate frequency\n{ Pulse.ar(XLine.kr(40, 4000, 6), 0.1, 0.2) }.play;\n\n// modulate pulse width\n{ Pulse.ar(200, SinOsc.kr(0.2).range(0.01, 0.99), 0.2) }.play;\n\n// two band limited square waves thru a resonant low pass filter\n{ RLPF.ar(Pulse.ar([100, 250], 0.5, 0.1), XLine.kr(8000, 400, 5), 0.05) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `PlayerSocket.numChannels` do?"}, {"role": "assistant", "content": "a player that can play other players using a cross-faded and fuse-protected socket"}]} -{"conversations": [{"role": "user", "content": "What happens when I call .play on a function?"}, {"role": "assistant", "content": "`.play` on a Function builds a SynthDef from the function body, adds it to the server under an anonymous name, and starts one Synth of it. You get back the Synth, so `x = { SinOsc.ar(440) * 0.1 }.play; x.free;` stops it. It is the fastest way to hear something, but it is not how you write a piece: nothing is named, nothing can be reused, and the definition is lost when the Synth is freed."}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nx = { |freq = 440, amp = 0.2| SinOsc.ar(freq) * amp }.play;\nx.set(\\freq, 660);\n```"}, {"role": "assistant", "content": "Starts an anonymous synth with two controls, then changes one of them while it plays.\n\nThe `|freq = 440, amp = 0.2|` are arguments of the function, and `.play` turns each into a Synth control\nwith that default value. `x` holds the Synth node. `.set(\\freq, 660)` sends a `/n_set` message to the\nserver, so the oscillator changes frequency without being restarted — that is why the sound glides rather\nthan re-triggering. Note that `\\freq` is a Symbol: the backslash is part of the name."}]} -{"conversations": [{"role": "user", "content": "What is `BLowPass4` in SuperCollider?"}, {"role": "assistant", "content": "BLowPass4 — 24db/oct rolloff - 4th order resonant Low Pass Filter [1] The B equalization suite is based on the Second Order Section (SOS) biquad UGen. Category: UGens > Filters > BEQSuite."}]} -{"conversations": [{"role": "user", "content": "What is `IdentityDictionary`?"}, {"role": "assistant", "content": "IdentityDictionary — associative collection mapping keys to values"}, {"role": "user", "content": "What does `IdentityDictionary.new` do?"}, {"role": "assistant", "content": "The #-parent and #-proto instance variables allow additional IdentityDictionary's to provide default values. The precedence order for determining the value of a key is the IdentityDictionary, its prototype, its parent. When the instance variable #-know is True, the IdentityDictionary responds to unknown messages by looking up the selector and evaluating the result with the dictionary as an argumen"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_sinegrain, { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0.5pi, env))\n}).add;\n\na = Pbind(\\instrument, \\help_sinegrain, \\note, Pseq([0, 7, 2, 9, 11, 10, 9, 8], inf), \\dur, 1);\na.play(quant: (quant: 1, phase: 0));\na.play(quant: (quant: 1, phase: 1/3));\na.play(quant: (quant: 1, phase: 1.0.rand));\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `InFeedback`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-InFeedback\", { |out = 0, in = 0|\n var input, sound;\n input = InFeedback.ar(in, 1);\n sound = SinOsc.ar(input * 1300 + 300, 0, 0.4);\n Out.ar(out, sound);\n\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SimpleNumber.sincPi` do?"}, {"role": "assistant", "content": "Returns the Sinus Cardinal of `x`. Also known as the \"sinc\" function. `sincPi(x) = sin(x) /"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Pisano periods for rythmic patterns."}, {"role": "assistant", "content": "```supercollider\nb = Buffer.read( s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\" );\n\n(\nSynthDef(\\playBuf, {| out = 0, buf = 0, amp = 0.2, pan = 0.0, dur = 0.2, gate = 1 startPos = 0 |\n var sig, env;\n env = EnvGen.ar( Env.sine( dur ), gate, amp, doneAction: 2 );\n sig = PlayBuf.ar( \n 1, \n buf, \n BufRateScale.ir( buf ), \n 1, \n startPos * BufFrames.ir( buf )\n );\n OffsetOut.ar(out, Pan2.ar( sig * env, pan ) )\n}).add\n);\n\n(\nPn(\n Plazy({\n var divisor = 3.rrand( 9 ), repeats = 10.rrand( 20 );\n var pisano, size, starts, durs, pans, amps;\n\n pisano = Array.pisano( divisor );\n size = pisano.size;\n starts = { 1.0.rand } ! size ;\n durs = { 0.03.rrand( 0.08 ) } ! size;\n pans = { 1.0.rand2 } ! size;\n amps = { 0.05.rrand( 0.8 ) } ! size;\n\n \"Divisor: %\\t pisano period is of length: %\\n\".postf( divisor, size );\n\n Pbind(\n \\instrument, \\playBuf,\n \\pisano, Pseq( pisano, repeats ),\n \\buf, b,\n \\amp, Pindex( amps, Pkey( \\pisano ) ),\n \\dur, Pindex( durs, Pkey( \\pisano ) ),\n \\pan, Pindex( pans, Pkey( \\pisano ) ),\n \\startPos, Pindex( starts, Pkey( \\pisano ) )\n )\n }),\n inf\n).play\n);\n\nb.free\n\n//////////////////////////////////////////////////////////////////////\n// + Array { \n// // The pisano period for the given integer.\n// *pisano { | divisor = 3 |\n// var list, lastPair, sum;\n// if ( divisor.isInteger.not or: { divisor < 0 } ){\n// \"The divisor must be a positive integer\".throw;\n// };\n// list = List[ 0, 1 ];\n// while {\n// lastPair = list.keep( -2 );\n// sum = lastPair.sum;\n// sum != 1 or: { lastPair.last != 0 }\n// }{\n// list.add( sum % divisor );\n// };\n// ^ list.array.drop( -1 )\n// }\n\n// }\n//////////////////////////////////////////////////////////////////////\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Blowing ambient with lots of reverb."}, {"role": "assistant", "content": "```supercollider\nfork{\n // notes sequence\n var seq = Pxrand([0,3,5,7,8],inf).asStream;\n loop{\n var dur = 8;\n var num = 8;\n var root = 36;\n var freq = (seq.next+root).midicps;\n var spread = rrand(0.4,0.8);\n var attack = rrand(0.05, 0.3);\n \n // play the cluster\n play{\n var harm = Array.geom(num, 1, 1.5);\n var harma = Array.geom(num, 0.5, 0.8);\n var detune = Array.fill(num, { LFNoise2.kr(1,0.01,1) });\n var source = PinkNoise.ar;\n var bandwidth = Rand(0.001,0.01);\n var generator = [\n SinOsc.ar(freq*harm*detune, mul:harma*0.3).scramble,\n Resonz.ar(source, freq*harm*detune, bandwidth, mul:harma).scramble * 50\n ].wchoose([0.2,0.8]);\n var snd = Splay.ar(generator,spread);\n snd * LFGauss.ar(dur, attack, loop:0, doneAction:2);\n };\n dur.wait;\n };\n \n};\n\n// global triple super gverb\n{\n var in = In.ar(0,2);\n in = (in*0.2) + GVerb.ar(in, 220, 12, mul:0.6);\n in = (in*0.2) + GVerb.ar(in, 220, 12, mul:0.6);\n in = (in*0.2) + GVerb.ar(in, 220, 12, mul:0.6);\n ReplaceOut.ar(0, Limiter.ar(LeakDC.ar(in)))\n}.play(addAction:\\addToTail)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// augmentation of nonlinearity:\n// GFIS itself used as time-varying control of another GFIS\n\nb = Buffer.read(s, Platform.miSCellaneousDirs[0] +/+ \"Sounds\" +/+ \"kitchen_sounds_1.wav\");\n\n// load to array and fill new buffer for iteration\n\nb.loadToFloatArray(action: { |array| a = array; \"done\".postln });\n\nd = a[3150..3300].normalize;\n\nc = Buffer.loadCollection(s, d);\n\n\n(\ny = {\n var r = LFDNoise3.ar(3).range(2.7, 3.4);\n var add = GFIS.ar({ |x| sin(r * x) }, 0.5, 3\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// augmentation of nonlinearity:\n// GFIS itself used as time-varying control of another GFIS\n\nb = Buffer.read(s, Platform.miSCellaneousDirs[0] +/+ \"Sounds\" +/+ \"kitchen_sounds_1.wav\");\n\n// load to array and fill new buffer for iteration\n\nb.loadToFloatArray(action: { |array| a = array; \"done\".postln });\n\nd = a[3150..3300].normalize;\n\nc = Buffer.loadCollection(s, d);\n\n\n(\ny = {\n var r = LFDNoise3.ar(3).range(2.7, 3.4);\n var add = GFIS.ar({ |x| sin(r * x) }, 0.5, 3) * [0.05, 0.055];\n GFIS.ar(\n { |x| BufRd.ar(1, c, c.numFrames * (x + add)) }, \n 0.5, 7\n ) * 0.2\n}.play\n);\n\ny.release\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// longer crossfade\n(\nSynthDef(\\conv_test2, { |out, kernel, t_trig = 0|\n var input = Impulse.ar(1);\n var framesize = 2048; // must have power of two\n var result = Convolution2L.ar(input, kernel, t_trig, 2048, 5, 0.5);\n Out.ar(out, result);\n}).add\n);\n\nx = Synth(\\conv_test2, [\\kernel, b]);\n\n// changing the buffer number:\nx.set(\\kernel, c);\nx.set(\\t_trig, 1); // after this trigger, the change will take effect.\nx.set(\\kernel, d);\nx.set(\\t_trig, 1); // after this trigger, the change will take effect.\n\nd.z\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// longer crossfade\n(\nSynthDef(\\conv_test2, { |out, kernel, t_trig = 0|\n var input = Impulse.ar(1);\n var framesize = 2048; // must have power of two\n var result = Convolution2L.ar(input, kernel, t_trig, 2048, 5, 0.5);\n Out.ar(out, result);\n}).add\n);\n\nx = Synth(\\conv_test2, [\\kernel, b]);\n\n// changing the buffer number:\nx.set(\\kernel, c);\nx.set(\\t_trig, 1); // after this trigger, the change will take effect.\nx.set(\\kernel, d);\nx.set(\\t_trig, 1); // after this trigger, the change will take effect.\n\nd.zero;\n\n40.do { |it| d.set(20 * it + 10, 1) }; // changing the buffers' contents\n\nx.set(\\t_trig, 1); // after this trigger, the change will take effect.\n\nx.set(\\kernel, b);\nx.set(\\t_trig, 1); // after this trigger, the change will take effect.\n\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for get different result each time running the pattern."}, {"role": "assistant", "content": "```supercollider\nTempoClock.default.tempo = 156/60;\n\n(\nSynthDef(\\spring, { |freq = 400, out = 0, pan = 0, gate = 1, dur = 0.15, curve = -4, amp = 1, index = 1|\n var sig = FreeVerb.ar(Pan2.ar(Blip.ar(freq, index), pan));\n var env = EnvGen.ar(Env.perc(0.01, dur, amp, curve), gate, doneAction:2);\n Out.ar(0, sig * env);\n}).add;\n);\n\n(\nPbind(*[\n instrument: \\spring,\n dur: Pseq([4, 1, 2, 1, 1, 1].scramble/ 4 / TempoClock.default.tempo, inf),\n degree: Pseq(#[1,2,3,4], inf) * Pkey(\\dur).reciprocal,\n octave: Pseq([2,3,4,4,4,3].scramble, inf),\n pan: Pxrand(Array.fill(100, { 0.gaussian(1).clip2(1) }), inf),\n amp: Pseq(#[0.95,1,0.8],inf),\n index: Pstutter(Pseq(#[4,8,12],inf), Pseq([2,3,4,5,6,8].scramble, inf))\n]).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `ClientOnTrigResponder` in SuperCollider briefly."}, {"role": "assistant", "content": "ClientOnTrigResponder — a helper object used by Instr to implement { }.onTrig inside of Instr functions Category: Libraries > crucial > Instr."}]} -{"conversations": [{"role": "user", "content": "Explain `ScoreClock` in SuperCollider briefly."}, {"role": "assistant", "content": "ScoreClock — Create a Score by capturing OSC and timings ScoreClock simplifies NRT synthesis by capturing OSC messages and timings of anything sent to the default server, and returns a Score object that can then be rendered to file or played back. Category: Scheduling > Clocks, External Control > OSC."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Midterm Q1 (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef( \"pulsey\",{arg freq, amp;\n var env, snd;\n env = Env.perc(attackTime: 0.2,\n releaseTime: 4,\n level: amp).kr(doneAction:2);\n snd = Pulse.ar(\n freq: freq*LFNoise2.kr([4, 5, 7]).range(0.988, 1.011),\n mul:env);\n snd = LPF.ar(in: snd, freq: 1000);\n snd = Splay.ar(snd);\n Out.ar(0, snd);\n\n\n}).add;\n);\n\n(\nm = [72, 79, 77, 79, 82, 79, 87, 86, 84, 82, 84, 79];\n\n\nPbind(\n \\instrument, \"pulsey\",\n \\midinote, Pseq(m, inf),\n \\dur, Pseq([Pn(0.5, 5), 1.5], inf),\n \\amp, Pwhite(0.15, 0.2)\n).play;\n\n\nPbind(\n \\instrument, \"pulsey\",\n \\midinote, Pseq(m.reverse, inf),\n \\dur, Pseq([Pn(0.5, 5), 1.5], inf),\n \\ctranspose, Pwrand([-12, -7, -24], [0.8, 0.1, 0.1], inf),\n \\amp, 0.08,\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Another fibonaccy melody."}, {"role": "assistant", "content": "```supercollider\n(\nc=13;a=Array.fib(64,0,1);b=Array.fill(size:c,function:{arg i;a[i]%12});\np=1/(21-c);Pdef(\\x,Pbind(\\dur,p,\\degree,Pseq(b,1,0)));\nr=Array.fill(c,{arg i;Pbindf(Pdef(\\x),\\mtranspose,1-b[i]);});\nPseq(r,(1/p)).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `RedMixer.new` do? What arguments does it take?"}, {"role": "assistant", "content": "create and hold multiple RedMixerChannel Arguments: inputChannels — Array of input stereo channels. A matching array of RedMixerChannel channels will be created.; outputChannels — Array of output stereo channels. A matching array of RedMixerChannel mixers will be created (think subgroups).; group — `nil` boots the default server and creates a group after the `defaultGroup`.; lag — For equalizer settings, balance and volume. In seconds.."}]} +{"conversations": [{"role": "user", "content": "I get 'FAILURE IN SERVER /s_new SynthDef not found'. What is wrong?"}, {"role": "assistant", "content": "The server does not know that SynthDef. Three usual causes, in order of likelihood:\n\n1. **The SynthDef was added before the server booted.** `SynthDef(...).add` is asynchronous; wrap the work\n in `s.waitForBoot { ... }` or put `s.sync` after `.add`.\n2. **The name does not match.** `SynthDef(\\bell, ...)` is played by `Synth(\\bell)`, not `\\Bell` — symbols\n are case-sensitive.\n3. **`.add` was never called.** Writing `SynthDef(\\bell, { ... })` without `.add` builds the definition in\n the language and sends nothing.\n\nCheck with `SynthDescLib.global.dict.keys` — if the name is not there, it never reached the server."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// Evaluate this to start your project\n// The Cactus instnce is stored in c by convention\n\nc = CactusGUI(Document.current.dir).cactus; // with GUI\nc = Cactus(Document.current.dir); // without GUI\n\n/*\n\nAny folder with sound files you place in the buffers folder becomes available\nwith the following syntax:\n\n c.buffers.at(\"[folder_name]/[file_name_without_extension]\").play;\n\nYou can also access the folder as a List\n\n c.buffers.at(\"[folder_name]\");\n\n*/\n\n// You can use the dictionary at .at to store anything you like. For example:\n\nc.at[\\exampleVariable] = 10000.rand;\n\n// Get the value\n\nc.at[\\exampleVariable];\n```"}, {"role": "assistant", "content": "Evaluate this to start your project The Cactus instnce is stored in c by convention."}]} +{"conversations": [{"role": "user", "content": "What does `Object.blend` do?"}, {"role": "assistant", "content": "Lineraly interpolate between this and argument `blend(10, 100,"}]} +{"conversations": [{"role": "user", "content": "What does `Signal.thresh` do?"}, {"role": "assistant", "content": "Thresholding replaces every value < threshold with"}]} +{"conversations": [{"role": "user", "content": "What is `PMantissaMask` in SuperCollider?"}, {"role": "assistant", "content": "PMantissaMask — UGenPatterns quark library Based on MantissaMask Category: Streams-Patterns-Events > UGenPatterns > Generators."}]} +{"conversations": [{"role": "user", "content": "What does `Function.fork` do?"}, {"role": "assistant", "content": "Returns a Routine using the receiver as it's function, and plays it in a TempoClock. `{ 4.do({ \"Threading...\".postln; 1.wait })"}]} +{"conversations": [{"role": "user", "content": "What are the arguments of GrainBuf.ar?"}, {"role": "assistant", "content": "`GrainBuf.ar(numChannels, trigger, dur, sndbuf, rate, pos, interp, pan, envbufnum, maxGrains, mul, add)`. The ones you always pass are numChannels (1 or 2), trigger (a UGen that fires grains, e.g. Impulse.kr(20)), dur (grain length in seconds), sndbuf (an integer buffer number, or `~buf`), rate (playback rate per grain), and pos (read position 0..1 into the buffer). Raise maxGrains if the server complains about too many grains rather than lowering density."}]} +{"conversations": [{"role": "user", "content": "What does `ProxySpace.copy` do?"}, {"role": "assistant", "content": "Copies the environment into a new one, with each proxy being copied as well (See: NodeProxy#-copy). Also the instance variables that determine the ProxySpace behaviour are included, such as server, fadeTime, quant, reshaping (this happens in the `copyState` method). `p ="}]} +{"conversations": [{"role": "user", "content": "What does `ArrayedCollection.++` do?"}, {"role": "assistant", "content": "Concatenate the contents of the two collections into a new ArrayedCollection."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `LinRand` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-LinRand\", { |out = 0, minmax = 1|\n Out.ar(out,\n FSinOsc.ar(\n LinRand(200.0, 10000.0, minmax),\n 0, Line.kr(0.2, 0, 0.01, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n// towards hi\n(\nRoutine({\n loop({\n Synth.new(\"help-LinRand\"); 0.04.wait;\n })\n}).play;\n);\n\n// towards lo (doesn't work like that yet)\n(\nRoutine({\n loop({\n Synth.new(\"help-LinRand\", [\\minmax, -1]); 0.04.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `WhiteNoise`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-WhiteNoise\", { |out = 0|\n Out.ar(out,\n WhiteNoise.ar(0.25)\n )\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{ Latoocarfian2DC.ar(\n SampleRate.ir/8,\n SampleRate.ir/2,\n LFNoise2.kr(2.dup, 1.5, 1.5),\n d:LFNoise2.kr(2.dup, 0.5, 1.5),\n mul:0.2\n) }.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{ Latoocarfian2DC.ar(\n SampleRate.ir/8,\n SampleRate.ir/2,\n LFNoise2.kr(2.dup, 1.5, 1.5),\n d:LFNoise2.kr(2.dup, 0.5, 1.5),\n mul:0.2\n) }.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = List[1, 2, 3]\na.foldAt(2) // same as at\na.foldAt(3) // folds back\na.foldAt([-1, 3, 1]) // array of indices (returns not a list, but an array)\na@|@3 //syntactic shortcut\n\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n 32.do{ |i|\n {\n var freq = pitches.foldAt(i).midicps;\n var env = Env.perc.ar(Done.freeSelf);\n SinOsc.ar(freq) * 0.1 * env\n }.play;\n 0.2.wait\n }\n}\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = List[1, 2, 3]\na.foldAt(2) // same as at\na.foldAt(3) // folds back\na.foldAt([-1, 3, 1]) // array of indices (returns not a list, but an array)\na@|@3 //syntactic shortcut\n\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n 32.do{ |i|\n {\n var freq = pitches.foldAt(i).midicps;\n var env = Env.perc.ar(Done.freeSelf);\n SinOsc.ar(freq) * 0.1 * env\n }.play;\n 0.2.wait\n }\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `LinRand` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-LinRand\", { |out = 0, minmax = 1|\n Out.ar(out,\n FSinOsc.ar(\n LinRand(200.0, 10000.0, minmax),\n 0, Line.kr(0.2, 0, 0.01, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n// towards hi\n(\nRoutine({\n loop({\n Synth.new(\"help-LinRand\"); 0.04.wait;\n })\n}).play;\n);\n\n// towards lo (doesn't work like that yet)\n(\nRoutine({\n loop({\n Synth.new(\"help-LinRand\", [\\minmax, -1]); 0.04.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is the difference between Env and EnvGen?"}, {"role": "assistant", "content": "Env is a language-side description: a list of levels, times and a curve, e.g. `Env.perc(0.01, 1)` or `Env.adsr(0.01, 0.1, 0.5, 0.8)`. EnvGen is the UGen that plays it on the server: `EnvGen.kr(env, gate, doneAction: 2)`. The same Env can be played by many EnvGens, and Env also has language-side uses such as `.asStream` inside Patterns and `.plot`."}]} +{"conversations": [{"role": "user", "content": "Explain `RedMixGUI` in SuperCollider briefly."}, {"role": "assistant", "content": "RedMixGUI — gui for RedMixMono, RedMixStereo, RedMixStereoMono gui for redMix objects. Category: Red > redMix."}]} +{"conversations": [{"role": "user", "content": "Explain `MIDIFuncChanMessageMatcher` in SuperCollider briefly."}, {"role": "assistant", "content": "MIDIFuncChanMessageMatcher — Matches incoming MIDI messages to responder funcs based on message channel This is used by MIDIMessageDispatcher to match incoming MIDI messages to instances of MIDIFunc or MIDIdef using MIDI channel. This class is private, and generally users should not need to address instances directly. Category: External Control > MIDI > Matchers."}]} +{"conversations": [{"role": "user", "content": "Strange offset behaviour when plotting some .kr uGens?"}, {"role": "assistant", "content": "SuperCollider forum — Strange offset behaviour when plotting some .kr uGens\n\nI’ve got a workaround for this now.\n\n```supercollider\ns.quit;\nServer.local.options.blockSize = 4;\ns.boot;\n\n{[\n LFTri.ar(s.sampleRate/2, 1, 2), // just to show where the samples are\n Impulse.ar(0), // audio rate impulse in correct place\n Impulse.kr(0), // control rate impulse with offset issue\n Trig1.kr(1, 0) // control rate impulse in correct place\n]}.plot(70/s.sampleRate);\n\n{[\n LFTri.ar(s.sampleRate/2, 1, 2), // just to show where the samples are\n Phasor.ar(Impulse.ar(0), 1/8, -2, 2, -0.625), // Phasor as it behaves in audio rate\n Phasor.kr(Impulse.kr(0), 1/2, -2, 2, -0.625), // Phasor as it behaves in control rate\n Phasor.kr(Impulse.kr(0), 1/2, -2, 2, -0.5) + (1.5 * Trig1.kr(1, 0)) // Phasor in control rate patched to match audio rate\n]}.plot(70/s.sampleRate)\n```\n\nI assume the problem is that the first control rate sample is meant to be more of a ‘sample -1’ than ‘sample 0’, hence why plot omits it when the output is at control rate. This would be fine if audio rate uGens started after one control period. Since they don’t, I’m happy to just adjust the code to make the subsequent samples correct, and then use ​ + (x * Trig1.kr(1, 0)) to patch the first sample. The only problem now is that it’s more complicated to do that with some other uGens."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `MantissaMask`."}, {"role": "assistant", "content": "```supercollider\n// preserve only 3 bits of mantissa.\n{ MantissaMask.ar(SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4), 3) }.play\n\n// the original\n{ SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4) }.play\n\n// the difference.\n(\n{\n var in;\n in = SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4);\n in - MantissaMask.ar(in, 3)\n}.play\n)\n\n\n// preserve 7 bits of mantissa.\n// This makes the lower 16 bits of the floating point number become zero.\n{ MantissaMask.ar(SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4), 7) }.play\n\n// the original\n{ SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4) }.play\n\n// the difference.\n(\n{\n var in;\n in = SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4);\n in - MantissaMask.ar(in, 7)\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Pdefn`?"}, {"role": "assistant", "content": "Pdefn — non event stream reference definition"}, {"role": "user", "content": "What does `Pdefn.all` do?"}, {"role": "assistant", "content": "A global IdentityDictionary with all proxies."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\nPdefn(\\x, Pbrown(0, 6, 0.1, inf));\nPbind(\\note, Pdefn(\\x), \\dur, 0.3).play;\nPbind(\\note, Pdefn(\\x), \\dur, 0.1, \\ctranspose, 15).play;\n// now change the definition\nPdefn(\\x, Pseq([0, 3, 5, 7, 9, 11], inf));\nPdefn(\\x, Pseq([0, 3, 3, 7], inf) + Pseq([0, [0, 3], [0, 5, 7]], inf));\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Compare:\n\n{ WhiteNoise.ar(0.25) }.play;\n\n{ LPZ2.ar(WhiteNoise.ar(0.25) }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Compare:\n\n{ WhiteNoise.ar(0.25) }.play;\n\n{ LPZ2.ar(WhiteNoise.ar(0.25)) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var trig;\n trig = Dust.kr(10);\n Pan2.ar(SinOsc.ar(\n TGaussRand.kr(300, 3000, trig)\n ),\n TGaussRand.kr(-1, 1, trig),\n 0.1\n )\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var trig;\n trig = Dust.kr(10);\n Pan2.ar(SinOsc.ar(\n TGaussRand.kr(300, 3000, trig)\n ),\n TGaussRand.kr(-1, 1, trig),\n 0.1\n )\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\nSynthDef(\"ReplaceOutHelp\", { |out = 0, freq = 440|\n var source;\n source = SinOsc.ar(freq, 0, 0.1);\n\n // write to the bus, replacing previous contents\n ReplaceOut.ar(out, source);\n\n}).add;\n);\n\n// each Synth replaces the output of the previous one\nx = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 500]);\ny = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 600]);\nz = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 700]);\n\n// release them in reverse order; the older Synths are still there.\nz.free;\ny.free;\nx.free;\n```"}, {"role": "assistant", "content": "write to the bus, replacing previous contents each Synth replaces the output of the previous one (ReplaceOut: Send signal to a bus, overwriting previous contents.)"}]} +{"conversations": [{"role": "user", "content": "What is `DebugFrame` in SuperCollider?"}, {"role": "assistant", "content": "DebugFrame — A representation of the call frame A representation of the call frame. Can be used to reconstruct a backtrace by using #-caller. Category: Core."}]} +{"conversations": [{"role": "user", "content": "How current is your SuperCollider knowledge?"}, {"role": "assistant", "content": "It comes from a snapshot of the SuperCollider repository (documentation, class library and examples) plus code I can reason about. So classes and arguments in that snapshot I know well, including argument order. Quarks, newer UGens, and anything outside the official tree I may not know at all, and I will say so rather than invent a method name. If you need certainty about a class, check its help page — `SinOsc.schelp` in the source tree is the authority."}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ var sig = SinOsc.ar(440) * 0.2; Out.ar(0, sig) }.play;\n```"}, {"role": "assistant", "content": "The minimal SynthDef idiom: a source multiplied by an amplitude, written to the master bus.\n\n`var sig = SinOsc.ar(440) * 0.2` builds the signal; `Out.ar(0, sig)` is the only mandatory part, because a\nUGen graph that never reaches an output produces no sound. `Out`'s first argument is the bus number — 0 is\nthe main stereo output — and the second is the signal. The function's return value does not matter here,\nwhich is why the `Out.ar` can sit on its own line. `.play` compiles this into an anonymous SynthDef and\nstarts one instance."}]} +{"conversations": [{"role": "user", "content": "What is `Pbind`?"}, {"role": "assistant", "content": "Pbind — combine several value patterns to one event stream by binding keys to values"}, {"role": "user", "content": "What does `Pbind.new` do?"}, {"role": "assistant", "content": "The arguments to Pbind are an alternating sequence of keys and patterns. `Pbind(\\note, Pseq([0, 4, 7]), \\amp, 0.1, \\dur, 0.2).play` The message `new` converts keyword arguments into key value pairs, so that we can write: `Pbind(note: Pseq([0, 4, 7]), amp: 0.1, dur: 0.2).play` A pattern can also be bound to an array of keys. In this case, the pattern must specify a sequence whose elements are array"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nPbind(\\note, Pseq([0, 4, 7]), \\amp, 0.1, \\dur, 0.2).play\n```"}]} +{"conversations": [{"role": "user", "content": "What is Ndef used for?"}, {"role": "assistant", "content": "Ndef is the JITLib node proxy: a named placeholder for a running signal chain that you can redefine while it plays. `Ndef(\\drone, { SinOsc.ar(55) * 0.1 }).play` starts it, and calling Ndef(\\drone, { ... }) again crossfades to the new definition without restarting the sound. It also supports chaining, `Ndef(\\drone)[1] = \\filter -> { |in| LPF.ar(in, 800) }`, which is the idiomatic way to build and modify a live patch."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Mix`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var n;\n n = 8; // number of 'voices'\n Mix.new( // mix all stereo pairs down.\n Pan2.ar( // pan the voice to a stereo position\n CombL.ar( // a comb filter used as a string resonator\n Dust.ar( // random impulses as an excitation function\n // an array to cause expansion of Dust to n channels\n // 1 means one impulse per second on average\n Array.fill(n, 1),\n 0.3 // amplitude\n ),\n 0.01, // max delay time in seconds\n // array of different random lengths for each 'string'\n Array.fill(n, {0.004.rand+0.0003}),\n 4 // decay time in seconds\n ),\n Array.fill(n,{1.0.rand2}) // give each voice a different pan position\n )\n )\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `LFClipNoise.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Clipped noise Arguments: freq — Approximate rate at which to generate random values.; mul — Output will be multiplied by this value.; add — This value will be added to the output.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n SinOsc.ar(\n Peak.ar(Dust.ar(20), Impulse.ar(0.4)) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// follow a sine lfo, reset rate controlled by mouse x\n(\n{\n SinOsc.ar(\n Peak.kr(SinOsc.kr(0.2), Impulse.kr(MouseX.kr(0.01, 2, 1))) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n SinOsc.ar(\n Peak.ar(Dust.ar(20), Impulse.ar(0.4)) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// follow a sine lfo, reset rate controlled by mouse x\n(\n{\n SinOsc.ar(\n Peak.kr(SinOsc.kr(0.2), Impulse.kr(MouseX.kr(0.01, 2, 1))) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n{Mix({|i|var j=Impulse,t=TChoose.kr(j.kr(1/8),[1,6,3]/8),r=Ringz.ar(j.ar(i*t+0.25),600*t*i+[0,9]);CombC.ar(r,1,0.5,4,0.1,r)}!4).tanh/4}.play\n```"}, {"role": "assistant", "content": "Hi colliders, this is my first post here, and also my very first sc tweet! \r\nIt's nothing special, just a little rhythmic Ringz thingy...\r\nAs a beginner, I found this really useful getting the hang of some syntax shortcuts:\r\nhttp://schemawound.com/post/25710867587/supercollider-tweets-background-tips."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nSynthDef(\\madtraffic, {|out, sig, gate=1, freq=440|\n // doneAction: 2 rilascia la synth quando EvnGen ha finito\n sig = (Blip.ar(freq)*0.7+Blip.ar(freq/2+Rand(1,12))*0.7)\n*EnvGen.kr(Env.asr(0.1, 0.3, 0.3), gate, doneAction:2);\n sig = RLPF.ar(sig,SinOsc.kr(0.3, 0, 200, 1500), 0.1);\n sig = FreeVerb.ar(sig, 0.5, 0.5, 0.5);\n Out.ar(out, sig);\n\n}).add;\n);\n\n(\nPbind(\n \\instrument, \\madtraffic,\n \\freq, Pseq([137, 373, Prand([237, 473, 713],1)], inf),\n \\legato, Pseq([1.7, 0.3], inf),\n \\dur, 0.3,\n \\out, Pseq([1, 0], inf)\n).play;\n)\n```"}, {"role": "assistant", "content": "\"It's the lack of eye contact that makes us more idiots, to the point that convertible riders give less to escalation. Closed in the car, explain the psychologists, we regress to childhood and react by shouting, or with that surrogate of the shock that is the horn.\"\r\n\r\n\r\n\r\nhttp://bz-buzz.blogspot.com/2018/09/mad-traffic.html\r\n\r\nhttp://bzakirasantjago.blogspot.it/."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `ReplaceOut` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// ... a reverb adapted from the \"01 Why SuperCollider document\" in the SC2 distribution\n(\nSynthDef(\"preDelay\", { arg inbus = 2;\n ReplaceOut.ar(\n 4,\n DelayN.ar(In.ar(inbus, 1), 0.048, 0.048)\n )\n}).add;\n\nSynthDef(\"combs\", {\n ReplaceOut.ar(\n 6,\n Mix.arFill(7, { CombL.ar(In.ar(4, 1), 0.1, LFNoise1.kr(Rand(0, 0.1), 0.04, 0.05), 15) })\n )\n}).add;\n\nSynthDef(\"allpass\", { arg gain = 0.2;\n var source;\n source = In.ar(6, 1);\n 4.do({ source = AllpassN.ar(source, 0.050, [Rand(0, 0.05), Rand(0, 0.05)], 1) });\n ReplaceOut.ar(\n 8,\n source * gain\n )\n}).add;\n\nSynthDef(\"theMixer\", { arg gain = 1;\n ReplaceOut.ar(\n 0,\n Mix.ar([In.ar(2, 1), In.ar(8, 2)]) * gain\n )\n}).add;\n);\n\n(\nSynth(\"fm1\", [\\bus, 2, \\freq, 440, \\carPartial, 1, \\modPartial, 1.99, \\mul, 0.071]);\nSynth(\"fm1\", [\\bus, 2, \\freq, 442, \\carPartial, 1, \\modPartial, 2.401, \\mul, 0.071]);\nSynth.tail(s, \"preDelay\");\nSynth.tail(s, \"combs\");\nSynth.tail(s, \"allpass\");\nSynth.tail(s, \"theMixer\", [\\gain, 0.64]);\n);\n\n(\ns.queryAllNodes;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `Nil` in SuperCollider briefly."}, {"role": "assistant", "content": "Nil — Represents uninitialized data Nil has a single instance named `nil` and is used to represent uninitialized data, bad values, or terminal values such as end-of-stream. Internally, `nil` also serves as a sentinel value, used to mark empty or unoccupied slots in hash-based data structures such as `Set`, and its subclasses. Because of this internal role, `nil` —despite being a valid object— cannot be stored as an element in `Set` Category: Core."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `DelayN` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// これは(SC2の配布物の中の)\"01 Why SuperCollider document\"からのリバーブ\n(\nSynthDef(\"preDelay\", { arg inbus = 2;\n Out.ar(\n 4,\n DelayN.ar(In.ar(inbus, 1), 0.048, 0.048)\n )\n}).add;\n\nSynthDef(\"combs\", {\n Out.ar(\n 6,\n Mix.arFill(7, { CombL.ar(In.ar(4, 1), 0.1, LFNoise1.kr(Rand(0, 0.1), 0.04, 0.05), 15) })\n )\n}).add;\n\nSynthDef(\"allpass\", { arg gain = 0.2;\n var source;\n source = In.ar(6, 1);\n 4.do({ source = AllpassN.ar(source, 0.050, [Rand(0, 0.05), Rand(0, 0.05)], 1) });\n Out.ar(\n 8,\n source * gain\n )\n}).add;\n\nSynthDef(\"theMixer\", { arg gain = 1;\n Out.ar(\n 0,\n Mix.ar([In.ar(2, 1), In.ar(8, 2)]) * gain\n )\n}).add;\n);\n\n(\nSynth(\"fm1\", [\\bus, 2, \\freq, 440, \\carPartial, 1, \\modPartial, 1.99, \\mul, 0.071]);\nSynth(\"fm1\", [\\bus, 2, \\freq, 442, \\carPartial, 1, \\modPartial, 2.401, \\mul, 0.071]);\nSynth.tail(s, \"preDelay\");\nSynth.tail(s, \"combs\");\nSynth.tail(s, \"allpass\");\nSynth.tail(s, \"theMixer\", [\\gain, 0.64]);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Pmulp` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\freq, Pseq([500, 600, 700]), \\instrument, \\sinegrain);\na = Pmulp(\\freq, Pseq([0.5, 0.9, 0.8], inf), a);\na.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Harmonics`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\na.ramp(1.0, 1.0); // returns a harmonic series\n\nb = Buffer.alloc(s, 512, 1);\n// harmonic series for freqs, ramp down for amps\nb.sine2(a.ramp(1.0, 1.0).postln, a.ramp(0.5, -0.025).postln, true, true, true);\n(\nz = SynthDef(\"help-Osc\", { |out = 0, bufnum = 0|\n Out.ar(out,\n Osc.ar(bufnum, 200, 0, 0.5)\n )\n});\n);\ny = z.play(s, [\\out, 0, \\bufnum, b]);\ny.free;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Ndef\nNdef(\\a, { Saw.ar(12) }).asCode;\n\n// in a pushed proxy space\np = ProxySpace.push(s.boot);\n~x = { Saw.ar(123, 0.1 };\n~x.play;\n~x.asCode;\n\np.end.pop;\n\n// anonymous nodeproxy also posts instructions:\nx = NodeProxy.new.source = { DC.ar };\nx.asCode;\n\nx.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Ndef\nNdef(\\a, { Saw.ar(12) }).asCode;\n\n// in a pushed proxy space\np = ProxySpace.push(s.boot);\n~x = { Saw.ar(123, 0.1) };\n~x.play;\n~x.asCode;\n\np.end.pop;\n\n// anonymous nodeproxy also posts instructions:\nx = NodeProxy.new.source = { DC.ar };\nx.asCode;\n\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// 2012.05.04\n// Work for NX014 Class\n// Inspiration: A Rukano Tweet. Thanks rukano!\n// Comment: Cosmic Organ.\n\np = ProxySpace.push(s.boot);\n\n~a.play;\n\n~a = { var alpha,gamma;\n alpha= LFNoise2;\n gamma= {[rrand(30,50),rrand(50,70),rrand(50,70),rrand(70,100)].choose.midicps*alpha.kr(1,0.01,1)}!24;\n Pan2.ar(LeakDC.ar(Normalizer.ar(\n BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(FreeVerb.ar(\n Splay.ar(RLPF.ar(LFSaw.ar(gamma)/4,gamma*LFCub.kr(rrand(0.01,0.1),0,2,3),alpha.kr(1/8,0.6,0.7))) \n ,0.1,0.1,0.1)\n ,100,6.0,6),1000,6.0,0),5000,6.0,0),10000,6.0,6)\n ,(0.8/0.999)*1,0.1)),0)\n};\n\n~a = nil;\n```"}, {"role": "assistant", "content": "A cosmic organ with a inspiration of rukano tweet. Thanks rukano!."}]} +{"conversations": [{"role": "user", "content": "Can I run SuperCollider without the IDE?"}, {"role": "assistant", "content": "Yes. `sclang` runs the language and `scsynth` the server, and they are separate processes by design\n— the IDE is only a client. A headless script is a `.scd` run with `sclang my-piece.scd`, and it must boot\nthe server itself:\n\n```supercollider\ns.boot;\ns.waitForBoot {\n // build SynthDefs, play, then wait\n 30.wait;\n s.quit;\n};\n```\n\nThat shape — boot, wait, play, quit, exit — is what makes a piece runnable from a cron job or a\nRaspberry Pi."}]} +{"conversations": [{"role": "user", "content": "What is `CondVar`?"}, {"role": "assistant", "content": "CondVar — Condition variable: block one or more threads until some condition is true"}, {"role": "user", "content": "What does `CondVar.wait` do?"}, {"role": "assistant", "content": "The behavior depends on whether a `predicate` is given. If no `predicate` is given, this method simply blocks the current thread until it is woken by `signalOne` or `signalAll`. Otherwise, this method is equivalent to `while { predicate.value.not } { cond.wait }`. In other words, the thread only blocks if the predicate is false, otherwise it blocks and only resumes once the thread has been signall"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nc = CondVar();\n\nRoutine {\n 1.wait;\n \"waited for 1 second\".postln;\n 1.wait;\n \"waited for another second, now waiting for you to run 'c.signalOne'...\".postln;\n c.wait;\n \"the condition is no longer waiting\".postln;\n 1.wait;\n \"waited for another second, now waiting for you...\".postln;\n c.wait;\n \"the condition is no longer waiting\".postln;\n 1.wait;\n \"the end\".postln;\n}.play;\n);\n\n// Run this line to unblock the routine\nc.signalOne;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Env`."}, {"role": "assistant", "content": "```supercollider\n// an envelope in a synth\n(\n{\n var env = Env([0, 1, 0.5, 1, 0], [0.01, 0.5, 0.02, 0.5]);\n SinOsc.ar(470) * EnvGen.kr(env, doneAction: Done.freeSelf)\n}.play\n);\n// an envelope to control a parameter in a pattern\n(\nPbind(\n \\note, Env([0, 12, 6, 13, 0], [1, 5, 2, 10]),\n \\dur, 0.1\n).play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n//code that utilizes the glitch.\n(\ns.waitForBoot{\n SynthDef(\\birdy, {|out= 0, amp= 0.1, freq= 1000, atk= 0.01, rel= 0.05, cur= -4, gate= 1|\n var env= EnvGen.kr(Env.asr(atk, 1, rel, cur), gate, doneAction:2);\n var src= SinOsc.ar(0.11, GlitchBRF.ar(SinOsc.ar(SinOsc.ar(0.12).exprange(1, freq), 2pi), 1/SinOsc.ar(0.13).range(1, #[99, 100])));\n Out.ar(out, Limiter.ar(LeakDC.ar(src*amp)));\n }).add\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n//code that utilizes the glitch.\n(\ns.waitForBoot{\n SynthDef(\\birdy, {|out= 0, amp= 0.1, freq= 1000, atk= 0.01, rel= 0.05, cur= -4, gate= 1|\n var env= EnvGen.kr(Env.asr(atk, 1, rel, cur), gate, doneAction:2);\n var src= SinOsc.ar(0.11, GlitchBRF.ar(SinOsc.ar(SinOsc.ar(0.12).exprange(1, freq), 2pi), 1/SinOsc.ar(0.13).range(1, #[99, 100])));\n Out.ar(out, Limiter.ar(LeakDC.ar(src*amp)));\n }).add;\n s.sync;\n Synth(\\birdy, [\\amp, 0.15]);\n};\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `AbstractPlayer.annotate` do? What arguments does it take?"}, {"role": "assistant", "content": "the base class for all Players : a playable object Arguments: thing; note."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `InFeedback`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-InFeedback\", { |out = 0, in = 0|\n Out.ar(out,\n InFeedback.ar(in, 1)\n );\n}).add;\nSynthDef(\"help-SinOsc\", { |out = 0, freq = 440|\n Out.ar(out, SinOsc.ar(freq, 0, 0.1))\n}).add;\n);\n\nx = Bus.audio(s, 1);\n\n// read from bus n play to bus 0 (silent)\na = Synth(\"help-InFeedback\", [\\in, x.index, \\out, 0]);\n\n// now play a synth after this one, playing to bus x\nb = Synth.after(a, \"help-SinOsc\", [\\out, x.index]);\n\n// add another synth before a which also writes to bus x\n// now you can't hear b, as its data is one cycle old, and is overwritten by c\nc = Synth.before(a, \"help-SinOsc\", [\\out, x.index, \\freq, 800]);\n\n// free c and you can hear b again\nc.free;\nx.free;\n\na.free; b.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What is rq in BPF.ar?"}, {"role": "assistant", "content": "rq is the reciprocal of Q, so it is a bandwidth control, not a Q control. Small rq means a narrow, resonant band; large rq means a wide, gentle one. The signature is `BPF.ar(in, freq, rq, mul, add)`. A common idiom is `rq = 0.3` for a broad sweep and `rq = 0.02` for a whistle. The same rq convention applies to RLPF and RHPF."}]} +{"conversations": [{"role": "user", "content": "Explain `SpectralEntropy` in SuperCollider briefly."}, {"role": "assistant", "content": "SpectralEntropy — Spectral feature extraction Spectral Entropy, with a choice of number of sub-bands. If one band, a measure of general peakiness of the spectral distribution. Category: UGens > Analysis."}]} +{"conversations": [{"role": "user", "content": "What is `Plotter`?"}, {"role": "assistant", "content": "Plotter — Plot numerical data on a window or view"}, {"role": "user", "content": "What does `Plotter.plotGraph` do?"}, {"role": "assistant", "content": "`{ |x| sin(x) }.plotGraph(300, 0, 2*pi);`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\na = { (0..10).scramble.normalize }.dup(2).plot;\na.editMode = true;\na.editFunc = { |...args| args.postln };\n);\n\n// using plotter as a control interface\n(\na = { (0..10).scramble.normalize(300, 400) }.dup.plot;\na.specs = \\freq; a.plotMode = \\bars;\na.editMode = true;\nx = {\n var phase = SinOsc.ar(\\rate.kr(a.value[1]));\n SinOsc.ar(\\freq.kr(a.value[0]), phase).mean * 0.1\n}.play;\na.editFunc = { |plotter, plotIndex, i, val|\n x.setn(\\freq, a.value[0]);\n x.setn(\\rate, a.value[1]);\n};\na.parent.onClose = { x.release };\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n(\n// Function to check an array for repetitions within a maximum test span\n\n~repetitionCheck = { |array, maxTestSpan|\n maxTestSpan.do { |i|\n var result = (array.drop(i+1) - array).drop((i+1).neg).includes(0).not;\n (\"no repetitions within a span of \" ++ (i+2).asString ++ \" items: \").post;\n result.postln;\n }\n};\n\n// prepare buffer to store DIdev values \n\nn = 10000; // buffer size\nr = 10000; // trigger rate\nb = Buffer.alloc(s, n);\n);\n\n\n// run to store, wait until finished (a bit more than 1 second)\n(\n{\n var trig = Impulse.ar(r);\n D\n// …\n```"}, {"role": "assistant", "content": "Function to check an array for repetitions within a maximum test span prepare buffer to store DIdev values (DIdev: pseudo drate ugen, searches for numbers with integer distance from a source signal, optionally avoiding repetitions within a span)"}]} +{"conversations": [{"role": "user", "content": "Explain `AbstractConsole` in SuperCollider briefly."}, {"role": "assistant", "content": "AbstractConsole — abstract parent class for the console widgets Category: Libraries > crucial > GUI > abstract."}]} +{"conversations": [{"role": "user", "content": "What is `CutBuf3` in SuperCollider?"}, {"role": "assistant", "content": "CutBuf3 — BBCut2 buffer playback with modulatable grain parameters Playback for a segmented buffer, with individual grains spawned for each event. Cuts play back any events within their scope. The scheduling system for bbcut2 takes account of groove based time deviations from quantised template positions for the events, and perceptual attack times. Note that FX units may switch exactly on the cuts, which may or may not match up with the event playback. There are Category: Libraries > BBCut > Cut synths."}]} +{"conversations": [{"role": "user", "content": "Explain `RedTest` in SuperCollider briefly."}, {"role": "assistant", "content": "RedTest — generate test signals Category: Red > redTest."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `StandardN`."}, {"role": "assistant", "content": "```supercollider\n// mouse-controlled param\n{ StandardN.ar(SampleRate.ir/2, MouseX.kr(0.9, 4)) * 0.3 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What is SuperCollider?"}, {"role": "assistant", "content": "SuperCollider is a platform for audio synthesis and algorithmic composition, written in C++ and SuperCollider. It splits into a language client (sclang) that runs your code and builds UGen graphs, and an audio server (scsynth) that does the DSP in real time. They talk over OSC."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// fadeTimes should be above blockSize\n// for shorter grains you can use smaller blocksizes\n\n(\ns.options.blockSize = 2;\ns.reboot;\n);\n\n// as the effect is AM on single outs we get side bands\n\n(\ns.doWhenBooted {\n x = {\n var lfo = LFDNoise3.ar(0.2);\n DXFan.ar(\n Dseq((0..7), inf),\n SinOsc.ar(lfo.range(800, 1500), 0, 0.03),\n size: 8,\n fadeTime: 0.0002\n )\n }.play\n};\n);\n\nx.release\n\n\n// go back to default\n\n(\ns.options.blockSize = 64;\ns.reboot;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// fadeTimes should be above blockSize\n// for shorter grains you can use smaller blocksizes\n\n(\ns.options.blockSize = 2;\ns.reboot;\n);\n\n// as the effect is AM on single outs we get side bands\n\n(\ns.doWhenBooted {\n x = {\n var lfo = LFDNoise3.ar(0.2);\n DXFan.ar(\n Dseq((0..7), inf),\n SinOsc.ar(lfo.range(800, 1500), 0, 0.03),\n size: 8,\n fadeTime: 0.0002\n )\n }.play\n};\n);\n\nx.release\n\n\n// go back to default\n\n(\ns.options.blockSize = 64;\ns.reboot;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BufSamples`."}, {"role": "assistant", "content": "```supercollider\n// example; this buffer is mono, so the number of samples matches the number of frames\nb = Buffer.read(s, ExampleFiles.child);\n\n// indexing with a phasor\n{ BufRd.ar(1, b, Phasor.ar(0, BufRateScale.kr(b), 0, BufSamples.kr(b))) }.play;\n\n// indexing by hand\n{ BufRd.ar(1, b, K2A.ar(MouseX.kr(0, BufSamples.kr(b)))) }.play;\n\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ DynKlank.ar(`[[800, 1071, 1153, 1723], nil, [1, 1, 1, 1]], Impulse.ar(2, 0, 0.1)) }.play;\n\n{ DynKlank.ar(`[[800, 1071, 1353, 1723], nil, [1, 1, 1, 1]], Dust.ar(8, 0.1)) }.play;\n\n{ DynKlank.ar(`[[800, 1071, 1353, 1723], nil, [1, 1, 1, 1]], PinkNoise.ar(0.007)) }.play;\n\n{ DynKlank.ar(`[[200, 671, 1153, 1723], nil, [1, 1, 1, 1]], PinkNoise.ar([0.007, 0.007]) }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ DynKlank.ar(`[[800, 1071, 1153, 1723], nil, [1, 1, 1, 1]], Impulse.ar(2, 0, 0.1)) }.play;\n\n{ DynKlank.ar(`[[800, 1071, 1353, 1723], nil, [1, 1, 1, 1]], Dust.ar(8, 0.1)) }.play;\n\n{ DynKlank.ar(`[[800, 1071, 1353, 1723], nil, [1, 1, 1, 1]], PinkNoise.ar(0.007)) }.play;\n\n{ DynKlank.ar(`[[200, 671, 1153, 1723], nil, [1, 1, 1, 1]], PinkNoise.ar([0.007, 0.007])) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `TextView.defaultGetDrag` do?"}, {"role": "assistant", "content": "A view displaying editable formatted text Returns: The #-selectedString."}]} +{"conversations": [{"role": "user", "content": "What does `IBVAplayer.play` do? What arguments does it take?"}, {"role": "assistant", "content": "start playing back data (this will mute and take over input from the serial Arguments: rate — playback rate. e.g. 2=double speed; repeats — number of times to loop. e.g. inf=infinite; action — a Function that will be evaluated when finished playing."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LinCongL`."}, {"role": "assistant", "content": "```supercollider\n// default initial params\n{ LinCongL.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for exploring of morphing cycled envelopes (i.e: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\ro_v19, {\n var freq = 40.rrand(90).debug('base freq');\n var seed = thisThread.randSeed = 1000000000.rand.debug('seed');\n var gen = [LFNoise2,LFNoise0,SinOsc,LFPulse,LFSaw];\n var sig = Splay.ar({\n var i = 4.exprand(40).asInteger;\n Median.ar(\n 3.exprand(18),\n EnvGen.ar(\n Env( // wave form\n [0] ++ Array.fill(i-1, { \n gen.choose.kr(\n 0.25.coin.if({ gen.choose.kr(0.01.exprand(0.1)).exprange(0.1,1) }, { 0.1.exprand(1) }), \n mul: 0.25.coin.if({ gen.choose.kr(0.05.exprand(10)).range(0.1,1) }, { 0.1.rrand(1) })\n )\n }) ++ [0],\n Array.rand(i-1, 0.1,1.0).normalizeSum,\n [[-5.0.rrand(5),\\sin].choose] ++ Array.fill(i-2, {\n [\\sin ! 1.rrand(6), -5.0.rrand(5) ! 1.rrand(4)].flat.choose\n }) ++ [[-5.0.rrand(5),\\sin].choose]\n ).circle,\n timeScale: Duty.kr( // freq\n Drand([4,8,16,24], inf), 0,\n Dwrand([1,2,4,8,16,32,64]*freq, ((14..7) ** 1.rrand(3)).normalizeSum, inf) // octave\n * 0.75.coin.if({ Duty.kr( // note\n [Dxrand, Drand].choose.new([0.125,0.25,0.5,1,2,4,6,8,12], inf), 0,\n Dshuf({ (0..11).choose.midiratio } ! 1.exprand(8), inf)\n ) }, { (0..11).choose.midiratio })\n ).reciprocal\n )\n ) * EnvGen.kr( // rhythm\n Env.perc(\n 0.01.exprand(0.4) * 0.25.coin.if({ Duty.kr( // atk\n Drand([0.5,1,2,4,8,12,16], inf), 0,\n Dshuf({ [1,2,3,4].choose } ! 1.exprand(8), inf)\n ) }, { 1 }),\n 0.1.exprand(4) * 0.75.coin.if({ Duty.kr( // release\n Drand([0.5,1,2,4,8,12,16], inf), 0,\n Dshuf({ [1,2,4,8,16].choose.reciprocal } ! 1.exprand(8), inf)\n ) }, { 1 }),\n LFNoise2.kr(0.1.exprand(10)).range(0.05,1), // appearance\n LFNoise2.kr(0.1.exprand(10)).range(-4,4),\n ).circle\n );\n } ! 3.rrand(9).debug('source'));\n BHiShelf.ar(\n GVerb.ar(\n Rotate2.ar(sig[0], sig[1], Duty.kr(Drand([2,4,8],inf), 0, Drand([-1,1,0],inf)) * LFSaw.kr(0.1.exprand(1))),\n 40.rrand(150).debug('room')\n ),\n LFNoise2.kr(0.1.exprand(0.5)).range(4000,6500),\n LFNoise2.kr(0.1.exprand(1)).range(1,3),\n LFNoise2.kr(0.1.exprand(1)).range(-24,-16)\n );\n}).play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Latency`?"}, {"role": "assistant", "content": "Latency — Measure audio latency for multiple channels"}, {"role": "user", "content": "What does `Latency.testAudio` do?"}, {"role": "assistant", "content": "main method to measure audio latency"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// server has hardwareBufferSize 512 for this example.\ns.options.hardwareBufferSize = 512; s.reboot;\n// do something that sends messages with server latency\nPbind(\\degree, Pbrown(-14, 14, 3), \\dur, 1/8).play;\ns.latency;\ns.latency = 0.1; // tune down ...\ns.latency = 0.05;\ns.latency = 0.025;\ns.latency = 0.012; // ... until every message posts \"late 0.01....\" now\ns.latency = 0.018; // go back up -> fewer late messages\ns.latency = 0.021; // go back up until ...\ns.latency = 0.024; // late messages are completely gone again\n\ns.latency = 0.03; // this works on many systems\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n SinOsc.ar(\n RunningMax.ar(Dust.ar(20), Impulse.ar(0.4)) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// follow a sine lfo, reset rate controlled by mouse x\n(\n{\n SinOsc.ar(\n RunningMax.kr(SinOsc.kr(0.2), Impulse.kr(MouseX.kr(0.01, 2, 1))) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n SinOsc.ar(\n RunningMax.ar(Dust.ar(20), Impulse.ar(0.4)) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// follow a sine lfo, reset rate controlled by mouse x\n(\n{\n SinOsc.ar(\n RunningMax.kr(SinOsc.kr(0.2), Impulse.kr(MouseX.kr(0.01, 2, 1))) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// connect will connect to all midi in devices\n// if you need to specify one,\n// check the sources at: MIDIClient.sources\n// and connect using MIDIIn.connect( source_index )\nMIDIIn.connect;\n\n// show incoming control data\n~control = { arg src, chan, num, val; \n [chan,num,val].postln; \n};\n\nMIDIIn.addFuncTo(\\control, ~control);\n```"}, {"role": "assistant", "content": "Simple example showing how to listen for MIDI control messages."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Lorenz2DN.ar(11025, 44100) }.play(s);\n\n// randomly modulate params\n(\n{ Lorenz2DN.ar(\n 11025, 44100,\n LFNoise0.kr(1, 2, 10),\n 20,\n LFNoise0.kr(1, 1.5, 2),\n 0.02\n) * 0.2 }.play(s);\n)\n\n// as a frequency control\n{ SinOsc.ar(Lorenz2DN.ar(40, 80, h:0.02)*800+900)*0.4 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Lorenz2DN.ar(11025, 44100) }.play(s);\n\n// randomly modulate params\n(\n{ Lorenz2DN.ar(\n 11025, 44100,\n LFNoise0.kr(1, 2, 10),\n 20,\n LFNoise0.kr(1, 1.5, 2),\n 0.02\n) * 0.2 }.play(s);\n)\n\n// as a frequency control\n{ SinOsc.ar(Lorenz2DN.ar(40, 80, h:0.02)*800+900)*0.4 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// if NTMI.helloSnd is not already defined in startup file, do this:\nfork {\n NTMI.numChans.do { |i|\n { LFDNoise3.ar(\n XLine.kr(\n exprand(2000, 5000),\n exprand(2000, 20000),\n 0.25, doneAction: 2),\n 0.1\n )\n }.play(outbus: i);\n 0.25.wait;\n };\n}\n```"}, {"role": "assistant", "content": "if NTMI.helloSnd is not already defined in startup file, do this:."}]} +{"conversations": [{"role": "user", "content": "Write an FM bell in SuperCollider."}, {"role": "assistant", "content": "PMOsc is phase modulation: a non-integer modulator ratio gives the inharmonic clang.\n\n```supercollider\n(\nSynthDef(\\fmBell, { |out = 0, freq = 440, amp = 0.2, dur = 4|\n var index = EnvGen.kr(Env([8, 0.2], [dur], -4));\n var sig = PMOsc.ar(freq, freq * 1.4, index, 0, 1);\n var env = EnvGen.kr(Env.perc(0.002, dur, 1, -5), doneAction: 2);\n Out.ar(out, Pan2.ar(sig * env * amp, 0));\n}).add;\n);\nSynth(\\fmBell, [\\freq, 550]);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `AbstractConsole.addToLayout` do? What arguments does it take?"}, {"role": "assistant", "content": "abstract parent class for the console widgets Arguments: moreFunc."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(//*********PREPARE**********\np.pop;\n//Any code that needs to access your own environment goes here\np = ProxySpace.push(s);\n~fxLoop.play.fadeTime_(5);\n);\n\n(//*********FXLoop**********\n~fxLoop = {\n var in = SoundIn.ar([0,1]);\n // in = in + (in * SinOsc.ar(LFTri.ar([0.1, 0.09]).range(215, 321)));\n in = in + CombC.ar(in, 2, SinOsc.ar(0.015).range(0.5, 1) * [0.13, 0.17], 7);\n in = in + CombC.ar(in, 2, SinOsc.ar(0.01).range(0.5, 1) * [0.1, 0.15], 7);\n in = in + CombC.ar(in, 2, [1.5, 1.0], 7);\n in = in + GVerb.ar(in, 10);\n in = in / 3;\n in;\n}\n)\n```"}, {"role": "assistant", "content": "Audio Sample: https://soundcloud.com/schemawound/supercollider-guitar-fx-test."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LatoocarfianC`."}, {"role": "assistant", "content": "```supercollider\n// randomly modulate all params\n(\n{ LatoocarfianC.ar(\n SampleRate.ir/4,\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 1.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5),\n LFNoise2.kr(2, 0.5, 1.5)\n) * 0.2 }.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Pmulp`."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\freq, Pseq([500, 600, 700]), \\instrument, \\sinegrain);\na = Pmulp(\\freq, Pseq([0.5, 0.9, 0.8], inf), a);\na.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `TempoPlayer` in SuperCollider?"}, {"role": "assistant", "content": "TempoPlayer — a control rate player that plays the TempoBus [which is the current Tempo] Outputs the current tempo in beats per seconds. All TempoPlayers share the same TempoBus, and so don't incur any additional resources. Category: Libraries > crucial > Players, Libraries > crucial > Scheduling."}]} +{"conversations": [{"role": "user", "content": "Explain `RedLSystem` in SuperCollider briefly."}, {"role": "assistant", "content": "RedLSystem — rewrite strings A simple string rewrite class. Category: Red > redUniverse > additional."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// crucial-library - sends midi clock and song position pointer\n// x.add( MIDIClockOut(\"IAC Driver\", \"IAC Bus 1\") )\n\nMxUnit.register('MIDIClockOut',\n(\n make: { arg mco;\n ~source = mco;\n MxUnit(mco, [], [])\n },\n spawnToBundle: { arg b;\n b.addFunction({~source.start}.inEnvir)\n },\n stopToBundle: { arg b;\n b.addFunction({~source.stop}.inEnvir)\n }\n /*,\n gotoBeat: { arg beat, atBeat, bundle;\n [beat, atBeat, bundle].debug;\n ~source.gotoBeatAtBeat(beat, atBeat)\n }*/\n\n));\n```"}, {"role": "assistant", "content": "crucial-library - sends midi clock and song position pointer x.add( MIDIClockOut(\"IAC Driver\", \"IAC Bus 1\") )."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n var mod = SinOsc.ar([0.1,0.15,0.2]).range(0,1);\n var saw = LFSaw.ar([10,12,15]);\n var out = (saw - ((saw>0)*mod)+(mod*0.5));\n Splay.ar(out)*0.4;\n}.play;\n\n{\n var mod = SinOsc.ar([0.1,0.15,0.2]).range(0,1);\n var saw = SinOsc.ar(LFSaw.ar([10,12,15]).range(200,300));\n var out = (saw - ((saw>0)*mod)+(mod*0.5));\n Splay.ar(out)*0.4;\n}.play\n)\n```"}, {"role": "assistant", "content": "Made with code from Jonatan Liljedahl and Glen Fraser. Based on the Korg Z1 sawtooth oscilator."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `NamedControl` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// compare this:\n(\na = {\n var x, y;\n x = NamedControl.kr(\\freq, 440).lag(3.5);\n y = NamedControl.kr(\\freq, 440).lag(1);\n SinOsc.ar([x, y] * [2, 1.2]) * 0.1\n}.play;\n);\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n\n// to this:\n(\na = {\n var x, y;\n x = Control.names([\\freq]).kr(440).lag(3.5);\n y = Control.names([\\freq]).kr(440).lag(1); // this hangs when set\n SinOsc.ar([x, y] * [2, 1.2]) * 0.1\n}.play;\n);\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var a = SinOsc.ar(1).round(0.1);\n var b = SinOsc.ar(1.2).round(0.1);\n BinaryOpUGen('==', a, b) * 0.1\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var a = SinOsc.ar(1).round(0.1);\n var b = SinOsc.ar(1.2).round(0.1);\n BinaryOpUGen('==', a, b) * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for SOUND 1, from orig Influx Example. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n// SOUND 1, from orig Influx Example\n(\n// // // if JITLibExtensions are used, you can make space local:\n// Ndef(\\dog).addSpec(\\intv, [-24, 24]);\n// Ndef(\\dog).addSpec(\\timescale, [0.01, 10, \\exp]);\n// Ndef(\\dog).addSpec(\\curve, [-10, 10]);\n// Ndef(\\dog).addSpec(\\ffreq, \\freq);\n//\n// Ndef(\\dog).addSpec(\\loopnode, [0, 12]);\n// Ndef(\\dog).addSpec(\\dens, [10, 1000, \\exp]);\n// Ndef(\\dog).addSpec(\\resfreq, \\freq);\n// Ndef(\\dog).addSpec(\\ringtime, [0.01, 1, \\exp]);\n\nSpec.add(\\intv, [-24, 24]);\nSpec.add(\\timescale, [0.01, 10, \\exp]);\nSpec.add(\\curve, [-10, 10]);\nSpec.add(\\ffreq, \\freq);\n\nSpec.add(\\loopnode, [0, 12]);\nSpec.add(\\dens, [10, 1000, \\exp]);\nSpec.add(\\resfreq, \\freq);\nSpec.add(\\ringtime, [0.01, 1, \\exp]);\n\n\nNdef(\\dog, { |amp=0, freq=250, intv=19, timescale=1, curve=0, loopnode=0, dens = 10, resfreq = 500, ringtime = 0.01|\n var n = 15;\n var env = EnvGen.kr(\n Env({ 1.0.rand2 }!(n+1), {1.0.rand}!n, curve, releaseNode: n-1, loopNode: loopnode.min(n-3)),\n timeScale: timescale);\n var pitch = (env * [1, 0.33, -1] * intv).midiratio * freq;\n var form = Formant.ar(pitch, pitch.rotate(1) * 1.6, pitch.rotate(2) * 2.6);\n\n var dusty = Ringz.ar(\n Dust.ar(dens!3),\n resfreq * LFNoise0.kr([3, 5, 7], 0.5, 1),\n ringtime)\n * ((dens ** -0.5) * (ringtime ** -0.3)\n );\n\n Splay.ar(form * dusty, level: amp) ;\n});\n);\n\nNdef(\\dog).set(\\amp, 0.2).vol_(0.2);\nNdef(\\dog).gui.moveTo(400, 380);\n\n/*\n// Ndef(\\dog).addHalo(\\orderedNames, Ndef(\\dog).controlKeys);\nNdef(\\dog).controlKeys;\nNdef(\\dog).vol_(0.5);\nNdefPreset( Ndef(\\dog) ).loadSettings;\nNdef(\\dog).play;\nNdef(\\dog).gui;\n*/\n```"}]} +{"conversations": [{"role": "user", "content": "Supernova, Groups, Threads, Ndef?"}, {"role": "assistant", "content": "SuperCollider forum — Supernova, Groups, Threads, Ndef?\n\nAbout Ndef:\n\nAFAIK you can manually move a NodeProxy’s group into another group:\n\n```supercollider\n~pargroup = ParGroup(s);\n\nNdef(\\a, { Silent.ar(1) });\n\nNdef(\\a).group.moveToHead(~pargroup);\n```\n\nBut...\n\nNodeProxies use InFeedback.\n\nI was a little suspicious about this for parallel processing. As I recalled, InFeedback’s result depends on the order of execution:\n\n-\nIf the source node for the bus finished processing before the server reaches InFeedback, then InFeedback will output the block of audio being processed now.\n\n-\nIf the source node comes after the node containing InFeedback, then it will output the previous block of audio.\n\nIn both cases, these are the most recently available audio blocks. But, if the order of evaluation is not consistent, then the output may not be consistent.\n\nLet’s test that:\n\n```supercollider\nb = Bus.audio(s, 1);\n\na = { SinOsc.ar(200, 0, 0.1) }.play(outbus: b);\n\nc = { InFeedback.ar(b, 1).dup }.play(target: a, addAction: \\addAfter);\n\n(\nfork {\n var order = Pseq([\\moveBefore, \\moveAfter], inf).asStream;\n loop {\n c.perform(order.next, a);\n 1.0.wait;\n }\n}\n)\n```\n\nOops.\n\nThis means you can’t randomly throw Ndefs into ParGroups. If one Ndef reads a signal from another, then you have to make sure that the target Ndef comes later in a serial (regular) Group. (Correctness of the result should be more important than “optimal” usage of multiple cores.)\n\nIf you don’t, and if supernova happens to put the source and target Ndefs onto separate cores at roughly the same time, then the target might evaluate InFeedback either before or after the source finishes, and there’s no guarantee of this being consistent. So you might get clicks.\n\nhjh"}]} +{"conversations": [{"role": "user", "content": "What does `TdefGui.envirGui` do?"}, {"role": "assistant", "content": "the gui for the Tdef's envir - if numItems >"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\np = Patch({ arg audio=0,ffreq=300;\n RHPF.ar(audio,ffreq,0.1)\n});\nq = Patch({\n Saw.ar(mul: 0.3)\n});\n\np.play;\nq.play;\n\n// adds a connection\n// but q is still out of main outs\np.connectInputToPlayer(0,q)\n\n\nq.patchTo(p,0;\n\n\np.gui\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\np = Patch({ arg audio=0,ffreq=300;\n RHPF.ar(audio,ffreq,0.1)\n});\nq = Patch({\n Saw.ar(mul: 0.3)\n});\n\np.play;\nq.play;\n\n// adds a connection\n// but q is still out of main outs\np.connectInputToPlayer(0,q)\n\n\nq.patchTo(p,0);\n\n\np.gui\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// set() creates a local environment that overrides the outer currentEnvironment\n\nPdefn(\\z).set(\\a, 1, \\b, 5);\n(\nPdefn(\\z, { |e|\n loop { yield((e.a + e.b) + 0.1.rand.round(0.01)) }\n})\n); // [1]\n\nt = Pdefn(\\z).asStream;\n\nt.nextN(3);\n\n(\nPdefn(\\z, { |e|\n // (e.a + e.b) + 0.1.rand.round(0.01) 1\n Pseq([1, 2, e.a], 1)\n})\n);\n\nPdefn(\\z, Pseq([1, 2, 3], 1));\n\ne = Pdefn(\\z).envir\n\n\nPdefn(\\z).set(\\a, 3);\n\nt.next\n// …\n```"}, {"role": "assistant", "content": "set() creates a local environment that overrides the outer currentEnvironment (e.a + e.b) + 0.1.rand.round(0.01) 1 (Pdefn: non event stream reference definition)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// example signal to process\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n z * 0.8\n}.play\n);\n\n(\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n [z, Limiter.ar(z, 0.4, 0.01)] * 0.5\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// example signal to process\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n z * 0.8\n}.play\n);\n\n(\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n [z, Limiter.ar(z, 0.4, 0.01)] * 0.5\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// where did I leave my keys?\n(\nvar n = 30, m = 5;\nNdef.clear(3);\nNdef.ar(\\x, n);\nNdef(\\y, { Splay.ar(Ndef.ar(\\x, m, LFNoise1.kr(1/m).range(0, n - m - 1))).clip2 * 0.5 }).play; \nNdef(\\x, { \n { \n var a = Ndef.ar(\\x, 1, LFNoise0.kr(Rand()) * Rand() + Rand() * n);\n a + 0.1 * SinOsc.ar(ExpRand(0.2, 1000)) \n } ! n\n}); \n);\n\n// where did I put my keys?\n(\nvar n = 30, m = 5;\nNdef.clear(3);\nNdef.ar(\\x, n);\nNdef(\\y, { Splay.ar(Ndef.ar(\\x, m, LFNoise1.kr(1/m).range(0, n - m - 1))).clip2 * 0.5 }).play; \nNdef(\\x, { \n {\n var a = Ndef.ar(\\x, 1, LFNoise0.kr(Rand()) * Rand() + Rand() * n);\n SinOsc.ar(ExpRand(0.2, 1000), a) \n } ! n\n}); \n)\n```"}, {"role": "assistant", "content": "Cross-tuning between multiple signal dimensions. The code is finished without listening."}]} +{"conversations": [{"role": "user", "content": "What does `DissonanceCurve.+` do? What arguments does it take?"}, {"role": "assistant", "content": "Adds two DiscconanceCurves together in a meaningful way. This would be useful to figure out a scale that works for two different Arguments: other — a Spectrum or a DissonanceCurve. Returns: a new DissonanceCurve"}]} +{"conversations": [{"role": "user", "content": "What is SuperCollider?"}, {"role": "assistant", "content": "SuperCollider is a platform for audio synthesis and algorithmic composition, written in C++ and SuperCollider. It splits into a language client (sclang) that runs your code and builds UGen graphs, and an audio server (scsynth) that does the DSP in real time. They talk over OSC."}]} +{"conversations": [{"role": "user", "content": "What does `Array.asRawOSC` do?"}, {"role": "assistant", "content": "Returns the OSC message as an Int8Array. Receiver can be a message or a bundle. See also Int8Array#-parseOSC. `[\\s_new, \\default, -1, 1, 1, \\freq, 1961].asRawOSC; //"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `ExpRand` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-ExpRand\", { |out = 0|\n Out.ar(out,\n FSinOsc.ar(\n ExpRand(100.0, 8000.0),\n 0, Line.kr(0.2, 0, 0.01, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n(\nRoutine({\n inf.do({ |i|\n Synth.new(\"help-ExpRand\"); 0.05.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LorenzL`."}, {"role": "assistant", "content": "```supercollider\n// vary frequency\n{ LorenzL.ar(MouseX.kr(20, SampleRate.ir)) * 0.3 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Routine` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// SynthDefs on the fly\ns.boot;\n(\nt = TempoClock.new;\nr = Routine.new({\n 10.do({\n // could be done with an argument instead of a new def, but proves the point\n SynthDef(\"help-EnvGen\" ++ i, { arg out = 0;\n Out.ar(\n out,\n EnvGen.kr(Env.perc, 1.0, doneAction: Done.freeSelf)\n * SinOsc.ar(100 + (100 * t.elapsedBeats), 0, 0.1)\n )\n }).play(s);\n 1.yield;\n });\n}).play(t); // Note the alternative syntax: Routine.play(aClock)\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Since the allpass delay has no audible effect as a resonator on\n// steady state sound ...\n\n{ AllpassN.ar(WhiteNoise.ar(0.1), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// ...these examples add the input to the effected sound and compare variants so that you can hear\n// the effect of the phase comb:\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassN.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2)\n}.play)\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassL.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Since the allpass delay has no audible effect as a resonator on\n// steady state sound ...\n\n{ AllpassN.ar(WhiteNoise.ar(0.1), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// ...these examples add the input to the effected sound and compare variants so that you can hear\n// the effect of the phase comb:\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassN.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2)\n}.play)\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassL.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2)\n}.play)\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassC.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2)\n}.play)\n\n// used as an echo - doesn't really sound different than Comb,\n// but it outputs the input signal immediately (inverted) and the echoes\n// are lower in amplitude.\n{ AllpassN.ar(Decay.ar(Dust.ar(1, 0.5), 0.2, WhiteNoise.ar), 0.2, 0.2, 3) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `MIDIClockOut` in SuperCollider?"}, {"role": "assistant", "content": "MIDIClockOut — a Player that sends MIDI Clock Out As a player this produces no audio, but emits MIDI Clock. It can be simply played and it will start sending. It can be added to a PlayerMixer and it will play in synch with the other players. Category: External Control > MIDI, Libraries > crucial > MIDI, Libraries > crucial > Scheduling."}]} +{"conversations": [{"role": "user", "content": "How do I distort a signal?"}, {"role": "assistant", "content": "Drive it into a nonlinearity, then tame the level: `tanh` is soft clipping, `.distort` is harder,\nand a low-pass after the drive keeps it from getting fizzy.\n\n```supercollider\n(\n{\n var sig = SinOsc.ar(110) * 0.3;\n var driven = (sig * 12).tanh;\n LPF.ar(driven, 5000) * 0.4\n}.play;\n)\n```\n\nMore drive means more harmonics; because they are generated, the output is louder as well as brighter, so\nscale the result down after the nonlinearity."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Resonz` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// 1st, evaluate a synthdef\n(\nSynthDef(\"pitchFromNoise\", { arg out = 0;\n Out.ar(\n out,\n Resonz.ar(\n WhiteNoise.ar(15),\n LFNoise0.kr(2, 110, 660),\n 0.005\n )\n )\n}).add;\n);\n\n// 2nd, make 2 synths\n(\nSynth(\"ringModulation\");\nSynth(\"pitchFromNoise\", [\\out, 1]);\n);\n\n// 3rd, tell the server to list its nodes\n(\ns.queryAllNodes;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n////////////// xosc nufo is unused by now ///////////\n// OSCdef(\\xoscAlive, { |msg, time|\n// if (NTMI.nufo.lastInTime == 0 or: { NTMI.nufo.timeSinceLast > 10 }) {\n// Tdef(\\allLEDs).play;\n// };\n// NTMI.nufo.deviceName = \\xosc;\n// NTMI.nufo.lastInTime = time;\n// }, \"/imu\").permanent_(true);\n```"}, {"role": "assistant", "content": "xosc nufo is unused by now /////////// OSCdef(\\xoscAlive, { |msg, time| if (NTMI.nufo.lastInTime == 0 or: { NTMI.nufo.timeSinceLast > 10 }) { Tdef(\\allLEDs).play; }; NTMI.nufo.deviceName = \\xosc; NTMI.nufo.lastInTime = time; }, \"/imu\").permanent_(true);."}]} +{"conversations": [{"role": "user", "content": "What does `VOSIM.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "vosim pulse generator Arguments: trig — [ar kr] starts a vosim pulse when a transition from non-positive to positive occurs and no other vosim is still going. audio rate input will produce sample accurate triggering.; freq — [ar kr] the frequency of the squared sinewave.; nCycles — the number of squared sinewaves to use in one vosim pulse. nCycles gets checked when VOSIM receives a trigger.; decay — the decay factor.."}]} +{"conversations": [{"role": "user", "content": "What does `Tempo.guiClass` do?"}, {"role": "assistant", "content": "for control of tempo and for use in tempo based calculations"}]} +{"conversations": [{"role": "user", "content": "What does `ListView.selectionMode` do? What arguments does it take?"}, {"role": "assistant", "content": "The allowed mode of item selection, according to the following Arguments: One of the Symbols listed in the table above.."}]} +{"conversations": [{"role": "user", "content": "How to generate paradiddles?"}, {"role": "assistant", "content": "SuperCollider forum — How to generate paradiddles?\n\nHi Rodet, I’m teaching jazz at college, and sometimes paradiddles come up in conversation (although I’m not a drummer). A paradiddle is basically a way of ‘evenly’ playing a roll (single/double/triple/whatever). If you take your drumsticks/fingers and play evenly:\n\nright, left, right, right, left, right, left, left, right, left, right, right, etc\n\nyou’ll notice that it’s possible to get an even rhythm, which when played fast becomes a roll. The idea of the single/double/triple is just to place the accents (lightly, or not) on the left, right hand, which if I understand helps keep an even stroke (and makes better sense to follow).\n\nSo, although I don’t know the goal of your idea, a simple code which would give you the solution could be a pattern. You’ll notice I’ve put in a SynthDef to give the ‘snare’ sound - not very real, but just for the demonstration. If you run these patterns, un-commenting the line needed (single, double or triple - don’t forget to comment out the lines you don’t need), you’ll hear the accents a paradiddle gives.\n\nIn this example Pbind ‘a’ gives the pulse, and Pbind ‘b’ the accents. And, if you play along with them (using your chart), you’ll notice the accents pass from right hand to left hand (or vice versa). This is (more or less) what paradiddles do, although a drummer will explain better how they ‘accent’ strokes to get more complicated/subtle rhythms.\n\n```supercollider\n(\nSynthDef(\\snare, {\n arg out=0, sus=0.1;\n var sig, env;\n sig = WhiteNoise.ar(0.1);\n env = EnvGen.kr(Env.perc(0.001, sus), doneAction:2);\n sig = sig*env;\n Out.ar(out, sig!2);\n}).add;\n);\n\n(\nt=TempoClock(80/60);\na=Pbind(\n \\instrument, \\snare,\n \\dur, 1/2,\n \\sus, 0.01\n);\nb=Pbind(\n \\instrument, \\snare,\n \\dur, 1,\n \\sus, Pseq([0.02, 0.01],inf), // single\n //\\sus, Pseq([0.02, 0.01, 0.01],inf), // double\n //\\sus, Pseq([0.02, 0.01, 0.01, 0.01],inf), // triple\n);\nPpar([a, b]).play(t);\n)\n```\n\nI hope that puts you on the right track.\n\np.s. Don’t forget to try out changing the speed to get the real effect. Try something like 320/60 on the TempoClock."}]} +{"conversations": [{"role": "user", "content": "What does `Float.as32Bits` do?"}, {"role": "assistant", "content": "64-bit Floating point number Returns: an Integer which is the bit pattern of this as a 32bit single precision float"}]} +{"conversations": [{"role": "user", "content": "What does `RedSeq.newArray` do? What arguments does it take?"}, {"role": "assistant", "content": "a sort of timeline - master sequencer Arguments: array — An array of indices and beats written together [index, beat].."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//multiple objects within a world with gravity force\n//color and size depends on object's mass\n\n(\nvar width= 300, height= 300, w, wgrav, world, n= 80;\n\n//--world\nw= RedWindow(\"vector test\", Rect(128, 64, width, height)).front;\nwgrav= RedVector2D[-0.1, 0.98]; //world xy gravity\nworld= RedWorld3(RedVector2D[width, height], wgrav, 20, 0.2); //dim,grav,maxvel,damp\n\n//--objects\n{\n var mass= 1.0.rrand(4); //random mass for each object\n RedObject(world, RedVector2D[width, 20].rand, 0, 0, mass, mass*5); //world,loc,vel,acc,mass,size\n}.dup(n);\n\n//--loop\nw.draw{\n world.objects.do{|o|\n o.addForce(world.gravity);\n o.update;\n world.contain(o);\n\n //--render\n Pen.strokeColor= Color.grey(o.mass/4);\n Pen.strokeRect(Rect.aboutRedObject2D(o));\n };\n};\nw.play;\nCmdPeriod.doOnce({w.close});\n)\n```"}, {"role": "assistant", "content": "multiple objects within a world with gravity force color and size depends on object's mass."}]} +{"conversations": [{"role": "user", "content": "What does `Latency.threshold` do?"}, {"role": "assistant", "content": "get and set amplitude threshold for pulses on input"}]} +{"conversations": [{"role": "user", "content": "How does multi-channel expansion work?"}, {"role": "assistant", "content": "If any argument of a UGen is an Array, the UGen is built once per element and the results are returned as an Array. So `SinOsc.ar([220, 330, 440])` is three oscillators, and `SinOsc.ar(220 * [1, 1.5])` is two. This is not a special stereo feature: it is uniform expansion, which is why `Splay.ar(SinOsc.ar([220,330,440]) * 0.1)` gives you a spread stereo field from three mono sources."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n SinOsc.ar(\n RunningMin.ar(Dust.ar(20), Impulse.ar(0.4)) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// follow a sine lfo, reset rate controlled by mouse x\n(\n{\n SinOsc.ar(\n RunningMin.kr(SinOsc.kr(0.2), Impulse.kr(MouseX.kr(0.01, 2, 1))) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n SinOsc.ar(\n RunningMin.ar(Dust.ar(20), Impulse.ar(0.4)) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// follow a sine lfo, reset rate controlled by mouse x\n(\n{\n SinOsc.ar(\n RunningMin.kr(SinOsc.kr(0.2), Impulse.kr(MouseX.kr(0.01, 2, 1))) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SequenceableCollection.isSeries` do? What arguments does it take?"}, {"role": "assistant", "content": "Returns true if the collection is an arithmetic Arguments: step — Step size to look for. If none is given, any step size will match. `[0, 1, 2, 3, 4, 5].isSeries; // true`."}]} {"conversations": [{"role": "user", "content": "What is the difference between the language and the server?"}, {"role": "assistant", "content": "sclang runs your code, the clock and Patterns, and builds UGen graphs. scsynth performs the DSP in real time. They communicate over OSC, which is why a language-side mistake can leave a sound running, and why s.freeAll stops it."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `TempoClock`."}, {"role": "assistant", "content": "```supercollider\nt = TempoClock.default;\nt.play({ |beats, time, clock| [beats, time, clock].postln });\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\nb = Buffer.alloc(s,2048,1);\n\n(\nSynthDef(\"help-brick\", { arg out=0, bufnum=0;\n var in, chain;\n in = {WhiteNoise.ar(0.2)}.dup;\n chain = FFT(bufnum, in);\n chain = PV_Cutoff(chain, SinOsc.kr(0.1));\n Out.ar(out, IFFT(chain).dup);\n}).play(s,[\\out, 0, \\bufnum, b.bufnum]);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\nb = Buffer.alloc(s,2048,1);\n\n(\nSynthDef(\"help-brick\", { arg out=0, bufnum=0;\n var in, chain;\n in = {WhiteNoise.ar(0.2)}.dup;\n chain = FFT(bufnum, in);\n chain = PV_Cutoff(chain, SinOsc.kr(0.1));\n Out.ar(out, IFFT(chain).dup);\n}).play(s,[\\out, 0, \\bufnum, b.bufnum]);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// UnitTestScript(\"Collapse\", thisProcess.nowExecutingPath).runScript;\n\n{\n |test|\n var collapseValues = List();\n var collapse;\n\n collapse = Collapse({ |v| collapseValues.add(v) }, 0.1);\n\n collapseValues.clear;\n\n collapse.value(1);\n test.assert(collapseValues.isEmpty, \"Collapse doesn't exec immediately\");\n\n 1.wait;\n test.assertEquals(collapseValues.array, [1], \"Collapse execs eventually\");\n\n collapseValues.clear;\n [1, 2, 3, 4, \"last\"].do { |i| collapse.(i); 0.05.wait };\n 1.wait;\n test.assertEquals(collapseValues.array, [\"last\"], \"Collapse only execs last value.\");\n\n collapseValues.clear;\n [\"first\", \"second\", \"last\"].do { |i| collapse.(i); 0.2.wait };\n test.assertEquals(collapseValues.array, [\"first\", \"second\", \"last\"], \"Collapse execs all values.\")\n\n};\n```"}, {"role": "assistant", "content": "UnitTestScript(\"Collapse\", thisProcess.nowExecutingPath).runScript;."}]} -{"conversations": [{"role": "user", "content": "What does `Tap.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Single tap into a delay line Arguments: bufnum — The index of the buffer to use; numChannels — Number of channels of the buffer; delaytime — Tap delay; cannot be modulated."}]} -{"conversations": [{"role": "user", "content": "What is SuperCollider?"}, {"role": "assistant", "content": "SuperCollider is a platform for audio synthesis and algorithmic composition, written in C++ and SuperCollider. It splits into a language client (sclang) that runs your code and builds UGen graphs, and an audio server (scsynth) that does the DSP in real time. They talk over OSC."}]} -{"conversations": [{"role": "user", "content": "Can I run SuperCollider without the IDE?"}, {"role": "assistant", "content": "Yes. `sclang` runs the language and `scsynth` the server, and they are separate processes by design\n— the IDE is only a client. A headless script is a `.scd` run with `sclang my-piece.scd`, and it must boot\nthe server itself:\n\n```supercollider\ns.boot;\ns.waitForBoot {\n // build SynthDefs, play, then wait\n 30.wait;\n s.quit;\n};\n```\n\nThat shape — boot, wait, play, quit, exit — is what makes a piece runnable from a cron job or a\nRaspberry Pi."}]} -{"conversations": [{"role": "user", "content": "What is `SystemSynthDefs`?"}, {"role": "assistant", "content": "SystemSynthDefs — SynthDefs assumed to exist on the server"}, {"role": "user", "content": "What does `SystemSynthDefs.numChannels` do?"}, {"role": "assistant", "content": "The SystemSynthDefs class generates SynthDefs with different number of channels that are chosen according to need. This class variable specifies the maximum number of channels."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na = { SinOsc.ar * 0.01 }.play;\na.defName; // has the prefix 'temp__', followed by a number\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nf = ();\nf.beatAndBar = {\n var t = currentEnvironment.clock; // t= TempoClock.new;\n var text = \"xB: \";\n\n var nBeatsPerBar = { arg n, beats, clock;\n var nBpb = clock.beatsPerBar * n;\n \"\" ++ n ++ text ++ (nBpb - (beats%(nBpb))).asInteger\n };\n\n t.play({arg beats, time, clock;\n ( //[\"beat: \" ++ (t.beatInBar + 1).asInteger] ++ //uncomment for beat in bar\n [1,2,4,8,16,32].collect( {|n,i| nBeatsPerBar.value(n, beats, clock)})\n ).postln;\n 1});\n \"beatAntBar\";\n}\n);\n\nf[\\beatAndBar].value;\n\n(\nf[\\beatAndBar].value;\nCmdPeriod.add(f[\\beatAndBar]);\n)\n```"}, {"role": "assistant", "content": "Prints beats to bars for a mutiple of bar.\r\nHow many beats left until next 1, 2, 4, 8, 16, 32, etc bar."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// using a protoEvent\nPdef(\\x, Pbind(\\dur, 0.1));\nPdef(\\x).trace.play(protoEvent: (freq: 1000);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// using a protoEvent\nPdef(\\x, Pbind(\\dur, 0.1));\nPdef(\\x).trace.play(protoEvent: (freq: 1000));\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Basic tone simulator of a stylophone?"}, {"role": "assistant", "content": "```supercollider\n/*\nRetro Stylophone\n\nReverse engineered from: https://www.waitingforfriday.com/?p=334\n\n1. Relaxation oscillator (UJT)\n\n- generated by a combination of two oscillators. The primary oscillator is a\n current controlled PUT (Programmable Uni-Junction Transistor) relaxation oscillator which is\n responsible for generating the overall tone of the instrument.\n A secondary LFO phase-shifted provides the vibrato\n (the relative slow wavering of a sound around the notes centre pitch)\n\n- around 10 VPP\n\n2. LFO phase-shift (vibrato)\n\n- generated by a low-frequency oscillator made with a transistor and several capacitors,\n which produces a triangle/sine wave fed into the frequency control voltage operating the UJT\n\n- frequency of about 8.5Hz, phased shifted of 180 degree, around 4.2 VPP\n*/\n\n(\nSynthDef(\\stylophone, { |freq = 220, vibAmp = 2, toneAmp = 5, atkTime = 0.01, trigger = 0|\n\n var lfo = OnePole.kr(LFPar.kr(8, mul: vibAmp, add: freq), 0.9); // 180 degree inversion\n var relaxOsc = LFPulse.ar(lfo, width: 0.9, mul: toneAmp);\n\n var asr = EnvGen.kr(Env.asr(atkTime * 5, releaseTime: 0.001, curve: \\lin), gate: trigger);\n\n Out.ar(0, relaxOsc * asr)\n}).add\n);\n\nf = Synth(\\stylophone);\n\nf.set(\\freq, 208.2);\nf.set(\\freq, 233.4);\n\nf.set(\\trigger, 1);\nf.set(\\trigger, 0);\nf.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Canvas3D.mRotateZ` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a matrix for rotating around Z Arguments: az — Z rotation."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Play your (short) soundfiles with some delay."}, {"role": "assistant", "content": "```supercollider\n// By Bjørn Houdorf March 2013, Play your (short) soundfiles with some delay.\n\nb = SoundFile.collectIntoBuffers(\"yourSoundFileFolder/*\"); // 1. rund this\n\n( // 2. and then run this\nt = Task({\n({\n var num= b.size.rand;\n var buf= b[num];\n 0.1*Splay.ar(PlayBuf.ar(buf.numChannels, buf, 1, 1, 0, 0));\n}.play;\n) \n});\n);\n\n\n( // 3. Then run this\nz = Task({\nloop({\n t.start;\n 0.1.wait;\n});\n});\n);\n\n\nz.start; // 4. and run this\nz.stop; // 5. and finally run this\n```"}]} -{"conversations": [{"role": "user", "content": "What does `MAbstractElement.kr` do? What arguments does it take?"}, {"role": "assistant", "content": "Use the value directly on the server (on a Arguments: server — optional argument that you only have to set once, and only if the server for the bus is not Server#-default.. Returns: an In#-kr holding the current value of this element. Reflects changes of the value."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes THX Deep Note inspired synth sketch."}, {"role": "assistant", "content": "```supercollider\n// A. Broz: Deep Choir (v2, 2020-10-29)\n(\n~numVoices = 30;\n\n~chaos = { |range = 1.0|\n ~numVoices collect: { exprand(180 / range, 260 * range) }\n};\n\n~bigChord = { |fund = 30, harmonics = 5|\n ~numVoices collect: {\n fund\n * rrand(1, harmonics) // build chord\n * rrand(1, 2) * rrand(1, 2) // octaves\n + rrand(-1.2, 1.2) // beats\n }\n};\n\n// Try with Pmono\nSynthDef(\\fakeTHX, {\n var env = EnvGen.kr(\n envelope: Env.adsr(15, \\decay.kr(10), 1, 10, curve: \\sine),\n gate: \\gate.kr(1),\n doneAction: Done.freeSelf,\n );\n var chord = \\freq.kr(~chaos.value, \\lag.kr(10));\n var meander = \\meander.kr(0.3, 8);\n var sig = chord collect: { |f|\n f = f * LFNoise2.kr(rrand(0.3, 0.8)).exprange(1 - meander, 1 + meander);\n BLowPass.ar(Saw.ar(f), f, 0.6);\n };\n sig = Splay.ar(sig, 0.8) * env * \\mul.kr(0.5, 3);\n Out.ar(0, sig);\n}).add;\n);\n\n(\nRoutine({\n var fakeTHX = Synth(\\fakeTHX);\n\n 10.wait;\n\n fakeTHX.set(\\meander, 0);\n\n fakeTHX.set(\\freq, ~bigChord.(30, 5));\n\n 10.wait;\n\n fakeTHX.set(\\gate, 0);\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SCluster.xsetFrequencies` do? What arguments does it take?"}, {"role": "assistant", "content": "convenience method for CODE.xset(\\frequencies, ...) will Arguments: arr — an array of floats in Hz.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\nz = {\n IIRFilter.ar(\n SoundIn.ar([0,1]),\n MouseX.kr(20,20000,\\exponential), // cutoff freq.\n MouseY.kr(0.01, 1.0, \\linear), // rq\n 0.5); // mul\n}.play)\nz.release;\n\n(\nz = {\n var sig, freq;\n freq = MouseX.kr(20,12000,\\exponential);\n sig = IIRFilter.ar(\n LFSaw.ar([freq * 0.99, freq * 1.01], 0, 0.1) ! 2,\n SinOsc.kr(SinOsc.kr(0.1),1.5pi,1550,1800),\n MouseY.kr(0.01,1,\\linear));\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\nz = {\n IIRFilter.ar(\n SoundIn.ar([0,1]),\n MouseX.kr(20,20000,\\exponential), // cutoff freq.\n MouseY.kr(0.01, 1.0, \\linear), // rq\n 0.5); // mul\n}.play)\nz.release;\n\n(\nz = {\n var sig, freq;\n freq = MouseX.kr(20,12000,\\exponential);\n sig = IIRFilter.ar(\n LFSaw.ar([freq * 0.99, freq * 1.01], 0, 0.1) ! 2,\n SinOsc.kr(SinOsc.kr(0.1),1.5pi,1550,1800),\n MouseY.kr(0.01,1,\\linear));\n (CombN.ar(sig, 0.4, [0.4,0.35],2) * 0.4) + (sig * 0.5);\n}.play)\nz.release\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `RedTest` in SuperCollider briefly."}, {"role": "assistant", "content": "RedTest — generate test signals Category: Red > redTest."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na.pulse(8, 0, 2, 1, 0);\n\nb.sine2(a.ramp(1.0, 1.0), a.pulse(8, 0, 2, 1, 0).postln, true, true, true);\ny = z.play(s, [\\out, 0, \\bufnum, b]);\nb.sine2(a.ramp(1.0, 1.0), a.pulse(8, 0, 2, 1, 0).postln, true, true, true);\nb.sine2(a.ramp(1.0, 1.0), a.pulse(4, 0, 2, 0.4, 0.2).postln, true, true, true);\nb.sine2(a.ramp(1.0, 1.0), a.pulse(7, 0.5pi, 3, 0.5, 0.1).postln, true, true, true;\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na.pulse(8, 0, 2, 1, 0);\n\nb.sine2(a.ramp(1.0, 1.0), a.pulse(8, 0, 2, 1, 0).postln, true, true, true);\ny = z.play(s, [\\out, 0, \\bufnum, b]);\nb.sine2(a.ramp(1.0, 1.0), a.pulse(8, 0, 2, 1, 0).postln, true, true, true);\nb.sine2(a.ramp(1.0, 1.0), a.pulse(4, 0, 2, 0.4, 0.2).postln, true, true, true);\nb.sine2(a.ramp(1.0, 1.0), a.pulse(7, 0.5pi, 3, 0.5, 0.1).postln, true, true, true);\ny.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `UScoreEditor.trimEventsEndAtPos` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: events — (describe argument here). Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "Splay - not getting spread, wrong use?"}, {"role": "assistant", "content": "SuperCollider forum — Splay - not getting spread, wrong use?\n\nYou need to undestand that if you have two identical signal coming from left and right it will always be mono. No stereo spread possible. So you need to introduce (at least) two different signals - and just different amplification will not really work.\n\nTo expand your first example, we can introduce an array of values for paramtere pos:\n\n```supercollider\n(\nx = { arg spread=1, level=0.2, center=0.0;\n Splay.ar(\n GrainBuf.ar(numChannels: 1,\n trigger: Impulse.kr(1.2875),\n dur: Impulse.kr(1.2875),\n sndbuf: b,\n pos:[0,0.5],\n interp: 1\n ),\n spread,\n level,\n center\n );\n}.play;\n);\n\nx.set(\\spread, 1, \\center, 0); // full stereo\nx.set(\\spread, 0, \\center, 0); // mono center\n```\n\nBy way of Multichannel Expansion this creates two different signals (channels, an array of 2 UGen graphs) that you can hear as different and therefore observe the stereo spread.\n\nAnd similarly, to use your other example with In.ar where I have added in=2, so that it takes my mic in (but you can specify another bus) and wrapped it into a feedback delay with an array of two values for delayTime. Multichannel expansion thus creates two channels that are different because they have different delaytimes but the rest of UGen graph is the same (a copy). Changing spread now works:\n\n```supercollider\n(\nSynthDef(\\stereo,{|out=0, in=2, spread=1, level=1, center=0.0|\n Out.ar(out,\n Splay.ar(\n CombN.ar(\n In.ar(in, 1), 1, [0.3,0.4], 2)\n ,spread,level,center));\n}).play;\n)\n```\n\nI hope that clarifies the issue better."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Nice to hear what KeyTrack thinks:\n\nd = Buffer.read(s, \"/Users/nickcollins/Desktop/ML/training_wav/78.wav\")\n\n(\n{\n var in, fft, resample, chord, rootnote, sympath;\n var key, transientdetection;\n\n in = PlayBuf.ar(1, d, BufRateScale.kr(d), 1, 0, 1);\n\n fft = FFT(LocalBuf(4096), in); // for sampling rates 44100 and 48000\n\n key = KeyTrack.kr(fft, 2.0, 0.5);\n key.poll;\n key = Median.kr(101, key); // Remove outlier wibbles\n\n chord = if(\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Nice to hear what KeyTrack thinks:\n\nd = Buffer.read(s, \"/Users/nickcollins/Desktop/ML/training_wav/78.wav\")\n\n(\n{\n var in, fft, resample, chord, rootnote, sympath;\n var key, transientdetection;\n\n in = PlayBuf.ar(1, d, BufRateScale.kr(d), 1, 0, 1);\n\n fft = FFT(LocalBuf(4096), in); // for sampling rates 44100 and 48000\n\n key = KeyTrack.kr(fft, 2.0, 0.5);\n key.poll;\n key = Median.kr(101, key); // Remove outlier wibbles\n\n chord = if(key < 12, #[0, 4, 7], #[0, 3, 7]);\n rootnote = if(key < 12, key, key-12) + 60;\n\n sympath = SinOsc.ar((rootnote + chord).midicps, 0, 0.4).mean;\n\n Pan2.ar(in, -0.5) + Pan2.ar(sympath, 0.5)\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\np = SerialPort(\n \"/dev/tty.usbserial-A800crTT\", // edit to match your port. SerialPort.listDevices\n baudrate: 9600, // check that baudrate is the same as in arduino sketch\n crtscts: true);\n);\n\n// send serial data - slow pulsating\n(\nr = Routine({\n inf.do{ |i|\n p.put(i.fold(0, 100).linexp(0, 100, 1, 255).asInteger.postln);\n 0.02.wait;\n };\n}).play;\n;\n\nr.stop;\np.close;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\np = SerialPort(\n \"/dev/tty.usbserial-A800crTT\", // edit to match your port. SerialPort.listDevices\n baudrate: 9600, // check that baudrate is the same as in arduino sketch\n crtscts: true);\n);\n\n// send serial data - slow pulsating\n(\nr = Routine({\n inf.do{ |i|\n p.put(i.fold(0, 100).linexp(0, 100, 1, 255).asInteger.postln);\n 0.02.wait;\n };\n}).play;\n);\n\nr.stop;\np.close;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Abusing Convolution2 to make pitch."}, {"role": "assistant", "content": "```supercollider\n// fixed (unchanging) impulse response\n// cmd-. to stop\n\n(\ns.waitForBoot {\n var c = Condition.new, cleanfunc = { CmdPeriod.remove(cleanfunc); b.free };\n fork {\n b = Buffer.alloc(s, 2048, 1);\n CmdPeriod.add(cleanfunc);\n s.sync;\n a = {\n RecordBuf.ar(BrownNoise.ar * EnvGen.ar(Env(#[0, 1, 0], #[0.5, 0.5], \\sin), timeScale: b.duration, doneAction: 2), b, loop: 0);\n 0\n }.play;\n OSCpathResponder(s.addr, ['/n_end', a.nodeID], { |time, resp, msg|\n resp.remove;\n c.unhang;\n }).add;\n c.hang;\n a = {\n var freq = MouseX.kr(150, 450, warp: 1, lag: 0.1);\n LeakDC.ar(Convolution2.ar(Impulse.ar(freq), b, framesize: b.numFrames) * -35.dbamp) ! 2;\n }.play;\n };\n};\n);\n\n\n\n// multiple impulse responses for timbre control\n(\ns.waitForBoot {\n var c = Condition.new, cleanfunc = { CmdPeriod.remove(cleanfunc); b.free };\n fork {\n b = Buffer.allocConsecutive(3, s, 2048, 1);\n CmdPeriod.add(cleanfunc);\n s.sync;\n a = {\n var sig = [BrownNoise.ar, PinkNoise.ar, WhiteNoise.ar];\n sig.do { |chan, i|\n RecordBuf.ar(chan * EnvGen.ar(Env(#[0, 1, 0], #[0.5, 0.5], \\sin), timeScale: b[i].duration, doneAction: 2), b[i], loop: 0);\n 0\n };\n }.play;\n OSCpathResponder(s.addr, ['/n_end', a.nodeID], { |time, resp, msg|\n resp.remove;\n c.unhang;\n }).add;\n c.hang;\n a = {\n var freq = MouseX.kr(150, 450, warp: 1, lag: 0.1),\n index = MouseY.kr(0, 1.99, lag: 0.1),\n iWhole = index.trunc(2),\n iFrac = index - iWhole,\n iAdjust = iFrac >= 1.0,\n trig = Impulse.ar(freq),\n convolvers = b.collect { |buf, i|\n LeakDC.ar(Convolution2.ar(trig, buf, framesize: buf.numFrames))\n };\n (\n XFade2.ar(\n Select.ar(iWhole + (2 * iAdjust), convolvers),\n Select.ar(iWhole + 1, convolvers),\n iFrac.fold(0, 1) * 2 - 1\n ) * -30.dbamp\n ) ! 2;\n }.play;\n };\n};\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `LID.at` do?"}, {"role": "assistant", "content": "If a `spec` is defined for this device, then you can use a controlName to look up a"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\ns.boot;\n\n\n\n// create with cueSoundFile class method\nb = Buffer.cueSoundFile(s, ExampleFiles.apollo11, 0, 1);\nx = { DiskIn.ar(1, b) }.play;\nb.close; // must call close in between cueing\n// now use like named instance method, but different arguments\nb.cueSoundFile(ExampleFiles.apollo11);\n// have to do all this to clean up properly!\nx.free; b.close; b.free;\n```"}, {"role": "assistant", "content": "create with cueSoundFile class method now use like named instance method, but different arguments (Buffer: Client-side representation of a buffer on a server)"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Ringz`."}, {"role": "assistant", "content": "```supercollider\n{ Ringz.ar(Dust.ar(3, 0.3), 2000, 2) }.play\n\n{ Ringz.ar(WhiteNoise.ar(0.005), 2000, 0.5) }.play\n\n// modulate frequency\n{ Ringz.ar(WhiteNoise.ar(0.005), XLine.kr(100, 3000, 10), 0.5) }.play\n\n{ Ringz.ar(Impulse.ar(6, 0, 0.3), XLine.kr(100, 3000, 10), 0.5) }.play\n\n// modulate ring time\n{ Ringz.ar(Impulse.ar(6, 0, 0.3), 2000, XLine.kr(4, 0.04, 8)) }.play\n\n// modulate ring time opposite direction\n{ Ringz.ar(Impulse.ar(6, 0, 0.3), 2000, XLine.kr(0.04, 4, 8)) }.play\n\n(\n{\n var exciter;\n exciter = WhiteNoise.ar(0.001);\n Mix.arFill(10, {\n Ringz.ar(exciter,\n XLine.kr(exprand(100.0, 5000.0), exprand(100.0, 5000.0), 20),\n 0.5)\n })\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Very quick-and-dirty hack to show stereo phase."}, {"role": "assistant", "content": "```supercollider\n(\nb = Bus.audio(s, 2);\na = { |inbus = 0|\n var sig = In.ar(inbus, 2);\n // x axis is side, oriented toward right;\n // y axis is mid\n [sig[1] - sig[0], sig.sum]\n}.play(s.defaultGroup, outbus: b, addAction: \\addAfter);\nc = s.scope;\nc.style = 2;\nc.bus = b;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Tempo.tempo` do? What arguments does it take?"}, {"role": "assistant", "content": "for control of tempo and for use in tempo based calculations Arguments: t."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nPdef(\\zed, \n Pbind(\n \\osc, Pseq([SinOsc, LFSaw],inf),\n \\instrument, Prout({ arg ev;\n SynthDef(\\zed, { arg out=0, gate=1, amp=0.1, pan=0, freq=200;\n var sig;\n sig = ev[\\osc].ar(freq);\n sig = sig * EnvGen.kr(\\adsr.kr(Env.adsr(0.1,0.1,0.8,0.1)), gate, doneAction:2);\n sig = Pan2.ar(sig, pan, amp);\n Out.ar(out, sig);\n }).add.yield;\n }).loop,\n \\degree, Pseq([0],inf),\n \\dur, 1,\n \\amp, 0.1,\n )\n).play;\n);\n```"}, {"role": "assistant", "content": "synthdef building should take less time than s.latency for this to work."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Periphonic (2D) encoder, 1 omni and 2 cardioid microphones\n// [0, 45, -45]\n\n~directions = [0, 45, -45].degrad;\n~pattern = [0, 0.5, 0.5];\n~encoder = FoaEncoderMatrix.newDirections(~directions, ~pattern;\n\n// inspect\n~encoder.dirChannels.raddeg;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Periphonic (2D) encoder, 1 omni and 2 cardioid microphones\n// [0, 45, -45]\n\n~directions = [0, 45, -45].degrad;\n~pattern = [0, 0.5, 0.5];\n~encoder = FoaEncoderMatrix.newDirections(~directions, ~pattern);\n\n// inspect\n~encoder.dirChannels.raddeg;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\nvar delay1, delay2, source; \n\n//k from -1 to 1\n\n//in samples\ndelay1= 100; \ndelay2= 40;\n\nsource= WhiteNoise.ar(0.5)*EnvGen.ar(Env([1,1,0],[(delay1+delay2)/SampleRate.ir,0.0]), Impulse.kr(MouseY.kr(1,4)));\n\nTwoTube.ar(source,MouseX.kr(-1,1),0.99,delay1,delay2); \n}.play\n\n);\n\n\n\n\n(\nSynthDef(\\twotube,{arg delay1=100, delay2=50, k=0.0, loss=0.999, dur=0.5, pan=0.0;\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\nvar delay1, delay2, source; \n\n//k from -1 to 1\n\n//in samples\ndelay1= 100; \ndelay2= 40;\n\nsource= WhiteNoise.ar(0.5)*EnvGen.ar(Env([1,1,0],[(delay1+delay2)/SampleRate.ir,0.0]), Impulse.kr(MouseY.kr(1,4)));\n\nTwoTube.ar(source,MouseX.kr(-1,1),0.99,delay1,delay2); \n}.play\n\n);\n\n\n\n\n(\nSynthDef(\\twotube,{arg delay1=100, delay2=50, k=0.0, loss=0.999, dur=0.5, pan=0.0; \nvar source; \n\n//k from -1 to 1\n\nsource= WhiteNoise.ar(0.5)*EnvGen.ar(Env([1,1,0,0],[(delay1+delay2)/SampleRate.ir,0.0,1.0]));\n\nOut.ar(0,Pan2.ar(TwoTube.ar(source,k,loss,delay1,delay2)*EnvGen.ar(Env([0,1,1,0],[0.001]++((dur-0.001)*[0.4,0.6])),doneAction:2),pan)); \n}).send(s); \n);\n\n\n\n(\nt.stop;\nt={\n\ninf.do{\n\nSynth(\\twotube,[\\delay1, rrand(1,300),\\delay2, rrand(1,300),\\loss, rrand(0.9,0.999),\\dur, rrand(0.1,5.0), \\pan, rrand(-1,1.0), \\k, rrand(-1,1.0)]);\n\n0.5.wait;\n};\n\n}.fork;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PV_MagSquared`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n(\nb = Buffer.alloc(s, 2048, 1);\nc = Buffer.read(s, ExampleFiles.child);\n);\n\n(\nSynthDef(\"help-magSquared\", { |out = 0, bufnum = 0, soundBufnum = 2|\n var in, chain;\n in = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);\n chain = FFT(bufnum, in);\n chain = PV_MagSquared(chain);\n Out.ar(out, 0.003 * IFFT(chain).dup);\n}).play(s, [\\out, 0, \\bufnum, b.bufnum, \\soundBufnum, c.bufnum]);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Env.asStream` do?"}, {"role": "assistant", "content": "Creates a Routine and embeds the Env in it. This allows the Env to function as a"}]} -{"conversations": [{"role": "user", "content": "What does `AbstractPlayer.plot` do? What arguments does it take?"}, {"role": "assistant", "content": "the base class for all Players : a playable object Arguments: duration; bounds."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Custom event type for wiring up effects?"}, {"role": "assistant", "content": "```supercollider\n(\n// add custom event\nEvent.addEventType(\\nbind, {arg server;\n\n var id = (currentEnvironment[\\ndef] ? currentEnvironment[\\instrument]).asSymbol;\n var type = \\note;\n\n if (Ndef(id).isPlaying.not) {\n Ndef(id).play;\n };\n\n ~type = type;\n ~group = Ndef(id).group;\n ~out = Ndef(id).bus;\n\n currentEnvironment.play;\n});\n\n// synth\nSynthDef(\\synth1, {arg freq = 440, out = 0;\n \n var env = Env.perc.kr(doneAction:2);\n var sig = SinOscFB.ar(freq * [1, 1.01], 0.7);\n sig = sig * env;\n OffsetOut.ar(out, Splay.ar(sig));\n \n}).add;\n\n// set up first set of fx\nNdef(\\fx1).play;\nNdef(\\fx1)[0] = \\filter -> {arg in;\n in.abs;\n};\n\n// set up additional fx\nNdef(\\fx2).play;\nNdef(\\fx2)[0] = \\filter -> {arg in;\n in + AllpassC.ar(in, 0.2, 0.2, [3, 5]);\n};\n\n);\n\n// play a pattern\nPbind(\\instrument, \\synth1, \n // specify custom event type\n \\type, \\nbind, \n // switch between fx\n \\ndef, Pseq([\\fx1, \\fx2], inf),\n \\degree, Pwhite(0, 5, inf)\n).play;\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Time and relative dimensions in SC?"}, {"role": "assistant", "content": "```supercollider\n(\n\n{\nvar output, filtFreq, noise, noiseAmp, amp = 0.4, chain;\nvar tardRate = 0.4, combs;\n\nnoiseAmp = SinOsc.kr(0.38, 0.2).exprange(0.1, 1);\n\nnoise = BrownNoise.ar(noiseAmp);\n\nfiltFreq = SinOsc.kr(tardRate).range(400, 1800);\nnoise = RLPF.ar(noise, filtFreq, 0.7);\n\nchain = FFT(LocalBuf(256), noise);\nchain = PV_BinShift(chain, SinOsc.kr(tardRate * 0.986, 0.7).range(0.96, 1.052), SinOsc.kr(tardRate * 1.003, 0.61).range(-3, 2.1));\nchain = PV_BinScramble(chain, 0.05, 0.1, 1.0 ); \nnoise = IFFT(chain);\nnoise = noise.fold(-0.5, 0.5);\ncombs = Mix(\n [\n CombL.ar(noise, 0.1, SinOsc.kr(tardRate * 0.9966, 0.1).range(0.00032, 0.00028) * 3.4, 0.4, 0.06),\n CombL.ar(noise, 0.1, SinOsc.kr(tardRate * 0.99684, 0.1).range(0.000318, 0.000266) * 3.397, 0.4, 0.06)\n ]\n) * 1.2;\n\noutput = (noise + combs) * amp;\noutput = HPF.ar(output, 80);\noutput ! 2\n\n}.play\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for SOUND 1, from orig Influx Example."}, {"role": "assistant", "content": "```supercollider\n// SOUND 1, from orig Influx Example\n(\n// // // if JITLibExtensions are used, you can make space local:\n// Ndef(\\dog).addSpec(\\intv, [-24, 24]);\n// Ndef(\\dog).addSpec(\\timescale, [0.01, 10, \\exp]);\n// Ndef(\\dog).addSpec(\\curve, [-10, 10]);\n// Ndef(\\dog).addSpec(\\ffreq, \\freq);\n//\n// Ndef(\\dog).addSpec(\\loopnode, [0, 12]);\n// Ndef(\\dog).addSpec(\\dens, [10, 1000, \\exp]);\n// Ndef(\\dog).addSpec(\\resfreq, \\freq);\n// Ndef(\\dog).addSpec(\\ringtime, [0.01, 1, \\exp]);\n\nSpec.add(\\intv, [-24, 24]);\nSpec.add(\\timescale, [0.01, 10, \\exp]);\nSpec.add(\\curve, [-10, 10]);\nSpec.add(\\ffreq, \\freq);\n\nSpec.add(\\loopnode, [0, 12]);\nSpec.add(\\dens, [10, 1000, \\exp]);\nSpec.add(\\resfreq, \\freq);\nSpec.add(\\ringtime, [0.01, 1, \\exp]);\n\n\nNdef(\\dog, { |amp=0, freq=250, intv=19, timescale=1, curve=0, loopnode=0, dens = 10, resfreq = 500, ringtime = 0.01|\n var n = 15;\n var env = EnvGen.kr(\n Env({ 1.0.rand2 }!(n+1), {1.0.rand}!n, curve, releaseNode: n-1, loopNode: loopnode.min(n-3)),\n timeScale: timescale);\n var pitch = (env * [1, 0.33, -1] * intv).midiratio * freq;\n var form = Formant.ar(pitch, pitch.rotate(1) * 1.6, pitch.rotate(2) * 2.6);\n\n var dusty = Ringz.ar(\n Dust.ar(dens!3),\n resfreq * LFNoise0.kr([3, 5, 7], 0.5, 1),\n ringtime)\n * ((dens ** -0.5) * (ringtime ** -0.3)\n );\n\n Splay.ar(form * dusty, level: amp) ;\n});\n);\n\nNdef(\\dog).set(\\amp, 0.2).vol_(0.2);\nNdef(\\dog).gui.moveTo(400, 380);\n\n/*\n// Ndef(\\dog).addHalo(\\orderedNames, Ndef(\\dog).controlKeys);\nNdef(\\dog).controlKeys;\nNdef(\\dog).vol_(0.5);\nNdefPreset( Ndef(\\dog) ).loadSettings;\nNdef(\\dog).play;\nNdef(\\dog).gui;\n*/\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Idea: network of loosely connected nodes?"}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\nodeTest, {\n // the input\n// var input = Impulse.ar([1, 3, 5].reciprocal * 1, phase: [0, 0.25, 0.5]).sum;\n\n //var input = Impulse.ar([2, 3], phase: [0, 0.25]).sum;\n// var input = Select.ar(Line.kr(0, 1, 10) * SinOsc.ar(0.01).range(0, 1), [Impulse.ar([0.2, 0.3], phase: [0, 0.25]).sum, LocalIn.ar(1)]);\n\n var input = Select.ar(Line.kr(0, 1, 10), [Impulse.ar(0.134), LocalIn.ar(1)]);\n // the nodes, each takes its predecessor as input and estimates the duration between two events.\n var nodes = (1..20).inject([input], {|last, item|\n var dur = Gate.ar(\n Timer.ar(TDelay.ar(last.first, Rand(1, 4))),\n last.first\n );\n\n [TDuty.ar(\n dur.lag(20),\n TDelay.ar(last.first, dur.lag(20)),\n 1\n )] ++ last\n });\n\n\n LocalOut.ar(nodes.first);\n\n // add a pitch to each\n nodes = nodes.collect{|node, i| SinOsc.ar((500 + (i*250)), 0.9pi)\n// * Decay2.ar(node, 0.01, 0.2)\n * EnvGen.ar(Env.perc(0.0001, 0.1), gate: node)\n * 2 * (25-i) * 0.01};\n\n // splay in stereo field\n //nodes.sum!2;\n Splay.ar(nodes)// + (SinOsc.ar(2000) * Decay2.ar(input, 0.01, 0.2) * 0.1);\n\n}).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// sound example\n(\nvar a = { 1.0.rand };\nvar b = a.linexp(0, 1, 40, 20000);\nfork {\n 15.do {\n (instrument: \\default, freq: b.value).play;\n 0.3.wait;\n }\n}\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// sound example\n(\nvar a = { 1.0.rand };\nvar b = a.linexp(0, 1, 40, 20000);\nfork {\n 15.do {\n (instrument: \\default, freq: b.value).play;\n 0.3.wait;\n }\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Hasher`."}, {"role": "assistant", "content": "```supercollider\n{ Hasher.ar(Line.ar(0, 1, 1), 0.2) }.play;\n\n// Even adding a small amount to the input can result in a very different output. Compare these two examples:\n(\n{\n SinOsc.ar(\n Hasher.kr(MouseX.kr(0, 10).round(1), 300, 500)\n ) * 0.1\n}.play;\n);\n\n(\n{\n SinOsc.ar(\n Hasher.kr(MouseX.kr(0, 10).round(1) + 0.0001, 300, 500)\n ) * 0.1\n}.play;\n);\n\n// Output stays constant while not moving the mouse.\n(\n{\n SinOsc.ar(\n Hasher.kr(MouseX.kr(0, 10), 300, 500)\n ) * 0.1\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Ppatmod`."}, {"role": "assistant", "content": "```supercollider\n(\na = Ppatmod(\n Pseq([0, 0, 0, 0], 1),\n { |pat, i|\n var list;\n list = pat.list;\n pat.list = list.put(list.size.rand, 2);\n }, inf);\n\nx = a.asStream;\n30.do({ x.next.postln });\n);\n\n\n// Ppatmod used to modify a pattern that produces a sequence of pitches:\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Pn(\n Ppatmod(\n Pseq([0, 0, 0, 0], 1),\n { |pat, i|\n var list;\n list = pat.list;\n pat.list = list.put(list.size.rand, 2);\n }, 15),\ninf).asStream;\n\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, (a.next*5+77).midicps]);\n 0.13.wait;\n })\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `IBVAplayer.play` do? What arguments does it take?"}, {"role": "assistant", "content": "start playing back data (this will mute and take over input from the serial Arguments: rate — playback rate. e.g. 2=double speed; repeats — number of times to loop. e.g. inf=infinite; action — a Function that will be evaluated when finished playing."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for late night experimenting."}, {"role": "assistant", "content": "```supercollider\n(\nvar seed = thisThread.randSeed = 1e8.rand.debug('seed');\n{|dur = 30|\n var voices = 2.pow(1.rrand(4)),\n sig = DelayC.ar({ Pan2.ar(\n PMOsc.performList(\\ar, {\n var freq = Lag.ar(LFSaw.ar([10,15]/((1..5).choose*[1,2,4].choose)).exprange(\n {200.rrand(400)}!2, {500.rrand(1100)}!2\n * Line.kr(0.5.rrand(2), 3.rrand(8.0),dur)\n ));\n [freq, freq/[2,4].choose + SinOsc.kr([10,25],0,5), XLine.kr(0.1,1.rrand(3.0),dur/1.rrand(2.0))]\n }.()).sum/2,\n [SinOsc,LFTri].choose.kr({4.0.rrand(11)}!2 * [XLine,Line].choose.kr(1,4,dur))\n ).sum/2 \n * LFGauss.kr(XLine.kr(\\beat.kr, \\beat.kr / \\beat_change.kr, dur) / [0.5,1,2,4].choose, 0.3) \n * EnvGen.kr([\n Env.perc(0.1,dur),\n Env.sine(dur),\n Env.performList(\\new, {|len| [\n [0]++Array.rand(len,0.1,1)++[0],\n Array.rand(len,0.1,1).normalizeSum * dur,\n Array.rand(len-1,-3.0,3.0)+[0]\n ]}.(2.rrand(10)))\n ].choose) } ! voices, 4, { 0.1.rrand(4) } ! voices, 1 / voices).sum * Line.kr(1,1,dur+5,doneAction:2);\n sig = Rotate2.ar(sig[0],sig[1], LFSaw.kr(Duty.kr(dur/4.rrand(16), 0, Drand([-1*\\beat.kr,\\beat.kr].reciprocal,inf))));\n}.play(args:[\n dur:1.rrand(25.0).debug('dur'), \n beat:1.rrand(6)*(1..4).reciprocal.choose/4, \n beat_change:1.rrand(8)\n])\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `FoaBalance.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "First Order Ambisonic (FOA) balance transformer Arguments: in — The B-format signal, an array: [w, x, y, z]; angle — The distortion angle, in radians. -pi/2 to pi/2; mul — Output will be multiplied by this value.; add — This value will be added to the output.."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Re: Dark sea horns."}, {"role": "assistant", "content": "```supercollider\n(\n Ndef(\\x, {\n var output;\n var delayTime;\n var delayMax = 0.2;\n var delayAdd = 0.1;\n var pulseFreq = 0.5;\n var proxyMul = 2;\n var pulseMin = 40;\n var pulseMax = 130;\n var numOfEchos = 2;\n\n var mainPulse = LFPulse.ar(pulseFreq, 0, 0.5).range(pulseMin, pulseMax);\n var proxy = Ndef(\\x).ar * proxyMul;\n var ampModFreq = SinOsc.ar(0.01, 0).range(0.3, 30);\n var ampMod = LFNoise1.ar(ampModFreq, 6);\n output = SinOsc.ar(mainPulse + proxy, 0, ampMod).tanh;\n numOfEchos.do{\n delayTime = {delayMax.rand + delayAdd}!2;\n output = AllpassL.ar(output, 0.1, delayTime, 5);\n };\n output.tanh;\n }).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Another fibonaccy melody."}, {"role": "assistant", "content": "```supercollider\n(\nc=13;a=Array.fib(64,0,1);b=Array.fill(size:c,function:{arg i;a[i]%12});\np=1/(21-c);Pdef(\\x,Pbind(\\dur,p,\\degree,Pseq(b,1,0)));\nr=Array.fill(c,{arg i;Pbindf(Pdef(\\x),\\mtranspose,1-b[i]);});\nPseq(r,(1/p)).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `MIDIFuncBothCAMessageMatcher` in SuperCollider briefly."}, {"role": "assistant", "content": "MIDIFuncBothCAMessageMatcher — Matches incoming MIDI messages to responder funcs based on message channel and source This is used by MIDIMessageDispatcher to match incoming MIDI messages to instances of MIDIFunc or MIDIdef using message source and MIDI channel (when the MIDIFunc specifies an array of channels). This class is private, and generally users should not need to address instances directly. Category: External Control > MIDI > Matchers."}]} -{"conversations": [{"role": "user", "content": "What is `Bag`?"}, {"role": "assistant", "content": "Bag — Unordered collection of objects"}, {"role": "user", "content": "What does `Bag.new` do?"}, {"role": "assistant", "content": "Creates a Bag with an initial capacity for n objects."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nBag[1, 2, 3].add(4).postln;\n\nBag[1, 2, 3].add(3).postln;\n\nBag[\"abc\", \"def\", \"ghi\"].add(\"jkl\").postln;\n\nBag[\"abc\", \"def\", \"ghi\"].add(\"def\").postln;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BPF`."}, {"role": "assistant", "content": "```supercollider\n{ BPF.ar(Saw.ar(200, 0.5), FSinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3600, 4000), 0.3) }.play;\n\n{ BPF.ar(Saw.ar(200, 0.5), MouseX.kr(100, 10000, 1), 0.3) }.play;\n\n // BPF on control signals:\n(\n{ var vib = BPF.kr(PinkNoise.kr, MouseX.kr(1, 100, 1), 0.3) * 10;\n SinOsc.ar(vib * 200 + 600) * 0.2 }.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\nx = SynthDef(\"help-node-set\", { |freq = #[440, 450, 460], out = 0|\n Out.ar(out, Mix(SinOsc.ar(freq, 0, 0.1)))\n}).play\n);\nx.set(\\freq, [1, 2, 3] * 400 + [1, 2, 3], \\out, 1); // two pairs\nx.set(\\freq, [3] * 400 + [1, 2, 3], \\out, 1); // two pairs\nx.set(0, [660, 680, 720], 1, 0; // freq is the first argument, so it's index is 0. out is index 1.\nx.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\nx = SynthDef(\"help-node-set\", { |freq = #[440, 450, 460], out = 0|\n Out.ar(out, Mix(SinOsc.ar(freq, 0, 0.1)))\n}).play\n);\nx.set(\\freq, [1, 2, 3] * 400 + [1, 2, 3], \\out, 1); // two pairs\nx.set(\\freq, [3] * 400 + [1, 2, 3], \\out, 1); // two pairs\nx.set(0, [660, 680, 720], 1, 0); // freq is the first argument, so it's index is 0. out is index 1.\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `EZLists.insertItem` do? What arguments does it take?"}, {"role": "assistant", "content": "Inserts a list/menu item at index Arguments: index — An Integer. The index where to insert an item.; name — An instance of String or Symbol. The name of the list/menu item.; action — An instance of Function.."}]} -{"conversations": [{"role": "user", "content": "What does `Slider2D.ctrl_scale` do? What arguments does it take?"}, {"role": "assistant", "content": "The factor by which #-step is multiplied when incrementing or decrementing the values by keyboard while the Ctrl key is Arguments: A Float.."}]} -{"conversations": [{"role": "user", "content": "What is `Pdef`?"}, {"role": "assistant", "content": "Pdef — stream reference definition"}, {"role": "user", "content": "What does `Pdef.all` do?"}, {"role": "assistant", "content": "A global IdentityDictionary with all proxies."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\nPdef(\\x, Pbind(\\note, Pbrown(0, 6, 0.1, inf)));\nPdef(\\x).quant = 0; // no waiting.\nPbindf(Pdef(\\x), \\dur, 0.03).play;\nPbindf(Pdef(\\x), \\dur, 0.1, \\ctranspose, 15).play;\nPbindf(Pdef(\\x), \\dur, 0.3, \\ctranspose, 2).play;\n// now change the definition\nPdef(\\x, Pbind(\\note, Pseq([0, 3, 5, 7, 9, 11], inf)));\nPdef(\\x, Pbind(\\freq, Pseq([1000, 1923, 245.2, 1718] / 1.2 + 0.1, inf)));\n```"}]} -{"conversations": [{"role": "user", "content": "What is `IdentitySet`?"}, {"role": "assistant", "content": "IdentitySet — a set according to identity"}, {"role": "user", "content": "What does `IdentitySet.add` do?"}, {"role": "assistant", "content": "Add anObject to the IdentitySet. An object which is equal to an object already in the IdentitySet will not be added. `IdentitySet[1, 2, 3].add(4);`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nIdentitySet[1, 2, 3].add(4);\nIdentitySet[1, 2, 3].add(3);\n// the two strings are equal but not identical\nIdentitySet[\"abc\", \"def\", \"ghi\"].add(\"def\");\n// symbols are guaranteed to be identical if they are equal\nIdentitySet['abc', 'def', 'ghi'].add('def');\nIdentitySet['abc', 'def', 'ghi'].add('jkl');\n```"}]} -{"conversations": [{"role": "user", "content": "What is `EventPatternProxy` in SuperCollider?"}, {"role": "assistant", "content": "EventPatternProxy — event stream reference Keeps a reference to a stream that can be replaced while in use. Category: JITLib > Patterns, Live Coding."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Will nobody switch the damn thing off??"}, {"role": "assistant", "content": "```supercollider\n(\n\n{\nvar dseq, trig;\n\ndseq = Dseq([SinOsc.ar(45).range(-5, 12), SinOsc.ar(SinOsc.ar(0.285).range(42, 48)).range(-9, 19), 9, 0, -12], inf);\ntrig = Impulse.ar(SinOsc.ar(0.2).range(44, 46));\nSinOsc.ar(\n (77 + Demand.ar(trig, 0, dseq)).midicps,\n 0,\n 0.5\n) ! 2\n\n\n}.play\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `QPalette.highlight` do?"}, {"role": "assistant", "content": "Convenience method to get or set the color for the 'highlight'"}]} -{"conversations": [{"role": "user", "content": "What is `IsOdd` in SuperCollider?"}, {"role": "assistant", "content": "IsOdd — validates that the tested object is an odd number Category: Libraries > crucial > Constraints."}]} -{"conversations": [{"role": "user", "content": "I get 'Node not found' when I call .set on a Synth after a while."}, {"role": "assistant", "content": "The Synth was freed and the language still holds a reference. That happens whenever the SynthDef used `doneAction: 2` and the envelope finished, or when something called `freeAll`/`CmdPeriod`. Guard it with `if (x.notNil and: { x.isPlaying }) { x.set(\\freq, 300) }`, or store the node in a variable that you clear when it ends. For sustained sounds the right pattern is a `gate` argument with `doneAction: 2` on the EnvGen, so the node lives until you release it."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Midterm Q3 (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"bell\", {arg freq, amp;\n\n\n var env, snd, partials, relativeAmps;\n\n partials = [0.5, 1, 1.19, 1.56, 2, 2.51, 2.66, 3.01, 4.1];\n relativeAmps = [0.25, 1, 0.8, 0.5, 0.9, 0.4, 0.3, 0.6, 0.1];\n\n env = Env.perc(\n attackTime: 0.01,\n releaseTime: 5,\n level: amp*relativeAmps).kr(doneAction:2);\n\n snd = SinOsc.ar(\n freq: freq*partials,\n mul: env\n );\n\n snd = Mix.ar(snd);\n\n Out.ar(0, snd * 0.1 ! 2);\n\n}).add;\n);\n\n\n//Test your \"bell\" SynthDef with the following Pbind:\n\n\n(\nPbind(\n \\instrument, \"bell\",\n \\degree, Pwhite(-5, 10),\n \\dur, Pwhite(3, 6),\n \\amp, Pwhite(0.1, 0.5)\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Bell example using Ndef?"}, {"role": "assistant", "content": "```supercollider\n(\nvar fundamental = 131;\nvar dur = 10;\nvar partials =\n[\n [1, 0.5, dur * 1],\n [1.02, 0.3, dur * 1],\n [1.01, 0.14, dur * 0.5],\n [2.44, 0.17, dur * 0.8],\n [3.31, 0.9, dur * 0.5],\n [5.1, 0.1, dur * 0.56],\n [5.9, 0.1, dur * 0.9],\n [11.01, 0.09, dur * 1],\n [13, 0.01, dur * 0.5],\n [15, 0.01, dur * 0.2],\n [16, 0.05, dur * 0.02],\n [19, 0.10, dur * 0.01],\n [20, 0.01, dur * 0.2],\n [24, 0.01, dur * 0.2],\n [4, 3, dur * 0.002] // attack\n];\n\nNdef(\\quickBell).fadeTime = 0;\nNdef(\\quickBell, {\n var snd, env;\n env = Env.perc(\n attackTime: 0.001,\n releaseTime: partials.flop.at(2),\n level: partials.flop.at(1)\n ).kr;\n // fundamental + inharmonics\n snd = SinOsc.ar(\n freq: fundamental * partials.flop.at(0);\n );\n snd = snd * env;\n snd = Splay.ar(snd);\n snd = Limiter.ar(snd);\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Pisano Periods are used to generate melodies."}, {"role": "assistant", "content": "```supercollider\n/*\nThe Fibonacci-sequence as controlsignal: melodies from Pisano Periods.\nBecause the sequence runs more or less exponentially, it seems best to assign the values to frequencies. \n*/\ns.boot;\nSynthDef( \\puls, {|freq=30, out|\n Out.ar(out,\n SinOsc.ar(freq, mul: 0.5*EnvGen.kr(Env.perc(0.01,0.75), doneAction: 2)),0)\n}).add;\n(\nm=3000; //max index, 5 minutes = 300 when dur=0.1\na=Array.newClear(m);//two arrays to store numbers from the Pisano Periods\nb=Array.newClear(m);\na.put(0,0); \na.put(1,1);\nd=2; //even divisor\ni=2; //index\nwhile ({i Generators > Stochastic."}]} -{"conversations": [{"role": "user", "content": "What does `SimpleNumber.ellint2C` do?"}, {"role": "assistant", "content": "Returns the complete elliptic integral of the second kind, Legendre form. Requires `-1 <= k <="}]} -{"conversations": [{"role": "user", "content": "Explain `Dstutter` in SuperCollider briefly."}, {"role": "assistant", "content": "Dstutter — Demand rate input replicator Category: UGens > Demand."}]} -{"conversations": [{"role": "user", "content": "I get 'index out of range' when playing a buffer."}, {"role": "assistant", "content": "A read position is past the end of the buffer. `PlayBuf` with a `startPos` in frames beyond `~buf.numFrames`, or a `BufRd`/`GrainBuf` whose phase goes above 1, produces this. For GrainBuf, pos is normalised 0..1, so pass `LFNoise1.kr(1).range(0, 1)` rather than a frame count; for PlayBuf, cap the position at `~buf.numFrames - 1`. If you just loaded the file, check `~buf.numFrames` — a failed read gives 0 frames and every position is out of range."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Benoit XVI (a SuperCollider snippet)?"}, {"role": "assistant", "content": "```supercollider\n// a supercollider port of Coloscope's Pure-data organ. \n\nSynthDef(\\benoit, {\n arg out=0, amp=0.5, freq=440, semione=12, semitwo=24, trackingmul=2, gate=1, sus=1, rel=1;\n var env, sig, sig1, sig2, sig3, ringmod, tracking, sig4;\n\n sig1 = Pulse.ar(freq, 0.17);\n sig2 = Pulse.ar((freq.cpsmidi - semione).midicps, 0.17);\n sig3 = Pulse.ar((freq.cpsmidi + semitwo).midicps, 0.17);\n\n sig4 = LFTri.ar((freq.cpsmidi - semitwo).midicps);\n\n env = EnvGen.ar(Env.linen(0,sus,rel), gate, doneAction:2);\n\n tracking = ((freq * 1) + freq) * trackingmul;\n sig = sig1 + sig2 + sig3 + (sig4 * 2);\n\n\n sig = RLPF.ar(sig, tracking, 1, 0.33);\n sig = FreeVerb.ar(sig, 0.12);\n sig = sig.tanh;\n sig = sig * env;\n\n\n Out.ar(out, (sig * amp));\n\n}).add;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Patch.argsForSynth` do?"}, {"role": "assistant", "content": "Pairs an Instr with inputs that that will be passed to the Instr"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Array`."}, {"role": "assistant", "content": "```supercollider\n(\nx = {\n SinOsc.ar([0.1, 0.2], 0).poll * 0.1\n}.play;\n);\nx.trace; // By tracing the Synth you can see the two Poll units we created\nx.free\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nDelayL.ar(z, 0.2, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\n(\n// recursive application of delay.\n{\nz = Decay2.ar(Dust.ar(1, 0.5), 0.01, 0.1, Saw.ar(100 + [0, 1]));\n5.do { |i| z = DelayL.ar(RLPF.ar(z, Rand(100, 3000), 0.03), 1, 1 / (2**i), 1, z * 0.5) };\nz\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nDelayL.ar(z, 0.2, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\n(\n// recursive application of delay.\n{\nz = Decay2.ar(Dust.ar(1, 0.5), 0.01, 0.1, Saw.ar(100 + [0, 1]));\n5.do { |i| z = DelayL.ar(RLPF.ar(z, Rand(100, 3000), 0.03), 1, 1 / (2**i), 1, z * 0.5) };\nz\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Fdef`."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\ns.boot;\nSynthDef(\"gpdef\",\n { |out = 0, freq = 440, sustain = 0.05, amp = 0.1|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain), doneAction: Done.freeSelf) * amp;\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n// fork a thread that plays some sounds\n(\nFdef(\\freq, 440);\nFdef(\\dur, 0.2);\n\nfork {\n loop {\n s.sendMsg(\"/s_new\", \"gpdef\", -1, 1, 1, \\freq, Fdef(\\freq).value);\n Fdef(\\dur).value.wait;\n }\n};\n);\n\n// some modifications\n\nFdef(\\freq, Fdef(\\midinote, 60).midicps);\nFdef(\\midinote, { [67, 64, 65].choose });\nFdef(\\midinote, { [67, 64, 65].choose } + Fdef(\\offset));\nFdef(\\offset, { 4.rand });\nFdef(\\dur, 0.23);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Int32Array.readFromStream` do?"}, {"role": "assistant", "content": "an array whose indexed slots are all of the same type"}]} -{"conversations": [{"role": "user", "content": "What is `AnnotatedDebugNodeWatcher` in SuperCollider?"}, {"role": "assistant", "content": "AnnotatedDebugNodeWatcher — Watches server replies for node ended/started events using AbstractPlayer's Node annotation system Like the normal DebugNodeWatcher, this watches server replies for node ended/started events. Category: Libraries > crucial > Debugging."}]} -{"conversations": [{"role": "user", "content": "What does `ModMap.map` do? What arguments does it take?"}, {"role": "assistant", "content": "A tool for modulating Ndefs Arguments: Input Ndef; key for argument to be modulated; key for type of modulation from ControlFiles; spec array; extraArguments for modulating signal (for example to control modulation frequency); lag time; where to post?."}]} -{"conversations": [{"role": "user", "content": "What does `CountLimit.count` do?"}, {"role": "assistant", "content": "Counts how many items have been presented to it. returns true until limit false thereafter"}]} -{"conversations": [{"role": "user", "content": "What is `AbstractFunction`?"}, {"role": "assistant", "content": "AbstractFunction — An object which responds to a set of messages that represent mathematical functions"}, {"role": "user", "content": "What does `AbstractFunction.neg` do?"}, {"role": "assistant", "content": "`a = { 10.rand.postln }; b = a.neg; b.value;`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na = { |x, root = 60| x + root }; b = a.midicps; [a.value(9), b.value(9)];\na = Pseries(60, 1, inf).midicps; a.asStream.nextN(12);\n{ a = LFNoise1.ar(1) * 5 + 60; Pulse.ar(a.round.midicps) * 0.1 }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `PSVsect_oi.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new PSVsect_oi Arguments: genList — An array of generators and corresponding offsets. Allowed generators: Integers, Streams or Patterns producing intervals or Sieves itself. Integers and Stream/Pattern output must be strictly positive. Integers as generators produce constant intervals. Offsets must be integers.; maxLength — Integer. Maximum number of items, which the stream will return. Defaults to inf.; limit — Integer. Limit up to which intervals can be returned by the stream. If no limit is passed, integer intervals might be returned up to default summation limit of 65536.."}]} -{"conversations": [{"role": "user", "content": "Explain `FFTSubbandFlatness` in SuperCollider briefly."}, {"role": "assistant", "content": "FFTSubbandFlatness — Spectral flatness, divided into subbands Calculates the spectral flatness measure, in the same manner as FFTFlatness, but divides the spectrum into (adjacent, non-overlapping) subbands, so returns separate measures for the different subbands. Category: UGens > Analysis, UGens > FFT."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Ppar two intrument cumbia base."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\bass, { | atk = 0.01, dur = 0.15, freq = 50, amp=0.8 |\n var env, osc;\n env = EnvGen.kr( Env.perc( atk, dur-atk, amp, 6 ), doneAction: 2 );\n osc = BPF.ar(LFSaw.ar(freq), freq, 2, mul: env) ! 2;\n Out.ar([0,1],osc);\n}).add;\n);\n\n(\nSynthDef('wiro', { | amp = 0.1 |\n var osc, env, noise, out;\n noise = LPF.ar(WhiteNoise.ar(1),6000);\n osc = HPF.ar(noise,2000);\n //env = Line.ar(1, 0, 0.1);\n env = EnvGen.kr(Env.perc(0.01,0.05), doneAction: 2);\n out = (osc * env);\n Out.ar([0,1],out*amp)\n}).add;\n);\n\n(\nPpar([\n Pbind(\n \\instrument, \\bass,\n \\degree, Pseq([ Pseq([Pn(Pshuf([0,2,4],1),2),Pn(Pshuf([3,5,7],1),2)],2),Pn(Pshuf([-3,-1,1],1),2) ],inf),\n \\dur, Pseq([0.25,0.5,0.25],inf),\n \\legato, Pseq([ Pgeom(0.05, 0.05, 40), Pgeom(2.05, -0.05, 40) ], inf),\n \\octave, 3,\n \\amp, 0.03\n ),\n\n Pbind(\n \\instrument, \\wiro,\n \\dur, Pseq([0.5,0.25,0.25], inf),\n \\legato, Pseq([ Pgeom(0.05, 0.05, 40), Pgeom(2.05, -0.05, 40) ], inf),\n \\amp, 0.05,\n )\n]).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Just a dirty FM bass shuffling?"}, {"role": "assistant", "content": "```supercollider\n(\nfork{\n SynthDef(\\basicFM, {|out = 0, gate = 1, amp = 1, carFreq = 1000, modFreq = 100, modAmount = 2000, clipAmount = 0.1|\n var modEnv = EnvGen.ar(Env.adsr(0.5, 0.5, 0.7, 0.1, peakLevel: modAmount), gate);\n var mod = SinOsc.ar(modFreq) * modEnv;\n var car = SinOsc.ar(carFreq + mod);\n var ampEnv = EnvGen.ar(Env.adsr(0.1, 0.3, 0.7, 0.2, peakLevel: amp), gate, doneAction: 2);\n var clip = clipAmount * 500;\n Out.ar(out, (car * ampEnv * clip).clip(-0.7, 0.7) * 0.1);\n }).add;\n\n s.sync;\n\n Pbind(*[\n instrument: \\basicFM,\n out: [0, 1],\n dur: Pseq([1/7, 1/3] / 1.2, inf),\n sustain: Pkey(\\dur),\n amp: 1/4,\n carFreq: Pseq([1, 1, 1, 2] * 350, inf),\n modFreq: Pkey(\\carFreq) * (1/8),\n modAmount: Pseq([2, 1, 0.5, 2, 1, 0.5, 2, 1, 2, 1, 0.5, 2, 1, 0.5, 2, 4] * 500, inf),\n clipAmount: Pseq([Pn(0.1, 32), Pn(1, 32)], inf)\n ]).play;\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// check blockSize before (or reset blockSize in examples)\n\n(\nif (s.options.blockSize != 64) {\n s.options.blockSize = 64;\n s.quit.reboot;\n}\n);\n\n// func can take an index as third arg, it runs from 0 to blockSize - 1\n// this can be used to define the feedback relation depending on it\n\n// note that inDepth is set to [2, 1] as we look back to inSig[i-1] (in[1][0]),\n// but not to lfo[i-1] (in[0][1] == lfo[0]), this saves 128 UGens !\n\n\n(\nx = {\n var inSig = SinOsc.ar([50, 50.1]);\n var lfo = SinOsc\n// …\n```"}, {"role": "assistant", "content": "check blockSize before (or reset blockSize in examples) func can take an index as third arg, it runs from 0 to blockSize - 1 (Fb1: single sample feedback / feedforward pseudo ugen)"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// Note that constructions like SynthDef(...) and Synth(...) are short for SynthDef.new(...), etc.\n// With SynthDef it is common to chain this with calls on the resulting instance,\n// e.g. SynthDef(...).add or SynthDef(...).play\n\n// make a simple def and send it to the server\n\ns.boot;\nSynthDef(\\SimpleSine, { |freq = 440, out| Out.ar(out, SinOsc.ar(freq, 0, 0.2)) }).add;\n\n// the above is essentially the same as the following:\nd = SynthDef(\\SimpleSine, { |freq = 440, out| Out.ar(out, SinOsc.ar(freq, 0, 0.2)) });\nd.add;\n// …\n```"}, {"role": "assistant", "content": "Note that constructions like SynthDef(...) and Synth(...) are short for SynthDef.new(...), etc. With SynthDef it is common to chain this with calls on the resulting instance, (SynthDef: Client-side representation of a synth definition)"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// Handy code for quick class demonstrations.\n// Comparing a few intervals - Just Intonation versus 12-tone Equal Tempered\n\n// Major third (just)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 60.midicps * 5/4], mul: 0.1) }).play\n// Major third (ET12)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 64.midicps], mul: 0.1) }).play;\n\n// Major second (just)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 60.midicps * 9/8], mul: 0.1) }).play\n// Major second (ET)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 62.midicps], mul: 0.1) }).play;\n\n// Perfect fifth (just)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 60.midicps * 3/2], mul: 0.1) }).play\n// Perfect fifth (ET)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 67.midicps], mul: 0.1) });\n```"}, {"role": "assistant", "content": "Simple handy code for quick class demonstrations. Hear and compare a few intervals in Just Intonation versus 12-tone Equal Tempered tuning."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// nOut allows for switching between iteration levels up to maximum n\n\n(\ny = {\n |nOut = 10|\n GFIS.ar({ |x| sin(LFDNoise1.ar(20).range(3, 3.5) * x) }, [0.2, 0.3], 10, nOut) * 0.1\n}.play\n);\n\n\ny.set(\\nOut, 9)\n\ny.set(\\nOut, 8)\n\ny.release\n\n\n// it can be passed an array of levels, \n// the resulting multichannel signal can e.g. be used for crossfaded switching with DXMix\n\n// switch between 3 mono signals and double them\n\n(\ny = {\n var src = GFIS.ar({ |x| sin(LFDNoise3.ar(30).\n// …\n```"}, {"role": "assistant", "content": "nOut allows for switching between iteration levels up to maximum n it can be passed an array of levels, (GFIS: generalized functional iteration synthesis pseudo ugen)"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Entities (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\ota, { arg freq=200, pan=0, amp=0.1;\n var sig;\n var env1, env2, env3, env4, env5, env6, env7, env8;\n var sig1, sig2, sig3, sig4, sig5, sig6, sig7, sig8;\n var fac = 1/SelectX.kr( SinOsc.kr(1/113).range(0,6), [1/2,1,2,4,8,64,128] )/8;\n env1 = EnvGen.ar(Env([42,21,42,30,84],[4,4,7.5,0.5]/fac).circle, 1);\n env2 = EnvGen.kr(Env([0,0,2,1],[4,4,4]).circle, 1);\n env3 = XLine.kr(1,0.1,20*1);\n\n freq = 8.collect({ arg x;\n freq + ( env1 * x ) + [0,SinOsc.kr(x+1, mul:env2).range(0,10*x)];\n });\n //freq.debug.shape.debug(\"freq\");\n sig = SinOsc.ar( freq / [1,2,4]);\n //sig.shape.debug(\"sig1\");\n sig = sig.collect({ arg isig, x;\n isig = SelectX.ar( SinOsc.kr(x+1/34).range(0,1), [isig, isig.fold2(env3)]);\n isig = SelectX.ar( SinOsc.kr(1/223, 3pi/2).range(0,1), [isig, ( isig * SinOsc.kr(1/48 * ( x + 1 )).range(1,100) ).tanh]);\n });\n //sig.shape.debug(\"sig2\");\n sig1 = sig.flop[1];\n sig = sig.flop[0];\n //sig.debug(\"sig\");\n sig1 = Pan2.ar(sig1, SinOsc.ar(sig1.size.collect({ arg x; SinOsc.kr(x/10+1.2).range(0,8) })) * SinOsc.kr(1/48).range(0,1), amp).mean;\n sig = Pan2.ar(sig, SinOsc.ar(sig.size.collect({ arg x; SinOsc.kr(x/10+1.1).range(0,8) })) * SinOsc.kr(1/58).range(0,1), amp).mean;\n sig = sig + sig1;\n sig = sig / 2.0;\n sig = LPF.ar(sig, 1999);\n sig;\n}).play;\n);\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Latoocarfian2DL.ar(MouseX.kr(20, SampleRate.ir * 0.5), MouseX.kr(40, SampleRate.ir), mul:0.2) }.play(s);\n\n\n(\n{ Latoocarfian2DL.ar(\n SampleRate.ir/4,\n SampleRate.ir,\n LFNoise2.kr(2.dup, 1.5, 1.5),\n d:LFNoise2.kr(2.dup, 0.5, 1.5),\n mul:0.2\n) }.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Latoocarfian2DL.ar(MouseX.kr(20, SampleRate.ir * 0.5), MouseX.kr(40, SampleRate.ir), mul:0.2) }.play(s);\n\n\n(\n{ Latoocarfian2DL.ar(\n SampleRate.ir/4,\n SampleRate.ir,\n LFNoise2.kr(2.dup, 1.5, 1.5),\n d:LFNoise2.kr(2.dup, 0.5, 1.5),\n mul:0.2\n) }.play(s);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `TextView.hasVerticalScroller` do? What arguments does it take?"}, {"role": "assistant", "content": "Whether the vertical scroller is shown. Note that if #-autohidesScrollers is `true` the scroller may be hidden despite this variable being set to `true`. Defaults to Arguments: A Boolean.."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\delay;\n~description = \"Simple delay line\";\n~channelLayout = \\mono;\n~function = {|in = 0, del = 0.5|\n DelayC.ar(in, 2, del);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nSynthDef(\\pluck, {|freq = 440, dur = 1|\nvar klang,note;\ndur = dur * 2;\nnote = freq.cpsmidi;\nnote = note + (LFNoise2.ar(20).range(-1,1) * (1/8));\nklang = SinOsc.ar((note * [1,1.002]).midicps, phase: VarSaw.ar(note.midicps, width: Line.ar(1,0.2,dur))) * 0.3;\nklang = klang * XLine.ar(1,1/10000,dur,doneAction:2);\nOut.ar(0, klang);\n}).store;\n\nPbind(\n\\instrument, \\pluck,\n\\degree, Pn(Pseries(0, Pwrand([Pwhite(-3,3,inf).round(1),1],[32,1],inf), 4),inf)-1 + [0,2,-1,-14],\n\\dur, Pseq([4, [5,2,1]].convertRhythm / 2, inf),\n\\strum, Pwhite(0,1/8,inf),\n\\octave, [5,6]\n).play;\n```"}, {"role": "assistant", "content": "A synthdef and simple pbind to play some (pretty repetitive) bebop-ish arpeggios. The conjunction reminds me a bit of James Blake."}]} -{"conversations": [{"role": "user", "content": "What does `BusPlug.audio` do?"}, {"role": "assistant", "content": "Create a new audio rate instance on the given"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// a Buffer for the UGens to use, one second at the current sample rate\nb = Buffer.alloc(s, s.sampleRate * 1, 1);\n\n// write a signal into a delay, tap it at multiple times\nSynthDef(\\test, { |out, buffer|\n var src, tapPhase, tap1, tap2, tap3;\n src = WhiteNoise.ar(0.2) * Decay.kr(Dust.kr(3), 0.2);\n tapPhase = DelTapWr.ar(buffer, src);\n #tap1, tap2, tap3 = DelTapRd.ar(buffer, tapPhase,\n [0.2, 0.27, 0.303], // tap times\n 1, // no interp\n [1.\n// …\n```"}, {"role": "assistant", "content": "a Buffer for the UGens to use, one second at the current sample rate write a signal into a delay, tap it at multiple times (DelTapWr: Write to a buffer for a DelTapRd UGen)"}]} -{"conversations": [{"role": "user", "content": "What is `Bus`?"}, {"role": "assistant", "content": "Bus — Representation of a bus on the server"}, {"role": "user", "content": "What does `Bus.control` do?"}, {"role": "assistant", "content": "Allocate a control bus on the server."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\na = Bus.control(s, 1).set(440);\nb = Bus.control(s, 1).set(0.01);\n);\n(\nSynthDef(\\rlpf, { |out, ffreq, rq|\n Out.ar(out, RLPF.ar(WhiteNoise.ar(0.2), ffreq, rq))\n}).play(s, [\\ffreq, a.asMap, \\rq, b.asMap]);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// z and y are the same object\nvar y, z;\nz = [1, 2, 3];\ny = z.add(4);\nz.postln;\ny.postln;\n);\n\n(\n// in this case a new object is returned\nvar y, z;\nz = [1, 2, 3, 4];\ny = z.add(5);\nz.postln;\ny.postln;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// z and y are the same object\nvar y, z;\nz = [1, 2, 3];\ny = z.add(4);\nz.postln;\ny.postln;\n);\n\n(\n// in this case a new object is returned\nvar y, z;\nz = [1, 2, 3, 4];\ny = z.add(5);\nz.postln;\ny.postln;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Condition`."}, {"role": "assistant", "content": "```supercollider\n// the same, using hang\n\n(\nc = Condition.new;\n\nRoutine {\n 1.wait;\n \"waited for 1 second\".postln;\n 1.wait;\n \"waited for another second, now waiting for you ... \".postln;\n c.hang;\n \"the condition has stopped waiting.\".postln;\n 1.wait;\n \"waited for another second\".postln;\n \"waiting for you ... \".postln;\n c.hang;\n \"the condition has stopped waiting.\".postln;\n}.play;\n);\n\n// continue\nc.unhang;\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Snow (a SuperCollider snippet)?"}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\snow, { arg freq=200, pan=0, amp=0.1, speed=1;\n var sig;\n var size = 20;\n var trig = Impulse.ar({ rrand(1/1,15.0) } ! size * \\density.kr(1));\n sig = { WhiteNoise.ar } ! size;\n sig = sig.collect({ arg sig, x;\n var bpfreq = exprand(50.0,16000) * \\tone.kr(1);\n var bpfrq = 0.1 * SinOsc.ar(( x+1 ) * 1/153 * speed).exprange(0.1,4) * \\blur.kr(1);\n sig = BPF.ar(sig, bpfreq, bpfrq) * 34;\n sig = BPF.ar(sig, bpfreq, bpfrq) * 4;\n sig = sig * EnvGen.ar(Env([0,1,0],[0.1,0.8]), trig[x]);\n //sig = sig.fold2( LFNoise0.kr(1/23 * ( x+1 ) * speed).range(0.01,8) ) * 4;\n sig = sig * SinOsc.ar(1/700 * ( x+1 ) * speed).range(0.01,1);\n });\n sig = Pan2.ar(sig, ( { rrand(-1.0,1) } ! size * SinOsc.ar(1/132 * (1..size) * speed).range(0,1) ), amp).mean;\n}).play;\n);\nNdef(\\snow).fadeTime = 16;\nNdef(\\snow).edit;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `ServerLog.sendMsg` do? What arguments does it take?"}, {"role": "assistant", "content": "records OSC traffic to and from a Server and displays this in a browseable searchable interface Arguments: ... args. Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `UnaryOpUGen`."}, {"role": "assistant", "content": "```supercollider\na = WhiteNoise.ar; // a WhiteNoise\nb = a.squared; // a UnaryOpUGen.\nb.operator; // squared\n\n// sound example\n\n{ var a = LFSaw.ar(300).range(0, 2pi); a.sin * 0.1 }.play;\n\n// Plotting the \"abs\" unary operator (via the server):\n\n{ SinOsc.ar(300).abs }.plot\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Harmonics`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\na.ramp(1.0, 1.0); // returns a harmonic series\n\nb = Buffer.alloc(s, 512, 1);\n// harmonic series for freqs, ramp down for amps\nb.sine2(a.ramp(1.0, 1.0).postln, a.ramp(0.5, -0.025).postln, true, true, true);\n(\nz = SynthDef(\"help-Osc\", { |out = 0, bufnum = 0|\n Out.ar(out,\n Osc.ar(bufnum, 200, 0, 0.5)\n )\n});\n);\ny = z.play(s, [\\out, 0, \\bufnum, b]);\ny.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What is the difference between .ar, .kr and .ir?"}, {"role": "assistant", "content": "The rate method decides how often a UGen is evaluated. `.ar` runs at the audio rate, once per sample, and produces an audio signal. `.kr` runs at the control rate, once per block of 64 samples by default, so it is cheaper and is used for parameters that do not need sample accuracy. `.ir` is evaluated once when the Synth is created and then never again, for constants such as SampleRate.ir or a size. Using .kr where you need audio-rate modulation gives stepped, zipper-noise-like control; using .ar where .kr would do costs CPU."}]} +{"conversations": [{"role": "user", "content": "What is the correct way to stop everything?"}, {"role": "assistant", "content": "Depends on what is playing, and they are different layers:\n\n- `s.freeAll` — frees every node on the server (all sound stops, definitions survive).\n- `CmdPeriod.run` — stops everything scheduled on the clocks (Patterns, Routines, Tasks).\n- `Ndef.clear; Pdef.clear` — clears the JITLib proxies.\n- `s.quit` — shuts the server down entirely.\n\nIn a session the habit is `CmdPeriod.run` first (stops the sequencing), then `s.freeAll` if a drone is still\nsounding."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nd = { |freq = 440|\n var internalFreq;\n internalFreq = LFNoise0.ar(0.3, 300, 800);\n SinOsc.ar(\n LeastChange.kr(freq, internalFreq) // two sources of change: one external, one internal\n ) * 0.1\n}.play\n);\n\nd.set(\\freq, 800);\nd.set(\\freq, 900;\nd.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nd = { |freq = 440|\n var internalFreq;\n internalFreq = LFNoise0.ar(0.3, 300, 800);\n SinOsc.ar(\n LeastChange.kr(freq, internalFreq) // two sources of change: one external, one internal\n ) * 0.1\n}.play\n);\n\nd.set(\\freq, 800);\nd.set(\\freq, 900);\nd.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//This is almost exactly the same as kick3.scd, they've been morphed into kik3.scd!\n\n\nSynthDef(\"kik\", { |basefreq = 50, ratio = 7, sweeptime = 0.05, preamp = 1, amp = 1, decay1 = 0.3, decay1L = 0.8, decay2 = 0.15, out|\n var fcurve = EnvGen.kr(Env([basefreq * ratio, basefreq], [sweeptime], \\exp)),\n env = EnvGen.kr(Env([1, decay1L, 0], [decay1, decay2], -4), doneAction: 2),\n sig = SinOsc.ar(fcurve, 0.5pi, preamp).distort * env * amp;\n Out.ar(out, sig ! 2)\n}).add;\n```"}, {"role": "assistant", "content": "This is almost exactly the same as kick3.scd, they've been morphed into kik3.scd!."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//spinning box / cube\n//after Shiffman https://codingtrain.github.io/website-archive/CodingChallenges/112-3d-rendering.html\n\n(\nvar width= 640, height= 480, w,\ntheta= 0, speed= 0.01, box;\n\nw= RedWindow(\"3Dbox\", Rect(128, 64, width, height)).front;\nbox= Red3DBox();\n\n//--loop\nw.draw{\n theta= theta+speed;\n box.rotation= RedVector3D[theta, theta, theta];\n box.update;\n\n //--render\n box.render(1, 100); //1= exaggerate, 2= standard\n Pen.translate(width*0.5, height*0.5);\n Pen.strokeColor= Color.white;\n box.drawOutlines;\n Pen.fillColor= Color.white;\n box.draw;\n};\nw.play;\nCmdPeriod.doOnce({w.close});\n)\n```"}, {"role": "assistant", "content": "spinning box / cube after Shiffman https://codingtrain.github.io/website-archive/CodingChallenges/112-3d-rendering.html."}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for seeking an Array!: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(// * //watch the postWindow\na=[\"m\",\"x\",\"f\",\"k\",\"d\",\"p\"];\nx=Array;\ny=x.newClear(6);\n~mxfkdp=Task({\n inf.do({y.put(x.series(6,0,1).choose,a.scramble).postln;\n 0.03.wait;})}).play;\nm=fork({inf.do({\n \"array num:\".postcln;\n if(y[x.series(6,0,1).choose.postcln]==a,\n {\"lo encontraste!/found it!\".postcln;\n 1.do({GVerb.ar(\n EnvGen.ar(Env.perc(0.01,8),1,doneAction:2)*\n Blip.ar(XLine.kr(440,1600,8)),50,10,0.02)}.play);\n ~mxfkdp.stop;\n m.stop;}, \n {\"buscando.../seeking...\".postcln;});\n 0.03.wait})});\n);\n//.SCtweetLong\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `DiskIn`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n\n\n// create with cueSoundFile class method\nb = Buffer.cueSoundFile(s, ExampleFiles.apollo11, 0, 1);\nx = { DiskIn.ar(1, b) }.play;\nb.close; // must call close in between cueing\n// now use like named instance method, but different arguments\nb.cueSoundFile(ExampleFiles.apollo11);\n// have to do all this to clean up properly!\nx.free; b.close; b.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n{\n\nvar in, fft, dissonance;\n\n//in = SinOsc.ar(MouseX.kr(100,1000),0,0.1);\n//in = Mix(SinOsc.ar([440,MouseX.kr(440,880)],0,0.1)); \nin= SoundIn.ar; \n\nfft = FFT(LocalBuf(2048), in);\n\ndissonance=SensoryDissonance.kr(fft);\n\ndissonance.poll; \n\nOut.ar(0,Pan2.ar(0.1*Blip.ar(100,(dissonance.sqrt)*200))); \n}.play\n);\n\n\n\n//different fftsize, max num peaks, own normalisation, avoid clamping by setting high value (more CPU cost) \n(\n// …\n```"}, {"role": "assistant", "content": "in = SinOsc.ar(MouseX.kr(100,1000),0,0.1); in = Mix(SinOsc.ar([440,MouseX.kr(440,880)],0,0.1)); (SensoryDissonance: Perceptual feature modeling sensory dissonance)"}]} +{"conversations": [{"role": "user", "content": "What does `Collection.asPairs` do? What arguments does it take?"}, {"role": "assistant", "content": "Answer an array with alternating key value pairs, like `[\\freq, 1848, \\amp, 0.2]`. This is part of the Key-Value-Pairs Arguments: class — The class of the collection to be returned. By default this is an Array.."}]} +{"conversations": [{"role": "user", "content": "I edited a SynthDef and the running sound did not change."}, {"role": "assistant", "content": "Redefining a SynthDef only affects Synths created after the new definition reaches the server; existing instances keep the graph they were built with. Free and recreate them: `~s.free; ~s = Synth(\\name)`. In JITLib, Ndef is the tool designed for this — redefining `Ndef(\\name, { ... })` crossfades to the new graph while it plays."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n// definition for future reference in arbitrary Environments\n\np = PLtuple(\\a);\n\n\n// prepare current Environment\n// PLtuple defaults to repeats = inf,\n// so inner Patterns are repeatedly embedded\n\n~a = [ Pshuf((60..65)), 70, Pshuf((75..80)) ];\n\n\n// run\n\nx = Pbind(\\midinote, p, \\dur, 0.2).trace.play;\n\n\n// replace elements\n\n~a[0] = 72.5;\n\n~a[1] = 74.5;\n\n~a[2] = Prand([85, 86, 87]);\n\n\n// re\n// …\n```"}, {"role": "assistant", "content": "definition for future reference in arbitrary Environments prepare current Environment (PLtuple: dynamic scope Ptuple variant)"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `NdefGui`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\np = ProxySpace.push(s.boot);\n\nl = NdefGui(nil, 3).moveTo(10, 120);\nm = NdefGui(nil, 3).moveTo(10, 240);\nn = NdefGui(nil, 3).moveTo(10, 360);\no = NdefGui(nil, 3).moveTo(10, 480);\n\nSpec.add(\\dens, [0.1, 300, \\exp]);\n\n// make 3 kinds of proxies: using tilde/proxyspace, Ndef, and unnamed.\n~spacy = { |dens = 5| Formlet.ar(Dust.ar(dens ! 2), LFDNoise0.kr(20 ! 2).lag(0.1).linexp(-1, 1, 300, 5000), 0.003, 0.03) };\nNdef(\\ndeffy, { GrayNoise.ar(0.1 ! 2) });\nc = NodeProxy.audio.source_({ PinkNoise.ar(0.1 ! 2) });\n\n// put one in each editor\nl.object_(~spacy);\nm.object_(Ndef(\\ndeffy));\nn.object_(c);\n);\n// One should also be able to drag and drop text into the drag,\n// but this is also not working yet.\n( Ndef(\\a) )\n```"}]} +{"conversations": [{"role": "user", "content": "Why LeakDC and not a standard HPF for DC removal?"}, {"role": "assistant", "content": "SuperCollider forum — Why LeakDC and not a standard HPF for DC removal?\n\nHello everyone,\n\nI’m a bit sceptical of the DC removal implementation in LeakDC. As I understand it, DC removal is nothing but a HPF, preferably placed below the audible range. For this purpose, LeakDC seems to be reaching far too high, attenuating the audible low frequencies. You can run the following code and look at the server meter to see the difference in level between the two audio channels (note: there is of course no DC offset in this example that would need fixing):\n\n```supercollider\n( play { [\n SinOsc.ar(50),\n LeakDC.ar(SinOsc.ar(50))\n] * 0.2 } )\n```\n\nAlso, LeakDC’s behaviour is not consistent between sample rates (as is mentioned in the help file).\n\nI ran the it through Plugin Doctor to back up my suspicions and got these results:\n\nstandard coefficient of 0.995:\n\nSR 48 kHz: Filter starts rolling off at 200 Hz, -2dB at 50 Hz.\n\nSR 96 kHz: Filter starts rolling off at 500 hz! It reaches already -2dB at 100 Hz, -5 dB at 50 Hz.\n\ncoefficient of 0.999:\n\nSR 48 kHz: Filter starts rolling off at 50 Hz, -2 dB at 10 Hz.\n\nSR 96 kHz: Filter starts rolling off at 100 Hz, -2 dB at 20 Hz.\n\nI wonder why one wouldn’t just use a standard HPF at 10 Hz (or so) instead? It is consistent between sample rates, it only starts to roll of below 30 Hz and it reaches only -0.5 dB at 20 Hz. So this actually looks much better in the server meter:\n\n```supercollider\n( play { [\n SinOsc.ar(50),\n HPF.ar(SinOsc.ar(50), 10)\n] * 0.2 } )\n```\n\nSo my question is: Is there any reason why the LeakDC implementation would be peferable to such a standard butterworth HPF?\n\nOne difference I can see is that the HPF still has an initial offset spike before settling around zero phase, LeakDC does not show that behaviour:\n\n```supercollider\n{ LeakDC.ar(DC.ar(0.5)) }.plot(0.5);\n{ HPF.ar(DC.ar(0.5), 10) }.plot(0.5);\n\n{ LeakDC.ar(SinOsc.ar + DC.ar(0.5)) }.plot(0.02);\n{ HPF.ar(SinOsc.ar + DC.ar(0.5), 10) }.plot(0.02);\n```\n\nSo this could be a reason – I don’t know enough about filters to understand why this happens though. Any enlightenment would be appreciated."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SampleRate`."}, {"role": "assistant", "content": "```supercollider\n// compares a 441 Hz sine tone derived from sample rate (44100 * 0.01, left)\n// with a 440 Hz tone (right), resulting in a 1 Hz beating\n(\n{\n var freq;\n freq = [SampleRate.ir * 0.01, 440];\n SinOsc.ar(freq, 0, 0.1)\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `BusPool.initClass` do?"}, {"role": "assistant", "content": "bus allocator with retain/release counting for shared busses"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ProxySynthDef`."}, {"role": "assistant", "content": "```supercollider\na = ProxySynthDef(\"xtest\", { SinOsc.ar(400) * 0.1 });\n\na.add;\n\nx = Synth(\"xtest\");\nx.release;\n\n\n/*\n\n if the resulting number of channels is larger than a given channelConstraint,\n it behaves according to the rate: audio rate signals are wrapped around\n a smaller channel size, control rate signals are not (the exceeding channels are left out)\n\n*/\n```"}]} +{"conversations": [{"role": "user", "content": "How does multi-channel expansion work?"}, {"role": "assistant", "content": "If any argument of a UGen is an Array, the UGen is built once per element and the results are returned as an Array. So `SinOsc.ar([220, 330, 440])` is three oscillators, and `SinOsc.ar(220 * [1, 1.5])` is two. This is not a special stereo feature: it is uniform expansion, which is why `Splay.ar(SinOsc.ar([220,330,440]) * 0.1)` gives you a spread stereo field from three mono sources."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// try wiggling mouse quickly:\n// LFNoise2 overshoots when going from high to low freqs, LFDNoise changes smoothly.\n\n{ SinOsc.ar(LFNoise2.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n{ SinOsc.ar(LFDNoise3.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFNoise2.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n\n{ LFDNoise3.ar(XLine.kr(2000, 20000, 8), 0.1\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// try wiggling mouse quickly:\n// LFNoise2 overshoots when going from high to low freqs, LFDNoise changes smoothly.\n\n{ SinOsc.ar(LFNoise2.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n{ SinOsc.ar(LFDNoise3.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFNoise2.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n\n{ LFDNoise3.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n\n// use as frequency control\n(\n{\n SinOsc.ar(\n LFDNoise3.ar(4, 400, 450),\n 0, 0.2\n )\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = { |x, root = 60| x + root }; b = a.midicps; [a.value(9), b.value(9)];\na = Pseries(60, 1, inf).midicps; a.asStream.nextN(12);\n{ a = LFNoise1.ar(1) * 5 + 60; Pulse.ar(a.round.midicps * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = { |x, root = 60| x + root }; b = a.midicps; [a.value(9), b.value(9)];\na = Pseries(60, 1, inf).midicps; a.asStream.nextN(12);\n{ a = LFNoise1.ar(1) * 5 + 60; Pulse.ar(a.round.midicps) * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n/* Audio plugin definition\n\n Each audio plugin should define the following global variables:\n ~name: (symbol) name of the spatializer\n ~description: (string) a short description\n ~function: the actual definition of the plugin\n\n*/\n\n~name = \\testtone;\n~description = \"a standard test tone (sine)\";\n~channelLayout = \\mono;\n\n~function = {| sfreq = 200 |\n FSinOsc.ar(sfreq)\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ var sig = SinOsc.ar(440) * 0.2; Out.ar(0, sig) }.play;\n```"}, {"role": "assistant", "content": "The minimal SynthDef idiom: a source multiplied by an amplitude, written to the master bus.\n\n`var sig = SinOsc.ar(440) * 0.2` builds the signal; `Out.ar(0, sig)` is the only mandatory part, because a\nUGen graph that never reaches an output produces no sound. `Out`'s first argument is the bus number — 0 is\nthe main stereo output — and the second is the signal. The function's return value does not matter here,\nwhich is why the `Out.ar` can sit on its own line. `.play` compiles this into an anonymous SynthDef and\nstarts one instance."}]} +{"conversations": [{"role": "user", "content": "What does `ServerOptions.sampleRate` do?"}, {"role": "assistant", "content": "The preferred sample rate. If non-nil the server app will attempt to set the sample rate of the hardware. The hardware has to support the sample rate that you"}]} +{"conversations": [{"role": "user", "content": "Explain `TBetaRand` in SuperCollider briefly."}, {"role": "assistant", "content": "TBetaRand — triggered beta random distribution Generates a random float value in beta distribution from `lo` to `hi` each time the trigger signal changes from nonpositive to positive values. Category: UGens > Random, UGens > Triggers."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Event` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\pm, { |out = 0, freq = 440, amp = 0.1, pan = 0, gate = 1, ratio = 1, index = 1, ar = 0.1, dr = 0.1|\n var z;\n z = LPF.ar(\n PMOsc.ar(freq, freq * ratio, Linen.kr(gate, ar, index, dr), 0, 0.3),\n XLine.kr(Rand(4000, 5000), Rand(2500, 3200), 1)\n ) * Linen.kr(gate, 0.01, 0.7, dr, 2);\n OffsetOut.ar(out, Pan2.ar(z, pan, amp));\n}).add;\n);\n\n(instrument: \\pm).play;\n\n(instrument: \\pm, ratio: 3.42, index: 12, freq: 150, ar: 8, dr: 3, sustain: 10).play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// default initial params\n{ LinCongN.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// default initial params\n{ LinCongN.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What is `NdefGui`?"}, {"role": "assistant", "content": "NdefGui — a gui for a NodeProxy or Ndef"}, {"role": "user", "content": "What does `NdefGui.big` do?"}, {"role": "assistant", "content": "two lines of controls for a big NdefGui, usually in its own window"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\np = ProxySpace.push(s.boot);\n\nl = NdefGui(nil, 3).moveTo(10, 120);\nm = NdefGui(nil, 3).moveTo(10, 240);\nn = NdefGui(nil, 3).moveTo(10, 360);\no = NdefGui(nil, 3).moveTo(10, 480);\n\nSpec.add(\\dens, [0.1, 300, \\exp]);\n\n// make 3 kinds of proxies: using tilde/proxyspace, Ndef, and unnamed.\n~spacy = { |dens = 5| Formlet.ar(Dust.ar(dens ! 2), LFDNoise0.kr(20 ! 2).lag(0.1).linexp(-1, 1, 300, 5000), 0.003, 0.03) };\nNdef(\\ndeffy, { GrayNoise.ar(0.1 ! 2) });\nc = NodeProxy.audio.source_({ PinkNoise.ar(0.1 ! 2) });\n\n// put one in each editor\nl.object_(~spacy);\nm.object_(Ndef(\\ndeffy));\nn.object_(c);\n);\n// One should also be able to drag and drop text into the drag,\n// but this is also not working yet.\n( Ndef(\\a) )\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ BrownNoise.ar(0.1) }.play;\n{ WhiteNoise.ar(0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ BrownNoise.ar(0.1) }.play;\n{ WhiteNoise.ar(0.1) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ LFNoise0.ar(1000, 0.25) }.play;\n\n// modulate frequency\n\n{ LFNoise0.ar(XLine.kr(1000, 10000, 10), 0.25) }.play;\n\n// as frequency modulator\n(\n{ SinOsc.ar(\n LFNoise0.ar(4, 400, 450),\n 0, 0.2\n )\n}.play;\n)\n\n// freq is the rate of starting points\n{ var freq = 1000; [LFNoise0.ar(freq), Impulse.ar(freq) }.plot\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ LFNoise0.ar(1000, 0.25) }.play;\n\n// modulate frequency\n\n{ LFNoise0.ar(XLine.kr(1000, 10000, 10), 0.25) }.play;\n\n// as frequency modulator\n(\n{ SinOsc.ar(\n LFNoise0.ar(4, 400, 450),\n 0, 0.2\n )\n}.play;\n)\n\n// freq is the rate of starting points\n{ var freq = 1000; [LFNoise0.ar(freq), Impulse.ar(freq)] }.plot\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for exploring of morphing cycled envelopes (i.e: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\ro_v19, {\n var freq = 40.rrand(90).debug('base freq');\n var seed = thisThread.randSeed = 1000000000.rand.debug('seed');\n var gen = [LFNoise2,LFNoise0,SinOsc,LFPulse,LFSaw];\n var sig = Splay.ar({\n var i = 4.exprand(40).asInteger;\n Median.ar(\n 3.exprand(18),\n EnvGen.ar(\n Env( // wave form\n [0] ++ Array.fill(i-1, { \n gen.choose.kr(\n 0.25.coin.if({ gen.choose.kr(0.01.exprand(0.1)).exprange(0.1,1) }, { 0.1.exprand(1) }), \n mul: 0.25.coin.if({ gen.choose.kr(0.05.exprand(10)).range(0.1,1) }, { 0.1.rrand(1) })\n )\n }) ++ [0],\n Array.rand(i-1, 0.1,1.0).normalizeSum,\n [[-5.0.rrand(5),\\sin].choose] ++ Array.fill(i-2, {\n [\\sin ! 1.rrand(6), -5.0.rrand(5) ! 1.rrand(4)].flat.choose\n }) ++ [[-5.0.rrand(5),\\sin].choose]\n ).circle,\n timeScale: Duty.kr( // freq\n Drand([4,8,16,24], inf), 0,\n Dwrand([1,2,4,8,16,32,64]*freq, ((14..7) ** 1.rrand(3)).normalizeSum, inf) // octave\n * 0.75.coin.if({ Duty.kr( // note\n [Dxrand, Drand].choose.new([0.125,0.25,0.5,1,2,4,6,8,12], inf), 0,\n Dshuf({ (0..11).choose.midiratio } ! 1.exprand(8), inf)\n ) }, { (0..11).choose.midiratio })\n ).reciprocal\n )\n ) * EnvGen.kr( // rhythm\n Env.perc(\n 0.01.exprand(0.4) * 0.25.coin.if({ Duty.kr( // atk\n Drand([0.5,1,2,4,8,12,16], inf), 0,\n Dshuf({ [1,2,3,4].choose } ! 1.exprand(8), inf)\n ) }, { 1 }),\n 0.1.exprand(4) * 0.75.coin.if({ Duty.kr( // release\n Drand([0.5,1,2,4,8,12,16], inf), 0,\n Dshuf({ [1,2,4,8,16].choose.reciprocal } ! 1.exprand(8), inf)\n ) }, { 1 }),\n LFNoise2.kr(0.1.exprand(10)).range(0.05,1), // appearance\n LFNoise2.kr(0.1.exprand(10)).range(-4,4),\n ).circle\n );\n } ! 3.rrand(9).debug('source'));\n BHiShelf.ar(\n GVerb.ar(\n Rotate2.ar(sig[0], sig[1], Duty.kr(Drand([2,4,8],inf), 0, Drand([-1,1,0],inf)) * LFSaw.kr(0.1.exprand(1))),\n 40.rrand(150).debug('room')\n ),\n LFNoise2.kr(0.1.exprand(0.5)).range(4000,6500),\n LFNoise2.kr(0.1.exprand(1)).range(1,3),\n LFNoise2.kr(0.1.exprand(1)).range(-24,-16)\n );\n}).play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Trig`."}, {"role": "assistant", "content": "```supercollider\n{ Trig.ar(Dust.ar(1), 0.2) * FSinOsc.ar(800, 0.5) }.play\n\n{ Trig.ar(Dust.ar(4), 0.1) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LinLin`."}, {"role": "assistant", "content": "```supercollider\n// linlin\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(mod.linlin(-1, 1, MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1))) * 0.1\n}.play;\n);\n\n// range\n(\n{\n var mod = LFNoise2.ar(80).range(MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1));\n SinOsc.ar(mod) * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `SelectX` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar(300),\n Pulse.ar(230)\n ];\n\n SelectX.ar(MouseX.kr(0, 1) * a.size, a) * 0.2\n}.play;\n);\n\n(\n{\n var a;\n a = [\n SinOsc.kr(0.25),\n LFSaw.kr(10),\n LFPulse.kr(0.3)\n ];\n\n SinOsc.ar(SelectX.kr(MouseX.kr(0, 1) * a.size, a) * 300 + 400) * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `Disintegrator` in SuperCollider briefly."}, {"role": "assistant", "content": "Disintegrator — port of some ladspa plugins Amplifies random half-cycles of it's input by multiplier. Set multiplier to 0 and vary probability for a weird fade effect, or set multiplier to -1 and probability to 0.5 to turn pitched sounds into noise. Category: UGens > Filters."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\ns.boot;\n\nInstr(\"saw\",{ arg freq=400; Saw.ar(freq) * EnvGen.kr(Env.perc,doneAction:2)});\n\np = Patch(\"saw\",[KrNumberEditor(300,\\freq)]);\n\nSheet({ arg f;\n p.gui(f);\n ActionButton(f,\"asEvent\",{\n p.asEvent.play.postln\n });\n});\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\ns.boot;\n\nInstr(\"saw\",{ arg freq=400; Saw.ar(freq) * EnvGen.kr(Env.perc,doneAction:2)});\n\np = Patch(\"saw\",[KrNumberEditor(300,\\freq)]);\n\nSheet({ arg f;\n p.gui(f);\n ActionButton(f,\"asEvent\",{\n p.asEvent.play.postln\n });\n});\n\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Duty`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\n {\n var freq;\n freq = Duty.kr(\n Drand([0.01, 0.2, 0.4], inf), // demand ugen as durations\n 0,\n Dseq([204, 400, 201, 502, 300, 200], inf)\n );\n SinOsc.ar(freq * [1, 1.01]) * 0.1\n\n }.play;\n);\n\n(\n {\n var freq;\n freq = Duty.kr(\n MouseX.kr(0.001, 2, 1), // control rate ugen as durations\n 0,\n Dseq([204, 400, 201, 502, 300, 200], inf)\n );\n SinOsc.ar(freq * [1, 1.01]) * 0.1\n\n }.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Plambda`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n/*\n\nA simple example:\nTwo patterns playing in parallel,\nsharing data between eachother\n\n*/\n(\n // a melody playing random scale degrees\n a = Pbind(\n \\dur, 0.125,\n \\octave, 4,\n \\degree, Plet(\\melody, pattern: Pwhite(0, 7))\n );\n\n // the bass, scale degrees sampled from the \\melody variable defined above\n b = Pbind(\n \\dur, 0.5,\n \\octave, 3,\n \\degree, Pget(\\melody, default: 1, repeats: inf).trace\n );\n\n // Play the patterns in parallel\n Plambda(\n Ppar([a, b], inf)\n ).play;\n);\n/*\n\nA more complex example:\nThree patterns running in parallel\n\n*/\n(\nSynthDef(\\sine,\n { |out = 0, freq = 440, sustain = 0.05, pan = 0, amp = 0.1|\n var env;\n env = EnvGen.kr(Env.perc(Rand(0.001, 0.02), sustain, AmpCompA.kr(freq)*amp), doneAction: Done.freeSelf);\n Out.ar(out, Pan2.ar(SinOsc.ar(freq), pan, env))\n }).add;\n);\n\n(\na = Plambda(\n Pseq([\n Pfindur(5,\n Ppar([\n Pbind(\\note, Plet(\\x, Prand([1, 5, 1, [10, 14]], inf)), \\dur, 8/3, \\pan, -1),\n Pbind(\\note, Plet(\\y, Pseq([5, 3, 2, 0, [0, 5, 6, 9]], inf)), \\dur, 0.5, \\pan, 1),\n Pbind(\\note, Pseq([Pget(\\x), Pget(\\y)], inf) + 12, \\pan, 0, \\dur, 2/3)\n ])\n ),\n Pbind(\\note, Pget(\\x, 0, 6) + [0, 5], \\dur, Pdup(inf, Prand([2/3, 1/6])))\n ], inf).trace(\\eventScope) // internally, the values are shared via \\eventScope\n);\n\nb = Pbindf(a, \\instrument, \\sine, \\legato, 0.1);\nb.play\n);\n\n// Play two copies of the complex pattern above in parallel, one of them transposed and playing with shorter durations\nPpar([b, Pbindf(b, \\ctranspose, 24, \\dur, Pkey(\\dur) * 0.25)]).play;\n```"}]} {"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\np = ProxySpace.push(s.boot);\n~a.play.quant_(4); ~b.play.quant_(4);\n~c = { LFNoise1.kr(8).range(0,15).round };\n~a = Pbind(\\degree, Pstutter(4, Pseq([0,2,3,4], inf)), \\octave, [3,4], \\dur, 0.25, \\amp, 0.3);\n~b = Pbind(\\octave, 4, \\scale, Scale.majorPentatonic, \\degree, ~c, \\dur, 1/4, \\legato, 0.5);\n```"}, {"role": "assistant", "content": "a short piece which plays random major music. It sounded very happy."}]} -{"conversations": [{"role": "user", "content": "What is `SendPeakRMS`?"}, {"role": "assistant", "content": "SendPeakRMS — Track peak and power of a signal for GUI applications."}, {"role": "user", "content": "What does `SendPeakRMS.ar` do?"}, {"role": "assistant", "content": "Unlike with other unit generators, the `ar` and `kr` methods do not specify the rate of the computation, but the granularity. When the SendPeakRMS ugen is instantiated with `kr`, the reply rate is quantized to control-rate blocks."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\n{\n SendPeakRMS.kr(Dust.ar(20), 20, 3, \"/replyAddress\")\n}.play;\n);\n\n(\no = OSCFunc({ |msg|\n \"peak: %, rms: %\".format(msg[3], msg[4]).postln\n}, '/replyAddress');\n);\no.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `MIDIFuncChanMessageMatcher.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Make a new Arguments: chan — (describe argument here); func — The Function to evaluate if a match is found.. Returns: An MIDIFuncChanMessageMatcher."}]} -{"conversations": [{"role": "user", "content": "Explain `GlitchHPF` in SuperCollider briefly."}, {"role": "assistant", "content": "GlitchHPF — backward compatibility after sc3.4 HPF and RHPF were changed to use double-precision floats (svn revision: 10300 - 8sep2010). GlitchHPF and GlitchRHPF can be used as drop-in replacements to get the old behavior back. Good for very noise and glitchy sounds. Category: UGens > Filters > Linear, UGens > Filters > GlitchUGens."}]} -{"conversations": [{"role": "user", "content": "What does `SDrone.defName` do?"}, {"role": "assistant", "content": "a LINKClasses/Symbol used for the internal"}]} -{"conversations": [{"role": "user", "content": "I get 'syntax error, unexpected NAME' on a block that looks fine."}, {"role": "assistant", "content": "Almost always a missing semicolon between two statements — SuperCollider does not insert them.\n\n```supercollider\n// broken: two statements, no separator\n{ var sig = SinOsc.ar(440) sig = sig * 0.1; sig }.play\n```\n\n```supercollider\n// fixed\n{ var sig = SinOsc.ar(440); sig = sig * 0.1; sig }.play\n```\nThe error points at the second statement, not at the missing semicolon before it, which is why it looks\nfine. If it is not a semicolon, count the brackets: `.ar(` open, `)` closed."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes open files within the Modality workshop folder."}, {"role": "assistant", "content": "```supercollider\n// open files within the Modality workshop folder\n\n~basePath = \"\".resolveRelative;\n\n// installing Modality and other quarks for this workshop:\n(~basePath +/+ \"0_installing.scd\").openDocument;\n\n// finding and defining devices:\n(~basePath +/+ \"1_finding_and_defining_devices_hid.scd\").openDocument;\n(~basePath +/+ \"1_finding_and_defining_devices_midi.scd\").openDocument;\n\n// exploring elements and actions:\n(~basePath +/+ \"2_elements_and_actions_hid.scd\").openDocument;\n(~basePath +/+ \"2_elements_and_actions_midi.scd\").openDocument;\n\n// using ndefs:\n(~basePath +/+ \"3_using_ndefs_hid.scd\").openDocument;\n(~basePath +/+ \"3_using_ndefs_midi.scd\").openDocument;\n\n\n// some shared sound processes\n(~basePath +/+ \"shared_processes\").openOS;\n\n(~basePath +/+ \"shared_processes/*\").pathMatch.collect(_.basename).postcs;\n(~basePath +/+ \"shared_processes/*\").pathMatch.choose.openDocument;\n// open one of them:\n(~basePath +/+ \"shared_processes/cat.scd\").openDocument;\n// load one directly, e.g. for use in controller patches:\n(~basePath +/+ \"shared_processes/cat.scd\").load;\n\n// ... you are welcome to share your own sound processes here!\n\n// some more modal functionality using MFunc:\n(~basePath +/+ \"5_modal_functionality_2_hid.scd\").openDocument;\n(~basePath +/+ \"5_modal_functionality_2_midi.scd\").openDocument;\n(~basePath +/+ \"5_modal_functions_2b_midi.scd\").openDocument;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// a Synth with a multi-node release stage\nd = { |gate = 1|\n var env = Env([0, 1, 0, 0.5, 0], 0.5, -4, releaseNode: 1);\n { BrownNoise.ar }.dup * EnvGen.kr(env, gate, doneAction: Done.freeSelf)\n}.play;\n);\n// forced release in 2 seconds:\n// end value (0) and shape (-4) are read from the env's last node, nodes 2 and 3 are skipped\nd.release(2);\n\n// without releaseTime: normal release stage, as defined in env (3 nodes)\nd.release(;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// a Synth with a multi-node release stage\nd = { |gate = 1|\n var env = Env([0, 1, 0, 0.5, 0], 0.5, -4, releaseNode: 1);\n { BrownNoise.ar }.dup * EnvGen.kr(env, gate, doneAction: Done.freeSelf)\n}.play;\n);\n// forced release in 2 seconds:\n// end value (0) and shape (-4) are read from the env's last node, nodes 2 and 3 are skipped\nd.release(2);\n\n// without releaseTime: normal release stage, as defined in env (3 nodes)\nd.release();\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// increase feedback\n{ FBSineC.ar(SampleRate.ir, 1, Line.kr(0.01, 4, 10), 1, 0.1) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// increase feedback\n{ FBSineC.ar(SampleRate.ir, 1, Line.kr(0.01, 4, 10), 1, 0.1) * 0.2 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "Saving \"Presets\"?"}, {"role": "assistant", "content": "SuperCollider forum — Saving \"Presets\"?\n\nIf you don’t care too much about it being human readable, just use writeArchive and readArchive:\n\n```supercollider\na = Array.fill(400, {rrand(0,2200)});\n\na.writeArchive(\"/Users/spluta1/Documents/SC/test\");\n\nb = Object.readArchive(\"/Users/spluta1/Documents/SC/test\");\n\nb.postln;\n```\n\nSam"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Beam me up scotty."}, {"role": "assistant", "content": "```supercollider\n{\nvar time = 8;\nvar freq = (40-12).midicps;\nvar a = VarSaw.ar(freq/2, width: XLine.ar(0.5,1,time)).range(0,XLine.ar(1,1/1000,time));\nvar tone = SinOsc.ar(freq).fold(-1*a,a);\nOut.ar(0, tone.dup);\n}.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes old school noise from needle on vinyl."}, {"role": "assistant", "content": "```supercollider\n{\n var sig, sig1, sig2, lpf, popHz, lagtime, noise, popHzMul,\n pan1, pan2, panmod1, panmod2;\n popHzMul = Decay.kr(Dust.kr(0.15), 3, 10, 0.8);\n popHz = LFNoise1.kr(20).exprange(0.1,10) * popHzMul;\n sig = Dust2.ar(popHz);\n lpf = LFNoise1.kr(10).exprange(1000,20000);\n lagtime = LFNoise1.kr(20).range(0.008,0.0001);\n sig = LPF.ar(sig, lpf);\n sig = Lag.ar(sig, lagtime);\n sig = sig + FreeVerb.ar(sig, 0.8, 1, mul:0.11);\n panmod1 = LFNoise1.kr(5).range(0.2,0.7);\n panmod2 = LFNoise1.kr(5).range(0.2,0.7);\n pan1 = SinOsc.kr(panmod1).range(-0.2,0.2);\n pan2 = SinOsc.kr(panmod2).range(-0.2,0.2);\n sig1 = Pan2.ar(sig, pan1, 0.5);\n sig2 = Pan2.ar(sig, pan2, 0.5);\n sig = sig1 + sig2;\n sig = sig + BPF.ar(BrownNoise.ar([0.0025,0.0025]), 7200, 0.4);\n sig = sig + HPF.ar(Crackle.ar([1.999,1.999], 0.0025),2000);\n Out.ar(0, sig*6);\n}.play\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Many patterns controlling a single synth."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\sawFilt, { |out = 0, freq = 440, amp = 0.1, gate = 1, cf = 100, wobble = 3, t_bd, t_sd, pw = 0.4|\n var base = Splay.ar(RLPF.ar(Pulse.ar(freq * [0.99,0.5,1.01],pw),cf.lag(0.05),0.3).madd(SinOsc.ar(wobble).range(0.5,4)).sin) * 0.5;\n var env = Linen.kr(gate, attackTime: 0.01, releaseTime: 0.5, doneAction: 2);\n var sig = base;\n var bd = tanh(Ringz.ar(LPF.ar(Trig.ar(t_bd,SampleDur.ir),1000),30,0.5,5).sin*2);\n var sd = tanh(Ringz.ar(LPF.ar(Trig.ar(t_sd,SampleDur.ir),1000),120,0.75,PinkNoise.ar(2!2)).sin*2);\n sd = HPF.ar(sd,60);\n sig = tanh(GVerb.ar(HPF.ar(base * env,30), 70, 11, 0.15)*0.5 + sig + bd + sd);\n Out.ar(out, sig*amp*env);\n}).add;\n);\n\n(\np = Pproto(\n {\n ~id = (\n type: \\on,\n dur: 0,\n instrument: \\sawFilt,\n amp: 1,\n ).yield[\\id];\n ~type = \\set;\n },\n Ppar([\n Pbind(\n \\args, #[freq],\n \\freq, Pseq([49,47,50,48]-12,inf).midicps,\n \\dur, 4,\n ),\n Pbind(\n \\args, #[cf],\n \\cf, Pseq([100,Prand([700,400,1100],3)],inf),\n \\stutter, Prand([1,2,4,8],inf),\n \\dur, PdurStutter(Pkey(\\stutter)*2, 2),\n // NOTE: also useful is .collect on patterns!\n // \\dur, Prand([1,2,4,8], inf).collect{ |x| (1/x)!(x*2) }.flatten\n ),\n Pbind(\n \\args, #[wobble],\n \\wobble, Pxrand([3,1.5,6],inf),\n \\dur, Prand([2,1],inf),\n ),\n Pbind(\n \\args, #[t_bd],\n \\t_bd, Pseq([1,0,0,1],inf),\n \\dur, 0.5,\n ),\n Pbind(\n \\args, #[t_sd],\n \\t_sd, Pseq([0,0,1,0],inf),\n \\dur, 0.5,\n ),\n Pbind(\n \\args, #[pw],\n \\pw, Prand([0.4,0.3,0.5],inf),\n \\dur, 2,\n ),\n ])\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// try wiggling mouse quickly;\n// LFNoise frequently seems stuck, LFDNoise changes smoothly.\n\n{ LFNoise0.ar(MouseX.kr(0.1, 1000, 1), 0.1) }.play\n\n{ LFDNoise0.ar(MouseX.kr(0.1, 1000, 1), 0.1) }.play\n\n// silent for 2 secs before going up in freq\n\n{ LFNoise0.ar(XLine.kr(0.5, 10000, 3), 0.1) }.scope;\n\n{ LFDNoise0.ar(XLine.kr(0.5, 10000, 3), 0.1) }.scope;\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFNoise0.ar(XLine.k\n// …\n```"}, {"role": "assistant", "content": "try wiggling mouse quickly; LFNoise frequently seems stuck, LFDNoise changes smoothly. (LFDNoise0: Dynamic step noise)"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes sclang fun )."}, {"role": "assistant", "content": "```supercollider\n( // whatever\nNdef(\\ff_twist, {\n var tempo = 156/60;//TempoClock.tempo;\n var bands = 4.rrand(16).debug('bands');\n var sync = bands.factors.scramble.pop.debug('sync');\n var gen = [LFNoise1,LFNoise2,LFNoise0];\n var sig = Splay.ar(\n VarSaw.ar(//LFSaw.kr(Array.rand(bands/sync, 8, 390).stutter(sync)).range(0.97,1.03) * \n Array.exprand(bands, 50, 400) * ({ gen.choose.kr(1/1.rrand(10)).exprange(1, 10) } ! (bands/sync)).stutter(sync), \n 0, \n { gen.choose.kr(1/1.rrand(10)).range(0.1,1) } ! bands, \n { gen.choose.kr(1/1.rrand(10)).range(0.1,1) } ! bands\n ) * ({ EnvGen.kr(Env.perc(0.008.exprand(0.03), tempo.reciprocal / [1,2,4,8].choose, 1, rrand(-7,-1.0)).circle) } ! (bands/sync)).stutter(sync)\n );\n sig = sig * 0.7 + GVerb.ar(sig, mul:0.3);\n sig = Rotate2.ar(\n sig[0], sig[1], \n LFSaw.kr( Duty.kr(tempo.reciprocal * (2,8..24).choose, 0, Drand((1..4)*tempo, inf)) )\n );\n sig;\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n\nSynthDef(\\param, { arg freq = 100, sustain, amp;\n var sig;\n sig = LFPar.ar(freq: freq,\n mul: EnvGen.kr(Env.perc(0, sustain, 0.5), doneAction:2) * amp);\n sig = Splay.ar(sig);\n Out.ar(0, sig);\n}).add;\n\ne = Pbind(\n \\midinote, Prout({\n var tone0, tone1, tone2, interval, freq0, delta;\n loop {\n tone0 = rrand(0,11);\n interval = rrand(2,4);\n tone1 = Scale.minor(\\pythagorean).at(tone0) + [0,12,24].choose + 0.07;\n tone2 = Scale.minor(\\pythagorean).at(tone0 + interval) + [0,12,24].choose;\n freq0 = [tone1,tone2]+48;\n postln(freq0);\n freq0.yield;\n }\n }),\n \\dur, Prand([1,2,4,8,12,16,4,6,8], inf),\n \\instrument, \\param,\n \\amp, 0.5,\n \\sustain, 2,\n).play(quant:1); // returns an EventStream\nTempoClock.default.tempo = 1200/60;\n\n)\n```"}, {"role": "assistant", "content": "minor random bliss in two for Prout (a SuperCollider snippet)."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for reverbio (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"reverb\", {arg freq=440, release=0.1;\n var in, s1,out, mod1, depth, mfreq;\n s1 = SoundIn.ar(0,mul:2);\n out=FreeVerb.ar(s1,mix:1,room:MouseX.kr(0,1),damp:MouseY.kr(0,1));\n Out.ar(0,out);\n Out.ar(1,out);\n}).load(s);\n);\na = Synth(\"reverb\");\na.free\n```"}]} -{"conversations": [{"role": "user", "content": "What is `IdentityBag`?"}, {"role": "assistant", "content": "IdentityBag — A Bag according to identity"}, {"role": "user", "content": "What does `IdentityBag.add` do?"}, {"role": "assistant", "content": "Add anObject to the Bag. A Bag may contain multiple entries of the same object. `IdentityBag[1, 2, 3].add(4);`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nIdentityBag[1, 2, 3].add(4);\nIdentityBag[1, 2, 3].add(3);\nIdentityBag[\"abc\", \"def\", \"ghi\"].add(\"jkl\");\nIdentityBag[\"abc\", \"def\", \"ghi\"].add(\"def\");\n```"}]} -{"conversations": [{"role": "user", "content": "What are the arguments of PlayBuf.ar?"}, {"role": "assistant", "content": "`PlayBuf.ar(numChannels, bufnum, rate, trigger, startPos, loop)`. numChannels must match what is in the buffer, or you get a channel mismatch; bufnum is the Buffer's integer number; rate is playback speed where 1 is normal and negative plays backwards; trigger restarts playback on each trigger in loop mode; startPos is in frames; loop is 0 or 1. `PlayBuf.ar(1, ~buf, BufRateScale.kr(~buf), loop: 1)` is the standard pitch-correct form."}]} -{"conversations": [{"role": "user", "content": "What does `In.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Read a signal from a bus. Arguments: bus — The index of the bus to read in from.; numChannels — The number of channels (i.e. adjacent buses) to read in. You cannot modulate this number by assigning it to an argument in a SynthDef.."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n(\n// Function to check an array for repetitions within a maximum test span\n\n~repetitionCheck = { |array, maxTestSpan|\n maxTestSpan.do { |i|\n var result = (array.drop(i+1) - array).drop((i+1).neg).includes(0).not;\n (\"no repetitions within a span of \" ++ (i+2).asString ++ \" items: \").post;\n result.postln;\n }\n};\n\n// prepare buffer to store DIdev values \n\nn = 10000; // buffer size\nr = 10000; // trigger rate\nb = Buffer.alloc(s, n);\n);\n\n\n// run to store, wait until finished (a bit more than 1 second)\n(\n{\n var trig = Impulse.ar(r);\n D\n// …\n```"}, {"role": "assistant", "content": "Function to check an array for repetitions within a maximum test span prepare buffer to store DIdev values (DIdev: pseudo drate ugen, searches for numbers with integer distance from a source signal, optionally avoiding repetitions within a span)"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var a, freq, trig;\n a = Dser([1, 3, 2, 7, 8], 8);\n trig = Impulse.kr(MouseX.kr(1, 40, 1));\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var a, freq, trig;\n a = Dser([1, 3, 2, 7, 8], 8);\n trig = Impulse.kr(MouseX.kr(1, 40, 1));\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `PLbindef`?"}, {"role": "assistant", "content": "PLbindef — wrapper for Pbindef which allows replacement in object prototyping style"}, {"role": "user", "content": "What does `PLbindef.new` do?"}, {"role": "assistant", "content": "Creates a new PLbindef object or sets sources as with Pbindef."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n// synthdefs to play with\n\n(\nSynthDef(\\noise_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, rq = 0.1, amp = 0.1|\n var sig = { WhiteNoise.ar } ! 2;\n sig = BPF.ar(sig, freq, rq) *\n EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2) *\n (rq ** -1) * (250 / (freq ** 0.8));\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\sin_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { SinOsc.ar(freq, Rand(0, 2pi)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\saw_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { VarSaw.ar(freq, Rand(0, 1)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n{\n\nvar in, fft, entropy;\n\n//in = SinOsc.ar(MouseX.kr(100,1000),0,0.1);\n//in = Mix(SinOsc.ar([440,MouseX.kr(440,880)],0,0.1)); \nin= SoundIn.ar; \n\nfft = FFT(LocalBuf(2048), in);\n\nentropy=SpectralEntropy.kr(fft,2048,1); //one output band (so full spectrum's entropy)\n\nentropy.poll; \n\nOut.ar(0,Pan2.ar(0.1*Blip.ar(100,10*(entropy.sqrt)))); \n}.play\n);\n\n\n\n\n(\n{\n\nvar in, fft, entropy;\nvar amplit\n// …\n```"}, {"role": "assistant", "content": "in = SinOsc.ar(MouseX.kr(100,1000),0,0.1); in = Mix(SinOsc.ar([440,MouseX.kr(440,880)],0,0.1)); (SpectralEntropy: Spectral feature extraction)"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Array`."}, {"role": "assistant", "content": "```supercollider\n(\nx = {\n SinOsc.ar([0.1, 0.2], 0).poll * 0.1\n}.play;\n);\nx.trace; // By tracing the Synth you can see the two Poll units we created\nx.free\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Verschwende deine Jugend (bassline cover)?"}, {"role": "assistant", "content": "```supercollider\n/* An approach to try to reproduce the 'famous' bassline of \"Verschwende deine Jugend\" by D.A.F. */\n\nSynthDef(\\daf_bass,{ |out, freq=440, sustain=1, gate=1, amp=0.1|\n var snd, env, fenv, harm;\n \n harm = [1,1.01,2,2.02,3.5,4.01,5.501];\n harm = harm ++ (harm*2);\n \n snd = SinOsc.ar(freq*harm).sum.distort.squared * 6;\n snd = snd + SinOsc.ar(freq / [1, 2]).sum!2;\n\n fenv = EnvGen.kr(Env.adsr(0.075,0.05,0.1,0.25));\n\n snd = RLPF.ar(snd, fenv.range(freq*2, freq*8), 0.75, 2) + (snd * 0.25);\n env = EnvGen.kr(Env.adsr(0.001,0.2,0.9,0.25), gate, amp, doneAction:2);\n \n snd = LeakDC.ar(Limiter.ar(snd * env));\n OffsetOut.ar(out, (snd!2));\n}).add;\n\n// approx 65 bpm\nTempoClock.default.tempo = 65/60;\n\n// approx bass pattern + modulation of Verschwende Deine Jugend bassline\nPdef(\\daf_bass,\n PmonoArtic(\\daf_bass,\n \\scale, Scale.minor,\n \\octave, [3],\n \\root, 2,\n \\ctranspose,Pseq([\n Pn(0, 8*4),\n Pn(-5, 8*4)\n ], inf),\n \\degree, Pseq([7,7s,1,8,1,1,7,1]-1,inf),\n \\dur, 0.18\n )\n).play;\n\n// link: http://www.youtube.com/watch?v=KjqrnUBdLqY\n```"}]} -{"conversations": [{"role": "user", "content": "What does `InstrSynthDef.buildControlsWithObjects` do? What arguments does it take?"}, {"role": "assistant", "content": "Extends SynthDef enabling the extra capabilities of Instr with Patch Arguments: instr; objects."}]} -{"conversations": [{"role": "user", "content": "What is `SFormant` in SuperCollider?"}, {"role": "assistant", "content": "SFormant — a formant sInstrument Based on optoformant3. Category: SInstruments."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// =========================\n// extra demos for \\glockenspiel\n// =========================\n\n(\n// made by Diya Menon\n// demo\nPbindef(\\dmglockenspiel,\n \\instrument, \"glockenspiel\",\n \\midinote, Pseq([\n [65, 68, 72, 75],\n 72, 72, 72, 70, 72, 70, 68,\n [61, 65, 70, 73, 77],\n 73, 73, 73, 72, 72, 70, 68], 2),\n \\amp, Pseq([0.015, 0.005, 0.005, 0.0075, 0.0075, 0.01, 0.01, 0.02], 4) * 3,\n \\dur, Pseq([0.3, 0.3, 0.3, 0.15, 0.15, 0.3, 0.15, 0.15], 4),\n \\rel, 3,\n \\exciterRel, 0.03,\n \\att, 0.0005,\n).play;\n)\n```"}, {"role": "assistant", "content": "========================= extra demos for \\glockenspiel =========================."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BufFrames`."}, {"role": "assistant", "content": "```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n// indexing with a phasor\n{ BufRd.ar(1, b, Phasor.ar(0, BufRateScale.kr(b), 0, BufFrames.kr(b))) }.play;\n\n// indexing by hand\n{ BufRd.ar(1, b, K2A.ar(MouseX.kr(0, BufFrames.kr(b)))) }.play;\n\nb.free\n```"}]} -{"conversations": [{"role": "user", "content": "What does `PLwhite.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new PLwhite Arguments: lo — Symbol or Pwhite lo arg. If a Symbol is passed, list can be assigned to an envir variable later on. Can be dynamically replaced by Patterns or Streams. Defaults to 0.; hi — Symbol or Pwhite hi arg. If a Symbol is passed, list can be assigned to an envir variable later on. Can be dynamically replaced by Patterns or Streams. Defaults to 1.; length — Symbol or Pwhite length arg. If a Symbol is passed, list can be assigned to an envir variable later on. Defaults to inf.; envir — Dictionary or one of the Symbols \\top, \\t (topEnvironment), \\current, \\c (currentEnvironment). Dictionary to be taken for variable reference. Defaults to \\current.."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Blip thru Formlet, pseudo-vocal synthesis."}, {"role": "assistant", "content": "```supercollider\n// Blip thru Formlet, pseudo-vocal synthesis.\n// hh&adc, since beijing 2005\n// 2019 made quad/MC\n\n// keywords: vocal, voice, formants\n\n/*\nNdef(\\formSing).gui;\nNdef(\\formSing).play;\nNdef(\\formSing).getHalo(\\stepFdev).value;\n*/\nNdef(\\formSing).addSpec(\\root, [20, 500, 6]);\nNdef(\\formSing).addSpec(\\formfrq, [50, 5000, \\exp]);\nNdef(\\formSing).addSpec(\\harm, [1, 256, \\exp]);\nNdef(\\formSing).addSpec(\\formLag, [0.01, 100, \\exp]);\nNdef(\\formSing).addSpec(\\ndiv, [0.01, 1, \\exp]);\nNdef(\\formSing).addSpec(\\fdev, [0, 24, \\amp]);\nNdef(\\formSing).addSpec(\\round, [0, 3, \\amp, 0.05]);\n\n(\n// modulating formant frequency\nNdef(\\formSing, { arg amp=0, root=150, formfrq=500, harm=20, fdev=2, ndiv = 0.2, formLag=0.1, round = 1.5;\n var freqCompare = 1; // ((formfrq / root).log2).abs.min(1).linexp(0, 1, 0.25, 1);\n var in = Blip.ar(\n root.lag(formLag) * LFNoise0.kr(root * ndiv ! q.numChans, fdev.max(0.01) ).midiratio,\n harm.lag(formLag), // .max(formfrq / root * 0.25),\n 0.1\n ) * GrayNoise.ar(0.1 ! q.numChans, 1);\n\n Limiter.ar(Formlet.ar(in, formfrq.lag(formLag), 0.005, 0.02) * (freqCompare * amp.lag(0.1)))\n .softclip;\n});\n);\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// using timer to modulate sine frequency: the slower the trigger is the higher the frequency\n(\n{ var trig;\n trig = Impulse.kr(MouseX.kr(0.5, 20, 1));\n SinOsc.ar(Timer.kr(trig) * 500 + 500, 0, 0.2)\n}.play;\n)\n```"}, {"role": "assistant", "content": "using timer to modulate sine frequency: the slower the trigger is the higher the frequency (Timer: Returns time since last triggered.)"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for some pattern exprimenting: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\brumm, { |dur = 1, pan = 2, freq = 40, index = 20|\n var sig = Pan2.ar(\n Blip.ar(freq, index),\n pan\n ) * EnvGen.ar(Env.perc(0.01, dur), doneAction: 2);\n Out.ar(0, sig);\n}).add;\n);\n\n(\nPbind(*[\n dur: Pseq([1.2, 0.2, 0.5, Pseries(0.1, -0.001, 100)], inf),\n pan: Pxrand(#[-0.5, 0.5, 0.1, -0.1, 0.8, -1], inf),\n freq: 40,\n instrument: \\brumm\n]).play();\n);\n\n(\nPbind(*[\n dur: Pseq([1.2, 0.2, 0.5, Pseries(0.1, -0.001, 100)], inf),\n pan: Pxrand(#[-0.5, 0.5, 0.1, -0.1, 0.8, -1], inf),\n freq: Pseq([Pseries(140, 0.5, 200)], inf),\n instrument: \\brumm\n]).play;\n);\n\n(\nPbind(*[\n dur: Pseq(Signal.chebyFill(1024, Array.rand(10, 0.0, 10.0)).abs + 0.05, inf),\n pan: Pxrand(#[-0.5, 0.5, 0.1, -0.1, 0.8, -1], inf),\n freq: Pseq(Signal.chebyFill(1024, Array.rand(10, 0.0, 10.0)).abs * 18000 + 120, inf),\n instrument: \\brumm\n]).play;\n);\n\n\n(\nPbind(*[\n dur: Pseq([1.2, 0.2, 0.5, Pseries(0.1, -0.002, 50)], inf),\n pan: Pxrand(#[-0.5, 0.5, 0.1, -0.1, 0.8, -1, 1, -0.8], inf),\n freq: Pseq([Pseries(740, 0.5, 200), Pxrand(Array.series(740, 0.5, 200), 50)], inf),\n instrument: \\brumm\n]).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "My pattern keeps playing after I press Ctrl+."}, {"role": "assistant", "content": "Ctrl+. (CmdPeriod) stops everything scheduled on the clocks, including Patterns. If yours survives, it is not scheduled on a clock — most often it is a `Synth` created directly, or a `Task`/`Routine` started on `SystemClock` in a way that outlived the period. Do you still see the node in `s.plotTree`?"}, {"role": "user", "content": "Yes, there's a synth."}, {"role": "assistant", "content": "Then the sound is a node, not a pattern: `s.freeAll` will stop it. The likely cause is a SynthDef whose EnvGen has no `doneAction`, or a drone with `gate = 1` that nothing releases. Add `doneAction: 2` to the envelope, or keep a reference and `x.set(\\gate, 0)` when you want it to end."}]} +{"conversations": [{"role": "user", "content": "What does `EnvelopeView.drawRects` do? What arguments does it take?"}, {"role": "assistant", "content": "Whether to draw the Arguments: A Boolean.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\n(\nSynthDef(\"help-PinkNoise\", { |out = 0|\n Out.ar(out, PinkNoise.ar(0.1))\n}).add;\n\nSynthDef(\"help-In\", { |out = 0, in = 0|\n var input;\n input = In.ar(in, 1);\n Out.ar(out, input);\n\n}).add;\n);\n\n// play noise on the right channel\nx = Synth(\"help-PinkNoise\", [\\out, 1]);\n\n// read the input and play it out on the left channel\nSynth.after(x, \"help-In\", [\\out, 0, \\in, 1];\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\n(\nSynthDef(\"help-PinkNoise\", { |out = 0|\n Out.ar(out, PinkNoise.ar(0.1))\n}).add;\n\nSynthDef(\"help-In\", { |out = 0, in = 0|\n var input;\n input = In.ar(in, 1);\n Out.ar(out, input);\n\n}).add;\n);\n\n// play noise on the right channel\nx = Synth(\"help-PinkNoise\", [\\out, 1]);\n\n// read the input and play it out on the left channel\nSynth.after(x, \"help-In\", [\\out, 0, \\in, 1]);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `SoundIn` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\nu = Server(\\scau, NetAddr(\"127.0.0.1\", 9989)); // Change the port from 9989 to the right one for you\nu.serverRunning = true;\nu.ping(10); // Gives about 0.02 for me - confirms that communication is working\n// Now let's create a quick ring-modulator effect:\nz = { SoundIn.ar([0,1]) * SinOsc.ar(MouseX.kr(100, 1000)) }.play(u);\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Collection`?"}, {"role": "assistant", "content": "Collection — Abstract superclass of all collections"}, {"role": "user", "content": "What does `Collection.newFrom` do?"}, {"role": "assistant", "content": "Creates a new Collection from another collection. This supports the interface for the method \"as\". `Array.newFrom(Set[4, 2, 1]);`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n~closet = [\\hat, \\hat, \\hat, \\coat, \\coat, \\shoe, \\shoe];\n~closet.removeAll([\\hat, \\coat, \\shoe, \\shoe]); // Doesn't empty the closet, just removes what we wanted to\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n VarLag.kr( // lag the modulator\n LFPulse.kr(1).range(100, 400), // frequency modulator\n 0.2, // lag time\n Line.kr(-8, 8, 15, doneAction: Done.freeSelf) // modulate shape\n ),\n 0, // sine phase\n 0.3 // sine amplitude\n )\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n VarLag.kr( // lag the modulator\n LFPulse.kr(1).range(100, 400), // frequency modulator\n 0.2, // lag time\n Line.kr(-8, 8, 15, doneAction: Done.freeSelf) // modulate shape\n ),\n 0, // sine phase\n 0.3 // sine amplitude\n )\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// You'll only hear the front two channels on a stereo setup.\n\n{ Pan4.ar(PinkNoise.ar, FSinOsc.kr(2), FSinOsc.kr(1.2), 0.3)) }.play;\n\n\n{ Pan4.ar(PinkNoise.ar, -1, 0, 0.3) }.play; // left pair\n{ Pan4.ar(PinkNoise.ar, 1, 0, 0.3) }.play; // right pair\n{ Pan4.ar(PinkNoise.ar, 0, -1, 0.3) }.play; // back pair\n{ Pan4.ar(PinkNoise.ar, 0, 1, 0.3) }.play; // front pair\n\n{ Pan4.ar(PinkNoise.ar, 0, 0, 0.3 }.play; // center\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// You'll only hear the front two channels on a stereo setup.\n\n{ Pan4.ar(PinkNoise.ar, FSinOsc.kr(2), FSinOsc.kr(1.2), 0.3)) }.play;\n\n\n{ Pan4.ar(PinkNoise.ar, -1, 0, 0.3) }.play; // left pair\n{ Pan4.ar(PinkNoise.ar, 1, 0, 0.3) }.play; // right pair\n{ Pan4.ar(PinkNoise.ar, 0, -1, 0.3) }.play; // back pair\n{ Pan4.ar(PinkNoise.ar, 0, 1, 0.3) }.play; // front pair\n\n{ Pan4.ar(PinkNoise.ar, 0, 0, 0.3) }.play; // center\n```"}]} +{"conversations": [{"role": "user", "content": "What is `HilbertHRe` in SuperCollider?"}, {"role": "assistant", "content": "HilbertHRe — Applies the Real part of the Hilbert Transform to an input signal. [1] Offers the Hilbert transform of an input signal via Weaver's Second Method,footWeaver, Donald. “A Third Method of Generation and Detection of Single-Sideband Signals.” Proceedings of the IRE, vol. 44, no. 12, 1956, pp. 1703–1705. known as Hartley Phasing.footUS Patent 1,666,206, Modulation System, April 17, 1928, United States Patent and Trademark Office. Category: Libraries > Hilbert > Pseudo-UGens, UGens > Filters > Nonlinear."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Compare:\n\n{ WhiteNoise.ar(0.25) }.play;\n\n{ HPZ2.ar(WhiteNoise.ar(0.25)) }.play;\n\n// HPZ2 is useful to detect changes in a signal:\n// see also HPZ1\n(\n{\n var changingSignal = LFNoise0.ar(1000);\n var hpz2 = HPZ2.ar(changingSignal);\n [hpz2, hpz2 > 0]\n}.plot\n;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Compare:\n\n{ WhiteNoise.ar(0.25) }.play;\n\n{ HPZ2.ar(WhiteNoise.ar(0.25)) }.play;\n\n// HPZ2 is useful to detect changes in a signal:\n// see also HPZ1\n(\n{\n var changingSignal = LFNoise0.ar(1000);\n var hpz2 = HPZ2.ar(changingSignal);\n [hpz2, hpz2 > 0]\n}.plot\n);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Pseq(#[60, 61, 63, 65, 72], inf).asStream;\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, a.next.midicps]);\n 0.2.wait;\n })\n}).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Pseq(#[60, 61, 63, 65, 72], inf).asStream;\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, a.next.midicps]);\n 0.2.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Scale`?"}, {"role": "assistant", "content": "Scale — represents a musical scale"}, {"role": "user", "content": "What does `Scale.all` do?"}, {"role": "assistant", "content": "The scale repository, to which new scales can be added. `Scale.all.put(\\catastrophic, Scale([0, 0.01, 0.04, 11.2]));`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\na = Scale.major;\na.degrees; // [0, 2, 4, 5, 7, 9, 11]\na.semitones; // [0, 2, 4, 5, 7, 9, 11]\na.cents; // [0, 200, 300, 500, 700, 900, 1100]\na.ratios; // [1, 1.1224620483089, 1.2599210498937, 1.3348398541685, etc.]\n\nPbind(\\scale, a, \\degree, Pseq((0..7) ++ (6..0) ++ [\\rest], 1), \\dur, 0.25).play;\n\n// use non-standard tuning\na.tuning_(\\just);\na.degrees; // no change; degrees are independent of tuning\na.semitones; // [0, 2.0391000173077, 3.1564128700055, 4.9804499913461, etc.]\na.ratios.collect(_.round(0.001)); // [1, 1.125, 1.2, 1.333, 1.5, 1.667, 1.875]\n\nPbind(\\scale, a, \\degree, Pseq((0..7) ++ (6..0) ++ [\\rest], 1), \\dur, 0.25).play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `RedSlide.up` do?"}, {"role": "assistant", "content": "Set or get the amount of lag when using the slide"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n var saw, bpf;\n saw = Saw.ar(\n freq: [1700,2000],\n mul: LFPulse.kr(\n freq: [2,7],\n width: 0.115));\n bpf = LPF.ar(in: saw, freq: SinOsc.kr(1/3).range(250, 4000)); \n}.play;\n)\n```"}, {"role": "assistant", "content": "Quiz 4a for MUSC 115, pp. 62-84 from Gentle Intro to SuperCollider."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Using sine waves to generate a saw waveform. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\nq={|f,e|a=Array.fill(e,{|j|e-j}).reverse;(Mix.ar(a.collect{|x|SinOsc.ar(f*x,0,1/x)})/2)!2};{q.(60,300)}.play //saw from sine #supercollider\n\n//Change the values passed to q to control the frequency and how many sines are used.\n```"}]} +{"conversations": [{"role": "user", "content": "I get 'FAILURE IN SERVER /s_new SynthDef not found'. What is wrong?"}, {"role": "assistant", "content": "The server does not know that SynthDef. Three usual causes, in order of likelihood:\n\n1. **The SynthDef was added before the server booted.** `SynthDef(...).add` is asynchronous; wrap the work\n in `s.waitForBoot { ... }` or put `s.sync` after `.add`.\n2. **The name does not match.** `SynthDef(\\bell, ...)` is played by `Synth(\\bell)`, not `\\Bell` — symbols\n are case-sensitive.\n3. **`.add` was never called.** Writing `SynthDef(\\bell, { ... })` without `.add` builds the definition in\n the language and sends nothing.\n\nCheck with `SynthDescLib.global.dict.keys` — if the name is not there, it never reached the server."}]} +{"conversations": [{"role": "user", "content": "What does `Vowel.formLib` do?"}, {"role": "assistant", "content": "holds formant information Returns: a Dictionary"}]} {"conversations": [{"role": "user", "content": "What does `HilbertHRe.calcCoeffs` do? What arguments does it take?"}, {"role": "assistant", "content": "Generate real Arguments: size — The size of the kernel used for Hartley Phasing filtering.."}]} -{"conversations": [{"role": "user", "content": "What does `ServerLogGui.showTimes` do?"}, {"role": "assistant", "content": "the interface for display and searching the ServerLog Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Pushing air."}, {"role": "assistant", "content": "```supercollider\n/*\n0050\n\"pushing air\" => \".--. ..- ... .... .. -. --. / .- .. .-.\"\n*/\n\n~morsestr = \".--. ..- ... .... .. -. --. / .- .. .-. / \";\n\n~ctlbus1 = Bus.control(s);\nMIDIIn.connectAll;\n\n(\nSynthDef(\\perc, {|freq=280|\n var ampEnv, snd, attack, release, sat, mod;\n release = 3;\n attack = ~ctlbus1.kr;\n sat = -2;\n mod = SinOsc.ar(4, 0, 2);\n ampEnv = EnvGen.ar(Env.perc(attack, release, 1), doneAction:2);\n snd = ampEnv * SinOsc.ar([freq, (1.005*freq)+mod], [Rand(0,3.14),Rand(0,3.14)]);\n snd = 2/(1 + (sat*snd).exp) - 1;\n Out.ar(0,snd);\n}).add;\n);\n\n~t = TempoClock.new;\n~t.tempo = 3;\nTdef(\\morse).play(~t);\n\n\n(\nMIDIdef.cc(\\attackTime, \n {|val, num, chan, src| \n var attackTime;\n\n attackTime = val.linlin(0,127,0,2);\n ~ctlbus1.set(attackTime);\n (\"attackTime: \" ++ attackTime).postln;\n },2);\n\nMIDIdef.cc(\\tempo, \n {|val, num, chan, src| \n var index;\n var tempoArray = [3,6,12];\n \n index = val.linlin(0,127,0,2);\n ~t.tempo = val.linlin(0,127,1,12);//tempoArray[index];\n val.linlin(0,127,1,12).postln;//tempoArray[index].postln;\n },14);\n);\n\n(\nTdef(\\morse,\n{ \n inf.do{ |i| \n \n var f0 = 180 * (2**(0/12));\n var freq = 2**(([-7,-3,0,2,5,9,12].choose)/12) * f0;\n var char = ~morsestr.wrapAt(i).asString;\n \n switch(char,\n \".\", { \".\".post; \n //x = Synth(\\default); \n x = Synth(\\perc, [\\freq, freq]); \n 1.wait;\n //x.release;\n },\n \"-\", { \"-\".post; \n //x = Synth(\\default); \n x = Synth(\\perc, [\\freq, freq]); \n 3.wait;\n //x.release;\n },\n \" \", { \" \".post; \n 1.wait;\n },\n \"/\", { \"/\".post;\n 3.wait;\n }, {});\n };\n})\n);\n\nTdef(\\morse).reset;\nTdef(\\morse).pause;\nTdef(\\morse).stop;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// Create a new empty collections with size 3:\nx = Array.new(3);\ny = Array.new(3);\nz = List.new(3);\n\n// Try to add 7 items to the array and list.\n// If the array exceeds maxSize, it will only\n// grow to an internally specified max size.\n(\n7.do { |i|\n x.add(i);\n y = y.add(i); // reassign array y on each add\n z.add(i);\n};\n);\n\n// Attempt to access the 5th item:\nx.at(4); // -> nil (out of bounds)\ny.at(4); // -> 4\nz.at(4); // -> 4\n\n// x grew only to size 4\nx.postln; // -> [ 0, 1, 2, 3 ]\ny.postln; // -> [ 0, 1, 2\n// …\n```"}, {"role": "assistant", "content": "Create a new empty collections with size 3: Try to add 7 items to the array and list. (List: list of items of variable size)"}]} -{"conversations": [{"role": "user", "content": "What does `PlayerInputProxy.setNodeControl` do? What arguments does it take?"}, {"role": "assistant", "content": "placeholder for Patch inputs for a player that will be supplied later Arguments: nc."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// play SinOscs silently and wait for granulation envelopes\n\n(\na = Bus.audio(s, 10);\nx = { Splay.ar(In.ar(a, 10) * SinOsc.ar((3..12) * 100, 0, 0.05)) }.play\n);\n\n\n// send envelopes to buses\n\n(\nz = {\n DXEnvFanOut.ar(\n Dseq((0..5) + a.index, inf) + Diwhite(1, 4),\n \n // with newer SC versions you can also write:\n // Dseq((0..5), inf) + Diwhite(1, 4) + a.index,\n \n fadeTime: 0.05,\n width: 1,\n initOutOffset: -0.5\n )\n}.play\n);\n\nx.release;\n\n// clean\n// …\n```"}, {"role": "assistant", "content": "play SinOscs silently and wait for granulation envelopes send envelopes to buses (DXEnvFanOut: sends crossfade envelopes to out buses according to demand-rate control)"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `BrownNoise`."}, {"role": "assistant", "content": "```supercollider\n{ SinOsc.ar(BrownNoise.ar(100, 200)) * 0.1 }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `LFDNoise1` in SuperCollider briefly."}, {"role": "assistant", "content": "LFDNoise1 — Dynamic ramp noise Like LFNoise1, it generates linearly interpolated random values at a rate given by the `freq` argument, with two differences: Category: UGens > Generators > Stochastic."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// First we create something to control\nx = { |freq = 440, amp = 0.6| MoogFF.ar(PinkNoise.ar(amp), freq).dup }.play;\n\n// In the following pattern, the first two keys are the ones that create the monophonic behaviour:\n(\np = Pbind(\n \\type, \\set, // This tells it we'll be setting parameters of an existing node...\n \\id, x.nodeID, // ...this tells it whose parameters we'll be setting\n \\args, #[\\freq, \\amp], // and this tells it which parameters to set\n \\freq, Pwhite(100, 1000),\n \\dur, 0.2,\n \\amp, Pseq((1, 0.99 .. 0.1), inf)\n).play;\n);\n\np.stop\nx.\n// …\n```"}, {"role": "assistant", "content": "First we create something to control In the following pattern, the first two keys are the ones that create the monophonic behaviour: (Pmono: monophonic event stream)"}]} -{"conversations": [{"role": "user", "content": "What does `PBlip.new` do? What arguments does it take?"}, {"role": "assistant", "content": "UGenPatterns quark library Arguments: freq; numharm; mul; add; length — Number of values produced.."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\ns.boot;\n\n// The mul and add arguments of SinOsc themselves use MulAdd!\n// These two examples will create precisely the same synth graph:\nx = { SinOsc.ar(440, 0, 0.1, 0.05) }.play(s);\nx.trace; // You should see a \"MulAdd\" in the trace\nx.free;\n\nx = { MulAdd(SinOsc.ar(440, 0), 0.1, 0.05) }.play(s);\nx.trace;\nx.free;\n\n// In fact this will produce the same graph too - the separate multiply and add are optimised into one MulAdd\nx = { SinOsc.ar(440, 0) * 0.1 + 0.05 }.play(s);\nx.trace;\nx.free;\n```"}, {"role": "assistant", "content": "The mul and add arguments of SinOsc themselves use MulAdd! These two examples will create precisely the same synth graph: (MulAdd: Multiply and add to a signal)"}]} -{"conversations": [{"role": "user", "content": "Speech to midi converter?"}, {"role": "assistant", "content": "SuperCollider forum — Speech to midi converter?\n\nHello!\n\nI want to make a speech to midi converter in Supercollider.\n\nI’ve started off trying to find a way to convert FFT data to midi-numbers to send to a midi-instrument, but I’m stuck:\n\n```supercollider\n~file = Buffer.read(s, \"path_to_file\", bufnum:1);\n\n(\n{\n var buf = Buffer.alloc(s, 2048, bufnum:2);\n var sig = PlayBuf.ar(2, 1, loop:1);\n var chain = FFT(buf, sig);\n var trig = Impulse.kr(30);\n chain[0].pvcalc(80, {\n |phas, mag|\n SendReply.kr(trig, \"/anal\", mag);\n });\n}.play\n);\n\n(\nOSCdef.new(\\midiConverter, {\n |msg|\n msg.postln;\n}, \"/anal\");\n)\n```\n\nthe output looks like this:\n\n[ /anal, 1000, -1, 0.0, 3.0463190078735, 2.1142015457153, -0.64955651760101, 2.3432319164276, -0.23956227302551, -3.1334409713745, -2.1829152107239, 1.1417833566666, -2.2972648143768, -0.74415707588196, -0.88793164491653, 1.9947071075439, -1.1327115297318, 2.6084003448486, etc...]\n\nI’m not sure how to interpret theese numbers. And I’m not sure pvcalc is even the best way to get the data I need. I want to somehow be able to control the resolution on how many of the loudest bins I’m going to convert to frequency and then from frequency to midi-number to send to a midi-instrument as the soundfile plays through.\n\nAny ideas?"}]} -{"conversations": [{"role": "user", "content": "Explain `FoaDecode` in SuperCollider briefly."}, {"role": "assistant", "content": "FoaDecode — First Order Ambisonic (FOA) decoder Renders (decodes) a First Order Ambisonic signal (B-format) to speaker feeds in a variety of configurations. DecodeB2 is the SuperCollider inbuilt equivalent. Category: Libraries > Ambisonic Toolkit > UGens > FOA > Decoder, UGens > Multichannel > Ambisonics."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\np = ProxySpace.push(s.boot);\n~a.play.quant_(4); ~b.play.quant_(4);\n~c = { LFNoise1.kr(8).range(0,15).round };\n~a = Pbind(\\degree, Pstutter(4, Pseq([0,2,3,4], inf)), \\octave, [3,4], \\dur, 0.25, \\amp, 0.3);\n~b = Pbind(\\octave, 4, \\scale, Scale.majorPentatonic, \\degree, ~c, \\dur, 1/4, \\legato, 0.5);\n```"}, {"role": "assistant", "content": "a short piece which plays random major music. It sounded very happy."}]} -{"conversations": [{"role": "user", "content": "What is `Pdrop` in SuperCollider?"}, {"role": "assistant", "content": "Pdrop — skips (drops) the first n events from a pattern Skips an initial (count) number of events from a pattern. Category: Streams-Patterns-Events > Patterns."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// connect a MIDI device, allNotesOff with CmdPeriod useful\n\nMIDIClient.init;\nm = MIDIOut(0);\ng = { 16.do({ |i| m.allNotesOff(i) }) };\nCmdPeriod.add(g); \n\n\np = Pbind(\n \\type, \\midi,\n \\midiout, m, \n \\chan, 0,\n\n \\amp, PL(\\amp),\n \\midinote, PLseq(\\seq) + PL(\\seqAdd), \n \\dur, 0.2\n);\n);\n\n(\nv = VarGui([\\seq, [36, 60, \\lin, 1, 36] ! 5, \n \\seqAdd, [0, 12, \\lin, 1, 0],\n \\amp, [0, 1, \\\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// connect a MIDI device, allNotesOff with CmdPeriod useful\n\nMIDIClient.init;\nm = MIDIOut(0);\ng = { 16.do({ |i| m.allNotesOff(i) }) };\nCmdPeriod.add(g); \n\n\np = Pbind(\n \\type, \\midi,\n \\midiout, m, \n \\chan, 0,\n\n \\amp, PL(\\amp),\n \\midinote, PLseq(\\seq) + PL(\\seqAdd), \n \\dur, 0.2\n);\n);\n\n(\nv = VarGui([\\seq, [36, 60, \\lin, 1, 36] ! 5, \n \\seqAdd, [0, 12, \\lin, 1, 0],\n \\amp, [0, 1, \\lin, 0.01, 0.8]],\n stream: p\n).gui;\n);\n\n// remove if not needed anymore\n\nCmdPeriod.remove(g);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `PIdev.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new PIdev Arguments: pattern — The source value pattern to start search from.; maxLookBack — Integer, the maximum lookback span. Fixed, defaults to 3.; loDev — Determines the current low deviation for the search. Defaults to -3.; hiDev — Determines the current high deviation for the search. Defaults to 3.; lookBack — Determines the current lookback span for avoiding repetitions. Can be modulated but must not exceed maxLookBack. If no value is passed, then maxLookBack is taken.; thr — Threshold for equality comparison. Can be modulated, defaults to 1e-3.; length — Number of repeats. Defaults to inf.."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BufDelayC`."}, {"role": "assistant", "content": "```supercollider\n// allocate buffer\nb = Buffer.alloc(s, 44100, 1);\n\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nBufDelayC.ar(b.bufnum, z, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\nb.free;\n\n\n// multichannel\n\n// two channels, two buffers\nb = Buffer.allocConsecutive(2, s, 32768, 1);\n\na = { |bufs = #[0, 1]|\n var sig = SinOsc.ar([440, 880]) * Decay2.kr(Impulse.kr([2, 4]), 0.01, 0.15);\n sig + BufDelayC.ar(bufs, sig, delaytime: 0.125)\n}.play(args: [bufs: b]);\n\na.free;\nb.do(_.free);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Very quick-and-dirty hack to show stereo phase."}, {"role": "assistant", "content": "```supercollider\n(\nb = Bus.audio(s, 2);\na = { |inbus = 0|\n var sig = In.ar(inbus, 2);\n // x axis is side, oriented toward right;\n // y axis is mid\n [sig[1] - sig[0], sig.sum]\n}.play(s.defaultGroup, outbus: b, addAction: \\addAfter);\nc = s.scope;\nc.style = 2;\nc.bus = b;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Now you're going to die (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\fall, { arg freq=200, pan=0, amp=0.1;\n var sig;\n sig = ( WhiteNoise.ar + 0.8 ) * LFSaw.ar({ exprand(10.0,10000) }!20 * ( 1 + ( SinOsc.ar((1..4).rand(0.0)/18 * XLine.kr(1,121200,80)) * 1/41 * XLine.kr(1,180,60) )));\n sig = DelayC.ar(sig, 0.2, {rrand(1/5,1/10000) * ( 1 + ( SinOsc.ar((1..2).rand(0.0)/18 * XLine.kr(1,121200,60)) * 1/41 * XLine.kr(1,180,60) ))}!4) + sig / 2;\n sig = DelayC.ar(sig, 0.2, {rrand(1/5,1/10000) * XLine.kr(1,1/1000,14)}!4) + sig / 2;\n sig = sig + BPF.ar(\n sig, \n { ( exprand(100.0,10000) * LFNoise1.ar(1/100.0.rand).range(1,2) ).clip(20,20000) }!10,\n { ( rand(0.01,1) * LFNoise1.ar(1/100.0.rand).range(1,2) ).clip(0.01,1) }!10\n );\n sig = BRF.ar(\n sig, \n { ( exprand(100.0,10000) * LFNoise1.ar(1/100.0.rand).range(1,2) ).clip(20,20000) }!10,\n { ( rand(0.01,1) * LFNoise1.ar(1/100.0.rand).range(1,2) ).clip(0.01,1) }!10\n );\n sig = LeakDC.ar(sig);\n sig = LPF.ar(sig, 17000 * XLine.kr(1/100,1,4));\n sig = sig * 5 * 3;\n sig = sig.mean;\n sig = sig * amp;\n sig;\n}).play;\n);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SimpleNumber.bilin` do? What arguments does it take?"}, {"role": "assistant", "content": "map the receiver from two assumed linear input ranges (inMin..inCenter) and (inCenter..inMax) to two linear output ranges (outMin..outCenter) and (outCenter..outMax). If the input exceeds the input range, the following behaviours are specified by the clip Arguments: inCenter; inMin — assumed input minimum; inMax — assumed input maximum; outCenter; outMin — output minimum; outMax — output maximum; clip — nil (don't clip) \\max (clip ceiling) \\min (clip floor) \\minmax (clip both - this is default).."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Dreset`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a, freq;\n a = Dreset(Dseries(0, 2, inf), Drand([0, 0, 0, 1], inf));\n freq = Duty.kr(1/MouseX.kr(1, 40, 1), 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n}.play;\n);\n\n// reset when mouse button is pressed\n(\n{\n var a, freq;\n a = Dreset(Dseries(0, 2, inf), MouseButton.kr);\n freq = Duty.kr(1/MouseX.kr(1, 40, 1), 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n}.play;\n);\n\n// audio rate\n(\n{\n var a, nmax = 90;\n a = { Dreset(Dseries(0, 1, inf), Drand(0 ! nmax ++ 1, inf)) } ! 2;\n Duty.ar(SampleDur.ir, 0, a) * (0.1 / nmax)\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\FuMaIn;\n~description = \"A live ambisonic input (ACN_FuMa)\";\n~channelLayout = \\ambi;\n\n~function = { |order = 1, t_trig = 0, bus = 0|\n var env = EnvGen.kr(Env([0,1], [1]), t_trig);\n var chans = Array.series(\n size: (order + 1).pow(2).asInteger,\n start: bus,\n step: 1\n );\n var input = SoundIn.ar(chans, env);\n HOAConverterFuma2AcnN3d.ar(order, input);\n}\n```"}, {"role": "assistant", "content": "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see ."}]} -{"conversations": [{"role": "user", "content": "What is `CSVFileReader` in SuperCollider?"}, {"role": "assistant", "content": "CSVFileReader — file reader for comma separated data CSVFileReader reads comma-separated text files into 2D arrays line by line. Category: Files."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nPbind(\n \\degree, Pseries(0, 1, inf).fold(-7, 7),\n \\dur, Pseq([Pn(0.125, { rrand(3, 6) }), Rest(0.25)], inf)\n).play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nPbind(\n \\degree, Pseries(0, 1, inf).fold(-7, 7),\n \\dur, Pseq([Pn(0.125, { rrand(3, 6) }), Rest(0.25)], inf)\n).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Custom event type for wiring up effects?"}, {"role": "assistant", "content": "```supercollider\n(\n// add custom event\nEvent.addEventType(\\nbind, {arg server;\n\n var id = (currentEnvironment[\\ndef] ? currentEnvironment[\\instrument]).asSymbol;\n var type = \\note;\n\n if (Ndef(id).isPlaying.not) {\n Ndef(id).play;\n };\n\n ~type = type;\n ~group = Ndef(id).group;\n ~out = Ndef(id).bus;\n\n currentEnvironment.play;\n});\n\n// synth\nSynthDef(\\synth1, {arg freq = 440, out = 0;\n \n var env = Env.perc.kr(doneAction:2);\n var sig = SinOscFB.ar(freq * [1, 1.01], 0.7);\n sig = sig * env;\n OffsetOut.ar(out, Splay.ar(sig));\n \n}).add;\n\n// set up first set of fx\nNdef(\\fx1).play;\nNdef(\\fx1)[0] = \\filter -> {arg in;\n in.abs;\n};\n\n// set up additional fx\nNdef(\\fx2).play;\nNdef(\\fx2)[0] = \\filter -> {arg in;\n in + AllpassC.ar(in, 0.2, 0.2, [3, 5]);\n};\n\n);\n\n// play a pattern\nPbind(\\instrument, \\synth1, \n // specify custom event type\n \\type, \\nbind, \n // switch between fx\n \\ndef, Pseq([\\fx1, \\fx2], inf),\n \\degree, Pwhite(0, 5, inf)\n).play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes beats to bar printing."}, {"role": "assistant", "content": "```supercollider\n(\nf = ();\nf.beatAndBar = {\n var t = currentEnvironment.clock; // t= TempoClock.new;\n var text = \"xB: \";\n\n var nBeatsPerBar = { arg n, beats, clock;\n var nBpb = clock.beatsPerBar * n;\n \"\" ++ n ++ text ++ (nBpb - (beats%(nBpb))).asInteger\n };\n\n t.play({arg beats, time, clock;\n ( //[\"beat: \" ++ (t.beatInBar + 1).asInteger] ++ //uncomment for beat in bar\n [1,2,4,8,16,32].collect( {|n,i| nBeatsPerBar.value(n, beats, clock)})\n ).postln;\n 1});\n \"beatAntBar\";\n}\n);\n\nf[\\beatAndBar].value;\n\n(\nf[\\beatAndBar].value;\nCmdPeriod.add(f[\\beatAndBar]);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `HPF`."}, {"role": "assistant", "content": "```supercollider\n{ HPF.ar(Saw.ar(200, 0.1), FSinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3600, 4000), 5) }.play;\n\n(\n{ var ctl = HPF.kr(LFSaw.kr(5), SinOsc.kr(XLine.kr(0.07, 30, 20), 0, 35, 40)) ;\n SinOsc.ar(ctl * 200 + 500);\n}.play;\n);\n\n(\n{ var ctl = HPF.kr(LFSaw.kr(5, 0.1), MouseX.kr(2, 200, 1));\n SinOsc.ar(ctl * 200 + 400) * 0.1;\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Rand or rand difference?"}, {"role": "assistant", "content": "SuperCollider forum — Rand or rand difference?\n\nI think you meant to compare Rand and rrand (not rand) – both generate a random number between a given low and high, but Rand is intended to be used inside a SynthDef and the behavior is slightly different. Compare:\n\n```supercollider\n(\nSynthDef(\\test, {\n var freq = rrand(400, 600);\n Out.ar(0, SinOsc.ar(freq) * 0.2);\n}).add;\n);\n\nSynth(\\test); // run and stop multiple times: always same freq\n\n(\nSynthDef(\\test2, {\n var freq = Rand(400, 600);\n Out.ar(0, SinOsc.ar(freq) * 0.2);\n}).add;\n);\n\nSynth(\\test2); // run and stop multiple times: every time a different freq\n```\n\nAs you can read in the help file, Rand is intended to be used inside SynthDefs when you want the particular behavior of a newly generated random frequency for each Synth called. You can use rrand(lo, hi) inside a SynthDef too, if you want the random number to be generated only once at time of SynthDef creation (it gets “inscribed in the recipe” for good), so all future and all Synth calls based on that SynthDef to use on that same random number.\n\nAs a side note, rand (as opposed to rrand) generates a random number between zero and the receiver:\n\n```supercollider\nrand(8); // random numbers between 0 and and 8 (excluding 8)\n\nrand(0.5, 8); // random numbers between 0 and 0.5; second argument is ignored here\n```\n\nAlso in regards to the specific way you present the example (as Functions, indicated by the curly braces): note the difference when you evaluate them:\n\n```supercollider\n{Rand(0.5,8)}.value; // returns 'a Rand'\n{rrand(0.5,8)}.value; // returns an actual random choice between lo and hi\n```\n\nHope this helps,\n\nB"}]} -{"conversations": [{"role": "user", "content": "What is `NamedControl`?"}, {"role": "assistant", "content": "NamedControl — Named reference to a control"}, {"role": "user", "content": "What does `NamedControl.ar` do?"}, {"role": "assistant", "content": "add a new instance of AudioControl with given name and default values. If lags are given, apply a Lag UGen to it."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// use NamedControl to create a number of multichannel controls:\n\na = { SinOsc.ar(NamedControl.kr(\\freq, [300, 330, 370], [1, 0.3, 0.02])).sum * 0.1 }.play;\na.setn(\\freq, [700, 705, 890]);\na.setn(\\freq, [0, 2, 5].midiratio * 400);\n\n// synonymous:\na = { SinOsc.ar(\\freq.kr([300, 330, 370], [1, 0.3, 0.02])).sum * 0.1 }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SGliss.removeVoices` do? What arguments does it take?"}, {"role": "assistant", "content": "remove Arguments: num — the number of voices to be removed.; action — a LINKClasses/Function that will be evaluated when the voice has faded out.."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n{ Pan2.ar(Klank.ar(`[[1, 2.2, 3.5, 4.9], nil, Array.series(4, 1, -0.2)], PinkNoise.ar(EnvGen.ar(Env.perc(0.001,0.01), Impulse.ar(4))), 0), 0); }.play;\n```"}, {"role": "assistant", "content": "I accidentally set the freqscale of a Klank to 0. What resulted was a surprisingly varied and dynamic bit of glitch. The joy of typos in SC :)."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Random deep fryer?"}, {"role": "assistant", "content": "```supercollider\n// random deep fryer. can turn in to rain, waves and other stuff.\n// nice with multichannel iteration. Change number at \"!2\".\n// volume compensation for high quality filter with \"1/q.sqrt\" for mul in BPF.\n// variable \"dist\" for distortion, increasing can go loud, decrease \"amp\" if so.\n// LFNoise1 with noisefreq,noisemul,noiseoffset gives it the wavy feel.\n\n(\nSynthDef(\\friture, {\n arg amp=0.5, dist=2, dens=12, dustamp=1, offset=0, noisefreq=2, noisemul=2,\n noiseoffset=0, frq1=200, frq2=2500, rq1=0.5, rq2=0.1, out=0;\n\n var sig, env;\n\n sig = {BPF.ar((Dust2.ar(dens, dustamp, offset)*LFNoise1.ar(noisefreq,noisemul,noiseoffset)),rrand(frq1,frq2),q=rrand(rq1,rq2),1/q.sqrt)}!2;\n sig = (sig*dist).tanh*amp;\n\n\n Out.ar(out,sig);\n\n }).add;\n);\n\ny = Synth.new(\\friture);\ny.free;\n\ny.set(\\dens,161);\ny.set(\\amp,0.5);\ny.set(\\dist,1);\ny.set(\\rq1,0.2);\ny.set(\\rq2,0.4);\ny.set(\\frq1,133);\ny.set(\\frq2,193);\ny.set(\\noisefreq,1);\ny.set(\\noisemul,2);\ny.set(\\noiseoffset,(-2));\ny.set(\\out,0);\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Voices (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n/* Voices\n\nhttp://www.kimri.org/blog/?p=64\n\n */\n\ns.boot;\n\nSynthDef(\\voice,{arg out=0,n=0,p=0,d=10,r=10;\nvar sig=Array.fill(3,{|i| VarSaw.ar(n.midicps*(i+1.0001),mul:0.05/(i+1))}).sum;\nvar sig2=Ringz.ar(WhiteNoise.ar(0.0003),TRand.ar(n.midicps,(n+1).midicps,Impulse.ar(10)));\nvar env=EnvGen.kr(Env.linen(d,1,r),gate:1,doneAction:2);\nOut.ar(out,Pan2.ar((sig+sig2)*env*(0.8+SinOsc.kr(0.1,0,0.2)),p));\n}).add;\n\nNdef(\\rev,{\nOut.ar(0,Limiter.ar(FreeVerb.ar(LPF.ar(In.ar([0,1]),10000),mix:0.33),0.7));\n};\n);\n\nTdef(\\voices,{\ninf.do{\n10.do{\nif ((0.8).coin,{\nSynth(\\voice,[\\n:[24,28,29,48,36,40,41,52,53,60,64,65].choose,\\p:{rrand(-0.5,0.5)},\\d:{rrand(5,13)},\\r:{rrand(8,14)}]);\n});\nrrand(0.1,1).wait;\n};\n18.wait;\n};\n});\n\nTdef(\\voices).play;\nTdef(\\voices).stop;\n\ns.quit;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Canvas3D.mScale` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a matrix for Arguments: sX — X scaling; sY — Y scaling; sZ — Z scaling."}]} -{"conversations": [{"role": "user", "content": "When should I use a Pattern instead of writing Synth code by hand?"}, {"role": "assistant", "content": "Use a Pattern when what you want to express is a sequence over time — notes, durations, amplitudes, parameters — rather than a signal. A Pbind describes events, and `.play` turns each event into a Synth (by default of the \\default instrument, or of \\instrument if you name one). Hand-written Synth code is for the sound itself; Patterns are for what plays when. The two compose: a SynthDef named \\bell is triggered from `Pbind(\\instrument, \\bell, ...)`."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `MantissaMask`."}, {"role": "assistant", "content": "```supercollider\n// preserve only 3 bits of mantissa.\n{ MantissaMask.ar(SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4), 3) }.play\n\n// the original\n{ SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4) }.play\n\n// the difference.\n(\n{\n var in;\n in = SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4);\n in - MantissaMask.ar(in, 3)\n}.play\n)\n\n\n// preserve 7 bits of mantissa.\n// This makes the lower 16 bits of the floating point number become zero.\n{ MantissaMask.ar(SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4), 7) }.play\n\n// the original\n{ SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4) }.play\n\n// the difference.\n(\n{\n var in;\n in = SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4);\n in - MantissaMask.ar(in, 7)\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Simple Amplitude Tracker (language side)?"}, {"role": "assistant", "content": "```supercollider\n(\n// Simple amplitude tracker sending values to sclang\nSynthDef(\\ampTracker, { |in|\n var freq = 30; // num of values per second\n SendReply.kr(Impulse.kr(freq), '/amp', Amplitude.kr(SoundIn.ar(in)));\n}).add;\n);\n\n// start the tracker on scsynth\nSynth(\\ampTracker);\n\n(\n// receive the values in sclang\nOSCdef(\\ampTracker, { |m|\n m.postln;\n // now use m[3] for your purpose (detecting changes, etc...)\n}, '/amp');\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `NdefGui`."}, {"role": "assistant", "content": "```supercollider\n(\np = ProxySpace.push(s.boot);\n\nl = NdefGui(nil, 3).moveTo(10, 120);\nm = NdefGui(nil, 3).moveTo(10, 240);\nn = NdefGui(nil, 3).moveTo(10, 360);\no = NdefGui(nil, 3).moveTo(10, 480);\n\nSpec.add(\\dens, [0.1, 300, \\exp]);\n\n// make 3 kinds of proxies: using tilde/proxyspace, Ndef, and unnamed.\n~spacy = { |dens = 5| Formlet.ar(Dust.ar(dens ! 2), LFDNoise0.kr(20 ! 2).lag(0.1).linexp(-1, 1, 300, 5000), 0.003, 0.03) };\nNdef(\\ndeffy, { GrayNoise.ar(0.1 ! 2) });\nc = NodeProxy.audio.source_({ PinkNoise.ar(0.1 ! 2) });\n\n// put one in each editor\nl.object_(~spacy);\nm.object_(Ndef(\\ndeffy));\nn.object_(c);\n);\n// One should also be able to drag and drop text into the drag,\n// but this is also not working yet.\n( Ndef(\\a) )\n```"}]} -{"conversations": [{"role": "user", "content": "What does `EnvelopedPlayer.storeArgs` do?"}, {"role": "assistant", "content": "takes a Player as input and plays it through an Env with fused protection"}]} -{"conversations": [{"role": "user", "content": "What are the arguments of GrainBuf.ar?"}, {"role": "assistant", "content": "`GrainBuf.ar(numChannels, trigger, dur, sndbuf, rate, pos, interp, pan, envbufnum, maxGrains, mul, add)`. The ones you always pass are numChannels (1 or 2), trigger (a UGen that fires grains, e.g. Impulse.kr(20)), dur (grain length in seconds), sndbuf (an integer buffer number, or `~buf`), rate (playback rate per grain), and pos (read position 0..1 into the buffer). Raise maxGrains if the server complains about too many grains rather than lowering density."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for seeking an Array!."}, {"role": "assistant", "content": "```supercollider\n(// * //watch the postWindow\na=[\"m\",\"x\",\"f\",\"k\",\"d\",\"p\"];\nx=Array;\ny=x.newClear(6);\n~mxfkdp=Task({\n inf.do({y.put(x.series(6,0,1).choose,a.scramble).postln;\n 0.03.wait;})}).play;\nm=fork({inf.do({\n \"array num:\".postcln;\n if(y[x.series(6,0,1).choose.postcln]==a,\n {\"lo encontraste!/found it!\".postcln;\n 1.do({GVerb.ar(\n EnvGen.ar(Env.perc(0.01,8),1,doneAction:2)*\n Blip.ar(XLine.kr(440,1600,8)),50,10,0.02)}.play);\n ~mxfkdp.stop;\n m.stop;}, \n {\"buscando.../seeking...\".postcln;});\n 0.03.wait})});\n);\n//.SCtweetLong\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns.waitForBoot({\n var fftsize = 16384;\n b = Buffer.alloc(s, fftsize)\n})\n);\n\n\n(\nx = {\n // Any input should theoretically be OK, white noise is a good choice\n var son = WhiteNoise.ar;\n// var son = Impulse.ar;\n var out = LPF.ar(son, MouseX.kr(100, 10000, 1));\n var fft1 = FFT(LocalBuf(b.numFrames), son, wintype: 1);\n var fft2 = FFT(b, out, wintype: 1);\n\n // As with most PV_ ugens, the result is *actually* stored in the first fft buf\n var result = PV_Div(fft2, fft1\n// …\n```"}, {"role": "assistant", "content": "Any input should theoretically be OK, white noise is a good choice var son = Impulse.ar; (PV_Div: Complex division)"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Blip.ar(Latch.ar(WhiteNoise.ar, Impulse.ar(9)) * 400 + 500, 4, 0.2 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Blip.ar(Latch.ar(WhiteNoise.ar, Impulse.ar(9)) * 400 + 500, 4, 0.2) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What is `PLPZ1` in SuperCollider?"}, {"role": "assistant", "content": "PLPZ1 — UGenPatterns quark library Based on LPZ1 Category: Streams-Patterns-Events > UGenPatterns > Modifiers."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Periphonic (3D) encoder, a 1/2 dome of 13 loudspeakers\n// [[0, 0], [45, 0], [90, 0], [135, 0], [-180, 0], [-135, 0], [-90, 0], [-45, 0],\n// [45, 35.3], [135, 35.3], [-135, 35.3], [-45, 35.3], [0, 90]]\n\n~directions = [[0, 0], [45, 0], [90, 0], [135, 0], [-180, 0], [-135, 0], [-90, 0],\n [-45, 0], [45, 35.3], [135, 35.3], [-135, 35.3], [-45, 35.3], [0, 90]].degrad;\n~encoder = FoaE\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Periphonic (3D) encoder, a 1/2 dome of 13 loudspeakers\n// [[0, 0], [45, 0], [90, 0], [135, 0], [-180, 0], [-135, 0], [-90, 0], [-45, 0],\n// [45, 35.3], [135, 35.3], [-135, 35.3], [-45, 35.3], [0, 90]]\n\n~directions = [[0, 0], [45, 0], [90, 0], [135, 0], [-180, 0], [-135, 0], [-90, 0],\n [-45, 0], [45, 35.3], [135, 35.3], [-135, 35.3], [-45, 35.3], [0, 90]].degrad;\n~encoder = FoaEncoderMatrix.newDirections(~directions);\n\n// inspect\n~encoder.dirChannels.raddeg;\n```"}]} -{"conversations": [{"role": "user", "content": "How to generate paradiddles?"}, {"role": "assistant", "content": "SuperCollider forum — How to generate paradiddles?\n\nHi Rodet, I’m teaching jazz at college, and sometimes paradiddles come up in conversation (although I’m not a drummer). A paradiddle is basically a way of ‘evenly’ playing a roll (single/double/triple/whatever). If you take your drumsticks/fingers and play evenly:\n\nright, left, right, right, left, right, left, left, right, left, right, right, etc\n\nyou’ll notice that it’s possible to get an even rhythm, which when played fast becomes a roll. The idea of the single/double/triple is just to place the accents (lightly, or not) on the left, right hand, which if I understand helps keep an even stroke (and makes better sense to follow).\n\nSo, although I don’t know the goal of your idea, a simple code which would give you the solution could be a pattern. You’ll notice I’ve put in a SynthDef to give the ‘snare’ sound - not very real, but just for the demonstration. If you run these patterns, un-commenting the line needed (single, double or triple - don’t forget to comment out the lines you don’t need), you’ll hear the accents a paradiddle gives.\n\nIn this example Pbind ‘a’ gives the pulse, and Pbind ‘b’ the accents. And, if you play along with them (using your chart), you’ll notice the accents pass from right hand to left hand (or vice versa). This is (more or less) what paradiddles do, although a drummer will explain better how they ‘accent’ strokes to get more complicated/subtle rhythms.\n\n```supercollider\n(\nSynthDef(\\snare, {\n arg out=0, sus=0.1;\n var sig, env;\n sig = WhiteNoise.ar(0.1);\n env = EnvGen.kr(Env.perc(0.001, sus), doneAction:2);\n sig = sig*env;\n Out.ar(out, sig!2);\n}).add;\n);\n\n(\nt=TempoClock(80/60);\na=Pbind(\n \\instrument, \\snare,\n \\dur, 1/2,\n \\sus, 0.01\n);\nb=Pbind(\n \\instrument, \\snare,\n \\dur, 1,\n \\sus, Pseq([0.02, 0.01],inf), // single\n //\\sus, Pseq([0.02, 0.01, 0.01],inf), // double\n //\\sus, Pseq([0.02, 0.01, 0.01, 0.01],inf), // triple\n);\nPpar([a, b]).play(t);\n)\n```\n\nI hope that puts you on the right track.\n\np.s. Don’t forget to try out changing the speed to get the real effect. Try something like 320/60 on the TempoClock."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nb = BSpline( Array.fill(8,{ arg i; [ exprand(40,500),1.0.rand ] }), 3.0,false );\n\nb.gui(nil,1200@300);\n\n);\n\n(\n{\n # f , w = SplineGen(b,0,loop:true).xyKr(MouseY.kr(0.1,20),32);\n Pulse.ar(f.clip(40,500),w.clip(0.0,1.0),0.4).dup\n}.play\n);\n\nb.interpolate(32.flop.plot\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nb = BSpline( Array.fill(8,{ arg i; [ exprand(40,500),1.0.rand ] }), 3.0,false );\n\nb.gui(nil,1200@300);\n\n);\n\n(\n{\n # f , w = SplineGen(b,0,loop:true).xyKr(MouseY.kr(0.1,20),32);\n Pulse.ar(f.clip(40,500),w.clip(0.0,1.0),0.4).dup\n}.play\n);\n\nb.interpolate(32).flop.plot\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\nvar noise, out;\nnoise = LFNoise0.kr(8);\n\nout = if( noise > 0.0,\n if(noise > 0.5, \n if(noise > 0.9, WhiteNoise.ar(0.2), Pulse.ar(60, 0.5, 0.4)),\n SinOsc.ar(500, 0, 0.25)\n ),\n Saw.ar(160, 0.5)\n);\n\nout ! 2\n\n}.play;\n)\n```"}, {"role": "assistant", "content": "A short, silly example of using if in a SynthDef. Using Select is generally a better thing to do."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Since the allpass delay has no audible effect as a resonator on\n// steady state sound ...\n\n{ AllpassL.ar(WhiteNoise.ar(0.1), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// ...these examples add the input to the effected sound and compare variants so that you can hear\n// the effect of the phase comb:\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassN.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2)\n}.play)\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassL.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Since the allpass delay has no audible effect as a resonator on\n// steady state sound ...\n\n{ AllpassL.ar(WhiteNoise.ar(0.1), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// ...these examples add the input to the effected sound and compare variants so that you can hear\n// the effect of the phase comb:\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassN.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2)\n}.play)\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassL.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2)\n}.play)\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassC.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2)\n}.play)\n\n// used as an echo - doesn't really sound different than Comb,\n// but it outputs the input signal immediately (inverted) and the echoes\n// are lower in amplitude.\n{ AllpassL.ar(Decay.ar(Dust.ar(1, 0.5), 0.2, WhiteNoise.ar), 0.2, 0.2, 3) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// proceed with caution. start at min volume, and not with your expensive speakers.\n\nfork{b=Buffer.alloc(s,512,1);inf.do{b.cheby({[1,0].choose}!2);{(Shaper.ar(b,SinOsc.ar(55,0,Line.kr(1,0,2,1,0,2))))!2}.play;0.1.wait;}};\n```"}, {"role": "assistant", "content": "can anyone tell me what the loud click is, and how to control it?\r\n\r\ni kind of really like it, but it sounds scary, \r\n\r\nand the resulting waveform is bizarre, too.\r\n\r\n[http://soundcloud.com/tengototen/m-chtegern-ikeda](http://soundcloud.com/tengototen/m-chtegern-ikeda)\r\n\r\n\r\nupdate: some discussion, and lots of interesting things to try out, [on the list](http://new-supercollider-mailing-lists-foru."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Migration from the old SourceForge wiki."}, {"role": "assistant", "content": "```supercollider\n// Sing whatever pitch you like into the microphone, but have the output conform to the key you press on your connected MIDI keyboard, like a very low-rent Autotune.\n// by nonprivate April 2009\n// best used with headphones\n// execute one by one...\n\ns = Server.local.boot;\nb = 200; // no. of control bus to use for pitch control\n(\n SynthDef(\"straightenUp\",\n { |baseFreq = 100|\n \n var in, freq, hasFreq, out;\n in = Mix.new(SoundIn.ar([0,1]));\n # freq, hasFreq = Pitch.kr(in, ampThreshold: 0.02, median: 7);\n out = PitchShift.ar(in, 0.08, (baseFreq / freq), 0.0, 0.0);\n Out.ar(0,[out, out])\n }\n ).send(s);\n);\n\ns.sendMsg(\"/s_new\", \"straightenUp\", n = s.nextNodeID, 1, 0);\n\ns.sendMsg(\"/n_map\", n, \"baseFreq\", b);\n\n(\n c = NoteOnResponder(\n { |src,chan,note,vel|\n \n s.sendMsg(\"/c_set\", b, note.midicps);\n \n },\n nil, // any source\n nil, // any channel\n nil, // any note\n nil // any vel\n );\n \n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Play your (short) soundfiles with some delay."}, {"role": "assistant", "content": "```supercollider\n// By Bjørn Houdorf March 2013, Play your (short) soundfiles with some delay.\n\nb = SoundFile.collectIntoBuffers(\"yourSoundFileFolder/*\"); // 1. rund this\n\n( // 2. and then run this\nt = Task({\n({\n var num= b.size.rand;\n var buf= b[num];\n 0.1*Splay.ar(PlayBuf.ar(buf.numChannels, buf, 1, 1, 0, 0));\n}.play;\n) \n});\n);\n\n\n( // 3. Then run this\nz = Task({\nloop({\n t.start;\n 0.1.wait;\n});\n});\n);\n\n\nz.start; // 4. and run this\nz.stop; // 5. and finally run this\n```"}]} -{"conversations": [{"role": "user", "content": "What is `BufDelayN` in SuperCollider?"}, {"role": "assistant", "content": "BufDelayN — Buffer based simple delay line with no interpolation. Simple delay line with no interpolation which uses a buffer for its internal memory. See also BufDelayL which uses linear interpolation, and BufDelayC which uses cubic interpolation. Cubic interpolation is more computationally expensive than linear, but more accurate. Category: UGens > Delays > Buffer."}]} -{"conversations": [{"role": "user", "content": "What does `PopUpTreeMenu.openAction` do?"}, {"role": "assistant", "content": "Function that gets evaluated when the popup menu is clicked. Arguments passed in: `this, mouseX,"}]} -{"conversations": [{"role": "user", "content": "I get 'Message not understood' on a nil variable."}, {"role": "assistant", "content": "`~buffer` (or any variable) was never assigned, or it was assigned in a different environment. Environment variables are per-environment: a `~buf` set in one server-side file block is not visible in another. Check with `~buf.postln` before using it. The other common cause is an assignment that failed silently, e.g. `~buf = Buffer.read(...)` where the file was missing — the error is posted but ~buf stays nil."}]} -{"conversations": [{"role": "user", "content": "What does `AbstractSFP.relativeBeats2secs` do? What arguments does it take?"}, {"role": "assistant", "content": "base class for SoundFilePlayer classes Arguments: beats."}]} -{"conversations": [{"role": "user", "content": "What does `PathName.isFolder` do?"}, {"role": "assistant", "content": "returns a Boolean indicating whether or not the path represents a folder (not a file)."}]} -{"conversations": [{"role": "user", "content": "What does `PV_RectComb2.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Make gaps in spectrum. Arguments: bufferA — FFT buffer A.; bufferB — FFT buffer B.; numTeeth — Number of teeth in the comb.; phase — Starting phase of comb pulse.; width — Pulse width of the comb.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// examples for direct pattern usage:\nMKtlDesc.postLoadable\nn = MKtl(\\nk1, \"korg-nanokontrol\");\nx = n.elementsDict[\\play]; // the play button\n\n// test asStream method - simple endless lookup\np = Pbind(\\test, x).trace.play;\n// switch value while playing, pattern gets current value\nx.value = 1;\nx.value = 0;\n\np.stop;\n\n// test embedInStream method:\n(\np = Pbind(\n \\test, Pseq([x, 4, 7], 8),\n \\dur, 0.5\n).trace.play;\n;\n// change value while playing\nx.value = 1;\nx.value = 0;\n\np.stop;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// examples for direct pattern usage:\nMKtlDesc.postLoadable\nn = MKtl(\\nk1, \"korg-nanokontrol\");\nx = n.elementsDict[\\play]; // the play button\n\n// test asStream method - simple endless lookup\np = Pbind(\\test, x).trace.play;\n// switch value while playing, pattern gets current value\nx.value = 1;\nx.value = 0;\n\np.stop;\n\n// test embedInStream method:\n(\np = Pbind(\n \\test, Pseq([x, 4, 7], 8),\n \\dur, 0.5\n).trace.play;\n);\n// change value while playing\nx.value = 1;\nx.value = 0;\n\np.stop;\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for instant nostalgia with wow and flutter?"}, {"role": "assistant", "content": "```supercollider\n// read a soundfile\n(\ns.waitForBoot({\n\n SynthDef(\\wowflutter_2chan, {\n arg bufnum, out = 0, wobble_rpm=33, wobble_amp=0.05, wobble_exp=39, flutter_amp=0.03, flutter_fixedfreq=6, flutter_variationfreq=2;\n var signed_wobble = wobble_amp*(SinOsc.kr(wobble_rpm/60)**wobble_exp);\n var wow = Select.kr(signed_wobble > 0, signed_wobble, 0);\n var flutter = flutter_amp*SinOsc.kr(flutter_fixedfreq+LFNoise2.kr(flutter_variationfreq));\n var combined_defects = 1 + wow + flutter;\n var sig = PlayBuf.ar(2, bufnum, BufRateScale.kr(bufnum)*combined_defects, doneAction:Done.freeSelf);\n Out.ar(out, sig);\n }).add;\n\n b = Buffer.read(s, \"pianomusic.wav\"); // link in code description, or use your own...\n s.sync;\n\n Synth(\\wowflutter_2chan ,[\n \\bufnum, b.bufnum,\n \\out, 0,\n \\wobble_rpm, 33,\n \\wobble_amp, 0.04,\n \\wobble_exp, 11, // best an odd power, higher values produce sharper, smaller peak\n \\flutter_amp, 0.02,\n \\flutter_fixedfreq, 6,\n \\flutter_variationfreq, 2\n ]);\n});\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for delay effect with accelerating echoes?"}, {"role": "assistant", "content": "```supercollider\n~buf = Buffer.alloc(s, s.sampleRate * 5);\n\n(\n{\n var trig, freq;\n var dry, snd, phase, iois;\n var cumulDelay;\n var decayFactor, lpfCutoff, numEchoes, ioiScale, ioiDecayFactor;\n\n // play with these!\n decayFactor = 0.65;\n lpfCutoff = 500;\n numEchoes = 16;\n ioiScale = 0.4;\n ioiDecayFactor = 0.75;\n\n // example input -- you can substitute other stuff here\n trig = Dust.ar(1);\n dry = Pulse.ar(100 * TIRand.ar(1, 12, trig));\n dry = dry * Decay2.ar(trig, 0.01, 0.2);\n\n phase = DelTapWr.ar(~buf, dry);\n iois = Array.geom(numEchoes, ioiScale, ioiDecayFactor);\n cumulDelay = iois.sum;\n (cumulDelay > ~buf.duration).if {\n Error(\"use a larger buffer\").throw;\n };\n snd = Silent.ar;\n iois.reverse.do { |ioi|\n snd = (snd + DelTapRd.ar(~buf, phase, cumulDelay, interp: 4)) * decayFactor;\n // one-pole lowpass -- LPF was too aggressive\n snd = OnePole.ar(snd, lpfCutoff / SampleRate.ir);\n cumulDelay = cumulDelay - ioi;\n };\n snd = snd + dry;\n \n snd * 0.5!2;\n}.play;\n\n// contributors so far: Nathan Ho\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(// * //watch the postWindow\na=[\"m\",\"x\",\"f\",\"k\",\"d\",\"p\"];\nx=Array;\ny=x.newClear(6);\n~mxfkdp=Task({\n inf.do({y.put(x.series(6,0,1).choose,a.scramble).postln;\n 0.03.wait;})}).play;\nm=fork({inf.do({\n \"array num:\".postcln;\n if(y[x.series(6,0,1).choose.postcln]==a,\n {\"lo encontraste!/found it!\".postcln;\n 1.do({GVerb.ar(\n EnvGen.ar(Env.perc(0.01,8),1,doneAction:2)*\n Blip.ar(XLine.kr(440,1600,8)),50,10,0.02)}.play);\n ~mxfkdp.stop;\n m.stop;}, \n {\"buscando.../seeking...\".postcln;});\n 0.03.wait})});\n);\n//.SCtweetLong\n```"}, {"role": "assistant", "content": "this code throws a scrambled array of arrays seeking among them for the original array,\r\nIt only sounds when it founds it. (may take a while)\r\nthe idea started trying a SCtweet, but became with this funny code!."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `IdentityBag`."}, {"role": "assistant", "content": "```supercollider\nIdentityBag[1, 2, 3].add(4);\nIdentityBag[1, 2, 3].add(3);\nIdentityBag[\"abc\", \"def\", \"ghi\"].add(\"jkl\");\nIdentityBag[\"abc\", \"def\", \"ghi\"].add(\"def\");\n```"}]} -{"conversations": [{"role": "user", "content": "What does `KDRMaskTester.new` do? What arguments does it take?"}, {"role": "assistant", "content": "KeyCodeResponder utility for comparing modifier masks Arguments: requireMask; denyMask; function; description."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\smooth, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.linen(0.05, sustain, 0.1), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n)\n```"}, {"role": "assistant", "content": "plays an arpeggio on the \"left hand\" and an arpeggio on the \"right hand\"."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pdict`."}, {"role": "assistant", "content": "```supercollider\nSynthDescLib.read;\n\n(\ne = (\n a: Pbind(\\dur, 0.1, \\degree, Pseq([0, 5, 4, 3, 2])),\n b: Pbind(\\dur, 0.06, \\degree, Pseq([7, 8, 7, 8])),\n c: Pbind(\\dur, 0.3, \\degree, Pseq([0, 1, 2], 2))\n);\n\nx = Pdict(e, Pseq([\n \\a, \\b,\n Prand([\\a, \\c])\n ], 4)\n );\nx.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `Slew` in SuperCollider briefly."}, {"role": "assistant", "content": "Slew — Slew rate limiter. Limits the slope of an input signal. The slope is expressed in units per second. Category: UGens > Filters > Nonlinear."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Granular electromaton."}, {"role": "assistant", "content": "```supercollider\n(\nServer.local.waitForBoot({\n(\nz.free;\nz = Buffer.alloc(s, 512, 1);\nz.sine1(1.0 / [1, 2, 3, 4], true, true, true);\n\n fork( { loop {\n SynthDef(\"g1\",{ arg out=0,bufnum=0,dur=1,rate=1,pos=0,sdens=1,edens=1;\n var dens = Line.kr(sdens,edens,dur);\n var trig = [LFNoise0,SinOsc,Impulse,LFPulse,LFSaw].choose.ar(Line.kr(sdens,edens,dur));\n //var env = EnvGen.kr(Env.perc(0.0001.rrand(0.1),dur*0.5.rrand(2)),doneAction:2);\n var env = EnvGen.kr(Env.perc(0.0001.rrand(0.1),dur*(0.5.rrand(4))),doneAction:2);\n Out.ar(out,\n GrainBuf.ar(2,trig,1/dens,bufnum,rate,pos)*env;\n )\n }).add();\n [1,2,4,8,16,32].choose.postln.wait;\n }\n }\n );\n\n\na = Pbind(\\instrument,\\g1,\\dur,Pseq([Pseq([0.25],32),Pseq([0.25,0.125,0.125],32),Pseq([0.125],32)],inf),\\sdens,Pseq([9000,1000,500]/10,inf),\\edens,Prand([Pseq([9000,1000,500]/10,4),Pseq([1],1)],inf),\\rate,Pfunc({-10.0.rrand(10)}),\\pos,Pfunc({1.0.rand}),\\bufnum,z.bufnum);\nb = Pbind(\\instrument,\\g1,\\dur,Pseq([4],inf),\\sdens,Pseq([9000,1000,500]/100,inf),\\edens,Prand([Pseq([9000,1000,500]/10,1),Pseq([1],3)],inf),\\rate,Pfunc({-10.0.rrand(10)}),\\pos,Pfunc({-10.0.rrand(10)}),\\bufnum,z.bufnum);\nc = Pbind(\\instrument,\\g1,\\dur,Pseq([4/3],inf),\\sdens,Pseq([9000,1000,500,25],inf),\\edens,Prand([Pseq([9000,1000,500,25],1),Pseq([1],4)],inf),\\rate,Pfunc({-100.0.rrand(100)}),\\pos,Pfunc({-10.0.rrand(10)}),\\bufnum,z.bufnum);\n\n\na =a.play;\nb =b.play;\nc =c.play;\n\n)\n});\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `PatternProxy.envir` do?"}, {"role": "assistant", "content": "provide a default environment for the proxy. If given, it is used as an environment for the routine function. When set for the first time, the routine pattern is"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LFPulse`."}, {"role": "assistant", "content": "```supercollider\n{ LFPulse.ar(XLine.kr(1, 200, 10), 0, 0.2, 0.1) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SequenceableCollection.pairsDo` do?"}, {"role": "assistant", "content": "Calls function for each subsequent pair of elements in the SequentialCollection. The function is passed the two elements and an index. `[1, 2, 3, 4, 5].pairsDo({ |a, b| [a, b].postln"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\"help-InFeedback\", { |out = 0, in = 0|\n Out.ar(out,\n InFeedback.ar(in, 1)\n );\n}).add;\nSynthDef(\"help-SinOsc\", { |out = 0, freq = 440|\n Out.ar(out, SinOsc.ar(freq, 0, 0.1))\n}).add;\n);\n\nx = Bus.audio(s, 1);\n\n// read from bus n play to bus 0 (silent)\na = Synth(\"help-InFeedback\", [\\in, x.index, \\out, 0]);\n\n// now play a synth after this one, playing to bus x\nb = Synth.after(a, \"help-SinOsc\", [\\out, x.index]);\n\n// add another synth\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\"help-InFeedback\", { |out = 0, in = 0|\n Out.ar(out,\n InFeedback.ar(in, 1)\n );\n}).add;\nSynthDef(\"help-SinOsc\", { |out = 0, freq = 440|\n Out.ar(out, SinOsc.ar(freq, 0, 0.1))\n}).add;\n);\n\nx = Bus.audio(s, 1);\n\n// read from bus n play to bus 0 (silent)\na = Synth(\"help-InFeedback\", [\\in, x.index, \\out, 0]);\n\n// now play a synth after this one, playing to bus x\nb = Synth.after(a, \"help-SinOsc\", [\\out, x.index]);\n\n// add another synth before a which also writes to bus x\n// now you can't hear b, as its data is one cycle old, and is overwritten by c\nc = Synth.before(a, \"help-SinOsc\", [\\out, x.index, \\freq, 800]);\n\n// free c and you can hear b again\nc.free;\nx.free;\n\na.free; b.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does Splay.ar do?"}, {"role": "assistant", "content": "`Splay.ar(inArray, spread, level, center, levelComp)` takes an array of mono signals and distributes them across the stereo field, so `Splay.ar(SinOsc.ar([220, 330, 440]) * 0.1)` is a three-source stereo chord rather than three separate synths. spread (0..1) controls how far the voices fan out and center shifts the middle. It is the shorthand for 'make this array stereo'."}]} -{"conversations": [{"role": "user", "content": "What is `BinaryOpUGen`?"}, {"role": "assistant", "content": "BinaryOpUGen — Apply a binary operation to the values of an input UGen"}, {"role": "user", "content": "What does `BinaryOpUGen.new` do?"}, {"role": "assistant", "content": "return a new instance that applies the operator `selector` to the UGens `a` and `b` normally, this is implicitly called when applying an operator to a UGen."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na = WhiteNoise.ar; // a WhiteNoise\nb = a + 2; // a BinaryOpUGen.\nb.operator; // +\n\n// sound example\n(\n{\n var a = LFSaw.ar(300);\n var b = LFSaw.ar(329.1);\n a % b * 0.1\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Scheduler`."}, {"role": "assistant", "content": "```supercollider\n// scheduling tasks\n(\nx = Scheduler(TempoClock.default);\n\nTask {\n inf.do { |i|\n (\"next \" ++ i ++ \" in task.\" + Main.elapsedTime).postln;\n 0.5.wait;\n }\n}.play(x);\n);\n\nx.advance(0.1);\nx.seconds;\nx.advance(5);\nx.seconds;\n\n(\nRoutine {\n loop { x.advance(0.1); 0.1.wait };\n}.play;\n);\n\n(\nTask { 5.do {\n x.advance(1);\n 2.0.rand.wait;\n }\n}.play;\n);\n\nx.advance(8.1);\n\nPbind(\\degree, Pseries(0, 2, 8), \\dur, 0.25).play(x);\n\n(\nTask { 5.do {\n x.advance(0.20);\n 1.0.wait;\n }\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `MKtl.makeLookupName` do?"}, {"role": "assistant", "content": "make a lookupName for a device based on (typically) its protocol, id number and productName. `MKtl.makeLookupName(\\hid, 0, \"Run'N'Drive -"}]} -{"conversations": [{"role": "user", "content": "What does `DragSink.defaultCanReceiveDrag` do?"}, {"role": "assistant", "content": "A simple drag-and-drop receiver. Returns: Always True."}]} -{"conversations": [{"role": "user", "content": "What does `MxUnitApp.disconnect` do?"}, {"role": "assistant", "content": "Disconnect all inlets and outlets of this Returns: this"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for electric guitar (a SuperCollider snippet)?"}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\noisecomb2, { arg out, gate=1, pan=0, freq=300, amp=0.1, noiselevel=0.2,\n minfreq=100, decaytime=1, doneAction=2, ffreq=500, rq=0.3, spread=0.8;\n var sig, env;\n sig = WhiteNoise.ar(noiselevel);\n sig = sig + ClipNoise.ar(noiselevel);\n sig = sig + AllpassC.ar(sig, 1/minfreq, 1/freq, decaytime);\n sig = RLPF.ar(sig, ffreq * \\ffreqtab.kr(1!10), rq);\n env = EnvGen.kr(\\adsr.kr(Env.adsr(0.6,0.1,0.8,0.1)), gate, doneAction:doneAction);\n sig = sig * env;\n sig = Splay.ar(sig, spread, 1, pan);\n sig = sig * amp;\n Out.ar(out, sig);\n}).store;\n);\n\n(\nPdef(\\plopbla, Pbind(\n \\instrument, \\noisecomb2,\n \\note, Pseq([[0,7],[1,8],[-1,5]]-2,inf),\n //\\note, Pseq([0,1,2,3,4],inf)\n \\octave, Pstep(Pseq([3,4],inf),Pseq([5,0.75],inf)),\n \\minfreq, 50,\n \\decaytime, 1.0,\n \\adsr, Pseq([\n [Env.adsr(0.02,0.1,0.8,0.4,curve:0.5)],\n [Env.adsr(0.02,0.1,0.8,0.4,curve:0.5)],\n [Env.adsr(0.02,0.1,0.8,0.4,curve:0.5)],\n [Env.adsr(0.03,0.1,0.8,0.1,curve:0.5)],\n [Env.adsr(0.03,0.1,0.8,0.1,curve:0.5)],\n [Env.adsr(0.03,0.1,0.8,0.1,curve:0.5)],\n ],inf),\n \\legato, 1.0,\n //\\ffreq, [500,610,820,140],\n \\ffreq, 500,\n //\\ffreqtab, [[0.8,1,1.1,1.2, 2,4,5,6, 8,10].scramble.postln],\n //\\ffreqtab, Pfunc{ [[ 0.1, 0.2, 0.3, 0.5, 1,2,3,8, 10, 12 ].scramble] + rrand(0.01,1.0); },\n //\\ffreqtab, [ 6, 4, 5, 10, 1, 1.2, 0.8, 1.1, 2, 8 ], // also nice\n \\ffreqtab, [[ 6, 4, 5, 10, 1, 1.2, 0.8, 0.4, 2, 8 ]],\n \\dur, Pseq([3,1,1, 0.25,0.25,0.25],inf),\n \\amp, 1.1\n)).play;\n);\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Henon2DC.ar(SampleRate.ir/4, SampleRate.ir/2, MouseX.kr(1,1.4), MouseY.kr(0,0.3)) * 0.2 }.play(s);\n\n(\n{ Henon2DC.ar(\n 2200, 8800,\n LFNoise2.kr(1, 0.2, 1.2),\n LFNoise2.kr(1, 0.15, 0.15)\n) * 0.2 }.play(s);\n)\n\n{ SinOsc.ar(Henon2DC.ar(20, 40, MouseX.kr(1,1.4), MouseY.kr(0,0.3))*800+900)*0.4 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Henon2DC.ar(SampleRate.ir/4, SampleRate.ir/2, MouseX.kr(1,1.4), MouseY.kr(0,0.3)) * 0.2 }.play(s);\n\n(\n{ Henon2DC.ar(\n 2200, 8800,\n LFNoise2.kr(1, 0.2, 1.2),\n LFNoise2.kr(1, 0.15, 0.15)\n) * 0.2 }.play(s);\n)\n\n{ SinOsc.ar(Henon2DC.ar(20, 40, MouseX.kr(1,1.4), MouseY.kr(0,0.3))*800+900)*0.4 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BufDelayN`."}, {"role": "assistant", "content": "```supercollider\n// allocate buffer\nb = Buffer.alloc(s, 44100, 1);\n\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nBufDelayN.ar(b.bufnum, z, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\nb.free;\n\n\n// multichannel\n\n// two channels, two buffers\nb = Buffer.allocConsecutive(2, s, 32768, 1);\n\na = { |bufs = #[0, 1]|\n var sig = SinOsc.ar([440, 880]) * Decay2.kr(Impulse.kr([2, 4]), 0.01, 0.15);\n sig + BufDelayN.ar(bufs, sig, delaytime: 0.125)\n}.play(args: [bufs: b]);\n\na.free;\nb.do(_.free);\n```"}]} -{"conversations": [{"role": "user", "content": "What is the node tree and what is a Group for?"}, {"role": "assistant", "content": "Everything running on the server is a node: Synths and Groups, arranged in a tree under the root group. Order matters, because audio flows through buses from earlier to later nodes in the same branch. A Group is a container that lets you address many nodes at once, which is what you want for an effect chain — put the instruments in one group, the effect in another, and `freeAll` or a volume change hits the whole group instead of a list of node ids."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// note that the root pitch is not stored in the Scale (which should arguably be called a Mode for that reason)\n// instead you supply it at play time:\n\n// key of A\nPbind(\n \\degree, Pseq((0..7), inf), // your melody goes here\n \\scale, Scale.major, // your scale goes here\n \\root, -3 // semitones relative to 60.midicps, so this is A\n.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// note that the root pitch is not stored in the Scale (which should arguably be called a Mode for that reason)\n// instead you supply it at play time:\n\n// key of A\nPbind(\n \\degree, Pseq((0..7), inf), // your melody goes here\n \\scale, Scale.major, // your scale goes here\n \\root, -3 // semitones relative to 60.midicps, so this is A\n).play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Wobble, tremolo, whatever you want to call it."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"Triangular AM\", { arg freq = 440, modfreq = 5, amp = 0.5, attack = 0.01, release = 0.1, pos = 0, gate = 1;\n var carrier, modulator, env;\n modulator = SinOsc.kr(modfreq).range(0, 1); // provides amplitude modulation for wobble\n carrier = LFTri.ar(freq: freq, mul: modulator); // provides triangle wave for an interesting harmonic\n env = Env.asr(\n attackTime: attack,\n sustainLevel: amp,\n releaseTime: release).kr(doneAction: 2, gate: gate);\n carrier = carrier * env;\n Out.ar(0, Pan2.ar(carrier, pos))\n}).add;\n);\n\n(\n// Using these settings you can produce a pulsating wobble sound\n~wobble = Pbind(\n \\instrument, \"Triangular AM\",\n \\scale, Scale.aeolian,\n \\ctranspose, -12,\n \\degree, Pseq([\n [-7,-3, 0, 2, 4, 7],\n [-8, -4, -1, 1, 3, 6],\n [-9, -5, -2, 0, 2, 5],\n [-5, -1, 2, 4, 6, 9],\n [-4, 0, 3, 5, 7, 10],\n ], inf),\n \\dur, Pseq([Pn(4, 3), 2, 2], inf),\n \\amp, 0.4,\n \\modfreq, Pseq([Pn(6.5, 3), 2, 6.5], inf),\n \\attack, 2,\n \\release, 1.2,\n \\pos, [-1, -0.7, -0.2, 0.2, 0.7, 1],\n \\gate, 0,\n);\n);\n\n~wobble.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `StreamKrDurGui` in SuperCollider briefly."}, {"role": "assistant", "content": "StreamKrDurGui — gui class Category: Libraries > crucial > GuiClasses."}]} -{"conversations": [{"role": "user", "content": "What does `EnvirGui.zone` do?"}, {"role": "assistant", "content": "the composite view the envirgui makes for"}]} -{"conversations": [{"role": "user", "content": "Explain `OffsetCP1` in SuperCollider briefly."}, {"role": "assistant", "content": "OffsetCP1 — Manual breakbeat specification This cut procedure allows the user to specify the durations in a block and offset, one block at a time. Category: Libraries > BBCut > Cut procedures."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Migration from the old SourceForge wiki?"}, {"role": "assistant", "content": "```supercollider\np = ProxySpace.push(s.boot);\n\n~out.play(0,2);\n\n// taube eule und maus\n(\n~out = { \n var tr, e, eg, fm, maus;\n maus = MouseX.kr(0.1, 2);\n e = Env([0, 1, 0.4, 1, 0], [0.03, 0.2 * maus, 0.2, maus]);\n tr = Dust.kr(0.3);\n eg = EnvGen.kr(e, tr);\n fm = SinOsc.ar(30, 0, 0.2 * (1 - eg), 1);\n SinOsc.ar(100 * eg + 200 * fm) * 0.1 * eg\n};\n);\n\n// taube eulen und maus\n(\n~out = { \n var tr, e, eg, fm, maus;\n maus = MouseX.kr(0.1, 2);\n e = { Env([0, 1, 0.4, 1, 0], [0.03, 0.2.rand, 0.2, maus]) };\n tr = { Dust.kr(0.3) };\n eg = [\n EnvGen.kr(e.value, tr.value), \n EnvGen.kr(e.value, tr.value)\n ];\n fm = SinOsc.ar(30, 0, 0.2 * (1 - eg), 1);\n SinOsc.ar(100 * eg + 200 * [1, 1.15] * fm) * 0.1 * eg\n};\n);\n\n\n// eulenschlag und maus\n(\n~out = { \n var tr, e, eg, fm, maus, n, u;\n n = 6;\n maus = MouseX.kr(0.1, 2);\n e = { Env([0, 1, 0.4, 1, 0], [0.03, 0.2.rand, 0.2, maus]) };\n tr = { Dust.kr(0.1) };\n eg = (e ! n).collect { arg env; EnvGen.kr(env, tr.value) };\n fm = SinOsc.ar({ 30 + 2.0.rand2 } ! n, 0, 0.2 * (1 - eg), 1);\n u = SinOsc.ar(100 * eg + 200 * { rrand(0.9, 1.1) } ! n * fm) * 0.1 * eg;\n u.clump(2).sum\n};\n);\n\n/*\nauthors so far:\njrh\n*/\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// A beautiful sc140 tweet by Batuhan Bozkurt, parametrized for real-time changes\n(\n// Start sound here\na = { | rateL = 5, rateR = 6, blipMul = 100, blipAdd = 50, fMul = 50, kMul = 1 |\n f = LocalIn.ar(2).tanh;\n k = Latch.kr(f[0].abs,Impulse.kr(1/4)) * kMul;\n LocalOut.ar(\n f +\n CombC.ar(Blip.ar([rateL, rateR], blipMul * k + blipAdd, 0.9), 1, k*0.3, fMul * f));f\n}.play\n);\n\n// Set parameters for changing sound here: \n\na.set(\\rateL, 10);\n\na.set(\\rateR, 8);\n\na.set(\\blipMul, 25);\n\na.set(\\blipAdd, 70);\n\na.set(\\fMul, 30);\n\n\na.set(\\kMul, 0.01);\n```"}, {"role": "assistant", "content": "A beautiful sc140 tweet by Batuhan Bozkurt, parametrized for real-time changes. To do: Add gui widgets for easier interactive control."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\ns.boot;\n\n(\nvar winenv;\n// a custom envelope\nwinenv = Env([0, 1, 0], [0.5, 0.5], [8, -8]);\nz = Buffer.sendCollection(s, winenv.discretize, 1);\n\nSynthDef(\\fm_grain_test, { |out, gate = 1, amp = 1, envbuf|\n var pan, env, freqdev;\n // use mouse x to control panning\n pan = MouseX.kr(-1, 1);\n // use WhiteNoise and mouse y to control deviation from center pitch\n freqdev = WhiteNoise.kr(MouseY.kr(0, 400));\n env = EnvGen.kr(\n Env([0,\n// …\n```"}, {"role": "assistant", "content": "use mouse x to control panning use WhiteNoise and mouse y to control deviation from center pitch (GrainFM: Granular synthesis with frequency modulated sine tones)"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Archive`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// make a storage place for various objects:\nq = (); // Event\n\nq[\\a_long_array] = Array.rand(128, 0.0, 1.0);\nq[\\pi_squared] = pi * pi;\nq[\\favourite_sound] = { { SinOsc.ar([300, 330]).sum * LFPulse.kr(2 + [0, 0.01]) * 0.1 }.play };\nq[\\same_long_array] = q[\\a_long_array]; // same objects may appear several times\n\nArchive.global.put(\\myData, q);\n\n\nArchive.global.at(\\myData).postcs;\n\n// after a recompile:\ns.boot;\n\nq = Archive.global.at(\\myData);\nq.postcs;\nq[\\favourite_sound].value;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Pmul`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, gate = 1|\n var env;\n env = EnvGen.kr(Env.asr(0.001, 1, 0.2), gate, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain, \\freq, 440);\nb = Pmul(\\freq, Pseq([1, 2, 3, 4, 5, 6, 7], inf), a);\nb.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `CoinGate`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\na = SynthDef(\"help-TCoin\", { |out = 0, prob = 0.5|\n var trig;\n trig = CoinGate.kr(prob, Impulse.kr(10));\n Out.ar(out,\n SinOsc.ar(\n TRand.kr(300.0, 400.0, trig), 0, 0.2\n )\n )\n}).play;\n);\n\na.set(\\prob, 1.0);\na.set(\\prob, 0.0);\na.set(\\prob, 0.1);\n\n\n(\na = SynthDef(\"help-TCoin\", { |out = 0, prob = 0.5|\n var trig;\n trig = Impulse.ar(20, 0, SinOsc.kr(0.5, 0, 1, 1));\n Out.ar(out,\n Mix.fill(3, { Ringz.ar(CoinGate.ar(prob, trig*0.5), #[1, 1.5]*Rand(1000, 9000), 0.01) })\n )\n}).play;\n);\n\na.set(\\prob, 1.0);\na.set(\\prob, 0.0);\na.set(\\prob, 0.1);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `NamedControl`."}, {"role": "assistant", "content": "```supercollider\n// use NamedControl to create a number of multichannel controls:\n\na = { SinOsc.ar(NamedControl.kr(\\freq, [300, 330, 370], [1, 0.3, 0.02])).sum * 0.1 }.play;\na.setn(\\freq, [700, 705, 890]);\na.setn(\\freq, [0, 2, 5].midiratio * 400);\n\n// synonymous:\na = { SinOsc.ar(\\freq.kr([300, 330, 370], [1, 0.3, 0.02])).sum * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `FoaMagIa` in SuperCollider?"}, {"role": "assistant", "content": "FoaMagIa — First Order Ambisonic (FOA) Magnitude of Soundfield Active Intensity Vector Return the Magnitude of Active Intensity Vector, ||Ia||, of a first order ambisonic (B-format) signal. Category: Libraries > Ambisonic Toolkit > UGens > FOA > Analyzer, UGens > Multichannel > Ambisonics, UGens > Analysis > Ambisonics."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for gabber kick (a SuperCollider snippet) that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\gabberkick, {\n var snd;\n snd = SinOsc.ar(Env([1000, 69, 60], [0.015, 0.1], \\exp).ar * [-0.1, 0, 0.1].midiratio);\n snd = Mix(snd);\n snd = (snd * 10).tanh;\n snd = (snd * 5.1).atan;\n snd = BPeakEQ.ar(snd, XLine.kr(2000, 100, 0.3), 2.0, 8);\n snd = snd + DelayC.ar(snd, 0.01, SinOsc.ar(4).range(0.0, 0.001));\n snd = RLPF.ar(snd, 8000, 0.7);\n snd = snd * Env([0, 1, 0.7, 0.7, 0], [0.001, 0.01, 0.3, 0.02]).ar(2);\n snd = (snd * 0.6).clip(-1, 1);\n Out.ar(\\out.kr(0), Pan2.ar(snd, \\pan.kr(0), \\amp.kr(0.1)));\n}).add;\n);\n\nSynth(\\gabberkick, [amp: 0.6])\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n‎{h={|f|1-LFTri.ar(f)};l={|s,e|Line.ar(s,e,1200,1,0,2)};FreeVerb.ar(h.(l.(147,5147))*h.(l.(1117,17))*h.(100)*h.([55,55.1])*0.05,0.7,1)}.play\n\n//Explanation of this piece - http://schemawound.com/post/40100438722/11-13-2012-tweet-explained\n```"}, {"role": "assistant", "content": "Explanation of this piece - http://schemawound.com/post/40100438722/11-13-2012-tweet-explained."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Using sine waves to generate a saw waveform. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\nq={|f,e|a=Array.fill(e,{|j|e-j}).reverse;(Mix.ar(a.collect{|x|SinOsc.ar(f*x,0,1/x)})/2)!2};{q.(60,300)}.play //saw from sine #supercollider\n\n//Change the values passed to q to control the frequency and how many sines are used.\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// randomly modulate params\n(\n{ LinCongN.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(0.1, 0.5, 1.4),\n LFNoise2.kr(0.1, 0.1, 0.1),\n LFNoise2.kr(0.1)\n) * 0.2 }.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// randomly modulate params\n(\n{ LinCongN.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(0.1, 0.5, 1.4),\n LFNoise2.kr(0.1, 0.1, 0.1),\n LFNoise2.kr(0.1)\n) * 0.2 }.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "How do I use a metronome or check my timing?"}, {"role": "assistant", "content": "A click on the clock you are using, plus a counter to see where you are in the bar:\n\n```supercollider\n(\nTdef(\\click, {\n var count = 0;\n loop {\n (Synth(\\hat, [\\amp, if (count % 4 == 0) { 0.25 } { 0.08 }]));\n count = count + 1;\n 1.wait;\n }\n}).play;\n)\n```\n\nBecause it waits on `TempoClock.default`, it stays in sync with every Pbind you start, which makes it a\ntempo reference rather than a separate sound."}]} +{"conversations": [{"role": "user", "content": "What does `WebView.onJavaScriptMsg` do?"}, {"role": "assistant", "content": "Sets the object to be evaluated when a javascript console message is"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `SharedOut` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\n// only works with the internal server\ns = Server.internal;\ns.boot;\n);\n\n(\nSynthDef(\"help-SharedOut\", {\n SharedOut.kr(0, SinOsc.kr(0.2));\n}).add;\n);\n\n(\ns.sendMsg(\\s_new, \"help-SharedOut\", x = s.nextNodeID, 0, 1);\ns.sendMsg(\\n_trace, x);\n\n// poll the shared control bus\nRoutine({\n 30.do({\n s.getSharedControl(0).postln;\n 0.2.wait;\n });\n}).play;\n);\n\n\ns.quit;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// record a buffer\nb = { Blip.ar(XLine.kr(10000, 4, 3) * [1, 1.2], 20) * 0.1 }.asBuffer(3, fadeTime: 0.1)\nb.plot; // after 3 seconds, you can see it.\n// play the soundfile back\n{ PlayBuf.ar(b.numChannels, b, LFNoise2.kr(2 ! 8).exprange(0.15, 1), loop: 1.sum }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// record a buffer\nb = { Blip.ar(XLine.kr(10000, 4, 3) * [1, 1.2], 20) * 0.1 }.asBuffer(3, fadeTime: 0.1)\nb.plot; // after 3 seconds, you can see it.\n// play the soundfile back\n{ PlayBuf.ar(b.numChannels, b, LFNoise2.kr(2 ! 8).exprange(0.15, 1), loop: 1).sum }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `UScore.stop` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: releaseTime — (describe argument here); changed — (describe argument here). Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "What does `SimpleNumber.betaFullC` do?"}, {"role": "assistant", "content": "Returns the full (non-normalised) complement of the incomplete beta function of `a`, `b` and `x`. Require 0 <= `x` <= 1, and `a,b` >"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Convolution2L`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// one last example\n(\nb = Buffer.alloc(s, 512, 1);\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, true, true);\n);\n\n(\n{\n var input = SoundIn.ar(0);\n var framesize = 512;\n Convolution2L.ar(input, b, 0, framesize, 1, 0.5);\n}.play\n);\n\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `PV_ChainUGen`?"}, {"role": "assistant", "content": "PV_ChainUGen — Base class for UGens that operate on FFT chains"}, {"role": "user", "content": "What does `PV_ChainUGen.fftSize` do?"}, {"role": "assistant", "content": "Returns the FFT chain buffer's size. `(`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var chain = FFT(LocalBuf(1024));\n chain.fftSize.poll;\n 0.0\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ var sig = SinOsc.ar(440) * 0.2; Out.ar(0, sig) }.play;\n```"}, {"role": "assistant", "content": "The minimal SynthDef idiom: a source multiplied by an amplitude, written to the master bus.\n\n`var sig = SinOsc.ar(440) * 0.2` builds the signal; `Out.ar(0, sig)` is the only mandatory part, because a\nUGen graph that never reaches an output produces no sound. `Out`'s first argument is the bus number — 0 is\nthe main stereo output — and the second is the signal. The function's return value does not matter here,\nwhich is why the `Out.ar` can sit on its own line. `.play` compiles this into an anonymous SynthDef and\nstarts one instance."}]} +{"conversations": [{"role": "user", "content": "In what order should I learn SuperCollider?"}, {"role": "assistant", "content": "The order that pays off fastest:\n\n1. **One UGen and Out** — `{ SinOsc.ar(440) * 0.2 }.play`. Learn that a graph must reach Out.\n2. **Envelopes and doneAction** — the difference between a sound and a click.\n3. **SynthDef and Synth** — naming a graph, controlling it with arguments, freeing it with a gate.\n4. **Patterns** — `Pbind` for sequence, so you stop writing loops by hand.\n5. **Buses and effects** — chaining, sends, groups.\n6. **JITLib** — Ndef for patches you modify while they play.\n\nVocabulary to carry: UGen, SynthDef, Synth, bus, group, envelope, gate, doneAction, Pattern, clock. Every\nconfusion in SuperCollider tends to be one of those words."}]} +{"conversations": [{"role": "user", "content": "What does `EZKnob.setColors` do? What arguments does it take?"}, {"role": "assistant", "content": "Wrapper class for label, knob, number box Arguments: stringBackground — An instance of Color. The `background` of the label and unit views.; stringColor — An instance of Color. The `stringColor` of the label and unit views.; numBackground — An instance of Color. The `numColor` of the number view.; numStringColor — An instance of Color. The `stringColor` of the number view.; numNormalColor — An instance of Color. The `normalColor` of the number view.; numTypingColor — An instance of Color. The `typingColor` of the number view.; knobColors — An instance of Color. The `knobColors` of the knob view.; background — An instance of Color. The `background` of the enclosing view.."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Using sine waves to generate a saw waveform. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\nq={|f,e|a=Array.fill(e,{|j|e-j}).reverse;(Mix.ar(a.collect{|x|SinOsc.ar(f*x,0,1/x)})/2)!2};{q.(60,300)}.play //saw from sine #supercollider\n\n//Change the values passed to q to control the frequency and how many sines are used.\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for nothing much ). Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n{|atk=0.05,dur=10,freq=50,amp=0.8|\n PMOsc.ar(\n Line.kr(1,2,dur,freq),\n LFNoise2.kr([1,2]).range(1,2)*freq,\n LFNoise2.kr([2,1]).range(0.1,3.5),\n 0,\n Decay2.ar(\n Impulse.ar(XLine.kr(1, 25, dur)) * SinOsc.ar(4/dur,[0,pi/2],0.05,1),\n 0.023, XLine.ar(1,35,dur).reciprocal,\n Line.ar(1,0.8,dur) * LFNoise2.kr(4/dur,0.05,1).dup\n ) * EnvGen.ar(Env([0,1,1,0],[atk,dur-atk,0.3]),1,amp, doneAction:2)\n )\n // * LFPulse.ar(XLine.kr(5,20,dur,freq * LFNoise2.kr([1,2]).range(0.95,1.05)))\n}.play(args:[\n freq:50.rrand(350).debug('freq'),\n dur:10.rrand(20).debug('dur')\n])\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n var time = 30;\n var line = Line.kr(3000, 290, time);\n var line2 = Line.kr(280, 290, time);\n var line3 = Line.kr(0.01, 10, time);\n var sin = Mix.ar(SinOsc.ar([line, line2]) * SinOsc.ar(line3));\n var comb = CombC.ar(sin, time, SinOsc.kr(0.1).range(0.1, 0.2), time);\n var env = EnvGen.ar(Env.linen(0.01, time, 10), 1, doneAction:2);\n comb * env * 0.05!2;\n}.play\n)\n```"}, {"role": "assistant", "content": "Here is some quick code that sounds like an old sci-fi UFO landing."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `GrayNoise`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-GrayNoise\", { |out = 0|\n Out.ar(out,\n GrayNoise.ar(-20.dbamp)\n )\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `UGen.lag2` do?"}, {"role": "assistant", "content": "Wraps the receiver in a Lag2 UGen, smoothing its output by `t1` seconds lagtime. If a second argument is given, it wraps it in a Lag2UD"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `QuadN`."}, {"role": "assistant", "content": "```supercollider\n// logistic map\n// equation: x1 = -r*x0^2 + r*x0\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n QuadN.ar(SampleRate.ir/4, r.neg, r, 0, 0.1) * 0.4;\n}.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for seasonal reflections ) that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n(\nfork { loop { \n Ndef(\\winter_curves, {\n var bands = 5.rrand(15) * 2;\n var freqs = Array.exprand(bands.debug('bands'), 20, 18000);\n Pan2.ar(\n SinOsc.ar(\n freqs, \n Array.rand(bands, 0, pi),\n AmpCompA.kr(freqs, freqs.sort.first)\n ).perform(0.5.coin.if(\\tanh,\\value).debug('kind')),\n FSinOsc.kr(\n Array.exprand(bands, 0.01, 15),\n Array.rand(bands, 0, pi),\n ),\n bands.reciprocal\n * LFGauss.kr(SinOsc.kr(Array.rand(bands, 0.05, 0.1)).range(1,10), 0.3)\n * FSinOsc.kr(\n Array.exprand(bands, 0.1, 15),\n 0.3\n ).range(0,1)\n ).sum\n * SelectX.kr(\n FSinOsc.kr(Array.exprand(bands, 0.1, 15)).range(0,1),\n [\n EnvGen.kr(\n Env.perc(\n FSinOsc.kr(1/16).range(0.01,0.1),\n FSinOsc.kr(1/8).range(0.25,0.3)\n ).blend(\n Env.sine( // 1/4\n FSinOsc.kr(Array.exprand(bands, 0.1, 15)).range(0.05,2)\n ).blend(\n Env.sine(1/4),\n FSinOsc.kr(Array.exprand(bands, 0.1, 15)).range(0.05,2).mean\n ),\n FSinOsc.kr(Array.exprand(bands, 0.1, 15)).range(0,1)\n ).circle,\n 1, 0.8, \n FSinOsc.kr(freqs.linlin(20,18000,0.1,20)).range(0, 0.2).mean\n ),\n 1\n ]\n ).clump(2).mean\n }).fadeTime_(0.5.rrand(2.5)).play;\n 8.rrand(30).debug('len').wait;\n} }\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `Option` in SuperCollider briefly."}, {"role": "assistant", "content": "Option — Represents optional values. In programming languages (especially functional programming languages) an option type is a polymorphic type that represents encapsulation of an optional value; e.g. it is used as the return type of functions which may or may not return a meaningful value when they're applied. It consists of either an empty constructor (called None()), or a constructor encapsulating the original data type A (writte Category: FP."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nm = SimpleMIDIFile.read( \"~/Téléchargements/Super Mario Bros 2 - Mario Dreams.mid\" ); \n(\n TempoClock.default.tempo = m.tempo/60;\n Pdef(\\bla, \n Pbind(\n \\instrument, \\default,\n [\\midinote, \\dur, \\sustain, \\amp], Prout({ arg ev;\n var timescale = 1/16/60;\n var prevev;\n m.noteSustainEvents.collect({ arg item, idx;\n // [track, absTime, \\noteOn, channel, note, velo, dur, upVelo]\n if(idx == 0) {\n prevev = [item[4], item[1], item[6] * timescale, item[5]/127]\n } {\n prevev[1] = item[1] - prevev[1] * timescale;\n ev = prevev.yield;\n prevev = [item[4], item[1], item[6] * timescale, item[5]/127];\n };\n });\n prevev[1] = prevev[2];\n ev = prevev.yield;\n }),\n )\n ).play\n)\n```"}, {"role": "assistant", "content": "There is the .p method (see http://sccode.org/1-5aT) but here is also a way to retrieve the values directly."}]} +{"conversations": [{"role": "user", "content": "What does doneAction do?"}, {"role": "assistant", "content": "It tells the server what to do to the enclosing Synth when the UGen finishes. The one that matters most is `doneAction: 2`, which frees the Synth: that is how a percussive sound cleans itself up instead of leaking silent nodes. `doneAction: 0` does nothing, so the Synth keeps running. EnvGen, Line, XLine, LinePan and friends all accept it, which is why `EnvGen.kr(Env.perc(0.01, 1), doneAction: 2)` is the standard envelope idiom."}]} +{"conversations": [{"role": "user", "content": "What are the arguments of EnvGen?"}, {"role": "assistant", "content": "`EnvGen.ar(envelope, gate, levelScale, levelBias, timeScale, doneAction)` — or the .kr form. Envelope is an Env; gate is the signal that holds the envelope open (a number for a one-shot, a trigger or gate control for a sustained sound); levelScale and levelBias scale and offset the output; timeScale stretches durations. Use `doneAction: 2` on a one-shot so the Synth frees itself."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\nz = { // toy with boost/cut\nBPeakEQ.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(20, 20000, \\exponential),\n 0.8, // rq\n MouseY.kr(12.0, -12.0, \\linear),\n 0.5); // mul\n}.play)\nz.release;\n\n(\nz = { // toy with rq\nBPeakEQ.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(20, 20000, \\exponential),\n MouseY.kr(10, 0.4, \\linear), // rq\n 6, // boost/cut - +6dB\n 0.5); // mul\n}.play\nz.release;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\nz = { // toy with boost/cut\nBPeakEQ.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(20, 20000, \\exponential),\n 0.8, // rq\n MouseY.kr(12.0, -12.0, \\linear),\n 0.5); // mul\n}.play)\nz.release;\n\n(\nz = { // toy with rq\nBPeakEQ.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(20, 20000, \\exponential),\n MouseY.kr(10, 0.4, \\linear), // rq\n 6, // boost/cut - +6dB\n 0.5); // mul\n}.play)\nz.release;\n```"}]} +{"conversations": [{"role": "user", "content": "What is the difference between Line and XLine?"}, {"role": "assistant", "content": "Both are ramps: `Line.kr(start, end, dur, mul, add, doneAction)` moves linearly, `XLine.kr(...)` moves exponentially in a fixed ratio per unit time. Use Line for amplitude and XLine for frequency or any parameter you hear logarithmically — a linear frequency sweep sounds like it rushes at the top and crawls at the bottom. Both take doneAction, so both can end a Synth."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Node`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n(\nx = SynthDef(\"help-node-set\", { |freq = 440, out = 0|\n Out.ar(out, SinOsc.ar(freq, 0, 0.1))\n}).play\n);\nx.set(\\freq, 880, \\out, 1); // two pairs\nx.set(0, 660, 1, 0); // freq is the first argument, so it's index is 0. out is index 1.\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `GbmanL`."}, {"role": "assistant", "content": "```supercollider\n// default initial params\n{ GbmanL.ar(MouseX.kr(20, SampleRate.ir)) * 0.1 }.play(s);\n\n// different initial params\n{ GbmanL.ar(MouseX.kr(20, SampleRate.ir), -0.7, -2.7) * 0.1 }.play(s);\n\n// wait for it...\n{ GbmanL.ar(MouseX.kr(20, SampleRate.ir), 1.2, 2.0002) * 0.1 }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(GbmanL.ar(40)*400+500)*0.4 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "How do I make a piece reproducible instead of a different take every time?"}, {"role": "assistant", "content": "Three things make a SuperCollider piece repeatable: a fixed seed, a fixed tempo, and no live input.\n\n```supercollider\n(\nthisThread.randSeed = 1234;\nTempoClock.default.tempo = 2;\nPbind(\\degree, Pwhite(0, 7, inf), \\dur, 0.25).play;\n)\n```\n\n`thisThread.randSeed` fixes the random sequence of the current thread, so `Pwhite`, `Prand` and friends give\nthe same values again. Recording with `s.record(path, duration: 30)` then makes the take an artifact rather\nthan a performance. Input from `MouseX` or a MIDI controller is the usual remaining source of difference."}]} +{"conversations": [{"role": "user", "content": "What does `JITGui.calcBounds` do?"}, {"role": "assistant", "content": "how to calculate the bounds for the zone in which to"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\ns.scope;\na = { HilbertFIR.ar(SinOsc.ar(100) * -20.dbamp, LocalBuf(2048) }.play;\na.release;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\ns.scope;\na = { HilbertFIR.ar(SinOsc.ar(100) * -20.dbamp, LocalBuf(2048)) }.play;\na.release;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `PV_MagBelow.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Pass bins below a threshold. Arguments: buffer — FFT buffer.; threshold — Magnitude threshold.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nd = { |gate = 1| { BrownNoise.ar }.dup * EnvGen.kr(Env.asr, gate, doneAction: Done.freeSelf) }.play;\nd.release(3;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nd = { |gate = 1| { BrownNoise.ar }.dup * EnvGen.kr(Env.asr, gate, doneAction: Done.freeSelf) }.play;\nd.release(3);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SharedIn`."}, {"role": "assistant", "content": "```supercollider\n(\n// only works with the internal server\ns = Server.internal;\ns.boot;\n);\n\n(\nSynthDef(\"help-SharedIn1\", {\n Out.ar(0, SinOsc.ar(Lag.kr(SharedIn.kr(0, 1), 0.01), 0, 0.2));\n}).add;\nSynthDef(\"help-SharedIn2\", {\n Out.ar(1, SinOsc.ar(Lag.kr(SharedIn.kr(0, 1), 0.01, 1.5), 0, 0.2));\n}).add;\n);\n\n(\ns.setSharedControl(0, 300); // an initial value\ns.sendMsg(\\s_new, \"help-SharedIn1\", x = s.nextNodeID, 0, 1);\ns.sendMsg(\\s_new, \"help-SharedIn2\", y = s.nextNodeID, 0, 1);\n\nRoutine({\n 30.do({\n s.setSharedControl(0, 300 * (10.rand + 1));\n 0.2.wait;\n });\n s.sendMsg(\\n_free, x);\n s.sendMsg(\\n_free, y);\n}).play;\n);\n\n\ns.quit;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `SoundIn` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\nu = Server(\\scau, NetAddr(\"127.0.0.1\", 9989)); // Change the port from 9989 to the right one for you\nu.serverRunning = true;\nu.ping(10); // Gives about 0.02 for me - confirms that communication is working\n// Now let's create a quick ring-modulator effect:\nz = { SoundIn.ar([0,1]) * SinOsc.ar(MouseX.kr(100, 1000)) }.play(u);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Function.scope` do? What arguments does it take?"}, {"role": "assistant", "content": "As play above, and calls Server-scope to open a scope window in which to view the output. `{ FSinOsc.ar(440, 0, 0.3) Arguments: numChannels — The number of channels to display in the scope window, starting from outbus. It automatically reflects the number of channels.; outbus — The output bus to play the audio out on. This is equivalent to Out.ar(outbus, theoutput). The default is 0.; fadeTime — A fadein time. The default is 0.05 seconds, which is just enough to avoid a click.; bufsize — The size of the buffer for the ScopeView. The default is 4096.; zoom — A zoom value for the scope's X axis. Larger values show more. The default is 1.; bounds — The bounds of the `Window` in which the scope is embedded. A Rect specifying position and size of the window. The size does not include the border and title bar. Position is measured from the bottom-left corner of the screen (this is different than View#-bounds). The default is nil and the scope win."}]} +{"conversations": [{"role": "user", "content": "What is `List`?"}, {"role": "assistant", "content": "List — list of items of variable size"}, {"role": "user", "content": "What does `List.new` do?"}, {"role": "assistant", "content": "Creates a List with the initial capacity given by size."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// Create a new empty collections with size 3:\nx = Array.new(3);\ny = Array.new(3);\nz = List.new(3);\n\n// Try to add 7 items to the array and list.\n// If the array exceeds maxSize, it will only\n// grow to an internally specified max size.\n(\n7.do { |i|\n x.add(i);\n y = y.add(i); // reassign array y on each add\n z.add(i);\n};\n);\n\n// Attempt to access the 5th item:\nx.at(4); // -> nil (out of bounds)\ny.at(4); // -> 4\nz.at(4); // -> 4\n\n// x grew only to size 4\nx.postln; // -> [ 0, 1, 2, 3 ]\ny.postln; // -> [ 0, 1, 2, 3, 4, 5, 6 ]\nz.postln; // -> List[ 0, 1, 2, 3, 4, 5, 6 ]\n```"}]} +{"conversations": [{"role": "user", "content": "What is `BHiPass` in SuperCollider?"}, {"role": "assistant", "content": "BHiPass — 12db/oct rolloff - 2nd order resonant Hi Pass Filter The B equalization suite is based on the Second Order Section (SOS) biquad UGen. Category: UGens > Filters > BEQSuite."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Recorder`."}, {"role": "assistant", "content": "```supercollider\nr = Recorder(s);\n{ GVerb.ar(Dust.ar(4)) }.play; // play on bus 64\nr.record(numChannels: 2);\nr.stopRecording;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `FoaXformerMatrix.newFocusZ` do? What arguments does it take?"}, {"role": "assistant", "content": "Apply focus along the Arguments: angle — The distortion angle, in radians. -pi/2 to pi/2."}]} +{"conversations": [{"role": "user", "content": "What is `Dictionary`?"}, {"role": "assistant", "content": "Dictionary — associative collection mapping keys to values"}, {"role": "user", "content": "What does `Dictionary.new` do?"}, {"role": "assistant", "content": "Creates a Dictionary with an initial capacity for n key value mappings."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nd = Dictionary.new;\nd.add(\\monkey -> 0).postln;\nd.add(\\robot -> 1).postln; // Add robot as a key with a value of 1\nd.add(\\monkey -> 2).postln; // Replaces the value for the key monkey with 2\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a closed hi-hat in SuperCollider."}, {"role": "assistant", "content": "High-passed noise with a very short envelope — the filter is what makes it a hat rather than a hiss.\n\n```supercollider\n(\nSynthDef(\\hat, { |out = 0, amp = 0.3, dur = 0.06|\n var env = EnvGen.kr(Env.perc(0.001, dur, 1, -6), doneAction: 2);\n Out.ar(out, Pan2.ar(HPF.ar(WhiteNoise.ar, 7000) * env * amp));\n}).add;\n);\nSynth(\\hat, [\\dur, 0.04]);\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Pproto` in SuperCollider?"}, {"role": "assistant", "content": "Pproto — provide a proto event for an event stream Pproto uses the makeFunction to allocate resources (buffers, buses, groups) and create a protoEvent that makes those resources available to a pattern. It is fully compatible with non-realtime synthesis using render. Category: Streams-Patterns-Events > Patterns > Server Control."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code:\n```supercollider\n{ SinOsc.ar(440) * EnvGen.kr(Env.perc(0.01, 1), doneAction: 2) }.play;\n```"}, {"role": "assistant", "content": "It plays a 440 Hz sine with a percussive envelope, and the Synth frees itself when the envelope\nends.\n\n- `SinOsc.ar(440)` is an audio-rate sine at 440 Hz.\n- `Env.perc(0.01, 1)` is a 10 ms attack to full level then a 1 s decay to zero.\n- `EnvGen.kr(...)` plays that envelope at control rate and multiplies the sine, so the sound fades out.\n- `doneAction: 2` frees the Synth at the end of the envelope, so it does not accumulate silent nodes.\n- `.play` on the function builds an anonymous SynthDef and starts one Synth of it."}]} +{"conversations": [{"role": "user", "content": "What does `BusPool.alloc` do? What arguments does it take?"}, {"role": "assistant", "content": "bus allocator with retain/release counting for shared busses Arguments: rate; server; numChannels; client; name."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Out`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-out\", { |out = 0, freq = 440|\n var source;\n source = SinOsc.ar(freq, 0, 0.1);\n\n // write to the bus, adding to previous contents\n Out.ar(out, source);\n\n}).add;\n);\n\n\nSynth(\"help-out\", [\\freq, 500]);\nSynth(\"help-out\", [\\freq, 600]);\nSynth(\"help-out\", [\\freq, 700]);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ LFPulse.kr(XLine.kr(1, 200, 10), 0, 0.2) * SinOsc.ar(440 * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ LFPulse.kr(XLine.kr(1, 200, 10), 0, 0.2) * SinOsc.ar(440) * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{Disintegrator.ar(SinOsc.ar([400, 404], 0, 0.2), MouseX.kr(0, 1), MouseY.kr(0, 1))}.play\n\n{Disintegrator.ar(SoundIn.ar, MouseX.kr(0, 44100), MouseY.kr(0, 1)}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{Disintegrator.ar(SinOsc.ar([400, 404], 0, 0.2), MouseX.kr(0, 1), MouseY.kr(0, 1))}.play\n\n{Disintegrator.ar(SoundIn.ar, MouseX.kr(0, 44100), MouseY.kr(0, 1))}.play\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PeakFollower`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n// no decay\n(\n{\n SinOsc.ar(\n PeakFollower.ar(Dust.ar(20, Line.kr(0, 1, 4)), 1.0) * 1500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// a little decay\n(\n{\n SinOsc.ar(\n PeakFollower.ar(Dust.ar(20, Line.kr(0, 1, 4)), 0.999) * 1500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// mouse x controls decay, center of the\n(\n{\n var decay;\n decay = MouseX.kr(0.99, 1.00001).min(1.0);\n SinOsc.ar(\n PeakFollower.ar(Dust.ar(20), decay) * 1500 + 200,\n 0, 0.2\n );\n\n}.play;\n);\n\n\n\n\n// follow a sine lfo, decay controlled by mouse x\n(\n{\n var decay;\n decay = MouseX.kr(0, 1.1).min(1.0);\n SinOsc.ar(\n PeakFollower.kr(SinOsc.kr(0.2), decay) * 200 + 500,\n 0, 0.2\n )\n\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `LocalIn.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Define and read from buses local to a synth. Arguments: numChannels — The number of channels (i.e. adjacent buses) to read in. You cannot modulate this number by assigning it to an argument in a SynthDef.; default — The initial value written to the bus once, so that it can be used before overwriting it with LocalOut. An array can be passed in to specify different values for each channel.."}]} +{"conversations": [{"role": "user", "content": "What does `EventSource.do` do? What arguments does it take?"}, {"role": "assistant", "content": "Run f every time a new event Arguments: f — A function. Returns: Unit `(`"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BPF`."}, {"role": "assistant", "content": "```supercollider\n{ BPF.ar(Saw.ar(200, 0.5), FSinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3600, 4000), 0.3) }.play;\n\n{ BPF.ar(Saw.ar(200, 0.5), MouseX.kr(100, 10000, 1), 0.3) }.play;\n\n // BPF on control signals:\n(\n{ var vib = BPF.kr(PinkNoise.kr, MouseX.kr(1, 100, 1), 0.3) * 10;\n SinOsc.ar(vib * 200 + 600) * 0.2 }.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `BufRd`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_playbuf, { |out = 0, bufnum = 0, rate = 1, startPos = 0, amp = 0.1, sustain = 1, pan = 0, loop = 1|\n var audio;\n rate = rate * BufRateScale.ir(bufnum);\n startPos = startPos * BufFrames.ir(bufnum);\n\n audio = BufRd.ar(1, bufnum, Phasor.ar(0, rate, startPos, BufFrames.ir(bufnum)), 1, 1);\n audio = EnvGen.ar(Env.sine, 1, timeScale: sustain, doneAction: Done.freeSelf) * audio;\n audio = Pan2.ar(audio, pan, amp);\n OffsetOut.ar(out, audio);\n}).add; // use .store for rendering example below\n\na = Pproto({\n ~newgroup = (type: \\group).yield;\n ~sf1 = (type: \\allocRead, path: ExampleFiles.apollo11).yield;\n},\n Pbind(*[\n instrument: \\help_playbuf,\n dur: Pseg([0, 0, 0.25, 0.5, 0.75, 1], 10).linexp(0, 1, 0.01, 2),\n legato: 4,\n startPos: Pn(Pseg([0, 1], 20), inf),\n rate: Pwhite(1, 1).midiratio,\n loop: 0,\n group: Pkey(\\newgroup),\n bufnum: Pkey(\\sf1)\n ])\n);\na.play;\n)\n\n// a.render(\"sounds/test.aif\", 40)\n// SoundFile.openRead(\"sounds/test.aif\").play\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// try wiggling mouse quickly:\n// LFNoise2 overshoots when going from high to low freqs, LFDNoise changes smoothly.\n\n{ SinOsc.ar(LFNoise2.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n{ SinOsc.ar(LFDNoise3.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFNoise2.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n\n{ LFDNoise3.ar(XLine.kr(2000, 20000, 8), 0.1\n// …\n```"}, {"role": "assistant", "content": "try wiggling mouse quickly: LFNoise2 overshoots when going from high to low freqs, LFDNoise changes smoothly. (LFDNoise3: Dynamic cubic noise)"}]} +{"conversations": [{"role": "user", "content": "What is the correct way to stop everything?"}, {"role": "assistant", "content": "Depends on what is playing, and they are different layers:\n\n- `s.freeAll` — frees every node on the server (all sound stops, definitions survive).\n- `CmdPeriod.run` — stops everything scheduled on the clocks (Patterns, Routines, Tasks).\n- `Ndef.clear; Pdef.clear` — clears the JITLib proxies.\n- `s.quit` — shuts the server down entirely.\n\nIn a session the habit is `CmdPeriod.run` first (stops the sequencing), then `s.freeAll` if a drone is still\nsounding."}]} +{"conversations": [{"role": "user", "content": "How do I use a metronome or check my timing?"}, {"role": "assistant", "content": "A click on the clock you are using, plus a counter to see where you are in the bar:\n\n```supercollider\n(\nTdef(\\click, {\n var count = 0;\n loop {\n (Synth(\\hat, [\\amp, if (count % 4 == 0) { 0.25 } { 0.08 }]));\n count = count + 1;\n 1.wait;\n }\n}).play;\n)\n```\n\nBecause it waits on `TempoClock.default`, it stays in sync with every Pbind you start, which makes it a\ntempo reference rather than a separate sound."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// example\n(\n{\n var trig = Impulse.kr(MouseX.kr(1, 100, 1));\n Ringz.ar(T2A.ar(trig), 800, 0.01) * 0.4\n}.play;\n);\n\n// compare with K2A\n(\n{\n var trig = Impulse.kr(200);\n [T2A.ar(trig), K2A.ar(trig)].lag(0.001)\n}.plot(10/200);\n);\n\n// removing jitter by randomising offset\n(\n{\n var trig = Impulse.kr(MouseX.kr(1, 100, 1));\n Ringz.ar(T2A.ar(trig, WhiteNoise.kr.range(0, s.options.blockSize - 1)), 800, 0.01)\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// example\n(\n{\n var trig = Impulse.kr(MouseX.kr(1, 100, 1));\n Ringz.ar(T2A.ar(trig), 800, 0.01) * 0.4\n}.play;\n);\n\n// compare with K2A\n(\n{\n var trig = Impulse.kr(200);\n [T2A.ar(trig), K2A.ar(trig)].lag(0.001)\n}.plot(10/200);\n);\n\n// removing jitter by randomising offset\n(\n{\n var trig = Impulse.kr(MouseX.kr(1, 100, 1));\n Ringz.ar(T2A.ar(trig, WhiteNoise.kr.range(0, s.options.blockSize - 1)), 800, 0.01) * 0.4\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// compare PL and PLn, start with polling two items from each Stream\n// Note that Pseq defaults to repeats = 1 and PL/PLn default to repeats = inf\n\n(\n~a = Pseq([1, 2, 3]);\nx = PLn(\\a).asStream;\ny = PL(\\a).asStream;\n\nx.nextN(2);\ny.nextN(2);\n);\n\n\n// replace proxy source \n\n~a = ~a * 100;\n\n\n// Stream from PLn finishes before replacement\n\nx.nextN(2)\n\n// With PL substream is replaced immediately\n\ny.nextN(2)\n```"}, {"role": "assistant", "content": "compare PL and PLn, start with polling two items from each Stream Note that Pseq defaults to repeats = 1 and PL/PLn default to repeats = inf (PLn: dynamic scope placeholder pattern whose streams will be finished before replacements)"}]} +{"conversations": [{"role": "user", "content": "Explain `DXEnvFanOut` in SuperCollider briefly."}, {"role": "assistant", "content": "DXEnvFanOut — sends crossfade envelopes to out buses according to demand-rate control DXEnvFanOut sends multichannel envelopes, which are used by DXMix / DXMixIn / DXFan / DXFanOut implicitely, to a sequence of out buses, which, together with fadeTimes and stepTimes, can be passed as demand rate ugens. It can be used as envelope and trigger at the same time, which leads to applications such as crossfading PlayBufs and different kinds of granulation, using a buffer or not. Category: Libraries > miSCellaneous > DX suite."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `ArrayedCollection` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n pitches.size.do{ |i|\n {\n var freq = pitches[i].midicps;\n var env = Env.perc.ar(Done.freeSelf);\n SinOsc.ar(freq) * 0.1 * env\n }.play;\n 0.2.wait\n }\n}\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an FM bell in SuperCollider."}, {"role": "assistant", "content": "PMOsc is phase modulation: a non-integer modulator ratio gives the inharmonic clang.\n\n```supercollider\n(\nSynthDef(\\fmBell, { |out = 0, freq = 440, amp = 0.2, dur = 4|\n var index = EnvGen.kr(Env([8, 0.2], [dur], -4));\n var sig = PMOsc.ar(freq, freq * 1.4, index, 0, 1);\n var env = EnvGen.kr(Env.perc(0.002, dur, 1, -5), doneAction: 2);\n Out.ar(out, Pan2.ar(sig * env * amp, 0));\n}).add;\n);\nSynth(\\fmBell, [\\freq, 550]);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a kick drum in SuperCollider."}, {"role": "assistant", "content": "A pitch-swept sine with a fast decay: the frequency envelope is what makes it read as a kick.\n\n```supercollider\n(\nSynthDef(\\kick, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 50, 40], [0.03, 0.15], -4));\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -6), doneAction: 2);\n Out.ar(out, Pan2.ar(SinOsc.ar(pitch) * env * amp));\n}).add;\n);\nSynth(\\kick);\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// derived from an answer by Sergio Luque to a mail to the sc-users SuperCollider mailing list on 2013/03/22\n\n(\nvar registerSize = 16;\nvar min =\"C2\".namemidi.asInteger;\nvar max = \"C6\".namemidi.asInteger;\nvar waitTime = 0.05; // in seconds\n//var chance = 0.1;\nvar chance = Pseq([Pseries(0, 0.1, 10), Pseries(1, -0.1, 10)], inf);\nvar change = 10; // step size\n\n\nPbind(\n \\midinote, Pswitch1(\n { \n Pbrown(min, max, Pif(Prout({ chance.trace.coin.embedInStream }), change, 0))\n } ! registerSize, \n Pseq(Array.iota(registerSize), inf)\n ),\n \\dur, waitTime\n).play\n)\n```"}, {"role": "assistant", "content": "wiard noise ring variation using a ringbuffer instead of bitshifting.\r\nRe-implemented according to Julian Parker's m4l patch.\r\nDerived from an answer by Sergio Luque to a mail to the sc-users SuperCollider mailing list on 2013/03/22."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Monzo function?"}, {"role": "assistant", "content": "```supercollider\n// https://en.xen.wiki/w/Monzo\n//Monzo notation of JI ratios is often used in combination with Vals for temperament theory. I wrote this not for temperament, but rather to use monzos as a possible alternative to otonality and utonality, espescially when sonifying streams that include negative numbers.\n\n(//function that takes a collection representing a monzo as an argument, and outputs the ratio it encodes\n~zo = {\n arg exponentCollection;\n var ratio = 1;\n exponentCollection.do({arg item, i; ratio = ratio * (i.nthPrime).pow(item);});\n ratio;\n};\n);\n\n//5-limit\n~zo.([-1, 1]); // 3/2\n~zo.([-2, 0, 1]); // 5/4\n~zo.([-3, 2]); // 9/8\n~zo.([-4, 4, -1]); // 81/80\n~zo.([-4, 4, -1]); // 81/80\n\n//7-limit\n~zo.([-2, 0, 0, 1]); // 7/4\n~zo.([-1, -1, 0, 1]); // 7/6\n~zo.([0, 0, -1, 1]); // 7/5\n\n//fractional monzos\n~zo.([-1/2, 3.3, 4, -5]); //sure\n//it might be fun to do monzo glissandos in different places?\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `FPSignal` in SuperCollider briefly."}, {"role": "assistant", "content": "FPSignal — Implementation of Functional Reactive Programming. This is port of the reactive-core library for Scala into SuperCollider. Category: FP, TimerES."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Midterm Q2 (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"sawSynth\",{arg freq, amp;\n var env, snd;\n\n env = Env.perc(\n attackTime:0.1,\n releaseTime:2,\n level:amp).kr(doneAction: 2);\n snd = Saw.ar(\n freq:freq*[0.99, 1.0, 1.001, 1.008],\n mul: env);\n snd = LPF.ar(in: snd,freq:2000);\n snd = Splay.ar(snd);\n Out.ar(0,snd);\n\n}).add;\n);\n\n(\nPbind(\n \\instrument, \"sawSynth\",\n \\freq, Pwhite(300, 700, inf),\n \\amp, Pwhite(0.15, 0.2)\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `PV_BinShift` in SuperCollider?"}, {"role": "assistant", "content": "PV_BinShift — Shift and stretch bin position. Shift and scale the positions of the bins. Can be used as a very crude frequency shifter/scaler. Category: UGens > FFT."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PlaneTree`."}, {"role": "assistant", "content": "```supercollider\n(\n// Three nodes in this data. First is always the root.\n// So the first is applied to decide whether to branch down to the second or third.\n// Then those nodes decide whether to classify the datum as 1/2/3/4.\n~treedata = [\n/* xoff,yoff, xvec,yvec, lisl, risl */\n [0.5, 0.5, -0.7, 0.4, 0, 0], // this is the root node, its number is 1\n [0.3, 0.7, 0.4, 0.7, 1, 1], // this one's number is 2\n [0.5, 0.2, -0.8,-0.8, 1, 1] // this one's number is 3\n];\n)\n```"}]} -{"conversations": [{"role": "user", "content": "My sustained synth never stops, even when I set the gate to 0."}, {"role": "assistant", "content": "A sustained EnvGen only releases when the gate goes from positive to non-positive *after* the envelope has started, and the Synth only disappears if that EnvGen has `doneAction: 2`. Check three things: the SynthDef actually takes a `gate = 1` argument, the Env is a sustained shape (Env.adsr or Env.asr, not Env.perc), and you call `x.set(\\gate, 0)` on the Synth object. Setting the gate on a different Synth, or on a Group, does nothing."}]} -{"conversations": [{"role": "user", "content": "What does `Mx.disconnectOutlet` do? What arguments does it take?"}, {"role": "assistant", "content": "A mixer and dynamic patching Arguments: outlet."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Tdef`."}, {"role": "assistant", "content": "```supercollider\nTdef(\\x).play; // create an empty Tdef and play it.\n\nTdef(\\x, { loop({ \"ggggggggggggggggg9999ggg999ggg999gg\".scramble.postln; 0.5.wait }) });\n\n\nTdef(\\x, { loop({ \"---------////----------------------\".scramble.postln; 0.25.wait }) });\nTdef(\\x, { loop({ thisThread.seconds.postln; 1.wait }) });\nTdef(\\x, { loop({ thisThread.seconds.postln; 1.01.wait }) });\n\nTempoClock.default.tempo = 2;\n\nTdef(\\x, { \"the end\".postln });\nTdef(\\x, { \"one more\".postln });\nTdef(\\x, { 10.do({ \"ten more\".scramble.postln; 0.25.wait }) });\nTdef(\\x, { loop({ \"lots more\".scramble.postln; 0.25.wait }) });\n\nTempoClock.default.tempo = 1;\n\nTdef(\\x).stop;\nTdef(\\x).play;\n\nTdef(\\x).clear;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PbindProxy`."}, {"role": "assistant", "content": "```supercollider\na = PbindProxy(\\note, Pseq([0, 7, 9], inf), \\dur, 0.2).play;\na.set(\\note, Pseq([0, 6, 10]));\na.stop;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nx = Mx.new.app;\nd = x.add( MxDocument.new ;\n// double click on it to open the document\nx.gui\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nx = Mx.new.app;\nd = x.add( MxDocument.new );\n// double click on it to open the document\nx.gui\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Dust`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-Dust\", { |out = 0|\n Out.ar(out,\n Dust.ar(200, 0.5)\n )\n}).play;\n);\n\n(\nSynthDef(\"help-Dust\", { |out = 0|\n Out.ar(out,\n Dust.ar(XLine.kr(20000, 2, 10), 0.5)\n )\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `FunctionList.addFunc` do?"}, {"role": "assistant", "content": "This message is used to be able to add to an Object, to a Function, or to a FunctionList. `nil.addFunc` returns a function, if only one function is passed in the argument. `function.addFunc` then returns a"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Dbrown`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a, freq, trig;\n a = Dbrown(0, 15, 1, inf);\n trig = Impulse.kr(MouseX.kr(1, 40, 1));\n freq = Demand.kr(trig, 0, a) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Instr.<>>` do? What arguments does it take?"}, {"role": "assistant", "content": "function composition : construct a CompositeInstr by patching this Instr into another Arguments: that — another Instr (or a CompositeInstr or Papplied Instr). Returns: a CompositeInstr"}]} -{"conversations": [{"role": "user", "content": "Interfacing SC with external software: MIDI or OSC?"}, {"role": "assistant", "content": "SuperCollider forum — Interfacing SC with external software: MIDI or OSC?\n\nI found this partial solution on sccode.org :\n\n```supercollider\n // declare an event type which sends OSC commands to Renoise\n\n(\nEvent.addEventType(\\renoise, { |server|\n var renoiseOscServer = NetAddr(\"127.0.0.1\", 8000);\n var notes = [~midinote.value, ~ctranspose.value, ~velocity.value, ~sustain.value, ~lag.value, ~timingOffset.value, ~instr.value, ~track.value].flop;\n var timeNoteOn, timeNoteOff, instrument, track, velocity;\n var serverLatency;\n\n serverLatency = server.latency ? 0;\n\n notes.do {|note|\n instrument = note[6] ? -1;\n track = note[7] ? -1;\n velocity = note[2].asInt.clip(0,127);\n\n // sustain and timingOffset are in beats, lag is in seconds\n timeNoteOn = (thisThread.clock.tempo.reciprocal*note[5])+note[4]+server.latency;\n timeNoteOff = (thisThread.clock.tempo.reciprocal*(note[3]+note[5]))+note[4]+server.latency;\n SystemClock.sched(timeNoteOn, {renoiseOscServer.sendMsg(\"/renoise/trigger/note_on\", instrument.asInt, track.asInt, (note[0]+note[1]).asInt, velocity )});\n SystemClock.sched(timeNoteOff, {renoiseOscServer.sendMsg(\"/renoise/trigger/note_off\", instrument.asInt, track.asInt, (note[0]+note[1]).asInt)});\n }\n});\n);\n\n// Now start Renoise OSC server, load a sample, and try some patterns\n\n// straight timing\n(\nPbind(*[\n type: \\renoise,\n legato: Pgauss(0.2,0.05,inf),\n dur: 0.2,\n degree: [2,5,12],\n track: Prand([0,1], inf),\n ctranspose: Pseq([0,0,0,0,4,4,4,4,5,5,5,5],inf),\n velocity: Pgauss(64,10,inf),\n]).play;\n)\n```\n\nhttp://sccode.org/1-4SN\n\nBut what I couldn’t find there was a simple syntax for sending Note Events or Midi Events as OSC messages... Do I really need to re-implement the whole SC’s defaultParentEvent as new OSC Event to send it using regular pattern’s syntax?"}]} +{"conversations": [{"role": "user", "content": "What does `Cyton.defaultSampleRate` do?"}, {"role": "assistant", "content": "An Integer that is different for each board. For Cyton boards it is 250"}]} +{"conversations": [{"role": "user", "content": "What does `Ref.dereference` do?"}, {"role": "assistant", "content": "Answer the value. This message is also defined in class Object where it just returns the receiver. Therefore anything.dereference will remove a Ref if there is one. This is slightly different than the value message, because value will also cause functions to evaluate themselves whereas dereference will"}]} +{"conversations": [{"role": "user", "content": "Write a warm pad in SuperCollider."}, {"role": "assistant", "content": "Detuned saws through a slow filter envelope and a long release: the detune is what makes it wide.\n\n```supercollider\n(\nSynthDef(\\pad, { |out = 0, freq = 220, amp = 0.15, gate = 1|\n var detune = [-0.06, -0.02, 0.02, 0.06];\n var sig = Mix(Saw.ar(freq * (1 + detune))) * 0.25;\n var env = EnvGen.kr(Env.adsr(1.2, 0.5, 0.7, 3), gate, doneAction: 2);\n var cutoff = SinOsc.kr(0.05).exprange(300, 2000);\n sig = RLPF.ar(sig, cutoff, 0.4);\n Out.ar(out, Splay.ar([sig, DelayN.ar(sig, 0.02, 0.012)]) * env * amp);\n}).add;\n);\n~pad = Synth(\\pad, [\\freq, 165]);\n~pad.set(\\gate, 0);\n```\n`gate` is what makes a sustained sound controllable: `\\gate, 0` releases it and `doneAction: 2` then\nfrees the Synth."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Resonz`."}, {"role": "assistant", "content": "```supercollider\n{ Resonz.ar(WhiteNoise.ar(0.5), 2000, 0.1) }.play\n\n// modulate frequency\n{ Resonz.ar(WhiteNoise.ar(0.5), XLine.kr(1000, 8000, 10), 0.05) }.play\n\n// modulate bandwidth\n{ Resonz.ar(WhiteNoise.ar(0.5), 2000, XLine.kr(1, 0.001, 8)) }.play\n\n// modulate bandwidth opposite direction\n{ Resonz.ar(WhiteNoise.ar(0.5), 2000, XLine.kr(0.001, 1, 8)) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for SOUND 1, from orig Influx Example. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// SOUND 1, from orig Influx Example\n(\nNdef(\\dog).addSpec(\\intv, [-24, 24]);\nNdef(\\dog).addSpec(\\timescale, [0.01, 10, \\exp]);\nNdef(\\dog).addSpec(\\curve, [-10, 10]);\nNdef(\\dog).addSpec(\\ffreq, \\freq);\n\nNdef(\\dog).addSpec(\\loopnode, [0, 12]);\nNdef(\\dog).addSpec(\\dens, [10, 1000]);\nNdef(\\dog).addSpec(\\resfreq, \\freq);\nNdef(\\dog).addSpec(\\ringtime, [0.01, 1, \\exp]);\n\nNdef(\\dog, { |amp=0, freq=250, intv=19, timescale=1, curve=0, loopnode=0, dens = 10, resfreq = 500, ringtime = 0.01|\n var n = 15;\n var env = EnvGen.kr(\n Env({ 1.0.rand2 }!(n+1), {1.0.rand}!n, curve, releaseNode: n-1, loopNode: loopnode.min(n-3)),\n timeScale: timescale);\n var pitch = (env * [1, 0.33, -1] * intv).midiratio * freq;\n var form = Formant.ar(pitch, pitch.rotate(1) * 1.6, pitch.rotate(2) * 2.6);\n\n var dusty = Ringz.ar(\n Dust.ar(dens!3),\n (resfreq * LFNoise0.kr([3, 5, 7], 0.5, 1)).lag(0.3),\n ringtime)\n * ((dens ** -0.5) * (ringtime ** -0.3)\n );\n\n Splay.ar(form * dusty, level: amp * 4) ;\n});\n);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n Instr(\\helpTempoPlayer,{\n Impulse.ar( Tempo.kr )\n });\n\n Patch(\\helpTempoPlayer).play(atTime:1)\n;\nTempo.bpm = 100;\n\nTempo.bpm = 180;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n Instr(\\helpTempoPlayer,{\n Impulse.ar( Tempo.kr )\n });\n\n Patch(\\helpTempoPlayer).play(atTime:1)\n);\nTempo.bpm = 100;\n\nTempo.bpm = 180;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nMix.ar([SinOsc.ar(220, 0, 0.1), SinOsc.ar(330, 0, 0.1)])\n```"}, {"role": "assistant", "content": "Sums two sine waves into one signal — a perfect fifth, 220 Hz and 330 Hz, at 0.1 amplitude each.\n\n`[SinOsc.ar(220, 0, 0.1), SinOsc.ar(330, 0, 0.1)]` is an Array of two audio-rate signals (each UGen\nreturns a signal; an array of them is just a list). `Mix.ar` adds the elements together. The alternative\n`+` operator does the same for two signals, and `Splay.ar` would spread them across the stereo field\ninstead of summing them."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `StandardL`."}, {"role": "assistant", "content": "```supercollider\n// vary frequency\n{ StandardL.ar(MouseX.kr(20, SampleRate.ir)) * 0.3 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `LinearSpline` in SuperCollider briefly."}, {"role": "assistant", "content": "LinearSpline — A simple linearly interpolated spline passing through a series of points. A spline is defined by a series of points. These points may be of 2 or more dimensions. 2 dimensional splines may be displayed and edited using a gui. A LinearSpline interpolates between points using straight lines with no curvature. Category: Splines, Envelopes > Splines."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Timer`."}, {"role": "assistant", "content": "```supercollider\n// using timer to modulate sine frequency: the slower the trigger is the higher the frequency\n(\n{ var trig;\n trig = Impulse.kr(MouseX.kr(0.5, 20, 1));\n SinOsc.ar(Timer.kr(trig) * 500 + 500, 0, 0.2)\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `SharedOut` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\n// only works with the internal server\ns = Server.internal;\ns.boot;\n);\n\n(\nSynthDef(\"help-SharedOut\", {\n SharedOut.kr(0, SinOsc.kr(0.2));\n}).add;\n);\n\n(\ns.sendMsg(\\s_new, \"help-SharedOut\", x = s.nextNodeID, 0, 1);\ns.sendMsg(\\n_trace, x);\n\n// poll the shared control bus\nRoutine({\n 30.do({\n s.getSharedControl(0).postln;\n 0.2.wait;\n });\n}).play;\n);\n\n\ns.quit;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nSynthDef(\\bird,{\n var sig, freqenv, env, trig;\n trig = Dust.ar(2);\n env = EnvGen.ar(Env.perc(0.01,0.4,0.8,-8), trig, doneAction: 2);\n freqenv = EnvGen.ar(Env([Rand(1000,3000), Rand(3000,6000), Rand(1000,2000), Rand(2000,5000)],[0.1,0.01,0.1]);, trig);\n sig = SinOsc.ar(freqenv, 0, env);\n sig = Pan2.ar(sig, Rand(-1.0,1.0));\n Out.ar(0, sig);\n}).add;\n);\n\n(\nRoutine({\n inf.do({\n Synth(\\bird);\n rrand(1.0,2.0).wait;\n })\n}).play;\n)\n```"}, {"role": "assistant", "content": "I haven't found a quite satisfying code about birds, so here's a very simple SynthDef to start with."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\nb = Buffer.alloc(s, 100);\nb.zero;\nb.set(33, 1.034);\n// This should detect the 33rd value as the highest...\nx = {BufMax.kr(b).poll}.play;\n\n// ...until we set a new winner...\nb.set(74, 1.038;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\nb = Buffer.alloc(s, 100);\nb.zero;\nb.set(33, 1.034);\n// This should detect the 33rd value as the highest...\nx = {BufMax.kr(b).poll}.play;\n\n// ...until we set a new winner...\nb.set(74, 1.038);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SOMTrain.kr` do? What arguments does it take?"}, {"role": "assistant", "content": "Create (train) a Self-Organising Map Arguments: bufnum — A reference to the buffer where the map will be created. Initialising the map is up to you (see below).; inputdata — An Array of the input signals for the net to learn.; netsize — The size of the neural net along one dimension.; numdims — The dimensionality of the neural net. Choose from 1, 2, 3, or 4.; traindur — The length of the training period; the number of data frames that will come in before the net gradually \"freezes\" into its final state; nhood — The initial size of the neighbourhood used in training. (The size always shrinks to zero as the training progresses.) The size is expressed as a fraction of netsize. Default is 0.5, and you probably don't need to change it.; gate — A simple on-or-off control. When off (gate<=0) the incoming data is ignored.; initweight — How heavily the algorithm weights the data points at first (the weighting always tails off to zero as the training progresses, in a reciprocal curve). Default is 1, and you usually don't need to change this.. Returns: The UGen outputs an array of three values: the number of data points still to come in before training finishes; the \"reconstruction error\" of the single data point that has most recently been input (t"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `ArrayedCollection` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n pitches.size.do{ |i|\n {\n var freq = pitches[i].midicps;\n var env = Env.perc.ar(Done.freeSelf);\n SinOsc.ar(freq) * 0.1 * env\n }.play;\n 0.2.wait\n }\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Int32Array.readFromStream` do?"}, {"role": "assistant", "content": "an array whose indexed slots are all of the same type"}]} +{"conversations": [{"role": "user", "content": "Explain `PV_CommonMag` in SuperCollider briefly."}, {"role": "assistant", "content": "PV_CommonMag — returns common magnitudes Returns magnitudes common to bufferA & bufferB within a tolerance level. Category: UGens > FFT."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LFDNoise0`."}, {"role": "assistant", "content": "```supercollider\n// try wiggling mouse quickly;\n// LFNoise frequently seems stuck, LFDNoise changes smoothly.\n\n{ LFNoise0.ar(MouseX.kr(0.1, 1000, 1), 0.1) }.play\n\n{ LFDNoise0.ar(MouseX.kr(0.1, 1000, 1), 0.1) }.play\n\n// silent for 2 secs before going up in freq\n\n{ LFNoise0.ar(XLine.kr(0.5, 10000, 3), 0.1) }.scope;\n\n{ LFDNoise0.ar(XLine.kr(0.5, 10000, 3), 0.1) }.scope;\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFNoise0.ar(XLine.kr(1000, 20000, 10), 0.1) }.scope;\n\n{ LFDNoise0.ar(XLine.kr(1000, 20000, 10), 0.1) }.scope;\n\n{ LFNoise2.ar(1000, 0.25) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Just going crazy with modulation. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"additivePad\", \n { arg numOfCycles = 100;\n var lfo;\n var lfo2;\n var lfo3;\n lfo = SinOsc.kr([Rand(0.5,1000),Rand(0.5,1000)], 1.5pi, 0.5, 0.5);\n lfo3 = SinOsc.kr([Rand(0.1,0.5),Rand(0.1,0.5)], 1.5pi, 0.5, 0.5);\n lfo2 = SinOsc.kr([(Rand(0.5,1000) * lfo) * lfo3, (Rand(0.5,1000) * (1 - lfo)) * (1 - lfo3)], 1.5pi, 0.5, 0.5);\n Out.ar(\n 0, \n Mix.arFill(\n numOfCycles,\n { \n SinOsc.ar(\n Rand(40,1000),\n 0, \n (numOfCycles.reciprocal * 0.75) * lfo2)\n }\n ) * EnvGen.kr(Env.perc(Rand(0.1,30), Rand(0.1,30)), doneAction: 2)\n )\n }\n).send(s); \n);\n\n(\nr = Routine({\n 200.do({\n x = Synth.new(\"additivePad\"); \n 10.wait;\n });\n});\n);\n\nr.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SubsampleOffset.ir` do?"}, {"role": "assistant", "content": "Offset from synth start within one sample."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n var gspring;\n gspring = { |freq|\n var delay, sinc, env, line, impul;\n\n delay = freq.reciprocal;\n impul = Impulse.ar(0);\n env = Env.perc(0.001, 0.01).ar;\n line = Line.ar(1000, 50, 0.01 );\n sinc = SinOsc.ar(line);\n\n Pluck.ar( sinc * env, impul, delay, delay, 5, 0.5);\n };\n\n\nSynthDef.new('eguitar',\n { arg amp=1, freq=150, out_bus=0, pan=0;\n\n var snd;\n\n snd = gspring.value(freq-50) +\n gspring.value(freq) +\n gspring.value(freq+50);\n\n snd = (snd * 32.dbamp).tanh;\n snd = RLPF.ar(snd, 2800+freq, 0.5);\n snd = (snd * 32.dbamp).tanh;\n snd = RLPF.ar(snd, 300+freq, 0.5);\n snd = (snd * 32.dbamp).tanh;\n\n snd * -20.dbamp;\n\n Out.ar(out_bus, snd );\n}).add\n);\n\nSynth('eguitar', [freq: 360]);\n```"}, {"role": "assistant", "content": "just a very limited attempt for reference purpose of a hoped for eguitar synth ´\r\nbased on https://sccode.org/1-5aC#c982."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// check blockSize before (or reset blockSize in examples)\n\n(\nif (s.options.blockSize != 64) {\n s.options.blockSize = 64;\n s.quit.reboot;\n}\n);\n\n// With divisions we must avoid division by zero resp. blowup, here it's max in the divisor.\n// The example also establishes a cross-feedback of the two channels by using reverse.\n\ns.scope\n\n// start fb fx Synth\n\n(\n~bus = Bus.audio(s, 2);\n\ny = {\n var inSig = In.ar(~bus, 2);\n var lfo = LFDNoise3.ar(1).linexp(-1, 1, 0.2, 10);\n LPF.ar(\n Fb1({ |\n// …\n```"}, {"role": "assistant", "content": "check blockSize before (or reset blockSize in examples) With divisions we must avoid division by zero resp. blowup, here it's max in the divisor. (Fb1: single sample feedback / feedforward pseudo ugen)"}]} +{"conversations": [{"role": "user", "content": "What does `MxUnit.getInlet` do? What arguments does it take?"}, {"role": "assistant", "content": "Container for a musical object (Instr, NDef, Spline etc); this is a single unit that has inlets and outlets which can be connected to other units Arguments: index."}]} +{"conversations": [{"role": "user", "content": "What does `NodeMap.map` do?"}, {"role": "assistant", "content": "map arguments of a node (synonymous with `set`, mapping is done automatically when a suitable argument is"}]} +{"conversations": [{"role": "user", "content": "I made a synth and I hear nothing. Where do I start?"}, {"role": "assistant", "content": "Start with the node tree, not the code: evaluate `s.plotTree`. If your Synth is not there, it never started or it already freed itself; if it is there, the problem is in the signal. Which of the two do you see?"}, {"role": "user", "content": "It's in the tree."}, {"role": "assistant", "content": "Then the node lives and the signal is being lost. Check three things in order: does the SynthDef reach `Out.ar(0, ...)` with bus 0; is any `amp`/`mul` zero; and is a filter closed, e.g. `LPF.ar(sig, 50)` on a 440 Hz sine. Paste the SynthDef and I will read it."}, {"role": "user", "content": "SynthDef(\\x, { |out = 0| Out.ar(out, LPF.ar(Saw.ar(60), 80) * 0.1) }).add; Synth(\\x, [\\out, 2]);"}, {"role": "assistant", "content": "Two things. You wrote a low-pass at 80 Hz over a 60 Hz saw, which leaves almost nothing above the fundamental — the patch is nearly a sine at 60 Hz at very low level. And you passed `\\out, 2`, so it is going to bus 2, not the master. Try `Synth(\\x)` with the default out and a cutoff of 800:\n\n```supercollider\nSynthDef(\\x, { |out = 0, cutoff = 800| Out.ar(out, LPF.ar(Saw.ar(60), cutoff) * 0.1) }).add;\nSynth(\\x);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DelayL`."}, {"role": "assistant", "content": "```supercollider\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nDelayL.ar(z, 0.2, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\n(\n// recursive application of delay.\n{\nz = Decay2.ar(Dust.ar(1, 0.5), 0.01, 0.1, Saw.ar(100 + [0, 1]));\n5.do { |i| z = DelayL.ar(RLPF.ar(z, Rand(100, 3000), 0.03), 1, 1 / (2**i), 1, z * 0.5) };\nz\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = {LFTri.ar(100+(1000*Maths2.ar(MouseX.kr, MouseY.kr, 0.2, 1-MouseButton.kr(lag:0.001))[0]), 0, 0.1)}.play //notice how I am taking the [0th channel of the Maths and ignoring the other outputs\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = {LFTri.ar(100+(1000*Maths2.ar(MouseX.kr, MouseY.kr, 0.2, 1-MouseButton.kr(lag:0.001))[0]), 0, 0.1)}.play //notice how I am taking the [0]th channel of the Maths and ignoring the other outputs\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `SyncSaw` that runs as it is."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n(\n// send a synth def to server\nSynthDef(\"tpulse\", { arg out=0,freq=700,sawFreq=440.0;\n Out.ar(out, SyncSaw.ar(freq, sawFreq,0.1) )\n}).send(s);\n);\n\n// all OSC commands generated in the function contained below will be added to a bundle\n// and executed simultaneously after 2 seconds.\n(\ns.makeBundle(2.0, {\n x = Synth.new(\"tpulse\");\n a = Bus.control.set(440);\n x.map(\\freq, a);\n});\n);\nx.free;\n\n// don't send\n(\nb = s.makeBundle(false, {\n x = { PinkNoise.ar(0.1) * In.kr(0, 1); }.play;\n});\n);\n// now pass b as a pre-existing bundle, and start both synths synchronously\n(\ns.makeBundle(nil, { // nil executes ASAP\n y = { SinOsc.kr(0.2).abs }.play(x, 0, 0, \\addBefore); // sine envelope\n}, b);\n);\nx.free; y.free;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\n\n\n// create with cueSoundFile class method\nb = Buffer.cueSoundFile(s, ExampleFiles.apollo11, 0, 1);\nx = { DiskIn.ar(1, b) }.play;\nb.close; // must call close in between cueing\n// now use like named instance method, but different arguments\nb.cueSoundFile(ExampleFiles.apollo11;\n// have to do all this to clean up properly!\nx.free; b.close; b.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\n\n\n// create with cueSoundFile class method\nb = Buffer.cueSoundFile(s, ExampleFiles.apollo11, 0, 1);\nx = { DiskIn.ar(1, b) }.play;\nb.close; // must call close in between cueing\n// now use like named instance method, but different arguments\nb.cueSoundFile(ExampleFiles.apollo11);\n// have to do all this to clean up properly!\nx.free; b.close; b.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SymbolArray.readFromStream` do?"}, {"role": "assistant", "content": "an array whose indexed slots are all of the same type"}]} +{"conversations": [{"role": "user", "content": "What are the arguments of GrainBuf.ar?"}, {"role": "assistant", "content": "`GrainBuf.ar(numChannels, trigger, dur, sndbuf, rate, pos, interp, pan, envbufnum, maxGrains, mul, add)`. The ones you always pass are numChannels (1 or 2), trigger (a UGen that fires grains, e.g. Impulse.kr(20)), dur (grain length in seconds), sndbuf (an integer buffer number, or `~buf`), rate (playback rate per grain), and pos (read position 0..1 into the buffer). Raise maxGrains if the server complains about too many grains rather than lowering density."}]} +{"conversations": [{"role": "user", "content": "What can you do?"}, {"role": "assistant", "content": "Write and explain SuperCollider: SynthDefs, UGens, Patterns, Ndef, buses and envelopes, and tell you why a patch is silent or will not compile. I am 198M parameters, so I am narrow on purpose."}]} +{"conversations": [{"role": "user", "content": "What does `TDelay.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Trigger delay. Arguments: in — Input trigger signal.; dur — Delay time in seconds.."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Pgtpar` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// synthdef\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n}).add;\n);\n\n// pattern with different start times\n(\nx = Pbind(\n \\instrument, \\help_sinegrain,\n \\degree, Pseq(#[0, 5, 4, 2, 1, 1, 3], inf),\n \\dur, Pseq(#[0.25, 0.5, 1.0], inf),\n \\scale, #[0, 3, 5, 9, 10]\n);\na = Pbus(Pgtpar([0.0, x, 1.5, x, 2.25, x])).play;\n);\ns.plotTree;\na.stop;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `IdentityDictionary.freezeAsParent` do?"}, {"role": "assistant", "content": "For optimizing the garbage collector load, objects can be frozen and become immutable. This method creates a new dictionary with the frozen instance as a parent so that all contents can be overwritten without losing this"}]} +{"conversations": [{"role": "user", "content": "What is `LanguageConfig` in SuperCollider?"}, {"role": "assistant", "content": "LanguageConfig — Access and modify interpreter configuration The LanguageConfig class provides access to the interpreter configuration. Category: Language."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// if \\degree, \\note or \\midinote are occuring after \\dur,\n// a frequency value will be calculated according to Event's usual conversion framework\n// and used for setting the arg 'freq'.\n\n(\np = PmonoPar([\n [\n \\dur, 1.0,\n \\pan, Pser([-0.9, 0, 0.9], 8) \n ],[\n \\dur, 0.4,\n \\midinote, Pseq((70..75), 7)\n ],[\n \\dur, 0.2,\n \\amp, Pseq([0.05, 0.3], 30) \n ]\n]).trace.play;\n)\n```"}, {"role": "assistant", "content": "if \\degree, \\note or \\midinote are occuring after \\dur, a frequency value will be calculated according to Event's usual conversion framework (PmonoPar: monophonic event pattern for an arbitrary number of timed setting streams)"}]} +{"conversations": [{"role": "user", "content": "What does `SDrone.xsetFrequencies` do? What arguments does it take?"}, {"role": "assistant", "content": "convenience method for CODE.xset(\\frequencies, ...) will Arguments: arr — an array of floats in Hz.."}]} +{"conversations": [{"role": "user", "content": "What does `History.startTimeStamp` do?"}, {"role": "assistant", "content": "keeps a history of interpreted lines of code"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n Ndef(\\x, {\n var output;\n var delayTime;\n var delayMax = 0.2;\n var delayAdd = 0.1;\n var pulseFreq = 0.5;\n var proxyMul = 2;\n var pulseMin = 40;\n var pulseMax = 130;\n var numOfEchos = 2;\n\n var mainPulse = LFPulse.ar(pulseFreq, 0, 0.5).range(pulseMin, pulseMax);\n var proxy = Ndef(\\x).ar * proxyMul;\n var ampModFreq = SinOsc.ar(0.01, 0).range(0.3, 30);\n var ampMod = LFNoise1.ar(ampModFreq, 6);\n output = SinOsc.ar(mainPulse + proxy, 0, ampMod).tanh;\n numOfEchos.do{\n delayTime = {delayMax.rand + delayAdd}!2;\n output = AllpassL.ar(output, 0.1, delayTime, 5);\n };\n output.tanh;\n }).play\n)\n```"}, {"role": "assistant", "content": "Something I put together a while back by forking Dark Sea Horns."}]} +{"conversations": [{"role": "user", "content": "How does multi-channel expansion work?"}, {"role": "assistant", "content": "If any argument of a UGen is an Array, the UGen is built once per element and the results are returned as an Array. So `SinOsc.ar([220, 330, 440])` is three oscillators, and `SinOsc.ar(220 * [1, 1.5])` is two. This is not a special stereo feature: it is uniform expansion, which is why `Splay.ar(SinOsc.ar([220,330,440]) * 0.1)` gives you a spread stereo field from three mono sources."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n var saw, bpf;\n saw = Pulse.ar(\n freq: [100,150],\n mul: LFPulse.kr(\n freq: [0, 0.03, 0.04],\n width: 0.15));\n bpf = LPF.ar(in: saw, freq: SinOsc.kr(-10, -5, 3).range(200, 400));\n Out.ar(0, bpf);\n}.play;\n)\n```"}, {"role": "assistant", "content": "//Pulse is the UGen. There is multichannel expansion due to the lists in the freqs. The range is a big part of the reason this sounds so deep."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\n{\n// Move the mouse. This varies from sinewave (left) to almost-square (right)\nvar sig = (SinOsc.ar(MouseY.kr(100, 1000, 1)) * MouseX.kr(1,10)).clip2(1);\nvar val = Crest.kr(sig, 440).poll;\n(sig * 0.1).dup\n}.play\n);\n\n(\n// Or as a plot (which shows the odd results you get over the first few samples):\n{\nvar sig = (SinOsc.ar(440, pi.rand) * XLine.kr(1,10, 5)).clip2(1);\nvar val = Crest.kr(sig, 440).poll;\nOut.ar(0, sig * 0.1.dup);\nK2A\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\n{\n// Move the mouse. This varies from sinewave (left) to almost-square (right)\nvar sig = (SinOsc.ar(MouseY.kr(100, 1000, 1)) * MouseX.kr(1,10)).clip2(1);\nvar val = Crest.kr(sig, 440).poll;\n(sig * 0.1).dup\n}.play\n);\n\n(\n// Or as a plot (which shows the odd results you get over the first few samples):\n{\nvar sig = (SinOsc.ar(440, pi.rand) * XLine.kr(1,10, 5)).clip2(1);\nvar val = Crest.kr(sig, 440).poll;\nOut.ar(0, sig * 0.1.dup);\nK2A.ar(val);\n}.plot(5, minval:1, maxval: 4)\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// examples: args are // outs, amps, ins, vol, fadeTime\n\n{ Out.ar(87, SinOsc.ar(MouseX.kr(40, 10000, 1) * [1, 2, 3], 0, 0.2)) }.play;\nx = Monitor.new;\n\n(\nx.playN(\n [0, 1, 4], // to these outs\n [0.1, 0.4, 0.3], // with these volumes\n [87, 88, 89] // from these ins\n);\n);\n(\nx.playN(\n [0, [1, 3, 2], 4], // outs can be nested: 87 -> 0, 88 -> [1, 3, 2], 89 -> 4\n [0.1, [0.4, 0.2, 0.1], 0.3], // with nested volumes 0.1, [0\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// examples: args are // outs, amps, ins, vol, fadeTime\n\n{ Out.ar(87, SinOsc.ar(MouseX.kr(40, 10000, 1) * [1, 2, 3], 0, 0.2)) }.play;\nx = Monitor.new;\n\n(\nx.playN(\n [0, 1, 4], // to these outs\n [0.1, 0.4, 0.3], // with these volumes\n [87, 88, 89] // from these ins\n);\n);\n(\nx.playN(\n [0, [1, 3, 2], 4], // outs can be nested: 87 -> 0, 88 -> [1, 3, 2], 89 -> 4\n [0.1, [0.4, 0.2, 0.1], 0.3], // with nested volumes 0.1, [0.4, 0.2, 0.1], and 0.3\n [87, 88, 89]); // reading from these ins\n);\n// can also set global volume and fadetime\nx.playN(vol: 0.0, fadeTime: 4);\n```"}]} +{"conversations": [{"role": "user", "content": "What are you not good at?"}, {"role": "assistant", "content": "Everything outside SuperCollider. I have no audio input, no live data, and my knowledge ends at the documentation snapshot I was trained on — so I can be confidently wrong about Quarks and new UGens."}]} +{"conversations": [{"role": "user", "content": "What does `SGliss.removeVoices` do? What arguments does it take?"}, {"role": "assistant", "content": "remove Arguments: num — the number of voices to be removed.; action — a LINKClasses/Function that will be evaluated when the voice has faded out.."}]} +{"conversations": [{"role": "user", "content": "What does `MultiSliderView.size` do? What arguments does it take?"}, {"role": "assistant", "content": "The amount of sliders. When setting -size, if the new amount is larger then the current, new sliders will be added with the value of 0. In the opposite case, the value of sliders up to the new amount will be preserved, and the rest of the sliders will be Arguments: An Integer.."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Pmul`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, gate = 1|\n var env;\n env = EnvGen.kr(Env.asr(0.001, 1, 0.2), gate, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain, \\freq, 440);\nb = Pmul(\\freq, Pseq([1, 2, 3, 4, 5, 6, 7], inf), a);\nb.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `BusPlug` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\ns.boot;\nz = Bus.control(s, 16);\nz.setn({ |i| (i * 5).nthPrime } ! 16 * 5 + 100);\na = BusPlug.for(z);\n{ Splay.ar(SinOsc.ar(a.kr(3, MouseX.kr(0, 25)))) * 0.1 }.play; // selectively play 3 channel of the 16, modulate offset\n```"}]} +{"conversations": [{"role": "user", "content": "GrainBuf complains about too many grains."}, {"role": "assistant", "content": "The number of simultaneous grains is `density × dur` in seconds, and it exceeds maxGrains (512 by default). Either lower the trigger rate, shorten the grains, or raise the limit: `GrainBuf.ar(2, trig, dur, buf, 1, pos, 2, 0, -1, 1024)` — the 1024 is maxGrains. Raising it costs server CPU per grain, so prefer halving the density if the sound does not need it."}]} +{"conversations": [{"role": "user", "content": "Why LeakDC and not a standard HPF for DC removal?"}, {"role": "assistant", "content": "SuperCollider forum — Why LeakDC and not a standard HPF for DC removal?\n\nHello everyone,\n\nI’m a bit sceptical of the DC removal implementation in LeakDC. As I understand it, DC removal is nothing but a HPF, preferably placed below the audible range. For this purpose, LeakDC seems to be reaching far too high, attenuating the audible low frequencies. You can run the following code and look at the server meter to see the difference in level between the two audio channels (note: there is of course no DC offset in this example that would need fixing):\n\n```supercollider\n( play { [\n SinOsc.ar(50),\n LeakDC.ar(SinOsc.ar(50))\n] * 0.2 } )\n```\n\nAlso, LeakDC’s behaviour is not consistent between sample rates (as is mentioned in the help file).\n\nI ran the it through Plugin Doctor to back up my suspicions and got these results:\n\nstandard coefficient of 0.995:\n\nSR 48 kHz: Filter starts rolling off at 200 Hz, -2dB at 50 Hz.\n\nSR 96 kHz: Filter starts rolling off at 500 hz! It reaches already -2dB at 100 Hz, -5 dB at 50 Hz.\n\ncoefficient of 0.999:\n\nSR 48 kHz: Filter starts rolling off at 50 Hz, -2 dB at 10 Hz.\n\nSR 96 kHz: Filter starts rolling off at 100 Hz, -2 dB at 20 Hz.\n\nI wonder why one wouldn’t just use a standard HPF at 10 Hz (or so) instead? It is consistent between sample rates, it only starts to roll of below 30 Hz and it reaches only -0.5 dB at 20 Hz. So this actually looks much better in the server meter:\n\n```supercollider\n( play { [\n SinOsc.ar(50),\n HPF.ar(SinOsc.ar(50), 10)\n] * 0.2 } )\n```\n\nSo my question is: Is there any reason why the LeakDC implementation would be peferable to such a standard butterworth HPF?\n\nOne difference I can see is that the HPF still has an initial offset spike before settling around zero phase, LeakDC does not show that behaviour:\n\n```supercollider\n{ LeakDC.ar(DC.ar(0.5)) }.plot(0.5);\n{ HPF.ar(DC.ar(0.5), 10) }.plot(0.5);\n\n{ LeakDC.ar(SinOsc.ar + DC.ar(0.5)) }.plot(0.02);\n{ HPF.ar(SinOsc.ar + DC.ar(0.5), 10) }.plot(0.02);\n```\n\nSo this could be a reason – I don’t know enough about filters to understand why this happens though. Any enlightenment would be appreciated."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar,\n Pulse.ar\n ];\n TWChoose.ar(Dust.ar(MouseX.kr(1, 1000, 1)), a, [0.99, 0.05, 0.05].normalizeSum) * 0.2\n\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar,\n Pulse.ar\n ];\n TWChoose.ar(Dust.ar(MouseX.kr(1, 1000, 1)), a, [0.99, 0.05, 0.05].normalizeSum) * 0.2\n\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Blip.ar(Latch.ar(WhiteNoise.ar, Impulse.ar(9)) * 400 + 500, 4, 0.2 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Blip.ar(Latch.ar(WhiteNoise.ar, Impulse.ar(9)) * 400 + 500, 4, 0.2) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// write a sine oscillator's output to a pin\n\n(\nSynthDef(\"help-DigitalOut\", { |out = 0|\n DigitalOut.ar(0, SinOsc.ar(10));\n}).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// write a sine oscillator's output to a pin\n\n(\nSynthDef(\"help-DigitalOut\", { |out = 0|\n DigitalOut.ar(0, SinOsc.ar(10));\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Pwrap` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Pn(\n Pwrap(\n Pgeom(200, 1.07, 96),\n 200,\n 1000.0\n ),\n inf\n);\nx = a.asStream;\n\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, x.next.debug, \\dur, 0.3]);\n 0.12.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Latch`."}, {"role": "assistant", "content": "```supercollider\n{ Blip.ar(LFNoise0.kr(9, 400, 500), 4, 0.2) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What is Ndef used for?"}, {"role": "assistant", "content": "Ndef is the JITLib node proxy: a named placeholder for a running signal chain that you can redefine while it plays. `Ndef(\\drone, { SinOsc.ar(55) * 0.1 }).play` starts it, and calling Ndef(\\drone, { ... }) again crossfades to the new definition without restarting the sound. It also supports chaining, `Ndef(\\drone)[1] = \\filter -> { |in| LPF.ar(in, 800) }`, which is the idiomatic way to build and modify a live patch."}]} +{"conversations": [{"role": "user", "content": "What are you not good at?"}, {"role": "assistant", "content": "Everything outside SuperCollider. I have no audio input, no live data, and my knowledge ends at the documentation snapshot I was trained on — so I can be confidently wrong about Quarks and new UGens."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var env = Env([0, 0.6, 0.3, 1.0, 0], [0.1, 0.02, 0.4, 1.1], [\\lin, \\exp, -6, \\sin]);\n var envgen = IEnvGen.kr(env, MouseX.kr(0, env.times.sum));\n env.plot;\n SinOsc.ar(envgen * 500 + 440)\n}.play;\n);\n\n// index with an SinOsc ... mouse controls amplitude of SinOsc\n// use offset so negative values of SinOsc will map into the Env\n(\n{\n var sin = SinOsc.ar(440, 0, MouseX.kr(0, 1));\n // use offset so negative values of SinOsc will map into the Env\n v\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var env = Env([0, 0.6, 0.3, 1.0, 0], [0.1, 0.02, 0.4, 1.1], [\\lin, \\exp, -6, \\sin]);\n var envgen = IEnvGen.kr(env, MouseX.kr(0, env.times.sum));\n env.plot;\n SinOsc.ar(envgen * 500 + 440)\n}.play;\n);\n\n// index with an SinOsc ... mouse controls amplitude of SinOsc\n// use offset so negative values of SinOsc will map into the Env\n(\n{\n var sin = SinOsc.ar(440, 0, MouseX.kr(0, 1));\n // use offset so negative values of SinOsc will map into the Env\n var env = Env([-1, -0.7, 0.7, 1], [0.8666, 0.2666, 0.8668], \\lin, offset: -1.0);\n IEnvGen.ar(env, sin) * 0.1\n}.play;\n);\n\n// index with Amplitude of input, control freq of SinOsc (uses SoundIn)\n(\n{\n var point = Amplitude.ar(SoundIn.ar(0), 0.01, 0.2);\n // use offset so negative values of SinOsc will map into the Env\n var env = Env.xyc([[0, 330, \\exp], [0.5, 440, \\exp], [1.0, 1760]]);\n SinOsc.ar(IEnvGen.kr(env, point)) * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Can I run SuperCollider without the IDE?"}, {"role": "assistant", "content": "Yes. `sclang` runs the language and `scsynth` the server, and they are separate processes by design\n— the IDE is only a client. A headless script is a `.scd` run with `sclang my-piece.scd`, and it must boot\nthe server itself:\n\n```supercollider\ns.boot;\ns.waitForBoot {\n // build SynthDefs, play, then wait\n 30.wait;\n s.quit;\n};\n```\n\nThat shape — boot, wait, play, quit, exit — is what makes a piece runnable from a cron job or a\nRaspberry Pi."}]} +{"conversations": [{"role": "user", "content": "Approaches to recording generated midi in DAW?"}, {"role": "assistant", "content": "SuperCollider forum — Approaches to recording generated midi in DAW?\n\nToday I spent another 6 hours or so trying to record in ardour (linux) both the midi information generated by supercollider and the audio generated by sending this midi to external synths. I finally hit the right combination of magic to make it work and I want to add my recipe in this thread so that I can find it back the future (and perhaps it also works for someone else).\n\nIngredient 1: a2jmidid. You can run it manually on the command line using “a2jmidid -e” or (like me) you can just use the “start midi bridge” button in the jack front-end application “Cadence” (enable the “export hardware ports checkbox”)\n\nIngredient 2: In supercollider itself, it is extremely important to only connect to a port and not to specify a destination uid. It seems that by specifying a destination uid, supercollider gets some kind of direct connection to the midi destination and ardour can no long introspect/record what is happening (I know it doesn’t sound scientific - this is purely the result of empiric observation/frustration.\n\nSo in supercollider, simply use\n\n```supercollider\n~synth1 = MIDIOut(0);\n~synth2 = MIDIOut(1);\n```\n\nand then in ardour’s Window->Midi Connections dialog, you can connect the out ports from supercollider to both your external synth and the track in which you want to record the midi information.\n\nFor midi driver in jack you can configure None.\n\nIf you want to record the generated midi in ardour, do NOT use connection syntax like\n\n```supercollider\n~synth1 = MIDIOut(0, MIDIClient.destinations[2].uid);\n```\n\nand do NOT use\n\n```supercollider\n~synth1 = MIDIOut.newByName(\"INTEGRA-7\", \"INTEGRA-7 MIDI 1\");\n```\n\nIf you just want to send midi to the external synth without recording the information, both previous ways of connecting work as well but these ways of connecting appear to work only if the jack MIDI driver is configured to use “ALSA sequencer” mode. It doesn’t seem to work with “None” or “ALSA Raw” (this may need some further investigation to clear out)."}]} +{"conversations": [{"role": "user", "content": "I get 'Node not found' when I call .set on a Synth after a while."}, {"role": "assistant", "content": "The Synth was freed and the language still holds a reference. That happens whenever the SynthDef used `doneAction: 2` and the envelope finished, or when something called `freeAll`/`CmdPeriod`. Guard it with `if (x.notNil and: { x.isPlaying }) { x.set(\\freq, 300) }`, or store the node in a variable that you clear when it ends. For sustained sounds the right pattern is a `gate` argument with `doneAction: 2` on the EnvGen, so the node lives until you release it."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// if NTMI.helloSnd is not already defined in startup file, do this:\nfork {\n NTMI.numChans.do { |i|\n { LFDNoise3.ar(\n XLine.kr(\n exprand(2000, 5000),\n exprand(2000, 20000),\n 0.25, doneAction: 2),\n 0.1\n )\n }.play(outbus: i);\n 0.25.wait;\n };\n}\n```"}, {"role": "assistant", "content": "if NTMI.helloSnd is not already defined in startup file, do this:."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Re: Re: the perfect frequencies. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\nf = {\n var rep = [4, 8, 16, 32];\n var n = rep.choose;\n var x = [\n\n 54, 60, 66, 72, 81, 90, 96, 102,\n 108, 128, 132, 144, 162, 180, 192, 204,\n 216, 240, 264, 288, 324, 360, 384, 408,\n 432, 480, 528, 576, 648, 720, 768, 816,\n 864, 960, 1056, 1152, 1296, 1440, 1536, 1632,\n 1728, 1920, 2112, 2304, 2592, 2880, 3072, 3264,\n 3456, 3840, 4224, 4608, 5184, 5760, 6144, 6528,\n 6912, 7680, 8448, 9216, 10368, 11520, 12288, 528\n\n ];\n var fac1 = [1,10,100,1000].choose;\n var fac2 = [1,10,100,1000].choose;\n var fac3 = [1,10,100,1000].choose;\n Mix.fill(n,\n {\n var detune = 5.rand;\n var saw;\n var sin;\n detune = XLine.kr(0.1,1+250.0.rand ,2+9.0.rand) * 2.0.rand* [1,-1].choose;\n sin = SinOsc.ar(x.choose * ( 1 + ( SinOsc.ar(x.choose/fac1) * x.choose/fac2 )) + detune, 4.rand, 0.25);\n saw = RLPF.ar(Saw.ar(x.choose*0.01+detune, 0.75), x.choose, 2.rand);\n saw = [\n saw,\n saw.fold2( SinOsc.ar(x.choose/fac3).range(0.1,1) ),\n saw.wrap2( SinOsc.ar(x.choose/fac3).range(0.1,1) ),\n saw * SinOsc.ar(x.choose/2),\n ( saw * SinOsc.ar(x.choose/fac3).range(1,20) ).tanh/2,\n ].choose;\n Pan2.ar((sin+saw) * EnvGen.kr(Env.sine(12, 1/n), 1, doneAction:2),\n 1.rand2) \n }\n );\n};\n);\n\n(\n// DEFINE A ROUTINE\nr = Routine({\n\n inf.do({\n f.play;\n 10.wait;\n })\n});\n);\n\nr.reset.play;\n```"}]} {"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// write a sine oscillator's output to a pin, and read the pin value at other times\n\n(\nSynthDef(\"help-DigitalIO\", { |out = 0|\n DigitalIO.ar(0, SinOsc.ar(10), LFPulse.kr(0.1)).poll;\n}).play;\n)\n```"}, {"role": "assistant", "content": "write a sine oscillator's output to a pin, and read the pin value at other times (DigitalIO: Read or write data to a digital pin)"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pmul`."}, {"role": "assistant", "content": "```supercollider\n(\nvar a, b;\na = Pmul(\\freq, 801, Pbind(\\freq, 100));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SynthDefFile.read` do? What arguments does it take?"}, {"role": "assistant", "content": "Read file with classes and synth Arguments: Specify Radicles Class.; Key to identify synth object.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nx = {\n |loDev = -1, hiDev = 1, lookBack = 2|\n var trig = Impulse.ar(7);\n // define maxLookBack, minLoDev and maxHiDev\n // source is rounded to integers here\n var midi = Demand.ar(trig, 0, DIdev(SinOsc.ar(0.2, 0, 15, 82).round, 11, -6, 5, lookBack, loDev, hiDev));\n midi.poll(7, label: \\midi);\n SinOsc.ar(midi.midicps.lag(0.007)) ! 2 * 0.1\n}.play;\n);\n\n\n// widen range and increase lookBack\n\n(\nx.set(\\loDev, -6);\nx.set(\\hiDev\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nx = {\n |loDev = -1, hiDev = 1, lookBack = 2|\n var trig = Impulse.ar(7);\n // define maxLookBack, minLoDev and maxHiDev\n // source is rounded to integers here\n var midi = Demand.ar(trig, 0, DIdev(SinOsc.ar(0.2, 0, 15, 82).round, 11, -6, 5, lookBack, loDev, hiDev));\n midi.poll(7, label: \\midi);\n SinOsc.ar(midi.midicps.lag(0.007)) ! 2 * 0.1\n}.play;\n);\n\n\n// widen range and increase lookBack\n\n(\nx.set(\\loDev, -6);\nx.set(\\hiDev, 5);\nx.set(\\lookBack, 10);\n);\n\nx.release\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Play your (short) soundfiles with some delay that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n// By Bjørn Houdorf March 2013, Play your (short) soundfiles with some delay.\n\nb = SoundFile.collectIntoBuffers(\"yourSoundFileFolder/*\"); // 1. rund this\n\n( // 2. and then run this\nt = Task({\n({\n var num= b.size.rand;\n var buf= b[num];\n 0.1*Splay.ar(PlayBuf.ar(buf.numChannels, buf, 1, 1, 0, 0));\n}.play;\n) \n});\n);\n\n\n( // 3. Then run this\nz = Task({\nloop({\n t.start;\n 0.1.wait;\n});\n});\n);\n\n\nz.start; // 4. and run this\nz.stop; // 5. and finally run this\n```"}]} +{"conversations": [{"role": "user", "content": "What is the difference between an audio bus and a control bus?"}, {"role": "assistant", "content": "Both are numbered channels on the server used to move signal between nodes. An audio bus carries audio-rate signal and holds one or more audio channels; a control bus carries one value per block, like a parameter. You write with Out.ar / Out.kr and read with In.ar / In.kr, or with `.asMap` / `\\param, bus.asMap` to drive a Synth's control from a bus. Buses are how effects are chained: a synth writes to a private bus, the effect reads it and writes to Out.ar(0, …)."}]} +{"conversations": [{"role": "user", "content": "What does `BufferProxy.freeToBundle` do? What arguments does it take?"}, {"role": "assistant", "content": "allocates a Buffer on play Arguments: bundle."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pseq`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Pseq(#[60, 61, 63, 65, 72], inf).asStream;\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, a.next.midicps]);\n 0.2.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for gabber kick (a SuperCollider snippet) that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\gabberkick, {\n var snd;\n snd = SinOsc.ar(Env([1000, 69, 60], [0.015, 0.1], \\exp).ar * [-0.1, 0, 0.1].midiratio);\n snd = Mix(snd);\n snd = (snd * 10).tanh;\n snd = (snd * 5.1).atan;\n snd = BPeakEQ.ar(snd, XLine.kr(2000, 100, 0.3), 2.0, 8);\n snd = snd + DelayC.ar(snd, 0.01, SinOsc.ar(4).range(0.0, 0.001));\n snd = RLPF.ar(snd, 8000, 0.7);\n snd = snd * Env([0, 1, 0.7, 0.7, 0], [0.001, 0.01, 0.3, 0.02]).ar(2);\n snd = (snd * 0.6).clip(-1, 1);\n Out.ar(\\out.kr(0), Pan2.ar(snd, \\pan.kr(0), \\amp.kr(0.1)));\n}).add;\n);\n\nSynth(\\gabberkick, [amp: 0.6])\n```"}]} +{"conversations": [{"role": "user", "content": "What does `AbstractDispatcher.remove` do? What arguments does it take?"}, {"role": "assistant", "content": "Remove a responder func from this Arguments: funcProxy — An instance of a subclass of AbstractResponderFunc to remove.."}]} +{"conversations": [{"role": "user", "content": "What does `MxUnitApp.name` do?"}, {"role": "assistant", "content": "Name is implemented by the object driver and should usually return a useful unique readable Returns: string"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LFTri`."}, {"role": "assistant", "content": "```supercollider\n// plot:\n{ LFTri.ar(40) }.plot(0.1);\n{ LFTri.ar(XLine.kr(1, 800, 0.1)) }.plot(0.1);\n\n{ LFTri.ar(500, 0, 0.1) }.play\n\n// used as both Oscillator and LFO:\n{ LFTri.ar(LFTri.kr(4, 0, 200, 400), 0, 0.1) }.play\n\n// phase. compare\n{ LFTri.ar(LFTri.kr(0.1, iphase: 0) * 200 + 400, 0, 0.1) }.play\n{ LFTri.ar(LFTri.kr(0.1, iphase: 1) * 200 + 400, 0, 0.1) }.play\n{ LFTri.ar(LFTri.kr(0.1, iphase: 2) * 200 + 400, 0, 0.1) }.play\n{ LFTri.ar(LFTri.kr(0.1, iphase: 3) * 200 + 400, 0, 0.1) }.play\n\n// together\n{ LFTri.ar(LFTri.kr(0.05, iphase: (0..3)) * 200 + 400, 0, 0.1).sum }.play\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Standard2DL.ar(220, 11025, mul:0.3) }.play(s);\n\n// mouse-controlled param\n{ Standard2DL.ar(11025, 44100, MouseX.kr(0.9,4), mul:0.3) }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(Standard2DL.ar(10, 20, MouseX.kr(0.9,4))*800+900)*0.4 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Standard2DL.ar(220, 11025, mul:0.3) }.play(s);\n\n// mouse-controlled param\n{ Standard2DL.ar(11025, 44100, MouseX.kr(0.9,4), mul:0.3) }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(Standard2DL.ar(10, 20, MouseX.kr(0.9,4))*800+900)*0.4 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `LinkClock.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new instance of Arguments: tempo — The initial #-tempo#tempo. Defaults to `1`.; beats — The time in beats, corresponding to the reference time. Default to `0`.; seconds — The reference time in seconds. See TempoClock#*new.; queueSize — The storage size of the scheduling queue. See TempoClock#*new.."}]} +{"conversations": [{"role": "user", "content": "What does `UChain.fadeOut` do? What arguments does it take?"}, {"role": "assistant", "content": "Set fade out Arguments: fadeOut — A Float bigger then zero.."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `JITGui`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// typically, only subclasses of JITGui are used,\n // so here are just some basic usage and layout tests\n\n // make its own window - defPos, minSize is used\ng = JITGui(Ndef(\\a));\n\n // make its own window, specific size\ng = JITGui(Ndef(\\a), bounds: 390@20);\n\n // provide full bounds\ng = JITGui(Ndef(\\a), bounds: Rect(200, 500, 390, 24));\n\n // extent is 0@0: minSize x, y is used\ng = JITGui(Ndef(\\a), bounds: Rect(200, 500, 0, 0));\ng = JITGui(Ndef(\\a), bounds: Rect(200, 500, 0, 50));\ng = JITGui(Ndef(\\a), bounds: Rect(200, 500, 500, 0));\n\n\n( // put a JITGui in an existing window:\nw = Window().front;\ng = JITGui(Ndef(\\a), 0, w, bounds: 300@48);\n);\n\n( // 5 lines high\nw = Window().front;\ng = JITGui(Ndef(\\a), 5, w);\n);\n\n( // recommended: use a FlowLayout.\nw = Window().front;\nw.addFlowLayout;\nEZSlider(w, 300@100, \\test, []);\ng = JITGui(Ndef(\\a), 0, w, bounds: 300@40);\n);\n\n// test changing color schemes for JITguis\n// this scheme is admittedly ugly but different\n\nGUI.skins.put(\\jit, (\n fontSpecs: [\"Inconsolata\", 12],\n fontColor: Color.white,\n background: Color(0.2, 0.85, 0.7, 0.5),\n foreground: Color.grey(0.1),\n onColor: Color(0.5, 0, 0.5),\n onColor2: Color(0.0, 0.5, 0.5),\n offColor: Color.grey(0.2, 0.5),\n hiliteColor: Color.green(1.0, 0.5),\n gap: 0 @ 0,\n margin: 2@2,\n buttonHeight: 18,\n headHeight: 24)\n);\n\n// make some JITGuis to check\nn = NdefGui(Ndef(\\a));\nNdef(\\a, { SinOsc.ar(\\freq.kr(250)) });\nNdef(\\a).clear;\nn = NdefMixer(s);\n\nTdefAllGui();\nTdef(\\a).set(\\amp, 0.25);\nTdefGui(Tdef(\\a), 5);\n\nEnvirGui((a: 123));\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Warp1`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\nb.free;\nb = Buffer.read(s, ExampleFiles.apollo11);\n{\n var pointer = Phasor.ar(0, SampleDur.ir / BufDur.ir(b) * XLine.kr(1, 0.25, 20));\n var sound = Warp1.ar(1, b, pointer, 1, 0.3, -1, 16, Line.kr(0, 1, 40), 4);\n Pan2.ar(sound, pointer * 2 - 1, 0.25)\n}.play\n);\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `AmpComp.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Basic psychoacoustic amplitude compensation. Arguments: freq — Input frequency value. For freq == root, the output is 1.0.; root — Root freq relative to which the curve is calculated (usually lowest freq).; exp — Exponent: how steep the curve decreases for increasing freq.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nDelayN.ar(z, 0.2, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\n(\n// recursive application of delay.\n{\nz = Decay2.ar(Dust.ar(1, 0.5), 0.01, 0.1, Saw.ar(100 + [0, 1]));\n5.do { |i| z = DelayN.ar(RLPF.ar(z, Rand(100, 3000), 0.03), 1, 1 / (2**i), 1, z * 0.5) };\nz\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nDelayN.ar(z, 0.2, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\n(\n// recursive application of delay.\n{\nz = Decay2.ar(Dust.ar(1, 0.5), 0.01, 0.1, Saw.ar(100 + [0, 1]));\n5.do { |i| z = DelayN.ar(RLPF.ar(z, Rand(100, 3000), 0.03), 1, 1 / (2**i), 1, z * 0.5) };\nz\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `DiskIn`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n\n\n// create with cueSoundFile class method\nb = Buffer.cueSoundFile(s, ExampleFiles.apollo11, 0, 1);\nx = { DiskIn.ar(1, b) }.play;\nb.close; // must call close in between cueing\n// now use like named instance method, but different arguments\nb.cueSoundFile(ExampleFiles.apollo11);\n// have to do all this to clean up properly!\nx.free; b.close; b.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `PLbindef`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n// synthdefs to play with\n\n(\nSynthDef(\\noise_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, rq = 0.1, amp = 0.1|\n var sig = { WhiteNoise.ar } ! 2;\n sig = BPF.ar(sig, freq, rq) *\n EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2) *\n (rq ** -1) * (250 / (freq ** 0.8));\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\sin_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { SinOsc.ar(freq, Rand(0, 2pi)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\saw_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { VarSaw.ar(freq, Rand(0, 1)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a random pentatonic melody that plays by itself."}, {"role": "assistant", "content": "Pick degrees from a pentatonic scale; `\\scale` and `\\root` define the pitch space, and `\\degree`\npicks within it.\n\n```supercollider\n(\nPbind(\n \\instrument, \\default,\n \\scale, Scale.minorPentatonic,\n \\root, 3,\n \\degree, Pwhite(0, 9, inf),\n \\octave, 5,\n \\dur, Pwhite(0.12, 0.28, inf),\n \\amp, 0.2,\n \\legato, 0.8\n).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns.waitForBoot({\n var fftsize = 16384;\n b = Buffer.alloc(s, fftsize)\n})\n);\n\n\n(\nx = {\n // Any input should theoretically be OK, white noise is a good choice\n var son = WhiteNoise.ar;\n// var son = Impulse.ar;\n var out = LPF.ar(son, MouseX.kr(100, 10000, 1));\n var fft1 = FFT(LocalBuf(b.numFrames), son, wintype: 1);\n var fft2 = FFT(b, out, wintype: 1);\n\n // As with most PV_ ugens, the result is *actually* stored in the first fft buf\n var result = PV_Div(fft2, fft1\n// …\n```"}, {"role": "assistant", "content": "Any input should theoretically be OK, white noise is a good choice var son = Impulse.ar; (PV_Div: Complex division)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nc = Condition.new(false);\n\nRoutine {\n 1.wait;\n \"waited for 1 second\".postln;\n 1.wait;\n \"waited for another second, now waiting for you ... \".postln;\n c.wait;\n \"the condition has stopped waiting.\".postln;\n 1.wait;\n \"waited for another second\".postln;\n \"waiting for you ... \".postln;\n c.test = false;\n c.wait;\n \"the condition has stopped waiting.\".postln;\n 1.wait;\n \"the end\".postln;\n}.play;\n);\n\n// continue\n(\nc.test = true;\nc.signal;\n);\n\n// a typical use is a routine that can pause under certain conditions:\n(\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nc = Condition.new(false);\n\nRoutine {\n 1.wait;\n \"waited for 1 second\".postln;\n 1.wait;\n \"waited for another second, now waiting for you ... \".postln;\n c.wait;\n \"the condition has stopped waiting.\".postln;\n 1.wait;\n \"waited for another second\".postln;\n \"waiting for you ... \".postln;\n c.test = false;\n c.wait;\n \"the condition has stopped waiting.\".postln;\n 1.wait;\n \"the end\".postln;\n}.play;\n);\n\n// continue\n(\nc.test = true;\nc.signal;\n);\n\n// a typical use is a routine that can pause under certain conditions:\n(\nc = Condition.new;\nfork { loop { 1.wait; \"going\".postln; c.wait } };\n);\nc.test = true; c.signal;\nc.test = false;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LFDNoise1`."}, {"role": "assistant", "content": "```supercollider\n// try wiggling mouse quickly;\n// LFNoise frequently seems stuck, LFDNoise changes smoothly.\n\n{ SinOsc.ar(LFNoise1.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n{ SinOsc.ar(LFDNoise1.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFNoise1.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n\n{ LFDNoise1.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n~pad = Synth(\\pad, [\\freq, 165]);\n~pad.set(\\gate, 0);\n```"}, {"role": "assistant", "content": "It starts a sustained synth and then releases it.\n\n`Synth(\\pad, [\\freq, 165])` creates an instance of a SynthDef that takes a `gate` argument (default 1). The\narray after the name is alternating argument names and values: `\\freq, 165`. Setting `\\gate` to 0 does not\ncut the sound dead — the EnvGen inside sees the gate close and runs the release stage of its Env, then frees\nthe Synth because that EnvGen has `doneAction: 2`. This is the standard lifecycle for pads, drones and any\nsound you want to stop gracefully."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot\n\n{ Ringz.ar(PinkNoise.ar([0.1, 0.2]).scope(\\pink), 2000, 1, 0.25 }.play; // multichannel works\ns.scope; // can still separately scope the output of the server\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot\n\n{ Ringz.ar(PinkNoise.ar([0.1, 0.2]).scope(\\pink), 2000, 1, 0.25) }.play; // multichannel works\ns.scope; // can still separately scope the output of the server\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//spinning box / cube\n//after Shiffman https://codingtrain.github.io/website-archive/CodingChallenges/112-3d-rendering.html\n\n(\nvar width= 640, height= 480, w,\ntheta= 0, speed= 0.01, box;\n\nw= RedWindow(\"3Dbox\", Rect(128, 64, width, height)).front;\nbox= Red3DBox();\n\n//--loop\nw.draw{\n theta= theta+speed;\n box.rotation= RedVector3D[theta, theta, theta];\n box.update;\n\n //--render\n box.render(1, 100); //1= exaggerate, 2= standard\n Pen.translate(width*0.5, height*0.5);\n Pen.strokeColor= Color.white;\n box.drawOutlines;\n Pen.fillColor= Color.white;\n box.draw;\n};\nw.play;\nCmdPeriod.doOnce({w.close});\n)\n```"}, {"role": "assistant", "content": "spinning box / cube after Shiffman https://codingtrain.github.io/website-archive/CodingChallenges/112-3d-rendering.html."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nSynthDef(\\bird,{\n var sig, freqenv, env, trig;\n trig = Dust.ar(2);\n env = EnvGen.ar(Env.perc(0.01,0.4,0.8,-8), trig, doneAction: 2);\n freqenv = EnvGen.ar(Env([Rand(1000,3000), Rand(3000,6000), Rand(1000,2000), Rand(2000,5000)],[0.1,0.01,0.1]);, trig);\n sig = SinOsc.ar(freqenv, 0, env);\n sig = Pan2.ar(sig, Rand(-1.0,1.0));\n Out.ar(0, sig);\n}).add;\n);\n\n(\nRoutine({\n inf.do({\n Synth(\\bird);\n rrand(1.0,2.0).wait;\n })\n}).play;\n)\n```"}, {"role": "assistant", "content": "I haven't found a quite satisfying code about birds, so here's a very simple SynthDef to start with."}]} +{"conversations": [{"role": "user", "content": "What is `ControlPatchIn` in SuperCollider?"}, {"role": "assistant", "content": "ControlPatchIn — manages a Player's input when connecting to other Players Category: Libraries > crucial > internals."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\nIdentitySet[1, 2, 3].add(4);\nIdentitySet[1, 2, 3].add(3);\n// the two strings are equal but not identical\nIdentitySet[\"abc\", \"def\", \"ghi\"].add(\"def\");\n// symbols are guaranteed to be identical if they are equal\nIdentitySet['abc', 'def', 'ghi'].add('def');\nIdentitySet['abc', 'def', 'ghi'].add('jkl');\n```"}, {"role": "assistant", "content": "the two strings are equal but not identical symbols are guaranteed to be identical if they are equal (IdentitySet: a set according to identity)"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `FBSineN`."}, {"role": "assistant", "content": "```supercollider\n// default initial params\n{ FBSineN.ar(SampleRate.ir/4) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `KmeansToBPSet1.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "K-means Oscillator Arguments: freq — frequency of oscillator; numdatapoints — Initial number of data points; maxnummeans — Maximum number of means allowed; nummeans — current num means; tnewdata — If a trigger is received, reset source data (k-rate); tnewmeans — If a trigger is received, reset means (k-rate); soft — Proportion to soften means update. If 1.0, immediate update, 0.0 no update, proportion inbetween amount to move from the old mean position to the new mean of the allocated cluster (ie soft k-means).; bufnum — Number of a Buffer which contains positions for means and data points; see examples below."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Resonz`."}, {"role": "assistant", "content": "```supercollider\n{ Resonz.ar(WhiteNoise.ar(0.5), 2000, 0.1) }.play\n\n// modulate frequency\n{ Resonz.ar(WhiteNoise.ar(0.5), XLine.kr(1000, 8000, 10), 0.05) }.play\n\n// modulate bandwidth\n{ Resonz.ar(WhiteNoise.ar(0.5), 2000, XLine.kr(1, 0.001, 8)) }.play\n\n// modulate bandwidth opposite direction\n{ Resonz.ar(WhiteNoise.ar(0.5), 2000, XLine.kr(0.001, 1, 8)) }.play\n```"}]} {"conversations": [{"role": "user", "content": "Can you run this code and tell me if it works?"}, {"role": "assistant", "content": "No — I cannot execute SuperCollider. What I can tell you is what would break and why: bracket balance, arguments that must exist for the class, a SynthDef that never reaches Out, a SynthDef played before it is added, an envelope that frees the Synth immediately. For certainty, evaluate it: the post window reports errors precisely, and `s.plotTree` shows whether the node exists."}]} -{"conversations": [{"role": "user", "content": "SC can't open or read files?"}, {"role": "assistant", "content": "SuperCollider forum — SC can't open or read files\n\nIt looks as though it’s finally working!\n\nI moved the file to a folder I created in the user support directory for SuperCollider and then changed the quotes to ascii.\n\nI think the issue was that at first I had the file name listed without the extension, then I added the extension to the file name and added the file extension to the file path in the code and this must have created a conflict.\n\nIn the first instance SC needed the file extension, ascii quotes, and since I’m on windows the path needed double \\ in the path file.\n\nThe final working code looks like this:\n\n```supercollider\nb = Buffer.readChannel(s, \"C:\\\\Users\\\\44774\\\\AppData\\\\Local\\\\SuperCollider\\\\Tables\\\\wubsquare.wav\", startFrame:0, numFrames: -1);\n```\n\nThe wav file is simply named wubsquare and I included the file extension in the code."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes SyncSaw madness."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\fun, {\n var src, freq = 25;\n var lagTime = \\lagTime.kr(0);\n var vibrato = \\vibrato.kr([ 1.3515662384033, 1.3061940193176, 0.604791264534, 1.2328997278214, 0.33569867610931, 0.40528120040894, 1.0865307760239, 1.22394572258, 1.7781081724167, 0.15319232463837 ], lagTime);\n \n var vibRatio = \\vibRatio.kr([ 2.9047239411079, 0.39578121743921, 0.10932490532285, 0.051738858660565, 0.17840235868831, 0.024495380749894, 3.9689920754869, 4.1139229659643, 0.23327501819885, 0.97643604193256 ], lagTime);\n \n var freqVary = \\freqVary.kr([ 143.76541377614, 14.25479545154, 6.6728691888342, 58.434807398325, 154.89385962072, 34.112274650688, 3.1140823758236, 10.42040949808, 158.59959972037, 1.2163188440936 ], lagTime);\n \n \n var numSrcs = vibrato.size;\n\n src = numSrcs.collect{|i|\n var freq2 = (freq * freqVary[i]) * LFNoise2.kr(0.01).range(1, 1.5);\n     \n SyncSaw.ar(freq2, freq2 * SinOsc.ar(Line.kr(1, vibrato[i], 20) * vibRatio[i], Rand(0, 0.8)).range(pi, pi * 0.1)) * rrand(0.05, 0.1)\n };\n \n src = Splay.ar(src);\n \n}).play\n);\n\nNdef(\\fun).fadeTime = 20;\n\nNdef(\\fun).rebuild\n\n(\nNdef(\\fun).setn(\n \\lagTime, [5],\n \\vibRatio, {exprand(0.1, 3)}!10,\n \\freqVary, {exprand(1, 150)}!10,\n \\vibrato, {exprand(0.3, 3)}!10\n)\n);\n(\nNdef(\\fun).setn(\n \\lagTime, [200],\n \\vibRatio, ({exprand(0.1, 3)}!10).sort,\n \\freqVary, ({exprand(1, 150)}!10).sort,\n \\vibrato, ({exprand(0.3, 3)}!10).sort\n)\n);\n\n(\nNdef(\\fun).xsetn(\n \\lagTime, [100],\n \\vibRatio, {exprand(0.1, 3)}!10,\n \\freqVary, {exprand(1, 150)}!10,\n \\vibrato, {exprand(0.3, 3)}!10\n))\n```"}]} -{"conversations": [{"role": "user", "content": "What is `PLFSaw` in SuperCollider?"}, {"role": "assistant", "content": "PLFSaw — UGenPatterns quark library Based on LFSaw Category: Streams-Patterns-Events > UGenPatterns > Generators."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for smooth arpeggio, updated envelope (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\bass, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.perc(0.2), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `VarGui`."}, {"role": "assistant", "content": "```supercollider\np = Pbind(\\midinote, Pfunc { ~midi } + Pseq([0, 3, 5, 7], inf), \\dur, 0.2)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SCluster.getAmplitudes` do?"}, {"role": "assistant", "content": "read the amplitude control rate bus Returns: an array of floats (0.0 to 1.0)."}]} -{"conversations": [{"role": "user", "content": "Can I run SuperCollider without the IDE?"}, {"role": "assistant", "content": "Yes. `sclang` runs the language and `scsynth` the server, and they are separate processes by design\n— the IDE is only a client. A headless script is a `.scd` run with `sclang my-piece.scd`, and it must boot\nthe server itself:\n\n```supercollider\ns.boot;\ns.waitForBoot {\n // build SynthDefs, play, then wait\n 30.wait;\n s.quit;\n};\n```\n\nThat shape — boot, wait, play, quit, exit — is what makes a piece runnable from a cron job or a\nRaspberry Pi."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// hear the difference, LinPan having a slight drop in the middle (yeah, it's subtle)...\n{ LinPan2.ar(SinOsc.ar(440), Line.kr(-1, 1, 5)) }.play;\n\n// ... whereas Pan2 is more smooth\n{ Pan2.ar(SinOsc.ar(440), Line.kr(-1, 1, 5)) }.play;\n\n// other examples\n{ LinPan2.ar(PinkNoise.ar(0.4), FSinOsc.kr(2)) }.play;\n\n{ LinPan2.ar(FSinOsc.ar(800, 0, 0.1), FSinOsc.kr(3)) }.play;\n```"}, {"role": "assistant", "content": "hear the difference, LinPan having a slight drop in the middle (yeah, it's subtle)... ... whereas Pan2 is more smooth (LinPan2: Two channel linear pan.)"}]} -{"conversations": [{"role": "user", "content": "What does `USession.prepareAndStart` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: targets — (describe argument here). Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Collection`."}, {"role": "assistant", "content": "```supercollider\n~closet = [\\hat, \\hat, \\hat, \\coat, \\coat, \\shoe, \\shoe];\n~closet.removeAll([\\hat, \\coat, \\shoe, \\shoe]); // Doesn't empty the closet, just removes what we wanted to\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `SawDPW` in SuperCollider briefly."}, {"role": "assistant", "content": "SawDPW — super-efficient sawtooth oscillator with low aliasing A sawtooth oscillator using the \"Differentiated Parabolic Wave\" technique, which suppresses aliasing at a wide range of frequencies, yet is about 3 times as CPU-efficient as SuperCollider's Saw ugen. Category: UGens > Generators."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pgate`."}, {"role": "assistant", "content": "```supercollider\n// Use \\step to change the octave randomly\n(\nPbind(\n \\degree, Pseq((0..7), inf),\n \\step, Pseq([false, false, false, true, false, true, false], inf),\n \\octave, Pgate(Pwhite(3, 7), inf, \\step),\n \\dur, 0.2\n).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `SGlissAmplitudes` in SuperCollider briefly."}, {"role": "assistant", "content": "SGlissAmplitudes — control SGliss amplitudes Amplitude control for LINKClasses/SGliss. Category: SInstruments."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n//var board= CytonSerial(\"/dev/tty.usbserial-DM00DRM0\", initAction: {|b| b.start});\nvar board= SyntheticData(initAction: {|b| b.start});\n~board= board;\n);\n\n~board.accelAction= {|xyz| xyz.postln}; //start posting synthetic accelerometer data\n\n~board.stop;\n~board.start;\n~board.close;\n```"}, {"role": "assistant", "content": "var board= CytonSerial(\"/dev/tty.usbserial-DM00DRM0\", initAction: {|b| b.start}); (SyntheticData: for generating synthetic test data coming from a board)"}]} -{"conversations": [{"role": "user", "content": "What is Env.perc and what does it take?"}, {"role": "assistant", "content": "`Env.perc(attackTime, releaseTime, level, curve)` — an attack to `level` (default 1) then a decay to zero, with curve defaulting to -4 (an exponential-ish decay). `Env.perc(0.01, 1)` is the default percussive envelope, and it is a complete Env, not a generator: pair it with EnvGen to hear it."}]} -{"conversations": [{"role": "user", "content": "What does `LineLayout.insert` do? What arguments does it take?"}, {"role": "assistant", "content": "Insert an item at a specific Arguments: item — The item can be a view, a layout, an Integer (specifying amount in pixels of empty space) or nil (for stretchable empty space).; index — The integer position among current items at which to insert the new item. If index is smaller than 0 or larger than the current amount of items, the new item will always be added to the end of the line.; stretch — An integer stretch factor.; align — A symbol expressing the alignment. See gui_alignments for possible values.."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `SelectXFocus`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a;\n a = [\n Saw.ar(LFSaw.kr(3 * [1, 1.01], 0, 100, 230)),\n SinOsc.ar,\n Pulse.ar(LFPulse.kr(3 * [1, 1.02], 0, 0.4, 100, 230)),\n SinOsc.ar(SinOsc.kr(4 * [1, 1.03], 0, 200, 300))\n ];\n\n SelectXFocus.ar(MouseX.kr(0, 1) * a.size, a, MouseY.kr(0, a.size)) * 0.2\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `QtGUI.style` do?"}, {"role": "assistant", "content": "Gets or sets the current GUI style. The given style must be a String"}]} -{"conversations": [{"role": "user", "content": "What is `AbstractServerAction`?"}, {"role": "assistant", "content": "AbstractServerAction — register actions to be taken for a server"}, {"role": "user", "content": "What does `AbstractServerAction.functionSelector` do?"}, {"role": "assistant", "content": "Subclasses return specific function selectors for objects that implement this as interface. Selectors are:"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// ServerBoot\ns.boot;\nf = { |server| \"------------The server '%' has booted.------------\\n\".postf(server) };\nServerBoot.add(f, \\default);\ns.quit; // quit the server and observe the post\ns.boot;\nServerBoot.remove(f, \\default); // remove it again\ns.quit;\ns.boot; // no post.\nServerBoot.add(f, Server.internal);\nServer.internal.quit;\nServer.internal.boot;\nServerBoot.removeAll; // clear all\n```"}]} -{"conversations": [{"role": "user", "content": "How do I make a piece reproducible instead of a different take every time?"}, {"role": "assistant", "content": "Three things make a SuperCollider piece repeatable: a fixed seed, a fixed tempo, and no live input.\n\n```supercollider\n(\nthisThread.randSeed = 1234;\nTempoClock.default.tempo = 2;\nPbind(\\degree, Pwhite(0, 7, inf), \\dur, 0.25).play;\n)\n```\n\n`thisThread.randSeed` fixes the random sequence of the current thread, so `Pwhite`, `Prand` and friends give\nthe same values again. Recording with `s.record(path, duration: 30)` then makes the take an artifact rather\nthan a performance. Input from `MouseX` or a MIDI controller is the usual remaining source of difference."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes BD with ringing BPF."}, {"role": "assistant", "content": "```supercollider\n// BD with ringing BPF\n\n(\nSynthDef.new(\\bazedrum,\n {\n arg out = 0, outlevel=0.5, freq = 50, wet=0.5, q = 220, clicklevel =0, decaytrig = 0.1,\n decayfreq = 0.21, mulfreq =2 , decayamp = 1, dist = 17;\n\n var envtrig, envfreq, envamp, trigger,click, sig;\n\n envtrig = EnvGen.ar(Env.perc(1/10**5, decaytrig, 1, -9));\n envfreq = EnvGen.kr(Env.perc(0.003, decayfreq, mulfreq, -5));\n envamp = EnvGen.kr(Env.perc(0.003, decayamp,1, 2),doneAction:2);\n freq = freq * (1 + envfreq);\n trigger = envtrig*HPF.ar(PinkNoise.ar,40)+(envtrig*2);\n click = HPF.ar(envtrig*WhiteNoise.ar,2000*(1-envtrig),clicklevel);\n sig = BPF.ar(trigger, freq,1/q, sqrt(q)*5);\n sig = sig + click;\n\n sig = LeakDC.ar(sig* envamp,0.996);\n\n sig = Balance2.ar(sig,(sig*dist).tanh/3,(wet*2)-1);\n\n sig = Mix.ar(sig/2)*outlevel;\n\n out = 0;\n Out.ar(out, sig!2);\n }\n ).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// create a window for a given Ndef\nNdef(\\sound).edit\n(\nNdef(\\sound, { |freq = 440, rate = 2|\n SinOsc.ar(freq * [1, 1.625]) * SinOsc.kr(rate).max(0) * 0.2\n}).play;\n);\n\n// set lags for controls:\nNdef(\\sound).lag(\\freq, 0.2, \\rate, 0.5);\nNdef(\\sound).clear(1);\n\n// create a mixer for all Ndefs:\nNdefMixer(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// create a window for a given Ndef\nNdef(\\sound).edit\n(\nNdef(\\sound, { |freq = 440, rate = 2|\n SinOsc.ar(freq * [1, 1.625]) * SinOsc.kr(rate).max(0) * 0.2\n}).play;\n);\n\n// set lags for controls:\nNdef(\\sound).lag(\\freq, 0.2, \\rate, 0.5);\nNdef(\\sound).clear(1);\n\n// create a mixer for all Ndefs:\nNdefMixer(s);\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n//listen to x and y output\n{Out.ar(0,Brusselator.ar(Impulse.kr(MouseY.kr(1,50,'exponential')),MouseX.kr(0.01,1,'exponential')))}.play\n\n//avoid DC offset (default gamma is 1.0, listening to x only, so take off gamma\n{Out.ar(0,Pan2.ar((Brusselator.ar(Impulse.kr(MouseY.kr(1,50,'exponential')),MouseX.kr(0.01,1,'exponential')))[0] - 1.0) )}.play\n\n\n//fun time, stable oscillation with these parameters\n{var mu = MouseY.kr(1.0,1.5); Out.ar(0,Pan2.\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n//listen to x and y output\n{Out.ar(0,Brusselator.ar(Impulse.kr(MouseY.kr(1,50,'exponential')),MouseX.kr(0.01,1,'exponential')))}.play\n\n//avoid DC offset (default gamma is 1.0, listening to x only, so take off gamma\n{Out.ar(0,Pan2.ar((Brusselator.ar(Impulse.kr(MouseY.kr(1,50,'exponential')),MouseX.kr(0.01,1,'exponential')))[0] - 1.0) )}.play\n\n\n//fun time, stable oscillation with these parameters\n{var mu = MouseY.kr(1.0,1.5); Out.ar(0,Pan2.ar(Brusselator.ar(0.0,MouseX.kr(0.01,0.1,'exponential'),mu,0.25)[0] ) )}.play\n\n\n{ Out.ar(0,Pan2.ar(Brusselator.ar(Impulse.kr(10),MouseX.kr(0.01,0.1,'exponential'),1.5,0.25,MouseY.kr(-1.0,1.0),0.0)[0]) )}.play\n\n\n{ Out.ar(0,Brusselator.ar(Impulse.kr(MouseY.kr(1,500,'exponential')),MouseX.kr(0.01,0.1,'exponential'),1.15,0.5,0.5,1.0) )}.play\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nd = SynthDef(\\tone, { |out = 0, freq = 200|\n var sig;\n\n freq.spec = ControlSpec(20, 20000);\n sig = SinOsc.ar(freq);\n\n Out.ar(out, sig);\n}).add;\n;\n\nd.specs.freq.postln;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nd = SynthDef(\\tone, { |out = 0, freq = 200|\n var sig;\n\n freq.spec = ControlSpec(20, 20000);\n sig = SinOsc.ar(freq);\n\n Out.ar(out, sig);\n}).add;\n);\n\nd.specs.freq.postln;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `MxUnitApp.copy` do? What arguments does it take?"}, {"role": "assistant", "content": "Copies the unit to a specific point, overwriting anything that might be Arguments: toPoint — destination point. Returns: new unit"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Association`."}, {"role": "assistant", "content": "```supercollider\n// associations can be a good way to store named data in order:\n(\na = [\\x -> 700, \\y -> 200, \\z -> 900];\n\nfork {\n a.do { |assoc|\n assoc.key.postln;\n assoc.value.postln;\n (freq: assoc.value).play;\n 2.wait;\n }\n};\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `LFDNoise3` in SuperCollider?"}, {"role": "assistant", "content": "LFDNoise3 — Dynamic cubic noise Similar to LFNoise2, it generates polynomially interpolated random values at a rate given by the `freq` argument, with 3 differences: Category: UGens > Generators > Stochastic."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// shifting a 100Hz tone by 1 Hz rising to 500Hz\n{ FreqShift.ar(SinOsc.ar(100), XLine.kr(1, 500, 5), 0, [0.1, 0.1]) }.play(s);\n\n// shifting a complex tone by 1 Hz rising to 500Hz\n{ FreqShift.ar(Klang.ar(`[[101, 303, 606, 808]]), XLine.kr(1, 500, 10), 0, [0.1, 0.1]) }.play(s);\n\n// modulating shift and phase\n{ FreqShift.ar(SinOsc.ar(10), LFNoise2.ar(0.3, 1500), SinOsc.ar(500).range(0, 2pi), [0.1, 0.1]) }.play(s);\n// …\n```"}, {"role": "assistant", "content": "shifting a 100Hz tone by 1 Hz rising to 500Hz shifting a complex tone by 1 Hz rising to 500Hz (FreqShift: Frequency Shifter.)"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Just going crazy with modulation."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"additivePad\", \n { arg numOfCycles = 100;\n var lfo;\n var lfo2;\n var lfo3;\n lfo = SinOsc.kr([Rand(0.5,1000),Rand(0.5,1000)], 1.5pi, 0.5, 0.5);\n lfo3 = SinOsc.kr([Rand(0.1,0.5),Rand(0.1,0.5)], 1.5pi, 0.5, 0.5);\n lfo2 = SinOsc.kr([(Rand(0.5,1000) * lfo) * lfo3, (Rand(0.5,1000) * (1 - lfo)) * (1 - lfo3)], 1.5pi, 0.5, 0.5);\n Out.ar(\n 0, \n Mix.arFill(\n numOfCycles,\n { \n SinOsc.ar(\n Rand(40,1000),\n 0, \n (numOfCycles.reciprocal * 0.75) * lfo2)\n }\n ) * EnvGen.kr(Env.perc(Rand(0.1,30), Rand(0.1,30)), doneAction: 2)\n )\n }\n).send(s); \n);\n\n(\nr = Routine({\n 200.do({\n x = Synth.new(\"additivePad\"); \n 10.wait;\n });\n});\n);\n\nr.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `EnvirGui.putSpec` do?"}, {"role": "assistant", "content": "add a spec for a given key, or (if it is a global key) override a global spec with a local one: `// set a desired range and"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LinCongC`."}, {"role": "assistant", "content": "```supercollider\n// randomly modulate params\n(\n{ LinCongC.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(0.1, 0.5, 1.4),\n LFNoise2.kr(0.1, 0.1, 0.1),\n LFNoise2.kr(0.1)\n) * 0.2 }.play(s);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Bag`?"}, {"role": "assistant", "content": "Bag — Unordered collection of objects"}, {"role": "user", "content": "What does `Bag.new` do?"}, {"role": "assistant", "content": "Creates a Bag with an initial capacity for n objects."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nBag[1, 2, 3].add(4).postln;\n\nBag[1, 2, 3].add(3).postln;\n\nBag[\"abc\", \"def\", \"ghi\"].add(\"jkl\").postln;\n\nBag[\"abc\", \"def\", \"ghi\"].add(\"def\").postln;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// try wiggling mouse quickly;\n// LFNoise frequently seems stuck, LFDNoise changes smoothly.\n\n{ SinOsc.ar(LFNoise1.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n{ SinOsc.ar(LFDNoise1.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFNoise1.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n\n{ LFDNoise1.ar(XLine.kr(2000, 20000, 8), 0.1 }.scope;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// try wiggling mouse quickly;\n// LFNoise frequently seems stuck, LFDNoise changes smoothly.\n\n{ SinOsc.ar(LFNoise1.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n{ SinOsc.ar(LFDNoise1.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFNoise1.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n\n{ LFDNoise1.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nSynthDef(\\pluck, {|freq = 440, dur = 1|\nvar klang,note;\ndur = dur * 2;\nnote = freq.cpsmidi;\nnote = note + (LFNoise2.ar(20).range(-1,1) * (1/8));\nklang = SinOsc.ar((note * [1,1.002]).midicps, phase: VarSaw.ar(note.midicps, width: Line.ar(1,0.2,dur))) * 0.3;\nklang = klang * XLine.ar(1,1/10000,dur,doneAction:2);\nOut.ar(0, klang);\n}).store;\n\nPbind(\n\\instrument, \\pluck,\n\\degree, Pn(Pseries(0, Pwrand([Pwhite(-3,3,inf).round(1),1],[32,1],inf), 4),inf)-1 + [0,2,-1,-14],\n\\dur, Pseq([4, [5,2,1]].convertRhythm / 2, inf),\n\\strum, Pwhite(0,1/8,inf),\n\\octave, [5,6]\n).play;\n```"}, {"role": "assistant", "content": "A synthdef and simple pbind to play some (pretty repetitive) bebop-ish arpeggios. The conjunction reminds me a bit of James Blake."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Custom event type for wiring up effects?"}, {"role": "assistant", "content": "```supercollider\n(\n// add custom event\nEvent.addEventType(\\nbind, {arg server;\n\n var id = (currentEnvironment[\\ndef] ? currentEnvironment[\\instrument]).asSymbol;\n var type = \\note;\n\n if (Ndef(id).isPlaying.not) {\n Ndef(id).play;\n };\n\n ~type = type;\n ~group = Ndef(id).group;\n ~out = Ndef(id).bus;\n\n currentEnvironment.play;\n});\n\n// synth\nSynthDef(\\synth1, {arg freq = 440, out = 0;\n \n var env = Env.perc.kr(doneAction:2);\n var sig = SinOscFB.ar(freq * [1, 1.01], 0.7);\n sig = sig * env;\n OffsetOut.ar(out, Splay.ar(sig));\n \n}).add;\n\n// set up first set of fx\nNdef(\\fx1).play;\nNdef(\\fx1)[0] = \\filter -> {arg in;\n in.abs;\n};\n\n// set up additional fx\nNdef(\\fx2).play;\nNdef(\\fx2)[0] = \\filter -> {arg in;\n in + AllpassC.ar(in, 0.2, 0.2, [3, 5]);\n};\n\n);\n\n// play a pattern\nPbind(\\instrument, \\synth1, \n // specify custom event type\n \\type, \\nbind, \n // switch between fx\n \\ndef, Pseq([\\fx1, \\fx2], inf),\n \\degree, Pwhite(0, 5, inf)\n).play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `ListView.selectionMode` do? What arguments does it take?"}, {"role": "assistant", "content": "The allowed mode of item selection, according to the following Arguments: One of the Symbols listed in the table above.."}]} -{"conversations": [{"role": "user", "content": "What is `KDRMaskTester` in SuperCollider?"}, {"role": "assistant", "content": "KDRMaskTester — KeyCodeResponder utility for comparing modifier masks Category: Libraries > crucial > GUI > internals."}]} -{"conversations": [{"role": "user", "content": "What does `SoundFile.writeData` do? What arguments does it take?"}, {"role": "assistant", "content": "Writes the rawArray to the sample data of the file. You must have already called Arguments: rawArray — The raw array must be a FloatArray or Signal, with all values between -1 and 1 to avoid clipping during playback. `(`."}]} -{"conversations": [{"role": "user", "content": "What does `Collection.asPairs` do? What arguments does it take?"}, {"role": "assistant", "content": "Answer an array with alternating key value pairs, like `[\\freq, 1848, \\amp, 0.2]`. This is part of the Key-Value-Pairs Arguments: class — The class of the collection to be returned. By default this is an Array.."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BufRateScale`."}, {"role": "assistant", "content": "```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n(\nx = { |rate = 1|\n BufRd.ar(1, b, Phasor.ar(0, BufRateScale.kr(b) * rate, 0, BufFrames.kr(b)))\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// Since the allpass delay has no audible effect as a resonator on\n// steady state sound ...\n\n{ AllpassL.ar(WhiteNoise.ar(0.1), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// ...these examples add the input to the effected sound and compare variants so that you can hear\n// the effect of the phase comb:\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassN.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2)\n}.play)\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassL.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2\n// …\n```"}, {"role": "assistant", "content": "Since the allpass delay has no audible effect as a resonator on steady state sound ... (AllpassL: Schroeder allpass delay line with linear interpolation.)"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// without any modification, convert FFT chain (frequency domain signal) back to audio (time domain signal)\n(\n{ var in, chain;\n in = WhiteNoise.ar;\n chain = FFT(LocalBuf(2048), in);\n IFFT.ar(chain) * -20.dbamp // inverse FFT\n}.play;\n)\n```"}, {"role": "assistant", "content": "without any modification, convert FFT chain (frequency domain signal) back to audio (time domain signal) (IFFT: Inverse Fast Fourier Transform)"}]} -{"conversations": [{"role": "user", "content": "What is `Object`?"}, {"role": "assistant", "content": "Object — abstract superclass of all objects"}, {"role": "user", "content": "What does `Object.readArchive` do?"}, {"role": "assistant", "content": "Read in an object from a text archive. `(`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// embedding an event\na = (z: 77);\nb = Pset(\\y, 8, a.streamArg(true)).asStream;\nc = Pset(\\y, 8, a.streamArg(false)).asStream;\nb.nextN(3, ()); // this ends\nc.nextN(3, ()); // this loops\n\n// embedding a pattern\na = Pbind(\\note, Pseq([1, 2]));\nb = Pset(\\y, 8, a.streamArg(true)).asStream;\nc = Pset(\\y, 8, a.streamArg(false)).asStream;\nb.nextN(3, ()); // this ends\nc.nextN(3, ()); // this ends, too\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Object.nextN` do? What arguments does it take?"}, {"role": "assistant", "content": "Returns an array with the results of calling #-next a given number of Arguments: n — Number of message calls; inval — argument passed to the next message `Routine { inf.do { |i| i.rand.yield } }.nextN(8)`."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `NodeControl`."}, {"role": "assistant", "content": "```supercollider\nd = SynthDef(\"help-NodeControl\", { |out = 0, freq = 400|\n Out.ar(out,\n SinOsc.ar(freq, 0, 0.5)\n )\n});\ny = d.play; // the synth\n\nc = NodeControl(y, 1);\n\nc.value = 500;\n\nc.value = 300;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// play SinOscs silently and wait for granulation envelopes\n\n(\na = Bus.audio(s, 10);\nx = { Splay.ar(In.ar(a, 10) * SinOsc.ar((3..12) * 100, 0, 0.05)) }.play\n);\n\n// send envelope to buses in parallel\n\n(\nz = {\n DXEnvFanOut.ar(\n [0, 3] + Dseq((0..3) + a.index, inf) + Diwhite(0, 3),\n \n // with newer SC versions you can also write:\n // [0, 3] + Dseq((0..3), inf) + Diwhite(0, 3) + a.index,\n \n fadeTime: 0.05,\n width: 1,\n initOutOffset: -0.5\n )\n// …\n```"}, {"role": "assistant", "content": "play SinOscs silently and wait for granulation envelopes send envelope to buses in parallel (DXEnvFanOut: sends crossfade envelopes to out buses according to demand-rate control)"}]} -{"conversations": [{"role": "user", "content": "What does `OSCSched.xschedAtTime` do? What arguments does it take?"}, {"role": "assistant", "content": "scheduling utility for just-in-time scheduling of OSC bundles Arguments: atTime — see atTime; server; bundle."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Pmulpre`."}, {"role": "assistant", "content": "```supercollider\n(\nvar a, b;\na = Pmulpre(\\freq, 801, Pset(\\freq, 500, Pbind(\\dur, 0.2)));\nx = a.asStream;\n9.do({ x.next(Event.default).postln });\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes danger loud click."}, {"role": "assistant", "content": "```supercollider\n// proceed with caution. start at min volume, and not with your expensive speakers.\n\nfork{b=Buffer.alloc(s,512,1);inf.do{b.cheby({[1,0].choose}!2);{(Shaper.ar(b,SinOsc.ar(55,0,Line.kr(1,0,2,1,0,2))))!2}.play;0.1.wait;}};\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `Pbjorklund` in SuperCollider briefly."}, {"role": "assistant", "content": "Pbjorklund — Euclidean Algorithm for generating traditional musical rhythms After an algorithm by E. Bjorklund. See paper by Godfried Toussaint. Category: Streams-Patterns-Events > Patterns > List."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ng = Group.new;\nx = Array.fill(5, { Synth(\\default) });\ns.queryAllNodes;\ns.reorder(x, g, \\addToTail;\ns.queryAllNodes;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ng = Group.new;\nx = Array.fill(5, { Synth(\\default) });\ns.queryAllNodes;\ns.reorder(x, g, \\addToTail);\ns.queryAllNodes;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BufDur`."}, {"role": "assistant", "content": "```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n{ BufRd.ar(1, b, Sweep.ar(Impulse.ar(BufDur.kr(b).reciprocal), BufSampleRate.kr(b))) }.play;\n\nb.free\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SimpleNumber.sphHankel2` do?"}, {"role": "assistant", "content": "Returns the result of the spherical Hankel functions of the second"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n/* Audio plugin definition\n\n Each audio plugin should define the following global variables:\n ~name: (symbol) name of the spatializer\n ~description: (string) a short description\n ~function: the actual definition of the plugin\n\n*/\n\n~name = \\PinkSin;\n~description = \"Mix of pink noise and sine wave\";\n~channelLayout = \\mono;\n\n~function = {| sfreq = 200, amp = 1 |\n amp*(PinkNoise.ar() + FSinOsc.ar(sfreq))\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n~mdef =\n{\n |key, func, msgNum, permanent = true|\n\n MIDIdef(key, func ?? { MIDIdef(key).func }, msgNum ? MIDIdef(key).msgNum, MIDIdef(key).chan, MIDIdef(key).msgType, MIDIdef(key).srcID).permanent_(permanent)\n}\n```"}, {"role": "assistant", "content": "Change arg values of MIDIdef after instantiation (a SuperCollider snippet)."}]} -{"conversations": [{"role": "user", "content": "Where does the magic frequency 261.6255653006 come from?"}, {"role": "assistant", "content": "SuperCollider forum — Where does the magic frequency 261.6255653006 come from?\n\nThinking about this a bit more, on one hand it might be useful if set (and everything else in Event) could fetch not only the msgFunc from the synthDesc, which it does (if args are set to []), but perhaps also the default values for the synth controls... and then used those in preference to Event defaults if “nothing is specified” for some key in the event. Alas “nothing is specified” is tedious to detect in Event, as it does its own calculations which have a lot of inputs (esp. for the frequency stuff). So, one could implement such a policy more explicitly in a \\finish callback that e.g. looks up in synthDesc only specific keys (say specified in a defArgs, possibly with [] meaning all found in the synthDesc) and sets only those if “not set” in event.\n\nI almost started coding this idea, but I realised that’s actually inferior to just putting the synth defaults in another event/environment, and chaining that before the event... which is exactly what I usually do with a Pdef.envir. That approach, besides sidestepping the issue of detecting what’s “not set” in the Event, has an extra advantage that a persistent set of defaults, after being initialized with the synthdef ones, can be easily tweaked in a gui. When I find myself that I often change the default value of some control like that, I go back and change the synthdef default. Because of that workflow, in which I always have the defaults loaded in an chained envir, I didn’t even have much realization of Event defaults for things like amp, freq etc. And I didn’t need type: \\set much until recently... for which getting the args constructed in that case is also rather easy as Pdef(...).controlKeys. Even without Pdefs, that’s straightforward (past loading those defaults into an event)\n\n```supercollider\ne = SynthDescLib.global.synthDescs.at(\\default).controls.inject((), { |e, c| e[c.name] = c.defaultValue });\n(instrument: \\default, dur: 1, amp: 0.2).next(e).play\n```"}]} +{"conversations": [{"role": "user", "content": "What is `CSVFileReader` in SuperCollider?"}, {"role": "assistant", "content": "CSVFileReader — file reader for comma separated data CSVFileReader reads comma-separated text files into 2D arrays line by line. Category: Files."}]} +{"conversations": [{"role": "user", "content": "What does `Process.run` do?"}, {"role": "assistant", "content": "called when the user chooses the Run menu command. Override this in class Main to do whatever you"}]} +{"conversations": [{"role": "user", "content": "What does `LastValue.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Output the last value before the input changed Arguments: in — The input signal.; diff — Difference threshold.."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LFCub`."}, {"role": "assistant", "content": "```supercollider\n{ LFCub.ar(LFCub.kr(LFCub.kr(0.2, 0, 8, 10), 0, 400, 800), 0, 0.1) }.play\n{ LFCub.ar(LFCub.kr(0.2, 0, 400, 800), 0, 0.1) }.play\n{ LFCub.ar(800, 0, 0.1) }.play\n{ LFCub.ar(XLine.kr(100, 8000, 30), 0, 0.1) }.play\n\n// compare:\n\n{ LFPar.ar(LFPar.kr(LFPar.kr(0.2, 0, 8, 10), 0, 400, 800), 0, 0.1) }.play\n{ LFPar.ar(LFPar.kr(0.2, 0, 400, 800), 0, 0.1) }.play\n{ LFPar.ar(800, 0, 0.1) }.play\n{ LFPar.ar(XLine.kr(100, 8000, 30), 0, 0.1) }.play\n\n\n{ SinOsc.ar(SinOsc.kr(SinOsc.kr(0.2, 0, 8, 10), 0, 400, 800), 0, 0.1) }.play\n{ SinOsc.ar(SinOsc.kr(0.2, 0, 400, 800), 0, 0.1) }.play\n{ SinOsc.ar(800, 0, 0.1) }.play\n{ SinOsc.ar(XLine.kr(100, 8000, 30), 0, 0.1) }.play\n\n{ LFTri.ar(LFTri.kr(LFTri.kr(0.2, 0, 8, 10), 0, 400, 800), 0, 0.1) }.play\n{ LFTri.ar(LFTri.kr(0.2, 0, 400, 800), 0, 0.1) }.play\n{ LFTri.ar(800, 0, 0.1) }.play\n{ LFTri.ar(XLine.kr(100, 8000, 30), 0, 0.1) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// Reminder: This isn't the intended typical usage! It's OK to do this though.\n(\nx = {\n var mags, phases, chain, sig;\n // Create simple undulating magnitudes\n mags = { FSinOsc.kr(ExpRand(0.1, 1)).range(0, 1) }.dup(100);\n // Then give them a \"rolloff\" to make the sound less unpleasant\n mags = mags * ((1, 0.99 .. 0.01).squared);\n // Let's turn the bins on and off at different rates, I'm *sure* that'll sound interesting\n mags = mags * { LFPulse.kr(2 ** IRand(-3, 5)).range(0, 1) }.dup(100);\n // Let's ignore phase for now\n phases = 0.\n// …\n```"}, {"role": "assistant", "content": "Reminder: This isn't the intended typical usage! It's OK to do this though. Create simple undulating magnitudes (FFTTrigger: Outputs the necessary signal for FFT chains, without doing an FFT on a signal)"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n \n// definition for future reference in arbitrary Environments,\n// Gauss distribution is not bounded, so do clip !\n\n(\np = Pbind(\n \\midinote, PLgauss(\\mean, \\dev).clip(60, 90),\n \\dur, 0.1\n);\n);\n\n// prepare current Environment\n\n(\n~mean = 75;\n~dev = 0.3;\n);\n\n\n// run\n\nx = p.play;\n\n\n// move mean value and distribution\n// PLseq defaults to repeats = inf\n\n(\n~mean = PLseq((80, 79.75..70.25));\n~dev = Pstutter(8, PLseq\n// …\n```"}, {"role": "assistant", "content": "definition for future reference in arbitrary Environments, Gauss distribution is not bounded, so do clip ! (PLgauss: dynamic scope Pgauss variant)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nt = SortedList.new(8, {|a,b| a.first < b.first });\nt.add([10, \"last\"]);\nt.add([1, \"first\"];\nt.postln;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nt = SortedList.new(8, {|a,b| a.first < b.first });\nt.add([10, \"last\"]);\nt.add([1, \"first\"]);\nt.postln;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Canvas3D.background` do? What arguments does it take?"}, {"role": "assistant", "content": "Set the background Arguments: b — A Color."}]} +{"conversations": [{"role": "user", "content": "What does `PlayerSocket.socketFreeAll` do?"}, {"role": "assistant", "content": "a player that can play other players using a cross-faded and fuse-protected socket"}]} +{"conversations": [{"role": "user", "content": "Write a kick drum in SuperCollider."}, {"role": "assistant", "content": "A pitch-swept sine with a fast decay: the frequency envelope is what makes it read as a kick.\n\n```supercollider\n(\nSynthDef(\\kick, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 50, 40], [0.03, 0.15], -4));\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -6), doneAction: 2);\n Out.ar(out, Pan2.ar(SinOsc.ar(pitch) * env * amp));\n}).add;\n);\nSynth(\\kick);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `T2A`."}, {"role": "assistant", "content": "```supercollider\n// example\n(\n{\n var trig = Impulse.kr(MouseX.kr(1, 100, 1));\n Ringz.ar(T2A.ar(trig), 800, 0.01) * 0.4\n}.play;\n);\n\n// compare with K2A\n(\n{\n var trig = Impulse.kr(200);\n [T2A.ar(trig), K2A.ar(trig)].lag(0.001)\n}.plot(10/200);\n);\n\n// removing jitter by randomising offset\n(\n{\n var trig = Impulse.kr(MouseX.kr(1, 100, 1));\n Ringz.ar(T2A.ar(trig, WhiteNoise.kr.range(0, s.options.blockSize - 1)), 800, 0.01) * 0.4\n}.play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "What are the server's default sample rate and block size?"}, {"role": "assistant", "content": "44100 Hz and 64 samples per block by default, so the control rate is 44100/64 = 689.06 Hz. You can read them from the language with `s.sampleRate` and `s.options.blockSize`, or from inside a Synth with `SampleRate.ir` and `ControlRate.ir`. A `.kr` signal therefore updates about 689 times a second, which is why it is smooth enough for filters and envelopes but not for audio-rate FM."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// randomly modulate params\n(\n{ LinCongN.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(0.1, 0.5, 1.4),\n LFNoise2.kr(0.1, 0.1, 0.1),\n LFNoise2.kr(0.1)\n) * 0.2 }.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// randomly modulate params\n(\n{ LinCongN.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(0.1, 0.5, 1.4),\n LFNoise2.kr(0.1, 0.1, 0.1),\n LFNoise2.kr(0.1)\n) * 0.2 }.play(s);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// note that the root pitch is not stored in the Scale (which should arguably be called a Mode for that reason)\n// instead you supply it at play time:\n\n// key of A\nPbind(\n \\degree, Pseq((0..7), inf), // your melody goes here\n \\scale, Scale.major, // your scale goes here\n \\root, -3 // semitones relative to 60.midicps, so this is A\n).play;\n```"}, {"role": "assistant", "content": "note that the root pitch is not stored in the Scale (which should arguably be called a Mode for that reason) instead you supply it at play time: (Scale: represents a musical scale)"}]} -{"conversations": [{"role": "user", "content": "Explain `HilbertPDNIm` in SuperCollider briefly."}, {"role": "assistant", "content": "HilbertPDNIm — Applies the Imaginary part of the Hilbert Transform to an input signal. [1] Offers the Hilbert Transform of an input signal via Weaver's Second Method,footWeaver, Donald. “A Third Method of Generation and Detection of Single-Sideband Signals.” Proceedings of the IRE, vol. 44, no. 12, 1956, pp. 1703–1705. known as Hartley Phasing,footUS Patent 1,666,206, Modulation System, April 17, 1928, United States Patent and Trademark Office. expressed as a 12th-order Phase Differenci Category: Libraries > Hilbert > Pseudo-UGens, UGens > Filters > Nonlinear."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes ~chaos2 (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\n~chaos2={\n var signal, myFrequency, frequencyMin=0.1, frequencyMax=30, myAmplitude, amplitudeMin=0.01, amplitudeMax=0.6, myPhase, phaseMin=0, phaseMax=1.5;\n myFrequency = Array.fill(2, {[rrand(frequencyMin, frequencyMax)]});\n myAmplitude = Array.fill(2, {[rrand(amplitudeMin, amplitudeMax)]});\n myPhase = Array.fill(2, {[rrand(phaseMin, phaseMax)]});\n signal = LeakDC.ar(ChaosGen.allSubclasses.choose.ar(myFrequency, myPhase, myAmplitude));\n myFrequency = (myFrequency + Array.fill(2, {[rrand(frequencyMin, frequencyMax)]})) * (signal);\n myAmplitude = (myAmplitude + Array.fill(2, {[rrand(amplitudeMin, amplitudeMax)]})) * (signal);\n myPhase = (myPhase + Array.fill(2, {[rrand(phaseMin, phaseMax)]}))* (signal);\n signal = LeakDC.ar(ChaosGen.allSubclasses.choose.ar(myFrequency, myPhase, myAmplitude));\n myFrequency = (myFrequency + Array.fill(2, {[rrand(frequencyMin, frequencyMax)]})) * (signal);\n myAmplitude = (myAmplitude + Array.fill(2, {[rrand(amplitudeMin, amplitudeMax)]})) * (signal);\n myPhase = (myPhase + Array.fill(2, {[rrand(phaseMin, phaseMax)]}))* (signal);\n signal = LeakDC.ar(ChaosGen.allSubclasses.choose.ar(myFrequency, myPhase, myAmplitude));\n Out.ar(0, LeakDC.ar(signal * 0.3));\n};\n);\n\n~chaosmegafeedback={Mix.new(~chaos2 ! 16) * 0.00000000000000000000000003}.scope;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Just experimenting with patterns."}, {"role": "assistant", "content": "```supercollider\n/* Some Funky Klangs - Totally botched the math on what I was trying to do but it sounds better this way */\n\n( \nSynthDef(\\DistKlangBlip, { \n | out = 0, release = 1, freq1 = 1, freq2 = 5, freq3 = 8, freqMult = 4 | \n var env = Linen.kr(Impulse.kr(0), 0.01, 1, release, doneAction:2); \n var freqs = ([freq1, freq2, freq3] * freqMult).midicps; \n var klang = Klang.ar(`[freqs, nil, nil ], 1, 0); \n Out.ar(out, klang.tanh!2 * env * 0.5) \n}).add\n\n);\n\n( \n Pbind(*[ \n instrument: \\DistKlangBlip, \n dur: Pxrand([0.25, 0.5], inf) * 0.5, \n release: Pkey(\\dur), \n freqMult: Pxrand((3..12), inf), \n freq2: Prand([4,5], inf), \n freq3: Prand([8,12], inf) \n]).play; \n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is a UGen graph in SuperCollider?"}, {"role": "assistant", "content": "A UGen graph is the directed acyclic graph of unit generators that a SynthDef describes: sources (SinOsc, WhiteNoise) feed processors (LPF, EnvGen, Pan2) and end at an output such as Out.ar. The language builds the graph; the server instantiates it once per Synth. A signal path is drawn by passing one UGen's output as another's input, and because UGens are multi-channel by default, the same expression can build a stereo or 8-channel graph depending on the arrays inside it."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{LPCError.ar(AudioIn.ar, MouseX.kr(1,64))}.play\n\n{LPCError.ar(SinOsc.ar(LFNoise0.kr(0.2,400,500)), MouseX.kr(1,64))}.play\n\n{LPCError.ar(Resonz.ar(Mix(Saw.ar(100*[1,0.9,0.8,0.7,0.5])),1000,0.1,2), MouseX.kr(1,64)}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{LPCError.ar(AudioIn.ar, MouseX.kr(1,64))}.play\n\n{LPCError.ar(SinOsc.ar(LFNoise0.kr(0.2,400,500)), MouseX.kr(1,64))}.play\n\n{LPCError.ar(Resonz.ar(Mix(Saw.ar(100*[1,0.9,0.8,0.7,0.5])),1000,0.1,2), MouseX.kr(1,64))}.play\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nb = Bus.audio(s, 2);\na = { |inbus = 0|\n var sig = In.ar(inbus, 2);\n // x axis is side, oriented toward right;\n // y axis is mid\n [sig[1] - sig[0], sig.sum]\n}.play(s.defaultGroup, outbus: b, addAction: \\addAfter);\nc = s.scope;\nc.style = 2;\nc.bus = b;\n)\n```"}, {"role": "assistant", "content": "Very quick-and-dirty hack to show stereo phase. Center = up (12:00). Full left = 10:30, full right = 1:30."}]} -{"conversations": [{"role": "user", "content": "What is `DataFile` in SuperCollider?"}, {"role": "assistant", "content": "DataFile — Write specs into File A tool for reading and writing data files. Category: Libraries > Radicles."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Convolution2L`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\conv_test, { |out, kernel, t_trig = 0|\n var input = Impulse.ar(1);\n var framesize = 2048; // must have power of two\n var result = Convolution2L.ar(input, kernel, t_trig, framesize, 1, 0.5);\n Out.ar(out, result);\n}).add\n);\n\nx = Synth(\\conv_test, [\\kernel, b]);\n\n// changing the buffer number:\nx.set(\\kernel, c);\nx.set(\\t_trig, 1); // after this trigger, the change will take effect.\nx.set(\\kernel, d);\nx.set(\\t_trig, 1); // after this trigger, the change will take effect.\n\nd.zero;\n40.do { |it| d.set(20 * it + 10, 1) }; // changing the buffers' contents\nx.set(\\t_trig, 1); // after this trigger, the change will take effect.\n\nx.set(\\kernel, b);\nx.set(\\t_trig, 1); // after this trigger, the change will take effect.\n\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `AbstractSystemAction` in SuperCollider briefly."}, {"role": "assistant", "content": "AbstractSystemAction — register actions to be taken for system events Category: Control."}]} -{"conversations": [{"role": "user", "content": "What does `Document.standardizePath` do? What arguments does it take?"}, {"role": "assistant", "content": "Editor-specific text document editing Arguments: p — The file system path to the directory. An instance of String.."}]} -{"conversations": [{"role": "user", "content": "What does `RedTime.addSec` do? What arguments does it take?"}, {"role": "assistant", "content": "calculate with time Arguments: sec — A SimpleNumber.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\n(\nSynthDef(\"help-phaseShift\", { |out = 0|\n var in, chain;\n in = SinOsc.ar(500);\n chain = FFT(LocalBuf(2048), in);\n chain = PV_PhaseShift(chain, LFNoise2.kr(1, 180, 180));\n Out.ar(out, 0.1 * IFFT(chain).dup);\n}).play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\n(\nSynthDef(\"help-phaseShift\", { |out = 0|\n var in, chain;\n in = SinOsc.ar(500);\n chain = FFT(LocalBuf(2048), in);\n chain = PV_PhaseShift(chain, LFNoise2.kr(1, 180, 180));\n Out.ar(out, 0.1 * IFFT(chain).dup);\n}).play(s);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `TWChoose`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar,\n Pulse.ar\n ];\n TWChoose.ar(Dust.ar(MouseX.kr(1, 1000, 1)), a, [0.99, 0.05, 0.05].normalizeSum) * 0.2\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// encoder - make sure you boot the server first!!\n~encoder = FoaEncoderKernel.newUHJ\n\n// inspect\n~encoder.kernelSize\n\n// calculate delay in samples\n(~encoder.kernelSize-1)/2 + ~encoder.kernelSize - s.options.blockSize\n\n// calculate delay in seconds\n((~encoder.kernelSize-1)/2 + ~encoder.kernelSize - s.options.blockSize / s.sampleRate\n\n// don't forget to free!!\n~encoder.free\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// encoder - make sure you boot the server first!!\n~encoder = FoaEncoderKernel.newUHJ\n\n// inspect\n~encoder.kernelSize\n\n// calculate delay in samples\n(~encoder.kernelSize-1)/2 + ~encoder.kernelSize - s.options.blockSize\n\n// calculate delay in seconds\n((~encoder.kernelSize-1)/2 + ~encoder.kernelSize - s.options.blockSize) / s.sampleRate\n\n// don't forget to free!!\n~encoder.free\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nPbind(note: Pseq([0, 4, 7]), amp: 0.1, dur: 0.2.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nPbind(note: Pseq([0, 4, 7]), amp: 0.1, dur: 0.2).play\n```"}]} -{"conversations": [{"role": "user", "content": "What does `EnvirGui.envir` do?"}, {"role": "assistant", "content": "the envir displayed - actually an alias for"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// larger pitch range and lookBack in upper voice, \n// as with most patterns, no automatic array expansion of pattern arguments\n\n(\np = Pbind(\n \\dur, 1/7,\n \\src, Pseg(Pseq([65, 85], inf), 5, \\sin).round,\n \\midinote, Ptuple([\n PIdev(Pkey(\\src), 1, -1, 1),\n PIdev(Pkey(\\src) + 8.5, 3, -5, 5)\n ]).trace(prefix: \"midi \"),\n).play;\n);\n\np.stop\n```"}, {"role": "assistant", "content": "larger pitch range and lookBack in upper voice, as with most patterns, no automatic array expansion of pattern arguments (PIdev: pattern searching for numbers with integer distance from a source pattern, optionally avoiding repetitions within a span)"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `DiskOut`."}, {"role": "assistant", "content": "```supercollider\n// start something to record\nx = Synth(\"bubbles\");\n\n// allocate a disk i/o buffer\nb = Buffer.alloc(s, 65536, 2);\n\n// create an output file for this buffer, leave it open\nb.write(\"~/diskouttest.wav\".standardizePath, \"wav\", \"int16\", 0, 0, true);\n// create the diskout node; making sure it comes after the source\nd = Synth.tail(nil, \"help-Diskout\", [\"bufnum\", b]);\n// stop recording\nd.free;\n// stop the bubbles\nx.free;\n// close the buffer and the soundfile\nb.close;\n// free the buffer\nb.free;\n\n// play it back\n(\nx = Synth.basicNew(\"help-Diskin-2chan\");\nm = { |buf| x.addToHeadMsg(nil, [\\bufnum, buf]) };\n\nb = Buffer.cueSoundFile(s, \"~/diskouttest.wav\".standardizePath, 0, 2, completionMessage: m);\n);\nx.free; b.close; b.free; // cleanup\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// NTMI.zoom sets all the influx'es inScalers AND RandomOrbit's excursion from current state.\n\nNTMI.zoom = NTMI.zoom?1;\n\n// tune this for jitter on zoom pot on NTMI\nSpec.add(\\zoom, [0, 1, \\lin, 0.025]);\n\nNTMI.setZoom = {|ev, val|\n val = \\zoom.asSpec.constrain(val);\n // \"global ZOOM f. RandomOrbits and Influxes: %\\n\".postf(val);\n NTMI.zoom = val;\n\n NTMI.inphlux.inScaler = NTMI.zoom;\n \"zoom: %\\n\".postf(NTMI.zoom);\n // return value\n val\n};\n// increment / decrement\nNTMI.incZoom = {|ev, inc=0.1|\n NTMI.setZoom((NTMI.zoom + inc));\n};\n```"}, {"role": "assistant", "content": "NTMI.zoom sets all the influx'es inScalers AND RandomOrbit's excursion from current state."}]} -{"conversations": [{"role": "user", "content": "What does `AbstractFunction.sqrdif` do?"}, {"role": "assistant", "content": "(a - b) ** 2 `({ [5, 6, 2].choose.postln } sqrdif: { [2, -1,"}]} -{"conversations": [{"role": "user", "content": "What does `MAbstractElement.resetAction` do?"}, {"role": "assistant", "content": "reset element action to nil, i.e. without any"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Benoit XVI (a SuperCollider snippet)?"}, {"role": "assistant", "content": "```supercollider\n// a supercollider port of Coloscope's Pure-data organ. \n\nSynthDef(\\benoit, {\n arg out=0, amp=0.5, freq=440, semione=12, semitwo=24, trackingmul=2, gate=1, sus=1, rel=1;\n var env, sig, sig1, sig2, sig3, ringmod, tracking, sig4;\n\n sig1 = Pulse.ar(freq, 0.17);\n sig2 = Pulse.ar((freq.cpsmidi - semione).midicps, 0.17);\n sig3 = Pulse.ar((freq.cpsmidi + semitwo).midicps, 0.17);\n\n sig4 = LFTri.ar((freq.cpsmidi - semitwo).midicps);\n\n env = EnvGen.ar(Env.linen(0,sus,rel), gate, doneAction:2);\n\n tracking = ((freq * 1) + freq) * trackingmul;\n sig = sig1 + sig2 + sig3 + (sig4 * 2);\n\n\n sig = RLPF.ar(sig, tracking, 1, 0.33);\n sig = FreeVerb.ar(sig, 0.12);\n sig = sig.tanh;\n sig = sig * env;\n\n\n Out.ar(out, (sig * amp));\n\n}).add;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n\n~remapConfig = IdentityDictionary[\n 0 -> 1,\n 1 -> 2,\n 2 -> 3,\n 3 -> 4,\n 4 -> 5,\n 5 -> 6,\n 6 -> 7,\n 7 -> 8,\n 8 -> 9,\n 9 -> 12,\n 10 -> 13,\n 11 -> 14,\n 12 -> 15,\n 13 -> 16,\n 14 -> 17\n];\n\n\n~generateRemapSynthDef = { |numInputChannels, numOutputChannels|\n SynthDef(\\remapOutputs, {\n var sig = In.ar(0, numInputChannels); \n var remapped = Array.fill(numOutputChannels, { Silent.ar(1) }); \n\n ~remapConfig.keysValuesDo { |src, dest|\n if (src < numInputChannels and: { dest < numOutputChannels }) {\n remapped[dest] = sig[src];\n }\n };\n\n ReplaceOut.ar(0, remapped);\n }).add;\n};\n\n~generateRemapSynthDef.(16, 18); \n);\n\n(\n~createRemapSynth = {\n ~remapSynth = Synth(\\remapOutputs, target: s.defaultGroup, addAction: \\addAfter);\n};\n\nServerTree.add( ~createRemapSynth);\n\n)\n```"}, {"role": "assistant", "content": "This code sets up a remapping system where input channels are mapped to output channels based on a predefined configuration. The remapping is done using a SynthDef that reads input signals, applies the remapping, and outputs the remapped signals. The ServerTree.add ensures that the remap synth is created and added to the server's node tree upon server startup and cmd-. and ctrl-.\r\n\r\nBased on discu."}]} -{"conversations": [{"role": "user", "content": "What does `AbstractPlayer.ar` do?"}, {"role": "assistant", "content": "the base class for all Players : a playable object"}]} -{"conversations": [{"role": "user", "content": "Approaches to recording generated midi in DAW?"}, {"role": "assistant", "content": "SuperCollider forum — Approaches to recording generated midi in DAW?\n\nToday I spent another 6 hours or so trying to record in ardour (linux) both the midi information generated by supercollider and the audio generated by sending this midi to external synths. I finally hit the right combination of magic to make it work and I want to add my recipe in this thread so that I can find it back the future (and perhaps it also works for someone else).\n\nIngredient 1: a2jmidid. You can run it manually on the command line using “a2jmidid -e” or (like me) you can just use the “start midi bridge” button in the jack front-end application “Cadence” (enable the “export hardware ports checkbox”)\n\nIngredient 2: In supercollider itself, it is extremely important to only connect to a port and not to specify a destination uid. It seems that by specifying a destination uid, supercollider gets some kind of direct connection to the midi destination and ardour can no long introspect/record what is happening (I know it doesn’t sound scientific - this is purely the result of empiric observation/frustration.\n\nSo in supercollider, simply use\n\n```supercollider\n~synth1 = MIDIOut(0);\n~synth2 = MIDIOut(1);\n```\n\nand then in ardour’s Window->Midi Connections dialog, you can connect the out ports from supercollider to both your external synth and the track in which you want to record the midi information.\n\nFor midi driver in jack you can configure None.\n\nIf you want to record the generated midi in ardour, do NOT use connection syntax like\n\n```supercollider\n~synth1 = MIDIOut(0, MIDIClient.destinations[2].uid);\n```\n\nand do NOT use\n\n```supercollider\n~synth1 = MIDIOut.newByName(\"INTEGRA-7\", \"INTEGRA-7 MIDI 1\");\n```\n\nIf you just want to send midi to the external synth without recording the information, both previous ways of connecting work as well but these ways of connecting appear to work only if the jack MIDI driver is configured to use “ALSA sequencer” mode. It doesn’t seem to work with “None” or “ALSA Raw” (this may need some further investigation to clear out)."}]} -{"conversations": [{"role": "user", "content": "What does `View.onClose` do?"}, {"role": "assistant", "content": "Sets or gets the object to be evaluated when the view is destroyed (i.e. #-close#closed or #-remove#removed). It is passed the view as an"}]} -{"conversations": [{"role": "user", "content": "What is `HilbertPDNIm` in SuperCollider?"}, {"role": "assistant", "content": "HilbertPDNIm — Applies the Imaginary part of the Hilbert Transform to an input signal. [1] Offers the Hilbert Transform of an input signal via Weaver's Second Method,footWeaver, Donald. “A Third Method of Generation and Detection of Single-Sideband Signals.” Proceedings of the IRE, vol. 44, no. 12, 1956, pp. 1703–1705. known as Hartley Phasing,footUS Patent 1,666,206, Modulation System, April 17, 1928, United States Patent and Trademark Office. expressed as a 12th-order Phase Differenci Category: Libraries > Hilbert > Pseudo-UGens, UGens > Filters > Nonlinear."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Electrode Theremin (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var saw, bpf;\n saw = Saw.ar(\n freq: 30, \n mul: SinOsc.kr(\n freq: LFPulse.ar(freq: [100, 1000]).range(1, 10),\n width: 0.9));\n bpf = BPF.ar(in: saw, freq: MouseY.kr(1000, [6000, 9000]), rq: MouseX.kr(0.1, 0.9), mul: 20);\n Out.ar(0, bpf);\n \n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `IFFT`?"}, {"role": "assistant", "content": "IFFT — Inverse Fast Fourier Transform"}, {"role": "user", "content": "What does `IFFT.new` do?"}, {"role": "assistant", "content": "returns a time domain signal from converting the FFT frequency domain signal chain. The *new method is equivalent to the *ar message returns an audio rate signal."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// without any modification, convert FFT chain (frequency domain signal) back to audio (time domain signal)\n(\n{ var in, chain;\n in = WhiteNoise.ar;\n chain = FFT(LocalBuf(2048), in);\n IFFT.ar(chain) * -20.dbamp // inverse FFT\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `CutRev1` in SuperCollider?"}, {"role": "assistant", "content": "CutRev1 — BBCut2 reverb CutRev1 adds a ring modulator effect to BBCut2 Category: Libraries > BBCut > Cut FX."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\n\n\n// create with cueSoundFile class method\nb = Buffer.cueSoundFile(s, ExampleFiles.apollo11, 0, 1);\nx = { DiskIn.ar(1, b) }.play;\nb.close; // must call close in between cueing\n// now use like named instance method, but different arguments\nb.cueSoundFile(ExampleFiles.apollo11;\n// have to do all this to clean up properly!\nx.free; b.close; b.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\n\n\n// create with cueSoundFile class method\nb = Buffer.cueSoundFile(s, ExampleFiles.apollo11, 0, 1);\nx = { DiskIn.ar(1, b) }.play;\nb.close; // must call close in between cueing\n// now use like named instance method, but different arguments\nb.cueSoundFile(ExampleFiles.apollo11);\n// have to do all this to clean up properly!\nx.free; b.close; b.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// Since the allpass delay has no audible effect as a resonator on\n// steady state sound ...\n\n{ AllpassN.ar(WhiteNoise.ar(0.1), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// ...these examples add the input to the effected sound and compare variants so that you can hear\n// the effect of the phase comb:\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassN.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2)\n}.play)\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassL.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2\n// …\n```"}, {"role": "assistant", "content": "Since the allpass delay has no audible effect as a resonator on steady state sound ... (AllpassN: Schroeder allpass delay line with no interpolation.)"}]} -{"conversations": [{"role": "user", "content": "What does `RedBMP.asInt32Array` do?"}, {"role": "assistant", "content": "Converts the data to an Int32Array and return"}]} -{"conversations": [{"role": "user", "content": "What does `PsymNilSafe.maxNull` do?"}, {"role": "assistant", "content": "Getter and setter for PsymNilSafe's variable"}]} -{"conversations": [{"role": "user", "content": "What does `Patch.watchNoncontrols` do?"}, {"role": "assistant", "content": "Pairs an Instr with inputs that that will be passed to the Instr"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\np = Pbind(\n \\instrument, \\synth_1a,\n \\preAmp, PL(\\preAmp), \n \\amp, PL(\\amp), \n \\midinote, PLseq(\\seq) + PL(\\seqAdd), \n \\dur, 0.2\n);\n\nq = Pbindf(p, \\midinote, PLseq(\\seq));\n\nv = VarGui([\\seq, { [48, 84, \\lin, 1, rrand(48, 84)] } ! 5, \n \\seqAdd, [0, 12, \\lin, 1, 7],\n \\amp, [0, 0.3, \\lin, 0.01, 0.07],\n \\preAmp, [5, 50, \\lin, 0.01, 20]],\n stream: [q,p].collect(_.asE\n// …\n```"}, {"role": "assistant", "content": "so currentEnvironment is given implicitely by both ESPs and used for setting ensures that players, also if started separately for the first time, (VarGui: slider / player gui to set envir variables and synth controllers and play synths, event patterns and tasks)"}]} -{"conversations": [{"role": "user", "content": "What does `EventPatternProxy.envir` do?"}, {"role": "assistant", "content": "provide a default event for the Pdef. It is used to filter the incoming stream before it is passed to the source pattern. This is similar to NodeProxy#-nodeMap. When set for the first time, the pattern is"}]} -{"conversations": [{"role": "user", "content": "What does `BlitB3.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Band limited impulse generation Arguments: freq."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LinRand`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-LinRand\", { |out = 0, minmax = 1|\n Out.ar(out,\n FSinOsc.ar(\n LinRand(200.0, 10000.0, minmax),\n 0, Line.kr(0.2, 0, 0.01, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n// towards hi\n(\nRoutine({\n loop({\n Synth.new(\"help-LinRand\"); 0.04.wait;\n })\n}).play;\n);\n\n// towards lo (doesn't work like that yet)\n(\nRoutine({\n loop({\n Synth.new(\"help-LinRand\", [\\minmax, -1]); 0.04.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is the difference between ~foo and a local variable?"}, {"role": "assistant", "content": "`var foo` is a local: it exists only inside the function or file block that declares it. `~foo` is an environment variable: it lives in the current Environment, survives between executions of the same block, and is visible to everything running in that environment. That is why `~buf = Buffer.read(s, path)` works in one cell and `PlayBuf.ar(1, ~buf)` works in the next, while a `var` would be gone."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// what can it sound like? see: https://www.youtube.com/watch?v=dRmY3tEwZyE \n// the youtube version has been sent through an additional reverb pedal, but\n// you don't need the pedal to get something that sounds interesting\n\n(\ns.options.memSize_(16384*10);\ns.reboot;\ns.waitForBoot({\n \n Ndef(\\bits, {\n var t = PulseCount.ar(Impulse.ar(8e3));\n var u = PulseCount.ar(Impulse.ar(7009));\n var sig = HPF.ar(\n (\n ((t * 15) & (t >> 5)) |\n ((t * 5) & (t >> [3, 4])) |\n ((t * 2) & (t >> 9)) |\n ((t * 8) & (t >> 11)) |\n (((t*t) & t) | (t >> 3))\n - 3 % 256\n ) / 127-1 * 3\n , 20\n ) * 0.1;\n var sig2 = LPF.ar(HPF.ar(gcd(t*u, u+t), WhiteNoise.ar()*2000 + 1000), 20);\n sig2 = sig2*sig;\n sig = 0.3*Splay.ar(Limiter.ar(Greyhole.ar(sig + sig2, sig, 0.5, sig), 0.5).flatten);\n }).play;\n});\n)\n```"}, {"role": "assistant", "content": "a surprisingly rich soundscape in a few lines of code (lucky accident)."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// distorts of course - would need scaling\n{ RunningSum.ar(SoundIn.ar) }.play\n\n// Running Average over x samples\n(\n{\n var x = 100;\n RunningSum.ar(LFSaw.ar, x) * (x.reciprocal)\n }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// distorts of course - would need scaling\n{ RunningSum.ar(SoundIn.ar) }.play\n\n// Running Average over x samples\n(\n{\n var x = 100;\n RunningSum.ar(LFSaw.ar, x) * (x.reciprocal)\n }.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Instr.prMakeSynth` do? What arguments does it take?"}, {"role": "assistant", "content": "An enhanced version of SynthDef with a library Arguments: targetStyle; anode; args — array or dict; bundle; atTime — see atTime; out — out bus index."}]} +{"conversations": [{"role": "user", "content": "What does `PageLayout.asPageLayout` do? What arguments does it take?"}, {"role": "assistant", "content": "Similar to asFlowView, this message converts nil and various other objects to a PageLayout. This is already a PageLayout, so it returns Arguments: name — Ignored. If the receiver had been nil then the name would be the Window name.; bounds — Ignored. Would have been used to size the PageLayout. Returns: self"}]} +{"conversations": [{"role": "user", "content": "Explain `Splay` in SuperCollider briefly."}, {"role": "assistant", "content": "Splay — Splay spreads an array of channels across the stereo field Splay spreads an array of channels across the stereo field. Optional arguments are spread and center, and equal power levelCompensation. The formula for the stereo position is ((0 .. (n - 1)) * (2 / (n - 1)) - 1) * spread + center Category: UGens > Multichannel > Panners."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PdurStutter`."}, {"role": "assistant", "content": "```supercollider\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,0,1,3,4,0], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n100.do({ x.next.postln });\n);\n\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n);\n\n\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,4,4,0,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DetectSilence`."}, {"role": "assistant", "content": "```supercollider\n// this frees after the Decay has become quiet enough for a long enough time\n{ var signal = Decay.ar(Impulse.ar(0), 2, PinkNoise.ar(0.2)); DetectSilence.ar(signal, doneAction: Done.freeSelf); signal }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\ns.scope(16);\n\n{ Out.ar(87, SinOsc.ar(MouseX.kr(40, 10000, 1) * [1, 2, 3], 0, 0.2)) }.play;\nx = Monitor.new;\nx.play(87, 3, 1, 2);\nx.out = 0;\nx.stop(3.0);\nx.play(87, 1, 0, 1); // in > out : now mixes down (wrapping)\nx.play(89, 1, 0, 2); // in < out : now distributes to 2 channels\nx.stop;\n\n// multiple play\nx.play(87, 1, 0, 2, multi: true);\nx.play(88, 1, 0, 2, multi: true);\nx.play(89, 1, 0, 2, multi: true;\nx.stop;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\ns.scope(16);\n\n{ Out.ar(87, SinOsc.ar(MouseX.kr(40, 10000, 1) * [1, 2, 3], 0, 0.2)) }.play;\nx = Monitor.new;\nx.play(87, 3, 1, 2);\nx.out = 0;\nx.stop(3.0);\nx.play(87, 1, 0, 1); // in > out : now mixes down (wrapping)\nx.play(89, 1, 0, 2); // in < out : now distributes to 2 channels\nx.stop;\n\n// multiple play\nx.play(87, 1, 0, 2, multi: true);\nx.play(88, 1, 0, 2, multi: true);\nx.play(89, 1, 0, 2, multi: true);\nx.stop;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `AbstractFunction`."}, {"role": "assistant", "content": "```supercollider\na = { |x, root = 60| x + root }; b = a.midicps; [a.value(9), b.value(9)];\na = Pseries(60, 1, inf).midicps; a.asStream.nextN(12);\n{ a = LFNoise1.ar(1) * 5 + 60; Pulse.ar(a.round.midicps) * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `AbstractSplineGui.showGrid` do?"}, {"role": "assistant", "content": "boolean: show the GridLines or not. Useful when displaying multiple splines on top of each Returns: boolean"}]} +{"conversations": [{"role": "user", "content": "What is `Buffer`?"}, {"role": "assistant", "content": "Buffer — Client-side representation of a buffer on a server"}, {"role": "user", "content": "What does `Buffer.alloc` do?"}, {"role": "assistant", "content": "Create and return a Buffer and immediately allocate the required memory on the server. The buffer's values will be initialised to 0.0."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n// allocate an array of Buffers and fill them with different harmonics\n(\nb = Buffer.allocConsecutive(8, s, 4096, 1, { |buf, i|\n buf.sine1Msg((1 .. ((i + 1) * 6)).reciprocal) // completion messages\n});\n\na = { VOsc.ar(SinOsc.kr(0.5, 0).range(b.first.bufnum + 0.1, b.last.bufnum - 0.1),\n [440, 441], 0, 0.2) }.play;\n);\na.free;\n\n// iterate over the array and free it\nb.do(_.free);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Hasher`."}, {"role": "assistant", "content": "```supercollider\n{ Hasher.ar(Line.ar(0, 1, 1), 0.2) }.play;\n\n// Even adding a small amount to the input can result in a very different output. Compare these two examples:\n(\n{\n SinOsc.ar(\n Hasher.kr(MouseX.kr(0, 10).round(1), 300, 500)\n ) * 0.1\n}.play;\n);\n\n(\n{\n SinOsc.ar(\n Hasher.kr(MouseX.kr(0, 10).round(1) + 0.0001, 300, 500)\n ) * 0.1\n}.play;\n);\n\n// Output stays constant while not moving the mouse.\n(\n{\n SinOsc.ar(\n Hasher.kr(MouseX.kr(0, 10), 300, 500)\n ) * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// default initial params\n{ FBSineL.ar(SampleRate.ir/4) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// default initial params\n{ FBSineL.ar(SampleRate.ir/4) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What is `OnePole` in SuperCollider?"}, {"role": "assistant", "content": "OnePole — One pole filter. A one pole filter. Implements the formula: Category: UGens > Filters > Linear."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DelayL`."}, {"role": "assistant", "content": "```supercollider\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nDelayL.ar(z, 0.2, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\n(\n// recursive application of delay.\n{\nz = Decay2.ar(Dust.ar(1, 0.5), 0.01, 0.1, Saw.ar(100 + [0, 1]));\n5.do { |i| z = DelayL.ar(RLPF.ar(z, Rand(100, 3000), 0.03), 1, 1 / (2**i), 1, z * 0.5) };\nz\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\envfol;\n~description = \"Envelope follower (audio rate)\";\n~channelLayout = \\mono;\n~function = {|in = 0, decaycoeff = 0.99, amp = 10.0, lpf = 20 |\n var env, out;\n in.scope;\n env = LPF.ar(PeakFollower.ar(in), lpf, mul: 50, add:-1);\n env.scope;\n env;\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n~x.play;\n\n~x = { var alpha,beta; alpha = rrand(99,399); beta = alpha = rrand(99,399);Pan2.ar(LeakDC.ar(Normalizer.ar(BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(BPeakEQ.ar(\nFreeVerb.ar(Formant.ar(TRand.kr(alpha,alpha+(rrand(5,20)),Impulse.kr(rrand(10,100))), TRand.kr(beta,beta+(rrand(5,20)),Impulse.kr(rrand(10,100))), EnvGen.kr(Env.adsr,Impulse.kr(rrand(100,666)))*rrand(666,3333),0.125),\nrrand(0.5,1.0),rrand(0.5,1.0),rrand(0.5,1.0))\n,100,6.0,12),1000,6.0,0),5000,6.0,0),10000,6.0,12),0.6,0.1)),0)\n};\n```"}, {"role": "assistant", "content": "A drone insect-string from:\r\n\r\nhttp://musicnumbers.wordpress.com/2011/11/25/nx010/."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// default initial params\n{ GbmanL.ar(MouseX.kr(20, SampleRate.ir)) * 0.1 }.play(s);\n\n// different initial params\n{ GbmanL.ar(MouseX.kr(20, SampleRate.ir), -0.7, -2.7) * 0.1 }.play(s);\n\n// wait for it...\n{ GbmanL.ar(MouseX.kr(20, SampleRate.ir), 1.2, 2.0002) * 0.1 }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(GbmanL.ar(40)*400+500)*0.4 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// default initial params\n{ GbmanL.ar(MouseX.kr(20, SampleRate.ir)) * 0.1 }.play(s);\n\n// different initial params\n{ GbmanL.ar(MouseX.kr(20, SampleRate.ir), -0.7, -2.7) * 0.1 }.play(s);\n\n// wait for it...\n{ GbmanL.ar(MouseX.kr(20, SampleRate.ir), 1.2, 2.0002) * 0.1 }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(GbmanL.ar(40)*400+500)*0.4 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Synth`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n(\n// send a synth def to server\nSynthDef(\"tpulse\", { |out = 0, freq = 700, sawFreq = 440.0|\n Out.ar(out, SyncSaw.ar(freq, sawFreq, 0.1));\n}).add;\n);\n\n// Here the defaults for *new will result in a Synth at the head of the default group\n// of the default Server. This will use the SynthDef's default arguments;\ny = Synth.new(\"tpulse\");\ny.free;\n\n// The same done explicitly\ny = Synth.new(\"tpulse\", nil, s, \\addToHead);\ny.free;\n\n// With some arguments\ny = Synth.new(\"tpulse\", [\\freq, 350, \\sawFreq, 220]);\ny.free;\n\n// make a new synth\ny = Synth(\"tpulse\");\n\n// pause\ny.run(false);\n\ny.run(true);\n\n// set a control by argument name\ny.set(\"freq\", 200);\n\n// or by index\ny.set(2, 100.0);\n\n// modulate out to bus number 1 (the right speaker)\ny.set(0, 1);\n\n// multiple set commands in one message\ny.set(\"out\", 0, \"freq\", 300);\n\n// free the synth from the server\ny.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `OSCSched.qsched` do? What arguments does it take?"}, {"role": "assistant", "content": "will happen at the next even division ( 4.0 means on the downbeat of a 4/4 bar ), or immediately if you happen to be exactly on a Arguments: quantize; server; bundle; onArrival."}]} +{"conversations": [{"role": "user", "content": "What does `Platform.platformDir` do?"}, {"role": "assistant", "content": "platform specific directory for class files (see"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n b = {|x,y|\n var arr = List[];\n case\n {y % x.size == 0} // condition 1\n {\n var per = y / x.size;\n x.size.do{|oo|\n var pp = 1,i = 1;\n arr.add( x[oo] );\n while({i < per},{\n arr.add(0);\n i = i+1;\n });\n }\n }\n {x.size % y == 0} // condition 2\n {\n var pp = x.size / y, i = 0, sz = x.size;\n while({i < sz},{\n if(i % pp == 0)\n { arr.add(x[i]) };\n i=i+1;\n });\n };\n arr\n };\n a = [1,1,1,1];\n c = b.value(a,16) \n // [ 1, 1, 1, 1 ]\n // becomes\n // [ 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 ]\n\n b.value(c,4); \n // [ 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 ]\n // becomes\n // [ 1, 1, 1, 1 ]\n)\n```"}, {"role": "assistant", "content": "useful for expanding or reducing arrays by 2^x.\r\nI would like to know if there is a more concise way to write this!\r\nAny suggestions?\r\n\r\n(duplicate post, sorry! forgot to log in!)."}]} +{"conversations": [{"role": "user", "content": "What does `OpenBCIboard.off` do? What arguments does it take?"}, {"role": "assistant", "content": "turn off (mute) one ore more Arguments: channel — can be an Integer or an Array of Integers. `c.off(1) //turn off the first channel`."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\ns.boot;\n\n(\nSynthDef(\"help-PinkNoise\", { |out = 0|\n Out.ar(out, PinkNoise.ar(0.1))\n}).add;\n\nSynthDef(\"help-In\", { |out = 0, in = 0|\n var input;\n input = In.ar(in, 1);\n Out.ar(out, input);\n\n}).add;\n);\n\n// play noise on the right channel\nx = Synth(\"help-PinkNoise\", [\\out, 1]);\n\n// read the input and play it out on the left channel\nSynth.after(x, \"help-In\", [\\out, 0, \\in, 1]);\n```"}, {"role": "assistant", "content": "play noise on the right channel read the input and play it out on the left channel (In: Read a signal from a bus.)"}]} +{"conversations": [{"role": "user", "content": "Explain `NodeMap` in SuperCollider briefly."}, {"role": "assistant", "content": "NodeMap — store control values and bus mappings Object to store control values and bus mappings independently of a specific node. Category: JITLib > NodeProxy, Server > Nodes, Server > Abstractions."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\Identity;\n~description = \"Output the Ambisonics stream to outputs channels, useful for NRT rendering\";\n\n~function = {|in = 0|\nin;\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\ns.plotTree;\n\n// Define and play a repeating pattern that generates a new synth every 0.4 seconds:\nx = Pn((dur: 0.4, midinote: 69, amp: 0.1)).play;\n\n/*\nThe NodeTreeView window dynamically displays active synth nodes.\nInitially, it shows the first node, and upon each refresh, it retains the previous node while adding a new one.\nThis results in the display of one or two subsequent nodes at each interval.\n*/\n\n// stop updating plotTree:\ns.nodeTreeView.stop;\n\n// start updating plotTree:\ns.nodeTreeView.start;\n\n// stop the playback of the pattern:\nx.stop;\n\ns.nodeTreeV\n// …\n```"}, {"role": "assistant", "content": "Define and play a repeating pattern that generates a new synth every 0.4 seconds: stop updating plotTree: (Server: Object representing a server application)"}]} {"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ LPF.ar(Saw.ar(100), SinOsc.kr(0.5).exprange(200, 2000)) * 0.2 }.play;\n```"}, {"role": "assistant", "content": "A sawtooth through a low-pass filter whose cutoff is swept slowly up and down — a classic filter\nsweep.\n\n- `Saw.ar(100)` is a 100 Hz sawtooth, rich in harmonics.\n- `SinOsc.kr(0.5)` is a control-rate sine at 0.5 Hz, so one full cycle takes 2 seconds.\n- `.exprange(200, 2000)` maps that -1..1 sine exponentially onto 200..2000 Hz — exponential is the right\n mapping for frequency, because we hear pitch logarithmically.\n- `LPF.ar(sig, cutoff)` removes harmonics above the cutoff; as it opens and closes you hear the tone\n brighten and darken.\n- `* 0.2` keeps the output from clipping."}]} -{"conversations": [{"role": "user", "content": "What does `KmeansToBPSet1.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "K-means Oscillator Arguments: freq — frequency of oscillator; numdatapoints — Initial number of data points; maxnummeans — Maximum number of means allowed; nummeans — current num means; tnewdata — If a trigger is received, reset source data (k-rate); tnewmeans — If a trigger is received, reset means (k-rate); soft — Proportion to soften means update. If 1.0, immediate update, 0.0 no update, proportion inbetween amount to move from the old mean position to the new mean of the allocated cluster (ie soft k-means).; bufnum — Number of a Buffer which contains positions for means and data points; see examples below."}]} -{"conversations": [{"role": "user", "content": "What is `Env`?"}, {"role": "assistant", "content": "Env — Specification for a segmented envelope"}, {"role": "user", "content": "What does `Env.new` do?"}, {"role": "assistant", "content": "Create a new envelope specification."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// an envelope in a synth\n(\n{\n var env = Env([0, 1, 0.5, 1, 0], [0.01, 0.5, 0.02, 0.5]);\n SinOsc.ar(470) * EnvGen.kr(env, doneAction: Done.freeSelf)\n}.play\n);\n// an envelope to control a parameter in a pattern\n(\nPbind(\n \\note, Env([0, 12, 6, 13, 0], [1, 5, 2, 10]),\n \\dur, 0.1\n).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a, b;\na = Place(#[1, [2, 5], [3, 6]], inf);\nx = a.asStream;\n8.do({ x.next.postln });\n);\n\n1\n2\n3\n1\n5\n6\n1\n2\n\n\n\n// Place used as a sequence of pitches\n\n(\nSynthDef(\"help-sinegrain\",\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n(\nc = Place(#[0, 0, [0, 4, 7], [1, 5,\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a, b;\na = Place(#[1, [2, 5], [3, 6]], inf);\nx = a.asStream;\n8.do({ x.next.postln });\n);\n\n1\n2\n3\n1\n5\n6\n1\n2\n\n\n\n// Place used as a sequence of pitches\n\n(\nSynthDef(\"help-sinegrain\",\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n(\nc = Place(#[0, 0, [0, 4, 7], [1, 5, 8], [2, 6, 9]], inf) + 67;\nx = c.asStream;\nRoutine({\n loop({\n Synth(\"help-sinegrain\", [\\freq, x.next.midicps]);\n 0.17.wait;\n })\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for minor scale filtered pulsewave demands?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n arg amp=0.1;\n var a, trig, basefreq, snd, cutoffmod, rqmod;\n \n a = Dseq([0, 2, 3, 5, 7, 8, 10, 12], inf);\n trig = Impulse.kr(4);\n basefreq = Demand.kr(trig, 0, a) + 38;\n basefreq = basefreq.midicps;\n cutoffmod = LFNoise2.ar(0.2).range(100,1500);\n rqmod = LFNoise2.ar(0.2).range(1,0.05);\n\n snd = (Pulse.ar(basefreq + 1 * SinOsc.kr(0.1.rand).range(0.99,1.010)) * amp) \n + (Pulse.ar(basefreq + 2 * SinOsc.kr(0.1.rand).range(0.99,1.010)) * amp) \n + (Pulse.ar(basefreq + 3 * SinOsc.kr(0.1.rand).range(0.99,1.01)) * amp)\n + (Pulse.ar(basefreq + 4 * SinOsc.kr(0.1.rand).range(0.99,1.01)) * amp)\n + (Pulse.ar(basefreq + 5 * SinOsc.kr(0.1.rand).range(0.99,1.01)) * amp)\n + (Pulse.ar(basefreq + 2 * SinOsc.kr(0.1.rand).range(0.99,1.010)) * amp) \n + (Pulse.ar(basefreq + 3 * SinOsc.kr(0.1.rand).range(0.99,1.01)) * amp)\n + (Pulse.ar(basefreq + 4 * SinOsc.kr(0.1.rand).range(0.99,1.01)) * amp)\n + (Pulse.ar(basefreq + 5 * SinOsc.kr(0.1.rand).range(0.99,1.01)) * amp)\n + (Pulse.ar(basefreq + 6 * SinOsc.kr(0.1.rand).range(0.99,1.01)) * amp);\n \n \n snd = LeakDC.ar(snd);\n snd = RLPF.ar(snd, cutoffmod, rqmod);\n snd = Limiter.ar(in: snd, level: 0.8, dur:0.001);\n snd.dup;\n \n}.play)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `UChain.dispose` do?"}, {"role": "assistant", "content": "Calls .dispose on each unit. This will dispose of Buffers or other resources"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for seasonal reflections )?"}, {"role": "assistant", "content": "```supercollider\n(\nfork { loop { \n Ndef(\\winter_curves, {\n var bands = 5.rrand(15) * 2;\n var freqs = Array.exprand(bands.debug('bands'), 20, 18000);\n Pan2.ar(\n SinOsc.ar(\n freqs, \n Array.rand(bands, 0, pi),\n AmpCompA.kr(freqs, freqs.sort.first)\n ).perform(0.5.coin.if(\\tanh,\\value).debug('kind')),\n FSinOsc.kr(\n Array.exprand(bands, 0.01, 15),\n Array.rand(bands, 0, pi),\n ),\n bands.reciprocal\n * LFGauss.kr(SinOsc.kr(Array.rand(bands, 0.05, 0.1)).range(1,10), 0.3)\n * FSinOsc.kr(\n Array.exprand(bands, 0.1, 15),\n 0.3\n ).range(0,1)\n ).sum\n * SelectX.kr(\n FSinOsc.kr(Array.exprand(bands, 0.1, 15)).range(0,1),\n [\n EnvGen.kr(\n Env.perc(\n FSinOsc.kr(1/16).range(0.01,0.1),\n FSinOsc.kr(1/8).range(0.25,0.3)\n ).blend(\n Env.sine( // 1/4\n FSinOsc.kr(Array.exprand(bands, 0.1, 15)).range(0.05,2)\n ).blend(\n Env.sine(1/4),\n FSinOsc.kr(Array.exprand(bands, 0.1, 15)).range(0.05,2).mean\n ),\n FSinOsc.kr(Array.exprand(bands, 0.1, 15)).range(0,1)\n ).circle,\n 1, 0.8, \n FSinOsc.kr(freqs.linlin(20,18000,0.1,20)).range(0, 0.2).mean\n ),\n 1\n ]\n ).clump(2).mean\n }).fadeTime_(0.5.rrand(2.5)).play;\n 8.rrand(30).debug('len').wait;\n} }\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `View.canFocus` do? What arguments does it take?"}, {"role": "assistant", "content": "Sets or gets whether the view can receive keyboard Arguments: A Boolean.."}]} -{"conversations": [{"role": "user", "content": "What does `AbstractFunction.bitHammingDistance` do?"}, {"role": "assistant", "content": "An object which responds to a set of messages that represent mathematical functions"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Set`."}, {"role": "assistant", "content": "```supercollider\nSet[1, 2, 3].add(4).postln;\nSet[1, 2, 3].add(3).postln;\nSet[\"abc\", \"def\", \"ghi\"].add(\"jkl\").postln;\nSet[\"abc\", \"def\", \"ghi\"].add(\"def\").postln;\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `TempoClock`."}, {"role": "assistant", "content": "```supercollider\nt = TempoClock.new;\n\nt.beatsPerBar = 3; // error! wrong thread\n\nt.schedAbs(t.nextBar, { t.beatsPerBar_(3) }); // OK\n\nt.beatsPerBar; // will be reflected after the barline\n\nt.schedAbs(t.nextBar, { thisThread.clock.beatsPerBar_(4) }); // OK\n\n(\nr = Routine {\n // by addressing \"this\" clock,\n // we are always changing meter in the right place\n var clock = thisThread.clock;\n\n clock.beats.debug(\"start time\");\n clock.timeToNextBeat(-1).wait;\n clock.beats.debug(\"barline\");\n\n // no need to 'sched'\n // because the Routine is already on this clock\n // flip 3/4 -> 4/4 or 4/4 -> 3/4\n clock.beatsPerBar = 7 - clock.beatsPerBar;\n clock.beatsPerBar.debug(\"set meter to\");\n\n 0.01.wait; // must be after barline for 'timeToNextBeat'\n clock.timeToNextBeat(-1).wait;\n clock.beats.debug(\"next barline\");\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nRoutine({ loop { Synth(\\kick); 0.5.wait } }).play;\n```"}, {"role": "assistant", "content": "It starts a kick every half second, forever.\n\nA Routine is a language-side coroutine: `.play` runs it on the clock, and `wait` suspends it until the next\nbeat without blocking anything else. Inside the `loop`, `Synth(\\kick)` creates a kick and `0.5.wait` waits\nhalf a beat on the current TempoClock — the tempo, not seconds, so changing the clock changes the rate.\nBecause the kick SynthDef frees itself with `doneAction: 2`, the loop can run for hours without leaking\nnodes."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n/// measuring lastUpdateTime from MKtls,\n/// to display which interfaces were recently active\n~time = ();\n~time.actives = [ MKtl(\\ntmi), MKtl(\\uc4), MKtl(\\ferrari) ];\n~time.times = ();\n~time.spec = [1000, 1, \\exp].asSpec;\n~time.actives.do { |mk| ~time.times.addSpec(mk.name, ~time.spec) };\n\n~time.egui = EnvirGui(~time.times);\n\n~time.times.getSpec\n\n~time.skip.stop.free;\n~time.skip = SkipJack({\n ~time.actives.do { |mk|\n ~time.times.put(mk.name, mk.timeSinceLast)\n }\n});\n~time.skip.dt = 0.5;\n\nMKtl(\\ntmi).elAt(\\battery).action.cs;\n\nl = List.new(1024);\nMKtl(\\ntmi).elAt(\\battery).action = { |el|\n var val = el.deviceValue;\n // l.add(val);\n // val.postln;\n // if (val > 0) { val.postln };\n};\n\nl.postcs;\n```"}, {"role": "assistant", "content": "measuring lastUpdateTime from MKtls, to display which interfaces were recently active."}]} -{"conversations": [{"role": "user", "content": "Explain `Bjorklund2` in SuperCollider briefly."}, {"role": "assistant", "content": "Bjorklund2 — Euclidean Algorithm for generating traditional musical rhythms After an algorithm by E. Bjorklund. See paper by Godfried Toussaint. Category: Collections."}]} -{"conversations": [{"role": "user", "content": "What does `EnvelopeView.step` do? What arguments does it take?"}, {"role": "assistant", "content": "Makes the nodes snap (i.e. quantized) to the nearest multiple of the argument. Unless this is larger than 0, nodes will not be movable using Arguments: A Float.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// frequency modulation\n(\nplay {\n DynKlang.ar(`[\n [800, 1000, 1200] + SinOsc.kr([2, 3, 4.2], 0, [13, 24, 12]),\n [0.3, 0.3, 0.3],\n [pi, pi, pi]\n ]\n) * 0.1\n};\n);\n\n\n// building new synths every 2 seconds\n(\nfork {\n loop {\n play {\n var mod = SinOsc.kr(Rand(0.1, 0.9), 0, Rand(5, 20));\n Pan2.ar(DynKlang.ar(`[Array.rand(12, 200.0, 2000.0), 1, mod]), 1.0.rand)\n * EnvGen.kr(Env.sine(4), 1, 0.02, doneAction: D\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// frequency modulation\n(\nplay {\n DynKlang.ar(`[\n [800, 1000, 1200] + SinOsc.kr([2, 3, 4.2], 0, [13, 24, 12]),\n [0.3, 0.3, 0.3],\n [pi, pi, pi]\n ]\n) * 0.1\n};\n);\n\n\n// building new synths every 2 seconds\n(\nfork {\n loop {\n play {\n var mod = SinOsc.kr(Rand(0.1, 0.9), 0, Rand(5, 20));\n Pan2.ar(DynKlang.ar(`[Array.rand(12, 200.0, 2000.0), 1, mod]), 1.0.rand)\n * EnvGen.kr(Env.sine(4), 1, 0.02, doneAction: Done.freeSelf)\n };\n 2.wait;\n }\n}\n);\n\n\n// resetting the frequencies and amplitudes after the synth has been created\n(\nSynthDef('help-dynKlang', { |out,\n freqs = #[220, 440, 880, 1760],\n amps = #[0.35, 0.23, 0.12, 0.05],\n phases = #[1, 1.5, 2, 2.5]|\n\n Out.ar(out, DynKlang.ar(`[freqs, amps, phases]))\n}).add\n);\n\na = Synth('help-dynKlang');\n\na.setn(\\freqs, Array.rand(4, 500, 2000));\na.setn(\\amps, Array.rand(4, 0.01, 0.25));\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Dictionary`?"}, {"role": "assistant", "content": "Dictionary — associative collection mapping keys to values"}, {"role": "user", "content": "What does `Dictionary.new` do?"}, {"role": "assistant", "content": "Creates a Dictionary with an initial capacity for n key value mappings."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nd = Dictionary.new;\nd.add(\\monkey -> 0).postln;\nd.add(\\robot -> 1).postln; // Add robot as a key with a value of 1\nd.add(\\monkey -> 2).postln; // Replaces the value for the key monkey with 2\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `Dgeom` in SuperCollider briefly."}, {"role": "assistant", "content": "Dgeom — Demand rate geometric series UGen. Category: UGens > Demand."}]} -{"conversations": [{"role": "user", "content": "Resizing FreqScope?"}, {"role": "assistant", "content": "SuperCollider forum — Resizing FreqScope?\n\nOddly, this seems to work:\n\n```supercollider\n// max partial = 20 kHz\n// do not play this loudly\na = { Blip.ar(100, 200, 0.02).dup }.play;\n\nv = FreqScope(800, 600); // top partial is shown below 1.75 kHz (?)\n\nv.scope.scope.xZoom = 1; // seems correct, by eyeballing\n\n// let's try another resolution\nv = FreqScope(600, 500);\nv.scope.scope.xZoom = 1; // hm, zoom = 1 seems OK here too\n```\n\nFreqScope includes the line scope.xZoom_((scope.bufSize*0.25) / width); so it may be that this calculation is incorrect. I’m unclear, for instance, why it’s dividing by width – apparently zooming out for larger windows...?\n\nBut I tried three different widths (800x600, 600x500, 200x150), and for all of them, xZoom = 1 appeared to be correct. It’s possible that this calculation is vestigial, then – maybe we needed it for the older version of frequency scope, but the Qt version might not need it at all.\n\nhjh"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for SOUND 1, from orig Influx Example. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n// SOUND 1, from orig Influx Example\n(\n// // // if JITLibExtensions are used, you can make space local:\n// Ndef(\\dog).addSpec(\\intv, [-24, 24]);\n// Ndef(\\dog).addSpec(\\timescale, [0.01, 10, \\exp]);\n// Ndef(\\dog).addSpec(\\curve, [-10, 10]);\n// Ndef(\\dog).addSpec(\\ffreq, \\freq);\n//\n// Ndef(\\dog).addSpec(\\loopnode, [0, 12]);\n// Ndef(\\dog).addSpec(\\dens, [10, 1000, \\exp]);\n// Ndef(\\dog).addSpec(\\resfreq, \\freq);\n// Ndef(\\dog).addSpec(\\ringtime, [0.01, 1, \\exp]);\n\nSpec.add(\\intv, [-24, 24]);\nSpec.add(\\timescale, [0.01, 10, \\exp]);\nSpec.add(\\curve, [-10, 10]);\nSpec.add(\\ffreq, \\freq);\n\nSpec.add(\\loopnode, [0, 12]);\nSpec.add(\\dens, [10, 1000, \\exp]);\nSpec.add(\\resfreq, \\freq);\nSpec.add(\\ringtime, [0.01, 1, \\exp]);\n\n\nNdef(\\dog, { |amp=0, freq=250, intv=19, timescale=1, curve=0, loopnode=0, dens = 10, resfreq = 500, ringtime = 0.01|\n var n = 15;\n var env = EnvGen.kr(\n Env({ 1.0.rand2 }!(n+1), {1.0.rand}!n, curve, releaseNode: n-1, loopNode: loopnode.min(n-3)),\n timeScale: timescale);\n var pitch = (env * [1, 0.33, -1] * intv).midiratio * freq;\n var form = Formant.ar(pitch, pitch.rotate(1) * 1.6, pitch.rotate(2) * 2.6);\n\n var dusty = Ringz.ar(\n Dust.ar(dens!3),\n resfreq * LFNoise0.kr([3, 5, 7], 0.5, 1),\n ringtime)\n * ((dens ** -0.5) * (ringtime ** -0.3)\n );\n\n Splay.ar(form * dusty, level: amp) ;\n});\n);\n\nNdef(\\dog).set(\\amp, 0.2).vol_(0.2);\nNdef(\\dog).gui.moveTo(400, 380);\n\n/*\n// Ndef(\\dog).addHalo(\\orderedNames, Ndef(\\dog).controlKeys);\nNdef(\\dog).controlKeys;\nNdef(\\dog).vol_(0.5);\nNdefPreset( Ndef(\\dog) ).loadSettings;\nNdef(\\dog).play;\nNdef(\\dog).gui;\n*/\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code:\n```supercollider\n{ SinOsc.ar(440) * EnvGen.kr(Env.perc(0.01, 1), doneAction: 2) }.play;\n```"}, {"role": "assistant", "content": "It plays a 440 Hz sine with a percussive envelope, and the Synth frees itself when the envelope\nends.\n\n- `SinOsc.ar(440)` is an audio-rate sine at 440 Hz.\n- `Env.perc(0.01, 1)` is a 10 ms attack to full level then a 1 s decay to zero.\n- `EnvGen.kr(...)` plays that envelope at control rate and multiplies the sine, so the sound fades out.\n- `doneAction: 2` frees the Synth at the end of the envelope, so it does not accumulate silent nodes.\n- `.play` on the function builds an anonymous SynthDef and starts one Synth of it."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Granular electromaton. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\nServer.local.waitForBoot({\n(\nz.free;\nz = Buffer.alloc(s, 512, 1);\nz.sine1(1.0 / [1, 2, 3, 4], true, true, true);\n\n fork( { loop {\n SynthDef(\"g1\",{ arg out=0,bufnum=0,dur=1,rate=1,pos=0,sdens=1,edens=1;\n var dens = Line.kr(sdens,edens,dur);\n var trig = [LFNoise0,SinOsc,Impulse,LFPulse,LFSaw].choose.ar(Line.kr(sdens,edens,dur));\n //var env = EnvGen.kr(Env.perc(0.0001.rrand(0.1),dur*0.5.rrand(2)),doneAction:2);\n var env = EnvGen.kr(Env.perc(0.0001.rrand(0.1),dur*(0.5.rrand(4))),doneAction:2);\n Out.ar(out,\n GrainBuf.ar(2,trig,1/dens,bufnum,rate,pos)*env;\n )\n }).add();\n [1,2,4,8,16,32].choose.postln.wait;\n }\n }\n );\n\n\na = Pbind(\\instrument,\\g1,\\dur,Pseq([Pseq([0.25],32),Pseq([0.25,0.125,0.125],32),Pseq([0.125],32)],inf),\\sdens,Pseq([9000,1000,500]/10,inf),\\edens,Prand([Pseq([9000,1000,500]/10,4),Pseq([1],1)],inf),\\rate,Pfunc({-10.0.rrand(10)}),\\pos,Pfunc({1.0.rand}),\\bufnum,z.bufnum);\nb = Pbind(\\instrument,\\g1,\\dur,Pseq([4],inf),\\sdens,Pseq([9000,1000,500]/100,inf),\\edens,Prand([Pseq([9000,1000,500]/10,1),Pseq([1],3)],inf),\\rate,Pfunc({-10.0.rrand(10)}),\\pos,Pfunc({-10.0.rrand(10)}),\\bufnum,z.bufnum);\nc = Pbind(\\instrument,\\g1,\\dur,Pseq([4/3],inf),\\sdens,Pseq([9000,1000,500,25],inf),\\edens,Prand([Pseq([9000,1000,500,25],1),Pseq([1],4)],inf),\\rate,Pfunc({-100.0.rrand(100)}),\\pos,Pfunc({-10.0.rrand(10)}),\\bufnum,z.bufnum);\n\n\na =a.play;\nb =b.play;\nc =c.play;\n\n)\n});\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `CutPBS1` in SuperCollider?"}, {"role": "assistant", "content": "CutPBS1 — CutBuf playback rate algorithm CutPBS1 is intended to be used in the pbsfunc (playback speed func) parameter of CutBuf2 and CutBuf3. The first repeat of each block has rate 1, and the following repeats follow a geometric sequence. Category: Libraries > BBCut > Cut FX."}]} +{"conversations": [{"role": "user", "content": "What does `RedOscillator2.couple` do? What arguments does it take?"}, {"role": "assistant", "content": "Apply influence from two other oscillator's phase (normally left and right when connected in a ring). Call this before each Arguments: prev — The EMPHASISleft LINKClasses/RedOscillator2 instance.; next — The EMPHASISright LINKClasses/RedOscillator2 instance.."}]} +{"conversations": [{"role": "user", "content": "Explain `PStandardN` in SuperCollider briefly."}, {"role": "assistant", "content": "PStandardN — UGenPatterns quark library Standard Map. Category: Streams-Patterns-Events > UGenPatterns > Generators."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n~resize_enveloppe = { | levels, times |\n var reverted_levels, index;\n index = 0;\n reverted_levels = levels.reverse;\n while( { reverted_levels[index] == 0 && reverted_levels[index+1] == 0 }, { times[ times.size - 1 - index] = 0.01; index = index + 1 } );\n};\n)\n```"}, {"role": "assistant", "content": "Enveloppes sizes are fixed. This means that if enveloppe's levels are equals to [ 1, 0, 0, 0, 0, 0, 0, 0 ] and times are equals to [ 1, 1, 1, 1, 1, 1, 1, 1 ], the synth UGens will take resources 8 seconds but will only be audible 1 second. To avoid this, passing both the levels and the times to this function will detect when the sound stops playing and will reduce the \"silence\" times to 0.01s, thu."}]} +{"conversations": [{"role": "user", "content": "What is `NumOutputBuses` in SuperCollider?"}, {"role": "assistant", "content": "NumOutputBuses — Number of output busses. Category: UGens > Info."}]} +{"conversations": [{"role": "user", "content": "What is `PV_MagMul` in SuperCollider?"}, {"role": "assistant", "content": "PV_MagMul — Multiply magnitudes. Multiplies magnitudes of two inputs and keeps the phases of the first input. Category: UGens > FFT."}]} +{"conversations": [{"role": "user", "content": "What does `LoopBuf.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "sample looping oscillator Arguments: numChannels — number of channels that the buffer will be. this must be a fixed integer. The architecture of the SynthDef cannot change after it is compiled.; bufnum — the index of the buffer to use; rate — - 1.0 is normal, 2.0 is one octave up, 0.5 is one octave down. -1.0 is backwards normal rate ... etc.; gate — positive gate starts playback from startPos. negative gate plays rest of sample from current position; startPos — sample frame to start playback; startLoop — sample frame of start of loop; endLoop — sample frame of end of loop; interpolation — 1 means no interpolation, 2 is linear, 4 is cubic interpolation."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nb = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n\n(\n{\n var snd, envTime, knee, out;\n snd = PlayBuf.ar(1, b, BufRateScale.kr(b), loop: 1);\n envTime = MouseX.kr(1.0e-3, 0.1e-3);\n knee = MouseY.kr(0, -90).dbamp;\n out = DelayC.ar(snd, 0.01, envTime * 0.5) * EnvFollow.ar(snd, 1 - (envTime * SampleRate.ir).reciprocal).max(knee).reciprocal;\n out * 0.1!2\n}.play;\n)\n```"}, {"role": "assistant", "content": "a replication of the legendary LADSPA plugin of the same name, originally written by steve harris. a compressor with a super fast attack which results in harsh distortion fx. requires sc3-plugins."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Convolution2L`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// one last example\n(\nb = Buffer.alloc(s, 512, 1);\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, true, true);\n);\n\n(\n{\n var input = SoundIn.ar(0);\n var framesize = 512;\n Convolution2L.ar(input, b, 0, framesize, 1, 0.5);\n}.play\n);\n\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nSynthDef(\"mini\",{\n Out.ar( 0,\n Instr.ar(\"minimoog.two\", SinOsc.kr(1.0).range(300,500) )\n )\n}).send(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nSynthDef(\"mini\",{\n Out.ar( 0,\n Instr.ar(\"minimoog.two\", SinOsc.kr(1.0).range(300,500) )\n )\n}).send(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Ringz` that runs as it is."}, {"role": "assistant", "content": "```supercollider\na = NodeProxy(s);\na[0] = { |freq = 440, dt=0.1, rate=2| Ringz.ar(Impulse.ar(rate * [1, 1.2]), freq, dt)*0.1 };\na.play;\n(\na[1] = \\set -> Pbind(\n \\dur, Prand([1, 0.5], inf),\n \\freq, Pwhite(200.0, 1000, inf),\n \\rate, Pdup(4, Prand([1, 3, 6, 10], inf)),\n \\dt, Pwhite(0.01, 0.1, inf)\n)\n);\n// modify the source in the meanwhile:\na[0] = { |freq = 440, dt=0.1, rate=2| Ringz.ar(Dust.ar(rate * 10.dup), freq, dt)*0.1 };\n\na.nodeMap.postln; // the values are not set in the node map.\na.clear(3);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n//Its not the spline that loops (that would be a loop in 2 dimensional space) but the SplineGen that is set to loop.\n\n// the spline does NOT loop,\nb = BSpline( Array.fill(16,{ arg i; [ i * 0.25,1.0.rand ] }), 3.0,false );\n\nb.gui(nil,1200@300);\n\n\n);\n(\n// the SplineGen loops\n{\n Saw.ar(SplineGen(b,loop:true).kr.linexp(0.0,1.0,40,500).clip(40,500)).dup * 0.4\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n//Its not the spline that loops (that would be a loop in 2 dimensional space) but the SplineGen that is set to loop.\n\n// the spline does NOT loop,\nb = BSpline( Array.fill(16,{ arg i; [ i * 0.25,1.0.rand ] }), 3.0,false );\n\nb.gui(nil,1200@300);\n\n\n);\n(\n// the SplineGen loops\n{\n Saw.ar(SplineGen(b,loop:true).kr.linexp(0.0,1.0,40,500).clip(40,500)).dup * 0.4\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "[ 1, 2, 1, 1, 2, 1, 1 ] how to find adjacent elements in an array?"}, {"role": "assistant", "content": "SuperCollider forum — [ 1, 2, 1, 1, 2, 1, 1 ] how to find adjacent elements in an array\n\nRandColors:\n\nI need to find the index, the how many times (the adjacent values are equal) and what is the adjacent value.\n\nThis is perhaps a bit verbose and clunky, but it meets the above specification:\n\n```supercollider\n(\n~repeats = {|array|\n // return [index, number of repeats, the value] for each repeated value\n var results = [];\n var thisIndex = 0;\n var thisCount = 1;\n var thisValue = array[0];\n array[1..].do{|val, i|\n if(val == thisValue,\n {thisCount = thisCount + 1},\n {\n if(\n thisCount > 1,\n {results = results.add([thisIndex, thisCount, thisValue])},\n );\n thisValue = val;\n thisIndex = i + 1;\n thisCount = 1;\n }\n )\n };\n if(thisCount > 1, {results = results.add([thisIndex, thisCount, thisValue])});\n results;\n}\n);\n\na = [1, 2, 1, 1, 1, 2, 1, 1];\nb = ~repeats.value(a);\n\na = [2, 3, 5, 5];\nb = ~repeats.value(a);\n```"}]} +{"conversations": [{"role": "user", "content": "What is `PSVop_o` in SuperCollider?"}, {"role": "assistant", "content": "PSVop_o — Sieve pattern for arbitrary set operations of integer generators with offsets and point output Pattern for arbitrary set operations of integer generators with offsets and point output. For an introduction and more examples see Sieves_and_Psieve_patterns. Category: Libraries > miSCellaneous > Sieves and Psieve Patterns, Streams-Patterns-Events > Sieves and Psieve Patterns."}]} +{"conversations": [{"role": "user", "content": "What does `StaticIntegerSpec.defaultControl` do? What arguments does it take?"}, {"role": "assistant", "content": "an integer that is supplied at the init of a synth and cannot change Arguments: val."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// increase feedback\n{ FBSineL.ar(SampleRate.ir, 1, Line.kr(0.01, 4, 10), 1, 0.1) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// increase feedback\n{ FBSineL.ar(SampleRate.ir, 1, Line.kr(0.01, 4, 10), 1, 0.1) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Object.hash` do?"}, {"role": "assistant", "content": "Answer a code used to index into a hash table. This is used by Dictionary and Set and their subclasses to implement fast object lookup. Objects which are equal == should have the same hash values. Whenever == is overridden in a class, hash should be overridden as well. `a = \"worth trying\"; b = \"worth"}]} +{"conversations": [{"role": "user", "content": "What does `SequenceableCollection.selectIndices` do?"}, {"role": "assistant", "content": "Return a new collection of same type as receiver which consists of all indices of those elements of the receiver for which function answers `true`. The function is passed two arguments, the item and an integer index. `#[a, b, c, g, h, h, j, h].selectIndices({ |item, i| item ===` If you want to control what type of collection is returned, use"}]} {"conversations": [{"role": "user", "content": "What does `SetResetFF.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Set-reset flip flop. Arguments: trig — The trigger that sets output to 1. Trigger can be any signal. A trigger happens when the signal changes from non-positive to positive.; reset — The trigger that sets output to 0. Trigger can be any signal. A trigger happens when the signal changes from non-positive to positive.."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for automatically playback of all soundfiles in a directory."}, {"role": "assistant", "content": "```supercollider\n(\nw = {|pathPattern|\nvar soundFiles;\n// get sounds\nsoundFiles = SoundFile.collect(pathPattern);\n\n// play back in order of their appearance\nPseq(soundFiles.collect{|file| file.cue((\\dur: file.duration))}, 1).play;\n}\n);\n\n// adjust path and evaluate the next line\nw.value(\"/Volumes/usbImport/PMD620/200804062000/*.WAV\")\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Snow (a SuperCollider snippet)?"}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\snow, { arg freq=200, pan=0, amp=0.1, speed=1;\n var sig;\n var size = 20;\n var trig = Impulse.ar({ rrand(1/1,15.0) } ! size * \\density.kr(1));\n sig = { WhiteNoise.ar } ! size;\n sig = sig.collect({ arg sig, x;\n var bpfreq = exprand(50.0,16000) * \\tone.kr(1);\n var bpfrq = 0.1 * SinOsc.ar(( x+1 ) * 1/153 * speed).exprange(0.1,4) * \\blur.kr(1);\n sig = BPF.ar(sig, bpfreq, bpfrq) * 34;\n sig = BPF.ar(sig, bpfreq, bpfrq) * 4;\n sig = sig * EnvGen.ar(Env([0,1,0],[0.1,0.8]), trig[x]);\n //sig = sig.fold2( LFNoise0.kr(1/23 * ( x+1 ) * speed).range(0.01,8) ) * 4;\n sig = sig * SinOsc.ar(1/700 * ( x+1 ) * speed).range(0.01,1);\n });\n sig = Pan2.ar(sig, ( { rrand(-1.0,1) } ! size * SinOsc.ar(1/132 * (1..size) * speed).range(0,1) ), amp).mean;\n}).play;\n);\nNdef(\\snow).fadeTime = 16;\nNdef(\\snow).edit;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//This example requires the FluCoMa tools to be installed from::\n//https://www.flucoma.org/download/\n\n(\nAlga.boot({\n //Sine oscillator with frequency modulation\n a = AN({ SinOsc.ar(\\freq.kr(10) + \\fm.ar(0)) }).play(chans:2);\n\n //Sine oscillator\n b = AN({ SinOsc.ar(\\freq.kr(440)) });\n\n //Pitch analyser\n c = AN({ FluidPitch.kr(\\in.ar) });\n\n //Patch first oscillator into the pitch analyser.\n a >> c;\n\n //Patch the pitch analyser into the \\freq input of the second oscillator\n c >>.freq b;\n\n //Create feedback: patch b's output to a's \\fm input, mapping -1 / 1 to -200 / 300\n a.from(b, \\fm, scale:[-200, 300], time:0.5);\n});\n);\n\n//Try with different scalings (change the values)\na.from(b, \\fm, scale:[-1432, 679], time:3);\n\n//Try new base frequencies (change the value)\na.from(100, \\freq, time:2);\n\n//Bye bye\n(\na.clear({\n b.clear;\n c.clear;\n}, time:3)\n);\n```"}, {"role": "assistant", "content": "This example requires the FluCoMa tools to be installed from https://www.flucoma.org/download/."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n/*\n( // PlayerBinop not yet implemented\n\nPatch(\\monosynth,[\n BeatClockPlayer.new(16) * MIDIGatePlayer.new,\n MIDIFreqPlayer.new,\n CCPlayer(50,[100,3000,\\exp,0.0,1500.0]),\n CCPlayer(51,[0.1,0.9,\\exp,0.0,0.2]),\n CCPlayer(52,[0.05,1.0])\n]).play\n\n\n*/\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n/*\n( // PlayerBinop not yet implemented\n\nPatch(\\monosynth,[\n BeatClockPlayer.new(16) * MIDIGatePlayer.new,\n MIDIFreqPlayer.new,\n CCPlayer(50,[100,3000,\\exp,0.0,1500.0]),\n CCPlayer(51,[0.1,0.9,\\exp,0.0,0.2]),\n CCPlayer(52,[0.05,1.0])\n]).play\n\n)\n*/\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `PSVop` in SuperCollider briefly."}, {"role": "assistant", "content": "PSVop — Sieve pattern for arbitrary set operations of integer generators with point output Pattern for arbitrary set operations of integer generators with point output. For an introduction and more examples see Sieves_and_Psieve_patterns. Category: Libraries > miSCellaneous > Sieves and Psieve Patterns, Streams-Patterns-Events > Sieves and Psieve Patterns."}]} -{"conversations": [{"role": "user", "content": "Explain `SClusterDistortions` in SuperCollider briefly."}, {"role": "assistant", "content": "SClusterDistortions — control SCluster distortions Distortions control for LINKClasses/SCluster. Category: SInstruments."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Ringz`."}, {"role": "assistant", "content": "```supercollider\n(\na = {\n // rectangular pulse exciter (deterministic input)\n var exc = EnvGen.ar(Env([1, 1, 0], [0.01, 0], \\lin)),\n sig = Ringz.ar(exc, 440, decaytime: 0.2),\n rms = sqrt(Integrator.ar(sig.squared) * (0.2 / SampleRate.ir)),\n end = DetectSilence.ar(sig, doneAction: 2);\n rms.poll(end);\n Silent.ar(1)\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `MethodLabel.classMethod` do? What arguments does it take?"}, {"role": "assistant", "content": "a brown colored button that displays the name of a label and inspects the Method when clicked Arguments: method; layout — the parent view, FlowView or window; minWidth — Label will automatically size itself to fit the name. minWidth specifies a minimum width so that multiple labels will align nicely.. Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "What does `SimpleNumber.cylNeumannPrime` do?"}, {"role": "assistant", "content": "Returns the first derivative with respect to x of the corresponding Neumann function. Requires `x >"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Lag3`."}, {"role": "assistant", "content": "```supercollider\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n Lag3.kr( // lag the modulator\n LFPulse.kr(4, 0, 0.5, 50, 400), // frequency modulator\n Line.kr(0, 1, 15) // modulate lag time\n ),\n 0, // phase\n 0.3 // sine amplitude\n )\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for late night experimenting."}, {"role": "assistant", "content": "```supercollider\n(\nvar seed = thisThread.randSeed = 1e8.rand.debug('seed');\n{|dur = 30|\n var voices = 2.pow(1.rrand(4)),\n sig = DelayC.ar({ Pan2.ar(\n PMOsc.performList(\\ar, {\n var freq = Lag.ar(LFSaw.ar([10,15]/((1..5).choose*[1,2,4].choose)).exprange(\n {200.rrand(400)}!2, {500.rrand(1100)}!2\n * Line.kr(0.5.rrand(2), 3.rrand(8.0),dur)\n ));\n [freq, freq/[2,4].choose + SinOsc.kr([10,25],0,5), XLine.kr(0.1,1.rrand(3.0),dur/1.rrand(2.0))]\n }.()).sum/2,\n [SinOsc,LFTri].choose.kr({4.0.rrand(11)}!2 * [XLine,Line].choose.kr(1,4,dur))\n ).sum/2 \n * LFGauss.kr(XLine.kr(\\beat.kr, \\beat.kr / \\beat_change.kr, dur) / [0.5,1,2,4].choose, 0.3) \n * EnvGen.kr([\n Env.perc(0.1,dur),\n Env.sine(dur),\n Env.performList(\\new, {|len| [\n [0]++Array.rand(len,0.1,1)++[0],\n Array.rand(len,0.1,1).normalizeSum * dur,\n Array.rand(len-1,-3.0,3.0)+[0]\n ]}.(2.rrand(10)))\n ].choose) } ! voices, 4, { 0.1.rrand(4) } ! voices, 1 / voices).sum * Line.kr(1,1,dur+5,doneAction:2);\n sig = Rotate2.ar(sig[0],sig[1], LFSaw.kr(Duty.kr(dur/4.rrand(16), 0, Drand([-1*\\beat.kr,\\beat.kr].reciprocal,inf))));\n}.play(args:[\n dur:1.rrand(25.0).debug('dur'), \n beat:1.rrand(6)*(1..4).reciprocal.choose/4, \n beat_change:1.rrand(8)\n])\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\"detectSilence-help\", { |out|\n var z;\n z = SinOsc.ar(Rand(400, 700), 0, LFDNoise3.kr(8).max(0)).softclip * 0.3;\n DetectSilence.ar(z, doneAction: Done.freeSelf);\n Out.ar(out, z);\n}).add;\n);\n\nSynth(\"detectSilence-help\");\nSynth(\"detectSilence-help\");\nSynth(\"detectSilence-help\");\n\n\n(\nTask({\n loop({\n Synth(\"detectSilence-help\");\n [0.5, 1].choose.wait;\n })\n}).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\"detectSilence-help\", { |out|\n var z;\n z = SinOsc.ar(Rand(400, 700), 0, LFDNoise3.kr(8).max(0)).softclip * 0.3;\n DetectSilence.ar(z, doneAction: Done.freeSelf);\n Out.ar(out, z);\n}).add;\n);\n\nSynth(\"detectSilence-help\");\nSynth(\"detectSilence-help\");\nSynth(\"detectSilence-help\");\n\n\n(\nTask({\n loop({\n Synth(\"detectSilence-help\");\n [0.5, 1].choose.wait;\n })\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for smooth arpeggio, updated envelope (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\bass, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.perc(0.2), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `ClassGui.guiBody` do? What arguments does it take?"}, {"role": "assistant", "content": "a Class inspector showing superclasses, methods and internals Arguments: layout — the parent view, FlowView or window. Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Simple Amplitude Tracker (language side)?"}, {"role": "assistant", "content": "```supercollider\n(\n// Simple amplitude tracker sending values to sclang\nSynthDef(\\ampTracker, { |in|\n var freq = 30; // num of values per second\n SendReply.kr(Impulse.kr(freq), '/amp', Amplitude.kr(SoundIn.ar(in)));\n}).add;\n);\n\n// start the tracker on scsynth\nSynth(\\ampTracker);\n\n(\n// receive the values in sclang\nOSCdef(\\ampTracker, { |m|\n m.postln;\n // now use m[3] for your purpose (detecting changes, etc...)\n}, '/amp');\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Monitor.group` do?"}, {"role": "assistant", "content": "Return the group in which all mapping synths are"}]} -{"conversations": [{"role": "user", "content": "What does `ArrayedCollection.extend` do?"}, {"role": "assistant", "content": "Extends the object to match size by adding a number of items. If size is less than receiver size then truncate. This method may return a new ArrayedCollection. For this reason, you should always assign the result of `extend` to a variable - never depend on add changing the receiver."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// per convention keys after \\dur are the ones to be set\n// playing ends after end of last stream\n\n(\np = PmonoPar([\n [\n \\dur, 1.0,\n \\pan, Pser([-0.9, 0, 0.9], 8) \n ],[\n \\dur, 0.4,\n \\freq, Pexprand(300, 1000, 24) \n ],[\n \\dur, 0.2,\n \\amp, Pseq([0.05, 0.3], 30) \n ]\n]).trace.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// per convention keys after \\dur are the ones to be set\n// playing ends after end of last stream\n\n(\np = PmonoPar([\n [\n \\dur, 1.0,\n \\pan, Pser([-0.9, 0, 0.9], 8) \n ],[\n \\dur, 0.4,\n \\freq, Pexprand(300, 1000, 24) \n ],[\n \\dur, 0.2,\n \\amp, Pseq([0.05, 0.3], 30) \n ]\n]).trace.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Swarm of sound files."}, {"role": "assistant", "content": "```supercollider\nb = SoundFile.collectIntoBuffers(\"yourSoundFileFolder/*\"); // By Bjørn Houdorf, December 21, 2012\n\n(\n{\nvar number = b.numChannels, randomNumber, trigger, delayed, panned, sound, mixedSound, rotatedSound;\ntrigger = Dust.kr(Array.fill(number,1), 1, -0.5); // Generates random impulses from -0.5 to 0.5. as a excitation function\nrandomNumber = TRand.kr(1, number, trigger);\nsound = PlayBuf.ar(Array.fill(number,1) ,randomNumber,1,trigger,0,0); // play sound files\ndelayed = DelayL.ar(sound, trigger, trigger); // delaying the sound files\npanned = Pan2.ar(delayed, Array.fill(number,{1.0.rand2})); // pan them out in the stereo field\nmixedSound = 0.05*Mix.new(panned);// and mix them to one stereo signal\nrotatedSound = Rotate2.ar(mixedSound[0], mixedSound[1], LFSaw.kr(0.05)); // rotate stereo signal\n}.play; // play it all\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a chord progression with Pbind."}, {"role": "assistant", "content": "Put an array of degrees in the pattern, use \\strum to spread the chord, and the default instrument\nplays all notes of each event.\n\n```supercollider\n(\nPbind(\n \\scale, Scale.minor,\n \\root, 2,\n \\degree, Pseq([[0, 4, 7], [-3, 0, 4], [-5, -1, 2], [0, 4, 7]], inf),\n \\dur, 1.5,\n \\strum, 0.02,\n \\amp, 0.12,\n \\legato, 0.9\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `ToggleFF` in SuperCollider briefly."}, {"role": "assistant", "content": "ToggleFF — Toggle flip flop. Toggles between 0 and 1 upon receiving a trigger. Category: UGens > Triggers."}]} -{"conversations": [{"role": "user", "content": "What does `WebView.onContentsSizeChanged` do?"}, {"role": "assistant", "content": "Sets the object to be evaluated when the contents size of the view has"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\nb = Buffer.alloc(s, 2048, 1);\nc = Buffer.read(s, \"sounds/a11wlk01.wav\");\n);\n\n(\nSynthDef(\"help-magGate\", { arg out=0, bufnum=0, soundBufnum=2;\n var in, chain;\n in = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);\n chain = FFT(bufnum, in);\n chain = PV_MagGate(chain, MouseX.kr(0, 100), MouseY.kr(0, 1));\n Out.ar(out, IFFT(chain).dup);\n}).play(s,[\\out, 0, \\bufnum, b.b\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\nb = Buffer.alloc(s, 2048, 1);\nc = Buffer.read(s, \"sounds/a11wlk01.wav\");\n);\n\n(\nSynthDef(\"help-magGate\", { arg out=0, bufnum=0, soundBufnum=2;\n var in, chain;\n in = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);\n chain = FFT(bufnum, in);\n chain = PV_MagGate(chain, MouseX.kr(0, 100), MouseY.kr(0, 1));\n Out.ar(out, IFFT(chain).dup);\n}).play(s,[\\out, 0, \\bufnum, b.bufnum, \\soundBufnum, c.bufnum]);\n);\n\n(\nSynthDef(\"help-magGate2\", { arg out=0, bufnum=0, soundBufnum=2;\n var in, chain, remove;\n in = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);\n chain = FFT(bufnum, in);\n remove = MouseY.kr(0, 1);\n chain = PV_MagGate(chain, MouseX.kr(-50, 0), remove);\n Out.ar(out, (remove * 3 - 2) * IFFT(chain).dup);\n}).play(s,[\\out, 0, \\bufnum, b.bufnum, \\soundBufnum, c.bufnum]);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `PulseDPW` in SuperCollider briefly."}, {"role": "assistant", "content": "PulseDPW — super-efficient square-wave oscillator with low aliasing Use this just like the Pulse UGen - as with SawDPW, this uses the \"Differentiated Parabolic Wave\" technique to create a waveform extremely efficiently and with low (but not zero) aliasing. Category: UGens > Generators."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Free`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\nSynthDef(\"a\", { Out.ar(0, SinOsc.ar(800, 0, 0.2)) }).add;\n\nSynthDef(\"b\", { |t_t = 0| Out.ar(1, PinkNoise.ar(0.3)); Free.kr(t_t, 1001) }).add;\n\ns.sendMsg(\\s_new, \\a, 1001, 0, 0);\n\ns.sendMsg(\\s_new, \\b, 1002, 0, 0);\n\ns.sendMsg(\\n_set, 1002, \\t_t, 1);\n\ns.sendMsg(\\s_new, \\a, 1001, 0, 0);\n\ns.sendMsg(\\n_set, 1002, \\t_t, 1);\n\ns.sendMsg(\\s_new, \\a, 1001, 0, 0);\n\ns.sendMsg(\\n_set, 1002, \\t_t, 1);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Enveloppes sizes are fixed."}, {"role": "assistant", "content": "```supercollider\n(\n~resize_enveloppe = { | levels, times |\n var reverted_levels, index;\n index = 0;\n reverted_levels = levels.reverse;\n while( { reverted_levels[index] == 0 && reverted_levels[index+1] == 0 }, { times[ times.size - 1 - index] = 0.01; index = index + 1 } );\n};\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Fb1_MSD.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new Fb1_MSD ar Arguments: f — External force. Defaults to 0.; mass — Mass. Defaults to 1.; spring — Spring stiffness. Defaults to 1.; dampen — Dampening factor. Defaults to 0.; tMul — Time multiplier, which determines velocity of proceeding in the dynamic system. The default value 1 means that the step delta of time equals 1 / sample duration. For getting audible oscillations you might, depending on the ODE definition, have to pass much higher values. Can also be a kr / ar UGen a; t0 — Initial time. Expects Number. Defaults to 0.; y0 — Initial value of the ODE. Expects array of size 2. Defaults to #[0, 0].; intType — Integration type. Expects one of the Symbols, for which procedures are stored with Fb1_ODEintdef. The use of symplectic procedures (with prefix 'sym') is highly recommended. Defaults to \\sym2. For more accurate integration you can try symplectic procedures of higher order like \\sym4, \\sym8 etc. Fami."}]} -{"conversations": [{"role": "user", "content": "Explain `PWrap` in SuperCollider briefly."}, {"role": "assistant", "content": "PWrap — UGenPatterns quark library Based on Wrap Category: Streams-Patterns-Events > UGenPatterns > Modifiers."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\ny = {\n var mod = GFIS.ar({ |x| sin(LFDNoise3.ar(1).range(2.9, 4) * x) }, 0.3, 7);\n SinOsc.ar(mod * [50, 51] * 70 + 300) * LFDNoise3.ar(2).range(0.2, 0.05)\n}.play\n;\n\ny.release\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\ny = {\n var mod = GFIS.ar({ |x| sin(LFDNoise3.ar(1).range(2.9, 4) * x) }, 0.3, 7);\n SinOsc.ar(mod * [50, 51] * 70 + 300) * LFDNoise3.ar(2).range(0.2, 0.05)\n}.play\n);\n\ny.release\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// decoder (two rings of 6)\n~decoder = FoaDecoderMatrix.newPeri(6\n\n// inspect\n~decoder.dirChannels.raddeg\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// decoder (two rings of 6)\n~decoder = FoaDecoderMatrix.newPeri(6)\n\n// inspect\n~decoder.dirChannels.raddeg\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `Red3DPlane` in SuperCollider briefly."}, {"role": "assistant", "content": "Red3DPlane — 3D plane / rectangle A class for rotating and rendering a plane in 3D. Category: Red > redUniverse > 3D."}]} -{"conversations": [{"role": "user", "content": "Explain `EaseInSine` in SuperCollider briefly."}, {"role": "assistant", "content": "EaseInSine — Sinusoidal ease-in Easing equation for a sinusoidal (sin(t)) ease-in, accelerating from zero velocity. Category: Ease."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nVowel().brightenRel(1 ).dBs.postln; \nVowel().brightenRel(0.1).dBs.postln;\nVowel().brightenRel(1.5).dBs.postln;\n\n// refFormant = 0 loud on the left\n{Formants.ar(100, Vowel().brightenRel(MouseX.kr(0, 2), 0 )) * 0.1}.play\n// refFormant = 1\n{Formants.ar(100, Vowel().brightenRel(MouseX.kr(0, 2), 1 )) * 0.1}.play\n// refFormant = 2\n{Formants.ar(100, Vowel().brightenRel(MouseX.kr(0, 2), 2 )) * 0.1}.play\n// refFormant = 3\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nVowel().brightenRel(1 ).dBs.postln; \nVowel().brightenRel(0.1).dBs.postln;\nVowel().brightenRel(1.5).dBs.postln;\n\n// refFormant = 0 loud on the left\n{Formants.ar(100, Vowel().brightenRel(MouseX.kr(0, 2), 0 )) * 0.1}.play\n// refFormant = 1\n{Formants.ar(100, Vowel().brightenRel(MouseX.kr(0, 2), 1 )) * 0.1}.play\n// refFormant = 2\n{Formants.ar(100, Vowel().brightenRel(MouseX.kr(0, 2), 2 )) * 0.1}.play\n// refFormant = 3\n{Formants.ar(100, Vowel().brightenRel(MouseX.kr(0, 2), 3 )) * 0.1}.play\n// refFormant = 4 loud on the right\n{Formants.ar(100, Vowel().brightenRel(MouseX.kr(0, 2), 4 )) * 0.1}.play\n```"}]} -{"conversations": [{"role": "user", "content": "What does `RedFood.eat` do?"}, {"role": "assistant", "content": "Takes away energy from this Returns: How much energy was taken away. Energy can not go below 0 so if there is 6 left and 10 is taken, this method returns 4."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\\acid, { |out, freq = 1000, gate = 1, pan = 1, cut = 4000, rez = 0.8, amp = 1|\n Out.ar(out,\n Pan2.ar(\n RLPF.ar(\n Pulse.ar(freq, 0.05),\n cut, rez),\n pan) * EnvGen.kr(Env.linen(0.01, 1, 0.3), gate, amp, doneAction: Done.freeSelf);\n )\n}).add;\n);\n\n(\nPbind(\\instrument, \\acid, \\dur, Pseq([0.25, 0.5, 0.25], inf), \\root, -12,\n \\degree, Pseq([0, 3, 5, 7, 9, 11, 5, 1], inf), \\pan, Pfun\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\\acid, { |out, freq = 1000, gate = 1, pan = 1, cut = 4000, rez = 0.8, amp = 1|\n Out.ar(out,\n Pan2.ar(\n RLPF.ar(\n Pulse.ar(freq, 0.05),\n cut, rez),\n pan) * EnvGen.kr(Env.linen(0.01, 1, 0.3), gate, amp, doneAction: Done.freeSelf);\n )\n}).add;\n);\n\n(\nPbind(\\instrument, \\acid, \\dur, Pseq([0.25, 0.5, 0.25], inf), \\root, -12,\n \\degree, Pseq([0, 3, 5, 7, 9, 11, 5, 1], inf), \\pan, Pfunc({ 1.0.rand2 }),\n \\cut, Pxrand([1000, 500, 2000, 300], inf), \\rez, Pfunc({ 0.7.rand +0.3 }), \\amp, 0.2).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `PathName.files` do?"}, {"role": "assistant", "content": "returns a list of all the files in the folder represented by this path."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for very punchy snare in neurofunk style."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\neurosnare, {\n var snd;\n // a percussive click to give it some attack\n snd = LPF.ar(HPF.ar(WhiteNoise.ar, 300), 8000) * Env.linen(0.001, 0.01, 0.001).ar;\n // sine sweep body. very important!\n snd = snd + (SinOsc.ar(Env([400, 196, 160], [0.04, 0.2], \\exp).ar) * Env.perc(0.04, 0.2).ar * 6.dbamp).tanh;\n // sound of snare coils rattling\n snd = snd + (HPF.ar(BPeakEQ.ar(WhiteNoise.ar, 4000, 0.5, 3), 300) * Env.perc(0.05, 0.2).delay(0.01).ar(2) * -3.dbamp);\n // another sound sweep to improve the attack, optional\n snd = snd + (SinOsc.ar(XLine.kr(3000, 1500, 0.01)) * Env.perc(0.001, 0.02).ar);\n // distortion helps glue everything together and acts as a compressor\n snd = (snd * 1.4).tanh;\n snd = Pan2.ar(snd, \\pan.kr(0), \\amp.kr(0.1));\n Out.ar(\\out.kr(0), snd);\n}).add;\n);\n\nSynth(\\neurosnare, [amp: 0.4]);\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// straight usage as value pattern for midinotes\n\n(\n// lookBack determines number of items to loop, must start with 0 (no loop),\n// doSkip determines if loops should be completed or not with new lookBack values.\n\n// Passing both via Functions enables to set on the fly,\n// enable immediate loop change by setting doSkip to 1\n\n~lookBack = 0;\n~doSkip = true;\n\np = Pbind(\n \\dur, 1/5,\n \\midinote, PSloop(\n Prand((60..80), inf),\n bufSize: 10,\n lookBack: { ~lookBack },\n doSkip: { ~doSkip }\n )\n).play\n);\n\n// wait a bit to fill buffer\n// keep running, set loop lengths immediately\n\n~\n// …\n```"}, {"role": "assistant", "content": "straight usage as value pattern for midinotes lookBack determines number of items to loop, must start with 0 (no loop), (PSloop: Pattern to derive loops from a given Pattern)"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nSynthDef(\\Synth3,\n {arg ress = 0;\n var klank, env;\n klank = Klank.ar(`[{Rand(70,21000)}!7, {Rand(0.128,0.700)}!7],BrownNoise.ar(0.7));\n klank = klank;\n env = EnvGen.kr(Env.perc(0.07, ress), doneAction:2);\n Out.ar(0, klank*env.dup*0.0128);\n}).add;\n)\n\n\n{inf.do{x = rrand(0.01,0.7); Synth(\\Synth3, [\\ress, x+(7*x)]); x.wait;}}.fork\n```"}, {"role": "assistant", "content": "Play around with {Rand(70, 21000)}!7\r\n\r\nA simple example for the begginers... hope I can contribute to something =)."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{Formants.ar(100, Vowel([\\e, \\o], [\\bass])) * 0.1 }.play\n{Formants.ar(100, Vowel(\\e, [\\bass,\\alto])) * 0.1 }.play\n{Formants.ar(100, Vowel([\\e, \\o], [\\bass,\\alto]) * 0.1 }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{Formants.ar(100, Vowel([\\e, \\o], [\\bass])) * 0.1 }.play\n{Formants.ar(100, Vowel(\\e, [\\bass,\\alto])) * 0.1 }.play\n{Formants.ar(100, Vowel([\\e, \\o], [\\bass,\\alto])) * 0.1 }.play\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Object.?` do?"}, {"role": "assistant", "content": "If the receiver is nil then answer anObject, otherwise answer the"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LinRand`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-LinRand\", { |out = 0, minmax = 1|\n Out.ar(out,\n FSinOsc.ar(\n LinRand(200.0, 10000.0, minmax),\n 0, Line.kr(0.2, 0, 0.01, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n// towards hi\n(\nRoutine({\n loop({\n Synth.new(\"help-LinRand\"); 0.04.wait;\n })\n}).play;\n);\n\n// towards lo (doesn't work like that yet)\n(\nRoutine({\n loop({\n Synth.new(\"help-LinRand\", [\\minmax, -1]); 0.04.wait;\n })\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nPseq([\n Pbind(\\instrument, \\acid, \\dur, Pseq([0.25, 0.5, 0.25], 4), \\root, -24,\n \\degree, Pseq([0, 3, 5, 7, 9, 11, 5, 1], inf), \\pan, Pfunc({ 1.0.rand2 }),\n \\cut, Pxrand([1000, 500, 2000, 300], inf), \\rez, Pfunc({ 0.7.rand +0.3 }), \\amp, 0.2),\n\n Pbind(\\instrument, \\acid, \\dur, Pseq([0.25], 6), \\root, -24, \\degree, Pseq([18, 17, 11, 9], inf),\n \\pan, Pfunc({ 1.0.rand2 }), \\cut, 1500, \\rez, Pfun\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nPseq([\n Pbind(\\instrument, \\acid, \\dur, Pseq([0.25, 0.5, 0.25], 4), \\root, -24,\n \\degree, Pseq([0, 3, 5, 7, 9, 11, 5, 1], inf), \\pan, Pfunc({ 1.0.rand2 }),\n \\cut, Pxrand([1000, 500, 2000, 300], inf), \\rez, Pfunc({ 0.7.rand +0.3 }), \\amp, 0.2),\n\n Pbind(\\instrument, \\acid, \\dur, Pseq([0.25], 6), \\root, -24, \\degree, Pseq([18, 17, 11, 9], inf),\n \\pan, Pfunc({ 1.0.rand2 }), \\cut, 1500, \\rez, Pfunc({ 0.7.rand +0.3 }), \\amp, 0.16)\n\n], inf).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `CombN`."}, {"role": "assistant", "content": "```supercollider\n// These examples compare the variants, so that you can hear the difference in interpolation\n\n// Comb used as a resonator. The resonant fundamental is equal to\n// reciprocal of the delay time.\n{ CombN.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ CombL.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ CombC.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// with negative feedback:\n{ CombN.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ CombL.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ CombC.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n// used as an echo.\n{ CombN.ar(Decay.ar(Dust.ar(1, 0.5), 0.2, WhiteNoise.ar), 0.2, 0.2, 3) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `DelayL.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Simple delay line with linear interpolation. Arguments: in — The input signal.; maxdelaytime — The maximum delay time in seconds. used to initialize the delay buffer size.; delaytime — Delay time in seconds.; mul — Output will be multiplied by this value.; add — This value will be added to the output.."}]} -{"conversations": [{"role": "user", "content": "What does `Object.cyc` do?"}, {"role": "assistant", "content": "Embeds the receiver in the stream n times (default: inf), each time resetting it. `a ="}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Modulation sequencing?"}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\rlpf, { arg out=0, amp=0.1, gate=1, pan=0, spread=0.8, freq=200, doneAction=2, ffreq=4000, rq=0.3;\n var sig, sig1, sig2, sig3;\n sig = LFSaw.ar(freq * [1.01,1,0.99]);\n sig = RLPF.ar(sig, ffreq, rq);\n sig = sig * EnvGen.ar(\\adsr.kr(Env.adsr(0.01,0.1,0.8,0.1)),gate,doneAction:doneAction);\n sig = Splay.ar(sig, spread, amp, pan);\n Out.ar(out, sig);\n}).add;\n);\n\n///////// lfo communicating with main pattern\n\n(\nNdef(\\lfo1, { EnvGen.kr(Env([1,4,1],[0.1,0.2]), \\trig.tr(0)) * \\lforange.kr(1000); });\n\nPdef(\\main, Pbind(\n \\instrument, \\rlpf,\n \\midinote, Pseq([60, 62, 64], inf),\n \\legato, 0.5,\n \\move, Pseq([0,1,0, 1,0,0],inf),\n \\lforange, Pseq([1000,2000,3000],inf).stutter(8),\n \\ffreq, Pfunc({ arg ev;\n Ndef(\\lfo1).set(\\trig, ev[\\move], \\lforange, ev[\\lforange]);\n Ndef(\\lfo1);\n }),\n \\dur, 0.5\n)).play \n);\n\n////// sub pattern way\n\n(\n Pdef(\\micro, { arg midinote, move;\n Pbind(\n \\instrument, \\rlpf,\n \\midinote, midinote + \n switch(move,\n \\up, Pseq((0..7)),\n \\down, Pseq((7..0)),\n Pseq(0!8),\n ),\n \\dur, 1/16,\n )\n });\n\n Pdef(\\main,\n Pbind(\n \\instrument, \\micro,\n \\move, Pseq([\\n, \\n, \\up, \\n, \\n, \\down],inf),\n \\type, \\phrase,\n \\midinote, Pseq([60, 62, 64], inf),\n \\dur, 1/2,\n )\n ).play;\n);\n\n//////// same in mono\n\n(\n Pdef(\\micro, { arg midinote, move;\n Pmono(\n \\rlpf,\n \\midinote, midinote + \n switch(move,\n \\up, Pseq((0..7)),\n \\down, Pseq((7..0)),\n Pseq(0!8),\n ),\n \\dur, 1/16,\n )\n });\n\n Pdef(\\main,\n Pbind(\n \\instrument, \\micro,\n \\move, Pseq([\\n, \\n, \\up, \\n, \\n, \\down],inf),\n \\type, \\phrase,\n \\midinote, Pseq([60, 62, 64], inf),\n \\dur, 1/2,\n )\n ).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Saving \"Presets\"?"}, {"role": "assistant", "content": "SuperCollider forum — Saving \"Presets\"?\n\nIf you don’t care too much about it being human readable, just use writeArchive and readArchive:\n\n```supercollider\na = Array.fill(400, {rrand(0,2200)});\n\na.writeArchive(\"/Users/spluta1/Documents/SC/test\");\n\nb = Object.readArchive(\"/Users/spluta1/Documents/SC/test\");\n\nb.postln;\n```\n\nSam"}]} -{"conversations": [{"role": "user", "content": "What is `PV_MagClip` in SuperCollider?"}, {"role": "assistant", "content": "PV_MagClip — Clip bins to a threshold. Clips bin magnitudes to a maximum threshold. Category: UGens > FFT."}]} -{"conversations": [{"role": "user", "content": "What does `RedEffectsRack.new` do? What arguments does it take?"}, {"role": "assistant", "content": "allround effects rack for RedEffectModule Arguments: efxClasses — An array of red effects to be used.; out — Output bus.; group — `nil` creates a group after the `defaultGroup`.; lag — a non-modulatable lag time for all parameters in all modules.."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Formant`."}, {"role": "assistant", "content": "```supercollider\n// modulate fundamental frequency, formant freq stays constant\n{ Formant.ar(XLine.kr(400, 1000, 8), 2000, 800, 0.125) }.play\n\n// modulate formant frequency, fundamental freq stays constant\n{ Formant.ar(200, XLine.kr(400, 4000, 8), 200, 0.125) }.play\n\n// modulate width frequency, other freqs stay constant\n{ Formant.ar(400, 2000, XLine.kr(800, 8000, 8), 0.125) }.play\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Ddup`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var freq, trig;\n var in = Dseq([1, 2, 3], inf);\n var rep = Ddup(Diwhite(2, 8, inf), in);\n trig = Impulse.kr(MouseX.kr(1, 40, 1));\n freq = Demand.kr(trig, 0, rep).poll(trig) * 30 + 340;\n SinOsc.ar(freq) * 0.1\n\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pset`."}, {"role": "assistant", "content": "```supercollider\n(\nvar a, b;\na = Pset(\\freq, 801, Pbind(\\dur, 0.5));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for change stuff in running Pbind with patternproxies?"}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\clusterboom, {| out = 0, freq=55, dur=1, amp=1|\n Out.ar(\n out,\n Splay.ar({SinOsc.ar(exprand(freq-(freq/128),freq+(freq/128)),0,0.1)}!33)\n * EnvGen.kr(Env.perc,1,1,0,dur,2)\n * amp\n ) \n}).add;\n);\n\n\n(\n~notes = [ 21, 21, 9, 19, 19, 9 ];\n~durs = [ 1/4, 1/4, 1/2, 1/8, 1/8, 14/8 ];\n~amps = [ 4, 4, 0, 3, 3, 0 ];\n\n~notespatternproxy = PatternProxy(Pxrand(~notes,inf)); \n~durspatternproxy = PatternProxy(Pxrand(~durs, inf));\n~ampspatternproxy = PatternProxy(Pxrand(~amps, inf)); \n\np = Pbind(\n \\instrument, \\clusterboom,\n \\midinote, ~notespatternproxy,\n \\dur, ~durspatternproxy,\n 'amp', ~ampspatternproxy, \n);\n);\np.play;\n\n// eval while running:\n\n~notespatternproxy.source = Pxrand(~notes + 7,inf); \n~notespatternproxy.source = Pxrand(union(~notes, ~notes + 7),inf); \n~notespatternproxy.source = Pxrand(~notes,inf);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `MIDIIn`."}, {"role": "assistant", "content": "```supercollider\nMIDIIn.connect;\ns.boot;\n\n(\nSynthDef(\"sik-goo\", { |out, freq = 440, formfreq = 100, gate = 0.0, bwfreq = 800|\n var x;\n x = Formant.ar(\n SinOsc.kr(0.02, 0, 10, freq),\n formfreq,\n bwfreq\n );\n x = EnvGen.kr(Env.adsr, gate, Latch.kr(gate, gate)) * x;\n Out.ar(out, x);\n}).add;\n);\n\nx = Synth(\"sik-goo\");\n\n// set the action:\n(\n~noteOn = { |src, chan, num, vel|\n x.set(\\freq, num.midicps / 4.0);\n x.set(\\gate, vel / 200);\n x.set(\\formfreq, vel / 127 * 1000);\n};\nMIDIIn.addFuncTo(\\noteOn, ~noteOn);\n\n~noteOff = { |src, chan, num, vel|\n x.set(\\gate, 0.0);\n};\nMIDIIn.addFuncTo(\\noteOff, ~noteOff);\n\n~bend = { |src, chan, val|\n // (val * 0.048828125).postln;\n x.set(\\bwfreq, val * 0.048828125);\n};\nMIDIIn.addFuncTo(\\bend, ~bend);\n);\n\n// cleanup\nMIDIIn.removeFuncFrom(\\noteOn, ~noteOn);\nMIDIIn.removeFuncFrom(\\noteOff, ~noteOff);\nMIDIIn.removeFuncFrom(\\bend, ~bend);\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Rest`?"}, {"role": "assistant", "content": "Rest — Represents a rest in event patterns"}, {"role": "user", "content": "What does `Rest.new` do?"}, {"role": "assistant", "content": "Create an instance of Rest, with a value to be used in the resulting rest event."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// do nothing for 2 seconds\n(note: Rest(), dur: 2).play;\n\n// intersperse pauses in pattern\nPbind(\\note, Pseq([0, 4, 7, 11], inf), \\dur, Pseq([2, 1, Rest(1)], inf) / 5).play;\n```"}]} -{"conversations": [{"role": "user", "content": "What is `PLinExp` in SuperCollider?"}, {"role": "assistant", "content": "PLinExp — UGenPatterns quark library Based on LinExp Category: Streams-Patterns-Events > UGenPatterns > Modifiers."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for load all files for the hyperdisco setup."}, {"role": "assistant", "content": "```supercollider\n//// load all files for the hyperdisco setup.\n\nq = q ? ();\nq.hyperfolder = q.hyperfolder ?? { thisProcess.nowExecutingPath.dirname };\n\n(q.hyperfolder +/+ \"libs/_SynthLib.scd\").loadPaths;\n(q.hyperfolder +/+ \"libs/_FXLib.scd\").loadPaths;\n(q.hyperfolder +/+ \"setup_files/2_makeHistory.scd\").loadPaths;\n\nif (Platform.hasQt) {\n (q.hyperfolder +/+ \"setup_files/1a_Butz.scd\").loadPaths;\n (q.hyperfolder +/+ \"setup_files/1b_winbounds.scd\").loadPaths;\n (q.hyperfolder +/+ \"setup_files/2b_makeHistoryGUI.scd\").loadPaths;\n};\n\n// this may be too harsh - comment out if not needed!\nServer.killAll;\n\nTask {\n try { (q.hyperfolder +/+ \"setup_files/1_logMeIn.scd\").loadPaths } {\n \"*** setup_files/1_logMeIn.scd failed!\".postln;\n };\n 1.wait;\n\n (q.hyperfolder +/+ \"setup_files/3_runCode*.scd\").loadPaths;\n\n // this could be problematic,\n if (Platform.hasQt) {\n // maybe we need a non-doc- SyncText version?\n (q.hyperfolder +/+ \"setup_files/4_makeSyncedEditor.scd\").loadPaths;\n // sent drawing code will just be ignored ...\n /// would be nice if it did get shown!\n (q.hyperfolder +/+ \"setup_files/5_drawer.scd\").loadPaths;\n };\n\n s.options.memSize = (2 ** 18).asInteger;\n s.waitForBoot {\n s.sync;\n (q.hyperfolder +/+ \"setup_files/6_HyperMasterFX.scd\").loadPaths;\n };\n\n}.play(AppClock);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `UScoreEditor.unmuteEvents` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: events — (describe argument here). Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `PbindProxy`."}, {"role": "assistant", "content": "```supercollider\na = PbindProxy(note: Pseq([0, 7, 9]), dur: 0.2).play;\na.stop;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\n(\nSynthDef(\"help-PinkNoise\", { |out = 0|\n Out.ar(out, PinkNoise.ar(0.1))\n}).add;\n\nSynthDef(\"help-In\", { |out = 0, in = 0|\n var input;\n input = In.ar(in, 1);\n Out.ar(out, input);\n\n}).add;\n);\n\n// play noise on the right channel\nx = Synth(\"help-PinkNoise\", [\\out, 1]);\n\n// read the input and play it out on the left channel\nSynth.after(x, \"help-In\", [\\out, 0, \\in, 1];\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\n(\nSynthDef(\"help-PinkNoise\", { |out = 0|\n Out.ar(out, PinkNoise.ar(0.1))\n}).add;\n\nSynthDef(\"help-In\", { |out = 0, in = 0|\n var input;\n input = In.ar(in, 1);\n Out.ar(out, input);\n\n}).add;\n);\n\n// play noise on the right channel\nx = Synth(\"help-PinkNoise\", [\\out, 1]);\n\n// read the input and play it out on the left channel\nSynth.after(x, \"help-In\", [\\out, 0, \\in, 1]);\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for strange device found in space )\r\n\r\np.s?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n Limiter.ar(HPF.ar(\n GVerb.ar(\n Pan2.ar(\n PMOsc.ar(\n Demand.kr(\n Impulse.kr(\n SinOsc.kr(SinOsc.kr(1/30).range(1/10, 1/15)).range(0, 25)\n * LFPulse.kr(0.2).range(0.5, 1)\n + \n LFDNoise3.kr(1/10, 10, 10)\n ), \n 0, \n Dxrand(Array.geom(100, 50, 1.06), inf) + Dgeom(1, 1.005)\n ),\n [[3,5],[7,11]] + SinOsc.ar([1/60, 1/45]).range(0, 1300),\n Demand.kr(\n Impulse.kr(SinOsc.kr(0.1).range(0.1, 20)),\n 0,\n Dxrand(Array.series(13, 0, 0.5), inf)\n )\n ).sum,\n SinOsc.ar(1, mul:0.5),\n LFPar.ar([1/5,1/3]).range(0.3, 1)\n ), \n 250, \n 0.5, \n damping:SinOsc.kr(1/20).range(0.2,0.7), \n drylevel: SinOsc.kr(1/15).range(0.2,0.7), \n earlyreflevel:0.3\n ) * 0.1\n +\n LFDNoise3.ar(SinOsc.kr(1/15, [0, pi/4]).range(100,350), 0.3),\n [SinOsc.ar(1/45, [0,pi/2]).range(20, 120)]\n ))\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// modulate frequency\n{ Blip.ar(XLine.kr(20000, 200, 6), 100, 0.2) }.play;\n\n// modulate numharmonics\n{ Blip.ar(200, Line.kr(1, 100, 20), 0.2 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// modulate frequency\n{ Blip.ar(XLine.kr(20000, 200, 6), 100, 0.2) }.play;\n\n// modulate numharmonics\n{ Blip.ar(200, Line.kr(1, 100, 20), 0.2) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Approaches to recording generated midi in DAW?"}, {"role": "assistant", "content": "SuperCollider forum — Approaches to recording generated midi in DAW?\n\nToday I spent another 6 hours or so trying to record in ardour (linux) both the midi information generated by supercollider and the audio generated by sending this midi to external synths. I finally hit the right combination of magic to make it work and I want to add my recipe in this thread so that I can find it back the future (and perhaps it also works for someone else).\n\nIngredient 1: a2jmidid. You can run it manually on the command line using “a2jmidid -e” or (like me) you can just use the “start midi bridge” button in the jack front-end application “Cadence” (enable the “export hardware ports checkbox”)\n\nIngredient 2: In supercollider itself, it is extremely important to only connect to a port and not to specify a destination uid. It seems that by specifying a destination uid, supercollider gets some kind of direct connection to the midi destination and ardour can no long introspect/record what is happening (I know it doesn’t sound scientific - this is purely the result of empiric observation/frustration.\n\nSo in supercollider, simply use\n\n```supercollider\n~synth1 = MIDIOut(0);\n~synth2 = MIDIOut(1);\n```\n\nand then in ardour’s Window->Midi Connections dialog, you can connect the out ports from supercollider to both your external synth and the track in which you want to record the midi information.\n\nFor midi driver in jack you can configure None.\n\nIf you want to record the generated midi in ardour, do NOT use connection syntax like\n\n```supercollider\n~synth1 = MIDIOut(0, MIDIClient.destinations[2].uid);\n```\n\nand do NOT use\n\n```supercollider\n~synth1 = MIDIOut.newByName(\"INTEGRA-7\", \"INTEGRA-7 MIDI 1\");\n```\n\nIf you just want to send midi to the external synth without recording the information, both previous ways of connecting work as well but these ways of connecting appear to work only if the jack MIDI driver is configured to use “ALSA sequencer” mode. It doesn’t seem to work with “None” or “ALSA Raw” (this may need some further investigation to clear out)."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// Evaluate this to start your project\n// The Cactus instnce is stored in c by convention\n\nc = CactusGUI(Document.current.dir).cactus; // with GUI\nc = Cactus(Document.current.dir); // without GUI\n\n/*\n\nAny folder with sound files you place in the buffers folder becomes available\nwith the following syntax:\n\n c.buffers.at(\"[folder_name]/[file_name_without_extension]\").play;\n\nYou can also access the folder as a List\n\n c.buffers.at(\"[folder_name]\");\n\n*/\n\n// You can use the dictionary at .at to store anything you like. For example:\n\nc.at[\\exampleVariable] = 10000.rand;\n\n// Get the value\n\nc.at[\\exampleVariable];\n```"}, {"role": "assistant", "content": "Evaluate this to start your project The Cactus instnce is stored in c by convention."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// A beautiful sc140 tweet by Batuhan Bozkurt, parametrized for real-time changes\n(\n// Start sound here\na = { | rateL = 5, rateR = 6, blipMul = 100, blipAdd = 50, fMul = 50, kMul = 1 |\n f = LocalIn.ar(2).tanh;\n k = Latch.kr(f[0].abs,Impulse.kr(1/4)) * kMul;\n LocalOut.ar(\n f +\n CombC.ar(Blip.ar([rateL, rateR], blipMul * k + blipAdd, 0.9), 1, k*0.3, fMul * f));f\n}.play\n);\n\n// Set parameters for changing sound here: \n\na.set(\\rateL, 10);\n\na.set(\\rateR, 8);\n\na.set(\\blipMul, 25);\n\na.set(\\blipAdd, 70);\n\na.set(\\fMul, 30);\n\n\na.set(\\kMul, 0.01);\n```"}, {"role": "assistant", "content": "A beautiful sc140 tweet by Batuhan Bozkurt, parametrized for real-time changes. To do: Add gui widgets for easier interactive control."}]} -{"conversations": [{"role": "user", "content": "What does `FoaMagI.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "First Order Ambisonic (FOA) Magnitude of Soundfield Complex Intensity Vector Arguments: in — The B-format signal, an array: [w, x, y, z]; size — Analysis filter kernel size.; method — The Soundfield analysis method:."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nx = [0, 10].asSpec.units_(\"sec\");\ny = [0, 1].asSpec.units_(\"amp\");\nd = DrawGrid((500@250).asRect, x.grid, y.grid);\n\n// set its properties before testing\nd.x.tickSpacing_(25);\nd.linePattern_(FloatArray[10.0, 5.0, 2.0, 5.0]);\n\n// generate a preview\n~testView = d.preview;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nx = [0, 10].asSpec.units_(\"sec\");\ny = [0, 1].asSpec.units_(\"amp\");\nd = DrawGrid((500@250).asRect, x.grid, y.grid);\n\n// set its properties before testing\nd.x.tickSpacing_(25);\nd.linePattern_(FloatArray[10.0, 5.0, 2.0, 5.0]);\n\n// generate a preview\n~testView = d.preview;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Mx.nextID` do?"}, {"role": "assistant", "content": "A mixer and dynamic patching Returns: int"}]} -{"conversations": [{"role": "user", "content": "What does `TempoClock.beatDur` do?"}, {"role": "assistant", "content": "Returns the duration in seconds of a current whole"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for very punchy snare in neurofunk style."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\neurosnare, {\n var snd;\n // a percussive click to give it some attack\n snd = LPF.ar(HPF.ar(WhiteNoise.ar, 300), 8000) * Env.linen(0.001, 0.01, 0.001).ar;\n // sine sweep body. very important!\n snd = snd + (SinOsc.ar(Env([400, 196, 160], [0.04, 0.2], \\exp).ar) * Env.perc(0.04, 0.2).ar * 6.dbamp).tanh;\n // sound of snare coils rattling\n snd = snd + (HPF.ar(BPeakEQ.ar(WhiteNoise.ar, 4000, 0.5, 3), 300) * Env.perc(0.05, 0.2).delay(0.01).ar(2) * -3.dbamp);\n // another sound sweep to improve the attack, optional\n snd = snd + (SinOsc.ar(XLine.kr(3000, 1500, 0.01)) * Env.perc(0.001, 0.02).ar);\n // distortion helps glue everything together and acts as a compressor\n snd = (snd * 1.4).tanh;\n snd = Pan2.ar(snd, \\pan.kr(0), \\amp.kr(0.1));\n Out.ar(\\out.kr(0), snd);\n}).add;\n);\n\nSynth(\\neurosnare, [amp: 0.4]);\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Convolution3` in SuperCollider?"}, {"role": "assistant", "content": "Convolution3 — Time based convolver. Strict convolution with fixed kernel which can be updated using a trigger signal. The convolution is performed in the time domain. Category: UGens > Convolution."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\delay;\n~description = \"Simple delay line\";\n~channelLayout = \\mono;\n~function = {|in = 0, del = 0.5|\n DelayC.ar(in, 2, del);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "My sustained synth never stops, even when I set the gate to 0."}, {"role": "assistant", "content": "A sustained EnvGen only releases when the gate goes from positive to non-positive *after* the envelope has started, and the Synth only disappears if that EnvGen has `doneAction: 2`. Check three things: the SynthDef actually takes a `gate = 1` argument, the Env is a sustained shape (Env.adsr or Env.asr, not Env.perc), and you call `x.set(\\gate, 0)` on the Synth object. Setting the gate on a different Synth, or on a Group, does nothing."}]} -{"conversations": [{"role": "user", "content": "Explain `Option` in SuperCollider briefly."}, {"role": "assistant", "content": "Option — Represents optional values. In programming languages (especially functional programming languages) an option type is a polymorphic type that represents encapsulation of an optional value; e.g. it is used as the return type of functions which may or may not return a meaningful value when they're applied. It consists of either an empty constructor (called None()), or a constructor encapsulating the original data type A (writte Category: FP."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// Pseq returns one item in the list after the other\n(\nPseq([\n (note: 2, sustain: 1, dur: 1.5),\n (note: [5, 7], sustain: 0.5, dur: 0.8),\n (note: [2, 6], sustain: 1, dur: 0.8)\n]).play;\n);\n\n// Pbind binds parameters to events:\n(\nPbind(\n \\note, Pseq([2, [5, 7], [2, 6]]),\n \\sustain, Pseq([1, 0.5, 1]),\n \\dur, Pseq([1.5, 0.8, 0.8])\n).play;\n);\n\n// per-event timing may be specified:\n(\nPbind(\n \\note, Pseq([[0, 9], [5, 7], [2, 6]], inf),\n \\s\n// …\n```"}, {"role": "assistant", "content": "Pseq returns one item in the list after the other Pbind binds parameters to events: (Event: an environment that represents an action)"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\nvar delay1, delay2, source; \n\n//k from -1 to 1\n\n//in samples\ndelay1= 100; \ndelay2= 40;\n\nsource= WhiteNoise.ar(0.5)*EnvGen.ar(Env([1,1,0],[(delay1+delay2)/SampleRate.ir,0.0]), Impulse.kr(MouseY.kr(1,4)));\n\nTwoTube.ar(source,MouseX.kr(-1,1),0.99,delay1,delay2); \n}.play\n\n);\n\n\n\n\n(\nSynthDef(\\twotube,{arg delay1=100, delay2=50, k=0.0, loss=0.999, dur=0.5, pan=0.0;\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\nvar delay1, delay2, source; \n\n//k from -1 to 1\n\n//in samples\ndelay1= 100; \ndelay2= 40;\n\nsource= WhiteNoise.ar(0.5)*EnvGen.ar(Env([1,1,0],[(delay1+delay2)/SampleRate.ir,0.0]), Impulse.kr(MouseY.kr(1,4)));\n\nTwoTube.ar(source,MouseX.kr(-1,1),0.99,delay1,delay2); \n}.play\n\n);\n\n\n\n\n(\nSynthDef(\\twotube,{arg delay1=100, delay2=50, k=0.0, loss=0.999, dur=0.5, pan=0.0; \nvar source; \n\n//k from -1 to 1\n\nsource= WhiteNoise.ar(0.5)*EnvGen.ar(Env([1,1,0,0],[(delay1+delay2)/SampleRate.ir,0.0,1.0]));\n\nOut.ar(0,Pan2.ar(TwoTube.ar(source,k,loss,delay1,delay2)*EnvGen.ar(Env([0,1,1,0],[0.001]++((dur-0.001)*[0.4,0.6])),doneAction:2),pan)); \n}).send(s); \n);\n\n\n\n(\nt.stop;\nt={\n\ninf.do{\n\nSynth(\\twotube,[\\delay1, rrand(1,300),\\delay2, rrand(1,300),\\loss, rrand(0.9,0.999),\\dur, rrand(0.1,5.0), \\pan, rrand(-1,1.0), \\k, rrand(-1,1.0)]);\n\n0.5.wait;\n};\n\n}.fork;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `ScoreClock.default` do?"}, {"role": "assistant", "content": "A global default ScoreClock, similar to TempoClock.default. ScoreClock has classmethods that redirects to the default clock, so you can use simply"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// different moduli\n(\n{\n var sig = LFSaw.ar(10);\n var dist = ModDif.kr(sig, 0, (0..8) * MouseX.kr(0, 1/5));\n Splay.ar(SinOsc.ar(dist * 4000 + 400)) * 0.1\n}.play;\n);\n\n// wrapping amplitude crossfade\n(\n{\n var numChan = 12;\n var x = SinOsc.ar({ rrand(300.0, 800.0) } ! numChan);\n var dist = ModDif.kr(MouseX.kr(0, numChan * 2), (0..numChan-1), numChan);\n x = x * max(0, 1 - dist);\n Splay.ar(x) * 0.1\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// different moduli\n(\n{\n var sig = LFSaw.ar(10);\n var dist = ModDif.kr(sig, 0, (0..8) * MouseX.kr(0, 1/5));\n Splay.ar(SinOsc.ar(dist * 4000 + 400)) * 0.1\n}.play;\n);\n\n// wrapping amplitude crossfade\n(\n{\n var numChan = 12;\n var x = SinOsc.ar({ rrand(300.0, 800.0) } ! numChan);\n var dist = ModDif.kr(MouseX.kr(0, numChan * 2), (0..numChan-1), numChan);\n x = x * max(0, 1 - dist);\n Splay.ar(x) * 0.1\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Synth`?"}, {"role": "assistant", "content": "Synth — Client-side representation of a synth node on the server"}, {"role": "user", "content": "What does `Synth.new` do?"}, {"role": "assistant", "content": "Create and return a new Synth object, and immediately start the corresponding synth node on the server."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n// create a Synth at the head of the default Server's default group\n// based on the SynthDef \"default\"\nx = Synth.new(\"default\");\ns.queryAllNodes; // note the default group (ID 1)\nx.free;\n\n// Using an arrayed control\n// run this block first to make the SynthDef\n(\nSynthDef(\"help-synth\", { |freq = #[440, 450, 460], out = 0|\n Out.ar(out, Mix(SinOsc.ar(freq, 0, 0.1)));\n}).add;\n);\n\n// then this a short while later\nx = Synth(\"help-synth\", [freq: [500, 501, 510]]);\n\nx = Synth(\"help-synth\", [freq: [500, 501, 510]]);\nx.set(\\freq, [1, 2, 3] * 400 + [1, 2, 3], \\out, 1);\nx.set(\\freq, [3] * 400 + [1, 2, 3], \\out, 1);\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What is the difference between \\degree, \\midinote and \\freq in a Pbind?"}, {"role": "assistant", "content": "`\\freq` is the frequency in Hz and is used as-is. `\\midinote` is a MIDI note number, converted to frequency by the default instrument. `\\degree` is a scale degree, quantised to the scale in \\scale (default major) rooted at \\root; degrees can be negative or fractional. If you set both, the more specific conversion wins, so set exactly one."}]} -{"conversations": [{"role": "user", "content": "What does `UScore.resume` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: targets — (describe argument here). Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DC`."}, {"role": "assistant", "content": "```supercollider\n// won't work (the output is 0.5*0.0), which is why we need the DC UGen!\n{ 0.5 }.play\n\n// constantly zero\n{ DC.ar(0.0) }.play;\n\n\n// DC offset; will click on start and finish\n{ DC.ar(0.5) + SinOsc.ar(440, 0, 0.1) }.play;\n\n\n// test - note the transient before LeakDC adapts and suppresses the offset\n{ LeakDC.ar(DC.ar(0.5)) }.play;\n\n\n// show scope\ns.scope\n```"}]} -{"conversations": [{"role": "user", "content": "I get 'syntax error, unexpected NAME' on a block that looks fine."}, {"role": "assistant", "content": "Almost always a missing semicolon between two statements — SuperCollider does not insert them.\n\n```supercollider\n// broken: two statements, no separator\n{ var sig = SinOsc.ar(440) sig = sig * 0.1; sig }.play\n```\n\n```supercollider\n// fixed\n{ var sig = SinOsc.ar(440); sig = sig * 0.1; sig }.play\n```\nThe error points at the second statement, not at the missing semicolon before it, which is why it looks\nfine. If it is not a semicolon, count the brackets: `.ar(` open, `)` closed."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Sinking in the Ocean (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nx= {\n var lfn = LFNoise2.kr(1);\n var saw = Saw.ar(\n freq: 30,\n mul: LFPulse.kr(\n freq: LFNoise1.kr(1).range(1, 5),\n width: 0.1));\n var bpf = BPF.ar( in: saw, freq: lfn.range(300, 1000), rq: 0.01, mul: 20);\n Pan2.ar(in: bpf, pos: lfn);\n}.play;\n\n\n{LPF.ar(\n in: WhiteNoise.ar(mul: 0.2),\n freq: LFNoise1.kr(1).range(100, 1000)\n)\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\ns.waitForBoot({\n var fftsize = 16384;\n b = Buffer.alloc(s, fftsize)\n})\n);\n\n\n(\nx = {\n // Any input should theoretically be OK, white noise is a good choice\n var son = WhiteNoise.ar;\n// var son = Impulse.ar;\n var out = LPF.ar(son, MouseX.kr(100, 10000, 1));\n var fft1 = FFT(LocalBuf(b.numFrames), son, wintype: 1);\n var fft2 = FFT(b, out, wintype: 1);\n\n // As with most PV_ ugens, the result is *actually* stored in the first fft buf\n var result = PV_Div(fft2, fft1\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\ns.waitForBoot({\n var fftsize = 16384;\n b = Buffer.alloc(s, fftsize)\n})\n);\n\n\n(\nx = {\n // Any input should theoretically be OK, white noise is a good choice\n var son = WhiteNoise.ar;\n// var son = Impulse.ar;\n var out = LPF.ar(son, MouseX.kr(100, 10000, 1));\n var fft1 = FFT(LocalBuf(b.numFrames), son, wintype: 1);\n var fft2 = FFT(b, out, wintype: 1);\n\n // As with most PV_ ugens, the result is *actually* stored in the first fft buf\n var result = PV_Div(fft2, fft1);\n\n out.dup * 0.1\n}.play;\n);\n\n// Now we can grab the FFT buffer and peek at the magnitudes\n(\np = Plotter.new;\nt = Task {\n loop {\n 0.1.wait;\n b.loadToFloatArray(action: { |data|\n {\n p.value = data[2..]\n .clump(2)\n .collect { |a| a[0].squared + a[1].squared }\n .collect { |a| if(a.isNaN) { 0.post } { a } }\n }.defer\n })\n} }.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "How do I add reverb with FreeVerb?"}, {"role": "assistant", "content": "`FreeVerb.ar(in, mix, room, damp)` — mix 0..1 is dry/wet, room 0..1 is the size (0.5 is a small room, 0.9 is a hall), damp 0..1 rolls off the high end of the tail. Put it after your sound: `FreeVerb.ar(SinOsc.ar(440) * 0.1, 0.4, 0.8, 0.5)`. For a send-style reverb, write the dry signal to Out.ar(0, …) and the same signal through FreeVerb to a second bus."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n~name = \\defaultMapper;\n\n// default mapper does nothing. It could have been named 'identity'\n~function = { |aziDeg = 0, eleDeg = 0, gainDB = -99, delayMs = 1, lpHz = 15000, hpHz = 5, spread = 0.01, nfIndex = 0|\n [[aziDeg, eleDeg, gainDB, delayMs, lpHz, hpHz, spread, nfIndex]];\n };\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// Analogizer\n// a quick draft of a model of the EHX Analogizer pedal\n// some info from \"https://www.bassic.de/threads/electro-harmonix-ehx-analogizer.14865686/\"\n\ns.default\ns.boot\n\n// used this for testing: https://www.freesound.org/people/wescwave/sounds/169885/\n~buf = Buffer.read(s, \"169884__wescwave__double-bass-test2.wav\");\n\n(\n~x.free;\n~x = {\n var a, d, s;\n\n a = PlayBuf.ar(2, ~buf, 1, 1, 0, 1);\n a = a.sum!2; // go mono to make the effect more prominent\n\n // the \"distortion modeling\" could use some more love...\n s = (a * MouseY.kr(26/2, 0).dbamp).tanh;\n s = s * MouseY.kr(-16/2, 0).dbamp;\n\n // a simple delay\n d = DelayC.ar(s, 0.1, MouseX.kr(3.5/1000, 65/1000));\n\n // dry/wet...\n a = a + (d * MouseY.kr(0, -96).dbamp);\n\n Out.ar(0, a);\n}.play\n)\n```"}, {"role": "assistant", "content": "The EHX Analogizer (http://www.ehx.com/products/analogizer) is a guitar pedal that apparently consists of a ultra-short delay with some gain stage. It's supposed to \"fatten\" and somehow \"spread\" the sound to make it appear more \"analog\" (thus: dirty). I wanted to quickly test the effect myself.\r\n\r\nI guess with some additional care of the distortion stage and maybe some very little modulation (ster."}]} +{"conversations": [{"role": "user", "content": "What does `NamedIntegersSpec.static` do?"}, {"role": "assistant", "content": "datatype specifying an option list with names and an integer output type"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Pfsm` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n(\na = Pfsm([\n #[0, 1],\n 67, #[0, 0, 3],\n 72, #[2],\n 73, #[0, 2],\n Pseq([74, 75, 76, 77]), #[2, 3, 3],\n nil, nil\n ], inf).asStream;\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, a.next.midicps]);\n 0.1.wait;\n })\n}).play;\n);\n\n(\nPfsm([\n #[5, 6, 7], // entry states\n\n // e1 (== state 0)\n Pbind(\\dur, Pseq([1/8, 3/8]), \\midinote, Pseq([86, 75])),\n // #[1], // as given in CMJ\n // my de-boredom-ated version..\n #[1, 1, 1, 1, 1, 1, 1, 8],\n // e2 (== state 1)\n Pbind(\\dur, 1/2, \\midinote, Pseq([69])),\n #[0, 1],\n // e3 (== state 2)\n Pbind(\\dur, 1/3, \\midinote, Pseq([55, 60, 66])),\n #[0, 1, 2, 2, 2, 2, 3, 3, 3, 3],\n // e4 (== state 3)\n Pbind(\\dur, 1/4, \\midinote, Pseq([81, 80, 77, 76])),\n #[1, 4, 4, 4, 4],\n // e5 (== state 4)\n Pbind(\\dur, Pseq([1, 2/3, 2/3, 2/3, 1]), \\midinote, Pseq([\\, 70, 70, 70, \\])),\n #[2, 3],\n // e6 (== state 5)\n Pbind(\\dur, 1/4, \\midinote, Pseq([59, 61])),\n #[0, 2, 4, 5, 5, 5, 5, 5, 5, 5],\n // e7 (== state 6)\n Pbind(\\dur, 1/4, \\midinote, Pseq([87, 88], 2)),\n #[4, 4, 4, 4, 6, 6, 6, 7, 7, 7],\n // e8 (== state 7)\n Pbind(\\dur, 1, \\midinote, Pseq([56])),\n #[1, 3, 6, 6, 6],\n // terminal state\n nil, nil\n]).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `ControlSpec`?"}, {"role": "assistant", "content": "ControlSpec — numerical input specification"}, {"role": "user", "content": "What does `ControlSpec.map` do?"}, {"role": "assistant", "content": "Maps and constrains a value between 0 and 1 to the range between minval and maxval."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// ControlSpec-map can also be used to map ugens\n(\nvar spec;\nspec = [100, 18000, \\exp].asSpec;\n{\n var freq, osc;\n osc = SinOsc.kr(0.1).range(0, 1);\n freq = spec.map(osc);\n\n freq.dump; // BinaryOpUGen\n\n SinOsc.ar(\n freq.poll\n )\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `PageLayout.show` do?"}, {"role": "assistant", "content": "Show the window if it was previously Returns: self"}]} +{"conversations": [{"role": "user", "content": "What is `Fb1_HopfA` in SuperCollider?"}, {"role": "assistant", "content": "Fb1_HopfA — Adaptive Hopf pseudo ugen This is an adaptive variant of Hopf, i.e. it can hold the frequency of an oscillating input f after it vanishes. The model refers to #[1], see also #[2] (4.1.) for an enhancement implemented with Fb1_HopfAFDC. The parameter naming follows the convention of #[2]. Category: Libraries > miSCellaneous > Nonlinear."}]} +{"conversations": [{"role": "user", "content": "What does `MKtl.elementsDict` do?"}, {"role": "assistant", "content": "all elements in one flat event so they can be accessed very fast by name."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// a Buffer for the UGens to use\nb = Buffer.alloc(s, 44100, 1);\n\n// write a signal into a delay, tap it at multiple times\nSynthDef(\\write, { |buffer, cout|\n var src, tapPhase, tap1, tap2, tap3;\n src = WhiteNoise.ar(0.2) * Decay.kr(Dust.kr(3), 0.7);\n tapPhase = DelTapWr.ar(buffer, src);\n Out.kr(cout, tapPhase);\n }).add;\n\nSynthDef(\\readFilt, { |out, buffer, cin|\n var phase, src, filt;\n phase = In.kr(cin);\n src = DelTapRd\n// …\n```"}, {"role": "assistant", "content": "a Buffer for the UGens to use write a signal into a delay, tap it at multiple times (DelTapWr: Write to a buffer for a DelTapRd UGen)"}]} +{"conversations": [{"role": "user", "content": "List of exit codes?"}, {"role": "assistant", "content": "SuperCollider forum — List of exit codes?\n\n7068696c:\n\n```supercollider\no = s.options;\no.inDevice = nil;\no.outDevice = \"ASIO : ASIO4ALL\";\n```\n\nHmmmm... In earlier SC versions, it wouldn’t have worked to have a nil input device in scsynth either (which is admittedly a problem for devices with no inputs). This was fixed in scsynth but it’s possible that it wasn’t fully fixed in supernova.\n\n@MarcinP – any thoughts about this? (I remember you worked on scsynth device selection but I don’t recall who ported that to supernova.)\n\nhjh"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\nz = {\nBBandStop.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(20, 20000, \\exponential),\n MouseY.kr(0.0, 10.0, \\linear), // bw\n 0.5); // mul\n}.play)\nz.release;\n\n(\nz = {\nBBandStop.ar(\n WhiteNoise.ar ! 2,\n MouseX.kr(20, 20000, \\exponential),\n MouseY.kr(0.0, 10.0, \\linear), // bw\n 0.1); // mul\n}.play)\nz.release;\n\n(\nz = { // drill...\nBBandStop.ar(\n SinOsc.ar(1000) ! 2,\n MouseX.kr(800, 1200, \\exponential),\n MouseY.k\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\nz = {\nBBandStop.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(20, 20000, \\exponential),\n MouseY.kr(0.0, 10.0, \\linear), // bw\n 0.5); // mul\n}.play)\nz.release;\n\n(\nz = {\nBBandStop.ar(\n WhiteNoise.ar ! 2,\n MouseX.kr(20, 20000, \\exponential),\n MouseY.kr(0.0, 10.0, \\linear), // bw\n 0.1); // mul\n}.play)\nz.release;\n\n(\nz = { // drill...\nBBandStop.ar(\n SinOsc.ar(1000) ! 2,\n MouseX.kr(800, 1200, \\exponential),\n MouseY.kr(0.0, 10.0, \\linear), // bw\n 0.1); // mul\n}.play)\nz.release;\n\n(\nz = { // nada\nBBandStop.ar(\n SinOsc.ar(1000) ! 2,\n 1000,\n MouseY.kr(0.0, 10.0, \\linear), // bw\n 0.5); // mul\n}.play)\nz.release;\n```"}]} +{"conversations": [{"role": "user", "content": "How do I add a reverb send to a whole group?"}, {"role": "assistant", "content": "Same shape as the delay: a private stereo bus, one effect reading it, instruments writing both dry\nand wet.\n\n```supercollider\n(\n~verbBus = Bus.audio(s, 2);\nSynthDef(\\verb, { |in = 0, out = 0, room = 0.85, mix = 0.5|\n Out.ar(out, FreeVerb.ar(In.ar(in, 2), mix, room, 0.5) * 0.7);\n}).add;\nSynthDef(\\blip, { |out = 0, send = 0, freq = 440, amp = 0.1|\n var env = EnvGen.kr(Env.perc(0.002, 0.4), doneAction: 2);\n var sig = SinOsc.ar(freq) * env * amp;\n Out.ar(out, sig);\n Out.ar(send, sig);\n}).add;\n);\nSynth(\\verb, [\\in, ~verbBus]);\nPbind(\\instrument, \\blip, \\send, ~verbBus, \\degree, Pseq([0, 4, 7, 11], inf), \\dur, 0.25).play;\n```"}]} +{"conversations": [{"role": "user", "content": "How do I see what a signal is doing?"}, {"role": "assistant", "content": "`.poll` prints values to the post window — `SinOsc.kr(1).poll` prints once per control block, and `.poll(10)` limits it to every 10th. `s.scope` opens an oscilloscope on the main output, and `.scope` on a UGen shows just that signal. For a numeric snapshot of many signals at once, `s.meter` shows the output levels, and `\".dump\".postln` style probes are common while debugging."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `MultiplexAnalogIn`."}, {"role": "assistant", "content": "```supercollider\n// modulate frequency of a sine oscillator\n\n(\nSynthDef(\"help-MultiplexAnalogIn\", { |out = 0|\n Out.ar(out,\n SinOsc.ar(MultiplexAnalogIn.ar(0, 1).exprange(200, 5000), 0, 0.1)\n )\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// These examples compare the variants, so that you can hear the difference in interpolation\n\n// Comb used as a resonator. The resonant fundamental is equal to\n// reciprocal of the delay time.\n{ CombN.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ CombL.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ CombC.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// with negative feedback:\n{ CombN.ar(WhiteNoise.ar(0.01), 0\n// …\n```"}, {"role": "assistant", "content": "These examples compare the variants, so that you can hear the difference in interpolation Comb used as a resonator. The resonant fundamental is equal to (CombL: Comb delay line with linear interpolation.)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = {LFTri.ar(50+(1000*Maths2.ar(10, 10, 0.5, 1)[0]), 0, 0.1)}.play //notice how I am taking the [0]th channel of the Maths and ignoring the [1st channel.\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = {LFTri.ar(50+(1000*Maths2.ar(10, 10, 0.5, 1)[0]), 0, 0.1)}.play //notice how I am taking the [0]th channel of the Maths and ignoring the [1]st channel.\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ControlName`."}, {"role": "assistant", "content": "```supercollider\n(\nd = SynthDef(\\tone, { |out = 0, freq = 200|\n var sig;\n\n freq.spec = ControlSpec(20, 20000);\n sig = SinOsc.ar(freq);\n\n Out.ar(out, sig);\n}).add;\n);\n\nd.specs.freq.postln;\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for smooth arpeggio, updated envelope (a SuperCollider snippet): bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\bass, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.perc(0.2), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SequenceableCollection.integrate` do?"}, {"role": "assistant", "content": "Returns a collection with the incremental sums of all elements. `[3, 4, 1,"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `BPF`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// synthdefs to play with\n(\nSynthDef(\\noise_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, rq = 0.1, amp = 0.1|\n var sig = { WhiteNoise.ar } ! 2;\n sig = BPF.ar(sig, freq, rq) *\n EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2) *\n (rq ** -1) * (250 / (freq ** 0.8));\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\sin_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { SinOsc.ar(freq, Rand(0, 2pi)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n\n\nSynthDef(\\saw_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { VarSaw.ar(freq, Rand(0, 1)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `NamedIntegersSpec.nisinit` do? What arguments does it take?"}, {"role": "assistant", "content": "datatype specifying an option list with names and an integer output type Arguments: n; s; d."}]} +{"conversations": [{"role": "user", "content": "Explain `FoaMagI` in SuperCollider briefly."}, {"role": "assistant", "content": "FoaMagI — First Order Ambisonic (FOA) Magnitude of Soundfield Complex Intensity Vector Return the Magnitude of Complex Intensity Vector, ||I||, of a first order ambisonic (B-format) signal. Category: Libraries > Ambisonic Toolkit > UGens > FOA > Analyzer, UGens > Multichannel > Ambisonics, UGens > Analysis > Ambisonics."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\ns.boot;\n\n(\nvar winenv;\n// a custom envelope\nwinenv = Env([0, 1, 0], [0.5, 0.5], [8, -8]);\nz = Buffer.sendCollection(s, winenv.discretize, 1);\n\nSynthDef(\\sin_grain_test, { |out, gate = 1, amp = 1, envbuf|\n var pan, env, freqdev;\n // use mouse x to control panning\n pan = MouseX.kr(-1, 1);\n // use WhiteNoise and mouse y to control deviation from center pitch\n freqdev = WhiteNoise.kr(MouseY.kr(0, 400));\n env = EnvGen.kr(\n Env([0, 1\n// …\n```"}, {"role": "assistant", "content": "use mouse x to control panning use WhiteNoise and mouse y to control deviation from center pitch (GrainSin: Granular synthesis with sine tones)"}]} +{"conversations": [{"role": "user", "content": "What can you do?"}, {"role": "assistant", "content": "Write and explain SuperCollider: SynthDefs, UGens, Patterns, Ndef, buses and envelopes, and tell you why a patch is silent or will not compile. I am 198M parameters, so I am narrow on purpose."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n b = {|x,y|\n var arr = List[];\n case\n {y % x.size == 0} // condition 1\n {\n var per = y / x.size;\n x.size.do{|oo|\n var pp = 1,i = 1;\n arr.add( x[oo] );\n while({i < per},{\n arr.add(0);\n i = i+1;\n });\n }\n }\n {x.size % y == 0} // condition 2\n {\n var pp = x.size / y, i = 0, sz = x.size;\n while({i < sz},{\n if(i % pp == 0)\n { arr.add(x[i]) };\n i=i+1;\n });\n };\n arr\n };\n a = [1,1,1,1];\n c = b.value(a,16) \n // [ 1, 1, 1, 1 ]\n // becomes\n // [ 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 ]\n\n b.value(c,4); \n // [ 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 ]\n // becomes\n // [ 1, 1, 1, 1 ]\n)\n```"}, {"role": "assistant", "content": "useful for expanding or reducing arrays by 2^x.\r\nI would like to know if there is a more concise way to write this!\r\nAny suggestions?\r\n\r\n(duplicate post, sorry! forgot to log in!)."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// ZoomH2 records two stereo .wav files:\n// SRxxxF.wav\n// SRxxxR.wav\n// correct input for FoaEncoderMatrix.newZoomH2 is:\n\n~in = [ SRxxxR[0], SRxxxR[1], SRxxxF[0], SRxxxF[1] ]\n```"}, {"role": "assistant", "content": "ZoomH2 records two stereo .wav files: correct input for FoaEncoderMatrix.newZoomH2 is: (FoaEncoderMatrix: First Order Ambisonic (FOA) encoder matrices)"}]} +{"conversations": [{"role": "user", "content": "How do I make this brighter?\n```supercollider\n{ LPF.ar(Saw.ar(110), 400) * 0.2 }.play;\n```"}, {"role": "assistant", "content": "Raise the cutoff. 400 Hz is well below the harmonics that carry brightness, so open it to 2000-4000 Hz:\n\n```supercollider\n{ LPF.ar(Saw.ar(110), 3000) * 0.2 }.play;\n```"}, {"role": "user", "content": "Still dull."}, {"role": "assistant", "content": "Then the low-pass is not the limit — the source is. A saw at 110 Hz has energy up to Nyquist, so check the amplitude: at 0.2 the high harmonics are quiet. Two moves: add resonance so the filter peak is audible, and raise the level slightly.\n\n```supercollider\n{ RLPF.ar(Saw.ar(110), 2500, 0.3) * 0.35 }.play;\n```\n\nIf that is still dull, the answer is a different source: `Saw` is band-limited and soft; try `LFSaw` or add a second detuned saw for more high content."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `RunningMax`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n SinOsc.ar(\n RunningMax.ar(Dust.ar(20), Impulse.ar(0.4)) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// follow a sine lfo, reset rate controlled by mouse x\n(\n{\n SinOsc.ar(\n RunningMax.kr(SinOsc.kr(0.2), Impulse.kr(MouseX.kr(0.01, 2, 1))) * 500 + 200,\n 0, 0.2\n )\n\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `EaseInExpo` in SuperCollider briefly."}, {"role": "assistant", "content": "EaseInExpo — Exponential ease-in Easing equation for an exponential (2^t) ease-in, accelerating from zero velocity. Category: Ease."}]} +{"conversations": [{"role": "user", "content": "What does `UnicodeResponder.global` do?"}, {"role": "assistant", "content": "register responder functions for unicode and modifier combinations"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Convolution2L`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// one last example\n(\nb = Buffer.alloc(s, 512, 1);\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, true, true);\n);\n\n(\n{\n var input = SoundIn.ar(0);\n var framesize = 512;\n Convolution2L.ar(input, b, 0, framesize, 1, 0.5);\n}.play\n);\n\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Henon2DL.ar(SampleRate.ir/4, SampleRate.ir, MouseX.kr(1,1.4), MouseY.kr(0,0.3)) * 0.2 }.play(s);\n\n(\n{ Henon2DL.ar(\n 2200, 8800,\n LFNoise2.kr(1, 0.2, 1.2),\n LFNoise2.kr(1, 0.15, 0.15)\n) * 0.2 }.play(s);\n)\n\n{ SinOsc.ar(Henon2DL.ar(20, 40, MouseX.kr(1,1.4), MouseY.kr(0,0.3))*800+900)*0.4 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Henon2DL.ar(SampleRate.ir/4, SampleRate.ir, MouseX.kr(1,1.4), MouseY.kr(0,0.3)) * 0.2 }.play(s);\n\n(\n{ Henon2DL.ar(\n 2200, 8800,\n LFNoise2.kr(1, 0.2, 1.2),\n LFNoise2.kr(1, 0.15, 0.15)\n) * 0.2 }.play(s);\n)\n\n{ SinOsc.ar(Henon2DL.ar(20, 40, MouseX.kr(1,1.4), MouseY.kr(0,0.3))*800+900)*0.4 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `FoldIndex`."}, {"role": "assistant", "content": "```supercollider\n// indexing into a table\n(\n{\n var buf = LocalBuf.newFrom([200, 300, 400, 500, 600, 800]);\n var freq = FoldIndex.kr(buf, MouseX.kr(0, BufFrames.ir(buf) * 3));\n SinOsc.ar(freq) * 0.1\n}.play;\n);\n\n// the same using a global buffer\n(\nt = [200, 300, 400, 500, 600, 800];\nb = Buffer(s, t.size, 1);\n\n// alloc and set the values\ns.listSendMsg(b.allocMsg(b.setnMsg(0, t)).postln);\n\nSynthDef(\\help_Index, { |out = 0, bufnum = 0|\n Out.ar(out,\n SinOsc.ar(\n FoldIndex.kr(\n bufnum,\n MouseX.kr(0, BufFrames.ir(bufnum) * 3)\n ),\n 0,\n 0.5\n )\n )\n}).play(s, [\\bufnum, b.bufnum]);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `ReplaceOut` in SuperCollider briefly."}, {"role": "assistant", "content": "ReplaceOut — Send signal to a bus, overwriting previous contents. Category: UGens > InOut."}]} +{"conversations": [{"role": "user", "content": "What does `Ndef.kr` do?"}, {"role": "assistant", "content": "equivalent to `*new(key).kr(numChannels, offset)` (see"}]} {"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ LPF.ar(Saw.ar(100), SinOsc.kr(0.5).exprange(200, 2000)) * 0.2 }.play;\n```"}, {"role": "assistant", "content": "A sawtooth through a low-pass filter whose cutoff is swept slowly up and down — a classic filter\nsweep.\n\n- `Saw.ar(100)` is a 100 Hz sawtooth, rich in harmonics.\n- `SinOsc.kr(0.5)` is a control-rate sine at 0.5 Hz, so one full cycle takes 2 seconds.\n- `.exprange(200, 2000)` maps that -1..1 sine exponentially onto 200..2000 Hz — exponential is the right\n mapping for frequency, because we hear pitch logarithmically.\n- `LPF.ar(sig, cutoff)` removes harmonics above the cutoff; as it opens and closes you hear the tone\n brighten and darken.\n- `* 0.2` keeps the output from clipping."}]} -{"conversations": [{"role": "user", "content": "What does `AbstractMessageMatcher.valueArray` do? What arguments does it take?"}, {"role": "assistant", "content": "As #-value above, but with the arguments passed as a single Array. This method is needed so that subclasses can work in Arguments: args — An Array containing the message and appropriate arguments.."}]} -{"conversations": [{"role": "user", "content": "What does `SoundFile.path` do?"}, {"role": "assistant", "content": "Get the pathname of the file. This variable is set via the #-openRead or #-openWrite"}]} +{"conversations": [{"role": "user", "content": "Why does every UGen have mul and add arguments?"}, {"role": "assistant", "content": "They are a convenience applied to the UGen's output: the result is `ugens_result * mul + add`. So `SinOsc.ar(440, 0, 0.2)` is the same as `SinOsc.ar(440) * 0.2`, and `SinOsc.ar(440, 0, 0.5, 1800)` is usable directly as a frequency. They exist because multiplying and offsetting is so common that folding it into the UGen saves a node in the graph and a line in the source."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Fdef`."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\ns.boot;\nSynthDef(\"gpdef\",\n { |out = 0, freq = 440, sustain = 0.05, amp = 0.1|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain), doneAction: Done.freeSelf) * amp;\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n// fork a thread that plays some sounds\n(\nFdef(\\freq, 440);\nFdef(\\dur, 0.2);\n\nfork {\n loop {\n s.sendMsg(\"/s_new\", \"gpdef\", -1, 1, 1, \\freq, Fdef(\\freq).value);\n Fdef(\\dur).value.wait;\n }\n};\n);\n\n// some modifications\n\nFdef(\\freq, Fdef(\\midinote, 60).midicps);\nFdef(\\midinote, { [67, 64, 65].choose });\nFdef(\\midinote, { [67, 64, 65].choose } + Fdef(\\offset));\nFdef(\\offset, { 4.rand });\nFdef(\\dur, 0.23);\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n(\nSynthDef(\"fm\", {| out = 0, amp = 0.2, midinote=1, octave = 5, carrier, modulator, depth,\n dur = 1, detune = 0|\n\n var carrierOsc, modulation, env, degree, ratio;\n\n\n // adjust the octave. This assumes the fregencies we give for analysis generate a tone in the octave around middle C\n degree = midinote - 60;\n degree = degree + (12 * (octave - 5));\n\n // now compute a ratio\n ratio = degree.midiratio;\n\n // multiple the ratio by all of the FM values\n carrier = (carrier * ratio) + detune; // Pbinds sometimes use a detune value\n modulator = modul\n// …\n```"}, {"role": "assistant", "content": "adjust the octave. This assumes the fregencies we give for analysis generate a tone in the octave around middle C now compute a ratio (DissonanceCurve: Analyzes timbres in order to create tunings)"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nb = SoundFile.collectIntoBuffers(\"yourSoundFileFolder/*\"); // By Bjørn Houdorf, December 21, 2012\n\n(\n{\nvar number = b.numChannels, randomNumber, trigger, delayed, panned, sound, mixedSound, rotatedSound;\ntrigger = Dust.kr(Array.fill(number,1), 1, -0.5); // Generates random impulses from -0.5 to 0.5. as a excitation function\nrandomNumber = TRand.kr(1, number, trigger);\nsound = PlayBuf.ar(Array.fill(number,1) ,randomNumber,1,trigger,0,0); // play sound files\ndelayed = DelayL.ar(sound, trigger, trigger); // delaying the sound files\npanned = Pan2.ar(delayed, Array.fill(number,{1.0.rand2})); // pan them out in the stereo field\nmixedSound = 0.05*Mix.new(panned);// and mix them to one stereo signal\nrotatedSound = Rotate2.ar(mixedSound[0], mixedSound[1], LFSaw.kr(0.05)); // rotate stereo signal\n}.play; // play it all\n)\n```"}, {"role": "assistant", "content": "Put your sound files in the sound file folder. The code plays random sound files panned out in the stereo field. A swarm of sound files."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `SampleRate`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// compares a 441 Hz sine tone derived from sample rate (44100 * 0.01, left)\n// with a 440 Hz tone (right), resulting in a 1 Hz beating\n(\n{\n var freq;\n freq = [SampleRate.ir * 0.01, 440];\n SinOsc.ar(freq, 0, 0.1)\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Blip thru Formlet, pseudo-vocal synthesis that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n// Blip thru Formlet, pseudo-vocal synthesis.\n// hh&adc, since beijing 2005\n// 2019 made quad/MC\n\n// keywords: vocal, voice, formants\n\n/*\nNdef(\\formSing).gui;\nNdef(\\formSing).play;\nNdef(\\formSing).getHalo(\\stepFdev).value;\n*/\nNdef(\\formSing).addSpec(\\root, [20, 500, 6]);\nNdef(\\formSing).addSpec(\\formfrq, [50, 5000, \\exp]);\nNdef(\\formSing).addSpec(\\harm, [1, 256, \\exp]);\nNdef(\\formSing).addSpec(\\formLag, [0.01, 100, \\exp]);\nNdef(\\formSing).addSpec(\\ndiv, [0.01, 1, \\exp]);\nNdef(\\formSing).addSpec(\\fdev, [0, 24, \\amp]);\nNdef(\\formSing).addSpec(\\round, [0, 3, \\amp, 0.05]);\n\n(\n// modulating formant frequency\nNdef(\\formSing, { arg amp=0, root=150, formfrq=500, harm=20, fdev=2, ndiv = 0.2, formLag=0.1, round = 1.5;\n var freqCompare = 1; // ((formfrq / root).log2).abs.min(1).linexp(0, 1, 0.25, 1);\n var in = Blip.ar(\n root.lag(formLag) * LFNoise0.kr(root * ndiv ! q.numChans, fdev.max(0.01) ).midiratio,\n harm.lag(formLag), // .max(formfrq / root * 0.25),\n 0.1\n ) * GrayNoise.ar(0.1 ! q.numChans, 1);\n\n Limiter.ar(Formlet.ar(in, formfrq.lag(formLag), 0.005, 0.02) * (freqCompare * amp.lag(0.1)))\n .softclip;\n});\n);\n```"}]} +{"conversations": [{"role": "user", "content": "What is the difference between ~foo and a local variable?"}, {"role": "assistant", "content": "`var foo` is a local: it exists only inside the function or file block that declares it. `~foo` is an environment variable: it lives in the current Environment, survives between executions of the same block, and is visible to everything running in that environment. That is why `~buf = Buffer.read(s, path)` works in one cell and `PlayBuf.ar(1, ~buf)` works in the next, while a `var` would be gone."}]} +{"conversations": [{"role": "user", "content": "What is the difference between a Synth and a SynthDef?"}, {"role": "assistant", "content": "A SynthDef is a definition: a compiled UGen graph with named controls, registered on the server once. A Synth is one running instance of that definition. You create the definition with `SynthDef(\\bell, { |freq = 440| ... }).add` and then instances with `Synth(\\bell, [\\freq, 660])`. Defining the same SynthDef twice replaces it for future instances; already running Synths keep the old graph until they are freed."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `IdentityDictionary`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_sinegrain, { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0.5pi, env))\n}).add;\n\na = Pbind(\\instrument, \\help_sinegrain, \\note, Pseq([0, 7, 2, 9, 11, 10, 9, 8], inf), \\dur, 1);\na.play(quant: (quant: 1, phase: 0));\na.play(quant: (quant: 1, phase: 1/3));\na.play(quant: (quant: 1, phase: 1.0.rand));\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\"ReplaceOutHelp\", { |out = 0, freq = 440|\n var source;\n source = SinOsc.ar(freq, 0, 0.1);\n\n // write to the bus, replacing previous contents\n ReplaceOut.ar(out, source);\n\n}).add;\n);\n\n// each Synth replaces the output of the previous one\nx = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 500]);\ny = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 600]);\nz = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 700];\n\n// release them in reverse order; the older Synths are still there.\nz.free;\ny.free;\nx.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\"ReplaceOutHelp\", { |out = 0, freq = 440|\n var source;\n source = SinOsc.ar(freq, 0, 0.1);\n\n // write to the bus, replacing previous contents\n ReplaceOut.ar(out, source);\n\n}).add;\n);\n\n// each Synth replaces the output of the previous one\nx = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 500]);\ny = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 600]);\nz = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 700]);\n\n// release them in reverse order; the older Synths are still there.\nz.free;\ny.free;\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "List of exit codes?"}, {"role": "assistant", "content": "SuperCollider forum — List of exit codes?\n\n7068696c:\n\n```supercollider\no = s.options;\no.inDevice = nil;\no.outDevice = \"ASIO : ASIO4ALL\";\n```\n\nHmmmm... In earlier SC versions, it wouldn’t have worked to have a nil input device in scsynth either (which is admittedly a problem for devices with no inputs). This was fixed in scsynth but it’s possible that it wasn’t fully fixed in supernova.\n\n@MarcinP – any thoughts about this? (I remember you worked on scsynth device selection but I don’t recall who ported that to supernova.)\n\nhjh"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `FreqScopeView`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// Start server\ns.boot;\n\n// Create analyzer in a window\n(\nw = Window(\"My Analyzer\", Rect(0, 0, 511, 300)); // width should be 511\nf = FreqScopeView(w, w.view.bounds);\nf.active_(true); // turn it on the first time;\n\nw.onClose_({ f.kill }); // you must have this\nw.front;\n{ SinOsc.ar([500, 1000], 0, 0.25).mean.dup }.play(s); // start two sine waves\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Pan2` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\ng = Group.new;\n\n// make 4 synths in g\n// 1.0.rand2 returns a random number from -1 to 1.\n4.do({ { arg amp = 0.1; Pan2.ar(SinOsc.ar(440 + 110.rand, 0, amp), 1.0.rand2) }.play(g); });\n\ng.set(\\amp, 0.005); // turn them all down\n\ng.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `BinaryOpUGen`?"}, {"role": "assistant", "content": "BinaryOpUGen — Apply a binary operation to the values of an input UGen"}, {"role": "user", "content": "What does `BinaryOpUGen.new` do?"}, {"role": "assistant", "content": "return a new instance that applies the operator `selector` to the UGens `a` and `b` normally, this is implicitly called when applying an operator to a UGen."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na = WhiteNoise.ar; // a WhiteNoise\nb = a + 2; // a BinaryOpUGen.\nb.operator; // +\n\n// sound example\n(\n{\n var a = LFSaw.ar(300);\n var b = LFSaw.ar(329.1);\n a % b * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `BusPool.makeBusFromSpec` do? What arguments does it take?"}, {"role": "assistant", "content": "bus allocator with retain/release counting for shared busses Arguments: busSpec; server; client; name."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Ref`."}, {"role": "assistant", "content": "```supercollider\n{ Klank.ar(`[[800, 1071, 1153, 1723], nil, [1, 1, 1, 1]], Impulse.ar(2, 0, 0.1)) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `EaseOutInElastic` in SuperCollider briefly."}, {"role": "assistant", "content": "EaseOutInElastic — Elastic ease-out/in Easing equation for an elastic (exponentially decaying sine wave) ease-out/in, decelerating until halfway, then accelerating. The a parameter is amplitude and p is period. Category: Ease."}]} +{"conversations": [{"role": "user", "content": "Explain `ArgNameLabel` in SuperCollider briefly."}, {"role": "assistant", "content": "ArgNameLabel — simple stylized Label for displaying an argument name Category: Libraries > crucial > GUI > utils."}]} +{"conversations": [{"role": "user", "content": "Why LeakDC and not a standard HPF for DC removal?"}, {"role": "assistant", "content": "SuperCollider forum — Why LeakDC and not a standard HPF for DC removal?\n\nHello everyone,\n\nI’m a bit sceptical of the DC removal implementation in LeakDC. As I understand it, DC removal is nothing but a HPF, preferably placed below the audible range. For this purpose, LeakDC seems to be reaching far too high, attenuating the audible low frequencies. You can run the following code and look at the server meter to see the difference in level between the two audio channels (note: there is of course no DC offset in this example that would need fixing):\n\n```supercollider\n( play { [\n SinOsc.ar(50),\n LeakDC.ar(SinOsc.ar(50))\n] * 0.2 } )\n```\n\nAlso, LeakDC’s behaviour is not consistent between sample rates (as is mentioned in the help file).\n\nI ran the it through Plugin Doctor to back up my suspicions and got these results:\n\nstandard coefficient of 0.995:\n\nSR 48 kHz: Filter starts rolling off at 200 Hz, -2dB at 50 Hz.\n\nSR 96 kHz: Filter starts rolling off at 500 hz! It reaches already -2dB at 100 Hz, -5 dB at 50 Hz.\n\ncoefficient of 0.999:\n\nSR 48 kHz: Filter starts rolling off at 50 Hz, -2 dB at 10 Hz.\n\nSR 96 kHz: Filter starts rolling off at 100 Hz, -2 dB at 20 Hz.\n\nI wonder why one wouldn’t just use a standard HPF at 10 Hz (or so) instead? It is consistent between sample rates, it only starts to roll of below 30 Hz and it reaches only -0.5 dB at 20 Hz. So this actually looks much better in the server meter:\n\n```supercollider\n( play { [\n SinOsc.ar(50),\n HPF.ar(SinOsc.ar(50), 10)\n] * 0.2 } )\n```\n\nSo my question is: Is there any reason why the LeakDC implementation would be peferable to such a standard butterworth HPF?\n\nOne difference I can see is that the HPF still has an initial offset spike before settling around zero phase, LeakDC does not show that behaviour:\n\n```supercollider\n{ LeakDC.ar(DC.ar(0.5)) }.plot(0.5);\n{ HPF.ar(DC.ar(0.5), 10) }.plot(0.5);\n\n{ LeakDC.ar(SinOsc.ar + DC.ar(0.5)) }.plot(0.02);\n{ HPF.ar(SinOsc.ar + DC.ar(0.5), 10) }.plot(0.02);\n```\n\nSo this could be a reason – I don’t know enough about filters to understand why this happens though. Any enlightenment would be appreciated."}]} +{"conversations": [{"role": "user", "content": "What is `SFPlayer` in SuperCollider?"}, {"role": "assistant", "content": "SFPlayer — A soundfile player SFPlayer plays sound files directly from disk. It also has a convenient #-gui. Category: UGens > InOut, UGens > Buffer."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// Handy code for quick class demonstrations.\n// Comparing a few intervals - Just Intonation versus 12-tone Equal Tempered\n\n// Major third (just)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 60.midicps * 5/4], mul: 0.1) }).play\n// Major third (ET12)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 64.midicps], mul: 0.1) }).play;\n\n// Major second (just)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 60.midicps * 9/8], mul: 0.1) }).play\n// Major second (ET)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 62.midicps], mul: 0.1) }).play;\n\n// Perfect fifth (just)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 60.midicps * 3/2], mul: 0.1) }).play\n// Perfect fifth (ET)\nNdef(\\a, { Saw.ar(freq: [60.midicps, 67.midicps], mul: 0.1) });\n```"}, {"role": "assistant", "content": "Simple handy code for quick class demonstrations. Hear and compare a few intervals in Just Intonation versus 12-tone Equal Tempered tuning."}]} +{"conversations": [{"role": "user", "content": "What is `XFade2` in SuperCollider?"}, {"role": "assistant", "content": "XFade2 — Equal power two channel cross fade. Two channel equal power crossfader. Category: UGens > Multichannel > Select."}]} +{"conversations": [{"role": "user", "content": "What is `Bag`?"}, {"role": "assistant", "content": "Bag — Unordered collection of objects"}, {"role": "user", "content": "What does `Bag.new` do?"}, {"role": "assistant", "content": "Creates a Bag with an initial capacity for n objects."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nBag[1, 2, 3].add(4).postln;\n\nBag[1, 2, 3].add(3).postln;\n\nBag[\"abc\", \"def\", \"ghi\"].add(\"jkl\").postln;\n\nBag[\"abc\", \"def\", \"ghi\"].add(\"def\").postln;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `BufWr` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\n// allocate a buffer for writinig into\ns = Server.local;\ns.sendMsg(\"/b_alloc\", 0, 44100 * 2);\n);\n\n\n// write into the buffer with a BufWr\n(\ny = { |rate = 1|\n var in;\n in = SinOsc.ar(LFNoise1.kr(2, 300, 400), 0, 0.1);\n BufWr.ar(in, 0, Phasor.ar(0, BufRateScale.kr(0) * rate, 0, BufFrames.kr(0)));\n 0.0 // quiet\n}.play;\n);\n\n// read it with a BufRd\n(\nx = { |rate = 1|\n BufRd.ar(1, 0, Phasor.ar(0, BufRateScale.kr(0) * rate, 0, BufFrames.kr(0)))\n}.play(s);\n);\n\n\n\nx.set(\\rate, 5);\ny.set(\\rate, 2.0.rand);\nx.set(\\rate, 2);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `History.recordLocally` do?"}, {"role": "assistant", "content": "get and set flag to turn recording local code evaluation on and"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n///////////////////// beat accurate playing /////////////////////\n\n\n\n\na = NodeProxy.audio(s, 2);\na.play;\n\na.quant = 2.0; // quantize changes to the next 2.0-beat multiple\na.source = { Ringz.ar(Impulse.ar(0.5, 0, 0.3), 3000, 0.01) };\na[1] = { Ringz.ar(Impulse.ar([0.5, 1], 0, 0.3), 1000, 0.01) };\na[2] = { Ringz.ar(Impulse.ar([3, 5]/2, 0, 0.3), 8000, 0.01) };\na[3] = { Ringz.ar(Impulse.ar([3, 5]*16, 0, 0.3), 5000,\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n///////////////////// beat accurate playing /////////////////////\n\n\n\n\na = NodeProxy.audio(s, 2);\na.play;\n\na.quant = 2.0; // quantize changes to the next 2.0-beat multiple\na.source = { Ringz.ar(Impulse.ar(0.5, 0, 0.3), 3000, 0.01) };\na[1] = { Ringz.ar(Impulse.ar([0.5, 1], 0, 0.3), 1000, 0.01) };\na[2] = { Ringz.ar(Impulse.ar([3, 5]/2, 0, 0.3), 8000, 0.01) };\na[3] = { Ringz.ar(Impulse.ar([3, 5]*16, 0, 0.3), 5000, 0.01) * LFPulse.kr(0.5, 0, 0.05) };\n\na.removeLast;\na.removeAt(2);\n\na.clear;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n Decay2.ar(\n Impulse.ar(8, 0, LFSaw.kr(0.3, 1, -0.3, 0.3)),\n 0.001,\n 0.3\n )\n * Mix.ar(Pulse.ar([80, 81], 0.3))\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n Decay2.ar(\n Impulse.ar(8, 0, LFSaw.kr(0.3, 1, -0.3, 0.3)),\n 0.001,\n 0.3\n )\n * Mix.ar(Pulse.ar([80, 81], 0.3))\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "How do I add reverb with FreeVerb?"}, {"role": "assistant", "content": "`FreeVerb.ar(in, mix, room, damp)` — mix 0..1 is dry/wet, room 0..1 is the size (0.5 is a small room, 0.9 is a hall), damp 0..1 rolls off the high end of the tail. Put it after your sound: `FreeVerb.ar(SinOsc.ar(440) * 0.1, 0.4, 0.8, 0.5)`. For a send-style reverb, write the dry signal to Out.ar(0, …) and the same signal through FreeVerb to a second bus."}]} +{"conversations": [{"role": "user", "content": "What does `TdefGui.close` do?"}, {"role": "assistant", "content": "(if the jitGui is in its own window) and close its"}]} +{"conversations": [{"role": "user", "content": "What is `PackFFT` in SuperCollider?"}, {"role": "assistant", "content": "PackFFT — Pack separate demand-rate FFT bin streams into an FFT chain buffer Takes an array of magnitudes and phases, and packs them into an FFT buffer ready for transforming back into time-domain audio using IFFT. Category: UGens > FFT."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `RandID` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// start a noise patch and set the id of the generator\n(\nSynthDef(\"help-RandID\", { |out = 0, id = 1|\n RandID.ir(id);\n Out.ar(out,\n WhiteNoise.ar(0.05) + Dust2.ar(70)\n )\n}).add;\n);\n\n// reset the seed of my rgen at a variable rate\n(\nSynthDef(\"help-RandSeed\", { |seed = 1910, id = 1|\n RandID.kr(id);\n RandSeed.kr(Impulse.kr(FSinOsc.kr(0.2, 0, 10, 11)), seed);\n}).add;\n\n);\n\n// start two noise synths on left and right channel with a different randgen id\na = Synth(\"help-RandID\", [\\out, 0, \\id, 1]);\nb = Synth(\"help-RandID\", [\\out, 1, \\id, 2]);\n\n// reset the seed of randgen 1\nx = Synth(\"help-RandSeed\", [\\id, 1]);\n\n// change the target randgen to 2 (affects right channel)\nx.set(\\id, 2);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ControlName`."}, {"role": "assistant", "content": "```supercollider\n(\nd = SynthDef(\\tone, { |out = 0, freq = 200|\n var sig;\n\n freq.spec = ControlSpec(20, 20000);\n sig = SinOsc.ar(freq);\n\n Out.ar(out, sig);\n}).add;\n);\n\nd.specs.freq.postln;\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Scale`."}, {"role": "assistant", "content": "```supercollider\n(\nr = {\n var scale = Scale.choose.postln;\n SinOsc.ar(\n (\n DegreeToKey.kr(\n scale.as(LocalBuf),\n MouseX.kr(0, 15), // mouse indexes into scale\n scale.stepsPerOctave,\n 1, // mul = 1\n 60 // offset by 72 notes\n )\n + LFNoise1.kr([3, 3], 0.04) // add some low freq stereo detuning\n ).midicps, // convert midi notes to hertz\n 0,\n 0.25\n )\n}.play;\n);\n\nr.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `InstrBrowser.inputSpec` do?"}, {"role": "assistant", "content": "Browse your instrument library, with customizable actions"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `GbmanN`."}, {"role": "assistant", "content": "```supercollider\n// default initial params\n{ GbmanN.ar(MouseX.kr(20, SampleRate.ir)) * 0.1 }.play(s);\n\n// change initial params\n{ GbmanN.ar(MouseX.kr(20, SampleRate.ir), -0.7, -2.7) * 0.1 }.play(s);\n\n// wait for it...\n{ GbmanN.ar(MouseX.kr(20, SampleRate.ir), 1.2, 2.0002) * 0.1 }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(GbmanN.ar(40)*400+500)*0.4 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// No args: loopback is immediate\n{ EnvGen.kr(Env([0.1, 1, 0.5], [0.01, 0.03]).circle) }.plot(0.2).plotMode_(\\dlines)\n\n// With loopback time and curve specified\n{ EnvGen.kr(Env([0.1, 1, 0.5], [0.01, 0.03]).circle(0.05, \\sin)) }.plot(0.2).plotMode_(\\dlines)\n\n( // Looping frequency modulation\n{\n SinOsc.ar(\n EnvGen.kr(\n Env(\n [6000, 700, 100], [1, 1], ['exp', 'lin']\n ).circle.postcs // post internal representation\n )\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// No args: loopback is immediate\n{ EnvGen.kr(Env([0.1, 1, 0.5], [0.01, 0.03]).circle) }.plot(0.2).plotMode_(\\dlines)\n\n// With loopback time and curve specified\n{ EnvGen.kr(Env([0.1, 1, 0.5], [0.01, 0.03]).circle(0.05, \\sin)) }.plot(0.2).plotMode_(\\dlines)\n\n( // Looping frequency modulation\n{\n SinOsc.ar(\n EnvGen.kr(\n Env(\n [6000, 700, 100], [1, 1], ['exp', 'lin']\n ).circle.postcs // post internal representation\n )\n ) * 0.1\n // add an audible metronome\n + (SinOsc.ar(280) * Decay.ar(Impulse.ar(1), 0.05) * 0.5)\n}.play;\n);\n\n( // Control the gate with MouseX\n{\n SinOsc.ar(\n EnvGen.kr(\n Env(\n [6000, 700, 100], [0.5, 0.5], ['exp', 'lin']\n ).circle(1).postcs,\n MouseX.kr > 0.5\n )\n ) * 0.1\n + (SinOsc.ar(280) * Decay.ar(Impulse.ar(1), 0.05) * 0.5)\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `IEnvGen`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var env = Env([0, 0.6, 0.3, 1.0, 0], [0.1, 0.02, 0.4, 1.1], [\\lin, \\exp, -6, \\sin]);\n var envgen = IEnvGen.kr(env, MouseX.kr(0, env.times.sum));\n env.plot;\n SinOsc.ar(envgen * 500 + 440)\n}.play;\n);\n\n// index with an SinOsc ... mouse controls amplitude of SinOsc\n// use offset so negative values of SinOsc will map into the Env\n(\n{\n var sin = SinOsc.ar(440, 0, MouseX.kr(0, 1));\n // use offset so negative values of SinOsc will map into the Env\n var env = Env([-1, -0.7, 0.7, 1], [0.8666, 0.2666, 0.8668], \\lin, offset: -1.0);\n IEnvGen.ar(env, sin) * 0.1\n}.play;\n);\n\n// index with Amplitude of input, control freq of SinOsc (uses SoundIn)\n(\n{\n var point = Amplitude.ar(SoundIn.ar(0), 0.01, 0.2);\n // use offset so negative values of SinOsc will map into the Env\n var env = Env.xyc([[0, 330, \\exp], [0.5, 440, \\exp], [1.0, 1760]]);\n SinOsc.ar(IEnvGen.kr(env, point)) * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `BusPlug.copyState` do? What arguments does it take?"}, {"role": "assistant", "content": "Copy the internal settings of one proxy into another. Old state is cleared, the bus is Arguments: proxy — The object whose internal state is being copied.."}]} +{"conversations": [{"role": "user", "content": "Explain `RedGUI` in SuperCollider briefly."}, {"role": "assistant", "content": "RedGUI — base class of gui wrappers This class is an abstract class and only creates a skin at `*initClass`. Category: Red > redGUI."}]} +{"conversations": [{"role": "user", "content": "Explain `AbstractSystemAction` in SuperCollider briefly."}, {"role": "assistant", "content": "AbstractSystemAction — register actions to be taken for system events Category: Control."}]} +{"conversations": [{"role": "user", "content": "Explain `PSVop` in SuperCollider briefly."}, {"role": "assistant", "content": "PSVop — Sieve pattern for arbitrary set operations of integer generators with point output Pattern for arbitrary set operations of integer generators with point output. For an introduction and more examples see Sieves_and_Psieve_patterns. Category: Libraries > miSCellaneous > Sieves and Psieve Patterns, Streams-Patterns-Events > Sieves and Psieve Patterns."}]} +{"conversations": [{"role": "user", "content": "What does `SplineGui.setZoom` do? What arguments does it take?"}, {"role": "assistant", "content": "Zoom along the horizontal domain to a subset of the entire Arguments: argFromX — X value at the left edge; argToX — X value at the right edge."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `OSCBundle`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// create a new, empty instance\na = OSCBundle.new;\n\n// a synthdef that needs to be sent to the server, an operation that is asynchronous,\n// i.e. we have to wait until it is finished.\nx = SynthDef(\"test\", { OffsetOut.ar(0, BPF.ar(Impulse.ar(4) * 10, Rand(9000, 1000), 0.1)) });\n// this is why addPrepare is used.\na.addPrepare([\"/d_recv\", x.asBytes]);\n// add is used with synchronous operations, like starting synths.\na.add([\"/s_new\", \"test\", -1]);\n\n// the bundle has now the synchronous separated from the asynchronous bundles:\na.messages;\na.preparationMessages;\n\n// this can be simply sent - the bundle takes care of the server client communication\n// like waiting for the synthdef to be loaded. the synth is started when the preparation\n// is finished.\n\ns.boot; // boot the server\na.send(s);\n\ns.freeAll; // free all nodes on the server\n\n// scheduled sending: the synths are started on the next beat.\n\na.schedSend(s, TempoClock.default, 1);\na.schedSend(s, TempoClock.default, 1);\na.schedSend(s, TempoClock.default, 1);\n\ns.freeAll; // free all nodes on the server\n\n// the bundle can contain several preparation messages and messages at a time.\n// the proparationMessages are sent first and only when they are all completed,\n// the other bundles are sent.\n// the bundle can also be reused, if there is no specific allocated buffers/node ids.\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for UI sounds (pt1): bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n// UI sounds\n// this code is an attempt to recreate a sound\n// inspired from some technological/electrical UI interface\n\n// 1. first define the synth\n// Here we are using the FM technique\n(\nSynthDef(\\fmmod, {\n |\n amp=0.2,\n fc=1000,\n fm = 100,\n idx = 100,\n atk=0.01,\n rls=0.1\n |\n var env = EnvGen.ar(Env.perc(atk, rls), doneAction:2);\n var modulator = SinOsc.ar(fm);\n var carrier = SinOsc.ar(fc + (idx*modulator) );\n var sig = carrier * env * amp;\n sig = HPF.ar(sig, 1000);\n Out.ar(0, sig!2);\n}).add;\n);\n\n// 2. then define the Pbind which will play the sequence\n// of UI sounds simulating variuos characters showing up on an\n// imaginary display.\n// Play around FC, FM, ATK and RLS to obtain different sound characters.\n(\np = Pbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 100,\n \\idx, 100,\n \\amp, 0.6,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).asEventStreamPlayer;\n);\n\n// 3. play it\np.play;\n\n// 4. Here are some presets\n\n// \"cricket\" preset\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 100,\n \\idx, 100,\n \\amp, 0.6,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 2\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 1000,\n \\idx, 100,\n \\amp, 0.6,\n \\atk, 0.001,\n \\rls, 0.01,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 3\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 100,\n \\idx, 10,\n \\amp, 0.4,\n \\atk, 0.01,\n \\rls, 0.01,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 4\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 1000,\n \\fm, 100,\n \\idx, 1000,\n \\amp, 0.2,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n\n// preset 5\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 5000,\n \\fm, 1000,\n \\idx, 1000,\n \\amp, 0.4,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 5\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 8000,\n \\fm, 1000,\n \\idx, 1000,\n \\amp, 0.7,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//spinning hypercube / tesseract\n//after Shiffman https://codingtrain.github.io/website-archive/CodingChallenges/113-hypercube.html\n\n\n(\nvar width= 640, height= 480, w,\ntheta= 0, speed= 0.005, hypercube;\n\nw= RedWindow(\"3Dhypercube\", Rect(128, 64, width, height)).front;\nhypercube= Red4DTesseract();\n\n//--loop\nw.draw{\n theta= theta+speed;\n hypercube.rotation= RedVector[theta, 0, 0, 0, 0, theta];\n hypercube.update;\n\n //--render\n hypercube.render(2, 500); //1= exaggerate, 2= standard\n Pen.translate(width*0.5, height*0.5);\n Pen.fillColor= Color.white;\n hypercube.draw;\n Pen.strokeColor= Color.white;\n hypercube.drawOutlines;\n};\nw.play;\nCmdPeriod.doOnce({w.close});\n)\n```"}, {"role": "assistant", "content": "spinning hypercube / tesseract after Shiffman https://codingtrain.github.io/website-archive/CodingChallenges/113-hypercube.html."}]} +{"conversations": [{"role": "user", "content": "What is `SortedList`?"}, {"role": "assistant", "content": "SortedList — a Collection whose items are kept in a sorted order."}, {"role": "user", "content": "What does `SortedList.new` do?"}, {"role": "assistant", "content": "Creates a SortedList with the initial capacity given by size and a comparison function. The SortedList can contain equal / identical elements more than once. The function must accept two arguments and return true if and only if the first argument comes before the second argument in the sort order. If omitted, defaults to `{|a, b| a < b}`. (Note that this is slightly different from what Sequenceabl"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nt = SortedList.new(8, {|a,b| a.first < b.first });\nt.add([10, \"last\"]);\nt.add([1, \"first\"]);\nt.postln;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `ProxyMixer.setNameLeftBorder` do?"}, {"role": "assistant", "content": "sets current left border of nameView, trading size with volume"}]} {"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// increase feedback\n{ FBSineL.ar(SampleRate.ir, 1, Line.kr(0.01, 4, 10), 1, 0.1) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// increase feedback\n{ FBSineL.ar(SampleRate.ir, 1, Line.kr(0.01, 4, 10), 1, 0.1) * 0.2 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Granular electromaton."}, {"role": "assistant", "content": "```supercollider\n(\nServer.local.waitForBoot({\n(\nz.free;\nz = Buffer.alloc(s, 512, 1);\nz.sine1(1.0 / [1, 2, 3, 4], true, true, true);\n\n fork( { loop {\n SynthDef(\"g1\",{ arg out=0,bufnum=0,dur=1,rate=1,pos=0,sdens=1,edens=1;\n var dens = Line.kr(sdens,edens,dur);\n var trig = [LFNoise0,SinOsc,Impulse,LFPulse,LFSaw].choose.ar(Line.kr(sdens,edens,dur));\n //var env = EnvGen.kr(Env.perc(0.0001.rrand(0.1),dur*0.5.rrand(2)),doneAction:2);\n var env = EnvGen.kr(Env.perc(0.0001.rrand(0.1),dur*(0.5.rrand(4))),doneAction:2);\n Out.ar(out,\n GrainBuf.ar(2,trig,1/dens,bufnum,rate,pos)*env;\n )\n }).add();\n [1,2,4,8,16,32].choose.postln.wait;\n }\n }\n );\n\n\na = Pbind(\\instrument,\\g1,\\dur,Pseq([Pseq([0.25],32),Pseq([0.25,0.125,0.125],32),Pseq([0.125],32)],inf),\\sdens,Pseq([9000,1000,500]/10,inf),\\edens,Prand([Pseq([9000,1000,500]/10,4),Pseq([1],1)],inf),\\rate,Pfunc({-10.0.rrand(10)}),\\pos,Pfunc({1.0.rand}),\\bufnum,z.bufnum);\nb = Pbind(\\instrument,\\g1,\\dur,Pseq([4],inf),\\sdens,Pseq([9000,1000,500]/100,inf),\\edens,Prand([Pseq([9000,1000,500]/10,1),Pseq([1],3)],inf),\\rate,Pfunc({-10.0.rrand(10)}),\\pos,Pfunc({-10.0.rrand(10)}),\\bufnum,z.bufnum);\nc = Pbind(\\instrument,\\g1,\\dur,Pseq([4/3],inf),\\sdens,Pseq([9000,1000,500,25],inf),\\edens,Prand([Pseq([9000,1000,500,25],1),Pseq([1],4)],inf),\\rate,Pfunc({-100.0.rrand(100)}),\\pos,Pfunc({-10.0.rrand(10)}),\\bufnum,z.bufnum);\n\n\na =a.play;\nb =b.play;\nc =c.play;\n\n)\n});\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Who are you?"}, {"role": "assistant", "content": "I am sc-mind, a 198M MiniMind-3-MoE trained from scratch on the SuperCollider source and help corpus. I write and explain SuperCollider: SynthDefs, UGens, Patterns, Ndef, the language/server split, and how to make sound that is not silence."}]} -{"conversations": [{"role": "user", "content": "What is `CondVar`?"}, {"role": "assistant", "content": "CondVar — Condition variable: block one or more threads until some condition is true"}, {"role": "user", "content": "What does `CondVar.wait` do?"}, {"role": "assistant", "content": "The behavior depends on whether a `predicate` is given. If no `predicate` is given, this method simply blocks the current thread until it is woken by `signalOne` or `signalAll`. Otherwise, this method is equivalent to `while { predicate.value.not } { cond.wait }`. In other words, the thread only blocks if the predicate is false, otherwise it blocks and only resumes once the thread has been signall"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nc = CondVar();\n\nRoutine {\n 1.wait;\n \"waited for 1 second\".postln;\n 1.wait;\n \"waited for another second, now waiting for you to run 'c.signalOne'...\".postln;\n c.wait;\n \"the condition is no longer waiting\".postln;\n 1.wait;\n \"waited for another second, now waiting for you...\".postln;\n c.wait;\n \"the condition is no longer waiting\".postln;\n 1.wait;\n \"the end\".postln;\n}.play;\n);\n\n// Run this line to unblock the routine\nc.signalOne;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\Identity;\n~description = \"Output the Ambisonics stream to outputs channels, useful for NRT rendering\";\n\n~function = {|in = 0|\nin;\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\HOABinaural;\n~description = \"Binaural decoder using the HOABinaural class from SC-HOA\";\n\n~function = { |in = 0, order|\n HOABinaural.ar(\n order: order,\n in: in\n );\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Receiving NIMate generated OSC messages."}, {"role": "assistant", "content": "```supercollider\n//NIMate \"Full Skeleton\" Kinect Theremin\n\n//Start server\n\ns.boot;\n\n\n//Start buses and OSC receivers\n\nb=Bus.control(s,3);\nc=Bus.control(s,3);\n\n\nOSCdef.new(\n \\rh_xyz,\n {\n |msg, time, addr, recvPort|\n postln(msg);\n b.setnSynchronous([msg[1],(msg[2]+1)/2,msg[3]+0.3]);\n },\n \"/Right_Hand\", nil, 7000\n);\n\n\nOSCdef.new(\n \\lh_xyz,\n {\n |msg, time, addr, recvPort|\n postln(msg);\n c.setnSynchronous([msg[1]+0.9,(msg[2]+1)/2,msg[3]+0.3]);\n },\n \"/Left_Hand\", nil, 7000\n);\n\n\nOSCdef(\\lh_xyz).enable;\nOSCdef(\\rh_xyz).enable;\n\n\n//Synth definition and bus mapping\n\nSynthDef(\\theremin,\n {\n |ctrl=#[0,0,0], ctrr=#[0,0,0]|\n var f, a, vibrate, tremrate;\n\n f = LinExp.kr(ctrr[0],0,1,100,1000);\n vibrate = LinExp.kr(ctrl[0],0,1,1,500);\n tremrate = 100*ctrl[1];\n\n a = SinOsc.ar(f + (f *\n SinOsc.ar(vibrate,0,0.1)),0,\n mul: ctrr[1])*\n SinOsc.kr(tremrate);\n\n Out.ar([0,1], a)\n }).add;\n\nx=Synth.new(\\theremin);\n\nx.map(\\ctrr,b);\nx.map(\\ctrl,c);\n\n\n//Clean up\n\nx.free;\nb.free;\nc.free;\ns.stop;\ns.quit;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\\sine, { |freq = 400, amp = 0.1| Out.ar(0, SinOsc.ar(freq, mul: amp)) }).add;\nSynthDef(\\pulse, { |freq = 400, amp = 0.1| Out.ar(0, Pulse.ar(freq, mul: amp)) }).add;\n);\n\n(\nx = Synth(\\sine).register;\ny = Synth(\\pulse).register;\n);\n\n// pause pulse \n\ny.run(false);\n\n// VarGui checks state, definition is known, new Synths of same definition can be started\n\nv = VarGui(synth: [x,y]).gui;\n\n\n// With nodeIDs or non-regist\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\\sine, { |freq = 400, amp = 0.1| Out.ar(0, SinOsc.ar(freq, mul: amp)) }).add;\nSynthDef(\\pulse, { |freq = 400, amp = 0.1| Out.ar(0, Pulse.ar(freq, mul: amp)) }).add;\n);\n\n(\nx = Synth(\\sine).register;\ny = Synth(\\pulse).register;\n);\n\n// pause pulse \n\ny.run(false);\n\n// VarGui checks state, definition is known, new Synths of same definition can be started\n\nv = VarGui(synth: [x,y]).gui;\n\n\n// With nodeIDs or non-registered Synths VarGui demands addtional state info\n\n(\nx = { SinOsc.ar(400, mul: 0.1) }.play;\ny = { Pulse.ar(700, mul: 0.01) }.play;\n);\n\ny.run(false);\n\n// no new Synths from temporary synth definition\n\nv = VarGui(synth: [x,y], assumePlaying: true, assumeRunning: [true, false]).gui;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `FoaFocusZ` in SuperCollider briefly."}, {"role": "assistant", "content": "FoaFocusZ — First Order Ambisonic (FOA) focus transformer Apply focus to a First Order Ambisonic signal (B-format) along the z-axis. Category: Libraries > Ambisonic Toolkit > UGens > FOA > Transformer, UGens > Multichannel > Ambisonics."}]} -{"conversations": [{"role": "user", "content": "What does `Pbind.embedInStream` do? What arguments does it take?"}, {"role": "assistant", "content": "From within a Stream like e.g. Routine, yield all events from this pattern before continuing. One pattern can be used to produce values for any number of independent Arguments: inevent — An event that is passed into all substreams and is used by them to produce the output events. `a = Pbind(note: Pseq([0, 4, 7]), amp: 0.1, dur: 0.2);`."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Object`."}, {"role": "assistant", "content": "```supercollider\n// embedding an event\na = (z: 77);\nb = Pset(\\y, 8, a.streamArg(true)).asStream;\nc = Pset(\\y, 8, a.streamArg(false)).asStream;\nb.nextN(3, ()); // this ends\nc.nextN(3, ()); // this loops\n\n// embedding a pattern\na = Pbind(\\note, Pseq([1, 2]));\nb = Pset(\\y, 8, a.streamArg(true)).asStream;\nc = Pset(\\y, 8, a.streamArg(false)).asStream;\nb.nextN(3, ()); // this ends\nc.nextN(3, ()); // this ends, too\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nMix.ar([SinOsc.ar(220, 0, 0.1), SinOsc.ar(330, 0, 0.1)])\n```"}, {"role": "assistant", "content": "Sums two sine waves into one signal — a perfect fifth, 220 Hz and 330 Hz, at 0.1 amplitude each.\n\n`[SinOsc.ar(220, 0, 0.1), SinOsc.ar(330, 0, 0.1)]` is an Array of two audio-rate signals (each UGen\nreturns a signal; an array of them is just a list). `Mix.ar` adds the elements together. The alternative\n`+` operator does the same for two signals, and `Splay.ar` would spread them across the stereo field\ninstead of summing them."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n//Define bow synthdef\n(\nSynthDef(\\help_dwgbowed, { |out=0, freq=440, amp=0.5,force=1, gate=1,pos=0.07,c1=0.25,c3=31,pan=0|\n var vib = Gendy1.kr(1,1,1,1,0.1, 4,mul:0.003,add:1);\n var son = DWGBowedSimple.ar(freq*vib, amp,force, gate,pos,0.1,c1,c3);\n son = DWGSoundBoard.ar(son);\n son = BPF.ar(son,118,1)+son;\n son = BPF.ar(son,430,1)+son;\n son = BPF.ar(son,\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n//Define bow synthdef\n(\nSynthDef(\\help_dwgbowed, { |out=0, freq=440, amp=0.5,force=1, gate=1,pos=0.07,c1=0.25,c3=31,pan=0|\n var vib = Gendy1.kr(1,1,1,1,0.1, 4,mul:0.003,add:1);\n var son = DWGBowedSimple.ar(freq*vib, amp,force, gate,pos,0.1,c1,c3);\n son = DWGSoundBoard.ar(son);\n son = BPF.ar(son,118,1)+son;\n son = BPF.ar(son,430,1)+son;\n son = BPF.ar(son,490,1)+son;\n son = LPF.ar(son,6000);\n Out.ar(out, Pan2.ar(son * 0.1, pan));\n}).add;\n);\n\n//Use it.\n(\n\nPbind(\n \\instrument, \\help_dwgbowed,\n \\dur , 0.25,\n \\degree, Pseq([1,5,7+3], inf),\n \\amp , Pseq([0.9,0.7,0.5],inf),\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "The server stopped responding. What do I do?"}, {"role": "assistant", "content": "In order: `Ctrl+.` (CmdPeriod) to reset scheduling, then `s.reboot` if the server itself is wedged.\nA reboot drops every SynthDef and buffer, so re-add them — which is why real projects keep their SynthDefs\nin a file you can re-evaluate rather than typing them in the REPL.\n\nIf the boot itself fails, the post window has the reason: usually the audio device (another application\nholding exclusive access) or a sample-rate mismatch. `Server.default.options.device` picks a device before\n`s.boot`."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// as a frequency control\n{ SinOsc.ar(StandardN.ar(40, MouseX.kr(0.9, 4))*800+900)*0.4 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// as a frequency control\n{ SinOsc.ar(StandardN.ar(40, MouseX.kr(0.9, 4))*800+900)*0.4 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for reverbio (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"reverb\", {arg freq=440, release=0.1;\n var in, s1,out, mod1, depth, mfreq;\n s1 = SoundIn.ar(0,mul:2);\n out=FreeVerb.ar(s1,mix:1,room:MouseX.kr(0,1),damp:MouseY.kr(0,1));\n Out.ar(0,out);\n Out.ar(1,out);\n}).load(s);\n);\na = Synth(\"reverb\");\na.free\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes beats to bar printing."}, {"role": "assistant", "content": "```supercollider\n(\nf = ();\nf.beatAndBar = {\n var t = currentEnvironment.clock; // t= TempoClock.new;\n var text = \"xB: \";\n\n var nBeatsPerBar = { arg n, beats, clock;\n var nBpb = clock.beatsPerBar * n;\n \"\" ++ n ++ text ++ (nBpb - (beats%(nBpb))).asInteger\n };\n\n t.play({arg beats, time, clock;\n ( //[\"beat: \" ++ (t.beatInBar + 1).asInteger] ++ //uncomment for beat in bar\n [1,2,4,8,16,32].collect( {|n,i| nBeatsPerBar.value(n, beats, clock)})\n ).postln;\n 1});\n \"beatAntBar\";\n}\n);\n\nf[\\beatAndBar].value;\n\n(\nf[\\beatAndBar].value;\nCmdPeriod.add(f[\\beatAndBar]);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LinCongL`."}, {"role": "assistant", "content": "```supercollider\n// default initial params\n{ LinCongL.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Ganglion.defaultSampleRate` do?"}, {"role": "assistant", "content": "An Integer that is different for each board. For Ganglion boards it is 200"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n var time = 0.23;\n var freq = (55).midicps;\n var a = VarSaw.ar(freq/2, width: XLine.ar(0.5,1,time)).range(0,XLine.ar(0.666,1/666,time));\n var tone = SinOsc.ar(freq).fold(-0.23*a,a) * EnvGen.ar(Env([1,0],[time]));\n Out.ar(0, tone.dup);\n}.play;\n)\n```"}, {"role": "assistant", "content": "Seekers are something you should avoid.\r\nI put this code through Rakarrack to get some samples for heXon.\r\nheXon is a FOSS dual stick arcade shooter available at www.LucKeyProductions.nl."}]} -{"conversations": [{"role": "user", "content": "What does `PbindFx.defaultSourceCleanupDelay` do?"}, {"role": "assistant", "content": "Get and set the value of this class variable. Defaults to"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nNdef(\\birdy, {arg freq=1500, amp=0.5, rate=10;\n var osc, son, convIn, rand;\n osc=LFCub;\n rand = LFNoise1.ar(rate);\n convIn=LinCongN.ar(rate);\n son = osc.ar(Convolution.ar(convIn,convIn));\n freq = Latch.kr(rand.range(0,1).round(0.1), rand) * freq;\n freq = osc.ar(osc.ar(rand)*rand.range(0,10)).range(freq, freq*3);\n son = Formlet.ar(son, freq, convIn.abs*0.1, rand.abs);\n son = Normalizer.ar(son, 0.9, 0.1) * convIn.abs * LFPulse.kr(LFPulse.kr(rand.abs), 0, rand.abs);\n son = son + GVerb.ar(son, 99, 2, mul: rand.range(0,0.3));\n son * amp\n}).play\n)\n```"}, {"role": "assistant", "content": "I just rewrote one of autocsi's tweets and came out with this which sounds like a digital bird of some kind:."}]} -{"conversations": [{"role": "user", "content": "What does `AbstractResponderFunc.dispatcher` do?"}, {"role": "assistant", "content": "et this object's dispatcher. This is the object which matches incoming messages with responder funcs. Instances can use custom dispatchers to support arbitrary matching Returns: An instance of an appropriate subclass of AbstractDispatcher. (The return type will depend on subclass.)"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nShutDown.add({ \"Good bye!!\".postln };\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nShutDown.add({ \"Good bye!!\".postln });\n```"}]} -{"conversations": [{"role": "user", "content": "Resizing FreqScope?"}, {"role": "assistant", "content": "SuperCollider forum — Resizing FreqScope?\n\nOddly, this seems to work:\n\n```supercollider\n// max partial = 20 kHz\n// do not play this loudly\na = { Blip.ar(100, 200, 0.02).dup }.play;\n\nv = FreqScope(800, 600); // top partial is shown below 1.75 kHz (?)\n\nv.scope.scope.xZoom = 1; // seems correct, by eyeballing\n\n// let's try another resolution\nv = FreqScope(600, 500);\nv.scope.scope.xZoom = 1; // hm, zoom = 1 seems OK here too\n```\n\nFreqScope includes the line scope.xZoom_((scope.bufSize*0.25) / width); so it may be that this calculation is incorrect. I’m unclear, for instance, why it’s dividing by width – apparently zooming out for larger windows...?\n\nBut I tried three different widths (800x600, 600x500, 200x150), and for all of them, xZoom = 1 appeared to be correct. It’s possible that this calculation is vestigial, then – maybe we needed it for the older version of frequency scope, but the Qt version might not need it at all.\n\nhjh"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Supercollider to Renoise."}, {"role": "assistant", "content": "```supercollider\n// declare an event type which sends OSC commands to Renoise\n\n(\nEvent.addEventType(\\renoise, { |server|\n var renoiseOscServer = NetAddr(\"127.0.0.1\", 8000);\n var notes = [~midinote.value, ~ctranspose.value, ~velocity.value, ~sustain.value, ~lag.value, ~timingOffset.value, ~instr.value, ~track.value].flop;\n var timeNoteOn, timeNoteOff, instrument, track, velocity;\n var serverLatency;\n\n serverLatency = server.latency ? 0;\n\n notes.do {|note|\n instrument = note[6] ? -1;\n track = note[7] ? -1;\n velocity = note[2].asInt.clip(0,127);\n\n // sustain and timingOffset are in beats, lag is in seconds\n timeNoteOn = (thisThread.clock.tempo.reciprocal*note[5])+note[4]+server.latency;\n timeNoteOff = (thisThread.clock.tempo.reciprocal*(note[3]+note[5]))+note[4]+server.latency;\n SystemClock.sched(timeNoteOn, {renoiseOscServer.sendMsg(\"/renoise/trigger/note_on\", instrument.asInt, track.asInt, (note[0]+note[1]).asInt, velocity )});\n SystemClock.sched(timeNoteOff, {renoiseOscServer.sendMsg(\"/renoise/trigger/note_off\", instrument.asInt, track.asInt, (note[0]+note[1]).asInt)});\n }\n});\n);\n\n// Now start Renoise OSC server, load a sample, and try some patterns\n\n// straight timing\n(\nPbind(*[\n type: \\renoise,\n legato: Pgauss(0.2,0.05,inf),\n dur: 0.2,\n degree: [2,5,12],\n track: Prand([0,1], inf),\n ctranspose: Pseq([0,0,0,0,4,4,4,4,5,5,5,5],inf),\n velocity: Pgauss(64,10,inf),\n]).play;\n);\n\n// loose timing\n(\nPbind(*[\n type: \\renoise,\n legato: 0.1,\n dur: 0.2,\n midinote: [66, 69, 74],\n lag: Pwhite(-0.05!3, 0.05)\n]).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nPbind(\\note, Pseq([0, 4, 7]), \\amp, 0.1, \\dur, 0.2.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nPbind(\\note, Pseq([0, 4, 7]), \\amp, 0.1, \\dur, 0.2).play\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Re: Timpani (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\ns.boot\n\n(\nSynthDef(\\aSynth, { |rel = 0, choose = 0, amp = 0|\n var klank, env;\n\n klank = Klank.ar(`[choose ! 12, {Rand(0.128, 0.7)} ! 12], BrownNoise.ar(0.7));\n env = EnvGen.kr(Env.perc(0.01, rel), doneAction: 2);\n Out.ar(0, klank * env.dup * amp);\n}).add;\n);\n\n(\n{\n 42.do{\n x = [70, 90, 120].choose;\n y = rrand(0.01, 5);\n // attack\n Synth(\\aSynth, [\\rel, y, \\choose, x, \\amp, 128e-6]);\n // resonance\n Synth(\\aSynth, [\\rel, 1, \\choose, x, \\amp, 128e-5]);\n y.wait;\n }\n}.fork;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Re: the perfect frequencies?"}, {"role": "assistant", "content": "```supercollider\n// Rumush\n// https://mycelialcordsblog.wordpress.com/\n// https://fungorumush.bandcamp.com/releases\n// https://soundcloud.com/fungorum\n\n(\nf = {\n var rep = [4, 8, 16, 32];\n var n = rep.choose;\n var x = [\n\n 54, 60, 66, 72, 81, 90, 96, 102,\n 108, 128, 132, 144, 162, 180, 192, 204,\n 216, 240, 264, 288, 324, 360, 384, 408,\n 432, 480, 528, 576, 648, 720, 768, 816,\n 864, 960, 1056, 1152, 1296, 1440, 1536, 1632,\n 1728, 1920, 2112, 2304, 2592, 2880, 3072, 3264,\n 3456, 3840, 4224, 4608, 5184, 5760, 6144, 6528,\n 6912, 7680, 8448, 9216, 10368, 11520, 12288, 528\n\n ];\n Mix.fill(n,\n {\n var detune = 5.rand;\n var sin = SinOsc.ar(x.choose, 4.rand, 0.25);\n var saw = RLPF.ar(Saw.ar(x.choose*0.01+detune, 0.75), x.choose, 2.rand).tanh;\n Pan2.ar((sin+saw) * EnvGen.kr(Env.sine(12, 1/n), 1, doneAction:2),\n 1.rand2) }\n );\n};\n);\n\n(\n// DEFINE A ROUTINE\nr = Routine({\n\n inf.do({\n f.play;\n 10.wait;\n })\n});\n);\n\nr.reset.play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Patch.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Pairs an Instr with inputs that that will be passed to the Instr Arguments: name — The Instr can be specified as: an Instr name `(` a direct function that will be used to create an Instr in place `(` or directly pass an Instr object `(`; inputs — an array of arguments for the Instr function. Can also be a dictionary: (argName: value, ... ) `Patch({ arg freq,amp;`; outClass — default is Out.ar You could supply ReplaceOut to do effect processing on a Bus."}]} -{"conversations": [{"role": "user", "content": "What does `RedLZ77.compress` do?"}, {"role": "assistant", "content": "Returns an array with length, distance and"}]} -{"conversations": [{"role": "user", "content": "What does `EZSlider.valueAction` do? What arguments does it take?"}, {"role": "assistant", "content": "Sets the value and performs the action at the index value and the global Arguments: val — An Integer.."}]} -{"conversations": [{"role": "user", "content": "What does `RecordBuf.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Record or overdub into a Buffer. Arguments: inputArray — An Array of input channels.; bufnum — The index of the buffer to use.; offset — An offset into the buffer in samples.; recLevel — Value to multiply by input before mixing with existing data.; preLevel — Value to multiply to existing data in buffer before mixing with input.; run — If zero, then recording stops, otherwise recording proceeds.; loop — If zero then don't loop, otherwise do. This is modulatable.; trigger — a trigger causes a jump to the start of the Buffer. A trigger occurs when a signal changes from negative value to positive value.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// silly but simple: understand a Saw for every SinOsc\nthis.preProcessor = { |code| code.replace(\"SinOsc\", \"Saw\") };\n\n{ SinOsc.ar(200 * 0.1 }.play;\n\npreProcessor = nil; // reset to nil.\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// silly but simple: understand a Saw for every SinOsc\nthis.preProcessor = { |code| code.replace(\"SinOsc\", \"Saw\") };\n\n{ SinOsc.ar(200) * 0.1 }.play;\n\npreProcessor = nil; // reset to nil.\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for instant nostalgia with wow and flutter?"}, {"role": "assistant", "content": "```supercollider\n// read a soundfile\n(\ns.waitForBoot({\n\n SynthDef(\\wowflutter_2chan, {\n arg bufnum, out = 0, wobble_rpm=33, wobble_amp=0.05, wobble_exp=39, flutter_amp=0.03, flutter_fixedfreq=6, flutter_variationfreq=2;\n var signed_wobble = wobble_amp*(SinOsc.kr(wobble_rpm/60)**wobble_exp);\n var wow = Select.kr(signed_wobble > 0, signed_wobble, 0);\n var flutter = flutter_amp*SinOsc.kr(flutter_fixedfreq+LFNoise2.kr(flutter_variationfreq));\n var combined_defects = 1 + wow + flutter;\n var sig = PlayBuf.ar(2, bufnum, BufRateScale.kr(bufnum)*combined_defects, doneAction:Done.freeSelf);\n Out.ar(out, sig);\n }).add;\n\n b = Buffer.read(s, \"pianomusic.wav\"); // link in code description, or use your own...\n s.sync;\n\n Synth(\\wowflutter_2chan ,[\n \\bufnum, b.bufnum,\n \\out, 0,\n \\wobble_rpm, 33,\n \\wobble_amp, 0.04,\n \\wobble_exp, 11, // best an odd power, higher values produce sharper, smaller peak\n \\flutter_amp, 0.02,\n \\flutter_fixedfreq, 6,\n \\flutter_variationfreq, 2\n ]);\n});\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `NestedAllpassC.ar` do?"}, {"role": "assistant", "content": "Nested Allpass filters as proposed by Vercoe and Pluckett"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n/* Audio plugin definition\n\n Each audio plugin should define the following global variables:\n ~name: (symbol) name of the spatializer\n ~description: (string) a short description\n ~function: the actual definition of the plugin\n\n*/\n\n~name = \\emptySource;\n~description = \"dummy/template\";\n~channelLayout = \\mono;\n\n~function = {\n DC.ar(0);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "Supernova, Groups, Threads, Ndef?"}, {"role": "assistant", "content": "SuperCollider forum — Supernova, Groups, Threads, Ndef?\n\nAbout Ndef:\n\nAFAIK you can manually move a NodeProxy’s group into another group:\n\n```supercollider\n~pargroup = ParGroup(s);\n\nNdef(\\a, { Silent.ar(1) });\n\nNdef(\\a).group.moveToHead(~pargroup);\n```\n\nBut...\n\nNodeProxies use InFeedback.\n\nI was a little suspicious about this for parallel processing. As I recalled, InFeedback’s result depends on the order of execution:\n\n-\nIf the source node for the bus finished processing before the server reaches InFeedback, then InFeedback will output the block of audio being processed now.\n\n-\nIf the source node comes after the node containing InFeedback, then it will output the previous block of audio.\n\nIn both cases, these are the most recently available audio blocks. But, if the order of evaluation is not consistent, then the output may not be consistent.\n\nLet’s test that:\n\n```supercollider\nb = Bus.audio(s, 1);\n\na = { SinOsc.ar(200, 0, 0.1) }.play(outbus: b);\n\nc = { InFeedback.ar(b, 1).dup }.play(target: a, addAction: \\addAfter);\n\n(\nfork {\n var order = Pseq([\\moveBefore, \\moveAfter], inf).asStream;\n loop {\n c.perform(order.next, a);\n 1.0.wait;\n }\n}\n)\n```\n\nOops.\n\nThis means you can’t randomly throw Ndefs into ParGroups. If one Ndef reads a signal from another, then you have to make sure that the target Ndef comes later in a serial (regular) Group. (Correctness of the result should be more important than “optimal” usage of multiple cores.)\n\nIf you don’t, and if supernova happens to put the source and target Ndefs onto separate cores at roughly the same time, then the target might evaluate InFeedback either before or after the source finishes, and there’s no guarantee of this being consistent. So you might get clicks.\n\nhjh"}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nMix.ar([SinOsc.ar(220, 0, 0.1), SinOsc.ar(330, 0, 0.1)])\n```"}, {"role": "assistant", "content": "Sums two sine waves into one signal — a perfect fifth, 220 Hz and 330 Hz, at 0.1 amplitude each.\n\n`[SinOsc.ar(220, 0, 0.1), SinOsc.ar(330, 0, 0.1)]` is an Array of two audio-rate signals (each UGen\nreturns a signal; an array of them is just a list). `Mix.ar` adds the elements together. The alternative\n`+` operator does the same for two signals, and `Splay.ar` would spread them across the stereo field\ninstead of summing them."}]} -{"conversations": [{"role": "user", "content": "Explain `UniqueID` in SuperCollider briefly."}, {"role": "assistant", "content": "UniqueID — source for unique numbers Category: Core."}]} -{"conversations": [{"role": "user", "content": "I get \"Message 'ar' not understood\". Why?"}, {"role": "assistant", "content": "You called a rate method on something that is not a UGen. `Env.ar(...)` and `Buffer.ar(...)` are the classic cases: Env is a language-side description and is played by `EnvGen.ar(env, ...)`; a Buffer is server memory and is played by `PlayBuf.ar` or `BufRd.ar`. The UGen is the thing with a rate method — if it is a description or a container, there is another UGen that consumes it."}]} -{"conversations": [{"role": "user", "content": "Explain `NdefParamGui` in SuperCollider briefly."}, {"role": "assistant", "content": "NdefParamGui — display the settings of a nodeproxy NdefParamGui displays all settings and mappings of a nodeproxy, so one can change them flexibly. Single number get displayed with an EZSlider, and anything else is shown as an EZText (a text field). Its main use is within NdefGui. Category: JITLib > GUI, Live Coding."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Listening to CC messages."}, {"role": "assistant", "content": "```supercollider\n// connect will connect to all midi in devices\n// if you need to specify one,\n// check the sources at: MIDIClient.sources\n// and connect using MIDIIn.connect( source_index )\nMIDIIn.connect;\n\n// show incoming control data\n~control = { arg src, chan, num, val; \n [chan,num,val].postln; \n};\n\nMIDIIn.addFuncTo(\\control, ~control);\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n(\nx = Pbind(\\midinote, Pseries(60, 1, 10), \\dur, 0.5).asStream;\ny = Pbind(\\midinote, Pseries(90, -1, 10), \\dur, 0.5).asStream;\n\nz = Pseq([2, 3, 1, 2], 1).asStream;\n\n~a = Pfuncn({ x.next(()) }, { z.next });\n~b = Pfuncn({ y.next(()) }, { z.next });\n\nPsymNilSafe(Pseq(\"ab\", inf)).trace.play;\n\n// shorter with method 'symplay':\n// trace indicates all events with delta = 0 (maxNull\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n(\nx = Pbind(\\midinote, Pseries(60, 1, 10), \\dur, 0.5).asStream;\ny = Pbind(\\midinote, Pseries(90, -1, 10), \\dur, 0.5).asStream;\n\nz = Pseq([2, 3, 1, 2], 1).asStream;\n\n~a = Pfuncn({ x.next(()) }, { z.next });\n~b = Pfuncn({ y.next(()) }, { z.next });\n\nPsymNilSafe(Pseq(\"ab\", inf)).trace.play;\n\n// shorter with method 'symplay':\n// trace indicates all events with delta = 0 (maxNull = 128) in the post window\n// Pseq(\"ab\", inf).trace.symplay\n\n\n// ATTENTION: with Psym the example leads to a SC hang !\n// Psym(Pseq(\"ab\", inf), currentEnvironment).trace.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Another fibonaccy melody."}, {"role": "assistant", "content": "```supercollider\n(\nc=13;a=Array.fib(64,0,1);b=Array.fill(size:c,function:{arg i;a[i]%12});\np=1/(21-c);Pdef(\\x,Pbind(\\dur,p,\\degree,Pseq(b,1,0)));\nr=Array.fill(c,{arg i;Pbindf(Pdef(\\x),\\mtranspose,1-b[i]);});\nPseq(r,(1/p)).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BufSampleRate`."}, {"role": "assistant", "content": "```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n// compares a 1102.5 Hz sine tone (11025 * 0.1, left) with a 1100 Hz tone (right)\n// the apollo sample has a sample rate of 11.025 kHz\n(\n{\n var freq;\n freq = [BufSampleRate.kr(b) * 0.1, 1100];\n SinOsc.ar(freq, 0, 0.1)\n}.play;\n);\n\nb.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `Latoocarfian2DL` in SuperCollider briefly."}, {"role": "assistant", "content": "Latoocarfian2DL — latoocarfian 2D chaotic generator `x(n+1) = sin(by(n)) + c*sin(bx(n))` Category: UGens > Generators > Stochastic."}]} -{"conversations": [{"role": "user", "content": "What does `SparseArray.newClear` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a new SparseArray of the specified size, with each slot's value being default. `g = SparseArray.newClear(20, Arguments: size — Number of slots in the desired array. Note that slots are not explicitly created, so the speed of creation is not related to the array size.; default — The default value, i.e. the value that all slots should take at first.."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\np = Pmono(\\default, \\dur, 0.2, \\freq, Pwhite(1, 8) * 100).play\n\np.stop\n\n// multi channel expansion is supported:\np = Pmono(\\default, \\dur, 0.2, \\freq, Pwhite(1, 8) * 100, \\detune, [0, 2, 5, 1]).play\n\np.stop\n\n\n// the following example will end after 5 seconds\n// or you can stop it sooner with a stop message\n(\np = Pfindur(5,\n Pset(\\detune, Pwhite(0, 1.0) * [0, 1, 3, 7],\n Ppar([\n Pmono(\\default, \\dur, 0.2, \\freq, Pwhite(1, 8) * 100),\n Pmono(\\default\n// …\n```"}, {"role": "assistant", "content": "multi channel expansion is supported: the following example will end after 5 seconds (Pmono: monophonic event stream)"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LinExp`."}, {"role": "assistant", "content": "```supercollider\n// linexp\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(mod.linexp(-1, 1, MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1))) * 0.1\n}.play;\n);\n\n// exprange\n(\n{\n var mod = LFNoise2.ar(80).exprange(MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1));\n SinOsc.ar(mod) * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `RedManchesterCode` in SuperCollider briefly."}, {"role": "assistant", "content": "RedManchesterCode — Manchester encoding As per IEEE 802.3. See http://en.wikipedia.org/wiki/Manchester_encoding Category: Red > redTools."}]} +{"conversations": [{"role": "user", "content": "What does `Document.implementationClass` do? What arguments does it take?"}, {"role": "assistant", "content": "The editor implementation specific class which will handle Arguments: value — A class for implementing Document.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// compare:\n(\n{\n var mod = SinOsc.kr(Line.kr(1, 10, 10));\n SinOsc.ar(mod * 400 + 500) * 0.1\n}.play;\n);\n\n(\n{\n var mod = SinOsc.kr(Line.kr(1, 10, 10));\n SinOsc.ar(LinExp.kr(mod, -1, 1, 100, 900)) * 0.1\n}.play;\n);\n\n// modulating destination values.\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(LinExp.ar(mod, -1, 1, MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1))) * 0.1\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// compare:\n(\n{\n var mod = SinOsc.kr(Line.kr(1, 10, 10));\n SinOsc.ar(mod * 400 + 500) * 0.1\n}.play;\n);\n\n(\n{\n var mod = SinOsc.kr(Line.kr(1, 10, 10));\n SinOsc.ar(LinExp.kr(mod, -1, 1, 100, 900)) * 0.1\n}.play;\n);\n\n// modulating destination values.\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(LinExp.ar(mod, -1, 1, MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1))) * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `ArrayedCollection` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n pitches.size.do{ |i|\n {\n var freq = pitches[i].midicps;\n var env = Env.perc.ar(Done.freeSelf);\n SinOsc.ar(freq) * 0.1 * env\n }.play;\n 0.2.wait\n }\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is SuperCollider?"}, {"role": "assistant", "content": "SuperCollider is a platform for audio synthesis and algorithmic composition, written in C++ and SuperCollider. It splits into a language client (sclang) that runs your code and builds UGen graphs, and an audio server (scsynth) that does the DSP in real time. They talk over OSC."}]} +{"conversations": [{"role": "user", "content": "A starting point to start experimenting with non-standard synthesis?"}, {"role": "assistant", "content": "SuperCollider forum — A starting point to start experimenting with non-standard synthesis?\n\nI while ago I did this noise cloud generator which might serve as inspiration. Other ideas: scramble signals with FFT tools, granular synthesis, FM-synthesis with extreme settings, like index-of-modulation = 4000.\n\n```supercollider\nSynthDef(\\clouds, {\n var num = 10;\n var dur = \\duration.kr(1/6);\n var sig = num.collect{\n var freq = Rand(30, 5000) * SinOsc.kr(LFNoise1.kr(dur).range(30, 1000), 0, LFNoise1.kr(dur)\n .range(0.01, 8)).midiratio;\n var sig = Select.ar(LFNoise0.kr(dur).range(0, 2).round,\n [SinOsc.ar(freq, 0, 0.3), Saw.ar(freq, 0.3), Pulse.ar(freq, 0, 0.3)]);\n var filtFreq = Rand(30, 1000) * LFNoise1.kr(dur).range(1.0, 5.0);\n var filt = Select.ar(LFNoise0.kr(dur).range(0, 2).round,\n [LPF.ar(sig, filtFreq), HPF.ar(sig, filtFreq), BPF.ar(sig, filtFreq)]\n );\n sig = CombL.ar(filt, 0.5, LFNoise1.kr(dur).range(0.02, 0.5), rrand(0.3, 2));\n sig\n };\n var env = Env.perc(\\atk.kr(0.02), \\rel.kr(6), 1, \\cur.kr(-4)).ar(2);\n sig = Splay.ar(sig); // nb! levelComp: true, so if removed signal will be extremely loud!\n sig = LPF.ar(sig, 2000);\n sig = FreeVerb2.ar(sig[0], sig[1], LFNoise1.kr(dur).range(0, 1.0), LFNoise1.kr(dur).range(0.2, 2));\n sig = sig * env * \\amp.kr(1);\n Out.ar(\\out.kr(0), sig)\n}).add;\n\nSynth(\\clouds, [\\atk, rrand(0.01, 2), \\rel, rrand(1, 6.0), \\duration, rrand(0.01, 1)])\n// run it several times, the outcome is highly random\n```"}]} +{"conversations": [{"role": "user", "content": "Write a kick drum in SuperCollider."}, {"role": "assistant", "content": "A pitch-swept sine with a fast decay: the frequency envelope is what makes it read as a kick.\n\n```supercollider\n(\nSynthDef(\\kick, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 50, 40], [0.03, 0.15], -4));\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -6), doneAction: 2);\n Out.ar(out, Pan2.ar(SinOsc.ar(pitch) * env * amp));\n}).add;\n);\nSynth(\\kick);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DetectSilence`."}, {"role": "assistant", "content": "```supercollider\n// this frees after the Decay has become quiet enough for a long enough time\n{ var signal = Decay.ar(Impulse.ar(0), 2, PinkNoise.ar(0.2)); DetectSilence.ar(signal, doneAction: Done.freeSelf); signal }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `U.addSynth` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: synth — (describe argument here). Returns: (returnvalue)"}]} {"conversations": [{"role": "user", "content": "What is Env.perc and what does it take?"}, {"role": "assistant", "content": "`Env.perc(attackTime, releaseTime, level, curve)` — an attack to `level` (default 1) then a decay to zero, with curve defaulting to -4 (an exponential-ish decay). `Env.perc(0.01, 1)` is the default percussive envelope, and it is a complete Env, not a generator: pair it with EnvGen to hear it."}]} -{"conversations": [{"role": "user", "content": "What is `RedVector2D` in SuperCollider?"}, {"role": "assistant", "content": "RedVector2D — a vector with two dimensions This is an optimised version of RedVector. It also adds the #-asPoint method. Category: Red > redUniverse."}]} -{"conversations": [{"role": "user", "content": "Interfacing SC with external software: MIDI or OSC?"}, {"role": "assistant", "content": "SuperCollider forum — Interfacing SC with external software: MIDI or OSC?\n\nI found this partial solution on sccode.org :\n\n```supercollider\n // declare an event type which sends OSC commands to Renoise\n\n(\nEvent.addEventType(\\renoise, { |server|\n var renoiseOscServer = NetAddr(\"127.0.0.1\", 8000);\n var notes = [~midinote.value, ~ctranspose.value, ~velocity.value, ~sustain.value, ~lag.value, ~timingOffset.value, ~instr.value, ~track.value].flop;\n var timeNoteOn, timeNoteOff, instrument, track, velocity;\n var serverLatency;\n\n serverLatency = server.latency ? 0;\n\n notes.do {|note|\n instrument = note[6] ? -1;\n track = note[7] ? -1;\n velocity = note[2].asInt.clip(0,127);\n\n // sustain and timingOffset are in beats, lag is in seconds\n timeNoteOn = (thisThread.clock.tempo.reciprocal*note[5])+note[4]+server.latency;\n timeNoteOff = (thisThread.clock.tempo.reciprocal*(note[3]+note[5]))+note[4]+server.latency;\n SystemClock.sched(timeNoteOn, {renoiseOscServer.sendMsg(\"/renoise/trigger/note_on\", instrument.asInt, track.asInt, (note[0]+note[1]).asInt, velocity )});\n SystemClock.sched(timeNoteOff, {renoiseOscServer.sendMsg(\"/renoise/trigger/note_off\", instrument.asInt, track.asInt, (note[0]+note[1]).asInt)});\n }\n});\n);\n\n// Now start Renoise OSC server, load a sample, and try some patterns\n\n// straight timing\n(\nPbind(*[\n type: \\renoise,\n legato: Pgauss(0.2,0.05,inf),\n dur: 0.2,\n degree: [2,5,12],\n track: Prand([0,1], inf),\n ctranspose: Pseq([0,0,0,0,4,4,4,4,5,5,5,5],inf),\n velocity: Pgauss(64,10,inf),\n]).play;\n)\n```\n\nhttp://sccode.org/1-4SN\n\nBut what I couldn’t find there was a simple syntax for sending Note Events or Midi Events as OSC messages... Do I really need to re-implement the whole SC’s defaultParentEvent as new OSC Event to send it using regular pattern’s syntax?"}]} -{"conversations": [{"role": "user", "content": "What is the difference between \\degree, \\midinote and \\freq in a Pbind?"}, {"role": "assistant", "content": "`\\freq` is the frequency in Hz and is used as-is. `\\midinote` is a MIDI note number, converted to frequency by the default instrument. `\\degree` is a scale degree, quantised to the scale in \\scale (default major) rooted at \\root; degrees can be negative or fractional. If you set both, the more specific conversion wins, so set exactly one."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// indexing into a table\n(\n{\n var buf = LocalBuf.newFrom([200, 300, 400, 500, 600, 800]);\n var freq = FoldIndex.kr(buf, MouseX.kr(0, BufFrames.ir(buf) * 3));\n SinOsc.ar(freq) * 0.1\n}.play;\n);\n\n// the same using a global buffer\n(\nt = [200, 300, 400, 500, 600, 800];\nb = Buffer(s, t.size, 1);\n\n// alloc and set the values\ns.listSendMsg(b.allocMsg(b.setnMsg(0, t)).postln);\n\nSynthDef(\\help_Index, { |out = 0, bufnum\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// indexing into a table\n(\n{\n var buf = LocalBuf.newFrom([200, 300, 400, 500, 600, 800]);\n var freq = FoldIndex.kr(buf, MouseX.kr(0, BufFrames.ir(buf) * 3));\n SinOsc.ar(freq) * 0.1\n}.play;\n);\n\n// the same using a global buffer\n(\nt = [200, 300, 400, 500, 600, 800];\nb = Buffer(s, t.size, 1);\n\n// alloc and set the values\ns.listSendMsg(b.allocMsg(b.setnMsg(0, t)).postln);\n\nSynthDef(\\help_Index, { |out = 0, bufnum = 0|\n Out.ar(out,\n SinOsc.ar(\n FoldIndex.kr(\n bufnum,\n MouseX.kr(0, BufFrames.ir(bufnum) * 3)\n ),\n 0,\n 0.5\n )\n )\n}).play(s, [\\bufnum, b.bufnum]);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `InFeedback` in SuperCollider briefly."}, {"role": "assistant", "content": "InFeedback — Read signal from a bus with a current or one cycle old timestamp. When the various output UGens (Out, Category: UGens > InOut."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nScoreClock.beginScore;\nScoreClock.tempo = 100/60;\nPbind(\n \\freq, 100*Pwhite(1,10,8),\n \\dur, 0.5,\n \\legato, 0.5\n).play(ScoreClock);\n~score = ScoreClock.makeScore;\n);\n// print it\n~score.score.do(_.postln);\"\"\n\n// render to file\n~score.recordNRT(\"~/score.osc\".standardizePath,\"~/score.aiff\".standardizePath;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nScoreClock.beginScore;\nScoreClock.tempo = 100/60;\nPbind(\n \\freq, 100*Pwhite(1,10,8),\n \\dur, 0.5,\n \\legato, 0.5\n).play(ScoreClock);\n~score = ScoreClock.makeScore;\n);\n// print it\n~score.score.do(_.postln);\"\"\n\n// render to file\n~score.recordNRT(\"~/score.osc\".standardizePath,\"~/score.aiff\".standardizePath);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Migration from the old SourceForge wiki."}, {"role": "assistant", "content": "```supercollider\n// Sing whatever pitch you like into the microphone, but have the output conform to the key you press on your connected MIDI keyboard, like a very low-rent Autotune.\n// by nonprivate April 2009\n// best used with headphones\n// execute one by one...\n\ns = Server.local.boot;\nb = 200; // no. of control bus to use for pitch control\n(\n SynthDef(\"straightenUp\",\n { |baseFreq = 100|\n \n var in, freq, hasFreq, out;\n in = Mix.new(SoundIn.ar([0,1]));\n # freq, hasFreq = Pitch.kr(in, ampThreshold: 0.02, median: 7);\n out = PitchShift.ar(in, 0.08, (baseFreq / freq), 0.0, 0.0);\n Out.ar(0,[out, out])\n }\n ).send(s);\n);\n\ns.sendMsg(\"/s_new\", \"straightenUp\", n = s.nextNodeID, 1, 0);\n\ns.sendMsg(\"/n_map\", n, \"baseFreq\", b);\n\n(\n c = NoteOnResponder(\n { |src,chan,note,vel|\n \n s.sendMsg(\"/c_set\", b, note.midicps);\n \n },\n nil, // any source\n nil, // any channel\n nil, // any note\n nil // any vel\n );\n \n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n~pad = Synth(\\pad, [\\freq, 165]);\n~pad.set(\\gate, 0);\n```"}, {"role": "assistant", "content": "It starts a sustained synth and then releases it.\n\n`Synth(\\pad, [\\freq, 165])` creates an instance of a SynthDef that takes a `gate` argument (default 1). The\narray after the name is alternating argument names and values: `\\freq, 165`. Setting `\\gate` to 0 does not\ncut the sound dead — the EnvGen inside sees the gate close and runs the release stage of its Env, then frees\nthe Synth because that EnvGen has `doneAction: 2`. This is the standard lifecycle for pads, drones and any\nsound you want to stop gracefully."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\np = ProxySpace.push(s.boot);\n~a.play.quant_(4); ~b.play.quant_(4);\n~c = { LFNoise1.kr(8).range(0,15).round };\n~a = Pbind(\\degree, Pstutter(4, Pseq([0,2,3,4], inf)), \\octave, [3,4], \\dur, 0.25, \\amp, 0.3);\n~b = Pbind(\\octave, 4, \\scale, Scale.majorPentatonic, \\degree, ~c, \\dur, 1/4, \\legato, 0.5);\n```"}, {"role": "assistant", "content": "a short piece which plays random major music. It sounded very happy."}]} +{"conversations": [{"role": "user", "content": "How do I pan notes around the stereo field in a pattern?"}, {"role": "assistant", "content": "Put `\\pan` in the Pbind: the default instrument understands it and passes it to Pan2.\n\n```supercollider\n(\nPbind(\n \\scale, Scale.minorPentatonic,\n \\degree, Pseq([0, 2, 4, 7, 9, 7, 4, 2], inf),\n \\dur, 0.2,\n \\pan, Pseq([-1, -0.5, 0, 0.5, 1, 0.5, 0, -0.5], inf),\n \\amp, 0.15\n).play;\n)\n```\n\nTo pan an arbitrary synth, add a `pan = 0` argument to the SynthDef and wrap the output in\n`Pan2.ar(sig, pan)`."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LatoocarfianC`."}, {"role": "assistant", "content": "```supercollider\n// default initial params\n{ LatoocarfianC.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `NodeProxy`."}, {"role": "assistant", "content": "```supercollider\nb = NodeProxy.new.play;\nb.source = { PinkNoise.ar(0.2.dup) };\n// now I want to filter b through a new proxy.\na = NodeProxy.new;\na <-- b; a.source = { HPF.ar(b.ar, 7000) };\na.source = { HPF.ar(b.ar, 3000) }; // changing the source\na.clear; b.clear;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Class.dumpByteCodes` do?"}, {"role": "assistant", "content": "Dump the byte codes of the named method."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `LFSaw`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\nfork {\n ~group = Group();\n\n 2.wait;\n\n SynthDef(\\buzz, {\n |out = 0, freq = 300, amp = 0.1, filter = 1.7|\n var sig = LFSaw.ar(freq * [1, 3, 5], 0, amp * [1, 0.5, 0.25]).sum;\n sig = LPF.ar(sig, freq * filter);\n Out.ar(out, sig);\n }).add;\n\n [50, 53, 58, 46, 60].midicps.do {\n |f, i|\n Synth(\\buzz, [\n \\out: 0, \\freq, f, \\filter: (i / 2) + 1\n ], target:~group);\n 2.wait;\n };\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for electric hum: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\eHum).addSpec(\\fFreq, ControlSpec(25, 1000, \\lin, step: 25));\nNdef(\\eHum).addSpec(\\fRq, [0.01, 0.2]);\nNdef(\\eHum).addSpec(\\fFreqIdx, [0, 8, \\lin, 0.2]);\nNdef(\\eHum).fadeTime = 2;\n\nNdef(\\eHum, {|fFreqIdx = 1, fRq = 0.1|\n var src = Impulse.ar([50, 75, 100]); // three sources\n var fFreq = (25 * (2 ** fFreqIdx));\n\n Splay.ar((BPF.ar(src, fFreq, fRq))* 8)\n})\n);\n\nNdef(\\eHum).gui;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// try wiggling mouse quickly:\n// LFNoise2 overshoots when going from high to low freqs, LFDNoise changes smoothly.\n\n{ SinOsc.ar(LFNoise2.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n{ SinOsc.ar(LFDNoise3.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFNoise2.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n\n{ LFDNoise3.ar(XLine.kr(2000, 20000, 8), 0.1\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// try wiggling mouse quickly:\n// LFNoise2 overshoots when going from high to low freqs, LFDNoise changes smoothly.\n\n{ SinOsc.ar(LFNoise2.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n{ SinOsc.ar(LFDNoise3.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFNoise2.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n\n{ LFDNoise3.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n\n// use as frequency control\n(\n{\n SinOsc.ar(\n LFDNoise3.ar(4, 400, 450),\n 0, 0.2\n )\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\"help-Rand\", { |out = 0|\n Out.ar(out,\n FSinOsc.ar(\n Rand(200.0, 400.0),\n 0, Line.kr(0.2, 0, 1, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n(\nRoutine({\n 8.do({\n Synth.new(\"help-Rand\"); 1.0.wait;\n })\n}).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\"help-Rand\", { |out = 0|\n Out.ar(out,\n FSinOsc.ar(\n Rand(200.0, 400.0),\n 0, Line.kr(0.2, 0, 1, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n(\nRoutine({\n 8.do({\n Synth.new(\"help-Rand\"); 1.0.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `PBlip.new` do? What arguments does it take?"}, {"role": "assistant", "content": "UGenPatterns quark library Arguments: freq; numharm; mul; add; length — Number of values produced.."}]} +{"conversations": [{"role": "user", "content": "What is `PauseSelfWhenDone` in SuperCollider?"}, {"role": "assistant", "content": "PauseSelfWhenDone — FIXME: PauseSelfWhenDone purpose. FIXME: PauseSelfWhenDone description. Category: UGens > Synth control, UGens > Undocumented."}]} +{"conversations": [{"role": "user", "content": "Explain `PageLayout` in SuperCollider briefly."}, {"role": "assistant", "content": "PageLayout — a Window with a FlowView on it for use in ObjectGui's MVC model This class encapsulates the common task of creating a Window, adding a FlowView (CompositeView with a FlowLayout on it). It also supports the MVC model by registering controllers that are then removed (sent the .remove message) when the Window closes. Additionally it can resize itself to fit the contents. Category: GUI."}]} +{"conversations": [{"role": "user", "content": "What does `OSCFunc.recvPort` do?"}, {"role": "assistant", "content": "Get this OSCFunc's receiving Returns: An Integer"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `PdurStutter`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,0,1,3,4,0], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n100.do({ x.next.postln });\n);\n\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\n\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n);\n\n\n(\na = PdurStutter(\n Pseq(#[1,1,1,1,1,2,2,2,2,2,3,3,3,3,4,4,0,4,4], inf),\n Pseq(#[0.5, 1, 2, 0.25, 0.25], inf)\n);\nx = a.asStream;\nRoutine({\n loop({\n Synth.grain(\\help_sinegrain, [\\freq, 440]);\n x.next.wait;\n })\n}).play(TempoClock.default);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// this frees after the Decay has become quiet enough for a long enough time\n{ var signal = Decay.ar(Impulse.ar(0), 2, PinkNoise.ar(0.2)); DetectSilence.ar(signal, doneAction: Done.freeSelf; signal }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// this frees after the Decay has become quiet enough for a long enough time\n{ var signal = Decay.ar(Impulse.ar(0), 2, PinkNoise.ar(0.2)); DetectSilence.ar(signal, doneAction: Done.freeSelf); signal }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nx = {\n |loDev = -6, hiDev = 5, lookBack = 2|\n var trig = Impulse.ar(5);\n // define maxLookBack, minLoDev and maxHiDev\n var midi = Demand.ar(trig, 0, DIdev(72, 11, -6, 5, lookBack, loDev, hiDev));\n midi.poll(5, label: \\midi);\n SinOsc.ar(midi.midicps.lag(0.007)) ! 2 * 0.1\n}.play;\n);\n\n\n// as lookBack equals 2, this defines a fixed sequence (up or down anyway)\n\n(\nx.set(\\loDev, -1);\nx.set(\\hiDev, 1)\n);\n\n\n// widen range\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nx = {\n |loDev = -6, hiDev = 5, lookBack = 2|\n var trig = Impulse.ar(5);\n // define maxLookBack, minLoDev and maxHiDev\n var midi = Demand.ar(trig, 0, DIdev(72, 11, -6, 5, lookBack, loDev, hiDev));\n midi.poll(5, label: \\midi);\n SinOsc.ar(midi.midicps.lag(0.007)) ! 2 * 0.1\n}.play;\n);\n\n\n// as lookBack equals 2, this defines a fixed sequence (up or down anyway)\n\n(\nx.set(\\loDev, -1);\nx.set(\\hiDev, 1)\n);\n\n\n// widen range\n\n(\nx.set(\\loDev, -6);\nx.set(\\hiDev, 5);\n);\n\n\n// force a twelve-tone row\n\nx.set(\\lookBack, 11)\n\n\n// contradictory input, lookBack 11 not possible within range, causes repetitions\n\n(\nx.set(\\loDev, -3);\nx.set(\\hiDev, 2)\n);\n\nx.release\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ SinOsc.ar(ControlRate.ir * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ SinOsc.ar(ControlRate.ir) * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// you have to write the sample path in the firts line\n\n~bufferdue = Buffer.read(s,\" WRITE YOUR SAMPLE PATH HERE \", bufnum:2);\n\n(\nSynthDef.new(\\bufbeat, {\n arg amp = 1, out = 0, buf, start, end, freq = 1;\n var sig, ptr;\n ptr = LFNoise1.ar(freq).range(0.0,end);\n sig = BufRd.ar(2, buf, ptr);\n sig = sig * amp;\n Out.ar(out, sig);\n}).add\n);\n\nx = Synth.new(\\bufbeat, [\\buf, ~bufferdue.bufnum, \\start,0, \\end, ~bufferdue.numFrames-1, \\freq, 1, \\amp, 0.5],g);\n\nx.free;\n```"}, {"role": "assistant", "content": "a simple BufRd with the starting point of lecture randomized by LFNoise1."}]} {"conversations": [{"role": "user", "content": "What does `UnixFILE.pos` do? What arguments does it take?"}, {"role": "assistant", "content": "Answer the current file Arguments: offset — an offset in bytes.; origin — one of the following Integers:."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// ===========================\n// extra demos for pluck\n// ===========================\n\n\n(\n// Made by Meha Gupta\n// Inspired by Happy by Julia Michaels\nPbindef(\\dmpluck,\n \\instrument, \"pluck\",\n \\midinote, Pseq([\n Pseq([\n [57, 69, 73, 76],\n [57, 69, 73, 76],\n [57, 71, 73, 80],\n [52, 78, 76, 80],\n [52, 78, 76, 80],\n [59, 71, 75],\n [59, 71, 75]], 2),\n 64]),\n \\amp, Pseq([0.2, 0.1, 0.2, 0.2, 0.1, 0.1, 0.1], inf) * 0.5,\n \\dur, Pseq([Pn(Pseq([0.25, 0.75, 1, 0.5, 0.5, 0.5, 0.5]), 2), 1]),\n \\decay, Pseq([1, 3, 3, 2, 2, 3, 3, 1, 3, 3, 2, 2, 3, 3, 4]),\n).play;\n)\n```"}, {"role": "assistant", "content": "=========================== extra demos for pluck ===========================."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ MoogLadder.ar(Mix(LFSaw.ar([120, 180], 0, 0.33)), LinExp.kr(LFCub.kr(0.1, 0.5*pi), -1, 1, 180, 8500), 0.75.dup }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ MoogLadder.ar(Mix(LFSaw.ar([120, 180], 0, 0.33)), LinExp.kr(LFCub.kr(0.1, 0.5*pi), -1, 1, 180, 8500), 0.75).dup }.play\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\FuMaIn;\n~description = \"A live ambisonic input (ACN_FuMa)\";\n~channelLayout = \\ambi;\n\n~function = { |order = 1, t_trig = 0, bus = 0|\n var env = EnvGen.kr(Env([0,1], [1]), t_trig);\n var chans = Array.series(\n size: (order + 1).pow(2).asInteger,\n start: bus,\n step: 1\n );\n var input = SoundIn.ar(chans, env);\n HOAConverterFuma2AcnN3d.ar(order, input);\n}\n```"}, {"role": "assistant", "content": "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see ."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// indexing into a table\n(\n{\n var buf = LocalBuf.newFrom([200, 300, 400, 500, 600, 800]);\n var freq = FoldIndex.kr(buf, MouseX.kr(0, BufFrames.ir(buf) * 3));\n SinOsc.ar(freq) * 0.1\n}.play;\n);\n\n// the same using a global buffer\n(\nt = [200, 300, 400, 500, 600, 800];\nb = Buffer(s, t.size, 1);\n\n// alloc and set the values\ns.listSendMsg(b.allocMsg(b.setnMsg(0, t)).postln);\n\nSynthDef(\\help_Index, { |out = 0, bufnum\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// indexing into a table\n(\n{\n var buf = LocalBuf.newFrom([200, 300, 400, 500, 600, 800]);\n var freq = FoldIndex.kr(buf, MouseX.kr(0, BufFrames.ir(buf) * 3));\n SinOsc.ar(freq) * 0.1\n}.play;\n);\n\n// the same using a global buffer\n(\nt = [200, 300, 400, 500, 600, 800];\nb = Buffer(s, t.size, 1);\n\n// alloc and set the values\ns.listSendMsg(b.allocMsg(b.setnMsg(0, t)).postln);\n\nSynthDef(\\help_Index, { |out = 0, bufnum = 0|\n Out.ar(out,\n SinOsc.ar(\n FoldIndex.kr(\n bufnum,\n MouseX.kr(0, BufFrames.ir(bufnum) * 3)\n ),\n 0,\n 0.5\n )\n )\n}).play(s, [\\bufnum, b.bufnum]);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//spinning hypercube / tesseract\n//after Shiffman https://codingtrain.github.io/website-archive/CodingChallenges/113-hypercube.html\n\n\n(\nvar width= 640, height= 480, w,\ntheta= 0, speed= 0.005, hypercube;\n\nw= RedWindow(\"3Dhypercube\", Rect(128, 64, width, height)).front;\nhypercube= Red4DTesseract();\n\n//--loop\nw.draw{\n theta= theta+speed;\n hypercube.rotation= RedVector[theta, 0, 0, 0, 0, theta];\n hypercube.update;\n\n //--render\n hypercube.render(2, 500); //1= exaggerate, 2= standard\n Pen.translate(width*0.5, height*0.5);\n Pen.fillColor= Color.white;\n hypercube.draw;\n Pen.strokeColor= Color.white;\n hypercube.drawOutlines;\n};\nw.play;\nCmdPeriod.doOnce({w.close});\n)\n```"}, {"role": "assistant", "content": "spinning hypercube / tesseract after Shiffman https://codingtrain.github.io/website-archive/CodingChallenges/113-hypercube.html."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// this does not work:\n(\n{\n var trig = Dust.ar(4);\n Trig.kr(trig, 0.1) * SinOsc.ar(800) * 0.1\n}.play;\n);\n\n// this works:\n(\n{\n var trig = T2K.kr(Dust.ar(4));\n Trig.kr(trig, 0.1) * SinOsc.ar(800) * 0.1\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// this does not work:\n(\n{\n var trig = Dust.ar(4);\n Trig.kr(trig, 0.1) * SinOsc.ar(800) * 0.1\n}.play;\n);\n\n// this works:\n(\n{\n var trig = T2K.kr(Dust.ar(4));\n Trig.kr(trig, 0.1) * SinOsc.ar(800) * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `LFPulse` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\ns.meter;\ns.scope;\n\n// synthesize 2 test signals at level 0.1 (-20 dB), first on separate channels\n(\n{ var n = 2, level = 0.1, spread = 1, pan = 0;\n LFPulse.ar({ 100.exprand(2000) } ! n).range(-1, 1) * level\n}.play;\n);\n\n// now mix/pan these 2 signals using Splay, level at 0.1 (-20dB)\n(\nx = { |spread = 1, level = 0.1, center = 0|\n var n = 2;\n var snd = LFPulse.ar({ 100.exprand(2000) } ! n).range(-1, 1);\n var stereo = Splay.ar(snd, spread, level, center);\n Peak.ar(stereo, Impulse.kr(2)).ampdb.poll(2);\n stereo\n}.play;\n);\n\n// when we set full spread, panned to center:\n// the 2 signals are discrete, left and right\n// we see the energy-based levelComp applied (1/2.sqrt).ampdb = -3\nx.set(\\spread, 1, \\center, 0); // -20 - 3 = -23dB\n\n// no spread, panned center:\n// each signal decreases by 3dB as they move to the center (from the panning function)\n// and the two signals mix on each channel, so we get -20 dB\nx.set(\\spread, 0, \\center, 0); // -20dB\n\n// no spread, panned fully right:\n// the signals fully mix in the right channel (+6 dB)\nx.set(\\spread, 0, \\center, 1); // -23 + 6 = -17db\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SimpleTriggerGui.guiBody` do? What arguments does it take?"}, {"role": "assistant", "content": "gui class. just a button to trigger Arguments: layout."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Kepler 22-b atmosphere. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\nfork { \n Ndef(\\ttwnd).play;//(d,2,addAction:\\addToHead);\n loop {\n var seed = thisThread.randSeed = 100000000.rand.debug('seed');\n Ndef(\\ttwnd, {\n var freq = [20, 7500];\n Splay.ar(\n { \n var bands = 2.rrand(10);\n var sig = { [BPF,RLPF,RHPF].choose.ar(\n LFNoise2.ar(freq[0].rrand(freq[1]), LFNoise2.kr(0.1.exprand(10))),\n Array.rand(bands, freq[0], freq[1]),\n Array.rand(bands, 0.2, 1.8)\n ).mean } ! 2;\n Rotate2.ar(sig[0], sig[1], LFSaw.kr(0.1.exprand(10)));\n } ! 4.rrand(6).debug('source'),\n 0.5.rrand(1)\n );\n }).fadeTime_(1.rrand(4.0));\n 10.0.rrand(40).debug('wait(bts)').wait;\n }\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Pbindef.new` do?"}, {"role": "assistant", "content": "store the pattern in the global dictionary of Pdef under key. If there is already a Pdef of this key, replace its pattern with the new one. If there is already a Pbindef af this key, set the parameters only, or add a new one (the whole pattern is replaced). Using *new(key) you can access the pattern at that key (if none is there, a default pattern is created). see"}]} +{"conversations": [{"role": "user", "content": "What does `HelpBrowser.goTo` do? What arguments does it take?"}, {"role": "assistant", "content": "When using the SCIDE, go to `url` in the built-in helpbrowser; otherwise, go to url with singleton `HelpBrowser` instance or a new window, depending on the `openNewWindows` Arguments: url — A String representing a web address, a local address in the URI format (`file:///path`), or a local path.."}]} +{"conversations": [{"role": "user", "content": "What does `FreqScopeView.response` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a scope in a special frequency-response mode. This uses FFT-based spectral division to estimate the frequency response of some effect, on the assumption that the signal to bus1 is transformed to the signal at bus2 by some linear time-invariant Arguments: parent — The parent view.; bounds — An instance of Rect, or a Point indicating `width@height`.; bus1 — The bus on which the \"pre\" signal is found.; bus2 — The bus on which the \"post\" signal is found.; freqMode — Linear (0) or log(1) frequency mode. Defaults to 1.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n// synthdefs to play with\n\n(\nSynthDef(\\noise_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, rq = 0.1, amp = 0.1|\n var sig = { WhiteNoise.ar } ! 2;\n sig = BPF.ar(sig, freq, rq) *\n EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2) *\n (rq ** -1) * (250 / (freq ** 0.8));\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\sin_grain, { |out = 0, freq = 4\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n// synthdefs to play with\n\n(\nSynthDef(\\noise_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, rq = 0.1, amp = 0.1|\n var sig = { WhiteNoise.ar } ! 2;\n sig = BPF.ar(sig, freq, rq) *\n EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2) *\n (rq ** -1) * (250 / (freq ** 0.8));\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\sin_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { SinOsc.ar(freq, Rand(0, 2pi)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\saw_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { VarSaw.ar(freq, Rand(0, 1)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `RedMixer` in SuperCollider?"}, {"role": "assistant", "content": "RedMixer — create and hold multiple RedMixerChannel A mixer that can mix any number of channels (RedMixerChannel) into one or more subgroups. Category: Red > redMixer."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// modulate frequency and index multiplier\n{ FBSineN.ar(LFNoise2.kr(1, 1e4, 1e4), LFNoise2.kr(1, 16, 17), 1, 1.005, 0.7) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// modulate frequency and index multiplier\n{ FBSineN.ar(LFNoise2.kr(1, 1e4, 1e4), LFNoise2.kr(1, 16, 17), 1, 1.005, 0.7) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `BufferProxySpec.initClass` do?"}, {"role": "assistant", "content": "datatype specifying an input of BufferProxy"}]} +{"conversations": [{"role": "user", "content": "Who made you?"}, {"role": "assistant", "content": "I was trained by the person who runs this project, on top of the MiniMind architecture. My weights started from random numbers and learned from the SuperCollider sources — no teacher model, no distillation."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nNdef(\\sound, {\n RHPF.ar(\n \\in1.ar([0, 0]) * \\in2.ar([0, 0]),\n \\freq.kr(6000, 2),\n \\rq.kr(0.2)\n ) * 7\n}).play;\nNdef(\\sound).fadeTime = 0.2; // avoid harsh clicks\n);\n\nNdef(\\a, { SinOsc.ar(MouseX.kr(300, 1000, 1) * [1, 1.2], \\phase.ar([0, 0]) * 0.2) });\nNdef(\\b, { LFDNoise3.ar(MouseY.kr(3, 1000, 1) * [1, 1.2]) });\nNdef(\\c, { LFTri.ar(MouseY.kr(3, 10, 1) * [1, 1.\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nNdef(\\sound, {\n RHPF.ar(\n \\in1.ar([0, 0]) * \\in2.ar([0, 0]),\n \\freq.kr(6000, 2),\n \\rq.kr(0.2)\n ) * 7\n}).play;\nNdef(\\sound).fadeTime = 0.2; // avoid harsh clicks\n);\n\nNdef(\\a, { SinOsc.ar(MouseX.kr(300, 1000, 1) * [1, 1.2], \\phase.ar([0, 0]) * 0.2) });\nNdef(\\b, { LFDNoise3.ar(MouseY.kr(3, 1000, 1) * [1, 1.2]) });\nNdef(\\c, { LFTri.ar(MouseY.kr(3, 10, 1) * [1, 1.2]).max(0) });\nNdef(\\a).fadeTime = 0.2; // avoid harsh clicks again\n\nNdef(\\sound) <<>.in1 Ndef(\\a);\nNdef(\\sound) <<>.in2 Ndef(\\b);\nNdef(\\sound) <<>.in2 Ndef(\\c);\nNdef(\\a) <<>.phase Ndef(\\sound);\nNdef(\\a) <<>.phase nil; // unmap\nNdef.clear(3); // fade out and clear all Ndefs\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\np = ProxySpace.push(s.boot);\n\nl = NdefGui(nil, 3).moveTo(10, 120);\nm = NdefGui(nil, 3).moveTo(10, 240);\nn = NdefGui(nil, 3).moveTo(10, 360);\no = NdefGui(nil, 3).moveTo(10, 480);\n\nSpec.add(\\dens, [0.1, 300, \\exp]);\n\n// make 3 kinds of proxies: using tilde/proxyspace, Ndef, and unnamed.\n~spacy = { |dens = 5| Formlet.ar(Dust.ar(dens ! 2), LFDNoise0.kr(20 ! 2).lag(0.1).linexp(-1, 1, 300, 5000), 0.003,\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\np = ProxySpace.push(s.boot);\n\nl = NdefGui(nil, 3).moveTo(10, 120);\nm = NdefGui(nil, 3).moveTo(10, 240);\nn = NdefGui(nil, 3).moveTo(10, 360);\no = NdefGui(nil, 3).moveTo(10, 480);\n\nSpec.add(\\dens, [0.1, 300, \\exp]);\n\n// make 3 kinds of proxies: using tilde/proxyspace, Ndef, and unnamed.\n~spacy = { |dens = 5| Formlet.ar(Dust.ar(dens ! 2), LFDNoise0.kr(20 ! 2).lag(0.1).linexp(-1, 1, 300, 5000), 0.003, 0.03) };\nNdef(\\ndeffy, { GrayNoise.ar(0.1 ! 2) });\nc = NodeProxy.audio.source_({ PinkNoise.ar(0.1 ! 2) });\n\n// put one in each editor\nl.object_(~spacy);\nm.object_(Ndef(\\ndeffy));\nn.object_(c);\n);\n// One should also be able to drag and drop text into the drag,\n// but this is also not working yet.\n( Ndef(\\a) )\n```"}]} +{"conversations": [{"role": "user", "content": "What does `BandSplitter2.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Split signal into 2 phase-coherent bands Arguments: sig — Input signal; f1 — Frequency of crossover.; order — Order of crossover filters (2, 4, 6, or 8)."}]} +{"conversations": [{"role": "user", "content": "What does `Window.minimize` do?"}, {"role": "assistant", "content": "Hides the window, only keeping its representation in the dock, taskbar,"}]} +{"conversations": [{"role": "user", "content": "Resetting start count with PulseDivider?"}, {"role": "assistant", "content": "SuperCollider forum — Resetting start count with PulseDivider?\n\ni think in your example Sweep is receiving a trigger while going from 0 to 1 causing the discontinuity in the phase because the duration between one trigger and the next is unknown.\n\nwith this example you get at least a continiuous phase with random triggers to drive the hanning window (evaluate it several times). but its not multichannel with distributed phases / windows accross channels:\n\n```supercollider\n(\nvar randomTrigPhase = { |triggerRate = 10, randomness = 1|\n var minDuration = (2 ** randomness) / triggerRate;\n var maxDuration = (2 ** (-1 * randomness)) / triggerRate;\n var demand = Dunique(minDuration * ((maxDuration / minDuration) ** Dwhite(0, 1)));\n var duration = Duty.ar(demand, DC.ar(0), demand);\n var phase = Phasor.ar(DC.ar(0), (1 / duration) / SampleRate.ir, 0, 1);\n (phase: phase, trigger: HPZ1.ar(phase) < 0);\n};\n\nvar hanningWindow = { |phase|\n (1 - (phase * 2pi).cos) / 2 * (phase < 1);\n};\n\n{\n var rate = 100;\n var phase = randomTrigPhase.(rate, 1).phase;\n hanningWindow.(phase);\n}.plot(0.1);\n)\n```\n\nim not sure if this is helping it just reminded me of some issue with multichannel random triggers and continiuous phases i have been trying to solve."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// use input amplitude to control SinOsc frequency - use headphones to prevent feedback.\n{\n SinOsc.ar(\n Amplitude.kr(\n SoundIn.ar(0),\n 0.01,\n 0.01,\n 1200,\n 400\n ),\n 0, 0.3)\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// use input amplitude to control SinOsc frequency - use headphones to prevent feedback.\n{\n SinOsc.ar(\n Amplitude.kr(\n SoundIn.ar(0),\n 0.01,\n 0.01,\n 1200,\n 400\n ),\n 0, 0.3)\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `BufCombN` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// These examples compare the variants, so that you can hear the difference in interpolation\n\n// allocate buffer\nb = Buffer.alloc(s, 44100, 1);\n\n// Comb used as a resonator. The resonant fundamental is equal to\n// reciprocal of the delay time.\n{ BufCombN.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ BufCombL.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ BufCombC.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// with negative feedback:\n{ BufCombN.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ BufCombL.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ BufCombC.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n// used as an echo.\n{ BufCombL.ar(b.bufnum, Decay.ar(Dust.ar(1, 0.5), 0.2, WhiteNoise.ar), 0.2, 3) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Atk.downloadMatrices` do?"}, {"role": "assistant", "content": "Download Atk Matrices, required by matrix"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// check blockSize before (or reset blockSize in examples)\n\n(\nif (s.options.blockSize != 64) {\n s.options.blockSize = 64;\n s.quit.reboot;\n}\n);\n\n\n// exponentiation can also be interesting\n// here an area of instability is crossed by a stereo lfo\n\ns.scope\n\n// start fb fx Synth\n\n(\n~bus = Bus.audio(s, 1);\n\ny = {\n var inSig = In.ar(~bus);\n var lfo = { LFDNoise3.ar(0.5).linexp(-1, 1, 0.1, 150) } ! 2;\n\n Fb1({ |in, out|\n in[1][0] * 0.07 +\n // out[0]\n// …\n```"}, {"role": "assistant", "content": "check blockSize before (or reset blockSize in examples) exponentiation can also be interesting (Fb1: single sample feedback / feedforward pseudo ugen)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nd = { |freq = 440| SinOsc.ar(LastValue.ar(freq, 20), 0, 0.2) }.play;\n\nd.set(\\freq, 400);\nd.set(\\freq, 200);\nd.set(\\freq, 670);\nd.set(\\freq, 680);\nd.set(\\freq, 695;\nd.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nd = { |freq = 440| SinOsc.ar(LastValue.ar(freq, 20), 0, 0.2) }.play;\n\nd.set(\\freq, 400);\nd.set(\\freq, 200);\nd.set(\\freq, 670);\nd.set(\\freq, 680);\nd.set(\\freq, 695);\nd.free;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n/*\n( // PlayerBinop not yet implemented\n\nPatch(\\monosynth,[\n BeatClockPlayer.new(16) * MIDIGatePlayer.new,\n MIDIFreqPlayer.new,\n CCPlayer(50,[100,3000,\\exp,0.0,1500.0]),\n CCPlayer(51,[0.1,0.9,\\exp,0.0,0.2]),\n CCPlayer(52,[0.05,1.0])\n]).play\n\n\n*/\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n/*\n( // PlayerBinop not yet implemented\n\nPatch(\\monosynth,[\n BeatClockPlayer.new(16) * MIDIGatePlayer.new,\n MIDIFreqPlayer.new,\n CCPlayer(50,[100,3000,\\exp,0.0,1500.0]),\n CCPlayer(51,[0.1,0.9,\\exp,0.0,0.2]),\n CCPlayer(52,[0.05,1.0])\n]).play\n\n)\n*/\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Lag2`."}, {"role": "assistant", "content": "```supercollider\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n Lag2.kr( // lag the modulator\n LFPulse.kr(4, 0, 0.5, 50, 400), // frequency modulator\n Line.kr(0, 1, 15) // modulate lag time\n ),\n 0, // phase\n 0.3 // sine amplitude\n )\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `MIDIFunc.trace` do? What arguments does it take?"}, {"role": "assistant", "content": "A convenience method which dumps all incoming MIDI Arguments: bool — A Boolean indicating whether dumping is on or off.."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\na = Scheduler(SystemClock);\n\na.sched(3, { \"now it is 3 seconds.\".postln; nil });\na.sched(5, { \"now it is 5 seconds.\".postln; nil });\na.sched(1, { \"now it is 1 second.\".postln; nil });\n\na.advance(0.5);\na.advance(0.5);\na.advance(2);\na.advance(2);\n\n// the beats, seconds and clock are passed into the task function:\na.sched(1, { |beats, secs, clock| [beats, secs, clock].postln });\na.advance(1);\n\n// the scheduling is relative to \"now\":\na.sched(3, { \"now it was 3 seconds.\".postln });\n// …\n```"}, {"role": "assistant", "content": "the beats, seconds and clock are passed into the task function: the scheduling is relative to \"now\": (Scheduler: schedules functions to be evaluated in the future)"}]} +{"conversations": [{"role": "user", "content": "What does `ServerLogGui.addAction` do? What arguments does it take?"}, {"role": "assistant", "content": "the interface for display and searching the ServerLog Arguments: num. Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `InTrig`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\ns = Server.local;\nb = Bus.control(s, 1);\n\nSynthDef(\"help-InTrig\", { |out = 0, busnum = 0|\n var inTrig;\n inTrig = InTrig.kr(busnum);\n Out.ar(out,\n EnvGen.kr(Env.perc, gate: inTrig, levelScale: inTrig) * SinOsc.ar\n )\n}).play(s, [\\out, 0, \\busnum, b.index]);\n\n\nb.set(1.0);\n\nb.value = 1.0;\n\nb.value = 0.2;\n\nb.value = 0.1;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for 003_102 (a SuperCollider snippet). Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\nSynthDef('003_102', {|out=0,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y| Out.ar(out, Pan2.ar(Normalizer.ar(( GbmanL.ar( LPF.ar( SyncSaw.ar(p, k, q, h ), FreqShift.ar(d, r, k, y, a ), h, n ), r, l, Blip.ar(r, f, u, i ), h ))*( LFPar.ar(d, x, Saw.ar(w, k, Formant.ar(s, q, d, DelayL.ar(y, 0.5, w, v, i ), e ) ), y ))*( LFCub.ar(q, a, h, g ))*( Gendy1.ar(r, c, r, QuadL.ar(h, o, j, t, t, v, f ), k, p, g, Pulse.ar(g, g, c, s ), PMOsc.ar(f, u, d, t, d, f ), f, LFNoise0.ar(k, l, e ), d ) )))) }).play(args: #[ a, 0.1, b, 0.83039082494709, c, 7.4736936148092, d, 57.834883574831, e, 0.56638920329924, f, 2.7610572022348, g, -0.60208093272399, h, 0.69731527262978, i, 0.97553825378418, j, 0.47619211673737, k, 0.45142233371735, l, 6.5229251440451, m, 0.34238355327673, n, 3.1624102065486, o, 1, p, 1, q, 5.4898714868897, r, 2.7777416341664, s, 10966.099508885, t, 0.15706503391266, u, 3.1945936724559, v, 20000, w, -4.6151277924266, x, 1.4588773159677, y, 0.0012384873762477 ])\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for Interpolate between Envs with Pseg: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\sin, { arg out=0, gate=1, amp=0.1, pan=0, freq=200;\n var sig;\n sig = SinOsc.ar(freq);\n sig = sig * EnvGen.kr(\\adsr.kr(Env.adsr(0.1,0.1,0.8,0.1)), gate, doneAction:2);\n sig = Pan2.ar(sig, pan, amp);\n Out.ar(out, sig);\n}).add;\n);\n\n(\n// sequence Envs\n// need [] else it is inlined or does pattern multichannel expansion\nPdef(\\demo, \n Pbind(\n \\instrument, \\sin,\n \\degree, Pseq([0, Pwhite(0,7,1)],inf),\n \\legato, 0.5,\n \\adsr, Pseq([\n [ Env.adsr(1.1,0.1,0.8,1.01) ],\n [ Env.adsr(0.01,0.1,0.8,0.01) ],\n [ Env.adsr(0.01,1.1,0.3,0.01) ],\n ],inf),\n )\n).play;\n);\n\n(\n// interpolate using Pseg\n// need .asArray\nPdef(\\demo, \n Pbind(\n \\instrument, \\sin,\n \\degree, Pseq([0, Pwhite(0,7,1)],inf),\n \\legato, 0.5,\n \\adsr, Pseg(Pseq([\n [ Env.adsr(1.1,0.1,0.8,1.01).asArray ],\n [ Env.adsr(0.01,0.1,0.8,0.01).asArray ],\n [ Env.adsr(0.01,1.1,0.3,0.01).asArray ],\n ],inf),8),\n )\n).play;\n);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `RedBMP.asImage` do?"}, {"role": "assistant", "content": "Converts the data to an Image and return it. NOTE: remember to free the"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\nz = {\nBBandPass.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(20, 20000, \\exponential),\n MouseY.kr(0.0, 10.0, \\linear), // bw\n 0.5); // mul\n}.play)\nz.release;\n\n(\nz = {\nBBandPass.ar(\n WhiteNoise.ar ! 2,\n MouseX.kr(20, 20000, \\exponential),\n MouseY.kr(0.0, 10.0, \\linear), // bw\n 0.5); // mul\n}.play\nz.release;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\nz = {\nBBandPass.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(20, 20000, \\exponential),\n MouseY.kr(0.0, 10.0, \\linear), // bw\n 0.5); // mul\n}.play)\nz.release;\n\n(\nz = {\nBBandPass.ar(\n WhiteNoise.ar ! 2,\n MouseX.kr(20, 20000, \\exponential),\n MouseY.kr(0.0, 10.0, \\linear), // bw\n 0.5); // mul\n}.play)\nz.release;\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Impulse`."}, {"role": "assistant", "content": "```supercollider\n{ Impulse.ar(4, [0, MouseX.kr(0, 1)], 0.2) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// The done action is invoked after maxFadeNum.\n\n(\nx = {\n var lfo = LFDNoise3.kr(0.2);\n DXMix.ar(\n Dseq([0, 1], inf),\n `[\n Saw.ar(lfo.range(40, 90) * [1, 1.02], 0.03),\n { BPF.ar(PinkNoise.ar(0.05), lfo.range(200, 5000), 0.1) } ! 2\n ],\n fadeTime: 0.5,\n stepTime: 1,\n fadeMode: 0, // check with other modes too\n maxFadeNum: 5,\n doneAction: 2\n )\n}.play\n;\n\nx.release\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// The done action is invoked after maxFadeNum.\n\n(\nx = {\n var lfo = LFDNoise3.kr(0.2);\n DXMix.ar(\n Dseq([0, 1], inf),\n `[\n Saw.ar(lfo.range(40, 90) * [1, 1.02], 0.03),\n { BPF.ar(PinkNoise.ar(0.05), lfo.range(200, 5000), 0.1) } ! 2\n ],\n fadeTime: 0.5,\n stepTime: 1,\n fadeMode: 0, // check with other modes too\n maxFadeNum: 5,\n doneAction: 2\n )\n}.play\n);\n\nx.release\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Logistic`."}, {"role": "assistant", "content": "```supercollider\n// default values\n{ Logistic.ar }.play\n\n// onset of chaos\n{ Logistic.ar(Line.kr(3.55, 3.6, 5), 1000) }.play\n\n// explore via Mouse\n{ Logistic.ar(MouseX.kr(3, 3.99), MouseY.kr(10, 10000, 'exponential'), 0.25, 0.5) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Mix`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var n;\n n = 8; // number of 'voices'\n Mix.new( // mix all stereo pairs down.\n Pan2.ar( // pan the voice to a stereo position\n CombL.ar( // a comb filter used as a string resonator\n Dust.ar( // random impulses as an excitation function\n // an array to cause expansion of Dust to n channels\n // 1 means one impulse per second on average\n Array.fill(n, 1),\n 0.3 // amplitude\n ),\n 0.01, // max delay time in seconds\n // array of different random lengths for each 'string'\n Array.fill(n, {0.004.rand+0.0003}),\n 4 // decay time in seconds\n ),\n Array.fill(n,{1.0.rand2}) // give each voice a different pan position\n )\n )\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `NumberEditor.bind` do? What arguments does it take?"}, {"role": "assistant", "content": "holds a float value with a spec, editable with a gui Arguments: model; varname; spec; layout; bounds; labelWidth."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `UnaryOpUGen` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\na = WhiteNoise.ar; // a WhiteNoise\nb = a.squared; // a UnaryOpUGen.\nb.operator; // squared\n\n// sound example\n\n{ var a = LFSaw.ar(300).range(0, 2pi); a.sin * 0.1 }.play;\n\n// Plotting the \"abs\" unary operator (via the server):\n\n{ SinOsc.ar(300).abs }.plot\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Padd`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, gate = 1|\n var env;\n env = EnvGen.kr(Env.asr(0.001, 1, 0.2), gate, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain, \\freq, 440);\nb = Padd(\\freq, Pseq([10, 30, 100], inf), a);\nb.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Synth` in SuperCollider?"}, {"role": "assistant", "content": "Synth — Client-side representation of a synth node on the server A Synth is the client-side representation of a synth node on the server. A Synth represents a single sound producing unit. What it does is defined in a SynthDef, which specifies what UGens are used and how they are patched together. It also specifies what inputs and outputs the Synth will have. A SynthDef is thus a kind of fixed pattern, upon which Synths are be based. (Despite this, a given Synth Category: Server > Nodes, Server > Abstractions."}]} {"conversations": [{"role": "user", "content": "How do I stop all sound?"}, {"role": "assistant", "content": "s.freeAll stops every node on the server. On the language side, Ndef.clear and Pdef.clear clear the proxies. If a Pattern is still running, Pdef(\\name).stop does it; CmdPeriod immediately stops everything scheduled on the default clock."}]} -{"conversations": [{"role": "user", "content": "Write a filter sweep over a saw."}, {"role": "assistant", "content": "An LFO on the cutoff of a resonant low-pass; XLine or an LFO both work, the LFO is the loopable one.\n\n```supercollider\n{ LPF.ar(Saw.ar([60, 60.2]), SinOsc.kr(0.2).exprange(150, 4000), 0.4) * 0.2 }.play;\n```\n\n`.exprange` is the exponential mapping you want for frequency; a linear `.range` sweep sounds uneven."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `SequenceableCollection`."}, {"role": "assistant", "content": "```supercollider\n~listing = [\"ls\", \"/\"].unixCmdGetStdOut; // Grab\n~listing.reverse.as(Array).dupEach.join.postln; // Mangle\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// for Nil: return the argument unmodified (an event).\nnil.transformEvent((x: 8));\n// for Dictionary (and thus for Event): add to the argument.\n(y: 100, z: 1).transformEvent((x: 8));\n// for Association: add the association to the event\n(\\a -> \\x).transformEvent((x: 8));\n// for Function: use the function receive the event as argument.\n{ |event| event.use { ~x = ~x + 1 }; event }.transformEvent((x: 8));\n```"}, {"role": "assistant", "content": "for Nil: return the argument unmodified (an event). for Dictionary (and thus for Event): add to the argument. (Nil: Represents uninitialized data)"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for late night experimenting."}, {"role": "assistant", "content": "```supercollider\n(\nvar seed = thisThread.randSeed = 1e8.rand.debug('seed');\n{|dur = 30|\n var voices = 2.pow(1.rrand(4)),\n sig = DelayC.ar({ Pan2.ar(\n PMOsc.performList(\\ar, {\n var freq = Lag.ar(LFSaw.ar([10,15]/((1..5).choose*[1,2,4].choose)).exprange(\n {200.rrand(400)}!2, {500.rrand(1100)}!2\n * Line.kr(0.5.rrand(2), 3.rrand(8.0),dur)\n ));\n [freq, freq/[2,4].choose + SinOsc.kr([10,25],0,5), XLine.kr(0.1,1.rrand(3.0),dur/1.rrand(2.0))]\n }.()).sum/2,\n [SinOsc,LFTri].choose.kr({4.0.rrand(11)}!2 * [XLine,Line].choose.kr(1,4,dur))\n ).sum/2 \n * LFGauss.kr(XLine.kr(\\beat.kr, \\beat.kr / \\beat_change.kr, dur) / [0.5,1,2,4].choose, 0.3) \n * EnvGen.kr([\n Env.perc(0.1,dur),\n Env.sine(dur),\n Env.performList(\\new, {|len| [\n [0]++Array.rand(len,0.1,1)++[0],\n Array.rand(len,0.1,1).normalizeSum * dur,\n Array.rand(len-1,-3.0,3.0)+[0]\n ]}.(2.rrand(10)))\n ].choose) } ! voices, 4, { 0.1.rrand(4) } ! voices, 1 / voices).sum * Line.kr(1,1,dur+5,doneAction:2);\n sig = Rotate2.ar(sig[0],sig[1], LFSaw.kr(Duty.kr(dur/4.rrand(16), 0, Drand([-1*\\beat.kr,\\beat.kr].reciprocal,inf))));\n}.play(args:[\n dur:1.rrand(25.0).debug('dur'), \n beat:1.rrand(6)*(1..4).reciprocal.choose/4, \n beat_change:1.rrand(8)\n])\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes sclang fun )."}, {"role": "assistant", "content": "```supercollider\n( // whatever\nNdef(\\ff_twist, {\n var tempo = 156/60;//TempoClock.tempo;\n var bands = 4.rrand(16).debug('bands');\n var sync = bands.factors.scramble.pop.debug('sync');\n var gen = [LFNoise1,LFNoise2,LFNoise0];\n var sig = Splay.ar(\n VarSaw.ar(//LFSaw.kr(Array.rand(bands/sync, 8, 390).stutter(sync)).range(0.97,1.03) * \n Array.exprand(bands, 50, 400) * ({ gen.choose.kr(1/1.rrand(10)).exprange(1, 10) } ! (bands/sync)).stutter(sync), \n 0, \n { gen.choose.kr(1/1.rrand(10)).range(0.1,1) } ! bands, \n { gen.choose.kr(1/1.rrand(10)).range(0.1,1) } ! bands\n ) * ({ EnvGen.kr(Env.perc(0.008.exprand(0.03), tempo.reciprocal / [1,2,4,8].choose, 1, rrand(-7,-1.0)).circle) } ! (bands/sync)).stutter(sync)\n );\n sig = sig * 0.7 + GVerb.ar(sig, mul:0.3);\n sig = Rotate2.ar(\n sig[0], sig[1], \n LFSaw.kr( Duty.kr(tempo.reciprocal * (2,8..24).choose, 0, Drand((1..4)*tempo, inf)) )\n );\n sig;\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// track audio in (try clapping a beat or beatboxing, but allow up to 6 seconds for tracking to begin) and spawning stuff at quarters, eighths and sixteenths\n(\nSynthDef(\\help_beattrack2_2, { |out|\n var trackb, trackh, trackq, tempo;\n var source, kbus;\n var bsound, hsound, qsound;\n\n source = SoundIn.ar(0);\n\n // downsampling automatic via kr from ar\n kbus = Out.kr(0, LPF.ar(source, 1000)); // ([feature1, feature3]++feature2);\n\n #trackb, trackh, trackq, tempo = BeatTrack2.kr(0, 1, weightingscheme:\n// …\n```"}, {"role": "assistant", "content": "track audio in (try clapping a beat or beatboxing, but allow up to 6 seconds for tracking to begin) and spawning stuff at quarters, eighths and sixteenths downsampling automatic via kr from ar (BeatTrack2: Template matching beat tracker)"}]} -{"conversations": [{"role": "user", "content": "What is `Symbol`?"}, {"role": "assistant", "content": "Symbol — a unique name for something"}, {"role": "user", "content": "What does `Symbol.isClassName` do?"}, {"role": "assistant", "content": "Answer whether the symbol can be a class name. This does not say if the class exists. `\\Array.isClassName;`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na = { SinOsc.ar(\\freq.kr(440, 1.2)) }.play;\na.set(\\freq, 330);\na.release;\na = { SinOsc.ar(\\freq.kr([440, 460], 1.2)) }.play;\na.setn(\\freq, [330, 367]);\na.release;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `RedGIF.controls` do?"}, {"role": "assistant", "content": "Array of RedGIFControl objects. Corresponding control also saved in each RedGIFImage. See"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for The quest for the prime numbers?"}, {"role": "assistant", "content": "```supercollider\n//Prime numbers\n \nServer.default.boot;\n(\n//maximum number\n~max=100;\n\n//synthdefs: 2 filtered sawteeth for number and divisor\nSynthDef ( \\gsaw, {arg g;\n Out.ar(1, \n RLPF.ar ( Saw.ar(20*g), 10000*(1-(g/~max)), 0.2, 0.2)\n )\n}).add;\n\nSynthDef ( \\dsaw, {arg d, g;\n Out.ar(0,\n RLPF.ar( Saw.ar(20*d), 10000*d/sqrt(g), 0.2, 0.2)\n // the square root is important: if you search for the divisors of a number,\n // don't search beyond the square root of the number. There won't be any.\n )\n}).add;\n\n//a fm-sound with carrier 20*number and modulator 20*divisor, modulation index = 10\nSynthDef (\\fm, {arg m, c;\n Out.ar(0,\n Pan2.ar(SinOsc.ar(20*c+(SinOsc.ar(20*m, 0, 200*m, 0))), 0)\n )\n}).add;\n\n);\n(\nr=Routine({\n var number, divisor;\n //the list of prime numbers\n l=Array.newClear(indexedSize: 0);\n\n for (2, ~max,{arg number;\n x=Synth(\\gsaw, [\\g, number]); //play the number\n divisor=2;\n p=true; //prime number?\n while ({((divisor <= (number.sqrt)).and(p == true))},\n { \n y=Synth(\\dsaw, [\\d, divisor, \\g, number]); //play the divisor\n z=Synth(\\fm, [\\m, divisor, \\c, number]); //play the fm sound of number and divisor\n 1.wait; //1 second should be enough to hear if a sound is harmonic\n // harmonic sound means: not a prime number\n y.free; \n z.free; \n if( number.mod(divisor) == 0, {p = false} ); //not a prime number\n divisor = divisor + 1;\n }\n );\n x.free;\n if (p == true){ //primenumber!\n l=l.add(number); //add primenumber to the list\n for (1, l.size, { arg i; //play the list of prime numbers\n z=Synth(\\fm, [\\m, l.size, \\c, l[i]]);\n 0.1.wait;\n z.free;\n });\n }\n\n });\n});\n);\nr.play;\n```"}]} -{"conversations": [{"role": "user", "content": "I made a synth and I hear nothing. Where do I start?"}, {"role": "assistant", "content": "Start with the node tree, not the code: evaluate `s.plotTree`. If your Synth is not there, it never started or it already freed itself; if it is there, the problem is in the signal. Which of the two do you see?"}, {"role": "user", "content": "It's in the tree."}, {"role": "assistant", "content": "Then the node lives and the signal is being lost. Check three things in order: does the SynthDef reach `Out.ar(0, ...)` with bus 0; is any `amp`/`mul` zero; and is a filter closed, e.g. `LPF.ar(sig, 50)` on a 440 Hz sine. Paste the SynthDef and I will read it."}, {"role": "user", "content": "SynthDef(\\x, { |out = 0| Out.ar(out, LPF.ar(Saw.ar(60), 80) * 0.1) }).add; Synth(\\x, [\\out, 2]);"}, {"role": "assistant", "content": "Two things. You wrote a low-pass at 80 Hz over a 60 Hz saw, which leaves almost nothing above the fundamental — the patch is nearly a sine at 60 Hz at very low level. And you passed `\\out, 2`, so it is going to bus 2, not the master. Try `Synth(\\x)` with the default out and a cutoff of 800:\n\n```supercollider\nSynthDef(\\x, { |out = 0, cutoff = 800| Out.ar(out, LPF.ar(Saw.ar(60), cutoff) * 0.1) }).add;\nSynth(\\x);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SimpleNumber.cylBesselKPrime` do?"}, {"role": "assistant", "content": "Returns the first derivative with respect to x of the corresponding Bessel function. Requires `x >"}]} -{"conversations": [{"role": "user", "content": "What does `PHS.play` do?"}, {"role": "assistant", "content": "A PHSplayer object is instantiated and started using the TempoClock clock. Quant or SimpleNumber quant lets the player step into the quantization as soon as possible, with respect to the necessary latency. The PHSplayer can be stopped and resumed with several"}]} -{"conversations": [{"role": "user", "content": "What does `Annotations.guiFindBus` do? What arguments does it take?"}, {"role": "assistant", "content": "stores names and notations for Nodes, identifying the Node's owner and its purpose Arguments: index; rate; layout."}]} -{"conversations": [{"role": "user", "content": "What is `Plambda` in SuperCollider?"}, {"role": "assistant", "content": "Plambda — create a scope (namespace) for enclosed streams Category: Streams-Patterns-Events > Patterns > Data Sharing."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na.formant(6, 3);\n\nb.sine2(a.formant(12, 3).postln, a.geom(1.2), true, true, true);\ny = z.play(s, [\\out, 0, \\bufnum, b];\ny.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na.formant(6, 3);\n\nb.sine2(a.formant(12, 3).postln, a.geom(1.2), true, true, true);\ny = z.play(s, [\\out, 0, \\bufnum, b]);\ny.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `ArrayedCollection.clipPut` do?"}, {"role": "assistant", "content": "Same as #-put, but values for index greater than the ArrayedCollection instance size minus one will be clipped to `size - 1`, which is the last"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Enveloppes sizes are fixed."}, {"role": "assistant", "content": "```supercollider\n(\n~resize_enveloppe = { | levels, times |\n var reverted_levels, index;\n index = 0;\n reverted_levels = levels.reverse;\n while( { reverted_levels[index] == 0 && reverted_levels[index+1] == 0 }, { times[ times.size - 1 - index] = 0.01; index = index + 1 } );\n};\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = Pbind(note: Pseq([0, 4, 7]), amp: 0.1, dur: 0.2);\nr = Routine { |inevent| (note:9, dur: 1).yield; a.embedInStream(inevent); };\nr.nextN(5, (x:7); // passing in an event for the next 5 values from r, \\x of 7 is passed through the Pbind stream\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = Pbind(note: Pseq([0, 4, 7]), amp: 0.1, dur: 0.2);\nr = Routine { |inevent| (note:9, dur: 1).yield; a.embedInStream(inevent); };\nr.nextN(5, (x:7)); // passing in an event for the next 5 values from r, \\x of 7 is passed through the Pbind stream\n```"}]} -{"conversations": [{"role": "user", "content": "What does `DoubleNestedAllpassL.ar` do?"}, {"role": "assistant", "content": "Nested Allpass filters as proposed by Vercoe and Pluckett"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LFDClipNoise`."}, {"role": "assistant", "content": "```supercollider\n// try wiggling the mouse quickly;\n// LFNoise frequently seems stuck, LFDNoise changes smoothly.\n\n{ LFClipNoise.ar(MouseX.kr(0.1, 1000, 1), 0.1) }.play\n\n{ LFDClipNoise.ar(MouseX.kr(0.1, 1000, 1), 0.1) }.play\n\n// silent for 2 secs before going up in freq\n\n{ LFClipNoise.ar(XLine.kr(0.5, 10000, 3), 0.1) }.scope;\n\n{ LFDClipNoise.ar(XLine.kr(0.5, 10000, 3), 0.1) }.scope;\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFClipNoise.ar(XLine.kr(1000, 20000, 10), 0.1) }.scope;\n\n{ LFDClipNoise.ar(XLine.kr(1000, 20000, 10), 0.1) }.scope;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\ns.waitForBoot({\n SynthDef(\\helpSeti, { |out, freqs = #[100, 150, 200, 250]|\n Out.ar(out, SinOsc.ar(freqs.poll, 0, 0.1).sum ! 2)\n }).add;\n s.sync;\n x = Synth(\\helpSeti);\n})\n);\nx.seti(\\freqs, 2, 600); // set only the third element\nx.seti(\\freqs, 1, [400, 410]; // set second and third element\nx.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\ns.waitForBoot({\n SynthDef(\\helpSeti, { |out, freqs = #[100, 150, 200, 250]|\n Out.ar(out, SinOsc.ar(freqs.poll, 0, 0.1).sum ! 2)\n }).add;\n s.sync;\n x = Synth(\\helpSeti);\n})\n);\nx.seti(\\freqs, 2, 600); // set only the third element\nx.seti(\\freqs, 1, [400, 410]); // set second and third element\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DynKlang`."}, {"role": "assistant", "content": "```supercollider\n// frequency modulation\n(\nplay {\n DynKlang.ar(`[\n [800, 1000, 1200] + SinOsc.kr([2, 3, 4.2], 0, [13, 24, 12]),\n [0.3, 0.3, 0.3],\n [pi, pi, pi]\n ]\n) * 0.1\n};\n);\n\n\n// building new synths every 2 seconds\n(\nfork {\n loop {\n play {\n var mod = SinOsc.kr(Rand(0.1, 0.9), 0, Rand(5, 20));\n Pan2.ar(DynKlang.ar(`[Array.rand(12, 200.0, 2000.0), 1, mod]), 1.0.rand)\n * EnvGen.kr(Env.sine(4), 1, 0.02, doneAction: Done.freeSelf)\n };\n 2.wait;\n }\n}\n);\n\n\n// resetting the frequencies and amplitudes after the synth has been created\n(\nSynthDef('help-dynKlang', { |out,\n freqs = #[220, 440, 880, 1760],\n amps = #[0.35, 0.23, 0.12, 0.05],\n phases = #[1, 1.5, 2, 2.5]|\n\n Out.ar(out, DynKlang.ar(`[freqs, amps, phases]))\n}).add\n);\n\na = Synth('help-dynKlang');\n\na.setn(\\freqs, Array.rand(4, 500, 2000));\na.setn(\\amps, Array.rand(4, 0.01, 0.25));\n```"}]} -{"conversations": [{"role": "user", "content": "What does `LinearSpline.minMaxVal` do? What arguments does it take?"}, {"role": "assistant", "content": "returns the min and max val of all points in the given dimension. Note that with subclasses that have curvature the min max returns only the points' min and max and does not account for curvature that may result in values above or below that in the final Arguments: dim — The dimension. Returns: [minVal,maxVal]"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.quit;\nf = { Group.new(s.defaultGroup); \"Other code can be evaluated too\".postln };\nServerTree.add(f);\ns.boot;\ns.queryAllNodes; // note the group within the default group\nServerTree.remove(f;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.quit;\nf = { Group.new(s.defaultGroup); \"Other code can be evaluated too\".postln };\nServerTree.add(f);\ns.boot;\ns.queryAllNodes; // note the group within the default group\nServerTree.remove(f);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `QuadL`."}, {"role": "assistant", "content": "```supercollider\n// default params\n{ QuadL.ar(SampleRate.ir/4) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `FoaWa` in SuperCollider briefly."}, {"role": "assistant", "content": "FoaWa — First Order Ambisonic (FOA) Soundfield Active Energy Vector Return the Active Energy Vector, Wa, of a first order ambisonic (B-format) signal. Category: Libraries > Ambisonic Toolkit > UGens > FOA > Analyzer, UGens > Multichannel > Ambisonics, UGens > Analysis > Ambisonics."}]} +{"conversations": [{"role": "user", "content": "What does `OSCSched.xschedAtTime` do? What arguments does it take?"}, {"role": "assistant", "content": "scheduling utility for just-in-time scheduling of OSC bundles Arguments: atTime — see atTime; server; bundle."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\na = { |tempo = 1| Ringz.ar(Impulse.ar(tempo), [501, 500], 1/tempo) }.play;\nt = TempoBusClock(a);\nTask { loop { \"klink\".postln; 1.wait } }.play(t);\n);\n\nt.tempo = 1.3;\nt.tempo = 0.5;\nt.tempo = 1.0;\n\n\n// in ProxySpace, a TempoBusClock can be added together with a ~tempo NodeProxy:\n\np = ProxySpace.push(s);\np.makeTempoClock;\np.clock; // now the ProxySpace's clock is a TempoBusClock\n\n~out.play;\n~out = { Ringz.ar(Impulse\n// …\n```"}, {"role": "assistant", "content": "in ProxySpace, a TempoBusClock can be added together with a ~tempo NodeProxy: patterns and tasks are synchronized: (TempoBusClock: a clock that synchronizes its tempo with the server)"}]} +{"conversations": [{"role": "user", "content": "What does `Task.reschedule` do?"}, {"role": "assistant", "content": "Switch the Task to a different clock, or a different time, without stopping. See Routine#-reschedule for complete"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Play it with the mouse\n{DFM1.ar(PinkNoise.ar(mul: 0.5), MouseX.kr(80, 5000, 'exponential'), MouseY.kr(0.1, 1.2))}.play;\n\n// Throbby bass\n{DFM1.ar(Pulse.ar(100, mul:0.4) + Pulse.ar(100.1, mul:0.4), SinOsc.kr(SinOsc.kr(0.3).range(0.2, 5)).range(80, 2000), 1.1, inputgain: 2.0, mul:0.7!2}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Play it with the mouse\n{DFM1.ar(PinkNoise.ar(mul: 0.5), MouseX.kr(80, 5000, 'exponential'), MouseY.kr(0.1, 1.2))}.play;\n\n// Throbby bass\n{DFM1.ar(Pulse.ar(100, mul:0.4) + Pulse.ar(100.1, mul:0.4), SinOsc.kr(SinOsc.kr(0.3).range(0.2, 5)).range(80, 2000), 1.1, inputgain: 2.0, mul:0.7)!2}.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n//listen to x and y output\n{Out.ar(0,Brusselator.ar(Impulse.kr(MouseY.kr(1,50,'exponential')),MouseX.kr(0.01,1,'exponential')))}.play\n\n//avoid DC offset (default gamma is 1.0, listening to x only, so take off gamma\n{Out.ar(0,Pan2.ar((Brusselator.ar(Impulse.kr(MouseY.kr(1,50,'exponential')),MouseX.kr(0.01,1,'exponential')))[0] - 1.0) )}.play\n\n\n//fun time, stable oscillation with these parameters\n{var mu = MouseY.kr(1.0,1.5); Out.ar(0,Pan2.\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n//listen to x and y output\n{Out.ar(0,Brusselator.ar(Impulse.kr(MouseY.kr(1,50,'exponential')),MouseX.kr(0.01,1,'exponential')))}.play\n\n//avoid DC offset (default gamma is 1.0, listening to x only, so take off gamma\n{Out.ar(0,Pan2.ar((Brusselator.ar(Impulse.kr(MouseY.kr(1,50,'exponential')),MouseX.kr(0.01,1,'exponential')))[0] - 1.0) )}.play\n\n\n//fun time, stable oscillation with these parameters\n{var mu = MouseY.kr(1.0,1.5); Out.ar(0,Pan2.ar(Brusselator.ar(0.0,MouseX.kr(0.01,0.1,'exponential'),mu,0.25)[0] ) )}.play\n\n\n{ Out.ar(0,Pan2.ar(Brusselator.ar(Impulse.kr(10),MouseX.kr(0.01,0.1,'exponential'),1.5,0.25,MouseY.kr(-1.0,1.0),0.0)[0]) )}.play\n\n\n{ Out.ar(0,Brusselator.ar(Impulse.kr(MouseY.kr(1,500,'exponential')),MouseX.kr(0.01,0.1,'exponential'),1.15,0.5,0.5,1.0) )}.play\n```"}]} +{"conversations": [{"role": "user", "content": "What is the difference between TempoClock and SystemClock?"}, {"role": "assistant", "content": "SystemClock runs in real time and is what `.wait` uses by default. TempoClock runs in beats and has a tempo, so it can be changed while things are playing and Patterns scheduled on it follow. `TempoClock.default` is the clock Patterns use unless told otherwise, which is why `TempoClock.default.tempo = 2` changes the speed of everything you already have running."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Pseq` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Pseq(#[60, 61, 63, 65, 72], inf).asStream;\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, a.next.midicps]);\n 0.2.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `TreeViewItem.setView` do? What arguments does it take?"}, {"role": "assistant", "content": "Places another view into the given data field. Only one view can be placed into a data field at once. If a view is already present, it will be removed and destroyed. If the number of data fields decreases due to a call to TreeView#-columns, the views contained in removed data fields will also be removed and Arguments: column — An integer index of a data field.; view — A View.."}]} +{"conversations": [{"role": "user", "content": "Explain `COsc` in SuperCollider briefly."}, {"role": "assistant", "content": "COsc — Chorusing wavetable oscillator. Chorusing wavetable lookup oscillator. Produces sum of two signals at Category: UGens > Generators > Deterministic."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n\nSynthDef(\\param, { arg freq = 100, sustain, amp;\n var sig;\n sig = LFPar.ar(freq: freq,\n mul: EnvGen.kr(Env.perc(0, sustain, 0.5), doneAction:2) * amp);\n sig = Splay.ar(sig);\n Out.ar(0, sig);\n}).add;\n\ne = Pbind(\n \\midinote, Prout({\n var tone0, tone1, tone2, interval, freq0, delta;\n loop {\n tone0 = rrand(0,11);\n interval = rrand(2,4);\n tone1 = Scale.minor(\\pythagorean).at(tone0) + [0,12,24].choose + 0.07;\n tone2 = Scale.minor(\\pythagorean).at(tone0 + interval) + [0,12,24].choose;\n freq0 = [tone1,tone2]+48;\n postln(freq0);\n freq0.yield;\n }\n }),\n \\dur, Prand([1,2,4,8,12,16,4,6,8], inf),\n \\instrument, \\param,\n \\amp, 0.5,\n \\sustain, 2,\n).play(quant:1); // returns an EventStream\nTempoClock.default.tempo = 1200/60;\n\n)\n```"}, {"role": "assistant", "content": "minor random bliss in two for Prout (a SuperCollider snippet)."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Resonz`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"pitchFromNoise\", { arg out = 0;\n Out.ar(\n out,\n Resonz.ar(\n WhiteNoise.ar(15),\n LFNoise0.kr(2, 110, 660),\n 0.005\n )\n )\n}).add;\n);\n\n\n(\nSynth(\"ringModulation\");\nSynth(\"pitchFromNoise\", [\\out, 1]);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Padd`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, gate = 1|\n var env;\n env = EnvGen.kr(Env.asr(0.001, 1, 0.2), gate, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain, \\freq, 440);\nb = Padd(\\freq, Pseq([10, 30, 100], inf), a);\nb.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Pgtpar` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// synthdef\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n}).add;\n);\n\n// pattern with different start times\n(\nx = Pbind(\n \\instrument, \\help_sinegrain,\n \\degree, Pseq(#[0, 5, 4, 2, 1, 1, 3], inf),\n \\dur, Pseq(#[0.25, 0.5, 1.0], inf),\n \\scale, #[0, 3, 5, 9, 10]\n);\na = Pbus(Pgtpar([0.0, x, 1.5, x, 2.25, x])).play;\n);\ns.plotTree;\na.stop;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Re: Re: the perfect frequencies. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\nf = {\n var rep = [4, 8, 16, 32];\n var n = rep.choose;\n var x = [\n\n 54, 60, 66, 72, 81, 90, 96, 102,\n 108, 128, 132, 144, 162, 180, 192, 204,\n 216, 240, 264, 288, 324, 360, 384, 408,\n 432, 480, 528, 576, 648, 720, 768, 816,\n 864, 960, 1056, 1152, 1296, 1440, 1536, 1632,\n 1728, 1920, 2112, 2304, 2592, 2880, 3072, 3264,\n 3456, 3840, 4224, 4608, 5184, 5760, 6144, 6528,\n 6912, 7680, 8448, 9216, 10368, 11520, 12288, 528\n\n ];\n var fac1 = [1,10,100,1000].choose;\n var fac2 = [1,10,100,1000].choose;\n var fac3 = [1,10,100,1000].choose;\n Mix.fill(n,\n {\n var detune = 5.rand;\n var saw;\n var sin;\n detune = XLine.kr(0.1,1+250.0.rand ,2+9.0.rand) * 2.0.rand* [1,-1].choose;\n sin = SinOsc.ar(x.choose * ( 1 + ( SinOsc.ar(x.choose/fac1) * x.choose/fac2 )) + detune, 4.rand, 0.25);\n saw = RLPF.ar(Saw.ar(x.choose*0.01+detune, 0.75), x.choose, 2.rand);\n saw = [\n saw,\n saw.fold2( SinOsc.ar(x.choose/fac3).range(0.1,1) ),\n saw.wrap2( SinOsc.ar(x.choose/fac3).range(0.1,1) ),\n saw * SinOsc.ar(x.choose/2),\n ( saw * SinOsc.ar(x.choose/fac3).range(1,20) ).tanh/2,\n ].choose;\n Pan2.ar((sin+saw) * EnvGen.kr(Env.sine(12, 1/n), 1, doneAction:2),\n 1.rand2) \n }\n );\n};\n);\n\n(\n// DEFINE A ROUTINE\nr = Routine({\n\n inf.do({\n f.play;\n 10.wait;\n })\n});\n);\n\nr.reset.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Red3D.render` do?"}, {"role": "assistant", "content": "Call this to perform the projection and scaling calculations. This updates the variable"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `In`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n(\nSynthDef(\"help-PinkNoise\", { |out = 0|\n Out.ar(out, PinkNoise.ar(0.1))\n}).add;\n\nSynthDef(\"help-In\", { |out = 0, in = 0|\n var input;\n input = In.ar(in, 1);\n Out.ar(out, input);\n\n}).add;\n);\n\n// play noise on the right channel\nx = Synth(\"help-PinkNoise\", [\\out, 1]);\n\n// read the input and play it out on the left channel\nSynth.after(x, \"help-In\", [\\out, 0, \\in, 1]);\n```"}]} +{"conversations": [{"role": "user", "content": "What is `BBCPPermute` in SuperCollider?"}, {"role": "assistant", "content": "BBCPPermute — Automatic breakbeat cutting algorithm A relatively straight forward cut procedure supporting arbitrary user defined permutation of equally divided chunks of the target. Category: Libraries > BBCut > Cut procedures."}]} +{"conversations": [{"role": "user", "content": "What does `EventStreamPlayer.reschedule` do?"}, {"role": "assistant", "content": "Switch the Task to a different clock, or a different time, without stopping. See Routine#-reschedule for complete"}]} +{"conversations": [{"role": "user", "content": "Explain `EaseOutInQuad` in SuperCollider briefly."}, {"role": "assistant", "content": "EaseOutInQuad — Quadratic ease-out/in Easing equation for a quadratic (t^2) ease-out/in, decelerating until halfway, then accelerating. Category: Ease."}]} +{"conversations": [{"role": "user", "content": "I get 'index out of range' when playing a buffer."}, {"role": "assistant", "content": "A read position is past the end of the buffer. `PlayBuf` with a `startPos` in frames beyond `~buf.numFrames`, or a `BufRd`/`GrainBuf` whose phase goes above 1, produces this. For GrainBuf, pos is normalised 0..1, so pass `LFNoise1.kr(1).range(0, 1)` rather than a frame count; for PlayBuf, cap the position at `~buf.numFrames - 1`. If you just loaded the file, check `~buf.numFrames` — a failed read gives 0 frames and every position is out of range."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Event` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\pm, { |out = 0, freq = 440, amp = 0.1, pan = 0, gate = 1, ratio = 1, index = 1, ar = 0.1, dr = 0.1|\n var z;\n z = LPF.ar(\n PMOsc.ar(freq, freq * ratio, Linen.kr(gate, ar, index, dr), 0, 0.3),\n XLine.kr(Rand(4000, 5000), Rand(2500, 3200), 1)\n ) * Linen.kr(gate, 0.01, 0.7, dr, 2);\n OffsetOut.ar(out, Pan2.ar(z, pan, amp));\n}).add;\n);\n\n(instrument: \\pm).play;\n\n(instrument: \\pm, ratio: 3.42, index: 12, freq: 150, ar: 8, dr: 3, sustain: 10).play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `FunctionDef.varArgsValue` do?"}, {"role": "assistant", "content": "Returns how many sets of variable arguments the function has. 0 for none, 1 for ellipsis arguments, 2 for keyword arguments. `{ |a, b, c| a + b * c }.def.varArgsValue; //"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pulse`."}, {"role": "assistant", "content": "```supercollider\n// modulate frequency\n{ Pulse.ar(XLine.kr(40, 4000, 6), 0.1, 0.2) }.play;\n\n// modulate pulse width\n{ Pulse.ar(200, SinOsc.kr(0.2).range(0.01, 0.99), 0.2) }.play;\n\n// two band limited square waves thru a resonant low pass filter\n{ RLPF.ar(Pulse.ar([100, 250], 0.5, 0.1), XLine.kr(8000, 400, 5), 0.05) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a, b;\na = Pxrand.new(#[1, 2, 3], 10); // return 10 items\nb = a.asStream;\n11.do({ b.next.postln });\n);\n\n// Pxrand used as a sequence of pitches:\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n(\na = Pxrand(#[60, 61, 63, 65, 72], inf).asStream;\nRoutine({\n loop({\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a, b;\na = Pxrand.new(#[1, 2, 3], 10); // return 10 items\nb = a.asStream;\n11.do({ b.next.postln });\n);\n\n// Pxrand used as a sequence of pitches:\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n(\na = Pxrand(#[60, 61, 63, 65, 72], inf).asStream;\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, a.next.midicps]);\n 0.1.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n var freq;\n\n freq = StreamKrDur(\n Pbrown(40,100,100,inf),\n `[ 1,2, 0.25], // an array\n 0.05);\n\n Tempo.bpm = 100; // times are in beats\n Patch({ arg freq=440;\n SinOsc.ar(freq,SinOsc.ar(600,0,0.3))\n //PMOsc.ar(freq,100,1.0,0,0.3)\n },[\n freq\n ]).play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n var freq;\n\n freq = StreamKrDur(\n Pbrown(40,100,100,inf),\n `[ 1,2, 0.25], // an array\n 0.05);\n\n Tempo.bpm = 100; // times are in beats\n Patch({ arg freq=440;\n SinOsc.ar(freq,SinOsc.ar(600,0,0.3))\n //PMOsc.ar(freq,100,1.0,0,0.3)\n },[\n freq\n ]).play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `FoaEncoderMatrix.numChannels` do?"}, {"role": "assistant", "content": "Answers the number of input channels (virtual loudspeakers or"}]} +{"conversations": [{"role": "user", "content": "Write a chord progression with Pbind."}, {"role": "assistant", "content": "Put an array of degrees in the pattern, use \\strum to spread the chord, and the default instrument\nplays all notes of each event.\n\n```supercollider\n(\nPbind(\n \\scale, Scale.minor,\n \\root, 2,\n \\degree, Pseq([[0, 4, 7], [-3, 0, 4], [-5, -1, 2], [0, 4, 7]], inf),\n \\dur, 1.5,\n \\strum, 0.02,\n \\amp, 0.12,\n \\legato, 0.9\n).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `UScoreEditor.deleteEvents` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: events — (describe argument here). Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "What does `SimpleNumber.ramp` do?"}, {"role": "assistant", "content": "Map the receiver onto a ramp starting at `0.0`, ending at `1.0`, effectively clipping the receiver at [0,"}]} +{"conversations": [{"role": "user", "content": "Are you an AI?"}, {"role": "assistant", "content": "Yes. I am a small language model specialised in SuperCollider. I generate text; I cannot hear audio, run sclang, or check whether a patch sounds the way you want."}]} +{"conversations": [{"role": "user", "content": "What does `AudioInPlayer.new` do? What arguments does it take?"}, {"role": "assistant", "content": "plays the computers audio in — microphone or record busses Arguments: numChannels; firstChannel — firstChannel - starting at 0."}]} +{"conversations": [{"role": "user", "content": "What is `Delay2` in SuperCollider?"}, {"role": "assistant", "content": "Delay2 — Two sample delay. Delays the input by two samples. Category: UGens > Delays."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Stethoscope`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var f = { |l,h| SinOsc.kr(0.1, {pi.rand}).range(l, h) } ;\n Pulse.ar({ f.(20, 1000) }!6, { f.(0.0, 1) }!6, { f.(0.0, 1.0) }!6)\n}.play;\n);\n\nc = s.scope;\nc.numChannels = 6;\nc.scopeView.waveColors = [Color.red, Color.red, Color.cyan, Color.cyan, Color.white, Color.white];\nc.style = 2;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Document.keyDownAction` do? What arguments does it take?"}, {"role": "assistant", "content": "Get/set the action to be performed on Arguments: action — An instance of Function or FunctionList. The arguments passed to the function are: `document`, `char`, `modifiers`, `unicode`, `keycode`. See View#Key actions for details on these arguments.."}]} +{"conversations": [{"role": "user", "content": "What is `Platform`?"}, {"role": "assistant", "content": "Platform — handle cross-platform differencies"}, {"role": "user", "content": "What does `Platform.case` do?"}, {"role": "assistant", "content": "Perform actions depending on the current platform (name), just like Object:switch: `Platform.case(`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// start a server program from the cmdLine for testing\n~pid = unixCmd(Server.program + s.options.asOptionsString(57100));\n// kill just that server program by its pid:\nthisProcess.platform.killProcessByID(~pid);\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Object`?"}, {"role": "assistant", "content": "Object — abstract superclass of all objects"}, {"role": "user", "content": "What does `Object.readArchive` do?"}, {"role": "assistant", "content": "Read in an object from a text archive. `(`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// embedding an event\na = (z: 77);\nb = Pset(\\y, 8, a.streamArg(true)).asStream;\nc = Pset(\\y, 8, a.streamArg(false)).asStream;\nb.nextN(3, ()); // this ends\nc.nextN(3, ()); // this loops\n\n// embedding a pattern\na = Pbind(\\note, Pseq([1, 2]));\nb = Pset(\\y, 8, a.streamArg(true)).asStream;\nc = Pset(\\y, 8, a.streamArg(false)).asStream;\nb.nextN(3, ()); // this ends\nc.nextN(3, ()); // this ends, too\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n//you must have run this line before any of the examples below\nf= BBCutBuffer(Platform.resourceDir +/+ \"sounds/break.aiff\",8);\n\nTempoClock.default.tempo_(2.3);\n\n//default\na=BBCut2(CutBuf1(f),CageCut.new).play;\n\na.end;\n\n//weirder\na=BBCut2(CutBuf1(f),CageCut(8.0,[0.2,0.3,0.4,0.1])).play;\n\na.end;\n\n//using your own permutation function\na=BBCut2(CutBuf1(f),CageCut(16.0,[1,3,3,1,1,2,2,1],{arg array; array.scramble\n// …\n```"}, {"role": "assistant", "content": "you must have run this line before any of the examples below using your own permutation function (CageCut: Automatic breakbeat cutting algorithm inspired by John Cage)"}]} +{"conversations": [{"role": "user", "content": "What is `Pbindf`?"}, {"role": "assistant", "content": "Pbindf — bind several value patterns to one existing event stream by binding keys to values"}, {"role": "user", "content": "What does `Pbindf.new` do?"}, {"role": "assistant", "content": "The arguments to Pbindf is the initial pattern followed by an alternating sequence of keys and patterns. A pattern can also be bound to an array of keys. In this case, the pattern must specify a sequence whose elements are arrays with at least as many elements as there are keys."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\na = Pbind(\\x, Pseq([1, 2, 3]), \\zzz, 9000); // input stream\nb = Pbindf(a, \\y, Prand([100, 300, 200], inf), \\zzz, 99);\nx = b.asStream;\n);\n\nx.next(()); // pass in an event ()\nx.next(());\nx.next(());\nx.next(()); // end: nil\n\n\n\n// sound examples\n\n// using the default synth def\na = Pbind(\\dur, 0.1);\nPbindf(a, \\freq, Prand([300, 500, 231.2, 399.2], inf)).play;\nPbindf(a, \\freq, Prand([1, 1.2, 2, 2.5, 3, 4], inf) * 200).play;\n\n\n(\n// a SynthDef\nSynthDef(\\test, { |out, freq = 440, amp = 0.1, nharms = 10, pan = 0, gate = 1|\n var audio = Blip.ar(freq, nharms, amp);\n var env = Linen.kr(gate, doneAction: Done.freeSelf);\n OffsetOut.ar(out, Pan2.ar(audio, pan, env));\n}).add;\n);\n\na = Pbind(\\instrument, \\test, \\dur, 0.1);\n\nPbindf(a, \\freq, Prand([1, 1.2, 2, 2.5, 3, 4], inf) * 200).play;\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `LPF`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\\default, { arg out=0, freq=440, amp=0.1, pan=0, gate=1;\n var z;\n z = LPF.ar(\n Mix.new(VarSaw.ar(freq + [0, Rand(-0.4,0.0), Rand(0.0,0.4)], 0, 0.3)),\n XLine.kr(Rand(4000,5000), Rand(2500,3200), 1)\n ) * Linen.kr(gate, 0.01, 0.7, 0.3, 2);\n OffsetOut.ar(out, Pan2.ar(z, pan, amp));\n}, [\\ir]);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nb.free;\nb = Buffer.read(s, ExampleFiles.apollo11);\n{\n var pointer = Phasor.ar(0, SampleDur.ir / BufDur.ir(b) * XLine.kr(1, 0.25, 20));\n var sound = Warp1.ar(1, b, pointer, 1, 0.3, -1, 16, Line.kr(0, 1, 40), 4);\n Pan2.ar(sound, pointer * 2 - 1, 0.25)\n}.play\n;\nb.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nb.free;\nb = Buffer.read(s, ExampleFiles.apollo11);\n{\n var pointer = Phasor.ar(0, SampleDur.ir / BufDur.ir(b) * XLine.kr(1, 0.25, 20));\n var sound = Warp1.ar(1, b, pointer, 1, 0.3, -1, 16, Line.kr(0, 1, 40), 4);\n Pan2.ar(sound, pointer * 2 - 1, 0.25)\n}.play\n);\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `RedBMP.palette` do?"}, {"role": "assistant", "content": "Colour table as a 1-dimensional array of Color objects. Size 256 for 8bit images, size 16 for 4bit images and size 2 for 1bit"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\Mirror;\n~description = \"Mirror soundfield\";\n\n~function = {|in = 0, order = 1, mirrorFrontBack = 0, mirrorLeftRight = 0, mirrorUpDown = 0 |\nHOATransMirror.ar(order, in, mirrorFrontBack, mirrorLeftRight, mirrorUpDown);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\np = PHS(h, [], 0.15, [ \\midinote, Pkey(\\val) ]).play;\n\n// also:\n// p = PHS(h, [], 0.15, [ \\midinote, Pfunc { |e| e.use { ~val } } ]).play;\n\n// stop allows resuming, cleanup with free or Cmd-. \n\np.stop; // HS synth still playing \n\np.play; // resume the PHSplayer\n\np.stop(true); // HS synth also paused \n\np.play; // resume the PHSplayer together with HS synth\n\np.free; // also stop HS synth and cleanup - PHSplayer and HS object are freed\n```"}, {"role": "assistant", "content": "p = PHS(h, [], 0.15, [ \\midinote, Pfunc { |e| e.use { ~val } } ]).play; stop allows resuming, cleanup with free or Cmd-. (HS: object for use of synth values in the language by event patterns)"}]} +{"conversations": [{"role": "user", "content": "What does `ServerOptions.useSystemClock` do?"}, {"role": "assistant", "content": "Tells supernova whether to sync to the driver's sample clock, or to the system"}]} +{"conversations": [{"role": "user", "content": "Saving \"Presets\"?"}, {"role": "assistant", "content": "SuperCollider forum — Saving \"Presets\"?\n\nIf you don’t care too much about it being human readable, just use writeArchive and readArchive:\n\n```supercollider\na = Array.fill(400, {rrand(0,2200)});\n\na.writeArchive(\"/Users/spluta1/Documents/SC/test\");\n\nb = Object.readArchive(\"/Users/spluta1/Documents/SC/test\");\n\nb.postln;\n```\n\nSam"}]} +{"conversations": [{"role": "user", "content": "What are you good at?"}, {"role": "assistant", "content": "SuperCollider. I can explain its classes and UGens, write SynthDefs and patches, read a patch back to you, and tell you why one does not compile. I am 198M parameters; I am not a general assistant."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ LFPulse.ar(50 * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ LFPulse.ar(50) * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `TWChoose`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar,\n Pulse.ar\n ];\n TWChoose.ar(Dust.ar(MouseX.kr(1, 1000, 1)), a, [0.99, 0.05, 0.05].normalizeSum) * 0.2\n\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `IdentityDictionary`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_sinegrain, { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0.5pi, env))\n}).add;\n\na = Pbind(\\instrument, \\help_sinegrain, \\note, Pseq([0, 7, 2, 9, 11, 10, 9, 8], inf), \\dur, 1);\na.play(quant: (quant: 1, phase: 0));\na.play(quant: (quant: 1, phase: 1/3));\na.play(quant: (quant: 1, phase: 1.0.rand));\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// vary frequency - these parameters are for \"one-pulse\" orbit\n{ RosslerL.ar(MouseX.kr(20, SampleRate.ir), 0.36, 0.35, 4.5) * 0.3 }.play(s);\n\n// randomly modulate params\n(\n{ RosslerL.ar(\n SampleRate.ir, \n 0.2, // First variable tends to lead to NaN if modulated in this example\n LFNoise0.kr(1, 0.01, 0.2),\n LFNoise0.kr(1, 0.2, 0.7)\n) * 0.2 }.play(s);\n)\n\n// as a frequency control\n{ SinOsc.ar(Lag.ar(RosslerL.ar(MouseX.kr(1, 200)))*800+900)*0.4 }.play\n// …\n```"}, {"role": "assistant", "content": "vary frequency - these parameters are for \"one-pulse\" orbit randomly modulate params (RosslerL: Rossler chaotic generator)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\na = RecNodeProxy.audio(s, 2);\na.source = { SinOsc.ar([400, 500], 0, 0.1) };\na.play; // monitor;\na.open(\"xproxySpace.aif\");\na.record(false);\n\na.source = { SinOsc.ar([400, 700], 0, 0.1) };\na.source = { SinOsc.ar([410, 510], 0, 0.1) };\na.source = { SinOsc.ar([LFNoise1.kr(80, 100, 300), 500], 0, 0.1 };\n\n// stop recording and close file\na.close;\n\n// monitor off\na.stop;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\na = RecNodeProxy.audio(s, 2);\na.source = { SinOsc.ar([400, 500], 0, 0.1) };\na.play; // monitor;\na.open(\"xproxySpace.aif\");\na.record(false);\n\na.source = { SinOsc.ar([400, 700], 0, 0.1) };\na.source = { SinOsc.ar([410, 510], 0, 0.1) };\na.source = { SinOsc.ar([LFNoise1.kr(80, 100, 300), 500], 0, 0.1) };\n\n// stop recording and close file\na.close;\n\n// monitor off\na.stop;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Pgbrown.new` do? What arguments does it take?"}, {"role": "assistant", "content": "geometric brownian motion pattern Arguments: lo — lower boundary of values.; hi — upper boundary of values.; step — maximum multiplication factor per step (omega) - the distribution is xrand2.; length — number of values produced.."}]} +{"conversations": [{"role": "user", "content": "What is `Nil` in SuperCollider?"}, {"role": "assistant", "content": "Nil — Represents uninitialized data Nil has a single instance named `nil` and is used to represent uninitialized data, bad values, or terminal values such as end-of-stream. Internally, `nil` also serves as a sentinel value, used to mark empty or unoccupied slots in hash-based data structures such as `Set`, and its subclasses. Because of this internal role, `nil` —despite being a valid object— cannot be stored as an element in `Set` Category: Core."}]} +{"conversations": [{"role": "user", "content": "What does `SynthlessPlayer.didStop` do?"}, {"role": "assistant", "content": "parent class for Players that will not spawn a synth"}]} +{"conversations": [{"role": "user", "content": "How should I organise a SuperCollider project on disk?"}, {"role": "assistant", "content": "One folder per piece, with a fixed shape:\n\n```text\nmy-piece/\n synthdefs.scd // only SynthDef(...).add, loaded first\n material.scd // buffers, samples, scales\n piece.scd // the performance: Tdefs, Pbinds, Ndefs\n README.md // tempo, required samples, how to run it\n```\n\nThen the workflow is: open `synthdefs.scd`, Ctrl+A Ctrl+Enter to load it, load `material.scd`, and work in\n`piece.scd`. Keeping definitions out of the performance file is what makes a reboot survivable and a piece\nre-runnable six months later."}]} +{"conversations": [{"role": "user", "content": "What does `ControlPatchIn.rate` do?"}, {"role": "assistant", "content": "manages a Player's input when connecting to other Players"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// vary frequency\n{ CuspN.ar(MouseX.kr(20, SampleRate.ir), 1.0, 1.99) * 0.3 }.play(s);\n\n// mouse-controlled params\n{ CuspN.ar(SampleRate.ir/4, MouseX.kr(0.9, 1.1, 1), MouseY.kr(1.8, 2, 1)) * 0.3 }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(CuspN.ar(40, MouseX.kr(0.9, 1.1, 1), MouseY.kr(1.8, 2, 1))*800+900)*0.4 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// vary frequency\n{ CuspN.ar(MouseX.kr(20, SampleRate.ir), 1.0, 1.99) * 0.3 }.play(s);\n\n// mouse-controlled params\n{ CuspN.ar(SampleRate.ir/4, MouseX.kr(0.9, 1.1, 1), MouseY.kr(1.8, 2, 1)) * 0.3 }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(CuspN.ar(40, MouseX.kr(0.9, 1.1, 1), MouseY.kr(1.8, 2, 1))*800+900)*0.4 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `MouseButton` in SuperCollider briefly."}, {"role": "assistant", "content": "MouseButton — Mouse button UGen. Category: UGens > User interaction."}]} +{"conversations": [{"role": "user", "content": "What is the difference between the language and the server?"}, {"role": "assistant", "content": "sclang runs your code, the clock and Patterns, and builds UGen graphs. scsynth performs the DSP in real time. They communicate over OSC, which is why a language-side mistake can leave a sound running, and why s.freeAll stops it."}]} +{"conversations": [{"role": "user", "content": "What does `MxArJack.guiClass` do?"}, {"role": "assistant", "content": "A hot swappable input point for use in internal patching"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for attempt at emulating a breathing sound. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\n//s.options.memSize_(64000);\nTempoClock.tempo_(1.0);\n\ns.waitForBoot({\n SynthDef(\\breathe_in, {\n | out = 0, gate = 1, in1=0.11, in2=0.63, in3=0.18, amdb= -10 |\n var menv = EnvGen.kr(Env.new([0,1,1,0],[in1, in2, in3], curve:'lin'),\n gate,\n doneAction:Done.freeSelf);\n var noise = WhiteNoise.ar(amdb.dbamp);\n var f1 = BPF.ar(in:noise, freq:5790, rq:0.1, mul:-29.dbamp);\n var f2 = BPF.ar(in:noise, freq:3400, rq:0.2, mul:-16.dbamp);\n var f3 = BPF.ar(in:noise, freq:1990, rq:0.1, mul:-23.dbamp);\n var f4 = BPF.ar(in:noise, freq:1250, rq:0.1, mul:-26.dbamp);\n Out.ar(out, menv*(f1+f2+f3+f4)!2);\n }).add;\n\n SynthDef(\\breathe_out, {\n | out = 0, gate=1, out1=0.343, out2=0.387, amdb= -4.33 |\n var menv = EnvGen.kr(Env.new([0, 1, 0], [out1,out2], curve:'lin'),\n gate,\n doneAction:Done.freeSelf);\n var noise = WhiteNoise.ar(amdb.dbamp);\n var f1 = BPF.ar(in:noise, freq:2290, rq:0.1, mul:-17.dbamp);\n var f2 = BPF.ar(in:noise, freq:1290, rq:0.1, mul:-19.dbamp);\n var f3 = BPF.ar(in:noise, freq:490, rq:0.1, mul:-18.dbamp);\n Out.ar(out, menv*(f1+f2+f3)!2);\n }).add;\n\n\n s.sync;\n\n fork {\n 50.do({\n var in1 = 0.11.rrand(0.22);\n var in2 = 0.6.rrand(0.8);\n var in3 = 0.16.rrand(0.30);\n var pausein = 0.11.rrand(0.20);\n var out1 = 0.30.rrand(0.50);\n var out2 = 0.36.rrand(0.50);\n var pauseout = 0.11.rrand(0.20);\n var amdb = -10.0.rrand(-14.0);\n var amdb2 = amdb/2.5;\n //(\"in1: \" ++ in1 ++ \" in2: \" ++ in2 ++ \" in3: \" ++ in3 ++ \" pausein: \" ++ pausein ++ \" out1: \" ++ out1 ++ \" out2: \" ++ out2 + \" pauseout: \" ++ pauseout).postln;\n Synth(\\breathe_in, [\\in1, in1, \\in2, in2, \\in3, in3, \\amdb, amdb]);\n (in1+in2+in3+pausein).wait;\n Synth(\\breathe_out, [\\out1, out1, \\out2, out2, \\amdb, amdb2]);\n (out1+out2+pauseout).wait;\n });\n };\n\n});\n);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Re: Re: the perfect frequencies. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\nf = {\n var rep = [4, 8, 16, 32];\n var n = rep.choose;\n var x = [\n\n 54, 60, 66, 72, 81, 90, 96, 102,\n 108, 128, 132, 144, 162, 180, 192, 204,\n 216, 240, 264, 288, 324, 360, 384, 408,\n 432, 480, 528, 576, 648, 720, 768, 816,\n 864, 960, 1056, 1152, 1296, 1440, 1536, 1632,\n 1728, 1920, 2112, 2304, 2592, 2880, 3072, 3264,\n 3456, 3840, 4224, 4608, 5184, 5760, 6144, 6528,\n 6912, 7680, 8448, 9216, 10368, 11520, 12288, 528\n\n ];\n var fac1 = [1,10,100,1000].choose;\n var fac2 = [1,10,100,1000].choose;\n var fac3 = [1,10,100,1000].choose;\n Mix.fill(n,\n {\n var detune = 5.rand;\n var saw;\n var sin;\n detune = XLine.kr(0.1,1+250.0.rand ,2+9.0.rand) * 2.0.rand* [1,-1].choose;\n sin = SinOsc.ar(x.choose * ( 1 + ( SinOsc.ar(x.choose/fac1) * x.choose/fac2 )) + detune, 4.rand, 0.25);\n saw = RLPF.ar(Saw.ar(x.choose*0.01+detune, 0.75), x.choose, 2.rand);\n saw = [\n saw,\n saw.fold2( SinOsc.ar(x.choose/fac3).range(0.1,1) ),\n saw.wrap2( SinOsc.ar(x.choose/fac3).range(0.1,1) ),\n saw * SinOsc.ar(x.choose/2),\n ( saw * SinOsc.ar(x.choose/fac3).range(1,20) ).tanh/2,\n ].choose;\n Pan2.ar((sin+saw) * EnvGen.kr(Env.sine(12, 1/n), 1, doneAction:2),\n 1.rand2) \n }\n );\n};\n);\n\n(\n// DEFINE A ROUTINE\nr = Routine({\n\n inf.do({\n f.play;\n 10.wait;\n })\n});\n);\n\nr.reset.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// These examples compare the variants, so that you can hear the difference in interpolation\n\n// Comb used as a resonator. The resonant fundamental is equal to\n// reciprocal of the delay time.\n{ CombN.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ CombL.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ CombC.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// with negative feedback:\n{ CombN.ar(WhiteNoise.ar(0.01), 0\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// These examples compare the variants, so that you can hear the difference in interpolation\n\n// Comb used as a resonator. The resonant fundamental is equal to\n// reciprocal of the delay time.\n{ CombN.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ CombL.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ CombC.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// with negative feedback:\n{ CombN.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ CombL.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ CombC.ar(WhiteNoise.ar(0.01), 0.01, XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n// used as an echo.\n{ CombL.ar(Decay.ar(Dust.ar(1, 0.5), 0.2, WhiteNoise.ar), 0.2, 0.2, 3) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Interpreter`?"}, {"role": "assistant", "content": "Interpreter — The interpreter defines a context in which interactive commands are compiled and executed."}, {"role": "user", "content": "What does `Interpreter.clearAll` do?"}, {"role": "assistant", "content": "set the values of the variables `a` through `z` to nil. `x = 123;`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// typical usage\na = 4;\nb = 3;\nb = b + a;\n\n// some sound\na = Synth(\\default);\ng = fork { loop { 0.1.wait; a.set(\\freq, 200 + 20.0.rand2.postln) } };\ng.stop; a.free;\n\n// an overview of all the variables\nthis.inspect;\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `PulseDivider`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\"help-PulseDivider\", { |out = 0|\n var p, a, b;\n p = Impulse.ar(8);\n a = SinOsc.ar(1200, 0, Decay2.ar(p, 0.005, 0.1));\n b = SinOsc.ar(600, 0, Decay2.ar(PulseDivider.ar(p, 4), 0.005, 0.5));\n\n Out.ar(out, (a + b) * 0.4)\n}).play;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// if NTMI.helloSnd is not already defined in startup file, do this:\nfork {\n NTMI.numChans.do { |i|\n { LFDNoise3.ar(\n XLine.kr(\n exprand(2000, 5000),\n exprand(2000, 20000),\n 0.25, doneAction: 2),\n 0.1\n )\n }.play(outbus: i);\n 0.25.wait;\n };\n}\n```"}, {"role": "assistant", "content": "if NTMI.helloSnd is not already defined in startup file, do this:."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Re: the perfect frequencies. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// Rumush\n// https://mycelialcordsblog.wordpress.com/\n// https://fungorumush.bandcamp.com/releases\n// https://soundcloud.com/fungorum\n\n(\nf = {\n var rep = [4, 8, 16, 32];\n var n = rep.choose;\n var x = [\n\n 54, 60, 66, 72, 81, 90, 96, 102,\n 108, 128, 132, 144, 162, 180, 192, 204,\n 216, 240, 264, 288, 324, 360, 384, 408,\n 432, 480, 528, 576, 648, 720, 768, 816,\n 864, 960, 1056, 1152, 1296, 1440, 1536, 1632,\n 1728, 1920, 2112, 2304, 2592, 2880, 3072, 3264,\n 3456, 3840, 4224, 4608, 5184, 5760, 6144, 6528,\n 6912, 7680, 8448, 9216, 10368, 11520, 12288, 528\n\n ];\n Mix.fill(n,\n {\n var detune = 5.rand;\n var sin = SinOsc.ar(x.choose, 4.rand, 0.25);\n var saw = RLPF.ar(Saw.ar(x.choose*0.01+detune, 0.75), x.choose, 2.rand).tanh;\n Pan2.ar((sin+saw) * EnvGen.kr(Env.sine(12, 1/n), 1, doneAction:2),\n 1.rand2) }\n );\n};\n);\n\n(\n// DEFINE A ROUTINE\nr = Routine({\n\n inf.do({\n f.play;\n 10.wait;\n })\n});\n);\n\nr.reset.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Balance2`."}, {"role": "assistant", "content": "```supercollider\n// a stereo signal, both channels at 0dB\n{ [SinOsc.ar(440), SinOsc.ar(440)] }.play\n\n// using Balance on a stereo signal with the position parameter at 0, effectively the same sound but both channels at -3dB\n{ Balance2.ar(SinOsc.ar(440), SinOsc.ar(440), 0) }.play\n\n// pan sweep from left to right\n{ Balance2.ar(SinOsc.ar(440), SinOsc.ar(1000), Line.kr(-1, 1, 5)) }.play\n\n// other examples\n{ Balance2.ar(LFSaw.ar(44), Pulse.ar(33), FSinOsc.kr(0.5), 0.1) }.play;\n{ var source; source = SinOsc.ar([440, 550]); Balance2.ar(source[0], source[1], LFNoise0.kr(4), 0.3) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "How do I make this brighter?\n```supercollider\n{ LPF.ar(Saw.ar(110), 400) * 0.2 }.play;\n```"}, {"role": "assistant", "content": "Raise the cutoff. 400 Hz is well below the harmonics that carry brightness, so open it to 2000-4000 Hz:\n\n```supercollider\n{ LPF.ar(Saw.ar(110), 3000) * 0.2 }.play;\n```"}, {"role": "user", "content": "Still dull."}, {"role": "assistant", "content": "Then the low-pass is not the limit — the source is. A saw at 110 Hz has energy up to Nyquist, so check the amplitude: at 0.2 the high harmonics are quiet. Two moves: add resonance so the filter peak is audible, and raise the level slightly.\n\n```supercollider\n{ RLPF.ar(Saw.ar(110), 2500, 0.3) * 0.35 }.play;\n```\n\nIf that is still dull, the answer is a different source: `Saw` is band-limited and soft; try `LFSaw` or add a second detuned saw for more high content."}]} +{"conversations": [{"role": "user", "content": "What does `U.def` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: newDef — (describe argument here); keepArgs — (describe argument here). Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\nPdef(\\x).play;\nPdef(\\x).quant = 0; // we don't want quant here.\nPdef(\\x, Pbind(\\degree, Pseq((0..5), inf), \\dur, 0.3)).condition_({ |val, i| i.postln % 6 == 0 });\nPdef(\\x, Pbind(\\degree, Pseq((0..7) + 5.rand, inf), \\dur, 0.3)).condition_({ |val, i| (i % 8).postln == 0 });\n\n// the above is equivalent to:\nPdef(\\x, Pbind(\\degree, Pseq((0..7) + 5.rand, inf), \\dur, 0.3)).count(8);\n\n// the value that is sent in is the event, so decisions can be made dependent on the event's fields\n```"}, {"role": "assistant", "content": "the above is equivalent to: the value that is sent in is the event, so decisions can be made dependent on the event's fields (Pdef: stream reference definition)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// a stereo signal, both channels at 0dB\n{ [SinOsc.ar(440), SinOsc.ar(440)] }.play\n\n// using Balance on a stereo signal with the position parameter at 0, effectively the same sound but both channels at -3dB\n{ Balance2.ar(SinOsc.ar(440), SinOsc.ar(440), 0) }.play\n\n// pan sweep from left to right\n{ Balance2.ar(SinOsc.ar(440), SinOsc.ar(1000), Line.kr(-1, 1, 5)) }.play\n\n// other examples\n{ Balance2.ar(LFSaw.ar(44), Pulse.ar(33), FSinOsc.kr(0.5), 0.1) }.play;\n{ var source; source = SinOsc\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// a stereo signal, both channels at 0dB\n{ [SinOsc.ar(440), SinOsc.ar(440)] }.play\n\n// using Balance on a stereo signal with the position parameter at 0, effectively the same sound but both channels at -3dB\n{ Balance2.ar(SinOsc.ar(440), SinOsc.ar(440), 0) }.play\n\n// pan sweep from left to right\n{ Balance2.ar(SinOsc.ar(440), SinOsc.ar(1000), Line.kr(-1, 1, 5)) }.play\n\n// other examples\n{ Balance2.ar(LFSaw.ar(44), Pulse.ar(33), FSinOsc.kr(0.5), 0.1) }.play;\n{ var source; source = SinOsc.ar([440, 550]); Balance2.ar(source[0], source[1], LFNoise0.kr(4), 0.3) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What can you do?"}, {"role": "assistant", "content": "Write and explain SuperCollider: SynthDefs, UGens, Patterns, Ndef, buses and envelopes, and tell you why a patch is silent or will not compile. I am 198M parameters, so I am narrow on purpose."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n(\np = Pbind(\n \\midinote, PlaceAll([[60, 61], 70, [80, [81, 81.5], 82]], inf),\n \\dur, 0.2\n);\n\nx = p.play;\n);\n\nx.stop;\n\n\n// to distinguish subarrays from arrays to be taken as output use Refs, \n// as wrapping in another array wouldn't do\n\n(\np = Pbind(\n \\midinote, PlaceAll([[60, 61], 70, [80, `[81, 81.5], 82]], inf),\n \\dur, 0.2\n);\n\nx = p.play;\n) ;\n\n\nx.stop;\n\n\n// Items may also\n// …\n```"}, {"role": "assistant", "content": "to distinguish subarrays from arrays to be taken as output use Refs, as wrapping in another array wouldn't do (PlaceAll: Arbitrarily nested embedding of subarrays)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{SineShaper.ar(SinOsc.ar([400, 404], 0, 0.2), MouseX.kr(0, 1))}.play\n\n{SineShaper.ar(SoundIn.ar, MouseX.kr(0, 1)}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{SineShaper.ar(SinOsc.ar([400, 404], 0, 0.2), MouseX.kr(0, 1))}.play\n\n{SineShaper.ar(SoundIn.ar, MouseX.kr(0, 1))}.play\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Env.asStream` do?"}, {"role": "assistant", "content": "Creates a Routine and embeds the Env in it. This allows the Env to function as a"}]} +{"conversations": [{"role": "user", "content": "What does `NumberEditor.guiClass` do?"}, {"role": "assistant", "content": "holds a float value with a spec, editable with a gui"}]} +{"conversations": [{"role": "user", "content": "What is `BufCombC` in SuperCollider?"}, {"role": "assistant", "content": "BufCombC — Buffer based comb delay line with cubic interpolation. Comb delay line with cubic interpolation which uses a buffer for its internal memory. See also BufCombN which uses no interpolation, and BufCombL which uses linear interpolation. Cubic interpolation is more computationally expensive than linear, but more accurate. Category: UGens > Delays > Buffer."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// where did I leave my keys?\n(\nvar n = 30, m = 5;\nNdef.clear(3);\nNdef.ar(\\x, n);\nNdef(\\y, { Splay.ar(Ndef.ar(\\x, m, LFNoise1.kr(1/m).range(0, n - m - 1))).clip2 * 0.5 }).play; \nNdef(\\x, { \n { \n var a = Ndef.ar(\\x, 1, LFNoise0.kr(Rand()) * Rand() + Rand() * n);\n a + 0.1 * SinOsc.ar(ExpRand(0.2, 1000)) \n } ! n\n}); \n);\n\n// where did I put my keys?\n(\nvar n = 30, m = 5;\nNdef.clear(3);\nNdef.ar(\\x, n);\nNdef(\\y, { Splay.ar(Ndef.ar(\\x, m, LFNoise1.kr(1/m).range(0, n - m - 1))).clip2 * 0.5 }).play; \nNdef(\\x, { \n {\n var a = Ndef.ar(\\x, 1, LFNoise0.kr(Rand()) * Rand() + Rand() * n);\n SinOsc.ar(ExpRand(0.2, 1000), a) \n } ! n\n}); \n)\n```"}, {"role": "assistant", "content": "Cross-tuning between multiple signal dimensions. The code is finished without listening."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Blip thru Formlet, pseudo-vocal synthesis that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n// Blip thru Formlet, pseudo-vocal synthesis.\n// hh&adc, since beijing 2005\n// 2019 made quad/MC\n\n// keywords: vocal, voice, formants\n\n/*\nNdef(\\formSing).gui;\nNdef(\\formSing).play;\nNdef(\\formSing).getHalo(\\stepFdev).value;\n*/\nNdef(\\formSing).addSpec(\\root, [20, 500, 6]);\nNdef(\\formSing).addSpec(\\formfrq, [50, 5000, \\exp]);\nNdef(\\formSing).addSpec(\\harm, [1, 256, \\exp]);\nNdef(\\formSing).addSpec(\\formLag, [0.01, 100, \\exp]);\nNdef(\\formSing).addSpec(\\ndiv, [0.01, 1, \\exp]);\nNdef(\\formSing).addSpec(\\fdev, [0, 24, \\amp]);\nNdef(\\formSing).addSpec(\\round, [0, 3, \\amp, 0.05]);\n\n(\n// modulating formant frequency\nNdef(\\formSing, { arg amp=0, root=150, formfrq=500, harm=20, fdev=2, ndiv = 0.2, formLag=0.1, round = 1.5;\n var freqCompare = 1; // ((formfrq / root).log2).abs.min(1).linexp(0, 1, 0.25, 1);\n var in = Blip.ar(\n root.lag(formLag) * LFNoise0.kr(root * ndiv ! q.numChans, fdev.max(0.01) ).midiratio,\n harm.lag(formLag), // .max(formfrq / root * 0.25),\n 0.1\n ) * GrayNoise.ar(0.1 ! q.numChans, 1);\n\n Limiter.ar(Formlet.ar(in, formfrq.lag(formLag), 0.005, 0.02) * (freqCompare * amp.lag(0.1)))\n .softclip;\n});\n);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SpecPcile.kr` do? What arguments does it take?"}, {"role": "assistant", "content": "Find a percentile of FFT magnitude spectrum Arguments: buffer — an FFT chain.; fraction; interpolate; binout."}]} +{"conversations": [{"role": "user", "content": "What does `EventSource.enAr` do?"}, {"role": "assistant", "content": "Implementation of Functional Reactive Programming."}]} +{"conversations": [{"role": "user", "content": "What does `DataBuffer.dataActive` do?"}, {"role": "assistant", "content": "a Boolean flag indicating if data should be buffered or"}]} +{"conversations": [{"role": "user", "content": "What does `ServerLog.filterBySynthDef` do? What arguments does it take?"}, {"role": "assistant", "content": "records OSC traffic to and from a Server and displays this in a browseable searchable interface Arguments: defName. Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Compander` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var z;\n\n // signal (clean)\n z = Decay2.ar(\n Impulse.ar(8, 0, LFSaw.kr(0.3, 1, -0.3, 0.3)),\n 0.001,\n 0.3\n )\n * Mix.ar(Pulse.ar([80, 81], 0.3));\n\n // apply gate (mouse x sets treshold)\n Compander.ar(z, z,\n thresh: MouseX.kr(0.001, 1),\n slopeBelow: 10,\n slopeAbove: 1,\n clampTime: 0.01,\n relaxTime: 0.01\n )\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Speech to midi converter?"}, {"role": "assistant", "content": "SuperCollider forum — Speech to midi converter?\n\nHello!\n\nI want to make a speech to midi converter in Supercollider.\n\nI’ve started off trying to find a way to convert FFT data to midi-numbers to send to a midi-instrument, but I’m stuck:\n\n```supercollider\n~file = Buffer.read(s, \"path_to_file\", bufnum:1);\n\n(\n{\n var buf = Buffer.alloc(s, 2048, bufnum:2);\n var sig = PlayBuf.ar(2, 1, loop:1);\n var chain = FFT(buf, sig);\n var trig = Impulse.kr(30);\n chain[0].pvcalc(80, {\n |phas, mag|\n SendReply.kr(trig, \"/anal\", mag);\n });\n}.play\n);\n\n(\nOSCdef.new(\\midiConverter, {\n |msg|\n msg.postln;\n}, \"/anal\");\n)\n```\n\nthe output looks like this:\n\n[ /anal, 1000, -1, 0.0, 3.0463190078735, 2.1142015457153, -0.64955651760101, 2.3432319164276, -0.23956227302551, -3.1334409713745, -2.1829152107239, 1.1417833566666, -2.2972648143768, -0.74415707588196, -0.88793164491653, 1.9947071075439, -1.1327115297318, 2.6084003448486, etc...]\n\nI’m not sure how to interpret theese numbers. And I’m not sure pvcalc is even the best way to get the data I need. I want to somehow be able to control the resolution on how many of the loudest bins I’m going to convert to frequency and then from frequency to midi-number to send to a midi-instrument as the soundfile plays through.\n\nAny ideas?"}]} +{"conversations": [{"role": "user", "content": "What does `PLwhite.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new PLwhite Arguments: lo — Symbol or Pwhite lo arg. If a Symbol is passed, list can be assigned to an envir variable later on. Can be dynamically replaced by Patterns or Streams. Defaults to 0.; hi — Symbol or Pwhite hi arg. If a Symbol is passed, list can be assigned to an envir variable later on. Can be dynamically replaced by Patterns or Streams. Defaults to 1.; length — Symbol or Pwhite length arg. If a Symbol is passed, list can be assigned to an envir variable later on. Defaults to inf.; envir — Dictionary or one of the Symbols \\top, \\t (topEnvironment), \\current, \\c (currentEnvironment). Dictionary to be taken for variable reference. Defaults to \\current.."}]} +{"conversations": [{"role": "user", "content": "What is `List`?"}, {"role": "assistant", "content": "List — list of items of variable size"}, {"role": "user", "content": "What does `List.new` do?"}, {"role": "assistant", "content": "Creates a List with the initial capacity given by size."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// Create a new empty collections with size 3:\nx = Array.new(3);\ny = Array.new(3);\nz = List.new(3);\n\n// Try to add 7 items to the array and list.\n// If the array exceeds maxSize, it will only\n// grow to an internally specified max size.\n(\n7.do { |i|\n x.add(i);\n y = y.add(i); // reassign array y on each add\n z.add(i);\n};\n);\n\n// Attempt to access the 5th item:\nx.at(4); // -> nil (out of bounds)\ny.at(4); // -> 4\nz.at(4); // -> 4\n\n// x grew only to size 4\nx.postln; // -> [ 0, 1, 2, 3 ]\ny.postln; // -> [ 0, 1, 2, 3, 4, 5, 6 ]\nz.postln; // -> List[ 0, 1, 2, 3, 4, 5, 6 ]\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// play SinOscs silently and wait for granulation envelopes\n\n(\na = Bus.audio(s, 10);\nx = { Splay.ar(In.ar(a, 10) * SinOsc.ar((3..12) * 100, 0, 0.05)) }.play\n);\n\n// send envelope to buses in parallel\n\n(\nz = {\n DXEnvFanOut.ar(\n [0, 3] + Dseq((0..3) + a.index, inf) + Diwhite(0, 3),\n \n // with newer SC versions you can also write:\n // [0, 3] + Dseq((0..3), inf) + Diwhite(0, 3) + a.index,\n \n fadeTime: 0.05,\n width: 1,\n initOutOffset: -0.5\n )\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// play SinOscs silently and wait for granulation envelopes\n\n(\na = Bus.audio(s, 10);\nx = { Splay.ar(In.ar(a, 10) * SinOsc.ar((3..12) * 100, 0, 0.05)) }.play\n);\n\n// send envelope to buses in parallel\n\n(\nz = {\n DXEnvFanOut.ar(\n [0, 3] + Dseq((0..3) + a.index, inf) + Diwhite(0, 3),\n \n // with newer SC versions you can also write:\n // [0, 3] + Dseq((0..3), inf) + Diwhite(0, 3) + a.index,\n \n fadeTime: 0.05,\n width: 1,\n initOutOffset: -0.5\n )\n}.play\n);\n\nx.release;\n\n// cleanup\n\n(\nz.free;\na.free;\n);\n\n\n// Ex.7 from DXEnvFan help looks a bit different,\n// as DXEnvFanOut is an out ugen we don't need to mix\n\n(\na = Bus.audio(s, 4);\n{\n DXEnvFanOut.ar(\n (0..3).collect { |i| Dseq((0..3).rotate(i), inf) } + a.index,\n fadeTime: [0.01, 0.05],\n width: 1\n );\n In.ar(a, 4)\n}.plot(0.2)\n);\n\na.free\n```"}]} +{"conversations": [{"role": "user", "content": "What is `TextView` in SuperCollider?"}, {"role": "assistant", "content": "TextView — A view displaying editable formatted text TextView consists of an area where multi-line text can be typed in and edited. Category: GUI > Views."}]} +{"conversations": [{"role": "user", "content": "What is `Dictionary`?"}, {"role": "assistant", "content": "Dictionary — associative collection mapping keys to values"}, {"role": "user", "content": "What does `Dictionary.new` do?"}, {"role": "assistant", "content": "Creates a Dictionary with an initial capacity for n key value mappings."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nd = Dictionary.new;\nd.add(\\monkey -> 0).postln;\nd.add(\\robot -> 1).postln; // Add robot as a key with a value of 1\nd.add(\\monkey -> 2).postln; // Replaces the value for the key monkey with 2\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Index.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Index into a table with a signal Arguments: bufnum — Index of the buffer.; in — The input signal.; mul — Output will be multiplied by this value.; add — This value will be added to the output.."}]} +{"conversations": [{"role": "user", "content": "Why LeakDC and not a standard HPF for DC removal?"}, {"role": "assistant", "content": "SuperCollider forum — Why LeakDC and not a standard HPF for DC removal?\n\nHello everyone,\n\nI’m a bit sceptical of the DC removal implementation in LeakDC. As I understand it, DC removal is nothing but a HPF, preferably placed below the audible range. For this purpose, LeakDC seems to be reaching far too high, attenuating the audible low frequencies. You can run the following code and look at the server meter to see the difference in level between the two audio channels (note: there is of course no DC offset in this example that would need fixing):\n\n```supercollider\n( play { [\n SinOsc.ar(50),\n LeakDC.ar(SinOsc.ar(50))\n] * 0.2 } )\n```\n\nAlso, LeakDC’s behaviour is not consistent between sample rates (as is mentioned in the help file).\n\nI ran the it through Plugin Doctor to back up my suspicions and got these results:\n\nstandard coefficient of 0.995:\n\nSR 48 kHz: Filter starts rolling off at 200 Hz, -2dB at 50 Hz.\n\nSR 96 kHz: Filter starts rolling off at 500 hz! It reaches already -2dB at 100 Hz, -5 dB at 50 Hz.\n\ncoefficient of 0.999:\n\nSR 48 kHz: Filter starts rolling off at 50 Hz, -2 dB at 10 Hz.\n\nSR 96 kHz: Filter starts rolling off at 100 Hz, -2 dB at 20 Hz.\n\nI wonder why one wouldn’t just use a standard HPF at 10 Hz (or so) instead? It is consistent between sample rates, it only starts to roll of below 30 Hz and it reaches only -0.5 dB at 20 Hz. So this actually looks much better in the server meter:\n\n```supercollider\n( play { [\n SinOsc.ar(50),\n HPF.ar(SinOsc.ar(50), 10)\n] * 0.2 } )\n```\n\nSo my question is: Is there any reason why the LeakDC implementation would be peferable to such a standard butterworth HPF?\n\nOne difference I can see is that the HPF still has an initial offset spike before settling around zero phase, LeakDC does not show that behaviour:\n\n```supercollider\n{ LeakDC.ar(DC.ar(0.5)) }.plot(0.5);\n{ HPF.ar(DC.ar(0.5), 10) }.plot(0.5);\n\n{ LeakDC.ar(SinOsc.ar + DC.ar(0.5)) }.plot(0.02);\n{ HPF.ar(SinOsc.ar + DC.ar(0.5), 10) }.plot(0.02);\n```\n\nSo this could be a reason – I don’t know enough about filters to understand why this happens though. Any enlightenment would be appreciated."}]} +{"conversations": [{"role": "user", "content": "What are you good at?"}, {"role": "assistant", "content": "SuperCollider. I can explain its classes and UGens, write SynthDefs and patches, read a patch back to you, and tell you why one does not compile. I am 198M parameters; I am not a general assistant."}]} {"conversations": [{"role": "user", "content": "How do I play a sample from disk?"}, {"role": "assistant", "content": "Load it into a Buffer on the server, then play the buffer. `BufRateScale` keeps the pitch right when\nthe file's sample rate differs from the server's.\n\n```supercollider\n(\ns.waitForBoot {\n ~buf = Buffer.read(s, \"C:/sounds/break.wav\");\n SynthDef(\\player, { |out = 0, buf = 0, amp = 0.6, rate = 1|\n var sig = PlayBuf.ar(2, buf, BufRateScale.kr(buf) * rate, loop: 1);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n ~player = Synth(\\player, [\\buf, ~buf]);\n};\n)\n```\nUse `numChannels` 1 for a mono file; a mismatch is silent or wrong-sounding rather than an error."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// Initial values - system state y0 at time t0: y(t0) = y0 - are essential for an ODE solution.\n// In this example with the MSD model (and constant f !) time isn't explicit,\n// therefore it makes no difference if we start at t = 0 or t = 10, time is only shifted.\n\n// However the position, described here by y, is time-dependent,\n// so it makes a difference to start with different values\n\n// y'(t) = w(t)\n// w'(t) = (f(t) - (dampen * w(t)) - (spring * y(t))) / mass\n\n(\nx = {\n var f = 0.2, mass = 0.001, spring = 50, dampen = 0.0005,\n\n sig = Fb1_ODE.ar(\\MSD,\n [f, mass, spring\n// …\n```"}, {"role": "assistant", "content": "Initial values - system state y0 at time t0: y(t0) = y0 - are essential for an ODE solution. In this example with the MSD model (and constant f !) time isn't explicit, (Fb1_ODE: general ordinary differential equation integrator pseudo ugen)"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for automatically playback of all soundfiles in a directory."}, {"role": "assistant", "content": "```supercollider\n(\nw = {|pathPattern|\nvar soundFiles;\n// get sounds\nsoundFiles = SoundFile.collect(pathPattern);\n\n// play back in order of their appearance\nPseq(soundFiles.collect{|file| file.cue((\\dur: file.duration))}, 1).play;\n}\n);\n\n// adjust path and evaluate the next line\nw.value(\"/Volumes/usbImport/PMD620/200804062000/*.WAV\")\n```"}]} -{"conversations": [{"role": "user", "content": "What does `KrNumberEditor.makePatchOut` do?"}, {"role": "assistant", "content": "a number box and slider for editing a float value [\\kr rate]"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\ns.boot;\n\n// excitation signal is WhiteNoise, triggered twice a second with varying OnePole coef\n(\n { Pluck.ar(WhiteNoise.ar(0.1), Impulse.kr(2), 440.reciprocal, 440.reciprocal, 10,\n coef: MouseX.kr(-0.999, 0.999))\n }.play(s)\n);\ns.quit;\n// a group of angry fretless mandolin players\n(\n {\n var freq, numparts;\n numparts = 50;\n freq = SinOsc.kr(Array.fill(numparts, { Rand(0.05, 0.2) }),\n Array.fill(numparts, { Rand(0, 1.0) })).range(1000,\n// …\n```"}, {"role": "assistant", "content": "excitation signal is WhiteNoise, triggered twice a second with varying OnePole coef a group of angry fretless mandolin players (Pluck: A Karplus-Strong UGen)"}]} -{"conversations": [{"role": "user", "content": "Explain `FoaMagI` in SuperCollider briefly."}, {"role": "assistant", "content": "FoaMagI — First Order Ambisonic (FOA) Magnitude of Soundfield Complex Intensity Vector Return the Magnitude of Complex Intensity Vector, ||I||, of a first order ambisonic (B-format) signal. Category: Libraries > Ambisonic Toolkit > UGens > FOA > Analyzer, UGens > Multichannel > Ambisonics, UGens > Analysis > Ambisonics."}]} -{"conversations": [{"role": "user", "content": "What is `PrintVal` in SuperCollider?"}, {"role": "assistant", "content": "PrintVal — debug assistance This is sometimes helpful just to check output values- it should post to the Post Window, but don't make it post too often or the CPU use will rise dramatically. Category: UGens > Unclassified //SLUGens released under the GNU GPL as extensions for SuperCollider 3, by Nick Collins, http://composerprogrammer.com/index.html."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\n(\nvar winenv;\n// a custom envelope\nwinenv = Env([0, 1, 0], [0.5, 0.5], [8, -8]);\nz = Buffer.sendCollection(s, winenv.discretize, 1);\n\nSynthDef(\\fm_grain_test, { |out, gate = 1, amp = 1, envbuf|\n var pan, env, freqdev;\n // use mouse x to control panning\n pan = MouseX.kr(-1, 1);\n // use WhiteNoise and mouse y to control deviation from center pitch\n freqdev = WhiteNoise.kr(MouseY.kr(0, 400));\n env = EnvGen.kr(\n Env([0,\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\n(\nvar winenv;\n// a custom envelope\nwinenv = Env([0, 1, 0], [0.5, 0.5], [8, -8]);\nz = Buffer.sendCollection(s, winenv.discretize, 1);\n\nSynthDef(\\fm_grain_test, { |out, gate = 1, amp = 1, envbuf|\n var pan, env, freqdev;\n // use mouse x to control panning\n pan = MouseX.kr(-1, 1);\n // use WhiteNoise and mouse y to control deviation from center pitch\n freqdev = WhiteNoise.kr(MouseY.kr(0, 400));\n env = EnvGen.kr(\n Env([0, 1, 0], [1, 1], \\sin, 1),\n gate,\n levelScale: amp,\n doneAction: Done.freeSelf);\n Out.ar(out,\n GrainFM.ar(2, Impulse.kr(10), 0.1, 440 + freqdev, 200, LFNoise1.kr.range(1, 10),\n pan, envbuf) * env)\n}).add;\n\n);\n\n// use built-in env\nx = Synth(\\fm_grain_test, [\\envbuf, -1])\n\n// switch to the custom env\nx.set(\\envbuf, z)\nx.set(\\envbuf, -1);\n\nx.set(\\gate, 0);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `EnvGate`."}, {"role": "assistant", "content": "```supercollider\na = { LPF.ar(Saw.ar(200), 600) * EnvGate.new }.play;\na.set(\\fadeTime, 2);\na.release;\n\n// the same as:\na.set(\\gate, 0);\n\n// several env gates can coexist in one synth def.\n(\na = {\n var sound1 = LPF.ar(Saw.ar(80), 600) * EnvGate.new;\n var sound2 = RLPF.ar(Saw.ar(200) * 0.5, 6000 * EnvGate.new + 60, 0.1) * EnvGate.new;\n sound1 + sound2\n}.play;\n);\na.set(\\fadeTime, 5);\na.release;\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for redo_minimalish sketch."}, {"role": "assistant", "content": "```supercollider\n//redFrik - redo_minimalish sketch\n(\ns.waitForBoot{\n \n SynthDef(\\p, {|out= 0, freq= 400, amp= 0.1, gate= 1, detune= 0|\n var env= EnvGen.ar(Env.perc(Rand(0.001, 0.01), LinRand(0.2, 0.4), amp, Rand(-9, -1)), doneAction:2);\n var snd= Mix(SinOsc.ar(freq+[0, detune*0.1], env*2pi));\n Out.ar(out, Pan2.ar(snd*env, Rand(-1, 1)));\n }).add;\n Ndef(\\p, Pspawn(Pbind(\\method,\\par,\\delta,1/8,\\pattern,{Pbind(\\instrument, \\p, \\dur,a=Pseq((1..9).sputter),\\sustain,1/8/a,\\degree,a,\\detune,a)})));\n Ndef(\\p).play(vol:0.5);\n \n Ndef(\\t, {\n var mod= Saw.ar([3, 4], Saw.ar(1, 32, 128), Duty.ar(1, 0, flop(Dseq([0, 8, 1, 5])*[1, 4, 8])));\n var snd= SinOsc.ar(Saw.ar(2, 64, 99), mod)/9;\n CombN.ar(snd, 1/4, 1/4.125, SinOsc.kr(0.005, 1.5pi).range(0, 6));\n });\n Ndef(\\t).play(vol:0.5);\n \n Routine.run({\n var cnt= 1;\n loop{\n var syn;\n cnt= cnt%8+1;\n syn= {\n var del= DelayN.ar(InFeedback.ar(0, 2)+(InFeedback.ar(100, 2)), 1, 1);\n SinOsc.ar(cnt*99+[0, 2], del[1..0])/4;\n }.play(outbus: 64);\n {syn.release(16)}.defer(9-cnt);\n wait(9-cnt);\n };\n });\n Ndef(\\c, {InFeedback.ar(64, 2)}).play(vol:0.5);\n \n Ndef(\\r, {\n var lfos= LFNoise1.ar(0.5!2);\n var snd= Crackle.ar(lfos.range(1.8, 1.98));\n Formlet.ar(snd, TExpRand.ar(200, 2000, lfos).lag(2), lfos.range(5e-4, 1e-3), 0.0012);\n });\n Ndef(\\r).play(vol:0.25);\n \n Routine.run({\n loop{\n var syn= {\n var snd= Pluck.ar(Crackle.ar([1.9, 1.8]), Mix(Impulse.ar({5.linrand+1}!2, -0.125)), 0.05, 0.05.linrand);\n BPF.ar(snd, 2000.rand+100, 0.25.rrand(1.75));\n }.play(s, 62, 18);\n {syn.release(69)}.defer(18);\n wait(18);\n };\n });\n Ndef(\\m, {InFeedback.ar(62, 2)*SinOsc.kr(0.006).range(0.25, 1)}).play(vol:0.5);\n \n NdefMixer(s);\n s.meter;\n};\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `SmoothFoldQ` in SuperCollider briefly."}, {"role": "assistant", "content": "SmoothFoldQ — wave folding pseudo ugen using parabolic segments Wave folding using SmoothClipQ. Values outside the range lo-hi are folded back, if foldRange > 0. A larger foldRange means less folding whereas a smaller foldRange causes more folding. The spectral result depends on the source wave form also but in general a smaller foldRange causes more energy in the higher spectrum whereas near foldRange == 0 the higher part of the spectrum again decreases. Note Category: Libraries > miSCellaneous > WaveFolding."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Cleanroom (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n~t = 1; TempoClock.default.tempo = ~t;\n(\nSynthDef(\\ambifall3, { arg out=0, gate=1, amp=0.1, pan=0, freq=200;\n var sig;\n //thisThread.randSeed = 1923;\n\n sig = SinOsc.ar(freq);\n sig = Pan2.ar(sig, pan, amp);\n sig = ( WhiteNoise.ar + 0.8 ) * LFSaw.ar({ exprand(10.0,10000) }!20 * ( 1 + ( SinOsc.ar((1..4).rand(0.0)/18 * XLine.kr(1,121200,80)) * 1/41 * XLine.kr(1,0.1,60) )));\n sig = DelayC.ar(sig, 0.2, {rrand(1/5,1/10000) * ( 1 + ( SinOsc.ar((1..2).rand(0.0)/18 * XLine.kr(42,11200,60)) * 1/41 * XLine.kr(1,180,60) ))}!4) + sig / 2;\n sig = DelayC.ar(sig, 0.2, {rrand(1/5,1/10000) * XLine.kr(1/1000,1/20001,14)}!4) + sig / 2;\n sig = sig + BPF.ar(\n sig, \n { ( exprand(100.0,10000) * LFNoise1.ar(1/100.0.rand).range(1,2) ).clip(20,20000) }!10,\n { ( rand(0.01,1) * LFNoise1.ar(1/100.0.rand).range(1,2) ).clip(0.01,1) }!10\n );\n sig = BRF.ar(\n sig, \n { ( exprand(100.0,10000) * LFNoise1.ar(1/100.0.rand).range(1,2) ).clip(20,20000) }!10,\n { ( rand(0.01,1) * LFNoise1.ar(1/100.0.rand).range(1,2) ).clip(0.01,1) }!10\n );\n sig = LeakDC.ar(sig);\n sig = LPF.ar(sig, 17000 * XLine.kr(1,1/100,4));\n sig = sig * 5 * 3;\n sig = sig.mean;\n //sig = sig.clip;\n //sig = Compander.ar(sig, sig, \\cpt.kr(0.4), \\cpbelow.kr(1.001), \\cpabove.kr(0.009), \\cpclamp.kr(0.01), \\cprelax.kr(0.1));\n sig = Limiter.ar(sig, 1);\n sig = sig * EnvGen.kr(\\adsr.kr(Env.adsr(0.1,0.1,0.8,4.1)), gate, doneAction:2);\n sig = sig * amp;\n Out.ar(out, sig);\n}).add;\n);\n(\nPdef(\\part, Pdef(\\ambifall3, \n Ppar([\n Pseq([\n Pmono(\\ambifall3,\n \\freq, 2,\n \\dur, Pseq([1],4),\n \\amp, 0.1,\n ),\n Event.silent(4),\n ],inf),\n ])\n)).play;\n);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Gbman2DC.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "gingerbreadman map 2D chaotic generator Arguments: minfreq, maxfreq — iteration frequency in Hertz; x0 — initial value of x; y0 — initial value of y."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n//var board= CytonSerial(\"/dev/tty.usbserial-DM00DRM0\", initAction: {|b| b.start});\nvar board= PlaybackData(\"~/Desktop/OpenBCI-RAW-2019-04-10_19-04-26.txt\", initAction: {|b| b.start});\n~board= board;\n);\n\n~board.currentTime; //time in file\n\n~board.accelAction= {|xyz| xyz.postln}; //start posting recorded accelerometer data\n\n~board.stop;\n~board.start;\n~board.close;\n```"}, {"role": "assistant", "content": "var board= CytonSerial(\"/dev/tty.usbserial-DM00DRM0\", initAction: {|b| b.start}); (PlaybackData: for playing back data from a file)"}]} -{"conversations": [{"role": "user", "content": "What does `HilbertH.calcRealCoeffs` do? What arguments does it take?"}, {"role": "assistant", "content": "Generate real Arguments: size — The size of the kernel used for Hartley Phasing filtering.."}]} -{"conversations": [{"role": "user", "content": "What does `SCButtonAdapter.initOneState` do? What arguments does it take?"}, {"role": "assistant", "content": "parent class for Button classes Arguments: name; textcolor; backcolor."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for some pattern exprimenting."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\brumm, { |dur = 1, pan = 2, freq = 40, index = 20|\n var sig = Pan2.ar(\n Blip.ar(freq, index),\n pan\n ) * EnvGen.ar(Env.perc(0.01, dur), doneAction: 2);\n Out.ar(0, sig);\n}).add;\n);\n\n(\nPbind(*[\n dur: Pseq([1.2, 0.2, 0.5, Pseries(0.1, -0.001, 100)], inf),\n pan: Pxrand(#[-0.5, 0.5, 0.1, -0.1, 0.8, -1], inf),\n freq: 40,\n instrument: \\brumm\n]).play();\n);\n\n(\nPbind(*[\n dur: Pseq([1.2, 0.2, 0.5, Pseries(0.1, -0.001, 100)], inf),\n pan: Pxrand(#[-0.5, 0.5, 0.1, -0.1, 0.8, -1], inf),\n freq: Pseq([Pseries(140, 0.5, 200)], inf),\n instrument: \\brumm\n]).play;\n);\n\n(\nPbind(*[\n dur: Pseq(Signal.chebyFill(1024, Array.rand(10, 0.0, 10.0)).abs + 0.05, inf),\n pan: Pxrand(#[-0.5, 0.5, 0.1, -0.1, 0.8, -1], inf),\n freq: Pseq(Signal.chebyFill(1024, Array.rand(10, 0.0, 10.0)).abs * 18000 + 120, inf),\n instrument: \\brumm\n]).play;\n);\n\n\n(\nPbind(*[\n dur: Pseq([1.2, 0.2, 0.5, Pseries(0.1, -0.002, 50)], inf),\n pan: Pxrand(#[-0.5, 0.5, 0.1, -0.1, 0.8, -1, 1, -0.8], inf),\n freq: Pseq([Pseries(740, 0.5, 200), Pxrand(Array.series(740, 0.5, 200), 50)], inf),\n instrument: \\brumm\n]).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for imitation of a ship's horn."}, {"role": "assistant", "content": "```supercollider\n(\n// by Nóslo Tredamus //\nSynthDef(\\Bocina3, {\n\n arg freq = 200, out = 0, amp = 1, gate = 1, bend = 21, relTime = 0.05, pitchRelTime = 0.015;\n var sig, env, mod, noise, pitchEnv;\n\n env = EnvGen.kr(Env.asr(0.1, 1, relTime), gate, doneAction: 0);\n pitchEnv = EnvGen.kr(\n Env(\n levels: [freq - bend, freq, freq, freq - bend],\n times: [0.3, 0, pitchRelTime],\n curve: [\\sine, 0, -8],\n releaseNode: 2\n ),\n gate\n );\n\n mod = LFNoise1.kr(3).exprange(pitchEnv * 1.5, pitchEnv * 3);\n sig = Mix([\n Saw.ar(pitchEnv, mul: amp),\n SinOsc.ar(pitchEnv * 2.098, mul: amp * 0.3),\n SinOsc.ar(pitchEnv * 2.3814, mul: amp * 0.3),\n SinOsc.ar(pitchEnv * 0.996, mul: amp * 0.3),\n Saw.ar(pitchEnv * 1.015, mul: amp * 0.8),\n Saw.ar(pitchEnv * 1.1907, mul: amp * 0.7),\n SinOsc.ar(pitchEnv * 1.503, mul: amp * 0.7),\n Saw.ar(pitchEnv * 0.498, mul: amp)\n ]);\n\n noise = PinkNoise.ar(amp * 0.9) * env;\n sig = sig + noise;\n sig = HPF.ar(sig, freq * 0.5);\n sig = LPF.ar(sig, mod);\n sig = sig * env;\n sig = GVerb.ar(sig, roomsize: 300, revtime: 0.6, drylevel: 1, mul: 0.9);\n sig = Limiter.ar(sig, 0.99);\n DetectSilence.ar(sig, amp: 0.001, time: 0.05, doneAction: 2);\n Out.ar(out, sig);\n}).add;\n);\n~claxon3 = Synth(\\Bocina3);\n~claxon3.set(\\gate, 0);\ns.record;\ns.stopRecording;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Sieve.&` do? What arguments does it take?"}, {"role": "assistant", "content": "Binary operator for instance method sect. Creates a new Sieve object in mode 'points', generated by the intersection of the receiver and a Arguments: gen — A generator. Allowed generators: Integers, Streams or Patterns producing intervals or Sieves itself. Integers and Stream/Pattern output must be strictly positive. Integers as generators produce zero and its positive multiples. Returned integers might go up to default limit 65536.."}]} -{"conversations": [{"role": "user", "content": "What is `Pseed` in SuperCollider?"}, {"role": "assistant", "content": "Pseed — set the random seed in subpattern Set the random generator seed of the resulting stream. Category: Streams-Patterns-Events > Patterns > Language Control."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nSynthDef(\"additivePad\", \n { arg numOfCycles = 100;\n var lfo;\n var lfo2;\n var lfo3;\n lfo = SinOsc.kr([Rand(0.5,1000),Rand(0.5,1000)], 1.5pi, 0.5, 0.5);\n lfo3 = SinOsc.kr([Rand(0.1,0.5),Rand(0.1,0.5)], 1.5pi, 0.5, 0.5);\n lfo2 = SinOsc.kr([(Rand(0.5,1000) * lfo) * lfo3, (Rand(0.5,1000) * (1 - lfo)) * (1 - lfo3)], 1.5pi, 0.5, 0.5);\n Out.ar(\n 0, \n Mix.arFill(\n numOfCycles,\n { \n SinOsc.ar(\n Rand(40,1000),\n 0, \n (numOfCycles.reciprocal * 0.75) * lfo2)\n }\n ) * EnvGen.kr(Env.perc(Rand(0.1,30), Rand(0.1,30)), doneAction: 2)\n )\n }\n).send(s); \n);\n\n(\nr = Routine({\n 200.do({\n x = Synth.new(\"additivePad\"); \n 10.wait;\n });\n});\n);\n\nr.play;\n```"}, {"role": "assistant", "content": "Just going crazy with modulation. Sample is available here: http://soundcloud.com/schemawound/schemawound-dawn-demo-version."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nc=13;a=Array.fib(64,0,1);b=Array.fill(size:c,function:{arg i;a[i]%12});\np=1/(21-c);Pdef(\\x,Pbind(\\dur,p,\\degree,Pseq(b,1,0)));\nr=Array.fill(c,{arg i;Pbindf(Pdef(\\x),\\mtranspose,1-b[i]);});\nPseq(r,(1/p)).play;\n)\n```"}, {"role": "assistant", "content": "Wow ! the conciseness of SuperCollider is wonderful !\r\nWe can make many attractive melodies !."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// wait\n\n(\nvar r;\nr = Routine {\n 10.do({ |a|\n a.postln;\n // Often you might see Wait being used to pause a routine\n // This waits for one second between each number\n 1.wait;\n });\n // Wait half second before saying we're done\n 0.5.wait;\n \"done\".postln;\n}.play;\n)\n```"}, {"role": "assistant", "content": "Often you might see Wait being used to pause a routine This waits for one second between each number (Routine: Functions that can return in the middle and then resume where they left off)"}]} -{"conversations": [{"role": "user", "content": "What is a UGen?"}, {"role": "assistant", "content": "A UGen is a unit generator: the primitive signal-processing node of the server. SinOsc, Saw, WhiteNoise, LPF and EnvGen are UGens, and they are wired into a graph inside a SynthDef."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Modes, scales, keys (tonal music) inside Pbinds."}, {"role": "assistant", "content": "```supercollider\n// MODES, SCALES, KEYS inside Pbinds\n\n// How to write Pbinds in a specific key, for example G minor\n// (using \\scale and \\degree inside Pbind)\n\n(\nPbind(\n \\scale, Scale.minor, // natural minor scale\n \\degree, Pseq([0, 1, 2, 3, 4, 5, 6s, 7, 8, 9, 10, 11]), // s for sharp, b for flats as needed\n \\root, 7, // 0 is C, 1 is C#, etc. For G minor, we put the root at 7 (seven semitones above C)\n \\dur, 1/2\n).play\n);\n\n// \\degree considers 0 to be the first scale degree.\n// If you prefer to think of 1 as the first scale degree (like in \"movable do\" solfege), simply add -1 to the end of the line.\n// The example below is in Eb Major\n(\nPbind(\n \\scale, Scale.major,\n \\degree, Pseq([1, 2, 3, 4, 5, 6, 7, 8]) - 1,\n \\root, 3, // Eb Major\n \\dur, 1/2\n).play\n);\n\n// F Mixolydian #4\n(\nPbind(\n \\scale, Scale.mixolydian,\n \\degree, Pseq([1, 2, 3, 4s, 5, 6, 7, 8], 3) - 1,\n \\root, 5, // F mixolydian with #4\n \\dur, 1/4\n).play\n);\n\nScale.directory;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{var n= 1024; WaveletDaub.ar(SoundIn.ar, n, MouseX.kr(0,n))}.play\n\n{var n= 1024; WaveletDaub.ar(Saw.ar(MouseY.kr(50,10000, 'exponential'),0.5), n, MouseX.kr(0,n)}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{var n= 1024; WaveletDaub.ar(SoundIn.ar, n, MouseX.kr(0,n))}.play\n\n{var n= 1024; WaveletDaub.ar(Saw.ar(MouseY.kr(50,10000, 'exponential'),0.5), n, MouseX.kr(0,n))}.play\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for vinil 10."}, {"role": "assistant", "content": "```supercollider\n// vinil 10\n// Esta cosa tiene un delay de maximo 10 segundos. La posicion X controla el tiempo de delay.\n// nos permite hacer una especie de 'scratch' como el de los djs con lo que entra por el mic\n(\nSynthDef.new(\"vinil10\", {arg gain=2; var in, delay;\n in = SoundIn.ar(0,mul:gain);\n delay = DelayL.ar(in!2,10,MouseX.kr(0,10))!2;\n Out.ar(0,delay)\n}).add;\n);\n\na = Synth(\"vinil10\");\n\na.free // libera (desactiva) el oscilador\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ProxySpace`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\np = ProxySpace.new;\np.fadeTime = 2; // fadeTime specifies crossfade\np[\\out].play; // monitor an empty placeholder through hardware output\n// set its source\np[\\out] = { SinOsc.ar([350, 351.3], 0, 0.2) };\np[\\out] = { Pulse.ar([350, 351.3] / 4, 0.4) * 0.2 };\np[\\out] = Pbind(\\dur, 0.03, \\freq, Pbrown(0, 1, 0.1, inf).linexp(0, 1, 200, 350));\n\n// route one proxy through another:\np[\\out] = { Ringz.ar(p[\\in].ar, [350, 351.3] * 8, 0.2) * 4 };\np[\\in] = { Impulse.ar([5, 7]/2, [0, 0.5]) };\n\np.clear(3); // clear after 3 seconds\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes morning on Gliese 667Cb."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var gen = { rrand(1,10).reciprocal };\n BPF.ar(\n SelectX.ar(LFNoise2.kr(gen!4).exprange(0.02,2), [BrownNoise.ar, WhiteNoise.ar, PinkNoise.ar]).mean,\n LFNoise2.ar(gen!8).exprange(20,2e4),\n LFNoise2.ar(gen!8).exprange(0.1,2),\n LFNoise2.ar(gen!8).range(0.1,1)\n ).clump(2).mean\n + FreeVerb.ar(\n LFPar.ar(\n LFNoise2.ar(gen!8).exprange(20,2e4) * SinOsc.ar(1/gen!8).exprange(1,1.2), 0,\n LFNoise2.ar(gen!8).exprange(0.08,0.5) * EnvGen.ar(\n Env.perc.blend(Env.sine, LFNoise2.kr(gen!8)).circle, \n timeScale: gen!8 // LFNoise2.ar(gen!8).range(1/5, 5)\n )\n ).clump(2).mean,\n LFNoise2.ar(1/5)\n ) \n + Pan2.ar(\n Pluck.ar(\n WhiteNoise.ar ! 2,\n Dust.ar(LFNoise2.kr(gen!2).exprange(1/5,5)), \n 1/200, LFNoise2.kr(gen!2).exprange(1/14000,1/200),\n LFNoise2.kr(gen!2).range(1,10),\n LFNoise2.kr(gen!2).range(0,1),\n LFNoise2.kr(gen!2).exprange(0.2,1)\n ),\n LFNoise2.kr(gen!2).range(-1,1)\n ).sum\n / 3;\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `EZGui.prMakeView` do?"}, {"role": "assistant", "content": "Called by init. Returns `[view, bounds]`. The container is either the enclosing Container, or a pop up window with a"}]} -{"conversations": [{"role": "user", "content": "Explain `SClusterFrequencies` in SuperCollider briefly."}, {"role": "assistant", "content": "SClusterFrequencies — control SCluster frequencies Frequency control for LINKClasses/SCluster. Category: SInstruments."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nSynthDef(\\madtraffic, {|out, sig, gate=1, freq=440|\n // doneAction: 2 rilascia la synth quando EvnGen ha finito\n sig = (Blip.ar(freq)*0.7+Blip.ar(freq/2+Rand(1,12))*0.7)\n*EnvGen.kr(Env.asr(0.1, 0.3, 0.3), gate, doneAction:2);\n sig = RLPF.ar(sig,SinOsc.kr(0.3, 0, 200, 1500), 0.1);\n sig = FreeVerb.ar(sig, 0.5, 0.5, 0.5);\n Out.ar(out, sig);\n\n}).add;\n);\n\n(\nPbind(\n \\instrument, \\madtraffic,\n \\freq, Pseq([137, 373, Prand([237, 473, 713],1)], inf),\n \\legato, Pseq([1.7, 0.3], inf),\n \\dur, 0.3,\n \\out, Pseq([1, 0], inf)\n).play;\n)\n```"}, {"role": "assistant", "content": "\"It's the lack of eye contact that makes us more idiots, to the point that convertible riders give less to escalation. Closed in the car, explain the psychologists, we regress to childhood and react by shouting, or with that surrogate of the shock that is the horn.\"\r\n\r\n\r\n\r\nhttp://bz-buzz.blogspot.com/2018/09/mad-traffic.html\r\n\r\nhttp://bzakirasantjago.blogspot.it/."}]} +{"conversations": [{"role": "user", "content": "Write a plucked string in SuperCollider."}, {"role": "assistant", "content": "Pluck is a Karplus-Strong string: a noise burst into a tuned delay with feedback. The delay time is\nthe reciprocal of the frequency.\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 220, amp = 0.5, dur = 3|\n var period = freq.reciprocal;\n var sig = Pluck.ar(WhiteNoise.ar(0.2), Impulse.kr(0), period, period, dur, 0.5);\n Out.ar(out, Pan2.ar(sig * amp, 0));\n}).add;\n);\nSynth(\\pluck, [\\freq, 330, \\dur, 4]);\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `LPCAnalyzer` in SuperCollider briefly."}, {"role": "assistant", "content": "LPCAnalyzer — Live Linear Predictive Coding Analysis and Resynthesis Linear predictive coding analysis on any arbitrary input signal. The spectrum of the input signal is modeled, and used to filter the source. This works most successfully if the source is spectrally flat to begin with, ie, an impulse train ( Impulse UGen ) or white noise ( WhiteNoise UGen ). Category: UGens > Analysis."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LorenzL`."}, {"role": "assistant", "content": "```supercollider\n// randomly modulate params\n(\n{ LorenzL.ar(\n SampleRate.ir,\n LFNoise0.kr(1, 2, 10),\n LFNoise0.kr(1, 20, 38),\n LFNoise0.kr(1, 1.5, 2)\n) * 0.2 }.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Saw`."}, {"role": "assistant", "content": "```supercollider\n// modulating the frequency\n\n{ Saw.ar(XLine.kr(40, 4000, 6), 0.2) }.play;\n\n// two band limited sawtooth waves through a resonant low pass filter\n\n{ RLPF.ar(Saw.ar([100, 250], 0.1), XLine.kr(8000, 400, 5), 0.05) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for some kick drums i wrote back in january: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\kick1, {\n var snd;\n snd = DC.ar(0);\n snd = snd + (SinOsc.ar(XLine.ar(800, 400, 0.01)) * Env.perc(0.0005, 0.01).ar);\n snd = snd + (BPF.ar(Hasher.ar(Sweep.ar), XLine.ar(800, 100, 0.01), 0.6) * Env.perc(0.001, 0.02).delay(0.001).ar);\n snd = snd + (SinOsc.ar(XLine.ar(172, 50, 0.01)) * Env.perc(0.0001, 0.3, 1, \\lin).delay(0.005).ar(2));\n snd = snd.tanh;\n Out.ar(\\out.kr(0), Pan2.ar(snd, \\pan.kr(0), \\amp.kr(0.1)));\n}).add;\n);\n\nSynth(\\kick1, [amp: 0.4]);\n\n(\nSynthDef(\\kick2, {\n var snd;\n snd = DC.ar(0);\n snd = snd + (HPF.ar(Hasher.ar(Sweep.ar), 1320) * Env.perc(0.003, 0.03).ar * 0.5);\n snd = snd + (SinOsc.ar(XLine.ar(750, 161, 0.02)) * Env.perc(0.0005, 0.02).ar);\n snd = snd + (SinOsc.ar(XLine.ar(167, 52, 0.04)) * Env.perc(0.0005, 0.3).ar(2));\n snd = snd.tanh;\n Out.ar(\\out.kr(0), Pan2.ar(snd, \\pan.kr(0), \\amp.kr(0.1)));\n}).add;\n);\n\nSynth(\\kick2, [amp: 0.4]);\n\n(\nSynthDef(\\kick3, {\n var snd;\n snd = DC.ar(0);\n snd = snd + (SinOsc.ar(XLine.ar(1500, 800, 0.01)) * Env.perc(0.0005, 0.01, curve: \\lin).ar);\n snd = snd + (BPF.ar(Impulse.ar(0) * SampleRate.ir / 48000, 6100, 1.0) * 3.dbamp);\n snd = snd + (BPF.ar(Hasher.ar(Sweep.ar), 300, 0.9) * Env.perc(0.001, 0.02).ar);\n snd = snd + (SinOsc.ar(XLine.ar(472, 60, 0.045)) * Env.perc(0.0001, 0.3, curve: \\lin).delay(0.005).ar(2));\n snd = snd.tanh;\n Out.ar(\\out.kr(0), Pan2.ar(snd, \\pan.kr(0), \\amp.kr(0.1)));\n}).add;\n);\n\nSynth(\\kick3, [amp: 0.4]);\n\n\n/*\ncontributors so far: nathan ho\n\ni use Hasher.ar(Sweep.ar) as a quick way to generate deterministic white noise, so i can get exactly the same kick each time for a precise digital sampler effect. you are free to replace it with WhiteNoise.ar.\n\nthe DC.ar(0) does nothing, it's just so i can reorder all the \"snd = snd +\" lines and/or comment out parts of the synth.\n\nsome of the attacks are so fast that Env:kr doesn't correctly handle them. that's why i always use Env:ar, so i don't have to think about ar/kr when i'm messing with sharp envelope attacks. i'm sure many of them could be refactored to kr for CPU, but idc\n*/\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `NdefGui`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\np = ProxySpace.push(s.boot);\n\nl = NdefGui(nil, 3).moveTo(10, 120);\nm = NdefGui(nil, 3).moveTo(10, 240);\nn = NdefGui(nil, 3).moveTo(10, 360);\no = NdefGui(nil, 3).moveTo(10, 480);\n\nSpec.add(\\dens, [0.1, 300, \\exp]);\n\n// make 3 kinds of proxies: using tilde/proxyspace, Ndef, and unnamed.\n~spacy = { |dens = 5| Formlet.ar(Dust.ar(dens ! 2), LFDNoise0.kr(20 ! 2).lag(0.1).linexp(-1, 1, 300, 5000), 0.003, 0.03) };\nNdef(\\ndeffy, { GrayNoise.ar(0.1 ! 2) });\nc = NodeProxy.audio.source_({ PinkNoise.ar(0.1 ! 2) });\n\n// put one in each editor\nl.object_(~spacy);\nm.object_(Ndef(\\ndeffy));\nn.object_(c);\n);\n// One should also be able to drag and drop text into the drag,\n// but this is also not working yet.\n( Ndef(\\a) )\n```"}]} +{"conversations": [{"role": "user", "content": "What does `FixNumChannelsPlayer.new` do? What arguments does it take?"}, {"role": "assistant", "content": "a utility Player that wraps another player with NumChannels Arguments: subject; numChannels."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PLbindef`."}, {"role": "assistant", "content": "```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n// synthdefs to play with\n\n(\nSynthDef(\\noise_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, rq = 0.1, amp = 0.1|\n var sig = { WhiteNoise.ar } ! 2;\n sig = BPF.ar(sig, freq, rq) *\n EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2) *\n (rq ** -1) * (250 / (freq ** 0.8));\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\sin_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { SinOsc.ar(freq, Rand(0, 2pi)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\saw_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { VarSaw.ar(freq, Rand(0, 1)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nSynthDef(\\Synth3,\n {arg ress = 0;\n var klank, env;\n klank = Klank.ar(`[{Rand(70,21000)}!7, {Rand(0.128,0.700)}!7],BrownNoise.ar(0.7));\n klank = klank;\n env = EnvGen.kr(Env.perc(0.07, ress), doneAction:2);\n Out.ar(0, klank*env.dup*0.0128);\n}).add;\n)\n\n\n{inf.do{x = rrand(0.01,0.7); Synth(\\Synth3, [\\ress, x+(7*x)]); x.wait;}}.fork\n```"}, {"role": "assistant", "content": "Play around with {Rand(70, 21000)}!7\r\n\r\nA simple example for the begginers... hope I can contribute to something =)."}]} +{"conversations": [{"role": "user", "content": "What is `RedGUI` in SuperCollider?"}, {"role": "assistant", "content": "RedGUI — base class of gui wrappers This class is an abstract class and only creates a skin at `*initClass`. Category: Red > redGUI."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n EnvGen.kr(\n Env.new([0.001, 1, 0.5, 0], [0.01, 0.3, 1], -4, 2, nil),\n Impulse.kr(10)\n ) * SinOsc.ar(440, 0, 0.1)\n}.play;\n);\n\n(\n{\n EnvGen.kr(\n Env.perc(0.1, 0.0, 0.5, 1, \\welch),\n Impulse.kr(100),\n timeScale: 0.1\n ) * SinOsc.ar(440, 0, 0.3)\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n EnvGen.kr(\n Env.new([0.001, 1, 0.5, 0], [0.01, 0.3, 1], -4, 2, nil),\n Impulse.kr(10)\n ) * SinOsc.ar(440, 0, 0.1)\n}.play;\n);\n\n(\n{\n EnvGen.kr(\n Env.perc(0.1, 0.0, 0.5, 1, \\welch),\n Impulse.kr(100),\n timeScale: 0.1\n ) * SinOsc.ar(440, 0, 0.3)\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Rand`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-Rand\", { |out = 0|\n Out.ar(out,\n FSinOsc.ar(\n Rand(200.0, 400.0),\n 0, Line.kr(0.2, 0, 1, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n(\nRoutine({\n 8.do({\n Synth.new(\"help-Rand\"); 1.0.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `PlayerInputProxy.ar` do?"}, {"role": "assistant", "content": "placeholder for Patch inputs for a player that will be supplied later"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DelayC`."}, {"role": "assistant", "content": "```supercollider\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nDelayC.ar(z, 0.2, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\n(\n// recursive application of delay.\n{\nz = Decay2.ar(Dust.ar(1, 0.5), 0.01, 0.1, Saw.ar(100 + [0, 1]));\n5.do { |i| z = DelayC.ar(RLPF.ar(z, Rand(100, 3000), 0.03), 1, 1 / (2**i), 1, z * 0.5) };\nz\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Object`?"}, {"role": "assistant", "content": "Object — abstract superclass of all objects"}, {"role": "user", "content": "What does `Object.readArchive` do?"}, {"role": "assistant", "content": "Read in an object from a text archive. `(`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// embedding an event\na = (z: 77);\nb = Pset(\\y, 8, a.streamArg(true)).asStream;\nc = Pset(\\y, 8, a.streamArg(false)).asStream;\nb.nextN(3, ()); // this ends\nc.nextN(3, ()); // this loops\n\n// embedding a pattern\na = Pbind(\\note, Pseq([1, 2]));\nb = Pset(\\y, 8, a.streamArg(true)).asStream;\nc = Pset(\\y, 8, a.streamArg(false)).asStream;\nb.nextN(3, ()); // this ends\nc.nextN(3, ()); // this ends, too\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Lorenz2DL.ar(11025, 44100) }.play(s);\n\n// randomly modulate params\n(\n{ Lorenz2DL.ar(\n 11025, 44100,\n LFNoise0.kr(1, 2, 10),\n 20,\n LFNoise0.kr(1, 1.5, 2),\n 0.02\n) * 0.2 }.play(s);\n)\n\n// as a frequency control\n{ SinOsc.ar(Lorenz2DL.ar(40, 80, h:0.02)*800+900)*0.4 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Lorenz2DL.ar(11025, 44100) }.play(s);\n\n// randomly modulate params\n(\n{ Lorenz2DL.ar(\n 11025, 44100,\n LFNoise0.kr(1, 2, 10),\n 20,\n LFNoise0.kr(1, 1.5, 2),\n 0.02\n) * 0.2 }.play(s);\n)\n\n// as a frequency control\n{ SinOsc.ar(Lorenz2DL.ar(40, 80, h:0.02)*800+900)*0.4 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `AbstractConsole.layout` do?"}, {"role": "assistant", "content": "abstract parent class for the console widgets"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// per convention keys after \\dur are the ones to be set\n// playing ends after end of last stream\n\n(\np = PmonoPar([\n [\n \\dur, 1.0,\n \\pan, Pser([-0.9, 0, 0.9], 8) \n ],[\n \\dur, 0.4,\n \\freq, Pexprand(300, 1000, 24) \n ],[\n \\dur, 0.2,\n \\amp, Pseq([0.05, 0.3], 30) \n ]\n]).trace.play;\n)\n```"}, {"role": "assistant", "content": "per convention keys after \\dur are the ones to be set playing ends after end of last stream (PmonoPar: monophonic event pattern for an arbitrary number of timed setting streams)"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for seasonal reflections ) that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n(\nfork { loop { \n Ndef(\\winter_curves, {\n var bands = 5.rrand(15) * 2;\n var freqs = Array.exprand(bands.debug('bands'), 20, 18000);\n Pan2.ar(\n SinOsc.ar(\n freqs, \n Array.rand(bands, 0, pi),\n AmpCompA.kr(freqs, freqs.sort.first)\n ).perform(0.5.coin.if(\\tanh,\\value).debug('kind')),\n FSinOsc.kr(\n Array.exprand(bands, 0.01, 15),\n Array.rand(bands, 0, pi),\n ),\n bands.reciprocal\n * LFGauss.kr(SinOsc.kr(Array.rand(bands, 0.05, 0.1)).range(1,10), 0.3)\n * FSinOsc.kr(\n Array.exprand(bands, 0.1, 15),\n 0.3\n ).range(0,1)\n ).sum\n * SelectX.kr(\n FSinOsc.kr(Array.exprand(bands, 0.1, 15)).range(0,1),\n [\n EnvGen.kr(\n Env.perc(\n FSinOsc.kr(1/16).range(0.01,0.1),\n FSinOsc.kr(1/8).range(0.25,0.3)\n ).blend(\n Env.sine( // 1/4\n FSinOsc.kr(Array.exprand(bands, 0.1, 15)).range(0.05,2)\n ).blend(\n Env.sine(1/4),\n FSinOsc.kr(Array.exprand(bands, 0.1, 15)).range(0.05,2).mean\n ),\n FSinOsc.kr(Array.exprand(bands, 0.1, 15)).range(0,1)\n ).circle,\n 1, 0.8, \n FSinOsc.kr(freqs.linlin(20,18000,0.1,20)).range(0, 0.2).mean\n ),\n 1\n ]\n ).clump(2).mean\n }).fadeTime_(0.5.rrand(2.5)).play;\n 8.rrand(30).debug('len').wait;\n} }\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `RecordBuf`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\nb = Buffer.alloc(s, s.sampleRate * 5, 1); // a 5 second 1 channel Buffer\n\n// record for four seconds\n(\nx = SynthDef(\"tutorial-RecordBuf\",{ arg out=0,bufnum=0;\n var noise;\n noise = PinkNoise.ar(0.3); // record some PinkNoise\n RecordBuf.ar(noise, bufnum); // by default this loops\n}).play(s,[\\out, 0, \\bufnum, b]);\n);\n\n// free the record synth after a few seconds\nx.free;\n\n// play it back\n(\nSynthDef(\"tutorial-playback\",{ arg out=0,bufnum=0;\n var playbuf;\n playbuf = PlayBuf.ar(1,bufnum);\n FreeSelfWhenDone.kr(playbuf); // frees the synth when the PlayBuf has played through once\n Out.ar(out, playbuf);\n}).play(s,[\\out, 0, \\bufnum, b]);\n);\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `MIDIdef.cc` do?"}, {"role": "assistant", "content": "A convenience method to create a new MIDIdef which responds to MIDI control messages. See #*new for argument Returns: An instance of MIDIdef which responds to MIDI control messages."}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ LPF.ar(Saw.ar(100), SinOsc.kr(0.5).exprange(200, 2000)) * 0.2 }.play;\n```"}, {"role": "assistant", "content": "A sawtooth through a low-pass filter whose cutoff is swept slowly up and down — a classic filter\nsweep.\n\n- `Saw.ar(100)` is a 100 Hz sawtooth, rich in harmonics.\n- `SinOsc.kr(0.5)` is a control-rate sine at 0.5 Hz, so one full cycle takes 2 seconds.\n- `.exprange(200, 2000)` maps that -1..1 sine exponentially onto 200..2000 Hz — exponential is the right\n mapping for frequency, because we hear pitch logarithmically.\n- `LPF.ar(sig, cutoff)` removes harmonics above the cutoff; as it opens and closes you hear the tone\n brighten and darken.\n- `* 0.2` keeps the output from clipping."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Symbol`."}, {"role": "assistant", "content": "```supercollider\na = { SinOsc.ar(\\freq.kr(440, 1.2)) }.play;\na.set(\\freq, 330);\na.release;\na = { SinOsc.ar(\\freq.kr([440, 460], 1.2)) }.play;\na.setn(\\freq, [330, 367]);\na.release;\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Rand`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-Rand\", { |out = 0|\n Out.ar(out,\n FSinOsc.ar(\n Rand(200.0, 400.0),\n 0, Line.kr(0.2, 0, 1, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n(\nRoutine({\n 8.do({\n Synth.new(\"help-Rand\"); 1.0.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nx = {\n SinOsc.ar([0.1, 0.2], 0).poll * 0.1\n}.play;\n;\nx.trace; // By tracing the Synth you can see the two Poll units we created\nx.free\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nx = {\n SinOsc.ar([0.1, 0.2], 0).poll * 0.1\n}.play;\n);\nx.trace; // By tracing the Synth you can see the two Poll units we created\nx.free\n```"}]} +{"conversations": [{"role": "user", "content": "What does `EnvelopeView.drawLines` do? What arguments does it take?"}, {"role": "assistant", "content": "Whether to draw the connections between the Arguments: A Boolean.."}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n~pad = Synth(\\pad, [\\freq, 165]);\n~pad.set(\\gate, 0);\n```"}, {"role": "assistant", "content": "It starts a sustained synth and then releases it.\n\n`Synth(\\pad, [\\freq, 165])` creates an instance of a SynthDef that takes a `gate` argument (default 1). The\narray after the name is alternating argument names and values: `\\freq, 165`. Setting `\\gate` to 0 does not\ncut the sound dead — the EnvGen inside sees the gate close and runs the release stage of its Env, then frees\nthe Synth because that EnvGen has `doneAction: 2`. This is the standard lifecycle for pads, drones and any\nsound you want to stop gracefully."}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for very punchy snare in neurofunk style: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\neurosnare, {\n var snd;\n // a percussive click to give it some attack\n snd = LPF.ar(HPF.ar(WhiteNoise.ar, 300), 8000) * Env.linen(0.001, 0.01, 0.001).ar;\n // sine sweep body. very important!\n snd = snd + (SinOsc.ar(Env([400, 196, 160], [0.04, 0.2], \\exp).ar) * Env.perc(0.04, 0.2).ar * 6.dbamp).tanh;\n // sound of snare coils rattling\n snd = snd + (HPF.ar(BPeakEQ.ar(WhiteNoise.ar, 4000, 0.5, 3), 300) * Env.perc(0.05, 0.2).delay(0.01).ar(2) * -3.dbamp);\n // another sound sweep to improve the attack, optional\n snd = snd + (SinOsc.ar(XLine.kr(3000, 1500, 0.01)) * Env.perc(0.001, 0.02).ar);\n // distortion helps glue everything together and acts as a compressor\n snd = (snd * 1.4).tanh;\n snd = Pan2.ar(snd, \\pan.kr(0), \\amp.kr(0.1));\n Out.ar(\\out.kr(0), snd);\n}).add;\n);\n\nSynth(\\neurosnare, [amp: 0.4]);\n```"}]} +{"conversations": [{"role": "user", "content": "What is `AbstractServerAction`?"}, {"role": "assistant", "content": "AbstractServerAction — register actions to be taken for a server"}, {"role": "user", "content": "What does `AbstractServerAction.functionSelector` do?"}, {"role": "assistant", "content": "Subclasses return specific function selectors for objects that implement this as interface. Selectors are:"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// ServerBoot\ns.boot;\nf = { |server| \"------------The server '%' has booted.------------\\n\".postf(server) };\nServerBoot.add(f, \\default);\ns.quit; // quit the server and observe the post\ns.boot;\nServerBoot.remove(f, \\default); // remove it again\ns.quit;\ns.boot; // no post.\nServerBoot.add(f, Server.internal);\nServer.internal.quit;\nServer.internal.boot;\nServerBoot.removeAll; // clear all\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nd = { |gate = 1| { BrownNoise.ar }.dup * EnvGen.kr(Env.asr, gate, doneAction: Done.freeSelf) }.play;\nd.release(3;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nd = { |gate = 1| { BrownNoise.ar }.dup * EnvGen.kr(Env.asr, gate, doneAction: Done.freeSelf) }.play;\nd.release(3);\n```"}]} +{"conversations": [{"role": "user", "content": "What is `PLinExp` in SuperCollider?"}, {"role": "assistant", "content": "PLinExp — UGenPatterns quark library Based on LinExp Category: Streams-Patterns-Events > UGenPatterns > Modifiers."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nx = { |freq = 440| SinOsc.ar(freq, 0, 0.3) }.play; // this returns a Synth object;\nx.set(\\freq, 880); // note you can set the freq argument\nx.defName; // the name of the resulting SynthDef\nx.release(4; // fadeout over 4 seconds\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nx = { |freq = 440| SinOsc.ar(freq, 0, 0.3) }.play; // this returns a Synth object;\nx.set(\\freq, 880); // note you can set the freq argument\nx.defName; // the name of the resulting SynthDef\nx.release(4); // fadeout over 4 seconds\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ SinOsc.ar(MouseX.kr(40, 10000, 1), 0, 0.1) }.play;\n{ SinOsc.ar(MouseX.kr(500, 10000, 1).poll, 0, 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ SinOsc.ar(MouseX.kr(40, 10000, 1), 0, 0.1) }.play;\n{ SinOsc.ar(MouseX.kr(500, 10000, 1).poll, 0, 0.1) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// multiple usage of the same name:\na = { SinOsc.ar(\\freq.kr(440, 1.0)) + Saw.ar(\\freq.kr(440, 1.0) * 0.5) * 0.1 }.play;\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n\n// with different lag values:\na = { SinOsc.ar(\\freq.kr(440).lag(3.5)) + Saw.ar(\\freq.kr(440).lag(0.05) * 0.5) * 0.1 }.play;\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n\n// control saved to a variable:\n(\na = {\n var freq = \\freq.kr(440);\n SinOsc\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// multiple usage of the same name:\na = { SinOsc.ar(\\freq.kr(440, 1.0)) + Saw.ar(\\freq.kr(440, 1.0) * 0.5) * 0.1 }.play;\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n\n// with different lag values:\na = { SinOsc.ar(\\freq.kr(440).lag(3.5)) + Saw.ar(\\freq.kr(440).lag(0.05) * 0.5) * 0.1 }.play;\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n\n// control saved to a variable:\n(\na = {\n var freq = \\freq.kr(440);\n SinOsc.ar(freq.lag(3.5)) + Saw.ar(freq.lag(0.05) * 0.5) * 0.1;\n}.play;\n);\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n{ CheckBadValues.kr(SinOsc.ar); 0 }.play // nothing wrong here\n\n{ CheckBadValues.kr(1 / 0, 1).poll; 0 }.play // check infinity\n\nx = { |test = -1| CheckBadValues.kr(test); 0 }.play // check NaN\nx.set(\\test, -1.sqrt);\n\n// don't post, but do something with the output\n(\nx = { |freq = 440|\n var good;\n good = BinaryOpUGen('==', CheckBadValues.kr(freq, 0, 0), 0);\n SinOsc.ar(freq, 0, 0.1) * good // silence the output if freq is bad\n}.play;\n);\nx.set(\\freq, -1.sqrt);\n// …\n```"}, {"role": "assistant", "content": "don't post, but do something with the output the UGen method checkBadValues passes through the input for quick testing (CheckBadValues: Test for infinity, not-a-number, and denormals)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// default initial params\n{ LinCongL.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// default initial params\n{ LinCongL.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// Analogizer\n// a quick draft of a model of the EHX Analogizer pedal\n// some info from \"https://www.bassic.de/threads/electro-harmonix-ehx-analogizer.14865686/\"\n\ns.default\ns.boot\n\n// used this for testing: https://www.freesound.org/people/wescwave/sounds/169885/\n~buf = Buffer.read(s, \"169884__wescwave__double-bass-test2.wav\");\n\n(\n~x.free;\n~x = {\n var a, d, s;\n\n a = PlayBuf.ar(2, ~buf, 1, 1, 0, 1);\n a = a.sum!2; // go mono to make the effect more prominent\n\n // the \"distortion modeling\" could use some more love...\n s = (a * MouseY.kr(26/2, 0).dbamp).tanh;\n s = s * MouseY.kr(-16/2, 0).dbamp;\n\n // a simple delay\n d = DelayC.ar(s, 0.1, MouseX.kr(3.5/1000, 65/1000));\n\n // dry/wet...\n a = a + (d * MouseY.kr(0, -96).dbamp);\n\n Out.ar(0, a);\n}.play\n)\n```"}, {"role": "assistant", "content": "The EHX Analogizer (http://www.ehx.com/products/analogizer) is a guitar pedal that apparently consists of a ultra-short delay with some gain stage. It's supposed to \"fatten\" and somehow \"spread\" the sound to make it appear more \"analog\" (thus: dirty). I wanted to quickly test the effect myself.\r\n\r\nI guess with some additional care of the distortion stage and maybe some very little modulation (ster."}]} +{"conversations": [{"role": "user", "content": "What does `KDRMaskTester.new` do? What arguments does it take?"}, {"role": "assistant", "content": "KeyCodeResponder utility for comparing modifier masks Arguments: requireMask; denyMask; function; description."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `ReplaceOut` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// ... a reverb adapted from the \"01 Why SuperCollider document\" in the SC2 distribution\n(\nSynthDef(\"preDelay\", { arg inbus = 2;\n ReplaceOut.ar(\n 4,\n DelayN.ar(In.ar(inbus, 1), 0.048, 0.048)\n )\n}).add;\n\nSynthDef(\"combs\", {\n ReplaceOut.ar(\n 6,\n Mix.arFill(7, { CombL.ar(In.ar(4, 1), 0.1, LFNoise1.kr(Rand(0, 0.1), 0.04, 0.05), 15) })\n )\n}).add;\n\nSynthDef(\"allpass\", { arg gain = 0.2;\n var source;\n source = In.ar(6, 1);\n 4.do({ source = AllpassN.ar(source, 0.050, [Rand(0, 0.05), Rand(0, 0.05)], 1) });\n ReplaceOut.ar(\n 8,\n source * gain\n )\n}).add;\n\nSynthDef(\"theMixer\", { arg gain = 1;\n ReplaceOut.ar(\n 0,\n Mix.ar([In.ar(2, 1), In.ar(8, 2)]) * gain\n )\n}).add;\n);\n\n(\nSynth(\"fm1\", [\\bus, 2, \\freq, 440, \\carPartial, 1, \\modPartial, 1.99, \\mul, 0.071]);\nSynth(\"fm1\", [\\bus, 2, \\freq, 442, \\carPartial, 1, \\modPartial, 2.401, \\mul, 0.071]);\nSynth.tail(s, \"preDelay\");\nSynth.tail(s, \"combs\");\nSynth.tail(s, \"allpass\");\nSynth.tail(s, \"theMixer\", [\\gain, 0.64]);\n);\n\n(\ns.queryAllNodes;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `SeenBefore` in SuperCollider briefly."}, {"role": "assistant", "content": "SeenBefore — eliminates duplicates by saving a history of objects it has tested Most constraints do not have any state or internal variables. This one saves each object in a history list and returns false if it has already seen an object. Category: Libraries > crucial > Constraints."}]} +{"conversations": [{"role": "user", "content": "What does `InstrSynthDef.buildErrorString` do?"}, {"role": "assistant", "content": "Extends SynthDef enabling the extra capabilities of Instr with Patch"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nNdef(\\bitshift, {\n var t = PulseCount.ar(Impulse.ar(8e3));\n var sig = HPF.ar(\n ( \n ((t * 15) & (t >> 5)) |\n ((t * 5) & (t >> [3, 4])) |\n ((t * 2) & (t >> 9)) |\n ((t * 8) & (t >> 11))\n - 3 % 256\n ) / 127-1 * 3\n , 20\n ).distort * 0.2; \n sig = Greyhole.ar(sig, sig, 0.5, sig).flop.mean/4;\n}).play;\n)\n```"}, {"role": "assistant", "content": "Not very original since I copied the bit code from http://schemawound.com/post/58980873930/bitwise and added a greyhole. But it sound so amazing I want to share it =)."}]} +{"conversations": [{"role": "user", "content": "What does `Recorder.filePrefix` do?"}, {"role": "assistant", "content": "a string used as prefix for the path when recording. This can be used to separate the outputs of several recorders. The default is"}]} +{"conversations": [{"role": "user", "content": "What does `Array2D.asArray` do?"}, {"role": "assistant", "content": "Return a flat array containing the elements. Returns: Array"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `VarGui`."}, {"role": "assistant", "content": "```supercollider\n// synth definition with raising frequency\n\n(\nSynthDef(\\synth_0, { |devFactor = 0.1, devFreq = 10, amp = 0.1|\n var freq = XLine.kr(400, 1200, 10); \n Out.ar(0, SinOsc.ar(SinOsc.ar(devFreq, 0, devFactor * freq, freq), mul: amp).dup(2) * EnvGate.new) \n}).add;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `OSCresponderNode` in SuperCollider briefly."}, {"role": "assistant", "content": "OSCresponderNode — client side network responder Category: External Control > OSC."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for danger loud click. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// proceed with caution. start at min volume, and not with your expensive speakers.\n\nfork{b=Buffer.alloc(s,512,1);inf.do{b.cheby({[1,0].choose}!2);{(Shaper.ar(b,SinOsc.ar(55,0,Line.kr(1,0,2,1,0,2))))!2}.play;0.1.wait;}};\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `NamedControl` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// compare this:\n(\na = {\n var x, y;\n x = NamedControl.kr(\\freq, 440).lag(3.5);\n y = NamedControl.kr(\\freq, 440).lag(1);\n SinOsc.ar([x, y] * [2, 1.2]) * 0.1\n}.play;\n);\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n\n// to this:\n(\na = {\n var x, y;\n x = Control.names([\\freq]).kr(440).lag(3.5);\n y = Control.names([\\freq]).kr(440).lag(1); // this hangs when set\n SinOsc.ar([x, y] * [2, 1.2]) * 0.1\n}.play;\n);\n\na.set(\\freq, 1220);\na.set(\\freq, 120);\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nDelayL.ar(z, 0.2, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\n(\n// recursive application of delay.\n{\nz = Decay2.ar(Dust.ar(1, 0.5), 0.01, 0.1, Saw.ar(100 + [0, 1]));\n5.do { |i| z = DelayL.ar(RLPF.ar(z, Rand(100, 3000), 0.03), 1, 1 / (2**i), 1, z * 0.5) };\nz\n}.play\n)\n```"}, {"role": "assistant", "content": "Dust randomly triggers Decay to create an exponential decay envelope for the WhiteNoise input source (DelayL: Simple delay line with linear interpolation.)"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LinCongL`."}, {"role": "assistant", "content": "```supercollider\n// default initial params\n{ LinCongL.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Server.unresponsive` do?"}, {"role": "assistant", "content": "`true` if the server is unresponsive (specifically, if it has failed to respond after ServerOptions#-pingsBeforeConsideredDead ping attempts); `false`"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n//Can be very noisy, high pitched and aliases badly: e.g., great fun, but watch out for your ears, filter, try out odd param settings. I've turned all the amplitudes down in the following\n\n\n//defaults, high pitched! WARNING\n{Out.ar(0,Pan2.ar(0.1*DoubleWell.ar(Impulse.kr(0),MouseX.kr(0.01,1,'exponential'),MouseY.kr(0.01,1,'exponential'),0.9,0.0001,0.25,LFNoise0.kr(1,0.4,0.5),LFNoise0.kr(1,0.4,0.5)),0.0))}.play\n\n\n//2 per second\n(\n{Out.ar(0,\n// …\n```"}, {"role": "assistant", "content": "Can be very noisy, high pitched and aliases badly: e.g., great fun, but watch out for your ears, filter, try out odd param settings. I've turned all the amplitudes down in the following defaults, high pitched! WARNING (DoubleWell: Forced DoubleWell Oscillator)"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Env`."}, {"role": "assistant", "content": "```supercollider\n// an envelope in a synth\n(\n{\n var env = Env([0, 1, 0.5, 1, 0], [0.01, 0.5, 0.02, 0.5]);\n SinOsc.ar(470) * EnvGen.kr(env, doneAction: Done.freeSelf)\n}.play\n);\n// an envelope to control a parameter in a pattern\n(\nPbind(\n \\note, Env([0, 12, 6, 13, 0], [1, 5, 2, 10]),\n \\dur, 0.1\n).play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `ControlRate` in SuperCollider briefly."}, {"role": "assistant", "content": "ControlRate — Server control rate. Get the current control rate of the server. Category: UGens > Info."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Blip thru Formlet, pseudo-vocal synthesis that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n// Blip thru Formlet, pseudo-vocal synthesis.\n// hh&adc, since beijing 2005\n// 2019 made quad/MC\n\n// keywords: vocal, voice, formants\n\n/*\nNdef(\\formSing).gui;\nNdef(\\formSing).play;\nNdef(\\formSing).getHalo(\\stepFdev).value;\n*/\nNdef(\\formSing).addSpec(\\root, [20, 500, 6]);\nNdef(\\formSing).addSpec(\\formfrq, [50, 5000, \\exp]);\nNdef(\\formSing).addSpec(\\harm, [1, 256, \\exp]);\nNdef(\\formSing).addSpec(\\formLag, [0.01, 100, \\exp]);\nNdef(\\formSing).addSpec(\\ndiv, [0.01, 1, \\exp]);\nNdef(\\formSing).addSpec(\\fdev, [0, 24, \\amp]);\nNdef(\\formSing).addSpec(\\round, [0, 3, \\amp, 0.05]);\n\n(\n// modulating formant frequency\nNdef(\\formSing, { arg amp=0, root=150, formfrq=500, harm=20, fdev=2, ndiv = 0.2, formLag=0.1, round = 1.5;\n var freqCompare = 1; // ((formfrq / root).log2).abs.min(1).linexp(0, 1, 0.25, 1);\n var in = Blip.ar(\n root.lag(formLag) * LFNoise0.kr(root * ndiv ! q.numChans, fdev.max(0.01) ).midiratio,\n harm.lag(formLag), // .max(formfrq / root * 0.25),\n 0.1\n ) * GrayNoise.ar(0.1 ! q.numChans, 1);\n\n Limiter.ar(Formlet.ar(in, formfrq.lag(formLag), 0.005, 0.02) * (freqCompare * amp.lag(0.1)))\n .softclip;\n});\n);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SynthDesc.outputData` do?"}, {"role": "assistant", "content": "Returns an array of events with information about any UGens that write to a bus (such as Out etc.). This includes the rate and number of channels of the UGen. If its first input is a control, also the corresponding control name is provided. `a = SynthDef(\\x, { |out, freq = 440| Out.ar(out,"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `QuadL`."}, {"role": "assistant", "content": "```supercollider\n// logistic map\n// equation: x1 = -r*x0^2 + r*x0\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n QuadL.ar(SampleRate.ir/4, r.neg, r, 0, 0.1) * 0.4;\n}.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `LinTrans.-` do?"}, {"role": "assistant", "content": "subtraciton between linear transformations. `a ="}]} +{"conversations": [{"role": "user", "content": "Explain `Hasher` in SuperCollider briefly."}, {"role": "assistant", "content": "Hasher — Scrambled value with a hash function. Returns a unique output value from -1 to +1 for each input value according to a hash function. The same input value will always produce the same output value. The input need not be in the range -1 to +1. Category: UGens > Filters > Nonlinear, UGens > Random."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n/* Audio plugin definition\n\n Each audio plugin should define the following global variables:\n ~name: (symbol) name of the spatializer\n ~description: (string) a short description\n ~function: the actual definition of the plugin\n\n*/\n\n~name = \\emptySource;\n~description = \"dummy/template\";\n~channelLayout = \\mono;\n\n~function = {\n DC.ar(0);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// increase phase multiplier\n{ FBSineL.ar(SampleRate.ir, 1, 0, XLine.kr(1, 2, 10), 0.1) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// increase phase multiplier\n{ FBSineL.ar(SampleRate.ir, 1, 0, XLine.kr(1, 2, 10), 0.1) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `BusPlug`."}, {"role": "assistant", "content": "```supercollider\nb = BusPlug.new;\n{ Blip.ar(b + 5) }.play;\nb.bus.set(12);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `FoaEncoderMatrix.numOutputs` do?"}, {"role": "assistant", "content": "Answers the number of outputs for the encoder. 3 for 2D and 4 for"}]} +{"conversations": [{"role": "user", "content": "What does `PathName.allFolders` do?"}, {"role": "assistant", "content": "returns a list of all the folder names contained in the pathname itself."}]} +{"conversations": [{"role": "user", "content": "What does `UChain.getAllUChains` do?"}, {"role": "assistant", "content": "Returns this. This method is used to recursivly get all the UChains in a Returns: UChain"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for little homage to \"Come Out\" by Steve Reich: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n/* A little homage to \"Come Out\" by Steve Reich.\n It explores ryhtmic aspects created by phasing, retriggering, and pitch shifting.\n It \"detours\" the original audio message available here\n http://www.freesound.org/people/ERH/sounds/34667/\n in which a police patrol recites\n \"We don't want to scare your children, that's the last thing we wanna do\".\n \n */\n\n\ns.options.memSize=128*1024;\ns.boot;\n\n~bus=Bus.audio(s,2);\n~buf=Buffer.readChannel(s,\"/home/***/Supercollider/sounds/v.wav\");\n\n(\nSynthDef(\\playbuff,{arg in=0,out=0,t_trig=0;\n var i=EnvGen.kr(Env([0,40,0.3,0.4,40,0],[0,60,20,20,30]),gate:1);\n var r=EnvGen.kr(Env([0,10,-0.9,-0.9],[40,20,15]),gate:t_trig,doneAction:2);\n var sig1=PlayBuf.ar(1,in,rate:1+r,trigger:Impulse.kr(i),loop:1);\n var sig2=PlayBuf.ar(1,in,rate:1+r,trigger:Impulse.kr(i+0.01),loop:1);\nOut.ar(out,Splay.ar([sig1,sig2],0.5));\n};\n).add;\n\nSynthDef(\\rev,{arg in=0,out=0;\n var sig=In.ar(in,2);\n sig=Compander.ar(sig,sig,0.8,1/3);\n sig=FreeVerb.ar(sig,mix:0.4);\nOut.ar(out,sig);\n};\n).add;\n);\n\nSynth(\\rev,[\\in:~bus]);\n\nfork{\nx=Synth(\\playbuff,[\\out:~bus]);\n75.wait;\nx.set(\\t_trig,1);\n};\n\ns.quit;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nr = {\n var scale = Scale.choose.postln;\n SinOsc.ar(\n (\n DegreeToKey.kr(\n scale.as(LocalBuf),\n MouseX.kr(0, 15), // mouse indexes into scale\n scale.stepsPerOctave,\n 1, // mul = 1\n 60 // offset by 72 notes\n )\n + LFNoise1.kr([3, 3], 0.04) // add some low freq stereo detuning\n ).midicps, // convert midi notes to hertz\n 0,\n 0.25\n )\n}.play;\n;\n\nr.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nr = {\n var scale = Scale.choose.postln;\n SinOsc.ar(\n (\n DegreeToKey.kr(\n scale.as(LocalBuf),\n MouseX.kr(0, 15), // mouse indexes into scale\n scale.stepsPerOctave,\n 1, // mul = 1\n 60 // offset by 72 notes\n )\n + LFNoise1.kr([3, 3], 0.04) // add some low freq stereo detuning\n ).midicps, // convert midi notes to hertz\n 0,\n 0.25\n )\n}.play;\n);\n\nr.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SelectX`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar(300),\n Pulse.ar(230)\n ];\n\n SelectX.ar(MouseX.kr(0, 1) * a.size, a) * 0.2\n}.play;\n);\n\n(\n{\n var a;\n a = [\n SinOsc.kr(0.25),\n LFSaw.kr(10),\n LFPulse.kr(0.3)\n ];\n\n SinOsc.ar(SelectX.kr(MouseX.kr(0, 1) * a.size, a) * 300 + 400) * 0.2\n}.play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "I get 'Message not understood' on a nil variable."}, {"role": "assistant", "content": "`~buffer` (or any variable) was never assigned, or it was assigned in a different environment. Environment variables are per-environment: a `~buf` set in one server-side file block is not visible in another. Check with `~buf.postln` before using it. The other common cause is an assignment that failed silently, e.g. `~buf = Buffer.read(...)` where the file was missing — the error is posted but ~buf stays nil."}]} -{"conversations": [{"role": "user", "content": "I get 'FAILURE IN SERVER /s_new SynthDef not found'. What is wrong?"}, {"role": "assistant", "content": "The server does not know that SynthDef. Three usual causes, in order of likelihood:\n\n1. **The SynthDef was added before the server booted.** `SynthDef(...).add` is asynchronous; wrap the work\n in `s.waitForBoot { ... }` or put `s.sync` after `.add`.\n2. **The name does not match.** `SynthDef(\\bell, ...)` is played by `Synth(\\bell)`, not `\\Bell` — symbols\n are case-sensitive.\n3. **`.add` was never called.** Writing `SynthDef(\\bell, { ... })` without `.add` builds the definition in\n the language and sends nothing.\n\nCheck with `SynthDescLib.global.dict.keys` — if the name is not there, it never reached the server."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nPbind(\\note, Pavaroh(\n Pseq([1, 2, 3, 2, 5, 4, 3, 4, 2, 1], 2),\n #[0, 2, 3, 6, 7, 9],\n #[0, 1, 3, 7, 8, 11]\n ),\n \\dur, 0.25\n).play;\n);\n\n\n// ___indian video game (1)\n(\nSynthDef(\"ivg\", { |out, freq = 900, pan|\n var trig, snd;\n trig = Impulse.kr(LFClipNoise.kr(4, 3, LFClipNoise.kr(0.2, 2, 7)));\n snd = RLPF.ar(\n SinOsc.ar(freq, 0, Decay.kr(trig, 1.8)).distort\n , 554, 0\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nPbind(\\note, Pavaroh(\n Pseq([1, 2, 3, 2, 5, 4, 3, 4, 2, 1], 2),\n #[0, 2, 3, 6, 7, 9],\n #[0, 1, 3, 7, 8, 11]\n ),\n \\dur, 0.25\n).play;\n);\n\n\n// ___indian video game (1)\n(\nSynthDef(\"ivg\", { |out, freq = 900, pan|\n var trig, snd;\n trig = Impulse.kr(LFClipNoise.kr(4, 3, LFClipNoise.kr(0.2, 2, 7)));\n snd = RLPF.ar(\n SinOsc.ar(freq, 0, Decay.kr(trig, 1.8)).distort\n , 554, 0.3)\n * 0.1;\n Out.ar(out, Pan2.ar(snd, pan))\n }).add;\n);\n\n(\n var aroh, avaroh, synth, str, pat;\n\n // gandhari raga. vadi: dha (7) samvadi: ga (3)\n\n aroh = #[0, 2, 5, 7, 10];\n avaroh = #[0, 1, 3, 5, 7, 9, 10];\n\n synth = Synth.head(s, \\ivg);\n pat = Prand([0, 2, 3, 4, 2, 1, 0, -1, -2], inf);\n str = Pavaroh(pat, aroh, avaroh).asStream;\n Routine({\n\n loop({\n synth.set(\\freq, midicps(str.next + 60));\n rrand([0.1, 1.0].choose, 0.5).wait;\n });\n\n }).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for smooth arpeggio, updated envelope (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\bass, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.perc(0.2), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for get different result each time running the pattern."}, {"role": "assistant", "content": "```supercollider\nTempoClock.default.tempo = 156/60;\n\n(\nSynthDef(\\spring, { |freq = 400, out = 0, pan = 0, gate = 1, dur = 0.15, curve = -4, amp = 1, index = 1|\n var sig = FreeVerb.ar(Pan2.ar(Blip.ar(freq, index), pan));\n var env = EnvGen.ar(Env.perc(0.01, dur, amp, curve), gate, doneAction:2);\n Out.ar(0, sig * env);\n}).add;\n);\n\n(\nPbind(*[\n instrument: \\spring,\n dur: Pseq([4, 1, 2, 1, 1, 1].scramble/ 4 / TempoClock.default.tempo, inf),\n degree: Pseq(#[1,2,3,4], inf) * Pkey(\\dur).reciprocal,\n octave: Pseq([2,3,4,4,4,3].scramble, inf),\n pan: Pxrand(Array.fill(100, { 0.gaussian(1).clip2(1) }), inf),\n amp: Pseq(#[0.95,1,0.8],inf),\n index: Pstutter(Pseq(#[4,8,12],inf), Pseq([2,3,4,5,6,8].scramble, inf))\n]).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `NodeProxy.send` do? What arguments does it take?"}, {"role": "assistant", "content": "Send a new synth without releasing the old one. If the source is a stream or a pattern, it starts a new Arguments: extraArgs — Arguments used to set the synth. The argument list is applied to the synth only. Arguments specified here override settings in the node map, but leave them untouched.; index — What slot to send a new synth with. If nil, uses all. (default: nil); freeLast — if to free the last synth at that index or not (default: true)."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BinaryOpFunction`."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nvar a = { 19.rand };\nvar b = { [5, 8, 9].choose };\nvar c = a + b;\nfork {\n 15.do {\n (instrument: \\default, note: [c.value, a.value]).play;\n 0.3.wait;\n }\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Tdef.reset` do?"}, {"role": "assistant", "content": "Switch the task immediately (stuck conditions can be subverted by"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// Pn advances Pgate each time its subpattern is repeated\n(\nPbind(\n \\degree, Pn(Pseq((0..7)), inf, \\step),\n \\mtranspose, Pgate(Pwhite(0, 5), inf, \\step),\n \\dur, 0.2\n).play\n);\n\n\n// Two different Pgates advanced at two different rates\n(\nPbind(\n\n \\scale, Scale.minor,\n \\foo, Pn(Pseq((0..2)), inf, \\step1),\n \\degree, Pn(Pseq((0..7).mirror), inf, \\step),\n \\ctranspose, Pgate(Pwhite(0, 5), inf, \\step) + Pgate(Pseq([0, 7, 0, -7], inf), inf, \\step1),\n \\dur, 0.\n// …\n```"}, {"role": "assistant", "content": "Pn advances Pgate each time its subpattern is repeated Two different Pgates advanced at two different rates (Pgate: A gated stream that only advances when a particular event key is true.)"}]} -{"conversations": [{"role": "user", "content": "What does `Ref.dereference` do?"}, {"role": "assistant", "content": "Answer the value. This message is also defined in class Object where it just returns the receiver. Therefore anything.dereference will remove a Ref if there is one. This is slightly different than the value message, because value will also cause functions to evaluate themselves whereas dereference will"}]} -{"conversations": [{"role": "user", "content": "Write a plucked string in SuperCollider."}, {"role": "assistant", "content": "Pluck is a Karplus-Strong string: a noise burst into a tuned delay with feedback. The delay time is\nthe reciprocal of the frequency.\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 220, amp = 0.5, dur = 3|\n var period = freq.reciprocal;\n var sig = Pluck.ar(WhiteNoise.ar(0.2), Impulse.kr(0), period, period, dur, 0.5);\n Out.ar(out, Pan2.ar(sig * amp, 0));\n}).add;\n);\nSynth(\\pluck, [\\freq, 330, \\dur, 4]);\n```"}]} -{"conversations": [{"role": "user", "content": "I made a synth and I hear nothing. Where do I start?"}, {"role": "assistant", "content": "Start with the node tree, not the code: evaluate `s.plotTree`. If your Synth is not there, it never started or it already freed itself; if it is there, the problem is in the signal. Which of the two do you see?"}, {"role": "user", "content": "It's in the tree."}, {"role": "assistant", "content": "Then the node lives and the signal is being lost. Check three things in order: does the SynthDef reach `Out.ar(0, ...)` with bus 0; is any `amp`/`mul` zero; and is a filter closed, e.g. `LPF.ar(sig, 50)` on a 440 Hz sine. Paste the SynthDef and I will read it."}, {"role": "user", "content": "SynthDef(\\x, { |out = 0| Out.ar(out, LPF.ar(Saw.ar(60), 80) * 0.1) }).add; Synth(\\x, [\\out, 2]);"}, {"role": "assistant", "content": "Two things. You wrote a low-pass at 80 Hz over a 60 Hz saw, which leaves almost nothing above the fundamental — the patch is nearly a sine at 60 Hz at very low level. And you passed `\\out, 2`, so it is going to bus 2, not the master. Try `Synth(\\x)` with the default out and a cutoff of 800:\n\n```supercollider\nSynthDef(\\x, { |out = 0, cutoff = 800| Out.ar(out, LPF.ar(Saw.ar(60), cutoff) * 0.1) }).add;\nSynth(\\x);\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Tuning`?"}, {"role": "assistant", "content": "Tuning — represents a musical tuning"}, {"role": "user", "content": "What does `Tuning.et` do?"}, {"role": "assistant", "content": "Creates an equal-tempered scale based on pitchesPerOctave."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nt = Tuning.et12;\nt.semitones; // [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]\nt.ratios; // [1, 1.0594630943591, 1.1224620483089, 1.1892071150019, etc.]\n\nPbind(\\scale, Scale.major(t), \\degree, Pseq((0..7) ++ (6..0) ++ [\\rest], 1), \\dur, 0.25).play;\n\n// use non-standard tuning\nt = Tuning.just;\nt.semitones; // [0, 1.1173128526978, 2.0391000173077, 3.1564128700055, etc.]\nt.ratios.collect(_.round(0.001)); // [1, 1.067, 1.125, 1.2, 1.25, 1.333, 1.406, 1.5, etc.]\n\nPbind(\\scale, Scale.major(t), \\degree, Pseq((0..7) ++ (6..0) ++ [\\rest], 1), \\dur, 0.25).play;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// sound examples\n\n// using the default synth def\nPbind(\n freq: Prand([300, 500, 231.2, 399.2], inf),\n dur: 0.1\n).play;\n\nPbind(\n freq: Prand([300, 500, 231.2, 399.2], inf),\n dur: Prand([0.1, 0.3], inf)\n).play;\n\nPbind(\n freq: Prand([1, 1.2, 2, 2.5, 3, 4], inf) * 200,\n dur: 0.1\n.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// sound examples\n\n// using the default synth def\nPbind(\n freq: Prand([300, 500, 231.2, 399.2], inf),\n dur: 0.1\n).play;\n\nPbind(\n freq: Prand([300, 500, 231.2, 399.2], inf),\n dur: Prand([0.1, 0.3], inf)\n).play;\n\nPbind(\n freq: Prand([1, 1.2, 2, 2.5, 3, 4], inf) * 200,\n dur: 0.1\n).play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `EnvelopedPlayer.didSpawn` do?"}, {"role": "assistant", "content": "takes a Player as input and plays it through an Env with fused protection"}]} -{"conversations": [{"role": "user", "content": "What does `Function.flop1` do?"}, {"role": "assistant", "content": "Same as #flop, return only an array if the arguments also contains an array. This can be used to implement Multichannel-Expansion. `// multichannel expansion for if, here to protect from"}]} -{"conversations": [{"role": "user", "content": "How do I stop all sound?"}, {"role": "assistant", "content": "s.freeAll stops every node on the server. On the language side, Ndef.clear and Pdef.clear clear the proxies. If a Pattern is still running, Pdef(\\name).stop does it; CmdPeriod immediately stops everything scheduled on the default clock."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes playing Pbinds with a MIDI controller (QuNeo, etc)."}, {"role": "assistant", "content": "```supercollider\n// Running Fifths\n// (QuNeo demo)\n//\n//\n// Ctrl + A, then Ctrl + Enter\n\ns.waitForBoot({\n\n MIDIIn.connectAll;\n\n a = Array.fill(8, {arg count; [count, count+7] });\n\n f = {arg velocity, midinote;\n var notes = if(midinote>=44, {a.reverse+midinote}, {a+midinote});\n p = Pbind(\n \\midinote, Pstutter(Pwrand([1, 3, 5], [0.1, 0.8, 0.1], inf), Pseq(notes)),\n \\dur, 0.1,\n \\amp, velocity/127 * 0.8,\n \\legato, 0.1,\n \\ctranspose, Pstutter(8, Pwhite(0, 36))\n ).play(quant: 0.1);\n };\n\n MIDIdef.noteOn(\\test, { arg vel, note; /*note.postln;*/ f.value(vel, note) });\n\n});\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Restricting fm to harmonic sidebands after[Chowning, 1973]?"}, {"role": "assistant", "content": "```supercollider\n(\n// restricting fm to harmonic sidebands after\n// [Chowning, 1973] Chowning, J. (1973). The synthesis of complex spectra by means of frequency modulation. Journal of the Audio Engineering Society, 21(7):526–534.\n// restriction actually happens because of the specs, not server-side.\n\nSpec.add(\\index, [0, 40]);\nSpec.add(\\harm1, [0, 20, \\lin, 1]);\nSpec.add(\\harm2, [0, 20, \\lin, 1]);\nSpec.add(\\fundFreq, \\freq);\n\nNdef(\\fmk, {\n \n PMOsc.ar(\n \\carFreq.kr(100, 0.1), \n (\\harm1.kr(1, 1)/(\\harm2.kr(1, 1)) * LFNoise1.ar(50).range(0.995, 1.001))*\\carFreq.kr(100), \n \\index.kr(1, 0.1) * SinOsc.ar(2.5).range(0.995, 1.005)\n ) \n})\n);\nNdef(\\fmk).gui\n```"}]} -{"conversations": [{"role": "user", "content": "What does `AbstractPlayer.play` do? What arguments does it take?"}, {"role": "assistant", "content": "boots the server, prepares the player for play (loading resources like samples etc.) and spawns the player all args are Arguments: group — a Server (will use the root node) a Group nil (default server's root node); atTime — see atTime; bus — bus - (Bus,Integer,Nil) a specific Bus to play on, otherwise will default to the main audio outs."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nf.add(p.asStream, 40\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nf.add(p.asStream, 40)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// you have to write the sample path in the firts line\n\n~bufferdue = Buffer.read(s,\" WRITE YOUR SAMPLE PATH HERE \", bufnum:2);\n\n(\nSynthDef.new(\\bufbeat, {\n arg amp = 1, out = 0, buf, start, end, freq = 1;\n var sig, ptr;\n ptr = LFNoise1.ar(freq).range(0.0,end);\n sig = BufRd.ar(2, buf, ptr);\n sig = sig * amp;\n Out.ar(out, sig);\n}).add\n);\n\nx = Synth.new(\\bufbeat, [\\buf, ~bufferdue.bufnum, \\start,0, \\end, ~bufferdue.numFrames-1, \\freq, 1, \\amp, 0.5],g);\n\nx.free;\n```"}, {"role": "assistant", "content": "a simple BufRd with the starting point of lecture randomized by LFNoise1."}]} -{"conversations": [{"role": "user", "content": "What does `MxUnitApp.moveBy` do? What arguments does it take?"}, {"role": "assistant", "content": "Move the unit by a channel@slot offset. Overwrites anything that might be Arguments: vector — Point representing the offset. eg. 1@0 will move it to the next channel."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// another example\n\n(\n// must have power of two framesize- FFT size will be sorted by Convolution2 to be double this\n// maximum is currently a = 8192 for FFT of size 16384\na = 2048;\n// kernel buffer\ng = Buffer.alloc(s, a, 1);\n);\n\n(\ng.set(0, 1.0);\n100.do { |i| g.set(a.rand, (i + 1).reciprocal) };\n);\n\n(\n// random impulse response\n{\n var input, inputAmp, threshhold, gate;\n\n input = SoundIn.ar(0);\n inputAmp = Amplitude.kr(input);\n threshhold = 0.02; // noise gating threshold\n gate = Lag.kr(inputAmp > threshhold, 0\n// …\n```"}, {"role": "assistant", "content": "must have power of two framesize- FFT size will be sorted by Convolution2 to be double this maximum is currently a = 8192 for FFT of size 16384 (Convolution2L: Real-time convolver with linear interpolation)"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// another example\n\n(\n// must have power of two framesize- FFT size will be sorted by Convolution2 to be double this\n// maximum is currently a = 8192 for FFT of size 16384\na = 2048;\n// kernel buffer\ng = Buffer.alloc(s, a, 1);\n);\n\n(\ng.set(0, 1.0);\n100.do { |i| g.set(a.rand, (i + 1).reciprocal) };\n);\n\n(\n// random impulse response\n{\n var input, inputAmp, threshhold, gate;\n\n input = SoundIn.ar(0);\n inputAmp = Amplitude.kr(input);\n threshhold = 0.02; // noise gating threshold\n gate = Lag.kr(inputAmp > threshhold, 0\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// another example\n\n(\n// must have power of two framesize- FFT size will be sorted by Convolution2 to be double this\n// maximum is currently a = 8192 for FFT of size 16384\na = 2048;\n// kernel buffer\ng = Buffer.alloc(s, a, 1);\n);\n\n(\ng.set(0, 1.0);\n100.do { |i| g.set(a.rand, (i + 1).reciprocal) };\n);\n\n(\n// random impulse response\n{\n var input, inputAmp, threshhold, gate;\n\n input = SoundIn.ar(0);\n inputAmp = Amplitude.kr(input);\n threshhold = 0.02; // noise gating threshold\n gate = Lag.kr(inputAmp > threshhold, 0.01);\n\n Convolution2L.ar(input * gate, g, 0, a, 1, 0.5);\n}.play\n);\n\ng.free;\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Feedback with beats."}, {"role": "assistant", "content": "```supercollider\nNdef(\\a, {\n var src, loc, delay=0.01;\n src = Decay2.ar(Impulse.ar(1/8), LFNoise2.kr(4).range(0.001, 0.0001),\n LFNoise2.kr(4).range(0.005, 0.05))!2\n * Saw.ar(LFNoise2.kr(4).exprange(40, 4000));\n loc = BPF.ar(LocalIn.ar(2) + [src, 0], LFNoise0.kr(1/4).range(100, 1200).lag, 3.2);\n loc = GVerb.ar(loc, 100, 4, mul:0.02, add:loc);\n loc = Compander.ar(loc, loc, 0.9, 1, 0.001);\n loc = (loc * 0.501).tanh;\n loc = Compander.ar(loc, loc, 0.1, 1, 0.1); \n loc = DelayC.ar(loc, delay * 2, delay * 1);\n LocalOut.ar(loc.reverse * 0.49);\n Out.ar(0, loc * 0.9)\n}).play;\n\nNdef(\\b, {\n var src, loc, del;\n del = 1/100;\n src = Decay2.ar(TDuty.ar(1/4,0,Dseq([1, 0.5, 0.3, 0.1],inf)), \n LFNoise2.kr(4).range(0.001, 0.0001), LFNoise2.kr(4).range(0.005, 0.05))!2\n * Saw.ar(LFNoise2.kr(200).exprange(40, 14000));\n loc = BPF.ar(LocalIn.ar(2) + [src, 0], LFNoise2.kr(0.1).range(40, 400), 3.2);\n loc = GVerb.ar(loc, 100, 4, mul:0.02, add:loc);\n loc = Compander.ar(loc, loc, 0.9, 1, 0.001);\n loc = (loc * 0.51).tanh;\n loc = Compander.ar(loc, loc, 0.1, 1, 0.1); \n loc = DelayC.ar(loc, del * 2, del * 1);\n LocalOut.ar(loc.reverse * 0.45);\n Out.ar(0, Compander.ar(loc,loc,0.1, 1, 0.05) * 1.2)\n}).play;\n\nNdef(\\c, {\n var src, loc, del=1/4;\n src = Decay2.ar(Impulse.ar(1), 0.0001, 0.05) * SinOsc.ar(60);\n loc = src + LocalIn.ar(2);\n loc = BPF.ar(loc, 800, 3.2).softclip;\n loc = DelayN.ar(loc, del, [0, del]);\n LocalOut.ar(loc.reverse * 0.99);\n Out.ar(0, loc * 2)\n}).play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Signal`."}, {"role": "assistant", "content": "```supercollider\nb = Signal.sineFill(512, [1]).play(true, 0.2);\nb.free; // free the buffer again.\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `IrNumberEditor` in SuperCollider briefly."}, {"role": "assistant", "content": "IrNumberEditor — a number box and slider for editing a float value [\\ir rate] When used with Patch or InstrSpawner this will result in an .ir rate control. This means you can only change the value before the synth starts, no 'control' rate modulation. Category: Libraries > crucial > Editors."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n\nSynthDef(\\param, { arg freq = 100, sustain, amp;\n var sig;\n sig = LFPar.ar(freq: freq,\n mul: EnvGen.kr(Env.perc(0, sustain, 0.5), doneAction:2) * amp);\n sig = Splay.ar(sig);\n Out.ar(0, sig);\n}).add;\n\ne = Pbind(\n \\midinote, Prout({\n var tone0, tone1, tone2, interval, freq0, delta;\n loop {\n tone0 = rrand(0,11);\n interval = rrand(2,4);\n tone1 = Scale.minor(\\pythagorean).at(tone0) + [0,12,24].choose + 0.07;\n tone2 = Scale.minor(\\pythagorean).at(tone0 + interval) + [0,12,24].choose;\n freq0 = [tone1,tone2]+48;\n postln(freq0);\n freq0.yield;\n }\n }),\n \\dur, Prand([1,2,4,8,12,16,4,6,8], inf),\n \\instrument, \\param,\n \\amp, 0.5,\n \\sustain, 2,\n).play(quant:1); // returns an EventStream\nTempoClock.default.tempo = 1200/60;\n\n)\n```"}, {"role": "assistant", "content": "minor random bliss in two for Prout (a SuperCollider snippet)."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n~chaos={\n var signal, myFrequency, frequencyMin=0.1, frequencyMax=30, myAmplitude, amplitudeMin=0.01, amplitudeMax=0.6, myPhase, phaseMin=0, phaseMax=1.5;\n myFrequency = Array.fill(2, {[rrand(frequencyMin, frequencyMax)]});\n myAmplitude = Array.fill(2, {[rrand(amplitudeMin, amplitudeMax)]});\n myPhase = Array.fill(2, {[rrand(phaseMin, phaseMax)]});\n signal = LeakDC.ar(ChaosGen.allSubclasses.choose.ar(myFrequency, myPhase, myAmplitude));\n Out.ar(0, signal);\n};\n);\n\n~chaos.scope\n```"}, {"role": "assistant", "content": "chaos gen modular function for modular pseudo ugen prototyping."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Psetpre`."}, {"role": "assistant", "content": "```supercollider\n(\nvar a, b;\na = Psetpre(\\freq, 801, Pbind(\\dur, 0.5));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Creaking door or roulette wheel?."}, {"role": "assistant", "content": "```supercollider\n(\n\n{\n\nvar output, basePitch = 387, macroPitch, macroPitchAmt = 400;\nvar modOsc, modAmt = 1.3, amp = 0.8;\nvar creakRate, creakTrig, creakEnvGen, noise, combs, oscFreq;\n\nnoise = LFNoise1.ar(LFNoise0.kr(4.8).lag(0.4).range(3646, 7777), 0.6);\n\ncreakRate = EnvGen.kr(\n Env(\n [40, 25, 15, 2],\n [0.9, 0.6, 1.0],\n -4\n ),\n doneAction: 2\n\n);\ncreakTrig = Impulse.kr(creakRate);\n\ncreakEnvGen = EnvGen.kr(\n Env(\n [0.0, 1.0, 0.0],\n [0.02, 0.1],\n [5, -8]\n ),\n creakTrig,\n timeScale: SinOsc.kr(1.5).range(0.12, 0.26) * Line.kr(0.5, 2.3, 2)\n\n);\n\nmacroPitch = EnvGen.kr(\n Env(\n [0.0, 4, 0.1, 0.3, 0.4, 0.7, 0.9],\n [0.2, 0.2, 0.4, 0.3, 0.48, 0.59],\n [2, 2, -4, -3, -2, -4]\n )\n\n);\nmodOsc = SinOsc.ar( (basePitch + (macroPitch * macroPitchAmt)) * 0.17);\nmodOsc = SinOsc.ar( (basePitch + (macroPitch * macroPitchAmt)) * 0.232, modOsc * 0.3);\n\noscFreq = basePitch + (macroPitch * macroPitchAmt);\noscFreq = oscFreq * (1 + (creakEnvGen * 2));\noutput = SinOsc.ar(oscFreq, modOsc * modAmt, 1);\noutput = output * SinOsc.ar(SinOsc.kr(1.6).range(1220, 1355));\noutput = output + noise;\noutput = output.clip(-0.5, 0.5) * creakEnvGen * amp * TRand.kr(0.8, 1.0, creakTrig);\n\ncombs = Mix([CombC.ar(output, 0.2, 0.0084, 0.12), CombC.ar(output, 0.2, 0.00181, 0.03)]);\noutput = output + (combs * 0.2);\noutput ! 2\n}.play\n\n\n)\n```"}]} -{"conversations": [{"role": "user", "content": "I get \"Message 'ar' not understood\". Why?"}, {"role": "assistant", "content": "You called a rate method on something that is not a UGen. `Env.ar(...)` and `Buffer.ar(...)` are the classic cases: Env is a language-side description and is played by `EnvGen.ar(env, ...)`; a Buffer is server memory and is played by `PlayBuf.ar` or `BufRd.ar`. The UGen is the thing with a rate method — if it is a description or a container, there is another UGen that consumes it."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for seasonal reflections )?"}, {"role": "assistant", "content": "```supercollider\n(\nfork { loop { \n Ndef(\\winter_curves, {\n var bands = 5.rrand(15) * 2;\n var freqs = Array.exprand(bands.debug('bands'), 20, 18000);\n Pan2.ar(\n SinOsc.ar(\n freqs, \n Array.rand(bands, 0, pi),\n AmpCompA.kr(freqs, freqs.sort.first)\n ).perform(0.5.coin.if(\\tanh,\\value).debug('kind')),\n FSinOsc.kr(\n Array.exprand(bands, 0.01, 15),\n Array.rand(bands, 0, pi),\n ),\n bands.reciprocal\n * LFGauss.kr(SinOsc.kr(Array.rand(bands, 0.05, 0.1)).range(1,10), 0.3)\n * FSinOsc.kr(\n Array.exprand(bands, 0.1, 15),\n 0.3\n ).range(0,1)\n ).sum\n * SelectX.kr(\n FSinOsc.kr(Array.exprand(bands, 0.1, 15)).range(0,1),\n [\n EnvGen.kr(\n Env.perc(\n FSinOsc.kr(1/16).range(0.01,0.1),\n FSinOsc.kr(1/8).range(0.25,0.3)\n ).blend(\n Env.sine( // 1/4\n FSinOsc.kr(Array.exprand(bands, 0.1, 15)).range(0.05,2)\n ).blend(\n Env.sine(1/4),\n FSinOsc.kr(Array.exprand(bands, 0.1, 15)).range(0.05,2).mean\n ),\n FSinOsc.kr(Array.exprand(bands, 0.1, 15)).range(0,1)\n ).circle,\n 1, 0.8, \n FSinOsc.kr(freqs.linlin(20,18000,0.1,20)).range(0, 0.2).mean\n ),\n 1\n ]\n ).clump(2).mean\n }).fadeTime_(0.5.rrand(2.5)).play;\n 8.rrand(30).debug('len').wait;\n} }\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `PV_MagBelow.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Pass bins below a threshold. Arguments: buffer — FFT buffer.; threshold — Magnitude threshold.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// logistic map\n// equation: x1 = -r*x0^2 + r*x0\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n QuadN.ar(SampleRate.ir/4, r.neg, r, 0, 0.1) * 0.4;\n}.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// logistic map\n// equation: x1 = -r*x0^2 + r*x0\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n QuadN.ar(SampleRate.ir/4, r.neg, r, 0, 0.1) * 0.4;\n}.play(s);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `AudioMulchClock.permanent` do?"}, {"role": "assistant", "content": "A Boolean. If true then the clock will continue to run after a CmdPeriod. The user is responsible for clearing permanent clocks with the #-clear"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `RunningSum`."}, {"role": "assistant", "content": "```supercollider\n// RMS Power\n(\n{\n var input, numsamp;\n\n input = LFSaw.ar;\n numsamp = 30;\n\n (RunningSum.ar(input.squared, numsamp) / numsamp).sqrt\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes sine ocean."}, {"role": "assistant", "content": "```supercollider\n(\n//fundamental pitch triad\n~notes = [45,55,60].midicps;\n\ns.waitForBoot({\n Routine{\n\n SynthDef.new(\\tone, {\n arg freq=440, pan=0, rel=0.05;\n var sig;\n sig = SinOsc.ar(freq);\n sig = sig * EnvGen.kr(Env.perc(0.005,rel), doneAction:2);\n sig = Pan2.ar(sig, pan, 0.05);\n Out.ar(0, sig);\n }).add;\n\n s.sync;\n\n 50.do{\n Pbind(\n \\instrument, \\tone,\n\n //trace some event times just for fun\n \\dur, Pseq(Array.geom(50, rrand(1.5,1.51), rrand(0.923,0.929)).mirror,inf).trace,\n\n \\freq, exprand(~notes[0],8000).round(~notes[0]),\n \\pan, rrand(-1.0,1.0),\n \\rel, exprand(0.005,0.35),\n ).play;\n\n Pbind(\n \\instrument, \\tone,\n \\dur, Pseq(Array.geom(50, rrand(1.5,1.51), rrand(0.923,0.929)).mirror,inf),\n \\freq, exprand(~notes[1],11000).round(~notes[1]),\n \\pan, rrand(-1.0,1.0),\n \\rel, exprand(0.005,0.35),\n ).play;\n\n Pbind(\n \\instrument, \\tone,\n \\dur, Pseq(\n Array.geom(50, rrand(1.5,1.51), rrand(0.923,0.929)).mirror,inf\n ),\n \\freq, exprand(~notes[2],15000).round(~notes[2]),\n \\pan, rrand(-1.0,1.0),\n \\rel, exprand(0.005,0.35),\n ).play;\n };\n }.play(AppClock);\n});\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for batuhan's buzzer parametrized."}, {"role": "assistant", "content": "```supercollider\n// A beautiful sc140 tweet by Batuhan Bozkurt, parametrized for real-time changes\n(\n// Start sound here\na = { | rateL = 5, rateR = 6, blipMul = 100, blipAdd = 50, fMul = 50, kMul = 1 |\n f = LocalIn.ar(2).tanh;\n k = Latch.kr(f[0].abs,Impulse.kr(1/4)) * kMul;\n LocalOut.ar(\n f +\n CombC.ar(Blip.ar([rateL, rateR], blipMul * k + blipAdd, 0.9), 1, k*0.3, fMul * f));f\n}.play\n);\n\n// Set parameters for changing sound here: \n\na.set(\\rateL, 10);\n\na.set(\\rateR, 8);\n\na.set(\\blipMul, 25);\n\na.set(\\blipAdd, 70);\n\na.set(\\fMul, 30);\n\n\na.set(\\kMul, 0.01);\n```"}]} -{"conversations": [{"role": "user", "content": "What does `StaticIntegerSpec.defaultControl` do? What arguments does it take?"}, {"role": "assistant", "content": "an integer that is supplied at the init of a synth and cannot change Arguments: val."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LatoocarfianN`."}, {"role": "assistant", "content": "```supercollider\n// default initial params\n{ LatoocarfianN.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Schemawound track from the SIGNALVOID compilation."}, {"role": "assistant", "content": "```supercollider\n/*\nSchemawound track from the SIGNALVOID compilation.\nSIGNALVOID is a noise compilation. Participants were asked to create up to three tracks, each of exactly one minute in length, with no gaps of silence at the beginning or end. Download the free compilation here: http://archive.org/details/SignalvoidMp3 or http://archive.org/details/SignalvoidFlac\nPhysical copies are available here http://signalvoid.bandcamp.com/merch/signalvoid-2\n\nBlog post about the creation of this track http://schemawound.tumblr.com/post/29065985817/signalvoid-1-burn-it-to-disc-then-burn-the-disc\n*/\n\n(\n {\n var saw1 = Saw.ar((10..100));\n var saw2 = Mix(Saw.ar(saw1).range(100, 600));\n var sin0 = SinOsc.ar(0.002).range(5,75);\n var sin1 = SinOsc.ar(0.1).range(1,sin0);\n var sin2 = SinOsc.ar(0.15).range(2,10);\n var sinMod = (sin1 * sin2)!2;\n var sin66 = SinOsc.ar(0.0164).range(600,1000);\n var saw3 = Saw.ar(sinMod).range(200, sin66);\n var saw4 = Saw.ar(saw3);\n var sin3 = Mix(SinOsc.ar((1..100)));\n var sum1 = (saw2 * saw4) * sin3;\n var comb1 = CombL.ar(sum1, 1, 0.2, 1) + sum1;\n var sin4 = SinOsc.ar(0.12).range(3, 1000);\n var comb2 = comb1.tanh;\n var sin5 = SinOsc.ar(sin4);\n var sin6 = SinOsc.ar(0.001);\n var comb3 = comb2 * sin5 * sin6;\n var sum2 = (comb2 + comb3) * 0.3;\n var verb1 = sum2;\n var line1 = Line.ar(1, 0.001, 60, doneAction: 2);\n var line2 = Line.ar(0, 1, 60);\n var comb4 = CombL.ar(verb1, 1, line1, 0.1) * line2;\n var sum3 = comb4 + verb1;\n sum3 * 0.5;\n }.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nSynthDef(\"help-Dust\", { |out = 0|\n Out.ar(out,\n Dust.ar(200, 0.5)\n )\n}).play;\n);\n\n(\nSynthDef(\"help-Dust\", { |out = 0|\n Out.ar(out,\n Dust.ar(XLine.kr(20000, 2, 10), 0.5)\n )\n}).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nSynthDef(\"help-Dust\", { |out = 0|\n Out.ar(out,\n Dust.ar(200, 0.5)\n )\n}).play;\n);\n\n(\nSynthDef(\"help-Dust\", { |out = 0|\n Out.ar(out,\n Dust.ar(XLine.kr(20000, 2, 10), 0.5)\n )\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `EZSlider.valueAction` do? What arguments does it take?"}, {"role": "assistant", "content": "Sets the value and performs the action at the index value and the global Arguments: val — An Integer.."}]} +{"conversations": [{"role": "user", "content": "What is `Red3DPlane` in SuperCollider?"}, {"role": "assistant", "content": "Red3DPlane — 3D plane / rectangle A class for rotating and rendering a plane in 3D. Category: Red > redUniverse > 3D."}]} +{"conversations": [{"role": "user", "content": "What does `Collection.includes` do?"}, {"role": "assistant", "content": "Answer whether anObject is contained in the receiver. `List[1, 2, 3,"}]} +{"conversations": [{"role": "user", "content": "What is `RosslerL` in SuperCollider?"}, {"role": "assistant", "content": "RosslerL — Rossler chaotic generator A strange attractor discovered by Otto Rossler based on work in chemical kinetics. The system is composed of three ordinary differential equations: x' = - y - z y' = x + ay z' = b + z(x - c) Category: UGens > Generators > Chaotic."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Just a dirty FM bass shuffling. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\nfork{\n SynthDef(\\basicFM, {|out = 0, gate = 1, amp = 1, carFreq = 1000, modFreq = 100, modAmount = 2000, clipAmount = 0.1|\n var modEnv = EnvGen.ar(Env.adsr(0.5, 0.5, 0.7, 0.1, peakLevel: modAmount), gate);\n var mod = SinOsc.ar(modFreq) * modEnv;\n var car = SinOsc.ar(carFreq + mod);\n var ampEnv = EnvGen.ar(Env.adsr(0.1, 0.3, 0.7, 0.2, peakLevel: amp), gate, doneAction: 2);\n var clip = clipAmount * 500;\n Out.ar(out, (car * ampEnv * clip).clip(-0.7, 0.7) * 0.1);\n }).add;\n\n s.sync;\n\n Pbind(*[\n instrument: \\basicFM,\n out: [0, 1],\n dur: Pseq([1/7, 1/3] / 1.2, inf),\n sustain: Pkey(\\dur),\n amp: 1/4,\n carFreq: Pseq([1, 1, 1, 2] * 350, inf),\n modFreq: Pkey(\\carFreq) * (1/8),\n modAmount: Pseq([2, 1, 0.5, 2, 1, 0.5, 2, 1, 2, 1, 0.5, 2, 1, 0.5, 2, 4] * 500, inf),\n clipAmount: Pseq([Pn(0.1, 32), Pn(1, 32)], inf)\n ]).play;\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// play SinOscs silently and wait for granulation envelopes\n\n(\na = Bus.audio(s, 10);\nx = { Splay.ar(In.ar(a, 10) * SinOsc.ar((3..12) * 100, 0, 0.05)) }.play\n);\n\n\n// send envelopes to buses\n\n(\nz = {\n DXEnvFanOut.ar(\n Dseq((0..5) + a.index, inf) + Diwhite(1, 4),\n \n // with newer SC versions you can also write:\n // Dseq((0..5), inf) + Diwhite(1, 4) + a.index,\n \n fadeTime: 0.05,\n width: 1,\n initOutOffset: -0.5\n )\n}.play\n);\n\nx.release;\n\n// clean\n// …\n```"}, {"role": "assistant", "content": "play SinOscs silently and wait for granulation envelopes send envelopes to buses (DXEnvFanOut: sends crossfade envelopes to out buses according to demand-rate control)"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nSynthDef(\\pluck, {|freq = 440, dur = 1|\nvar klang,note;\ndur = dur * 2;\nnote = freq.cpsmidi;\nnote = note + (LFNoise2.ar(20).range(-1,1) * (1/8));\nklang = SinOsc.ar((note * [1,1.002]).midicps, phase: VarSaw.ar(note.midicps, width: Line.ar(1,0.2,dur))) * 0.3;\nklang = klang * XLine.ar(1,1/10000,dur,doneAction:2);\nOut.ar(0, klang);\n}).store;\n\nPbind(\n\\instrument, \\pluck,\n\\degree, Pn(Pseries(0, Pwrand([Pwhite(-3,3,inf).round(1),1],[32,1],inf), 4),inf)-1 + [0,2,-1,-14],\n\\dur, Pseq([4, [5,2,1]].convertRhythm / 2, inf),\n\\strum, Pwhite(0,1/8,inf),\n\\octave, [5,6]\n).play;\n```"}, {"role": "assistant", "content": "A synthdef and simple pbind to play some (pretty repetitive) bebop-ish arpeggios. The conjunction reminds me a bit of James Blake."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\nvar trigger, fund, flashInst;\nflashInst = Array.fill(7,\n{\ntrigger = Dust.kr(2)*PinkNoise.ar(1);\nfund = rrand(100, 137);\nPan2.ar(\nMix.ar(\nArray.fill(7,\n{arg counter;\nvar partial;\npartial = counter + 3;\n//HenonC.ar(fund*partial).atan *\nDPW3Tri.ar(fund*partial).atan *\nEnvGen.kr(Env.adsr(0.01, 0, 0.1, 7.0),\ntrigger, 1/partial) *AY.ar(713)* max(0, LFNoise1.kr(rrand(37.0, 73.0)))\n})\n)*0.2,\n1.0.rand2)\n});\nMix.ar(flashInst)*0.6\n}.play\n)\n```"}, {"role": "assistant", "content": "\"High-energy Radio Bursts, generated by an old coffee machine of Arab origin, manifest themselves as noise and audio signals, and trigger a magnetic alteration with unpredictable effects;\"\r\n\r\n\r\n\r\nhttp://bz-buzz.blogspot.com/2018/10/radio-bursts-from-old-coffee-pot.html\r\n\r\nhttp://bzakirasantjago.blogspot.com/."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nDelayC.ar(z, 0.2, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\n(\n// recursive application of delay.\n{\nz = Decay2.ar(Dust.ar(1, 0.5), 0.01, 0.1, Saw.ar(100 + [0, 1]));\n5.do { |i| z = DelayC.ar(RLPF.ar(z, Rand(100, 3000), 0.03), 1, 1 / (2**i), 1, z * 0.5) };\nz\n}.play\n)\n```"}, {"role": "assistant", "content": "Dust randomly triggers Decay to create an exponential decay envelope for the WhiteNoise input source (DelayC: Simple delay line with cubic interpolation.)"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for smooth arpeggio, updated envelope (a SuperCollider snippet): bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\bass, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.perc(0.2), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `AbstractConstraint` in SuperCollider?"}, {"role": "assistant", "content": "AbstractConstraint — abstract parent class for the Constraints micro-library See the Constraints first. Category: Libraries > crucial > Constraints > abstract."}]} +{"conversations": [{"role": "user", "content": "What does `ServerLogSentEvent.matchSynthDef` do? What arguments does it take?"}, {"role": "assistant", "content": "internal usage Arguments: defName. Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "What is `PCombN` in SuperCollider?"}, {"role": "assistant", "content": "PCombN — UGenPatterns quark library Based on CombN Category: Streams-Patterns-Events > UGenPatterns > Modifiers."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pause`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\nSynthDef(\\a, { Out.ar(0, SinOsc.ar(800, 0, 0.2)) }).add;\n\nSynthDef(\\b, { |gate = 1| Out.ar(1, PinkNoise.ar(0.3)); Pause.kr(gate, 1001) }).add;\n\ns.sendMsg(\\s_new, \\a, 1001, 0, 0);\n\ns.sendMsg(\\s_new, \\b, 1002, 0, 0);\n\ns.sendMsg(\\n_set, 1002, \\gate, 0);\n\ns.sendMsg(\\n_set, 1002, \\gate, 1);\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n\n ~needed_interval = 20;\n\n ~funk = {\n\n // if last time isn't defined, create it with 1000 seconds ago time\n if( ~last_time.isNil ) {\n ~last_time = Date.getDate.bootSeconds;\n ~last_time = ~last_time - 1000;\n };\n\n // if needed interval has passed, execute the funkie\n if( ( Date.getDate.bootSeconds - ~last_time ) > ~needed_interval ) {\n\n // safe last execution time, so next calls will have to wait the needed interval\n ~last_time = Date.getDate.bootSeconds;\n\n ( \"SOMETHING HAPPENS HERE AT MAXIMUN RATE OF 1 TIME EACH\" + ~needed_interval + \" SECONDS \" );\n\n } {\n ( \"YOU STILL HAVE TO WAIT\" );\n }\n };\n);\n\n~funk.value()\n```"}, {"role": "assistant", "content": "A friend of mine asked me how to limit a function to happen at maximun rate of 1 time every N seconds.."}]} +{"conversations": [{"role": "user", "content": "What does `CCBank.isMapped` do? What arguments does it take?"}, {"role": "assistant", "content": "a set of named MIDI CCResponders Arguments: key."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = { |x| #[440, 720, 801, 1020.2].at(x) }; b = a.cpsmidi; [a.value(3), b.value(3)];\na = Pseries(220, 220, inf).cpsmidi; a.asStream.nextN(12); // overtone series as midinotes\n// follow but round to next midinote\n{ a = Pitch.kr(SoundIn.ar).at(1); Pulse.ar(a.cpsmidi.round.midicps * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = { |x| #[440, 720, 801, 1020.2].at(x) }; b = a.cpsmidi; [a.value(3), b.value(3)];\na = Pseries(220, 220, inf).cpsmidi; a.asStream.nextN(12); // overtone series as midinotes\n// follow but round to next midinote\n{ a = Pitch.kr(SoundIn.ar).at(1); Pulse.ar(a.cpsmidi.round.midicps) * 0.1 }.play;\n```"}]} {"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `AnalogIn`."}, {"role": "assistant", "content": "```supercollider\n// modulate frequency of a sine oscillator\n\n(\nSynthDef(\"help-AnalogIn\", { |out = 0|\n Out.ar(out,\n SinOsc.ar(AnalogIn.ar(0).exprange(200, 5000), 0, 0.1)\n )\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for strange device found in space )\r\n\r\np.s?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n Limiter.ar(HPF.ar(\n GVerb.ar(\n Pan2.ar(\n PMOsc.ar(\n Demand.kr(\n Impulse.kr(\n SinOsc.kr(SinOsc.kr(1/30).range(1/10, 1/15)).range(0, 25)\n * LFPulse.kr(0.2).range(0.5, 1)\n + \n LFDNoise3.kr(1/10, 10, 10)\n ), \n 0, \n Dxrand(Array.geom(100, 50, 1.06), inf) + Dgeom(1, 1.005)\n ),\n [[3,5],[7,11]] + SinOsc.ar([1/60, 1/45]).range(0, 1300),\n Demand.kr(\n Impulse.kr(SinOsc.kr(0.1).range(0.1, 20)),\n 0,\n Dxrand(Array.series(13, 0, 0.5), inf)\n )\n ).sum,\n SinOsc.ar(1, mul:0.5),\n LFPar.ar([1/5,1/3]).range(0.3, 1)\n ), \n 250, \n 0.5, \n damping:SinOsc.kr(1/20).range(0.2,0.7), \n drylevel: SinOsc.kr(1/15).range(0.2,0.7), \n earlyreflevel:0.3\n ) * 0.1\n +\n LFDNoise3.ar(SinOsc.kr(1/15, [0, pi/4]).range(100,350), 0.3),\n [SinOsc.ar(1/45, [0,pi/2]).range(20, 120)]\n ))\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for redo_minimalish sketch."}, {"role": "assistant", "content": "```supercollider\n//redFrik - redo_minimalish sketch\n(\ns.waitForBoot{\n \n SynthDef(\\p, {|out= 0, freq= 400, amp= 0.1, gate= 1, detune= 0|\n var env= EnvGen.ar(Env.perc(Rand(0.001, 0.01), LinRand(0.2, 0.4), amp, Rand(-9, -1)), doneAction:2);\n var snd= Mix(SinOsc.ar(freq+[0, detune*0.1], env*2pi));\n Out.ar(out, Pan2.ar(snd*env, Rand(-1, 1)));\n }).add;\n Ndef(\\p, Pspawn(Pbind(\\method,\\par,\\delta,1/8,\\pattern,{Pbind(\\instrument, \\p, \\dur,a=Pseq((1..9).sputter),\\sustain,1/8/a,\\degree,a,\\detune,a)})));\n Ndef(\\p).play(vol:0.5);\n \n Ndef(\\t, {\n var mod= Saw.ar([3, 4], Saw.ar(1, 32, 128), Duty.ar(1, 0, flop(Dseq([0, 8, 1, 5])*[1, 4, 8])));\n var snd= SinOsc.ar(Saw.ar(2, 64, 99), mod)/9;\n CombN.ar(snd, 1/4, 1/4.125, SinOsc.kr(0.005, 1.5pi).range(0, 6));\n });\n Ndef(\\t).play(vol:0.5);\n \n Routine.run({\n var cnt= 1;\n loop{\n var syn;\n cnt= cnt%8+1;\n syn= {\n var del= DelayN.ar(InFeedback.ar(0, 2)+(InFeedback.ar(100, 2)), 1, 1);\n SinOsc.ar(cnt*99+[0, 2], del[1..0])/4;\n }.play(outbus: 64);\n {syn.release(16)}.defer(9-cnt);\n wait(9-cnt);\n };\n });\n Ndef(\\c, {InFeedback.ar(64, 2)}).play(vol:0.5);\n \n Ndef(\\r, {\n var lfos= LFNoise1.ar(0.5!2);\n var snd= Crackle.ar(lfos.range(1.8, 1.98));\n Formlet.ar(snd, TExpRand.ar(200, 2000, lfos).lag(2), lfos.range(5e-4, 1e-3), 0.0012);\n });\n Ndef(\\r).play(vol:0.25);\n \n Routine.run({\n loop{\n var syn= {\n var snd= Pluck.ar(Crackle.ar([1.9, 1.8]), Mix(Impulse.ar({5.linrand+1}!2, -0.125)), 0.05, 0.05.linrand);\n BPF.ar(snd, 2000.rand+100, 0.25.rrand(1.75));\n }.play(s, 62, 18);\n {syn.release(69)}.defer(18);\n wait(18);\n };\n });\n Ndef(\\m, {InFeedback.ar(62, 2)*SinOsc.kr(0.006).range(0.25, 1)}).play(vol:0.5);\n \n NdefMixer(s);\n s.meter;\n};\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// modulate frequency of a sine oscillator\n\n(\nSynthDef(\"help-AnalogIn\", { |out = 0|\n Out.ar(out,\n SinOsc.ar(AnalogIn.ar(0).exprange(200, 5000), 0, 0.1)\n )\n}).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// modulate frequency of a sine oscillator\n\n(\nSynthDef(\"help-AnalogIn\", { |out = 0|\n Out.ar(out,\n SinOsc.ar(AnalogIn.ar(0).exprange(200, 5000), 0, 0.1)\n )\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `UGen.prune` do?"}, {"role": "assistant", "content": "Limits the receiver range to one of the four clip modes, see `linlin`"}]} -{"conversations": [{"role": "user", "content": "What does `FoaMFreqOsc.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "First Order Ambisonic (FOA) monofrequent soundfield generator Arguments: freq — Frequency in Hertz. Sampled at audio-rate.; phase — Phase offset or modulator in radians. Sampled at audio-rate.; azimuthA — Azimuth of the Active Intensity Vector, in radians.; elevationA — Elevation of the Active Intensity Vector, in radians.; azimuthR — Azimuth of the Reactive Intensity Vector, in radians.; elevationR — Elevation of the Reactive Intensity Vector, in radians.; alpha; beta."}]} -{"conversations": [{"role": "user", "content": "SC can't open or read files?"}, {"role": "assistant", "content": "SuperCollider forum — SC can't open or read files\n\nIt looks as though it’s finally working!\n\nI moved the file to a folder I created in the user support directory for SuperCollider and then changed the quotes to ascii.\n\nI think the issue was that at first I had the file name listed without the extension, then I added the extension to the file name and added the file extension to the file path in the code and this must have created a conflict.\n\nIn the first instance SC needed the file extension, ascii quotes, and since I’m on windows the path needed double \\ in the path file.\n\nThe final working code looks like this:\n\n```supercollider\nb = Buffer.readChannel(s, \"C:\\\\Users\\\\44774\\\\AppData\\\\Local\\\\SuperCollider\\\\Tables\\\\wubsquare.wav\", startFrame:0, numFrames: -1);\n```\n\nThe wav file is simply named wubsquare and I included the file extension in the code."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n//MUST be a buffer with data in format [sizeofcurrentsieve,sieveentry1,sieveentry2,...] where currentsize always less than initially allocated buffer length -1. \n\n{ Sieve1.ar(LocalBuf.newFrom([10]++({0.75.rand}!10)),MouseX.kr(2,100))*0.2}.play\n\n{ Sieve1.ar(LocalBuf.newFrom([88]++({[0.1.rand,0.5.rand].wchoose([0.8,0.2])}!88)),MouseX.kr(1,100))*0.2}.play\n\nb = Buffer.alloc(s,300); \n\nb.setn(0, [88]++({[0.1.rand,0.5.rand]\n// …\n```"}, {"role": "assistant", "content": "MUST be a buffer with data in format [sizeofcurrentsieve,sieveentry1,sieveentry2,...] where currentsize always less than initially allocated buffer length -1. dynamically swap buffer (Sieve1: Fuzzy sieve based synthesis)"}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nPbind(\\degree, Pseq([0, 2, 4, 7], inf), \\dur, 0.25).play;\n```"}, {"role": "assistant", "content": "It plays a four-note major arpeggio in a loop, one note every 250 ms.\n\n`Pbind` builds an event stream: each event is the current value of every key. `Pseq([0, 2, 4, 7], inf)`\ncycles the degrees forever, and `\\dur, 0.25` sets the time between events in beats on the default\nTempoClock. With no `\\instrument`, the `\\default` SynthDef is used, which converts `\\degree` to a\nfrequency through the current scale (major, rooted at C by default). `.play` schedules it on the clock\nand returns an EventStreamPlayer."}]} -{"conversations": [{"role": "user", "content": "What is `TGaussRand` in SuperCollider?"}, {"role": "assistant", "content": "TGaussRand — triggered gaussian random distribution Generates a random float value in gaussian distribution from `lo` to `hi` each time the trigger signal changes from nonpositive to positive values. Category: UGens > Random, UGens > Triggers."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Algorithmic melancholy (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nvar n = 20, baseFreq = 45.midicps;\nvar lsin, rsin, arg1, arg2, sig;\nvar bus, busIndex, scale, freq, freqIndex, amp;\nvar responder;\n\nscale = Scale.nikriz.ratios * baseFreq;\n\nbus = Bus.control( s, 2 * n );\nbus.setn( { 1.0.rand2 } ! ( 2 * n ) );\nbusIndex = bus.index;\n\nfreq = Bus.control( s, n );\nfreqIndex = freq.index;\n\nresponder = OSCFunc({ | id |\n freq.setAt( id[2] , scale.choose * 1.rrand( 3 ) );\n},'/tr', s.addr);\n\nCmdPeriod.doOnce { [ bus, freq, responder ].free; };\n\nn.do {|i|\n freq.setn( { scale.choose * rrand( 1, 3) } ! n );\n {\n #arg1, arg2 = In.kr( 2 * i + busIndex, 2 );\n\n #lsin, rsin = SinOsc.kr( [ arg1, arg2 ], { 2.0.rrand(20.0) } ! 2 * [ arg2, arg1 ] ); \n\n sig = Formant.ar( \n LFNoise0.kr( 0.05, 2.5, 7) * arg1, \n arg2,\n 500.0.rrand(700) \n );\n\n ReplaceOut.kr( 2 * i + busIndex, [ rsin, lsin ] );\n\n sig = Pluck.ar( \n BrownNoise.ar(0.5), \n sig, \n 0.025, \n freq.kr( 1, i ).reciprocal, \n 3.7\n ) * 0.6;\n\n amp = Line.kr( dur: rrand( 1.0, 20.0) ) * max( 0, LFNoise1.kr( 0.05, 0.6, 0.4 ) ) ;\n sig = sig * amp;\n SendTrig.kr( amp <= 0, i, i );\n\n Pan2.ar( sig, 0.8.rand2 )\n }.play\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\ne.stream = Pbind(\n \\degree, Pseq([0, 1, 2, 4, 6, 3, 4, 8], inf),\n \\dur, Prand([0.2, 0.4, 0.8], inf),\n \\amp, 0.05, \\octave, 5,\n \\instrument, \\cfstring1, \\ctranspose, 0\n).asStream;\n);\n\n(\ne.stream = Pbind(\n \\degree, Pseq([0, 1, 2, 4, 6, 3, 4, 8], inf),\n \\dur, Prand([0.2, 0.4, 0.8], inf),\n \\amp, 0.05, \\octave, 5,\n \\instrument, \\cfstring1, \\ctranspose, 0\n).asStream;\n);\n\n(\ne.stream = Pbind(\n \\degree, Pxrand([0, 1,\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\ne.stream = Pbind(\n \\degree, Pseq([0, 1, 2, 4, 6, 3, 4, 8], inf),\n \\dur, Prand([0.2, 0.4, 0.8], inf),\n \\amp, 0.05, \\octave, 5,\n \\instrument, \\cfstring1, \\ctranspose, 0\n).asStream;\n);\n\n(\ne.stream = Pbind(\n \\degree, Pseq([0, 1, 2, 4, 6, 3, 4, 8], inf),\n \\dur, Prand([0.2, 0.4, 0.8], inf),\n \\amp, 0.05, \\octave, 5,\n \\instrument, \\cfstring1, \\ctranspose, 0\n).asStream;\n);\n\n(\ne.stream = Pbind(\n \\degree, Pxrand([0, 1, 2, 4, 6, 3, 5, 7, 8], inf),\n \\dur, Prand([0.2, 0.4, 0.8], inf), \\amp, 0.05,\n \\octave, 5, \\instrument, \\cfstring1\n).asStream;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "I get 'Node not found' when I call .set on a Synth after a while."}, {"role": "assistant", "content": "The Synth was freed and the language still holds a reference. That happens whenever the SynthDef used `doneAction: 2` and the envelope finished, or when something called `freeAll`/`CmdPeriod`. Guard it with `if (x.notNil and: { x.isPlaying }) { x.set(\\freq, 300) }`, or store the node in a variable that you clear when it ends. For sustained sounds the right pattern is a `gate` argument with `doneAction: 2` on the EnvGen, so the node lives until you release it."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Vibrato`."}, {"role": "assistant", "content": "```supercollider\n// vibrato at 1 Hz, note the use of DC.ar UGen; a constant of 400.0 doesn't work\n{ SinOsc.ar(Vibrato.ar(DC.ar(400.0), 1, 0.02)) }.play\n\n// compare: k-rate freq input can be a constant\n{ SinOsc.ar(Vibrato.kr(400.0, 1, 0.02)) }.play\n\n// control rate and rateVariation\n{ SinOsc.ar(Vibrato.ar(DC.ar(400.0), MouseX.kr(2.0, 100.0), 0.1, 1.0, 1.0, MouseY.kr(0.0, 1.0), 0.1)) }.play\n\n// control depth and depthVariation\n{ SinOsc.ar(Vibrato.ar(DC.ar(400.0), LFNoise1.kr(1, 3, 7), MouseX.kr(0.0, 1.0), 1.0, 1.0, MouseY.kr(0.0, 1.0), 0.1)) }.play\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Out.ar(0,Pan2.ar(0.5*Fhn2DL.ar(220,800,0.3,0.3,0.6,0.8,LFPulse.kr(MouseX.kr(1, 10, 1), 0, 0.1)),0.0)) }.play\n\n(\nSynthDef(\\fhn, {|out=0, pan=0, amp=0.1|\n var sig;\n sig=Fhn2DL.ar(110, 22050, TExpRand.kr(0.001, 0.2, Dust.kr(8)), TExpRand.kr(0.001, 0.2, Dust.kr(13)), TRand.kr(0.1, 0.4, Dust.kr(5)),TRand.kr(0.1, 1.9, Dust.\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Out.ar(0,Pan2.ar(0.5*Fhn2DL.ar(220,800,0.3,0.3,0.6,0.8,LFPulse.kr(MouseX.kr(1, 10, 1), 0, 0.1)),0.0)) }.play\n\n(\nSynthDef(\\fhn, {|out=0, pan=0, amp=0.1|\n var sig;\n sig=Fhn2DL.ar(110, 22050, TExpRand.kr(0.001, 0.2, Dust.kr(8)), TExpRand.kr(0.001, 0.2, Dust.kr(13)), TRand.kr(0.1, 0.4, Dust.kr(5)),TRand.kr(0.1, 1.9, Dust.kr(3)), mul:amp);\n Out.ar(0,Pan2.ar(sig, pan))\n}).play\n);\n\n(\nSynthDef(\\fhn, {|out=0, pan=0, amp=0.1|\n var sig, trig1, trig2, b0, b1;\n trig1=FhnTrig.kr(5, 8, 0.3, 0.3, 1, 1);\n trig2=FhnTrig.kr(8, 13, 0.27, 0.27, 0.6, 0.8);\n b0=Fhn2DN.kr(3, 5, 0.29, 0.29, 0.5, 1.1, mul:0.23, add:0.25);\n b1=Fhn2DN.kr(2, 3, 0.25, 0.25, 0.2, 1.5, mul:0.48, add:0.5);\n sig=Fhn2DL.ar(110, 22050, TExpRand.kr(0.001, 0.3, trig1), TExpRand.kr(0.001, 0.3, trig2), b0, b1, mul:amp);\n Out.ar(0,Pan2.ar(sig, pan))\n}).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `ToggleFF` in SuperCollider?"}, {"role": "assistant", "content": "ToggleFF — Toggle flip flop. Toggles between 0 and 1 upon receiving a trigger. Category: UGens > Triggers."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var trig = Dust.kr(10);\n SinOsc.ar(\n TExpRand.kr(300.0, 3000.0, trig)\n ) * 0.1\n}.play;\n);\n\n(\n{\n var trig = Dust.ar(MouseX.kr(1, 8000, 1));\n SinOsc.ar(\n TExpRand.ar(300.0, 3000.0, trig)\n ) * 0.1\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var trig = Dust.kr(10);\n SinOsc.ar(\n TExpRand.kr(300.0, 3000.0, trig)\n ) * 0.1\n}.play;\n);\n\n(\n{\n var trig = Dust.ar(MouseX.kr(1, 8000, 1));\n SinOsc.ar(\n TExpRand.ar(300.0, 3000.0, trig)\n ) * 0.1\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Buffer.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Create and return a new Buffer object, without immediately allocating the corresponding memory on the server. This combined with 'message' methods can be flexible with Arguments: server — The server on which to allocate the buffer. The default is the default Server.; numFrames — The number of frames to allocate. Actual memory use will correspond to numFrames * numChannels.; numChannels — The number of channels for the Buffer. The default is 1.; bufnum — An explicitly specified buffer number. Supplying a number bypasses the server's buffer allocator, which can lead to conflicts. The best practice is to leave this unset and let the buffer number allocator choose the next available bufnum.; sampleRate — The sample rate of the buffer. The default is the sample rate of the server.."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\nx = SynthDef(\"help-node-setn\", {\n arg out, freq1 = 440, freq2 = 440, freq3 = 440, amp1 = 0.05, amp2 = 0.05, amp3 = 0.05;\n Out.ar(out, Mix(SinOsc.ar([freq1, freq2, freq3], 0, [amp1, amp2, amp3])))\n}).play;\n);\n// set 3 controls starting from \\freq1, and 3 controls starting from \\amp1\nx.setn(\\freq1, [440, 880, 441], \\amp1, [0.3, 0.1, 0.3];\nx.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\nx = SynthDef(\"help-node-setn\", {\n arg out, freq1 = 440, freq2 = 440, freq3 = 440, amp1 = 0.05, amp2 = 0.05, amp3 = 0.05;\n Out.ar(out, Mix(SinOsc.ar([freq1, freq2, freq3], 0, [amp1, amp2, amp3])))\n}).play;\n);\n// set 3 controls starting from \\freq1, and 3 controls starting from \\amp1\nx.setn(\\freq1, [440, 880, 441], \\amp1, [0.3, 0.1, 0.3]);\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\nSynthDef(\"a\", { Out.ar(0, SinOsc.ar(800, 0, 0.2)) }).add;\n\nSynthDef(\"b\", { |t_t = 0| Out.ar(1, PinkNoise.ar(0.3)); Free.kr(t_t, 1001) }).add;\n\ns.sendMsg(\\s_new, \\a, 1001, 0, 0);\n\ns.sendMsg(\\s_new, \\b, 1002, 0, 0);\n\ns.sendMsg(\\n_set, 1002, \\t_t, 1);\n\ns.sendMsg(\\s_new, \\a, 1001, 0, 0);\n\ns.sendMsg(\\n_set, 1002, \\t_t, 1);\n\ns.sendMsg(\\s_new, \\a,\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\nSynthDef(\"a\", { Out.ar(0, SinOsc.ar(800, 0, 0.2)) }).add;\n\nSynthDef(\"b\", { |t_t = 0| Out.ar(1, PinkNoise.ar(0.3)); Free.kr(t_t, 1001) }).add;\n\ns.sendMsg(\\s_new, \\a, 1001, 0, 0);\n\ns.sendMsg(\\s_new, \\b, 1002, 0, 0);\n\ns.sendMsg(\\n_set, 1002, \\t_t, 1);\n\ns.sendMsg(\\s_new, \\a, 1001, 0, 0);\n\ns.sendMsg(\\n_set, 1002, \\t_t, 1);\n\ns.sendMsg(\\s_new, \\a, 1001, 0, 0);\n\ns.sendMsg(\\n_set, 1002, \\t_t, 1);\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nVowel().brightenExp(1).dBs.postln; \nVowel().brightenExp(0.1).dBs.postln;\nVowel().brightenExp(1.5).dBs.postln;\n\n{Formants.ar(100, Vowel(\\a, \\bass).brightenExp(MouseX.kr(0,5)) * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nVowel().brightenExp(1).dBs.postln; \nVowel().brightenExp(0.1).dBs.postln;\nVowel().brightenExp(1.5).dBs.postln;\n\n{Formants.ar(100, Vowel(\\a, \\bass).brightenExp(MouseX.kr(0,5))) * 0.1 }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for simple smooth arp."}, {"role": "assistant", "content": "```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\smooth, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.linen(0.05, sustain, 0.1), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Bell example using Ndef?"}, {"role": "assistant", "content": "```supercollider\n(\nvar fundamental = 131;\nvar dur = 10;\nvar partials =\n[\n [1, 0.5, dur * 1],\n [1.02, 0.3, dur * 1],\n [1.01, 0.14, dur * 0.5],\n [2.44, 0.17, dur * 0.8],\n [3.31, 0.9, dur * 0.5],\n [5.1, 0.1, dur * 0.56],\n [5.9, 0.1, dur * 0.9],\n [11.01, 0.09, dur * 1],\n [13, 0.01, dur * 0.5],\n [15, 0.01, dur * 0.2],\n [16, 0.05, dur * 0.02],\n [19, 0.10, dur * 0.01],\n [20, 0.01, dur * 0.2],\n [24, 0.01, dur * 0.2],\n [4, 3, dur * 0.002] // attack\n];\n\nNdef(\\quickBell).fadeTime = 0;\nNdef(\\quickBell, {\n var snd, env;\n env = Env.perc(\n attackTime: 0.001,\n releaseTime: partials.flop.at(2),\n level: partials.flop.at(1)\n ).kr;\n // fundamental + inharmonics\n snd = SinOsc.ar(\n freq: fundamental * partials.flop.at(0);\n );\n snd = snd * env;\n snd = Splay.ar(snd);\n snd = Limiter.ar(snd);\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for some scale stuff by a novice-SC lovable unicorn."}, {"role": "assistant", "content": "```supercollider\n(\ns.newBusAllocators;\ns.options.numOutputBusChannels = 2;\n~reverbBus = Bus.audio(s,2);\n\ns.waitForBoot({\n\n Buffer.freeAll;\n ~scale1 = Buffer.loadCollection(\n s,Scale.new(#[0,7,15.93,5,9.7,12,17.5,13.1],12));\n\n SynthDef(\\rainbow,{\n arg buf, samp=0.2,root=37,atk=0.1,decay=10, amp=0.3;\n var sig, index, tonic, freq, env;\n index = LFSaw.kr(samp).range(\\bottom.ir(4),\\top.ir(9));\n index = index*BufFrames.kr(buf);\n tonic = DegreeToKey.kr(buf,index)+root;\n freq = tonic.midicps;\n env = EnvGen.ar(Env.perc(atk,decay,0.7,-2),doneAction:2);\n sig = SyncSaw.ar(root.midicps,freq, mul:0.5)*env;\n sig = BPF.ar(sig, \\cfreq.kr(1000),\\rq.ir(0.3))*amp;\n sig = Pan2.ar(\n sig,\n SinOsc.kr(\n \\rate.kr(0.05).range(-0.9,0.9)+{Rand(-0.6,0.6)}),\n \\level.kr(1),\n );\n Out.ar(\\out.ir(~reverbBus),sig);\n }).add;\n\n SynthDef(\\reverb, {\n arg in=0, out=0, revdecay=5;\n var wet,dry, sig;\n wet = In.ar(~reverbBus,2);\n dry = In.ar(~reverbBus,2);\n wet = CombL.ar(\n wet,\n 0.1,\n SinOsc.kr(0.01).range(0.04,0.1),\n revdecay,\n 0.7);\n wet = LPF.ar(wet,\\lpf.kr(4800));\n sig = XFade2.ar(wet,dry,\\mix.kr(0.2),\\amp.kr(0.3));\n Out.ar(out,sig);\n }).add;\n});\n\nSynth(\\reverb,[\\mix,-0.5],addAction:'addToTail');\n\n~rainbow = Pbind(\n \\instrument, \\rainbow,\n \\dur, Prand([0.2,1.3],inf),\n \\buf, ~scale1,\n \\root, Prand([23,30,35,37],inf),\n \\amp, Pwhite(0.15,0.5,inf),\n \\bottom, Prand([2,5],inf),\n \\top, Pwhite(7.0,9.1,inf),\n \\samp, Pexprand(0.07,0.5,inf),\n \\rate, Pexprand(0.1,3,inf),\n \\cfreq, Pseq([\n Pseries(120,30,76),\n Pseries(2400,-30,76),\n ],inf),\n \\rq, Pkey(\\samp)+Pwhite(0.1,0.15,inf).asStream,\n \\atk, Pexprand(0.04,0.3,inf),\n \\decay, Pexprand(6,15,inf),\n \\level, Env(#[0,1,0],#[100,110],'lin'),\n \\out, ~reverbBus,\n);\n~rainbow.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `BSplineGui.curveGui` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: layout — (describe argument here). Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `UGen`."}, {"role": "assistant", "content": "```supercollider\n{ Blip.ar(Blip.kr(4, 5, 500, 60), 59, 0.1) }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes ~chaos2 (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\n~chaos2={\n var signal, myFrequency, frequencyMin=0.1, frequencyMax=30, myAmplitude, amplitudeMin=0.01, amplitudeMax=0.6, myPhase, phaseMin=0, phaseMax=1.5;\n myFrequency = Array.fill(2, {[rrand(frequencyMin, frequencyMax)]});\n myAmplitude = Array.fill(2, {[rrand(amplitudeMin, amplitudeMax)]});\n myPhase = Array.fill(2, {[rrand(phaseMin, phaseMax)]});\n signal = LeakDC.ar(ChaosGen.allSubclasses.choose.ar(myFrequency, myPhase, myAmplitude));\n myFrequency = (myFrequency + Array.fill(2, {[rrand(frequencyMin, frequencyMax)]})) * (signal);\n myAmplitude = (myAmplitude + Array.fill(2, {[rrand(amplitudeMin, amplitudeMax)]})) * (signal);\n myPhase = (myPhase + Array.fill(2, {[rrand(phaseMin, phaseMax)]}))* (signal);\n signal = LeakDC.ar(ChaosGen.allSubclasses.choose.ar(myFrequency, myPhase, myAmplitude));\n myFrequency = (myFrequency + Array.fill(2, {[rrand(frequencyMin, frequencyMax)]})) * (signal);\n myAmplitude = (myAmplitude + Array.fill(2, {[rrand(amplitudeMin, amplitudeMax)]})) * (signal);\n myPhase = (myPhase + Array.fill(2, {[rrand(phaseMin, phaseMax)]}))* (signal);\n signal = LeakDC.ar(ChaosGen.allSubclasses.choose.ar(myFrequency, myPhase, myAmplitude));\n Out.ar(0, LeakDC.ar(signal * 0.3));\n};\n);\n\n~chaosmegafeedback={Mix.new(~chaos2 ! 16) * 0.00000000000000000000000003}.scope;\n```"}]} -{"conversations": [{"role": "user", "content": "What is `NodeMap`?"}, {"role": "assistant", "content": "NodeMap — store control values and bus mappings"}, {"role": "user", "content": "What does `NodeMap.map` do?"}, {"role": "assistant", "content": "map arguments of a node (synonymous with `set`, mapping is done automatically when a suitable argument is passed)."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n(\nSynthDef(\"modsine\",\n { |out, freq = 320, amp = 0.2|\n Out.ar(out, SinOsc.ar(freq, 0, amp));\n }).add;\nSynthDef(\"lfo\",\n { |out, rate = 2|\n Out.kr(out, LFPulse.kr(rate, 0, 0.1, 0.2))\n }).add;\n);\n\n// start nodes\n(\nb = Bus.control(s, 1);\nx = Synth(\"modsine\");\ny = Synth.before(x, \"lfo\", [\\out, b]);\n);\n\n// create some node maps\n(\nh = NodeMap.new;\nh.set(\\freq, 800);\nh.map(\\amp, b);\n\nk = NodeMap.new;\nk.set(\\freq, 400);\nk.unmap(\\amp);\n);\n\n// apply the maps\n\nh.sendToNode(x); // the first time a new bundle is made\nk.sendToNode(x);\n\nh.sendToNode(x); // the second time the cache is used\nk.sendToNode(x);\n\nh.set(\\freq, 600);\n\nh.sendToNode(x); // when a value was changed, a new bundle is made\n\n// free all\nx.free; b.free; y.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `BezierSpline.fromPoints` do? What arguments does it take?"}, {"role": "assistant", "content": "An alternate Arguments: points — The points for each segment.; controlPoints — Optional, defaulting to no controlPoints. An array of controlPoints arrays, one controlPoint array for each segment. It is of size one less than the number of points, as each controlPoint array is inbetween each point. controlPoint arrays may have 0 or more controlPoints. controlPoints should be of ; isClosed — if the spline loops back to the first point. Returns: a BezierSpline"}]} -{"conversations": [{"role": "user", "content": "What does `Method.primitiveName` do?"}, {"role": "assistant", "content": "Code that implements an operation upon instances of a Class. Returns: A Symbol which contains the name of the primitive function that implements the Method, if there is one."}]} -{"conversations": [{"role": "user", "content": "What does `CCBank.guiOne` do? What arguments does it take?"}, {"role": "assistant", "content": "a set of named MIDI CCResponders Arguments: layout; assc; minWidth."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes playing Pbinds with a MIDI controller (QuNeo, etc)."}, {"role": "assistant", "content": "```supercollider\n// Running Fifths\n// (QuNeo demo)\n//\n//\n// Ctrl + A, then Ctrl + Enter\n\ns.waitForBoot({\n\n MIDIIn.connectAll;\n\n a = Array.fill(8, {arg count; [count, count+7] });\n\n f = {arg velocity, midinote;\n var notes = if(midinote>=44, {a.reverse+midinote}, {a+midinote});\n p = Pbind(\n \\midinote, Pstutter(Pwrand([1, 3, 5], [0.1, 0.8, 0.1], inf), Pseq(notes)),\n \\dur, 0.1,\n \\amp, velocity/127 * 0.8,\n \\legato, 0.1,\n \\ctranspose, Pstutter(8, Pwhite(0, 36))\n ).play(quant: 0.1);\n };\n\n MIDIdef.noteOn(\\test, { arg vel, note; /*note.postln;*/ f.value(vel, note) });\n\n});\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\np = ProxySpace.push(s.boot);\np.reshaping = \\elastic;\n~out.play;\n~out = { Blip.ar(~freq, ~numharm) };\n~freq = 70;\n~numharm = { MouseX.kr(2, 100, 1) };\n\nq = p.copy; p.pop; q.push;\n\nq.reshaping.postln; // also elastic\n~out.play;\n~freq = { MouseY.kr(2, 1000, 1) * [1, 1.2 };\n\np.end; q.end;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\np = ProxySpace.push(s.boot);\np.reshaping = \\elastic;\n~out.play;\n~out = { Blip.ar(~freq, ~numharm) };\n~freq = 70;\n~numharm = { MouseX.kr(2, 100, 1) };\n\nq = p.copy; p.pop; q.push;\n\nq.reshaping.postln; // also elastic\n~out.play;\n~freq = { MouseY.kr(2, 1000, 1) * [1, 1.2] };\n\np.end; q.end;\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Pmul`."}, {"role": "assistant", "content": "```supercollider\n(\nvar a, b;\na = Pmul(\\freq, Pseq([3, 4, 6], 2), Pbind(\\freq, 100));\nx = a.asStream;\n9.do({ x.next(Event.new).postln });\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// hand code a mono signal to a decorrelated soundfield in B-format\n// NOTE: the demonstrated kernel is not ideal for this task\n\n// define encoding kernel\n(\nvar kernelSize;\nvar scale;\n\nkernelSize = 256;\nscale = 24.neg.dbamp;\n\n~kernel = [[\n Buffer.loadCollection(s, FloatArray.fill(kernelSize, {(3/2).sqrt * scale.rand2})),\n Buffer.loadCollection(s, FloatArray.fill(kernelSize, {scale.rand2})),\n Buffer.loadCollection(s, FloatArray.fill(kernelSize, {scale.rand2})),\n Buffer.loadCollection(\n// …\n```"}, {"role": "assistant", "content": "hand code a mono signal to a decorrelated soundfield in B-format NOTE: the demonstrated kernel is not ideal for this task (AtkKernelConv: Kernel convolution from the Ambisonic Toolkit (ATK))"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\nServer.local.quit; // If server running, need to stop it for this example\n\n// We'll modify the server boot procedure to set our env var...\n~realserverprogram = Server.program;\nServer.program = \"export PANCREAS=220;\" + Server.program\ns.boot;\n\n(\nx = {\n// Env var specifies frequency.\n// If you change the env var name to one that isn't set, 440 is used.\nSinOsc.ar(Getenv(\\PANCREAS, 440), 0, 0.1);\n}.play(Server.local);\n);\nx.free;\n\n// This should restore the variable to what it was\nServer.program = ~realserverprogram;\n```"}, {"role": "assistant", "content": "We'll modify the server boot procedure to set our env var... Env var specifies frequency. (Getenv: Read (numeric) shell environment variables into a synth)"}]} -{"conversations": [{"role": "user", "content": "What is `Latency`?"}, {"role": "assistant", "content": "Latency — Measure audio latency for multiple channels"}, {"role": "user", "content": "What does `Latency.testAudio` do?"}, {"role": "assistant", "content": "main method to measure audio latency"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// server has hardwareBufferSize 512 for this example.\ns.options.hardwareBufferSize = 512; s.reboot;\n// do something that sends messages with server latency\nPbind(\\degree, Pbrown(-14, 14, 3), \\dur, 1/8).play;\ns.latency;\ns.latency = 0.1; // tune down ...\ns.latency = 0.05;\ns.latency = 0.025;\ns.latency = 0.012; // ... until every message posts \"late 0.01....\" now\ns.latency = 0.018; // go back up -> fewer late messages\ns.latency = 0.021; // go back up until ...\ns.latency = 0.024; // late messages are completely gone again\n\ns.latency = 0.03; // this works on many systems\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Looping sampler with crossfading."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\\simpler, {\n arg buf=0\n ,freq=220\n ,sampleStart=0\n ,loopStart=0\n ,loopLen=1 // between 0 (min) and 1 (max)\n ,fadeTime=0.1\n ,gate=1\n ,attack=0.01\n ,sustain=1\n ,release=1\n ,f0=220;\n\n var rate = freq / f0;\n var sr = rate*BufSampleRate.kr(buf);\n var fadeFrames = fadeTime*sr;\n var loopEnd = loopLen*(BufFrames.kr(buf) - loopStart) + loopStart;\n var loopFrames = loopEnd - loopStart + 1;\n var loopTime = (loopFrames - fadeFrames)/sr;\n var startUpTime = (loopStart - sampleStart)/sr;\n\n var trigLoop = TDuty.ar(Dseq([startUpTime + loopTime, Dseq([loopTime], inf)]), gapFirst:1);\n\n var phaseA = Phasor.ar(trigLoop, rate, sampleStart, inf, loopStart);\n var phaseB = Phasor.ar(trigLoop, rate, loopEnd - fadeFrames, inf, loopEnd - fadeFrames);\n\n var srcA = BufRd.ar(buf.numChannels, buf, phaseA);\n var srcB = BufRd.ar(buf.numChannels, buf, phaseB);\n\n var startLoop = SetResetFF.ar(trigLoop);\n var loopPan = Phasor.ar(trigLoop, 2/fadeFrames * rate, -1, inf, -1).clip(-1,1);\n\n var out = Select.ar(startLoop, [srcA, LinXFade2.ar(srcB, srcA, pan:loopPan)]);\n var env = EnvGen.ar(Env.asr(attack, sustain, release, 1), gate, doneAction:2);\n\n Out.ar(0, Splay.ar(out) * env);\n}).add;\n\n// Try it out:\n~buf = Buffer.read(s, Platform.resourceDir +/+ 'sounds/a11wlk01.wav');\n\nPdef(\\p, Pbind(*[\n instrument: \\simpler\n ,buf: ~buf\n ,octave: Prand([3,4,5],inf)\n ,degree: Pn(Plazy({Pseq([-4,0,5,7,9,12].scramble.clump(2),2)}))\n ,dur: 0.5\n ,strum: Prand([0, 0.125, 0.25], inf)\n ,strumEndsTogether: false\n ,loopStart: Pwhite(90000, 150000)\n ,sampleStart: Pwhite(50000, 85000)\n ,loopLen: 0.4\n ,fadeTime: 0.15\n ,attack: 0.25\n ,release: 4\n])).play;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// poor man's panning\n{\n var f, hornbostelwertheimerkonstante;\n f = MouseY.kr(1, 100, 1);\n hornbostelwertheimerkonstante = 0.00063;\n Impulse.ar(f, hornbostelwertheimerkonstante * f * [1, MouseX.kr(0, 2)], 0.1) \n}.play\n```"}, {"role": "assistant", "content": "If you are too poor to afford changing the amplitudes of a stereo signal, just let the channels wait. But the signal frequency is an impasse that is to be valued in itself."}]} -{"conversations": [{"role": "user", "content": "What does `File.getcwd` do?"}, {"role": "assistant", "content": "POSIX standard 'get current working directory'. `//"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// given a simple instrument\nInstr(\\Pulse,{ arg freq=440.0,width=0.5,mul=0.1;\n Pulse.ar( freq, width, mul )\n});\n\n// a patch specifies inputs (arguments) to that instrument\np = Patch( \\Pulse, [ 300, 0.2, 0.1 ]);\n\n//the default server will be booted, the SynthDef written and loaded\np.play;\n\n;\n\np.stop;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// given a simple instrument\nInstr(\\Pulse,{ arg freq=440.0,width=0.5,mul=0.1;\n Pulse.ar( freq, width, mul )\n});\n\n// a patch specifies inputs (arguments) to that instrument\np = Patch( \\Pulse, [ 300, 0.2, 0.1 ]);\n\n//the default server will be booted, the SynthDef written and loaded\np.play;\n\n);\n\np.stop;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `List`."}, {"role": "assistant", "content": "```supercollider\n// Create a new empty collections with size 3:\nx = Array.new(3);\ny = Array.new(3);\nz = List.new(3);\n\n// Try to add 7 items to the array and list.\n// If the array exceeds maxSize, it will only\n// grow to an internally specified max size.\n(\n7.do { |i|\n x.add(i);\n y = y.add(i); // reassign array y on each add\n z.add(i);\n};\n);\n\n// Attempt to access the 5th item:\nx.at(4); // -> nil (out of bounds)\ny.at(4); // -> 4\nz.at(4); // -> 4\n\n// x grew only to size 4\nx.postln; // -> [ 0, 1, 2, 3 ]\ny.postln; // -> [ 0, 1, 2, 3, 4, 5, 6 ]\nz.postln; // -> List[ 0, 1, 2, 3, 4, 5, 6 ]\n```"}]} +{"conversations": [{"role": "user", "content": "What does `U.prepareAndStart` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: target — (describe argument here); loadDef — (describe argument here). Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = {LFTri.ar(100+(1000*Maths2.ar(MouseX.kr, MouseY.kr, 0.2, 1, 0, 1, LFPulse.ar(2))[0]), 0, 0.1}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = {LFTri.ar(100+(1000*Maths2.ar(MouseX.kr, MouseY.kr, 0.2, 1, 0, 1, LFPulse.ar(2))[0]), 0, 0.1)}.play\n```"}]} +{"conversations": [{"role": "user", "content": "What does `KeyCodeResponder.optionModifier` do?"}, {"role": "assistant", "content": "register responder functions for keycode and modifier combinations"}]} +{"conversations": [{"role": "user", "content": "How do I set the tempo?"}, {"role": "assistant", "content": "TempoClock.default.tempo = 120/60; the argument is beats per second, so 120 BPM is 2.0. Patterns scheduled on the default clock then follow it."}]} +{"conversations": [{"role": "user", "content": "Approaches to recording generated midi in DAW?"}, {"role": "assistant", "content": "SuperCollider forum — Approaches to recording generated midi in DAW?\n\nToday I spent another 6 hours or so trying to record in ardour (linux) both the midi information generated by supercollider and the audio generated by sending this midi to external synths. I finally hit the right combination of magic to make it work and I want to add my recipe in this thread so that I can find it back the future (and perhaps it also works for someone else).\n\nIngredient 1: a2jmidid. You can run it manually on the command line using “a2jmidid -e” or (like me) you can just use the “start midi bridge” button in the jack front-end application “Cadence” (enable the “export hardware ports checkbox”)\n\nIngredient 2: In supercollider itself, it is extremely important to only connect to a port and not to specify a destination uid. It seems that by specifying a destination uid, supercollider gets some kind of direct connection to the midi destination and ardour can no long introspect/record what is happening (I know it doesn’t sound scientific - this is purely the result of empiric observation/frustration.\n\nSo in supercollider, simply use\n\n```supercollider\n~synth1 = MIDIOut(0);\n~synth2 = MIDIOut(1);\n```\n\nand then in ardour’s Window->Midi Connections dialog, you can connect the out ports from supercollider to both your external synth and the track in which you want to record the midi information.\n\nFor midi driver in jack you can configure None.\n\nIf you want to record the generated midi in ardour, do NOT use connection syntax like\n\n```supercollider\n~synth1 = MIDIOut(0, MIDIClient.destinations[2].uid);\n```\n\nand do NOT use\n\n```supercollider\n~synth1 = MIDIOut.newByName(\"INTEGRA-7\", \"INTEGRA-7 MIDI 1\");\n```\n\nIf you just want to send midi to the external synth without recording the information, both previous ways of connecting work as well but these ways of connecting appear to work only if the jack MIDI driver is configured to use “ALSA sequencer” mode. It doesn’t seem to work with “None” or “ALSA Raw” (this may need some further investigation to clear out)."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `EnvGen`."}, {"role": "assistant", "content": "```supercollider\n{ PinkNoise.ar(EnvGen.kr(Env.perc, doneAction: Done.freeSelf)) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "What does `LinCongC.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Linear congruential chaotic generator Arguments: freq — Iteration frequency in Hertz; a — Multiplier amount; c — Increment amount; m — Modulus amount; xi — Initial value of x."}]} +{"conversations": [{"role": "user", "content": "How do I make a delay line?"}, {"role": "assistant", "content": "`CombN.ar(in, maxdelaytime, delaytime, decaytime)` is a feedback delay: maxdelaytime is the buffer size, delaytime the actual delay (and it can modulate), decaytime how long the repeats take to die. For a clean single echo use `DelayN.ar(in, maxdelaytime, delaytime)`, which has no feedback. Both replace the `in` with the delayed signal, so mix with the dry: `dry + CombN.ar(dry, 0.5, 0.3, 2) * 0.4`."}]} +{"conversations": [{"role": "user", "content": "What is `SendPeakRMS`?"}, {"role": "assistant", "content": "SendPeakRMS — Track peak and power of a signal for GUI applications."}, {"role": "user", "content": "What does `SendPeakRMS.ar` do?"}, {"role": "assistant", "content": "Unlike with other unit generators, the `ar` and `kr` methods do not specify the rate of the computation, but the granularity. When the SendPeakRMS ugen is instantiated with `kr`, the reply rate is quantized to control-rate blocks."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\n{\n SendPeakRMS.kr(Dust.ar(20), 20, 3, \"/replyAddress\")\n}.play;\n);\n\n(\no = OSCFunc({ |msg|\n \"peak: %, rms: %\".format(msg[3], msg[4]).postln\n}, '/replyAddress');\n);\no.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SequenceableCollection.rejectIndicesAs` do?"}, {"role": "assistant", "content": "Return a new collection of type class which consists of all indices of those elements of the receiver for which function answers `false`. The function is passed two arguments, the item and an integer index. `#[a, b, c, g, h, h, j, h].rejectIndicesAs({ |item, i| item"}]} +{"conversations": [{"role": "user", "content": "What is `BAllPass` in SuperCollider?"}, {"role": "assistant", "content": "BAllPass — All Pass Filter The B equalization suite is based on the Second Order Section (SOS) biquad UGen. Category: UGens > Filters > BEQSuite."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `InTrig`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\ns = Server.local;\nb = Bus.control(s, 1);\n\nSynthDef(\"help-InTrig\", { |out = 0, busnum = 0|\n var inTrig;\n inTrig = InTrig.kr(busnum);\n Out.ar(out,\n EnvGen.kr(Env.perc, gate: inTrig, levelScale: inTrig) * SinOsc.ar\n )\n}).play(s, [\\out, 0, \\busnum, b.index]);\n\n\nb.set(1.0);\n\nb.value = 1.0;\n\nb.value = 0.2;\n\nb.value = 0.1;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pan2`."}, {"role": "assistant", "content": "```supercollider\n// hear the difference, LinPan having a slight drop in the middle...\n{ LinPan2.ar(SinOsc.ar(440), Line.kr(-1, 1, 5)) }.play\n\n// ... whereas Pan2 is more smooth\n{ Pan2.ar(SinOsc.ar(440), Line.kr(-1, 1, 5)) }.play\n\n// other examples\n{ Pan2.ar(PinkNoise.ar(0.4), FSinOsc.kr(2), 0.3) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SequenceableCollection.indexIn` do?"}, {"role": "assistant", "content": "Returns the closest index of the value in the collection (collection must be sorted). `[2, 3, 5,"}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n~buf = Buffer.read(s, \"C:/sounds/break.wav\");\nPlayBuf.ar(1, ~buf, BufRateScale.kr(~buf), loop: 1);\n```"}, {"role": "assistant", "content": "Loads a sound file into server memory, then plays it in a loop at the file's original pitch.\n\n- `Buffer.read(s, path)` allocates a buffer on the server and fills it from the file. It is asynchronous:\n the Buffer object returns immediately, the samples arrive later.\n- `PlayBuf.ar(1, buf, ...)` needs the channel count first — 1 for a mono file. A wrong count is the usual\n cause of a buffer that plays wrongly or not at all.\n- `BufRateScale.kr(buf)` compensates when the file's sample rate differs from the server's, so `rate: 1` is\n the file's true speed.\n- `loop: 1` restarts at the end instead of stopping.\n\nBecause the read is asynchronous, this line pair is only safe if a `s.sync` or a wait happened in between;\notherwise PlayBuf sees a buffer with no data yet."}]} +{"conversations": [{"role": "user", "content": "Saving \"Presets\"?"}, {"role": "assistant", "content": "SuperCollider forum — Saving \"Presets\"?\n\nIf you don’t care too much about it being human readable, just use writeArchive and readArchive:\n\n```supercollider\na = Array.fill(400, {rrand(0,2200)});\n\na.writeArchive(\"/Users/spluta1/Documents/SC/test\");\n\nb = Object.readArchive(\"/Users/spluta1/Documents/SC/test\");\n\nb.postln;\n```\n\nSam"}]} +{"conversations": [{"role": "user", "content": "What does `PatchOut.prNew` do? What arguments does it take?"}, {"role": "assistant", "content": "manages a Player's output when connecting to other Players Arguments: source; group; bus."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Symbol`."}, {"role": "assistant", "content": "```supercollider\na = { Ringz.ar(T2A.ar(\\trig.tr), \\freq.kr(500, 1), 0.8) }.play;\na.set(\\freq, 330, \\trig, 1);\na.set(\\freq, 830, \\trig, 1);\na.release;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `GrainFM` in SuperCollider?"}, {"role": "assistant", "content": "GrainFM — Granular synthesis with frequency modulated sine tones Category: UGens > Generators > Granular."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// constant source (72), max deviation +/- 3\n// no repetition within 5 pitches\n\n(\nx = {\n var trig = Impulse.ar(5);\n var midi = Demand.ar(trig, 0, DIdev(72, 2, -1, 2));\n midi.poll(5, label: \\midi);\n SinOsc.ar(midi.midicps.lag(0.007)) ! 2 * 0.1\n}.play;\n;\n\nx.release\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// constant source (72), max deviation +/- 3\n// no repetition within 5 pitches\n\n(\nx = {\n var trig = Impulse.ar(5);\n var midi = Demand.ar(trig, 0, DIdev(72, 2, -1, 2));\n midi.poll(5, label: \\midi);\n SinOsc.ar(midi.midicps.lag(0.007)) ! 2 * 0.1\n}.play;\n);\n\nx.release\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Harmonics`?"}, {"role": "assistant", "content": "Harmonics — Convenient factory for filling buffers with harmonics on the server"}, {"role": "user", "content": "What does `Harmonics.new` do?"}, {"role": "assistant", "content": "Create a new Harmonics array of size. Nothing is filled in for you, until instance methods are applied. `a = Harmonics.new(16); // just returns an instance of Harmon`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na.ramp(1.0, 1.0); // returns a harmonic series\n\nb = Buffer.alloc(s, 512, 1);\n// harmonic series for freqs, ramp down for amps\nb.sine2(a.ramp(1.0, 1.0).postln, a.ramp(0.5, -0.025).postln, true, true, true);\n(\nz = SynthDef(\"help-Osc\", { |out = 0, bufnum = 0|\n Out.ar(out,\n Osc.ar(bufnum, 200, 0, 0.5)\n )\n});\n);\ny = z.play(s, [\\out, 0, \\bufnum, b]);\ny.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `SPlayFileDiskStereo` in SuperCollider briefly."}, {"role": "assistant", "content": "SPlayFileDiskStereo — a sound file player that streams from disk in stereo This class is a wrapper for VDiskIn and will take any soundfile with 1, 2 or 4 (by default) channels and mix it down and play it in STEREO. Use SPlayFileDisk for mixing down and playing in MONO, and SPlayFileDiskQuad for QUAD playback. Category: SInstruments."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\ns.boot;\n\n// The mul and add arguments of SinOsc themselves use MulAdd!\n// These two examples will create precisely the same synth graph:\nx = { SinOsc.ar(440, 0, 0.1, 0.05) }.play(s);\nx.trace; // You should see a \"MulAdd\" in the trace\nx.free;\n\nx = { MulAdd(SinOsc.ar(440, 0), 0.1, 0.05) }.play(s);\nx.trace;\nx.free;\n\n// In fact this will produce the same graph too - the separate multiply and add are optimised into one MulAdd\nx = { SinOsc.ar(440, 0) * 0.1 + 0.05 }.play(s);\nx.trace;\nx.free;\n```"}, {"role": "assistant", "content": "The mul and add arguments of SinOsc themselves use MulAdd! These two examples will create precisely the same synth graph: (MulAdd: Multiply and add to a signal)"}]} +{"conversations": [{"role": "user", "content": "How do I make this brighter?\n```supercollider\n{ LPF.ar(Saw.ar(110), 400) * 0.2 }.play;\n```"}, {"role": "assistant", "content": "Raise the cutoff. 400 Hz is well below the harmonics that carry brightness, so open it to 2000-4000 Hz:\n\n```supercollider\n{ LPF.ar(Saw.ar(110), 3000) * 0.2 }.play;\n```"}, {"role": "user", "content": "Still dull."}, {"role": "assistant", "content": "Then the low-pass is not the limit — the source is. A saw at 110 Hz has energy up to Nyquist, so check the amplitude: at 0.2 the high harmonics are quiet. Two moves: add resonance so the filter peak is audible, and raise the level slightly.\n\n```supercollider\n{ RLPF.ar(Saw.ar(110), 2500, 0.3) * 0.35 }.play;\n```\n\nIf that is still dull, the answer is a different source: `Saw` is band-limited and soft; try `LFSaw` or add a second detuned saw for more high content."}]} +{"conversations": [{"role": "user", "content": "What does `Maybe.new` do? What arguments does it take?"}, {"role": "assistant", "content": "create a new Arguments: thing — an object or nil. `a = Maybe.new;`."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Env`."}, {"role": "assistant", "content": "```supercollider\n// an envelope in a synth\n(\n{\n var env = Env([0, 1, 0.5, 1, 0], [0.01, 0.5, 0.02, 0.5]);\n SinOsc.ar(470) * EnvGen.kr(env, doneAction: Done.freeSelf)\n}.play\n);\n// an envelope to control a parameter in a pattern\n(\nPbind(\n \\note, Env([0, 12, 6, 13, 0], [1, 5, 2, 10]),\n \\dur, 0.1\n).play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `VarGui.gui` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a gui Arguments: sliderHeight — Gui slider height. Defaults to 18.; sliderWidth — Gui slider width. Depends on number of columns if not given explicitely.; labelWidth — Slider label width. Default depends on platform and gui scheme (70 or 75).; numberWidth — Slider numberbox width. Default depends on platform and gui scheme (40 or 45).; sliderType — One of the Symbols \\standard, \\smooth, \\round. Both latter refer to EZSmoothSlider and EZRoundSlider from wslib (Quark), which needs to be installed for that choice. See #Ex. 8#Ex.8 . Defaults to \\standard.; sliderMode — One of the Symbols \\jump, \\move. Only relevant in case of sliderType \\smooth or \\round. Determines behaviour if slider field is clicked apart from the knob. See #Ex. 8#Ex.8. Defaults to \\jump.; playerHeight — Gui player height. Defaults to 18.; precisionSpan — Integer. Precision span to be regarded for representation of controlspec step. See #Ex. 9#Ex.9. Defaults to 10.."}]} +{"conversations": [{"role": "user", "content": "How do I stop all sound?"}, {"role": "assistant", "content": "s.freeAll stops every node on the server. On the language side, Ndef.clear and Pdef.clear clear the proxies. If a Pattern is still running, Pdef(\\name).stop does it; CmdPeriod immediately stops everything scheduled on the default clock."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n~mdef =\n{\n |key, func, msgNum, permanent = true|\n\n MIDIdef(key, func ?? { MIDIdef(key).func }, msgNum ? MIDIdef(key).msgNum, MIDIdef(key).chan, MIDIdef(key).msgType, MIDIdef(key).srcID).permanent_(permanent)\n}\n```"}, {"role": "assistant", "content": "Change arg values of MIDIdef after instantiation (a SuperCollider snippet)."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Timer`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// using timer to modulate sine frequency: the slower the trigger is the higher the frequency\n(\n{ var trig;\n trig = Impulse.kr(MouseX.kr(0.5, 20, 1));\n SinOsc.ar(Timer.kr(trig) * 500 + 500, 0, 0.2)\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Hasher.ar(Line.ar(0, 1, 1), 0.2) }.play;\n\n// Even adding a small amount to the input can result in a very different output. Compare these two examples:\n(\n{\n SinOsc.ar(\n Hasher.kr(MouseX.kr(0, 10).round(1), 300, 500)\n ) * 0.1\n}.play;\n);\n\n(\n{\n SinOsc.ar(\n Hasher.kr(MouseX.kr(0, 10).round(1) + 0.0001, 300, 500)\n ) * 0.1\n}.play;\n);\n\n// Output stays constant while not moving the mouse.\n(\n{\n SinOsc.ar(\n Hasher.kr(MouseX.kr(0, 10), 300, 500)\n ) * 0.1\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Hasher.ar(Line.ar(0, 1, 1), 0.2) }.play;\n\n// Even adding a small amount to the input can result in a very different output. Compare these two examples:\n(\n{\n SinOsc.ar(\n Hasher.kr(MouseX.kr(0, 10).round(1), 300, 500)\n ) * 0.1\n}.play;\n);\n\n(\n{\n SinOsc.ar(\n Hasher.kr(MouseX.kr(0, 10).round(1) + 0.0001, 300, 500)\n ) * 0.1\n}.play;\n);\n\n// Output stays constant while not moving the mouse.\n(\n{\n SinOsc.ar(\n Hasher.kr(MouseX.kr(0, 10), 300, 500)\n ) * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\nSynthDef(\\a, { Out.ar(0, SinOsc.ar(800, 0, 0.2)) }).add;\n\nSynthDef(\\b, { |gate = 1| Out.ar(1, PinkNoise.ar(0.3)); Pause.kr(gate, 1001) }).add;\n\ns.sendMsg(\\s_new, \\a, 1001, 0, 0);\n\ns.sendMsg(\\s_new, \\b, 1002, 0, 0);\n\ns.sendMsg(\\n_set, 1002, \\gate, 0);\n\ns.sendMsg(\\n_set, 1002, \\gate, 1;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\nSynthDef(\\a, { Out.ar(0, SinOsc.ar(800, 0, 0.2)) }).add;\n\nSynthDef(\\b, { |gate = 1| Out.ar(1, PinkNoise.ar(0.3)); Pause.kr(gate, 1001) }).add;\n\ns.sendMsg(\\s_new, \\a, 1001, 0, 0);\n\ns.sendMsg(\\s_new, \\b, 1002, 0, 0);\n\ns.sendMsg(\\n_set, 1002, \\gate, 0);\n\ns.sendMsg(\\n_set, 1002, \\gate, 1);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = WhiteNoise.ar; // a WhiteNoise\nb = a.squared; // a UnaryOpUGen.\nb.operator; // squared\n\n// sound example\n\n{ var a = LFSaw.ar(300).range(0, 2pi); a.sin * 0.1 }.play;\n\n// Plotting the \"abs\" unary operator (via the server):\n\n{ SinOsc.ar(300.abs }.plot\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = WhiteNoise.ar; // a WhiteNoise\nb = a.squared; // a UnaryOpUGen.\nb.operator; // squared\n\n// sound example\n\n{ var a = LFSaw.ar(300).range(0, 2pi); a.sin * 0.1 }.play;\n\n// Plotting the \"abs\" unary operator (via the server):\n\n{ SinOsc.ar(300).abs }.plot\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Fb1_ODEintdef.remove` do? What arguments does it take?"}, {"role": "assistant", "content": "Removes the Fb1_ODEintdef of the Symbol key from the Arguments: key — Symbol.."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PulseDivider`."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\"help-PulseDivider\", { |out = 0|\n var p, a, b;\n p = Impulse.ar(8);\n a = SinOsc.ar(1200, 0, Decay2.ar(p, 0.005, 0.1));\n b = SinOsc.ar(600, 0, Decay2.ar(PulseDivider.ar(p, 4), 0.005, 0.5));\n\n Out.ar(out, (a + b) * 0.4)\n}).play;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `FoaSFVL` in SuperCollider?"}, {"role": "assistant", "content": "FoaSFVL — First Order Ambisonic (FOA) Soundfield Velocity Level Return the Soundfield Velocity Level, SFVL, of a first order ambisonic (B-format) signal, in dB. Category: Libraries > Ambisonic Toolkit > UGens > FOA > Analyzer, UGens > Multichannel > Ambisonics, UGens > Analysis > Ambisonics."}]} +{"conversations": [{"role": "user", "content": "Synth Iteration Help?"}, {"role": "assistant", "content": "SuperCollider forum — Synth Iteration Help\n\n```supercollider\n(\nSynthDef (\\sine_tone) {\narg freq = 440, amp = 1, len = 1, bus = 0;\nvar sig, env;\nenv = Env.step ([ amp ], [ len ]);\nenv = EnvGen.kr (env, doneAction: 2);\nsig = SinOsc.ar (freq, 0, env);\nOut.ar (bus % 2, sig); // bus modulo 2 here to wrap to stereo\n}.add;\n)\n```\n\nmaybe try wrapping the bus array to [ 0, 1 ] by using modulo: bus % 2. this should let you hear what is going on using a stereo output\n\nby using a Pbind, each “note” is being instantiated as a separate synth with its own length, amplitude, frequency and bus. the doneAction: 2 argument in the EnvGen.kr ugen just means each synth will free itself once it is done playing the note it has been assigned."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `History` that runs as it is."}, {"role": "assistant", "content": "```supercollider\nHistory.clear.end; // if needed, clear History first\nHistory.start; // starts recording, opens log file\n\n// execute these lines one by one, as a little performance history\n1 + 2;\np = ProxySpace.push(s.boot);\n~a = { Dust.ar([1, 1] * 30) * 0.3 };\n~a.play;\n~a.end(3);\n\nHistory.started; // is it on now?\n\n// stops recording history and ends logging.\nHistory.end;\nHistory.started;\n\nHistory.document; // creates a document with current history\nHistory.showLogFolder; // opens the folder where logs are written.\nHistory.showLogFile; // opens the current log file as it was written.\n\n\n// make a gui window, to access code history lines at will,\n// e.g. for code reuse in performance, adaptation, sharing, etc:\ng = History.makeWin;\n// specify left-bottom position, and number of lines in textview\ng = History.makeWin(0@20, 5);\n\n// play back the recorded history line by line\nHistory.play(0);\n\n\n// history can even record and play back stops with CmdPeriod.\n// run these lines one at a time:\nHistory.clear.start;\n1 + 2;\n2 + 3;\ns.boot;\n(dur: inf).play;\n\nCmdPeriod.run; // or hit the Stop key command, Cmd-., or ctrl-.\n3 + 4; // continue recording into history\n4 + 5;\nHistory.end;\n\n// Replays history, including a CmdPeriod, and keeps replaying history.\nHistory.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `HoaBalance.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Higher Order Ambisonic (HOA) balance transformer Arguments: in — The input signal.; angle — Distortion angle, in radians. -pi/2 to pi/2; radius — Radius, in meters.; order — Ambisonic order.."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `DetectSilence`."}, {"role": "assistant", "content": "```supercollider\n// this frees after the Decay has become quiet enough for a long enough time\n{ var signal = Decay.ar(Impulse.ar(0), 2, PinkNoise.ar(0.2)); DetectSilence.ar(signal, doneAction: Done.freeSelf); signal }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// modulate fundamental frequency, formant freq stays constant\n{ Formant.ar(XLine.kr(400, 1000, 8), 2000, 800, 0.125) }.play\n\n// modulate formant frequency, fundamental freq stays constant\n{ Formant.ar(200, XLine.kr(400, 4000, 8), 200, 0.125) }.play\n\n// modulate width frequency, other freqs stay constant\n{ Formant.ar(400, 2000, XLine.kr(800, 8000, 8), 0.125 }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// modulate fundamental frequency, formant freq stays constant\n{ Formant.ar(XLine.kr(400, 1000, 8), 2000, 800, 0.125) }.play\n\n// modulate formant frequency, fundamental freq stays constant\n{ Formant.ar(200, XLine.kr(400, 4000, 8), 200, 0.125) }.play\n\n// modulate width frequency, other freqs stay constant\n{ Formant.ar(400, 2000, XLine.kr(800, 8000, 8), 0.125) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\freq, Pseq([500, 600, 700]), \\instrument, \\sinegrain);\na = Paddp(\\freq, Pseq([30, 90, -100], inf), a);\na.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\freq, Pseq([500, 600, 700]), \\instrument, \\sinegrain);\na = Paddp(\\freq, Pseq([30, 90, -100], inf), a);\na.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// q.zoom sets all the influx'es inScalers AND RandomOrbit's excursion from current state.\n\nq.zoom = q.zoom?1;\n\nq.setZoom = {|ev, val|\n val = val.clip(0.05, 1.0).round(0.05);\n // \"global ZOOM f. RandomOrbits and Influxes: %\\n\".postf(val);\n q.zoom = val;\n // do external funcs here\n try{ q.prez.ezs.value = q.zoom };\n q.inphlux.inScaler = q.zoom;\n // return value\n val\n};\n// increment / decrement\nq.incZoom = {|ev, inc=0.1|\n q.setZoom((q.zoom + inc));\n};\n\n\n// set it to poti on ana in 8 (it was 7, not worked)\nMKtl(\\xosc).elAt('inA').at(7).action.add(\\setZoom, {|el|\n var val = el.value.clip(0.05, 1).round(0.05);\n if (val != q.zoom) {\n \"zoom from xosc: %\\n\".postf(val);\n q.setZoom(val)\n };\n});\n```"}, {"role": "assistant", "content": "q.zoom sets all the influx'es inScalers AND RandomOrbit's excursion from current state."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `LFSaw`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\nfork {\n ~group = Group();\n\n 2.wait;\n\n SynthDef(\\buzz, {\n |out = 0, freq = 300, amp = 0.1, filter = 1.7|\n var sig = LFSaw.ar(freq * [1, 3, 5], 0, amp * [1, 0.5, 0.25]).sum;\n sig = LPF.ar(sig, freq * filter);\n Out.ar(out, sig);\n }).add;\n\n [50, 53, 58, 46, 60].midicps.do {\n |f, i|\n Synth(\\buzz, [\n \\out: 0, \\freq, f, \\filter: (i / 2) + 1\n ], target:~group);\n 2.wait;\n };\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SCViewHolder.background` do? What arguments does it take?"}, {"role": "assistant", "content": "This method is forwarded to the Arguments: b. Returns: The result of calling the method on the proxied view"}]} +{"conversations": [{"role": "user", "content": "What are the arguments of Pan2?"}, {"role": "assistant", "content": "`Pan2.ar(in, pos, level)` — in is the mono signal, pos is -1 (left) to 1 (right) with 0 in the middle, and level scales the output. It is equal-power, so a centred signal is -3 dB per channel rather than half amplitude. `Pan2.ar(sig, SinOsc.kr(0.1))` is the simplest autopan."}]} +{"conversations": [{"role": "user", "content": "What does `PatchIn.connectedTo` do?"}, {"role": "assistant", "content": "manages a Player's input when connecting to other Players"}]} +{"conversations": [{"role": "user", "content": "What does `ServerLogGui.cmd_nfree` do? What arguments does it take?"}, {"role": "assistant", "content": "the interface for display and searching the ServerLog Arguments: msg; r. Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SharedOut`."}, {"role": "assistant", "content": "```supercollider\n(\n// only works with the internal server\ns = Server.internal;\ns.boot;\n);\n\n(\nSynthDef(\"help-SharedOut\", {\n SharedOut.kr(0, SinOsc.kr(0.2));\n}).add;\n);\n\n(\ns.sendMsg(\\s_new, \"help-SharedOut\", x = s.nextNodeID, 0, 1);\ns.sendMsg(\\n_trace, x);\n\n// poll the shared control bus\nRoutine({\n 30.do({\n s.getSharedControl(0).postln;\n 0.2.wait;\n });\n}).play;\n);\n\n\ns.quit;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\ns.plotTree;\n\n// Define and play a repeating pattern that generates a new synth every 0.4 seconds:\nx = Pn((dur: 0.4, midinote: 69, amp: 0.1)).play;\n\n/*\nThe NodeTreeView window dynamically displays active synth nodes.\nInitially, it shows the first node, and upon each refresh, it retains the previous node while adding a new one.\nThis results in the display of one or two subsequent nodes at each interval.\n*/\n\n// stop updating plotTree:\ns.nodeTreeView.stop;\n\n// start updating plotTree:\ns.nodeTreeView.start;\n\n// stop the playback of the pattern:\nx.stop;\n\ns.nodeTreeV\n// …\n```"}, {"role": "assistant", "content": "Define and play a repeating pattern that generates a new synth every 0.4 seconds: stop updating plotTree: (Server: Object representing a server application)"}]} +{"conversations": [{"role": "user", "content": "Splay - not getting spread, wrong use?"}, {"role": "assistant", "content": "SuperCollider forum — Splay - not getting spread, wrong use?\n\nYou need to undestand that if you have two identical signal coming from left and right it will always be mono. No stereo spread possible. So you need to introduce (at least) two different signals - and just different amplification will not really work.\n\nTo expand your first example, we can introduce an array of values for paramtere pos:\n\n```supercollider\n(\nx = { arg spread=1, level=0.2, center=0.0;\n Splay.ar(\n GrainBuf.ar(numChannels: 1,\n trigger: Impulse.kr(1.2875),\n dur: Impulse.kr(1.2875),\n sndbuf: b,\n pos:[0,0.5],\n interp: 1\n ),\n spread,\n level,\n center\n );\n}.play;\n);\n\nx.set(\\spread, 1, \\center, 0); // full stereo\nx.set(\\spread, 0, \\center, 0); // mono center\n```\n\nBy way of Multichannel Expansion this creates two different signals (channels, an array of 2 UGen graphs) that you can hear as different and therefore observe the stereo spread.\n\nAnd similarly, to use your other example with In.ar where I have added in=2, so that it takes my mic in (but you can specify another bus) and wrapped it into a feedback delay with an array of two values for delayTime. Multichannel expansion thus creates two channels that are different because they have different delaytimes but the rest of UGen graph is the same (a copy). Changing spread now works:\n\n```supercollider\n(\nSynthDef(\\stereo,{|out=0, in=2, spread=1, level=1, center=0.0|\n Out.ar(out,\n Splay.ar(\n CombN.ar(\n In.ar(in, 1), 1, [0.3,0.4], 2)\n ,spread,level,center));\n}).play;\n)\n```\n\nI hope that clarifies the issue better."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Compare:\n\n{ WhiteNoise.ar(0.25) }.play;\n\n{ BPZ2.ar(WhiteNoise.ar(0.25) }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Compare:\n\n{ WhiteNoise.ar(0.25) }.play;\n\n{ BPZ2.ar(WhiteNoise.ar(0.25)) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BusPlug`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\nz = Bus.control(s, 16);\nz.setn({ |i| (i * 5).nthPrime } ! 16 * 5 + 100);\na = BusPlug.for(z);\n{ Splay.ar(SinOsc.ar(a.kr(3, MouseX.kr(0, 25)))) * 0.1 }.play; // selectively play 3 channel of the 16, modulate offset\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Saw`."}, {"role": "assistant", "content": "```supercollider\n// modulating the frequency\n\n{ Saw.ar(XLine.kr(40, 4000, 6), 0.2) }.play;\n\n// two band limited sawtooth waves through a resonant low pass filter\n\n{ RLPF.ar(Saw.ar([100, 250], 0.1), XLine.kr(8000, 400, 5), 0.05) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\ns.boot;\n\n// no decay\n(\n{\n SinOsc.ar(\n PeakFollower.ar(Dust.ar(20, Line.kr(0, 1, 4)), 1.0) * 1500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// a little decay\n(\n{\n SinOsc.ar(\n PeakFollower.ar(Dust.ar(20, Line.kr(0, 1, 4)), 0.999) * 1500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// mouse x controls decay, center of the\n(\n{\n var decay;\n decay = MouseX.kr(0.99, 1.00001).min(1.0);\n SinOsc.ar(\n PeakFollower.ar(Dust\n// …\n```"}, {"role": "assistant", "content": "mouse x controls decay, center of the follow a sine lfo, decay controlled by mouse x (PeakFollower: Track peak signal amplitude.)"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BufRateScale`."}, {"role": "assistant", "content": "```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n(\nx = { |rate = 1|\n BufRd.ar(1, b, Phasor.ar(0, BufRateScale.kr(b) * rate, 0, BufFrames.kr(b)))\n}.play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LinCongC`."}, {"role": "assistant", "content": "```supercollider\n// default initial params\n{ LinCongC.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Symbol`."}, {"role": "assistant", "content": "```supercollider\na = { SinOsc.ar(\\freq.kr(440, 1.2)) }.play;\na.set(\\freq, 330);\na.release;\na = { SinOsc.ar(\\freq.kr([440, 460], 1.2)) }.play;\na.setn(\\freq, [330, 367]);\na.release;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Integer.degreeToKey` do?"}, {"role": "assistant", "content": "Interpret this as index into a scale with a given number of steps per"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Pattern transcription of intro chords of this song."}, {"role": "assistant", "content": "```supercollider\n// Crystal Waters \"Gypsy Woman (She's Homeless)\" - chords\n(\n~bpm = TempoClock.new(120/60);\nPbind(\n \\midinote, Pseq([\n Pn([45, 57, 67, 72, 76], 2),\n Pn([46, 58, 69, 74, 77], 3),\n Pn([43, 55, 67, 70, 74, 77], 2), \n Pn([48, 60, 67, 70, 73, 76], 3),\n Pseq([\n Pn([50, 62, 65, 69, 72, 76], 2),\n Pn([50, 62, 65, 69, 72, 74], 3)\n ], 2),\n Pn([45, 57, 67, 72, 76], 2),\n Pn([46, 58, 69, 74, 77], 3),\n Pn([52, 64, 76, 79, 83, 86], 2),\n Pn([51, 63, 75, 79, 82, 86], 3),\n Pseq([\n Pn([50, 62, 65, 69, 72, 76], 2),\n Pn([50, 62, 65, 69, 72, 74], 3)\n ], 2),\n ], inf),\n \\ctranspose, -12,\n \\dur, Pseq([1, Pn(3/4, 4)], inf),\n \\amp, 0.2,\n \\legato, Pseq([0.5, 0.5, Pwhite(0.2, 0.3, 3)], inf)\n).play(~bpm);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pbind`."}, {"role": "assistant", "content": "```supercollider\nPbind(\\note, Pseq([0, 4, 7]), \\amp, 0.1, \\dur, 0.2).play\n```"}]} -{"conversations": [{"role": "user", "content": "What does `MIDIMKtlDevice.postPossible` do?"}, {"role": "assistant", "content": "Post all access code for device that could be used by"}]} -{"conversations": [{"role": "user", "content": "Explain `LFNoise2` in SuperCollider briefly."}, {"role": "assistant", "content": "LFNoise2 — Quadratic noise. Generates quadratically interpolated random values at a rate given by the nearest integer division of the sample rate by the `freq` argument. Category: UGens > Generators > Stochastic."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for more tweets (pitchshift feedback + sinoscfb)?"}, {"role": "assistant", "content": "```supercollider\n// probably horrible for speakers... \n\n// glitchift\n{l=LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j**[l,k],k),[0.05,0.03],j);LocalOut.ar(s);s}.play;\n// drone\n{l=LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j**[2,2.1],k),[0.05,0.03],j);LocalOut.ar(s);s}.play;\n\n\n// few more I was mucking around with (remove tanh loop for < 140c)\n{l = LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j**l,k),[0.05,0.03],j);5.do{s=s.tanh+(s*0.1)};LocalOut.ar(s);s}.play;\n\n{l = LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j**2,k),[0.05,0.03],j);5.do{s=s.tanh+(s*0.1)};LocalOut.ar(s);s}.play;\n\n{l = LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j*20,k),[0.05,0.03],j);5.do{s=s.tanh+(s*0.1)};LocalOut.ar(s);s}.play;\n\n{l = LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j**j,k),[0.05,0.03],j);5.do{s=s.tanh+(s*0.1)};LocalOut.ar(s);s}.play;\n\n{l = LocalIn.ar(2);k=LFSaw.ar(l,0,l,1);j=k.range(0.25,4.0);s=PitchShift.ar(SinOscFB.ar(j**l.abs,k),[0.05,0.03],j);5.do{s=s.tanh+(s*0.1)};LocalOut.ar(s);s}.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nRoutine({ loop { Synth(\\kick); 0.5.wait } }).play;\n```"}, {"role": "assistant", "content": "It starts a kick every half second, forever.\n\nA Routine is a language-side coroutine: `.play` runs it on the clock, and `wait` suspends it until the next\nbeat without blocking anything else. Inside the `loop`, `Synth(\\kick)` creates a kick and `0.5.wait` waits\nhalf a beat on the current TempoClock — the tempo, not seconds, so changing the clock changes the rate.\nBecause the kick SynthDef frees itself with `doneAction: 2`, the loop can run for hours without leaking\nnodes."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// ZoomH2 records two stereo .wav files:\n// SRxxxF.wav\n// SRxxxR.wav\n// correct input for FoaEncoderMatrix.newZoomH2 is:\n\n~in = [ SRxxxR[0], SRxxxR[1], SRxxxF[0], SRxxxF[1] ]\n```"}, {"role": "assistant", "content": "ZoomH2 records two stereo .wav files: correct input for FoaEncoderMatrix.newZoomH2 is: (FoaEncoderMatrix: First Order Ambisonic (FOA) encoder matrices)"}]} -{"conversations": [{"role": "user", "content": "What does `String.load` do?"}, {"role": "assistant", "content": "Load and Interpreter#-executeFile#execute the file at the path represented by the receiver, and (optionally) pass positional and keyword arguments to the"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n b = {|x,y|\n var arr = List[];\n case\n {y % x.size == 0} // condition 1\n {\n var per = y / x.size;\n x.size.do{|oo|\n var pp = 1,i = 1;\n arr.add( x[oo] );\n while({i < per},{\n arr.add(0);\n i = i+1;\n });\n }\n }\n {x.size % y == 0} // condition 2\n {\n var pp = x.size / y, i = 0, sz = x.size;\n while({i < sz},{\n if(i % pp == 0)\n { arr.add(x[i]) };\n i=i+1;\n });\n };\n arr\n };\n a = [1,1,1,1];\n c = b.value(a,16) \n // [ 1, 1, 1, 1 ]\n // becomes\n // [ 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 ]\n\n b.value(c,4); \n // [ 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 ]\n // becomes\n // [ 1, 1, 1, 1 ]\n)\n```"}, {"role": "assistant", "content": "useful for expanding or reducing arrays by 2^x.\r\nI would like to know if there is a more concise way to write this!\r\nAny suggestions?\r\n\r\n(duplicate post, sorry! forgot to log in!)."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LatoocarfianC`."}, {"role": "assistant", "content": "```supercollider\n// default initial params\n{ LatoocarfianC.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nMIDIIn.connectAll;\n// MIDIClient.init;\n\n\n(\n// A SynthDef with ADSR envelope\nSynthDef(\"quick2\", {arg freq = 440, amp = 0.1, gate = 1;\n var snd, env;\n env = Env.adsr(0.01, 0.1, 0.3, 2, amp).kr(2, gate);\n snd = Saw.ar(freq: [freq, freq*1.5], mul: env);\n Out.ar(0, snd)\n}).add;\n);\n\n// Play it with a MIDI keyboard\n(\nvar noteArray = Array.newClear(128); // array has one slot per possible MIDI note\n\nMIDIdef.noteOn(\\myKeyDown, {arg vel, note;\n noteArray[note] = Synth(\"quick2\", [\\freq, note.midicps, \\amp, vel.linlin(0, 127, 0, 1)]);\n [\"NOTE ON\", note].postln;\n});\n\nMIDIdef.noteOff(\\myKeyUp, {arg vel, note;\n noteArray[note].set(\\gate, 0);\n [\"NOTE OFF\", note].postln;\n});\n)\n// PS. Make sure SC MIDI connections are made (MIDIIn.connectAll)\n```"}, {"role": "assistant", "content": "Basic example - how to use a MIDI keyboard with a simple synth."}]} -{"conversations": [{"role": "user", "content": "What does `Window.removeFromOnClose` do?"}, {"role": "assistant", "content": "Removes an object from #-onClose, if the latter is an"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for radio static with tuning noise (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"radiostatic\", {arg out=0;\n var hum, sineSweep, tuning, dustNoise, staticNoise, humFreq, numHarms;\n \n numHarms = 7;\n humFreq = 100;\n hum = Array.fill(numHarms, {|i| SinOsc.ar( (i+1) * humFreq, 0, 1/numHarms)});\n hum = hum.sum;\n dustNoise = Dust.ar(LFNoise1.ar(0.5).range(1000,8000));\n staticNoise = hum * dustNoise * LFNoise1.ar(1).range(0.5, 2);\n \n sineSweep = SinOsc.ar(LFNoise2.ar(1).range(20, 11000));\n tuning = SinOsc.ar(10000).ring4(sineSweep) * LFNoise2.ar(1.1).range(0.05, 0.1);\n\n Out.ar(out, Pan2.ar(staticNoise + tuning, 0));\n}).add;\n);\n \na = Synth(\"radiostatic\");\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `GVerb`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\n// CAUTION: THE FOLLOWING CAN BE EXTREMELY LOUD\n// set the following variable to true if you want to run this code\nvar run = false;\nif (run) {\n { GVerb.ar(Dust.ar(5), SinOsc.kr(0.3).range(10, 14), drylevel:0) }.play\n}\n// 3.13 super loud glitch (crackling)! 3.14: super loud glitch (cleaner pitch shifting)!\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `AnalogIn` in SuperCollider?"}, {"role": "assistant", "content": "AnalogIn — Read data from an analog input Read a DC-coupled analog input connected to a sensor (e.g.: a potentiometer or CV in). Category: UGens > Bela."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var z;\n\n // signal (clean)\n z = Decay2.ar(\n Impulse.ar(8, 0, LFSaw.kr(0.3, 1, -0.3, 0.3)),\n 0.001,\n 0.3\n )\n * Mix.ar(Pulse.ar([80, 81], 0.3));\n\n // apply gate (mouse x sets treshold)\n Compander.ar(z, z,\n thresh: MouseX.kr(0.001, 1),\n slopeBelow: 10,\n slopeAbove: 1,\n clampTime: 0.01,\n relaxTime: 0.01\n )\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var z;\n\n // signal (clean)\n z = Decay2.ar(\n Impulse.ar(8, 0, LFSaw.kr(0.3, 1, -0.3, 0.3)),\n 0.001,\n 0.3\n )\n * Mix.ar(Pulse.ar([80, 81], 0.3));\n\n // apply gate (mouse x sets treshold)\n Compander.ar(z, z,\n thresh: MouseX.kr(0.001, 1),\n slopeBelow: 10,\n slopeAbove: 1,\n clampTime: 0.01,\n relaxTime: 0.01\n )\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `SelectXFocus`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a;\n a = [\n Saw.ar(LFSaw.kr(3 * [1, 1.01], 0, 100, 230)),\n SinOsc.ar,\n Pulse.ar(LFPulse.kr(3 * [1, 1.02], 0, 0.4, 100, 230)),\n SinOsc.ar(SinOsc.kr(4 * [1, 1.03], 0, 200, 300))\n ];\n\n SelectXFocus.ar(MouseX.kr(0, 1) * a.size, a, MouseY.kr(0, a.size)) * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `FreqScope`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n// create a new analyzer\nFreqScope.new(400, 200, 0, server: s);\n\n// basic sine\n{ SinOsc.ar(2000, 0, 0.25) }.play(s);\n\n// random saw\n{ RLPF.ar(Saw.ar(110, 0.2), LFNoise2.kr(1, 1e4, 1e4), LFNoise2.kr(1, 0.2, 0.22)) }.play(s);\n\n// modulate phase\n{ SinOsc.ar(800, SinOsc.ar(XLine.kr(20, 8000, 10), 0, 2pi), 0.25) }.play(s);\n\n// all harmonics\n{ Blip.ar(200, Line.kr(1, 100, 10), 0.2) }.play(s);\n\n// access the FreqScopeView object to set properties of the Qt Object:\nFreqScope.getInstance // get the FreqScope instance\n .scope // and its FreqScopeView\n .setProperty(\\updateInterval, 1000)\n // set updateInterval to 1000 ms because of reasons\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(// * //watch the postWindow\na=[\"m\",\"x\",\"f\",\"k\",\"d\",\"p\"];\nx=Array;\ny=x.newClear(6);\n~mxfkdp=Task({\n inf.do({y.put(x.series(6,0,1).choose,a.scramble).postln;\n 0.03.wait;})}).play;\nm=fork({inf.do({\n \"array num:\".postcln;\n if(y[x.series(6,0,1).choose.postcln]==a,\n {\"lo encontraste!/found it!\".postcln;\n 1.do({GVerb.ar(\n EnvGen.ar(Env.perc(0.01,8),1,doneAction:2)*\n Blip.ar(XLine.kr(440,1600,8)),50,10,0.02)}.play);\n ~mxfkdp.stop;\n m.stop;}, \n {\"buscando.../seeking...\".postcln;});\n 0.03.wait})});\n);\n//.SCtweetLong\n```"}, {"role": "assistant", "content": "this code throws a scrambled array of arrays seeking among them for the original array,\r\nIt only sounds when it founds it. (may take a while)\r\nthe idea started trying a SCtweet, but became with this funny code!."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n/// Installing sc3-plugins quarks\n\n// If you installed the sc3-plugins to a user location:\n~sc3plugs = Quarks(\nreposPath: \"https://sc3-plugins.svn.sourceforge.net/svnroot/sc3-plugins/build\",\nlocalPath: Platform.userAppSupportDir +/+ \"SC3plugins\"\n);\n\n// If the sc3-plugins were installed to a system wide location:\n~sc3plugs = Quarks(\nreposPath: \"https://sc3-plugins.svn.sourceforge.net/svnroot/sc3-plugins/build\",\nlocalPath: Platform.systemAppSupportDir +/+ \"SC3plugins\"\n);\n\n\n// Get a GUI of the available Quarks and install the ones you want to try out:\n~sc3plugs.gui;\n\n\n// For more general Help on Quarks, see the Quarks helpfile\n```"}, {"role": "assistant", "content": "Installing sc3-plugins quarks If you installed the sc3-plugins to a user location:."}]} +{"conversations": [{"role": "user", "content": "What is `BinaryOpFunction`?"}, {"role": "assistant", "content": "BinaryOpFunction — represent a binary operation on a function"}, {"role": "user", "content": "What does `BinaryOpFunction.value` do?"}, {"role": "assistant", "content": "Executes each of the operand functions and then performs the selector on the result."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nvar a = { 19.rand };\nvar b = { [5, 8, 9].choose };\nvar c = a + b;\nfork {\n 15.do {\n (instrument: \\default, note: [c.value, a.value]).play;\n 0.3.wait;\n }\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "How do I make a piece reproducible instead of a different take every time?"}, {"role": "assistant", "content": "Three things make a SuperCollider piece repeatable: a fixed seed, a fixed tempo, and no live input.\n\n```supercollider\n(\nthisThread.randSeed = 1234;\nTempoClock.default.tempo = 2;\nPbind(\\degree, Pwhite(0, 7, inf), \\dur, 0.25).play;\n)\n```\n\n`thisThread.randSeed` fixes the random sequence of the current thread, so `Pwhite`, `Prand` and friends give\nthe same values again. Recording with `s.record(path, duration: 30)` then makes the take an artifact rather\nthan a performance. Input from `MouseX` or a MIDI controller is the usual remaining source of difference."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\nz = { // toy around with boost/cut\nBHiShelf.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(2200, 18000, \\exponential),\n 1.0, // rs\n MouseY.kr(18.0, -18.0, \\linear),\n 0.5); // mul\n}.play)\nz.release;\n\n(\nz = { // toy around with rs\nBHiShelf.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(2200, 18000, \\exponential),\n MouseY.kr(0.1, 1.0, \\linear), // rs\n 6, // db\n 0.5); // mul\n}.play\nz.release;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\nz = { // toy around with boost/cut\nBHiShelf.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(2200, 18000, \\exponential),\n 1.0, // rs\n MouseY.kr(18.0, -18.0, \\linear),\n 0.5); // mul\n}.play)\nz.release;\n\n(\nz = { // toy around with rs\nBHiShelf.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(2200, 18000, \\exponential),\n MouseY.kr(0.1, 1.0, \\linear), // rs\n 6, // db\n 0.5); // mul\n}.play)\nz.release;\n```"}]} +{"conversations": [{"role": "user", "content": "[ 1, 2, 1, 1, 2, 1, 1 ] how to find adjacent elements in an array?"}, {"role": "assistant", "content": "SuperCollider forum — [ 1, 2, 1, 1, 2, 1, 1 ] how to find adjacent elements in an array\n\nRandColors:\n\nI need to find the index, the how many times (the adjacent values are equal) and what is the adjacent value.\n\nThis is perhaps a bit verbose and clunky, but it meets the above specification:\n\n```supercollider\n(\n~repeats = {|array|\n // return [index, number of repeats, the value] for each repeated value\n var results = [];\n var thisIndex = 0;\n var thisCount = 1;\n var thisValue = array[0];\n array[1..].do{|val, i|\n if(val == thisValue,\n {thisCount = thisCount + 1},\n {\n if(\n thisCount > 1,\n {results = results.add([thisIndex, thisCount, thisValue])},\n );\n thisValue = val;\n thisIndex = i + 1;\n thisCount = 1;\n }\n )\n };\n if(thisCount > 1, {results = results.add([thisIndex, thisCount, thisValue])});\n results;\n}\n);\n\na = [1, 2, 1, 1, 1, 2, 1, 1];\nb = ~repeats.value(a);\n\na = [2, 3, 5, 5];\nb = ~repeats.value(a);\n```"}]} +{"conversations": [{"role": "user", "content": "When should I use a Pattern instead of writing Synth code by hand?"}, {"role": "assistant", "content": "Use a Pattern when what you want to express is a sequence over time — notes, durations, amplitudes, parameters — rather than a signal. A Pbind describes events, and `.play` turns each event into a Synth (by default of the \\default instrument, or of \\instrument if you name one). Hand-written Synth code is for the sound itself; Patterns are for what plays when. The two compose: a SynthDef named \\bell is triggered from `Pbind(\\instrument, \\bell, ...)`."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `BusPlug` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\ns.boot;\nz = Bus.control(s, 16);\nz.setn({ |i| (i * 5).nthPrime } ! 16 * 5 + 100);\na = BusPlug.for(z);\n{ Splay.ar(SinOsc.ar(a.kr(3, MouseX.kr(0, 25)))) * 0.1 }.play; // selectively play 3 channel of the 16, modulate offset\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Compander` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var z;\n\n // signal (clean)\n z = Decay2.ar(\n Impulse.ar(8, 0, LFSaw.kr(0.3, 1, -0.3, 0.3)),\n 0.001,\n 0.3\n )\n * Mix.ar(Pulse.ar([80, 81], 0.3));\n\n // apply gate (mouse x sets treshold)\n Compander.ar(z, z,\n thresh: MouseX.kr(0.001, 1),\n slopeBelow: 10,\n slopeAbove: 1,\n clampTime: 0.01,\n relaxTime: 0.01\n )\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\smooth, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.linen(0.05, sustain, 0.1), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n)\n```"}, {"role": "assistant", "content": "plays an arpeggio on the \"left hand\" and an arpeggio on the \"right hand\"."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// randomly modulate params\n(\n{ LorenzL.ar(\n SampleRate.ir,\n LFNoise0.kr(1, 2, 10),\n LFNoise0.kr(1, 20, 38),\n LFNoise0.kr(1, 1.5, 2)\n) * 0.2 }.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// randomly modulate params\n(\n{ LorenzL.ar(\n SampleRate.ir,\n LFNoise0.kr(1, 2, 10),\n LFNoise0.kr(1, 20, 38),\n LFNoise0.kr(1, 1.5, 2)\n) * 0.2 }.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n\n// definition for future reference in arbitrary Environments\n\n(\np = Pbind(\n \\midinote, PLbeta(\\lo, \\hi, \\p1, \\p2),\n \\dur, 0.1\n);\n);\n\n// prepare current Environment\n// prob values for equal distribution\n\n(\n~lo = 60;\n~hi = 90;\n~p1 = 1;\n~p2 = 1;\n);\n\n\n// run\n\nx = p.play;\n\n\n// replace probabilities, get values close to the bounds\n\n(\n~p1 = 0.02;\n~p2 = 0.02;\n);\n\n\n// change between close-to-bounds and equally-distributed\n// PLseq\n// …\n```"}, {"role": "assistant", "content": "definition for future reference in arbitrary Environments prepare current Environment (PLbeta: dynamic scope Pbeta variant)"}]} +{"conversations": [{"role": "user", "content": "Write an FM bell in SuperCollider."}, {"role": "assistant", "content": "PMOsc is phase modulation: a non-integer modulator ratio gives the inharmonic clang.\n\n```supercollider\n(\nSynthDef(\\fmBell, { |out = 0, freq = 440, amp = 0.2, dur = 4|\n var index = EnvGen.kr(Env([8, 0.2], [dur], -4));\n var sig = PMOsc.ar(freq, freq * 1.4, index, 0, 1);\n var env = EnvGen.kr(Env.perc(0.002, dur, 1, -5), doneAction: 2);\n Out.ar(out, Pan2.ar(sig * env * amp, 0));\n}).add;\n);\nSynth(\\fmBell, [\\freq, 550]);\n```"}]} +{"conversations": [{"role": "user", "content": "What is `SystemSynthDefs`?"}, {"role": "assistant", "content": "SystemSynthDefs — SynthDefs assumed to exist on the server"}, {"role": "user", "content": "What does `SystemSynthDefs.numChannels` do?"}, {"role": "assistant", "content": "The SystemSynthDefs class generates SynthDefs with different number of channels that are chosen according to need. This class variable specifies the maximum number of channels."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na = { SinOsc.ar * 0.01 }.play;\na.defName; // has the prefix 'temp__', followed by a number\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Warp1`."}, {"role": "assistant", "content": "```supercollider\n(\nb.free;\nb = Buffer.read(s, ExampleFiles.apollo11);\n{\n var pointer = Phasor.ar(0, SampleDur.ir / BufDur.ir(b) * XLine.kr(1, 0.25, 20));\n var sound = Warp1.ar(1, b, pointer, 1, 0.3, -1, 16, Line.kr(0, 1, 40), 4);\n Pan2.ar(sound, pointer * 2 - 1, 0.25)\n}.play\n);\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `RedIntelHex` in SuperCollider?"}, {"role": "assistant", "content": "RedIntelHex — read and decode intel hex files See http://en.wikipedia.org/wiki/Intel_HEX and http://www.sbprojects.com/knowledge/fileformats/intelhex.php Category: Red > redTools."}]} +{"conversations": [{"role": "user", "content": "What does `Integer.modSeaside` do?"}, {"role": "assistant", "content": "Pre-3.14 modulo with unexpected behavior for negative integer modulus. For dividends smaller than a negative divisor, modSeaside pulls the resulting remainder below the divisor. It thereby leaves zero as peaks on the zero line. Like in the usual mod, all larger dividends result in remainders above zero."}]} +{"conversations": [{"role": "user", "content": "What does `HS.postOSC` do?"}, {"role": "assistant", "content": "Set or get the flag that defines whether OSC messages should be posted or not. Boolean. Defaults to"}]} +{"conversations": [{"role": "user", "content": "Explain `FoaWd` in SuperCollider briefly."}, {"role": "assistant", "content": "FoaWd — First Order Ambisonic (FOA) Soundfield Potential & Kinetic Energy Difference Return the Potential & Kinetic Energy Difference, Wd, of a first order ambisonic (B-format) signal. Category: Libraries > Ambisonic Toolkit > UGens > FOA > Analyzer, UGens > Multichannel > Ambisonics, UGens > Analysis > Ambisonics."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Recorder`."}, {"role": "assistant", "content": "```supercollider\nr = Recorder(s);\n{ GVerb.ar(Dust.ar(4)) }.play; // play on bus 64\nr.record(numChannels: 2);\nr.stopRecording;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n(\nx = { |rate = 1|\n BufRd.ar(1, b, Phasor.ar(0, BufRateScale.kr(b) * rate, 0, BufFrames.kr(b)))\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n(\nx = { |rate = 1|\n BufRd.ar(1, b, Phasor.ar(0, BufRateScale.kr(b) * rate, 0, BufFrames.kr(b)))\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// default initial params\n{ LatoocarfianL.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// default initial params\n{ LatoocarfianL.ar(MouseX.kr(20, SampleRate.ir)) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Balance2`."}, {"role": "assistant", "content": "```supercollider\n// a stereo signal, both channels at 0dB\n{ [SinOsc.ar(440), SinOsc.ar(440)] }.play\n\n// using Balance on a stereo signal with the position parameter at 0, effectively the same sound but both channels at -3dB\n{ Balance2.ar(SinOsc.ar(440), SinOsc.ar(440), 0) }.play\n\n// pan sweep from left to right\n{ Balance2.ar(SinOsc.ar(440), SinOsc.ar(1000), Line.kr(-1, 1, 5)) }.play\n\n// other examples\n{ Balance2.ar(LFSaw.ar(44), Pulse.ar(33), FSinOsc.kr(0.5), 0.1) }.play;\n{ var source; source = SinOsc.ar([440, 550]); Balance2.ar(source[0], source[1], LFNoise0.kr(4), 0.3) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\na = Scheduler(SystemClock);\n\na.sched(3, { \"now it is 3 seconds.\".postln; nil });\na.sched(5, { \"now it is 5 seconds.\".postln; nil });\na.sched(1, { \"now it is 1 second.\".postln; nil });\n\na.advance(0.5);\na.advance(0.5);\na.advance(2);\na.advance(2);\n\n// the beats, seconds and clock are passed into the task function:\na.sched(1, { |beats, secs, clock| [beats, secs, clock].postln });\na.advance(1);\n\n// the scheduling is relative to \"now\":\na.sched(3, { \"now it was 3 seconds.\".postln });\n// …\n```"}, {"role": "assistant", "content": "the beats, seconds and clock are passed into the task function: the scheduling is relative to \"now\": (Scheduler: schedules functions to be evaluated in the future)"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `RandID`."}, {"role": "assistant", "content": "```supercollider\n// start a noise patch and set the id of the generator\n(\nSynthDef(\"help-RandID\", { |out = 0, id = 1|\n RandID.ir(id);\n Out.ar(out,\n WhiteNoise.ar(0.05) + Dust2.ar(70)\n )\n}).add;\n);\n\n// reset the seed of my rgen at a variable rate\n(\nSynthDef(\"help-RandSeed\", { |seed = 1910, id = 1|\n RandID.kr(id);\n RandSeed.kr(Impulse.kr(FSinOsc.kr(0.2, 0, 10, 11)), seed);\n}).add;\n\n);\n\n// start two noise synths on left and right channel with a different randgen id\na = Synth(\"help-RandID\", [\\out, 0, \\id, 1]);\nb = Synth(\"help-RandID\", [\\out, 1, \\id, 2]);\n\n// reset the seed of randgen 1\nx = Synth(\"help-RandSeed\", [\\id, 1]);\n\n// change the target randgen to 2 (affects right channel)\nx.set(\\id, 2);\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\AcnSn3dIn;\n~description = \"A live ambisonic input (ACN_SN3D)\";\n~channelLayout = \\ambi;\n\n~function = { |order=1, t_trig = 0, bus = 0|\n var env = EnvGen.kr(Env([0,1], [1]), t_trig);\n var chans = Array.series(\n size: (order + 1).pow(2).asInteger,\n start: bus,\n step: 1\n );\n var input = SoundIn.ar(chans) * env;\n HOAConverterAcnSn3d2AcnN3d.ar(order, input);\n};\n```"}, {"role": "assistant", "content": "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see ."}]} +{"conversations": [{"role": "user", "content": "What does `SmoothFoldQ2.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "wave folding pseudo ugen using parabolic segments, two fold ranges Arguments: in — input signal.; lo — lower limit, defaults to -1.; hi — upper limit, defaults to 1.; foldRangeLo — the relative amount of the range (defined by lo and hi) used for folding back values below lo, should be >= 0 and <= 1. 0 means no folding (just smooth clipping), 1 means that the full range is used for folding, values inbetween determine the range near lo, which is used for folding, defaults to 1.; foldRangeHi — the relative amount of the range (defined by lo and hi) used for folding back values above hi, should be >= 0 and <= 1. 0 means no folding (just smooth clipping), 1 means that the full range is used for folding, values inbetween determine the range near hi, which is used for folding, defaults to 1.; smoothAmount — amount of smoothness, must be >= 0 and <= 1, defaults to 0.5.; delta — Threshold for avoiding zero divisions (which would happen if lo = hi and the border case of amount = 1). Normally not to be set by the user, except for very small clipping ranges, defaults to 0.00001.."}]} +{"conversations": [{"role": "user", "content": "What does `MxChannelApp.fader` do?"}, {"role": "assistant", "content": "the MxChannelFader is an audio unit with level, mute, solo and circuit breaker protection (bad values and sudden peaks). This returns that unit. You can connect to it: unit.out >> Returns: MxChannelFader"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Fdef`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\ns.boot;\nSynthDef(\"gpdef\",\n { |out = 0, freq = 440, sustain = 0.05, amp = 0.1|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain), doneAction: Done.freeSelf) * amp;\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n// fork a thread that plays some sounds\n(\nFdef(\\freq, 440);\nFdef(\\dur, 0.2);\n\nfork {\n loop {\n s.sendMsg(\"/s_new\", \"gpdef\", -1, 1, 1, \\freq, Fdef(\\freq).value);\n Fdef(\\dur).value.wait;\n }\n};\n);\n\n// some modifications\n\nFdef(\\freq, Fdef(\\midinote, 60).midicps);\nFdef(\\midinote, { [67, 64, 65].choose });\nFdef(\\midinote, { [67, 64, 65].choose } + Fdef(\\offset));\nFdef(\\offset, { 4.rand });\nFdef(\\dur, 0.23);\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\ambiIn;\n~description = \"A live ambisonic input (ACN_N3D)\";\n~channelLayout = \\ambi;\n\n~function = { |order = 1, t_trig = 0, bus = 0|\n var env = EnvGen.kr(Env([0,1], [1]), t_trig);\n var chans = Array.series(\n size: (order + 1).pow(2).asInteger,\n start: bus,\n step: 1\n );\n SoundIn.ar(chans) * env;\n};\n```"}, {"role": "assistant", "content": "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see ."}]} +{"conversations": [{"role": "user", "content": "What does `KeyCodeResponder.registerKeycode` do? What arguments does it take?"}, {"role": "assistant", "content": "register responder functions for keycode and modifier combinations Arguments: modifier; keycode; function."}]} +{"conversations": [{"role": "user", "content": "What is `Plotter`?"}, {"role": "assistant", "content": "Plotter — Plot numerical data on a window or view"}, {"role": "user", "content": "What does `Plotter.plotGraph` do?"}, {"role": "assistant", "content": "`{ |x| sin(x) }.plotGraph(300, 0, 2*pi);`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\na = { (0..10).scramble.normalize }.dup(2).plot;\na.editMode = true;\na.editFunc = { |...args| args.postln };\n);\n\n// using plotter as a control interface\n(\na = { (0..10).scramble.normalize(300, 400) }.dup.plot;\na.specs = \\freq; a.plotMode = \\bars;\na.editMode = true;\nx = {\n var phase = SinOsc.ar(\\rate.kr(a.value[1]));\n SinOsc.ar(\\freq.kr(a.value[0]), phase).mean * 0.1\n}.play;\na.editFunc = { |plotter, plotIndex, i, val|\n x.setn(\\freq, a.value[0]);\n x.setn(\\rate, a.value[1]);\n};\na.parent.onClose = { x.release };\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `View.minWidth` do? What arguments does it take?"}, {"role": "assistant", "content": "Set minimum allowed width of the view, the view will not be able to shrink smaller in width, neither by user interaction nor Arguments: width — An Int.."}]} +{"conversations": [{"role": "user", "content": "Explain `LFNoise0` in SuperCollider briefly."}, {"role": "assistant", "content": "LFNoise0 — Step noise Generates random values at a rate given by the nearest integer division of the sample rate by the `freq` argument. Category: UGens > Generators > Stochastic."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Function`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\nx = { |freq = 440| SinOsc.ar(freq, 0, 0.3) }.play; // this returns a Synth object;\nx.set(\\freq, 880); // note you can set the freq argument\nx.defName; // the name of the resulting SynthDef\nx.release(4); // fadeout over 4 seconds\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Collection`?"}, {"role": "assistant", "content": "Collection — Abstract superclass of all collections"}, {"role": "user", "content": "What does `Collection.newFrom` do?"}, {"role": "assistant", "content": "Creates a new Collection from another collection. This supports the interface for the method \"as\". `Array.newFrom(Set[4, 2, 1]);`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n~closet = [\\hat, \\hat, \\hat, \\coat, \\coat, \\shoe, \\shoe];\n~closet.removeAll([\\hat, \\coat, \\shoe, \\shoe]); // Doesn't empty the closet, just removes what we wanted to\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n///////////////////// channel offset/object index /////////////////////\n\n\na = NodeProxy.audio(s, 2);\na.play;\na[0] = { Ringz.ar(Impulse.ar(5, 0, 0.1), 1260) };\na.put(1, { Ringz.ar(Impulse.ar(5.3, 0, 0.1), 420) }, 1);\na.put(0, { Ringz.ar(Dust.ar([1, 1]*15.3, 0.1), 720) }, 1);\na.put(1, { Ringz.ar(Impulse.ar(5.3, 0, 0.1), 420) }, 1;\na.end;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n///////////////////// channel offset/object index /////////////////////\n\n\na = NodeProxy.audio(s, 2);\na.play;\na[0] = { Ringz.ar(Impulse.ar(5, 0, 0.1), 1260) };\na.put(1, { Ringz.ar(Impulse.ar(5.3, 0, 0.1), 420) }, 1);\na.put(0, { Ringz.ar(Dust.ar([1, 1]*15.3, 0.1), 720) }, 1);\na.put(1, { Ringz.ar(Impulse.ar(5.3, 0, 0.1), 420) }, 1);\na.end;\n```"}]} +{"conversations": [{"role": "user", "content": "What happens when I call .play on a function?"}, {"role": "assistant", "content": "`.play` on a Function builds a SynthDef from the function body, adds it to the server under an anonymous name, and starts one Synth of it. You get back the Synth, so `x = { SinOsc.ar(440) * 0.1 }.play; x.free;` stops it. It is the fastest way to hear something, but it is not how you write a piece: nothing is named, nothing can be reused, and the definition is lost when the Synth is freed."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a, b;\na = Pwrand.new([1, 2, 3], [1, 3, 5].normalizeSum, 6); // return 6 items\nb = a.asStream;\n7.do({ b.next.postln });\n);\n\n// Prand used as a sequence of pitches:\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n(\na = Pwrand([60, 61, 63, 65, 72], [10, 2\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a, b;\na = Pwrand.new([1, 2, 3], [1, 3, 5].normalizeSum, 6); // return 6 items\nb = a.asStream;\n7.do({ b.next.postln });\n);\n\n// Prand used as a sequence of pitches:\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n\n(\na = Pwrand([60, 61, 63, 65, 72], [10, 2, 3, 1, 3].normalizeSum, inf).asStream;\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, a.next.midicps]);\n 0.1.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n(\nx = {\n |lookBack = 3, thr = 1|\n var trig = Impulse.ar(7);\n // for a non-integer source it makes sense to take a sufficiently large threshold thr\n var midi = Demand.ar(trig, 0, DIdev(SinOsc.ar(0.2, 0, 15, 82), 5, -6, 5, lookBack, thr: thr));\n midi.poll(7, label: \\midi);\n SinOsc.ar(midi.midicps.lag(0.007)) ! 2 * 0.1\n}.play;\n);\n\n// close floats can occur here \nx.set(\\thr, 0.01)\n\n// not here\nx.set(\\thr, 2)\n\nx.release\n```"}, {"role": "assistant", "content": "for a non-integer source it makes sense to take a sufficiently large threshold thr close floats can occur here (DIdev: pseudo drate ugen, searches for numbers with integer distance from a source signal, optionally avoiding repetitions within a span)"}]} +{"conversations": [{"role": "user", "content": "What does `MultiSplineFr.addDimension` do? What arguments does it take?"}, {"role": "assistant", "content": "Multi dimensional spline frame rate device Arguments: default."}]} +{"conversations": [{"role": "user", "content": "What does `AbstractFunction.sqrdif` do?"}, {"role": "assistant", "content": "(a - b) ** 2 `({ [5, 6, 2].choose.postln } sqrdif: { [2, -1,"}]} +{"conversations": [{"role": "user", "content": "What is `UnaryOpUGen`?"}, {"role": "assistant", "content": "UnaryOpUGen — Apply a unary operation to the values of an input ugen"}, {"role": "user", "content": "What does `UnaryOpUGen.new` do?"}, {"role": "assistant", "content": "return a new instance that applies the operator `selector` to the ugen `a`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na = WhiteNoise.ar; // a WhiteNoise\nb = a.squared; // a UnaryOpUGen.\nb.operator; // squared\n\n// sound example\n\n{ var a = LFSaw.ar(300).range(0, 2pi); a.sin * 0.1 }.play;\n\n// Plotting the \"abs\" unary operator (via the server):\n\n{ SinOsc.ar(300).abs }.plot\n```"}]} +{"conversations": [{"role": "user", "content": "What does `AbstractVector.isOrthogonal` do?"}, {"role": "assistant", "content": "`RealVector[0,0,1,0].isOrthogonal(RealVector[1,0,0,0])`"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\ns.boot;\n\n(\nvar winenv;\n// a custom envelope\nwinenv = Env([0, 1, 0], [0.5, 0.5], [8, -8]);\nz = Buffer.sendCollection(s, winenv.discretize, 1);\n\nSynthDef(\\fm_grain_test, { |out, gate = 1, amp = 1, envbuf|\n var pan, env, freqdev;\n // use mouse x to control panning\n pan = MouseX.kr(-1, 1);\n // use WhiteNoise and mouse y to control deviation from center pitch\n freqdev = WhiteNoise.kr(MouseY.kr(0, 400));\n env = EnvGen.kr(\n Env([0,\n// …\n```"}, {"role": "assistant", "content": "use mouse x to control panning use WhiteNoise and mouse y to control deviation from center pitch (GrainFM: Granular synthesis with frequency modulated sine tones)"}]} +{"conversations": [{"role": "user", "content": "What does `FFT.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Fast Fourier Transform Arguments: buffer — A buffer to store spectral data. The buffer's size must correspond to a power of 2. LocalBuf is useful here, because processes should not share data between synths. (Note: most PV UGens operate on this data in place. Use PV_Copy for parallel processing.); in — The signal to be analyzed. The signal's rate determines the rate at which the input is read.; hop — The amount of offset from the beginning of one FFT analysis frame to the next, measured in multiples of the analysis frame size. This can range between 1.0 and values close to (but larger than) 0.0, and the default is 0.5 (meaning each frame has a 50% overlap with the preceding/following frames).; wintype — Defines how the data is windowed:; active — A simple control allowing FFT analysis to be active (>0) or inactive (<=0). This is mainly useful for signal analysis processes which are only intended to analyse at specific times rather than continuously; winsize — The windowed audio frames are usually the same size as the buffer. If you wish the FFT to be zero-padded then you can specify a window size smaller than the actual buffer size (e.g. window size 1024 with buffer size 2048). Both values must still be a power of two. Leave this at its default of zero f. Returns: The FFT chain"}]} +{"conversations": [{"role": "user", "content": "What does `Object.post` do?"}, {"role": "assistant", "content": "Print a string representation of the receiver to the post window. `\"hello\".post; \"hello\".post;"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// what can it sound like? see: https://www.youtube.com/watch?v=dRmY3tEwZyE \n// the youtube version has been sent through an additional reverb pedal, but\n// you don't need the pedal to get something that sounds interesting\n\n(\ns.options.memSize_(16384*10);\ns.reboot;\ns.waitForBoot({\n \n Ndef(\\bits, {\n var t = PulseCount.ar(Impulse.ar(8e3));\n var u = PulseCount.ar(Impulse.ar(7009));\n var sig = HPF.ar(\n (\n ((t * 15) & (t >> 5)) |\n ((t * 5) & (t >> [3, 4])) |\n ((t * 2) & (t >> 9)) |\n ((t * 8) & (t >> 11)) |\n (((t*t) & t) | (t >> 3))\n - 3 % 256\n ) / 127-1 * 3\n , 20\n ) * 0.1;\n var sig2 = LPF.ar(HPF.ar(gcd(t*u, u+t), WhiteNoise.ar()*2000 + 1000), 20);\n sig2 = sig2*sig;\n sig = 0.3*Splay.ar(Limiter.ar(Greyhole.ar(sig + sig2, sig, 0.5, sig), 0.5).flatten);\n }).play;\n});\n)\n```"}, {"role": "assistant", "content": "a surprisingly rich soundscape in a few lines of code (lucky accident)."}]} +{"conversations": [{"role": "user", "content": "What does `GridLines.new` do? What arguments does it take?"}, {"role": "assistant", "content": "A factory class for AbstractGridLines Arguments: spec — A ControlSpec that defines the minimum and maximum values, warp and step.. Returns: A subclass of AbstractGridLines, e.g. LinearGridLines or ExponentialGridLines."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Out.ar(87, SinOsc.ar(MouseX.kr(340, 1000, 1) * [1, 2, 3], 0, 0.2)) }.play;\nx = Monitor.new.play(87, 3, 0, fadeTime: 3;\nx.vol = 0.3;\nx.stop;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Out.ar(87, SinOsc.ar(MouseX.kr(340, 1000, 1) * [1, 2, 3], 0, 0.2)) }.play;\nx = Monitor.new.play(87, 3, 0, fadeTime: 3);\nx.vol = 0.3;\nx.stop;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\n// create a new analyzer\nFreqScope.new(400, 200, 0, server: s);\n\n// basic sine\n{ SinOsc.ar(2000, 0, 0.25) }.play(s);\n\n// random saw\n{ RLPF.ar(Saw.ar(110, 0.2), LFNoise2.kr(1, 1e4, 1e4), LFNoise2.kr(1, 0.2, 0.22)) }.play(s);\n\n// modulate phase\n{ SinOsc.ar(800, SinOsc.ar(XLine.kr(20, 8000, 10), 0, 2pi), 0.25) }.play(s);\n\n// all harmonics\n{ Blip.ar(200, Line.kr(1, 100, 10), 0.2) }.play(s);\n\n// access the Fre\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\n// create a new analyzer\nFreqScope.new(400, 200, 0, server: s);\n\n// basic sine\n{ SinOsc.ar(2000, 0, 0.25) }.play(s);\n\n// random saw\n{ RLPF.ar(Saw.ar(110, 0.2), LFNoise2.kr(1, 1e4, 1e4), LFNoise2.kr(1, 0.2, 0.22)) }.play(s);\n\n// modulate phase\n{ SinOsc.ar(800, SinOsc.ar(XLine.kr(20, 8000, 10), 0, 2pi), 0.25) }.play(s);\n\n// all harmonics\n{ Blip.ar(200, Line.kr(1, 100, 10), 0.2) }.play(s);\n\n// access the FreqScopeView object to set properties of the Qt Object:\nFreqScope.getInstance // get the FreqScope instance\n .scope // and its FreqScopeView\n .setProperty(\\updateInterval, 1000)\n // set updateInterval to 1000 ms because of reasons\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Compander` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var z;\n\n // signal (clean)\n z = Decay2.ar(\n Impulse.ar(8, 0, LFSaw.kr(0.3, 1, -0.3, 0.3)),\n 0.001,\n 0.3\n )\n * Mix.ar(Pulse.ar([80, 81], 0.3));\n\n // apply gate (mouse x sets treshold)\n Compander.ar(z, z,\n thresh: MouseX.kr(0.001, 1),\n slopeBelow: 10,\n slopeAbove: 1,\n clampTime: 0.01,\n relaxTime: 0.01\n )\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Integrator`."}, {"role": "assistant", "content": "```supercollider\n{ Integrator.ar(LFPulse.ar(300, 0.2, 0.1), MouseX.kr(0.001, 0.999, 1)) }.play\n\n// used as an envelope\n{ Integrator.ar(LFPulse.ar(3, 0.2, 0.0004), 0.999, FSinOsc.ar(700), 0) }.play\n\n\n// scope\n\n{ Integrator.ar(LFPulse.ar(1500 / 4, 0.2, 0.1), MouseX.kr(0.01, 0.999, 1)) }.scope\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Padd`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, gate = 1|\n var env;\n env = EnvGen.kr(Env.asr(0.001, 1, 0.2), gate, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain, \\freq, 440);\nb = Padd(\\freq, Pseq([10, 30, 100], inf), a);\nb.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SynthDef.play` do?"}, {"role": "assistant", "content": "A convenience method which compiles the def and sends it to target's server. When this asynchronous command is completed, it creates one synth from this definition, using the argument values specified in the Array args. For a list of valid addActions see Synth. The default is Returns: a corresponding Synth object."}]} +{"conversations": [{"role": "user", "content": "What does `FoaDecoderKernel.newUHJ` do? What arguments does it take?"}, {"role": "assistant", "content": "Ambisonic UHJ stereo decoder. footSee: Arguments: kernelSize — 256, 512, 1024, 2048, 4096, 8192; server; sampleRate — The sample rate defaults to `nil` and is usually supplied by the running server. In NRT, you can specify a sampleRate to avoid booting a server.; score — Default is `nil` for most real time usages. When using NRT, you can supply a score (a Score or a CtkScore) onto which the kernels will be added, which lets you bypass booting a server.."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Scale`."}, {"role": "assistant", "content": "```supercollider\n(\nr = {\n var scale = Scale.choose.postln;\n SinOsc.ar(\n (\n DegreeToKey.kr(\n scale.as(LocalBuf),\n MouseX.kr(0, 15), // mouse indexes into scale\n scale.stepsPerOctave,\n 1, // mul = 1\n 60 // offset by 72 notes\n )\n + LFNoise1.kr([3, 3], 0.04) // add some low freq stereo detuning\n ).midicps, // convert midi notes to hertz\n 0,\n 0.25\n )\n}.play;\n);\n\nr.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LinCongN`."}, {"role": "assistant", "content": "```supercollider\n// randomly modulate params\n(\n{ LinCongN.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(0.1, 0.5, 1.4),\n LFNoise2.kr(0.1, 0.1, 0.1),\n LFNoise2.kr(0.1)\n) * 0.2 }.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Can you listen to the sound you generate?"}, {"role": "assistant", "content": "No. I am 198M parameters trained on SuperCollider's documentation and class library; I have no audio input and no way to hear a result. What I can do is reason about the code: whether it reaches an output bus, whether the envelope will ever open, whether a filter at that cutoff leaves anything audible. Treat my patches as a starting point you listen to, not as a judgement about how they sound."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nSynthDef(\\bird,{\n var sig, freqenv, env, trig;\n trig = Dust.ar(2);\n env = EnvGen.ar(Env.perc(0.01,0.4,0.8,-8), trig, doneAction: 2);\n freqenv = EnvGen.ar(Env([Rand(1000,3000), Rand(3000,6000), Rand(1000,2000), Rand(2000,5000)],[0.1,0.01,0.1]);, trig);\n sig = SinOsc.ar(freqenv, 0, env);\n sig = Pan2.ar(sig, Rand(-1.0,1.0));\n Out.ar(0, sig);\n}).add;\n);\n\n(\nRoutine({\n inf.do({\n Synth(\\bird);\n rrand(1.0,2.0).wait;\n })\n}).play;\n)\n```"}, {"role": "assistant", "content": "I haven't found a quite satisfying code about birds, so here's a very simple SynthDef to start with."}]} +{"conversations": [{"role": "user", "content": "Explain `OffsetCP1` in SuperCollider briefly."}, {"role": "assistant", "content": "OffsetCP1 — Manual breakbeat specification This cut procedure allows the user to specify the durations in a block and offset, one block at a time. Category: Libraries > BBCut > Cut procedures."}]} +{"conversations": [{"role": "user", "content": "What does `MAbstractElement.resetAction` do?"}, {"role": "assistant", "content": "reset element action to nil, i.e. without any"}]} +{"conversations": [{"role": "user", "content": "What is `SampleSpec` in SuperCollider?"}, {"role": "assistant", "content": "SampleSpec — datatype specifying a Sample Category: Spec, Libraries > crucial > Spec, Libraries > crucial > Buffers > Specs."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nVowel().brightenExp(1).dBs.postln; \nVowel().brightenExp(0.1).dBs.postln;\nVowel().brightenExp(1.5).dBs.postln;\n\n{Formants.ar(100, Vowel(\\a, \\bass).brightenExp(MouseX.kr(0,5)) * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nVowel().brightenExp(1).dBs.postln; \nVowel().brightenExp(0.1).dBs.postln;\nVowel().brightenExp(1.5).dBs.postln;\n\n{Formants.ar(100, Vowel(\\a, \\bass).brightenExp(MouseX.kr(0,5))) * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `PRunningMin` in SuperCollider?"}, {"role": "assistant", "content": "PRunningMin — UGenPatterns quark library Based on RunningMin Category: Streams-Patterns-Events > UGenPatterns > Modifiers."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// logistic map\n// equation: x1 = -r*x0^2 + r*x0\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n QuadL.ar(SampleRate.ir/4, r.neg, r, 0, 0.1) * 0.4;\n}.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// logistic map\n// equation: x1 = -r*x0^2 + r*x0\n(\n{ var r;\n r = MouseX.kr(3.5441, 4); // stable range\n QuadL.ar(SampleRate.ir/4, r.neg, r, 0, 0.1) * 0.4;\n}.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `MxQuery.where` do? What arguments does it take?"}, {"role": "assistant", "content": "Filters the results by testing each source object if objects.selector == equalsValue. eg. qs.inlets.where(\\name,\\freq) would return all inlets with the name Arguments: selector — The selector will be called on the source. For a unit this is what is inside it. For inlets, outlets and channels it is the inlet,outlet,channel itself. Thus inlet.name == 'freq' is asking the inlet.; equalsValue — The value to be matched for equality. Returns: an MxQuery with the selected results"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Pulse`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\\harpsi, { |outbus = 0, freq = 440, amp = 0.1, gate = 1|\n var out;\n out = EnvGen.ar(Env.adsr, gate, doneAction: Done.freeSelf) * amp *\n Pulse.ar(freq, 0.25, 0.75);\n Out.ar(outbus, out ! 2);\n}).add; // see below for more on .add\n\np = Pbind(\n // Use \\harpsi, not \\default\n \\instrument, \\harpsi,\n \\degree, Pseries(0, 1, 8),\n \\dur, 0.25\n).play;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Symbol`?"}, {"role": "assistant", "content": "Symbol — a unique name for something"}, {"role": "user", "content": "What does `Symbol.isClassName` do?"}, {"role": "assistant", "content": "Answer whether the symbol can be a class name. This does not say if the class exists. `\\Array.isClassName;`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na = { SinOsc.ar(\\freq.kr(440, 1.2)) }.play;\na.set(\\freq, 330);\na.release;\na = { SinOsc.ar(\\freq.kr([440, 460], 1.2)) }.play;\na.setn(\\freq, [330, 367]);\na.release;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `MultiLevelIdentityDictionary.choose` do?"}, {"role": "assistant", "content": "Choose a branch at each level, descend the tree until a leaf is chosen. By using arguments key1, key2 ... keyN, one can start at an address within the tree, descend the tree until a leaf is"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// modulate fundamental frequency, formant freq stays constant\n{ Formant.ar(XLine.kr(400, 1000, 8), 2000, 800, 0.125) }.play\n\n// modulate formant frequency, fundamental freq stays constant\n{ Formant.ar(200, XLine.kr(400, 4000, 8), 200, 0.125) }.play\n\n// modulate width frequency, other freqs stay constant\n{ Formant.ar(400, 2000, XLine.kr(800, 8000, 8), 0.125) }.play\n```"}, {"role": "assistant", "content": "modulate fundamental frequency, formant freq stays constant modulate formant frequency, fundamental freq stays constant (Formant: Formant oscillator)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// default values\n{ Logistic.ar }.play\n\n// onset of chaos\n{ Logistic.ar(Line.kr(3.55, 3.6, 5), 1000) }.play\n\n// explore via Mouse\n{ Logistic.ar(MouseX.kr(3, 3.99), MouseY.kr(10, 10000, 'exponential'), 0.25, 0.5 }.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// default values\n{ Logistic.ar }.play\n\n// onset of chaos\n{ Logistic.ar(Line.kr(3.55, 3.6, 5), 1000) }.play\n\n// explore via Mouse\n{ Logistic.ar(MouseX.kr(3, 3.99), MouseY.kr(10, 10000, 'exponential'), 0.25, 0.5) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "What is `SFormant` in SuperCollider?"}, {"role": "assistant", "content": "SFormant — a formant sInstrument Based on optoformant3. Category: SInstruments."}]} +{"conversations": [{"role": "user", "content": "What is `FoaAnalyze` in SuperCollider?"}, {"role": "assistant", "content": "FoaAnalyze — First Order Ambisonic (FOA) analyzer Analyzes a First Order Ambisonic signal (B-format). Category: Libraries > Ambisonic Toolkit > UGens > FOA > Analyzer, UGens > Multichannel > Ambisonics, UGens > Analysis > Ambisonics."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// modulate frequency\n{ Pulse .ar(XLine.kr(40,4000,6),0.1, 0.2) }.play;\n{ PulseDPW.ar(XLine.kr(40,4000,6),0.1, 0.2) }.play;\n\n// two band limited square waves thru a resonant low pass filter\n{ RLPF.ar(Pulse .ar([100,250],0.5,0.1), XLine.kr(8000,400,5), 0.05) }.play;\n{ RLPF.ar(PulseDPW.ar([100,250],0.5,0.1), XLine.kr(8000,400,5), 0.05 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// modulate frequency\n{ Pulse .ar(XLine.kr(40,4000,6),0.1, 0.2) }.play;\n{ PulseDPW.ar(XLine.kr(40,4000,6),0.1, 0.2) }.play;\n\n// two band limited square waves thru a resonant low pass filter\n{ RLPF.ar(Pulse .ar([100,250],0.5,0.1), XLine.kr(8000,400,5), 0.05) }.play;\n{ RLPF.ar(PulseDPW.ar([100,250],0.5,0.1), XLine.kr(8000,400,5), 0.05) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Amplitude`."}, {"role": "assistant", "content": "```supercollider\n// use input amplitude to control Pulse amplitude - use headphones to prevent feedback.\n{ Pulse.ar(90, 0.3, Amplitude.kr(SoundIn.ar(0))) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `UChain.prepareWaitAndStart` do? What arguments does it take?"}, {"role": "assistant", "content": "Start preparation, then wait during waitTime seconds, and finally start the Arguments: target — A collection of targets.; startPos — Offset in seconds from the start of the event.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// play to buses silently\n\n(\na = Bus.audio(s, 5);\nx = { Out.ar(a.index, SinOsc.ar((3..7) * 100, 0, 0.05)) }.play\n);\n\n\n// mix the source\n// a Drate ugen with arrays causes multichannel expansion\n// thus the drate ugen for fadeTime needs to be wrapped into a Function\n\n(\nz = {\n DXMixIn.ar(\n Drand([[0, 1], [2, 3], [4, 0], [1, 2], [3, 4]], inf) + a.index,\n fadeTime: { Dwhite(0.5, 5) }\n )\n}.play(addAction: \\addToTail)\n);\n\n// stop DXMixIn, source still running\n\nz.release\n\n\n// get source\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// play to buses silently\n\n(\na = Bus.audio(s, 5);\nx = { Out.ar(a.index, SinOsc.ar((3..7) * 100, 0, 0.05)) }.play\n);\n\n\n// mix the source\n// a Drate ugen with arrays causes multichannel expansion\n// thus the drate ugen for fadeTime needs to be wrapped into a Function\n\n(\nz = {\n DXMixIn.ar(\n Drand([[0, 1], [2, 3], [4, 0], [1, 2], [3, 4]], inf) + a.index,\n fadeTime: { Dwhite(0.5, 5) }\n )\n}.play(addAction: \\addToTail)\n);\n\n// stop DXMixIn, source still running\n\nz.release\n\n\n// get source with other rhythm\n\n(\nz = {\n DXMixIn.ar(\n Dseq([[0, 1], [2, 3], [4, 0], [1, 2], [3, 4]], inf) + a.index,\n fadeTime: [0.05, 2]\n )\n}.play(addAction: \\addToTail)\n);\n\nz.release\n\n// cleanup\n\n(\nx.free;\na.free;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Pmulpre` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain);\nb = Pmulpre(\\freq, Pseq([1, 2, 3], inf), a);\nb.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `DWGPluckedStiff` in SuperCollider briefly."}, {"role": "assistant", "content": "DWGPluckedStiff — Plucked physical model. Digital wave guide physical model of a plucked instrument. It implements inharmonicity due to string stiffness acording to J. Rauhala and V. Välimäki, Tunable dispersion filter design for piano synthesis, IEEE Signal Processing Letters, vol. 13, no. 5, pp. 253256, 2006. Category: UGens > PhysicalModels."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Out` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-out\", { |out = 0, freq = 440|\n var source;\n source = SinOsc.ar(freq, 0, 0.1);\n\n // write to the bus, adding to previous contents\n Out.ar(out, source);\n\n}).add;\n);\n\n\nSynth(\"help-out\", [\\freq, 500]);\nSynth(\"help-out\", [\\freq, 600]);\nSynth(\"help-out\", [\\freq, 700]);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `UScore.checkIfInEmptyTrack` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: evt — (describe argument here). Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `UnaryOpUGen` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\na = WhiteNoise.ar; // a WhiteNoise\nb = a.squared; // a UnaryOpUGen.\nb.operator; // squared\n\n// sound example\n\n{ var a = LFSaw.ar(300).range(0, 2pi); a.sin * 0.1 }.play;\n\n// Plotting the \"abs\" unary operator (via the server):\n\n{ SinOsc.ar(300).abs }.plot\n```"}]} +{"conversations": [{"role": "user", "content": "What does `PMouseX.new` do? What arguments does it take?"}, {"role": "assistant", "content": "UGenPatterns quark library Arguments: minval; maxval; warp — 0 for linear and 1 for exponential. The symbols CODE\\linear and CODE\\exponential also work.; lag; length — Number of values produced.."}]} +{"conversations": [{"role": "user", "content": "What does `MIDIClockOut.stopToBundle` do? What arguments does it take?"}, {"role": "assistant", "content": "a Player that sends MIDI Clock Out Arguments: b."}]} +{"conversations": [{"role": "user", "content": "What does `MKtlElement.deviceSpec` do?"}, {"role": "assistant", "content": "The spec that maps between the numerical value range the device sends and/or receives, and the the unipolar range in the"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `ExpRand` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"help-ExpRand\", { |out = 0|\n Out.ar(out,\n FSinOsc.ar(\n ExpRand(100.0, 8000.0),\n 0, Line.kr(0.2, 0, 0.01, doneAction: Done.freeSelf))\n )\n}).add;\n);\n\n(\nRoutine({\n inf.do({ |i|\n Synth.new(\"help-ExpRand\"); 0.05.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\sub;\n~description = \"Dedicate a channel to subwoofer signal. Ideally use with monoSpat spatializer\";\n~channelLayout = \\mono;\n~function = { |in = 0, sub_gainDB = -99, sub_lpHz = 200|\n LPF.ar(in, sub_lpHz.clip(5.0, 18000)) * sub_gainDB.dbamp\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "How do I play a sample from disk?"}, {"role": "assistant", "content": "Load it into a Buffer on the server, then play the buffer. `BufRateScale` keeps the pitch right when\nthe file's sample rate differs from the server's.\n\n```supercollider\n(\ns.waitForBoot {\n ~buf = Buffer.read(s, \"C:/sounds/break.wav\");\n SynthDef(\\player, { |out = 0, buf = 0, amp = 0.6, rate = 1|\n var sig = PlayBuf.ar(2, buf, BufRateScale.kr(buf) * rate, loop: 1);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n ~player = Synth(\\player, [\\buf, ~buf]);\n};\n)\n```\nUse `numChannels` 1 for a mono file; a mismatch is silent or wrong-sounding rather than an error."}]} +{"conversations": [{"role": "user", "content": "What does `SaveConsole.new` do? What arguments does it take?"}, {"role": "assistant", "content": "widget with Save/SaveAs/Open controls Arguments: object — anything that can respond to .asCompileString and thus be saved to disk; path — supply this if the object you are supplying was already loaded from disk and has a known path. This is used for the save/save as behavior.; layout."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// p = ProxySpace.push(s.boot);\n\nl = NodeProxyEditor(nil, 3); l.w.bounds_(l.w.bounds.moveBy(0, 120));\nm = NodeProxyEditor(nil, 3); m.w.bounds_(m.w.bounds.moveBy(0, 240));\nn = NodeProxyEditor(nil, 3); n.w.bounds_(n.w.bounds.moveBy(0, 360));\no = NodeProxyEditor(nil, 3); o.w.bounds_(o.w.bounds.moveBy(0, 480));\n\nSpec.add(\\dens, [0.1, 300, \\exp]);\n\n // make 3 kinds of proxies: using tilde/pro\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// p = ProxySpace.push(s.boot);\n\nl = NodeProxyEditor(nil, 3); l.w.bounds_(l.w.bounds.moveBy(0, 120));\nm = NodeProxyEditor(nil, 3); m.w.bounds_(m.w.bounds.moveBy(0, 240));\nn = NodeProxyEditor(nil, 3); n.w.bounds_(n.w.bounds.moveBy(0, 360));\no = NodeProxyEditor(nil, 3); o.w.bounds_(o.w.bounds.moveBy(0, 480));\n\nSpec.add(\\dens, [0.1, 300, \\exp]);\n\n // make 3 kinds of proxies: using tilde/proxyspace, Ndef, and unnamed.\n~spacy = { |dens = 5| Formlet.ar(Dust.ar(dens ! 2), LFDNoise0.kr(20 ! 2).lag(0.1).linexp(-1, 1, 300, 5000), 0.003, 0.03) };\nNdef(\\ndeffy, { GrayNoise.ar(0.1 ! 2) });\nc = NodeProxy.audio.source_({ PinkNoise.ar(0.1 ! 2) });\n\n // put one in each editor\nl.proxy_(~spacy);\nm.proxy_(Ndef(\\ndeffy));\nn.proxy_(c);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `NumberEditorGui` in SuperCollider?"}, {"role": "assistant", "content": "NumberEditorGui — gui class Category: Libraries > crucial > GuiClasses."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `FoldIndex`."}, {"role": "assistant", "content": "```supercollider\n// indexing into a table\n(\n{\n var buf = LocalBuf.newFrom([200, 300, 400, 500, 600, 800]);\n var freq = FoldIndex.kr(buf, MouseX.kr(0, BufFrames.ir(buf) * 3));\n SinOsc.ar(freq) * 0.1\n}.play;\n);\n\n// the same using a global buffer\n(\nt = [200, 300, 400, 500, 600, 800];\nb = Buffer(s, t.size, 1);\n\n// alloc and set the values\ns.listSendMsg(b.allocMsg(b.setnMsg(0, t)).postln);\n\nSynthDef(\\help_Index, { |out = 0, bufnum = 0|\n Out.ar(out,\n SinOsc.ar(\n FoldIndex.kr(\n bufnum,\n MouseX.kr(0, BufFrames.ir(bufnum) * 3)\n ),\n 0,\n 0.5\n )\n )\n}).play(s, [\\bufnum, b.bufnum]);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for blaplop (a SuperCollider snippet) that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\bla, { arg out=0, amp=0.1, gate=1, pan=0, freq=200;\n var sig;\n var tab;\n tab = \\tab.kr(1 ! 15);\n sig = LFSaw.ar(freq * tab.abs);\n sig = sig.sum;\n sig = RLPF.ar(sig, Rand(10,freq*2) + 100 * SinOsc.ar(tab.abs).range(0.01,Rand(2,7)));\n sig = sig.sum;\n sig = sig / 100;\n sig = sig.tanh;\n sig = sig * EnvGen.ar(Env.adsr(0.01,0.1,0.8,0.1+ExpRand(0.001,0.2)),gate,doneAction:2);\n sig = Pan2.ar(sig, pan, amp);\n Out.ar(out, sig);\n}).add;\n);\n\n(\nPdef(\\plop, Pbind(\n \\instrument, \\bla,\n \\degree, Pstep(Pseq([\n Pseq([0,2,4],4),\n Pseq([0,12,6],4),\n Pseq([0,12,6]+7,1),\n ],inf), 1),\n \\octave, 3,\n \\tab, Pfunc {\n var tab;\n [\n //tab = { arg n; (n + 1.asFloat.rand + 1).tanh / (n.rand+1) } ! 15;\n tab = { arg n; (n + 2.asFloat.rand + 1) / (n+1) } ! 15;\n tab.postln;\n ]\n },\n \\dur, PdurStutter( Prand([1,2,4],inf), Pseq([1,2,3]/2,inf)),\n \\amp, 0.4\n)).play;\n);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Image.tileInRect` do? What arguments does it take?"}, {"role": "assistant", "content": "tile the image or a portion of it in a specified rectangle of the current graphic context. This may stretch the image depending on the destination rect. Arguments: rect — the Rect where to draw it; fromRect — the portion of the Image to use; operation — the compositing operation to use. `'sourceOver'` is the default.; opacity — the opacity to use, ranging from 0.0 (fully transparent) to 1.0 (fully opaque)."}]} +{"conversations": [{"role": "user", "content": "Which keys does a Pbind understand?"}, {"role": "assistant", "content": "The ones you use constantly are \\instrument (a SynthDef name), \\dur (seconds), \\degree (scale degree), \\midinote, \\freq, \\amp, \\legato (note length as a fraction of \\dur), and \\scale plus \\root for the scale used by \\degree. Everything else is passed to the Synth as an argument, so a SynthDef with `|cutoff = 800|` can be driven by `\\cutoff, Pwhite(400, 4000)`."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for seasonal reflections ) that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n(\nfork { loop { \n Ndef(\\winter_curves, {\n var bands = 5.rrand(15) * 2;\n var freqs = Array.exprand(bands.debug('bands'), 20, 18000);\n Pan2.ar(\n SinOsc.ar(\n freqs, \n Array.rand(bands, 0, pi),\n AmpCompA.kr(freqs, freqs.sort.first)\n ).perform(0.5.coin.if(\\tanh,\\value).debug('kind')),\n FSinOsc.kr(\n Array.exprand(bands, 0.01, 15),\n Array.rand(bands, 0, pi),\n ),\n bands.reciprocal\n * LFGauss.kr(SinOsc.kr(Array.rand(bands, 0.05, 0.1)).range(1,10), 0.3)\n * FSinOsc.kr(\n Array.exprand(bands, 0.1, 15),\n 0.3\n ).range(0,1)\n ).sum\n * SelectX.kr(\n FSinOsc.kr(Array.exprand(bands, 0.1, 15)).range(0,1),\n [\n EnvGen.kr(\n Env.perc(\n FSinOsc.kr(1/16).range(0.01,0.1),\n FSinOsc.kr(1/8).range(0.25,0.3)\n ).blend(\n Env.sine( // 1/4\n FSinOsc.kr(Array.exprand(bands, 0.1, 15)).range(0.05,2)\n ).blend(\n Env.sine(1/4),\n FSinOsc.kr(Array.exprand(bands, 0.1, 15)).range(0.05,2).mean\n ),\n FSinOsc.kr(Array.exprand(bands, 0.1, 15)).range(0,1)\n ).circle,\n 1, 0.8, \n FSinOsc.kr(freqs.linlin(20,18000,0.1,20)).range(0, 0.2).mean\n ),\n 1\n ]\n ).clump(2).mean\n }).fadeTime_(0.5.rrand(2.5)).play;\n 8.rrand(30).debug('len').wait;\n} }\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\nz = {\n BHiPass.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(10, 20000, \\exponential), // cutoff freq.\n MouseY.kr(0.0, 1.0, \\linear), // rq\n 0.5); // mul\n}.play\n;\nz.release;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\nz = {\n BHiPass.ar(\n SoundIn.ar([0, 1]),\n MouseX.kr(10, 20000, \\exponential), // cutoff freq.\n MouseY.kr(0.0, 1.0, \\linear), // rq\n 0.5); // mul\n}.play\n);\nz.release;\n```"}]} {"conversations": [{"role": "user", "content": "What does Lag do?"}, {"role": "assistant", "content": "`Lag.ar(in, lagTime)` and `Lag.kr(in, lagTime)` smooth a signal with an exponential lag towards its target, which removes the clicks and zipper noise a stepped control would produce. Lag.kr on a mouse or MIDI input is the standard way to make a parameter feel analogue: `Lag.kr(MouseX.kr(200, 4000), 0.2)`. Lag2 and Lag3 are the second- and third-order versions, smoother and slower."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n\nvar in, fft, entropy;\n\n//in = SinOsc.ar(MouseX.kr(100,1000),0,0.1);\n//in = Mix(SinOsc.ar([440,MouseX.kr(440,880)],0,0.1)); \nin= SoundIn.ar; \n\nfft = FFT(LocalBuf(2048), in);\n\nentropy=SpectralEntropy.kr(fft,2048,1); //one output band (so full spectrum's entropy)\n\nentropy.poll; \n\nOut.ar(0,Pan2.ar(0.1*Blip.ar(100,10*(entropy.sqrt)))); \n}.play\n);\n\n\n\n\n(\n{\n\nvar in, fft, entropy;\nvar amplit\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n\nvar in, fft, entropy;\n\n//in = SinOsc.ar(MouseX.kr(100,1000),0,0.1);\n//in = Mix(SinOsc.ar([440,MouseX.kr(440,880)],0,0.1)); \nin= SoundIn.ar; \n\nfft = FFT(LocalBuf(2048), in);\n\nentropy=SpectralEntropy.kr(fft,2048,1); //one output band (so full spectrum's entropy)\n\nentropy.poll; \n\nOut.ar(0,Pan2.ar(0.1*Blip.ar(100,10*(entropy.sqrt)))); \n}.play\n);\n\n\n\n\n(\n{\n\nvar in, fft, entropy;\nvar amplitude; \n\nin= SoundIn.ar; \n\namplitude = Amplitude.kr(in); \n\nfft = FFT(LocalBuf(1024), in);\n\nentropy=SpectralEntropy.kr(fft,1024,10);//10 bands\n\nentropy = entropy * (amplitude.min(0.2)*5.0); //scale by amplitude to avoid low amplitude noise issues\n\nentropy.poll; \n\n//Out.ar(0,Pan2.ar(0.1*Blip.ar((entropy[0])*200,entropy[1].sqrt))); \n\nOut.ar(0,Splay.ar(0.1*Blip.ar((entropy)*200,entropy.sqrt)));\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a plucked string in SuperCollider."}, {"role": "assistant", "content": "Pluck is a Karplus-Strong string: a noise burst into a tuned delay with feedback. The delay time is\nthe reciprocal of the frequency.\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 220, amp = 0.5, dur = 3|\n var period = freq.reciprocal;\n var sig = Pluck.ar(WhiteNoise.ar(0.2), Impulse.kr(0), period, period, dur, 0.5);\n Out.ar(out, Pan2.ar(sig * amp, 0));\n}).add;\n);\nSynth(\\pluck, [\\freq, 330, \\dur, 4]);\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Bus`?"}, {"role": "assistant", "content": "Bus — Representation of a bus on the server"}, {"role": "user", "content": "What does `Bus.control` do?"}, {"role": "assistant", "content": "Allocate a control bus on the server."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\na = Bus.control(s, 1).set(440);\nb = Bus.control(s, 1).set(0.01);\n);\n(\nSynthDef(\\rlpf, { |out, ffreq, rq|\n Out.ar(out, RLPF.ar(WhiteNoise.ar(0.2), ffreq, rq))\n}).play(s, [\\ffreq, a.asMap, \\rq, b.asMap]);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for micro-beat repeat, based on delay."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\stutter,{\n arg in=0, out=0;\n var sig, delayTime, increment, trigger;\n var reset=\\reset.kr(0);\n var delayPitch=\\pitch.kr(12);\n var offsetms=\\offsetms.kr(0)/1000;\n var strobe=\\strobe.kr(1);\n var on=\\onoff.kr(0);\n var envGen, sustainTime;\n var atkTime=0.002, relTime=0.002;\n\n reset=reset*on;\n // Convert pitch to delay time in seconds\n delayTime = delayPitch.midicps.reciprocal;\n\n // Trigger for incrementing delay time\n trigger = Impulse.ar(delayTime.reciprocal);\n\n // Calculate sustain time to ensure envelope stays high for the chunk duration minus attack and release\n sustainTime = delayTime - (atkTime + relTime);\n\n // Ensure sustainTime is not negative\n sustainTime = max(sustainTime, 0)*strobe;\n\n // Increment delay time\n increment = Dseries(0, delayTime, inf)*on;\n increment = Demand.ar(trigger, reset, increment);\n\n // Generate an envelope to soften clicks\n envGen = EnvGen.ar(Env([0, 1, 1, 0], [atkTime, sustainTime, relTime], 'lin'), trigger);\n\n\n // Get input signal\n sig = In.ar(in, 1); // Assuming stereo input\n\n // Apply delay\n sig = DelayC.ar(sig, 24, increment+offsetms);\n\n // Apply envGen\n sig=sig*envGen;\n\n // Output\n Out.ar(out, sig);\n}).add();\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `MAbstractElement.indices` do?"}, {"role": "assistant", "content": "returns an array of indices that points to `this` from the top level of the `MKtl` elements hierarchy. These values correspond with"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes morning on Gliese 667Cb."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var gen = { rrand(1,10).reciprocal };\n BPF.ar(\n SelectX.ar(LFNoise2.kr(gen!4).exprange(0.02,2), [BrownNoise.ar, WhiteNoise.ar, PinkNoise.ar]).mean,\n LFNoise2.ar(gen!8).exprange(20,2e4),\n LFNoise2.ar(gen!8).exprange(0.1,2),\n LFNoise2.ar(gen!8).range(0.1,1)\n ).clump(2).mean\n + FreeVerb.ar(\n LFPar.ar(\n LFNoise2.ar(gen!8).exprange(20,2e4) * SinOsc.ar(1/gen!8).exprange(1,1.2), 0,\n LFNoise2.ar(gen!8).exprange(0.08,0.5) * EnvGen.ar(\n Env.perc.blend(Env.sine, LFNoise2.kr(gen!8)).circle, \n timeScale: gen!8 // LFNoise2.ar(gen!8).range(1/5, 5)\n )\n ).clump(2).mean,\n LFNoise2.ar(1/5)\n ) \n + Pan2.ar(\n Pluck.ar(\n WhiteNoise.ar ! 2,\n Dust.ar(LFNoise2.kr(gen!2).exprange(1/5,5)), \n 1/200, LFNoise2.kr(gen!2).exprange(1/14000,1/200),\n LFNoise2.kr(gen!2).range(1,10),\n LFNoise2.kr(gen!2).range(0,1),\n LFNoise2.kr(gen!2).exprange(0.2,1)\n ),\n LFNoise2.kr(gen!2).range(-1,1)\n ).sum\n / 3;\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `AbstractServerAction`."}, {"role": "assistant", "content": "```supercollider\n// ServerQuit\ns.boot;\nf = { |server| \"------------The server '%' has quit.------------\\n\".postf(server) };\nServerQuit.add(f, \\default);\ns.quit; // quit the server and observe the post\ns.boot;\nServerQuit.remove(f, \\default); // remove it again\ns.quit; // no post.\nServerQuit.add(f, Server.internal);\nServer.internal.boot;\nServer.internal.quit;\nServerQuit.removeAll; // clear all\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Latency`?"}, {"role": "assistant", "content": "Latency — Measure audio latency for multiple channels"}, {"role": "user", "content": "What does `Latency.testAudio` do?"}, {"role": "assistant", "content": "main method to measure audio latency"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// server has hardwareBufferSize 512 for this example.\ns.options.hardwareBufferSize = 512; s.reboot;\n// do something that sends messages with server latency\nPbind(\\degree, Pbrown(-14, 14, 3), \\dur, 1/8).play;\ns.latency;\ns.latency = 0.1; // tune down ...\ns.latency = 0.05;\ns.latency = 0.025;\ns.latency = 0.012; // ... until every message posts \"late 0.01....\" now\ns.latency = 0.018; // go back up -> fewer late messages\ns.latency = 0.021; // go back up until ...\ns.latency = 0.024; // late messages are completely gone again\n\ns.latency = 0.03; // this works on many systems\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Dswitch`."}, {"role": "assistant", "content": "```supercollider\n(\n {\n var d, trig;\n d = Dswitch([\n Dwhite(3, 4, 2),\n Dwhite(0, 1, 2),\n Dseq([1, 1, 1, 0], 2)\n ], Dseq([0, 1, 2, 1, 0], 2));\n\n trig = Impulse.kr(4);\n\n SinOsc.ar(\n Demand.kr(trig, 0, d).poll(trig)\n * 300 + 400\n )\n * 0.1 ! 2\n }.play;\n);\n\n// compare with Dswitch1:\n\n(\n {\n var d, trig;\n d = Dswitch1([\n Dwhite(3, 4, 2),\n Dwhite(0, 1, 2),\n Dseq([1, 1, 1, 0], 2)\n ], Dseq([0, 1, 2, 1, 0], 2));\n\n trig = Impulse.kr(4);\n\n SinOsc.ar(\n Demand.kr(trig, 0, d).poll(trig)\n * 300 + 400\n )\n * 0.1 ! 2\n }.play;\n);\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// server has hardwareBufferSize 512 for this example.\ns.options.hardwareBufferSize = 512; s.reboot;\n// do something that sends messages with server latency\nPbind(\\degree, Pbrown(-14, 14, 3), \\dur, 1/8.play;\ns.latency;\ns.latency = 0.1; // tune down ...\ns.latency = 0.05;\ns.latency = 0.025;\ns.latency = 0.012; // ... until every message posts \"late 0.01....\" now\ns.latency = 0.018; // go back up -> fewer late messages\ns.latency = 0.021; // go back up until ...\ns.latency = 0.024; // late mess\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// server has hardwareBufferSize 512 for this example.\ns.options.hardwareBufferSize = 512; s.reboot;\n// do something that sends messages with server latency\nPbind(\\degree, Pbrown(-14, 14, 3), \\dur, 1/8).play;\ns.latency;\ns.latency = 0.1; // tune down ...\ns.latency = 0.05;\ns.latency = 0.025;\ns.latency = 0.012; // ... until every message posts \"late 0.01....\" now\ns.latency = 0.018; // go back up -> fewer late messages\ns.latency = 0.021; // go back up until ...\ns.latency = 0.024; // late messages are completely gone again\n\ns.latency = 0.03; // this works on many systems\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SequenceableCollection.rejectIndicesAs` do?"}, {"role": "assistant", "content": "Return a new collection of type class which consists of all indices of those elements of the receiver for which function answers `false`. The function is passed two arguments, the item and an integer index. `#[a, b, c, g, h, h, j, h].rejectIndicesAs({ |item, i| item"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n/* Audio plugin definition\n\n Each audio plugin should define the following global variables:\n ~name: (symbol) name of the spatializer\n ~description: (string) a short description\n ~function: the actual definition of the plugin\n\n*/\n\n~name = \\PinkSin;\n~description = \"Mix of pink noise and sine wave\";\n~channelLayout = \\mono;\n\n~function = {| sfreq = 200, amp = 1 |\n amp*(PinkNoise.ar() + FSinOsc.ar(sfreq))\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n(\nSynthDef(\"fm\", {| out = 0, amp = 0.2, midinote=1, octave = 5, carrier, modulator, depth,\n dur = 1, detune = 0|\n\n var carrierOsc, modulation, env, degree, ratio;\n\n\n // adjust the octave. This assumes the fregencies we give for analysis generate a tone in the octave around middle C\n degree = midinote - 60;\n degree = degree + (12 * (octave - 5));\n\n // now compute a ratio\n ratio = degree.midiratio;\n\n // multiple the ratio by all of the FM values\n carrier = (carrier * ratio) + detune; // Pbinds sometimes use a detune value\n modulator = modul\n// …\n```"}, {"role": "assistant", "content": "adjust the octave. This assumes the fregencies we give for analysis generate a tone in the octave around middle C now compute a ratio (DissonanceCurve: Analyzes timbres in order to create tunings)"}]} -{"conversations": [{"role": "user", "content": "What does `MassEditUChain.prepareAndStart` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: target — (describe argument here); loadDef — (describe argument here). Returns: (returnvalue)"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Pdefn`."}, {"role": "assistant", "content": "```supercollider\nz = Pbind(\\degree, Pdefn(\\x, \\), \\dur, 0.25).play;\nPdefn(\\x, Pseq((0..5), inf)).condition_({ |val, i| i.postln % 6 == 0 });\nPdefn(\\x, Pseq((7..0), inf)).condition_({ |val, i| i.postln % 8 == 0 });\n\n\n// the above is equvalent to:\nPdefn(\\x, Pseq((7..0), inf)).count(8);\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\Mirror;\n~description = \"Mirror soundfield\";\n\n~function = {|in = 0, order = 1, mirrorFrontBack = 0, mirrorLeftRight = 0, mirrorUpDown = 0 |\nHOATransMirror.ar(order, in, mirrorFrontBack, mirrorLeftRight, mirrorUpDown);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} -{"conversations": [{"role": "user", "content": "What is `ParGroup`?"}, {"role": "assistant", "content": "ParGroup — Client-side representation of a parallel group node on the server"}, {"role": "user", "content": "What does `ParGroup.basicNew` do?"}, {"role": "assistant", "content": "Create and return a ParGroup object without creating a group node on the server. (This method is inherited from Node and is documented here only for convenience.)"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\nfork {\n p = ParGroup.new;\n loop {\n (\n degree: rrand(0.0, 12.0).round(1/4),\n group: p,\n db: rrand(-30, -25),\n pan: rrand(-1.0, 1.0)\n ).play;\n 0.2.wait;\n }\n}\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `MIDIMKtlDevice` in SuperCollider briefly."}, {"role": "assistant", "content": "MIDIMKtlDevice — The Modality class for creating and accessing external midi controllers MIDIMKtlDevice provides an internal interface for MIDI controllers you can connect to your computer. Category: Libraries > Modality, External Control."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nvar a, b;\na = Prand([1, 2, 3, 4, 5], 6); // return 6 items\nb = a.asStream;\n7.do({ b.next.postln });\n);\n\n// return also a subpattern:\n(\nvar a, b;\na = Prand([1, Pseq([10, 20, 30]), 2, 3, 4, 5], 6); // return 6 items\nb = a.asStream;\n7.do({ b.next.postln });\n);\n\n// Prand used as a sequence of pitches:\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneA\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nvar a, b;\na = Prand([1, 2, 3, 4, 5], 6); // return 6 items\nb = a.asStream;\n7.do({ b.next.postln });\n);\n\n// return also a subpattern:\n(\nvar a, b;\na = Prand([1, Pseq([10, 20, 30]), 2, 3, 4, 5], 6); // return 6 items\nb = a.asStream;\n7.do({ b.next.postln });\n);\n\n// Prand used as a sequence of pitches:\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Prand(#[60, 61, 63, 65, 72], inf).asStream;\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, a.next.midicps]);\n 0.2.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `CXMenu.gui` do? What arguments does it take?"}, {"role": "assistant", "content": "a basic nav menu Arguments: parent; windowWidth; height; argButtonWidth."}]} +{"conversations": [{"role": "user", "content": "What is `RedBuffer` in SuperCollider?"}, {"role": "assistant", "content": "RedBuffer — buffer a segment of a soundfile This class creates buffers with segments from sound files. Category: Red > redGrain."}]} +{"conversations": [{"role": "user", "content": "What does `Main.scVersionPatch` do?"}, {"role": "assistant", "content": "The concrete instance of Process Returns: patch version number as Integer"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Routine` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// SynthDefs on the fly\ns.boot;\n(\nt = TempoClock.new;\nr = Routine.new({\n 10.do({\n // could be done with an argument instead of a new def, but proves the point\n SynthDef(\"help-EnvGen\" ++ i, { arg out = 0;\n Out.ar(\n out,\n EnvGen.kr(Env.perc, 1.0, doneAction: Done.freeSelf)\n * SinOsc.ar(100 + (100 * t.elapsedBeats), 0, 0.1)\n )\n }).play(s);\n 1.yield;\n });\n}).play(t); // Note the alternative syntax: Routine.play(aClock)\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// Since the allpass delay has no audible effect as a resonator on\n// steady-state sound ...\n\n{ AllpassC.ar(WhiteNoise.ar(0.1), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// ...these examples add the input to the effected sound and compare variants so that you can hear\n// the effect of the phase comb:\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassN.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2)\n}.play)\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassL.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0\n// …\n```"}, {"role": "assistant", "content": "Since the allpass delay has no audible effect as a resonator on steady-state sound ... (AllpassC: Schroeder allpass delay line with cubic interpolation.)"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// where did I leave my keys?\n(\nvar n = 30, m = 5;\nNdef.clear(3);\nNdef.ar(\\x, n);\nNdef(\\y, { Splay.ar(Ndef.ar(\\x, m, LFNoise1.kr(1/m).range(0, n - m - 1))).clip2 * 0.5 }).play; \nNdef(\\x, { \n { \n var a = Ndef.ar(\\x, 1, LFNoise0.kr(Rand()) * Rand() + Rand() * n);\n a + 0.1 * SinOsc.ar(ExpRand(0.2, 1000)) \n } ! n\n}); \n);\n\n// where did I put my keys?\n(\nvar n = 30, m = 5;\nNdef.clear(3);\nNdef.ar(\\x, n);\nNdef(\\y, { Splay.ar(Ndef.ar(\\x, m, LFNoise1.kr(1/m).range(0, n - m - 1))).clip2 * 0.5 }).play; \nNdef(\\x, { \n {\n var a = Ndef.ar(\\x, 1, LFNoise0.kr(Rand()) * Rand() + Rand() * n);\n SinOsc.ar(ExpRand(0.2, 1000), a) \n } ! n\n}); \n)\n```"}, {"role": "assistant", "content": "Cross-tuning between multiple signal dimensions. The code is finished without listening."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// using timer to modulate sine frequency: the slower the trigger is the higher the frequency\n(\n{ var trig;\n trig = Impulse.kr(MouseX.kr(0.5, 20, 1));\n SinOsc.ar(Timer.kr(trig) * 500 + 500, 0, 0.2)\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// using timer to modulate sine frequency: the slower the trigger is the higher the frequency\n(\n{ var trig;\n trig = Impulse.kr(MouseX.kr(0.5, 20, 1));\n SinOsc.ar(Timer.kr(trig) * 500 + 500, 0, 0.2)\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SimpleNumber.atanh` do?"}, {"role": "assistant", "content": "Returns the reciprocal of the hyperbolic sine function at `x`. Requires `-1 < x <"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LFCub`."}, {"role": "assistant", "content": "```supercollider\n{ LFCub.ar(LFCub.kr(LFCub.kr(0.2, 0, 8, 10), 0, 400, 800), 0, 0.1) }.play\n{ LFCub.ar(LFCub.kr(0.2, 0, 400, 800), 0, 0.1) }.play\n{ LFCub.ar(800, 0, 0.1) }.play\n{ LFCub.ar(XLine.kr(100, 8000, 30), 0, 0.1) }.play\n\n// compare:\n\n{ LFPar.ar(LFPar.kr(LFPar.kr(0.2, 0, 8, 10), 0, 400, 800), 0, 0.1) }.play\n{ LFPar.ar(LFPar.kr(0.2, 0, 400, 800), 0, 0.1) }.play\n{ LFPar.ar(800, 0, 0.1) }.play\n{ LFPar.ar(XLine.kr(100, 8000, 30), 0, 0.1) }.play\n\n\n{ SinOsc.ar(SinOsc.kr(SinOsc.kr(0.2, 0, 8, 10), 0, 400, 800), 0, 0.1) }.play\n{ SinOsc.ar(SinOsc.kr(0.2, 0, 400, 800), 0, 0.1) }.play\n{ SinOsc.ar(800, 0, 0.1) }.play\n{ SinOsc.ar(XLine.kr(100, 8000, 30), 0, 0.1) }.play\n\n{ LFTri.ar(LFTri.kr(LFTri.kr(0.2, 0, 8, 10), 0, 400, 800), 0, 0.1) }.play\n{ LFTri.ar(LFTri.kr(0.2, 0, 400, 800), 0, 0.1) }.play\n{ LFTri.ar(800, 0, 0.1) }.play\n{ LFTri.ar(XLine.kr(100, 8000, 30), 0, 0.1) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `T2A` in SuperCollider briefly."}, {"role": "assistant", "content": "T2A — Control rate trigger to audio rate trigger converter Converts control rate trigger into audio rate trigger (maximally one per control period). Category: UGens > Conversion, UGens > Triggers."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `T2A`."}, {"role": "assistant", "content": "```supercollider\n// example\n(\n{\n var trig = Impulse.kr(MouseX.kr(1, 100, 1));\n Ringz.ar(T2A.ar(trig), 800, 0.01) * 0.4\n}.play;\n);\n\n// compare with K2A\n(\n{\n var trig = Impulse.kr(200);\n [T2A.ar(trig), K2A.ar(trig)].lag(0.001)\n}.plot(10/200);\n);\n\n// removing jitter by randomising offset\n(\n{\n var trig = Impulse.kr(MouseX.kr(1, 100, 1));\n Ringz.ar(T2A.ar(trig, WhiteNoise.kr.range(0, s.options.blockSize - 1)), 800, 0.01) * 0.4\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `FoaWr.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "First Order Ambisonic (FOA) Soundfield Reactive Energy Vector Arguments: in — The B-format signal, an array: [w, x, y, z]; size — Analysis filter kernel size.; method — The Soundfield analysis method:."}]} +{"conversations": [{"role": "user", "content": "What does `KeyCodeResponder.controlModifier` do?"}, {"role": "assistant", "content": "register responder functions for keycode and modifier combinations"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Looping sampler with crossfading. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\nSynthDef(\\simpler, {\n arg buf=0\n ,freq=220\n ,sampleStart=0\n ,loopStart=0\n ,loopLen=1 // between 0 (min) and 1 (max)\n ,fadeTime=0.1\n ,gate=1\n ,attack=0.01\n ,sustain=1\n ,release=1\n ,f0=220;\n\n var rate = freq / f0;\n var sr = rate*BufSampleRate.kr(buf);\n var fadeFrames = fadeTime*sr;\n var loopEnd = loopLen*(BufFrames.kr(buf) - loopStart) + loopStart;\n var loopFrames = loopEnd - loopStart + 1;\n var loopTime = (loopFrames - fadeFrames)/sr;\n var startUpTime = (loopStart - sampleStart)/sr;\n\n var trigLoop = TDuty.ar(Dseq([startUpTime + loopTime, Dseq([loopTime], inf)]), gapFirst:1);\n\n var phaseA = Phasor.ar(trigLoop, rate, sampleStart, inf, loopStart);\n var phaseB = Phasor.ar(trigLoop, rate, loopEnd - fadeFrames, inf, loopEnd - fadeFrames);\n\n var srcA = BufRd.ar(buf.numChannels, buf, phaseA);\n var srcB = BufRd.ar(buf.numChannels, buf, phaseB);\n\n var startLoop = SetResetFF.ar(trigLoop);\n var loopPan = Phasor.ar(trigLoop, 2/fadeFrames * rate, -1, inf, -1).clip(-1,1);\n\n var out = Select.ar(startLoop, [srcA, LinXFade2.ar(srcB, srcA, pan:loopPan)]);\n var env = EnvGen.ar(Env.asr(attack, sustain, release, 1), gate, doneAction:2);\n\n Out.ar(0, Splay.ar(out) * env);\n}).add;\n\n// Try it out:\n~buf = Buffer.read(s, Platform.resourceDir +/+ 'sounds/a11wlk01.wav');\n\nPdef(\\p, Pbind(*[\n instrument: \\simpler\n ,buf: ~buf\n ,octave: Prand([3,4,5],inf)\n ,degree: Pn(Plazy({Pseq([-4,0,5,7,9,12].scramble.clump(2),2)}))\n ,dur: 0.5\n ,strum: Prand([0, 0.125, 0.25], inf)\n ,strumEndsTogether: false\n ,loopStart: Pwhite(90000, 150000)\n ,sampleStart: Pwhite(50000, 85000)\n ,loopLen: 0.4\n ,fadeTime: 0.15\n ,attack: 0.25\n ,release: 4\n])).play;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `ArrayedCollection`?"}, {"role": "assistant", "content": "ArrayedCollection — Abstract superclass of Collections of fixed maximum size"}, {"role": "user", "content": "What does `ArrayedCollection.newClear` do?"}, {"role": "assistant", "content": "Creates a new instance with indexedSize indexable slots. The slots are filled with Nil, zero or something else appropriate to the type of indexable slots in the object. `Array.newClear(4).postln;`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n pitches.size.do{ |i|\n {\n var freq = pitches[i].midicps;\n var env = Env.perc.ar(Done.freeSelf);\n SinOsc.ar(freq) * 0.1 * env\n }.play;\n 0.2.wait\n }\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is a SynthDef?"}, {"role": "assistant", "content": "A SynthDef is a named, compiled server-side instrument: a UGen graph plus named controls. You build one with SynthDef(\\name, { |args| ... }).add, and then play instances with Synth(\\name)."}]} +{"conversations": [{"role": "user", "content": "What is `AbstractDispatcher` in SuperCollider?"}, {"role": "assistant", "content": "AbstractDispatcher — Dispatches incoming messages to Functions Instances of AbstractDispatcher dispatch incoming messages (e.g. MIDI, OSC), to registered instances of AbstractResponderFunc. There will be a default dispatcher for each message type, but one can have multiple dispatchers per type in order to implement custom dispatching for groups of ResponderFuncs. (The main example of this is OSC pattern matching with OSCMessagePatternDispatcher.) Normally use Category: External Control > Abstract Classes."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Duty`."}, {"role": "assistant", "content": "```supercollider\n(\n {\n var freq;\n freq = Duty.kr(\n Dseq([0.2, 0.3, 0.4, Dseq([1, 1, 1, 2, 1, 2], inf)]) / 2,\n Dust.kr(1), // control rate reset\n Dseq([0, 1, 2, Dseq([1, 2, 3, 4, 5], inf)])\n ) * 30 + 250;\n SinOsc.ar(freq * [1, 1.01]) * 0.1\n\n }.play;\n);\n\n(\n {\n var freq;\n freq = Duty.kr(\n Dseq([0.2, 0.3, 0.4, Dseq([1, 1, 1, 2, 1, 2], inf)]) / 2,\n Dseq([1, 2, 4, 5], inf), // demand rate reset\n Dseq([0, 1, 2, Dseq([1, 2, 3, 4, 5], inf)])\n ) * 30 + 250;\n SinOsc.ar(freq * [1, 1.01]) * 0.1\n\n }.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Compander`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n Decay2.ar(\n Impulse.ar(8, 0, LFSaw.kr(0.3, 1, -0.3, 0.3)),\n 0.001,\n 0.3\n )\n * Mix.ar(Pulse.ar([80, 81], 0.3))\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Duty`."}, {"role": "assistant", "content": "```supercollider\n(\n {\n var freq;\n freq = Duty.kr(\n Drand([0.01, 0.2, 0.4], inf), // demand ugen as durations\n 0,\n Dseq([204, 400, 201, 502, 300, 200], inf)\n );\n SinOsc.ar(freq * [1, 1.01]) * 0.1\n\n }.play;\n);\n\n(\n {\n var freq;\n freq = Duty.kr(\n MouseX.kr(0.001, 2, 1), // control rate ugen as durations\n 0,\n Dseq([204, 400, 201, 502, 300, 200], inf)\n );\n SinOsc.ar(freq * [1, 1.01]) * 0.1\n\n }.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Fdef`."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\ns.boot;\nSynthDef(\"gpdef\",\n { |out = 0, freq = 440, sustain = 0.05, amp = 0.1|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain), doneAction: Done.freeSelf) * amp;\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n// fork a thread that plays some sounds\n(\nFdef(\\freq, 440);\nFdef(\\dur, 0.2);\n\nfork {\n loop {\n s.sendMsg(\"/s_new\", \"gpdef\", -1, 1, 1, \\freq, Fdef(\\freq).value);\n Fdef(\\dur).value.wait;\n }\n};\n);\n\n// some modifications\n\nFdef(\\freq, Fdef(\\midinote, 60).midicps);\nFdef(\\midinote, { [67, 64, 65].choose });\nFdef(\\midinote, { [67, 64, 65].choose } + Fdef(\\offset));\nFdef(\\offset, { 4.rand });\nFdef(\\dur, 0.23);\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for Interpolate between Envs with Pseg: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\sin, { arg out=0, gate=1, amp=0.1, pan=0, freq=200;\n var sig;\n sig = SinOsc.ar(freq);\n sig = sig * EnvGen.kr(\\adsr.kr(Env.adsr(0.1,0.1,0.8,0.1)), gate, doneAction:2);\n sig = Pan2.ar(sig, pan, amp);\n Out.ar(out, sig);\n}).add;\n);\n\n(\n// sequence Envs\n// need [] else it is inlined or does pattern multichannel expansion\nPdef(\\demo, \n Pbind(\n \\instrument, \\sin,\n \\degree, Pseq([0, Pwhite(0,7,1)],inf),\n \\legato, 0.5,\n \\adsr, Pseq([\n [ Env.adsr(1.1,0.1,0.8,1.01) ],\n [ Env.adsr(0.01,0.1,0.8,0.01) ],\n [ Env.adsr(0.01,1.1,0.3,0.01) ],\n ],inf),\n )\n).play;\n);\n\n(\n// interpolate using Pseg\n// need .asArray\nPdef(\\demo, \n Pbind(\n \\instrument, \\sin,\n \\degree, Pseq([0, Pwhite(0,7,1)],inf),\n \\legato, 0.5,\n \\adsr, Pseg(Pseq([\n [ Env.adsr(1.1,0.1,0.8,1.01).asArray ],\n [ Env.adsr(0.01,0.1,0.8,0.01).asArray ],\n [ Env.adsr(0.01,1.1,0.3,0.01).asArray ],\n ],inf),8),\n )\n).play;\n);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// use input amplitude to control Pulse amplitude - use headphones to prevent feedback.\n{ Pulse.ar(90, 0.3, Amplitude.kr(SoundIn.ar(0)) }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// use input amplitude to control Pulse amplitude - use headphones to prevent feedback.\n{ Pulse.ar(90, 0.3, Amplitude.kr(SoundIn.ar(0))) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ RLPF.ar(Saw.ar(200, 0.1), SinOsc.ar(XLine.kr(0.7, 300, 20), 0, 3600, 4000), 0.2) }.play;\n\n\n(\n{ var ctl = RLPF.ar(Saw.ar(5, 0.1), 25, 0.03);\n SinOsc.ar(ctl * 200 + 400) * 0.1;\n}.play;\n);\n\n\n(\n{ var ctl = RLPF.ar(Saw.ar(5, 0.1), MouseX.kr(2, 200, 1), MouseY.kr(0.01, 1, 1));\n SinOsc.ar(ctl * 200 + 400) * 0.1;\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ RLPF.ar(Saw.ar(200, 0.1), SinOsc.ar(XLine.kr(0.7, 300, 20), 0, 3600, 4000), 0.2) }.play;\n\n\n(\n{ var ctl = RLPF.ar(Saw.ar(5, 0.1), 25, 0.03);\n SinOsc.ar(ctl * 200 + 400) * 0.1;\n}.play;\n);\n\n\n(\n{ var ctl = RLPF.ar(Saw.ar(5, 0.1), MouseX.kr(2, 200, 1), MouseY.kr(0.01, 1, 1));\n SinOsc.ar(ctl * 200 + 400) * 0.1;\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `PMOsc` in SuperCollider?"}, {"role": "assistant", "content": "PMOsc — Phase modulation oscillator pair. Phase modulation sine oscillator pair. Category: UGens > Generators > Deterministic."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `SharedIn`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n// only works with the internal server\ns = Server.internal;\ns.boot;\n);\n\n(\nSynthDef(\"help-SharedIn1\", {\n Out.ar(0, SinOsc.ar(Lag.kr(SharedIn.kr(0, 1), 0.01), 0, 0.2));\n}).add;\nSynthDef(\"help-SharedIn2\", {\n Out.ar(1, SinOsc.ar(Lag.kr(SharedIn.kr(0, 1), 0.01, 1.5), 0, 0.2));\n}).add;\n);\n\n(\ns.setSharedControl(0, 300); // an initial value\ns.sendMsg(\\s_new, \"help-SharedIn1\", x = s.nextNodeID, 0, 1);\ns.sendMsg(\\s_new, \"help-SharedIn2\", y = s.nextNodeID, 0, 1);\n\nRoutine({\n 30.do({\n s.setSharedControl(0, 300 * (10.rand + 1));\n 0.2.wait;\n });\n s.sendMsg(\\n_free, x);\n s.sendMsg(\\n_free, y);\n}).play;\n);\n\n\ns.quit;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `MxUnit.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Container for a musical object (Instr, NDef, Spline etc); this is a single unit that has inlets and outlets which can be connected to other units Arguments: source; inlets; outlets."}]} +{"conversations": [{"role": "user", "content": "What is `DrawGrid`?"}, {"role": "assistant", "content": "DrawGrid — Draws grid lines on a UserView for plotting"}, {"role": "user", "content": "What does `DrawGrid.draw` do?"}, {"role": "assistant", "content": "This draws to the currently active UserView. This method is meant to be called from inside the UserView#-drawFunc#-drawFunc of a `UserView`."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nx = [0, 10].asSpec.units_(\"sec\");\ny = [0, 1].asSpec.units_(\"amp\");\nd = DrawGrid((500@250).asRect, x.grid, y.grid);\n\n// set its properties before testing\nd.x.tickSpacing_(25);\nd.linePattern_(FloatArray[10.0, 5.0, 2.0, 5.0]);\n\n// generate a preview\n~testView = d.preview;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Compander`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n Decay2.ar(\n Impulse.ar(8, 0, LFSaw.kr(0.3, 1, -0.3, 0.3)),\n 0.001,\n 0.3\n )\n * Mix.ar(Pulse.ar([80, 81], 0.3))\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// linlin\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(mod.linlin(-1, 1, MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1))) * 0.1\n}.play;\n);\n\n// range\n(\n{\n var mod = LFNoise2.ar(80).range(MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1));\n SinOsc.ar(mod) * 0.1\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// linlin\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(mod.linlin(-1, 1, MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1))) * 0.1\n}.play;\n);\n\n// range\n(\n{\n var mod = LFNoise2.ar(80).range(MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1));\n SinOsc.ar(mod) * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for batuhan's buzzer parametrized that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n// A beautiful sc140 tweet by Batuhan Bozkurt, parametrized for real-time changes\n(\n// Start sound here\na = { | rateL = 5, rateR = 6, blipMul = 100, blipAdd = 50, fMul = 50, kMul = 1 |\n f = LocalIn.ar(2).tanh;\n k = Latch.kr(f[0].abs,Impulse.kr(1/4)) * kMul;\n LocalOut.ar(\n f +\n CombC.ar(Blip.ar([rateL, rateR], blipMul * k + blipAdd, 0.9), 1, k*0.3, fMul * f));f\n}.play\n);\n\n// Set parameters for changing sound here: \n\na.set(\\rateL, 10);\n\na.set(\\rateR, 8);\n\na.set(\\blipMul, 25);\n\na.set(\\blipAdd, 70);\n\na.set(\\fMul, 30);\n\n\na.set(\\kMul, 0.01);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nfork {\n { SinOsc.ar(440 ! 2) * Line.kr(0, 1, 5, doneAction: Done.freeSelf) }.play.waitForFree;\n { PinkNoise.ar(1) * Line.kr(1, 0, 2, doneAction: Done.freeSelf) }.play.onFree { \"done\".postln };\n}\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nfork {\n { SinOsc.ar(440 ! 2) * Line.kr(0, 1, 5, doneAction: Done.freeSelf) }.play.waitForFree;\n { PinkNoise.ar(1) * Line.kr(1, 0, 2, doneAction: Done.freeSelf) }.play.onFree { \"done\".postln };\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "How big are you?"}, {"role": "assistant", "content": "198M parameters in total, 64M active per token because the feed-forward layers are a mixture of four experts with top-1 routing. That is small enough to train in minutes on one GPU."}]} +{"conversations": [{"role": "user", "content": "What is `NodeMap`?"}, {"role": "assistant", "content": "NodeMap — store control values and bus mappings"}, {"role": "user", "content": "What does `NodeMap.map` do?"}, {"role": "assistant", "content": "map arguments of a node (synonymous with `set`, mapping is done automatically when a suitable argument is passed)."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n(\nSynthDef(\"modsine\",\n { |out, freq = 320, amp = 0.2|\n Out.ar(out, SinOsc.ar(freq, 0, amp));\n }).add;\nSynthDef(\"lfo\",\n { |out, rate = 2|\n Out.kr(out, LFPulse.kr(rate, 0, 0.1, 0.2))\n }).add;\n);\n\n// start nodes\n(\nb = Bus.control(s, 1);\nx = Synth(\"modsine\");\ny = Synth.before(x, \"lfo\", [\\out, b]);\n);\n\n// create some node maps\n(\nh = NodeMap.new;\nh.set(\\freq, 800);\nh.map(\\amp, b);\n\nk = NodeMap.new;\nk.set(\\freq, 400);\nk.unmap(\\amp);\n);\n\n// apply the maps\n\nh.sendToNode(x); // the first time a new bundle is made\nk.sendToNode(x);\n\nh.sendToNode(x); // the second time the cache is used\nk.sendToNode(x);\n\nh.set(\\freq, 600);\n\nh.sendToNode(x); // when a value was changed, a new bundle is made\n\n// free all\nx.free; b.free; y.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\delay;\n~description = \"Simple delay line\";\n~channelLayout = \\mono;\n~function = {|in = 0, del = 0.5|\n DelayC.ar(in, 2, del);\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// given a UGen graph:\n(\n{\nSplay.ar(SinOsc.ar({ exprand(300.0, 10000.0) } ! 17, 0, { 1.0.rand } ! 17)) * 0.1 \n}.play\n);\n\n// É all existing UGen inputs can be replaced or modified with an arbitrary function (here with a modulator)\n(\n{\nBend({ |in|\n in * LFDNoise3.kr(MouseX.kr(0.1, 200, 1), 0.1, 1)\n}, {\n Splay.ar(SinOsc.ar({ exprand(300.0, 10000.0) } ! 17, 0, { 1.0.rand } ! 17))\n \n}) * 0.1\n}.play\n)\n```"}, {"role": "assistant", "content": "given a UGen graph: É all existing UGen inputs can be replaced or modified with an arbitrary function (here with a modulator) (Bend: UGen wrapper for code bending)"}]} +{"conversations": [{"role": "user", "content": "What does `RedGIFImage.interlaced` do?"}, {"role": "assistant", "content": "A boolean. Indicates that this image needs to be drawn in separate"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Ndef\nNdef(\\a, { Saw.ar(12) }).asCode;\n\n// in a pushed proxy space\np = ProxySpace.push(s.boot);\n~x = { Saw.ar(123, 0.1 };\n~x.play;\n~x.asCode;\n\np.end.pop;\n\n// anonymous nodeproxy also posts instructions:\nx = NodeProxy.new.source = { DC.ar };\nx.asCode;\n\nx.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Ndef\nNdef(\\a, { Saw.ar(12) }).asCode;\n\n// in a pushed proxy space\np = ProxySpace.push(s.boot);\n~x = { Saw.ar(123, 0.1) };\n~x.play;\n~x.asCode;\n\np.end.pop;\n\n// anonymous nodeproxy also posts instructions:\nx = NodeProxy.new.source = { DC.ar };\nx.asCode;\n\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BiPanB2`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var w, x, y, p, q, a, b, c, d;\n\n p = LFSaw.ar(200);\n q = LFSaw.ar(301);\n\n // B-format encode\n #w, x, y = BiPanB2.ar(p, q, MouseX.kr(-1, 1), 0.1);\n\n // B-format decode to quad\n #a, b, c, d = DecodeB2.ar(4, w, x, y);\n\n [a, b, d, c] // reorder to my speaker arrangement: Lf Rf Lr Rr\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Document.selectedString` do? What arguments does it take?"}, {"role": "assistant", "content": "Gets/sets the selected Arguments: txt — An instance of String.."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Node`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n(\nx = SynthDef(\"help-node-set\", { |freq = 440, out = 0|\n Out.ar(out, SinOsc.ar(freq, 0, 0.1))\n}).play\n);\nx.set(\\freq, 880, \\out, 1); // two pairs\nx.set(0, 660, 1, 0); // freq is the first argument, so it's index is 0. out is index 1.\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `PLFSaw` in SuperCollider?"}, {"role": "assistant", "content": "PLFSaw — UGenPatterns quark library Based on LFSaw Category: Streams-Patterns-Events > UGenPatterns > Generators."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n\n~remapConfig = IdentityDictionary[\n 0 -> 1,\n 1 -> 2,\n 2 -> 3,\n 3 -> 4,\n 4 -> 5,\n 5 -> 6,\n 6 -> 7,\n 7 -> 8,\n 8 -> 9,\n 9 -> 12,\n 10 -> 13,\n 11 -> 14,\n 12 -> 15,\n 13 -> 16,\n 14 -> 17\n];\n\n\n~generateRemapSynthDef = { |numInputChannels, numOutputChannels|\n SynthDef(\\remapOutputs, {\n var sig = In.ar(0, numInputChannels); \n var remapped = Array.fill(numOutputChannels, { Silent.ar(1) }); \n\n ~remapConfig.keysValuesDo { |src, dest|\n if (src < numInputChannels and: { dest < numOutputChannels }) {\n remapped[dest] = sig[src];\n }\n };\n\n ReplaceOut.ar(0, remapped);\n }).add;\n};\n\n~generateRemapSynthDef.(16, 18); \n);\n\n(\n~createRemapSynth = {\n ~remapSynth = Synth(\\remapOutputs, target: s.defaultGroup, addAction: \\addAfter);\n};\n\nServerTree.add( ~createRemapSynth);\n\n)\n```"}, {"role": "assistant", "content": "This code sets up a remapping system where input channels are mapped to output channels based on a predefined configuration. The remapping is done using a SynthDef that reads input signals, applies the remapping, and outputs the remapped signals. The ServerTree.add ensures that the remap synth is created and added to the server's node tree upon server startup and cmd-. and ctrl-.\r\n\r\nBased on discu."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// Kabelscahden \n// by Alberto de Campo and Julian Rohrhuber, 3/2003\n// licenced under creative commons Attribution-ShareAlike 2.5\n\n\n(\n{\n var h, n, m, k, trig;\n trig = Dust.kr( 7 ** LFNoise1.kr(0.3) );\n h = ToggleFF.kr(CoinGate.kr(0.4,trig)) *\n RLPF.ar(LFPulse.ar(50, 0, 0.5, 1, LFNoise1.kr(2, 0.5, -0.5)), 6000, 0.15);\n n = Trig.ar(trig, TRand.kr(0, 0.01, CoinGate.kr(0.4,trig))) * WhiteNoise.ar;\n m = Trig.ar(trig, TRand.kr(0, 0.01, CoinGate.kr(0.4,trig))) * BrownNoise.ar;\n k = Trig.ar(trig, LFNoise1.kr([ 4, 4.2 ], 0.1, 0.11)) *\n LFClipNoise.ar(LFNoise0.kr(7, 30, 40));\n LeakDC.ar(h + n + k + m * 10).distort;\n}.play;\n);\n\nhttps://swiki.hfbk-hamburg.de/MusicTechnology/851\n```"}, {"role": "assistant", "content": "Kabelscahden Guitar Cable Hum Buzz Noise Cable damage - Repost (a SuperCollider snippet)."}]} +{"conversations": [{"role": "user", "content": "What is `KeyCodeResponderStack` in SuperCollider?"}, {"role": "assistant", "content": "KeyCodeResponderStack — internal Category: Libraries > crucial > internals."}]} +{"conversations": [{"role": "user", "content": "Do is not ¨returning¨ array (campanology)?"}, {"role": "assistant", "content": "SuperCollider forum — Do is not ̈returning ̈ array (campanology)\n\nYou can remove the need for all mutable variables by computing the indexes to swap first - these are stored in indexesEven and indexesOdd.\n\nThen an array of functions is made (swappers)...i.e.[indexesEven, indexesOdd, indexesEven....]\n\nFinally, .inject is used to chain these together, taking the previous result as the input to the next and building an array.\n\n```supercollider\n(\n~swap_sort_steps = {\n |parts|\n var swapConsequtiveIndexes = {|from, to|\n (from..to).clump(2).collect{|p| p.reverse }.flat\n };\n var indexesEven = swapConsequtiveIndexes.(0, parts - 1);\n var indexesOdd = [0] ++ swapConsequtiveIndexes.(1, parts - 1);\n var swappers = parts.collect{ |n|\n {|toSwap| if(n.even)\n { indexesEven.collect{|i| toSwap[i]} }\n { indexesOdd.collect{|i| toSwap[i]} }\n }\n };\n postf(\"indexesEven : %\\nindexesOdd : %\\n\", indexesEven, indexesOdd);\n swappers.inject( [(0..parts-1)], {\n |col, f|\n col ++ [f.(col.last)]\n });\n};\n)\n```\n\nAlso, as I’m sure you know, if anyone else is reading who doesn’t know what this is... its a swap sort algorithm."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = { LPF.ar(Saw.ar(200), 600) * EnvGate.new }.play;\na.set(\\fadeTime, 2);\na.release;\n\n// the same as:\na.set(\\gate, 0);\n\n// several env gates can coexist in one synth def.\n(\na = {\n var sound1 = LPF.ar(Saw.ar(80), 600) * EnvGate.new;\n var sound2 = RLPF.ar(Saw.ar(200) * 0.5, 6000 * EnvGate.new + 60, 0.1) * EnvGate.new;\n sound1 + sound2\n}.play;\n);\na.set(\\fadeTime, 5;\na.release;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = { LPF.ar(Saw.ar(200), 600) * EnvGate.new }.play;\na.set(\\fadeTime, 2);\na.release;\n\n// the same as:\na.set(\\gate, 0);\n\n// several env gates can coexist in one synth def.\n(\na = {\n var sound1 = LPF.ar(Saw.ar(80), 600) * EnvGate.new;\n var sound2 = RLPF.ar(Saw.ar(200) * 0.5, 6000 * EnvGate.new + 60, 0.1) * EnvGate.new;\n sound1 + sound2\n}.play;\n);\na.set(\\fadeTime, 5);\na.release;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `FoaAnalyze.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "First Order Ambisonic (FOA) analyzer Arguments: in — The input signal, an array: [in0, in1, ... inN]; kind — The kind of analysis to apply.; ... args — Arguments (listed above with each 'kind') for the wrapped transformer UGens. Arguments can NOT be passed in through keyword through the FoaAnalyze wrapper. You can pass values in by keyword if you use the transform UGens directly.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ RHPF.ar(Saw.ar(200, 0.1), FSinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3600, 4000), 0.2) }.play;\n\n(\n{ var ctl = RHPF.kr(LFSaw.kr(2), SinOsc.kr(XLine.kr(0.07, 30, 20), 0, 35, 40), 0.05);\n SinOsc.ar(ctl * 200 + 500);\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ RHPF.ar(Saw.ar(200, 0.1), FSinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3600, 4000), 0.2) }.play;\n\n(\n{ var ctl = RHPF.kr(LFSaw.kr(2), SinOsc.kr(XLine.kr(0.07, 30, 20), 0, 35, 40), 0.05);\n SinOsc.ar(ctl * 200 + 500);\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n// synthdefs to play with\n\n(\nSynthDef(\\noise_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, rq = 0.1, amp = 0.1|\n var sig = { WhiteNoise.ar } ! 2;\n sig = BPF.ar(sig, freq, rq) *\n EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2) *\n (rq ** -1) * (250 / (freq ** 0.8));\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\sin_grain, { |out = 0, freq = 4\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n// synthdefs to play with\n\n(\nSynthDef(\\noise_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, rq = 0.1, amp = 0.1|\n var sig = { WhiteNoise.ar } ! 2;\n sig = BPF.ar(sig, freq, rq) *\n EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2) *\n (rq ** -1) * (250 / (freq ** 0.8));\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\sin_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { SinOsc.ar(freq, Rand(0, 2pi)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\saw_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { VarSaw.ar(freq, Rand(0, 1)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What's the difference between Env.perc and Env.adsr?"}, {"role": "assistant", "content": "`Env.perc(attack, release)` goes up once and decays to zero — one-shot sounds. `Env.adsr(a, d, s, r)` holds at a sustain level while its gate is open and only releases when the gate closes — notes you start and stop."}, {"role": "user", "content": "So which do I use for a pad?"}, {"role": "assistant", "content": "adsr, with `gate` as a Synth argument and `doneAction: 2` on the EnvGen:\n\n```supercollider\nSynthDef(\\pad, { |out = 0, freq = 220, gate = 1|\n var env = EnvGen.kr(Env.adsr(0.8, 0.4, 0.7, 2), gate, doneAction: 2);\n Out.ar(out, Saw.ar(freq) * env * 0.1)\n}).add;\n```\n\nThen `x.set(\\gate, 0)` releases it over the 2 seconds of release time."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LFDNoise3`."}, {"role": "assistant", "content": "```supercollider\n// try wiggling mouse quickly:\n// LFNoise2 overshoots when going from high to low freqs, LFDNoise changes smoothly.\n\n{ SinOsc.ar(LFNoise2.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n{ SinOsc.ar(LFDNoise3.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFNoise2.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n\n{ LFDNoise3.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n\n// use as frequency control\n(\n{\n SinOsc.ar(\n LFDNoise3.ar(4, 400, 450),\n 0, 0.2\n )\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nNdef(\\sound, { SinOsc.ar([600, 635], Ndef.ar(\\sound), LFNoise1.kr(2).max(0) * 0.2) });\nNdef(\\sound.play;\nNdef.clear;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nNdef(\\sound, { SinOsc.ar([600, 635], Ndef.ar(\\sound), LFNoise1.kr(2).max(0) * 0.2) });\nNdef(\\sound).play;\nNdef.clear;\n```"}]} +{"conversations": [{"role": "user", "content": "Buffer.read fails and I get a path error. What should the path look like?"}, {"role": "assistant", "content": "On Windows use forward slashes or escaped backslashes inside the string: `Buffer.read(s, \"C:/sounds/kick.wav\")`. A single backslash starts an escape sequence, which is why `\"C:\\sounds\\kick.wav\"` fails. Also check the extension is real (`.wav`, `.aiff`, `.flac`) and that the file is not on a network path — the server reads it, not the language, and it may resolve differently. For sounds that ship with SuperCollider, `Platform.resourceDir +/+ \"sounds/a11wlk01.wav\"` is the portable form."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Pgtpar` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// synthdef\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n}).add;\n);\n\n// pattern with different start times\n(\nx = Pbind(\n \\instrument, \\help_sinegrain,\n \\degree, Pseq(#[0, 5, 4, 2, 1, 1, 3], inf),\n \\dur, Pseq(#[0.25, 0.5, 1.0], inf),\n \\scale, #[0, 3, 5, 9, 10]\n);\na = Pbus(Pgtpar([0.0, x, 1.5, x, 2.25, x])).play;\n);\ns.plotTree;\na.stop;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Pmulp` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\freq, Pseq([500, 600, 700]), \\instrument, \\sinegrain);\na = Pmulp(\\freq, Pseq([0.5, 0.9, 0.8], inf), a);\na.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n var time = 0.23;\n var freq = (55).midicps;\n var a = VarSaw.ar(freq/2, width: XLine.ar(0.5,1,time)).range(0,XLine.ar(0.666,1/666,time));\n var tone = SinOsc.ar(freq).fold(-0.23*a,a) * EnvGen.ar(Env([1,0],[time]));\n Out.ar(0, tone.dup);\n}.play;\n)\n```"}, {"role": "assistant", "content": "Seekers are something you should avoid.\r\nI put this code through Rakarrack to get some samples for heXon.\r\nheXon is a FOSS dual stick arcade shooter available at www.LucKeyProductions.nl."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n/* Audio plugin definition\n\n Each audio plugin should define the following global variables:\n ~name: (symbol) name of the spatializer\n ~description: (string) a short description\n ~function: the actual definition of the plugin\n\n*/\n\n~name = \\testtone;\n~description = \"a standard test tone (sine)\";\n~channelLayout = \\mono;\n\n~function = {| sfreq = 200 |\n FSinOsc.ar(sfreq)\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// UnitTestScript(\"Collapse\", thisProcess.nowExecutingPath).runScript;\n\n{\n |test|\n var collapseValues = List();\n var collapse;\n\n collapse = Collapse({ |v| collapseValues.add(v) }, 0.1);\n\n collapseValues.clear;\n\n collapse.value(1);\n test.assert(collapseValues.isEmpty, \"Collapse doesn't exec immediately\");\n\n 1.wait;\n test.assertEquals(collapseValues.array, [1], \"Collapse execs eventually\");\n\n collapseValues.clear;\n [1, 2, 3, 4, \"last\"].do { |i| collapse.(i); 0.05.wait };\n 1.wait;\n test.assertEquals(collapseValues.array, [\"last\"], \"Collapse only execs last value.\");\n\n collapseValues.clear;\n [\"first\", \"second\", \"last\"].do { |i| collapse.(i); 0.2.wait };\n test.assertEquals(collapseValues.array, [\"first\", \"second\", \"last\"], \"Collapse execs all values.\")\n\n};\n```"}, {"role": "assistant", "content": "UnitTestScript(\"Collapse\", thisProcess.nowExecutingPath).runScript;."}]} +{"conversations": [{"role": "user", "content": "What does `MxChannelApp.db` do? What arguments does it take?"}, {"role": "assistant", "content": "get or set level by Arguments: db — dB. Returns: dB"}]} +{"conversations": [{"role": "user", "content": "What does `Select.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Select output from an array of inputs. Arguments: which — Integer index; array — Input array of signals."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// world's most expensive patchcord (use headphones to avoid feedback)\n{ SoundIn.ar(0) }.play;\n\n// stereo version\n{ SoundIn.ar([0, 1]) }.play;\n\n// scope input; silent output\n{ Amplitude.kr(SoundIn.ar(0) }.scope;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// world's most expensive patchcord (use headphones to avoid feedback)\n{ SoundIn.ar(0) }.play;\n\n// stereo version\n{ SoundIn.ar([0, 1]) }.play;\n\n// scope input; silent output\n{ Amplitude.kr(SoundIn.ar(0)) }.scope;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Color.symmetricDifference` do? What arguments does it take?"}, {"role": "assistant", "content": "An object which stores color values Arguments: aColor — An instance of Color.; opacity — A value between 0 and 1. Default value is 1.0.."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// synth definition with raising frequency\n\n(\nSynthDef(\\synth_0, { |devFactor = 0.1, devFreq = 10, amp = 0.1|\n var freq = XLine.kr(400, 1200, 10); \n Out.ar(0, SinOsc.ar(SinOsc.ar(devFreq, 0, devFactor * freq, freq), mul: amp).dup(2) * EnvGate.new) \n}).add;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// synth definition with raising frequency\n\n(\nSynthDef(\\synth_0, { |devFactor = 0.1, devFreq = 10, amp = 0.1|\n var freq = XLine.kr(400, 1200, 10); \n Out.ar(0, SinOsc.ar(SinOsc.ar(devFreq, 0, devFactor * freq, freq), mul: amp).dup(2) * EnvGate.new) \n}).add;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// time warped analog bubbles, time scale is mouse x position\n{\n\n Bend.time(MouseX.kr(0.02, 20, 1), {\n var f = LFSaw.kr(0.4, 0, 24, LFSaw.kr([8,7.23], 0, 3, 80)).midicps; // glissando function\n CombN.ar(SinOsc.ar(f, 0, 0.04), 0.2, 0.2, 4) // echoing sine wave\n })\n\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// time warped analog bubbles, time scale is mouse x position\n{\n\n Bend.time(MouseX.kr(0.02, 20, 1), {\n var f = LFSaw.kr(0.4, 0, 24, LFSaw.kr([8,7.23], 0, 3, 80)).midicps; // glissando function\n CombN.ar(SinOsc.ar(f, 0, 0.04), 0.2, 0.2, 4) // echoing sine wave\n })\n\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// Evaluate this to start your project\n// The Cactus instnce is stored in c by convention\n\nc = CactusGUI(Document.current.dir).cactus; // with GUI\nc = Cactus(Document.current.dir); // without GUI\n\n/*\n\nAny folder with sound files you place in the buffers folder becomes available\nwith the following syntax:\n\n c.buffers.at(\"[folder_name]/[file_name_without_extension]\").play;\n\nYou can also access the folder as a List\n\n c.buffers.at(\"[folder_name]\");\n\n*/\n\n// You can use the dictionary at .at to store anything you like. For example:\n\nc.at[\\exampleVariable] = 10000.rand;\n\n// Get the value\n\nc.at[\\exampleVariable];\n```"}, {"role": "assistant", "content": "Evaluate this to start your project The Cactus instnce is stored in c by convention."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n// Function to check an array for repetitions within a maximum test span\n\n~repetitionCheck = { |array, maxTestSpan|\n maxTestSpan.do { |i|\n var result = (array.drop(i+1) - array).drop((i+1).neg).includes(0).not;\n (\"no repetitions within a span of \" ++ (i+2).asString ++ \" items: \").post;\n result.postln;\n }\n}\n);\n\n// test case\n// no repetitions within a maximum span of 6 (lookBack == 5)\n\n(\np = PIdev(Pbrown(0, 20, 0.3).round.asInteger, 5, -7, 7).iter;\na = p.nextN(10000);\na.plot;\n~repetitionCheck.(a, 10);\n)\n```"}, {"role": "assistant", "content": "Function to check an array for repetitions within a maximum test span no repetitions within a maximum span of 6 (lookBack == 5) (PIdev: pattern searching for numbers with integer distance from a source pattern, optionally avoiding repetitions within a span)"}]} +{"conversations": [{"role": "user", "content": "What can you do?"}, {"role": "assistant", "content": "Write and explain SuperCollider: SynthDefs, UGens, Patterns, Ndef, buses and envelopes, and tell you why a patch is silent or will not compile. I am 198M parameters, so I am narrow on purpose."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Paddpre` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain);\nb = Paddpre(\\freq, Pseq([10, 30, 100], inf), a);\nb.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `OSCMessagePatternDispatcher` in SuperCollider briefly."}, {"role": "assistant", "content": "OSCMessagePatternDispatcher — The default pattern matching dispatcher for OSCFunc and OSCdef. OSCMessageDispatcher dispatches incoming OSC messages to matching functions, using pattern matching to see if regular expressions wildcards in the incoming message's address pattern match one of this dispatcher's OSCFuncs' paths. Normally users should not have to create or message instances of this class directly. For details on OSC pattern matching, see http://opensoundcontrol.org/spec-1_0 Category: External Control > OSC > Dispatchers."}]} +{"conversations": [{"role": "user", "content": "Write a closed hi-hat in SuperCollider."}, {"role": "assistant", "content": "High-passed noise with a very short envelope — the filter is what makes it a hat rather than a hiss.\n\n```supercollider\n(\nSynthDef(\\hat, { |out = 0, amp = 0.3, dur = 0.06|\n var env = EnvGen.kr(Env.perc(0.001, dur, 1, -6), doneAction: 2);\n Out.ar(out, Pan2.ar(HPF.ar(WhiteNoise.ar, 7000) * env * amp));\n}).add;\n);\nSynth(\\hat, [\\dur, 0.04]);\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BufDur`."}, {"role": "assistant", "content": "```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n{ BufRd.ar(1, b, Sweep.ar(Impulse.ar(BufDur.kr(b).reciprocal), BufSampleRate.kr(b))) }.play;\n\nb.free\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LPF`."}, {"role": "assistant", "content": "```supercollider\n{ LPF.ar(Saw.ar(200, 0.1), SinOsc.kr(XLine.kr(0.7, 300, 20), 0, 3600, 4000)) }.play;\n\n// kr:\n(\n{ var ctl = LPF.kr(LFPulse.kr(8), SinOsc.kr(XLine.kr(1, 30, 5)) + 2);\n SinOsc.ar(ctl * 200 + 400)\n}.play;\n);\n\n(\n{ var ctl = LPF.kr(LFPulse.kr(8), MouseX.kr(2, 50, 1));\n SinOsc.ar(ctl * 200 + 400)\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is the difference between ~foo and a local variable?"}, {"role": "assistant", "content": "`var foo` is a local: it exists only inside the function or file block that declares it. `~foo` is an environment variable: it lives in the current Environment, survives between executions of the same block, and is visible to everything running in that environment. That is why `~buf = Buffer.read(s, path)` works in one cell and `PlayBuf.ar(1, ~buf)` works in the next, while a `var` would be gone."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// preserve only 3 bits of mantissa.\n{ MantissaMask.ar(SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4), 3) }.play\n\n// the original\n{ SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4) }.play\n\n// the difference.\n(\n{\n var in;\n in = SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4);\n in - MantissaMask.ar(in, 3)\n}.play\n)\n\n\n// preserve 7 bits of mantissa.\n// This makes the lower 16 bits of the floating point number become zero.\n{ MantissaMask.ar(SinOsc.ar(SinO\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// preserve only 3 bits of mantissa.\n{ MantissaMask.ar(SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4), 3) }.play\n\n// the original\n{ SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4) }.play\n\n// the difference.\n(\n{\n var in;\n in = SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4);\n in - MantissaMask.ar(in, 3)\n}.play\n)\n\n\n// preserve 7 bits of mantissa.\n// This makes the lower 16 bits of the floating point number become zero.\n{ MantissaMask.ar(SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4), 7) }.play\n\n// the original\n{ SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4) }.play\n\n// the difference.\n(\n{\n var in;\n in = SinOsc.ar(SinOsc.kr(0.2, 0, 400, 500), 0, 0.4);\n in - MantissaMask.ar(in, 7)\n}.play\n)\n```"}]} {"conversations": [{"role": "user", "content": "What are the server's default sample rate and block size?"}, {"role": "assistant", "content": "44100 Hz and 64 samples per block by default, so the control rate is 44100/64 = 689.06 Hz. You can read them from the language with `s.sampleRate` and `s.options.blockSize`, or from inside a Synth with `SampleRate.ir` and `ControlRate.ir`. A `.kr` signal therefore updates about 689 times a second, which is why it is smooth enough for filters and envelopes but not for audio-rate FM."}]} -{"conversations": [{"role": "user", "content": "What is `PLbindef`?"}, {"role": "assistant", "content": "PLbindef — wrapper for Pbindef which allows replacement in object prototyping style"}, {"role": "user", "content": "What does `PLbindef.new` do?"}, {"role": "assistant", "content": "Creates a new PLbindef object or sets sources as with Pbindef."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n// synthdefs to play with\n\n(\nSynthDef(\\noise_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, rq = 0.1, amp = 0.1|\n var sig = { WhiteNoise.ar } ! 2;\n sig = BPF.ar(sig, freq, rq) *\n EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2) *\n (rq ** -1) * (250 / (freq ** 0.8));\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\sin_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { SinOsc.ar(freq, Rand(0, 2pi)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n\nSynthDef(\\saw_grain, { |out = 0, freq = 400, att = 0.005, rel = 0.1, amp = 0.1|\n var sig = { VarSaw.ar(freq, Rand(0, 1)) } ! 2;\n sig = sig * EnvGen.ar(Env.perc(att, rel, amp), doneAction: 2);\n OffsetOut.ar(out, sig);\n}).add;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SequenceableCollection.flatBelow` do? What arguments does it take?"}, {"role": "assistant", "content": "Flatten all subarrays deeper than Arguments: level — Specifies from what level onward to flatten. level 0 is outermost, so flatBelow(0) is like flat. `a = [1, 2, [3, 4, [5, 6, [7, 8, [9, 0]]]]];`."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Lag2UD`."}, {"role": "assistant", "content": "```supercollider\n// used to lag pitch\n(\nSynthDef(\\lag2ud_help, { |out, freq = 300, lagup = 1, lagdown = 5|\n Out.ar(out,\n SinOsc.ar( // sine wave\n Lag2UD.kr( // lag the frequency\n freq,\n lagup,\n lagdown\n ),\n 0, // phase\n 0.2 // sine amplitude\n )\n );\n}).add;\n);\n\nx = Synth(\\lag2ud_help); // create the synth\n\nx.set(\\freq, 500); // set the frequency to a higher value (takes 1 second)\nx.set(\\freq, 100); // set the frequency to a lower value (takes 5 seconds)\nx.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\nServer.local.quit; // If server running, need to stop it for this example\n\n// We'll modify the server boot procedure to set our env var...\n~realserverprogram = Server.program;\nServer.program = \"export PANCREAS=220;\" + Server.program\ns.boot;\n\n(\nx = {\n// Env var specifies frequency.\n// If you change the env var name to one that isn't set, 440 is used.\nSinOsc.ar(Getenv(\\PANCREAS, 440), 0, 0.1);\n}.play(Server.local);\n);\nx.free;\n\n// This should restore the variable to what it was\nServer.program = ~realserverprogram;\n```"}, {"role": "assistant", "content": "We'll modify the server boot procedure to set our env var... Env var specifies frequency. (Getenv: Read (numeric) shell environment variables into a synth)"}]} -{"conversations": [{"role": "user", "content": "Explain `PLseq` in SuperCollider briefly."}, {"role": "assistant", "content": "PLseq — dynamic scope Pseq variant Takes Symbol args for later reference by the Streams, which will read from variables in the Environments of their instantiation. See PLx_suite. Category: Libraries > miSCellaneous > PLx suite, Streams-Patterns-Events > PLx suite."}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// Pantophonic (2D) decoder with four channels arranged in a rectangle:\n// [ 30, -30, -150, 150 ]\n\n// specify 1/2 the desired directions\n~directions = [ 30, -30 ].degrad;\n~decoder = FoaDecoderMatrix.newDiametric(~directions);\n\n// inspect\n~decoder.dirChannels.raddeg\n```"}, {"role": "assistant", "content": "Pantophonic (2D) decoder with four channels arranged in a rectangle: [ 30, -30, -150, 150 ] (FoaDecoderMatrix: First Order Ambisonic (FOA) decoder matrices)"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nc = CondVar();\n\nRoutine {\n 1.wait;\n \"waited for 1 second\".postln;\n 1.wait;\n \"waited for another second, now waiting for you to run 'c.signalOne'...\".postln;\n c.wait;\n \"the condition is no longer waiting\".postln;\n 1.wait;\n \"waited for another second, now waiting for you...\".postln;\n c.wait;\n \"the condition is no longer waiting\".postln;\n 1.wait;\n \"the end\".postln;\n}.play;\n;\n\n// Run this line to unblock the routine\nc.signalOne;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nc = CondVar();\n\nRoutine {\n 1.wait;\n \"waited for 1 second\".postln;\n 1.wait;\n \"waited for another second, now waiting for you to run 'c.signalOne'...\".postln;\n c.wait;\n \"the condition is no longer waiting\".postln;\n 1.wait;\n \"waited for another second, now waiting for you...\".postln;\n c.wait;\n \"the condition is no longer waiting\".postln;\n 1.wait;\n \"the end\".postln;\n}.play;\n);\n\n// Run this line to unblock the routine\nc.signalOne;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `KeyCodeResponderStack.value` do? What arguments does it take?"}, {"role": "assistant", "content": "internal Arguments: view; char; modifier; unicode; keycode."}]} -{"conversations": [{"role": "user", "content": "What does `Atk.userExtensionsDir` do?"}, {"role": "assistant", "content": "a class that stores some global variables for the Ambisonic Toolkit Returns: a path to the 'extensions' dir inside the ATK support dir. This is where user-generated matrices and kernels are stored to and rerieved from by default."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Monitor`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\ns.scope(16);\n\n{ Out.ar(87, SinOsc.ar(MouseX.kr(40, 10000, 1) * [1, 2, 3], 0, 0.2)) }.play;\nx = Monitor.new;\nx.play(87, 3, 1, 2);\nx.out = 0;\nx.stop(3.0);\nx.play(87, 1, 0, 1); // in > out : now mixes down (wrapping)\nx.play(89, 1, 0, 2); // in < out : now distributes to 2 channels\nx.stop;\n\n// multiple play\nx.play(87, 1, 0, 2, multi: true);\nx.play(88, 1, 0, 2, multi: true);\nx.play(89, 1, 0, 2, multi: true);\nx.stop;\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `ControlRate`."}, {"role": "assistant", "content": "```supercollider\n{ SinOsc.ar(ControlRate.ir) * 0.1 }.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Ppatmod`."}, {"role": "assistant", "content": "```supercollider\n(\na = Ppatmod(\n Pseq([0, 0, 0, 0], 1),\n { |pat, i|\n var list;\n list = pat.list;\n pat.list = list.put(list.size.rand, 2);\n }, inf);\n\nx = a.asStream;\n30.do({ x.next.postln });\n);\n\n\n// Ppatmod used to modify a pattern that produces a sequence of pitches:\n\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Pn(\n Ppatmod(\n Pseq([0, 0, 0, 0], 1),\n { |pat, i|\n var list;\n list = pat.list;\n pat.list = list.put(list.size.rand, 2);\n }, 15),\ninf).asStream;\n\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, (a.next*5+77).midicps]);\n 0.13.wait;\n })\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for tired pads."}, {"role": "assistant", "content": "```supercollider\n// this is what I write when I didn't sleep last night.. zzzzzz\n// easy subsynth with dynklank and simple scale\n\n(\n\nfork{ \n loop{\n var time;\n time = 5.rand;\n {\n var sound, freqs, envs, rings, numvoices, env;\n numvoices = 40;\n freqs = {(Scale.major(\\just).degrees+26+\n (0,12..110).choose).choose}.dup(numvoices).midicps;\n rings = {1.0.rand}.dup(numvoices);\n envs = { EnvGen.kr(Env.linen( time/3.0.rand, \n time/3.0.rand, time/3.0.rand, 1.0.rand ) ) }.dup(numvoices);\n \n sound = PinkNoise.ar(numvoices.reciprocal!2);\n sound = DynKlank.ar(`[freqs,envs,rings], sound );\n sound = sound * EnvGen.kr(Env.linen(time.rand,time/3,time.rand),doneAction:2);\n \n sound = HPF.ar(sound, 120);\n \n 4.do{sound = DelayC.ar(sound, 0.4, [0.4.rand,0.4.rand], 1/8, sound) };\n \n //good call - lets turn this down \n sound*0.2;\n }.play;\n time.rand.wait;\n }\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//This example requires the FluCoMa tools to be installed from::\n//https://www.flucoma.org/download/\n\n(\nAlga.boot({\n //Sine oscillator with frequency modulation\n a = AN({ SinOsc.ar(\\freq.kr(10) + \\fm.ar(0)) }).play(chans:2);\n\n //Sine oscillator\n b = AN({ SinOsc.ar(\\freq.kr(440)) });\n\n //Pitch analyser\n c = AN({ FluidPitch.kr(\\in.ar) });\n\n //Patch first oscillator into the pitch analyser.\n a >> c;\n\n //Patch the pitch analyser into the \\freq input of the second oscillator\n c >>.freq b;\n\n //Create feedback: patch b's output to a's \\fm input, mapping -1 / 1 to -200 / 300\n a.from(b, \\fm, scale:[-200, 300], time:0.5);\n});\n);\n\n//Try with different scalings (change the values)\na.from(b, \\fm, scale:[-1432, 679], time:3);\n\n//Try new base frequencies (change the value)\na.from(100, \\freq, time:2);\n\n//Bye bye\n(\na.clear({\n b.clear;\n c.clear;\n}, time:3)\n);\n```"}, {"role": "assistant", "content": "This example requires the FluCoMa tools to be installed from https://www.flucoma.org/download/."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n//var board= CytonSerial(\"/dev/tty.usbserial-DM00DRM0\", initAction: {|b| b.start});\nvar board= SyntheticData(initAction: {|b| b.start});\n~board= board;\n;\n\n~board.accelAction= {|xyz| xyz.postln}; //start posting synthetic accelerometer data\n\n~board.stop;\n~board.start;\n~board.close;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n//var board= CytonSerial(\"/dev/tty.usbserial-DM00DRM0\", initAction: {|b| b.start});\nvar board= SyntheticData(initAction: {|b| b.start});\n~board= board;\n);\n\n~board.accelAction= {|xyz| xyz.postln}; //start posting synthetic accelerometer data\n\n~board.stop;\n~board.start;\n~board.close;\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// compares a 441 Hz sine tone derived from sample rate (44100 * 0.01, left)\n// with a 440 Hz tone (right), resulting in a 1 Hz beating\n(\n{\n var freq;\n freq = [SampleRate.ir * 0.01, 440];\n SinOsc.ar(freq, 0, 0.1)\n}.play;\n)\n```"}, {"role": "assistant", "content": "compares a 441 Hz sine tone derived from sample rate (44100 * 0.01, left) with a 440 Hz tone (right), resulting in a 1 Hz beating (SampleRate: Server sample rate.)"}]} -{"conversations": [{"role": "user", "content": "What is `ProxySynthDef`?"}, {"role": "assistant", "content": "ProxySynthDef — synth def that wraps ugen graph"}, {"role": "user", "content": "What does `ProxySynthDef.sampleAccurate` do?"}, {"role": "assistant", "content": "always use OffsetOut, if set to true (default: false)"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\na = ProxySynthDef(\"xtest\", { SinOsc.ar(400) * 0.1 });\n\na.add;\n\nx = Synth(\"xtest\");\nx.release;\n\n\n/*\n\n if the resulting number of channels is larger than a given channelConstraint,\n it behaves according to the rate: audio rate signals are wrapped around\n a smaller channel size, control rate signals are not (the exceeding channels are left out)\n\n*/\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// ServerQuit\ns.boot;\nf = { |server| \"------------The server '%' has quit.------------\\n\".postf(server) };\nServerQuit.add(f, \\default);\ns.quit; // quit the server and observe the post\ns.boot;\nServerQuit.remove(f, \\default); // remove it again\ns.quit; // no post.\nServerQuit.add(f, Server.internal;\nServer.internal.boot;\nServer.internal.quit;\nServerQuit.removeAll; // clear all\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// ServerQuit\ns.boot;\nf = { |server| \"------------The server '%' has quit.------------\\n\".postf(server) };\nServerQuit.add(f, \\default);\ns.quit; // quit the server and observe the post\ns.boot;\nServerQuit.remove(f, \\default); // remove it again\ns.quit; // no post.\nServerQuit.add(f, Server.internal);\nServer.internal.boot;\nServer.internal.quit;\nServerQuit.removeAll; // clear all\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes simple peak detection algorithm."}, {"role": "assistant", "content": "```supercollider\nq = q ? ();\n\n(\nq.s1 = {|q, left, item, right, rContextSize|\n //[left, item, right].postln;\n ((maxItem(item - left) ? 0) + (maxItem(item - right) ? 0)) * 0.5\n};\n\nq.peak1 = {|q, signal, windowSize = 4|\n var mean, sDev, aAbs, peaksSize;\n var rWindowSize = windowSize.reciprocal;\n var h = 3; // 1<= h <= 3\n var idxs = List[];\n var a = signal.collect{|val, i|\n // compute peak function value for each of the N points in T\n q.s1(\n signal.copyRange(i-windowSize, i-1), \n val, \n signal.copyRange(i+1, i + windowSize), \n val\n );\n };\n // Compute the mean m and standard deviation s of all positive values in array a;\n aAbs = a.abs;\n mean = aAbs.mean;\n sDev = aAbs.stdDev;\n\n// mean.postln;\n// sDev.postln;\n \n\n a.do{|val, i| // collect all indices that are concidered big \n if ((a[i]>0) && ((a[i]-mean) > (h*sDev))) {\n idxs.add(i);\n }\n };\n peaksSize = idxs.size.postln;\n\n // retain only one peak of any set of peaks within windowSize of each other\n idxs.inject([0], {|last, now, i|\n ((now - last.last) <= windowSize).if({\n (signal[now] > signal[last.last]).if({\n last.pop;\n last ++ now;\n }, {\n last;\n })\n }, {\n last ++ now; \n })\n })\n}\n);\n\n// apply peak1 to any \"signal\", i.e. a 1-dimensional sequence of numbers, play around with the windowSize param (and possibly h, see above).\nq.res = q.peak1(q.wireWset.amps, 4);q.res\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ControlName`."}, {"role": "assistant", "content": "```supercollider\n(\nd = SynthDef(\\tone, { |out = 0, freq = 200|\n var sig;\n\n freq.spec = ControlSpec(20, 20000);\n sig = SinOsc.ar(freq);\n\n Out.ar(out, sig);\n}).add;\n);\n\nd.specs.freq.postln;\n```"}]} -{"conversations": [{"role": "user", "content": "What is `SmoothFoldS2` in SuperCollider?"}, {"role": "assistant", "content": "SmoothFoldS2 — wave folding pseudo ugen using sine segments, two fold ranges Wave folding using SmoothClipS. Values outside the range lo-hi are folded back, if the concerned foldRange > 0. A larger foldRange means less folding whereas a smaller foldRange causes more folding. The spectral result depends on the source wave form also but in general a smaller foldRange causes more energy in the higher spectrum whereas near foldRange == 0 the higher part of the spectrum again d Category: Libraries > miSCellaneous > WaveFolding."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Pattern transcription of intro chords of this song."}, {"role": "assistant", "content": "```supercollider\n// Crystal Waters \"Gypsy Woman (She's Homeless)\" - chords\n(\n~bpm = TempoClock.new(120/60);\nPbind(\n \\midinote, Pseq([\n Pn([45, 57, 67, 72, 76], 2),\n Pn([46, 58, 69, 74, 77], 3),\n Pn([43, 55, 67, 70, 74, 77], 2), \n Pn([48, 60, 67, 70, 73, 76], 3),\n Pseq([\n Pn([50, 62, 65, 69, 72, 76], 2),\n Pn([50, 62, 65, 69, 72, 74], 3)\n ], 2),\n Pn([45, 57, 67, 72, 76], 2),\n Pn([46, 58, 69, 74, 77], 3),\n Pn([52, 64, 76, 79, 83, 86], 2),\n Pn([51, 63, 75, 79, 82, 86], 3),\n Pseq([\n Pn([50, 62, 65, 69, 72, 76], 2),\n Pn([50, 62, 65, 69, 72, 74], 3)\n ], 2),\n ], inf),\n \\ctranspose, -12,\n \\dur, Pseq([1, Pn(3/4, 4)], inf),\n \\amp, 0.2,\n \\legato, Pseq([0.5, 0.5, Pwhite(0.2, 0.3, 3)], inf)\n).play(~bpm);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Image.fromWindow` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new Image from a portion of a Window. this can be used to capture either a window or a specific View. `// WINDOW Arguments: window — the Window object.; rect — optional. the constrained rect to capture inside the Window. By default, it is the window size.."}]} -{"conversations": [{"role": "user", "content": "What is `PV_ChainUGen`?"}, {"role": "assistant", "content": "PV_ChainUGen — Base class for UGens that operate on FFT chains"}, {"role": "user", "content": "What does `PV_ChainUGen.fftSize` do?"}, {"role": "assistant", "content": "Returns the FFT chain buffer's size. `(`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var chain = FFT(LocalBuf(1024));\n chain.fftSize.poll;\n 0.0\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// if NTMI.helloSnd is not already defined in startup file, do this:\nfork {\n NTMI.numChans.do { |i|\n { LFDNoise3.ar(\n XLine.kr(\n exprand(2000, 5000),\n exprand(2000, 20000),\n 0.25, doneAction: 2),\n 0.1\n )\n }.play(outbus: i);\n 0.25.wait;\n };\n}\n```"}, {"role": "assistant", "content": "if NTMI.helloSnd is not already defined in startup file, do this:."}]} -{"conversations": [{"role": "user", "content": "What does `LID.debug` do?"}, {"role": "assistant", "content": "When set to true, the incoming data from any opened LID device will be printed to the post"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for seeking an Array!."}, {"role": "assistant", "content": "```supercollider\n(// * //watch the postWindow\na=[\"m\",\"x\",\"f\",\"k\",\"d\",\"p\"];\nx=Array;\ny=x.newClear(6);\n~mxfkdp=Task({\n inf.do({y.put(x.series(6,0,1).choose,a.scramble).postln;\n 0.03.wait;})}).play;\nm=fork({inf.do({\n \"array num:\".postcln;\n if(y[x.series(6,0,1).choose.postcln]==a,\n {\"lo encontraste!/found it!\".postcln;\n 1.do({GVerb.ar(\n EnvGen.ar(Env.perc(0.01,8),1,doneAction:2)*\n Blip.ar(XLine.kr(440,1600,8)),50,10,0.02)}.play);\n ~mxfkdp.stop;\n m.stop;}, \n {\"buscando.../seeking...\".postcln;});\n 0.03.wait})});\n);\n//.SCtweetLong\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Many patterns controlling a single synth."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\sawFilt, { |out = 0, freq = 440, amp = 0.1, gate = 1, cf = 100, wobble = 3, t_bd, t_sd, pw = 0.4|\n var base = Splay.ar(RLPF.ar(Pulse.ar(freq * [0.99,0.5,1.01],pw),cf.lag(0.05),0.3).madd(SinOsc.ar(wobble).range(0.5,4)).sin) * 0.5;\n var env = Linen.kr(gate, attackTime: 0.01, releaseTime: 0.5, doneAction: 2);\n var sig = base;\n var bd = tanh(Ringz.ar(LPF.ar(Trig.ar(t_bd,SampleDur.ir),1000),30,0.5,5).sin*2);\n var sd = tanh(Ringz.ar(LPF.ar(Trig.ar(t_sd,SampleDur.ir),1000),120,0.75,PinkNoise.ar(2!2)).sin*2);\n sd = HPF.ar(sd,60);\n sig = tanh(GVerb.ar(HPF.ar(base * env,30), 70, 11, 0.15)*0.5 + sig + bd + sd);\n Out.ar(out, sig*amp*env);\n}).add;\n);\n\n(\np = Pproto(\n {\n ~id = (\n type: \\on,\n dur: 0,\n instrument: \\sawFilt,\n amp: 1,\n ).yield[\\id];\n ~type = \\set;\n },\n Ppar([\n Pbind(\n \\args, #[freq],\n \\freq, Pseq([49,47,50,48]-12,inf).midicps,\n \\dur, 4,\n ),\n Pbind(\n \\args, #[cf],\n \\cf, Pseq([100,Prand([700,400,1100],3)],inf),\n \\stutter, Prand([1,2,4,8],inf),\n \\dur, PdurStutter(Pkey(\\stutter)*2, 2),\n // NOTE: also useful is .collect on patterns!\n // \\dur, Prand([1,2,4,8], inf).collect{ |x| (1/x)!(x*2) }.flatten\n ),\n Pbind(\n \\args, #[wobble],\n \\wobble, Pxrand([3,1.5,6],inf),\n \\dur, Prand([2,1],inf),\n ),\n Pbind(\n \\args, #[t_bd],\n \\t_bd, Pseq([1,0,0,1],inf),\n \\dur, 0.5,\n ),\n Pbind(\n \\args, #[t_sd],\n \\t_sd, Pseq([0,0,1,0],inf),\n \\dur, 0.5,\n ),\n Pbind(\n \\args, #[pw],\n \\pw, Prand([0.4,0.3,0.5],inf),\n \\dur, 2,\n ),\n ])\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `MultiplexAnalogIn`."}, {"role": "assistant", "content": "```supercollider\n// modulate frequency of a sine oscillator\n\n(\nSynthDef(\"help-MultiplexAnalogIn\", { |out = 0|\n Out.ar(out,\n SinOsc.ar(MultiplexAnalogIn.ar(0, 1).exprange(200, 5000), 0, 0.1)\n )\n}).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `MxUnit.getInlet` do? What arguments does it take?"}, {"role": "assistant", "content": "Container for a musical object (Instr, NDef, Spline etc); this is a single unit that has inlets and outlets which can be connected to other units Arguments: index."}]} -{"conversations": [{"role": "user", "content": "How do I stop all sound?"}, {"role": "assistant", "content": "s.freeAll stops every node on the server. On the language side, Ndef.clear and Pdef.clear clear the proxies. If a Pattern is still running, Pdef(\\name).stop does it; CmdPeriod immediately stops everything scheduled on the default clock."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Rest`."}, {"role": "assistant", "content": "```supercollider\n// do nothing for 2 seconds\n(note: Rest(), dur: 2).play;\n\n// intersperse pauses in pattern\nPbind(\\note, Pseq([0, 4, 7, 11], inf), \\dur, Pseq([2, 1, Rest(1)], inf) / 5).play;\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Josh Parmenter (2007) record scratcher?"}, {"role": "assistant", "content": "```supercollider\n// Josh Parmenter (2007)\n// record scratcher\n\nSynthDef(\\scratch, {arg gate = 1, buffer;\n var buf, speed, env;\n env = EnvGen.kr(\n Env([0,1,0], [0.1, 0.1], \\sin, 1),\n gate, doneAction: 20);\n speed = MouseX.kr(-10, 10);\n speed = speed - DelayN.kr(speed, 0.1, 0.1);\n speed = MouseButton.kr(1, 0, 0.3) + speed ;\n buf = PlayBuf.ar(1, buffer, speed * BufRateScale.kr(buffer), loop: 1);\n Out.ar(0, (buf * env).dup );\n}).add;\n\ns.boot;\n\n// path to a mono soundfile here\na = Buffer.read(s, ExampleFiles.child);\n\nb = Synth(\\scratch, [\\buffer, a]);\n\n// move mouse to scrub the record.\n// press mouse button to 'stop the record', you can scrub while it is stopped.\n\n// stop the synth\nb.set(\\gate, 0);\n// free the Buffer\na.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `ProxySpace.reduce` do?"}, {"role": "assistant", "content": "free all proxies that are not needed in order to play the ones passed in with 'to'. if none are passed in, all proxies that are monitored (with the play message) are kept as well as their parents"}]} -{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//multiple objects within a world with gravity force\n//color and size depends on object's mass\n\n(\nvar width= 300, height= 300, w, wgrav, world, n= 80;\n\n//--world\nw= RedWindow(\"vector test\", Rect(128, 64, width, height)).front;\nwgrav= RedVector2D[-0.1, 0.98]; //world xy gravity\nworld= RedWorld3(RedVector2D[width, height], wgrav, 20, 0.2); //dim,grav,maxvel,damp\n\n//--objects\n{\n var mass= 1.0.rrand(4); //random mass for each object\n RedObject(world, RedVector2D[width, 20].rand, 0, 0, mass, mass*5); //world,loc,vel,acc,mass,size\n}.dup(n);\n\n//--loop\nw.draw{\n world.objects.do{|o|\n o.addForce(world.gravity);\n o.update;\n world.contain(o);\n\n //--render\n Pen.strokeColor= Color.grey(o.mass/4);\n Pen.strokeRect(Rect.aboutRedObject2D(o));\n };\n};\nw.play;\nCmdPeriod.doOnce({w.close});\n)\n```"}, {"role": "assistant", "content": "multiple objects within a world with gravity force color and size depends on object's mass."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Pbindef`."}, {"role": "assistant", "content": "```supercollider\nPbindef(\\x, note: Pseq([0, 7, 9]), dur: 0.2).play;\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for Extra Demos for \\apadMH SynthDef."}, {"role": "assistant", "content": "```supercollider\n// Extra Demos for \\apadMH SynthDef\n\n\n(\n// made by Diya Menon\n// inspired by Eastside\n// demo\nPbindef(\\dmapadMH2,\n \\instrument, \"apadMH\",\n \\midinote, Pseq([\n 73, 73, 73, 73, 69, 71, 71, 71, 69, 69, 69, 69, 69, 64, 69, 69, 69, 69,\n [57, 61, 52, 69, 73, 64],\n [56, 59, 51, 68, 71, 63],\n [61, 64, 56, 73, 76, 68],\n [54, 57, 49, 66, 69, 61],\n [54, 57, 49, 66, 69, 61],\n [56, 59, 51, 68, 71, 63],\n [57, 61, 52, 69, 73, 64],\n ]),\n \\amp, Pseq([\n Pn([0.075], 18),\n 0.081, 0.065, 0.075, 0.1, 0.065, 0.05, 0.1\n ]),\n \\dur, Pseq([\n Pn(0.17, 3), 0.34,\n Pseq([Pn(0.17, 4), 0.34], 2),\n Pn(0.17, 4),\n 1.5, 0.75, 0.75, 1.5, 0.75, 0.75, 1.5]),\n \\rel, Pgeom(0.01, 1.25),\n \\reverbMix, 0\n).play;\n);\n\n(\n// by Bruno Ruviaro\nPbindef(\\apadMH2,\n \\instrument, \"apadMH\",\n \\degree, Pwhite(-10, 15, inf),\n \\amp, Pwhite(0.06, 0.2, inf),\n \\mtranspose, Prand([\n 0,\n [0, 4],\n 0,\n [0, 5, 7]\n ], inf),\n \\dur, Prand([1, 2, 2.6], inf),\n \\att, Pwhite(0.9, 1.5),\n \\rel, 6, //Pn(Pgeom(0.01, 1.25), inf),\n \\legato, 1,\n \\vibratoRate, Pwhite(2.0, 4.0, inf),\n \\vibratoDepth, Pwhite(0.005, 0.02, inf),\n \\reverbMix, 0.2\n).play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `FoaMirror` in SuperCollider briefly."}, {"role": "assistant", "content": "FoaMirror — First Order Ambisonic (FOA) mirror transformer Mirror a First Order Ambisonic signal (B-format) across an arbitrary plane. Category: Libraries > Ambisonic Toolkit > UGens > FOA > Transformer, UGens > Multichannel > Ambisonics."}]} -{"conversations": [{"role": "user", "content": "Explain `EaseOutQuad` in SuperCollider briefly."}, {"role": "assistant", "content": "EaseOutQuad — Quadratic ease-out Easing equation for a quadratic (t^2) ease-out, decelerating to zero velocity. Category: Ease."}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for late night experimenting."}, {"role": "assistant", "content": "```supercollider\n(\nvar seed = thisThread.randSeed = 1e8.rand.debug('seed');\n{|dur = 30|\n var voices = 2.pow(1.rrand(4)),\n sig = DelayC.ar({ Pan2.ar(\n PMOsc.performList(\\ar, {\n var freq = Lag.ar(LFSaw.ar([10,15]/((1..5).choose*[1,2,4].choose)).exprange(\n {200.rrand(400)}!2, {500.rrand(1100)}!2\n * Line.kr(0.5.rrand(2), 3.rrand(8.0),dur)\n ));\n [freq, freq/[2,4].choose + SinOsc.kr([10,25],0,5), XLine.kr(0.1,1.rrand(3.0),dur/1.rrand(2.0))]\n }.()).sum/2,\n [SinOsc,LFTri].choose.kr({4.0.rrand(11)}!2 * [XLine,Line].choose.kr(1,4,dur))\n ).sum/2 \n * LFGauss.kr(XLine.kr(\\beat.kr, \\beat.kr / \\beat_change.kr, dur) / [0.5,1,2,4].choose, 0.3) \n * EnvGen.kr([\n Env.perc(0.1,dur),\n Env.sine(dur),\n Env.performList(\\new, {|len| [\n [0]++Array.rand(len,0.1,1)++[0],\n Array.rand(len,0.1,1).normalizeSum * dur,\n Array.rand(len-1,-3.0,3.0)+[0]\n ]}.(2.rrand(10)))\n ].choose) } ! voices, 4, { 0.1.rrand(4) } ! voices, 1 / voices).sum * Line.kr(1,1,dur+5,doneAction:2);\n sig = Rotate2.ar(sig[0],sig[1], LFSaw.kr(Duty.kr(dur/4.rrand(16), 0, Drand([-1*\\beat.kr,\\beat.kr].reciprocal,inf))));\n}.play(args:[\n dur:1.rrand(25.0).debug('dur'), \n beat:1.rrand(6)*(1..4).reciprocal.choose/4, \n beat_change:1.rrand(8)\n])\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Patch.respawn` do? What arguments does it take?"}, {"role": "assistant", "content": "Pairs an Instr with inputs that that will be passed to the Instr Arguments: atTime — see atTime."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n~resize_enveloppe = { | levels, times |\n var reverted_levels, index;\n index = 0;\n reverted_levels = levels.reverse;\n while( { reverted_levels[index] == 0 && reverted_levels[index+1] == 0 }, { times[ times.size - 1 - index] = 0.01; index = index + 1 } );\n};\n)\n```"}, {"role": "assistant", "content": "Enveloppes sizes are fixed. This means that if enveloppe's levels are equals to [ 1, 0, 0, 0, 0, 0, 0, 0 ] and times are equals to [ 1, 1, 1, 1, 1, 1, 1, 1 ], the synth UGens will take resources 8 seconds but will only be audible 1 second. To avoid this, passing both the levels and the times to this function will detect when the sound stops playing and will reduce the \"silence\" times to 0.01s, thu."}]} -{"conversations": [{"role": "user", "content": "What does `SoundFileView.selectionSize` do? What arguments does it take?"}, {"role": "assistant", "content": "The size of a Arguments: index — The index of the selection; an Integer between 0 an 63.. Returns: An Integer."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that makes Beam me up scotty."}, {"role": "assistant", "content": "```supercollider\n{\nvar time = 8;\nvar freq = (40-12).midicps;\nvar a = VarSaw.ar(freq/2, width: XLine.ar(0.5,1,time)).range(0,XLine.ar(1,1/1000,time));\nvar tone = SinOsc.ar(freq).fold(-1*a,a);\nOut.ar(0, tone.dup);\n}.play;\n```"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Pisano Periods are used to generate melodies."}, {"role": "assistant", "content": "```supercollider\n/*\nThe Fibonacci-sequence as controlsignal: melodies from Pisano Periods.\nBecause the sequence runs more or less exponentially, it seems best to assign the values to frequencies. \n*/\ns.boot;\nSynthDef( \\puls, {|freq=30, out|\n Out.ar(out,\n SinOsc.ar(freq, mul: 0.5*EnvGen.kr(Env.perc(0.01,0.75), doneAction: 2)),0)\n}).add;\n(\nm=3000; //max index, 5 minutes = 300 when dur=0.1\na=Array.newClear(m);//two arrays to store numbers from the Pisano Periods\nb=Array.newClear(m);\na.put(0,0); \na.put(1,1);\nd=2; //even divisor\ni=2; //index\nwhile ({i Analysis > Amplitude."}]} -{"conversations": [{"role": "user", "content": "What does `TdefGui.envirGui` do?"}, {"role": "assistant", "content": "the gui for the Tdef's envir - if numItems >"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Event`."}, {"role": "assistant", "content": "```supercollider\n(freq: 761).play // play a default synth sound with 761 Hz\n```"}]} -{"conversations": [{"role": "user", "content": "How do I get a Euclidean-style rhythm in SuperCollider?"}, {"role": "assistant", "content": "Describe the pattern as a list of hits and rests; `Rest` gives the gap without starting a Synth.\n\n```supercollider\n(\nPbind(\n \\instrument, \\hat,\n \\dur, 0.125,\n \\amp, Pseq([0.3, 0, 0, 0.3, 0, 0.3, 0, 0], inf).collect { |x| x + 0.001 }\n).play;\n)\n```\n\nFor real Euclidean generation use `Pseq([1,0,0,1,0,1,0,0], inf)` on a duration multiplier and wrap rests\nwith `Rest`, or compute the pattern with `bjorklund`-style logic in a Function and `Pseq` the result."}]} -{"conversations": [{"role": "user", "content": "Explain `DemandSpec` in SuperCollider briefly."}, {"role": "assistant", "content": "DemandSpec — datatype specifying a \\demand rate input or output Category: Spec, Libraries > crucial > Spec."}]} -{"conversations": [{"role": "user", "content": "What does `Interface.guiBodyFunction` do?"}, {"role": "assistant", "content": "Sets up an environment in which you can build a player, a GUI and responders for midi and keyboard control"}]} -{"conversations": [{"role": "user", "content": "What happens when I call .play on a function?"}, {"role": "assistant", "content": "`.play` on a Function builds a SynthDef from the function body, adds it to the server under an anonymous name, and starts one Synth of it. You get back the Synth, so `x = { SinOsc.ar(440) * 0.1 }.play; x.free;` stops it. It is the fastest way to hear something, but it is not how you write a piece: nothing is named, nothing can be reused, and the definition is lost when the Synth is freed."}]} -{"conversations": [{"role": "user", "content": "What does `RedMixerChannel.hiFreq` do?"}, {"role": "assistant", "content": "Get and set channel equalizer high band frequency (in Hz). Note: activate band first with `eqHi="}]} -{"conversations": [{"role": "user", "content": "How do I distort a signal?"}, {"role": "assistant", "content": "Drive it into a nonlinearity, then tame the level: `tanh` is soft clipping, `.distort` is harder,\nand a low-pass after the drive keeps it from getting fizzy.\n\n```supercollider\n(\n{\n var sig = SinOsc.ar(110) * 0.3;\n var driven = (sig * 12).tanh;\n LPF.ar(driven, 5000) * 0.4\n}.play;\n)\n```\n\nMore drive means more harmonics; because they are generated, the output is louder as well as brighter, so\nscale the result down after the nonlinearity."}]} -{"conversations": [{"role": "user", "content": "How do I make a delay line?"}, {"role": "assistant", "content": "`CombN.ar(in, maxdelaytime, delaytime, decaytime)` is a feedback delay: maxdelaytime is the buffer size, delaytime the actual delay (and it can modulate), decaytime how long the repeats take to die. For a clean single echo use `DelayN.ar(in, maxdelaytime, delaytime)`, which has no feedback. Both replace the `in` with the delayed signal, so mix with the dry: `dry + CombN.ar(dry, 0.5, 0.3, 2) * 0.4`."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `WrapIndex`."}, {"role": "assistant", "content": "```supercollider\n// indexing into a table\n(\n{\n var buf = LocalBuf.newFrom([200, 300, 400, 500, 600, 800]);\n var freq = WrapIndex.kr(buf, MouseX.kr(0, BufFrames.ir(buf) * 3));\n SinOsc.ar(freq) * 0.1\n}.play;\n);\n\n// the same using a global buffer\n(\nt = [200, 300, 400, 500, 600, 800];\nb = Buffer(s, t.size, 1);\n\n// alloc and set the values\ns.listSendMsg(b.allocMsg(b.setnMsg(0, t)).postln);\n\nSynthDef(\\help_Index, { |out = 0, bufnum = 0|\n Out.ar(out,\n SinOsc.ar(\n WrapIndex.kr(\n bufnum,\n MouseX.kr(0, BufFrames.ir(bufnum) * 3)\n ),\n 0,\n 0.5\n )\n )\n}).play(s, [\\bufnum, b.bufnum]);\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What is `BelaScope`?"}, {"role": "assistant", "content": "BelaScope — Bela's Oscilloscope interface"}, {"role": "user", "content": "What does `BelaScope.scope` do?"}, {"role": "assistant", "content": "Send an array of UGen data to Bela's oscilloscope."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n{ BelaScope.scope(0, SinOsc.ar) }.play;\n// same using UGen\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Platform`?"}, {"role": "assistant", "content": "Platform — handle cross-platform differencies"}, {"role": "user", "content": "What does `Platform.case` do?"}, {"role": "assistant", "content": "Perform actions depending on the current platform (name), just like Object:switch: `Platform.case(`"}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// start a server program from the cmdLine for testing\n~pid = unixCmd(Server.program + s.options.asOptionsString(57100));\n// kill just that server program by its pid:\nthisProcess.platform.killProcessByID(~pid);\n```"}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Interpolate between Envs with Pseg?"}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\sin, { arg out=0, gate=1, amp=0.1, pan=0, freq=200;\n var sig;\n sig = SinOsc.ar(freq);\n sig = sig * EnvGen.kr(\\adsr.kr(Env.adsr(0.1,0.1,0.8,0.1)), gate, doneAction:2);\n sig = Pan2.ar(sig, pan, amp);\n Out.ar(out, sig);\n}).add;\n);\n\n(\n// sequence Envs\n// need [] else it is inlined or does pattern multichannel expansion\nPdef(\\demo, \n Pbind(\n \\instrument, \\sin,\n \\degree, Pseq([0, Pwhite(0,7,1)],inf),\n \\legato, 0.5,\n \\adsr, Pseq([\n [ Env.adsr(1.1,0.1,0.8,1.01) ],\n [ Env.adsr(0.01,0.1,0.8,0.01) ],\n [ Env.adsr(0.01,1.1,0.3,0.01) ],\n ],inf),\n )\n).play;\n);\n\n(\n// interpolate using Pseg\n// need .asArray\nPdef(\\demo, \n Pbind(\n \\instrument, \\sin,\n \\degree, Pseq([0, Pwhite(0,7,1)],inf),\n \\legato, 0.5,\n \\adsr, Pseg(Pseq([\n [ Env.adsr(1.1,0.1,0.8,1.01).asArray ],\n [ Env.adsr(0.01,0.1,0.8,0.01).asArray ],\n [ Env.adsr(0.01,1.1,0.3,0.01).asArray ],\n ],inf),8),\n )\n).play;\n);\n```"}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n var gspring;\n gspring = { |freq|\n var delay, sinc, env, line, impul;\n\n delay = freq.reciprocal;\n impul = Impulse.ar(0);\n env = Env.perc(0.001, 0.01).ar;\n line = Line.ar(1000, 50, 0.01 );\n sinc = SinOsc.ar(line);\n\n Pluck.ar( sinc * env, impul, delay, delay, 5, 0.5);\n };\n\n\nSynthDef.new('eguitar',\n { arg amp=1, freq=150, out_bus=0, pan=0;\n\n var snd;\n\n snd = gspring.value(freq-50) +\n gspring.value(freq) +\n gspring.value(freq+50);\n\n snd = (snd * 32.dbamp).tanh;\n snd = RLPF.ar(snd, 2800+freq, 0.5);\n snd = (snd * 32.dbamp).tanh;\n snd = RLPF.ar(snd, 300+freq, 0.5);\n snd = (snd * 32.dbamp).tanh;\n\n snd * -20.dbamp;\n\n Out.ar(out_bus, snd );\n}).add\n);\n\nSynth('eguitar', [freq: 360]);\n```"}, {"role": "assistant", "content": "just a very limited attempt for reference purpose of a hoped for eguitar synth ´\r\nbased on https://sccode.org/1-5aC#c982."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `SynthDef`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_isRand, { |out|\n Out.ar(out,\n SinOsc.ar(Rand(400, 800), 0, 0.2) * Line.kr(1, 0, 1, doneAction: Done.freeSelf)\n )\n}).add;\n);\na = Synth(\\help_isRand);\nb = Synth(\\help_isRand); // a different randomly selected freq\n```"}]} -{"conversations": [{"role": "user", "content": "What is `Env`?"}, {"role": "assistant", "content": "Env — Specification for a segmented envelope"}, {"role": "user", "content": "What does `Env.new` do?"}, {"role": "assistant", "content": "Create a new envelope specification."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// an envelope in a synth\n(\n{\n var env = Env([0, 1, 0.5, 1, 0], [0.01, 0.5, 0.02, 0.5]);\n SinOsc.ar(470) * EnvGen.kr(env, doneAction: Done.freeSelf)\n}.play\n);\n// an envelope to control a parameter in a pattern\n(\nPbind(\n \\note, Env([0, 12, 6, 13, 0], [1, 5, 2, 10]),\n \\dur, 0.1\n).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Latch`."}, {"role": "assistant", "content": "```supercollider\n{ Blip.ar(LFNoise0.kr(9, 400, 500), 4, 0.2) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na.ramp(1.0, 1.0); // returns a harmonic series\n\nb = Buffer.alloc(s, 512, 1);\n// harmonic series for freqs, ramp down for amps\nb.sine2(a.ramp(1.0, 1.0).postln, a.ramp(0.5, -0.025).postln, true, true, true);\n(\nz = SynthDef(\"help-Osc\", { |out = 0, bufnum = 0|\n Out.ar(out,\n Osc.ar(bufnum, 200, 0, 0.5)\n )\n});\n);\ny = z.play(s, [\\out, 0, \\bufnum, b];\ny.free;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na.ramp(1.0, 1.0); // returns a harmonic series\n\nb = Buffer.alloc(s, 512, 1);\n// harmonic series for freqs, ramp down for amps\nb.sine2(a.ramp(1.0, 1.0).postln, a.ramp(0.5, -0.025).postln, true, true, true);\n(\nz = SynthDef(\"help-Osc\", { |out = 0, bufnum = 0|\n Out.ar(out,\n Osc.ar(bufnum, 200, 0, 0.5)\n )\n});\n);\ny = z.play(s, [\\out, 0, \\bufnum, b]);\ny.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Pgtpar` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// synthdef\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n}).add;\n);\n\n// pattern with different start times\n(\nx = Pbind(\n \\instrument, \\help_sinegrain,\n \\degree, Pseq(#[0, 5, 4, 2, 1, 1, 3], inf),\n \\dur, Pseq(#[0.25, 0.5, 1.0], inf),\n \\scale, #[0, 3, 5, 9, 10]\n);\na = Pbus(Pgtpar([0.0, x, 1.5, x, 2.25, x])).play;\n);\ns.plotTree;\na.stop;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Limiter` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\n// example signal to process\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n z * 0.8\n}.play\n);\n\n(\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n [z, Limiter.ar(z, 0.4, 0.01)] * 0.5\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ArrayedCollection`."}, {"role": "assistant", "content": "```supercollider\n(\nvar pitches = [43.0, 55.0, 58.86, 57.42, 67.0];\nfork {\n pitches.size.do{ |i|\n {\n var freq = pitches[i].midicps;\n var env = Env.perc.ar(Done.freeSelf);\n SinOsc.ar(freq) * 0.1 * env\n }.play;\n 0.2.wait\n }\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SimpleTrigger.guiClass` do?"}, {"role": "assistant", "content": "a player that emits a trigger on button push or .trig"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// where did I leave my keys?\n(\nvar n = 30, m = 5;\nNdef.clear(3);\nNdef.ar(\\x, n);\nNdef(\\y, { Splay.ar(Ndef.ar(\\x, m, LFNoise1.kr(1/m).range(0, n - m - 1))).clip2 * 0.5 }).play; \nNdef(\\x, { \n { \n var a = Ndef.ar(\\x, 1, LFNoise0.kr(Rand()) * Rand() + Rand() * n);\n a + 0.1 * SinOsc.ar(ExpRand(0.2, 1000)) \n } ! n\n}); \n);\n\n// where did I put my keys?\n(\nvar n = 30, m = 5;\nNdef.clear(3);\nNdef.ar(\\x, n);\nNdef(\\y, { Splay.ar(Ndef.ar(\\x, m, LFNoise1.kr(1/m).range(0, n - m - 1))).clip2 * 0.5 }).play; \nNdef(\\x, { \n {\n var a = Ndef.ar(\\x, 1, LFNoise0.kr(Rand()) * Rand() + Rand() * n);\n SinOsc.ar(ExpRand(0.2, 1000), a) \n } ! n\n}); \n)\n```"}, {"role": "assistant", "content": "Cross-tuning between multiple signal dimensions. The code is finished without listening."}]} +{"conversations": [{"role": "user", "content": "What does `SoundFile.openWrite` do? What arguments does it take?"}, {"role": "assistant", "content": "Try to create an audio file at the given path. Note that there is no `numFrames` argument: the number of frames is counted after writing data into the Arguments: pathName — Full path to the sound file. Use String#-standardizePath to resolve home-folder shortcuts such as `~`.; headerFormat — A string for the sound file format. Valid strings are listed at SoundFile#-headerFormat. If not given, the default `\"AIFF\"` is used.; sampleFormat — A string for the sample format. Valid strings are listed at SoundFile#-sampleFormat. If not given, the default `\"float\"` is used.; numChannels — An integer number of channels (1 by default).; sampleRate — An integer sample rate (44100 by default).. Returns: A new SoundFile instance if successful, or `nil` if file open failed. User code should check for `nil` before doing anything with the SoundFile object."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n\n(\nx = Pbind(\\midinote, Pseries(60, 1, 10), \\dur, 0.5).asStream;\ny = Pbind(\\midinote, Pseries(90, -1, 10), \\dur, 0.5).asStream;\n\nz = Pseq([2, 3, 1, 2], 1).asStream;\n\n~a = Pfuncn({ x.next(()) }, { z.next });\n~b = Pfuncn({ y.next(()) }, { z.next });\n\nPsymNilSafe(Pseq(\"ab\", inf)).trace.play;\n\n// shorter with method 'symplay':\n// trace indicates all events with delta = 0 (maxNull\n// …\n```"}, {"role": "assistant", "content": "shorter with method 'symplay': trace indicates all events with delta = 0 (maxNull = 128) in the post window (PsymNilSafe: Psym variant that avoids hangs if all referenced patterns return nil)"}]} +{"conversations": [{"role": "user", "content": "What does `MultiSplineFr.gui` do? What arguments does it take?"}, {"role": "assistant", "content": "Multi dimensional spline frame rate device Arguments: parent; bounds; maxTime."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nx = {\n // A collection of different tones:\n var son = SinOsc.ar((100, 100.3 .. 110));\n var val = ArrayMin.ar(son).at(0);\n val = LeakDC.ar(val); // the operation tends to induce DC offset\n Pan2.ar(val)\n}.play\n;\nx.free\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nx = {\n // A collection of different tones:\n var son = SinOsc.ar((100, 100.3 .. 110));\n var val = ArrayMin.ar(son).at(0);\n val = LeakDC.ar(val); // the operation tends to induce DC offset\n Pan2.ar(val)\n}.play\n);\nx.free\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Condition`?"}, {"role": "assistant", "content": "Condition — Block the execution of a thread"}, {"role": "user", "content": "What does `Condition.new` do?"}, {"role": "assistant", "content": "Create a new instance, set the test variable."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nc = Condition.new(false);\n\nRoutine {\n 1.wait;\n \"waited for 1 second\".postln;\n 1.wait;\n \"waited for another second, now waiting for you ... \".postln;\n c.wait;\n \"the condition has stopped waiting.\".postln;\n 1.wait;\n \"waited for another second\".postln;\n \"waiting for you ... \".postln;\n c.test = false;\n c.wait;\n \"the condition has stopped waiting.\".postln;\n 1.wait;\n \"the end\".postln;\n}.play;\n);\n\n// continue\n(\nc.test = true;\nc.signal;\n);\n\n// a typical use is a routine that can pause under certain conditions:\n(\nc = Condition.new;\nfork { loop { 1.wait; \"going\".postln; c.wait } };\n);\nc.test = true; c.signal;\nc.test = false;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Limiter` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\n// example signal to process\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n z * 0.8\n}.play\n);\n\n(\n{\n var z;\n z = Decay2.ar(\n Impulse.ar(8, LFSaw.kr(0.25, -0.6, 0.7)),\n 0.001, 0.3, FSinOsc.ar(500));\n [z, Limiter.ar(z, 0.4, 0.01)] * 0.5\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nNdef(\\sound).fadeTime = 3;\n(\nNdef(\\sound, { |fadeTime = 1, gate = 1|\n var e = Env.adsr(fadeTime, 0.01, 0.4, fadeTime).ar(2, gate);\n SinOsc.ar(100 + (e * 700), SinOsc.ar(208) * (1 - e) * 6) * e * 0.1\n}).play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nNdef(\\sound).fadeTime = 3;\n(\nNdef(\\sound, { |fadeTime = 1, gate = 1|\n var e = Env.adsr(fadeTime, 0.01, 0.4, fadeTime).ar(2, gate);\n SinOsc.ar(100 + (e * 700), SinOsc.ar(208) * (1 - e) * 6) * e * 0.1\n}).play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for smooth arpeggio, updated envelope (a SuperCollider snippet): bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\bass, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.perc(0.2), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Collection.includesEqual` do?"}, {"role": "assistant", "content": "Answer whether anObject is contained in the receiver. In contrast to #-includes this tests for equality - not identity. `List[\"a\", \"b\", \"c\"].includesEqual(\"c\"); //"}]} +{"conversations": [{"role": "user", "content": "What does `View.resize` do? What arguments does it take?"}, {"role": "assistant", "content": "Determines what happens with the view's position and size when its parent is resized. See GUI-Introduction#view for further Arguments: An Int (1 to 9) defining the auto-resize behavior. See Resize for a list of valid resize modes.."}]} +{"conversations": [{"role": "user", "content": "What does `BezierSpline.ntic` do?"}, {"role": "assistant", "content": "used internally to cubically interpolate between two points with 3 or more control points between"}]} +{"conversations": [{"role": "user", "content": "What does `AbstractWrappingDispatcher.getKeysForFuncProxy` do? What arguments does it take?"}, {"role": "assistant", "content": "Subclasses should override this to return an Array containing all the keys at which the specified responder func's functions are stored in this dispatchers active Arguments: funcProxy — An instance of a subclass of AbstractResponderFunc.. Returns: An Array."}]} +{"conversations": [{"role": "user", "content": "What does `Interpreter.interpretPrint` do?"}, {"role": "assistant", "content": "Compile and execute a String, printing the result. `this.interpretPrint(\"123 +"}]} +{"conversations": [{"role": "user", "content": "Explain `PMantissaMask` in SuperCollider briefly."}, {"role": "assistant", "content": "PMantissaMask — UGenPatterns quark library Based on MantissaMask Category: Streams-Patterns-Events > UGenPatterns > Generators."}]} +{"conversations": [{"role": "user", "content": "What does `Function.valueArray` do?"}, {"role": "assistant", "content": "Evaluates the FunctionDef referred to by the Function. If the last argument is an Array or List, then it is unpacked and appended to the other arguments (if any) to the Function. If the last argument is not an Array or List then this is the same as the 'value' method. `{ |a, b, c| ((a * b) + c).postln }.valueArray([3, 10, 7]);` A common syntactic shortcut: `{ |a, b, c| ((a * b) + c).postln }.value(*[3, 10,"}]} +{"conversations": [{"role": "user", "content": "What does `TdefGui.editString` do?"}, {"role": "assistant", "content": "a compileString that recreates the Tdef's envir at"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n(\nx = {\n |loDev = -6, hiDev = 5, lookBack = 2|\n var trig = Impulse.ar(5);\n // define maxLookBack, minLoDev and maxHiDev\n var midi = Demand.ar(trig, 0, DIdev(72, 11, -6, 5, lookBack, loDev, hiDev));\n midi.poll(5, label: \\midi);\n SinOsc.ar(midi.midicps.lag(0.007)) ! 2 * 0.1\n}.play;\n);\n\n\n// as lookBack equals 2, this defines a fixed sequence (up or down anyway)\n\n(\nx.set(\\loDev, -1);\nx.set(\\hiDev, 1)\n);\n\n\n// widen range\n// …\n```"}, {"role": "assistant", "content": "define maxLookBack, minLoDev and maxHiDev as lookBack equals 2, this defines a fixed sequence (up or down anyway) (DIdev: pseudo drate ugen, searches for numbers with integer distance from a source signal, optionally avoiding repetitions within a span)"}]} +{"conversations": [{"role": "user", "content": "What is `UGen`?"}, {"role": "assistant", "content": "UGen — Abstract superclass of all unit generators"}, {"role": "user", "content": "What does `UGen.multiNew` do?"}, {"role": "assistant", "content": "These methods are responsible for multichannel expansion. They call `*new1(rate, ...args)` for each parallel combination. Most `*ar / *kr` methods delegate to #*multiNewList."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n{ Blip.ar(Blip.kr(4, 5, 500, 60), 59, 0.1) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nPsloth {\n var seed, repeats;\n\n *new { arg seed, repeats=1;\n ^super.newCopyArgs(seed, repeats);\n }\n\n storeArgs{^[seed, repeats]}\n\n embedInStream { arg inval;\n var size=seed.size;\n var pointers=List[];\n repeats.value(inval).do({ arg j;\n j = j+1;\n if(j == j.nextPowerOf(size),{ pointers.add(0); });\n pointers.collect{|i| seed.at(i)}.sum.embedInStream(inval);\n pointers.do{|x, i|\n if((i==0) || (pointers[0..(i-1)].sum==0), {pointers[i] = ((x+1)%size);})\n };\n });\n ^inval\n }\n}\n```"}, {"role": "assistant", "content": "Save this as an extension and recompile class library. You can now use `Psloth([0,1,0], 10)`, for example, instead of declaring a new routine for each pattern.\r\n\r\nI didn't persist the use cases, as this should be saved as a `.sc` file. Please refer to the ancestor code for usage.\r\n\r\nMemory/CPU usage will grow over time, but at a decreasing rate. This can be used for a large amount of repeats. Exte."}]} +{"conversations": [{"role": "user", "content": "What is the difference between Line and XLine?"}, {"role": "assistant", "content": "Both are ramps: `Line.kr(start, end, dur, mul, add, doneAction)` moves linearly, `XLine.kr(...)` moves exponentially in a fixed ratio per unit time. Use Line for amplitude and XLine for frequency or any parameter you hear logarithmically — a linear frequency sweep sounds like it rushes at the top and crawls at the bottom. Both take doneAction, so both can end a Synth."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nPdef(\\zed, \n Pbind(\n \\osc, Pseq([SinOsc, LFSaw],inf),\n \\instrument, Prout({ arg ev;\n SynthDef(\\zed, { arg out=0, gate=1, amp=0.1, pan=0, freq=200;\n var sig;\n sig = ev[\\osc].ar(freq);\n sig = sig * EnvGen.kr(\\adsr.kr(Env.adsr(0.1,0.1,0.8,0.1)), gate, doneAction:2);\n sig = Pan2.ar(sig, pan, amp);\n Out.ar(out, sig);\n }).add.yield;\n }).loop,\n \\degree, Pseq([0],inf),\n \\dur, 1,\n \\amp, 0.1,\n )\n).play;\n);\n```"}, {"role": "assistant", "content": "synthdef building should take less time than s.latency for this to work."}]} +{"conversations": [{"role": "user", "content": "What is `Oregonator` in SuperCollider?"}, {"role": "assistant", "content": "Oregonator — Chemical reaction modelling Oscillator Euler ODE solver implementation of the Oregonator equations (http://www.scholarpedia.org/article/Oregonator). Category: UGens > Generators > Chaotic //SLUGens released under the GNU GPL as extensions for SuperCollider 3, by Nick Collins, http://composerprogrammer.com/index.html."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Pseq` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Pseq(#[60, 61, 63, 65, 72], inf).asStream;\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, a.next.midicps]);\n 0.2.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// randomly modulate params\n(\n{ LinCongL.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(0.1, 0.5, 1.4),\n LFNoise2.kr(0.1, 0.1, 0.1),\n LFNoise2.kr(0.1)\n) * 0.2 }.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// randomly modulate params\n(\n{ LinCongL.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(0.1, 0.5, 1.4),\n LFNoise2.kr(0.1, 0.1, 0.1),\n LFNoise2.kr(0.1)\n) * 0.2 }.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Archive`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n// make a storage place for various objects:\nq = (); // Event\n\nq[\\a_long_array] = Array.rand(128, 0.0, 1.0);\nq[\\pi_squared] = pi * pi;\nq[\\favourite_sound] = { { SinOsc.ar([300, 330]).sum * LFPulse.kr(2 + [0, 0.01]) * 0.1 }.play };\nq[\\same_long_array] = q[\\a_long_array]; // same objects may appear several times\n\nArchive.global.put(\\myData, q);\n\n\nArchive.global.at(\\myData).postcs;\n\n// after a recompile:\ns.boot;\n\nq = Archive.global.at(\\myData);\nq.postcs;\nq[\\favourite_sound].value;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SinOsc`."}, {"role": "assistant", "content": "```supercollider\n// create an audio-rate sine wave at 200 Hz,\n// starting with phase 0 and an amplitude of 0.5\n{ SinOsc.ar(200, 0, 0.5) }.play;\n\n// modulate the frequency with an exponential ramp\n{ SinOsc.ar(XLine.kr(2000, 200), 0, 0.5) }.play;\n\n// more complex frequency modulation\n{ SinOsc.ar(SinOsc.ar(XLine.kr(1, 1000, 9), 0, 200, 800), 0, 0.25) }.play;\n\n// phase modulation (see also PMOsc)\n{ SinOsc.ar(800, SinOsc.ar(XLine.kr(1, 1000, 9), 0, 2pi), 0.25) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `BLowShelf` in SuperCollider?"}, {"role": "assistant", "content": "BLowShelf — Low Shelf The B equalization suite is based on the Second Order Section (SOS) biquad UGen. Category: UGens > Filters > BEQSuite."}]} +{"conversations": [{"role": "user", "content": "What does `ServerGui.update` do? What arguments does it take?"}, {"role": "assistant", "content": "an alternate small server view Arguments: changer; what."}]} {"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\nvar trigger, fund, flashInst;\nflashInst = Array.fill(7,\n{\ntrigger = Dust.kr(2)*PinkNoise.ar(1);\nfund = rrand(100, 137);\nPan2.ar(\nMix.ar(\nArray.fill(7,\n{arg counter;\nvar partial;\npartial = counter + 3;\n//HenonC.ar(fund*partial).atan *\nDPW3Tri.ar(fund*partial).atan *\nEnvGen.kr(Env.adsr(0.01, 0, 0.1, 7.0),\ntrigger, 1/partial) *AY.ar(713)* max(0, LFNoise1.kr(rrand(37.0, 73.0)))\n})\n)*0.2,\n1.0.rand2)\n});\nMix.ar(flashInst)*0.6\n}.play\n)\n```"}, {"role": "assistant", "content": "\"High-energy Radio Bursts, generated by an old coffee machine of Arab origin, manifest themselves as noise and audio signals, and trigger a magnetic alteration with unpredictable effects;\"\r\n\r\n\r\n\r\nhttp://bz-buzz.blogspot.com/2018/10/radio-bursts-from-old-coffee-pot.html\r\n\r\nhttp://bzakirasantjago.blogspot.com/."}]} -{"conversations": [{"role": "user", "content": "What does `View.alwaysOnTop` do? What arguments does it take?"}, {"role": "assistant", "content": "If the view is a window, gets or sets whether it should always stay on top of other Arguments: boolean — A Boolean stating whether the view should always stay on top.."}]} -{"conversations": [{"role": "user", "content": "What does `SineShaper.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "port of some ladspa plugins Arguments: in — The input signal.; limit; mul — Output will be multiplied by this value.; add — This value will be added to the output.."}]} -{"conversations": [{"role": "user", "content": "What does `Image.closeAllPlotWindows` do?"}, {"role": "assistant", "content": "Close all the Image plot windows currently"}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LinExp`."}, {"role": "assistant", "content": "```supercollider\n// linexp\n(\n{\n var mod = LFNoise2.ar(80);\n SinOsc.ar(mod.linexp(-1, 1, MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1))) * 0.1\n}.play;\n);\n\n// exprange\n(\n{\n var mod = LFNoise2.ar(80).exprange(MouseX.kr(200, 8000, 1), MouseY.kr(200, 8000, 1));\n SinOsc.ar(mod) * 0.1\n}.play;\n)\n```"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n\np = EnvelopedPlayer(\n Patch({\n SinOsc.ar * 0.1\n }),\n Env.adsr(releaseTime: 2.0),\n 1\n);\n\np.play;\n\n/*\nGroup(0)\n Group(1)\n Synth(\"-tIRuC\" : 1000) Patch[ f-1833258691 ]:synth\n Synth(\"EnvelopedPlayer1yeG~u\" : 1001) an EnvelopedPlayer:synth\n*/\n;\n\np.release;\n\np.status\n\np.free\n\np.insp\n\n\np.group\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n\np = EnvelopedPlayer(\n Patch({\n SinOsc.ar * 0.1\n }),\n Env.adsr(releaseTime: 2.0),\n 1\n);\n\np.play;\n\n/*\nGroup(0)\n Group(1)\n Synth(\"-tIRuC\" : 1000) Patch[ f-1833258691 ]:synth\n Synth(\"EnvelopedPlayer1yeG~u\" : 1001) an EnvelopedPlayer:synth\n*/\n);\n\np.release;\n\np.status\n\np.free\n\np.insp\n\n\np.group\n```"}]} -{"conversations": [{"role": "user", "content": "I edited a SynthDef and the running sound did not change."}, {"role": "assistant", "content": "Redefining a SynthDef only affects Synths created after the new definition reaches the server; existing instances keep the graph they were built with. Free and recreate them: `~s.free; ~s = Synth(\\name)`. In JITLib, Ndef is the tool designed for this — redefining `Ndef(\\name, { ... })` crossfades to the new graph while it plays."}]} -{"conversations": [{"role": "user", "content": "What does `KeyCodeResponder.registerKeycode` do? What arguments does it take?"}, {"role": "assistant", "content": "register responder functions for keycode and modifier combinations Arguments: modifier; keycode; function."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Migration from the old SourceForge wiki."}, {"role": "assistant", "content": "```supercollider\n// Sing whatever pitch you like into the microphone, but have the output conform to the key you press on your connected MIDI keyboard, like a very low-rent Autotune.\n// by nonprivate April 2009\n// best used with headphones\n// execute one by one...\n\ns = Server.local.boot;\nb = 200; // no. of control bus to use for pitch control\n(\n SynthDef(\"straightenUp\",\n { |baseFreq = 100|\n \n var in, freq, hasFreq, out;\n in = Mix.new(SoundIn.ar([0,1]));\n # freq, hasFreq = Pitch.kr(in, ampThreshold: 0.02, median: 7);\n out = PitchShift.ar(in, 0.08, (baseFreq / freq), 0.0, 0.0);\n Out.ar(0,[out, out])\n }\n ).send(s);\n);\n\ns.sendMsg(\"/s_new\", \"straightenUp\", n = s.nextNodeID, 1, 0);\n\ns.sendMsg(\"/n_map\", n, \"baseFreq\", b);\n\n(\n c = NoteOnResponder(\n { |src,chan,note,vel|\n \n s.sendMsg(\"/c_set\", b, note.midicps);\n \n },\n nil, // any source\n nil, // any channel\n nil, // any note\n nil // any vel\n );\n \n)\n```"}]} -{"conversations": [{"role": "user", "content": "What are the arguments of GrainBuf.ar?"}, {"role": "assistant", "content": "`GrainBuf.ar(numChannels, trigger, dur, sndbuf, rate, pos, interp, pan, envbufnum, maxGrains, mul, add)`. The ones you always pass are numChannels (1 or 2), trigger (a UGen that fires grains, e.g. Impulse.kr(20)), dur (grain length in seconds), sndbuf (an integer buffer number, or `~buf`), rate (playback rate per grain), and pos (read position 0..1 into the buffer). Raise maxGrains if the server complains about too many grains rather than lowering density."}]} -{"conversations": [{"role": "user", "content": "What does `Condition.wait` do?"}, {"role": "assistant", "content": "Wait until the condition is true and signalled. This only works in a Routine. This method yields a symbol (\\hang), so that the clock doesn't reschedule the Routine. `c = Condition(false); fork { 0.5.wait; \"started"}]} -{"conversations": [{"role": "user", "content": "What does `RedSamp.prepareForPlay` do? What arguments does it take?"}, {"role": "assistant", "content": "Attach a soundfile to a key (number or symbol) and create buffers - one for each overlapping voice. This method is also has the alias `preload` for backward Arguments: key — A number or a symbol.; buffer — A Buffer instance.; startFrame — In samples.; numFrames — How much of the file to load in samples. Leave as `nil` to load the complete file.."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// The following files are test materials on my machine; you will subsitute your own filenames here\n// A major\nd = Buffer.read(s, \"/Volumes/data/stevebeattrack/samples/100.wav\");\n// F major; hard to track!\nd = Buffer.read(s, \"/Volumes/data/stevebeattrack/samples/115.wav\");\n\n// straight forward since no transients; training set from MIREX2006\n// 01 = A major\n// 57 = b minor\n// 78 e minor\n// 08 Bb major\n\nd = Buffer.read(s, \"/Users/nickcollins/Desktop/ML/training_wav/78.wav\")\n\n(\n{\n var in, fft, resample;\n var\n// …\n```"}, {"role": "assistant", "content": "The following files are test materials on my machine; you will subsitute your own filenames here F major; hard to track! (KeyTrack: Key tracker)"}]} -{"conversations": [{"role": "user", "content": "What does `PCombN.new` do? What arguments does it take?"}, {"role": "assistant", "content": "UGenPatterns quark library Arguments: pattern; maxdelaytime — Fixed.; delaytime; decaytime — Differs from CombN. Here feedback factor.; mul; add."}]} -{"conversations": [{"role": "user", "content": "Can you write me a SuperCollider patch for Re: Variations for Z1 sawtooth?"}, {"role": "assistant", "content": "```supercollider\n(\n{\n var mod = SinOsc.ar([0.1,0.15,0.2]).range(0,1);\n var sig = LFPulse.ar(1.1).range(1,10);\n var sig2 = LFNoise1.ar(0.08).range(0.99,1.01);\n var saw = LFSaw.ar([10,12,15]*sig*sig2);\n var out = (saw - ((saw>0)*mod)+(mod*0.5));\n Splay.ar(out)*0.1;\n}.play;\n\n{\n var mod = SinOsc.ar([0.1,0.15,0.2]).range(0,1);\n var sig = LFPulse.ar(1).range(1,10);\n var sig2 = LFTri.ar(0.1,[0,1,2,3]).range(1,10*sig);\n var sig3 = LFNoise1.ar(0.05).range(0.99,1.01);\n var saw = SinOsc.ar(LFSaw.ar([10,12,15]*sig2*sig3).range(200,300));\n var out = (saw - ((saw>0)*mod)+(mod*0.5));\n Splay.ar(out)*0.1;\n}.play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `Button.defaultReceiveDrag` do?"}, {"role": "assistant", "content": "The default method called when a drag has been received. If the drag contains a number, then action is set to the current drag. Otherwise `valueAction_()` is performed using the"}]} +{"conversations": [{"role": "user", "content": "What is `NoLagControlSpec` in SuperCollider?"}, {"role": "assistant", "content": "NoLagControlSpec — datatype specifying a 'control' rate input that does not any lag applied to it Control rate inputs are usually given a Lag to smooth out any zipper noises. Some inputs like those used for binary flags (eg 0/1 to toggle playing) should not ever get a lag. Category: Spec, Libraries > crucial > Spec."}]} +{"conversations": [{"role": "user", "content": "What is `IFFT`?"}, {"role": "assistant", "content": "IFFT — Inverse Fast Fourier Transform"}, {"role": "user", "content": "What does `IFFT.new` do?"}, {"role": "assistant", "content": "returns a time domain signal from converting the FFT frequency domain signal chain. The *new method is equivalent to the *ar message returns an audio rate signal."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// without any modification, convert FFT chain (frequency domain signal) back to audio (time domain signal)\n(\n{ var in, chain;\n in = WhiteNoise.ar;\n chain = FFT(LocalBuf(2048), in);\n IFFT.ar(chain) * -20.dbamp // inverse FFT\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is a bus, in one sentence?"}, {"role": "assistant", "content": "A numbered channel on the server that nodes write signal into and read signal out of, which is how sounds are chained without cables."}, {"role": "user", "content": "Show me using one for an effect."}, {"role": "assistant", "content": "Write the source to a private bus, read it in the effect, send the effect to the master:\n\n```supercollider\n(\n~bus = Bus.audio(s, 1);\nSynthDef(\\src, { |out = 0| Out.ar(out, Saw.ar(110) * 0.1) }).add;\nSynthDef(\\fx, { |in = 0| Out.ar(0, RLPF.ar(In.ar(in, 1), 1200, 0.3)) }).add;\n);\nSynth(\\fx, [\\in, ~bus]);\nSynth(\\src, [\\out, ~bus]);\n```\n\nOrder matters: the effect exists before the source, so the source's output has a listener."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n VarLag.kr( // lag the modulator\n LFPulse.kr(1).range(100, 400), // frequency modulator\n 0.2, // lag time\n Line.kr(-8, 8, 15, doneAction: Done.freeSelf) // modulate shape\n ),\n 0, // sine phase\n 0.3 // sine amplitude\n )\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n VarLag.kr( // lag the modulator\n LFPulse.kr(1).range(100, 400), // frequency modulator\n 0.2, // lag time\n Line.kr(-8, 8, 15, doneAction: Done.freeSelf) // modulate shape\n ),\n 0, // sine phase\n 0.3 // sine amplitude\n )\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "How do I get a Euclidean-style rhythm in SuperCollider?"}, {"role": "assistant", "content": "Describe the pattern as a list of hits and rests; `Rest` gives the gap without starting a Synth.\n\n```supercollider\n(\nPbind(\n \\instrument, \\hat,\n \\dur, 0.125,\n \\amp, Pseq([0.3, 0, 0, 0.3, 0, 0.3, 0, 0], inf).collect { |x| x + 0.001 }\n).play;\n)\n```\n\nFor real Euclidean generation use `Pseq([1,0,0,1,0,1,0,0], inf)` on a duration multiplier and wrap rests\nwith `Rest`, or compute the pattern with `bjorklund`-style logic in a Function and `Pseq` the result."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// record a buffer\nb = { Blip.ar(XLine.kr(10000, 4, 3) * [1, 1.2], 20) * 0.1 }.asBuffer(3, fadeTime: 0.1)\nb.plot; // after 3 seconds, you can see it.\n// play the soundfile back\n{ PlayBuf.ar(b.numChannels, b, LFNoise2.kr(2 ! 8).exprange(0.15, 1), loop: 1.sum }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// record a buffer\nb = { Blip.ar(XLine.kr(10000, 4, 3) * [1, 1.2], 20) * 0.1 }.asBuffer(3, fadeTime: 0.1)\nb.plot; // after 3 seconds, you can see it.\n// play the soundfile back\n{ PlayBuf.ar(b.numChannels, b, LFNoise2.kr(2 ! 8).exprange(0.15, 1), loop: 1).sum }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `BiPanB2`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var w, x, y, p, q, a, b, c, d;\n\n p = LFSaw.ar(200);\n q = LFSaw.ar(301);\n\n // B-format encode\n #w, x, y = BiPanB2.ar(p, q, MouseX.kr(-1, 1), 0.1);\n\n // B-format decode to quad\n #a, b, c, d = DecodeB2.ar(4, w, x, y);\n\n [a, b, d, c] // reorder to my speaker arrangement: Lf Rf Lr Rr\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ LPF.ar(Saw.ar(100), SinOsc.kr(0.5).exprange(200, 2000)) * 0.2 }.play;\n```"}, {"role": "assistant", "content": "A sawtooth through a low-pass filter whose cutoff is swept slowly up and down — a classic filter\nsweep.\n\n- `Saw.ar(100)` is a 100 Hz sawtooth, rich in harmonics.\n- `SinOsc.kr(0.5)` is a control-rate sine at 0.5 Hz, so one full cycle takes 2 seconds.\n- `.exprange(200, 2000)` maps that -1..1 sine exponentially onto 200..2000 Hz — exponential is the right\n mapping for frequency, because we hear pitch logarithmically.\n- `LPF.ar(sig, cutoff)` removes harmonics above the cutoff; as it opens and closes you hear the tone\n brighten and darken.\n- `* 0.2` keeps the output from clipping."}]} +{"conversations": [{"role": "user", "content": "What does `JITGui.getState` do?"}, {"role": "assistant", "content": "ask the object for all aspects of its current state that will be"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// For more SynthDefs and examples please head to: https://mycelialcordsblog.wordpress.com/ \n\n(\nSynthDef(\\hasherTest,\n{\narg rate = 1, freq = 60, index = 1000, tRate = 100,\nout = 0, fRate = 0.1;\n\nvar t_trig = LFPulse.kr(0.5/fRate, 0.5);\nvar random = LFNoise0.ar(rate, add:1);\nvar noise = Hasher.ar(random);\nvar sound = Saw.ar((freq+(noise*index)), Decay.kr(Impulse.kr(tRate), noise*0.001)).tanh;\nsound = Pan2.ar(sound, noise-0.3*2);\nFreeSelf.kr(t_trig);\nOut.ar(out, sound);\n}).store;\n);\n\n(\nPbind(\n\\instrument, \\hasherTest,\n\\dur, 5,\n\\rate, Pfuncn({100.rand}, inf),\n\\freq, Pfuncn({10000.rand}, inf),\n\\index, Pfuncn({20000.rand}, inf),\n\\tRate, Pfuncn({1000.rand}, inf),\n\\fRate, 5,\n).play;\n)\n```"}, {"role": "assistant", "content": "It is a simple SynthDef I made after having a look at Hasher UGen with a pattern to play it. It creates nice and varied glitch sounds."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n\n// no decay\n(\n{\n SinOsc.ar(\n PeakFollower.ar(Dust.ar(20, Line.kr(0, 1, 4)), 1.0) * 1500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// a little decay\n(\n{\n SinOsc.ar(\n PeakFollower.ar(Dust.ar(20, Line.kr(0, 1, 4)), 0.999) * 1500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// mouse x controls decay, center of the\n(\n{\n var decay;\n decay = MouseX.kr(0.99, 1.00001).min(1.0);\n SinOsc.ar(\n PeakFollower.ar(Dust\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n\n// no decay\n(\n{\n SinOsc.ar(\n PeakFollower.ar(Dust.ar(20, Line.kr(0, 1, 4)), 1.0) * 1500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// a little decay\n(\n{\n SinOsc.ar(\n PeakFollower.ar(Dust.ar(20, Line.kr(0, 1, 4)), 0.999) * 1500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// mouse x controls decay, center of the\n(\n{\n var decay;\n decay = MouseX.kr(0.99, 1.00001).min(1.0);\n SinOsc.ar(\n PeakFollower.ar(Dust.ar(20), decay) * 1500 + 200,\n 0, 0.2\n );\n\n}.play;\n);\n\n\n\n\n// follow a sine lfo, decay controlled by mouse x\n(\n{\n var decay;\n decay = MouseX.kr(0, 1.1).min(1.0);\n SinOsc.ar(\n PeakFollower.kr(SinOsc.kr(0.2), decay) * 200 + 500,\n 0, 0.2\n )\n\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is a Buffer, and how is it different from a SoundFile?"}, {"role": "assistant", "content": "A Buffer is server-side memory: an array of samples (or a wavetable) living on scsynth, addressed by an integer bufnum. A SoundFile is a language-side object for reading or writing a file on disk. `Buffer.read(s, path)` loads a sound file into server memory and gives you a Buffer; `SoundFile.openRead(path)` just reads metadata such as duration and sample rate without loading audio. PlayBuf, GrainBuf and BufRd all take a Buffer, never a SoundFile."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `List`."}, {"role": "assistant", "content": "```supercollider\n(\n// Create a new empty List with size: 3\nx = List.new(3);\n\nx.postln; // -> List[ ]\n\n// Add numbers 0 to 4 to the List\n5.do({ |i| x.add(i) });\n\n// The list has been modified in-place with each added item\nx.postln; // -> List[ 0, 1, 2, 3, 4 ]\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Why LeakDC and not a standard HPF for DC removal?"}, {"role": "assistant", "content": "SuperCollider forum — Why LeakDC and not a standard HPF for DC removal?\n\nHello everyone,\n\nI’m a bit sceptical of the DC removal implementation in LeakDC. As I understand it, DC removal is nothing but a HPF, preferably placed below the audible range. For this purpose, LeakDC seems to be reaching far too high, attenuating the audible low frequencies. You can run the following code and look at the server meter to see the difference in level between the two audio channels (note: there is of course no DC offset in this example that would need fixing):\n\n```supercollider\n( play { [\n SinOsc.ar(50),\n LeakDC.ar(SinOsc.ar(50))\n] * 0.2 } )\n```\n\nAlso, LeakDC’s behaviour is not consistent between sample rates (as is mentioned in the help file).\n\nI ran the it through Plugin Doctor to back up my suspicions and got these results:\n\nstandard coefficient of 0.995:\n\nSR 48 kHz: Filter starts rolling off at 200 Hz, -2dB at 50 Hz.\n\nSR 96 kHz: Filter starts rolling off at 500 hz! It reaches already -2dB at 100 Hz, -5 dB at 50 Hz.\n\ncoefficient of 0.999:\n\nSR 48 kHz: Filter starts rolling off at 50 Hz, -2 dB at 10 Hz.\n\nSR 96 kHz: Filter starts rolling off at 100 Hz, -2 dB at 20 Hz.\n\nI wonder why one wouldn’t just use a standard HPF at 10 Hz (or so) instead? It is consistent between sample rates, it only starts to roll of below 30 Hz and it reaches only -0.5 dB at 20 Hz. So this actually looks much better in the server meter:\n\n```supercollider\n( play { [\n SinOsc.ar(50),\n HPF.ar(SinOsc.ar(50), 10)\n] * 0.2 } )\n```\n\nSo my question is: Is there any reason why the LeakDC implementation would be peferable to such a standard butterworth HPF?\n\nOne difference I can see is that the HPF still has an initial offset spike before settling around zero phase, LeakDC does not show that behaviour:\n\n```supercollider\n{ LeakDC.ar(DC.ar(0.5)) }.plot(0.5);\n{ HPF.ar(DC.ar(0.5), 10) }.plot(0.5);\n\n{ LeakDC.ar(SinOsc.ar + DC.ar(0.5)) }.plot(0.02);\n{ HPF.ar(SinOsc.ar + DC.ar(0.5), 10) }.plot(0.02);\n```\n\nSo this could be a reason – I don’t know enough about filters to understand why this happens though. Any enlightenment would be appreciated."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `SoundIn` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\nu = Server(\\scau, NetAddr(\"127.0.0.1\", 9989)); // Change the port from 9989 to the right one for you\nu.serverRunning = true;\nu.ping(10); // Gives about 0.02 for me - confirms that communication is working\n// Now let's create a quick ring-modulator effect:\nz = { SoundIn.ar([0,1]) * SinOsc.ar(MouseX.kr(100, 1000)) }.play(u);\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for Re: Dark sea horns: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\n Ndef(\\x, {\n var output;\n var delayTime;\n var delayMax = 0.2;\n var delayAdd = 0.1;\n var pulseFreq = 0.5;\n var proxyMul = 2;\n var pulseMin = 40;\n var pulseMax = 130;\n var numOfEchos = 2;\n\n var mainPulse = LFPulse.ar(pulseFreq, 0, 0.5).range(pulseMin, pulseMax);\n var proxy = Ndef(\\x).ar * proxyMul;\n var ampModFreq = SinOsc.ar(0.01, 0).range(0.3, 30);\n var ampMod = LFNoise1.ar(ampModFreq, 6);\n output = SinOsc.ar(mainPulse + proxy, 0, ampMod).tanh;\n numOfEchos.do{\n delayTime = {delayMax.rand + delayAdd}!2;\n output = AllpassL.ar(output, 0.1, delayTime, 5);\n };\n output.tanh;\n }).play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Approaches to recording generated midi in DAW?"}, {"role": "assistant", "content": "SuperCollider forum — Approaches to recording generated midi in DAW?\n\nToday I spent another 6 hours or so trying to record in ardour (linux) both the midi information generated by supercollider and the audio generated by sending this midi to external synths. I finally hit the right combination of magic to make it work and I want to add my recipe in this thread so that I can find it back the future (and perhaps it also works for someone else).\n\nIngredient 1: a2jmidid. You can run it manually on the command line using “a2jmidid -e” or (like me) you can just use the “start midi bridge” button in the jack front-end application “Cadence” (enable the “export hardware ports checkbox”)\n\nIngredient 2: In supercollider itself, it is extremely important to only connect to a port and not to specify a destination uid. It seems that by specifying a destination uid, supercollider gets some kind of direct connection to the midi destination and ardour can no long introspect/record what is happening (I know it doesn’t sound scientific - this is purely the result of empiric observation/frustration.\n\nSo in supercollider, simply use\n\n```supercollider\n~synth1 = MIDIOut(0);\n~synth2 = MIDIOut(1);\n```\n\nand then in ardour’s Window->Midi Connections dialog, you can connect the out ports from supercollider to both your external synth and the track in which you want to record the midi information.\n\nFor midi driver in jack you can configure None.\n\nIf you want to record the generated midi in ardour, do NOT use connection syntax like\n\n```supercollider\n~synth1 = MIDIOut(0, MIDIClient.destinations[2].uid);\n```\n\nand do NOT use\n\n```supercollider\n~synth1 = MIDIOut.newByName(\"INTEGRA-7\", \"INTEGRA-7 MIDI 1\");\n```\n\nIf you just want to send midi to the external synth without recording the information, both previous ways of connecting work as well but these ways of connecting appear to work only if the jack MIDI driver is configured to use “ALSA sequencer” mode. It doesn’t seem to work with “None” or “ALSA Raw” (this may need some further investigation to clear out)."}]} +{"conversations": [{"role": "user", "content": "What are you good at?"}, {"role": "assistant", "content": "SuperCollider. I can explain its classes and UGens, write SynthDefs and patches, read a patch back to you, and tell you why one does not compile. I am 198M parameters; I am not a general assistant."}]} +{"conversations": [{"role": "user", "content": "What does `AbstractFunction.sqrt` do?"}, {"role": "assistant", "content": "`a = { |x| x + 1 }; b = a.sqrt; [a.value(1),"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for some kick drums i wrote back in january: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\kick1, {\n var snd;\n snd = DC.ar(0);\n snd = snd + (SinOsc.ar(XLine.ar(800, 400, 0.01)) * Env.perc(0.0005, 0.01).ar);\n snd = snd + (BPF.ar(Hasher.ar(Sweep.ar), XLine.ar(800, 100, 0.01), 0.6) * Env.perc(0.001, 0.02).delay(0.001).ar);\n snd = snd + (SinOsc.ar(XLine.ar(172, 50, 0.01)) * Env.perc(0.0001, 0.3, 1, \\lin).delay(0.005).ar(2));\n snd = snd.tanh;\n Out.ar(\\out.kr(0), Pan2.ar(snd, \\pan.kr(0), \\amp.kr(0.1)));\n}).add;\n);\n\nSynth(\\kick1, [amp: 0.4]);\n\n(\nSynthDef(\\kick2, {\n var snd;\n snd = DC.ar(0);\n snd = snd + (HPF.ar(Hasher.ar(Sweep.ar), 1320) * Env.perc(0.003, 0.03).ar * 0.5);\n snd = snd + (SinOsc.ar(XLine.ar(750, 161, 0.02)) * Env.perc(0.0005, 0.02).ar);\n snd = snd + (SinOsc.ar(XLine.ar(167, 52, 0.04)) * Env.perc(0.0005, 0.3).ar(2));\n snd = snd.tanh;\n Out.ar(\\out.kr(0), Pan2.ar(snd, \\pan.kr(0), \\amp.kr(0.1)));\n}).add;\n);\n\nSynth(\\kick2, [amp: 0.4]);\n\n(\nSynthDef(\\kick3, {\n var snd;\n snd = DC.ar(0);\n snd = snd + (SinOsc.ar(XLine.ar(1500, 800, 0.01)) * Env.perc(0.0005, 0.01, curve: \\lin).ar);\n snd = snd + (BPF.ar(Impulse.ar(0) * SampleRate.ir / 48000, 6100, 1.0) * 3.dbamp);\n snd = snd + (BPF.ar(Hasher.ar(Sweep.ar), 300, 0.9) * Env.perc(0.001, 0.02).ar);\n snd = snd + (SinOsc.ar(XLine.ar(472, 60, 0.045)) * Env.perc(0.0001, 0.3, curve: \\lin).delay(0.005).ar(2));\n snd = snd.tanh;\n Out.ar(\\out.kr(0), Pan2.ar(snd, \\pan.kr(0), \\amp.kr(0.1)));\n}).add;\n);\n\nSynth(\\kick3, [amp: 0.4]);\n\n\n/*\ncontributors so far: nathan ho\n\ni use Hasher.ar(Sweep.ar) as a quick way to generate deterministic white noise, so i can get exactly the same kick each time for a precise digital sampler effect. you are free to replace it with WhiteNoise.ar.\n\nthe DC.ar(0) does nothing, it's just so i can reorder all the \"snd = snd +\" lines and/or comment out parts of the synth.\n\nsome of the attacks are so fast that Env:kr doesn't correctly handle them. that's why i always use Env:ar, so i don't have to think about ar/kr when i'm messing with sharp envelope attacks. i'm sure many of them could be refactored to kr for CPU, but idc\n*/\n```"}]} +{"conversations": [{"role": "user", "content": "Write a random pentatonic melody that plays by itself."}, {"role": "assistant", "content": "Pick degrees from a pentatonic scale; `\\scale` and `\\root` define the pitch space, and `\\degree`\npicks within it.\n\n```supercollider\n(\nPbind(\n \\instrument, \\default,\n \\scale, Scale.minorPentatonic,\n \\root, 3,\n \\degree, Pwhite(0, 9, inf),\n \\octave, 5,\n \\dur, Pwhite(0.12, 0.28, inf),\n \\amp, 0.2,\n \\legato, 0.8\n).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `RangeSlider.hi` do? What arguments does it take?"}, {"role": "assistant", "content": "The high end of the range. If you attempt to set it lower then the current #-lo, -lo will be set instead, and -hi will become the old -lo. When setting -hi the value will always be clipped to the range between 0 and Arguments: A Float between 0 and 1.."}]} +{"conversations": [{"role": "user", "content": "What does `SoundFileView.scroll` do? What arguments does it take?"}, {"role": "assistant", "content": "Scrolls by a fraction of the visible Arguments: A Float.."}]} +{"conversations": [{"role": "user", "content": "What does `SerialPort.listDevices` do?"}, {"role": "assistant", "content": "Prints the list of available devices, one per line. Shorthand for `SerialPort.devices.do(_.postln)`."}]} +{"conversations": [{"role": "user", "content": "Explain `LinLin` in SuperCollider briefly."}, {"role": "assistant", "content": "LinLin — Map a linear range to another linear range Maps a linear range of values to another linear range of values. Category: UGens > Maths."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\ns.boot;\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n Ramp.kr( // lag the modulator\n LFPulse.kr(4, 0, 0.5, 50, 400), // frequency modulator\n Line.kr(0, 1, 15) // modulate lag time\n ),\n 0, // phase\n 0.3 // sine amplitude\n )\n}.scope;\n);\n\n// Compare\n(\nvar pulse;\n{\n pulse = LFPulse.kr(8.772);\n Out.kr(0, [Ramp.kr(pulse, 0.025), Lag.kr(pulse, 0.025), pulse]);\n}.play;\ns.scope(3, bufsize: 4\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\ns.boot;\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n Ramp.kr( // lag the modulator\n LFPulse.kr(4, 0, 0.5, 50, 400), // frequency modulator\n Line.kr(0, 1, 15) // modulate lag time\n ),\n 0, // phase\n 0.3 // sine amplitude\n )\n}.scope;\n);\n\n// Compare\n(\nvar pulse;\n{\n pulse = LFPulse.kr(8.772);\n Out.kr(0, [Ramp.kr(pulse, 0.025), Lag.kr(pulse, 0.025), pulse]);\n}.play;\ns.scope(3, bufsize: 44100, rate: \\control, zoom: 40);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `FoaTumble.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "First Order Ambisonic (FOA) rotation transformer Arguments: in — The B-format signal, an array: [w, x, y, z]; angle — Rotation angle, in radians.; mul — Output will be multiplied by this value.; add — This value will be added to the output.."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Pgtpar` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n// synthdef\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n}).add;\n);\n\n// pattern with different start times\n(\nx = Pbind(\n \\instrument, \\help_sinegrain,\n \\degree, Pseq(#[0, 5, 4, 2, 1, 1, 3], inf),\n \\dur, Pseq(#[0.25, 0.5, 1.0], inf),\n \\scale, #[0, 3, 5, 9, 10]\n);\na = Pbus(Pgtpar([0.0, x, 1.5, x, 2.25, x])).play;\n);\ns.plotTree;\na.stop;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `SampleGui` in SuperCollider?"}, {"role": "assistant", "content": "SampleGui — gui class Category: Libraries > crucial > GuiClasses."}]} {"conversations": [{"role": "user", "content": "What does `UGen.name` do?"}, {"role": "assistant", "content": "Abstract superclass of all unit generators Returns: The Class name of the receiver as a String."}]} -{"conversations": [{"role": "user", "content": "Write a closed hi-hat in SuperCollider."}, {"role": "assistant", "content": "High-passed noise with a very short envelope — the filter is what makes it a hat rather than a hiss.\n\n```supercollider\n(\nSynthDef(\\hat, { |out = 0, amp = 0.3, dur = 0.06|\n var env = EnvGen.kr(Env.perc(0.001, dur, 1, -6), doneAction: 2);\n Out.ar(out, Pan2.ar(HPF.ar(WhiteNoise.ar, 7000) * env * amp));\n}).add;\n);\nSynth(\\hat, [\\dur, 0.04]);\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BufSampleRate`."}, {"role": "assistant", "content": "```supercollider\nb = Buffer.read(s, ExampleFiles.child);\n\n// compares a 1102.5 Hz sine tone (11025 * 0.1, left) with a 1100 Hz tone (right)\n// the apollo sample has a sample rate of 11.025 kHz\n(\n{\n var freq;\n freq = [BufSampleRate.kr(b) * 0.1, 1100];\n SinOsc.ar(freq, 0, 0.1)\n}.play;\n);\n\nb.free;\n```"}]} -{"conversations": [{"role": "user", "content": "What is the difference between an audio bus and a control bus?"}, {"role": "assistant", "content": "Both are numbered channels on the server used to move signal between nodes. An audio bus carries audio-rate signal and holds one or more audio channels; a control bus carries one value per block, like a parameter. You write with Out.ar / Out.kr and read with In.ar / In.kr, or with `.asMap` / `\\param, bus.asMap` to drive a Synth's control from a bus. Buses are how effects are chained: a synth writes to a private bus, the effect reads it and writes to Out.ar(0, …)."}]} -{"conversations": [{"role": "user", "content": "Explain `LFNoise0` in SuperCollider briefly."}, {"role": "assistant", "content": "LFNoise0 — Step noise Generates random values at a rate given by the nearest integer division of the sample rate by the `freq` argument. Category: UGens > Generators > Stochastic."}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for algorithmic/aleatoric composition for mallets and proxy patterns."}, {"role": "assistant", "content": "```supercollider\n/*\"Musical Toys For Little Robots\"\n\n or\n\n \"How I learned to stop worrying and love the proxy\"\n\nhttp://soundcloud.com/unknown-artist-6/musical-toys-for-little-robots\n\n */\n\n~fx=Bus.audio(s,2);\n\n(\nSynthDef(\\mallet,{arg in=0,out=0,m=48,a=1,r=1,p=0;\n\n var sig=Array.fill(3,{|n| SinOsc.ar(m.midicps+(n*0.01),mul:a*0.3)}).sum;\n var env=EnvGen.kr(Env.perc(0.001,r),gate:1,doneAction:2);\n\n Out.ar(out,Pan2.ar(sig*env,pos:p));\n};\n).add;\n\nSynthDef(\\rev,{arg in=0,out=0;\n var sig=In.ar(in,2);\n sig=sig*0.8+CombC.ar(sig,0.5,0.3,0.5,0.2);\n Out.ar(out,sig)\n };\n).add;\n);\n\nSynth(\\rev,[\\in:~fx]);\n\n\n(\nfork{\n var degrees=Prand([0,4,5,7,9,12],inf).asStream;\n var root=[36,48,60,72];\n var x;\n x=Array.new;\n a=PatternProxy(Pseq([0+root.wchoose([0.3,0.4,0.2,0.1])],inf));\n d=1/8;\n\n ~streams=[];\n ~names={|pbind| ~streams=~streams++pbind.play(quant:1)};\n\n ~names.value(Pbind(*[\\instrument:\\mallet,\n \\m:a,\n \\dur:d,\n \\a:{rrand(0.4,1)*0.05},\n \\p:{rrand(-0.2,0.2)},\n \\r:{rrand(0.5,0.8)},\n \\out:~fx\n ]));\n\n\n 20.do({|n|\n x=x.add(degrees.next+root.wchoose([0.3,0.4,0.2,0.1]));\n x.postln;\n a.source=Pseq(x.scramble,inf);\n if ((n+1) % 6 == 0,{~names.value(Pbind(*[\\instrument:\\mallet,\n \\m:Pcollect({arg inval;inval-[-24,12].choose},a),\n \\dur:d,\n \\a:{rrand(0.4,1)*0.05/(n+1)},\n \\p:{rrand(-0.2,0.2)},\n \\r:{rrand(0.5,0.8)},\n \\out:~fx\n ]));\"new stream\".postln});\n (n+1).wait});\n\n 19.do({|n|\n x.removeAt(0);\n x.postln;\n a.source=Pseq(x.scramble,inf);\n (19-(n+1)).wait;});\n4.wait;\n ~streams.do{|n| n.stop;2.wait};\n}\n)\n```"}]} -{"conversations": [{"role": "user", "content": "What does `RangeSlider.range` do?"}, {"role": "assistant", "content": "The difference between #-hi and #-lo. Setting -range will set -hi to -lo +"}]} -{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for gabber kick (a SuperCollider snippet)."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\gabberkick, {\n var snd;\n snd = SinOsc.ar(Env([1000, 69, 60], [0.015, 0.1], \\exp).ar * [-0.1, 0, 0.1].midiratio);\n snd = Mix(snd);\n snd = (snd * 10).tanh;\n snd = (snd * 5.1).atan;\n snd = BPeakEQ.ar(snd, XLine.kr(2000, 100, 0.3), 2.0, 8);\n snd = snd + DelayC.ar(snd, 0.01, SinOsc.ar(4).range(0.0, 0.001));\n snd = RLPF.ar(snd, 8000, 0.7);\n snd = snd * Env([0, 1, 0.7, 0.7, 0], [0.001, 0.01, 0.3, 0.02]).ar(2);\n snd = (snd * 0.6).clip(-1, 1);\n Out.ar(\\out.kr(0), Pan2.ar(snd, \\pan.kr(0), \\amp.kr(0.1)));\n}).add;\n);\n\nSynth(\\gabberkick, [amp: 0.6])\n```"}]} -{"conversations": [{"role": "user", "content": "What does `SequenceableCollection.editDistance` do? What arguments does it take?"}, {"role": "assistant", "content": "Returns the minimum number of changes to modify this `SequenceableCollection` into the other `SequenceableCollection`. A change can be: an addition, a deletion, or a substitution. This is known as the Levenshtein Distance and is implemented in SuperCollider using the Wagner–Fischer algorithm. The default comparison uses identity - see Object#-== and Object#-=== Where both arrays are raw arrays (String, Int16Array, Int32Array, FloatArray etc., or any derived classes), like Arguments: other — The `SequenceableCollection` to compare against; compareFunc — An optional comparison function to use for each element. It will be provided two arguments, and the function must return a boolean as to whether or not they are the same. Default value is `nil`, which will use identity (not equality) to compare elements. `[1, 2, 3, 4].editDistance([2, 3, 4, 5], { |a."}]} -{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nc=13;a=Array.fib(64,0,1);b=Array.fill(size:c,function:{arg i;a[i]%12});\np=1/(21-c);Pdef(\\x,Pbind(\\dur,p,\\degree,Pseq(b,1,0)));\nr=Array.fill(c,{arg i;Pbindf(Pdef(\\x),\\mtranspose,1-b[i]);});\nPseq(r,(1/p)).play;\n)\n```"}, {"role": "assistant", "content": "Wow ! the conciseness of SuperCollider is wonderful !\r\nWe can make many attractive melodies !."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LazyEnvir`."}, {"role": "assistant", "content": "```supercollider\ne = LazyEnvir.new;\ne.use { ~x = ~y + ~z };\ne.at(\\x);\ne.at(\\x).source; // the source is a binary operation (addition on the placeholders)\ne.use { ~y = 5; ~z = 7 };\ne.at(\\x).value; // the value is 12\n```"}]} -{"conversations": [{"role": "user", "content": "Show me a SuperCollider patch for julian rohrhuber (c 2007)."}, {"role": "assistant", "content": "```supercollider\n// julian rohrhuber (c 2007)\n\n(\nSynthDef(\"deepsea\", { arg out, pan=0, amp=0.1, variation=0.9;\n var dt, n, freq, mul, t, u;\n n = Rand(7, 46);\n dt = 25.0 + Rand(-1.7, 1.7);\n dt = dt + LFNoise2.kr(2, variation) * 0.001;\n freq = 901 + Rand(0, 65);\n t = Impulse.ar(dt.reciprocal, 0, 100);\n mul = PulseCount.ar(t) < n;\n u = BPF.ar(mul * t, freq, 0.1);\n u = BPF.ar(u, freq, 0.2);\n DetectSilence.ar(u, doneAction:2);\n Out.ar(out, Pan2.ar(u, pan, amp));\n}).add;\n);\n\n(\nSynthDef(\"deepsea\", { arg out, pan=0, amp=0.1, variation=0.9;\n var dt, n, freq, mul, t, u, count;\n n = Rand(7, 46);\n dt = 25.0 + Rand(-1.7, 1.7);\n dt = dt + LFNoise2.kr(2, variation) * 0.001;\n freq = 901 + Rand(0, 65);\n t = Impulse.ar(dt.reciprocal, 0, 100);\n count = PulseCount.ar(t);\n mul = count < n;\n u = BPF.ar(mul * t, freq, 0.1);\n u = BPF.ar(u, freq * (count % LFNoise1.kr(1).range(2, 20) + 1), 0.2);\n DetectSilence.ar(u, doneAction:2);\n Out.ar(out, Pan2.ar(u, pan, amp * 10));\n}).add;\n);\n\n\n\ns.sendMsg(\"/s_new\", \"deepsea\", -1);\n\n\np = ProxySpace.push(s.boot);\n\n~out.play;\n~out.fadeTime = 10;\n\n(\n~fish = Pbind(\n \\instrument, \\deepsea,\n \\dur, Pfunc #{ rrand(9.0, 2.0) },\n \\pan, Pfunc #{ 1.0.rand2 }\n );\n);\n\n~out = ~fish;\n~out[1] = \\filter -> #{ arg in; BPF.ar(in * 5, 700, 0.1) };\n\n(\n~out[2] = \\filter -> #{ arg in;\n CombL.ar(LPF.ar(in * LFNoise1.kr(0.1).max(0), 800), 0.5, 0.5) + in.reverse\n};\n);\n\n(\n~out[3] = \\filter -> #{ arg in; var x; x = in;\n 5.do { x = AllpassN.ar(x, 0.18, {0.06.rand} ! 2 + 0.06, 8) };\n LPF.ar(x + in, 400) + (LFNoise1.kr(0.2) * in)\n };\n\n);\n\n\n\n~out[1] = nil;\n~out[2] = nil;\n\n\np.clear(10).pop;\n```"}]} -{"conversations": [{"role": "user", "content": "What does `LastValue.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Output the last value before the input changed Arguments: in — The input signal.; diff — Difference threshold.."}]} -{"conversations": [{"role": "user", "content": "What does `Tempo.destroy` do?"}, {"role": "assistant", "content": "for control of tempo and for use in tempo based calculations"}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Pn advances Pgate each time its subpattern is repeated\n(\nPbind(\n \\degree, Pn(Pseq((0..7)), inf, \\step),\n \\mtranspose, Pgate(Pwhite(0, 5), inf, \\step),\n \\dur, 0.2\n).play\n);\n\n\n// Two different Pgates advanced at two different rates\n(\nPbind(\n\n \\scale, Scale.minor,\n \\foo, Pn(Pseq((0..2)), inf, \\step1),\n \\degree, Pn(Pseq((0..7).mirror), inf, \\step),\n \\ctranspose, Pgate(Pwhite(0, 5), inf, \\step) + Pgate(Pseq([0, 7, 0, -7], inf), inf, \\step1),\n \\dur, 0.\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Pn advances Pgate each time its subpattern is repeated\n(\nPbind(\n \\degree, Pn(Pseq((0..7)), inf, \\step),\n \\mtranspose, Pgate(Pwhite(0, 5), inf, \\step),\n \\dur, 0.2\n).play\n);\n\n\n// Two different Pgates advanced at two different rates\n(\nPbind(\n\n \\scale, Scale.minor,\n \\foo, Pn(Pseq((0..2)), inf, \\step1),\n \\degree, Pn(Pseq((0..7).mirror), inf, \\step),\n \\ctranspose, Pgate(Pwhite(0, 5), inf, \\step) + Pgate(Pseq([0, 7, 0, -7], inf), inf, \\step1),\n \\dur, 0.2\n).play\n)\n```"}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LorenzL`."}, {"role": "assistant", "content": "```supercollider\n// vary frequency\n{ LorenzL.ar(MouseX.kr(20, SampleRate.ir)) * 0.3 }.play(s);\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `SendTrig` in SuperCollider briefly."}, {"role": "assistant", "content": "SendTrig — Send a trigger message from the server back to the client. On receiving a trigger (a non-positive to positive transition), send a trigger message from the server back to the client. Category: UGens > Triggers."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n//Define piano synthdef and soundboard\n(\nSynthDef(\\help_oteypianostring, { |out=0, freq=440,gate=1, amp=0.5,rho=1|\n var son = OteyPianoStrings.ar(freq, amp, rho:rho)*EnvGen.ar(Env.asr(0,1,0.1),gate,doneAction:2);\n Out.ar(out, Pan2.ar(son * 1, LinLin.kr(freq,36.midicps,90.midicps,-0.75,0.75)));\n}).add;\n\nSynthDef(\\piano_soundboard,{\n var audio = In.ar([20, 21], 2);\n audio = Otey\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n//Define piano synthdef and soundboard\n(\nSynthDef(\\help_oteypianostring, { |out=0, freq=440,gate=1, amp=0.5,rho=1|\n var son = OteyPianoStrings.ar(freq, amp, rho:rho)*EnvGen.ar(Env.asr(0,1,0.1),gate,doneAction:2);\n Out.ar(out, Pan2.ar(son * 1, LinLin.kr(freq,36.midicps,90.midicps,-0.75,0.75)));\n}).add;\n\nSynthDef(\\piano_soundboard,{\n var audio = In.ar([20, 21], 2);\n audio = OteySoundBoard.ar(audio);\n Out.ar(0,audio);\n}).add\n);\n\n//start soundboard effect\nSynth.tail(1,\\piano_soundboard);\n\n//Use it.\n(\nPbind(\n \\instrument, \\help_oteypianostring,\n \\delta, 1,\n \\dur, 3,\n \\degree, Pseq([1,3,5], inf),\n \\out, 20,\n).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// turn on and off a sine oscillator\n\n(\nSynthDef(\"help-DigitalIn\", { |out = 0|\n Out.ar(out,\n SinOsc.ar(500, 0, 0.1 * DigitalIn.ar(0))\n )\n}).play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// turn on and off a sine oscillator\n\n(\nSynthDef(\"help-DigitalIn\", { |out = 0|\n Out.ar(out,\n SinOsc.ar(500, 0, 0.1 * DigitalIn.ar(0))\n )\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{SinOsc.ar(Summer.kr(Impulse.kr(5), 1.5, 0, 0).poll * 100, 0, 0.1)}.play;\n\n(\n{\n var trig = Dust.kr(5);\n var reset = Impulse.kr(0.5);\n SinOsc.ar(Summer.kr(trig, [0.5, 0.25], reset, 1) * 100, 0, 0.1)\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{SinOsc.ar(Summer.kr(Impulse.kr(5), 1.5, 0, 0).poll * 100, 0, 0.1)}.play;\n\n(\n{\n var trig = Dust.kr(5);\n var reset = Impulse.kr(0.5);\n SinOsc.ar(Summer.kr(trig, [0.5, 0.25], reset, 1) * 100, 0, 0.1)\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `InstrSynthDef.loadDefFileToBundle` do? What arguments does it take?"}, {"role": "assistant", "content": "Extends SynthDef enabling the extra capabilities of Instr with Patch Arguments: def; bundle; server."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// default initial params\n{ GbmanN.ar(MouseX.kr(20, SampleRate.ir)) * 0.1 }.play(s);\n\n// change initial params\n{ GbmanN.ar(MouseX.kr(20, SampleRate.ir), -0.7, -2.7) * 0.1 }.play(s);\n\n// wait for it...\n{ GbmanN.ar(MouseX.kr(20, SampleRate.ir), 1.2, 2.0002) * 0.1 }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(GbmanN.ar(40)*400+500)*0.4 }.play(s;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// default initial params\n{ GbmanN.ar(MouseX.kr(20, SampleRate.ir)) * 0.1 }.play(s);\n\n// change initial params\n{ GbmanN.ar(MouseX.kr(20, SampleRate.ir), -0.7, -2.7) * 0.1 }.play(s);\n\n// wait for it...\n{ GbmanN.ar(MouseX.kr(20, SampleRate.ir), 1.2, 2.0002) * 0.1 }.play(s);\n\n// as a frequency control\n{ SinOsc.ar(GbmanN.ar(40)*400+500)*0.4 }.play(s);\n```"}]} {"conversations": [{"role": "user", "content": "Why does every UGen have mul and add arguments?"}, {"role": "assistant", "content": "They are a convenience applied to the UGen's output: the result is `ugens_result * mul + add`. So `SinOsc.ar(440, 0, 0.2)` is the same as `SinOsc.ar(440) * 0.2`, and `SinOsc.ar(440, 0, 0.5, 1800)` is usable directly as a frequency. They exist because multiplying and offsetting is so common that folding it into the UGen saves a node in the graph and a line in the source."}]} -{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `SerialPort`."}, {"role": "assistant", "content": "```supercollider\n(\np = SerialPort(\n \"/dev/tty.usbserial-A800crTT\", // edit to match your port. SerialPort.listDevices\n baudrate: 9600, // check that baudrate is the same as in arduino sketch\n crtscts: true);\n);\n\n// read 10bit serial data sent from Arduino's Serial.println\n(\nr = Routine({\n var byte, str, res;\n 99999.do{ |i|\n if(p.read == 10, {\n str = \"\";\n while({ byte = p.read; byte != 13 }, {\n str = str++byte.asAscii;\n });\n res = str.asInteger;\n (\"read value:\"+res).postln;\n });\n };\n}).play;\n);\n\nr.stop;\np.close;\n```"}]} -{"conversations": [{"role": "user", "content": "Explain `DetaBlockerBuf` in SuperCollider briefly."}, {"role": "assistant", "content": "DetaBlockerBuf — Demand version of the BetaBlocker VChip Demand Rate BetaBlocker UGen with a heap possibly shared with other instances. For every trigger, it computes one step of the underlying BetaBlocker engine and then returns the stack's top element. Category: UGens > Demand."}]} -{"conversations": [{"role": "user", "content": "How do I distort a signal?"}, {"role": "assistant", "content": "Drive it into a nonlinearity, then tame the level: `tanh` is soft clipping, `.distort` is harder,\nand a low-pass after the drive keeps it from getting fizzy.\n\n```supercollider\n(\n{\n var sig = SinOsc.ar(110) * 0.3;\n var driven = (sig * 12).tanh;\n LPF.ar(driven, 5000) * 0.4\n}.play;\n)\n```\n\nMore drive means more harmonics; because they are generated, the output is louder as well as brighter, so\nscale the result down after the nonlinearity."}]} -{"conversations": [{"role": "user", "content": "Explain `NAryOpStream` in SuperCollider briefly."}, {"role": "assistant", "content": "NAryOpStream — several streams combined by an n-ary operator A NAryOpStream is created as a result of a n-ary math operation on a Stream. It is defined to respond to next by returning the result of the math operation on the next value from the stream. It responds to reset by resetting the Stream. Category: Streams-Patterns-Events."}]} -{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Impulse`."}, {"role": "assistant", "content": "```supercollider\n{ Impulse.ar(800, 0.0, 0.5, 0) }.play\n\n{ Impulse.ar(XLine.kr(800, 100, 5), 0.0, 0.5, 0) }.play\n```"}]} -{"conversations": [{"role": "user", "content": "Who are you?"}, {"role": "assistant", "content": "I am sc-mind, a 198M MiniMind-3-MoE trained from scratch on the SuperCollider source and help corpus. I write and explain SuperCollider: SynthDefs, UGens, Patterns, Ndef, the language/server split, and how to make sound that is not silence."}]} -{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n//run one line at a time\nf= BBCutBuffer(Platform.resourceDir +/+ \"sounds/break.aiff\",8);\n\nPost << [\\length,f.length, \\beatlength, f.beatlength, \\events, f.eventstarts] << nl;\n\n\nf= BBCutBuffer.array([Platform.resourceDir +/+ \"sounds/break.aiff\",Platform.resourceDir +/+ \"sounds/break2.aiff\"],[8,4],[[0,10000],[3500,6700,9000]]);\n\nf.do({ arg val; Post << [\\length,val.length, \\beatlength, val.beatlength, \\events, val.eventstarts] << nl;\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n//run one line at a time\nf= BBCutBuffer(Platform.resourceDir +/+ \"sounds/break.aiff\",8);\n\nPost << [\\length,f.length, \\beatlength, f.beatlength, \\events, f.eventstarts] << nl;\n\n\nf= BBCutBuffer.array([Platform.resourceDir +/+ \"sounds/break.aiff\",Platform.resourceDir +/+ \"sounds/break2.aiff\"],[8,4],[[0,10000],[3500,6700,9000]]);\n\nf.do({ arg val; Post << [\\length,val.length, \\beatlength, val.beatlength, \\events, val.eventstarts] << nl;});\n\n\n//will only select playback positions from the events list given above, using an offset choice function\n(\nBBCut2(CutGroup([CutBuf1(f[1],{arg buffer; buffer.eventstarts.choose}), CutBPF1(1000,drqfunc:0.5)]), ChooseCutProc(0.125,4)).play(2)\n);\n\n//change the event positions allowed\nf[1].events_([10000,20000,40000]);\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n// timing offset = 0\np = Pbind(\\freq, 440, \\pan, -1, \\delta, 1.0, \\sustain, 0.1).play(quant: [2, 0, 0]);\n// timing offest = 0.1\nq = Pbind(\\freq, 880, \\pan, 1, \\delta, 0.5, \\sustain, 0.1).play(quant: [2, 0, 0.1]);\n);\n\n// p's nextBeat is x.0 - q's is x.4 or x.9 (e.g., halves of a beat minus 0.1)\n[p.nextBeat, q.nextBeat]\n\np.stop; q.stop;\n```"}, {"role": "assistant", "content": "timing offest = 0.1 p's nextBeat is x.0 - q's is x.4 or x.9 (e.g., halves of a beat minus 0.1) (Quant: encapsulate quantization issues associated with EventStreamPlayer and TempoClock)"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Saw`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\n SynthDef(\\controlList, { |out = 0, freq = 440, amp = 0.1, detune = #[0.999, 1.001], gate = 1|\n var sig = Mix(Saw.ar(freq * (detune ++ [1]), amp)),\n env = EnvGen.kr(Env.adsr, gate, doneAction: Done.freeSelf);\n Out.ar(out, (sig * env) ! 2);\n }).add;\n\n SynthDescLib.global[\\controlList]\n )\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SDrone.set` do? What arguments does it take?"}, {"role": "assistant", "content": "set parameters for all internal nodes and save them in the arguments Arguments: ... args — an LINKClasses/Array with key/value pairs. can also be a single key/value pair.."}]} +{"conversations": [{"role": "user", "content": "How to generate paradiddles?"}, {"role": "assistant", "content": "SuperCollider forum — How to generate paradiddles?\n\nHi Rodet, I’m teaching jazz at college, and sometimes paradiddles come up in conversation (although I’m not a drummer). A paradiddle is basically a way of ‘evenly’ playing a roll (single/double/triple/whatever). If you take your drumsticks/fingers and play evenly:\n\nright, left, right, right, left, right, left, left, right, left, right, right, etc\n\nyou’ll notice that it’s possible to get an even rhythm, which when played fast becomes a roll. The idea of the single/double/triple is just to place the accents (lightly, or not) on the left, right hand, which if I understand helps keep an even stroke (and makes better sense to follow).\n\nSo, although I don’t know the goal of your idea, a simple code which would give you the solution could be a pattern. You’ll notice I’ve put in a SynthDef to give the ‘snare’ sound - not very real, but just for the demonstration. If you run these patterns, un-commenting the line needed (single, double or triple - don’t forget to comment out the lines you don’t need), you’ll hear the accents a paradiddle gives.\n\nIn this example Pbind ‘a’ gives the pulse, and Pbind ‘b’ the accents. And, if you play along with them (using your chart), you’ll notice the accents pass from right hand to left hand (or vice versa). This is (more or less) what paradiddles do, although a drummer will explain better how they ‘accent’ strokes to get more complicated/subtle rhythms.\n\n```supercollider\n(\nSynthDef(\\snare, {\n arg out=0, sus=0.1;\n var sig, env;\n sig = WhiteNoise.ar(0.1);\n env = EnvGen.kr(Env.perc(0.001, sus), doneAction:2);\n sig = sig*env;\n Out.ar(out, sig!2);\n}).add;\n);\n\n(\nt=TempoClock(80/60);\na=Pbind(\n \\instrument, \\snare,\n \\dur, 1/2,\n \\sus, 0.01\n);\nb=Pbind(\n \\instrument, \\snare,\n \\dur, 1,\n \\sus, Pseq([0.02, 0.01],inf), // single\n //\\sus, Pseq([0.02, 0.01, 0.01],inf), // double\n //\\sus, Pseq([0.02, 0.01, 0.01, 0.01],inf), // triple\n);\nPpar([a, b]).play(t);\n)\n```\n\nI hope that puts you on the right track.\n\np.s. Don’t forget to try out changing the speed to get the real effect. Try something like 320/60 on the TempoClock."}]} +{"conversations": [{"role": "user", "content": "Explain `CircleRamp` in SuperCollider briefly."}, {"role": "assistant", "content": "CircleRamp — circular linear lag This is just like Ramp, but always takes the shortest way around a defined circle, wrapping values where appropriate. This can be useful when smoothing panning signals for speaker rings, for instance in Vector Base Amplitude Panning. Category: UGens > Filters > Linear."}]} +{"conversations": [{"role": "user", "content": "Explain `MassEditU` in SuperCollider briefly."}, {"role": "assistant", "content": "MassEditU — Edit multiple units simultaneously. Mimicks a real U, but in fact edits multiple instances of U. Category: UnitLib."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// mixer parametric eq as wahwah\n{ MidEQ.ar(Saw.ar(200, 0.2), FSinOsc.kr(1, 0, 24, 84).midicps, 0.3, 12) }.play\n\n\n// notch filter\n(\n{ var in;\n in = PinkNoise.ar(0.2) + SinOsc.ar(600, 0, 0.1);\n MidEQ.ar(in, SinOsc.kr(0.2, 0.5pi) * 2 + 600, 0.01, -24)\n}.play\n);\n\n/////\n// first start the synth\n(\nx = { |freq = 400, db = 0, rq = 0.1|\n var in;\n in = SinOsc.ar([400, 420], 0, 0.4);\n MidEQ.ar(in, freq\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// mixer parametric eq as wahwah\n{ MidEQ.ar(Saw.ar(200, 0.2), FSinOsc.kr(1, 0, 24, 84).midicps, 0.3, 12) }.play\n\n\n// notch filter\n(\n{ var in;\n in = PinkNoise.ar(0.2) + SinOsc.ar(600, 0, 0.1);\n MidEQ.ar(in, SinOsc.kr(0.2, 0.5pi) * 2 + 600, 0.01, -24)\n}.play\n);\n\n/////\n// first start the synth\n(\nx = { |freq = 400, db = 0, rq = 0.1|\n var in;\n in = SinOsc.ar([400, 420], 0, 0.4);\n MidEQ.ar(in, freq, Lag.kr(rq, 0.3), db)\n }.play\n);\n\n// now play with its parameters to hear how the filter affects two frequencies\n// that are very close to each other\n\nx.set(\\db, -12)\nx.set(\\rq, 0.1)\nx.set(\\rq, 0.03)\nx.set(\\freq, 410)\nx.set(\\freq, 420)\nx.set(\\freq, 400)\nx.set(\\freq, 500)\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `BusPlug`."}, {"role": "assistant", "content": "```supercollider\nb = BusPlug.new;\n{ Blip.ar(b + 5) }.play;\nb.bus.set(12);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `ServerLog.filterByBus` do? What arguments does it take?"}, {"role": "assistant", "content": "records OSC traffic to and from a Server and displays this in a browseable searchable interface Arguments: index; rate. Returns: (returnvalue)"}]} +{"conversations": [{"role": "user", "content": "Explain `ChaosGen` in SuperCollider briefly."}, {"role": "assistant", "content": "ChaosGen — UGens that cause chaos \"ChaosGen\" is an abstract class - in other words, a class that you do not use directly. Instead, use one of its subclasses. Various things inherit from this abstract class, including HenonN, LinCongL, LatoocarfianL, GbmanL, CuspL, StandardL, and more. Category: UGens > Generators > Chaotic."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Convolution2L`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// one last example\n(\nb = Buffer.alloc(s, 512, 1);\nb.sine1(1.0/[1, 2, 3, 4, 5, 6], true, true, true);\n);\n\n(\n{\n var input = SoundIn.ar(0);\n var framesize = 512;\n Convolution2L.ar(input, b, 0, framesize, 1, 0.5);\n}.play\n);\n\nb.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `MultiTap`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\nb = Buffer.alloc(s, s.sampleRate);\n(\n{\n MultiTap.ar(`[0.1, 0.2, 0.3, 0.4], `[0.1, 0.2, 0.4, 0.8],\n Decay.ar(Dust.ar(2), 0.1, PinkNoise.ar), bufnum: b.bufnum)\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\ns.boot;\nNdef(\\a).ar;\nNdef(\\k).kr;\n\n // make a MonitorGui with all bells and whistles\nm = MonitorGui.new(bounds: 500@40, options: [\\name, \\level, \\fade]);\n\n // when it has a kr proxy, it is visible, but disabled\nm.object_(Ndef(\\k));\n // with an ar proxy, it is enabled\nm.object_(Ndef(\\a));\n\n\n // show its play state\nNdef(\\a).play\n // and volume\nNdef(\\a).vol_(0.25);\n\n // NOTE: shift-clicking the play button opens a playN dialog!\n\nNdef(\\a).stop;\nNdef(\\a).play(0);\n```"}, {"role": "assistant", "content": "make a MonitorGui with all bells and whistles when it has a kr proxy, it is visible, but disabled (MonitorGui: display and control a Monitor)"}]} +{"conversations": [{"role": "user", "content": "What does `ServerOptions.zeroConf` do?"}, {"role": "assistant", "content": "A Boolean indication whether or not the server should publish its port using zero configuration networking, to facilitate network interaction. This is true by default; if you find unacceptable delays (beachballing) upon server boot, you can try setting this to"}]} +{"conversations": [{"role": "user", "content": "What does `Synth.basicNew` do? What arguments does it take?"}, {"role": "assistant", "content": "Create and return a Synth object without creating a synth node on the Arguments: defName — A String or Symbol specifying the name of the SynthDef to use in creating the Synth.; server — An optional instance of Server. If nil this will default to the default Server.; nodeID — An optional node ID number. If not supplied one will be generated by the Server's NodeIDAllocator. Normally you should not need to supply an ID.."}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Bus`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\nb = Bus(\\audio, 0, 2);\ns.bind {\n SynthDef(\\sinPerc, { |out = 0|\n var signal = SinOsc.ar * Env.sine(0.1).ar(gate: Impulse.ar(2));\n OffsetOut.ar(out, signal ! 2) }\n ).add;\n s.sync;\n Synth(\\sinPerc, [\\out, b]);\n b.plot(1);\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for seeking an Array!: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(// * //watch the postWindow\na=[\"m\",\"x\",\"f\",\"k\",\"d\",\"p\"];\nx=Array;\ny=x.newClear(6);\n~mxfkdp=Task({\n inf.do({y.put(x.series(6,0,1).choose,a.scramble).postln;\n 0.03.wait;})}).play;\nm=fork({inf.do({\n \"array num:\".postcln;\n if(y[x.series(6,0,1).choose.postcln]==a,\n {\"lo encontraste!/found it!\".postcln;\n 1.do({GVerb.ar(\n EnvGen.ar(Env.perc(0.01,8),1,doneAction:2)*\n Blip.ar(XLine.kr(440,1600,8)),50,10,0.02)}.play);\n ~mxfkdp.stop;\n m.stop;}, \n {\"buscando.../seeking...\".postcln;});\n 0.03.wait})});\n);\n//.SCtweetLong\n```"}]} +{"conversations": [{"role": "user", "content": "What does `KeyResponder.register` do? What arguments does it take?"}, {"role": "assistant", "content": "combines KeyCodeResponder and UnicodeResponder Arguments: key; shift; caps; opt; cntl; function; description."}]} +{"conversations": [{"role": "user", "content": "Explain `NoteOffResponder` in SuperCollider briefly."}, {"role": "assistant", "content": "NoteOffResponder — allow functions to be registered to respond to MIDI noteOff events Category: External Control > MIDI."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nb = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n\n(\n{\n var snd, envTime, knee, out;\n snd = PlayBuf.ar(1, b, BufRateScale.kr(b), loop: 1);\n envTime = MouseX.kr(1.0e-3, 0.1e-3);\n knee = MouseY.kr(0, -90).dbamp;\n out = DelayC.ar(snd, 0.01, envTime * 0.5) * EnvFollow.ar(snd, 1 - (envTime * SampleRate.ir).reciprocal).max(knee).reciprocal;\n out * 0.1!2\n}.play;\n)\n```"}, {"role": "assistant", "content": "a replication of the legendary LADSPA plugin of the same name, originally written by steve harris. a compressor with a super fast attack which results in harsh distortion fx. requires sc3-plugins."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\ns = Server.local;\nServer.default = s;\ns.boot;\n);\n \n \n// definition for future reference in arbitrary Environments\n\n(\np = Pbind(\n \\midinote, PLnaryFunc(\\f, \\src, [\\dev]),\n \\dur, 0.1\n);\n);\n\n\n// define Environment and play\n\n(\ne = (f: { |x,y| x + y }, src: PLseq([61, 62]), dev: Pbrown(-5, 5, 0.2) );\n\ne.use { x = p.play };\n);\n\n\n// replace Function input Patterns\n\ne.dev = PLseq((0, 0.5..7));\n\ne.src = PLseq([61,64,6\n// …\n```"}, {"role": "assistant", "content": "definition for future reference in arbitrary Environments define Environment and play (PLnaryFunc: dynamic scope PnaryFunc variant)"}]} +{"conversations": [{"role": "user", "content": "Strange offset behaviour when plotting some .kr uGens?"}, {"role": "assistant", "content": "SuperCollider forum — Strange offset behaviour when plotting some .kr uGens\n\nI’ve got a workaround for this now.\n\n```supercollider\ns.quit;\nServer.local.options.blockSize = 4;\ns.boot;\n\n{[\n LFTri.ar(s.sampleRate/2, 1, 2), // just to show where the samples are\n Impulse.ar(0), // audio rate impulse in correct place\n Impulse.kr(0), // control rate impulse with offset issue\n Trig1.kr(1, 0) // control rate impulse in correct place\n]}.plot(70/s.sampleRate);\n\n{[\n LFTri.ar(s.sampleRate/2, 1, 2), // just to show where the samples are\n Phasor.ar(Impulse.ar(0), 1/8, -2, 2, -0.625), // Phasor as it behaves in audio rate\n Phasor.kr(Impulse.kr(0), 1/2, -2, 2, -0.625), // Phasor as it behaves in control rate\n Phasor.kr(Impulse.kr(0), 1/2, -2, 2, -0.5) + (1.5 * Trig1.kr(1, 0)) // Phasor in control rate patched to match audio rate\n]}.plot(70/s.sampleRate)\n```\n\nI assume the problem is that the first control rate sample is meant to be more of a ‘sample -1’ than ‘sample 0’, hence why plot omits it when the output is at control rate. This would be fine if audio rate uGens started after one control period. Since they don’t, I’m happy to just adjust the code to make the subsequent samples correct, and then use ​ + (x * Trig1.kr(1, 0)) to patch the first sample. The only problem now is that it’s more complicated to do that with some other uGens."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Compare:\n\n{ WhiteNoise.ar(0.25) }.play;\n\n{ LPZ1.ar(WhiteNoise.ar(0.25) }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Compare:\n\n{ WhiteNoise.ar(0.25) }.play;\n\n{ LPZ1.ar(WhiteNoise.ar(0.25)) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for electric hum: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\eHum).addSpec(\\fFreq, ControlSpec(25, 1000, \\lin, step: 25));\nNdef(\\eHum).addSpec(\\fRq, [0.01, 0.2]);\nNdef(\\eHum).addSpec(\\fFreqIdx, [0, 8, \\lin, 0.2]);\nNdef(\\eHum).fadeTime = 2;\n\nNdef(\\eHum, {|fFreqIdx = 1, fRq = 0.1|\n var src = Impulse.ar([50, 75, 100]); // three sources\n var fFreq = (25 * (2 ** fFreqIdx));\n\n Splay.ar((BPF.ar(src, fFreq, fRq))* 8)\n})\n);\n\nNdef(\\eHum).gui;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nDelayC.ar(z, 0.2, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\n(\n// recursive application of delay.\n{\nz = Decay2.ar(Dust.ar(1, 0.5), 0.01, 0.1, Saw.ar(100 + [0, 1]));\n5.do { |i| z = DelayC.ar(RLPF.ar(z, Rand(100, 3000), 0.03), 1, 1 / (2**i), 1, z * 0.5) };\nz\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// Dust randomly triggers Decay to create an exponential\n// decay envelope for the WhiteNoise input source\n{\nz = Decay.ar(Dust.ar(1, 0.5), 0.3, WhiteNoise.ar);\nDelayC.ar(z, 0.2, 0.2, 1, z); // input is mixed with delay via the add input\n}.play\n);\n\n(\n// recursive application of delay.\n{\nz = Decay2.ar(Dust.ar(1, 0.5), 0.01, 0.1, Saw.ar(100 + [0, 1]));\n5.do { |i| z = DelayC.ar(RLPF.ar(z, Rand(100, 3000), 0.03), 1, 1 / (2**i), 1, z * 0.5) };\nz\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for little experiment with periodicity: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n/* An little experiment with periodicity. \n Maybe there can be some sync artifact...\n */\n\ns.boot;\n\nSynthDef(\\mallet,{arg in=0,out=0,f=0,f2=0,a=0.1,r=1.8;\n\n var sig=Array.fill(3,{|n| SinOsc.ar(f*(n+1),mul:a/(n*n+1))}).sum;\n var env=EnvGen.kr(Env.perc(0.001,r),gate:Impulse.kr(f2),doneAction:0);\n\nOut.ar(out,sig*env!2);\n};\n).add;\n\n~root=60;\n~degrees=[0,4,5,7,9,12,16,17,19,21].scramble;\n~num=10;\n~coeff=0.75;\n\nArray.fill(~num,{|n| Synth.new(\\mallet,[\\f:(~root +~degrees[n]).midicps,\\a:0.2/~num,\\f2:(1+(n*~coeff))*0.1])});\n\ns.quit;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// result of BufRd is used as index for the next BufRd\n// needs Buffer c prepared above\n\n(\ny = {\n GFIS.ar(\n { |x| BufRd.ar(1, c, c.numFrames * x) },\n (LFDNoise3.ar(3) * [1, 1.1]).range(0.5, 0.51), 7\n ) * 0.2\n}.play\n;\n\ny.release\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// result of BufRd is used as index for the next BufRd\n// needs Buffer c prepared above\n\n(\ny = {\n GFIS.ar(\n { |x| BufRd.ar(1, c, c.numFrames * x) },\n (LFDNoise3.ar(3) * [1, 1.1]).range(0.5, 0.51), 7\n ) * 0.2\n}.play\n);\n\ny.release\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `DelayN` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// これは(SC2の配布物の中の)\"01 Why SuperCollider document\"からのリバーブ\n(\nSynthDef(\"preDelay\", { arg inbus = 2;\n Out.ar(\n 4,\n DelayN.ar(In.ar(inbus, 1), 0.048, 0.048)\n )\n}).add;\n\nSynthDef(\"combs\", {\n Out.ar(\n 6,\n Mix.arFill(7, { CombL.ar(In.ar(4, 1), 0.1, LFNoise1.kr(Rand(0, 0.1), 0.04, 0.05), 15) })\n )\n}).add;\n\nSynthDef(\"allpass\", { arg gain = 0.2;\n var source;\n source = In.ar(6, 1);\n 4.do({ source = AllpassN.ar(source, 0.050, [Rand(0, 0.05), Rand(0, 0.05)], 1) });\n Out.ar(\n 8,\n source * gain\n )\n}).add;\n\nSynthDef(\"theMixer\", { arg gain = 1;\n Out.ar(\n 0,\n Mix.ar([In.ar(2, 1), In.ar(8, 2)]) * gain\n )\n}).add;\n);\n\n(\nSynth(\"fm1\", [\\bus, 2, \\freq, 440, \\carPartial, 1, \\modPartial, 1.99, \\mul, 0.071]);\nSynth(\"fm1\", [\\bus, 2, \\freq, 442, \\carPartial, 1, \\modPartial, 2.401, \\mul, 0.071]);\nSynth.tail(s, \"preDelay\");\nSynth.tail(s, \"combs\");\nSynth.tail(s, \"allpass\");\nSynth.tail(s, \"theMixer\", [\\gain, 0.64]);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Object.postln` do?"}, {"role": "assistant", "content": "Print a string representation of the receiver followed by a newline. `\"hello\".postln; \"hello\".postln;"}]} +{"conversations": [{"role": "user", "content": "What is `EaseOutCubic` in SuperCollider?"}, {"role": "assistant", "content": "EaseOutCubic — Cubic ease-out Easing equation for a cubic (t^3) ease-out, decelerating to zero velocity. Category: Ease."}]} +{"conversations": [{"role": "user", "content": "I get \"Message 'ar' not understood\". Why?"}, {"role": "assistant", "content": "You called a rate method on something that is not a UGen. `Env.ar(...)` and `Buffer.ar(...)` are the classic cases: Env is a language-side description and is played by `EnvGen.ar(env, ...)`; a Buffer is server memory and is played by `PlayBuf.ar` or `BufRd.ar`. The UGen is the thing with a rate method — if it is a description or a container, there is another UGen that consumes it."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\nm = SimpleMIDIFile.read( \"~/Téléchargements/Super Mario Bros 2 - Mario Dreams.mid\" ); \n(\n TempoClock.default.tempo = m.tempo/60;\n Pdef(\\bla, \n Pbind(\n \\instrument, \\default,\n [\\midinote, \\dur, \\sustain, \\amp], Prout({ arg ev;\n var timescale = 1/16/60;\n var prevev;\n m.noteSustainEvents.collect({ arg item, idx;\n // [track, absTime, \\noteOn, channel, note, velo, dur, upVelo]\n if(idx == 0) {\n prevev = [item[4], item[1], item[6] * timescale, item[5]/127]\n } {\n prevev[1] = item[1] - prevev[1] * timescale;\n ev = prevev.yield;\n prevev = [item[4], item[1], item[6] * timescale, item[5]/127];\n };\n });\n prevev[1] = prevev[2];\n ev = prevev.yield;\n }),\n )\n ).play\n)\n```"}, {"role": "assistant", "content": "There is the .p method (see http://sccode.org/1-5aT) but here is also a way to retrieve the values directly."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n Lag3.kr( // lag the modulator\n LFPulse.kr(4, 0, 0.5, 50, 400), // frequency modulator\n Line.kr(0, 1, 15) // modulate lag time\n ),\n 0, // phase\n 0.3 // sine amplitude\n )\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// used to lag pitch\n{\n SinOsc.ar( // sine wave\n Lag3.kr( // lag the modulator\n LFPulse.kr(4, 0, 0.5, 50, 400), // frequency modulator\n Line.kr(0, 1, 15) // modulate lag time\n ),\n 0, // phase\n 0.3 // sine amplitude\n )\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for electric hum: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\eHum).addSpec(\\fFreq, ControlSpec(25, 1000, \\lin, step: 25));\nNdef(\\eHum).addSpec(\\fRq, [0.01, 0.2]);\nNdef(\\eHum).addSpec(\\fFreqIdx, [0, 8, \\lin, 0.2]);\nNdef(\\eHum).fadeTime = 2;\n\nNdef(\\eHum, {|fFreqIdx = 1, fRq = 0.1|\n var src = Impulse.ar([50, 75, 100]); // three sources\n var fFreq = (25 * (2 ** fFreqIdx));\n\n Splay.ar((BPF.ar(src, fFreq, fRq))* 8)\n})\n);\n\nNdef(\\eHum).gui;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `SelectX` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a;\n a = [\n SinOsc.ar,\n Saw.ar(300),\n Pulse.ar(230)\n ];\n\n SelectX.ar(MouseX.kr(0, 1) * a.size, a) * 0.2\n}.play;\n);\n\n(\n{\n var a;\n a = [\n SinOsc.kr(0.25),\n LFSaw.kr(10),\n LFPulse.kr(0.3)\n ];\n\n SinOsc.ar(SelectX.kr(MouseX.kr(0, 1) * a.size, a) * 300 + 400) * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Buffer.readChannelMsg` do?"}, {"role": "assistant", "content": "as above for single channel, with last arg being"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ReplaceOut`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\"ReplaceOutHelp\", { |out = 0, freq = 440|\n var source;\n source = SinOsc.ar(freq, 0, 0.1);\n\n // write to the bus, replacing previous contents\n ReplaceOut.ar(out, source);\n\n}).add;\n);\n\n// each Synth replaces the output of the previous one\nx = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 500]);\ny = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 600]);\nz = Synth.tail(s, \"ReplaceOutHelp\", [\\freq, 700]);\n\n// release them in reverse order; the older Synths are still there.\nz.free;\ny.free;\nx.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `FBSineL`."}, {"role": "assistant", "content": "```supercollider\n// default initial params\n{ FBSineL.ar(SampleRate.ir/4) * 0.2 }.play(s);\n```"}]} +{"conversations": [{"role": "user", "content": "Where does the magic frequency 261.6255653006 come from?"}, {"role": "assistant", "content": "SuperCollider forum — Where does the magic frequency 261.6255653006 come from?\n\nThinking about this a bit more, on one hand it might be useful if set (and everything else in Event) could fetch not only the msgFunc from the synthDesc, which it does (if args are set to []), but perhaps also the default values for the synth controls... and then used those in preference to Event defaults if “nothing is specified” for some key in the event. Alas “nothing is specified” is tedious to detect in Event, as it does its own calculations which have a lot of inputs (esp. for the frequency stuff). So, one could implement such a policy more explicitly in a \\finish callback that e.g. looks up in synthDesc only specific keys (say specified in a defArgs, possibly with [] meaning all found in the synthDesc) and sets only those if “not set” in event.\n\nI almost started coding this idea, but I realised that’s actually inferior to just putting the synth defaults in another event/environment, and chaining that before the event... which is exactly what I usually do with a Pdef.envir. That approach, besides sidestepping the issue of detecting what’s “not set” in the Event, has an extra advantage that a persistent set of defaults, after being initialized with the synthdef ones, can be easily tweaked in a gui. When I find myself that I often change the default value of some control like that, I go back and change the synthdef default. Because of that workflow, in which I always have the defaults loaded in an chained envir, I didn’t even have much realization of Event defaults for things like amp, freq etc. And I didn’t need type: \\set much until recently... for which getting the args constructed in that case is also rather easy as Pdef(...).controlKeys. Even without Pdefs, that’s straightforward (past loading those defaults into an event)\n\n```supercollider\ne = SynthDescLib.global.synthDescs.at(\\default).controls.inject((), { |e, c| e[c.name] = c.defaultValue });\n(instrument: \\default, dur: 1, amp: 0.2).next(e).play\n```"}]} +{"conversations": [{"role": "user", "content": "What does `PV_JensenAndersen.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "FFT feature detector for onset detection. Arguments: buffer — FFT buffer.; propsc — Proportion of spectral centroid feature.; prophfe — Proportion of high frequency energy feature.; prophfc — Proportion of high frequency content feature.; propsf — Proportion of spectral flux feature.; threshold — Threshold level for allowing a detection.; waittime — If triggered, minimum wait until a further frame can cause another spot (useful to stop multiple detects on heavy signals).."}]} +{"conversations": [{"role": "user", "content": "How should I check an answer you give me?"}, {"role": "assistant", "content": "Three quick checks, cheapest first. Does it evaluate without a syntax error — the post window points at the exact character. Does the node appear in `s.plotTree` — if yes, the problem is signal rather than lifecycle. Does it reach `Out.ar(0, ...)` with a non-zero amplitude and an open filter. If those three pass and it is still silent, the class's own help page will show the argument order you may have assumed wrong."}]} +{"conversations": [{"role": "user", "content": "What is the difference between ~foo and a local variable?"}, {"role": "assistant", "content": "`var foo` is a local: it exists only inside the function or file block that declares it. `~foo` is an environment variable: it lives in the current Environment, survives between executions of the same block, and is visible to everything running in that environment. That is why `~buf = Buffer.read(s, path)` works in one cell and `PlayBuf.ar(1, ~buf)` works in the next, while a `var` would be gone."}]} +{"conversations": [{"role": "user", "content": "What can you do?"}, {"role": "assistant", "content": "Write and explain SuperCollider: SynthDefs, UGens, Patterns, Ndef, buses and envelopes, and tell you why a patch is silent or will not compile. I am 198M parameters, so I am narrow on purpose."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nSynthDef(\"help-PulseCount\", { |out = 0|\n Out.ar(out,\n SinOsc.ar(\n PulseCount.ar(Impulse.ar(10), Impulse.ar(0.4)) * 200,\n 0, 0.05\n )\n )\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nSynthDef(\"help-PulseCount\", { |out = 0|\n Out.ar(out,\n SinOsc.ar(\n PulseCount.ar(Impulse.ar(10), Impulse.ar(0.4)) * 200,\n 0, 0.05\n )\n )\n}).play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `LinearSpline.new` do? What arguments does it take?"}, {"role": "assistant", "content": "A simple linearly interpolated spline passing through a series of points. Arguments: points — An array of points supplied as either Point objects or simple arrays. Points may have unlimited dimensions, though all points in a spline need to have the same number of dimensions.; isClosed [boolean] — If the spline's last point loops around to its first point.."}]} +{"conversations": [{"role": "user", "content": "What does `HistoryGui.docFlag` do?"}, {"role": "assistant", "content": "get or set the symbol for the doc strategy to use: `\\sameDoc` tries to re-use a single text window, `\\newDoc` always makes a new one (and keep track of old"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = Env.adsr;\na.levels;\na.range(42, 45).levels;\na.exprange(42, 45).levels;\na.curverange(42, 45, -4).levels;\n\n(\n// Mapping an Env to an exponential frequency range:\n{\n SinOsc.ar(EnvGen.ar(Env.perc(0.01, 0.7).exprange(40, 10000), doneAction: Done.freeSelf)) * 0.2;\n}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = Env.adsr;\na.levels;\na.range(42, 45).levels;\na.exprange(42, 45).levels;\na.curverange(42, 45, -4).levels;\n\n(\n// Mapping an Env to an exponential frequency range:\n{\n SinOsc.ar(EnvGen.ar(Env.perc(0.01, 0.7).exprange(40, 10000), doneAction: Done.freeSelf)) * 0.2;\n}.play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Pan2` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\ns.bind {\n SynthDef(\"tpulse2\", { arg out=0, freq=700, sawFreq=440.0;\n Out.ar(out, Pan2.ar(SyncSaw.ar(freq, sawFreq, 0.1), SinOsc.kr(8)) )\n }).send(s);\n s.sync; // wait until synthdef is loaded\n x = Synth.new(\"tpulse2\");\n a = Bus.control.set(440);\n x.map(\\freq, a);\n};\n);\n\na.free; x.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `DelayN` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// これは(SC2の配布物の中の)\"01 Why SuperCollider document\"からのリバーブ\n(\nSynthDef(\"preDelay\", { arg inbus = 2;\n Out.ar(\n 4,\n DelayN.ar(In.ar(inbus, 1), 0.048, 0.048)\n )\n}).add;\n\nSynthDef(\"combs\", {\n Out.ar(\n 6,\n Mix.arFill(7, { CombL.ar(In.ar(4, 1), 0.1, LFNoise1.kr(Rand(0, 0.1), 0.04, 0.05), 15) })\n )\n}).add;\n\nSynthDef(\"allpass\", { arg gain = 0.2;\n var source;\n source = In.ar(6, 1);\n 4.do({ source = AllpassN.ar(source, 0.050, [Rand(0, 0.05), Rand(0, 0.05)], 1) });\n Out.ar(\n 8,\n source * gain\n )\n}).add;\n\nSynthDef(\"theMixer\", { arg gain = 1;\n Out.ar(\n 0,\n Mix.ar([In.ar(2, 1), In.ar(8, 2)]) * gain\n )\n}).add;\n);\n\n(\nSynth(\"fm1\", [\\bus, 2, \\freq, 440, \\carPartial, 1, \\modPartial, 1.99, \\mul, 0.071]);\nSynth(\"fm1\", [\\bus, 2, \\freq, 442, \\carPartial, 1, \\modPartial, 2.401, \\mul, 0.071]);\nSynth.tail(s, \"preDelay\");\nSynth.tail(s, \"combs\");\nSynth.tail(s, \"allpass\");\nSynth.tail(s, \"theMixer\", [\\gain, 0.64]);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Canvas3D.preDrawFunc` do?"}, {"role": "assistant", "content": "Function to evaluate at the beginning of the draw"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ LFNoise0.ar(1000, 0.25) }.play;\n\n// modulate frequency\n\n{ LFNoise0.ar(XLine.kr(1000, 10000, 10), 0.25) }.play;\n\n// as frequency modulator\n(\n{ SinOsc.ar(\n LFNoise0.ar(4, 400, 450),\n 0, 0.2\n )\n}.play;\n)\n\n// freq is the rate of starting points\n{ var freq = 1000; [LFNoise0.ar(freq), Impulse.ar(freq) }.plot\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ LFNoise0.ar(1000, 0.25) }.play;\n\n// modulate frequency\n\n{ LFNoise0.ar(XLine.kr(1000, 10000, 10), 0.25) }.play;\n\n// as frequency modulator\n(\n{ SinOsc.ar(\n LFNoise0.ar(4, 400, 450),\n 0, 0.2\n )\n}.play;\n)\n\n// freq is the rate of starting points\n{ var freq = 1000; [LFNoise0.ar(freq), Impulse.ar(freq)] }.plot\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// you have to write the sample path in the firts line\n\n~bufferdue = Buffer.read(s,\" WRITE YOUR SAMPLE PATH HERE \", bufnum:2);\n\n(\nSynthDef.new(\\bufbeat, {\n arg amp = 1, out = 0, buf, start, end, freq = 1;\n var sig, ptr;\n ptr = LFNoise1.ar(freq).range(0.0,end);\n sig = BufRd.ar(2, buf, ptr);\n sig = sig * amp;\n Out.ar(out, sig);\n}).add\n);\n\nx = Synth.new(\\bufbeat, [\\buf, ~bufferdue.bufnum, \\start,0, \\end, ~bufferdue.numFrames-1, \\freq, 1, \\amp, 0.5],g);\n\nx.free;\n```"}, {"role": "assistant", "content": "a simple BufRd with the starting point of lecture randomized by LFNoise1."}]} +{"conversations": [{"role": "user", "content": "What does `RedFood.eat` do?"}, {"role": "assistant", "content": "Takes away energy from this Returns: How much energy was taken away. Energy can not go below 0 so if there is 6 left and 10 is taken, this method returns 4."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// world's most expensive patchcord (use headphones to avoid feedback)\n{ SoundIn.ar(0) }.play;\n\n// stereo version\n{ SoundIn.ar([0, 1]) }.play;\n\n// scope input; silent output\n{ Amplitude.kr(SoundIn.ar(0)) }.scope;\n```"}, {"role": "assistant", "content": "world's most expensive patchcord (use headphones to avoid feedback) scope input; silent output (SoundIn: Read audio from hardware inputs)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\nNdef(\\sound, { SinOsc.ar([600, 635], Ndef.ar(\\sound), LFNoise1.kr(2).max(0) * 0.2) });\nNdef(\\sound.play;\nNdef.clear;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\nNdef(\\sound, { SinOsc.ar([600, 635], Ndef.ar(\\sound), LFNoise1.kr(2).max(0) * 0.2) });\nNdef(\\sound).play;\nNdef.clear;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `ReplaceOut` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// ... a reverb adapted from the \"01 Why SuperCollider document\" in the SC2 distribution\n(\nSynthDef(\"preDelay\", { arg inbus = 2;\n ReplaceOut.ar(\n 4,\n DelayN.ar(In.ar(inbus, 1), 0.048, 0.048)\n )\n}).add;\n\nSynthDef(\"combs\", {\n ReplaceOut.ar(\n 6,\n Mix.arFill(7, { CombL.ar(In.ar(4, 1), 0.1, LFNoise1.kr(Rand(0, 0.1), 0.04, 0.05), 15) })\n )\n}).add;\n\nSynthDef(\"allpass\", { arg gain = 0.2;\n var source;\n source = In.ar(6, 1);\n 4.do({ source = AllpassN.ar(source, 0.050, [Rand(0, 0.05), Rand(0, 0.05)], 1) });\n ReplaceOut.ar(\n 8,\n source * gain\n )\n}).add;\n\nSynthDef(\"theMixer\", { arg gain = 1;\n ReplaceOut.ar(\n 0,\n Mix.ar([In.ar(2, 1), In.ar(8, 2)]) * gain\n )\n}).add;\n);\n\n(\nSynth(\"fm1\", [\\bus, 2, \\freq, 440, \\carPartial, 1, \\modPartial, 1.99, \\mul, 0.071]);\nSynth(\"fm1\", [\\bus, 2, \\freq, 442, \\carPartial, 1, \\modPartial, 2.401, \\mul, 0.071]);\nSynth.tail(s, \"preDelay\");\nSynth.tail(s, \"combs\");\nSynth.tail(s, \"allpass\");\nSynth.tail(s, \"theMixer\", [\\gain, 0.64]);\n);\n\n(\ns.queryAllNodes;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `LorenzL`."}, {"role": "assistant", "content": "```supercollider\n// randomly modulate params\n(\n{ LorenzL.ar(\n SampleRate.ir,\n LFNoise0.kr(1, 2, 10),\n LFNoise0.kr(1, 20, 38),\n LFNoise0.kr(1, 1.5, 2)\n) * 0.2 }.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `SelectButtonSet` in SuperCollider briefly."}, {"role": "assistant", "content": "SelectButtonSet — a set of radio buttons Radio button style set, fashioned as a single object. Category: Libraries > crucial > GUI."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n\n~name = \\AcnSn3dIn;\n~description = \"A live ambisonic input (ACN_SN3D)\";\n~channelLayout = \\ambi;\n\n~function = { |order=1, t_trig = 0, bus = 0|\n var env = EnvGen.kr(Env([0,1], [1]), t_trig);\n var chans = Array.series(\n size: (order + 1).pow(2).asInteger,\n start: bus,\n step: 1\n );\n var input = SoundIn.ar(chans) * env;\n HOAConverterAcnSn3d2AcnN3d.ar(order, input);\n};\n```"}, {"role": "assistant", "content": "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see ."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n// A beautiful sc140 tweet by Batuhan Bozkurt, parametrized for real-time changes\n(\n// Start sound here\na = { | rateL = 5, rateR = 6, blipMul = 100, blipAdd = 50, fMul = 50, kMul = 1 |\n f = LocalIn.ar(2).tanh;\n k = Latch.kr(f[0].abs,Impulse.kr(1/4)) * kMul;\n LocalOut.ar(\n f +\n CombC.ar(Blip.ar([rateL, rateR], blipMul * k + blipAdd, 0.9), 1, k*0.3, fMul * f));f\n}.play\n);\n\n// Set parameters for changing sound here: \n\na.set(\\rateL, 10);\n\na.set(\\rateR, 8);\n\na.set(\\blipMul, 25);\n\na.set(\\blipAdd, 70);\n\na.set(\\fMul, 30);\n\n\na.set(\\kMul, 0.01);\n```"}, {"role": "assistant", "content": "A beautiful sc140 tweet by Batuhan Bozkurt, parametrized for real-time changes. To do: Add gui widgets for easier interactive control."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ProxySpace`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\np = ProxySpace.new;\np.fadeTime = 2; // fadeTime specifies crossfade\np[\\out].play; // monitor an empty placeholder through hardware output\n// set its source\np[\\out] = { SinOsc.ar([350, 351.3], 0, 0.2) };\np[\\out] = { Pulse.ar([350, 351.3] / 4, 0.4) * 0.2 };\np[\\out] = Pbind(\\dur, 0.03, \\freq, Pbrown(0, 1, 0.1, inf).linexp(0, 1, 200, 350));\n\n// route one proxy through another:\np[\\out] = { Ringz.ar(p[\\in].ar, [350, 351.3] * 8, 0.2) * 4 };\np[\\in] = { Impulse.ar([5, 7]/2, [0, 0.5]) };\n\np.clear(3); // clear after 3 seconds\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `RandID` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// start a noise patch and set the id of the generator\n(\nSynthDef(\"help-RandID\", { |out = 0, id = 1|\n RandID.ir(id);\n Out.ar(out,\n WhiteNoise.ar(0.05) + Dust2.ar(70)\n )\n}).add;\n);\n\n// reset the seed of my rgen at a variable rate\n(\nSynthDef(\"help-RandSeed\", { |seed = 1910, id = 1|\n RandID.kr(id);\n RandSeed.kr(Impulse.kr(FSinOsc.kr(0.2, 0, 10, 11)), seed);\n}).add;\n\n);\n\n// start two noise synths on left and right channel with a different randgen id\na = Synth(\"help-RandID\", [\\out, 0, \\id, 1]);\nb = Synth(\"help-RandID\", [\\out, 1, \\id, 2]);\n\n// reset the seed of randgen 1\nx = Synth(\"help-RandSeed\", [\\id, 1]);\n\n// change the target randgen to 2 (affects right channel)\nx.set(\\id, 2);\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ LPF.ar(Saw.ar(100), SinOsc.kr(0.5).exprange(200, 2000)) * 0.2 }.play;\n```"}, {"role": "assistant", "content": "A sawtooth through a low-pass filter whose cutoff is swept slowly up and down — a classic filter\nsweep.\n\n- `Saw.ar(100)` is a 100 Hz sawtooth, rich in harmonics.\n- `SinOsc.kr(0.5)` is a control-rate sine at 0.5 Hz, so one full cycle takes 2 seconds.\n- `.exprange(200, 2000)` maps that -1..1 sine exponentially onto 200..2000 Hz — exponential is the right\n mapping for frequency, because we hear pitch logarithmically.\n- `LPF.ar(sig, cutoff)` removes harmonics above the cutoff; as it opens and closes you hear the tone\n brighten and darken.\n- `* 0.2` keeps the output from clipping."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Ringz` that runs as it is."}, {"role": "assistant", "content": "```supercollider\na = NodeProxy(s);\na[0] = { |freq = 440, dt=0.1, rate=2| Ringz.ar(Impulse.ar(rate * [1, 1.2]), freq, dt)*0.1 };\na.play;\n(\na[1] = \\set -> Pbind(\n \\dur, Prand([1, 0.5], inf),\n \\freq, Pwhite(200.0, 1000, inf),\n \\rate, Pdup(4, Prand([1, 3, 6, 10], inf)),\n \\dt, Pwhite(0.01, 0.1, inf)\n)\n);\n// modify the source in the meanwhile:\na[0] = { |freq = 440, dt=0.1, rate=2| Ringz.ar(Dust.ar(rate * 10.dup), freq, dt)*0.1 };\n\na.nodeMap.postln; // the values are not set in the node map.\na.clear(3);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SimpleNumber.ellint2C` do?"}, {"role": "assistant", "content": "Returns the complete elliptic integral of the second kind, Legendre form. Requires `-1 <= k <="}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\na = WhiteNoise.ar; // a WhiteNoise\nb = a + 2; // a BinaryOpUGen.\nb.operator; // +\n\n// sound example\n(\n{\n var a = LFSaw.ar(300);\n var b = LFSaw.ar(329.1);\n a % b * 0.1\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\na = WhiteNoise.ar; // a WhiteNoise\nb = a + 2; // a BinaryOpUGen.\nb.operator; // +\n\n// sound example\n(\n{\n var a = LFSaw.ar(300);\n var b = LFSaw.ar(329.1);\n a % b * 0.1\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Hilbert.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Applies the Hilbert transform to an input signal. Arguments: in — The input signal to transform.; mul — Output will be multiplied by this value.; add — This value will be added to the output.."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pseq`."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Pseq(#[60, 61, 63, 65, 72], inf).asStream;\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, a.next.midicps]);\n 0.2.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `IdentityDictionary`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_sinegrain, { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0.5pi, env))\n}).add;\n\na = Pbind(\\instrument, \\help_sinegrain, \\note, Pseq([0, 7, 2, 9, 11, 10, 9, 8], inf), \\dur, 1);\na.play(quant: (quant: 1, phase: 0));\na.play(quant: (quant: 1, phase: 1/3));\na.play(quant: (quant: 1, phase: 1.0.rand));\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `DelayN` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// これは(SC2の配布物の中の)\"01 Why SuperCollider document\"からのリバーブ\n(\nSynthDef(\"preDelay\", { arg inbus = 2;\n Out.ar(\n 4,\n DelayN.ar(In.ar(inbus, 1), 0.048, 0.048)\n )\n}).add;\n\nSynthDef(\"combs\", {\n Out.ar(\n 6,\n Mix.arFill(7, { CombL.ar(In.ar(4, 1), 0.1, LFNoise1.kr(Rand(0, 0.1), 0.04, 0.05), 15) })\n )\n}).add;\n\nSynthDef(\"allpass\", { arg gain = 0.2;\n var source;\n source = In.ar(6, 1);\n 4.do({ source = AllpassN.ar(source, 0.050, [Rand(0, 0.05), Rand(0, 0.05)], 1) });\n Out.ar(\n 8,\n source * gain\n )\n}).add;\n\nSynthDef(\"theMixer\", { arg gain = 1;\n Out.ar(\n 0,\n Mix.ar([In.ar(2, 1), In.ar(8, 2)]) * gain\n )\n}).add;\n);\n\n(\nSynth(\"fm1\", [\\bus, 2, \\freq, 440, \\carPartial, 1, \\modPartial, 1.99, \\mul, 0.071]);\nSynth(\"fm1\", [\\bus, 2, \\freq, 442, \\carPartial, 1, \\modPartial, 2.401, \\mul, 0.071]);\nSynth.tail(s, \"preDelay\");\nSynth.tail(s, \"combs\");\nSynth.tail(s, \"allpass\");\nSynth.tail(s, \"theMixer\", [\\gain, 0.64]);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Prewrite.new` do? What arguments does it take?"}, {"role": "assistant", "content": "L-system pattern for selfsimilar structures Arguments: pattern — starting value; dict — a dictionary or an event.; levels — number of levels `IdentityDictionary[`."}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `SelectXFocus`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var a;\n a = [\n Saw.ar(LFSaw.kr(3 * [1, 1.01], 0, 100, 230)),\n SinOsc.ar,\n Pulse.ar(LFPulse.kr(3 * [1, 1.02], 0, 0.4, 100, 230)),\n SinOsc.ar(SinOsc.kr(4 * [1, 1.03], 0, 200, 300))\n ];\n\n SelectXFocus.ar(MouseX.kr(0, 1) * a.size, a, MouseY.kr(0, a.size)) * 0.2\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Basic tone simulator of a stylophone. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n/*\nRetro Stylophone\n\nReverse engineered from: https://www.waitingforfriday.com/?p=334\n\n1. Relaxation oscillator (UJT)\n\n- generated by a combination of two oscillators. The primary oscillator is a\n current controlled PUT (Programmable Uni-Junction Transistor) relaxation oscillator which is\n responsible for generating the overall tone of the instrument.\n A secondary LFO phase-shifted provides the vibrato\n (the relative slow wavering of a sound around the notes centre pitch)\n\n- around 10 VPP\n\n2. LFO phase-shift (vibrato)\n\n- generated by a low-frequency oscillator made with a transistor and several capacitors,\n which produces a triangle/sine wave fed into the frequency control voltage operating the UJT\n\n- frequency of about 8.5Hz, phased shifted of 180 degree, around 4.2 VPP\n*/\n\n(\nSynthDef(\\stylophone, { |freq = 220, vibAmp = 2, toneAmp = 5, atkTime = 0.01, trigger = 0|\n\n var lfo = OnePole.kr(LFPar.kr(8, mul: vibAmp, add: freq), 0.9); // 180 degree inversion\n var relaxOsc = LFPulse.ar(lfo, width: 0.9, mul: toneAmp);\n\n var asr = EnvGen.kr(Env.asr(atkTime * 5, releaseTime: 0.001, curve: \\lin), gate: trigger);\n\n Out.ar(0, relaxOsc * asr)\n}).add\n);\n\nf = Synth(\\stylophone);\n\nf.set(\\freq, 208.2);\nf.set(\\freq, 233.4);\n\nf.set(\\trigger, 1);\nf.set(\\trigger, 0);\nf.free;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ProxySpace`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\np = ProxySpace.new;\np.fadeTime = 2; // fadeTime specifies crossfade\np[\\out].play; // monitor an empty placeholder through hardware output\n// set its source\np[\\out] = { SinOsc.ar([350, 351.3], 0, 0.2) };\np[\\out] = { Pulse.ar([350, 351.3] / 4, 0.4) * 0.2 };\np[\\out] = Pbind(\\dur, 0.03, \\freq, Pbrown(0, 1, 0.1, inf).linexp(0, 1, 200, 350));\n\n// route one proxy through another:\np[\\out] = { Ringz.ar(p[\\in].ar, [350, 351.3] * 8, 0.2) * 4 };\np[\\in] = { Impulse.ar([5, 7]/2, [0, 0.5]) };\n\np.clear(3); // clear after 3 seconds\n```"}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `SampleRate`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// compares a 441 Hz sine tone derived from sample rate (44100 * 0.01, left)\n// with a 440 Hz tone (right), resulting in a 1 Hz beating\n(\n{\n var freq;\n freq = [SampleRate.ir * 0.01, 440];\n SinOsc.ar(freq, 0, 0.1)\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for smooth arpeggio, updated envelope (a SuperCollider snippet): bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\ns.boot;\n);\n\n(\nSynthDef(\\bass, { |freq = 440, sustain = 1, amp = 0.5|\n var sig;\n sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(Env.perc(0.2), doneAction: 2);\n Out.ar(0, sig ! 2)\n}).add;\n);\n\n(\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([36 + 0, 36 + 7, 36 + 12], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5], inf)\n).play;\n);\n\n\n(\np = Pbind(\n // the name of the SynthDef to use for each note\n \\instrument, \\smooth,\n // MIDI note numbers -- converted automatically to Hz\n \\midinote, Pseq([60+0, 60+5, 60+7, 60+8, 60+7, 60+5], inf),\n // rhythmic values\n \\dur, Pseq([0.5, 0.5, 0.5, 0.5, 0.5, 0.5], inf)\n).play;\n)\n\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Thunk` in SuperCollider?"}, {"role": "assistant", "content": "Thunk — unevaluated value Thunk, \"past tense of think\", can be used when a calculation may, or may not have to be performed at a later point in time, and its value is needed several times. This is an example of lazy evaluation, and can be used to avoid unnecessary calculations and to make state immutable. Category: Core > Kernel."}]} +{"conversations": [{"role": "user", "content": "What does `OpenObject.replyPort` do?"}, {"role": "assistant", "content": "Some applications do not allow to receive messages through the same port they are passing in the OSC message as reply port. As a workaround, this port can be explicitly overridden"}]} +{"conversations": [{"role": "user", "content": "What does `NodeProxy.defaultFadeTime` do?"}, {"role": "assistant", "content": "The overlap time between successive source replacements which all instances have by default. Each instance has its own value which can be set via"}]} +{"conversations": [{"role": "user", "content": "What is `Dictionary`?"}, {"role": "assistant", "content": "Dictionary — associative collection mapping keys to values"}, {"role": "user", "content": "What does `Dictionary.new` do?"}, {"role": "assistant", "content": "Creates a Dictionary with an initial capacity for n key value mappings."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nd = Dictionary.new;\nd.add(\\monkey -> 0).postln;\nd.add(\\robot -> 1).postln; // Add robot as a key with a value of 1\nd.add(\\monkey -> 2).postln; // Replaces the value for the key monkey with 2\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// straight usage as value pattern for midinotes\n\n(\n// lookBack determines number of items to loop, must start with 0 (no loop),\n// doSkip determines if loops should be completed or not with new lookBack values.\n\n// Passing both via Functions enables to set on the fly,\n// enable immediate loop change by setting doSkip to 1\n\n~lookBack = 0;\n~doSkip = true;\n\np = Pbind(\n \\dur, 1/5,\n \\midinote, PSloop(\n Prand((60..80), inf),\n bufSize: 10,\n lookBack: { ~lookBack },\n doSkip: { ~doSkip }\n )\n).play\n);\n\n// wait a bit to fill buffer\n// keep running, set loop lengths immediately\n\n~\n// …\n```"}, {"role": "assistant", "content": "straight usage as value pattern for midinotes lookBack determines number of items to loop, must start with 0 (no loop), (PSloop: Pattern to derive loops from a given Pattern)"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\n var time = 30;\n var line = Line.kr(3000, 290, time);\n var line2 = Line.kr(280, 290, time);\n var line3 = Line.kr(0.01, 10, time);\n var sin = Mix.ar(SinOsc.ar([line, line2]) * SinOsc.ar(line3));\n var comb = CombC.ar(sin, time, SinOsc.kr(0.1).range(0.1, 0.2), time);\n var env = EnvGen.ar(Env.linen(0.01, time, 10), 1, doneAction:2);\n comb * env * 0.05!2;\n}.play\n)\n```"}, {"role": "assistant", "content": "Here is some quick code that sounds like an old sci-fi UFO landing."}]} +{"conversations": [{"role": "user", "content": "What is `ZeroXBufWr` in SuperCollider?"}, {"role": "assistant", "content": "ZeroXBufWr — writes zero crossing analysis from signals to buffers ZeroXBufWr analyses zero crossings from an input signal and writes the signal and the zero crossing indices to buffers. It is intended to be used with ZeroXBufRd and TZeroXBufRd, see these help files for more examples. Category: Libraries > miSCellaneous > ZeroX ugens."}]} +{"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Fdef`: bind everything it needs first."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\ns.boot;\nSynthDef(\"gpdef\",\n { |out = 0, freq = 440, sustain = 0.05, amp = 0.1|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain), doneAction: Done.freeSelf) * amp;\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n// fork a thread that plays some sounds\n(\nFdef(\\freq, 440);\nFdef(\\dur, 0.2);\n\nfork {\n loop {\n s.sendMsg(\"/s_new\", \"gpdef\", -1, 1, 1, \\freq, Fdef(\\freq).value);\n Fdef(\\dur).value.wait;\n }\n};\n);\n\n// some modifications\n\nFdef(\\freq, Fdef(\\midinote, 60).midicps);\nFdef(\\midinote, { [67, 64, 65].choose });\nFdef(\\midinote, { [67, 64, 65].choose } + Fdef(\\offset));\nFdef(\\offset, { 4.rand });\nFdef(\\dur, 0.23);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var w, x, y, p, q, a, b, c, d;\n\n p = LFSaw.ar(200);\n q = LFSaw.ar(301);\n\n // B-format encode\n #w, x, y = BiPanB2.ar(p, q, MouseX.kr(-1, 1), 0.1);\n\n // B-format decode to quad\n #a, b, c, d = DecodeB2.ar(4, w, x, y);\n\n [a, b, d, c] // reorder to my speaker arrangement: Lf Rf Lr Rr\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var w, x, y, p, q, a, b, c, d;\n\n p = LFSaw.ar(200);\n q = LFSaw.ar(301);\n\n // B-format encode\n #w, x, y = BiPanB2.ar(p, q, MouseX.kr(-1, 1), 0.1);\n\n // B-format decode to quad\n #a, b, c, d = DecodeB2.ar(4, w, x, y);\n\n [a, b, d, c] // reorder to my speaker arrangement: Lf Rf Lr Rr\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "How do I make a piece reproducible instead of a different take every time?"}, {"role": "assistant", "content": "Three things make a SuperCollider piece repeatable: a fixed seed, a fixed tempo, and no live input.\n\n```supercollider\n(\nthisThread.randSeed = 1234;\nTempoClock.default.tempo = 2;\nPbind(\\degree, Pwhite(0, 7, inf), \\dur, 0.25).play;\n)\n```\n\n`thisThread.randSeed` fixes the random sequence of the current thread, so `Pwhite`, `Prand` and friends give\nthe same values again. Recording with `s.record(path, duration: 30)` then makes the take an artifact rather\nthan a performance. Input from `MouseX` or a MIDI controller is the usual remaining source of difference."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Timer`."}, {"role": "assistant", "content": "```supercollider\n// using timer to modulate sine frequency: the slower the trigger is the higher the frequency\n(\n{ var trig;\n trig = Impulse.kr(MouseX.kr(0.5, 20, 1));\n SinOsc.ar(Timer.kr(trig) * 500 + 500, 0, 0.2)\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n{\n var z;\n\n // signal (clean)\n z = Decay2.ar(\n Impulse.ar(8, 0, LFSaw.kr(0.3, 1, -0.3, 0.3)),\n 0.001,\n 0.3\n )\n * Mix.ar(Pulse.ar([80, 81], 0.3));\n\n // apply gate (mouse x sets treshold)\n Compander.ar(z, z,\n thresh: MouseX.kr(0.001, 1),\n slopeBelow: 10,\n slopeAbove: 1,\n clampTime: 0.01,\n relaxTime: 0.01\n )\n}.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n{\n var z;\n\n // signal (clean)\n z = Decay2.ar(\n Impulse.ar(8, 0, LFSaw.kr(0.3, 1, -0.3, 0.3)),\n 0.001,\n 0.3\n )\n * Mix.ar(Pulse.ar([80, 81], 0.3));\n\n // apply gate (mouse x sets treshold)\n Compander.ar(z, z,\n thresh: MouseX.kr(0.001, 1),\n slopeBelow: 10,\n slopeAbove: 1,\n clampTime: 0.01,\n relaxTime: 0.01\n )\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain `IsEven` in SuperCollider briefly."}, {"role": "assistant", "content": "IsEven — answers whether the item is even. `(` Category: Libraries > crucial > Constraints."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n// only works with the internal server\ns = Server.internal;\ns.boot;\n);\n\n(\nSynthDef(\"help-SharedOut\", {\n SharedOut.kr(0, SinOsc.kr(0.2));\n}).add;\n);\n\n(\ns.sendMsg(\\s_new, \"help-SharedOut\", x = s.nextNodeID, 0, 1);\ns.sendMsg(\\n_trace, x);\n\n// poll the shared control bus\nRoutine({\n 30.do({\n s.getSharedControl(0).postln;\n 0.2.wait;\n });\n}).play;\n;\n\n\ns.quit;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n// only works with the internal server\ns = Server.internal;\ns.boot;\n);\n\n(\nSynthDef(\"help-SharedOut\", {\n SharedOut.kr(0, SinOsc.kr(0.2));\n}).add;\n);\n\n(\ns.sendMsg(\\s_new, \"help-SharedOut\", x = s.nextNodeID, 0, 1);\ns.sendMsg(\\n_trace, x);\n\n// poll the shared control bus\nRoutine({\n 30.do({\n s.getSharedControl(0).postln;\n 0.2.wait;\n });\n}).play;\n);\n\n\ns.quit;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `MxUnit.handlersForClass` do? What arguments does it take?"}, {"role": "assistant", "content": "Container for a musical object (Instr, NDef, Spline etc); this is a single unit that has inlets and outlets which can be connected to other units Arguments: class."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// nothing especially implemented\n\n(\nx = {\n var trig = Impulse.ar(7);\n var in = [0, 8.5];\n var maxLookBack = [1, 3];\n var loDev = [-1, -5];\n var hiDev = [1, 5];\n var midi = { |i| Demand.ar(trig, 0,\n DIdev(\n in[i] + SinOsc.ar(0.1, -pi/2).range(65, 85).round,\n maxLookBack: maxLookBack[i],\n loDev: loDev[i],\n hiDev: hiDev[i]\n ).dpoll(label: \"midi_\" ++ (i == 0).if { \"lo\" }{ \"hi\"})\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// nothing especially implemented\n\n(\nx = {\n var trig = Impulse.ar(7);\n var in = [0, 8.5];\n var maxLookBack = [1, 3];\n var loDev = [-1, -5];\n var hiDev = [1, 5];\n var midi = { |i| Demand.ar(trig, 0,\n DIdev(\n in[i] + SinOsc.ar(0.1, -pi/2).range(65, 85).round,\n maxLookBack: maxLookBack[i],\n loDev: loDev[i],\n hiDev: hiDev[i]\n ).dpoll(label: \"midi_\" ++ (i == 0).if { \"lo\" }{ \"hi\"})\n ) } ! 2;\n SinOsc.ar(midi.lag(0.007).midicps, 0, 0.1)\n}.play;\n);\n\nx.release\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\nc = Condition.new(false);\n\nRoutine {\n 1.wait;\n \"waited for 1 second\".postln;\n 1.wait;\n \"waited for another second, now waiting for you ... \".postln;\n c.wait;\n \"the condition has stopped waiting.\".postln;\n 1.wait;\n \"waited for another second\".postln;\n \"waiting for you ... \".postln;\n c.test = false;\n c.wait;\n \"the condition has stopped waiting.\".postln;\n 1.wait;\n \"the end\".postln;\n}.play;\n);\n\n// continue\n(\nc.test = true;\nc.signal;\n);\n\n// a typical use is a routine that can pause under certain conditions:\n(\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\nc = Condition.new(false);\n\nRoutine {\n 1.wait;\n \"waited for 1 second\".postln;\n 1.wait;\n \"waited for another second, now waiting for you ... \".postln;\n c.wait;\n \"the condition has stopped waiting.\".postln;\n 1.wait;\n \"waited for another second\".postln;\n \"waiting for you ... \".postln;\n c.test = false;\n c.wait;\n \"the condition has stopped waiting.\".postln;\n 1.wait;\n \"the end\".postln;\n}.play;\n);\n\n// continue\n(\nc.test = true;\nc.signal;\n);\n\n// a typical use is a routine that can pause under certain conditions:\n(\nc = Condition.new;\nfork { loop { 1.wait; \"going\".postln; c.wait } };\n);\nc.test = true; c.signal;\nc.test = false;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ FSinOsc.ar(800) * 0.2 }.play;\n\n{ FSinOsc.ar(XLine.kr(200, 4000, 1)) * 0.2 }.play;\n\n// loses amplitude towards the end\n{ FSinOsc.ar(FSinOsc.ar(XLine.kr(4, 401, 8), 0.0, 200, 800) * 0.2 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ FSinOsc.ar(800) * 0.2 }.play;\n\n{ FSinOsc.ar(XLine.kr(200, 4000, 1)) * 0.2 }.play;\n\n// loses amplitude towards the end\n{ FSinOsc.ar(FSinOsc.ar(XLine.kr(4, 401, 8), 0.0, 200, 800)) * 0.2 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for 003_102 (a SuperCollider snippet). Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\nSynthDef('003_102', {|out=0,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y| Out.ar(out, Pan2.ar(Normalizer.ar(( GbmanL.ar( LPF.ar( SyncSaw.ar(p, k, q, h ), FreqShift.ar(d, r, k, y, a ), h, n ), r, l, Blip.ar(r, f, u, i ), h ))*( LFPar.ar(d, x, Saw.ar(w, k, Formant.ar(s, q, d, DelayL.ar(y, 0.5, w, v, i ), e ) ), y ))*( LFCub.ar(q, a, h, g ))*( Gendy1.ar(r, c, r, QuadL.ar(h, o, j, t, t, v, f ), k, p, g, Pulse.ar(g, g, c, s ), PMOsc.ar(f, u, d, t, d, f ), f, LFNoise0.ar(k, l, e ), d ) )))) }).play(args: #[ a, 0.1, b, 0.83039082494709, c, 7.4736936148092, d, 57.834883574831, e, 0.56638920329924, f, 2.7610572022348, g, -0.60208093272399, h, 0.69731527262978, i, 0.97553825378418, j, 0.47619211673737, k, 0.45142233371735, l, 6.5229251440451, m, 0.34238355327673, n, 3.1624102065486, o, 1, p, 1, q, 5.4898714868897, r, 2.7777416341664, s, 10966.099508885, t, 0.15706503391266, u, 3.1945936724559, v, 20000, w, -4.6151277924266, x, 1.4588773159677, y, 0.0012384873762477 ])\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for UI sounds (pt1): bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n// UI sounds\n// this code is an attempt to recreate a sound\n// inspired from some technological/electrical UI interface\n\n// 1. first define the synth\n// Here we are using the FM technique\n(\nSynthDef(\\fmmod, {\n |\n amp=0.2,\n fc=1000,\n fm = 100,\n idx = 100,\n atk=0.01,\n rls=0.1\n |\n var env = EnvGen.ar(Env.perc(atk, rls), doneAction:2);\n var modulator = SinOsc.ar(fm);\n var carrier = SinOsc.ar(fc + (idx*modulator) );\n var sig = carrier * env * amp;\n sig = HPF.ar(sig, 1000);\n Out.ar(0, sig!2);\n}).add;\n);\n\n// 2. then define the Pbind which will play the sequence\n// of UI sounds simulating variuos characters showing up on an\n// imaginary display.\n// Play around FC, FM, ATK and RLS to obtain different sound characters.\n(\np = Pbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 100,\n \\idx, 100,\n \\amp, 0.6,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).asEventStreamPlayer;\n);\n\n// 3. play it\np.play;\n\n// 4. Here are some presets\n\n// \"cricket\" preset\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 100,\n \\idx, 100,\n \\amp, 0.6,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 2\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 1000,\n \\idx, 100,\n \\amp, 0.6,\n \\atk, 0.001,\n \\rls, 0.01,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 3\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 10000,\n \\fm, 100,\n \\idx, 10,\n \\amp, 0.4,\n \\atk, 0.01,\n \\rls, 0.01,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 4\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 1000,\n \\fm, 100,\n \\idx, 1000,\n \\amp, 0.2,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n\n// preset 5\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 5000,\n \\fm, 1000,\n \\idx, 1000,\n \\amp, 0.4,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n);\n\n// preset 5\n(\nPbind(\n \\instrument, \\fmmod,\n \\fc, 8000,\n \\fm, 1000,\n \\idx, 1000,\n \\amp, 0.7,\n \\atk, 0.01,\n \\rls, 0.001,\n \\dur, Pwhite(0.1, 0.05, 10)\n).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// randomly modulate params\n(\n{ LinCongN.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(0.1, 0.5, 1.4),\n LFNoise2.kr(0.1, 0.1, 0.1),\n LFNoise2.kr(0.1)\n) * 0.2 }.play(s);\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// randomly modulate params\n(\n{ LinCongN.ar(\n LFNoise2.kr(1, 1e4, 1e4),\n LFNoise2.kr(0.1, 0.5, 1.4),\n LFNoise2.kr(0.1, 0.1, 0.1),\n LFNoise2.kr(0.1)\n) * 0.2 }.play(s);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Pmulpre` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nSynthDef(\\sinegrain,\n { |out = 0, freq = 440, sustain = 0.02|\n var env;\n env = EnvGen.kr(Env.perc(0.001, sustain), 1, doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env * 0.1))\n }).add;\n);\n\n(\na = Pbind(\\dur, 0.5, \\instrument, \\sinegrain);\nb = Pmulpre(\\freq, Pseq([1, 2, 3], inf), a);\nb.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `RedKGrain.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Create granulator (stereo only for Arguments: server — If `nil` then the default server will be used.."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `WrapIndex`."}, {"role": "assistant", "content": "```supercollider\n// indexing into a table\n(\n{\n var buf = LocalBuf.newFrom([200, 300, 400, 500, 600, 800]);\n var freq = WrapIndex.kr(buf, MouseX.kr(0, BufFrames.ir(buf) * 3));\n SinOsc.ar(freq) * 0.1\n}.play;\n);\n\n// the same using a global buffer\n(\nt = [200, 300, 400, 500, 600, 800];\nb = Buffer(s, t.size, 1);\n\n// alloc and set the values\ns.listSendMsg(b.allocMsg(b.setnMsg(0, t)).postln);\n\nSynthDef(\\help_Index, { |out = 0, bufnum = 0|\n Out.ar(out,\n SinOsc.ar(\n WrapIndex.kr(\n bufnum,\n MouseX.kr(0, BufFrames.ir(bufnum) * 3)\n ),\n 0,\n 0.5\n )\n )\n}).play(s, [\\bufnum, b.bufnum]);\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Very quick-and-dirty hack to show stereo phase. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\nb = Bus.audio(s, 2);\na = { |inbus = 0|\n var sig = In.ar(inbus, 2);\n // x axis is side, oriented toward right;\n // y axis is mid\n [sig[1] - sig[0], sig.sum]\n}.play(s.defaultGroup, outbus: b, addAction: \\addAfter);\nc = s.scope;\nc.style = 2;\nc.bus = b;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What are you good at?"}, {"role": "assistant", "content": "SuperCollider. I can explain its classes and UGens, write SynthDefs and patches, read a patch back to you, and tell you why one does not compile. I am 198M parameters; I am not a general assistant."}]} +{"conversations": [{"role": "user", "content": "What does `View.keyDown` do?"}, {"role": "assistant", "content": "Handles response to a key press event. First evaluates Returns: A Boolean, stating whether the event was handled or not (and will not or will propagate to the parent view, respectively), or the view, in which case it lets the Qt view implementation handle the even"}]} +{"conversations": [{"role": "user", "content": "What does `Red4D.vectors` do?"}, {"role": "assistant", "content": "An array of RedVector4D. This holds the current positions of all points (corners) after rotation is applied. This is calculated when calling"}]} +{"conversations": [{"role": "user", "content": "What does `NoLagControlSpec.defaultControl` do? What arguments does it take?"}, {"role": "assistant", "content": "datatype specifying a 'control' rate input that does not any lag applied to it Arguments: val."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `NodeProxy` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\na = NodeProxy.new.play; // play to hardware output.\na.fadeTime = 2; // fadeTime specifies crossfade\n// set the source\na.source = { SinOsc.ar([350, 351.3], 0, 0.2) };\na.source = { Pulse.ar([350, 351.3] / 4, 0.4) * 0.2 };\na.source = Pbind(\\dur, 0.03, \\freq, Pbrown(0, 1, 0.1, inf).linexp(0, 1, 200, 350));\n\nb = NodeProxy.new;\na.source = { Ringz.ar(b.ar, [350, 351.3] * 8, 0.2) * 4 };\nb.source = { Impulse.ar([5, 7]/2, [0, 0.5]) };\n\na.clear(3); // clear after 3 seconds\nb.clear(3);\n```"}]} +{"conversations": [{"role": "user", "content": "What is `OnError` in SuperCollider?"}, {"role": "assistant", "content": "OnError — register functions to be evaluated when an error occurs OnError registers functions to perform an action when an error occurs. Category: Control."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `BufWr`."}, {"role": "assistant", "content": "```supercollider\n(\n// allocate a buffer for writinig into\ns = Server.local;\ns.sendMsg(\"/b_alloc\", 0, 44100 * 2);\n);\n\n\n// write into the buffer with a BufWr\n(\ny = { |rate = 1|\n var in;\n in = SinOsc.ar(LFNoise1.kr(2, 300, 400), 0, 0.1);\n BufWr.ar(in, 0, Phasor.ar(0, BufRateScale.kr(0) * rate, 0, BufFrames.kr(0)));\n 0.0 // quiet\n}.play;\n);\n\n// read it with a BufRd\n(\nx = { |rate = 1|\n BufRd.ar(1, 0, Phasor.ar(0, BufRateScale.kr(0) * rate, 0, BufFrames.kr(0)))\n}.play(s);\n);\n\n\n\nx.set(\\rate, 5);\ny.set(\\rate, 2.0.rand);\nx.set(\\rate, 2);\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n// example: two SuperCollider apps communicating\n\n// application 1:\nn = NetAddr(\"127.0.0.1\", 57120); // the url should be the one of computer of app 2 (or nil)\n\no = OSCresponderNode(n, '/chat', { |t, r, msg| (\"time:\" + t).postln; msg[1].postln }).add;\n\n// application 2:\nm = NetAddr(\"127.0.0.1\", 57120); // the url should be the one of computer of app 1\nm.sendMsg(\"/chat\", \"Hello App 1\");\n\n// sending bundles (including timestamps)\n(\nm.sendBundle(2.0, [\"/chat\", \"Hello App 1\"], [\"/chat\", \"Hallo Wurld\n// …\n```"}, {"role": "assistant", "content": "example: two SuperCollider apps communicating sending bundles (including timestamps) (OSCresponderNode: client side network responder)"}]} +{"conversations": [{"role": "user", "content": "What is `BinaryOpFunction`?"}, {"role": "assistant", "content": "BinaryOpFunction — represent a binary operation on a function"}, {"role": "user", "content": "What does `BinaryOpFunction.value` do?"}, {"role": "assistant", "content": "Executes each of the operand functions and then performs the selector on the result."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n// sound example\n(\nvar a = { 19.rand };\nvar b = { [5, 8, 9].choose };\nvar c = a + b;\nfork {\n 15.do {\n (instrument: \\default, note: [c.value, a.value]).play;\n 0.3.wait;\n }\n}\n)\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{SmoothDecimator.ar(SinOsc.ar([400, 404], 0, 0.2), MouseX.kr(0, 44100), MouseY.kr(0, 1))}.play\n\n{SmoothDecimator.ar(SoundIn.ar, MouseX.kr(0, 44100), MouseY.kr(0, 1)}.play\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{SmoothDecimator.ar(SinOsc.ar([400, 404], 0, 0.2), MouseX.kr(0, 44100), MouseY.kr(0, 1))}.play\n\n{SmoothDecimator.ar(SoundIn.ar, MouseX.kr(0, 44100), MouseY.kr(0, 1))}.play\n```"}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Blip thru Formlet, pseudo-vocal synthesis that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n// Blip thru Formlet, pseudo-vocal synthesis.\n// hh&adc, since beijing 2005\n// 2019 made quad/MC\n\n// keywords: vocal, voice, formants\n\n/*\nNdef(\\formSing).gui;\nNdef(\\formSing).play;\nNdef(\\formSing).getHalo(\\stepFdev).value;\n*/\nNdef(\\formSing).addSpec(\\root, [20, 500, 6]);\nNdef(\\formSing).addSpec(\\formfrq, [50, 5000, \\exp]);\nNdef(\\formSing).addSpec(\\harm, [1, 256, \\exp]);\nNdef(\\formSing).addSpec(\\formLag, [0.01, 100, \\exp]);\nNdef(\\formSing).addSpec(\\ndiv, [0.01, 1, \\exp]);\nNdef(\\formSing).addSpec(\\fdev, [0, 24, \\amp]);\nNdef(\\formSing).addSpec(\\round, [0, 3, \\amp, 0.05]);\n\n(\n// modulating formant frequency\nNdef(\\formSing, { arg amp=0, root=150, formfrq=500, harm=20, fdev=2, ndiv = 0.2, formLag=0.1, round = 1.5;\n var freqCompare = 1; // ((formfrq / root).log2).abs.min(1).linexp(0, 1, 0.25, 1);\n var in = Blip.ar(\n root.lag(formLag) * LFNoise0.kr(root * ndiv ! q.numChans, fdev.max(0.01) ).midiratio,\n harm.lag(formLag), // .max(formfrq / root * 0.25),\n 0.1\n ) * GrayNoise.ar(0.1 ! q.numChans, 1);\n\n Limiter.ar(Formlet.ar(in, formfrq.lag(formLag), 0.005, 0.02) * (freqCompare * amp.lag(0.1)))\n .softclip;\n});\n);\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n{\n var env = Env([0, 0.6, 0.3, 1.0, 0], [0.1, 0.02, 0.4, 1.1], [\\lin, \\exp, -6, \\sin]);\n var envgen = IEnvGen.kr(env, MouseX.kr(0, env.times.sum));\n env.plot;\n SinOsc.ar(envgen * 500 + 440)\n}.play;\n);\n\n// index with an SinOsc ... mouse controls amplitude of SinOsc\n// use offset so negative values of SinOsc will map into the Env\n(\n{\n var sin = SinOsc.ar(440, 0, MouseX.kr(0, 1));\n // use offset so negative values of SinOsc will map into the Env\n v\n// …\n```"}, {"role": "assistant", "content": "index with an SinOsc ... mouse controls amplitude of SinOsc use offset so negative values of SinOsc will map into the Env (IEnvGen: Envelope generator for polling values from an Env)"}]} +{"conversations": [{"role": "user", "content": "What does `Instr.proxyControlClass` do?"}, {"role": "assistant", "content": "An enhanced version of SynthDef with a library"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Formant`."}, {"role": "assistant", "content": "```supercollider\n// modulate fundamental frequency, formant freq stays constant\n{ Formant.ar(XLine.kr(400, 1000, 8), 2000, 800, 0.125) }.play\n\n// modulate formant frequency, fundamental freq stays constant\n{ Formant.ar(200, XLine.kr(400, 4000, 8), 200, 0.125) }.play\n\n// modulate width frequency, other freqs stay constant\n{ Formant.ar(400, 2000, XLine.kr(800, 8000, 8), 0.125) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `OnePole`."}, {"role": "assistant", "content": "```supercollider\n{ OnePole.ar(WhiteNoise.ar(0.5), 0.95) }.play\n\n{ OnePole.ar(WhiteNoise.ar(0.5), -0.95) }.play\n\n{ OnePole.ar(WhiteNoise.ar(0.5), Line.kr(-0.99, 0.99, 10)) }.play\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Object.awake` do? What arguments does it take?"}, {"role": "assistant", "content": "This method is called by a Clock on which the object was scheduled when its scheduling time is up. It calls #-next, passing on the scheduling time in beats as an Arguments: beats — The scheduling time in beats. This is equal to the current logical time (Thread#-beats).; seconds — The scheduling time in seconds. This is equal to the current logical time (Thread#-seconds).; clock — The clock on which the object was scheduled.."}]} +{"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Just experimenting with patterns that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n/* Some Funky Klangs - Totally botched the math on what I was trying to do but it sounds better this way */\n\n( \nSynthDef(\\DistKlangBlip, { \n | out = 0, release = 1, freq1 = 1, freq2 = 5, freq3 = 8, freqMult = 4 | \n var env = Linen.kr(Impulse.kr(0), 0.01, 1, release, doneAction:2); \n var freqs = ([freq1, freq2, freq3] * freqMult).midicps; \n var klang = Klang.ar(`[freqs, nil, nil ], 1, 0); \n Out.ar(out, klang.tanh!2 * env * 0.5) \n}).add\n\n);\n\n( \n Pbind(*[ \n instrument: \\DistKlangBlip, \n dur: Pxrand([0.25, 0.5], inf) * 0.5, \n release: Pkey(\\dur), \n freqMult: Pxrand((3..12), inf), \n freq2: Prand([4,5], inf), \n freq3: Prand([8,12], inf) \n]).play; \n)\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `PeakFollower`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n// no decay\n(\n{\n SinOsc.ar(\n PeakFollower.ar(Dust.ar(20, Line.kr(0, 1, 4)), 1.0) * 1500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// a little decay\n(\n{\n SinOsc.ar(\n PeakFollower.ar(Dust.ar(20, Line.kr(0, 1, 4)), 0.999) * 1500 + 200,\n 0, 0.2\n )\n\n}.play;\n);\n\n// mouse x controls decay, center of the\n(\n{\n var decay;\n decay = MouseX.kr(0.99, 1.00001).min(1.0);\n SinOsc.ar(\n PeakFollower.ar(Dust.ar(20), decay) * 1500 + 200,\n 0, 0.2\n );\n\n}.play;\n);\n\n\n\n\n// follow a sine lfo, decay controlled by mouse x\n(\n{\n var decay;\n decay = MouseX.kr(0, 1.1).min(1.0);\n SinOsc.ar(\n PeakFollower.kr(SinOsc.kr(0.2), decay) * 200 + 500,\n 0, 0.2\n )\n\n}.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Function.asRoutine` do?"}, {"role": "assistant", "content": "Returns a Routine using this as its func"}]} +{"conversations": [{"role": "user", "content": "Explain `NodeControl` in SuperCollider briefly."}, {"role": "assistant", "content": "NodeControl — Encapsulates in an object a node and an index. This object can be held by a client and have its value set without otherwise having to store the details about where the node's input is. Category: Server > Nodes."}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `BufCombN` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n// These examples compare the variants, so that you can hear the difference in interpolation\n\n// allocate buffer\nb = Buffer.alloc(s, 44100, 1);\n\n// Comb used as a resonator. The resonant fundamental is equal to\n// reciprocal of the delay time.\n{ BufCombN.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ BufCombL.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n{ BufCombC.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// with negative feedback:\n{ BufCombN.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ BufCombL.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n{ BufCombC.ar(b.bufnum, WhiteNoise.ar(0.01), XLine.kr(0.0001, 0.01, 20), -0.2) }.play;\n\n// used as an echo.\n{ BufCombL.ar(b.bufnum, Decay.ar(Dust.ar(1, 0.5), 0.2, WhiteNoise.ar), 0.2, 3) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "How do I make a piece reproducible instead of a different take every time?"}, {"role": "assistant", "content": "Three things make a SuperCollider piece repeatable: a fixed seed, a fixed tempo, and no live input.\n\n```supercollider\n(\nthisThread.randSeed = 1234;\nTempoClock.default.tempo = 2;\nPbind(\\degree, Pwhite(0, 7, inf), \\dur, 0.25).play;\n)\n```\n\n`thisThread.randSeed` fixes the random sequence of the current thread, so `Pwhite`, `Prand` and friends give\nthe same values again. Recording with `s.record(path, duration: 30)` then makes the take an artifact rather\nthan a performance. Input from `MouseX` or a MIDI controller is the usual remaining source of difference."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider code do?\n```supercollider\n(\n// trig with MouseY crossing center of screen\n{\n var in, chain;\n in = Mix.ar(SinOsc.ar(200 * (1..10), 0, Array.fill(10, { rrand(0.1, 0.2) })));\n chain = FFT(LocalBuf(2048), in);\n chain = PV_Diffuser(chain, MouseY.kr > 0.5);\n 0.5 * IFFT(chain).dup;\n}.play\n);\n\n(\nb = Buffer.read(s, ExampleFiles.child);\n\n// trig with MouseY crossing center of screen\n{\n var in, chain;\n in = PlayBuf.ar(1, b, BufRateScale.kr(b), loop: 1);\n chain = FFT(Local\n// …\n```"}, {"role": "assistant", "content": "trig with MouseY crossing center of screen trig with MouseY crossing center of screen (PV_Diffuser: Random phase shifting.)"}]} +{"conversations": [{"role": "user", "content": "What does `LevelIndicator.numMajorTicks` do? What arguments does it take?"}, {"role": "assistant", "content": "The number of ticks in the view's scale which will be large Arguments: number — An Integer >= 0. `(`."}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n{\nvar trigger, fund, flashInst;\nflashInst = Array.fill(7,\n{\ntrigger = Dust.kr(2)*PinkNoise.ar(1);\nfund = rrand(100, 137);\nPan2.ar(\nMix.ar(\nArray.fill(7,\n{arg counter;\nvar partial;\npartial = counter + 3;\n//HenonC.ar(fund*partial).atan *\nDPW3Tri.ar(fund*partial).atan *\nEnvGen.kr(Env.adsr(0.01, 0, 0.1, 7.0),\ntrigger, 1/partial) *AY.ar(713)* max(0, LFNoise1.kr(rrand(37.0, 73.0)))\n})\n)*0.2,\n1.0.rand2)\n});\nMix.ar(flashInst)*0.6\n}.play\n)\n```"}, {"role": "assistant", "content": "\"High-energy Radio Bursts, generated by an old coffee machine of Arab origin, manifest themselves as noise and audio signals, and trigger a magnetic alteration with unpredictable effects;\"\r\n\r\n\r\n\r\nhttp://bz-buzz.blogspot.com/2018/10/radio-bursts-from-old-coffee-pot.html\r\n\r\nhttp://bzakirasantjago.blogspot.com/."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `ProxySynthDef`."}, {"role": "assistant", "content": "```supercollider\na = ProxySynthDef(\"xtest\", { SinOsc.ar(400) * 0.1 });\n\na.add;\n\nx = Synth(\"xtest\");\nx.release;\n\n\n/*\n\n if the resulting number of channels is larger than a given channelConstraint,\n it behaves according to the rate: audio rate signals are wrapped around\n a smaller channel size, control rate signals are not (the exceeding channels are left out)\n\n*/\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n//a SynthDef\n(\nSynthDef(\"plucking\", {arg amp = 0.1, freq = 220, decay = 5, coef = 0.1;\n\nvar env, snd;\nenv = EnvGen.kr(Env.linen(0, decay, 0.5), doneAction: 2);\nsnd = Pluck.ar(\n in: Saw.ar(freq, 0.5*amp),\n trig: Impulse.kr(0),\n\n maxdelaytime: 0.1,\n delaytime: freq.reciprocal,\n decaytime: decay,\n coef: coef);\n Out.ar(0, [snd, snd]);\n}).add;\n);\n\n//Bugger soundtrack\n(\nPbind(\n \\instrument, \"plucking\",\n \\scale, Scale.lydian,\n \\degree, Prand([[-2.5, -4.001], [-7.002, -5], [-1, -3.003], [1.005, 0.51]], inf),\n \\amp, Pseq([0.1, 0.2, 0.3, 0.4, 0.5, 0.5, 0.5, 0.5], inf),\n \\decay, Pseq([0.25,1, 0.5, 0.125], inf),\n \\coef, Pseq([0.7, 0.8, 0.9], inf),\n \\dur, Pseq([0.01, 0.0025, 0.2475, 0.24, 0.5], inf)\n).play;\n)\n```"}, {"role": "assistant", "content": "This will be the sound track for Bugger, a Frogger clone that started as a school assignment.\r\nSimple SynthDef using Pluck, and a few Pbinds. \r\n\r\nBugger can be found on [GitLab](https://gitlab.com/Modanung/Bugger)."}]} +{"conversations": [{"role": "user", "content": "What does `Recorder.record` do? What arguments does it take?"}, {"role": "assistant", "content": "Starts or resumes recording the Arguments: path — this is optional, and is passed to `prepareForRecord` (above).; bus — The bus (Bus object or integer bus index), the offset at which to start to count the number of channels. You can record any adjacent number of bus channels.; numChannels — The number of output channels to record.; node — The Node to record immediately after. By default, this is the default group 1.; duration — If set, this limits recording to a given time in seconds.."}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for exploring of morphing cycled envelopes (i.e: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\ro_v19, {\n var freq = 40.rrand(90).debug('base freq');\n var seed = thisThread.randSeed = 1000000000.rand.debug('seed');\n var gen = [LFNoise2,LFNoise0,SinOsc,LFPulse,LFSaw];\n var sig = Splay.ar({\n var i = 4.exprand(40).asInteger;\n Median.ar(\n 3.exprand(18),\n EnvGen.ar(\n Env( // wave form\n [0] ++ Array.fill(i-1, { \n gen.choose.kr(\n 0.25.coin.if({ gen.choose.kr(0.01.exprand(0.1)).exprange(0.1,1) }, { 0.1.exprand(1) }), \n mul: 0.25.coin.if({ gen.choose.kr(0.05.exprand(10)).range(0.1,1) }, { 0.1.rrand(1) })\n )\n }) ++ [0],\n Array.rand(i-1, 0.1,1.0).normalizeSum,\n [[-5.0.rrand(5),\\sin].choose] ++ Array.fill(i-2, {\n [\\sin ! 1.rrand(6), -5.0.rrand(5) ! 1.rrand(4)].flat.choose\n }) ++ [[-5.0.rrand(5),\\sin].choose]\n ).circle,\n timeScale: Duty.kr( // freq\n Drand([4,8,16,24], inf), 0,\n Dwrand([1,2,4,8,16,32,64]*freq, ((14..7) ** 1.rrand(3)).normalizeSum, inf) // octave\n * 0.75.coin.if({ Duty.kr( // note\n [Dxrand, Drand].choose.new([0.125,0.25,0.5,1,2,4,6,8,12], inf), 0,\n Dshuf({ (0..11).choose.midiratio } ! 1.exprand(8), inf)\n ) }, { (0..11).choose.midiratio })\n ).reciprocal\n )\n ) * EnvGen.kr( // rhythm\n Env.perc(\n 0.01.exprand(0.4) * 0.25.coin.if({ Duty.kr( // atk\n Drand([0.5,1,2,4,8,12,16], inf), 0,\n Dshuf({ [1,2,3,4].choose } ! 1.exprand(8), inf)\n ) }, { 1 }),\n 0.1.exprand(4) * 0.75.coin.if({ Duty.kr( // release\n Drand([0.5,1,2,4,8,12,16], inf), 0,\n Dshuf({ [1,2,4,8,16].choose.reciprocal } ! 1.exprand(8), inf)\n ) }, { 1 }),\n LFNoise2.kr(0.1.exprand(10)).range(0.05,1), // appearance\n LFNoise2.kr(0.1.exprand(10)).range(-4,4),\n ).circle\n );\n } ! 3.rrand(9).debug('source'));\n BHiShelf.ar(\n GVerb.ar(\n Rotate2.ar(sig[0], sig[1], Duty.kr(Drand([2,4,8],inf), 0, Drand([-1,1,0],inf)) * LFSaw.kr(0.1.exprand(1))),\n 40.rrand(150).debug('room')\n ),\n LFNoise2.kr(0.1.exprand(0.5)).range(4000,6500),\n LFNoise2.kr(0.1.exprand(1)).range(1,3),\n LFNoise2.kr(0.1.exprand(1)).range(-24,-16)\n );\n}).play\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// python preprocessor, given that you have python installed\n// thanks to tasos tsesmetzis\n\n(\nthis.preProcessor = PreProcessor.new.startDelimiter_(\"{-\").endDelimiter_(\"-}\");\n\n// a simple python call\ne = (\n lang: \\python,\n languages:\n (\n python: // code is the incoming string, event is the event for parameters and output\n {|code, event|\n var input, pipe, output;\n code = e[\\prefix] ++ \"print\" ++ \"(\" ++ code ++ \")\";\n input = \"python -c '%'\".format(code);\n pipe = Pipe(input, \"r\");\n output = pipe.readUpTo;\n pipe.close;\n event.put(\\result, output)\n }\n ),\n prefix: \"import math;\"\n);\n);\n\n// ok, assuming such a little interpreter exists for a given language,\n// one can now use it in code.\n\n(\ne =\n{-\n math.factorial(61)\n-}.value(e);\ne.result;\n);\n\ne.calc_result = e.result.as(Array).collect { |x| x.asString.interpret };\n\nPbind(\\note, Pseq(e.calc_result), \\dur, 0.1).play;\n```"}, {"role": "assistant", "content": "python preprocessor, given that you have python installed thanks to tasos tsesmetzis."}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ LFPulse.ar(50 * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ LFPulse.ar(50) * 0.1 }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nSynthDef(\\madtraffic, {|out, sig, gate=1, freq=440|\n // doneAction: 2 rilascia la synth quando EvnGen ha finito\n sig = (Blip.ar(freq)*0.7+Blip.ar(freq/2+Rand(1,12))*0.7)\n*EnvGen.kr(Env.asr(0.1, 0.3, 0.3), gate, doneAction:2);\n sig = RLPF.ar(sig,SinOsc.kr(0.3, 0, 200, 1500), 0.1);\n sig = FreeVerb.ar(sig, 0.5, 0.5, 0.5);\n Out.ar(out, sig);\n\n}).add;\n);\n\n(\nPbind(\n \\instrument, \\madtraffic,\n \\freq, Pseq([137, 373, Prand([237, 473, 713],1)], inf),\n \\legato, Pseq([1.7, 0.3], inf),\n \\dur, 0.3,\n \\out, Pseq([1, 0], inf)\n).play;\n)\n```"}, {"role": "assistant", "content": "\"It's the lack of eye contact that makes us more idiots, to the point that convertible riders give less to escalation. Closed in the car, explain the psychologists, we regress to childhood and react by shouting, or with that surrogate of the shock that is the horn.\"\r\n\r\n\r\n\r\nhttp://bz-buzz.blogspot.com/2018/09/mad-traffic.html\r\n\r\nhttp://bzakirasantjago.blogspot.it/."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Duty`."}, {"role": "assistant", "content": "```supercollider\n(\n {\n var freq;\n freq = Duty.kr(\n Drand([0.01, 0.2, 0.4], inf), // demand ugen as durations\n 0,\n Dseq([204, 400, 201, 502, 300, 200], inf)\n );\n SinOsc.ar(freq * [1, 1.01]) * 0.1\n\n }.play;\n);\n\n(\n {\n var freq;\n freq = Duty.kr(\n MouseX.kr(0.001, 2, 1), // control rate ugen as durations\n 0,\n Dseq([204, 400, 201, 502, 300, 200], inf)\n );\n SinOsc.ar(freq * [1, 1.01]) * 0.1\n\n }.play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for very punchy snare in neurofunk style: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\neurosnare, {\n var snd;\n // a percussive click to give it some attack\n snd = LPF.ar(HPF.ar(WhiteNoise.ar, 300), 8000) * Env.linen(0.001, 0.01, 0.001).ar;\n // sine sweep body. very important!\n snd = snd + (SinOsc.ar(Env([400, 196, 160], [0.04, 0.2], \\exp).ar) * Env.perc(0.04, 0.2).ar * 6.dbamp).tanh;\n // sound of snare coils rattling\n snd = snd + (HPF.ar(BPeakEQ.ar(WhiteNoise.ar, 4000, 0.5, 3), 300) * Env.perc(0.05, 0.2).delay(0.01).ar(2) * -3.dbamp);\n // another sound sweep to improve the attack, optional\n snd = snd + (SinOsc.ar(XLine.kr(3000, 1500, 0.01)) * Env.perc(0.001, 0.02).ar);\n // distortion helps glue everything together and acts as a compressor\n snd = (snd * 1.4).tanh;\n snd = Pan2.ar(snd, \\pan.kr(0), \\amp.kr(0.1));\n Out.ar(\\out.kr(0), snd);\n}).add;\n);\n\nSynth(\\neurosnare, [amp: 0.4]);\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n{ Out.ar(87, SinOsc.ar(MouseX.kr(240, 1000, 1) * [1, 2, 3], 0, 0.2)) }.play; // play three sine tone on channels 87, 88, and 89\nx = Monitor.new; // create a new monitor\nx.play(fromIndex: 87, fromNumChannels: 3, toIndex: 0, toNumChannels: 2; // play them back to the stereo hardware channels\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n{ Out.ar(87, SinOsc.ar(MouseX.kr(240, 1000, 1) * [1, 2, 3], 0, 0.2)) }.play; // play three sine tone on channels 87, 88, and 89\nx = Monitor.new; // create a new monitor\nx.play(fromIndex: 87, fromNumChannels: 3, toIndex: 0, toNumChannels: 2); // play them back to the stereo hardware channels\n```"}]} +{"conversations": [{"role": "user", "content": "What does `PlayerSocket.numChannels` do?"}, {"role": "assistant", "content": "a player that can play other players using a cross-faded and fuse-protected socket"}]} +{"conversations": [{"role": "user", "content": "What does `FoaBalance.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "First Order Ambisonic (FOA) balance transformer Arguments: in — The B-format signal, an array: [w, x, y, z]; angle — The distortion angle, in radians. -pi/2 to pi/2; mul — Output will be multiplied by this value.; add — This value will be added to the output.."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `Pgtpar`."}, {"role": "assistant", "content": "```supercollider\n// synthdef\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n}).add;\n);\n\n// pattern with different start times\n(\nx = Pbind(\n \\instrument, \\help_sinegrain,\n \\degree, Pseq(#[0, 5, 4, 2, 1, 1, 3], inf),\n \\dur, Pseq(#[0.25, 0.5, 1.0], inf),\n \\scale, #[0, 3, 5, 9, 10]\n);\na = Pbus(Pgtpar([0.0, x, 1.5, x, 2.25, x])).play;\n);\ns.plotTree;\na.stop;\n```"}]} +{"conversations": [{"role": "user", "content": "What is `Routine`?"}, {"role": "assistant", "content": "Routine — Functions that can return in the middle and then resume where they left off"}, {"role": "user", "content": "What does `Routine.new` do?"}, {"role": "assistant", "content": "Creates an instance of Routine, passing it the Function with code to run."}, {"role": "user", "content": "Show me a working example."}, {"role": "assistant", "content": "```supercollider\n(\nr = Routine { |inval|\n loop {\n // thisThread refers to the routine.\n postf(\"beats: % seconds: % time: % \\n\",\n thisThread.beats, thisThread.seconds, Main.elapsedTime\n );\n 1.0.yield;\n\n }\n}.play;\n);\n\nr.stop;\nr.beats;\nr.seconds;\nr.clock;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SoundIn`."}, {"role": "assistant", "content": "```supercollider\n// world's most expensive patchcord (use headphones to avoid feedback)\n{ SoundIn.ar(0) }.play;\n\n// stereo version\n{ SoundIn.ar([0, 1]) }.play;\n\n// scope input; silent output\n{ Amplitude.kr(SoundIn.ar(0)) }.scope;\n```"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\na = SynthDef(\"help-TCoin\", { |out = 0, prob = 0.5|\n var trig;\n trig = CoinGate.kr(prob, Impulse.kr(10));\n Out.ar(out,\n SinOsc.ar(\n TRand.kr(300.0, 400.0, trig), 0, 0.2\n )\n )\n}).play;\n);\n\na.set(\\prob, 1.0);\na.set(\\prob, 0.0);\na.set(\\prob, 0.1);\n\n\n(\na = SynthDef(\"help-TCoin\", { |out = 0, prob = 0.5|\n var trig;\n trig = Impulse.ar(20, 0, SinOsc.kr(0.5, 0, 1, 1));\n Out.ar(out,\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\na = SynthDef(\"help-TCoin\", { |out = 0, prob = 0.5|\n var trig;\n trig = CoinGate.kr(prob, Impulse.kr(10));\n Out.ar(out,\n SinOsc.ar(\n TRand.kr(300.0, 400.0, trig), 0, 0.2\n )\n )\n}).play;\n);\n\na.set(\\prob, 1.0);\na.set(\\prob, 0.0);\na.set(\\prob, 0.1);\n\n\n(\na = SynthDef(\"help-TCoin\", { |out = 0, prob = 0.5|\n var trig;\n trig = Impulse.ar(20, 0, SinOsc.kr(0.5, 0, 1, 1));\n Out.ar(out,\n Mix.fill(3, { Ringz.ar(CoinGate.ar(prob, trig*0.5), #[1, 1.5]*Rand(1000, 9000), 0.01) })\n )\n}).play;\n);\n\na.set(\\prob, 1.0);\na.set(\\prob, 0.0);\na.set(\\prob, 0.1);\n```"}]} +{"conversations": [{"role": "user", "content": "What does `Updater.updateFunc` do?"}, {"role": "assistant", "content": "simple MVC utility; calls an update handler when the model changes"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider patch.\n```supercollider\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see .\n\n/* Audio plugin definition\n\n Each audio plugin should define the following global variables:\n ~name: (symbol) name of the spatializer\n ~description: (string) a short description\n ~function: the actual definition of the plugin\n\n*/\n\n~name = \\testtone;\n~description = \"a standard test tone (sine)\";\n~channelLayout = \\mono;\n\n~function = {| sfreq = 200 |\n FSinOsc.ar(sfreq)\n};\n```"}, {"role": "assistant", "content": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a."}]} +{"conversations": [{"role": "user", "content": "SC can't open or read files?"}, {"role": "assistant", "content": "SuperCollider forum — SC can't open or read files\n\nIt looks as though it’s finally working!\n\nI moved the file to a folder I created in the user support directory for SuperCollider and then changed the quotes to ascii.\n\nI think the issue was that at first I had the file name listed without the extension, then I added the extension to the file name and added the file extension to the file path in the code and this must have created a conflict.\n\nIn the first instance SC needed the file extension, ascii quotes, and since I’m on windows the path needed double \\ in the path file.\n\nThe final working code looks like this:\n\n```supercollider\nb = Buffer.readChannel(s, \"C:\\\\Users\\\\44774\\\\AppData\\\\Local\\\\SuperCollider\\\\Tables\\\\wubsquare.wav\", startFrame:0, numFrames: -1);\n```\n\nThe wav file is simply named wubsquare and I included the file extension in the code."}]} +{"conversations": [{"role": "user", "content": "What does `SimpleNumber.cylBesselKPrime` do?"}, {"role": "assistant", "content": "Returns the first derivative with respect to x of the corresponding Bessel function. Requires `x >"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n(\n Instr(\\beatClockPlayerTest,{ arg gate=0.0,freq=300;\n var a,t;\n\n t = gate;\n a = Decay2.kr(t,0.01,0.1).clip2(1.0);\n a * SinOsc.ar(freq);\n },[\n \\gate\n ]);\n\n PlayerMixer([\n Patch.new(\\beatClockPlayerTest,\n [\n BeatClockPlayer(4), // trig / gate\n 300\n ]),\n Patch.new(\\beatClockPlayerTest,\n [\n Stream2Trig(1.0,1.0),\n 600\n ])\n ]).play;\n\n Tempo.default.gui\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n(\n Instr(\\beatClockPlayerTest,{ arg gate=0.0,freq=300;\n var a,t;\n\n t = gate;\n a = Decay2.kr(t,0.01,0.1).clip2(1.0);\n a * SinOsc.ar(freq);\n },[\n \\gate\n ]);\n\n PlayerMixer([\n Patch.new(\\beatClockPlayerTest,\n [\n BeatClockPlayer(4), // trig / gate\n 300\n ]),\n Patch.new(\\beatClockPlayerTest,\n [\n Stream2Trig(1.0,1.0),\n 600\n ])\n ]).play;\n\n Tempo.default.gui\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\n// restricting fm to harmonic sidebands after\n// [Chowning, 1973] Chowning, J. (1973). The synthesis of complex spectra by means of frequency modulation. Journal of the Audio Engineering Society, 21(7):526–534.\n// restriction actually happens because of the specs, not server-side.\n\nSpec.add(\\index, [0, 40]);\nSpec.add(\\harm1, [0, 20, \\lin, 1]);\nSpec.add(\\harm2, [0, 20, \\lin, 1]);\nSpec.add(\\fundFreq, \\freq);\n\nNdef(\\fmk, {\n \n PMOsc.ar(\n \\carFreq.kr(100, 0.1), \n (\\harm1.kr(1, 1)/(\\harm2.kr(1, 1)) * LFNoise1.ar(50).range(0.995, 1.001))*\\carFreq.kr(100), \n \\index.kr(1, 0.1) * SinOsc.ar(2.5).range(0.995, 1.005)\n ) \n})\n);\nNdef(\\fmk).gui\n```"}, {"role": "assistant", "content": "Restricting fm to harmonic sidebands after[Chowning, 1973]. Restriction actually happens because of the specs, not server-side.\r\n----- \r\nChowning, J. (1973). The synthesis of complex spectra by means of frequency modulation. Journal of the Audio Engineering Society, 21(7):526–534."}]} +{"conversations": [{"role": "user", "content": "What is the difference between the language and the server?"}, {"role": "assistant", "content": "sclang runs your code, the clock and Patterns, and builds UGen graphs. scsynth performs the DSP in real time. They communicate over OSC, which is why a language-side mistake can leave a sound running, and why s.freeAll stops it."}]} +{"conversations": [{"role": "user", "content": "What is the difference between .ar, .kr and .ir?"}, {"role": "assistant", "content": "The rate method decides how often a UGen is evaluated. `.ar` runs at the audio rate, once per sample, and produces an audio signal. `.kr` runs at the control rate, once per block of 64 samples by default, so it is cheaper and is used for parameters that do not need sample accuracy. `.ir` is evaluated once when the Synth is created and then never again, for constants such as SampleRate.ir or a size. Using .kr where you need audio-rate modulation gives stepped, zipper-noise-like control; using .ar where .kr would do costs CPU."}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `LFDNoise1`."}, {"role": "assistant", "content": "```supercollider\n// try wiggling mouse quickly;\n// LFNoise frequently seems stuck, LFDNoise changes smoothly.\n\n{ SinOsc.ar(LFNoise1.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n{ SinOsc.ar(LFDNoise1.ar(MouseX.kr(0.1, 1000, 1), 200, 500), 0, 0.2) }.play\n\n\n// LFNoise quantizes time steps at high freqs, LFDNoise does not:\n\n{ LFNoise1.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n\n{ LFDNoise1.ar(XLine.kr(2000, 20000, 8), 0.1) }.scope;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `AbstractServerAction.remove` do?"}, {"role": "assistant", "content": "Remove an item or object from registry. If server is nil, remove from all"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `SharedIn`."}, {"role": "assistant", "content": "```supercollider\n(\n// only works with the internal server\ns = Server.internal;\ns.boot;\n);\n\n(\nSynthDef(\"help-SharedIn1\", {\n Out.ar(0, SinOsc.ar(Lag.kr(SharedIn.kr(0, 1), 0.01), 0, 0.2));\n}).add;\nSynthDef(\"help-SharedIn2\", {\n Out.ar(1, SinOsc.ar(Lag.kr(SharedIn.kr(0, 1), 0.01, 1.5), 0, 0.2));\n}).add;\n);\n\n(\ns.setSharedControl(0, 300); // an initial value\ns.sendMsg(\\s_new, \"help-SharedIn1\", x = s.nextNodeID, 0, 1);\ns.sendMsg(\\s_new, \"help-SharedIn2\", y = s.nextNodeID, 0, 1);\n\nRoutine({\n 30.do({\n s.setSharedControl(0, 300 * (10.rand + 1));\n 0.2.wait;\n });\n s.sendMsg(\\n_free, x);\n s.sendMsg(\\n_free, y);\n}).play;\n);\n\n\ns.quit;\n```"}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// note that the root pitch is not stored in the Scale (which should arguably be called a Mode for that reason)\n// instead you supply it at play time:\n\n// key of A\nPbind(\n \\degree, Pseq((0..7), inf), // your melody goes here\n \\scale, Scale.major, // your scale goes here\n \\root, -3 // semitones relative to 60.midicps, so this is A\n).play;\n```"}, {"role": "assistant", "content": "note that the root pitch is not stored in the Scale (which should arguably be called a Mode for that reason) instead you supply it at play time: (Scale: represents a musical scale)"}]} +{"conversations": [{"role": "user", "content": "Explain `Pxrand` in SuperCollider briefly."}, {"role": "assistant", "content": "Pxrand — embed values randomly chosen from a list Like Prand, returns one item from the list at random for each repeat, but Pxrand never repeats the same element twice in a row. Category: Streams-Patterns-Events > Patterns > List."}]} +{"conversations": [{"role": "user", "content": "Explain this SuperCollider code.\n```supercollider\n// same as above, but we set the address to nil so we can receive from anywhere\n// no need for a NetAddr since we are just listening (and not sending)\n\no = OSCresponderNode(nil, '/test', { |t, r, msg| msg.postln }).add;\no.remove;\n```"}, {"role": "assistant", "content": "same as above, but we set the address to nil so we can receive from anywhere no need for a NetAddr since we are just listening (and not sending) (OSCresponderNode: client side network responder)"}]} +{"conversations": [{"role": "user", "content": "This SuperCollider code does not compile. What is wrong and what should it be?\n\n```supercollider\n// Since the allpass delay has no audible effect as a resonator on\n// steady state sound ...\n\n{ AllpassN.ar(WhiteNoise.ar(0.1), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// ...these examples add the input to the effected sound and compare variants so that you can hear\n// the effect of the phase comb:\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassN.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2)\n}.play)\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassL.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2\n// …\n```"}, {"role": "assistant", "content": "A closing bracket is missing: the parenthesis opened earlier is never closed, so the expression cannot be parsed.\n\n```supercollider\n// Since the allpass delay has no audible effect as a resonator on\n// steady state sound ...\n\n{ AllpassN.ar(WhiteNoise.ar(0.1), 0.01, XLine.kr(0.0001, 0.01, 20), 0.2) }.play;\n\n// ...these examples add the input to the effected sound and compare variants so that you can hear\n// the effect of the phase comb:\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassN.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2)\n}.play)\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassL.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2)\n}.play)\n\n(\n{\n z = WhiteNoise.ar(0.2);\n z + AllpassC.ar(z, 0.01, XLine.kr(0.0001, 0.01, 20), 0.2)\n}.play)\n\n// used as an echo - doesn't really sound different than Comb,\n// but it outputs the input signal immediately (inverted) and the echoes\n// are lower in amplitude.\n{ AllpassN.ar(Decay.ar(Dust.ar(1, 0.5), 0.2, WhiteNoise.ar), 0.2, 0.2, 3) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "What does `SimpleNumber.airyAiPrime` do?"}, {"role": "assistant", "content": "Returns the derivative of the Airy function Ai at"}]} +{"conversations": [{"role": "user", "content": "What does `RedKCS.stopListening` do?"}, {"role": "assistant", "content": "free internal analyser synth and responder. also a `CmdPeriod` will clear"}]} +{"conversations": [{"role": "user", "content": "Show another SuperCollider example using `Symbol`."}, {"role": "assistant", "content": "```supercollider\na = { Ringz.ar(T2A.ar(\\trig.tr), \\freq.kr(500, 1), 0.8) }.play;\na.set(\\freq, 330, \\trig, 1);\na.set(\\freq, 830, \\trig, 1);\na.release;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `UnaryOpUGen`."}, {"role": "assistant", "content": "```supercollider\na = WhiteNoise.ar; // a WhiteNoise\nb = a.squared; // a UnaryOpUGen.\nb.operator; // squared\n\n// sound example\n\n{ var a = LFSaw.ar(300).range(0, 2pi); a.sin * 0.1 }.play;\n\n// Plotting the \"abs\" unary operator (via the server):\n\n{ SinOsc.ar(300).abs }.plot\n```"}]} +{"conversations": [{"role": "user", "content": "Write a minimal SuperCollider example that uses `UGen`."}, {"role": "assistant", "content": "```supercollider\n{ Blip.ar(Blip.kr(4, 5, 500, 60), 59, 0.1) }.play;\n```"}]} +{"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Pseq` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\nSynthDef(\\help_sinegrain,\n { |out = 0, freq = 440, sustain = 0.05|\n var env;\n env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);\n Out.ar(out, SinOsc.ar(freq, 0, env))\n }).add;\n);\n\n(\na = Pseq(#[60, 61, 63, 65, 72], inf).asStream;\nRoutine({\n loop({\n Synth(\\help_sinegrain, [\\freq, a.next.midicps]);\n 0.2.wait;\n })\n}).play;\n)\n```"}]} +{"conversations": [{"role": "user", "content": "What does this SuperCollider patch do?\n```supercollider\n(\nNdef(\\bitshift, {\n var t = PulseCount.ar(Impulse.ar(8e3));\n var sig = HPF.ar(\n ( \n ((t * 15) & (t >> 5)) |\n ((t * 5) & (t >> [3, 4])) |\n ((t * 2) & (t >> 9)) |\n ((t * 8) & (t >> 11))\n - 3 % 256\n ) / 127-1 * 3\n , 20\n ).distort * 0.2; \n sig = Greyhole.ar(sig, sig, 0.5, sig).flop.mean/4;\n}).play;\n)\n```"}, {"role": "assistant", "content": "Not very original since I copied the bit code from http://schemawound.com/post/58980873930/bitwise and added a greyhole. But it sound so amazing I want to share it =)."}]}